Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Raspberry pi and Parallax Propellor

Sun Dec 02, 2012 7:22 pm

I am trying to connect a Rapsberry pi to parallax Propeller microcontroller. My intend is to use the propeller read comands from the pi and control motors and read sensors and relay the information back to the Pi on a mobile robot. I intend to add vision eventually using OpenCV or some other vision library so the Usb port cannot be used for communications. Any information regarding how to do the communications would be appreciated. Oh and one more thing my programming experiences are primarly C++ and Java with a little basic.

User avatar
TonyD
Posts: 451
Joined: Thu Sep 08, 2011 10:58 am
Location: Newcastle, UK
Contact: Website

Re: Raspberry pi and Parallax Propellor

Sun Dec 02, 2012 9:19 pm

Have you tried the Parallax forums. There's been a few discussions doing just that. Connecting a Prop chip to a RPi and using the RPi as a development platform was the main aim and also using the Prop as a programmable super i/o chip
Tony

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Sun Dec 02, 2012 9:47 pm

I will see what I can find. But even if I do I probably will still need help setting up communications on the RPi end

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Sun Dec 02, 2012 9:51 pm

would you mind sending me the links? I searched the parallax forum myself and did not find those posts

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13278
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspberry pi and Parallax Propellor

Mon Dec 03, 2012 12:02 am

There has been several other threads here about this very same topic!
Simply search for "propeller".

PI + Propeller seems to have very good Synarchy (will very well support each other) IMHO. :ugeek:

dgately
Posts: 4
Joined: Thu Jul 12, 2012 5:21 pm

Re: Raspberry pi and Parallax Propellor

Mon Dec 03, 2012 5:18 pm

You can search the Parallax forums (& related pages) with this URL:

http://ronczap.home.insightbb.com/ParaSite.htm

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Mon Dec 03, 2012 10:27 pm

I managed to find some useful stuff. Thank you for that. I do need however to know how much voltage is outputted on the pi's GPIO pins.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13278
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspberry pi and Parallax Propellor

Mon Dec 03, 2012 11:10 pm

The PI uses 3,3V levels on all its GPIO pins.

before I go on a little warning:
Do not try to put hard (that is able do deliver lots of current) 5V levels on the PI, as you might succeed in lifting the PI's 3V3 supply up to 5V through the protection diodes embedded in GPIO pins, and putting 5V on the 3V3 line can destroy chips on the PI! So when you put a 5V signal on a PI GPIO pin, at least put a 1 series resistor in between the 5V driver and the GPIO pin, or better yet, divide the 5V signal to 3V with a resistor divider consisting of a 2K2 and a 3K3 resistor.

But as the propeller is also a 3V3 powered chip it can be directly interfaced to a PI without any problems! Digital signal levels are completely compatible.

The Raspberry PI has many hardware assisted I/O capabilities, maybe the most obvious way to connect a raspberry PI and a Propeller is to use the UART, but do note that the boot software of the PI has assigned the UART port to a command terminal, if you want to use it for your own purposes you should program Linux to release the UART port before you can use it.
Obviously SPI and I2C are other candidates, or you can use multiple parallel ports and built your own bit banged interface with them.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Tue Dec 04, 2012 12:14 am

no need I only wanted to know if I need to add a resister if I wanted to do direct serial communications from the Pi GPIO pins to the prop

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Tue Dec 04, 2012 12:16 am

dis regard that last post. I do not know alot about UART does anybody know if a good website or post about it. Wiring, code I need both.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Tue Dec 04, 2012 12:26 am

another update. Just searched the Propeller object exchange. Found code for the propeller end. Still need code for the other though. Preferably in C/c++

robotworkshop
Posts: 24
Joined: Thu Aug 30, 2012 7:19 pm

Re: Raspberry pi and Parallax Propellor

Tue Dec 04, 2012 6:09 pm

I think you're looking at making the connection more complicated than it needs to be. You shouldn't need to deal with the GPIO at all.

Instead just plug the Parallax Propeller into the USB port of the Raspberry Pi. Or, plug it into a powered USB HUB and then into the Raspberry Pi. Most of the Propeller boards now and a built-in USB connection which uses an FTDI chip. This makes the Propeller board look like another serial port.

You can then use that connection to download new code to the Propeller or you can use that serial (over USB) connection to send commands and data between the Raspberry Pi and the Propeller.

The Propeller is a great chip for handling the I/O. It is very flexible and can handle multiple things at once. The Raspberry Pi is great for the higher level stuff. I am going to use this setup on one of my own robots that already has a couple Propeller boards controlling it. The Raspberry Pi will give me a wireless LAN connection to the robot and also make it easier for the high level stuff.

The interface is very similar to the Raspberry Pi to Arduino example in this months MagPi issue.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Tue Dec 04, 2012 8:49 pm

unfortunately as explained in my first post, the sole purpose of adding the Pi to my robot is to use open CV or some other vision library that propeller simply could not run, which means likely I am going to use a web cam were are primarily as far as I know usb based. Is there a way to address multiple devices connected through a single usb port via usb hub without increasing the complexity of the code too much? If so I would like an example of this, in the C family of programming languages preferably.

Metatronin
Posts: 55
Joined: Sat Aug 04, 2012 5:19 am

Re: Raspberry pi and Parallax Propellor

Wed Dec 05, 2012 12:00 am

There is a camera board that plugs into the pi on one of the board connectors. Of course its not out yet.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Wed Dec 05, 2012 2:40 am

I will still need code for both UART and using the USB port on the Pi end no matter which I use. Examples or links to examples would appreciated

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Wed Dec 05, 2012 10:12 pm

I have decided it best to use UART fro the communication between pi and propellor. I would like to know if there is any good posts with samples of UART code or a website with samples. I would like links please.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13278
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspberry pi and Parallax Propellor

Thu Dec 06, 2012 12:01 am

Just Search... for UART, there a dozens of threads with information.
If you found out how it all works, maybe you can write a small introduction about it in the WIKI, currently there seems to be no such thing yet,

Another source of information is the documentation that comes with the Gertboard,
The gertboard uses the UART to connect with an ATMega chip, exactly like you want to do with a Propeller. If I recall right the documentation should be online somewhere.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Thu Dec 06, 2012 1:54 am

I probably should have clarified that I need it for the pi but thanks anyway

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13278
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspberry pi and Parallax Propellor

Thu Dec 06, 2012 5:45 pm

My answer IS for information on using the UART on the PI!

The "Search..." option is the search option on this site, see the top right corner. There:

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Thu Dec 06, 2012 9:10 pm

I Think I found what I need. SO I will not posting for a few days.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Sat Dec 08, 2012 6:07 pm

I am back. I found this code on the forum[code#include <avr/io.h>

#define USART_BAUD 9600ul
#define USART_UBBR_VALUE (F_CPU/16/USART_BAUD-1)

void USART_vInit(void)
{
UBRRH = (unsigned char)(USART_UBBR_VALUE>>8);
UBRRL = (unsigned char)USART_UBBR_VALUE;
UCSRB = (1<<RXEN)|(1<<TXEN);
UCSRC = (0<<USBS)|(3<<UCSZ0)|(1<<URSEL);
}

void USART_vSendByte(uint8_t u8Data)
{
while(!(UCSRA&(1<<UDRE)));
UDR = u8Data;
}

uint8_t USART_vReceiveByte()
{
while(!(UCSRA&(1<<RXC)));

return UDR;
}
int main(void)
{
int data = 0x00;
USART_vInit();

while(1)
{
data = USART_vReceiveByte();
USART_vSendByte(data);
}
return 0;
}
][/code]
it is meant for an ARV microcontroller but it acheives what I am hoping to do. WI wondering if I can use this code with the propellor. If not is it possible to modify the code to do so?

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13278
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspberry pi and Parallax Propellor

Sat Dec 08, 2012 8:27 pm

Although its in C basically this is for a completely different architecture, so will probably do you no good at all, at least not directly!
That is because there most probably is suitable, very similar, driver code available already, fo example if you use python there probably is an existing library to add UART functionality to python, and for many jobs you could even use one of the existing Linux terminal emulator application program, if only to test the connection.
The main task you have is finding out how to take over the existing code that uses the UART for a SSL link with Linux, so that you can use a terminal to log into the linux running on the PI. You need to take over (disable) that code so that your own code can use the UART.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Sat Dec 08, 2012 11:28 pm

In fact in the discussion that code came from the original poster actually tried in python but unsuccessful. he even uploaded the source code. I think I start from there, but I don't know anything about python. If you don't hear from me for week, that's because I am learning the language. Thank god the semester at Massasoit Community college is almost over.

Patrick222122
Posts: 80
Joined: Sun Dec 02, 2012 5:51 pm

Re: Raspberry pi and Parallax Propellor

Sun Dec 09, 2012 2:42 pm

Change of plans. I found a library for I2c for the Raspberry pi on Quick2Wire.com and a matching object on the propeller Object exchange. I will post again in a few days when I learn more about Python.

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 13278
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: Raspberry pi and Parallax Propellor

Sun Dec 09, 2012 3:08 pm

Perhaps this helps: http://pyserial.sourceforge.net/

I2C is nice, and can potentially be faster than UART but it needs a "master" "slave" setup, so either the PI or the Propeller needs to manage (initiate) all transfers (for both ways). If that isn't a problem (depending on use) then great, otherwise using the UART might be better. One fix is to make a GPIO on the slave and "altert, I need output" pin, and connect it to a similar pin on the master, so that it becomes aware that the save device needs a transfer.

Return to “Automation, sensing and robotics”