MCUXpresso Config Tools: How to Use the Pins Tool (Japanese Blog) table of contents
Introduction
In what situations can the Pins Tool be used?
Installing Config Tools
Pins Tool screen configuration
Pins Tool Basics ~Where do signals flow from and to?~
Demonstration: Change pin settings and change the blinking color of the LED.
Bonus - View the pin list in a document (Excel file)
Introduction
This article explains the "Pins Tool," which is included in MCUXpresso Config Tools and is used for configuring pins. For instructions on using the "Clocks Tool," please refer to the following article.
MCUXpresso Config Tools: How to Use the Clocks Tool (Japanese Blog)
Recent microcontrollers (MCUs) integrate many peripheral functions, resulting in some MCUs having over 200 pins. MCU pin configurations are designed for flexibility, allowing multiple functions (signals) to be assigned to a single pin. Furthermore, multiple pin options are available for the same function. While highly flexible, this flexibility makes configuration quite complex. Therefore, deciding which function to assign to which pin (pin multiplexing configuration) is one of the important and challenging tasks in the early stages of design. This is where the "Pins Tool" in MCUXpresso Config Tools comes in handy. Pins Tool allows you to intuitively perform pin assignments and electrical settings via a GUI, and automatically generate the results as code, thus avoiding manual configuration errors and conflicts.
We'll start by explaining how to use the Pins Tool within Config Tools in the VS Code environment. Then, we'll demonstrate how to change pin settings and alter the LED blinking color.
In what situations can the Pins Tool be used?
When you want to check existing pin settings
When you want to design to avoid pin conflicts (*If you accidentally make a conflicting setting, the error will be displayed in a visually clear way.)
When you want to adjust electrical settings such as pull-up/pull-down and drive strength using a GUI.
When you want to automatically generate pin configuration codes
Installing Config Tools
This guide explains how to install Config Tools in the VS Code environment. *If you haven't installed MCUXpresso for VS Code yet, please refer to this blog post.
Installing MCUXpresso for VSC and SDK (Japanese blog)
After launching VS Code, select MCUXpresso from the left-hand panel, and then click Open MCUXpresso Installer from the Quick Start Panel.
The installer will launch. Select MCUXpresso Configuration Tools and click Install in the upper right corner. (This blog post describes the installation of MCUXpresso Config Tools v26.03.)
You will be prompted to log in to MyNXP as soon as the installation begins.
After logging in, the License Agreement will be displayed. Please review its contents and agree to them.
*Please restart VS Code after installation.
Q. What if the installation fails? A. Please download the installer appropriate for your PC's OS environment from the following website and try it out. MCUXpresso Config Tools | Software Development for NXP Microcontrollers (MCUs) | NXP Semiconductors As you proceed with the installation, the following screen will appear on the initial screen. If you do not see anything relevant, you can close it.
To access Config Tools from VS Code, install the SDK, import the sample, and then right-click on your project. "Open with MCUXpresso Config Tools" will appear; click on it. *This entire process will be explained in detail in the final demonstration, so we will omit it here. Config Tools will start after a short while.
If you are using the MCUXpresso IDE, Config Tools are integrated by default and can be launched directly from the top tab.
Pins Tool screen configuration
After launching Config Tools, you can switch between tools using the panel on the right side of the screen.
This time, we'll select "Pins".
This section describes the main views within the Pin Tool.
Pins: Assign peripherals on a pin-by-pin basis.
Peripheral Signals: Assign pins on a per-peripheral basis.
Package: Visualizes the pin configuration of the chip.
Routing Details: Configures the connections between each pin and peripheral, as well as input/output settings.
Problems: Errors or warnings related to the settings are displayed.
Next, we'll take a closer look at Routing Details, which are the most important aspect of the setup.
# : Indicates the actual pin number (location) on the MCU package.
Peripheral: Indicates the peripheral assigned to the pin.
Signal: Indicates the peripheral's signal. For UART, TX/RX will be displayed; for SPI, SCK or MOSI will be displayed.
Arrow: Indicates connection direction.:<-> <- :ペリフェラルへの入力 ->Bidirectional: Output from peripheral
Routed pin/signal: Indicates the pin to which a peripheral signal is connected or an internal signal.
Label: A label that can be set arbitrarily.
Identifier: An identifier used during code generation. This identifier is automatically generated as a #define macro and referenced from the application code.
Direction: Specifies the input/output direction when using the pin as a GPIO. For signals such as UART and SPI, the input/output direction is predetermined, so the Direction may only be a reference display.
If there is an error due to incorrect pin settings, the Problems view will display the location and cause of the error. Other areas will also be highlighted in red, allowing you to visually identify the problem areas.
In the diagram below, multiple peripherals are configured for pin B12, meaning a conflict is occurring.
Pins Tool Basics ~Where do signals flow from and to?~
Before actually using the tool, let's clarify what Pins Tool is used to configure.
In PinsTool "Where do traffic signals come from, and where do they go?" We will configure the pin settings from this perspective. There are three main patterns to this "flow."
① Inputting external signals into the MCU (pin ⇀ peripheral)
First, let's look at input. This involves inputting signals from external sensors, switches, or other ICs into peripherals within the MCU via pins.
Clicking the "+" button in Routing Details will add a row, allowing you to enter data directly.
The example in the diagram below shows that "the signal input from the reset button SW1 is taken into the MCU via the F3 pin (RESET_B)."
② Outputting signals from inside the MCU to the outside (Peripheral ⇀ Pin)
Next is output. This is a case where a signal is sent to the outside from the peripherals inside the MCU via pins.
The example in the diagram below shows how to "assign the signal (FLEXSPI_B_DATA0) from the internal peripheral (FlexSPI) to the K3 pin and output that signal externally."
③ Internally self-contained connections (peripheral ⇀ peripheral)
Finally, there's the case where the output of one internal peripheral is connected to the input of another internal peripheral.
In the example shown in the diagram below, the PWM trigger signal (PWM0_A0_TRIG0) is routed to the ADC0 trigger input (TRG) via internal routing. This indicates that it will be used as CH0. In this case, since it does not go through an external pin, the "#" indicating the leftmost pin assignment is n/a.
In most actual designs, cases ① and ②, which involve input and output to external systems, make up the majority. Internal connections (③) are used for more advanced control and optimization.
Demonstration: Change pin settings and change the blinking color of the LED.
From here, we will actually change the pin settings in Pins Tool and see if the blinking color of the LEDs on the evaluation board changes.
Hardware Preparation The evaluation board used in this article is the FRDM-MCXN947
Installing the SDK With MCUXpresso selected in the left-hand panel within VS Code , click " Import Repository ".
Next, click on " REMOTE ARCHIVE ," the second option from the left, and search for " FRDM-MCXN947 " in the Package section . It should appear immediately when you type " 947. "
The Name , Location , and the "Create Git" checkbox can be set as you wish.
*For Name and Location names, it is best to use only lowercase alphanumeric characters and underscores (_) or hyphens (-) , and avoid symbols such as ( \, /, :, *, ?, ", <, >, | ) and spaces (which may cause program malfunctions).
Finally, check the " I agree " box and click " Import " to begin the SDK installation. Please wait a moment. The installation is complete when " Repository successfully imported" is displayed in the lower right corner of the screen.
Importing sample code
Once the SDK installation is complete, proceed to import the sample code. Click " Import Example From Repository " in the panel on the left.
Within each tab displayed on the right, under " Repository ," select the SDK you just imported. Please select FRDM-MCXN947 for " Board ". In this " Template " demonstration, we will show how to change the blinking color of the LED . Try typing " led " and selecting " driver_examples/gpio/gpio_led_output_cm33_core0 " that appears.
Next, select the Toolchain and click " Import" .
Open ConfigTools
Right-click on the imported sample and select " Open with MCUXpresso Config Tools ". The Config Tools will launch after a short wait.
Once Config Tools opens, first check the Overview in the right-hand panel. In this example, both Clocks and Pins are green (ON ) , indicating that both tools are enabled.
Select Pins to see the current pin settings.
Looking at " Routing Details ," three pins (A1, B1, B12) are enabled. However, when we look at the Direction of the B12 pin set for the LED , it says " Not Specified ," which means that the LED is not set to output in Pins Tool .
So, why does the LED blink even though it's not configured? Let's go back to VS Code and look at the C source file (gpio_led_output.c).
Looking at the C source file, the pin functionality is reflected by BOARD_InitHardware() , but as we confirmed earlier, at this point, pin B12 is not set as a GPIO output in Pins Tool . Therefore, in the initial state of this sample, the GPIO input/output direction depends on the source code, not on Pins Tool. Specifically, the GPIO_PinInit() function initializes pin B12 as a "GPIO output," making it ready to control the LED .
The goal here is to change the pin settings using Pins Tool and reflect those changes in the code. Therefore, we will remove the parts of the source code related to GPIO initialization and control ( shown in red below ) . Deleting it will remove the GPIO output settings from anywhere, so the LED will no longer blink when you build and debug.
Next, configure the pins using Pins Tools . In Pins Tools , change the Direction of GPIO0_10 for pin # B12 to Output .
This is the case of ② above, where an internal MCU signal is sent to the outside (peripheral ⇀ pin). This changes the configuration so that "pin B12 ( PIO0_10 ) is set as a GPIO output, and the signal controlled by the MCU 's internal GPIO (software control) is output to the outside ( LED_RED ) via the pin."
You can see the code changes in the Code Preview panel on the right. Changing from "Not Specified" to "Output" adds GPIO initialization code to the bottom of pin_mux.c .
Now, we will rewrite the sample code. First, click Update Code in the upper left corner of the Config Tools screen.
A window will then appear. Here, you can see the code changes, just like in Code Preview.
When you return to VS Code , you will see three checkboxes at the top of the screen. Make sure they are checked and click OK . After a short while, the changes made in Clocks Tool will be applied to the sample code in VS Code . *This may not be displayed if you are using a different SDK version.
Once complete, connect the board (FRDM-MCXN947) to your PC before building.
Once the connection is established, debug the imported sample ( build, write, and run the application ) .
Once the debugging process is complete, the program will have stopped at the breakpoint, so click the "|▶" icon at the top of the screen.
As shown in the video, the red LED will start flashing.
(function() { var wrapper = document.getElementById('lia-vid-6397512171112w304h540r886'); var videoEl = wrapper ? wrapper.querySelector('video-js') : null; if (videoEl) { if (window.videojs) { window.videojs(videoEl).ready(function() { this.on('loadedmetadata', function() { this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) { bar.setAttribute('role', 'presentation'); bar.setAttribute('aria-hidden', 'true'); }); }); }); } }})(); (Show My Videos)
To exit the program, click the square icon ( the LED will continue to blink as long as it's connected to the PC, but please ignore this for now ) .
Why did the red LED blink? Here's some additional information about why the red LED was blinking. The blinking of the red LED in this case is determined by two main settings:
app.h: Defines which LED (pin) to control.
pin_mux.c: Defines how to use that pin.
These two elements enable the LED to blink.
Which LED is being controlled? (app.h) At the bottom of the C source file " gpio_led_output.c ", there is a function called GPIO_PortToggle : which inverts the output of a specified GPIO pin.
In this function,
BOARD_LED_GPIO (GPIO port)
BOARD_LED_GPIO_PIN(pin number)
This inverts the output of the specified GPIO pin, causing the LED to blink.
However, at this point, it's not clear which color LED corresponds to this GPIO port and pin. Then, right-click on BOARD_LED_GPIO and select " Go to Definition " (or "fn + F12" ) to open " app.h ".
If you check the Definitions section in app.h , you'll see that these definitions are assigned to the GPIO pin for the red LED . This confirms that the target of the operation is the red LED . However, even if the red LED is assigned in app.h , the LED will not light up unless the pin is configured as a GPIO output.
How to use pins (pin_mux.c)
Next, we'll look at the contents of pin_mux.c to check the pin settings. Inside " gpio_led_output.c ", you'll find Pin, Clock, Debug There is a BOARD_InitHardware(); function to initialize each console, so right-click here and select " Go to Definition " (or "fn + F12" ) to see more details.
The next location is BOARD_InitPins();, where the pin settings are described. Right-click on BOARD_InitPins(); again and select " Go to Definition (or "fn + F12" )" to open " pin_mux.c ".
pin_mux.c is a file that reflects the settings configured in Pins Tool , and it is the same as what you saw in Code Preview when you changed the red LED to an output earlier. At the very bottom, there is the following description, which means that pin B12 connected to the red LED is initialized as a GPIO output with an initial value of 0 .
In this way, app.h determines "which LED to control (the red LED )," and pin_mux.c makes "that pin available as a GPIO output," so that the red LED can be controlled by GPIO_PortToggle() .
Change the pin settings to change the LED's blinking color to blue.
Next, we will change the LED 's blinking color from red to blue by changing the pin settings. Returning to the Config Tool , if you search for " LED " in Pins , you will find that pin C4 corresponds to the blue LED (LED_BLUE) .
When you check the C4 pin, a window like the one shown below will appear. Check GPIO1:GPIO,2 (PIO1_2) and click Done .
Once you've completed these steps, the C4 pin you added will appear in the Routing Details . The C4 pin is configured as a GPIO function ( PIO1_2 ), and the label "LED_BLUE " is assigned to this pin. This allows the software to treat this pin as a blue LED .
Next, we will configure the pin input/output settings. Change the red LED in the Direction panel from Output ⇀ Not Specified, and the blue LED from Not Specified ⇀ Output . With this setting, the blue LED is configured as a GPIO output.
You can see the changes in pin_mux.c in Code Preview .
Now, rewrite the sample code. As before, run Update Code in Config Tools and confirm the changes in VS Code . The changed pin settings will be reflected.
So far, pin_mux.c has been updated. Finally, update app.h. Open app.h using the steps described earlier, and change LED_RED to LED_BLUE . By changing this definition, you can switch the GPIO control target from a red LED to a blue LED .
Once you've completed these steps, debug again ( build, flash, and run the application ) . Once the debugging process is complete, click the "|▶" icon at the top of the screen. As shown in the video, the blue LED will start flashing.
(function() { var wrapper = document.getElementById('lia-vid-6397512593112w304h540r703'); var videoEl = wrapper ? wrapper.querySelector('video-js') : null; if (videoEl) { if (window.videojs) { window.videojs(videoEl).ready(function() { this.on('loadedmetadata', function() { this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) { bar.setAttribute('role', 'presentation'); bar.setAttribute('aria-hidden', 'true'); }); }); }); } }})(); (Show My Videos)
Incidentally, the reason why one LED could blink in different colors is that the FRDM-MCXN947 board used in this project is equipped with an RGB LED. Looking at the circuit diagram of the FRDM-MCXN947 , you can see that R/G/B are assigned to each pin. Therefore, by setting the output of two colored pins simultaneously within Pins Tool and formatting the source code appropriately, it is possible to represent a variety of colors (e.g., red + blue = purple ).
Bonus - View the pin list in a document (Excel file)
When you open the MCX N reference manual , you will find an attached file called MCXNP184M150F70_Pinout.xlsx . This file contains a list of pins and a list of peripheral functions for each pin. These days, with the evolution of Pins Tool, the need to manually configure pin settings while referring to such lists may be decreasing.
On the other hand, it can still be used as a useful reference document in the early stages of system design, such as for device selection, package comparison, and checking available peripherals. To download the MCX N reference manual, you need to register for a MyNXP account .
*Opened in Acrobat Reader
This explanation used a simple example, but pin configurations in actual designs are much more complex. That's where Pins Tool comes in handy; it helps prevent errors and allows for efficient configuration. Please give it a try!
=========================
We are currently unable to respond to comments left in the " Comment " section of this post . We apologize for the inconvenience, but please refer to " Technical Questions to NXP - How to Contact Us ( Japanese Blog ) " when making inquiries . (If you are already an NXP distributor or have a relationship with NXP , you may ask your representative directly.) This guide focuses on the "Pins Tool" within MCUXpresso Config Tools, explaining the basics and methods of setting up pins. This guide will cover everything from installation in the VS Code environment to a demonstration of LED blinking by changing pin settings.
(Estimated time: 10 minutes *Assumes MCUXpresso for VSC (Visual Studio Code) SDK is installed) MCUXpresso MCX Victoria | Downloads Japanese Blog
記事全体を表示