Teaching at a university means to work in a very special environment. What students love is ‘Open Source’: because it allows them to ‘see’ things and learn from the technology. The other thing is: students have a low budgets, so they appreciate if they can use inexpensive or low-cost hardware and software. The FRDM-KL25Z Freedom board for sure meets that low price, and no extra programming device needed.
Now they are building their own boards, and they wish to program and debug it. They can borrow the Segger J-Links and P&E Multilinks we have available at the university. But why not use the Freedom board as ‘hobby’ debug and programming solution? As explored in “Using the Freedom Board as SWD Programmer“, they can use the default factory installed OpenSDA to program another microcontroller of same type. But not to debug it.
While writing the ”Using the Freedom Board as SWD Programmer” article, I was looking into USBDM. USBDM has added in January 2013 support for OpenSDA. But at that time, it was somehow not working for me, and I had not enough time to find out what the problem was. Time to get that fixed. Good news: With help and tips from the USBDM community, I have it finally working
“As an engineer, you should ask for the best tools available. Spending money for better tools can make the difference between finding a problem quickly, or wasting days or weeks, and ultimately failing a project.” (unknown)
I had to learn it the hard way: some ‘hard-to-find-problems’ sometimes only can be found with some amount of luck, or with using a good trace solution. CodeWarrior already supports trace, such as using the MTB on the Cortex-M0+. But with this I’m limited to the on-chip trace buffer or on-chip RAM, which is better than nothing. But to solve the real hard problems, a bit of more power and memory is needed. And here where the P&E Tracelink comes into play: with 128 MByte trace buffer it would allow me to record a lot more trace data .
Maybe Eclipse is ‘too much’, and you are looking for something different? The cool thing with Processor Expert is that while this is Eclipse based, you can use it easily with other tool chains like IAR Embedded Workbench. So you have the choice, and I have explored things a little with porting FreeRTOS for Cortex-M0+ to IAR .
IAR Embedded Workbench with FreeRTOS
In this tutorial I’m showing how use IAR with FreeRTOS and the Freedom FRDM-KL25Z Board, using Processor Expert components.
Debugging is usually a ‘stop-inspect-continue’ process. That does not work very well for watching a system which continuously changes its state. For this usually I toggle an LED, or write things to the console to watch with a human eye what is going on. But there is something very powerful in the CodeWarrior debugger too: to display variables and memory content while the target is running.
I have a project working, and then I want to do a copy. Unfortunately, this is not as simple as it should be . In order to copy a project with all the settings, some knowledge about the internals of the project structure is required, which is the topic of this post.
In “Copy my Project” I was using a ColdFire V2 project which is not an easy case, as is using a Target Task to flash the microcontroller. Fortunately, all other targets in CodeWarrior for MCU are *not* using target tasks . With little help and preparation, a copy a project is not that difficult to do. I’m showing how to do this with the FRDM-KL25Z project I have created in this post.
Sometimes I show to much in a tutorial: only writing something to the UART? Sounds boring, so why not adding tasks, LEDs and a full shell implementation to the mix as in this post? Yes, definitely too much to start with at the beginning . So less is more, and if it is just about the UART. And I promise: it is doable with around 50 lines of application code .
AND: I admit, this post title is a trap . It is not about printf(). But it *is* about using the UART on the KL25Z Freedom board and to do things like printf(), and even more. Trust me. It is about how to write *and* read from the UART. While I’m using here the Kinetis-L ARM Cortex-M0+ KL25Z Freedom board, it is applicable to any other Kinetis device.
USB has two sides: if it works, it is great . If it does not, it is really bad . It took a while in the desktop and PC world until USB for common devices (mouse, keyboard, memory sticks, …) was working without issues. But ‘non-standard’ devices like a USB debugging probe/cable are not of that kind of category.
Occasionally I run into USB driver issues in my class. So this post is about identifying the different USB driver parts for the P&E OpenSDA, P&E OSBDM/OSJTAG and P&E Multilinks. And how to install the drivers manually if something is not going well.
Many new notebooks do not have a serial port any more: everything is USB. This can lead to problems (see USB or not: CDC with Processor Expert) as many embedded targets use normal RS-232. In my classes I’m using the Tower boards: some Tower boards have an on-board 2 pin RS-232 header, e.g. the Tower TWR-MCF52259. Others like the TWR-K60N512 use the added TWR-SER board. The Tower boards have as well a USB capable S08JM60 which is used for debugging (OSBDM/OSJTAG), so why not using the OSBDM microcontroller as Serial-to-USB gateway?
It is one of these long weekends which allow to catch up on many things. One thing I finally completed was the move to FreeRTOS V7.1.1. With this I did some tests using the Tower boards, including the Kinetis one. So I have rebuild my Kinetis K60 application and was ready to flash the device. But then to my surprise I got this dialog:
Freescale S08 controllers have an internal clock generator (ICG) which allows the device to run without an external clock signal. But as devices differ, they need to be calibrated and trimmed. The microcontrollers are usually trimmed in the factory. How can I trim it myself if I need something better?