Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Mesh DFU over serial

Hello,

My goal is to make DFU over a mesh network.

Using this guide , I did the following:

nrfjprog --program bin/softdevice/s132_nrf52_7.2.0_softdevice.hex --chiperase

nrfjprog --program bin/bootloader/gccarmemb/mesh_bootloader_serial_gccarmemb_nrf52832_xxAA.hex

nrfjprog --program C:\Users\lidor\Desktop\netled\Netbag\build\serial_nrf52832_xxAA_s132_7.2.0_Debug\serial_nrf52832_xxAA_s132_7.2.0.hex

nrfjprog --program tools/dfu/bin/device_page_nrf52832_xxAA_s132_7.2.0.hex

nrfjprog --reset

Using mesh-nrfutil, I send the DFU request:

nrfutil-mesh --verbose dfu serial -pkg dfu_test.zip -p COM3 -b 115200 --mesh

I see the following output on my DK:

<t: 459057>, nrf_mesh_dfu.c, 421, New firmware!
<t: 525396>, nrf_mesh_dfu.c, 421, New firmware!
<t: 591620>, serial.c, 226, Error type data: : 0B
<t: 608136>, serial.c, 226, Error type data: : 0B
<t: 624934>, serial.c, 226, Error type data: : 0B
<t: 641662>, serial.c, 226, Error type data: : 0B
<t: 658498>, serial.c, 226, Error type data: : 0B
<t: 674908>, serial.c, 226, Error type data: : 0B
<t: 691812>, serial.c, 226, Error type data: : 0B
<t: 708616>, serial.c, 226, Error type data: : 0B
<t: 725453>, serial.c, 226, Error type data: : 0B
<t: 742297>, serial.c, 226, Error type data: : 0B

(I added the log at line 226 to see what is the error)

I already opened a ticket about my issue: https://devzone.nordicsemi.com/f/nordic-q-a/88428/nrf-mesh-dfu-over-the-air. Edvin, the man who helps me, asked me to open a new one because he will be back on August 1st.

DFU failed for some reason I cannot figure out.

It would be great if someone could help me figure this out! Thank you!

Parents
  • Hello Lidor,

    I believe you'll have to wait until Edvin gets back to get help with the main issue of Mesh DFU.

    If I've understood you and your case history correctly, you are trying to get our proprietary Mesh DFU solution from nRF5 SDK to work, and it currently does not. The only error message you get, is one you've added yourself as a log someplace in serial.c, that happens to be on line 226. Without it (which the project is by default), there is no error, the DFU simply does not work. 

    Is this correct? And in what function did you add this "Error type data: : 0B" log? serial_translate_error? serial_process? Could you share this modified function with me?

    Regards,

    Elfving

Reply
  • Hello Lidor,

    I believe you'll have to wait until Edvin gets back to get help with the main issue of Mesh DFU.

    If I've understood you and your case history correctly, you are trying to get our proprietary Mesh DFU solution from nRF5 SDK to work, and it currently does not. The only error message you get, is one you've added yourself as a log someplace in serial.c, that happens to be on line 226. Without it (which the project is by default), there is no error, the DFU simply does not work. 

    Is this correct? And in what function did you add this "Error type data: : 0B" log? serial_translate_error? serial_process? Could you share this modified function with me?

    Regards,

    Elfving

Children
  • You understood correctly. I changed serial_translate_error as follows:

    uint8_t serial_translate_error(uint32_t error)
    {
         if (error)
         {
            __LOG_XB(LOG_SRC_SERIAL, LOG_LEVEL_INFO, "Error type data: ", &error, 1);
         }
        switch (error)
        {
            case NRF_SUCCESS:
                return SERIAL_STATUS_SUCCESS;
            case NRF_ERROR_SVC_HANDLER_MISSING:
                return SERIAL_STATUS_ERROR_INVALID_STATE;
            case NRF_ERROR_SOFTDEVICE_NOT_ENABLED:
                return SERIAL_STATUS_ERROR_INVALID_STATE;
            case NRF_ERROR_INTERNAL:
                return SERIAL_STATUS_ERROR_INTERNAL;
            case NRF_ERROR_NO_MEM:
                return SERIAL_STATUS_ERROR_REJECTED;
            case NRF_ERROR_NOT_FOUND:
                return SERIAL_STATUS_ERROR_REJECTED;
            case NRF_ERROR_NOT_SUPPORTED:
                return SERIAL_STATUS_ERROR_REJECTED;
            case NRF_ERROR_INVALID_PARAM:
                return SERIAL_STATUS_ERROR_INVALID_PARAMETER;
            case NRF_ERROR_INVALID_STATE:
                return SERIAL_STATUS_ERROR_INVALID_STATE;
            case NRF_ERROR_INVALID_LENGTH:
                return SERIAL_STATUS_ERROR_INVALID_LENGTH;
            case NRF_ERROR_INVALID_FLAGS:
                return SERIAL_STATUS_ERROR_INVALID_STATE;
            case NRF_ERROR_INVALID_DATA:
                return SERIAL_STATUS_ERROR_INVALID_DATA;
            case NRF_ERROR_DATA_SIZE:
                return SERIAL_STATUS_ERROR_INVALID_LENGTH;
            case NRF_ERROR_TIMEOUT:
                return SERIAL_STATUS_ERROR_TIMEOUT;
            case NRF_ERROR_NULL:
                return SERIAL_STATUS_ERROR_INTERNAL;
            case NRF_ERROR_FORBIDDEN:
                return SERIAL_STATUS_ERROR_REJECTED;
            case NRF_ERROR_INVALID_ADDR:
                return SERIAL_STATUS_ERROR_INVALID_DATA;
            case NRF_ERROR_BUSY:
                return SERIAL_STATUS_ERROR_BUSY;
            case BLE_ERROR_NOT_ENABLED:
                return SERIAL_STATUS_ERROR_REJECTED;
            default:
                return SERIAL_STATUS_ERROR_UNKNOWN;
        }
    }
    Also to check, I downloaded the mesh SDK5 again and worked with a new unzipped Mesh SDK and the results are the same.

  • Case 0xB0, or 0d11 is NRF_ERROR_INVALID_DATA.

    So you are not getting any error codes like "Failed to upgrade target. Error is: Device returned status code ERROR_INVALID_DATA" from either of the devices?

    What log level are you using?

    Regards,

    Elfving

  • The debug level I'm using is 3.

    I get the following logs from the device:

    <t:          0>, main.c,  189, ----- Bluetooth Mesh Serial Interface Application -----
    <t:       8767>, nrf_mesh_dfu.c,  753, Version info: BL(ver, id): 0x01 0x01 SD: 0x0101
    <t:       8770>, nrf_mesh_dfu.c,  755, Version info: APP company: 0x00000059 id: 0x0001 version: 0x00000001
    <t:       8797>, main.c,  175, Enabling ECDH offloading...
    <t:       8802>, main.c,  178, Initializing serial interface...
    <t:       8804>, serial_handler_prov.c,  279, Generating encryption keypair...
    <t:      13645>, main.c,  198, Initialization complete!
    <t:      18420>, mesh_app_utils.c,   66, Device UUID (raw): B66F3B2F0D6A4BD089E64985D5E52C70
    <t:      18423>, mesh_app_utils.c,   67, Device UUID : B66F3B2F-0D6A-4BD0-89E6-4985D5E52C70
    <t:      18433>, nrf_mesh_dfu.c,  554, 	RADIO TX! SLOT 0, count 15, interval: periodic, handle: FFFE
    <t:      18437>, nrf_mesh_dfu.c,  593, 	SERIAL TX (type: 65534)
    <t:      18445>, main.c,  224, Bluetooth Mesh Serial Interface Application started!
    <t:     389576>, serial_handler_device.c,  125, Echo data: : AABBCCDD
    <t:     390092>, nrf_mesh_dfu.c,  418, 	New firmware!
    <t:     456569>, nrf_mesh_dfu.c,  418, 	New firmware!
    

    If I try to send a new packet over serial, I get the following output from mesh-nrfutil:

    D:\Nordic\mesh-nrfutil>nrfutil-mesh --verbose dfu serial -pkg dfu_test.zip -p COM3 -b 115200 --mesh
    Upgrading target on COM3 with DFU package D:\Nordic\mesh-nrfutil\dfu_test.zip. Flow control is disabled.
    Flushing com-port...
    Opened com-port
    Starting DFU upgrade of type 4, SoftDevice size: 0, bootloader size: 0, application size: 2416
    Sending DFU start packet, afterwards we wait for the flash on target to be initialized before continuing.
    1: PC -> target: 0502aabbccdd
    target -> PC: 0582aabbccdd
    Got echo response
    Sending DFU init packet
    Sending ready packet
    1: PC -> target: 1378fdff040fea4e3e9159000000020004000000
    target -> PC: 16a6045900000002000400000059000000010001000000
    target -> PC: 03847800
    1: PC -> target: 1378fdff040fea4e3e9159000000020004000000
    target -> PC: 16a6045900000002000400000059000000010001000000
    target -> PC: 03847800
    Sending start packet
    1: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    2: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    3: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    4: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    5: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    6: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    7: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    8: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    9: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    10: PC -> target: 1478fcff0000ea4e3e91ffffffff5c02000040000c
    target -> PC: 03847887
    
    
    Failed to upgrade target. Error is: Device returned status code ERROR_INVALID_DATA (135) on a DFU data packet.
    
    Possible causes:
    - bootloader, SoftDevice or application on target does not match the requirements in the DFU package.
    - baud rate or flow control is not the same as in the target bootloader.
    - target is not in DFU mode. If using the SDK examples, press Button 4 and RESET and release both to enter DFU mode.
    - if the error is ERROR_BUSY at the beginning of the DFU process,increase the value of PAGE_ERASE_TIME_MAX by few milliseconds.
    Closing serial port...

  • Sorry for the delay, I've been away on vacation. 

    Is this still an issue for you, or have you gotten any further on it. I see that you've at least gotten further in your case with Edvin?

    Regards,

    Elfving

Related