code generated calls MX_DMA_Init too late, after MX_SPI_Init
I'm a relatively new user but am just about getting up to speed with STM32 family and STM32CubeIDE. I love that there is a gui that helps to generate code to configure peripherals, however I am learning to distrust some of the detals of the code generation :(
One that just cost me a few hours of head scratching:
I was setting up an STM32L4R5ZI (nucleo) board as a full duplex SPI slave, and had configured all the pins & settings correctly. Blocking mode HAL_SPI_TransmitReceive was working, but when I configured DMA and used the _DMA variant of the function, I could not get any of the DMA complete interrupts or callbacks to fire.
I compared my code over and over again to an example, until I randomly looked at the initialization code that Cube had generated for me, which included this block:
MX_GPIO_Init();
MX_LPUART1_UART_Init();
MX_USART3_UART_Init();
MX_USB_OTG_FS_PCD_Init();
MX_SPI1_Init();
MX_DMA_Init();
I found that if I moved the DMA_Init line before the SPI Init line, everything worked as expected.
However, every time I regenerate code, it moves the DMA init back to the bottom.
I am guessing this is a bug in the cube code generation? certainly as a new user of this platform, i'm not confident to point fingers; but it's frustrating that it gives the appearance of a helpful platform, but bugs like this really stop you from making progress, as you question everything first :(
What can I do to force STMCube to move the DMA_Init line earlier?
and if this is a bug, how quickly are these sorts of things typically fixed? what should I do in the meantime?
Thanks!
I appreciate
