2021-08-31 08:28 AM
The MX generated C code issues the USART initiation call before the DMA initiation call. My code simply echoes back any text received by the USART. Unfortunately the echoed data (correct length) is all zeros. The UART read buffer is initialised with zeros.
The issue is resolved by simply placing the DMA initiation call before the USART initiation call!
What’s going on? Looks like the DMA code upsets something set by the USART code, but what?
Solved! Go to Solution.
2021-09-01 02:06 AM
Ahhh, reading the link you sent at the beginning "BUG: CubeMX/CubeIDE ignores changes in initialization order" it appears that I should have gone into the MX project manager->advanced settings to change the order. After moving the DMA init() behind the USART init() and re-generating the code the init sequences are then in the correct order. Is this something the programmer has to have knowledge of - the correct order of the MX initialisation functions? Wow!!
2021-09-01 11:27 AM
Our files are identical except for this line, which appears to dictate the initialization order:
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_ETH_Init-ETH-false-HAL-true,4-MX_USART3_UART_Init-USART3-false-HAL-true,5-MX_DMA_Init-DMA-false-HAL-true,6-MX_USB_OTG_HS_USB_Init-USB_OTG_HS-false-HAL-true,0-MX_CORTEX_M7_Init-CORTEX_M7-false-HAL-true
> Is this something the programmer has to have knowledge of - the correct order of the MX initialisation functions?
It wouldn't hurt, but CubeMX should generate it correctly. Not sure why the behavior is different between our systems.
2021-09-01 11:49 AM
Well I think that you've taken it as far as is possible, TDK, thank you; and for introducing me to a more detailed look at the MX configurator, as well as providing an explanation of a rather time-consuming and infuriating puzzle.
2021-09-01 11:15 PM
So, in conclusion, am I correct in understanding you to say that (presumably) on Windows, using the latest version of CubeIDE a programmer setting up a DMA USART receive capability does not have to concern herself with the intricacies of the operation as the code generator recognises this and ensures the DMA initialisation precedes that of the USART?
2021-09-01 11:23 PM
2021-09-01 11:27 PM
Agreed!
2021-09-06 09:27 AM
I’ve been using another board recently (rather than my Nucleo-H723ZG). This board, a Nucleo-H743ZI2, does not present any initialisation sequence error when using USART with DMA.