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.

CC2650: OpenThread NIC

Part Number: CC2650
Other Parts Discussed in Thread: CC2538

Hi, 

I have OpenThread running on my cc2650 Launchpad.  Is there a way to configure it as a network adapter or a serial UART for a PC? Basically I wish to pass UDP packets through it to the PC to which it is connected. I see it has a secondary COM port labeled as "XDS110 Class Auxiliary Data Port" in device manager. I also noticed it has a "udp" CLI option. However I can't seem to find documentation for either. The 'help' output does not match that of  

Thanks,
Matt

  • Hey Matt,

    Thanks for the interest with OpenThread.

    To start, the XDS110 debugger presents two Virtual COM ports to the host. One is the Application UART; this is the UART from the cc2650. The other COM port is the Aux Data Port; this is an interface to the JTAG debugger itself. This can be setup for many uses but is mainly a way for the XDS110 to interact with the host, not a way to interact with the cc2650 directly.

    The `udp` option in the CLI example is a way to setup a simple UDP server or to send a UDP message. This is link the `coap` command in the CLI, which allows the user to setup a simple CoAP server or to send CoAP messages. I would point you to the UDP example README for documentation on the `udp` command, and would point you to the CLI README for documentation on the `coap` command.

    To setup OpenThread as a network interface for you computer I would suggest you use the NCP example with wpantund. Wpantud can be built on a unix-like system, to connect to the Network CoProcessor through the UART interface using spinel. Wpantund is the tunnel daemon that would run on the host processor that allows OpenThread to present a network interface.

    This all being said, the cc2650 cannot act as a Thread router. This is why the builds are limited to "mtd" configurations, Minimal Thread Device.The cc2650 does not have the requisite RAM to be a Router. To form a network, you will need a cc2538 or cc2652 to act as a Router.

    Thanks,

    Seth

  • Is it possible that I can run UDP server on one CC2650 and UDP client on another to make them communicate to each other without OpenThread router?
  • Hey YK,

    No, Thread is a mesh protocol, not a point to point protocol. At least one Full Thread Device must be started to form a Thread Network. When forming the network; this FTD is a router and will be promoted to leader. Thread currently does not support end devices communicating directly with each other.

    Thanks,
    Seth
  • @srickard Thanks for clarifying this.
  • Hi Seth,

    Thanks for the response. The links you provided to the READMEs take me a 404 on this site, but using my browser's inspection tool, I was able to see the links you meant for me to look at.  Seems the "title" and "href" attributes were mixed up.

    On the CC2650, using the latest OpenThread build from the repository, there is no "coap" CLI option, most likely due to the size limitation of the board.

    I do have wpantund working with another OpenThread device which can act as a leader, but when I tried it using the CC2650, wpantund did not appear to work:

    wpantund[2148]: Starting wpantund 0.07.01rc1 (Mar 27 2017 22:14:29) . . .
    wpantund[2148]:         SOURCE_VERSION = 0.07.01rc1
    wpantund[2148]:         BUILD_VERSION = 0.07.01rc1-23-g07f6861
    wpantund[2148]: Reading configuration from "/etc/wpantund.conf" . . .
    wpantund[2148]: Configuration file "/etc/wpantund.conf" read.
    wpantund[2148]: set-config-param: "Config:NCP:DriverName" = "spinel"
    wpantund[2148]: set-config-param: "Config:NCP:SocketPath" = "/dev/ttyACM0"
    wpantund[2148]: set-config-param: "Config:TUN:InterfaceName" = "wpan0"
    wpantund[2148]: Ready. Using DBUS bus ":1.8"
    wpantund[2148]: Stat (autolog): Tx: 0 packets (0 udp, 0 tcp, 0 icmp6) -- 0 bytes
    wpantund[2148]: Stat (autolog): Tx history is empty
    wpantund[2148]: Stat (autolog):
    wpantund[2148]: Stat (autolog): Rx: 0 packets (0 udp, 0 tcp, 0 icmp6) -- 0 bytes
    wpantund[2148]: Stat (autolog): Rx history is empty
    wpantund[2148]: Stat (autolog):
    wpantund[2148]: Stat (autolog): NCP state history is empty.
    wpantund[2148]: Stat (autolog):
    wpantund[2148]: Stat (autolog):
    wpantund[2148]: Opening tun interface socket with name "wpan0"
    wpantund[2148]: Running as root without dropping privileges!
    wpantund[2148]: Initializing NCP
    wpantund[2148]: NCP is now BUSY.
    wpantund[2148]: [->NCP] CMD_PROP_VALUE_GET(PROP_PROTOCOL_VERSION) tid:1
    wpantund[2148]:         ↳ 810201
    wpantund[2148]: [->NCP] CMD_PROP_VALUE_GET(PROP_NET_STACK_UP) tid:2
    wpantund[2148]:         ↳ 820242
    wpantund[2148]: SpinelNCPInstance-Protothreads.cpp:447: Requirement Failed (get_ncp_state() != UNINITIALIZED)
    wpantund[2148]: Resetting and trying again... (retry 1)
    wpantund[2148]: [->NCP] CMD_RESET tid:3
    wpantund[2148]:         ↳ 8301
    wpantund[2148]: SpinelNCPInstance-Protothreads.cpp:424: Requirement Failed (event == EVENT_NCP_RESET)
    wpantund[2148]: Resetting and trying again... (retry 2)
    wpantund[2148]: SpinelNCPInstance-Protothreads.cpp:424: Requirement Failed (event == EVENT_NCP_RESET)
    wpantund[2148]: Resetting and trying again... (retry 3)
    wpantund[2148]: [->NCP] CMD_RESET tid:4
    wpantund[2148]:         ↳ 8401
    wpantund[2148]: SpinelNCPInstance-Protothreads.cpp:424: Requirement Failed (event == EVENT_NCP_RESET)
    wpantund[2148]: The NCP is misbehaving: Repeatedly unable to initialize NCP. Entering fault state.
    wpantund[2148]: State change: "uninitialized" -> "uninitialized:fault"
    

    I also tried /dev/ttyACM1.

    Here is the output from the working device:

    wpantund[2201]: Starting wpantund 0.07.01rc1 (Mar 27 2017 22:14:29) . . .
    wpantund[2201]:         SOURCE_VERSION = 0.07.01rc1
    wpantund[2201]:         BUILD_VERSION = 0.07.01rc1-23-g07f6861
    wpantund[2201]: Reading configuration from "/etc/wpantund.conf" . . .
    wpantund[2201]: Configuration file "/etc/wpantund.conf" read.
    wpantund[2201]: set-config-param: "Config:NCP:DriverName" = "spinel"
    wpantund[2201]: set-config-param: "Config:NCP:SocketPath" = "/dev/ttyACM0"
    wpantund[2201]: set-config-param: "Config:TUN:InterfaceName" = "wpan0"
    wpantund[2201]: Ready. Using DBUS bus ":1.10"
    wpantund[2201]: Stat (autolog): Tx: 0 packets (0 udp, 0 tcp, 0 icmp6) -- 0 bytes
    wpantund[2201]: Stat (autolog): Tx history is empty
    wpantund[2201]: Stat (autolog):
    wpantund[2201]: Stat (autolog): Rx: 0 packets (0 udp, 0 tcp, 0 icmp6) -- 0 bytes
    wpantund[2201]: Stat (autolog): Rx history is empty
    wpantund[2201]: Stat (autolog):
    wpantund[2201]: Stat (autolog): NCP state history is empty.
    wpantund[2201]: Stat (autolog):
    wpantund[2201]: Stat (autolog):
    wpantund[2201]: Opening tun interface socket with name "wpan0"
    wpantund[2201]: Running as root without dropping privileges!
    wpantund[2201]: Initializing NCP
    wpantund[2201]: NCP is now BUSY.
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_LAST_STATUS) tid:0
    wpantund[2201]: [-NCP-]: Last status (STATUS_RESET_POWER_ON, 112)
    wpantund[2201]: [-NCP-]: NCP was reset (STATUS_RESET_POWER_ON, 112)
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_IPV6_LL_ADDR) tid:0
    wpantund[2201]: Adding IPv6 Address...
    wpantund[2201]: TunnelIPv6Interface: Adding address "fe80::e022:f8d8:71f:9802" to interface "wpan0".
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_IPV6_ML_ADDR) tid:0
    wpantund[2201]: Adding IPv6 Address...
    wpantund[2201]: TunnelIPv6Interface: Adding address "fd5d:f85d:3a37:0:a381:c3e7:ac7:d693" to interface "wpan0".
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_NET_KEY_SEQUENCE_COUNTER) tid:0
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_IPV6_ADDRESS_TABLE) tid:0
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(SPINEL_PROP_THREAD_LEADER_NETWORK_DATA) tid:0
    wpantund[2201]: [-NCP-] Leader network data:
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(SPINEL_PROP_THREAD_ON_MESH_NETS) tid:0
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_THREAD_LOCAL_ROUTES) tid:0
    wpantund[2201]: [->NCP] CMD_PROP_VALUE_GET(PROP_PROTOCOL_VERSION) tid:1
    wpantund[2201]:         ↳ 810201
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_PROTOCOL_VERSION) tid:1
    wpantund[2201]: [-NCP-]: NCP is using different protocol minor version (NCP:3, wpantund:2)
    wpantund[2201]: [->NCP] CMD_PROP_VALUE_GET(PROP_NET_STACK_UP) tid:2
    wpantund[2201]:         ↳ 820242
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_NET_STACK_UP) tid:2
    wpantund[2201]: State change: "uninitialized" -> "offline"
    wpantund[2201]: [->NCP] CMD_PROP_VALUE_GET(PROP_NCP_VERSION) tid:3
    wpantund[2201]:         ↳ 830202
    wpantund[2201]: [NCP->] CMD_PROP_VALUE_IS(PROP_NCP_VERSION) tid:3
    wpantund[2201]: NCP is running "OPENTHREAD/g129c419-dirty; Jul 11 2017 14:14:41"
    wpantund[2201]: Driver is running "0.07.01rc1 (0.07.01rc1-23-g07f6861; Mar 27 2017 22:14:29)"
    

    It appears that the CC2650 cannot be used for the purpose I intend - forwarding traffic to the PC.  I am able to create the mesh, but it seems that any traffic over OpenThread to the CC2650 will remain on the CC2650 and cannot be routed to the PC. Would you agree or am I missing something? 

    Thanks,
    Matt

  • Hey Matt,

    To enable the application CoAP example in the CLI, you will have to pass `COAP=1` to the Makefile. It is not built in by default, but shouldn't be too large for the cc2650.

    I'm surprised that wpantund didn't connect right away. The `ncp_mtd` firmware should work, it may not get all the traffic that the `ncp_ftd` firmware would, but you should be able to connect to the network. Could you make sure to restart the cc2650 after you flash the `ncp_mtd` firmware, it is possible that the cJTAG interface set the "halt-in-boot" flag during programming. Then when wpantund tries to restart it, the JTAG module on the device holds at the reset.

    I can try to recreate your setup over here.

    Thanks,

    Seth

  • Hi Seth,

    I didn't realize that I need to load a different image for NCP functionality.  I've got it up and running now, but I'm unable to join the network as I get the following error:

    wpanctl:wpan0> join "OpenThread"
    Joining "OpenThread" 0000000000000000 as node type "end-device"
    join failed with error 16. PropertyNotFound
    Error 16 (0x10)

    Any clue what might be causing that? I did a scan and found:

    wpanctl:wpan0> scan
       | Joinable | NetworkName        | PAN ID | Ch | XPanID           | HWAddr           | RSSI
    ---+----------+--------------------+--------+----+------------------+------------------+------
     1 |      YES | "OpenThread"       | 0x98F3 | 22 | 5DF85D3A37F8D708 | E222F8D8071F9802 |  -50
    

    I tried to match the PANID, network key, and channel but it was a no go. I'm able to join using the cli_mtd image.

    Thanks,

    Matt

  • Hey Matt,

    Great, you got the NCP connected to the host.

    I think the only thing you are missing from connecting to the network is the extended PAN identifier. You can see on line 2 of your first code block that you are trying to connect to an XPANID of all zeros.

    Joining "OpenThread" 0000000000000000 as node type "end-device"

    You can shorten the steps to input the information by using the indices from the scan. For example; after a scan you could type `join 1` and it would set the information from the first line of the scan output. If you are using something other than the default network key, you still have to enter that.

    It looks like you are almost there.

  • I tried setting the xpanid, but it still appeared as zeros.  Then I tried the following:

    wpanctl:wpan0> join 1 0x1234001234001234
    Joining "1" 1234001234001234 as node type "end-device"
    join failed with error 16. PropertyNotFound
    Error 16 (0x10)
    

    Although the network key, panid, xpanid, and channel match, I still get the above error.

  • So `join 1` will use the panid, xpanid, channel, etc. from the first line of the last scan results for the join operation.

    Try setting every option for the join operation:

    join -p <panid> -x <xpanid> -c <channel> <network_name>

    If that does not work, please set the log level to the hightest by starting wpanctl with `-o SysLogMask all` or typing `set syslogmask all` in the interactive terminal. This should tell us what the PropertyNotFound error is about.

  • I believe this was the relevant portion of the syslog after trying to join the network using the command above:

    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: [->NCP] CMD_PROP_VALUE_SET(PROP_THREAD_ROUTER_ROLE_ENABLED) tid:10
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: #011↳ 8A03872A00
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT: fd_count=9 cms_timeout=5000
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     read_fd_set: 4, 5, 6, 8
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     write_fd_set:
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT: fd_count=9 cms_timeout=0
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     read_fd_set: 4, 5, 6, 8
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     write_fd_set:
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT: fd_count=9 cms_timeout=0
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     read_fd_set: 4, 5, 6, 8
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     write_fd_set:
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT: fd_count=9 cms_timeout=5000
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     read_fd_set: 4, 5, 6, 8
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     write_fd_set:
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT: fd_count=9 cms_timeout=4996
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     read_fd_set: 4, 5, 6, 8
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SELECT:     write_fd_set:
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: [NCP->] CMD_PROP_VALUE_IS(PROP_LAST_STATUS) tid:10
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: [-NCP-]: Last status (STATUS_PROP_NOT_FOUND, 13)
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: SpinelNCPTaskJoin.cpp:152: Requirement Failed ((ret) == 0)
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: Join failed: 16
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: Sending DBus response for "Join" to ":1.11"
    Aug 25 20:04:47 vagrant-ubuntu-trusty-64 wpantund[1451]: State change: "associating" -> "offline"
    

    It appears to be an issue with the PROP_LAST_STATUS property?

    Thanks,

    Matt

  • Hey Matt,

    It seems like wpantund is querying the NCP for it's last state, which would have been stored in non-volatile storage. The problem is that the Flash platform driver was not implemented on the cc2650 because of size concerns. So the settings driver will always return `OT_ERROR_NOT_FOUND`, which seems to be propagated up through the spinel interface as `STATUS_PROP_NOT_FOUND`. I'm surprised that they don't have a default value or graceful way to handle this, but if they are trying to query a value that isn't there it probably should be a failure.

    Getting the cc2650 NCP to work with wpantund looks to be blocked on a working flash driver. The good news is that the cc2652 flash driver can be easily ported over, if you have room in the memory map. Driverlib is functionally the same between the two SoCs, the only real difference is that the page size for the cc2650 is 0x1000 instead of 0x2000 for the cc2652.

    Thanks,

    Seth