cancel
Showing results for 
Search instead for 
Did you mean: 

how can i detect the baudrate of incoming data on UART port on stm32f070 micro controller?

jagadeesh v
Associate
Posted on January 04, 2017 at 11:33

Hi all,

I'm wokring on STM32 Nucleo board(STM32F070).

I've a requirment to check the baud rate of incoming data on UART2 and verify the packets.

how can i check that? 

Any Idea??

thanks in advance.

#stm32-nucleo #uart #uart-baud-rate #stm32f070
2 REPLIES 2
Nesrine M_O
Lead II
Posted on January 04, 2017 at 11:55

Hi

v.jagadeesh

‌,

If you have a look to

http://www.st.com/content/ccc/resource/technical/document/application_note/group0/66/fa/62/a2/5c/75/48/a8/DM00327191/files/DM00327pdf/jcr:content/translations/en.DM00327pdf

application note, the Software automatic baud rate detection section, may give you an idea to start:

In fact, the idea of the software approach is to send a 0x7F data frame to the USARTx_RX pin. This is connected to the EXTI line, which is configured to generate an interrupt on each rising edge.

The duration of the interval between the two rising edges is measured using the Systick timer. This duration corresponds to the duration of 8 bits, so

  • bit time = calculated duration / 8

  • baud rate = 1/bit time

The USARTx_BRR register is then programmed, based on the calculated baud rate value.

-Nesrine-

Posted on January 04, 2017 at 17:08

Would depend on the data and packet format a lot, wouldn't it?

You can use TIM or EXTI to measure minimum bit timing, you wouldn't be able to receive valid data until you selected the right value based on the pulse widths you measured, and computed against the internal time base.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..