2021-06-08 07:16 AM
Hi,
I have written an STM32 program that transmits data using HAL_UART_Transmit_DMA .
However, for some reason, the first time I call this HAL function, Rx line only outputs 0s.
The second message I'm sending actually sends the first message,
The third message sends the second, and so on.
I have verified with debug that each call to the HAL function has the correct message in the buffer parameter, and I have verified with scope (the scope I used can interpret the outgoing message) that every message that goes out of the Rx pin is the previous one.
this is the code that is called in a loop, please note that I'm always getting HAL_OK as a return value:
if( m_configuration.huart->gState == HAL_UART_STATE_READY ) {
if( HAL_OK == HAL_UART_Transmit_DMA( m_configuration.huart, reinterpret_cast< U08 * >( pData ), static_cast< uint16_t >( length ))) {
amount = length ;
}
}
else{
amount = itsTUtilityCircularBufferTx.putElements( reinterpret_cast< U08 * >( pData ), length ) ;
}
Is this a known issue?
2021-06-08 07:27 AM
Sounds like a mismanaged cache issue. What STM32?
Although if the behavior is super regular, sounds more like a bug somewhere in the code or in your interpretation of it.
2021-06-08 07:36 AM
Sorry, I forgot to mention, I use STM32H743ZI2 (Nucleo Board EVB).
Perhaps I should have mentioned that currently I'm sending messages in, and using a counter sending responses to these messages.
I receive all the messages in the correct order, verified by debugging the code.
However, when sending out my response, this issue causes a mismatch in my flow because the first message gets a bunch of 0s as answer, the second message gets the first message response, etc.