- Notifications
You must be signed in to change notification settings - Fork5
This guide is focused on the MXChip IoT DevKit (AZ3166).
License
eclipse-threadx/iot-devkit
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This starter application is an adaptation of a sample developed originally by Microsoft. The original code can be found here:
https://github.com/eclipse-threadx/getting-started
We removed code providing support for Azure IoT Cloud. The only board supported is the MXChip AZ3166 for the time being.
Eclipse ThreadX and Eclipse ThreadX NetX Duo are included as submodules.
When cloning, you must specify the--recurse-submodules
option to get the code for the submodules. If you forget this option, just run the following commands in the root folder of your clone.
git submodule initgit submodule update --recursive
Theoretically, any recent laptop running Windows 11, Linux, or MacOS should do.
We tested on the following environments:
- Windows 11 24H2 (Version 10.0.26100.2161)
- Ubuntu 22.04.5 LTS (Windows Subsystem for Linux version 2.3.24.0)
- Mac M1, macOS Sonoma 14.6.1 (23G93), native
- Mac M1, macOS Sonoma 14.6.1 (23G93), Parallels Desktop for Mac Version 17.1.7 (51588), Ubuntu 22.04.5 LTS
This sample is preconfigured to work with theMXChip AZ3166 board.
This board can run Eclipse ThreadX but is also Arduino compatible.
The board features aSTM32F412RG MCU from STMicroelectronics. The MCU is clocked at 100Mhz and comes with 1 Mbyte of flash memory and 256Kbytes of SRAM.
The AZ3166 has the following hardware onboard:
- 128*64 dot matrix OLED display: VGM128064
- RGB LED lights controlled by P9813:
- Temperature and Humidity Sensor: HTS221
- Atmospheric pressure sensor: LPS22HB
- Bidirectional mono audio ADC/DAC: NAU88C10, microphone and 3.5mm headphone jack
- Six-axis accelerometer: LSM6DSL
- Geomagnetic sensor: LIS2MDL
- DC motor
- Two buttons
- three LED indicators
The board also features WiFi connectivity. However, only 2.4Ghz networks are supported.
This starter application is preconfigured to provide access to some, but not all, of the peripherals above.
In terms of tooling, all you need to work on the challenge is CMake, Ninja, and a suitable C compiler. Naturally, having Git installed could help as well. ;-)
The source code for ThreadX and related modules is very portable and compliant with all "required" and "mandatory" rules of MISRA-C:2004 and MISRA C:2012. Most modern C compilers should be able to compile it. The official build pipelines rely on Arm's embedded GNU toolchain.
Below are instructions to install the tools.
Ubuntu
apt install ninja-build cmake
Then, download and install Arm's embedded GNU toolchain, available athttps://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
The following will download and unpack version 13.3.rel1 of the software to/opt
.
wget https://developer.arm.com/-/media/Files/downloads/gnu/13.3.rel1/binrel/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xzsudo tar xJf arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi.tar.xz -C /opt
To test, you can run the following commands:
export PATH=$PATH:/opt/arm-gnu-toolchain-13.3.rel1-x86_64-arm-none-eabi/binarm-none-eabi-gcc --version
MacOS
For Mac M1, we tested using version 14.2.rel1. Below are links to download. The install is similar to Linux.
- Mac M1 native:arm-gnu-toolchain-14.2.rel1-darwin-arm64-arm-none-eabi.pkg
- Ubuntu 22.04.5 on Mac M1 via Parallels Desktop:arm-gnu-toolchain-14.2.rel1-aarch64-arm-none-eabi.tar.xz
Windows
winget install --id=Arm.GnuArmEmbeddedToolchain -ewinget install --id=Ninja-build.Ninja -ewinget install --id=Kitware.CMake -e
To compile the application, simply execute the relevant script found in theMXChip/AZ3166/scripts
folder.
To deploy your code on the AZ3166, just plug the board on your computer. When you do so, this will create a virtual drive and a serial port over USB. On my Windows laptop, the board appears as thed:
drive and theCOM4
serial port.
Once compilation is finished, you will find the executable in theMXChip/AZ3166/build/app
folder. The default filename ismxchip_threadx.bin
. Just copy that file to the virtual drive and the AZ3166's boot loader will reset the board and execute your code. There is also a deploy script in theMXChip/AZ3166/scripts
folder.
You can use any terminal application to connect to the serial port and monitor your application's output. Personally, we use Tera Term, which you can install usingwinget
. Just make sure you set the baud rate to115,200. On MacOS, we usedSerialTools which you can install via the Mac App Store.
If you deployed this application without any changes, you will get the following output in your terminal:
Scanning I2C bus..........................0x1a...0x1e.0x20...........................0x3c...............................0x5c..0x5f..........0x6a.....................Starting Eclipse ThreadX threadInitializing WiFiERROR: wifi_ssid is emptyERROR: wifi_init (0x00000043)ERROR: Failed to initialize the network (0x00000043)
To connect the board to a WiFi network, edit the following constants found incloud_config.h
:
HOSTNAME
WIFI_SSID
WIFI_PASSWORD
Make sure to select an appropriate value forWIFI_MODE
as well.
If the WiFi is properly congiured, you will get the output below at application startup:
Initializing WiFi MAC address: C8:93:46:88:6F:9ESUCCESS: WiFi initialized
The starter application provided in this repository simply initiates the board and WiFi connectivity.
We will eventually deliver updates showing how to access the sensors and publish data over MQTT and HTTP. Stay tuned!
NetX Duo is a comprehensive TCP/IPv4 and v6 network stack. It offers built-in HTTP and MQTT clients, among other things.
If you need a local MQTT broker for testing, we recommend using Eclipse Mosquitto. Here is how to install it.
You will find the Eclipse ThreadX documentation here:https://github.com/eclipse-threadx/rtos-docs
Ubuntu
apt install mosquitto mosquitto mosquitto-clients
The mosquitto-clients package installs themosquitto_pub
andmosquitto_sub
utilities.
Windows
winget install --id=EclipseFoundation.Mosquitto
The Windows installer provides themosquitto_pub
andmosquitto_sub
utilities. The default installation directory isProgram Files\mosquittoC:\Program Files\mosquitto
.