Shop OBEX P1 Docs P2 Docs Learn Events
FullDuplexSerial Problems — Parallax Forums

FullDuplexSerial Problems

Matt32493Matt32493 Posts: 23
edited 2010-11-23 15:37 in Propeller 1
I am trying to get my prop to communicate with the computer, but i am having some problems.. I am trying to send a simple string determined in the program, but on the computer i am getting random symbols, no real text at all. Tried with 2 different terminals, and tried experimenting with the code and baud rates, and still nothing. Any ideas? I have tried several different demo codes, i have tried multiple eeprom chips, and 2 different PROP chips. I know that the USB-Serial device works because i use it to program the PROP. I am using parallaxes serial terminal so it is not encoding problem...

Comments

  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-11-17 15:01
    It sounds like a baudrate or clock frequency problem. Post the simplest code you have tried and we can see if we have the same problem.

    John Abshier
  • Matt32493Matt32493 Posts: 23
    edited 2010-11-17 15:11
    OBJ
    
      serial : "FullDuplexSerial" 
      
    PUB Start
    
      serial.start(31,30, %0000, 115_200)
    
      repeat
        serial.str(String("Print Text To Terminal"))    
        waitcnt(clkfreq + cnt)
    

    I am getting the following out of the terminal:
    *¹€®¡*¥€©³€*¡´´
  • Dave HeinDave Hein Posts: 6,347
    edited 2010-11-17 15:12
    Make sure you define _clkmode and _xinfreq or _clkfreq. That's caught me a few times.
  • mojorizingmojorizing Posts: 249
    edited 2010-11-17 15:17
    "*¹€®¡*¥€©³€*¡´´ "


    Hey, no foul langange on the forums!!!



    ....incorrect baudrate, maybe.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-11-17 15:20
    Adding these lines makes you code work on a Demoboard. Values for pll and _xinfreq will depend on your board, but the ones below are the most common.

    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000

    John Abshier
  • Matt32493Matt32493 Posts: 23
    edited 2010-11-17 15:20
    using:
    _clkmode = xtal1
    _xinfreq = 5_000_000
    

    Nothing happens.
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-11-17 15:30
    Add the lines to you code like this:
    CON
    _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    
    OBJ
    
      serial : "FullDuplexSerial" 
      
    PUB Start
    
      serial.start(31,30, %0000, 115_200)
    
      repeat
        serial.str(String("Print Text To Terminal"))    
        waitcnt(clkfreq + cnt)
    

    John Abshier
  • Matt32493Matt32493 Posts: 23
    edited 2010-11-17 15:32
    mojorizing wrote: »
    "*¹€®¡*¥€©³€*¡´´ "

    Hey, no foul langange on the forums!!!

    ....incorrect baudrate, maybe.

    *¹€®¡*¥€©³€*¡´´
    *¹€®¡*¥€©³€*¡´´
    *¹€®¡*¥€©³€*¡´´
    What NOW!! :p

    I have the baud in terminal set to 115200
    And in code 115_200

    And i dont always set _clkmode.
    just defaults to RCFast = ~12MHz
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-11-17 15:35
    The internal oscilator is not accurate enough for high speed serial coms.

    John Abshier
  • Matt32493Matt32493 Posts: 23
    edited 2010-11-17 15:39
    So i need to get an external oscillator to use this?
  • John AbshierJohn Abshier Posts: 1,116
    edited 2010-11-17 15:42
    It may work at low baud rates. Start with 300 and work your way up. The best solution is to use a crystal. The Propeller will be faster and you can do accurate timing.

    John Abshier
  • Matt32493Matt32493 Posts: 23
    edited 2010-11-17 19:57
    Ok thank you. I have a crystal on its way anyway. i just may have to re-purpose it while another one is waiting for an order large enough to buy :p
  • RockyDRockyD Posts: 17
    edited 2010-11-17 21:08
    I have found you can use Full Duplex Serial without a crystal, but you have to change the baud rate. This would not be a good permanent solution, but it can allow for some testing.

    Let’s say you want to use 1200 baud. You use Full Duplex Serial and set it to 1200 and you get bad output. You then try 1150 or 1250 and see what you get, and keep trying if needed. There will be a certain number range that will work with RCFAST. The reason it is not working is that RCFAST is more than 10% inaccurate which is causing bits to be messed up. I do not know how well the long term stability is, but I have found it to work in the short term.

    But, I do agree a crystal is much easier.
  • Matt32493Matt32493 Posts: 23
    edited 2010-11-23 15:37
    How would one go about using this oscillator?
    I can not find anywhere that will show me how to connect it, and connecting one leg to xin and one leg to xout does not work like i thought it would..
    Help Please?
    Thanks
    Matt
Sign In or Register to comment.