2023-11-09 08:13 AM
Hello, I'd like to better understand some settings in CubeMX to be sure default settings are OK for my application.
Starting with USART2 Configuration for example:
- in "DMA Settings" tab, what behavior is modified by the Priority dropdown (Low, Medium, High, Very High)?
- in "Parameter Settings", what exactly mean "Overrun" (Disable/Enable) and "DMA on RX Error" (Disable/Enable)
- etc.
Thank you for pointing me the existing (hopefully) documentation 🙂
Thomas
Solved! Go to Solution.
2023-11-13 03:28 AM
Hello @Thomas LB ,
Thank you for updating the post and I apologize that my last comment didn't answer your request.
The DMA priority is described in the reference manual and precisely in Section 11.4.3 DMA arbitration Section and Figure 27. DMA request mapping.
The DMA arbiter manages the priority between the different channels. When an active channel x is granted by the arbiter (hardware requested or software triggered), a single DMA transfer is issued (such as a AHB ‘read followed by write’ transfer of a single data). Then, the arbiter considers again the set of active channels and selects the one with the highest priority. If two requests have the same software priority level, the channel with the lowest index gets priority. For example, channel 2 gets priority over channel 4.
For more overrun and DMA on Reception Error, I suggests you to refer to the same reference manual and precisely section 29 Universal synchronous/asynchronous receiver transmitter (USART/UART) Section.
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-10 02:47 AM - edited 2023-11-10 02:49 AM
Hello @Thomas LB ,
For UART example, I recommend you to take a look to Getting started with UART wiki article.
This article explains what is UART and how to use it through examples.
These examples are configured using STM32CubeMX.
Also, I think the available USART examples compatible with STM32CubeMx can help you.
I hope this answer your request.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-13 02:01 AM
Hello,
No this does not answer my request at all :(
This documentation is very useful to start something working but still many options configurable in cubeMx that are not described is this tutorial.
If such documentation does not exist can you answer my question directly?
USART2 Configuration for example:
- in "DMA Settings" tab, what behavior is modified by the Priority dropdown (Low, Medium, High, Very High)?
- in "Parameter Settings", what exactly mean "Overrun" (Disable/Enable) and "DMA on RX Error" (Disable/Enable)
2023-11-13 03:28 AM
Hello @Thomas LB ,
Thank you for updating the post and I apologize that my last comment didn't answer your request.
The DMA priority is described in the reference manual and precisely in Section 11.4.3 DMA arbitration Section and Figure 27. DMA request mapping.
The DMA arbiter manages the priority between the different channels. When an active channel x is granted by the arbiter (hardware requested or software triggered), a single DMA transfer is issued (such as a AHB ‘read followed by write’ transfer of a single data). Then, the arbiter considers again the set of active channels and selects the one with the highest priority. If two requests have the same software priority level, the channel with the lowest index gets priority. For example, channel 2 gets priority over channel 4.
For more overrun and DMA on Reception Error, I suggests you to refer to the same reference manual and precisely section 29 Universal synchronous/asynchronous receiver transmitter (USART/UART) Section.
Thank you.
Kaouthar
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-11-13 04:39 AM - edited 2023-11-13 04:41 AM
Re. " what exactly mean "Overrun" (Disable/Enable) and "DMA on RX Error" (Disable/Enable)":
The U(S)ARTs can detect the condition when new receive byte arrives before the software reads the previous received byte from the RX data register. This is called overrun. By default U(S)ART then stops receiving until software acknowledges this and clears the overflow flag. This behavior is generally good, but complicates the software. Often developers prefer that the UART ignores the overrun, drops the previous byte and just keeps receiving. The error is handled somewhere else (for example, by verifying checksum on received data records). So in newer STM32 MCUs, the U(S)ARTs have option to disable detection of overrun.
2023-11-15 06:02 AM
Thank you both for detailed explanation!
Do you recommend setting different priority for DMA RX and TX so that they don't mess with each other?
@KDJEM.1 the reference manual is way more complicated that the fancy CubeMX GUI ^^ it's a shame that some options are not detailed enough so that we don't have to dig into the reference manual as non-expert :\
@Pavel A. Thank you, this "Overrun" thing was pretty clear to me. The behavior of the Enable/Disable was not: if I set "Overrun" to "Disable" in CubeMX it means it doesn't stop right? Could be misleading 🙂
Regarding "DMA on RX Error" it's also unclear, I've found that it stops the DMA on RX error if it's set to Enable but I'm not sure what's the most robust way to use it and configure the HAL_UART_ErrorCallback() accordingly after. Any advice?
Thank you,
Have a good day,
2023-11-15 10:04 AM - edited 2023-11-15 11:54 AM
> if I set "Overrun" to "Disable" in CubeMX it means it doesn't stop right?
If you set "Overrun" to "Disable", overrun won't be detected and won't be one of reasons to stop the show. (other UART RX errors such as format error still are detected).
The well known UART DMA examples by Tilen Majerle show the robust method. Directly from the ST expert.