cancel
Showing results for 
Search instead for 
Did you mean: 

What is the correct procedure to replace the example UserApp in SBSFU with a different existing project in STM32CubeIDE (generated with CubeMX)?

BaxEDM
Associate

I have attempted the following:

-Build and tested a simple app, called TestApp with STM32CubeIDE/CubeMX, runs fine on itself (without SBSFU)

-Build and tested the SBSFU 2_images example, works fine.

-The TestApp runs on the same hardware as the SBSFU example and I want to replace the example SBSFU UserApp with the TestApp.

-To achieve this I copied all project settings from UserApp to TestApp.

-Modified postbuild.sh call to use the TestApp.bin instead

-Managed to build the SBSFU_TestApp.bin without errors

-Flashed SBSFU_TestApp.bin according to the SBSFU UserApp instructions

-SBSFU boots correctly and signals that the TestApp is started, but the TestApp does not run.

I suspect the problem lies in the STM32L475VGTx_FLASH.ld file. These differ quite a bit in the UserApp and in the TestApp. In the TestApp, CubeMX has generated it. I tried to replace that file in the TestApp with the one from UserApp, but then the TestApp also does not run anymore, even on itself, without SBSFU. What complicates things is that I also do not know how to debug an app that is running inside of SBSFU.

The TestApp is very small and does not use FreeRTOS, it only prints "Hello World" to the uart. If I can get this to work the next step is to change to my large app (FreeRTOS + OTA).

For now I'm lost. Already spent a few days on this without any luck, hope anyone here knows the best way to do this.

12 REPLIES 12
MBax.2
Senior

Just as a test, I changed my clock source to the HSI instead of the PLL. Now my application runs like it should, but I still have a problem. I need to use the PLL and apparently SBSFU was using it prior to calling my TestApp. So when my TestApp wants to reconfigure the PLL, this is not allowed for some reason and the TestApp hangs in an error handler.

I think most people use the PLL as source, so this should be a common problem for everyone that uses SBSFU? Is there a solution for this? Perhaps change SBSFU to use the HSI instead?

MBax.2
Senior

Thanks @Frantz LEFRERE (ST Employee) !

My small test program is now running. Next step is to do the same for my large FreeRTOS based program and see what I will run into. I came across some posts of people struggling with that. Fingers crossed.

SBSFU and the user application are 2 independent applications and each of them sets its clock configuration.

So basically, what you are trying to do is to reconfigure the PLL when switching from SBSFU to UserApp.

It is possible but to do so, you need to follow a specific sequence, you cannot modify the PLL settings right away.

Please have a look at this example:

https://github.com/STMicroelectronics/STM32CubeL4/tree/master/Projects/NUCLEO-L476RG/Examples/RCC/RCC_ClockConfig