STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
498 stars 305 forks source link

UART: No DMA Full Interrupt with DMA Receive to Idle mode #255

Closed Meravid closed 1 year ago

Meravid commented 1 year ago

Caution The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum

Describe the set-up

Describe the bug With DMA receive to idle mode no interrupt is triggered if the DMA buffer is completely full. This means, if your DMA buffer is 100 bytes large and already 80 bytes were received the reception of additional 20 bytes will trigger no interrupt. If you would receive 19 or 21 bytes instead of 20 bytes there is one triggered.

How To Reproduce

  1. Indicate the global behavior of your application project Receiving messages with arbitrary length via UART in combination with DMA.

  2. The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...) The condition in Drivers\STM32H7xx_HAL_Driver\Src\stm32h7xx_hal_uart.c is not correct. On the left side of the following screenshot the original condition is shown. On the right side is a possible bug fix shown. grafik

  3. The use case that generates the problem Reception of UART message with DMA Receive to Idle mode, so that the DMA buffer is completely filled.

  4. How we can reproduce the problem

Additional context If you have a first analysis or patch correction, thank you to share your proposal.

Screenshots If applicable, add screenshots to help explain your problem.

ASELSTM commented 1 year ago

Hi @Meravid,

Indeed, the HAL_UARTEx_RxEventCallback() is a Rx event notification called after use of advanced reception service, it is called each time a data is received. In the case of DMA receive to idle mode, in the end of transfer the HAL_UARTEx_RxEventCallback() is called as part of the DMA transfer complete callback.

Consequently, once the DMA UART receive process is complete, the transfer complete interrupt is triggered, and UART_DMAReceiveCplt() is called which in turn calls HAL_UARTEx_RxEventCallback() .

https://github.com/STMicroelectronics/STM32CubeH7/blob/ed7d3d4a8e0961ad2bcb21ba7681d5443964253c/Drivers/STM32H7xx_HAL_Driver/Src/stm32h7xx_hal_uart.c#L3738-L3747

With regard,

ASELSTM commented 1 year ago

Hi @Meravid,

Please allow me to close this thread as no activity. You may reopen it at anytime if you have any details to share with us in order to help you to solve the issue. Thank you for your comprehension.

With regards,