HAL_UART_Receive_DMA calls RxCpltCallback, but receives no data
In my project, I'm using UART1 with DMA enabled, similar to this:
MX_GPIO_Init();
MX_DMA_Init();
MX_UART7_Init(); // initializes, and I assume, correctly
void DMA1_Stream1_IRQHandler(void) {
HAL_DMA_IRQHandler(&hdma_uart7_tx);
}
void DMA1_Stream3_IRQHandler(void) {
HAL_DMA_IRQHandler(&hdma_uart7_rx);
}
void UART7_IRQHandler(void) {
HAL_UART_IRQHandler(&huart7);
}
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
if (huart->Instance == UART7)
complete = 1;
}
void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) {
error();
}The setup was with CubeMX, and I included the IR-related stuff. The DMA is non-circular, with auto-increase for memory but not for the peripheral.
The code that receives data looks like this:
complete = 0;
HAL_UART_Receive_DMA(&huart7, buffer, size);
HAL_DELAY(5000); // <-- simplified
if (complete)
return buffer;
But when doing so, the callback HAL_UART_RxCpltCallback is called (i.e., complete is set to 1), but the buffer contains no (new) data. Also, the IR doesn't fire immediately (this cannot be observed with this snippet here). The sending of data works.
What am I missing here? Did I forget some action or configuration? Could this be an interrupt issue, as I'm using various priorities here?
