OTA2 Reliability for Battery-operated Wireless Devices - KBA231150

Version 2

    Version: **

     

    Translation - Japanese: バッテリー駆動のワイヤレスデバイスのOTA2信頼性 - KBA231150 - Community Translated (JA)

     

    To guarantee a reliable OTA2 operation for battery-operated wireless devices such as CYW43907 and CYW54907, it is recommended to check the battery level before executing the OTA2 extract operation.

     

    In /43xxx_Wi-Fi/apps/snip/ota2_extract/ota2_extract.c, the CHECK_BATTERY_LEVEL_BEFORE_OTA2_UPGRADE macro instructs the function to ensure that the battery level is checked before calling the OTA2 extract function. The battery level is checked using the platform_check_battery_level(CHECK_BATTERY_LEVEL_OTA2_UPGRADE_MINIMUM) function. You should customize this function according to your battery circuit design. It contains function calls to measure the battery level.

     

    CHECK_BATTERY_LEVEL_OTA2_UPGRADE_MINIMUM is a user-defined constant which indicates the minimum battery level necessary to perform an OTA2 operation. If the measured battery level is below this value, the platform_check_battery_level() function will return an error; the OTA2 extract operation will not proceed. The CHECK_BATTERY_LEVEL_BEFORE_OTA2_UPGRADE macro can be defined in wiced_defaults.h to enable this feature.

     

    The code snippet of ota2_extract.c is shown below. The macros and functions used for checking the battery-level are highlighted.

     

    void application_start( )

    {

        wiced_result_t              result;

        extractor_extract_result_t  extract_result;

        platform_dct_ota2_config_t  dct_ota2_config;

     

        /*

         * Initially:

         * We don't use the normal wiced_init(), as we don't want wiced_wlan_connectivity_init( ); unless we are running SoftAP

         * We don't use wiced_core_init(), as we don't want to use wiced_platform_init( ), as the filesystem may be invalid, and we don't want to assert

         */

    platform_init_external_devices();

     

        /* initialize DCT mutex */

    wiced_dct_init();

     

    OTA2_EXTRACT_PRINTF(("\r\nHi, I'm the OTA2 extraction app (ota2_extract).\r\n"));

     

        extract_result = EXTRACT_RESULT_OK;

     

        if ( ota2_extract_check_battery_level() != WICED_SUCCESS)

        {

            extract_result = EXTRACT_RESULT_ERROR_BATTERY_LOW;

        }

     

    The function definition of ota2_extract_check_battery_level() is shown below (also in ota2_extract.c):

     

    /* Returns WICED_ERROR if battery level considered too low */

    wiced_result_t ota2_extract_check_battery_level( void )

    {

    #ifdef CHECK_BATTERY_LEVEL_BEFORE_OTA2_UPGRADE

        /* check for battery level before doing large amount of writing */

        if (platform_check_battery_level(CHECK_BATTERY_LEVEL_OTA2_UPGRADE_MINIMUM) != WICED_SUCCESS)

        {

            /* check_battery_level() failed */

            return WICED_ERROR

        }

    #endif /* CHECK_BATTERY_LEVEL_BEFORE_OTA2_UPGRADE */

     

        return WICED_SUCCESS;

    }