cancel
Showing results for 
Search instead for 
Did you mean: 

Bug? UART_DMA_callback not accessible when DMA not in circular-mode

BerndNW18
Associate II

Hi, I'm using CubeMX, Firmware STM32Cube_FW_F4_V1.24.2 with an STM32F411VET (DISCO). When I configure an UART for TX in DMA regular-mode (as opposed to circular-mode), the code in function

UART_DMATransmitCplt()

in file stm32f4xx_hal_uart.c at line 2540)

skips the callback function, if circular-mode is not set (see else in line 2557).

I believe this is a bug. If I'm using the code in a wrong way, please let me know.

I intend to send some data out, and when this is completed by the DMA in background, I want to set the gState to HAL_UART_STATE_READY in the huartx structure (because the driver doesn't do it by default). Only this way I can send more than once on the UART.

Greetings, Bernd

1 ACCEPTED SOLUTION

Accepted Solutions

In the non-circular version, after the DMA finished its job, the UART Transmit Complete Interrupt is enabled, and in that interrupt then the callback in question is called.

I don't Cube.

JW

View solution in original post

2 REPLIES 2

In the non-circular version, after the DMA finished its job, the UART Transmit Complete Interrupt is enabled, and in that interrupt then the callback in question is called.

I don't Cube.

JW

Jan, thank you for pointing out that UART's TCIE is activated in that case. I just didn't see it...

Turns out that CubeMX doesn't automatically activate the interrupt for UART, if one selects to use the DMA. Therefore, in that case the UART's interrupt isn't handled (because CubeMX doesn't implement the ISR - only the DMA-channel's ISR is implemented).

My solution was to simply tick the interrupt-option for the UART in Cube. Voila!

Thanks, Bernd