2024-08-12 09:54 AM
Hello.
Could anyone explain me why when I try to transmit data by UART using DMA in IDLE interrupt function from receive DMA on the same UART working in circular mode, once in several attempts my reception lost some data? TX and RX use different channels of DMA.
When I change Trasmit_DMA to casual Transmit in work even though the interrupt handling takes more time.
2024-08-13 04:07 AM
At this point, you are dealing with details of your own system design, and I don't think I can help with that.
JW
2024-08-13 04:44 AM
I can add that I have replaced DMA channel with TX of another UART and not it seems to work correctly. RX and TX on one UART use not only different DMA channels but different DMA.
2024-08-13 11:52 AM
Don't write your code in HAL_UART_IRQHandler and leave it as is. I've seen other programmers do this and their code don't work correctly, which i confirmed.
void UART5_IRQHandler(void)
{
HAL_UART_IRQHandler(&huart5);
}
Instead do it the HAL_UARTEx_RxEventCallback callback. After some testing, i found that writing code in the callback instead, fixed the other programmers issue. See if this works for you?
You might want to pass Size to your EngineAT_execute to help you copy the correct amount of bytes to your buffer?
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if(huart == &huart5)
{
EngineAT_execute();
}
}