Week 5. I continued working on utilizing FreeRTOS for our board as last week I had done a very improper implementation. In my inexperienced eyes, everything was working, but more and more issues were appearing. That’s when Dr. Shawn took a look at the chaos I’ve created. Basically I didn’t understand well enough how an RTOS works, and my implementation was bound to crash. Therefore I had to go back and read more of the documentation as Dr. Shawn told me my task was basically “80% thinking, 20% coding”.

For example, each app sub-system would be attempting to write its status to the CDC port, however since in RTOS everything happens together (multitasking) the port would crash. I took Dr. Shawn’s advice on how I should implement it, and I started working from the dual CDC port read/write example implementation by MP Lab’s harmony, which was a bit advanced as our original program only had a single port that we would only be writing to.

I spent most of the week studying the documentation. I familiarized myself with how queues, interrupt routines and semaphores work in FreeRTOS. After which I worked on the code, I took Dr. Shawn’s suggestion for a simple implementation and protected the CDC with a mutex. Only the task holding the mutex will be able to write to the CDC. Its still work in progress but with what I learned I should be able to finish quickly. It seems simple once you read enough.


Leave a Reply

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