2019-12-17 02:20 PM
UART Communication Using DMA Not Working
I have Nucleo-F767ZI Rev B board and using the STM32CubeIDE Version: 1.1.0.
To test and implement UAR-DMA communication as presented in:
STM32CubeMX basics: 10.11 STM32Cube HAL labs UART - UART DMA https://www.youtube.com/watch?v=BxFYmBYBmaU
My code:
/* USER CODE BEGIN 2 */
HAL_UART_Transmit(&huart3, (uint8_t *)"\n\r UART3", 8,100);
//HAL_UART_Transmit(&huart3, (uint8_t *)"\n\rHello", 7, 100);
HAL_UART_Transmit_DMA(&huart3, (uint8_t *) "\n\rHello", 7);
HAL_Delay(300);
HAL_UART_Transmit(&huart3, (uint8_t *)"\n\r UART3 OK", 11, 100);
If the DMA is selected only " UART3 " is printed, the UART3 sop working thereafter.
If the polling version is selected: " UART3 Hello UART3 OK" is printed.
The same will happen if a vector is the source of the for printing.
What I am missing here?
2019-12-18 12:47 AM
2019-12-18 07:33 AM
Thank you for the quick reply.
Changed the initialization order, which resulted that the 1st UART-DMA message gets printed, but after that, the UART port stopped working for DMA or polling access.
/* Test code */
HAL_UART_Transmit(&huart3,mReset, sizeof(mReset),1000); //OK
resp = HAL_UART_Transmit_DMA(&huart3, mesage2, sizeof(mesage2)) ; //OK
HAL_Delay(900); /* Insert a 0.9s delay in order to finish the print by the interrupt.*/
HAL_UART_Transmit(&huart3, pcVersionInfo, sizeof(pcVersionInfo),100); // ??? No output
//HAL_UART_Transmit_DMA(&huart3, pcVersionInfo, sizeof(pcVersionInfo)); // ??? No output
2020-09-06 09:51 PM
I had a similar issue where only the first DMA transmission would work, and found the fix was to enable HAL_UART_IRQHandler()
See this thread for more details:
https://community.st.com/s/question/0D50X00009XkgtY/dma-uart-with-hal-remain-busy-bug