Shop OBEX P1 Docs P2 Docs Learn Events
Serial Comms - What am I doing wrong? Can someone help the noob? — Parallax Forums

Serial Comms - What am I doing wrong? Can someone help the noob?

pacmanpacman Posts: 327
edited 2009-05-15 20:23 in Propeller 1
Hiya,

Im using the Extended_FDSerial object in an effort to get some simple serial comms working but I seem to be having a problem with the prop recieing data.

I can send OK.

I'm note sure if its a wiring problem, a mode 'problem' (with the way you start FDSerial), a code problem (I'm not using the .WorkDammYouWork method properly), a hardware problem (the level shifter board, the USB to serial cable), or something else....

Does someone have (or could quicly bash out) a TESTED spin program thay would be able to share to allow me to 1)send a 'test' string out the TX pin, 2) check for data (using .RXcheck would do) on the RX pin and 3) spit the answer to 2 out via the SimpleDebug object.

My reasoning is that I can use your working program to check all the external bits.

I have searched the forum (and object exchange) for a 'pre-canned' serial test program but have had no luch with my efforts

(and is it me or is the forum search broken? More than one term {even when seperated with ,} always gives 0 results) - I've even used the Google search function as recommended in the sticky, but still no joy...


Huge thanks in anticipation..

Paul

Comments

  • mosquito56mosquito56 Posts: 387
    edited 2009-05-13 21:22
    In the PE kits lab there is a program called "hyperterminal frequencies" that takes a keyboard entry to set a freq for a speaker. This would test your input and output as it uses bi-directional. This is the program I use to setup a keyboard requirement for a progam.



    Don

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·······

    ······· "What do you mean, it doesn't have any tubes?"
    ······· "No such thing as a dumb question" unless it's on the internet
    ········
  • dodgerdodger Posts: 37
    edited 2009-05-14 03:44
    Hey,



    I had similar trouble when I first started using the propeller.

    I would recommend·using·the same pins that are used for programing to interface with your serial terminal

    Heres an example:

    Serial.start (31,30,0,9600)

    Its also might be· a good idea to download the parallax serial term for now till you get things working.·

    Hope this helps
  • pacmanpacman Posts: 327
    edited 2009-05-14 10:11
    I am now working with the Terminal Frequency program (thanks mosquito)

    Plugging my level shifter board straight onto the RX/TX pins (rather than the prop plug) doesn't give me any joy at all...

    But substituing my prefered pins (8 & 9) still leave me with the prop only being able to TX not RX.

    Does the DuplexSerial module set the RX pin to an input? or do I have to set that external in my code? (I dont see where/how it's getting set in the example?)

    Thanks for the help so far
  • LeonLeon Posts: 7,620
    edited 2009-05-14 10:25
    This test program works with Full Duplex Serial:

    ''*****************************
    ''* Full Duplex Serial test   *
    ''*                           *
    ''*****************************
    
    CON
    
            _clkmode        = xtal1 + pll16x
            _xinfreq        = 5_000_000
    
    
    OBJ
    
            FD_test     : "FullDuplexSerial"
    
    
    PUB go
    
    '' Starts 'Full Duplex Serial'.
    '' Use a terminal program on the host machine to communicate.
    
      FD_test.start(31, 30, 0, 38400)
      repeat
        FD_test.str(string("This is a string"))
        FD_test.tx(13)
        FD_test.dec(1234)
        FD_test.tx(13)
      while true
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-05-14 12:19
    You can not set the DIRA of other COGs! Each COG has it's own DIRA register and is the only one who can access it. In the end all DIRA registers of all COGs are or'ed and the result will define which pins are really outputs. So, what you have to take care of is that no other COG than the Serial one is using PIN 9 as output, otherwise receiving will of course fail.

    Don't know the example you talk about, but DIRA of each COG is initialized as 0, so you only have to set the output pins, all other pins are defaulted to input.
  • pacmanpacman Posts: 327
    edited 2009-05-15 05:57
    Ok, More dumb questions.


    So assuming I get my code working using pins 30 & 31 {FullDuplexSerial.Start(31,30,0,9600,)} but then ONLY change the pin definitions in the code {FullDuplexSerial.Start(8,9,0,9600,)} then I _should_ have no other issues?

    That is providing that the external hardware is OK.

    That is where I think I'm coming unstuck - I can get "Terminal Frequency" working from pins 31,30 but shift them to 8 & 9 and I can only get the prop to TX (it won't RX, no matter how hard I bash on the keyboard). I'm starting to suspect that
    my line shifter level board (Futurlec http://www.futurlec.com.au/Mini_RS232_TTL_3V.jsp) only works one way??
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-05-15 12:49
    I don't find a datasheet for the board, but the pictures assume that it works in both ways. You have two serial ports available both with RX and TX. Did you connect one of the ports to the PC?

    In this case you can simply test if the board itself is working. Connect the RX with the TX on the 3.3V side and the keystrokes should be echoed to the terminal program.
  • pacmanpacman Posts: 327
    edited 2009-05-15 20:23
    Thanks MagIO2 that was so obvious (that I missed it - or perhaps I'm just bit thick.....).

    Now I know the external line driver board (and thus the USB convertor cable and all other associated wiring) is fine...


    Back to more bug hunting....
Sign In or Register to comment.