Shop OBEX P1 Docs P2 Docs Learn Events
TTL Serial out — Parallax Forums

TTL Serial out

telluriantellurian Posts: 52
edited 2013-07-05 17:26 in Propeller 1
OK I'm stumped and so embarrassed ... this should be easy :(

I am using Full DuplexSerial to set up a TTL serial connection do a synapse wireless device (http://www.synapse-wireless.com/snap-components/rf-engine ... they blow the pants off Xbee btw:).

I can read data from the Synapse module just fine ... but tx from propeller is sending nothing (!! ?). for example ... I send "scan" to the module but the propeller only outputs 0xFF for each character (or is it 0x00? lol ... looking at it on the scope ... not sure if I have the scope polarity right)

Here is a test program:

CON

  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000

  '-------------------------------------------------------------------------------
  'Propeller Pinout
  '-------------------------------------------------------------------------------
  sio_rx            = 3         'propeller IO pin for serial tx from Synapse RF
  sio_tx            = 4         'Propeller IO pin for serial rx to Synapse RF


OBJ

  SIO           : "fullduplexserial"  
  
PUB start | gx, tmr1, idx, str, tmp

  SIO.start( sio_rx, sio_tx, 0, 9600 )

  repeat
    SIO.str( string ("scan" ) )
    waitcnt( 3000000 + cnt )


basically pin 4 only ever puts 0xFF (or 0x00 like I said ... per the scope) ... certainly NOT "scan"

What am I doing wrong (and stupid) ?

Thanks for any insight & help

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-07-04 18:29
    Works fine here with PST (sio_tx = 30). So it's certainly not the program (assuming rx and tx polarity are the same).
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-07-04 20:27
    It's possible you're not indenting correctly but we wont know unless you use code tags.

    attachment.php?attachmentid=78421&d=1297987572
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-07-04 21:26
    FYI, it's probably better to use waitcnt like this...
    waitcnt(_clkfreq*2 +cnt) 'wait 2 secs
    or
    waitcnt(_clkfreq/1000 + cnt) 'wait 1ms

    Your delay is (assumed 80MHz) 3,000,000 / 80,000,000 = 37.5ms. At 9600 baud, this is ~1000 chars/sec. So you are actually fine.

    Have you tried outputting FDX to pins 30/31 and looking with PST (parallax serial terminal)? You should add a delay before you start to send to give you time to invoke PST.
  • telluriantellurian Posts: 52
    edited 2013-07-05 03:01
    Cluso99 wrote: »
    FYI, it's probably better to use waitcnt like this...
    waitcnt(_clkfreq*2 +cnt) 'wait 2 secs
    or
    waitcnt(_clkfreq/1000 + cnt) 'wait 1ms

    Your delay is (assumed 80MHz) 3,000,000 / 80,000,000 = 37.5ms. At 9600 baud, this is ~1000 chars/sec. So you are actually fine.

    Have you tried outputting FDX to pins 30/31 and looking with PST (parallax serial terminal)? You should add a delay before you start to send to give you time to invoke PST.

    The wait is just junk I just wanted a break between send in the "scan" messages. FDS should work with any pins and I need a TTL connection not using pins 30/31. I am not implying there is something wrong with FDS, rather I am sure that I am overlooking something. The above test "program" is just to show a very simple example ... it should be outputting "scan" but all I see is the start bit and the stop bit with 0x00 for each character.. I have tried this on 3 different parallax chips and always get the same result. The device I talk to will output a string on command and I can read it just fine, but nothing comes out of the prop's TX pin (the simple program shown should output the "scan" command but does not). I tried pullups and pull downs (i.e. all ttl -> RS232 chips do that internally) but no difference :(

    So ... if anyone has done a serial TTL connection to some (any) device, perhaps you could provide some insight or point me to some place (URL) with an example.
  • telluriantellurian Posts: 52
    edited 2013-07-05 04:17
    OK. let me rephrase. Using the following test program:
    CON
    
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
      '-------------------------------------------------------------------------------
      'Propeller Pinout
      '-------------------------------------------------------------------------------
      sio_rx            = 3         'propeller IO pin for serial tx from Synapse RF
      sio_tx            = 4         'Propeller IO pin for serial rx to Synapse RF
    
    
    OBJ
    
      SIO           : "fullduplexserial"  
      
    PUB start | gx, tmr1, idx, str, tmp
    
      SIO.start( sio_rx, sio_tx, 0, 9600 )
      waitcnt(clkfreq + cnt)   'Wait 1 second
    
      repeat
        SIO.str( string ("scan" ) )
        waitcnt( 3000000 + cnt )
    

    I see this on the scope on pin 4 :

    100_0625_b.jpg


    I do not have anything connected to the propeller, just put a scope probe on pin4 ... I see start and stop bits but the message bytes are all 0x00 ... not "scan".

    Tks
    845 x 620 - 77K
  • AribaAriba Posts: 2,690
    edited 2013-07-05 13:32
    Do you really measure at P4 ? Perhaps what you see is a respond of the RF-module on pin 3 ?
    Here is how the output of your code looks on my scope:
    fds1.png

    Andy
    320 x 240 - 2K
  • telluriantellurian Posts: 52
    edited 2013-07-05 15:52
    Yes, I am measuring P4 directly. I do not have anything connected to the prop just to make sure that it isn't some effect from the RF module. I see people suggesting using PST (parallax serial terminal) ... did you use PST or FDS (full duplex serial)? I also tried it using other pins (including 30/31) in case there was something wrong with P4, I get the same result. I have not used FDS for quite a while, perhaps there is something wrong with the latest version (??).

    At any rate I swapped out FDS for PST and presto its working like it should! For some reason FDS just keeps shooting out blank characters (I have no clue why atm). So I will just use PST instead, probably will trim out the terminal stuff (don't need it). I am using the Text based GUI for VGA_HiRes_Text Driver I wrote a long time ago to monitor and control a network of Synapse RF modules so I need to maximize the space (the VGA_HiRes_Text driver gobbles up a good chunk of memory, even at 800x600).

    I've never been a fan of XBee, the Synapse RF Modules are way easier to use, cheaper, more powerful (will run user code right in the module), and have fantastic range ...up to 3 miles LOS. (no I don't own stock, lol).
  • AribaAriba Posts: 2,690
    edited 2013-07-05 16:20
    I have nothing changed - just copy and paste your code to PropTool.
    Looks like your FDS is broken.Do you perhaps have a modified version in the same directory as your test spin code? The compiler will then compile this version and not the one from the library.

    Andy
  • kuronekokuroneko Posts: 3,623
    edited 2013-07-05 17:10
    tellurian wrote: »
    For some reason FDS just keeps shooting out blank characters (I have no clue why atm).
    As suggested in [post=1193543]post #2[/post], set your tx pin to 30 and validate the output on your host computer. Either you get lots of scan messages or you don't see anything at all (0 is usually interpreted as CLS in PST).
  • telluriantellurian Posts: 52
    edited 2013-07-05 17:26
    Nothing is impossible, I could have accidentally altered FDS :)
Sign In or Register to comment.