Maker spaces and ‘FabLabs’ are popular and accessible in many areas. 3D printers are on the cheap, and powerful laser cutters are in the range of the fearless hobbyist. You can get dirty-cheap PCBs from China in less than a week (ok, probably not right now because of Corona virus) and it is easy to SMD solder parts these days with a DIY SMD PnP machine and OpenPnP. With the right equipment and skill set it is possible to build many cool projects. It is very rewarding and a great learning thing. Blog about it so other can learn too. And it even could get featured on Hackaday.
But: The risk is that someone might send you letter about a ‘Copyright Infringement’. Sadly, this is what happened to me for one of my recent projects. I don’t think that ‘take down’ letter was justified, but I learned a great deal what I should have done differently to avoid that situation. So in the end, it was a learning opportunity, which I believe is worth to share. In essence: what can a maker or educator do?
Hackaday: building a giant meta-clock made of smaller clocks (image: original image from Hackaday)
The gnuplot is a versatile and powerful tool to plot and visualize all kind of data. I wish there would be a plugin for it in Eclipse. But as this is not (yet?) the case, here is how I’m using it with gdb and Eclipse, using the MCUXpresso IDE as example.
Eclipse with its CDT managed Make system makes it easy to build projects, because it can handle a lot of the background tasks and settings between the project and the build setting. It can get a bit difficult if I want to include a library or other sub-source project for which I have to add extra compiler #define or add extra includes path settings.
Eclipse project settings for include paths
This article show the different ways I have found to make such imports (and exports) easier.
When using an RTOS like FreeRTOS, sooner or later you have to ask the question: how much time is spent in each task? The Eclipse based MCUXpresso IDE has a nice view showing exactly this kind of information:
FreeRTOS Runtime Information
For FreeRTOS (or that Task List view) to show that very useful information, the developer has to provide a helping hand so the RTOS can collect this information. This article shows how this can be done on an ARM Cortex-M.
The NXP LPC55S69-EVK is a versatile board. In this article I show how it can be used with Adafruit TFT LCD boards, both with resistive and capacitive touch. For the software I’m using the open source LittlevGL GUI.
Bootloaders are a fine thing: With this I can load any applications I like. Power comes with some complexity, and a bootloader alone is a complex thing already. But this applies to the application part too: I need to link the application to a certain offset in the memory space so it can be loaded by the bootloader, plus the application typically needs to add some extra information to be used by the bootloader. This article describes how to build a bootloader application with Eclipse (MCUXpresso IDE) using the MCUXpresso SDK.
Stack overflows are probably the number 1 enemy of embedded applications: a call to a a printf() monster likely will use too much stack space, resulting in overwritten memory and crashing applications. But stack memory is limited and expensive on these devices, so you don’t want to spend too much space for it. But for sure not to little too. Or bad things will happen.
The Eclipse based MCUXpresso IDE has a ‘Heap and Stack Usage’ view which can be used to monitor the stack usage and shows that a stack overflow happened:
Heap and Stack Usage
But this is using the help of the debugger: how to catch stack overflows at runtime without the need of a debugger? There is an option in the GNU gcc compiler to help with this kind of situation, even if it was not originally intended for something different. Continue reading →
The Espressif ESP32 devices are getting everywhere: they are inexpensive, readily available and Espressif IDF environment and build system actually is pretty good and working well for me including Eclipse (see “Building and Flashing ESP32 Applications with Eclipse“). The default way to program an ESP32 is to a) enter UART bootloader by pressing some push buttons and b) flash the application with ESP-IDF using a USB cable.
That works fine if the ESP32 is directly connected to the host PC. But in my case it is is behind an NXP Kinetis K22FX512 ARM Cortex-M4F microcontroller and not directly accessible by the host PC. So I had to find a way how to allow boot loading the ESP32 through the ARM Cortex-M which is the topic of this article.
The new semester is approaching in a very fast way, and so is the new lecture and lab module ‘Advanced Distributed Systems’ at the Lucerne University. For that module we are going to build a new ‘Sumo’ style robot with WLAN capabilities using the ESP32 chip. It will be a new robot PCB, and below is the current robot (based on NXP K22FX512) with the WLAN module connected to it:
It is great if vendors provide a starting point for my own projects. A working ‘blinky’ is always a great starter. Convenience always has a price, and with a ‘blinky’ it is that the code size for just ‘toggling a GPIO pin’ is exaggerated. For a device with a tiny amount of RAM and FLASH this can be concerning: will my application ever fit to that device if a ‘blinky’ takes that much? Don’t worry: a blinky (or any other project) can be easily trimmed down.
Binky on NXP LPC845-BRK Board
I use a ‘blinky’ project here just as an example: the trimming tips can apply to any other kind of projects too.
With the cost of an single pin, many ARM Cortex-M boards including the NXP i.MX RT1064 can produde SWO data: think about a pin able to stream data out of the chip in realtime. For example interrupt activity which otherwise might be hard to capture:
In a modern development workflow both command-line and a graphical user interface has its place. On the GUI side, Eclipse is famous that it offers many different ways to accomplish something which is great. But sometimes I continue to use an old habit or way because I have missed that there is a newer and better way, and the MCUXpresso Eclipse IDE is no exception to that. In this article I show a few ways how to use the mouse even more productive.