PDA

View Full Version : Can you easily make a way for two Propellers to comunicate?



Microcontrolled
01-26-2009, 06:19 AM
I am working on a project that includes three propeller chips and the connections go like this: Prop 1 is connected in a duel serial line with Prop2, and prop 2 loads programs into prop 3. If·Prop 2 has a collections of programs to be run by Prop 3 and prop 1 tells what to load, how would they communicate? (P.S. The serial comunication is through a phone jack with the probes on the Propeller straight through to the wires of the jack, and the cable ends at the "Hydra-Net" port on a Hydra, which has a filter and resistor on it. ) Also, I am using the Propeller Loader·Object for Prop 2 to Prop 3, and just the Phone line for connections between Prop1 and Prop 2. Here is a pictre of the custom Duel-Propeller PCB before the Phone jack was added. Neither of the connections work and that is the·problem. Please explain·simply what I should do because I have only been learning the Propeller for·4 months and I am only 14. Thank you for your patience. http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you for reading!·

Cluso99
01-26-2009, 07:29 AM
The easiest way is to use 2 pins and communicate serially - use the FullDuplexSerial object. 115200 baud or slower will work fine. You may achieve higher speeds, but start here first. I am planning to communicate >1Mbaud (untested and unproven), but to do that I am using a common oscillator and synchronising the cogs.

If you have problems, just ask here - there are plenty of willing people on the forum only too happy to answer your questions http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index (http://forums.parallax.com/showthread.php?p=778427)
· Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)

My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)

Bob Lawrence (VE1RLL)
01-26-2009, 08:00 AM
@microcontroled1204

Your doing great! The info below should help you.


Beau Schwabe (Parallax) said...
Ok, beta testers... I have run this DEMO and tested over 100 Billion data Bits with no Transmission Errors over the distance of 10 feet from one Propeller to another Propeller.
Here is a beta release before I place it in the object exchange. ... Enjoy!!


Click here for the complete info:
http://forums.parallax.com/showthread.php?p=691952

Have fun!

Bob

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Aka: CosmicBob

Beau Schwabe (Parallax)
01-26-2009, 11:33 AM
Suppose I need to put this into the Object exchange Huh?! ... I think it's ready, i.e. haven't heard too many complaints about it, I just wanted to clean it up a bit and make the handshaking a little more seamless.

This project however was designed exactly for the purpose of high-speed data transfer from Propeller to Propeller ... because of this I did not conform to standard serial communication and decided to use features that were unique to the Propeller.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Leon
01-26-2009, 11:44 AM
It could be tested on one Propeller with one cog transmitting and another receiving, presumably.

Leon

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle

Beau Schwabe (Parallax)
01-26-2009, 12:12 PM
Leon,

Initially that's how I wrote the code, and then I moved it to two separate Propellers. I only tested it to 10 feet and the wire I used was purposefully poor quality so that it would fall in the worst extreme.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Ale
01-26-2009, 01:28 PM
I use Beau's method, either 4 or 8 parallel bits. Works quite well. I use it bidirectionally but it is still half-duplex. My propellers are separated a few cm, and not 3 m. Some high-speed differential buffers and recievers can be used in the case of longer distances.

Mike Huselton
01-26-2009, 01:34 PM
Beau,

Would you please post the code? I think we understand it is experimental.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH - Electronics: Engineer - Programming: Professional

dMajo
01-26-2009, 02:17 PM
@Quantum, look at Bob's link (code there)

Microcontrolled
01-26-2009, 11:17 PM
One thing I don't understand about the whole data transfer is how to rieceive the data with the RX line. I have tryed many different communication objects including Simple Seirial, Full Duplex serial, BS2 commands (with the debug in/out command) and Serial COM. (I have not yet tryed the object above) Every one of those objects required something to rieceive the data from the RX line.
My communication object is :

{{ Propeller communicate test }}

Obj
Ser : "Full_Duplex_Serial"

PUB Start

Ser.init (3, 4, 3, 19600)
Ser.tx (Bit1, 8)
if Ser.rx | Bit1
Ser.tx (Bit3, 8)
else
Ser.tx (Bit2, 8)

DAT

Bit1 byte %11111111 ' Return true
Bit2 byte %00000000 ' Return False
Bit3 byte %10101010 ' Confirm

will this work? Or will I have to store the value in a varible? If so, how do I do it? How do I read the data bit from the transfer?
I am not very experienced so please help!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you for reading!·

···

Cluso99
01-27-2009, 10:17 AM
I am hoping to use the counters to shift the data in and out to get really high speed blocks. My clocks (therefore props) are synchronised.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index (http://forums.parallax.com/showthread.php?p=778427)
· Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)

My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)

Mike Huselton
01-27-2009, 10:56 AM
Cluso,

Did you use an external clock to synchronize the two props?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH - Electronics: Engineer - Programming: Professional

Cluso99
01-27-2009, 12:10 PM
yes (a crystal oscillator). It's the only way to synchronise high speed without using a CLK pin like I2C or SPI. You still have to bring the cogs from different props into sync though.

My plan is to send a start bit, followed by x bits (say 64 bytes [or more]·of 8 bits = 512 bits) followed by stop. I know the counters (video) can clock the bits out, but I am unsure at what speed I can clock in using the counters and which mode - but this can wait for now.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:

· Prop Tools under Development or Completed (Index) (http://forums.parallax.com/showthread.php?p=753439)
· Emulators (Micros eg Altair, and Terminals eg VT100) - index (http://forums.parallax.com/showthread.php?p=778427)
· Search the Propeller forums (via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)

My cruising website is: ·www.bluemagic.biz (http://www.bluemagic.biz)

Post Edited (Cluso99) : 1/27/2009 5:15:50 AM GMT

Mike Green
01-27-2009, 12:23 PM
microcontroled1204,
The serial I/O drivers already take care of processing the 8-bit values passed to ser.tx to make them into a bitstream and they do the equivalent to take a bitstream and extract 8-bit values that are returned by calls to ser.rx.

The easiest way to understand what's going on is to look at the Simple_Serial object and particularly the rx and tx routines. Each routine is really only about 7 lines of Spin. Take some sample data (like the value %10101010) and run it through the transmit routine on paper. Take a piece of paper and make a column for each variable and a couple of columns for intermediate results. Each line on the paper is a statement of the program (or a convenient part of a statement). For example, if the statement is "i := i + 1", you might have the value 4 on the current line. Start a new line and, in the "i" column put 5, then go on to look at the next statement.

Microcontrolled
01-27-2009, 07:53 PM
Thank You! The project i am working on is very big so help is still greatly appreciated!

P.S. Does anyone know if theres going to be another Propeller Design Contest this year??

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you for reading!·

···

TreeLab
01-27-2009, 08:49 PM
microcontroled1204
The Full duplex codes run in their own cog, so they must be 'start'-ed, not 'init'-ed. As Mike pointed out, the source code is the best reference possible. (Use the Source Luke, Use the Source). The easiest way to check these codes out is to connect via the PropPlug to a PC running a terminal program, or PropTerm, etc. Then you can really see what is going across the wire. There are also multi-serial versions available in the ObEx that can reduce the cog count in busy systems.
Cheers!
Paul Rowntree

Microcontrolled
01-27-2009, 11:05 PM
The number of cogs luckily doesen't matter in this project considering that having 3 Propellers comunicate gives you 24 cogs. Oh... I forgot to mention that I was running Full_Duplex_Serial_Plus_Plus.
The first PUB routine there is "init". Another question: What is PropTerm???

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you for reading!·

···

TreeLab
01-28-2009, 12:08 AM
PropTerm was written by Ariba specifically for working with the prop over the serial port. It makes it easier to switch back and forth from the PropTool than with HyperTerm or its ilk, (where you have to disconnect before recompiling, then reconnect afterwards)

http://insonix.ch/propeller/prop_term.html

The download links are at the bottom of the web page.

Microcontrolled
01-28-2009, 01:04 AM
I succecesfuly downloaded PropTerm! I didn't expect it to be in Germen, though.
Thank You for the help!
Help is still appreciated, however, thank you!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Thank you for reading!·

···