cancel
Showing results for 
Search instead for 
Did you mean: 

BLE_Ota for large files keeps failing

CHossack
Associate III

Hi,

I’m trying to implement OTA using the example software and hardware below. But it seems very unreliable.

  • STM32Cube_FW_WB_V1.7.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE
    • BLE_Ota
    • BLE_p2pServer_ota
    • Compiled with IAR  for ARM 8.50
  • STM32CubeProgrammer API v2.4.0
  • STM32CubeMonitor-RF Version 2.5.0
  • STM32WB55 Nucleo Pack
    • Nucleo board 
      • PNWB55$CU3
    • USB Dongle

I programmed BLE_Ota.out and BLE_p2pServer_ota.out into the P-NUCLEO-WB55 using the STM32CubeProgrammer and verified the green LED is flashing indicating RF messages.

I then used the STM32CubeMonitor-RF with the USB dongle and Nucleo board about 5 cm apart.

And then I tried to perform an OTA update. I found mostly it worked, but sometimes it failed. When it failed, the flash memory at 0x08007000 was all FFs (which is where the new application should be located). I added a break point to BLE_Ota and verified this was due to an invalid magic number (0x94448A29).

When you create a build the address of the last word in your image is stored at offset 140 in your file. The last word should contain the magic value 0x94448A29 for the BLE_OTA to assume the OTA worked correctly.

But when it failed I noticed the magic number was actually located early on in memory. It seems a BLE packet is lost somewhere so the magic number isn’t placed at the correct location.

Since my code is a bit bigger I added some padding to simulated my larger file

Main.c

/* USER CODE BEGIN PTD */
#define p16 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
#define p256 p16,p16,p16,p16,p16,p16,p16,p16,p16,p16,p16,p16,p16,p16,p16,p16
#define p4k p256,p256,p256,p256,p256,p256,p256,p256,p256,p256,p256,p256,p256,p256,p256,p256
#define p64k p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k,p4k
const uint8_t padding[] = {p64k,p64k};
uint8_t const * paddingPtr;
/* USER CODE END PTD */
 
:
 
  /* USER CODE BEGIN 1 */
  paddingPtr= &padding[sizeof(padding)-1];
  /* USER CODE END 1 */

With this new larger file I can never get the OTA to work. So it looks likes the OTA is too unreliable to work successfully... or am I doing something wrong?

Thank you for your help

Chris

10 REPLIES 10
CHossack
Associate III

Hi All,

just to let you know all of the required changes has been added to at least version STM32Cube_FW_WB_V1.12.1.

But they have rename EVT_BLUE_GATT_WRITE_PERMIT_REQ to ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE to keep up with their naming convention.

cheers

Chris