In this project, we demonstrate how µC/OS II can be used in a PSoC 4 BLE design.
µC/OS-II and µC/OS-III are preemptive, highly portable, and scalable real-time kernels. Designed for ease of use on a huge number of CPU architectures, these kernels are a key component of the µC/OS real-time operating system.
Project DetailsHere is the PSoC Creator Top Design Schematic:
The RTOS library is also provided with the project and has been integrated using the Compiler Settings. Also, the necessary port files are part of the project. Here, we use two Tasks:
- BLE Task to notify when there is a switch press and send the current switch press count
- Switch Task to detect if there is a switch press event
The project also demonstrates how to use Queues where data can be shared across tasks. In the Switch task, we "post" the current switch press count to the BLE queue so that the BLE task can "accept" it.
A new task is created inside the function App_TaskCreate using OSTaskCreateExt. We use the function OSQPost to post to the queue and OSQAccept to receive data from the queue.
Note that the uC/OS uses pretty good amount of RAM and FLASH. So, you may need PSoC devices that can afford this memory. Here we use the 256K BLE device.
TestingYou need PSoC Creator 4.0 to build the project. Build the project and program it to the CY8CKIT-143 module placed in the -042 BLE Kit.
Open CySmart and connect to the device "uCOS_Example". Discover All the attributes. Press the switch SW2 and see the current switch press count. As you press it again and again, you can see the count getting incremented.
Comments
Please log in or sign up to comment.