Skip to main content
satyam9896
Associate III
October 15, 2024
Question

OTA implementation stm32l072

SO I HAVE STARTED MY PROJECT WITH STM32L072 SERIES WHICH IS HAVING 192B FLASH 64 PIN IC along with bluenrg-m2sa. my concern and doubt is regarding implementation of ota feature to stm32l072 ic which i never implemented and work on before and also the examples and other refrences are mostly availabe for L4 or F series IC so my request to give me and help me with appropriate resoures and file so that i can easily implement the ota feature to my project and can easily understand also.

This topic has been closed for replies.

21 replies

Andrew Neil
Super User
October 15, 2024

@satyam9896 wrote:

 PROJECT WITH STM32L072 ... along with bluenrg-m2sa. 


So which part's firmware are you trying to update - the STM32L072 or the BlueNRG ?

 

https://www.st.com/resource/en/application_note/an4657-stm32-inapplication-programming-iap-using-the-usart-stmicroelectronics.pdf

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
satyam9896
Associate III
October 15, 2024

i will update the stm32l0 ic only and using the bluenrg to recieve the hex or code from dedicated app if any.

Andrew Neil
Super User
October 15, 2024

@satyam9896 wrote:

 using the bluenrg to recieve the hex or code 


Strongly recommend that you do not send hex!

Writing a reliable hex decoder is non-trivial, and hex is very inefficient over the air.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
satyam9896
Associate III
October 15, 2024

okay so bin i will use however please help in implementation.

Andrew Neil
Super User
October 15, 2024

You've marked this as solved.

If it's not solved, you can un-mark the solution:

https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256#:~:text=If%20you%20accidentally%20chose%20the%20wrong%20post%20as%20solution%2C%20you%20can%20always%20revert%20this%20action%20by%20clicking%20%22Not%20the%20Solution%22

 


@satyam9896 wrote:

 please help in implementation.


Did you read the linked Application Note?

What have you tried so far?

Where are you stuck?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
satyam9896
Associate III
October 15, 2024

Sorry my bad. i did not that i hve marked it but anyways coming to the point linked app note so i have not seen that yet.

so far i have downloaded the project and tried to go through the given examples 

https://github.com/STMicroelectronics/fp-sns-allmems1/tree/main/Projects/STM32L476JG-SensorTile/Applications/ALLMEMS1

I just dont know how to start and from where to start.

 

Andrew Neil
Super User
October 15, 2024

Before looking at code, you should read the Application Note - to understand what the code is trying to achieve:

https://www.st.com/resource/en/application_note/an4657-stm32-inapplication-programming-iap-using-the-usart-stmicroelectronics.pdf

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
satyam9896
Associate III
October 15, 2024

but this application is saying programming using USART but my Aim to get the firmware updated via bluetooth communication. is that application will explain me about OTA ? and that tho using ble?

 

Andrew Neil
Super User
October 15, 2024

Any & every update scheme involves two parts:

  1. Transferring the data;
  2. Getting that data into the Flash.

The two are independent - you can substitute a different way to transfer the data without affecting the Flash programming.

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
satyam9896
Associate III
October 17, 2024

Hi, i checked the doc. and got to lknow about the basic flow. however i still need examples and refrences to start the basic ota implementation atleaste.

satyam9896
Associate III
October 21, 2024

Hi, I started with basic bootloader which will help to controller to jump from custum bootloader to application address which is at different location oviusly so that means it req two hex file which is suppose to be flash at different address but when im doint this its not working.. can you help me. i will share the snippet below 

this is bootloader code which will start at address 0x08000000 and its of 16KB.

main{

goto_application();

while(1){}

static void goto_application(void)
{
 // printf("Gonna Jump to Application\n");
  findbootMode=2;
  void (*app_reset_handler)(void) = (void*)(*((volatile uint32_t*) (0x08004000 + 4U))); //Given 16KB to Application
 
  // Turn OFF the Green Led to tell the user that Bootloader is not running
  
  /* Reset the Clock */
  HAL_RCC_DeInit();
  HAL_DeInit();
  __set_MSP(*(volatile uint32_t*) 0x08004000);
  SysTick->CTRL = 0;
  SysTick->LOAD = 0;
  SysTick->VAL = 0;
findbootMode = 3;
  
  /* Jump to application */
  app_reset_handler();    //call the app reset handler
}

}

 

using the address 0x08004000 for application 

 

 

now for application i did nothing but changes the vect table offset value

#define VECT_TAB_OFFSET 0x08004000U

and toggling the variable values if it enters successfully

main(){

while(1){

findbootMode=5;
HAL_Delay(2000);
findbootMode=6;
HAL_Delay(2000);}

}

Andrew Neil
Super User
October 21, 2024
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
satyam9896
Associate III
October 22, 2024
Hi, I started with basic bootloader which will help to controller to jump from custum bootloader to application address which is at different location oviusly so that means it req two hex file which is suppose to be flash at different address but when im doint this its not working.. can you help me. i will share the snippet below 

this is bootloader code which will start at address 0x08000000 and its of 16KB.

main{

goto_application();

while(1){}

static void goto_application(void)
{
 // printf("Gonna Jump to Application\n");
 findbootMode=2;
 void (*app_reset_handler)(void) = (void*)(*((volatile uint32_t*) (0x08004000 + 4U))); //Given 16KB to Application
 
 // Turn OFF the Green Led to tell the user that Bootloader is not running
 
 /* Reset the Clock */
 HAL_RCC_DeInit();
 HAL_DeInit();
 __set_MSP(*(volatile uint32_t*) 0x08004000);
 SysTick->CTRL = 0;
 SysTick->LOAD = 0;
 SysTick->VAL = 0;
findbootMode = 3;
 
 /* Jump to application */
 app_reset_handler(); //call the app reset handler
}
}

 

using the address 0x08004000 for application 

 

 

now for application i did nothing but changes the vect table offset value

#define VECT_TAB_OFFSET 0x08004000U

and toggling the variable values if it enters successfully

main(){

while(1){

findbootMode=5;
HAL_Delay(2000);
findbootMode=6;
HAL_Delay(2000);}

}
satyam9896
Associate III
October 22, 2024

now im able to jumb from custome bootloader to app VEC Table  but i need reference code how to advertise therough BLE and get the firmware image and also bootloader shall help to flash the new image at specific location.

MM..1
Super User
October 22, 2024

OTA for MCUs without air connection isnt basic task, and i mean not exist sample for this. I only can explain how i test:

1. My aplication have BT module connected RX TX to STM on pins supported with system bootloader AN2606

2. In my app after some special operation code config module BT to SPP passthrough with even parity as require AN2606 ... no own bootloader required ... i jump into system bootloader here

3. Use phone with SPP and App for upgrade OTA

I dont test BLE , but apk support it , your job is prepare BLE SPP pass...

satyam9896
Associate III
October 22, 2024

i understand all your point however there was sensor app example in cube mx i generated that and i got the code ..im facing some issue while advertisement as it is some time advertise somtime not..but i will see that ..

but what i need is to know which charcterstic and services are req to advertise and enable the sensor application and alsoo alow firmware image recieve part.