cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_UART_Receive_DMA can't work in STM32L476RG nucleo

paker earth
Associate II
Posted on January 20, 2017 at 05:03

Hi all

I used the example ''UART_TwoBoards_ComDMA''.

Just comment #define TRANSMITTER_BOARD, because I only have one device connecting to PC.

After run it, I couldn't see LD2 flashing.

It should be toggled because while (UartReady != SET) loop.

If I add some code ''HAL_UART_Transmit_DMA(&UartHandle, (uint8_t*)aTxBuffer, TXBUFFERSIZE);'' between HAL_UART_Receive_DMA() and 

while (UartReady != SET) loop.

It will show messages on my PC terminal, but LD2 still didn't flash.

I don't know where is the code running.

I tried to input some datas, unfortunately HAL_UART_RxCpltCallback() has no respond.

If someone could show me a example using 

HAL_UART_Receive_DMA could work in STM32L476 nucleo.

or tell me how to debug the problem.

Thank you all in advance.

0690X000006060qQAA.png
2 REPLIES 2
Adam Hu
Associate
Posted on January 20, 2017 at 06:14

MX_DMA_Init();

MX_USART1_UART_Init();

HAL_UART_MspInit(&huart1);

HAL_UART_Receive_DMA(&huart1,aTxBuffer,1024);

these are key codes in Uart receive process using DMA;

paker earth
Associate II
Posted on January 20, 2017 at 10:40

Thank you, Adam Hu.

After some tests, I find my device can't receive any data in polling and DMA mode.

But it works well when I use HAL_UART_Receive_IT();

So the problem seems to be why the receive IRQ procedure has no response when I tried to send character.

HAL_DMA_Start_IT().