I`m using STM32F103CBT6 core with UART via DMA on 9600 baud rate.
The device in idle state transfers data between controller and bill validator unit. In the same time I`m sniffing the data that are going there.
When I need to emulate the bill validator and send my own commands to the controller I just switching logical ICs (to break up the communication between them) and sending my own data to the USART 2.
My application works generally fine except one issue. I found out that sometimes the data seems to be corrupted. To show the issue I prepares some screenshots from the logic analyzer app:
Here is the correct data packet:
And here is the corrupted data packet:
Of course I tried to debug it with ST-Link but I saw that data array that is going to the HAL_UART_Transmit_DMA function is correct. I also tried to make an array to be const (as the original data packet`s CRC - last two bytes - are dynamically calculated) but without success.
So here I`m sure that data that going to the HAL library is correct.
I don`t know where to search now but I guess that the problem is with DMA.
I didn`t received any data while transmitting on that UART, and sending new data packet way after the previous one was sent.
P.S. I need to add that the problem is not constant but happens on 1 of the ~10-20 transfers. At the same time the corrupted packet looks every time the same. I guess it related to that fact that request command also the same every time.