Idle Time Recovery With an RTOS

 In this project we are improving a digital picture frame application by recovering some of it’s idle time for use by other threads. The thread “Thread_SlideShow” decodes and displays on the LCD each of the JPEG image files located in the root directory of the micro SD card. The board we are using (FRDM-KL25Z) only has a legacy single-bit SPI interface to communicate with the micro SD card, as our MCU does not support the high-performance parallel SD interface.

Initially the program would use polling to check if the SD card controller was ready to read the address location on the SD card. I optimized the program to allow other threads to contribute to the work load instead of busy-waiting on the hardware to become ready.  This was achieved by measuring the average time of the hardware for a ready response. Then instructing the thread to wait for that measured time, which allowed the program to leave the current task and perform others while it waited on the SD card controller hardware.

The project in its entirety can be found in the Git repository below.
(You must be logged in to view the contents of the repository)

https://git.robsengineeringadventures.com/rmhunter/idle-time-recovery

Leave a comment

Your email address will not be published. Required fields are marked *

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