2025-05-29 6:32 AM
Hello,
I implement RS-485 on STM32G491. I receive with ReceiveToIdle_DMA and I also transmit with DMA. I need to know if currently something is being received because that means I cannot send data now because RS485 is half-duplex. As far as I know I cannot use IDLE flag as it clears after interrupt and I need to know if RX line is now IDLE or now I am receiving data.
In sumarry - what condition should I check before sending data and changing DE state of the transceiver to make sure RX is silent now.
Looking forward to your replies!
2025-05-29 6:41 AM
Bonus questions:
2025-05-29 8:16 AM
To determine that you should respond, you need to validate the received request, e.g., it's addressed to you and has a valid checksum.
Consider implementing your own USART interrupt handler, that way you can measure the inter-character gap time (using a timer that you reset when a character is received); a gap time > 3.5 char can be used to indicate that the received message is complete.
2025-05-29 12:03 PM
Hi,
Your microcontroller support Modbus RTU/ASCII regarding recognize silence. Please see reference manual RM0440.
2025-05-29 12:59 PM
Your USART have BUSY flag, that can be used to detect reception. But AFAIK most RS485 drivers doesn't provide information about "line free" condition. And even if they did provide this information, there would still be a chance that two nodes would start transmitting at the same time. Therefore you have to rely on communication protocol to avoid collisions.