2019-12-01 01:28 PM
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
Solved! Go to Solution.
2019-12-02 02:27 AM
in MX, in the Project Manager->Advanced Settings, you have a table "Generated Function Calls" with each init function listed in order of creation.
In fact, it may not be always visible (it has already been reported), but at the bottom of this box, that can be a bit far from the end of the table, need to
use the scrollbar, you will find some buttons to move up/down the selected line in the list to change the ordering.
2019-12-01 02:26 PM
This is an already known bug in CubeMX, try to search here on forum.
JW
@Amel NASRI , wouldn't it be worth putting up a sticky post regarding this issue?
2019-12-01 02:33 PM
thanks! I did search a bit but didnt find it :( I also looked in the release notes, not there either.
is there a workaround?
2019-12-02 02:27 AM
in MX, in the Project Manager->Advanced Settings, you have a table "Generated Function Calls" with each init function listed in order of creation.
In fact, it may not be always visible (it has already been reported), but at the bottom of this box, that can be a bit far from the end of the table, need to
use the scrollbar, you will find some buttons to move up/down the selected line in the list to change the ordering.