There is now an example project available on GitHub which runs FreeRTOS on the FRDM-KL05Z board:
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:
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.
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:
The example project is available on GitHub here.
Happy Freedom 🙂
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
LikeLike
Hi Andrei,
I have reworded that sentence. And yes, the bus clock is limited to 24 MHz for the Kinetis-L, so it is not possible to go beyond that.
LikeLike
Hi Andrei,
There are 2 SPI ports available in the MKL25Z128VLK4 on the new FRDM-KL25Z board, you might like to try that instead.. as a bonus, it’s a little bit cheaper as well. 🙂
LikeLike