First of all when starting this endeavor the first question is: Which language to use.
As Apache MyNewt is written in C, C, C++, Rust or Go would be reasonable choices.
So first, for this project, I'll start summing up the requirements and then add each candidate towards it's pro's and con's.
Requirement | C | C++ | Rust | Go | Links |
---|---|---|---|---|---|
Size of the binary must be as small as possible | |||||
Memory usage of the running program must be as small as possible | |||||
The running program should be as optimized as possible in order to use less CPU cycles | |||||
We must be able to integrate the application on Apache MyNewt | |||||
As we will be using Thrift for communication with a PLC4X Master, Thrift support is required | https://thrift.apache.org/docs/Languages | ||||
Build tool | CMake | CMake | Rust Cargo | Go (Integrated build tool) | |
It should be integrable into the Apache PLC4X Build | |||||
IDE Support should help writing code | |||||
Should support Unit-Testing |
Conclusion:
It seems Rust would be a good candidate, followed by C++ and C. Go I would like to completely keep out of this endeavour.
However I think I'll start implementing the model, parsers and serializers in C as the Java counterparts are structurally very similar and C is: a) Well established b) I know it c) Integration into the build works d) I can use them in any other C-based language (Also C++, Rust and Golang)
Update: 03.04.2020
I finished setting up a PLC4C module in the normal PLC4X build which uses CMake to build a C11 application as well as tests and run these integrated into the maven phases:
- Compile → Compiles the libraries and applications
- Test-Compiler → Compiles the tests
- Test → Uses CTest to execute the tests
While talking to Julian Feinauer I mentioned my dilemma with Thrift not being a good candidate for the communication to my Embedded client. He suggested gRPC which seems to pretty lightweight and binary with the option to secure communication using TLS and alike. Unfortunately I couldn't find a true C-type implementation. However looking at some gRPC packets in WireShark it seems that it shouldn't be a problem to generate a client using our code-generator. All we need for this is an MSPEC for gRPC. I think this is the most promising path as it doesn't make us depend on another solution which itself might again require third party tools.
Apache MyNewt
Everything in MyNewt is built with the projects own build tool "Newt" this can be built locally.
The mynwet core module is a set of libraries that can be used by applications. So it's not built itself.
Inside the mynewt core libary there are some interesting parts where I had to find out what they mean first:
- mynewt-core/hw/mcu: MCU = Micro Controller Unit (The type of processor/chip your solution will be running on)
- mynewt-core/hw/bsp: BSP = Board Support Package (Some development boards come with on-board periferials, these BSPs help pre-configuring different setups)
- mynewt-core/hw/drivers/crypto: Crypto drivers (usually included in some of the MCUs like the stm32)
- mynewt-core/hw/drivers/hash: Cryptographic Hashing drivers (usually included in some of the MCUs like the stm32)
- mynewt-core/hw/drivers/adc: ADC = Analog Digital Converters
- mynewt-core/hw/drivers/display/ssd1673: E-Paper driver
- mynewt-core/hw/drivers/lora: LoRaWan drivers
- mynewt-core/hw/drivers/lwip: LightWeight IP Stack
- mynewt-core/hw/drivers/trng: True Random Number Generator
For this project I will be needing:
- crypto
- hash
- lwip
- Second ethernet device
- Optionally LoRaWan support
Suitable Hardware (Only MyNewt supported devices listed on the website):
MyNewt modules | CPU and memory specs | Connectors | Connectivity | Bus Types | I/O | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Device | Picture | Price range | Dimensions | Tested with MyNewt 1.8.0 | bsp | mcu | Chip | Cpu Speed | Ultra Low Power | crypto | Ram | Flash | SD | Power | Arduino Uno Style Connectors | Arduino Nano Style Connectors | Adafruit Feather Connectors | Raspberry Pi Connectors | mikroBUS Connectors | Ethernet 100/10MBit | Wifi | LoRaWan support | Sigfox support | 6LoWPAN support | ZigBee support | Bluetooth | Bluetooth Low Energy | NFC | Infrared | SPI | I²C | I²S | USB | CAN | UART | Digital | Analog | Sensors | Datasheet | Remarks | |||||||
Input | Output | Input | Output | Magnetometer | Accelerometer | Barometer | Humidity | Temperature | Other | ||||||||||||||||||||||||||||||||||||||
Adafruit nRF52 Feather | 25€ - 30€ | 51x23x8mm | ada_feather_nrf52 | nrf52xxx | 64 MHz | 64 KB | 512 KB | 1,7 - 3,3V | 19 | 19 (12 PWM) | 8 (12 bit) | https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather | Seems out of stock at Adafruit | ||||||||||||||||||||||||||||||||||
Adafruit Feather STM32F405 | 22€ - 30€ | 52x23x10mm | ada_feather_stm32f405 | stm32f4xx | STM32F405 | 168MHz | 192 KB (128 KB general usage) | 1 MB (Additional 2 MB SPI Flash) | 3,3V (Most pins 5V compliant) | 14 (general purpose) | 14 (general purpose) | 6 | 2 | https://learn.adafruit.com/adafruit-stm32f405-feather-express | Seems out of stock at Adafruit | ||||||||||||||||||||||||||||||||
Apollo 2 Evaluation board | 55€ | ??? | apollo2_evb | nrf52xxx | 48 MHz | 256 KB | 1 MB | 1,8 - 3,6V | 15 (14 bit) | https://www.ambiqmicro.com/static/mcu/files/Apollo2_MCU_Data_Sheet_rev1p1.pdf | Pretty difficult to find specs on as well as shops for purchassing | ||||||||||||||||||||||||||||||||||||
Arduino Primo | 40€ | 68x53mm | arduino_primo_nrf52 | nrf52xxx | STM32F103RBT6 nRF52832 (Arduino) ESP8266 (Wifi) | 20 KB 64 KB 8 MB / 12 MB | 64 KB 512 KB 4 MB | 3,3V | 14 | 14 (12 PWM) | 6 | https://store.arduino.cc/arduino-primo | Seems to be Retired | ||||||||||||||||||||||||||||||||||
B-L072Z-LRWAN1 | 50€ | 106x65mm (Without Antenna) | b-l072z-lrwan1 | stm32l0xx | STM32L072CZ | 32 MHz (max) | 20KB | 196KB | 3,3V | 16 | 16 | 13 (12 bit) | 2 | ||||||||||||||||||||||||||||||||||
B-L475E-IOT01A | 50€ - 60€ | 72x41x9mm | b-l475e-iot01a | stm32l4xx | STM32L4 | 80 MHz (max) | 128KB | 1MB | 2 Microphones Time-Of-Flight gesture-detection sensor | https://www.st.com/content/ccc/resource/technical/document/data_brief/group1/ab/8e/cb/09/e6/fc/42/9a/DM00347837/files/DM00347837.pdf/jcr:content/translations/en.DM00347837.pdf | |||||||||||||||||||||||||||||||||||||
BBC Microbit | 15€ - 20€ | 43x52mm | bbc_microbit | nrf51xxx | Nordic nRF51822 | 16 MHz | 16 KB | 256 KB | 4,5 - 5,25V | 11 (general purpose) | 11 (general purpose) | 6 | https://en.wikipedia.org/wiki/Micro_Bit https://microbit-micropython.readthedocs.io/en/latest/pin.html | ||||||||||||||||||||||||||||||||||
Black VET6 STM32F407VET6 Board | 8€ - 14€ | 140x140x20mm | black_vet6 | stm32f4xx | STM32F407VET6 | 168 MHz | 192 KB | 512KB | 1,8 - 3,6V | 82 | 82 | 16 (12 bit) | 2 | https://os.mbed.com/users/hudakz/code/STM32F407VET6_Hello/shortlog/ | |||||||||||||||||||||||||||||||||
Waveshare BLE400 module | 20€ | 95x55mm | ble400 | nrf51xxx | Nordic nRF51822 | 16 MHz | 16 KB | 256 KB | 1,8 - 3,5V 3,3 - 5V | 0 | 0 | 0 | 0 | https://www.waveshare.com/wiki/BLE400 | Seems to need extension boards for connectivity | ||||||||||||||||||||||||||||||||
Bluepill stm32f103c8 board | 1€ - 2,5€ | 53x23mm | bluepill | stm32f1xx | STM32F103C8T6 | 72 MHz | 20 KB | 64 KB | 3,3 - 5V | 32 (general purpose) | 32 (general purpose) | 10 | 0 | https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html http://stefanfrings.de/stm32/stm32f1.html | |||||||||||||||||||||||||||||||||
Rigado BMD-200 evaluation board | 67€ | 60x38mm | bmd200 | nrf51xxx | Nordic nRF51822 | 16 MHz | 32/16 KB | 256 KB | 1,8 - 3,6V | 14 (general purpose) | 14 (general purpose) | 8 | 0 | Ambient Light Sensor | https://www.u-blox.com/sites/default/files/BMD-200_DataSheet_%28UBX-19034211%29.pdf | ||||||||||||||||||||||||||||||||
Rigado BMD-300 evaluation board | 71€ - 96€ | 82x56mm | bmd300eval | nrf52xxx | Nordic nRF52832 | 32 MHz | 64 KB | 512 KB | 1,8 - 3,6V 5V | 32 (general purpose) | 32 (general purpose) | 8 | 0 | https://www.u-blox.com/sites/default/files/BMD-300_DataSheet_%28UBX-19033350%29.pdf | |||||||||||||||||||||||||||||||||
Calliope Mini | 33€ - 40€ | 85x85x13mm | calliope_mini | nrf51xxx | Nordic nRF51822 | 16 MHz | 16 KB | 256 KB | 3,3V | 11 (general purpose) | 11 (general purpose) ( | 4 | 0 |
| https://calliope.cc/media/pages/calliope-mini/technische-daten/933629563-1581514273/2020_tech-sheet.pdf | ||||||||||||||||||||||||||||||||
70€ | 100x106mm | ci40 | danube | cXT200 | 550 MHz | 256 MB | 512 MB | 5V 9V | 32 (general purpose) | 32 (general purpose) (4 PWM) | 5 | 0 |
| Seems quite oversized for this project | |||||||||||||||||||||||||||||||||
Dialog DA1469x PRO development kit | dialog_da1469x-dk-pro | da14699 | Couldn't find any place to purchase this kit | ||||||||||||||||||||||||||||||||||||||||||||
DWM1001 Development Kit | 43€ - 62€ | 62x43mm | dwm1001-dev | nrf52xxx | Nordic nRF52832 | 64 MHz | 64 KB | 512 KB | 2,8 - 3,6V 3,6V - 5.5V | 24 (general purpose) | 24 (general purpose) | 0 | 0 | https://www.decawave.com/wp-content/uploads/2019/01/DWM1001-DEV_Datasheet-1.2.pdf https://www.decawave.com/sites/default/files/dwm1001_system_overview.pdf https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf | |||||||||||||||||||||||||||||||||
embarc emsk Development Kit | 182€ | embarc_emsk | snps | 128 MB | 2 MB | Seems to be/have an FPGA | |||||||||||||||||||||||||||||||||||||||||
Fanstel EV-BT840(E) | 56€ | fanstel-ev-bt840 | nrf52xxx | Nordic nRF52840 | 64 MHz | 265 KB | 1 MB | 1,7V - 5,5V | 48 (general purpose) | 48 (general purpose) (16 PWM) | 8 (12 bit) | 0 | https://www.fanstel.com/bt840e | ||||||||||||||||||||||||||||||||||
FRDM-K64F | 49€ | 81x53mm | frdm-k64f | MK64F12 | MK64FN1M0VLL12 | 120 MHz | 256KB | 1MB | 3,3V 5-9V | 40 (general purpose) | 40 (general purpose) (16 PWM) | 24 (12 bit) | 24 (12 bit) | https://www.nxp.com/design/development-boards/freedom-development-boards/mcu-boards/freedom-development-platform-for-kinetis-k64-k63-and-k24-mcus:FRDM-K64F https://os.mbed.com/platforms/FRDM-K64F/ | |||||||||||||||||||||||||||||||||
HiFive1 board (revB) | 70€ | 68x51mm | hifive1 | fe310 | SiFive E31 | 320 MHz | 8+16 KB | 4MB | 1,8V 3,3V 7-12V | 19 | 19 (9 PWM) | https://www.sifive.com/boards/hifive1 | |||||||||||||||||||||||||||||||||||
ublox EVK-NINA-B1xx | 70€ 10€ (chip) | 10x14mm (chip) | nina-b1 | nrf52xxx | Nordic nRF52832 | 64 MHz | 64KB | 512KB | 7 (general purpose) | 7 (general purpose) | 8 | 0 | https://www.u-blox.com/en/product/evk-nina-b1?lang=de https://www.u-blox.com/en/product/nina-b1-series-open-cpu | NINA-B111 and B112 are super-mini cpus | |||||||||||||||||||||||||||||||||
Nordic nRF51 DK | 33€ | nordic_pca10028 | nrf51xxx | Nordic nRF51822 | 16 MHz | 16 KB | 256 KB | 3V (bat.) 5V (usb) | 31 (general purpose) | 31 (general purpose) | 0 | https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF51-DK nRF51822https://www.nordicsemi.com/-/media/Software-and-other-downloads/Product-Briefs/nRF51822-product-brief.pdf?la=en&hash=A4B5A9AA6675A58F7B779AF81C860CD69EB867FD | |||||||||||||||||||||||||||||||||||
Nordic nRF51 DK (16k) | nordic_pca10028-16k | nrf51xxx | Nordic nRF51822 | 16 MHz | 16 KB | 256 KB | 3V (bat.) 5V (usb) | 31 (general purpose) | 31 (general purpose) | 0 | https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF51-DK nRF51822https://www.nordicsemi.com/-/media/Software-and-other-downloads/Product-Briefs/nRF51822-product-brief.pdf?la=en&hash=A4B5A9AA6675A58F7B779AF81C860CD69EB867FD | ||||||||||||||||||||||||||||||||||||
Nordic nRF52 DK | 42€ | nordic_pca10040 | nrf52xxx | Nordic nRF52832 | 64 MHz | 64KB | 512KB | 1,7-3V (bat.) 5V (usb) | 32 (general purpose) | 31 (general purpose) ( | 0 | https://www.nordicsemi.com/-/media/Software-and-other-downloads/Product-Briefs/nRF52-DK-product-brief.pdf?la=en&hash=01C23BC9A39B642EF150702065B7673E430EBE05 https://www.nordicsemi.com/-/media/Software-and-other-downloads/Product-Briefs/nRF52832-product-brief.pdf?la=en&hash=2F9D995F754BA2F2EA944A2C4351E682AB7CB0B9 | |||||||||||||||||||||||||||||||||||
Nordic nRF52840 DK | 52€ | nordic_pca10056 | nrf52xxx | Nordic nRF52840 | 64MHz | 256KB | 1MB | 1,7-3V (bat.) 5V (usb) | 48 (general purpose) | 48 (general purpose) | 0 | https://www.nordicsemi.com/Software-and-tools/Development-Kits/nRF52840-DK https://www.nordicsemi.com/Products/Low-power-short-range-wireless/nRF52840 | |||||||||||||||||||||||||||||||||||
Nordic Thingy:52 | 45€ | 60x60mm | nordic_pca20020 | nrf52xxx | Nordic nRF52832 | 64 MHz | 64KB | 512KB | Included Li-Po Batery | 32 (general purpose) | 31 (general purpose) ( | 0 |
| https://www.nordicsemi.com/Software-and-tools/Prototyping-platforms/Nordic-Thingy-52 | |||||||||||||||||||||||||||||||||
Arduino 101 | nrf51-arduino_101 | nrf51xxx | Arduino 101 powered by Intel Curie which integrates an nRF51822 Product is retired | ||||||||||||||||||||||||||||||||||||||||||||
RedBearLabs BLE Nano | nrf51-blenano | nrf51xxx | Nordic nRF51822 | 16 MHz | 16 KB | 256 KB | 1,8-3,3V 5V | 8 | 8 | 6 | 0 | https://os.mbed.com/platforms/RedBearLab-BLE-Nano/ | Manufacturer website offline and out of stock everywhere | ||||||||||||||||||||||||||||||||||
Nucleo F030R8 | 12-20€ | 83x70mm | nucleo-f030r8 | stm32f0xx | STM32F030R8T6 | 48 MHz | 8 KB | 64 KB | 2,4-3,6V 5V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/data_brief/nucleo-f030r8.pdf https://www.st.com/en/evaluation-tools/nucleo-f030r8.html | |||||||||||||||||||||||||||||||||
Nucleo F072RB | 16-20€ | 83x70mm | nucleo-f072rb | stm32f0xx | STM32F072RBT6 | 48 MHz | 16 KB | 128 KB | 2,4-3,6V 5V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/data_brief/nucleo-f030r8.pdf https://www.st.com/en/evaluation-tools/nucleo-f030r8.html | |||||||||||||||||||||||||||||||||
Nucleo F103RB | 16-20€ | 83x70mm | nucleo-f103rb | stm32f1xx | STM32F103RBT6 | 72 MHz | 20 KB | 128 KB | 2,4-3,6V 5V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/data_brief/nucleo-f030r8.pdf https://www.st.com/en/evaluation-tools/nucleo-f030r8.html | |||||||||||||||||||||||||||||||||
Nucleo F303K8 | 12€ | 50x19mm | nucleo-f303k8 | stm32f3xx | STM32F303K8T6 | 72 MHz | 16 KB | 64 KB | 2,4-3,6V 5V | 22 (general purpose) | 22 (general purpose) | 8 (12 bit) | 2 (12 bit) | https://www.st.com/resource/en/data_brief/nucleo-f303k8.pdf https://www.st.com/content/ccc/resource/sales_and_marketing/promotional_material/brochure/fa/7d/6f/b6/8e/c5/4e/b1/brstm32f3.pdf/files/brstm32f3.pdf/jcr:content/translations/en.brstm32f3.pdf | |||||||||||||||||||||||||||||||||
Nucleo F303RE | 14€ | 83x70mm | nucleo-f303re | stm32f3xx | STM32F303RET6 | 72 MHz | 80 KB | 512 KB | 2,4-3,6V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/user_manual/dm00105823-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf | |||||||||||||||||||||||||||||||||
Nucleo F401RE | 14€ | 83x70mm | nucleo-f401re | stm32f4xx | STM32F401RET6U | 84 MHz | 96 KB | 512 KB | 2,4-3,6V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/data_brief/nucleo-f401re.pdf https://www.st.com/resource/en/user_manual/dm00105823-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf | |||||||||||||||||||||||||||||||||
Nucleo F411RE | 19€ | 83x70mm | nucleo-f401re | stm32f4xx | STM32F411RET6U | 100 MHz | 128 KB | 512 KB | 2,4-3,6V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/data_brief/nucleo-f411re.pdf https://www.st.com/content/ccc/resource/sales_and_marketing/promotional_material/flyer/d2/06/5c/20/25/28/42/ff/flstm32nucleo.pdf/files/flstm32nucleo.pdf/jcr:content/translations/en.flstm32nucleo.pdf | |||||||||||||||||||||||||||||||||
Nucleo F413ZH | 22€ | 133x70mm | nucleo-f413zh | stm32f4xx | STM32F413ZHT6U | 100 MHz | 320 KB | 1,5 MB | 2,4-3,6V | 73 (general purpose) | 73 (general purpose) | 9 | 0 | https://www.st.com/resource/en/data_brief/nucleo-f413zh.pdf https://www.st.com/content/ccc/resource/sales_and_marketing/promotional_material/flyer/d2/06/5c/20/25/28/42/ff/flstm32nucleo.pdf/files/flstm32nucleo.pdf/jcr:content/translations/en.flstm32nucleo.pdf | |||||||||||||||||||||||||||||||||
26€ | 133x70mm | nucleo-f439zi | stm32f4xx | STM32F439ZIT6U | 180 MHz | (available) | 256KB | 2MB | 2,4-3,6V 5V 7-12V | 73 (general purpose) | 73 (general purpose) | 9 | 0 | https://www.st.com/resource/en/data_brief/nucleo-f439zi.pdf | |||||||||||||||||||||||||||||||||
Nucleo F746ZG | 26€ | 133x70mm | nucleo-f746zg | stm32f7xx | STM32F746ZGT6U | 216 MHz | 320KB | 1MB | 2,4-3,6V 5V 7-12V | 73 (general purpose) | 73 (general purpose) | 9 | 0 | https://www.st.com/content/ccc/resource/sales_and_marketing/promotional_material/flyer/d2/06/5c/20/25/28/42/ff/flstm32nucleo.pdf/files/flstm32nucleo.pdf/jcr:content/translations/en.flstm32nucleo.pdf | |||||||||||||||||||||||||||||||||
Nucleo F767ZI | 26€ | 133x70mm | nucleo-f767zi | stm32f7xx | STM32F767ZIT6U | 216 MHz | 512KB | 2MB | 2,4-3,6V 5V 7-12V | 73 (general purpose) | 73 (general purpose) | 9 | 0 | https://www.st.com/content/ccc/resource/sales_and_marketing/promotional_material/flyer/d2/06/5c/20/25/28/42/ff/flstm32nucleo.pdf/files/flstm32nucleo.pdf/jcr:content/translations/en.flstm32nucleo.pdf | |||||||||||||||||||||||||||||||||
Nucleo L476RG | 16€ | 83x70mm | nucleo-l476rg | stm32l4xx | STM32L476RGT6U | 80 MHz | 128 KB | 1 MB | 2,4-3,6V 5V 7-12V | 55 (general purpose) | 55 (general purpose) | 16 (12 bit) | 0 | https://www.st.com/resource/en/data_brief/nucleo-l476rg.pdf https://www.st.com/resource/en/user_manual/dm00105928-getting-started-with-stm32-nucleo-board-software-development-tools-stmicroelectronics.pdf | |||||||||||||||||||||||||||||||||
Olimex STM32-P103 | 20€ | 100x90mm | olimex-p103 | stm32f1xx | STM32F103RBT6 | 72 MHz | 20KB | 128KB | 5V 6V | 51 (general purpose) | 51 (general purpose) | 2 (12 bit) | 0 | https://www.olimex.com/Products/ARM/ST/STM32-P103/ https://www.olimex.com/Products/ARM/ST/STM32-P103/resources/STM32-P103.pdf | |||||||||||||||||||||||||||||||||
Olimex STM32-E407 | 30€ | 101x86mm | olimex_stm32-e407_devboard | stm32f4xx | STM32F407ZGT6 | 168MHz | 195KB | 1MB | 6-16V | 114 (general purpose) | 114 (general purpose) | 3 (12 bit) | 0 | https://www.olimex.com/Products/ARM/ST/STM32-E407/open-source-hardware https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407.pdf | Potentially second Ethernet with UEXT | ||||||||||||||||||||||||||||||||
P-NUCLEO-WB55 board | 49€ | 70x65mm (board) 50x26mm (dongle) | p-nucleo-wb55 | stm32wbxx | STM32WB | 64 Mhz (dual core) | 128 KB | 1 MB | 5V | 9 (general purpose) | 9 (general purpose) | 6 | 0 | https://www.st.com/en/evaluation-tools/p-nucleo-wb55.html https://www.st.com/resource/en/user_manual/dm00517423-bluetooth-low-energy-and-802154-nucleo-pack-based-on-stm32wb-series-microcontrollers-stmicroelectronics.pdf | Bundle of a board and a dongle with the same STM32 chips | ||||||||||||||||||||||||||||||||
Digilent: Wi-FIRE: WiFi Enabled PIC32MZ Microcontroller Board | 73€ | pic32mz2048_wi-fire | pic32mz2048efg100 | PIC32MZ2048EFG100 | 200 MHz | 512 KB | 2 MB | 4-30V | 43 (general purpose) | 43 (general purpose) | 12 (10 bit) | 0 | https://store.digilentinc.com/wi-fire-wifi-enabled-pic32mz-microcontroller-board/ https://reference.digilentinc.com/reference/microprocessor/wi-fire/reference-manual?_ga=2.247851591.1122965972.1586722353-1761803863.1586360803 | ||||||||||||||||||||||||||||||||||
Curiosity PIC32MX470 Development Board | 25€ | pic32mx470f512h | PIC32MX470512H | 120 MHz | 128 KB | 512 KB | 5V | 0 | 0 | 0 | 0 | https://www.microchip.com/DevelopmentTools/ProductDetails/PartNO/DM320103#additional-summary | Potentially 2 ethernet clickboards | ||||||||||||||||||||||||||||||||||
6LoWPAN Clicker board | 31€ | 76x32mm | pic32mx470_6lp_clicker | pic32mx470f512h | PIC32MX470F512H | 120 MHz | 128 KB | 512 KB | 5V | 0 | 0 | 0 | 0 | https://download.mikroe.com/documents/starter-boards/clicker/6lowpan/6lowpan-clicker-manual-v100.pdf | |||||||||||||||||||||||||||||||||
Pine64 PineTime smartwatch | 23€ | 38x40mm | pinetime | nrf52xxx | Nordic nRF52832 | 64 MHz | 64 KB | 512 KB | 5V (charging) | 0 | 0 | 0 | 0 |
| https://store.pine64.org/?product=pinetime-dev-kit | This is actually a watch | |||||||||||||||||||||||||||||||
Espruino puck.js | 35€ | 36x36x16mm | puckjs | nrf52xxx | Nordic nRF52832 | 64 MHz | 64 KB | 512 KB | 3V (CR2032 batery) | 17 (general purpose) | 17 (general purpose) | 5 | 0 |
| https://shop.espruino.com/puckjs http://www.espruino.com/Puck.js | ||||||||||||||||||||||||||||||||
Red Bear Labs blend2 module | rb-blend2 | nrf52xxx | Retired | ||||||||||||||||||||||||||||||||||||||||||||
Red Bear Labs nano2 module | rb-nano2 | nrf52xxx | Retired | ||||||||||||||||||||||||||||||||||||||||||||
Reel Board | 49€ | reel_board | nrf52xxx | Nordic nRF52840 | 64 MHz | 256 KB | 1 MB | 1,5V (battery) 5V (usb) |
| 3 (general purpose) | 3 (general purpose) | 0 | 0 |
| https://www.phytec.de/produkt/internet-of-things/reelboard/ https://docs.zephyrproject.org/latest/boards/arm/reel_board/doc/index.html | ||||||||||||||||||||||||||||||||
RuuviTag rev B | 29€ | 52x52x13mm | ruuvitag_rev_b | nrf52xxx | Nordic nRF52832 | 64 MHz | 64 KB | 512 KB | 3V (battery CR2477) | 0 | 0 | 0 | 0 | https://ruuvi.com/files/ruuvitag-tech-spec-2019-7.pdf | |||||||||||||||||||||||||||||||||
STM32F3 Discovery (Digital Compass) | 14€ | 97x66mm | stm32f3discovery | stm32f3xx | STM32F303VCT6 | 75 MHz | 48 kB | 256 KB | 3V 5V |
| https://www.st.com/resource/en/data_brief/stm32f3discovery.pdf https://www.st.com/resource/en/user_manual/dm00063382-discovery-kit-with-stm32f303vc-mcu-stmicroelectronics.pdf | ||||||||||||||||||||||||||||||||||||
STM32F4 Discovery (Audio) | 23-28€ | 97x66mm | stm32f4discovery | stm32f4xx | STM32F407VG | 168 MHz | 192 KB | 1 MB | 3V 5V | 54 (general purpose) | 54 (general purpose) | 3 | 2 |
| https://www.st.com/resource/en/data_brief/stm32f4discovery.pdf https://www.st.com/resource/en/user_manual/dm00039084-discovery-kit-with-stm32f407vg-mcu-stmicroelectronics.pdf https://www.st.com/en/microcontrollers-microprocessors/stm32f407vg.html | ||||||||||||||||||||||||||||||||
STM32F746G Discovery (Audio + Touchscreen) | 63-90€ | 97x66mm | stm32f7discovery | stm32f7xx | STM32F746NGH6 | 216 MHz | 340KB | 1MB | 3V 5V |
| https://www.st.com/en/evaluation-tools/32f746gdiscovery.html https://www.st.com/resource/en/data_brief/32f746gdiscovery.pdf https://www.st.com/resource/en/user_manual/dm00190424-discovery-kit-for-stm32f7-series-with-stm32f746ng-mcu-stmicroelectronics.pdf | With Touchscreen | |||||||||||||||||||||||||||||||||||
STM32F411 Discovery | 23-28€ | 97x66mm | stm32f4discovery | stm32f4xx | STM32F407VG | 168 MHz | 192 KB | 1 MB | 3V 5V | 54 (general purpose) | 54 (general purpose) | 3 | 2 |
| https://www.st.com/resource/en/data_brief/stm32f4discovery.pdf https://www.st.com/resource/en/user_manual/dm00039084-discovery-kit-with-stm32f407vg-mcu-stmicroelectronics.pdf https://www.st.com/en/microcontrollers-microprocessors/stm32f407vg.html | ||||||||||||||||||||||||||||||||
STM32F429 Discovery | 34-39€ | 119x66mm | stm32f429discovery | stm32f4xx | STM32F429ZIT6 | 180 MHz | 256 KB | 2 MB | 3V 5V |
| https://www.st.com/en/evaluation-tools/32f429idiscovery.html#overview https://www.st.com/resource/en/data_brief/32f429idiscovery.pdf https://www.st.com/resource/en/user_manual/dm00093903-discovery-kit-with-stm32f429zi-mcu-stmicroelectronics.pdf | ||||||||||||||||||||||||||||||||||||
STM32L152 Discovery | 14€ | 112x56mm | stm32l152discovery | stm32l1xx | STM32L152RBT6 | 32 MHz | 16 KB | 128 KB | 3V 5V |
| https://www.st.com/en/evaluation-tools/32l152cdiscovery.html https://www.st.com/resource/en/data_brief/32l152cdiscovery.pdf https://www.st.com/resource/en/user_manual/dm00027954-discovery-kits-with-stm32l152rct6-and-stm32l152rbt6-mcus-stmicroelectronics.pdf | ||||||||||||||||||||||||||||||||||||
Telenor EE-02 | Open-Source Hardwar | 27x26x5mm | telee02 | nrf52xxx | Nordic nRF52832 | 64 MHz | 64 KB | 512 KB | 1,8 - 3,7V | 16 (general purpose) | 16 (general purpose) (4 PWM) | 8 (12 bit) | 0 | https://docs.exploratory.engineering/ee-02/ https://docs.exploratory.engineering/ee-02/ee02-pinout/ |
| ||||||||||||||||||||||||||||||||
NXP USB KW41Z | 55€ | usbmkw41z | mkw41z | Kinetis MKW41Z512 | 48 MHz | 128 KB | 512 KB | 5V | 0 | 0 | 0 | 0 | https://www.nxp.com/webapp/Download?colCode=USBKW41ZUG (Requires Login) https://www.nxp.com/docs/en/fact-sheet/KNTSKW41Z31Z21ZFS.pdf | ||||||||||||||||||||||||||||||||||
VNG VBLUno51 | 20€ (not sure as the price is in Vietnamese Đồng) | vbluno51 | nrf51xxx | Nordic nRF51822 | 16 MHz | 32 KB | 256 KB | 5V (USB) | 21 (general purpose) | 21 (general purpose) | 6 (10 bit) | 0 | https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/boards/arm/nrf51_vbluno51/doc/index.html https://vngiotlab.github.io/vbluno/ | ||||||||||||||||||||||||||||||||||
VNG VBLUno52 | vbluno52 | nrf52xxx | Nordic nRF52832 | 64 MHz | 64 KB | 512 KB | 5V (USB) 3V (batery) 9-12V (Power adapter) | 19 (general purpose) | 19 (general purpose) | 6 (10 bit) | 0 | https://docs.zephyrproject.org/latest/boards/arm/nrf52_vbluno52/doc/index.html https://docs.platformio.org/en/latest/boards/nordicnrf52/vbluno52.html |
|
Questions:
- black_vet6: What is a MAC and can I attach multiple MACs?
- black_vet6: Can I use the Ethernet in MyNewt?
- STM32-P103: Can I connect multiple UEXT boards?
- STM32-P103: Can I use the Ethernet in MyNewt?
Ethernet Shields
Generally the most Ethernet Shields use SPI for communication with the backend. So any MyNewt Board capable of SPI (Guess all of them)
- W5100: Seems to be the reference Arduino supported type
- W5500: A newer, cheaper and more performant version, allowing more concurrent connections however with slight differences in how connections are denied
- ENC28J60: Seems to be just a MAC (Medium Access Controller) which just handles Ethernet Frames (It doesn't do any higher level protocols such as IP, TCP or UDP)
Name | Interface | SPI Speed | SPI Modes | Full Duplex | Half Duplex | TCP | UDP | Number of Socket Connections | |
---|---|---|---|---|---|---|---|---|---|
W5100 | SPI | 0,3 | 4 | ||||||
W5500 | SPI | 0,3 | 8 |
| |||||
ENC28J60 | SPI | 20 MHz | 0 | Just ethernet support | http://ww1.microchip.com/downloads/en/DeviceDoc/39662e.pdf |
One would think that it's ideal to use a board without any on-board Ethernet (Which would open a lot of possibilities for us) and to just stick 2 shields on top of each other, however this complicates things. SPI requires one dedicated line to each SPI device (Chip-Select). In the Arduino pinout there is only one pre-defined Chip-Select line available. So the usual solution is to use other digital pins as substitute for the chip-select. However this requires the driver to utilize this, but what's probably more difficult, we can't just stack two shields on top of each other as the chip-select pin of the board has to be re-directed to the chip-select pin of the shield. Perhaps it would be an option to cut off the direct pin of the SPI chip-select connector of the second shield and to jumper one of the others to the now unconnected one.
Setups
- Two Ethernet Ports (PoE on one port)
- One Ethernet Port, One LoRaWan device (Low Power MCU)
- One Ethernet Port, One Bluetooth Low Energy device (Low Power MCU)
Two Ethernet Ports
Using the Arduino Nano form factor:
- Nucleo F303K8
- Nano W5500 Ethernet Shield (With PoE)
- Nano W5500 Ethernet Shield
Problems:
- As both shields would be using the same SPI Source-Select connector, perhaps cut off the SPI-SS pin on the second board and bridge a neighboring pin to the cut off SPI-SS pin (Have to configure another digital pin as SS for the second device)
- Both Ethernet ports would be using the same SPI channel (Not sure if there could be problems with the transfer speed)
Using any development board exposing two separate SPI channels
In the end it's our goal to create a new PCB containing the PoE, Ethernet connectivity as well as the MCU, so it would be best to be able to actively choose the network device type. So perhaps not selecting one with an on-board Ethernet might be the best solution.
To avoid above problems, it might be better to use a development board which exposes more than one SPI port to it's external pins.
Ideally using a W5100 or even better a W5500 chip based solution (This seems to be the most standard solution.
For powering: A PoE Extractor that is connected to the Ethernet connector and the boards power supply
Hardware selection
Regarding communication every option will require one Ethernet Port, however for the second network adapter there is a number of options: Ethernet, WiFi, 6LoWPAN, BlueTooth Low Energy, LoRaWan
All of these communication forms have different use-cases and capabilities:
- Ethernet: No range, highest throughput
- Wifi: short range, high throughput
- 6LoWPAN, BlueTooth Low Energy: Range +/- 100m medium range, medium throughput
- LoRaWan: Long range (1-50km), small throughput
I see the following usage scenarios:
- Adding industrial hardware that's on the shopfloor with the ability to connect an ethernet-cable: Ethernet (Energy consumption doesn't matter)
- Adding industrial hardware that's on the shopfloor without the ability to connect an ethernet-cable: WiFi (Energy consumption doesn't matter)
- Adding industrial hardware that's on the factory ground without the ability to connect an ethernet-cable: 6LoWPAN, BlueTooth Low Energy (Energy consumption might matter)
- Adding industrial hardware that's off-site: LoRaWan, Sigfox (Low energy consumption is probably important)
Regarding the MCUs, I have to admit that I have absolutely no idea how small I can go. So for the shopfloor scenarios I'll probably go for the higher performant STM32F models.
For the other two, I'll try the low energy options.
Memory wise, I'll probably go more for the 512 KB Flash versions of the STM32F models and the 64 MHz
This results in the following matrix:
Name | MCU | Comm | Additional Comm Chip | Board | Adons | Remarks |
---|---|---|---|---|---|---|
Cabled Shopfloor | STM32F767ZIT6U | Ethernet | W5500 | Nucleo F767ZI | Highest performance MCU, Lots of Memory | |
Wireless Shopfloor | STM32F411RET6U | WiFi | W5500, SPWF01SA | Nucleo F411RE | X-NUCLEO-IDW01M1 (WiFi) | Medium sized MCU, medium Memory |
Wireless On-Site | Nordic nRF52840 | BlueTooth Low Energy | W5500 | Nordic nRF52840 DK | ||
Wireless Off-Site | STM32L072CZ | LoRaWan | W5500 | B-L072Z-LRWAN1 |
Order List:
- Nucleo F767ZI: 26€
- Nucleo F411RE: 19€
- Nordic nRF52840 DK: 52€
- B-L072Z-LRWAN1: 50€
- 2x W5500 Ethernet modules: 18€
- X-NUCLEO-IDW01M1: 22€
Interesting Links:
Building MyNewt applications in rust: https://medium.com/@ly.lee/hosting-embedded-rust-apps-on-apache-mynewt-with-stm32-blue-pill-c86b119fe5f (Seems to make excessive use of "unsafe" code which sort of eliminates some of the benefits Rust brings us)
Performance comparison between C and Rust: https://kornel.ski/rust-c-speed
MBed TLS: https://tls.mbed.org/tech-updates/releases/mbedtls-2.13.0-2.7.6-and-2.1.15-released (Apache Licensed version available which also seems to use CMake for a build system)
Apache MxNewt SSL/TLS Library (Unfortunately GPLv2 licensed): https://www.wolfssl.com/wolfssl-apache-mynewt-port-2/
Protocol Buffer implementation for native C: https://github.com/nanopb/nanopb
Listing of boards and some details: https://docs.platformio.org/en/latest/boards/
Test results for boards with MyNewt versions1.8.0 Test Results