An example to use MCUXpresso Pins Tool in a FreeRTOS project

Showing results for 
Show  only  | Search instead for 
Did you mean: 

An example to use MCUXpresso Pins Tool in a FreeRTOS project

An example to use MCUXpresso Pins Tool in a FreeRTOS project

MCUXpresso Pins Tool allows you to configure pin routing and generates ‘pin_mux.c & h’ source files. This article describes how to configure Pins in a FreeRTOS project with MCUXpresso pins tool.  In this example, pin PTC9 on Freedom-k66 board is configured.


Software and Tools

In this article, I’m using the following:

MCUXpresso IDE 10.2.1

MCUXpresso SDK 2.4.1 for  Frdm-k66f  board.  With Amazon FreeRTOS v10 .You can get it from

FRDM-K66 board

First, we need to have a working FreeRTOS project. Here we import the freertos_hello example into MCUXpresso IDE workspace.

To open the tool, simply right click on the project in Project Explorer and select the appropriate open command.


Then we can see the pin table, peripheral signals, package/pinout view, Routed pins view, generated code view.



Basic configuration can be done in either of these views Pins, Peripheral Signals or package. More advanced settings can be adjusted in Routed Pins view.

Beginning with Peripheral selection

In the Pins view on the left find a pin and peripheral signal in the table and configure the routing by clicking on the signal cell.


In this example, select PTC9.  Click into the cells to make them ‘green’

Select PTC9 on the Peripherals signals view,


Routed Pins configure

Route the selected signal to the desired pin,and configure it in the Routed Pins view.

It is possible to easily identify routed pins/peripherals in the package using highlighting. By default, the current selection (pin/peripheral) is highlighted in the package view.

State Indicator of Pin Tool

Green indicates pin/peripheral is routed

Yellow indicates pin/peripheral is currently selected

Red indicates an error

Light grey indicates pin/peripheral is available but is not currently routed.

It is also possible to configure the pin electrical features. Use the table drop down menu to configure the pin. To configure pins, start from left to right—select the peripheral first, then select required signal, and finally select the routed pin.


Code generation

 The Pins Tool automatically generates the source code for pin_mux.c and pin_mux.h on the right panel of the Code Preview view.


The configuration will be saved into .mex file, see picture below


Export the code.


You can now copy-paste the content of the sources to the application and IDE. Alternatively, you can export the generated files. To export the files, select the menu  Export


Click Next and specify the directory, Click Finish to export the files.

Integrate code the FreeRTOS task

In the source code, Board_InitBootPins() calls initial code in pin_mux.c/h

In hello world task, we toggle the configured pin


 * @brief Task responsible for printing of "Hello world." message.


static void hello_task(void *pvParameters)


    for (;;)


        PRINTF("Hello world.\r\n");

        /* Toggle LED. */






Then run the example, we can see LED is toggled every 200ms.


For information about how to create an FreeRTOS project with MCUXpresso IDE, please see the following document 

For information about configuring with MCUXpresso peripheral tool in an FreeRTOS project, please see the following document.

No ratings
Version history
Last update:
‎11-06-2018 10:49 PM
Updated by: