Shop OBEX P1 Docs P2 Docs Learn Events
Propelelr Fast Serial comunication — Parallax Forums

Propelelr Fast Serial comunication

BTXBTX Posts: 674
edited 2009-10-07 14:04 in Propeller 1
Hi all.
Somebody last days talk about a fast serial comunication between propellers, but I can't remember neither found that thread.
Any ideas if there exist an object for that purpose ? I should to comunicate two pchips with no more than three pins each at high speed as possible.
I'm talking about much more than 115Kbps.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Regards.

Alberto.

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-07 03:35
    Hi Alberto, there was a thread where we were transmitting at 10Mb/sec, is that enough?

    But I have plenty of objects that routinely handle 1Mb/sec without imposing upon timing too much. What distance are you talking about anyway?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-07 06:54
    Beau posted an article - search ultra high speed serial or similar

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

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • simonlsimonl Posts: 866
    edited 2009-10-07 12:50
    Beau's code is here: http://forums.parallax.com/showthread.php?p=691952

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,
    Simon

    www.norfolkhelicopterclub.com

    Announcement: To cut costs in the current economic climate, we have switched-off the light at the end of the tunnel.
  • BTXBTX Posts: 674
    edited 2009-10-07 13:05
    Thanks so much guys !!

    @Peter, it is only about two inches max, with the 10Mbps, do you mean the Simon and Cluso talk about ?
    That's pretty enough !!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-07 13:21
    I can't find the thread again for this but it is some code I played a bit with and tested for 10Mbit. It just uses a normal serial link but transfers 32-bits at a time. When I find the link I will post it but here is the code.
    ''*********************************************
    ''*  Fast Prop-Prop Comm v0.1 Alpha           *
    ''*  Sends information quickly between Props  *
    ''*  Author: Brandon Nimon                    *
    ''*  Created: 16 September, 2009              * 
    ''***********************************************************************************
    ''* Requires pull-down on communication line.                                       *
    ''*   Prop1──┳──Prop2                                                             *
    ''*           10K                                                                  *
    ''*                                                                                *
    ''* The difference in clock speed between the two Propellers cannot excede 0.5%.    *
    ''* Transfers information at 2 instructions per bit (8 cycles).                     *
    ''***********************************************************************************
    
    ' 5.56us for 32 bits = normally 7.2M baud
    ' throughput of 711KB/s
    
    CON
    
      { ==[noparse][[/noparse] CLOCK SET ]== }         
      _CLKMODE      = XTAL1 + PLL16X
      _XINFREQ      = 5_000_000                             ' 5MHz Crystal
                                         
      BUFFER_SIZE = 256                                      ' longs to send and recieve (always sends all longs)
      
    OBJ
    
      DEBUG  : "FullDuplexSerial" 
    
    VAR
    
      long txbuffer[noparse][[/noparse]BUFFER_SIZE]
      long rxbuffer[noparse][[/noparse]BUFFER_SIZE+4]
      long rxvalue[noparse][[/noparse]BUFFER_SIZE]
    
    PUB Main | loc, i
    '' sets up for single-propeller testing
    
      DEBUG.start(31, 30, 0, 115200*8)
      waitcnt(clkfreq + cnt)  
      DEBUG.tx($0D)
    
      longfill(@txbuffer, 0, BUFFER_SIZE)                   ' clear output (not necisary now that I am filling it below)                                           
      longfill(@txbuffer[noparse][[/noparse]6], 21845, BUFFER_SIZE)                     ' fill rest of buffer with _a_ number
      txbuffer[noparse][[/noparse]0] := $55555555                              ' just some test data
      txbuffer := 2345
      txbuffer := 34567
      txbuffer := 456789
      txbuffer := 5678901
      txbuffer := 67890123
      txbuffer[noparse][[/noparse]BUFFER_SIZE-1] := 987654321
    
      recieve(1)                                           ' recieve on pin 27
      send(0)                                              ' send on pin 26
      REPEAT
        waitrx                                              ' wait for input
        REPEAT i fROM 0 TO constant(BUFFER_SIZE - 1)
          DEBUG.tx($0d)
          debug.dec(i)
          debug.tx(",")
          DEBUG.dec(rxvalue[i])                             ' display all longs of rx
        DEBUG.tx($0d)
    
    PUB send (pin)
    
      txpin := pin
      cognew(@tx_entry, @txbuffer)
    
    PUB recieve (pin)
    
      longfill(@rxbuffer, 0, BUFFER_SIZE)                   ' clear data (just in case)
      rxmask := |< pin
      cognew(@rx_entry, @rxbuffer)
    
    PUB waitrx
                    
      REPEAT UNTIL rxbuffer                                 ' wait until _something_ is put into the first long of the buffer
      waitcnt(constant((12 * 32 + 20) * (BUFFER_SIZE - 1)) + cnt) ' wait for rest of info to be transfered @12 cycles per bit
      longmove(@rxvalue, @rxbuffer, BUFFER_SIZE)            ' I would like to get rid of this
      longfill(@rxbuffer, 0, BUFFER_SIZE)                   ' clear for next use (again, I will find a way to remove this)
      RETURN @rxvalue                                       ' not used, but will be needed once it is an object
    
    DAT
                            ORG 0
    tx_entry
                            MOV     txmask, #1
                            SHL     txmask, txpin           ' setup mask
    
                            MOV     CTRA, nco
                            ADD     CTRA, txpin             ' NCO on this pin number
                            MOV     DIRA, txmask            ' set pin as outpu
    
    tx_bloop                MOV     txptr, PAR              ' get input buffer address
                            MOV     txbidx, #buffer_size             ' set for 32 longs
    
    tx_loop
                            RDLONG  txval, txptr            ' get current output long
                            MOV     txidx, #32              ' set for 32 bits (a long)
    
                            MOV     PHSA, negone            ' send a one-instruction pulse
                            MOV     PHSA, txval             ' setup NCO output
    
    
    txbloop                 'NOP                             ' to sync with RX loop. this can be removed when RX DJNZ is replaced with many instructions
                            SHL     PHSA, #1                ' set next bit
                            DJNZ    txidx, #txbloop
    
                            MOV     PHSA, #0                ' make sure 0 output
                            
                            MOV     time, cnt               
                            ADD     time, wait              
                            WAITCNT time, #0                ' wait for RX loop
    
                            ADD     txptr, #4               ' move read pointer one long
                            DJNZ    txbidx, #tx_loop        ' do next long until done with buffer
    
                            MOV     time, cnt
                            ADD     time, wait2
                            WAITCNT time, #0                ' wait for RX to be ready again
                            
                            JMP     #tx_bloop                        
    
              
    wait                    LONG    20                      ' this will end up being slightly faster
    wait2                   LONG    80000                   ' this too will end up being faster
    negone                  LONG    -1
    nco                     LONG    %00100 << 26
    txpin                   LONG    0                       ' set in SPIN
    
    txval                   RES
    txmask                  RES
    time                    RES
    txidx                   RES
    txbidx                  RES
    txptr                   RES
    
                            FIT 496
    
    '=======================================================                        
                                                            '
                            ORG 0
    rx_entry
                            OR     dira,synch
                            andn     outa,synch
                            MOV     rxptr, PAR              ' get output buffer address
                            MOV     rxbidx, #buffer_size
                            
    rx_loop                 MOV     rxidx, #32              ' set for 32 bits (a long)
                            MOV     rxval, #0               ' clear current long
                            
                            WAITPEQ rxmask, rxmask          ' wait for high pulse from TX
                            
    :loop                                           
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
    
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
                            TEST    rxmask, INA      WC     ' get INA mask
                            RCL     rxval, #1               ' set value
    
    '                        DJNZ    rxidx, #:loop           ' will be removed and replaced with 32 test/rcl for speed purposes
                            XOR     outa,synch
                            WRLONG  rxval, rxptr            ' write current long to buffer
    
                            ADD     rxptr, #4               ' move write pointer one long
                            DJNZ    rxbidx, #rx_loop        ' do next long until done with buffer
                            
                            JMP     #rx_entry  
                                       
    rxmask                  LONG    0                       ' set in SPIN
    synch                   LONG    4
    
    rxval                   RES
    rxptr                   RES
    rxidx                   RES
    rxbidx                  RES
    
                            FIT 496                        
      
    [/i]
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-07 13:31
    Finally found the thread but I had to resort to the forum posts which are emailed into my gmail account. All I had to do was type a few words in there and presto. The search.parallax.com is NOT all that great.

    http://forums.parallax.com/showthread.php?p=841367

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • BTXBTX Posts: 674
    edited 2009-10-07 14:04
    Yeah Peter !!! Thank you.
    That's what I was looking for, & yes, search.parallax gives me a headache last night searching.... [noparse]:([/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
Sign In or Register to comment.