cancel
Showing results for 
Search instead for 
Did you mean: 

Hardfault error (STM32F746G) when generating project with cubeMx

Zui
Senior

Hello

i'm using STM32F746G with touchGfx and keil for a project. i have a working empty project (a blank screen with a button). but when i regenerate the project with cubeMX checking the option :"generate peripheral initialization as a pair of '.c/.h/' files per peripheral" i get HardFault Handler. My keil caller stack say is caused by: touchgfx_init ->setLanguage ->hardFault_Handler

28 REPLIES 28
EEuge
Senior

Dear Zui! Have you enabled memory mapped mode for QSPI?

Try to add BSP_QSPI_EnableMemoryMappedMode(); after QSPI initialisation.

looked at that, all was said in that post i've already tryed, still not working =(

Can I see your project?

Michael K
Senior III

Hi, I'm going to necro-bump this topic because I somewhat randomly came across it again. I think this happens because for some reason when you check the peripheral pair box and regenerate, CubeMX removes code within User Code labels, including that which is responsible for setting up DSI, LTDC, QSPI and FMC in certain TouchGFX application templates, fyi @Martin KJELDSEN​ .

Here's my Git diff after checking the box, generating, and then unchecking the box then generating again. Red lines denote removals that occurred after the first generation, and persisted after the second. The whole list is about twice as long as shown in the screenshot. @Imen DAHMEN​ this is a fairly serious issue with CubeMX that should get another look. Using CubeIDE 1.6.0 with CubeMX plugin Version: 6.2.0-RC3.0693W00000BdJuFQAV.png

Embedded UI/UX Consulting: cadenza.design

That looks scary. I haven't come across this issue in Stand alone CubeMX. Have you tried CubeIDE 1.6.1 plugin? It probably uses CubeMX 6.2.1 (latest official).

Just tried it with standalone CubeMX 6.2.1 and it does the same thing.

Embedded UI/UX Consulting: cadenza.design

Lot of persistent complaints on the forum, perhaps some subtle whitespace, or CR/LF anomalies. Really need to get this stuff root-caused, and a thorough QA test-set..

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi @Michael K​

I created a ticket for the STM32CubeMX team, could you tell me exactly what box you checked/unchecked so that I can try to replicate it and share my project to them ?

Could you share your settings in the "Code Generator" section in the "Project Manager" tab ?

/Romain

I'm still trying to understand what you are trying to do as well. From what the CubeMX team told me the "Generate peripheral initialization as a pair of .c/.h files" option is not moving sections from the already generated initialization files but rather re-initializing peripheral in the main.c file ( the already .c peripheral initialization files will be removed). So the changes in User code related to peripheral initialization will not be moved nor saved, but the user sections that are not related to periphel initialization will be kept. (quite annoying to be honest since if you click it out of curiosity you just get rid of your code without realizing it :grinning_face_with_sweat:)

/Romain