mbed-os github
Dependencies: ADS1015 Faulhaber HTU21D_mod MS5837_potless Sensor_Head_RevB_3 USBDevice_dfu Utilsdfu beep
Fork of ARNSRS_testDFU by
Diff: main.cpp
- Revision:
- 54:2062e5786a66
- Parent:
- 53:84571a5e2cda
- Child:
- 55:6536e02d729e
diff -r 84571a5e2cda -r 2062e5786a66 main.cpp --- a/main.cpp Thu May 31 07:53:44 2018 +0000 +++ b/main.cpp Thu May 31 08:03:28 2018 +0000 @@ -161,7 +161,7 @@ void FLASH_set_boot_bank(int bank) { - HAL_DeInit(); + //HAL_DeInit(); FLASH_OBProgramInitTypeDef OBInit; /* Set BFB2 bit to enable boot from Flash Bank2 */ /* Allow Access to the Flash control registers and user Flash. */ @@ -172,6 +172,7 @@ HAL_FLASH_OB_Unlock(); /* Get the Dual boot configuration status. */ HAL_FLASHEx_OBGetConfig(&OBInit); + wait(1); /* Enable/Disable dual boot feature */ OBInit.OptionType = OPTIONBYTE_USER; @@ -185,12 +186,14 @@ break; } +HAL_FLASHEx_OBProgram (&OBInit); +wait(1); if(HAL_FLASHEx_OBProgram (&OBInit) != HAL_OK) { /* Failed setting the option bytes configuration. * Call 'HAL_FLASH_GetError()' for details. */ serialMonit.printf("Impossible de changer BFB2.\n"); - } + } else {serialMonit.printf("BFB2.\n");} HAL_FLASH_OB_Launch(); HAL_FLASH_OB_Lock(); @@ -879,6 +882,7 @@ UTILS::UnMount_Flash(); FLASH_set_boot_bank(2); OUTPUT(" Reboot...\r\n"); + while(1); //HAL_NVIC_SystemReset; }