Personal tools
You are here: Home Forums R8C/Tiny Auto Baudrate Generation

Auto Baudrate Generation

Up to R8C/Tiny

Auto Baudrate Generation

Posted by Sharan Desunagi at September 01. 2008

Hi,

   I'm developing a project using R8C/11 controller, I wanna measure baudrate of incoming message & adjust the baudrate of R8C/11 microcontroller to the baudrate of incoming message. Is it possible to measure the baudrate of incoming message(say, from PC), if so how...

Plz help me out

With Regards,

Sharan

Re: Auto Baudrate Generation

Posted by Icecap at September 01. 2008
It all depends... If the PC sends out the same character until it gets a reply it's fully possible to make an autoadjust. If it sends an "space" (0x20) it would look like: 0 00000100 1(1) (The first '0' is the startbit, the last '1' is the stopbit, could be 2 * '1' if 2 stopbit is chosen) If the baudrate on the R8C is too high the incoming value would give overflow and/or framing error, thus the baudrate om the R8C should be lowered, if the recieved data is < 0x20 the baudrate should be raised. To lower/raise You need to make a tabel of "possible" baudrates and their values in the baudrate-register.

Re: Auto Baudrate Generation

Posted by Sharan Desunagi at September 11. 2008

Previously Icecap wrote:

It all depends...

If the PC sends out the same character until it gets a reply it's fully possible to make an autoadjust.

If it sends an "space" (0x20) it would look like: 0 00000100 1(1)
(The first '0' is the startbit, the last '1' is the stopbit, could be 2 * '1' if 2 stopbit is chosen)

If the baudrate on the R8C is too high the incoming value would give overflow and/or framing error, thus the baudrate om the R8C should be lowered, if the recieved data is < 0x20 the baudrate should be raised.

To lower/raise You need to make a tabel of "possible" baudrates and their values in the baudrate-register.

ok thak u,

how to detect the start bit and stop bit of the incomming message,plz helpme out

Re: Auto Baudrate Generation

Posted by Icecap at September 11. 2008
The hardware does that! (to a certain degree) All the definitions is in the datasheet, refer to that (as always). But a hint: Start recieving at the middle baudrate, see what value that comes. If a lot of framing errors comes (2 in a row) step the baudrate up one notch, reset and test again. It should also be possible to make a routine that monitors the RXD-pin and compares with the timing of a timer. If You could calculate the time for the startbit You have the baudrate. You could do this i several ways but the fewer standart baudrates used, the faster and simpler it will be.

Re: Auto Baudrate Generation

Posted by Calvin Grier at September 11. 2008

There's an app note and code for doing auto-baud with an H8 and a separate one on the M32C on Renesas.com   Here's the link for the M32C:

http://documentation.renesas.com/eng/products/mpumcu/apn/rej05b0723_m16cap.pdf

Powered by Ploneboard