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

How do I set up CoAP Server whit SED on Nrf Connect SDK v1.4.0

Hey,

I am wondering if it is possible to run MTD and SED on the CoAP server on nRF Connect SDK v1.4.0. 

I have looked at the question "How do I set up CoAP Server whit SED" (link below) in DevZone but that is for the Nordic SDK  3.2.0 or later. This two SDKs is a bit different from each other and I can't find some of the functions and parameters. e.g. thread_configuration_t in on the nRF Connect SDK. So how do I setup so that the server is a SED whit this SDK?

 

SED - Sleepy End Device

MTD - Minimal Thread Device

Link: Nordic DevZone (nordicsemi.com)

Parents
  • Hi Sebastian,

    Thinking from the application level, I am a bit confused about this request.

    The role of  MTD/SED device is most likely to be used as a Coap client. It is disabled most of the time and wakes on occasion to poll or send messages with its parent.

    An FTD can be used as either Coap server or client benefit from its always-on radio and calculate power to handle requests from clients. 

    I am not sure how they would work if their roles swap.  Let me know your opinions. :-)

    The NCS has Thread Coap client example provide options for FTD or MTD/SED: Thread: CoAP Client — nRF Connect SDK 1.4.0 documentation (nordicsemi.com) It build as a FTD device defaultly. overlay-mtd.conf  contains configuration for MTD/SED setup. Thread Coap server example only configured as an FTD device: Thread: CoAP Server — nRF Connect SDK 1.4.0 documentation (nordicsemi.com)

    Best regards,

    Charlie

     

  • What I am trying to do is to have an end devise that on request can send information to the asking device. My understanding of CoAP is that only a client can send a request to a server. Due to this I need to have them switched so that the end device is a server and the router is a client.

    So my question is if I can configure a server to use the SED/MTD and be triggered to wake up when an incoming massages is detected.

    Best regards,

    Sebastian

  • Sorry for my miss understanding, I agree with you. I will contact our openThread expert for potential solutions.

  • Hi Sebastian,

    I got a temporary solution to set up a SED mode CoAP server.

    1. Rebuild CoAP server. You need to copy "overlay-mtd.conf" from CoAP client sample to CoAP server. Add "list(INSERT OVERLAY_CONFIG 1 overlay-mtd.conf)" to CMakeLists.txt and rebuild this sample. You may want to cut down "CONFIG_OPENTHREAD_POLL_PERIOD=3000" to avoid lang lantency. Make sure you erase the chip and flash, the previous setting may be stored in the chip if you only use the flash to flash application area. I use "west flash --erase" on my test.

    2. Rebuild CoAP client. You need to change the multicast IP address in order to reach the SEDs according to the multicastt description on OpenThread. The IP address to use is network dependent. On my device, they are

    uart:~$ ot ipmaddr
    ff33:40:fdde:ad00:beef:0:0:1
    ff32:40:fdde:ad00:beef:0:0:1
    ff02:0:0:0:0:0:0:1
    ff03:0:0:0:0:0:0:1
    ff03:0:0:0:0:0:0:fc

    the sample uses the ff03:0:0:0:0:0:0:1 address as it is universal, but it does not reach SEDs. So the desired addresses are the first and second, depending on the scope.

    change the multicast_local_addr in coap_client_utils.c like

    static struct sockaddr_in6 multicast_local_addr = {
    	.sin6_family = AF_INET6,
    	.sin6_port = htons(COAP_PORT),
    	//.sin6_addr.s6_addr = { 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    	//		       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
        .sin6_addr.s6_addr = { 0xff, 0x33, 0x00, 0x40, 0xfd, 0xde, 0xad, 0x00,
    	 		       0xbe, 0xe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
    	.sin6_scope_id = 0U
    };

    rebuild and flash after erasing chip.

    Then you should be able to use Button 2 on CoAP client  to toggle LED 4 on CoAP server. 

Reply
  • Hi Sebastian,

    I got a temporary solution to set up a SED mode CoAP server.

    1. Rebuild CoAP server. You need to copy "overlay-mtd.conf" from CoAP client sample to CoAP server. Add "list(INSERT OVERLAY_CONFIG 1 overlay-mtd.conf)" to CMakeLists.txt and rebuild this sample. You may want to cut down "CONFIG_OPENTHREAD_POLL_PERIOD=3000" to avoid lang lantency. Make sure you erase the chip and flash, the previous setting may be stored in the chip if you only use the flash to flash application area. I use "west flash --erase" on my test.

    2. Rebuild CoAP client. You need to change the multicast IP address in order to reach the SEDs according to the multicastt description on OpenThread. The IP address to use is network dependent. On my device, they are

    uart:~$ ot ipmaddr
    ff33:40:fdde:ad00:beef:0:0:1
    ff32:40:fdde:ad00:beef:0:0:1
    ff02:0:0:0:0:0:0:1
    ff03:0:0:0:0:0:0:1
    ff03:0:0:0:0:0:0:fc

    the sample uses the ff03:0:0:0:0:0:0:1 address as it is universal, but it does not reach SEDs. So the desired addresses are the first and second, depending on the scope.

    change the multicast_local_addr in coap_client_utils.c like

    static struct sockaddr_in6 multicast_local_addr = {
    	.sin6_family = AF_INET6,
    	.sin6_port = htons(COAP_PORT),
    	//.sin6_addr.s6_addr = { 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    	//		       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
        .sin6_addr.s6_addr = { 0xff, 0x33, 0x00, 0x40, 0xfd, 0xde, 0xad, 0x00,
    	 		       0xbe, 0xe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 },
    	.sin6_scope_id = 0U
    };

    rebuild and flash after erasing chip.

    Then you should be able to use Button 2 on CoAP client  to toggle LED 4 on CoAP server. 

Children
No Data
Related