AnsweredAssumed Answered


Question asked by korol.oleg on Oct 2, 2015
I have used CubeMX to generate initialization code for my application and met a problem.

CubeMX generates code for initialization all selected peripherals including FMC (SDRAM in my case) and LTDC, and places all code to main() function. So far, so good.

But there is no way to actually start SDRAM before LTDC will try to use it!

I know that it is common to start SDRAM in startup file and get it up and running before main() will be executed.

But, sorry! I was installed CubeMX to simplify my life, I selected all pins and timings in CubeMX interface, and I do not need to use SDRAM to anything except LTDC buffer.

I have no way to add SDRAM start routine to auto-generated code between FMC and LTDC initialization (it will be deleted after next re-generation) - and no user hooks allowed here.
I have no way to make FMC initialization in startup file - it will be re-initialized in main(), because I cannot disable FMC initialization without deleting  FMC from CubeMX project (and why I have to set all these parameters if all of them are useless)?

Now I manually adding my SDRAM startup routine in main() after EACH re-gererating code from CubeMX, what is VERY boring.

Maybe, it will be useful to add to CubeMX possibility to add:
 - or possibility to optionally disable init routines in CubeMX to some peripherals
 - or add user hook to HAL_SDRAM_Init() to allow actually start SDRAM before it will be used by next initialized peripheral
 - or add possibility to choose will it write FMC initialization to main() or to startup file

Or just add /* USER CODE */ segments at start and end of each _Init() function!
This will allow to modify/add almost anything inside it.

Maybe I missed some checkbox simewhere?
What should I do in my case?