This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC1352P7: Wi-SUN device with both NWP and CoAP functionalities

Part Number: CC1352P7

Hi everyone,

I have already tested the examples available for Wi-SUN implementation and as I have noticed, the full embedded app has CoAP functionality and the NWP example does not. I need a device that have both NWP and CoAP functionalities, what changes do I need to do?

Thank you.

  • Hi Eduardo,

    the ns_br example has CoAP and NWP capability. The network is structured as a border router device from TI and a host running the ti-wisunfan-pyspinel client (NWP).

    What do you mean by: "the full embedded app has CoAP functionality and the NWP example does not" ?

    Can you please explain me in more detail what you would like to implement?

    Thank you.
    Kind regards,
    Theo

  • Hi Theo,

    I want a router node that will work with both NWP and CoAP functionalities. Reading the ns_br README (https://dev.ti.com/tirex4-desktop/nodeContent?a=BSEc4rl__7.40.00.77&node=A__AH7jFiIch3.eUi7WC4z2HQ__com.ti.SIMPLELINK_CC13XX_CC26XX_SDK_WISUNFAN_MODULE__BSEc4rl__7.40.00.77&r=BSEc4rl__7.41.00.17) I understood that the ns_node example does not support CoAP, correct?

    Best regards,
    Eduardo.

  • Hi Eduardo,

    this is correct. The ns_node example supports NCP but not CoAP and the ns_coap_node example supports no NCP but CoAP.

    The reason for that is that the NCP is connected over UART to the PySpinel client running on the host. The node is then busy listening to commands from that. Instead the CoAP node listens to the radio. To implement both on the same node you would need to schedule when it is listening to the radio and when to the UART which will also require handling of missed messages and commands.

    I would recommend to use either one of both starting from our example projects. 

    What exactly would you like to implement? For what do you need the NCP on the node additionally to CoAP?

    Kind regards,
    Theo

  • Hi Theo,

    My application uses a MCU as a host that must collect data and send to our platform. We want to do this using either an LTE module or CC1352P7 (Wi-SUN), so I need something generic that will work on both cases. On both cases the MCU must control connection, data flow, functionalities etc.

    I need to be able to configure connection and use all functionalities that NWP offers.

    Could you guide me where I would need to make those changes?

    Best regards,
    Eduardo.

  • Hi Eduardo,

    what kind of MCU are you using (linux or windows based)?

    So your setup is host<->border router and host<->router node and you want to communicate from the host on the router node side to the host of the border router?

    If you're using a linux host you could have a look here: https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1352075/faq-lp-cc1352p7-use-wfantund-on-a-linux-host-connected-to-a-ti-wi-sun-fan-router-node

    Kind regards,
    Theo

  • Hi Theo,

    I am using an ESP32 as host on the side of the router node and a linux based (like Raspberry Pi) on the side of the border router.

    Yes, I want to communicate both hosts on each side using router node and border router.

    This link you sent me would be helpful with ESP32 too? I'm implementing using C language.

    Regards,
    Eduardo.

  • Hi Eduardo,

    wfantund is made to run on a linux host. You can only use it for the host of the border router.

    Unfortunately we have no example code for a host on ESP32.

    Kind reards,
    Theo 

  • Hi Theo,

    I know it is made to run on linux, I'll have to implement it to be able to use on ESP.

    But would https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1352075/faq-lp-cc1352p7-use-wfantund-on-a-linux-host-connected-to-a-ti-wi-sun-fan-router-node thread help me with the issue about router node with NWP?

    Regards,
    Eduardo.

  • Hi Eduardo,

    if you read through the linked thread then you will find at the end the example of sending a ping from a host connected to a router node to a border router and its host. So this would help you with the communication that you want to perform.

    Kind regards,
    Theo

  • Hi Eduardo,

    did you had a chance to look at the linked example showing linux host to linux host communication from router node to border router?
    Is it an option for you to use a linux host on both sides? 

    Kind regards,
    Theo

  • Hi Theo,

    I checked that he shows a ping example using a node with a linux host, but I still could not take a look at the code to check how it is implemented.

    Using a linux host on the side of the router node is not an option, I really need to do this using ESP32.

    Best regards,
    Eduardo.

  • Hi Eduardo,

    thank you for the update.
    Please reach out again if you have any further questions.

    Kind regards,
    Theo

  • Hi Theo,

    From the link you sent me, if I could understand it correctly, just switching the is_net_stack_up() function would be enough to my application and I would be able to use both CoAP and NWP resources without needing to worry about switching the UART between NWP and the antenna? This would be resolved?

    Thank you.

    Regards,
    Eduardo.

  • Hi Eduardo,

    in the case of the link that I sent you: https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1352075/faq-lp-cc1352p7-use-wfantund-on-a-linux-host-connected-to-a-ti-wi-sun-fan-router-node

    the ping is send from host to host using the border router and router node as network interfaces (NWP). There are no CoAP services involved. Instead of sending a ping it would be the same way possible implement sending data packages.

    In your case you would need to write an application that can replace wfantund on the side using the ESP32. You could then use the border router and router node in NWP mode as network interfaces and send your data from host to host without using CoAP.

    Kind regards,
    Theo

  • Hi Theo,

    Thank you for the explanation. I intend to use spinel-cli.py code as base to develop the interface between ESP32 and CC1352P7 in the router node. Then, using the example in the link that you sent me to change the ns_node example I would be able to use the router node in NWP mode, correct?

    If so, I would then need to implement CoAP in this ns_node code modified? Is there a flag or something like that that I would need to set to activate CoAP functionalities?

    Best regards,
    Eduardo.

  • Hi Eduardo,

    yes you can use the router node as NWP with the spinel-cli.py. In that case you need to keep in mind that you can not use the router node as network interface as it communicates over UART to the host ESP32. That means you need to implement the handling of incoming messages and the message sending on the router node so that you forward them to your host. You can start by looking at the wpan_callback function that is used for OAD which implements the handling for an incoming OAD package. 

    When you are using the router node as NWP you will not be able to add CoAP services as both modes conflict each other. Instead you can use the border router as network interface with a linux host running wfantund as shown in the example of the link that I sent you. On the router node side you need to forward the network traffic over UART to the spinel-cli on your host. With such an implementation you will then be able to send messages from host to host in any direction in the way that you define it so there is also no need for CoAP.

    Kind regards,
    Theo

  • Hi Theo,

    I'm sorry, I don't know if I could completely understand your answer. Just to guarantee that my requisites are clear for you:
    I need to build a network using a border router with NWP that communicates to a linux host, I think there are no problems at this point because it is what is already build in the border router example. The devices that will connect to this network are composed by CC1352P7 connected to a host (ESP32) that will be responsible to configure some connection parameters, such as network name, pan id etc. The host (ESP32) also needs to send some important data to the border router using CC1352P7, that is why I need to be able to have some kind of communication between node and border router. The use of CoAP is because I am familiar with it and it is an application protocol that has everything that I need, such as guarantee of data delivering, GET, POST methods etc...

    With this in mind I'd like to guarantee that I could understand your explanation about possible ways of reaching these goals:

    1. What I could understand until now is that the problem of using both CoAP and NWP functionalities is that in one case the CPU is always listening to the radio and in the other case it is always listening to UART interface, correct?

    2. If statement 1 is correct, if I could find a way of guarantee that I could handle CoAP messages and NWP (for example using some kind of interruption) I would be able to have what I need?

    3. If NWP is always busy listening to UART and is never able to listen to antenna, then what is the purpose of ns_node example? I mean, it connects to the network and then can't communicate with it or am I misunderstanding something?

    4. The example in https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1352075/faq-lp-cc1352p7-use-wfantund-on-a-linux-host-connected-to-a-ti-wi-sun-fan-router-node would let me communicate border router with ns_node example using a linux host. If I write a code such as spinel-cli.py in C language and use it with ESP32 I would be able to communicate my node with border router using ESP32? If so, it would be using simple UDP protocol but not CoAP, correct?

    5. If statement 4 is correct, if I can communicate node with border router, then I would be to implement CoAP, correct?

    I think these are all the questions I have at the moment and I appreciate if you could make everything clear for me.

    Best regards,
    Eduardo.

  • Hi Eduardo,

    I'll take it from the beginning.

    From what I understood you want to achieve host to host communication using Wi-SUN. We have implemented an example for sending a ping using a linux host (https://github.com/TexasInstruments/ti-wisunfantund) on each side with the border router and the router node compiled as NWP. In the linked thread it is explained how a ping can be send from the host of the router node to the host of the border router (https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1352075/faq-lp-cc1352p7-use-wfantund-on-a-linux-host-connected-to-a-ti-wi-sun-fan-router-node). There is no CoAP messages used for it instead the border router and the router node are used as network interfaces and the message is sent from host to host (addressed over ip).

    In our example code you are not able to use CoAP and NWP together. I simplified the explanation as the "listening to the UART" conflicts with the CoAP implementation. Of course you can look into how to change the implementation which is an option but you need to do it for boarder router and router node and implement message sending for the host running on the router node side as it is not designed for host to host communication. The reason is that the CoAP node was designed to run as fully embedded application.

    Instead I would recommend you to implement host to host communication by using a linux host running wfantund with boarder router as NWP to open the network. You can then use the boarder router as network interface which means that you can address the linux host with its ip address. To do so you can use a router node as NWP connected to a spinel-cli running on your ESP32. The difference on the side of the router node is that the connection between router node and host is a UART connection so you need to implement the forwarding of received UDP messages over UART and the sending of UDP messages that the host sends to the router node over UART. But there is a good starting point for this looking at the OAD wpan_callback function. 

    In this communication setup you don't need CoAP because you establish host to host communication over UDP which gives you full control over you message flow.

    Kind regards,
    Theo


  • Hi Theo,

    Thank you very much for the detailed explanation.

    It seems like implementing these modifications I would be able to reach the specifications of my project.

    In this case where I will use UDP to communicate between hosts, I would only need to implement guaranteed message delivery and something like the commands that CoAP would offer (GET, POST ...), correct?

    Best regards,
    Eduardo.

  • Hi Eduardo,

    you need to register UDP services according to your needs and also implement the correct handling/forwarding of the UDP messages on the router node side to the spinel-cli. The handling of the message by the host is completely up to you. You can start by looking at the implementation of the CoAP and OAD services.

    Kind regards,
    Theo

  • Hi Theo,

    Thank you very much for the explanation.

    Just to make it clear for me, the ping command is handled by CC1352P7 on the node side and responds automatically because there is no need to forward the message to the host, correct?

    Best regards,
    Eduardo.

  • Hi Eduardo,

    exactly. The ping is handled by the node in the embedded application. Only if you connect a linux host running wfantund you are able to ping the host directly.

    Kind regards,
    Theo

  • Thank you, Theo!

    I will keep developing now based on these information you gave me.

    Once this thread is already quite big, it's okay for me to close it and in case I need any further support I'll open a new question with more specific details.

    Thank you again for your support!

    Best regards,
    Eduardo.