2020-12-20 01:57 PM
Hi,
I'm trying to update the FW of the BLUENRG-M2SP module on my X-NUCLEO-BNRG2A1.
I'm using CubeMX with the X-Cube-BLE2.3.1.0 SW pack, together with the IFRStackUpdater application. The IFRStackUpdater works perfectly up to the point where the "Blue Flag" has to be reset, and consistently returns a status of 0x4A (bluenrg_2_utils.c: aci_hal_updater_reset_blue_flag()).
The clearing of the Blue Flag works, and so does the erasing , writing and checksum verification. I even added an additional check, where I read back every block of data that was written, and even this shows up with no errors.
I already tried to look what the 0x4A error code means and discovered it in the BlueNRG-1_2-DK 3.2.1:
In DTM_Updater.c, line 139:
#define BLUEFLAG_FAILED_OP ((uint8_t)0x4A)
It seems the error gets triggered by lines 406 and 407 in DTM_Updater.c
if (flash_sw_lock != FLASH_UNLOCK_WORD)
return ERROR;
Surely, if aci_hal_updater_erase_blue_flag() succeeds, aci_hal_updater_reset_blue_flag() should also succeed, in IFRStackUpdatercode (bluenrg_2_utils.c: program_device())?
Back to the firmware:
What I also find strange in DTM_Updater.c, is that the handling of an error on erasing and resetting of the BLUEFLAG, gets handled in different ways:
case CMD_UPDATER_ERASE_BLUEFLAG:
word_tmp = BLUE_FLAG_RESET;
if(flash_Write(BLUE_FLAG_FLASH_BASE_ADDRESS, (uint8_t *)&word_tmp, 4) == 0) {
event_buffer[EVT_BUFF_OFFSET[dtm_interface]+6] = BLE_STATUS_SUCCESS;
}
else {
event_buffer[4+6] = BLUEFLAG_FAILED_OP; <--------------------------
}
break;
case CMD_UPDATER_RESET_BLUEFLAG:
/* Write the blue flag */
word_tmp = BLUE_FLAG_SET;
if(flash_Write(BLUE_FLAG_FLASH_BASE_ADDRESS, (uint8_t *)&word_tmp, 4) == 0) {
event_buffer[EVT_BUFF_OFFSET[dtm_interface]+6] = BLE_STATUS_SUCCESS;
}
else {
event_buffer[EVT_BUFF_OFFSET[dtm_interface]+6] = BLUEFLAG_FAILED_OP; <----------
}
break;
One final piece of information is that aci_hal_get_updater_version returns a version == 6 and I am using the SPI interface at 1Mbit/s.
It will be much appreciated if anyone could tell me why the aci_hal_updater_reset_blue_flag() call always returns 0x4A.
Thanks.
2021-01-06 01:33 AM
Same here! Did you find the solution?
2021-01-08 11:29 PM
No, I didn't find a solution yet.
I however can bootload the module, and load a .bin file to it.
I ended up buying another X-NUCLEO-BNRG2A1 board and downloaded its memory via the bootloader and then uploaded it to the one that was messed up.
The problem seems to be that IFRStackUpdater's base address for loading the sw is probably wrong, but I'm still investigating.
It's a pity that there's no Linux support/tools for the BNRG series. :(