software uart baud rate changes

Moderator: Benj

Post Reply
Brian Walsh
Posts: 29
Joined: Thu Jan 14, 2010 10:43 pm
Has thanked: 3 times
Contact:

software uart baud rate changes

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: software uart baud rate changes

Post 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.

Brian Walsh
Posts: 29
Joined: Thu Jan 14, 2010 10:43 pm
Has thanked: 3 times
Contact:

Re: software uart baud rate changes

Post by Brian Walsh »

Thanks Ben, I'll look forward to that.

Regards,

Brian Walsh.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: software uart baud rate changes

Post 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
Martin

Brian Walsh
Posts: 29
Joined: Thu Jan 14, 2010 10:43 pm
Has thanked: 3 times
Contact:

Re: software uart baud rate changes

Post 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.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: software uart baud rate changes

Post 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?
Martin

Post Reply