Page 1 of 1

software uart baud rate changes

Posted: Mon May 23, 2011 4:08 pm
by Brian Walsh
I am aware that the preset baud rates don't work with the software uart and the user defined option has to be used to get usable bit times, however there is another strange problem.

If I send a string of up to 31 characters plus crlf via the software uart everything works as expected. Uppercase U is a good character to use as its bits alternate and it is easy to measure the bit time. At 9600 baud this comes out at 104us. If I then send strings of 32 or 33 characters + crlf the terminal screen displays rubbish because the bit time has majically changed to 143us. Strings of 34 and more characters work again as the bit time returns to 104us. I haven't tested to see if the problem recurrs around 64 characters but I wouldn't be surprised if it did.

I noticed this first at 115.2 kbaud and put it down to the high speed but it happens exactly the same way at 9600.

I am using an 18F4620 @ 40MHz. Any ideas?

Thanks,

Brian Walsh

Re: software uart baud rate changes

Posted: Tue May 24, 2011 10:39 am
by Benj
Hello Brian,

I have a plan in place to make the software UART more reliable for the upcoming release. Its strange how the number of characters is effecting the baud rate. I wouldn't have thought that was possible. I'll get around to looking at the code this week so I'll let you know if I spot anything that could be causing this strange behavior.

Re: software uart baud rate changes

Posted: Tue May 24, 2011 5:50 pm
by Brian Walsh
Thanks Ben, I'll look forward to that.

Regards,

Brian Walsh.

Re: software uart baud rate changes

Posted: Tue May 24, 2011 7:22 pm
by medelec35
I also found using software uart higher than 4800 baud causes problems. So I just stick to 4800 for now, if that helps.

Martin

Re: software uart baud rate changes

Posted: Wed May 25, 2011 1:11 am
by Brian Walsh
Hi Martin,

I was actually dismissing baud rate as the culprit but focussing on string length as the somewhat bizzare villain of the piece. Are you saying that you can send my delinquent string lengths at 4800 baud?

Regards,

Brian Walsh.

Re: software uart baud rate changes

Posted: Wed May 25, 2011 7:36 am
by medelec35
To be honest, I can't answer that question. What I said may not be relevant at all. I only mentioned it because you are having issues with software based UART, and I am with baud above 4800.
Although I am using 4MHz internal osc, Factory calibrated to 1%, That maybe the cause with my set up?