> For the complete documentation index, see [llms.txt](https://nxp.gitbook.io/nxp-cup/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nxp.gitbook.io/nxp-cup/2025-fall-2026-nxp-cup-mcxn947/mcxn947-software-setup/dive-into-the-led-blinky-demo.md).

# Dive into the LED blinky demo

First let's create a Workspace Folder. Launch workspace where you want to locate it. Keep in mind that workspace switching restarts IDE.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FW65PgjGgHKWMK35hJpgJ%2Fimage-15.png?alt=media&amp;token=d3899851-1b9d-4f60-8b82-0fdb63c25726" alt=""><figcaption></figcaption></figure>

Close the Welcome page and select "Import SDK example(s)...". Select the correct MCXN947 board and press "Next".

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FPSQJ5Y2rVvi4eunmoRnO%2Fimage-16.png?alt=media&amp;token=3f8fa43a-f7a0-4277-9385-5b7c1c53a930" alt=""><figcaption></figcaption></figure>

Now from the Import Wizard, drop down on the demo\_apps section and select the "led\_blinky" application. Then press "Finish" and wait for the project to open.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FxUCRc2ij5Vqzz9tFypBN%2Fimage-17.png?alt=media&amp;token=55af4b9f-1bb1-44fb-b0d9-37dc9a292e31" alt=""><figcaption></figcaption></figure>

You can see what the project window is split into.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FL8EinRzCUqTnNCrOHaQX%2Fimage-18.png?alt=media&amp;token=e3ef5750-e0f9-48c0-9de9-eb7eb9864b77" alt=""><figcaption></figcaption></figure>

Let's take a look at the code. The top part of the code contains the includes files present in the project tree and visible in the Project Explorer tab.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FOR83PsbRDGEccluvBWce%2Fimage-19.png?alt=media&amp;token=35ee7e9a-5961-4494-abac-d2613c9f2718" alt=""><figcaption></figcaption></figure>

The next section is the SysTick\_Handler function that toggles the red LED on the board.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FrUzX34yle5oDtRJ2TtDy%2Fimage-20.png?alt=media&amp;token=d6b69c75-d40d-4f11-9f49-35ce571dd4da" alt=""><figcaption></figcaption></figure>

This function will be periodically called to switch ON and OFF the LED. Ctrl + click on the GPIO\_PortToggle function opens the declaration present in fsl\_gpio.h header file.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FlB7acRqclHCMx88n0KJE%2Fimage-21.png?alt=media&amp;token=bbbca8bc-863c-4041-ab2c-3db5b6d82d36" alt=""><figcaption></figcaption></figure>

The main function starts by calling the initialization function.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FBbXyWAJJdZyGeeYk11CD%2Fimage-22.png?alt=media&amp;token=14f28b3a-201d-4d71-86d7-27047986b21d" alt=""><figcaption></figcaption></figure>

The initialization function can be found in the hardware\_init.c file.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FIQoHJD8Tu2hxODWFz83p%2Fimage-23.png?alt=media&amp;token=bcc637e5-d68e-47eb-8df3-57c139bd747f" alt=""><figcaption></figcaption></figure>

This function enables a clock and initializes the board pinds. Then the BOARD\_BootClockFRO12M() sets the clock frequency to 12 MHz. SysTick\_Config(12000000UL) sets a counter with a value of 12.000.000 that makes the LED blink once per second. More on timers will be covered later. Changing the counter value will increase/decrease the blinking frequency but note that it needs to be slow enough for the human eye to notice it. LED\_RED\_INIT(LOGIC\_LED\_OFF) calls GPIO\_PinWrite() that changes the output of the GPIO (in this case to the OFF state).

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FpBQV9xiijQbhyVTdZCpt%2Fimage-24.png?alt=media&amp;token=8a51be89-9cdd-4a09-965c-986dea4335e3" alt=""><figcaption></figcaption></figure>

Now let's divo into how to build and download the code on your board.

In order to build a project, have it selected and then either click on the "build icon" in the shortcuts provided above or by clicking "Build" in the Quickstart Panel.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FAq7whGb0FYfWiHdrMOzI%2Fimage-25.png?alt=media&amp;token=ed7c9932-2ff7-40bd-af61-4634dc26c53b" alt=""><figcaption></figcaption></figure>

The project should finish the build without any errors or warnings in the console.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2F1KhKee61Ibp4C4RQavIJ%2Fimage-26.png?alt=media&amp;token=53392de4-7b4f-44f7-afcf-97444f63b1e2" alt=""><figcaption></figcaption></figure>

For the download step, make sure your board is connected to the computer through the J17 'MCU-LINK' port.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FaPZcqRJKUYRBCnSsqcL0%2Fimage-28.png?alt=media&amp;token=0d2fdd9a-aaf9-462d-abc0-27e00c798841" alt=""><figcaption></figcaption></figure>

Download the application to your board by either cliking on the "debug" icon above or clicking "Debug" in the Quickstart Panel.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2F4v1vWMffoAukkmfF7IuS%2Fimage-27.png?alt=media&amp;token=fab6b203-ed6b-4da0-87b8-64ff4a5b3423" alt=""><figcaption></figcaption></figure>

In the next window, select the MCU-LINK CMSIS-DAP debug probe.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FaPSTle6y7AtNwgm7R5Up%2Fimage-29.png?alt=media&amp;token=b2c1c43e-239e-4240-a724-2b339a1e657f" alt=""><figcaption></figcaption></figure>

To run the application, press the "run" icon.

<figure><img src="https://2412084329-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-L9GLtaxrQtBdBRsFIJB%2Fuploads%2FDqT6pUf5MHG1eYfPRQ3H%2Fimage-30.png?alt=media&amp;token=2127b734-fcc1-47c3-832a-e6f356e1a977" alt=""><figcaption></figcaption></figure>
