nikmonios / FreeRTOS_MSP432_LEDs_example

Blink 2 built-in LEDS, with different frequency, on an MSP432P401R launchpad using FreeRTOS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FreeRTOS_MSP432_LEDs_example

Blink 2 built-in LEDS, with different frequency, on an MSP432P401R launchpad using FreeRTOS


FreeRTOS offers a demo for the MSP432 launchpad, blinkind one LED every 400 milliseconds.


This demo expands the initial code, adding new threads for a second blinking LED.
The second LED blinks in a different frequency than the first LED, and in various colours (using the built-in RGB functionality of the launchapd)

You should already have the FreeRTOS scource code installed on your PC. To run this demo, download this CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil directory and replace your directory_where_freertos_is_installed\FreeRTOS\Demo\CORTEX_M4F_MSP432_LaunchPad_IAR_CCS_Keil directory.
Then follow the instructions from FreeRTOS to import the project to your IDE, rebuild it, and flash the launchpad.

The files that were modified are:
-main.c
-main_blinky.c


In main.c file, new GPIOs that correspond to the LED were added
MAP_GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN0 );
MAP_GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN0 );
MAP_GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN1 );
MAP_GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN1 );
MAP_GPIO_setOutputLowOnPin( GPIO_PORT_P2, GPIO_PIN2 );
MAP_GPIO_setAsOutputPin( GPIO_PORT_P2, GPIO_PIN2 );



In main_blinky.c, new threads were added using the xTaskCreate function. A new frequency for the second LED was used (#define secondQUEUE_SEND_FREQUENCY_MS ( pdMS_TO_TICKS( 500UL ) )), and 2 new functions that are used by the threads were created.


This is the launchpad that was used:
alt text

You can buy it at: http://www.ti.com/tool/MSP-EXP432P401R

About

Blink 2 built-in LEDS, with different frequency, on an MSP432P401R launchpad using FreeRTOS