Over the last couple of years, I’ve utilized a few different Arduino, Raspberry Pi, and other Linux based hobbyist development boards, like the BeagleBone Black, for many of my projects. I, however, never used other microcontroller boards that weren’t Arduino compatible. Recently, I started experimenting with the Okdo E1, a development board that’s powered by the LPC55S69, a very capable NXP microcontroller.
So I found myself in the situation of being a complete beginner again, and while there was some material out there that discusses the absolute basics, most of it was still quite technical and was clearly aimed at professionals. Therefore, I decided to write a gentler (and more top-level) introduction that explains how you can get started with using the LPC55S69 GPIO pins.
Creating a new project in MCUXpresso
Make sure to download and install the MCUXpresso IDE if you haven’t done that already. Before you proceed any further, make sure that you read through the official getting started guide and that you can execute the hello world project.
Then, create a new C/C++ project in MCUXpresso:

Make sure to select the correct entry in the pop-up window:

On the next page, make sure to select the lpcxpresso55s69 SDK and click the ‘next’ button:

Enter a name for your project on the next page, check whether the gpio driver is imported (which it should be by default), and click ‘finish’ once you’re done:

After a short while, the new project should open up automatically, and you should see something similar to this:

Configuring the system clock
Next, you’ll have to configure the system clock (as demonstrated in the getting started guide). Because the process is explained in great detail in the aforementioned guide, I’ll only show you the end result of that step:

Using the pins tool to configure the GPIO pins
Once you’ve configured the project and the clock, make sure to upload the code to the microcontroller and see whether everything goes as planned. Once the upload’s done, you should see that ‘Hello World’ got printed to the serial monitor of the IDE.
Now, stop the debugging process, and open up the ‘Pins’ tool in MCUXpresso:

The tool should bring up the following perspective within the IDE:

Next, you should think about what GPIO pin you’d like to use:

In this tutorial, I’ll be using PIO0_15 (Pin #4 on the left-hand side of the PCB). In the pins tool, use the search bar in the left panel to find that pin. Once you found it, click the gray box next to the pin’s number:

When you click that small gray box, a pop-up window will appear where you can select the function(s) that this pin should have. In this case, choose GPIO:

Once you’re done, click the ‘Update Code’ button and switch back to the Code-Editor perspective.
Writing values to and reading values from the GPIO pins
Once you routed the GPIO pins that you’d like to control, get back to the main code file and add the following lines for every GPIO pin you want to use to output values:
gpio_pin_config_t PIO0_15_config =
{
kGPIO_DigitalOutput, // Mode
0 // Initial State
};
int main(void)
{
BOARD_InitPins();
/* Other initialization calls */
GPIO_PinInit(GPIO, 0, 15, &PIO0_15_config);
/* Rest of the main method */
}
Above the main, I added a small configuration for the GPIO pin in question. It states that the pin will be used as an output and that its initial state will be LOW. In the main method itself, the pin is initialized. These steps are only necessary if you want to output something. GPIO pins that you’ll use as input pins don’t have to be initialized this way.
To read a pin’s state use the following function:
// Read the current state of pin PIO0_15
bool value = GPIO_PinRead(GPIO, 0, 15);
To set a pin HIGH or LOW, use the following function:
GPIO_PinWrite(GPIO, 0, 15, 1U); // Set pin HIGH
GPIO_PinWrite(GPIO, 0, 15, 0U); // Set pin LOW
Note that output pins must be initialised as described above before you can use them!
You can take a look at the official API page for further details and examples.
Summary
Maybe it’s just me, but being a maker and coming from a Raspberry Pi and Arduino background with little to no experience in embedded systems, I found it quite confusing to get started with the LPC5500. I couldn’t find a tutorial that talked about these simple beginner’s topics. That’s why I decided to quickly put one together. Once you get the hang of it, the process is pretty straight-forward and easy to remember.
Sources
MCUXpresso API – mcuxpresso.nxp.com
Okdo E1 getting started guide – okdo.com
Getting started with the LPC5500 series – allaboutcircuits.com
First experience with Okdo E1 board – mcuoneclipse.com
Image sources
[Title image] Original image courtesy of allaboutcircuits.com
[Figure 7] Okdo E1 pinout diagram – okdo.com
Table of content
How to use the GPIO pins of the LPC55S69 (You are here)
How to use interrupts on the LPC55S69

One thought on “How to use the GPIO pins on the LPC55S69 powered Okdo E1”