Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

OTA over serial failure| sdk 15.2

Hello Everyone,

I am using nrf52832 and sdk 15.2 for ota over serial. I have made bootloader for OTA over UART and tested same with nrfutil using my dfu package file. firmware is upgraded successfully and  working fine.

Now I need to upgrade firmware using host MCU. I tried sending dfu package file( .zip ) to nrf52832 over UART using slip librairy to upgrade firmware but it is not working.

Is there any compulsion to send Ping packet, PNR, MTU Packet, init packet, application and bootloader separately over UART?

Can we send directly dfu package created through nrfutil to nrf52832 from other MCU over UART?

Kindly suggest me right approach.

Parents
  • Hello,

     

    Now I need to upgrade firmware using host MCU. I tried sending dfu package file( .zip ) to nrf52832 over UART using slip librairy to upgrade firmware but it is not working.

     From this, I interpret that you want to drag'n'drop from a computer, isn't that right? Is that the final way you want to do it? Or do you want to program the nRF From a microcontroller on a PCB? 

    What HW are you running on? Is it a DK, or is it a custom PCB?

    BR,

    Edvin

  • No, I don't want drag and drop from computer. I want upgrade nrf from other MCU through UART. I have custom PCB. Kindly help for the same.

  • Hello ,

    Thank you very much for your support. OTA over serial is sucessfull. Relaxed

    The problem was in the init packet. I had used softdevice.dat file for init packet. I converted this file into hex by online hex converter. now I used application.dat file for the init packet and sent over serial and after that sent app file and OTA worked.

    Can you please tell me how to make init packet. please share init packet structure. I checked nrfutil code but its quit confusing for me. I have sent following packet.

    uint8_t init_packet1[] = {8, 10, 67, 8, 1, 18, 63, 8, 3, 16, 2, 26, 2, 175, 1, 32, 0, 40, 0, 48, 0, 56, 196, 93, 66, 36, 8, 3, 18, 32, 14, 112, 16, 50, 29, 176, 115, 77, 235, 99, 214, 61, 143, 198, 237, 176, 123, 34, 183, 203, 209, 236, 252, 234, 62, 106, 216, 241, 146, 51, 178, 154, 72, 0, 82};
    uint32_t init_packet1_len = 65;
    uint8_t init_packet2[] = {8, 4, 8, 1, 18, 0};
    uint32_t init_packet2_len = 6;

    Thanks a lot again!!

    Regards,

    Somesh

  • Hello ,

    I have a problem while upgrading firmware. I am upgrading firmware by sending init packet and then app file serially. In some condition init packet is sent successfull and executed using ( 0x04 ) command but while sending app file due to some reason not executed successfully and OTa over serial fails. 

    after that I tried again to do the same but init packet is not getting executed successfully becuase it was done before. so my question is, Is there any way to reset nrf bootloader so that after if ota fails then second time bootloader should start again( erase all files) from init packet.

    Please help me to handle this.

    Awaiting your quick response.

    With warm regards,

    Somesh Burkule

  • Hello,

    I am sorry. I didn't see this until now. When a message is marked as a "verified answer", it no longer pops up in the queue. Did you manage to generate the init packet?

    Do you know why the init execute command fails? Where was it "done before"? I didn't understand that part. 

    Could the problem be that you don't use Flow Control on the UART? Or do you use flow control?

    BR,
    Edvin

  • Hi,

    I have generated init packet. 

    I tried sending init packet and app file. that time init packet executes successfully but app file not due to some reason.now want to send again init packet and app file but init packet does not executes because it was done before. I need to execute this init packet from crash now again. is there any command to set bootloader to recieve init packet from crash again.

Reply
  • Hi,

    I have generated init packet. 

    I tried sending init packet and app file. that time init packet executes successfully but app file not due to some reason.now want to send again init packet and app file but init packet does not executes because it was done before. I need to execute this init packet from crash now again. is there any command to set bootloader to recieve init packet from crash again.

Children
  • One way to reset the device is to call a systemreset from the sourcecode if the second init (application image) fails. Depending on whether you have a valid application or not you may have to set the correct reset register (the way that you set it to get it to run DFU mode instead of the application) in the first place. 

    The way this is typically done is to write to the NRF_POWER->GPREGRET register.

    Please see how this register is checked in dfu_enter_check() in nrf_bootloader.c:

        if (NRF_BL_DFU_ENTER_METHOD_GPREGRET &&
           (nrf_power_gpregret_get() & BOOTLOADER_DFU_START))
        {
            NRF_LOG_DEBUG("DFU mode requested via GPREGRET.");
            return true;
        }

    So this register has to be written before the reset (you can use bootloader_reset() to reset the bootloader).

    But perhaps it would be more interresting to know why the execute command doesn't work? Do you use HWFC? At what rate are you sending the packets?

  • Let me explain in briefly.

    I first sent two files( Baud:115200, HWFC Disabled )

    Init packet -> executes successfully

    application file -> does not executes( I am downloading file from server then sending file to nrf through serially so if network failor occurs it fails)

    then I send two files again( Baud:115200, HWFC Disabled )

    Init packet -> does not executes

    application file -> does not executes

  • If you do not use HWFC then the issue may be that it doesn't have time to write the packets to flash with the speed you are sending them. Try to add some delay between each packet, and see if the issue remains. Alternatively, try to enable HWFC and see whether that may be the issue. If the nRF Has no way of holding back the UART packets, and they are received too fast, I am not sure how the bootloader would react.

    BR,

    Edvin

  • I think that is not the issue.

    I have used 10ms of delay when sending packet.

    As per my observation, nrf is not executing second init packet if first one is executed successfully and stored in flash. so that I was asking to erase flash in boot mode.

    Is it correct?

  • If the init packet is already transmitted, you can start directly on the application image. Wouldn't that be a better approach?

    You can probably delete the init packet as well, If you want that, the sequence on the bootloader would be:

    startup -> check if the init packet is present -> check if a valid application is present -> delete the init packet if the application is invalid.

    Exactly why it is rejected if it doesn't work on first try I am not sure. 

    Out of curiousity, is it an image containing bootloader or application?

Related