cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L433 DMA Issues - No Interrupt

Rogers.Gary
Senior II

Hello Community:

What I am doing should be easy and straightforward, but the results are not. On this card

(NUCLEO-L433) I am using CubeMX to do just one thing - set USART1 to transmit and receive, with only the receive set up for DMA. I set it up in Cube as DMA1 Channel 5, Circular, with byte increment to memory. USART global interrupt 1 is not enabled.

The base code is generated, I then added the function handler HAL_UART_RxCpltCallback. To set up the DMA, I added HAL_UART_Receive_DMA(&huart1, (uint8_t*)rxChar, 1);

I use a jumper to connect PA9 to PA10. I then run the code, sending a 6 byte buffer with:

HAL_UART_Transmit(&huart1, (uint8_t*)&myByte,6,0xFFFFFFFF);

The issue: I put a break point in the interrupt handler:

void DMA1_Channel5_IRQHandler(void)

{

 HAL_DMA_IRQHandler(&hdma_usart1_rx);

}

and it never reaches there. I have looked at examples but cannot find any reason why this DMA is not running to the interrupt. I veririfed that all the DMA and USART functions are being initialized.

FYI - I am able to use a regular interrupt handler and it works 100%, capturing the buffer in the HAL_UART_RxCpltCallback.

After doing some searching, I have not found anything conclusive, and it appears I am doing everything correctly - but apparently not! I am at a complete loss to understand what is going on. Can someone help me with this?

2 REPLIES 2
Jack Peacock_2
Senior III

Check the USART status register for an error. Any RX error will halt DMA. Also check the DMA status register to see if the channel is enabled. Does the DMA count register change?

Never used the HAL but there's nothing wrong with USART RX and DMA in hardware. I've used it since the 'F103 came out. Nearly always it's a USART error if DMA stops, unless DMA is misconfigured.

Jack Peacock

Rogers.Gary
Senior II

Hey, thanks for answering!

I'm sending a string of 6 hex values. The device I am sending to replies back within 1.3ms. I see the data on a scope. The interrupt handler in the file "stm32l4xx_it.c" never triggers. If the interrupt never triggers, how can I check the register values except at that moment?

What about this now. I have a Nucleo-476 card. Same thing. generated the cubemx code for a regular interrupt. Well, the interrupt runs, but only once. Why? What could possible cause it to behave like this? What am I missing? What do I need to do in the interrupt ? Anything? Wow. Even if I call MX_USART1_UART_Init(); at the end of the function HAL_UART_RxCpltCallback, it still never runs. Sooooo frustrating.