2021-09-08 06:41 AM
Hi everybody,
This is the first time I'm writing in a forum so I'm sorry if I didn't right.
I'm developed a board based on STM32F091VBT.I'm using this board to communicate with other devices (two touch, a gateway and another board based on STM32F091VBT) via RS485 and RS232. Everything works well but, after a random time, the communication between the two board suddenly stops working (meanwhile the communication with the other devices still works). I analyzed the situation with an oscilloscope and also with debugger and I can clearly see the data frame sent by the other board but for some reason the receive interrupt of my board doesn't be triggered anymore.
I'm using the HAL_UART_RxCpltCallback and helping myself with the debug I was able to catch the moment and I can see that, when this strange behaviour happens, this condition "if (UartHandle->Instance == USART6)" doesn't become true even though the data frame is continuously sent by the other board.
I also notice that frequently a frame error happen but then, after cleared the flag, continues to work.
I was thinking to an overrun error so I disable it in the advanced init but the problem still happens.
I also tried to follow this advice HAL library serial port FE frame error processing method - Fear Cat but the situation didn't change.
Have you ever faced a similar problem? Do you have any suggestion?
I tried to be as clear as possible, I'm sorry if I wasn't and thanks for your reply!
2021-09-08 09:04 AM
rs485 is half duplex, are you handling your transceiver's enable/disable tx/rx pin correctly?
maybe your transceiver stays in tx mode forever?
2021-09-09 03:16 AM
Hi Javier,
Thanks for your answer.
Yep, I manage the DE pin directly just to avoid these kind of problems, in fact the communication between the other devices on the others RS485 ports still works.
The communication between the two boards works well for a random time and then for some reason stop working.
It seems like a noise that cause this issue but I'm working with checksum so I just reject the corrupt data and go on.
One board is a master so the other send the data only after receiving, so I can exclude some collision problems.
The communication between the devices has the same baudrate (38400) and the same settings. The only thing that changes is the frequency: with the other devices is every 200ms with the one that cause the issue is 100ms.