Performance Zone is brought to you in partnership with:

Erich is Professor at Lucerne University of Applied Sciences and Arts and Distinguished Member of Technical Staff at Freescale Semiconductor. Erich has a MsCS degree and 18+ years of experience in the embedded software and tools world. He created many embedded cross C/C++ compilers and debuggers. Additionally he is researching in the domain of programming languages, real time and mechatronic systems. Erich is a DZone MVB and is not an employee of DZone and has posted 117 posts at DZone. You can read more from them at their website. View Full User Profile

A new Freedom Board: FRDM-K20D50M with ARM Cortex M4

04.18.2013
| 4665 views |
  • submit to reddit

Freescale/Farnell/Element14 announced last week a new Freedom Board: the FRDM-K20D50M :-) . As you can expect, I was not able to resist, and ordered one from my local Farnell store right away. So I did my first steps with it on this sunny and wonderful weekend (yes! we skipped Spring Time and entered Summer Time right away!).

I do not need to compare the board with the previous Freedom boards, as I have found an article here. I a nutshell: I get pretty much the same as with the FRDM-KL25Z, but instead of an ARM Cortex-M0+, it has an ARM Cortex-M4!

The new FRDM-K20D50M Board

The new FRDM-K20D50M Board

Farnell.ch sold me the FRDM-KL25Z for CHF 17.05, while the FRDM-K20D50M is listed for CHF 32.25. That’s about twice the price of the FRDM-KL25Z :-( . Ok, I get an ARM Cortex-M4 instead of an ARM Cortex-M0+, but what else? Let’s see.

The Content

The board comes in the typical Freedom board, only that it the board is a red one:

FRDM-K20D50M Box and Content

FRDM-K20D50M Box and Content

The box includes a small bag with the 4 dual-row headers. Nice! That justifies at least some of the higher price.

Dual Row Arduino Headers

Dual Row Arduino Headers

The Board

The front side of the board looks very familiar to the existing FRDM boards:

FRDM-K20D50M Front Side

FRDM-K20D50M Front Side

Having a closer look, there are a few more add-ons:

  1. There are two crystals: one 32 kHz and one 8 MHz one.
  2. New analog Ambient Light Sensor with J12 jumper to isolate it
  3. New Temperature Sensor (U11) with jumper J13 to isolate it (Note: the user manual says that this sensor is *not* populated. However, it is present on my board :-) )
  4. Two jumpers (J16 and J17) to disconnect the I2C lines to the accelerometer
  5. Jumper J14 to cut the reset line between OpenSDA and the target CPU
  6. Jumper J13 to isolate the BD1020HFV-TR temperature sensor
  7. Jumper J21 to enable USB Host support (unprotected), so my hack is not needed any more :-)
Changes on board compared to FRDM-KL25Z

Changes on board compared to FRDM-KL25Z

On the backside the battery holder is not populated (same as on earlier Freedom boards):

FRDM-K20D50M Backside

FRDM-K20D50M Backside

I noted that many pins on the dual row headers are marked as NC (Not Connected). So J9 could have been a single row header (which would be cheaper?).

Software

Freescale provides at this link an updated OpenSDA package plus bare-metal source code and examples. The source code package is not what I need in the first place as I already have a lot of drivers with Processor Expert, but always good to have such a package.

The Quick-Start Package (FRDM-K20D50M_QSP.zip) has an updated OpenSDA debug application and mass storage bootloader.

FRDM-K20D50M Quick Start

FRDM-K20D50M Quick Start

The board has the same OpenSDA on-board debug connection, so I had first to load the Debug Application (same procedure as for the FRDM-KL25Z: press the reset button on power-up, load the OpenSDA Debug App, re-power the board).

I loaded that new DEBUG-APP and I do not remember which one was factory installed. Anyway, that v106 worked for me and CodeWarrior for MCU10.3

First Project with CodeWarrior

Using CodeWarrior for MCU10.3, the MK20DX128VLH5 (mask 1N86B) is supported in the Wizard:

MK20DX128 in the CodeWarrior Wizard

MK20DX128 in the CodeWarrior Wizard

The OpenSDA connection is not available in the connection page of the Wizard. But this does not matter, as the normal P&E Multilink connection works. I only have to change the Interface in the debugger settings from P&E Multilink to OpenSDA:

OpenSDA Debug Connection for FRDM-K20D50M

OpenSDA Debug Connection for FRDM-K20D50M

:!: Do not forget to enable the ‘SWD’ debug option. I missed to set this option in the first place, and then the debugger reported “ERR: Can not enter background mode” :-(

Running FreeRTOS

Running an emtpy bareboard application was just a matter of minutes. To use more of the board ressources, I added the FreeRTOS operating system, Shell over OpenSDA CDC and RGB LED support to it:

FreeRTOS and additional components

FreeRTOS and other components

All what I needed to do is to configure the RTOS and assign the proper pins for the LED and serial connection. With Processor Expert this took less than 10 minutes from start until I had a shiny toggling LED on my board :-) :

FreeRTOS running on the FRDM-K20D50M

FreeRTOS running on the FRDM-K20D50M, with headers populated

The CodeWarrior project is available on GitHub here and will be extended over time.

Summary

That new Freedom board adds a Cortex-M4 to the existing FRDM-KL25Z and FRDM-KL05Z. It comes with the headers, plus temperature and ambient light sensor. While the M4 provides more horse-power, I wish it would have more than 16 KByte of RAM. Especially as STMicroelectronics has the STM32F3Discovery board with an ARM Cortex M4, 256 KByte of Flash and 48 KByte of RAM for CHF 25.55, compared to the CHF 32.25 for the FRDM-K20D50M? On the other side: there is no Processor Expert for the Discovery Board ;-) . I think these days it is the software which makes the difference, not the silicon or the board. Silicon is only sand ;-)

I’m happy with what I was able to carry out with the board in a very short time. It is a great addition to my set of boards, especially as it can interface with Arduino (compatible) shields. And I want to run my Zumo with it so I have a little red+black robot :-) . That will be a lot of fun: I already have some ideas how to use the temperature and ambient light sensors :mgreen:.

Happy Boarding :-)

PS: Yes, I had a beautiful and sunny week-end *outside*. Processor Expert enabled me to spend many hours outside with my family. Thank you! Despite the fact that I catched a light sun burn ;-)

Published at DZone with permission of Erich Styger, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)