#embedded

Optimizing SPI communication on STM32 MCUs: a comprehensive guide to high-frequency communication

Published at July 28, 2023 · Artur Kowalski ·  22 min read

In this blog post, we delve into the fascinating world of Serial Peripheral Interface (SPI) on STM32 microcontrollers (MCUs). Specifically, we explore how SPI is utilized in TPM chips for communication with PC motherboards. We encounter the challenges of achieving high-frequency SPI communication, especially when operating as a slave, and the specific limitations of STM32L476 MCUs. The article further uncovers the limitations of existing approaches in platforms like Zephyr and STM32 HAL. We then embark on a journey to fix SPI issues, improve DMA performance, and optimize the firmware for high-speed SPI communication. Throughout the blog post, we provide in-depth technical insights and share valuable test results. Join us as we push the boundaries of SPI communication and unlock new possibilities in the world of microcontrollers....

Categories: firmware miscellaneous security



OpenOCD and development environment for Zephyr on NXP FRDM-K64F

Published at March 18, 2017 · Piotr Król ·  12 min read

In this post I would like to describe process of setting up NXP FRDM-K64F development environment under Linux and start Zephyr development using it. Why NXP FRDM-K64F ? I choose this platform mostly because of ready to use guide about using 802.15.4 communication by attaching TI CC2520, which was presented here. Typical wireless stack starts with 802.15.4, then 6LoWPAN adaptation and then IPv6, which carries application protocols. 6LoWPAN compress IPv6 so it can fit BLE and 802....

Categories: firmware iot


Nerves project triage on BeagleBone Black Black

Published at March 10, 2017 · Piotr Król ·  6 min read

Recently one of my customers brought to my attention Nerves. It aims to simplify use of Elixir (functional language leveraging Erlang VM) in embedded systems. This system has couple interesting features that are worth of research and blog post. First is booting directly to application which is running in BEAM (Erlang VM). Nerves project replace systemd process with programming language virtual machine running application code. Concept is very interesting and I wonder if someone tried to use that with other VMs ie....

Categories: firmware os-dev


Zephyr initial triage on Nucleo-64 STM32F411RE

Published at January 14, 2017 · Piotr Król ·  7 min read

As I mention in previous post Zephyr RTOS is an interesting initiative started by Intel, NXP and couple other strong organizations. With so well founded background future for this RTOS should look bright and I think it will quickly became important player on IoT arena. Because of that it is worth to dig little bit deeper in this RTOS and see what problems we faced when trying to develop for some well known development board....

Categories: firmware iot


Failure of ECC508A crypto coprocessor initial triage with SAM G55 Xplained Pro Evaluation Kit

Published at November 24, 2016 · Piotr Król ·  7 min read

Some time ago (around August 2016) embedded community media were hit with hype around simplified flow for AWS IoT provisioning (1, 2, 3). I’m personally very interested in all categories related to those news: IoT - is 3mdeb business core and despite this term was largely abused these days, we just love to build connected embedded devices. Building this kind of devices is inherently related with firmware deployment, provisioning and update problems....

Categories: firmware iot security


Starting with Nucleo-F411RE and mbed OS for command line enthusiasts

Published at November 23, 2016 · Piotr Król ·  9 min read

When I first time read about mbed OS I was really sceptical, especially idea of having web browser as my IDE and compiler in the cloud seems to be very scary to me. ARM engineers proved to provide high quality products, but this was not enough to me. Then I heard very good words about mbed OS IDE from Jack Ganssle, this was still not enough. Finally customers started to ask about this RTOS and I had to look deeper....

Categories: firmware iot


Chromium GStreamer backed for i.MX6 research

Published at November 1, 2016 · Piotr Król ·  3 min read

Recently I work on i.MX6 based project that requires video hardware decoding in web browser (best case in QtWebEngine, which is entire Chromium platform in Qt). Chromium After some research it appears that Chromium is not interested in providing external support for GStreamer-backed video hardware decoding. Truly going through all discussion related to this topic was very disappointing. Typically Chromium developers just close thread when discussion started to be noisy and there mass of complaining people raised....

Categories: app-dev


SAMG55 + OLED1 Xplained Pro Hello World!

Published at October 20, 2016 · Piotr Król ·  4 min read

AMG55 - recognition in the field If you are considering working on SAMG55 Xplained Pro board here you will find some basic know-how to quickly get you started. What you will need? In this example I will be using SAMG55 Xplained Pro with OLED1 extension board, and Atmel Studio 7.0 with Data Visualizer addon, which requires Windows to work. This however should be similar for other board with EDBG debugger....

Categories: firmware iot


FWTS on ARMv8 platform (HiKey LeMaker version) from scratch

Published at July 25, 2016 · Piotr Król ·  8 min read

This is second post from series about LeMaker version of HiKey board from 96boards Customer Edition family. Previous post focused on describing hardware part. In this post I would like to show how to setup firmware development and testing environment. This post highly rely on 96boards documentation, so kudos to 96boards and LeMaker for providing lot of information for developers. Obtain pre-compiled binaries 1 2 3 4 5 6 7 wget https://builds....

Categories: firmware


Powering on LeMaker HiKey (ARMv8)

Published at May 19, 2016 · Piotr Król ·  4 min read

Embedded Systems Consultants have chance to live in interesting times. ARM expansion touch server market and UEFI coming to non-x86 platforms. Firmware gaining its importance and because handling real development is harder and harder lot of things starting to happen in open source. Big players trying to address security and virtualization issues, what leads to really interesting features in recent SoCs. Couple weeks ago I decided to recover my knowledge about UEFI and take a look how it is implemented for architecture that have its momentum - namely ARM in its 8 version (ARMv8)....

Categories: firmware


PC Engines APU2 netboot Debian installation

Published at March 26, 2016 · Piotr Król ·  3 min read

In previous post I described how to setup PXE server and boot Debian installer using it. I mentioned that provided setup is limited and some extensive configuration is needed to make it useful for real world example. Since that time I learned that there is chain command in iPXE, which give ability to use arbitrary TFTP server as boot file source. Using RPi PXE server For example by changing my test network topology from previous post to something like that:...

Categories: os-dev


Emulate Rapberry Pi 2 in QEMU

Published at December 30, 2015 · Piotr Król ·  4 min read

In the process of planning system testing for one of my clients I found that someone from Microsoft published patches with BCM2836 support to QEMU mailing list. I thought it is very interesting, because if it is possible to setup emulated Raspberry Pi many use cases can be tested faster and in more automatic way. For example checking how application behave when running on more then one device at once, testing massive deployment process, stress testing and finally speed up debug-fix-test process....

Categories: app-dev os-dev


Using PlatformIO with TI MSP430 LunchPads

Published at December 8, 2015 · Piotr Król ·  6 min read

PlatformIO is very interesting project that aim to solve very important problem of configuring deployment environment for embedded systems. IMHO good approach is to focus on modularity (various IDE can be used, even Vim) and simplicity (in best case 2 command should be enough to deploy first code). Recent years we have explosion of bootstrapping applications (ie.vagrant, puppet). Most of them seems to follow git-like command line interface and getting a lot of attention from programmers community....

Categories: firmware iot


Linux, RPi and USB over IP updated

Published at October 27, 2015 · Piotr Król ·  4 min read

Because of increasing interesting in USB over IP topic I decided to refresh my old post. I will focus on doing the same thing with more recent version of Raspabian. If you need more information please read my previous post. Setup SD card First get recent version of Raspbian, then unzip and dd it to SD card: 1 sudo dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/sdc If you are impatient and want to know what happen in background you can use this method of tracking dd progress:...

Categories: os-dev


Building Android 4.2 LiveSuit image for Cubietruck (Allwinner A20)

Published at September 16, 2015 · Piotr Król ·  7 min read

Treating A20 boards like outdated piece of HW by vendors makes building Android for Cubietruck not trivial task. Finding documentation, mailing list or blog post that clearly describe steps is almost impossible. Most of links to SDK are broken and instructions outdated. Because of that I decided to leave couple notes for me and all of you lost in this madness. Hopefully below steps can build foundation for future development and improvements....

Categories: os-dev


Setup for Linux kernel development on Cubietruck

Published at September 1, 2015 · Piotr Król ·  8 min read

During last couple of months I see quite big interest in building products on A20 SoC. This chip can be bought for 6USD in quantity. Most important features are: Dual-Core ARM Cortex-A7 (ARMv7) Mali-400 MP2 HDMI, VGA and LCD MMC and NAND OTG and 2 Host ports Tracking media related to low-end mobile market IMHO the hottest SoCs are Allwinner A20 and Rockchip RK3288. A20 ship with dozen development boards like Cubieboard or pcDuino series, Banana Pi, MarsBoard or Hummingbird....

Categories: os-dev


ESP-12 update to SDK v0.9.5 and AT v0.21.0.0? noobs tutorial

Published at January 25, 2015 · Piotr Król ·  5 min read

January 23th Espressif published new ESP IOT SDK on their forum v0.9.5. My ESP-12 came with with pretty old version so I decide to update it to latest one: 1 2 3 4 5 6 7 8 9 10 AT+RST OK y_RSöfJ[úndor:www.ai-thinker.com Version:0.9.2.4] ready AT+GMR 0018000902-AI03 OK ESP-12 firmware update pin configuration As picture presents in addition to normal operation we have to pull down GPIO0 and pull up GPIO2....

Categories: firmware iot


Power on of ESP-12 (ESP8266)

Published at January 24, 2015 · Piotr Król ·  3 min read

ESP8266 is a SoC made by Espressif. For last couple of months this chip is a rockstar of HackADay and makers community around the Internet. Mostly because of WiFi modules built based on it (ESP-XX family). Rich interface (GPIO, SPI, SDIO, I2C) give those boards potential to be standalone MCU with WiFi capability for wide range of applications. In quantity you can get ESP-01 for $2.7 (for 1kpcs). Of course there is no free lunch....

Categories: firmware iot


0x6: Root file system for embedded system

Published at June 7, 2013 · Piotr Król ·  10 min read

Introduction To make our embedded linux work as virtual development platform we need some environment after booting. There is many approaches to get working root file system but I will use the easiest one as an exercise. I don’t want to create full embedded distribution (this is good plan for future works). Right now I will be happy with simple initramfs based on BusyBox. For all interested in creating own root filesystem there are few places where you can find information:...

Categories: os-dev


0x5: Qemu network configuration and tftp for Virtual Development Board

Published at June 7, 2013 · Piotr Król ·  7 min read

Introduction This was not trivial task to me. As usual google is your friend and RTFM works. First we will set tftp which we use to download modified kernel for U-Boot. Second I will show how to setup bridged network for QEMU needs and finally we will perform some basic test of our setup. Let’s go. Setup tftpd First install: 1 sudo apt-get install tftpd tftp Make sure that /srv/tftp is writable for your user....

Categories: app-dev os-dev


0x4: Linux kernel for embedded system

Published at June 7, 2013 · Piotr Król ·  3 min read

A little history Thinking about embedded linux probably leads to first try of porting linux to different architecture. I did google research (I know I should probably read mailing list archive) and found that there were few attempt to port linux to different platform. There is no clear information about which port of linux was first. This is probably because many hackers didn’t report their effort. Arguably earliest out-of-tree version was probably for Acron A5000 (arm), Motorola 68000 (m68k) around Spring/Summer of 1994....

Categories: os-dev


0x3: Embedded board bootloader

Published at June 7, 2013 · Piotr Król ·  3 min read

What is bootloader ? It is a program written to bring up more complex code (eg. kernel). On very simple system it can even not exist. Bootloader should prepare all required hardware that kernel or different operating software will need at its start point. It is hard to create cross platform bootloader because of variety of system requirements. Why we need bootloader ? The true is that we don’t :) because we can simply pass kernel and initramfs as parameters to QEMU, but it is not common practice for real development environment....

Categories: firmware


0x2: Toolchain for Virtual Development Board

Published at June 7, 2013 · Piotr Król ·  4 min read

Introduction This is probably the most complicated topic of all related to embedded development but we need to deal with it at the beginning. I read a lot about toolchains but still don’t know enough to explain details. I think that best answers are in crosstool-ng documentation. What is toolchain ? Toolchain as the name said is a set of tools chained together, so output of one tool is the input for different tool....

Categories: app-dev os-dev


0x0: Intro to Virtual Development Board building

Published at June 7, 2013 · Piotr Król ·  2 min read

Preface There are many reasons why ambitious programmers should care about huge rush in embedded market. IMO there is great potential in it. I don’t want to go deep into this but take a look at all tablets, phones, smart TVs and other cool stuff like wireless in you washing machine or refrigerator (ok this two are right now only a gadgets :) ). This is all embedded. Another thing is that wages of experienced embedded developers are really high....

Categories: firmware


Yet another quick build of arm-unknown-linux-gnueabi

Published at April 3, 2013 · Piotr Król ·  3 min read

So I decide to check what is going on with crosstool-ng and refresh my old post about building arm-unknown-linux-gnueabi toolchain. Last post was pretty popular, so definitely this is direction I should follow :). I will not repeat myself, so if you encounter any problems please check last post, section with known problems in crosstool-ng doc/ directory or RTFM. Let’s begin: Get the latest crosstool-ng As usual I’m trying to use latest version possible....

Categories: app-dev os-dev


Building ARM toolchain? part 2: gcc and eglibc

Published at April 12, 2012 · Piotr Król ·  4 min read

Unfortunately after few tries of cross compiling eglibc using different source for instructions I always end with hard to solve issues. Luckily, in the sources of eglibc I noticed instructions for cross-compiling written long time ago by Jim Blandy(I know i should start here). Lot of thanks to him for it. Below I describe my experience which I gained during eglibc cross compilation for arm-unknown-linux-gnueabi and procedure that I used. Commands below contain some constants that I used in previous works....

Categories: app-dev os-dev


Building ARM toolchain - part 1: libs and binutils

Published at March 20, 2012 · Piotr Król ·  3 min read

Searching the Internet for information on how to build arm toolchain from scratch I realize that it is very hard to find information about this matter (and recent one even harder). I will try to fill this lack of information and try to build toolchain. My main goal is to use a component based on the GNU public license, and using them in as the newest version as it is possible....

Categories: app-dev os-dev


Quick build of arm-unknown-linux-gnueabi with crosstool-ng

Published at March 14, 2012 · Piotr Król ·  2 min read

You might be surprised at how much you have to make to correctly build arm-unknown-linux-gnueabi config based toolchain with crosstool-ng. As you can see examples of many open source projects, the man’s work is a rare resource. The result of this economic fact is that the attempt to build configuration arm-unknown-linux-gnueabi is not a simple task and during an operation you can come across many problems. Although I am not afraid of problems and effectively try to fight them and of course sharing the results of my work....

Categories: app-dev os-dev