2021-12-07 03:09 AM
Hi
I am testing STM32WL55
I am trying to communicate through UART1 and UART2 using DMA.
I set up DMA as below.
USART1_TX => DMA2_Channel 7 : Normal
USART1_RX => DMA2_Channel 6 : Circular
USART2_TX => DMA2_Channel 2 : Normal
USART2_RX => DMA2_Channel 1 : Circular
I set up RX DMA as below
HAL_UART_Receive_DMA(&huart1, &rxBuffer1, 1);
HAL_UART_Receive_DMA(&huart2, &rxBuffer2, 1);
and I coded rx callback function as below
void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
if (huart->Instance == USART1) {
loadReceiveConsoleData(rxBuffer1);
}
else if(huart->Instance == USART2) {
loadReceiveModemData(rxBuffer2);
}
}
When sending data to UART1, the loadReceiveConsoleData function handles it well and there is no problem. But when sending data to UART2, the callback function is called only once, and the loadReceiveModemData function is not executed since it is not called after that. I don't know why.
Can you tell me what is the problem ?
and Can you let me know how to resolve the problem?
I generate code from IOC file using STM32CubeIDE
I attatch the source