Skip to main content
christophkeiner9
Associate III
August 15, 2023
Solved

USART1: is it busy receiving?

  • August 15, 2023
  • 2 replies
  • 1317 views

I use the USART1 on a STM32F103RB in half duplex RS485 configuration.
My question is: how can i be shure, that the bus is idle?

OK, i can see RXNE if a complete Byte was received, but if the USART is just receiving the bits and it has not reached the stop bit, i can't find a "busy" Flag or similar.

But shurely i don't want to start sending in this case.
Actually the only way i see is to use the EXTI interrupt line for that.
Has anybody a hint for this issue?

Thank You!

This topic has been closed for replies.
Best answer by waclawek.jan

Just FYI, newer STM32 (starting with 'F0/'F3) UARTs do have a BUSY flag, indicating ongoing Rx.

But even then, it is set only after start bit is detected successfully. As Clive said above, you should design the higher-level protocol so that this simply does not happen thus is not an issue.

JW

2 replies

Tesla DeLorean
Guru
August 15, 2023

>>My question is: how can I be sure, that the bus is idle?

Use a protocol that provides, packets, sizes, and expectations.

Waiting for something to "stop sending" seems prone to all kinds of issues and misinterpretations.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
christophkeiner9
Associate III
August 16, 2023

Thank you for your Reply.

I use Modbus RTU, but i usually like to check things that can go wrong as far as i can.

waclawek.jan
waclawek.janBest answer
Super User
August 15, 2023

Just FYI, newer STM32 (starting with 'F0/'F3) UARTs do have a BUSY flag, indicating ongoing Rx.

But even then, it is set only after start bit is detected successfully. As Clive said above, you should design the higher-level protocol so that this simply does not happen thus is not an issue.

JW