How to use Nordic’s Zephyr development tools for stm32 targets

For a recent project, I used an LTE modem from Nordic – nrf9160. It’s a very capable and impressive piece of hardware (with the only drawback – pretty hard to solder. From my personal experience, it’s nearly impossible to solder it manually). But what was even more impressive was the software which is available for this modem. Nordic suggests a convenient set of VS Code plugins that allow you easy installation and intuitive use for firmware development. On top of that, you are getting SDK based on Zephyr OS with hardware management based on the Devicetree concept. Although it was very new for me and the learning curve was a bit steep at the beginning I really liked Zephyr OS and now going to use it in my next project based on Wio-E5 LORA module from SeeedStudio (has stm32wle5 uC inside).

I didn’t want to use a dedicated toolchain/SDK installation for the LORA project (in the end one of the main purposes of Zephyr OS is code reuse for different platforms, right?) and I assumed that wonderful VS Code plugins from Nordic will equally good work for stm32 (well, except maybe debugging functionality). It also showed the LORA e5 dev board in the list of supported targets. So I tried to compile a “blinky” sample project and was disappointed that the compilation failed. A short look in the “ncs” folder (where all the Nordic tools are installed) showed that complete STMs HAL is absent (which is sort of logical, in the end, it’s a tool for nrf9160, not for stm32). Although west.yml in Zephyr folder was ok (this file describes which modules will be available in your Zephyr SDK, to get more information about this please check information about “west” – swiss knife tool for your Zephyr projects). I kept searching and found another west.yml in the nrf folder. It had the following “allowlist” inside, which by adding “- hal_stm32” line and running “west update” command, allowed me to successfully build my blinky sample for stm32 :

So now I have a convenient IDE that works for both Nordic and STM chips for the cost of only a few additional megabytes used for the new HAL. In the same way, you can add support for any other chips that are supported by Zephyr. I’ll also explain how to add debugging functionality in my next post.

DIY esp8266 oscilloscope, cheap and simple?

Hi, I like the idea of simple and cheap tools for DIY community. That’s why I tried to create a simple 40Msps DIY oscilloscope based on esp32 chip. Unfortunately, the chip, in spite of all of its power, wasn’t able to handle the data flow from 40Msps ADC (it turned out that only up to 20Msps is possible for the esp32). But, in my opinion, 20Msps isn’t enough for a complicated design with an external ADC when there is an excellent stm32f303 microcontroller that can reach about the same speed with an embedded ADC + analog watchdog functionality for a hardware trigger purposes. STMicroelectronics produces very convenient development boards for its microcontrollers and I have a new idea! If we take a cheap and easy to buy dev board (for example stm32nucleo-f303k8), equip it with a bare minimum analog front end (simplest possible attenuator + amplifier to have high input impedance and suitable input signal range capabilities), add an esp8266 module for wireless communication + 18650 Li-Ion battery for power. All together will provide us with a relatively simple “stm32nucleo – hat” PCB that will turn the dev board from ST into a wireless oscilloscope. Basically, I’ve already run 2 PCB revisions and the idea looks absolutely viable. We can get up to 18Msps with 6-bit resolution and 10Msps at 12-bit, which is pretty good taking into account the simplicity and price of the device. The only problem is the proper design of the analog front end which is not that simple when you want to have both low cost and proper quality at higher frequencies at the same time. But it looks like I figured out all the needed changes and ready to prepare the next revision of the PCB to test my ideas. I’ll publish all my work as an open source design as soon as it works properly. Should you want to support this project please donate.btn_donateCC_LGdav

This post will be extended as soon as new information (schematic, pcb, firmware) is available.

To be continued…

SWO logger from M5STACK

Hi all, a short update on SWO logger. I managed to implement a very basic SWO data logger based on M5STACK device. Looks nice and works well (see the picture below where my test setup is shown). I have to admit though, that this thing turned out to be not as simple as expected. Now it needs some real-life testing. I’ll use it for some of my future projects and let you know about my experience. I hope it worth the time spent on it.

img_20180828_180254

  • – the white thing on the picture is a power bank, small blue PCB is the “device under test” stm32 “bluePill”, black box with LCD – m5stack that runs my SWO data logger software.