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

DFU compatibility for a mesh example

Hi,

I am interested to know how to make a mesh node (for example, a light server) compatible to perform a DFU.

I have gone through the DFU page and I noticed that the DFU is done over the Serial port. I understand that the dfu firmware is being replaced with blinky firmware. Correct me if I am wrong.

Now, what changes should I make to the commands inorder to make the light_server example node to be DFU compatible/capable over the air?

Would replacing the application hex file on step 8 to light_server instead of dfu solve it? or should I add any other commands to have light_server firmware first?

Thank you.

Parents
  • Hello,

    well. The short answer is that you need the mesh_evt_handler() to handle DFU packets, like it does in the DFU example. In addition, if you want the device to handle Serial DFU (the one who receives the packets from nrfutil), you need it to support serial DFU as well. 

    This is done in nrf_mesh_serial_init(NULL); in mesh_init(void).

    Inside this call, serial_handler_dfu_init() is called, which handles the DFU serial messages.

    When you try to include the DFU packets (over Mesh) you will probably have to include everything you need around as well. Give it a go, and let me know if you get stuck.

    BR,

    Edvin

  • Hi,

    The short answer is that you need the mesh_evt_handler() to handle DFU packets, like it does in the DFU example.

    I notice that nrf_mesh_evt_handler_t is used in only few examples like EnOcean, light switch provisioner, Lpn examples. 

    So, in order to make other examples DFU capable, I need to add the nrf_mesh_evt_handler while mesh initilization.

    Give it a go, and let me know if you get stuck.

    If I am trying to push the dfu packets over the air but not serial, I should push it from the nrf connect app right? or can we do it from the mesh app? Sorry but I have no idea about how to push it OTA!!

    Thank you.

  • I tried it the same way. My setup was something like this:

    board 1 -- device page 1(key1)

    board 2 -- device page 2(key2)

    boards 3,4,5 -- device page 3(key3)

    created the DFU packet with key1 and pushed it to board 1.

    The result is board 1 gets updated with Blinky. 

    boards 2, 3, 4 and 5 indicate that the DFU event ended (LED's 1 and 2 are on)

    Please find the picture below (boards 1 and 2) showing the result:

    I tested it. It works

    When you say it works, did you mean that the board two was also updated with Blinky or just that the packets were pushed successfully but board 2 wasn't updated because of different device page?

    Thank you.

  • DeveloperZ said:
    When you say it works, did you mean that the board two was also updated with Blinky or just that the packets were pushed successfully but board 2 wasn't updated because of different device page?

     Only the boards with the correct key and application ID is updated. However you will see that the rest of the boards are also receiving the DFU image, but that is just for retransmission/relaying. They will not update to the new application unless both application ID and keys are correct.

  • And have you tried to push a DFU image with application key 2 to board 1? Does board 2 update then?

  • Yes, 

    The result was.... board 1 with LED's 1 and 2 ON indicating the DFU event ended and board 2 got updated with Blinky!!!

  • As we discussed in the previous thread about the changes made to the UART that caused failure in pushing the DFU, how to push the update for an application which uses UART(requires changes to few files)?

    Any idea about this?

    This is what I tried: In a different 3.1.0 Mesh SDK and 15.2.0 SDK, I made changes to few UART files and implemented a mesh example with UART. I copied that hex file into a folder containing the stock SDK's, created a zip file in that folder and tried to push it onto the boards with Mesh dfu stock example. It failed to push the update.

    Does the changes in the UART files of the receiving DFU packet also causes failure to push DFU?

    I shall try once again and update if there is any change in the test that I made with this UART application.

Reply
  • As we discussed in the previous thread about the changes made to the UART that caused failure in pushing the DFU, how to push the update for an application which uses UART(requires changes to few files)?

    Any idea about this?

    This is what I tried: In a different 3.1.0 Mesh SDK and 15.2.0 SDK, I made changes to few UART files and implemented a mesh example with UART. I copied that hex file into a folder containing the stock SDK's, created a zip file in that folder and tried to push it onto the boards with Mesh dfu stock example. It failed to push the update.

    Does the changes in the UART files of the receiving DFU packet also causes failure to push DFU?

    I shall try once again and update if there is any change in the test that I made with this UART application.

Children
  • Hello, You can add an event handler for your UART by changing nrf_mesh_serial_init(NULL) with nrf_mesh_serial(nrf_mesh_serial_app_rx_cb_t app_rx_cb).

    What do you tent do use your UART for? Do you need to send data as well?

  • Please note that the nRF52832 only can use one UART at once, so it is not straight forward to have more UARTs. If you can use the same UART for what you want, that is fine, but if you want to implement a second UART for a sensor or whatever, you would need to switch between two different UARTs, so you can't enable both at once.

  • Hello,

    Yes, I am using the uart for a sensor to send/receive data.

    I tried this following scenario:

    (Note: No multiple UARTS used)

    I developed a UART application in a folder with stock SDK's. My application required few changes to UART files (app_uart.c, app_uart_fifo.c, nrfx_uart.c), change of baud rate and hardware flow control was disabled. I built the project and copied the hex file into a different folder that has stock SDK's which I was using to perform DFU.

    Now, I programmed two development boards with DFU stock example and device pages with different keys. Generated the DFU zip with key 2 and pushed the packet to board 1. 

    Transfer started (I didn't expect it to) and the process was very slow. It felt like the update is going to take few days. After 5-7 minutes, the transfer failed.

    Do you have any idea of why the transfer started? and after it started, why it failed? 

    if you want to implement a second UART for a sensor or whatever, you would need to switch between two different UARTs

    I will try it.

    Thank you.

  • Hello,

    What compiler do you use? Segger Embedded Studio? Armgcc (what version)?

    I have seen this error before, and it was caused by an "untested" compilator. 

    Just to clarify the UART situation. You can have the bootloader over Mesh on a node without using the UART (so you can use the UART for a sensor), but it is a bit more challenging to use UART for sensor + DFU. I suggest that you have one node that only uses UART for DFU, and the rest can use it for the sensors. Is that a viable solution?

    If not, you would have to somehow decide to disconnect the UART from the sensor, and initialize the UART for the DFU.

    BR,

    Edvin

  • What compiler do you use? Segger Embedded Studio? Armgcc (what version)?

    I use Segger Embedded Studio v4.12.

    I suggest that you have one node that only uses UART for DFU, and the rest can use it for the sensors. Is that a viable solution?

    Yes, I can do that. I can use a gateway node which can use the serial Bootloader to push the application onto the network and all the nodes that have UART application can use a Mesh Bootloader(not serial).

    You can have the bootloader over Mesh on a node without using the UART

    Do you mean the "mesh_bootloader_gccarmemb_nrf52832_xxAA.hex" file in the bin/bootloader folder?

    Thank you.

Related