We all should know it: dynamic memory usage can be dangerous. There can be memory fragmentation, use-after-free, out-of-memory and memory leaks. While I do prefer static memory allocation for embedded systems, using a dynamic memory allocation in some applications is not avoidable or just makes sense.
In one of my lecture modules we develop a ‘Boulder’ game, where the player has to collect underground diamonds and avoid moving monsters:
I’ll show you have FreeRTOS memory usage can be tracked and monitored.
When something goes wrong in an embedded system, a watchdog timer is the last line of defense against a blocked or malfunctioning system. A watchdog is a special timer which needs to be ‘kicked’ in a special way, otherwise the timer will run out and reset the system.
The Raspberry Pi Pico RP2040 is a very versatile microcontroller. It is not the least expensive or the most powerful microcontroller, but it is one which is available and has an excellent software and tool ecosystem.
This article shows how to use the Raspberry Pi Pico-W with BLE and optional WiFi, running with FreeRTOS.
One of the biggest fears of embedded systems developers are stack overflows. FreeRTOS includes a cool feature to monitor and catch task stack overflows. But what about the MSP (Main Stack Pointer) on ARM, or the interrupt stack? What if not using an RTOS and running a bare-metal application?
There is a simple way monitoring stack usage at runtime, and for this I want to share the routines and what is now available inside the McuArm module.
I’m in the final stage of finishing a electrical vehicle (EV) charger controller, which optimizes battery loading using the available PV system: use as much as possible the solar energy and not the grid.
If doing embedded development, then the debugging solution is probably the most important single tool in the development chain. Because very debugging probe has its pros and cons, I usually have at least three different debug probes on my desk, simply to get the job done in all aspects.
What is true for the hardware debugging probes, is true for the gdb client and server side. I’m using mostly the P&E, SEGGER and CMSIS-DAP plugins (e.g. NXP LinkServer) and OpenOCD from the Eclipse IDE side. But there are more choices, for example pyOCD.
It is the exam and grading time at the university, and the same time I’m preparing the lectures and labs for the new semester starting mid of February. I’m always heading for using the latest and greatest tools in my labs. A few days ago, NXP released the new version of the MCUXpresso IDE, version 11.7.0. Time to check it out…
The year 2022 is coming to an end, and I have spent some time today on a little side project. It is about making an Electrical Vehicle (EV) wallbox charger accessible over Modbus RTU. It is not finished yet, and I plan to publish more articles on it, but I can share that I’m able to access and control the Heidelberg EV charger with a Raspberry Pi Pico W (Dual Core Cortex M0+), NXP K22FN512 (Cortex M4F) and LPC845 (Single Core Cortex M0+):
In many embedded applications, it is mandatory that memory allocation is static and not dynamic. Means that no calls to things like malloc() or free() shall be used in the application, because they might fail at runtime (out of memory, heap fragmentation).
But when linking with 3rd party libraries or even with the C/C++ standard libraries, how to ensure no dynamic memory is used? The problem can occur as well for C++ objects, or a simple call to printf() which internally requires some dynamic memory allocated.