This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to enable Minimum Block Request ?

Hi,

To support the large and dense networks we are building, I need my network coordinator to be able to throttle OTA packets to not completely overtake the network’s bandwidth and cause dropped data packets.To achieve this, I use the Minimum Block Request and Dynamic Block Request option for Zigbee OTA. For the end device to support this feature, I need the Minimum Block Request Period attribute enabled.But I don't know how to operate it? I haven't found any relevant examples.

  • Hi

    nRF5_SDK_for_Thread_and_Zigbee_v4.1.0_32ce5f8/examples/zigbee/ota/client/pca10056

    I made the following changes:

    m_dev_ctx.ota_attr.min_block_reque = 60; /m_dev_ctx.ota_attr.min_block_reque = 300;

    But ‘’MinimunBlockPeriod‘’ has not changed

    Do you have a solution to this problem? Or do you not understand my proposition?

  • Things get a bit messy when we reply to comments that are not the latest one, so I'll reply in this one, so it is the one on the bottom.

    I am sorry you feel that way. I am truly trying to help, and trust me, if I knew how to solve this with a one-liner, I would tell you.

     

    Edvin said:
    Do you do it inside ota_client_attr_init()? Or somewhere else?

     The reason I asked this is because I don't know where you are trying to adjust this parameter. Is it inside ota_client_attr_init(), and is ota_client_attr_init() called before you start the zboss stack (zboss_start_no_autostart())? I needed to ask this because I don't know what modifications you have done to the application. If I do this, it wouldn't have any effect (see bottom line)

    ...
    static void ota_client_attr_init(void)
    {
        /* Basic cluster attributes data */
        m_dev_ctx.basic_attr.zcl_version  = ZB_ZCL_VERSION;
        m_dev_ctx.basic_attr.power_source = ZB_ZCL_BASIC_POWER_SOURCE_UNKNOWN;
    
        /* OTA cluster attributes data */
        zb_ieee_addr_t addr = ZB_ZCL_OTA_UPGRADE_SERVER_DEF_VALUE;
        ZB_MEMCPY(m_dev_ctx.ota_attr.upgrade_server, addr, sizeof(zb_ieee_addr_t));
        m_dev_ctx.ota_attr.file_offset = ZB_ZCL_OTA_UPGRADE_FILE_OFFSET_DEF_VALUE;
        m_dev_ctx.ota_attr.file_version = s_dfu_settings.app_version;
        m_dev_ctx.ota_attr.stack_version = ZB_ZCL_OTA_UPGRADE_FILE_HEADER_STACK_PRO;
        m_dev_ctx.ota_attr.downloaded_file_ver  = ZB_ZCL_OTA_UPGRADE_DOWNLOADED_FILE_VERSION_DEF_VALUE;
        m_dev_ctx.ota_attr.downloaded_stack_ver = ZB_ZCL_OTA_UPGRADE_DOWNLOADED_STACK_DEF_VALUE;
        m_dev_ctx.ota_attr.image_status = ZB_ZCL_OTA_UPGRADE_IMAGE_STATUS_DEF_VALUE;
        m_dev_ctx.ota_attr.manufacturer = OTA_UPGRADE_TEST_MANUFACTURER;
        m_dev_ctx.ota_attr.image_type = OTA_UPGRADE_TEST_IMAGE_TYPE;
        m_dev_ctx.ota_attr.min_block_reque = 0;
        m_dev_ctx.ota_attr.image_stamp = ZB_ZCL_OTA_UPGRADE_IMAGE_STAMP_MIN_VALUE;
    }
    ...
    int main(void)
    {
        zb_ret_t       zb_err_code;
        zb_ieee_addr_t ieee_addr;
        ret_code_t     err_code;
    
        /* Initialize timers, logging and LEDs */
        timers_init();
        log_init();
        bsp_board_init(BSP_INIT_LEDS);
    
        /* Set Zigbee stack logging level and traffic dump subsystem. */
        ZB_SET_TRACE_LEVEL(ZIGBEE_TRACE_LEVEL);
        ZB_SET_TRACE_MASK(ZIGBEE_TRACE_MASK);
        ZB_SET_TRAF_DUMP_OFF();
    
        /* Initialize the Zigbee DFU Transport */
        zb_dfu_init(OTA_ENDPOINT);
    
        /* Initialize the attributes */
        ota_client_attr_init();
    
        /* Initialize Zigbee stack. */
        ZB_INIT("ota_client");
    
        /* Set device address to the value read from FICR registers. */
        zb_osif_get_ieee_eui64(ieee_addr);
        zb_set_long_address(ieee_addr);
    
        /* Set static long IEEE address. */
        zb_set_network_router_role(IEEE_CHANNEL_MASK);
        zb_set_max_children(MAX_CHILDREN);
        zigbee_erase_persistent_storage(ERASE_PERSISTENT_CONFIG);
        zb_set_keepalive_timeout(ZB_MILLISECONDS_TO_BEACON_INTERVAL(3000));
    
        /* Register OTA Client device context (endpoints). */
        ZB_AF_REGISTER_DEVICE_CTX(&ota_upgrade_client_ctx);
    
        /* Register callback for handling ZCL commands. */
        ZB_ZCL_REGISTER_DEVICE_CB(zcl_device_cb);
    
        /* Initialize Periodic OTA server discovery */
        err_code = zb_zcl_ota_upgrade_client_with_periodical_discovery_init(&m_discovery_ctx, &m_ota_server_discovery_timer, OTA_ENDPOINT);
        APP_ERROR_CHECK(err_code);
    
        zb_err_code = zboss_start_no_autostart();
        ZB_ERROR_CHECK(zb_err_code);
        
        m_dev_ctx.ota_attr.min_block_reque = 60;    //<-- This line has no effect.

     

    Jiuping Li said:

    m_dev_ctx.ota_attr.min_block_reque = 60; /m_dev_ctx.ota_attr.min_block_reque = 300;

     Out of curiousity, do you see any difference between 0 and 60? 0 and 300? Did you see my comment regarding the ZB_CONFIG_APS_DUPS_TABLE_SIZE ?

    The reason I ask these simple questions is that I don't have any way to measure this myself, while apparently you have. I am sorry, but that means I rely on you to do some work and testing as well.

  • I've been looking forward to your reply for a long time. I'm very glad to receive it today. Please let's continue with this question, OK?The following is my revised part(However, this parameter does not cause any change during OTA):


    static void ota_client_attr_init(void)
    {
        /* Basic cluster attributes data */
        m_dev_ctx.basic_attr.zcl_version  = ZB_ZCL_VERSION;
        m_dev_ctx.basic_attr.power_source = ZB_ZCL_BASIC_POWER_SOURCE_UNKNOWN;
    
        /* OTA cluster attributes data */
        zb_ieee_addr_t addr = ZB_ZCL_OTA_UPGRADE_SERVER_DEF_VALUE;
        ZB_MEMCPY(m_dev_ctx.ota_attr.upgrade_server, addr, sizeof(zb_ieee_addr_t));
        m_dev_ctx.ota_attr.file_offset = ZB_ZCL_OTA_UPGRADE_FILE_OFFSET_DEF_VALUE;
        m_dev_ctx.ota_attr.file_version = s_dfu_settings.app_version;
        m_dev_ctx.ota_attr.stack_version = ZB_ZCL_OTA_UPGRADE_FILE_HEADER_STACK_PRO;
        m_dev_ctx.ota_attr.downloaded_file_ver  = ZB_ZCL_OTA_UPGRADE_DOWNLOADED_FILE_VERSION_DEF_VALUE;
        m_dev_ctx.ota_attr.downloaded_stack_ver = ZB_ZCL_OTA_UPGRADE_DOWNLOADED_STACK_DEF_VALUE;
        m_dev_ctx.ota_attr.image_status = ZB_ZCL_OTA_UPGRADE_IMAGE_STATUS_DEF_VALUE;
        m_dev_ctx.ota_attr.manufacturer = OTA_UPGRADE_TEST_MANUFACTURER;
        m_dev_ctx.ota_attr.image_type = OTA_UPGRADE_TEST_IMAGE_TYPE;
        m_dev_ctx.ota_attr.min_block_reque = 30;//here ...^_^
        m_dev_ctx.ota_attr.image_stamp = ZB_ZCL_OTA_UPGRADE_IMAGE_STAMP_MIN_VALUE;
    }

    Is the following part your advice to me? I don't quite understand. I just want to confirm with you

    /* Initialize Periodic OTA server discovery */
        err_code = zb_zcl_ota_upgrade_client_with_periodical_discovery_init(&m_discovery_ctx, &m_ota_server_discovery_timer, OTA_ENDPOINT);
        APP_ERROR_CHECK(err_code);
    
        zb_err_code = zboss_start_no_autostart();
        ZB_ERROR_CHECK(zb_err_code);
        
        m_dev_ctx.ota_attr.min_block_reque = 60;    //<-- This line has no effect.

  • Jiuping Li said:
    Is the following part your advice to me?

     No. I wanted to make sure that you didn't do that. you need to set it in the initialization, before the zboss stack is started.

     

    Jiuping Li said:
    (However, this parameter does not cause any change during OTA

     What is your OTA server? Is it sending packets faster than the min_block_reques? Or is it perhaps already slow enough that this doesn't affect the speed?

    Again, I am sorry for the late reply. I have been out of office (vacation), and I will be on a leave a week from now. I will reassign this ticket before I go on that leave, if it is not yet solved.

    I believe the OTA server in nrfutil is slower than 30ms per packet. Are you using the nrfutil OTA server to send the firmware upgrade?

    If not, what are you using? And are you sure that this device is following the specification? Does it work with other devices that has set the minimum block request?

    Best regards,

    Edvin

Related