Is there an UART auto baud rate example?

Koschi
Posts: 6
Joined: Tue Aug 22, 2017 8:49 am

Is there an UART auto baud rate example?

Postby Koschi » Fri Feb 02, 2018 9:48 am

Hello there!

I stumbled across chapter 13.3.4 "Baud Rate Detection" in the ESP32's technical reference and tried to implement this feature in one of my projects.
Although i did find a correspondig constant UART_AUTOBAUD_EN, i do not understand how to enable the detection. I also could not find any example.

Has somebody done this? Or is there an example and i just didn't find it?


Thanks in advance

Koschi

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Is there an UART auto baud rate example?

Postby WiFive » Fri Feb 02, 2018 1:48 pm

UART_LOWPULSE_MIN_CNT stores minimum low-pulse width, UART_HIGHPULSE_MIN_CNT stores
minimum high-pulse width. By reading these two registers, software can calculate the baud rate of the
transmitter.
So you have to calculate and set the baud yourself based on those values, it is not really "auto".

Koschi
Posts: 6
Joined: Tue Aug 22, 2017 8:49 am

Re: Is there an UART auto baud rate example?

Postby Koschi » Fri Feb 09, 2018 5:23 pm

This is not how i interpreted this passage. I thought it was more like a "if you have auto baudrate detection and want to know where you're at, you have to calculatue it yourself". But it would work without that.
Anyways, i looked into directly writing to registers to do this, and it doesn't seem to work that easily. I'll first look into other ways to maybe get the result i need.

As it turns out a deviation from the target baudrate of about +/- 5% is not a problem. So i might try using this to "guess" the baudrate. Hoping it will not deviate too much.

Thanks anyways! Maybe i'll come back to this thread.

Who is online

Users browsing this forum: Baidu [Spider] and 374 guests