Many of the NXP OpenSDA boot loaders are vulnerable to Windows 8.x or Windows 10: write accesses of Windows can confuse the factory bootloader and make the debug firmware and bootloader useless. In this post I show how to recover the bootloader using MCUXpresso IDE and the P&E Universal Multilink.
Using P&E Multilink Universal to restore the OpenSDA Bootloader on NXP FRDM-K22F Board
A bootloader on a microcontroller is a very useful thing. It allows me to update the firmware in the field if necessary. There are many ways to use and make a bootloader (see “Serial Bootloader for the Freedom Board with Processor Expert“). But such a bootloader needs some space in FLASH, plus it needs to be programmed first on a blank device, so a JTAG programmer is needed. That’s why vendors have started including a ROM bootloader into their devices: the microcontroller comes out of the factory with a bootloader in FLASH. So instead writing my bootloader, I can use the one in the ROM.
FRDM-KL03Z with ROM Bootloader
And as with everything, there are pros and cons of that approach.
The Hexiwear docking station would have a nice feature: it has embedded a debug circuit (OpenSDA). That way I would not need an external debug probe to debug the Hexiwear. However, a debug probe is required to reprogram the docking station itself:
Repgrogramming the Mikroelektronika Docking Station
Getting a board from a distributor like Farnell/Element14/Mouser (add your own distributor) means that chances are high that the default firmware on it is written years from now because the inventory has not been updated, or because boards are still produced with that original firmware (because of testing?). So what happens if I use board with a firmware developed pre-Windows 8/10 area?
Freshly Unboxed NXP FRDM-KL25Z Board
It might work, but chances are high that the bootloader and firmware is not ready for the ‘modern age’, and as a result the board might be bricked. If you still have a Windows 7 machine around (I do!), you are lucky. If not, then you need to read this article….
Sometimes things don’t go well, especially with bringing up a new board design. I always sweat blood that first minute when I try to connect with the debugger to a new design: Will it work? After the optical inspection, performing electrical tests (no shortcuts? voltage levels ok?) the inflection point is when I’m connecting the first time with the debugger to the new board: either it will properly connect and program the device (hurrah!) or it will fail and potentially difficult hours of investigations have to follow.
More and more of my students are using Microsoft Windows 10 machines, and my computer has been upgraded to Windows 10 a couple of week ago too. From my work and experience, a new operating system causes always some challenges, and Windows 10 is no difference. And no, this is not about Microsoft vs. Apple vs. Linux, this post is about addressing a potential and painful problem which I have observed with Windows 10 machines, and to my understanding it could happen with any other operating system too. The problem is that somehow on several student machines the bootloader and OpenSDA application on their FRDM boards did not work any more.
FRDM-K64F (top) programming the OpenSDA Bootloader (bottom)
For a university research project I need a fast microcontroller with lots of RAM and FLASH memory. I have ordered a TWR-KV58F220M board from NXP which arrived yesterday. The special thing is that it has on of these new ARM Cortex-M7F on it:
NXP FTF Tech Forum in Austin has been a blast! I’m running another FreeRTOS hands-on session (FTF-DES-N2048) this afternoon which yet again is fully booked. But we will squeeze in as many as possible from the waiting list.
One very exciting thing we are going to use is FreeRTOS thread awareness in Eclipse/Kinetis Design Studio: to see and debug the FreeRTOS threads in Eclipse using the Segger GDB and it will show the list of threads in the Debug view:
FreeRTOS is probably the number one RTOS used, and Eclipse is likely the most popular IDE I can think of. But debugging FreeRTOS applications with Eclipse and GDB is somewhat limited? What I would like to get at the minimum is this: ability to see all the different threads in the Eclipse debug view like this:
FreeRTOS Threads in Eclipse with OpenOCD
As you might guess from that screenshot: this post is about how to make FreeRTOS tread debugging possible with Eclipse and GDB :-).
I’m using the FRDM-KL25Z in my classes, and that board is very popular: low price (<$15), reasonable features (48 MHz ARM Cortex M0+, 128 KByte of FLASH, 16 KByte of RAM), and many tutorials elsewhere and on McuOnEclipse :-).
For the next (Fall) semester I’m looking for alternative boards, and one is the Freescale (now NXP) FRDM-KL27Z:
Many times it is very useful to debug multiple boards at the same time. For example if I’m debugging a communication stack between two boards: that way I can debug the protocol on both sides. Eclipse is a great framework which allows that. This post shows how to debug multiple boards (e.g. the NXP Freedom boards) in parallel from the same Eclipse IDE using GDB and the Segger J-Link:
In “CodeWarrior Flash Programming from a DOS Shell” I showed how to program a device from the DOS shell. Because that example was for ColdFire and CodeWarrior for MCU10.2, here is the same for a Kinetis (FRDM-KL25Z) and CodeWarrior for MCU10.6. In my workspace (c:\tmp\wsp_10.6) I have a project folder (FRDM-KL25Z).
I’m using the ‘Flash Programmer’ to sneak the needed commands:
In “Unboxing the Freescale FRDM-KL43Z Board” I was using the FRDM-KL43Z board the first time. The FRDM-KL43Z board has an on-board debug interface (Kinetis K20, OpenSDA). In this post I show how to use the FRDM-KL43Z board to debug another ARM board.
The Teensy is a great and tiny board (see “USB CDC with the Teensy 3.1 Board“), but it lacks real SWD/JTAG debugging capabilities (see “Hacking the Teensy V3.1 for SWD Debugging“). The Freescale Freedom boards are great, but for many applications too big, and have potentially too many components on it. So what about building a breadboard friendly tiny board which *has* SWD debugging ability *and* can be used to debug another boards?
So here is a working prototype based on the FRDM-K20D50M:
OpenOCD is an open source and free-of-charge debugging solution, which is a great option here at the University of Lucerne, as students do not need to buy an expensive debugging probe. Still, I recommend to buy professional probes like the P&E or Segger ones, as they are worth every (Euro) cent. But for a ‘zero’ budget, OpenOCD with CMSIS-DAP is something to consider. And with Kinetis Design Studio using the GNU ARM Eclipse Plugins, OpenOCD is not that hard to be used. And because both Freescale and GNU ARM Eclipse offer OpenOCD Windows binaries, that connection method is in the reach of Windows users too.