AppNote Content Input Request: Propeller to Propeller Communication
Ken Gracey
Posts: 7,392
Parallax Semiconductor received several requests for creating an AppNote detailing various Propeller to Propeller communication examples. Since the subject is very broad and full of possibilities, it may be important for us to break it into smaller pieces which can be used alone or build upon a larger, robust approach. Some lower-level objects are likely already in the process of Gold Standard verification.
We would like your input on the content of this AppNote before we begin any planning.
Please provide any input on communication protocols (async, I2C, RS-232/485, etc.), using buffers, and what types of examples would be beneficial. We are also interested in the type of application - are the two Propellers on the same product, or is the use more of a product to product communication?
We would allow this thread to collect some comments before we develop the scope of the AppNote(s) around the subject.
Thanks,
Ken Gracey
We would like your input on the content of this AppNote before we begin any planning.
Please provide any input on communication protocols (async, I2C, RS-232/485, etc.), using buffers, and what types of examples would be beneficial. We are also interested in the type of application - are the two Propellers on the same product, or is the use more of a product to product communication?
We would allow this thread to collect some comments before we develop the scope of the AppNote(s) around the subject.
Thanks,
Ken Gracey
Comments
- quad serial object
- half duplex RS485
- 100kbps/400kbps/1mbps I2C slave, master
- SPI slave/master
- Beau's 14Mbps throughput (20Mbps clock) high speed serial
Very nice to have:
- CAN bus support
- Modbus support
- ENCJ TCP/IP support
- WIZNET TCP/IP support
- XBee / ZigBee support
I don't think product-to-product communication is difficult - generally there is distance involved, so something like ModBus over RS485 might be applied.
Most of the time a second prop is being added due to running out of cogs, or running out of ram. These causes may be best handled by two different application notes.
A common cause of running out of ram is due to a big video bitmap consuming 20-24kb of the available 32kb. I would like to see an application note where a master prop loads a slave prop to be a slave video generator. The slave would not have an EEPROM but be loaded via its P31, P30 and Reset pins from the master prop. Once up and running the slave would receive display commands from the master. Structuring it this way would also allow the 'slave prop' to be controlled by any other master, such as a PC or other micro.
At the moment the information required to achieve something like this exists, but is very scattered - some is in the obex (eg Chips Prop Loader), some in various forum threads, and I saw at least one document someone had produced about loading props. It would be good to draw it all together into a single app note.
The propforth solution to prop to prop communication is stable and the examples are in the release archive from Google Code. It uses a synchronous serial channel running at clock speed.
In propforth, one cog handles communication between the user and the cog running an application, usually the forth interpreter by default. To the user it appears that communication is between the user terminal and cogs 0-6, while in fact cog 7 manages communication between the user terminal and whichever cog 0-6 is connected to the channel.
In a multi-prop configuration, cogs still handles communication the same way. Another cog, perhaps cog 6 handle communication to the secondary prop. The user can connect to the cogs on the secondary prop using the same interfaces as the first, so the transition to the second prop is transparent (after establishing the channels).
A single prop appears to have seven free cogs, 0 to 6. Adding a second prop costs a additional cog on the primary prop for the communications channel, leaving cogs 0-5 on the master and cogs 0-6 on the slave, for a net gain of 6 cogs, making 13 total.
I was able to get the example to run the forth prompt on the secondary props cogs, to the user it looks like there are a bunch more cogs and a boat load of extra pins. But I have not made any demo applications yet. If any of this material is suitable for your purpose, we can talk to Sal Sanci and work something up.
The simple FullDuplexSerial ("FDX") is quite OK for speeds to 115,200 baud. However, FDX needs the mods to enable larger buffers (see the Obex for my FDX_rr00x version which fixes this).
FDX can be used with RS232 or RS485 drivers for remote props, whereas directly linked for local props (local does not have to be in the same box).
For higher speeds, Beau's code would be better and I like the 32bit transfers. I had in mind to write a 12bit transfer, so it might be an advantage if the bit trasfer size could be modified (set initially?).
I think there is a need for a multi-port serial driver such as the 4 port one in the obex. This could also be used for prop-prop comms.
Lastly, there may be a need for a multi-dropped serial driver where we have many props connected.
Downloading also needs to in the app note (or a different app note) because in professional use, it is likely for multiple props that only 1 eeprom would exist.
John Abshier
Economy is cost rating, Speed is "IPC" Inter-Propeller-Communications, IO is amount of IO left after IPC connections, Nodes is number of propellers, Multi-Master means ease of having more than one IPC "initiator" such as a client/server network or a primary/secondary interface.
The pin selections were made so we wouldn't have to change allot of existing code.
It is nice to see that you seriously considered writing an app note for this subject. I truly believe it is in Parallax's best interest.
As you know, I am not a microcontroller guru like some of these guys, so the protocol issue is way over my head. However you did ask:
I am personally interested in both. Thanks for your interest and attention pertaining to this matter. I am sure that many people will find it very useful.
Bruce
Other appnotes would be master/slave props, loading one (or more) props from another. There should also be a section on clocks (independent (each with there own xtal), common clock (separate clock source), and master prop feeding slaves with there clock). The clocking could be it's own appnote. Another appnote could be the concept of a prop as a separate video generator, referencing these other appnotes to avoid complexity. A final appnote or reference note may be the electrical circuit examples, verified speeds, noise an error handling conderations, etc). The error handling (or not) would be important for the resiliency of the system, and whatever final solution it's part off.
'
Let the AppleApp do the heavy lifting.
'
The need for speed.......
Paul
My thoughts are for a chip - to - chip interface were the electrical interface is added depending on the distance between devices.
I would choose an async one wire serial interface with a start bit, 32 data bits, parity bit and stop bit.
The concept is one wire is used and the designated master always starts the communication with one slave, point - to - point.
If the option is to use driving buffers than an optional pin would be used to turn the direction of the buffer.
I would think that this could be run at 1/2 or a bit less than the prop instuction time.
Regards,
Richard
Ditto ditto ditto. Multiple masters, self-enumeration (auto-addressing) of slaves, bus collision detection/recovery a bonus.
Of course, simple communications such as passing sensor readings from one prop to another would be useful as well for beginners. Such code exists (as already pointed out in this thread) but folks new to the props won't know where to pick it up, so having an appnote on doing this can only help.
These are of course the simplest prop-prop communications examples, and would give a relative new user a lot to work on until they were advanced enough to do other things.
By then, it's hoped they'd be more aware of other resources, and could find the more complicated things on their own, but perhaps just pointers to such things in the appnotes would be of assistance.
There is an awful lot of processing required for some of these and that would have
a large effect on speed, memory, cost of development, etc.
As noted earlier, a second Propeller chip is usually considered because of running out
of resources (memory, pins, cogs). So it seems that a very simple system, defined specifically
for P2P might be more to the point.
Set Pin X high/low/toggle/pulse?
Send/receive buffer
All using already existing communications objects.
And move on with the application...
If you are talking prop to prop, there are several options: synchronous, asynchronous; buffered or not; protocol or not; etc.
If you are including I2C, RS-232/485, and/or other external hardware, then those are a separate issue.
One could start at the top with one wire no external hardware, add protocol , and work through to various external hardware.
This is how we did as mentioned in post 5. All the code, demos, and documentation is there. But somebody that knows about writing app notes would have to do that work. And somebody that knows about spin, PASM, and C would have to do those parts.
About protocol: If you don't include protocol, you might not have anything you can actually use. For example, the synchronous serial example in propforth, its kind of complex and hard to use on its own, but once the protocol is added, its"drop in and go", we start it up and it just works.
So?
Start with a simple Prop to Prop protocol.
How to get two props talking to each other on a proto board?
That has been suggested so often to fix Prop solve resource problems
that I'd kind of like to see how that works.
The rest will come along naturally as and when needed.
To that end, I guess it's time for some new boards!
Dual Propeller Boards
step 1
This is a normal Prop chip schematic - with a Prop as a peripheral.
Boss uses slave as a VGA display, Key, Mouse, SD,
And an expanded board adding all the rest - RAM, ADC, et al ?
Instrument Interfaces - protocols out the yin-yang.
All the above and my favs - GPIB, NEMA, and 357 Chevy...
distributed parallel processing
DEMO High Speed Multi Prop-to-Prop Communication
Can master also "provide" the shared memory?
Could the concept be implemented that way?
1) High Speed comm between multiple props that uses one cog only (I condensed the Beau Schwabe objects to one object only where the user defines read only zones in buffer)
2) A LabView program that selects the appropriate prop loader configuration file ( a spin file) and then uses the Propellent.DLL to load the customized spin program along with the Chip Gracey PropLoader program. The result is it kind of looks like a conditional compiler to load the right prop with the desired program from one user interface. I think the Propeller Tool could be easily modified to do this function too.
3) A rudimentary command-control-communication structure that operates like a rudimentary state machine. (Set command in command buffer -> wait for prop state to change to command complete).
I also wrote a pass through debugger that opens a serial port to a desired prop and passes its data through to the PC but it is not included in this upload.
All of this means only one USB port is required to program and debug multiple props.
I also think this set of programs would make a great app note in itself for multiple prop comm/programming/debugging.
Regards,
sm