SLAAEK8 August 2024 MSPM0G3507 , MSPM0L1306
This subsystem example shows how to implement a simple, non-preemptive, run-to-completion (RTC) scheduler in MSPM0. The example includes both the scheduler, and simple task header and source files, which demonstrate the minimum requirements for building tasks for this kind of scheduling implementation. In a system, use of an RTC scheduler is most appropriate when there are multiple tasks which need to be completed by the system, that can be triggered in any order, and the actual execution time or order of these tasks is not critical.
The task scheduler subsystem is generic and appropriate for any device in the MSPM0 portfolio. Table 2-1 lists the peripherals used in the example tasks, but these are not required to make use of the scheduler portion of the example.
Subblock Functionality | Peripheral Use | Notes |
---|---|---|
DAC8 (Optional) | (1 ×) COMP | Shown as COMP_0_INST in
code |
Buffer (Optional) | (1 ×) OPA | Shown as OPA_0_INST in code |
Timer (Optional) | (1 ×) TIMG | Shown as TIMER_0_INST in
code |
LED Output (Optional) | (1 ×) GPIO | Shown as GPIO_LEDS_USER_LED_1 in
code |
Switch Input (Optional) | (1 ×) GPIO | Shown as
GPIO_SWITCHES_USER_SWITCH_1 in code |
Based on the requirements shown in Table 2-1, the example code is compatible with the devices shown in
Table 3-1.
Compatible Devices | EVM |
---|---|
MSPM0Lx | LP-MSPM0L1306 |
MSPM0Gx | LP-MSPM0G3507 |
MSPM0Cx (without use of DAC8 and Buffer) | LP-MSPM0C1104 |
Complete the following to implement the simple scheduler application:
scheduler
source and header files
to the existing project.scheduler
function is constructed to act as the main software loop for the application.
After initialization, add a call to the scheduler
function as
shown in Section 7.DAC8Driver
and
SwitchDriver
source and header files provide simple
examples of how this can be done.scheduler
when the device is woken from sleep by a system interrupt.