Communications between props.
DiverBob
Posts: 1,110
I'm looking to interface one prop (master) with 6 prop (slaves). I had thought to have the master have separate serial lines to each prop (star configuration).
Looking through the OBEX there is one object for up to 4 ports; are there any other objects that could open at least 6 ports? Or conversely, are there any other recommendations on communications from the master to each of the slave boards? Or would it be better to tie all the slave boards RX lines to the master TX? This approach works easily for transmitting so long as each slave board is 'listening' for their commands. But this method gets very complicated fast when sending the acknowledge and data back to the master to avoid collisions.
Options and advise is welcomed as I'm just starting this portion of the project off and this is another area I haven't got a lot of experience.
Bob
Looking through the OBEX there is one object for up to 4 ports; are there any other objects that could open at least 6 ports? Or conversely, are there any other recommendations on communications from the master to each of the slave boards? Or would it be better to tie all the slave boards RX lines to the master TX? This approach works easily for transmitting so long as each slave board is 'listening' for their commands. But this method gets very complicated fast when sending the acknowledge and data back to the master to avoid collisions.
Options and advise is welcomed as I'm just starting this portion of the project off and this is another area I haven't got a lot of experience.
Bob
Comments
Beau also had a great high speed object (14Mbps effective as I recall) however that would require one cog per slave.
If the props are close (on the same pcb for instance) then high speed serial is fine. You could use 2 cogs and the 4port serial as Bill suggested. This is the easiest. Go slower if there are distances involved, and maybe driver and receiver chips if necessary.
Otherwise, you could multi-drop using the slaves TX lines tied together and a pullup. You would need to run some form of protocol, and the slave TX would be driving DIRA instead of OUTA with OUTA[tx]=0 ie open collector driving method. Bill also has done some RS485 multidropping.
Alter
Multi-drop via open collector tx/rx like you suggest would work well, but I am not aware of any objects for that
Give each one an address and if fast speed is required, give those subroutines an extra monitoring cog.
Jeff
What about the protocol to select the various props though? Any ideas?
Just taking a quick look at your RoboPi and saw this...
"three ten-pin Mikronauts I/O module expansion connectors (P0-P7, P8-P15, P16-P23)"
Should this be 8pin ???
Scrap that - saw the 10 pin connectors
As for 2 instances, you just need to copy the 4port object to a new name and change something in the code to make the object look different to the compiler. You will be able to tell by the file size of the compiled code that both copies have been included.
If you post some simple code, one of us can ensure that it's compiling with both objects included separately.
So then each slave prop would be the same and use separate connections. It's an easier solution.
I like that idea, serial is simpler than I2C and I'm already using serial in other areas. I'll give it a try tonight and see what happens. I may need to use the multi-port serial object in the slave computers also as I'm streaming troubleshooting data to the monitor via the USB programming cable, will need another port for the master to slave connection. That may require some tweaking go my code depending on how close the multi-port serial is to FullDuplexSerialPlus.
While a search and replace of the changed method names shouldn't take long, another option is just to change the name of the method in the new driver. As I type this, I realize it's not a simple drop in replacement. You need to add a port identifier to each serial call. This will require you to go the search and replace route anyway so not much use in changing the method names.
Have you used a Modbus system? You could use a similar technique of assigning addresses to each Propeller. When I make a multiple Propeller project using ID numbers for each Propeller, I save the ID number to upper EEPROM so it doesn't get erased when loading a new program. The program then detect if it's a fresh install and retrieves the ID number (from upper EEPROM). This allows multiple Propellers to have identical code with their individual behavior determined by their ID number.
I am not sure how you aredebugging, but a simple way if you have a small composite monitor is to ues a pin and serial resistor (any value 200-1K works for a 1pin composite. see my 1pin debug in obex. I have a cheap ~$25 car reversing monitor that performs nicely.
Using two 4port objects, or more, should be quite simple. If you need heldjust ask. I've done it before but just cannot what i did atm.
I'm just using my computer monitor to scroll through text and variable values as the motor routines work. I'm not sure what you mean, are you using a seperate VGA monitor for output or something else?
I was looking through the examples using the 4 port object, it looks pretty straight forward. Due to some severe storms and power outages I didn't get to do any testing last night, hopefully tonight will be better.
Your project sound very cool. I am working on a similar project and have written an object that might be of interest. I just uploaded it to OBEX. I called it PropBus. For some reason searching for PropBus does not find it, but when I sort by date it is at the top of the list.
It is loosely patterned after MIL-STD-1553. It supports up to 255 buffers/remotes and uses one wire for the interface.
I hope this helps.
Mike
http://obex.parallax.com/object/749
Interesting concept! I see that it uses one wire for bidirectional but how does you keep the RT computers from interfering with the BC if the RT wants to make a transmission back to the BC? Also, can one RT communicate directly with another RT?
The reason there is only one BC is that the BC controls the timing of when data is transferred on the bus. The RTs must wait for a command from the BC before transmitting data. Because all devices are on the same wire, when one device, BC or RT, sends data any or all devices can receive that data. All of this protocol is handled by the objects. As a user all you see is a buffer of data that gets updates periodically.
Mike
Wow ... nice work!
... Tim
PS - you should post your own thread on this object ... I have ideas and questions, and would rather not hi-jack this thread.
BTW ... Your link in the OBEX comments to your 'thread' on this object is broken --- generates error 404
I'm going to try your object and see what the output looks like ... sounds excellent.
... Tim
Try www.parallaxinc.com/.... (Guest)
Or try my tools index in my signature.
Done. I just started a thread titled PropBus.
Mike
I think this is the one:
http://forums.parallax.com/showthread.php/120422-Debug-to-TV-using-1-PinTV-option-1-PinKBD-(minimal-footprint-screen-buf-overl
Here is the code for the master computer: The output from this code displays correctly on the serial terminal when I was using P30 & P31 via USB. The only change was to change the TX and RX pins to P0, P1.
Here is the code for the slave computer:
Hopefully better eyes than mine can see what I'm doing wrong here.
Bob
The input signal is hard coded to be '$,1,1,' followed by the angle valve from the master to slave. However the slave is showing that sometimes the $ is missing or additional characters starting on the left side of the string are cut off. Eventually the entire string shows up and everything works right. I think ithe problem is in the GetStr function in the Slave computer code, but not sure why I get different outputs where different numbers of characters get cut off starting from the left side of the string. And why then it will suddenly just start working right? The GetStr function is copied from the Full DuplexSerialPlus object sine the 4 port serial object doesn't seem to have an equivalent function.