I am working on a project involving two STM boards, where the objective is to send and receive a single byte of random data simultaneously between the boards. Each board assigns itself the name 'A' or 'B' based on whether the received random number is greater than the one it sent. This process repeats until the numbers are not equal. The data is being send using UART.
The problem I am facing is that during simultaneous data transmission, there is a loss of data. I suspect that the issue lies in the synchronization or timing between the two boards. For sending and receiving data I am using hal_uart_transmit_it and hal_uart_receive_it. Also the code for the boards has to be common.
Any guidance or suggestions on how to approach this problem would be greatly appreciated.
I don't have any good idea right now I am constantly receiving and transmitting data but nothing is happening
If boards are not far from each other, you can use one cable to connect two pins. When one board starts transmitting it changes this pin and DMA transmission is triggered on the second one. This way they will be perfectly synchronised.