+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 20 of 30

Thread: DEMO: High Speed Multi-Prop to Prop Communication

  1. #1

    Default DEMO: High Speed Multi-Prop to Prop Communication

    I should have released this sooner... the "Saturday robotics club" that I participate in has a project going on where this is a perfect fit, and after cleaning it up a bit I thought I would pass it along.

    ------------------------------------------------------------------------------------------------

    Here is a derivative of the high speed 8.42 Meg Baud (1.05 Million Bytes per second) Prop-to-Prop communication that I wrote some time ago. Last March there were several changes to the front end of both the Receiver and the Transmitter in the way that the handshaking took place. Before you had to make sure that the Receiver was up and running before you Transmitted... this is no longer the case, now it doesn't matter making it more user friendly.

    For just the average user, it's pretty straight forward... there is only one command to Send, and there is only one command to Receive.

    Basic Use:
    To receive, just specify the pin you want to listen on and the address of where you want the received data to go to. Remember, this transmission is designed to send large packets of data, so if your just sending a few bytes here and there, this object is probably not for you.

    RX(_Pin,_DataAddress)

    To Transmit, is basically the same thing with a few more parameters... you specify the pin you want to yell on, the address of where the data is coming from, How much data you want to send in longs.

    TX(_Pin,_DataSamples,_DataAddress,_%0000, 0)

    Note: the last two fields are not used in the Basic setup, they will be discussed in Advanced Use.

    So that's it for basic use.

    Advanced Use:

    The Receive is just the same as before, but it can be used as a function to return additional. information from the Server.

    Command := RX(_Pin,_DataAddress)

    This will receive data just as before and place it in the assigned address, but Command contains the size of the transmitted packet, a destination offset, and a Packet Command. Organized as such...

    %ssssssssssssss_aaaaaaaaaaaaaa_cccc

    where:
    s = 14-Bit Packet Size
    a = 14-Bit Destination Offset
    c = 4 Bit Command

    The Packet Size is obviously useful for determining how much data you received and allows support for variable width packets.

    The Destination Offset is unique in the sense that the Server has some control as to where the Data will end up on the receiver. Basically this value gets added to the DataAddress that you specify on the receiver so that the incoming data is written to a location starting at the DataAddress plus the Offset. This feature allows random block writes from the Server to the Client.

    The 4-Bit Command is just a way for the server to pass a specific command to the receiver. It can be used for anything you want. It's up to you.

    For Transmission, it's just the same as the Basic Transmission as well, except the two parameters that were Zero'd out now have some meaning.

    TX(_Pin,_DataSamples,_DataAddress,_DataCommand,_Of fset)

    DataCommand as just mentioned is a 4-bit command you can pass directly to the Client and can be used for anything you want.

    The Offset, also just mentioned, can be used to tell the receiver to write data to another location.
    This is useful when you only want to update a block or section of memory on the Client.

    ------------------------------------------------------------------------------------------------
    Finally with the Demo programs supplied, shows a round-robin approach to sending data across multiple Propellers.

    The Idea is that you have one buffer that every Propeller sends around the loop ... "infinitely"
    To prevent collisions, ALL Propellers have access to reading the entire buffer, however, and this is what makes it work. Each Propeller can only write to a specific assigned location of that buffer. <- This isn't exactly true, but it's a good programming practice to implement. There aren't any collisions for similar reasons that you don't have collisions from COG to COG on a single Propeller.

    When a Propeller reads the Buffer, he is only allowed to write to the section that he is assigned to before sending the Buffer on to the next Propeller. (Note the Demo Code has this restriction lifted and can write to any location on the Buffer... But in my description, that's how you would typically manage the data across multiple Propellers and avoid collision. It works in the Demo, because there is only one Propeller writing to the buffer)

    In the Ring, you can have as many Propellers as you want, with each Propeller only having a 3-wire interface... (Ground, TX, and RX) ... I have tested up to 5 Propellers with the supplied demo code.

    One Propeller must be identified as the Server to initiate the data ring, but all of the other Propellers are identified as Clients.

    Within each Propeller regardless of Server or Client ALL Propellers have equal access to the Data Buffer.


    I Hope this makes sense... Enjoy!!

    EDIT: added a slightly newer version that addresses detection of the USB plugged into the PC. This prevents unwanted resets.

    EDIT: Check this link out for a way to control switches across multiple Propellers, i.e. for lighting
    Last edited by Beau Schwabe (Parallax); 01-24-2013 at 05:23 AM.
    Beau Schwabe | Parallax Semiconductor
    IC Layout Engineer
    Parallax Inc. * 599 Menlo Drive * Rocklin California 95765
    www.parallaxsemiconductor.com



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."
    www.BScircuitdesigns.com: IC's * Inductive proximity sensors * Misc

  2. #2

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Beau,

    Cool!

    Any idea how far separated the props can be from adjacent Props?

    And do you mean there is no upper limit as to the number of Props?
    Harley Shanko

  3. #3

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    "Any idea how far separated the props can be from adjacent Props?" - I did some crude testing under poor conditions on purpose, using about 10 feet of unshielded speaker wire.... After 100's of billions of Bits that were transferred there were Zero Packet losses. I used Pseudo random data, as well as pattern testing.

    "And do you mean there is no upper limit as to the number of Props? " - within reason to the amount of speed that your willing to sacrifice. The data transmits at just over 1 Million Bytes per second. Propagation delay on per Propeller basis "IF" a Propeller needs to write to the buffer will contribute to that propagation delay.
    Beau Schwabe | Parallax Semiconductor
    IC Layout Engineer
    Parallax Inc. * 599 Menlo Drive * Rocklin California 95765
    www.parallaxsemiconductor.com



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."
    www.BScircuitdesigns.com: IC's * Inductive proximity sensors * Misc

  4. #4
    Cluso99's Avatar
    Location
    Sydney/Brisbane Australia or 'sailing on the high seas'
    Posts
    9,670

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Nice work Beau. Thankyou. Seems to be just what the doctor ordered (No not Drac).

    Once I get a few of my miniature prop pcbs built I should be able to give this a workout I am sure jazzed could too.
    My Prop boards: CpuBlade, TriBlade, RamBlade, www.clusos.com
    Prop Tools (Index)
    Emulators (Index) ZiCog (Z80)
    Prop OS (also see Sphinx, PropDos, PropCmd)

  5. #5

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Seems to be just what the doctor ordered (No not Drac).
    Oh, but it is! This is going to be perfect for talking to the 256x224 full color video propeller. 8 megbaud is fast enough to run video at that resolution. Sweet. Thanks Beau!

  6. #6

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    How did I miss this!? Great work Beau. I'll give it a whirl soon as I can - thanks
    Cheers,
    Simon

  7. #7

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    For my next project I am thinking about using this to communicate when a different microcontroller that is 5v...the 5v microcontroller would be the server...what resistors values should I use....the write up show 100ohms on the tx with 330 going to ground on both the TX and RX...

    Thanks

  8. #8

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    dr hydra,

    The 330 Ohm resistors form a transmission line between One Propeller and another Propeller and should be of equal value for proper matching on both ends. This Transmission line helps to reduce any external RF interference that could enter the line due to antenna effects.

    The 100 Ohm resistor is there for protection in a situation where both the Server and Client could potentially drive the line in disagreement.

    That said, you need to treat both of the 330 Ohm resistors as if they are in parallel with each other... so the circuit now becomes a voltage divider between the 100 Ohms protection resistor and 165 Ohms (1/2 of 330 Ohms). Using a 100 Ohm resistor is about as high as you can go and still have a signal on the receivers side that is above the voltage threshold of the I/O.


    ...So using 3.3V on the TX side, the receiving voltage level should be about 2.05V ... using 5V on the TX side, the receiving voltage level should be about 3.12V

    In which case, the 3V logic should be ok ... the question is, is 2.05V enough for the 5V logic to determine a logic "1"



    The biggest problem I see will be getting the timing just right with your 5V micro processor. The timing needs to be within 25ns to 50ns or it won't work correctly.
    Beau Schwabe | Parallax Semiconductor
    IC Layout Engineer
    Parallax Inc. * 599 Menlo Drive * Rocklin California 95765
    www.parallaxsemiconductor.com



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."
    www.BScircuitdesigns.com: IC's * Inductive proximity sensors * Misc

  9. #9

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    If the 2 Props are about 1cm apart, may I know will 1 x 330ohm for each Rx & Tx line be sufficient instead of 2?
    TellMe Wearable™ , A Smart Bluetooth Notification Wearable Device for your smartphone
    Motion-Control your ActivityBot with your Android smartphone, MyActivityBot


    Kenichi

  10. #10

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    If the Propellers are that close, then yes, you could use one resistor, and the value of 330 is fine as well.

    I'm confused though, I thought you were wanting to communicate using the same high speed protocol with a 5V micro?
    Beau Schwabe | Parallax Semiconductor
    IC Layout Engineer
    Parallax Inc. * 599 Menlo Drive * Rocklin California 95765
    www.parallaxsemiconductor.com



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."
    www.BScircuitdesigns.com: IC's * Inductive proximity sensors * Misc

  11. #11

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Thanks Beau.

    Erm, its dr hydra working with 5v. I doing a dual-prop design.
    TellMe Wearable™ , A Smart Bluetooth Notification Wearable Device for your smartphone
    Motion-Control your ActivityBot with your Android smartphone, MyActivityBot


    Kenichi

  12. #12

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Nice work Beau.
    This will work prefect for me as well.
    William Stefan
    The Basic Stamp Nut with some Spin

  13. #13

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Beau,

    I have another idea, what do you think?

    Add an "assert" that is pulled high by an external resistor, then assert low before transmitting a message. The prop does a listen for assert, then pulls it low, then transmits a packet with a source and destination ID, then lets go of assert. This is a more rudimentary method if CSMA/CD and gives you more payload space in the packet. It also avoids the token ring effect.

    I'm sure there are some clever ways of reducing the instruction count so that collisions are very unlikely.

    If you get rid of the wire count limitation, do an I2C like data, clock, and select. You pull select low, then wait for the same number of clocks as it took to do the check and set for select, then check that the clock isn't low, then bring the clock low to signal the begin of transmission. Doing the select, then waiting, then bringing clock low would ensure a foolproof protocol for collision avoidance.

    Then you just put multiple props on a bus and just run a simple wait loop to receive all the time, or break in to send.

  14. #14

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    I love this code.

    I am using it to run a common memory buffer between 3 props. 24 core processing with 1K shared RAM.

    Is there a way to pack it into one cog? Right now I dedicate a cog to write my process variables into out of the shared memory plus the HS_Rx and HS_Tx cog. That takes up 25% of my oompf.

    If the user modifying memory code could reside in one cog along with the Tx and Rx methods that would be great. Right now my 3 props are indeed maxed out.

    sm

  15. #15

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Glad you like the code, it was fun to write once it came alive :-)

    Because of speed requirements, the code needs to have it's own cog, but the cog only gets launched when you call the command. After the request is done it should release the cog. Perhaps the duty requirements can be shared with another cog that doesn't need to continuously run as well.
    Beau Schwabe | Parallax Semiconductor
    IC Layout Engineer
    Parallax Inc. * 599 Menlo Drive * Rocklin California 95765
    www.parallaxsemiconductor.com



    Asked about the ramifications of his discoveries, Hertz replied, "Nothing, I guess." Hertz also stated, "I do not think that the wireless waves I have discovered will have any practical application."
    www.BScircuitdesigns.com: IC's * Inductive proximity sensors * Misc

  16. #16

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    I was wondering if the Rx and Tx code sections could be loaded into one PASM cog, called alternately from within, with a small section to transfer user defined registers into the transfer buffer in between calls to Rx and Tx. It would require each client to be custom configured

  17. #17

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Hey everyone, I'm sure that this is a very simple question, but I'm a bit stumped. I've been able to connect my two props and the demo is working perfectly, but what I'd like to be able to do is be able to have the server send values from variables, not a data block. What I'm trying to do is have one propeller that is monitoring a number of sensors (~10) and sending the data back to the other propeller. I'm using v2 from above. I think that I should be able to modify this "bytemove(@Buffer,@TestMessage,strsize(@TestMessag e))" section of the code and replace the "@TestMessage" with my variable in the server side, but no luck. Any suggestions or ideas would be great! Thanks!

    Dave

  18. #18

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    The only difference between variables and a data block is a matter of semantics and location. If you define variables all of the same type (byte / word / long) and define them in order (as VARs), they will in fact become a data block (a contiguous series of bytes / words / longs in memory and can be manipulated by having the address of the first location and the length of the block. If the variables can't be all of the same type and/or can't be contiguous, then you'll have to move them to or from an area where that's true.

    Another thing you can do is define a DAT block and put your variables in there ... aligned properly. Like this:

    Code:
    DAT
    firstByte  BYTE  0
    padding1 BYTE  0
    firstWord WORD 0
    padding2 WORD 0
    firstLong LONG 0
    This is just to illustrate padding when a BYTE is followed by a WORD or LONG or a WORD is followed by a LONG. If you have a LONG first, you don't need padding for WORDs or BYTEs and if you have a WORD first, you don't need padding for BYTEs. These variables can be used in Spin just like a VAR. Here an initial value has to be specified and, if you're making an object that will be defined multiple times in your program, there will be only one DAT for that object ... not one copy per object reference as with VARs.

  19. #19

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    Hi Mike,

    Thanks for the info. I've been giving it a try and I'm still not able to get it to work.

    On the Client side I've just changed the last line PST.str(@buffer) to PST.dec(@Buffer)

    On the Server side I've made a couple of changes.

    The result is that I see "2308" in the terminal window, regardless of what I set the variable "SensorData" as. Any suggestions?

    Thanks!



    Client:

    VAR

    long Buffer[1024],Stack[400]

    OBJ
    hsRX : "HSp2pRX" 'High Speed Receive driver
    hsTX : "HSp2pTX" 'High Speed Transmit driver
    PST : "Parallax Serial Terminal" 'RS232 Serial Driver

    PUB start|debugLED
    '-------------------------------------------------------------------------------------------
    if ina[USB_Rx] == 0 '' Check to see if USB port is powered
    outa[USB_Tx] := 0 '' Force Propeller Tx line LOW if USB not connected
    else
    cognew(SerialDisplay,@Stack) '' Initialize serial communication to the PC

    '-------------------------------------------------------------------------------------------
    dira[23..16]~~ '<- I/O direction for debug LEDs
    '-------------------------------------------------------------------------------------------
    repeat
    hsRX.RX(RX_Pin,@Buffer) '<- Receive Data from External Propeller
    hsTX.TX(TX_Pin,1024,@Buffer,Command,Offset) '<- Transmit Data to External Propeller

    '-------------------------------------------------------------------------------------------
    debugLED++ '<- debug LED section
    if debugLED > 60
    outa[23..16] := $FF - outa[23..16]
    debugLED := 0
    '-------------------------------------------------------------------------------------------
    PUB SerialDisplay 'DEBUG ONLY
    PST.Start(19200)
    repeat
    PST.HOME
    PST.dec(@Buffer) '<- Display Data







    Server side:




    long Buffer[1024]

    long SensorData

    Con



    OBJ
    hsRX : "HSp2pRX" 'High Speed Receive driver
    hsTX : "HSp2pTX" 'High Speed Transmit driver


    PUB start|debugLED


    SensorData := 12345

    longmove(@Buffer,SensorData,1) '<- Moves TestMessage into Buffer

    dira[23..16]~~

    repeat
    hsTX.TX(TX_Pin,1024,@Buffer,Command,Offset) '<- Transmit Data to External Propeller
    hsRX.RX(RX_Pin,@Buffer) '<- Receive Data from External Propeller

    debugLED++
    if debugLED > 60
    outa[23..16] := $FF - outa[23..16]
    debugLED := 0



    'Dat

    'SensorData long 0

  20. #20

    Default Re: DEMO: High Speed Multi-Prop to Prop Communication

    You really have to use the [ code ] and [ /code ] tags when posting code, particularly Spin code. See this:

+ Reply to Thread

Similar Threads

  1. Propeller DEMO : (14.5 Meg Baud) High Speed Prop-to-Prop Serial Communication
    By Beau Schwabe (Parallax) in forum Propeller 1 Multicore Microcontroller
    Replies: 50
    Last Post: 12-25-2010, 07:29 PM
  2. BOEn needs to pull high on Prop2 for a Prop to Prop connection?
    By MacTuxLin in forum Propeller 1 Multicore Microcontroller
    Replies: 2
    Last Post: 06-18-2010, 07:53 PM
  3. Open Source High Speed SRAM Module(AKA Super Prop)
    By mctrivia in forum General Discussion
    Replies: 184
    Last Post: 09-27-2009, 12:58 AM
  4. Prop with high speed camera array??
    By Graham Stabler in forum Propeller 1 Multicore Microcontroller
    Replies: 18
    Last Post: 02-02-2007, 07:41 AM
  5. Multi prop communication/loading
    By hinv in forum Propeller 1 Multicore Microcontroller
    Replies: 5
    Last Post: 01-31-2007, 12:09 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts