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

DFU project

I try to create coap server project and it should by  updateable by DFU. I merge project simple coap server and thread dfu client, and I keep  instructions in documentation to build it and run DFU. But Server doesnt response to coap requests and when I start multicast DFU process server is not updated. and when I try to start unicast DFU it waiting to promote a router. 

Parents
  • I am folowing this instructions:

    first version

    D:
    cd IS\nRF5_SDK_for_Thread_and_Zigbee_v3.1.0_c7c4730\examples\thread\dfu_client
    make -C dfu_client_coap_server\pca10056\blank\armgcc
    nrfutil settings generate --family NRF52840 --application dfu_client_coap_server\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --application-version 1 --bootloader-version 1 --bl-settings-version 1 settings.hex
    mergehex -m dfu_client_coap_server\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex settings.hex -o dfu_client.hex
    nrfjprog -f nrf52 --eraseall
    nrfjprog -f nrf52 -r --program ..\..\..\components\softdevice\mbr\nrf52840\hex\mbr_nrf52_2.4.1_mbr.hex --chiperase
    nrfjprog -f nrf52 -r --program bootloader\pca10056\blank\armgcc\_build\nrf52840_xxaa_mbr.hex
    nrfjprog -f nrf52 -r --program dfu_client.hex --sectorerase


    code change

    next version
    make -C dfu_client_coap_server\pca10056\blank\armgcc
    nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 2 --application dfu_client_coap_server\pca10056\blank\armgcc\_build\nrf52840_xxaa.hex --key-file key.pem app_dfu_package.zip


    DFU multicast
    nrfutil dfu thread -f -pkg app_dfu_package.zip -p COM14 --channel 11 --panid 43981 -r 4 -rs 5000 -a FF03::1

    DFU unicast
    nrfutil dfu thread -f -pkg app_dfu_package.zip -p COM14 --channel 11 --panid 43981
    nrfutil dfu thread -f -pkg app_dfu_package.zip -p COM14 --channel 11 --panid 43981 -a fdde:ad00:beef:0:65ab:b4da:9355:117b

  • Hi,

    Can you post the log output? Have you tried to run the DFU client application without the coap server and see if everything works? Can you post your project folder so we can reproduce it?

    Best regards,

    Marjeris

  • Hi Frantisek,

    Sorry for the delay with this case but I will need to consult with our Thread developers to see how to best implement this functionality. The Thread DFU client example is using another CoAP library (from the IoT SDK) and I am not sure what is the best way to merge these two examples.

    The project works fine when thread_coap_init() is not called so my guess is that something is being initialized twice or in the wrong way when using the two coap libraries simultaneously.

    For reference:

    CoAP library used in Thread DFU coap client: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_tz_v3.1.0%2Fgroup__api-coap-group.html&cp=5_3_5_0_0_6_3

    CoAP library used in simple_coap_server example: https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.iotsdk.v0.9.0%2Flib_iot_coap.html

    I will update you when I have more information.

    Best regards,

    Marjeris

  • Hi Frantisek,

    Sorry for the late reply. I have discuss the issue with a collegue of mine working in the Thread team. We don't think these two examples can run in parallel.

    What is happening now is that enabling the built-in CoAP (from the OpenThread library) results in it getting all CoAP traffic, so the DFU packets are not handled by the second CoAP implementation, since the built-in CoAP binds to a specific port, so both DFU_UDP_PORT and OT_DEFAULT_COAP_PORT are defined as the same port. 

    #define OT_DEFAULT_COAP_PORT 5683 ///< Default CoAP port, as specified in RFC 7252

    The OpenThread built-in CoAP is much simpler an limited than the external used in the DFU, therefore our recommendation is not enabling the OT CoAP, and rather build your server application using the external CoAP.

    When using the external CoAP library you can create a separate resource with coap_resource_create(), it takes a callback and a resource name, which is the URI path. The examples in nRF5_SDK/examples/iot/coap/ipv6/client and server could be used as a reference.

    Best regards,

    Marjeris

  • And if I use another port for coap server it will be ok? 

  • Hi Fran,

    Such an approach will have two CoAP implementations running at the same time which is not a good practice, it would be better to have a single one handling all communications, have a single port for all CoAP traffic and then based on the resource URI handle messages properly.

Reply Children
Related