2023-08-15 08:00 AM
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!
Solved! Go to Solution.
2023-08-15 01:57 PM
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
2023-08-15 10:05 AM
>>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.
2023-08-15 01:57 PM
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
2023-08-15 11:06 PM
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.