Page 1 of 1

Is there an UART auto baud rate example?

Posted: Fri Feb 02, 2018 9:48 am
by Koschi
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

Re: Is there an UART auto baud rate example?

Posted: Fri Feb 02, 2018 1:48 pm
by WiFive
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".

Re: Is there an UART auto baud rate example?

Posted: Fri Feb 09, 2018 5:23 pm
by Koschi
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.