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

How to enter DFU mode with SR3v1.2

Hi, 

I'm tring to enter DFU mode by combo keys by KEY_COMBO_TWO_KEY_REGISTER().

In v1.1, I used m_pwr_mgmt_shutdown(M_PWR_MGMT_SHUTDOWN_TYPE_DFU) to enter DFU mode directly. 

Now it is not work anymore, and I  find that there is a function called  static void m_coms_ble_dfu_fs_evt_handler(nrf_fstorage_evt_t *p_evt) in M_coms_ble_dfu.c  references  nrf_pwm_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU), and has some works before nrf_pwm_mgmt_shutdown(), I guess it is for buttonless dfu mode .

I want to ask 2 questions :

1. What is fstorage event handler: m_coms_ble_dfu_fs_evt_handler?  how can I use it properly? 

2. Can I use simpler way as before in sr3v1.1 to activate DFU instead of using m_coms_ble_dfu_fs_evt ? 

Thanks.

Ralph

Parents
  • Hi Ralph, 

    the Smart Remote v1.2 firmware supports peer data sharing,i.e. it stores the peer address and encryption keys in to flash settings page so that the bootloader can use it to re-connect to the central after the reset to enter DFU mode. Writing to flash is asynchronous so the m_coms_ble_dfu_fs_evt_handler is there to ensure that the peer data is correctly written to flash, i.e. NRF_FSTORAGE_EVT_WRITE_RESULT event is received  prior to initiating the shutdown procedure. 

    You I think you should still be able to use the nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU) to put the remote in DFU mode. However, the bootloader will then perform undirected advertisement if the peer data is not written to flash. 

     

    ret_code_t status = sd_power_gpregret_clr(0, 0xFF);
    if (status == NRF_SUCCESS)
    {
        status = sd_power_gpregret_set(0, BOOTLOADER_DFU_START);
    }
    
    if (status == NRF_SUCCESS)
    {
    
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_DFU);
    }

     

  • Hi ,Bjorn 

    I used these 3 lines yesterday, but not work and I didnt check the status is NRF_SUCCESS or others,I will check again. 

    I also want to check whether it enters the boot loader, so I enable the  NRF_LOG_ENABLED && NRF_LOG_BACKEND_RTT_ENABLED in sdk_config.h in boot loader projec to seek some info from the log.

    But  comes out these Errors: L6406E: No space in execution regions with .ANY selector matching nrf_log_backend_rtt.o(i.nrf_log_backend_rtt_flush).Guess the space is not enough to fit the feature of log.

  • I set CONFIG_DFU_HW_VERSION to 0x20023 in sr3_config_nrf52810_pca20031.h and packaged the dfu zip file with parameter --hw_version 0x20023,too.

     It said the HW version wrong by secure DFU service's DFU Control Point in nRF connect .

    I think the code is at dfu_handle_prevalidate() in dfu_req_handling.c where checkc of init command HW version 

  • Are you sure that sr3_config_nrf52810_pca20031.h is the config file included in your build? If you get this error, the HW_VERSION of bootloader and init packet does not match.

  • I think so,because as I change it back to 0x20031 in the config file, I can DFU the RCU.

    But I can try again, so theoretically, the HW_VERSION may be changed in config.h as long as init packet has the same HW_VERSION, right?

  • BTW, I can't check the log,seems the size of FLASH and RAM in BT (52810)are too small for log module.

    I change the size of FLASH and decrease the size of buffers of log , but RAM keeps overflow. 

    The only message I can see is the message from nRF connect.

  • Ralph said:
    I think so,because as I change it back to 0x20031 in the config file, I can DFU the RCU.

    I guess you then also change parameter --hw_version 0x20031 when you create the DFU packet? Have you tried not changing the config (set it to 0x20023), and then test with a DFU packet created with --hw_version 0x20031. If it works, the bootloader have the wrong config.

    Have you read the Working with Smart Remote 3 for nRF52810 documentation? Due to the limited RAM and Flash sizes of nRF52810, the logger is disabled by default. Having both DFU bootloader and logging enabled at the same time might not work at all.

Reply
  • Ralph said:
    I think so,because as I change it back to 0x20031 in the config file, I can DFU the RCU.

    I guess you then also change parameter --hw_version 0x20031 when you create the DFU packet? Have you tried not changing the config (set it to 0x20023), and then test with a DFU packet created with --hw_version 0x20031. If it works, the bootloader have the wrong config.

    Have you read the Working with Smart Remote 3 for nRF52810 documentation? Due to the limited RAM and Flash sizes of nRF52810, the logger is disabled by default. Having both DFU bootloader and logging enabled at the same time might not work at all.

Children
No Data
Related