Wiki

Clone wiki

PyRTEdoc / Home

Welcome

Welcome and thanks for visiting PyRTE wiki!

We are a bunch of engineers down under from M2MConnectivity, which was acquired by Sierra wireless in Jan 2020. We started looking into using Sierra Wireless Legato to build embedded applications for IoT projects months later. Legato Framework is a fantastic project to IoT community, esp useful for developers who are familiar with Linux development although not limited to. Additional to the heavy-lifting works Legato Framework has done, we found some glue works could be needed on these directions,

  • Seamless development experience across PC and embedded device
  • Hassle-free set up – no recompiling Linux or worrying about partitions
  • No skills needed for wireless network

We also believe more domain experts in various industries getting into application development, esp. people with data analytics background with Python skills.

So if you share any of these beliefs, you may find PyRTE useful, which we have built to address the following,

  • Standard Python3 with most popular modules supported. User can develop on PC with familiar Python environment.
  • The runtime is wrapped as standard Legato application installer – no need to rebuild Linux or customize firmware.
  • The runtime comes with a connection manager(wrapped as a separate Legato app called connManager) which handles wireless network attachment.

These hardware are supported currently,

More hardware to be supported next,

  • Other Legato modules if there are demands
  • IoT Boards from Renfell
  • RIIM mesh modules and boards from Radiocrafts

Installation

Get the installers of connManager and PyRTE

Please find the download page here.

Why there is a connManager app?

When develop an app with Python on PC, the internet connection is "assumed" to be always available. However, on a cellular device, it's not always true. There will be specific component to handle "attaching" the device to cellular network. If we implement this component in application development, we would find it hard to have a seamless development experience across PC and cellular device. So we have connManager here with these functions,

  • detect off the network and reattach to cellular network
  • detect WAN rx usage, and if zero incoming traffic for certain time, reboot the device
  • count continue retries of failure of attachment and reboot
  • reboot device once receive a reboot SMS
  • expose a status file in case application needs to know the connection status

connManager is wrapped as a standard Legato app so that the users of PyRTE can still choose to not use connManager by not installing connManager.

PyRTE is actively developed for latest Legato and firmware versions.

It's important you use the correct PyRTE and connManager matching the firmware and Legato versions on your current device.

You can ssh into your device and issue these commands to get the versions,

root@fx30s:~# fwupdate query
Connecting to service ...
Firmware Version: SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
Bootloader Version: SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
Linux Version: 3.18.140 #1 PREEMPT Fri May 14 11:13:23 UTC 2021
FX30 Version: R14.1.1.002

root@fx30s:~# legato version
19.11.5.a1621d58_27c4cd8552e17e79fdc3b0c91ff8bce9
root@fx30s:~#

Both of PyRTE and connManager are standard Legato apps. Any ways to install a Legato app apply to them.

The quickest way would be to SCP the installers to FX30 or other target devices at /tmp. Then use update command to install the app,

root@fx30s:/tmp# update connManager.v0.0.6.wp77xx.update
Unpacking package: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
Applying update: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
SUCCESS
root@fx30s:/tmp# update --mark-good
System is now marked 'Good'.
root@fx30s:/tmp#
root@fx30s:/tmp# update pyrte.wp77xx.update
Unpacking package: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
Applying update: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
SUCCESS
root@fx30s:/tmp# update --mark-good
System is now marked 'Good'.
root@fx30s:/tmp#

Alternatively, if you are a Legato developer and have your dev machine set up, you can use app install to install the app on target.

(lsh:fx30s_r9) user:~/myWorkspace/apps/legatoconnmanager$ app install connManager.v0.0.6.wp77xx.update 192.168.2.2
Applying update from file 'connManager.v0.0.6.wp77xx.update' to device at address '192.168.2.2'.
The authenticity of host '192.168.2.2 (192.168.2.2)' can't be established.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.2' (RSA) to the list of known hosts.
root@192.168.2.2's password: 
Unpacking package: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
Applying update: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
SUCCESS
Done

(lsh:fx30s_r9) user:~/myWorkspace/apps/pyrte/release$ app install pyrte.wp77xx.update 192.168.2.2
Applying update from file 'pyrte.wp77xx.update' to device at address '192.168.2.2'.
root@192.168.2.2's password: 
Unpacking package: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
Applying update: 100% ++++++++++++++++++++++++++++++++++++++++++++++++++
SUCCESS
Done
(lsh:fx30s_r9) user:~/myWorkspace/apps/pyrte/release$ 

Note: Sometimes, if the app has been installed before, it looks the app install wouldn't install the new one. It's possible to be caused by the 30min probation period in which the app fails can cause the system to roll back to a previous good one. So have to issue update --mark-good in FX30 to label the system good. connMananger reboots in 15mins if no RX bytes, which can trigger rolling back to good previous system mechanism. So don't forget to mark the system good.

Make sure to ssh into the device and config APN,

cm data apn <apn> 

Config connManager to meet your request,

connManager Config Usage:

e.g.: config set /apps/connManager/app/noRxDataTimeout 1800

  • noRegTimeout Specify timeout in seconds before reset radio for no registration, default 60
  • maxRadioRetry Specify max times of retry of reset of radio without registration, default 3
  • noRxDataTimeout Specify timeout in seconds before reboot for no receiving traffic, default 900

Quick test with Google

ssh into the device and give it a go,

root@fx30s:~# python3
Python 3.5.2 (default, Oct  2 2020, 02:54:47)
[GCC 6.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
>>> import requests
>>> r = requests.get('https://www.google.com')
>>> r.status_code
200

Development Guide

Support

Have fun!

Updated