2024-03-12 07:34 AM
Hello,
I've implemented the solution proposed in https://github.com/MaJerle/stm32-usart-uart-dma-rx-tx?tab=readme-ov-file by @Tilen MAJERLE for efficiently using the DMA in circular mode with a buffer for the UART in a STM32L4 board.
I'm trying to port my driver to the M4 processor of a STM32MP157-DK2. I've successully configured the UART3 in the M4 project with DMA in normal mode and I'm receiving one byte at a time and adding them with the RxComplete callback to my buffer.
However, when I changed the DMA mode to circular, my surprise was that there is no HAL_UARTEx_ReceiveToIdle_DMA function in the HAL driver and no HAL_UARTEx_RxEventCallback callback. So I can use the RxComplete and RxHalfComplete callbacks but no idle line callback, which is a big problem when using a long circular buffer size.
Can anyone explain what is the problem, why there is no Idle line detection here or how can this feature be implemented for this board?
Thanks in advance.
Solved! Go to Solution.
2024-06-03 03:36 AM
Hello @bruno_b2s ,
As explained during the handling of your internal case, you can take reference from MP13 Uart HAL or H7 to add some HAL API's and use the implementation done by you by taking L4 example.
There is no Hardware limitation to the circular DMA feature, this is supported on STM32MP1.
Best Regards,
Kevin
2024-03-29 03:13 AM
Hi @bruno_b2s
An internal case #BZ176781 has been open to address this point
Will keep you posted
Olivier
2024-03-29 05:59 PM
Skip using the Circular buffer and implement your own buffer queue that you point the DMA to. That way you don't have to keep copying the data to another array. It's all done by the DMA. You can just use the half complete callback and not bother with Full Complete callback.
See this project which explains more about it
https://github.com/karlyamashita/Nucleo-G431RB_Three_UART/wiki
2024-04-03 05:34 AM
Thanks for your reply @Karl Yamashita. I think the problem is not setting the UART DMA in Normal or Circular mode - although in my opinion using circular mode helps saving CPU time. The problem is that with the generated code for a STM32MP157-DK2, I can't use HAL_UARTEx_ReceiveToIdle_DMA or HAL_UARTEx_RxEventCallback. They simply don't exist in the generated drivers.
I see in your wiki (very interesting by the way, I'm using a similar wrap-up but with less features, trying to imitate Arduino Serial), that you use these functions too. So my question to ST is @Olivier GALLIEN : why these functions are not there? how can I use the Idle callback without them?
Best regards,
Bruno
2024-06-03 03:36 AM
Hello @bruno_b2s ,
As explained during the handling of your internal case, you can take reference from MP13 Uart HAL or H7 to add some HAL API's and use the implementation done by you by taking L4 example.
There is no Hardware limitation to the circular DMA feature, this is supported on STM32MP1.
Best Regards,
Kevin