PSoC®/PRoC™ BLE Upgradable Stack OTA Project Gets Stuck in Launcher Project if Frequently Powered ON and OFF - KBA219824

Version: **

 

Question:

Use the PSoC or PRoC BLE chip with 256K flash and merge the upgradable stack OTA with the application project. If frequently powered on and off, the project gets stuck in the launcher project and flash is corrupted. How do I solve this issue?

 

Answer:

This is caused because of bootloader writes to metadata each time during startup even if the same data is already in flash. A flash write requires stable power for device Vdd and Vss pins. To avoid bootloader write to metadata during startup if the same data is already in flash, change the line from 2812 to 2828 in the Launcher.c file to the following code, which will check if the same data is already in flash before writing to flash. The bootloader V1.5 or lower version have the issue; this will be fixed in a future version. 

if (rowData[address % CYDEV_FLS_ROW_SIZE] != runType)

    {

        rowData[address % CYDEV_FLS_ROW_SIZE] = runType;

        #if(CY_PSOC4)

        (void) CySysFlashWriteRow((uint32) rowNum, rowData);

    #else

        (void) CyWriteRowData(arrayId, rowNum, rowData);

    #endif  /* (CY_PSOC4) */

    #if(CY_PSOC5)

        /***************************************************************************

        * When writing to flash, data in the instruction cache can become stale.

        * Therefore, the cache data does not correlate to the data just written to

        * flash. A call to CyFlushCache() is required to invalidate the data in the

        * cache and force fresh information to be loaded from flash.

        ***************************************************************************/

        CyFlushCache();

    #endif /* (CY_PSOC5) */

    }