cancel
Showing results for 
Search instead for 
Did you mean: 

OTA implementation stm32l072

satyam9896
Associate II

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.

21 REPLIES 21

Try start with read AN2606 and StmDfuUsb - Stm32 flashing - Apps on Google Play

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 II

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 II
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);}

}

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.

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 wrote:

 i need reference code how to advertise through BLE ...


Again, this is a separate issue from firmware update.

The way you get your BLE device to do advertising is entirely unrelated to the firmware update part.

So look for examples which just deal with advertising.

Get that working, and then integrate into your system

 


@satyam9896 wrote:

... and get the firmware image ... 


Again, as far as the BLE is concerned, it's all just data - you just need to look for examples of transferring data.

 


@satyam9896 wrote:

... also bootloader shall help to flash the new image at specific location.


And the bootloader neither knows nor cares how the data was transferred.

satyam9896
Associate II

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.

my ble is connected through SPI protocol to stm32..im using one of the ble sensor application example code which is availabe in cube mx ..i generated that and able to advertise the local name however i want to know which services and characterstics are req to generate the name in air and also which characterstics are used to alow OTA feature on sensor app so that i will write my know project just for OTA recive and ignore the other sensor feature availabe.