cancel
Showing results for 
Search instead for 
Did you mean: 

How to stop the freertos scheduler and execute the code from while of main function?

AMull.11
Associate II

Hi Guys,

I am working on one of the project using STM32H743, where code will update from the UART.

The Application code is based on the FreeRTOS.

So, when I want to update the firmware i need to stop the FreeRTOS scheduler and get back to the while loop of main function.

I had tried with the vTaskEndScheduler() API, but still code is not coming to while loop of main function.

If any one knows please help me to solve this issue.

Any kind of help will be appreciated.

Thank You.

11 REPLIES 11
AMull.11
Associate II

Yeah I used vTaskSuspendAll also, but after doing this how to run one funtion from where I can update the TouchGFX assets I am not getting.

Do you update the firmware or datat only? Do you place that data on the same place and has the same length or it differs (including code)?

If you change the code, its absolutley recopmended to reste the system.

If you change data only, then you have to take care that the firmware will work if you change them without compiling the firmware.

If you are not 100.0% sure, then you have to reset the system else you need to start scheduler again and continue work.

I would do: When only data changed then check if the firmware has only eference to the first entry. Then it shure that the firmware can manage the data, even when its changed. I'm almost sure that the Grafik System cant do that. So you have to make a full update and then reset the system. But you cant update the system when you are running the same firmware (in same place). The technik you can use is the IAP (In Application Programming). You place your own boatloader at beginn or at end of the flash and you call the IAP manually. I mean you decide to update the code then you deinitialize everything and either call the IAP manually to update the code or you call the system bootloader. To manage this you can either save in a non volatile RAM area (Battery backupd RAM like RTC RAM) or a special area of normal RAM a special signature. Your Firmware checks this area and if it finds the signature, it starts the firmware update. Afterward this area will be cleared and reset the system. So is IAP working. If you want use the System boot programming its more complicated and need also hardware changes. Specially when the application decides to make update, is the system boot not useable.

You can find the IAP examples on ST web site. They are all using serial interface for update and not available for all MCUs but if you look at them, its very easy to change to another MCU or update to use another way or another protocol.