Getting Started with the LPCXpresso51U68

Last Modified: 2019-03-26 19:47:00Supports LPCXpresso51U68 for the LPC51U68 MCUs

Contents of this document

  • 1

    Plug It In
  • 2

    Get Software
  • 3

    Build, Run
  • 4

    Create

1. Plug It In

1.1 Get Started With the LPCXpresso51U68 Development Board - Demo.

Get started with the LPCXpresso51U68 Development Board – Unpacking and powering up.

1.2 Attach the USB Cable

GS-OM40005-1.1

1.3 Run the Out-of-Box Demo

Your LPCXpresso51U68 board comes preloaded with a simple program to blink the RGB LED red, approximately every second. The demo will power up and run whenever the board is powered (from either USB connector), but at this stage connect to the power J5 (target) connector.

GS-OM40005-1.2

2. Get Software

2.1 Getting Started With the MCUXpresso SDK

Want to learn more about SDK?

The MCUXpresso Software Development Kit (SDK) is complimentary and includes full source code under a permissive open-source license for all hardware abstraction and peripheral driver software.

Click below to download a pre-configured SDK release for the LPCXpresso51U68, which includes versions for MCUXpresso IDE, Keil MDK and IAR EWARM. Use LPCXpresso51U68 as the target board.

MCUXPRESSO-SDK-TN

Get SDK

You can also use the online MCUXpresso web tool to create a custom SDK package for the LPCXpresso51U68 using the SDK builder.

2.2 Install your Toolchain

To set up your LPCXpresso51U68 for use with 3rd party tools, first install LPCScrypt in order to install the board’s device drivers.

MCUXpresso IDE

Get MCUXpresso IDE

Want to use a different toolchain? No problem! The MCUXpresso SDK includes support for other tools such as IAR and Keil.

GS Tool Logos

To set up your LPCXpresso51U68 for use with 3rd party tools, first install LPCScrypt in order to install the board’s device drivers. The video below shows how to use LPCScrypt to program your board’s debug probe using this utility.

2.3 MCUXpresso Config Tools

The MCUXpresso Config Tool is an integrated suite of configuration tools that guides users in creating new MCUXpresso SDK projects, and provides pin and clock tools to generate initialization C code for custom board support.

MCUXpresso Config Tools

Get MCUXpresso Config Tools

2.4 Serial Terminal

Not sure how to use a terminal application? Try one of these tutorials: Tera Term Tutorial, PuTTY Tutorial.

3. Build, Run

3.1 Explore the MCUXpresso SDK Example Code

The MCUXpresso SDK comes with a long list of example applications code. To see what's available, browse to the SDK boards folder of your SDK installation and select LPCXpresso51U68.

<sdk_install_directory>/boards/LPCXpresso51U68</sdk_install_directory>

To learn more about specific example code, open the readme.txt file in an example’s directory.

3.2 Build, Run

If one or more of the demo application or driver examples sounds interesting, you're probably wanting to know how you can build and debug yourself. The Getting Started with SDK for LPC51U68 guide provides easy, step-by-step instructions on how to configure, build, and debug demos for all toolchains supported by the SDK.

Use the guide below to learn how to open, build and debug an example application using the MCUXpresso IDE.

Using a different toolchain?

4. Create

4.1 Get SDK Project Generator

Let's create our own project and make a simple SDK-based application. NXP provides an intuitive, simple project generation utility that allows creation of custom projects based on the Kinetis SDK.

Get Project Generator

4.2 Run the SDK Project Generator

After extracting the ZIP file, open the utility by clicking on the KSDK_Project_Generator executable for your computer's operating system. Point the tool to your SDK installation path, name your project, and select the board that it uses as a reference. Click on the Quick Generate button to finish.

KSDK-PROJECT-GENERATOR

4.3 Open Your Project

Your new project will be located in.

<sdk_install_directory>/examples/frdmk64/user_apps</sdk_install_directory>

Open the project in your toolchain of choice by using the same process described in section 3.2.

4.4 Write Some Code

Now, let's make our new project do something other than spin in an infinite loop. The SDK examples provide a board support package (BSP) to do various things specific to the board, including macros and definitions for items such as LEDs, switches and peripheral instances. To keep things simple, lets make the LED blink using the BSP macros.

Update the main() function in your project's main.c file with the following code:

volatile int delay;
// Configure board specific pin muxing
BOARD_InitPins();

// Configure clock source
BOARD_BootClockRUN();

// Initialize the UART terminal
BOARD_InitDebugConsole();

PRINTF("\r\nRunning the myProject project.\n");

// Enable GPIO port for the red LED
CLOCK_EnableClock(kCLOCK_PortE);
PORT_SetPinMux(BOARD_LED_RED_GPIO_PORT, BOARD_LED_RED_GPIO_PIN, kPORT_MuxAsGpio);
LED_RED_INIT(LOGIC_LED_OFF);
for (;;){
  LED_RED_TOGGLE();
  delay = 5000000;
  while(delay--);
}

4.5 Build, Download, Run

With the changes made to your main() function, build your application. Once the build is complete, download the application to your board.

If you need help figuring out how to build, download or run an application, reference your tool-specific guide from section 3.2.

4.6 Success

With the application downloaded, you will see the FRDM-KE15Z's red LED blinking. You can also view terminal output using PRINTF.

Running a Demo Using Kinetis Design Studio IDE

Install KDS Updates

Before using KDS IDE with KSDK, it is recommended that you make sure that your tools are up-to-date. The steps discussed below are shown using the Windows version of KDS, but are identical for Mac and Linux users.

  1. Select "Help" → "Check for Updates".

    GS-FRDM-K64F-KDS-IMG1
  2. Install all updates from Freescale/NXP – these are denoted by “com.NXP.xxx” or “com.nxp.xxx”. There may also be updates for things such as toolchain or debug interfaces. While these additional updates are typically OK to install, sometimes they may cause issues since they aren’t released as part of the KDS toolchain.

Build an Example Application

The following steps will guide you through opening the hello_world application. These steps may change slightly for other example applications as some of these applications may have additional layers of folders in their path.

  1. Select File → Import from the KDS IDE menu. In the window that appears, expand the "Project of Projects" folder and select "Existing Project Sets". Then, click the "Next" button.

    GS-FRDM-K64F-KDS-IMG7
  2. Click the "Browse" button next to the "Import from file:" option.

    GS-FRDM-K64F-KDS-IMG8
  3. Point to the example application project, which can be found using this path:

    <install_dir >/boards/<board_name >/<example_type>/<application_name>/kds</application_name></example_type></board_name ></install_dir >

    For this guide, choose the specific location:

    <install_dir>/boards/frdmke15z/demo_apps/hello_world/kds</install_dir>
  4. After pointing to the correct directory, your "Import Working Sets and Projects" window should look like the figure below. Click the "Finish" button.

    GS-FRDM-K64F-KDS-IMG9
  5. There are two project configurations (build targets) supported for each KSDK project:

    • Debug – Compiler optimization is set to low, and debug information is generated for the executable. This target should be selected for development and debug.
    • Release – Compiler optimization is set to high, and debug information is not generated. This target should be selected for final application deployment.
  6. Choose the appropriate build target, "Debug" or "Release", by clicking the downward facing arrow next to the hammer icon, as shown below. For this example, select the "Debug" target.

    GS-FRDM-K64F-KDS-IMG10
  7. The library starts building after the build target is selected. To rebuild the library in the future, click the hammer icon (assuming the same build target is chosen).

Run an Example Application

The FRDM-KE15Z board comes loaded with the mbed/CMSIS-DAP debug interface from the factory. If you have changed the debug OpenSDA application on your board, visit OpenSDA for information on updating or restoring your board to the factory state.

  1. Connect the development platform to your PC via USB cable between the "SDAUSB" USB port on the board and the PC USB connector.

  2. Open the terminal application on the PC (such as PuTTY or TeraTerm) and connect to the debug COM port you determined earlier. Configure the terminal with these settings:

    • 15200 baud rate
    • No parity
    • 8 data bits
    • 1 stop bit
  3. For Linux OS users only, run the following commands in your terminal. These install libudev onto your system, which is required by KDS IDE to launch the debugger.

    user@ubuntu:~$ sudo apt-get install libudev-dev libudev1
    user@ubuntu:~$ sudo ln –s /usr/lib/x86_64-linux-gnu/libudev.so /usr/lib/x86_64-linux-gnu/libudev.so.0
  4. Ensure that the debugger configuration is correct for the target you're attempting to connect to. This refers to the OpenSDA interface of your board. If you’re unsure what your board has, please consult Appendix B of the PDF linked in the top right hand corner of this dialog.

    • To check the available debugger configurations, click the small downward arrow next to the green "Debug" button and select "Debug Configurations".

      GS-FRDM-K64F-KDS-IMG11
    • In the Debug Configurations dialog box, select debug configuration that corresponds to the hardware platform you’re using. For Windows or Linux users, select is the mbed/CMSIS-DAP option under OpenOCD For Mac users, select J-Link.

      After selecting the debugger interface, click the "Debug" button to launch the debugger.

      GS-FRDM-K64F-KDS-IMG12
  5. The application is downloaded to the target and automatically run to main():

    GS-FRDM-K64F-KDS-IMG13
  6. Start the application by clicking the "Resume" button:

    GS-FRDM-K64F-KDS-IMG14
  7. The hello_world application is now running and a banner is displayed on the terminal. If this is not the case, check your terminal settings and connections.

    GS-FRDM-K64F-KDS-IMG15

Tera Term Tutorial

Tera Term Tutorial

Tera Term is a very popular open source terminal emulation application. This program can be used to display information sent from your NXP development platform's virtual serial port.

  1. Download Tera Term from SourceForge. After the download, run the installer and then return to this webpage to continue.
  2. Download

  3. Launch Tera Term. The first time it launches, it will show you the following dialog. Select the serial option. Assuming your board is plugged in, there should be a COM port automatically populated in the list.
  4. Tera-Term-Connection-MCUXPRESSO
  5. Configure the serial port settings (using the COM port number identified earlier) to 115200 baud rate, 8 data bits, no parity and 1 stop bit. To do this, go to Setup → Serial Port and change the settings.
  6. Verify that the connection is open. If connected, Tera Term will show something like below in it's title bar.
  7. Tera-Term-Console
  8. You're ready to go

PuTTY Tutorial

PuTTY Tutorial

PuTTY is a popular terminal emulation application. This program can be used to display information sent from your NXP development platform's virtual serial port.

  1. Download PuTTY using the button below. After the download, run the installer and then return to this webpage to continue.
  2. Download

  3. Launch PuTTY by either double clicking on the *.exe file you downloaded or from the Start menu, depending on the type of download you selected.
  4. Configure In the window that launches, select the Serial radio button and enter the COM port number that you determined earlier. Also enter the baud rate, in this case 115200.
  5. PUTTY-Configuration
  6. Click Open to open the serial connection. Assuming the board is connected and you entered the correct COM port, the terminal window will open. If the configuration is not correct, PuTTY will alert you.
  7. You're ready to go

Support

Troubleshooting

Demo not working?

Did your board come in a box that looks like this?

FRDM BOX

No problem! Your board simply came in the old packaging and has a different out-of-box demo loaded into the flash memory.

You should be seeing the RGB LED toggling between each of the three colors; red, blue and green. It's OK to move onto the next step when you're ready.

Still not working?

Try proceeding to the next steps to get other example applications running on your board. If you still have problems, try contacting us through the NXP Community.