PDA

View Full Version : USING pcFullDuplexSerial4FC.spin-Mis reading



Chuck Minton
11-23-2010, 10:26 PM
Thanks to those helping with my bit problem shift problem.
Now onto my next issue...in new thread

I am trying to implement a display that has integral buttons. When a button is pushed, the display sends a serial packet. for instance the notification packet when the left button is pushed is supposed to be $80 01 03 63. Using ParallaxSerialTerminal I get 100% of button push all the time. However, because I was out of cogs, forum suggestions pointed to the PCFullDuplexSerial4FC. I got that going, but now I don't get proper reading from my serial sources but It sees to transmit well. Most of the time I rx the first byte right , then the second and third byte seems to be usually wrong(but quasi consistent), and the forth byte is always right. I am thinking there must be a timing issue ... why else would PST read right all the time... none the less it did free up a cog! I will be able to fit it all on one prop!
The good part is if I can figure this out, I will be more or less to the completion point of my project... getting so close!
I tried switching baud from 115200 to 19200 ( my only options)... That was worse ... could write but would not read it at all.
So, If any one is up on PCFullDuplexSerial4FC, and what may be causing this and how I could fix it I would appreciate it a whole lot.
(Using a Crystal Fontz Logic Level display)

Thanks ,
Chuck

Timmoore
11-23-2010, 10:32 PM
I think you are sending from the prop to the display? Have you tried sending to a PC and seeing what you are getting and whether you are getting it on a PC correctly. i.e. whether its an interaction just with the display? It also would be interesting to see what numbers you are getting for the 4 bytes if they are almost consistent.

Chuck Minton
11-23-2010, 10:48 PM
Tim,
I can send to the display perfect all the time.
I am having trouble reading from the display: When a button is pushed, it is supposed to send a packt to the prop telling what button was pushed.
Using PST it works great.
Using PCFullDuplexSerial4FC, because I am out of cogs, I don't get proper read of the packet coming into the prop from the display.
The first and last bytes are always right, but the center two are usually wrong and vary a little.
I have hooked the display directly up to my prop clip and into terminal . That reads fine.
The problem happens using PCFullDuplexSerial4FC, which I need to do to free up cogs.

for instance:
this is the read from the left button:$80 80 81 63
this is what the display is sending : $80 01 03 63

switch back to pst and does it fine.

Chuck Minton
11-23-2010, 11:53 PM
Timmoore,
I see in Comments,"''* Tested 4 ports to 115Kbps with 6MHz crystal ".
I am using 5Mhz X-tal @ PLL 16X.. could this be an issue.
Also other stirng someone suggested nudgeing baud rate a little in FullDuplexSerial, is this possible with this code??? I wonder if the freq of the dispaly is off a little.
On scope, both seem to be strong and same pitch: Can't tell for sure...not a storage scope.

Timmoore
11-24-2010, 12:41 AM
I would vary the baudrate around 115200. I have run 4 ports at 115200 with 5Mhz but it is senstive to the baud rate.
My guess is if you look at the timing from the last bit of the 1 char to the 1st of the 2nd, etc for each char the last char has a slightly longer time. So you are starting late into the char with the 2nd and 3rd chars

Chuck Minton
11-24-2010, 12:49 AM
I would vary the baudrate around 115200. I have run 4 ports at 115200 with 5Mhz but it is senstive to the baud rate.
My guess is if you look at the timing from the last bit of the 1 char to the 1st of the 2nd, etc for each char the last char has a slightly longer time. So you are starting late into the char with the 2nd and 3rd chars
Thanks Timmoore,
Sounds good for me, how is that accomplished,

can I just change the Constants???
BAUD1200 = 1200
BAUD2400 = 2400
BAUD4800 = 4800
BAUD9600 = 9600
BAUD19200 = 19200
BAUD38400 = 38400
BAUD57600 = 57600
BAUD115200 = 115200 <<<<

...a little higher or a little lower???

Timmoore
11-24-2010, 01:12 AM
I just use a number rather than the constant e.g. 114800 as the arguement

Chuck Minton
11-24-2010, 01:20 AM
OK!!!HURRAY!

TNX...
I had to step up the 4port to 117000 <>124000 and works GREAT!
Things qiut working at all at 111000
So probably set at 118000

Thanks so much for the help Timmoore!

Dr_Acula
12-11-2010, 03:23 AM
I've just been testing this - with a 5Mhz clock I'm getting it working between 108000 to 120000. This is using a terminal program ShamCom from Shamrock Software.