PDA

View Full Version : FullDuplexSerial Problems



Matt32493
11-17-2010, 10:45 PM
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...

John Abshier
11-17-2010, 11:01 PM
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

Matt32493
11-17-2010, 11:11 PM
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 Hein
11-17-2010, 11:12 PM
Make sure you define _clkmode and _xinfreq or _clkfreq. That's caught me a few times.

mojorizing
11-17-2010, 11:17 PM
"*¹€®¡*¥€©³€*¡´´ "


Hey, no foul langange on the forums!!!



....incorrect baudrate, maybe.

John Abshier
11-17-2010, 11:20 PM
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

Matt32493
11-17-2010, 11:20 PM
using:



_clkmode = xtal1
_xinfreq = 5_000_000


Nothing happens.

John Abshier
11-17-2010, 11:30 PM
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

Matt32493
11-17-2010, 11:32 PM
"*¹€®¡*¥€©³€*¡´´ "

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 Abshier
11-17-2010, 11:35 PM
The internal oscilator is not accurate enough for high speed serial coms.

John Abshier

Matt32493
11-17-2010, 11:39 PM
So i need to get an external oscillator to use this?

John Abshier
11-17-2010, 11:42 PM
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

Matt32493
11-18-2010, 03:57 AM
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

RockyD
11-18-2010, 05:08 AM
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.

Matt32493
11-23-2010, 11:37 PM
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