FreeRTOS on the FRDM-KL05Z Board

There is now an example project available on GitHub which runs FreeRTOS on the FRDM-KL05Z board:

FRDM-KL25Z Board with FreeRTOS

FRDM-KL25Z Board with FreeRTOS

Note: the picture shows a preproduction board. The board available from Farnell/element14 has the components placed slightly differently. See this post.

Running an RTOS on a microcontroller with 32 KByte of Flash and 4 KByte of RAM is somewhat challenging, but certainly possible for a small Kernel like FreeRTOS. Right now I’m using less than 1 KByte RAM in the project, so plenty of room for extensions.

As outlined in this post, I have changed the project settings so it is using the QFN32 package:

KL05Z CPU Package

KL05Z CPU Package

Application

The application creates one task which toggles the red RGB LED, while the IDLE task toggles the green LED. The whole application fits into less than 1 KByte of RAM and less than 4 KByte of FLASH. While it would be possible to even more reduce the footprint as outlined in this post, I kept things simple so the project can be easily used as a starting point for any RTOS enabled project on the Kinetis KL05.

KL05Z FreeRTOS Project Components

KL05Z FreeRTOS Project Components

Clock Settings

The board has a 32 kHz crystal on it. I have configured the clock to use the FEE mode in order to reach the a 48 MHz core clock and a 24 MHz bus cock:

KL05 Clock Settings

KL05 Clock Settings

The example project is available on GitHub here.

Happy Freedom 🙂

3 thoughts on “FreeRTOS on the FRDM-KL05Z Board

  1. You have a funny errata in the first sentence from Clock Settings.

    I was able to get same settings as yours (about 48MHz core clock) but I would like to have higher bus clock (at least 32MHz) because I’m using SPI and it only gets to 12MHz (I think 16MHz would be perfect).
    This is because I have an OLED screen, flash (for images and fonts) and SRAM (for screen buffering) all on the same SPI bus. So it takes a while to move data from flash to SRAM (when drawing) and from SRAM to OLED (when flushing the screen).

    I haven’t checked the datasheet yet but I think the bus clock is limited to 24MHz.

    Thanks

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.