Yes, I have been busy with all the different ARM Cortex Mx cores I’m using in my projects. But beside of the ‘ARM domination of the world’, there are other interesting processors out there. While the ARM cores have added DSP (Digital Signal Processing) capabilities blurring the boundaries between pure MCU and DSP processors, there is still a place (or niche?) for specialized DSP processors. The power of such processors is in the domain of fast signal processing, e.g. for intelligent power switches or for advanced motor control.
If you read my posts, then you probably know: I *love* the FRDM boards! But: Freescale has only the lower-end processors available with a FRDM board (yet?). As I need something more powerful for my Raspberry Pi Camera project, I’m using Tower boards instead. This gives me an ARM Cortex-M4 with 120 MHz, Floating Point unit plus 128 KByte SRAM :-).
For that project I need USB. So this post is about using the TWR-K60F120M and TWR-K70F120M with USB connectivity, using the USB CDC device class as example. Initially I thought I can do as easily with the FRDM boards. It turned out, that things are not that easy.
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 :-).
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 :shock:.
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?
In many cases I do a full erase-flash-debug cycle: I get my embedded microcontroller flash completely erased and then programmed with my application. Well, that does not work that way if I program with a bootloader. Yes, I can flash the bootloader and then load my target application with the bootloader, but that’s not the scenario I want to use in the development phase. I want to flash my application and keep the bootloader on the target. This means: I need to do erase and program a part of the memory. But how to do this?
The update 1.0.0 for the MCU10.2 release has been published on the Freescale CW MCU V10.2 Updates & Patches web site. Downloading the 500 MByte zip file and installing the update will take a while. After downloading I select Help > Install New Software … and specify the archive file.
Note: In general uninstalling an eclipse update is not possible. If you want to keep our original MCU10.2 on the side, then follow this trick: Copy your existing MCU10.2 installation folder and rename it (say to ‘MCU10.2_without_update’). Then apply the update to the normal MCU10.2. If you want to revert to the version without the update, simple delete the updated installation and rename the one without the update again. No need to reinstall things again. And you can use both the updated version and the normal version in parallel too: simply launch the eclipse\cwide you want
Time to read the release notes and dig into what has been changed and improved.