Interacting with the Kit at CLI via tmo_shell

Introduction

This document guides the reader on how to interact with the IoT Developer Kit at command line.

Prerequisites

For demonstration purposes we will be using Tera Term in the rest of this document. Windows 10 is the operating system that Tera Term is installed on. Using a different serial app, however, on a different OS is perfectly acceptable.

Interacting with the Kit at CLI via the tmo_shell

What is the tmo_shell?

The tmo_shell is T-Mobile's general-purpose interactive app for testing many features on the DevEdge IoT Developer Kit. It is an application based on the Zephyr RTOS. Note that the tmo_shell is already installed on the DevEdge IoT Developer Kit.

Where can I find the code for the tmo_shell?

You can find the code for the tmo_shell at https://github.com/tmobile/DevEdge-IoTDevKit-ZephyrSDK.

How do I connect to the tmo_shell?

  1. On a computer with several USB-A ports, install a serial app (e.g. Tera Term on Windows, 'screen' or Picocom on Linux). You will need this app to communicate with the serial ports on the T-Mobile DevEdge IoT Developer Kit.

  2. Connect your IoT Developer Kit to your computer like in the screenshot below.

  3. On your computer, open the Tera Term app. The Tera Term: New Connection window opens.
  4. Select the "Serial" radio button then from the drop down select the port that your T-Mobile DevEdge IoT Developer Kit is connected to. Click OK.

  5. Under Setup > Serial port... the settings for the kit's port need to be assigned the following way or you will not be able to connect to the kit:
    1. Speed / Baud Rate: 9600
    2. Data: 8
    3. Parity: none
    4. Stop bits: 1
    5. Flow control: none
    6. Click New setting if you had to change any of these values. Cancel if you did not. The Tera Term command line appears.

  6. In the Tera Term command line console press Enter on your keyboard. The Zephyr uart command line appears.

  7. Type tmo. This will display all of the commands available in the tmo_shell.

  8. Below is a list of things you may want to do at CLI.

What are some things I would want to do at tmo_shell CLI?

Connect to Wi-Fi

  1. Enter tmo ifaces in Tera Term. Based on the Data Sheet, the murata.1sc is the LTE CAT-M1/NB1 cellular modem and the RS9116W is the Wi-Fi/BLE radio device.

  2. Scan for available networks by running tmo wifi scan <iface_id>.

  3. Connect to a network by running tmo wifi connect <iface> "<ssid>" 0 "<psk>" or tmo wifi connect <iface> "<ssid>" if your network lacks a password.

  4. If the connection is successful you should receive a "Connected" response.

  5. Check the status of the Wi-Fi connection by entering tmo wifi status <iface>.

    You can also see that you are connected to your chosen Wi-Fi by looking at your smartphone > DevEdge IoT companion app > Home > Connectivity section.


Testing TCP connect/send/recv/close

  1. Create a TCP socket by calling tmo tcp create <iface> .

    For this to work, you must be connected to Wi-Fi. The error "Socket creation failed, errno = 0" indicates that you are not connected to Wi-Fi and, as a result, the TCP socket cannot be created.

  2. If the socket is created properly a <socket_number> will appear. In the case of the screenshot below the socket number is 0.

  3. To list all open sockets type tmo sockets.

  4. Connect the socket to a server by calling tmo tcp connect <socket_number> <ip_addr> <port>:

    You will need an echo server IP address in order to complete this part of the exercise.

    The message "Connected socket 0" appears if the call was made successfully.

  5. Send data by calling tmo tcp send <socket_number> "<data>". When you hit Enter on your keyboard Tera Term will simple go back to the uart prompt.

  6. To see the data you just sent, call tmo tcp recv <socket_number>.

  7. Close the socket by calling tmo tcp close <socket_number>.


Testing UDP connect/send/recv/close

  1. Create a UDP socket by calling tmo udp create <iface>.

    For this to work, you must be connected to Wi-Fi. The error "Socket creation failed, errno = 0" indicates that you are not connected to Wi-Fi and, as a result, the UDP socket cannot be created.

  2. If the socket is created properly a <socket_number> will appear. In the case of the screenshot below the socket number is 0.

  3. Connect the socket to a server by calling tmo udp connect <socket_number> <ip_addr> <port>.

    You will need an echo server IP address in order to complete this part of the exercise.

  4. The message "Connected socket 0" appears if the call was made successfully.

  5. Send data by calling tmo udp send <socket_number> "<data>".

  6. Receive data by calling tmo udp recv <socket_number>.

  7. Close the socket by calling tmo udp close <socket_number>.

  8. To check that the socket is closed type tmo sockets.


Testing UDP sendto/recvfrom

  1. Create a UDP socket by calling tmo udp create <iface>.

    For this to work, you must be connected to Wi-Fi. The error "Socket creation failed, errno = 0" indicates that you are not connected to Wi-Fi and, as a result, the UDP socket cannot be created.

  2. If the socket is created properly a <socket_number> will appear. In the case of the screenshot below the socket number is 0.

  3. Send data to by calling tmo udp sendto <socket_number> <server_ip> <server_port> "<data>".

    You will need an echo server IP address in order to complete this part of the exercise.

  4. Receive data by calling tmo udp recvfrom <socket_number>.

  5. Close the socket by calling tmo udp close <socket_number>.


Testing SMS send message

  1. Enter modem list.

  2. Enter modem sms send <modem index> <phone number> "<message>".

    Remember to replace 5555555555 with your cell phone number. In addition, spaces are not allowed in the message. If there are, please use quotes (single or double) around the message.

  3. Check you phone for a text message from your IoT Developer Kit.


Testing SMS receive message

Send an SMS from your phone back to the device then receive it on the device with this command.

  1. Enter modem sms recv 0 10.


Testing DNS Resolution

To perform DNS resolve, use the syntax shown below.

For this to work, you must be connected to Wi-Fi. The error "zsock_getaddrinfo failed (-2)" indicates that you are not connected to Wi-Fi and, as a result, the DNS call will fail.

  1. Enter tmo ifaces.

  2. Enter tmo dns <iface> t-mobile.com.

  3. The IoT Developer Kit returns address information, IP address and more.


Testing BLE SMP Pairing

Some things to note:

  1. For Bluetooth Low Energy (BLE) features you need a BLE monitoring app. T-Mobile recommends the LightBlue app.
  2. For Secure Manager Protocol (SMP) pairing, you may need to unpair the kit from the smartphone to test pairing again. This can be done in your smartphone's Bluetooth settings.

To enable SMP pairing enter tmo ble smp enable. After SMP is enabled if you try and pair your DevEdge IoT companion app to your IoT Developer Kit a "Connected <bluetooth_address> (random)" appears. A passkey appears as well. Enter this passkey in your smartphone's DevEdge IoT companion app.

The result on your smartphone looks like the below. Again, enter this passkey in your companion app.

To disable SMP pairing enter tmo ble smp disable.

To choose the pairing verification methodology, simply enable the relevant IO capabilities using the tmo ble smp toggle and tmo ble smp callbacks commands. For example, to test key entry on a device enable only keyboard enter the following at CLI:

uart:~$ tmo ble smp enable
SMP Enabled.
uart:~$ tmo ble smp callbacks
CONFIRM: disabled
DISPLAY: enabled
KEYBOARD: disabled
uart:~$ tmo ble smp toggle display
Display is now disabled
uart:~$ tmo ble smp toggle keyboard
Keyboard is now enabled
uart:~$ tmo ble smp callbacks
CONFIRM: disabled
DISPLAY: disabled
KEYBOARD: enabled
uart:~$


Find the IMEI

  1. Enter tmo ifaces. Based on the Data Sheet, the murata.1sc is the LTE CAT-M1/NB1 cellular modem and the RS9116W is the Wi-Fi/BLE radio device.

  2. Enter tmo modem.

  3. Enter tmo modem 1 imei.

  4. The IMEI for your IoT Developer Kit appears.


View JSON Data

  1. Enter tmo json payload then press Enter on your keyboard.

Turn on the Green LED

This command is utilizing the Zephyr shell instead of the tmo_shell. Please see the document API Sample Requests to learn more.


  1. Enter led on pwmleds 2.

  2. The green light on the IoT Developer Kit turns on.


Find the tmo_shell / SDK Version Number

  1. Type tmo version then press Enter on your keyboard.


Further Resources

Beyond the list above, there are other commands available at tmo_shell. Take a look at the table below.

tmo_shell Commands

Commands

Command Description

Subcommands

Subcommand Descriptions

Required Arguments

Example Syntax

battery

Battery and charger status.

  1. charger
  2. discharge
  3. percent
  4. voltage
  1. Get charger status.
  2. Discharge battery for shipping.
  3. Get battery level (percent)
  4. Get battery level (volts)
Not applicable.
  1. tmo battery charger
  2. tmo battery discharge
  3. tmo battery percent
  4. tmo battery voltage
ble

Various Bluetooth Low Energy (BLE) commands.

  1. smp
    1. enable
    2. disable
    3. callbacks
    4. toggle
    5. respond
  2. adv
    1. conn
    2. eddystone
    3. ibeacon
  3. rssi
  1. BLE SMP Controls
    1. Enable Security Manager Protocol (SMP)
    2. Disable Security Manager Protocol (SMP)
    3. Show enabled callbacks.
    4. Toggle call backs.
    5. Send response.
  2. BLE advertisement test controls
    1. Advertise as connectable
    2. Advertise as eddystone beacon
    3. Advertise as ibeacon
  3. BLE peripheral RSSI read

  1. tmo ble adv ibeacon
buzzer

Buzzer test.

  1. jingle
  2. ramp
  3. tone
  4. vol
  1. Play TMO jingle
  2. Play ramp tune
  3. Play a tone for a time
  4. Set buzzer volume
  1. Not applicable.
  2. Not applicable.
  3. <freq in Hz> <time in msecs>
  4. <volume percent>
  1. tmo buzzer jingle
  2. tmo buzzer ramp
  3. tmo buzzer tone <freq in Hz> <time in msecs>
  4. tmo buzzer vol 45
certs

CA cert commands. Load, list, or dump certificates of authority on to your kit.

  1. dld
  2. info
  3. list
  4. load
  5. modem_load
  1. Download certificates.
  2. Print certificates.
  3. List certificates.
  4. Load certificates.
  5. Send loaded certificate to modem.

  1. tmo certs dld <devid> <URL>
  2. tmo certs info
  3. tmo certs list
  4. tmo certs load <indexid>
  5. tmo certs load <modem_load>
dfu Device firmware (FW) updates.
  1. auth_key
  2. base_url
  3. download
  4. iface
  5. settings
  6. update
  7. version
  1. Set firmware download auth key.
  2. Set firmware download base URL.
  3. Download firmware.
  4. Set firmware download iface.
  5. Print DFU settings.
  6. Update firmware.
  7. Get current firmware version.
<iface>
  1. tmo dfu version 1
  2. tmo dfu update 2 0
  3. tmo dfu download 2
dns Performs a DNS lookup.NoneNot applicable<devid> <hostname> tmo dns 2 t-mobile.com
file

File commands.

  1. cp
  2. ll
  3. mv
  4. sha1
  1. Copy a file.
  2. Detailed file list.
  3. Move a file.
  4. Compute a file SHA1.

  1. tmo file cp <source file> <destination file>
  2. tmo file ll <folder>
gnssversion Displays the GNSS / GPS device's firmware version number. NoneNot applicableNot applicabletmo gnssversion
http Get http URL.NoneNot applicable<devid> <URL>tmo http 2 http://www.t-mobile.com
hwid Read the HWID divider voltage.NoneNot applicable
tmo hwid
ifaces List all the interfaces available on the kit with their ID number. NoneNot applicableNot applicable. tmo ifaces
json JSON data options. This set of commands allows the user to send JSON data to a particular base URL and path (endpoint). It also allows for the printing of the JSON payload at CLI.
  1. base_url
  2. disable
  3. enable
  4. iface
  5. path
  6. payload
  7. settings
  1. Set JSON base URL.
  2. Disable JSON transmission.
  3. Enable JSON transmission.
  4. Set JSON iface.
  5. Set JSON path part of URL.
  6. Print JSON data.
  7. Print JSON settings to understand what base URL, path, and interface is being used in the JSON post.
<iface>
  1. tmo json base_url https://devkit.devedge.t-mobile.com
  2. tmo json disable
  3. tmo json enable
  4. tmo json iface 2
  5. tmo json path /device/12345678
  6. tmo json payload
  7. tmo json settings
kermit Embedded kermit.
  1. -r
  2. -s <file>
  3. -p
  4. -b [12345]
  5. -k
  6. -B
  7. -T
  8. -R
  9. -L
  10. -h
  1. Receive files
  2. Send files
  3. Parity: none, even, odd, mark, space
  4. Block check type: 1, 2, 3, or 5
  5. Keep incompletely received files
  6. Force binary mode
  7. Force text mode
  8. Remote mode (vs local)
  9. Local mode (vs remote)
  10. Help (this message)

  1. tmo kermit -r
  2. tmo kermit -s /tmo/test.txt
location Get latitude, longitude, Sats, HDOP, TTFF, and 1PPS data. NoneNot applicable.Not applicable. tmo location
modem

Modem status and control.

None Not applicable

<iface> <cmd_str>

cmd_str has the following available arguments:

  1. <apn>
  2. <awake>
  3. <conn_sts>
  4. <edrx>
  5. <golden>
  6. <iccid>
  7. <imei>
  8. <imsi>
  9. <ip>
  10. <ip6>
  11. <msisdn>
  12. <psm>
  13. <ptw>
  14. <sim>
  15. <sleep>
  16. <ssi>
  17. <version>
  18. <wake>
tmo modem 1 imei
ping Test and verify if a particular destination IP address exists.
  1. -c
  2. -s
  3. -t
  1. Defines the ping's count.
  2. Defines the ping's packet size.
  3. Defines the ping's timeout.
<iface>tmo ping [-c count] [-s packetsize] [-t timeout] 2 t-mobile.com
pmDevice power management controls.
  1. get
  2. lock
  3. off
  4. on
  5. resume
  6. suspend
  7. unlock
  1. Get a device's power management state
  2. Lock a device's power management state
  3. Put a device into the off/unpowered state
  4. Put a device into the on/powered state
  5. Resume a device into the suspended state
  6. Put a device into the suspended state
  7. Unlock a device's power management state

Use the command device list to obtain the name of the device you wish to learn more about or type tmo pm get . Examples of device names include:

  • murata_1sc
  • rs9116w@0
  • pwmleds
  • sonycxd5605@24
  • tsl2540@39
  1. tmo pm get murata_1sc
  2. tmo pm lock rs9116w@0
  3. tmo pm off sonycxd5605@24

sntp

Synchronize your kit's system time with a server of your choice. NoneNot applicableNot applicabletmo sntp <iface> <server>
sockets Lists all the open sockets available on the kit. NoneNot applicableNot applicabletmo sockets
sys_pm System power management controls.
  1. active
  2. fulloff
  3. idle
  4. off
  5. standby
  6. suspend
  1. Put system into the active state
  2. Put system into the off state (without RTCC)
  3. Put system into an idle state
  4. Put system into the off state (retaining RTCC)
  5. Put system into the standby state
  6. Put system into the suspend state
Not applicable
  1. tmo sys_pm active
  2. tmo sys_pm fulloff
  3. tmo sys_pm idle
  4. tmo sys_pm off
  5. tmo sys_pm standby
  6. tmo sys_pm suspend
tcp Send/receive TCP packets.
  1. close
  2. connect
  3. create
  4. recv
  5. recb
  6. recvsms
  7. secure_create
  8. send
  9. sendb
  10. sendsms
  11. xfersz
  1. Close a TCP socket.
  2. Connect to another TCP.
  3. Create secure TCP packets.
  4. Receive TCP packets.
  5. Receive larger TCP packets, up to 5000 KB.
  6. Receive text message.
  7. Create a secure TCP socket.
  8. Send TCP packets.
  9. Send larger TCP packets, up to 5000 KB.
  10. Send text message.
  11. ???
  1. <socket>
  2. <socket><ip><port>
  3. <iface>
  4. <socket>
  5. <socket> <size>
  6. <socket> <wait time (seconds)>
  7. <iface>
  8. <socket> <payload>
  9. <socket><size>
  10. <socket><phone number><message>
  11. [size]
tmo tcp create <iface_id>
test Run automated tests.
  1. mfg
  2. qa
  1. Manufacturing
  2. Quality Assurance
Not applicable.tmo test mfg
udp Send/receive UDP packets.
  1. cert
  2. ca
  3. close
  4. connect
  5. create
  6. key
  7. profile
  8. secure_create
  9. recv
  10. recvb
  11. recvfrom
  12. recvsms
  13. send
  14. sendb
  15. sendsms
  16. sendto
  17. xfersz
  1. Create or delete a DTLS credential for a UDP socket.
  2. Create or delete a DTLS certificate of authority for a UDP socket.
  3. Close UDP socket.
  4. Connect to another UDP.
  5. Create UDP packets.
  6. Create or delete a DTLS credential key for a UDP socket.
  7. Create or delete a certificate profile for a UDP socket.
  8. Create a secure UDP socket.
  9. Receive UDP packets.
  10. Receive large UDP packets, up to 5000 KB.
  11. Receive UDP packets from a sender.
  12. Receive text message.
  13. Send UDP packets.
  14. Send UDP packets to a specific port.
  15. Send large UDP packets, up to 5000 KB.
  16. Send text message.
  17. ???
  1. <w or d> <socket>
  2. <w or d> <socket>
  3. <socket>
  4. <socket> <ip> <port>
  5. <iface>
  6. <w or d> <socket>
  7. <a or d> <socket>
  8. <iface>
  9. <socket>
  10. <socket> <size>
  11. <socket> <ip> <port>
  12. <socket> <wait time (seconds)>
  13. <socket payload>
  14. <socket> <size>
  15. <socket> <phone number> <message>
  16. <socket> <ip> <port> <payload>
  17. <size>
tmo udp connect <socket_number> <ip_addr> <port>
version

Print the version details for the tmo_shell. Use this command to understand what version of the tmo_shell your IoT Developer Kit is on.

NoneNot applicable.Not applicable. tmo version
wifi Wi-Fi controls. Connect to Wi-Fi using these commands.
  1. connect
  2. disconnect
  3. mac
  4. scan
  5. status
  1. Connect to Wi-Fi.
  2. Disconnect from Wi-Fi.
  3. Obtain the media access control address for an interface.
  4. Scan for Wi-Fi SSIDs.
  5. Check the Wi-Fi status of an interface.
  1. <iface> "<SSID>"
    <channel number (optional), 0 mean all>
    <PSK (optional: valid only for secured SSIDs)>
  2. <iface>
  3. <iface>
  4. <iface>
  5. <iface>
  1. tmo wifi scan <iface_id>
  2. tmo wifi connect <iface_id> "<SSID>" 0 "<PSK>"
  3. tmo wifi mac 2

tmo_shell Glossary

Term

Definition

FTDI An acronym for Future Technology Devices International.
HDOP

An acronym for the phrase "Horizontal Dilution Of Precision". Please read this Wikipedia article to learn more about this GNSS data value.

<iface> Interface ID.
<payload>

The data to be sent.

<psk> Password for your SSID or Wi-Fi network.
<port> Port number.
<socket> Socket ID.
<SSID> A wireless local area network identifier.
TTFF An acronym for the phrase "Time To First Fix". Please read this Wikipedia article to learn more about this GNSS data value.


Troubleshooting

  • Issue 1 - I cannot connect to my IoT Developer Kit via serial app? What am I doing wrong?
  • Solution 1 - Please check to ensure that the J-Link USB-C Debug port is plugged into your computer like in the picture below. If it is plugged in any other way you will not be able to connect your serial port to your kit.


FAQ

  • Question 1 - What API calls can I make to the sensors via CLI?
  • Answer 1 - Please read the API Sample Requests document to learn more.


  • Question 2 - What format is the resulting sensor data in?
  • Answer 2 - JSON


  • Question 3 - Why am I seeing a "Disconnected from 01:23:45:67:89:01 (random) (reason 0x13)" message in Tera Term / my serial app? What is the caused from?
  • Answer 3 - When you disconnect the Bluetooth DevEdge IoT mobile app from the DevEdge IoT Developer Kit, the above message is what appears in your serial app.
    • In your mobile app:

      In your serial app:


  • Question 4 - Why am I seeing a "Connected 01:23:45:67:89:01 (random)" message in Tera Term / my serial app?
  • Answer 4 - In the mobile app, when you tap the T-Mobile DevEdge device, the bluetooth connection creates this message.
    • In your mobile app:

      In your serial app:


  • Question 5 - When using the command tmo wifi connect 2 "<SSID>" 0 "<psk>" I get the following error: "Connection request failed (8)". What does this mean?
  • Answer 5 - Your password is not being accepting by the Wi-Fi connection. Re-check your password and try again.