This blog is in continuation to my earlier blog on out of box on OM13077OM13077 LPCXpresso board
Introduction to OM13077 Dual processor cores NXP LPCXpresso development board and demonstrating the existing project using LPCXpresso tool [Importing the example project and executing on NXP LPC54102 board]
Here I am creating new project for demonstrating GPIO button based on polling the input switch and glowing the user led. If button is pressed then blue led is turned on continuously and if released the led will turn off
The LPCXpresso54102 board includes the following features:
- Dual processor cores: ARM Cortex-M4 and ARM Cortex-M0+. The M0+ core runs at the same frequency as the M4 core. Both cores operate up to a maximum frequency of 100 MHz.
- On-board high-speed USB based debug probe with CMSIS-DAP and LPCXpresso IDE Redlink protocol options, can debug on-board LPC54102 or external target
- Support for external debug probes
- Tri-color LED
- Target Reset, ISP and WAKE buttons
- Expansion options based on Arduino UNO and Pmod, plus additional expansion port pins
- On-board 1.8/3.3V or external power supply options
- Built-in MCU power consumption and supply voltage measurement
- UART, I2C and SPI port bridging from LPC54102 target to usb via the on-board debug probe
- FTDI UART connector
The board contains the new LPC54102 ultra-low-power dual core ARM Cortex-M4F/M0+microcontroller targetted at always on-sensor processing applications that can run up to 100MHz each core.
The main idea is to use the cortex-M0+ core for sensor listening data collection and aggregation, and then wake up periodically the cortex-M4F to perform complex data processing tasks.
To proceed further the below are the prerequisites:
1. Installed LPCXpresso IDE tool chain or you can download it from below link:
https://www.lpcware.com/lpcxpresso/download
2. LPCOpen examples and libraries:
or
C:\nxp\LPCXpresso_8.1.4_606\lpcxpresso\Examples\LPCOpen
3. LPCXpresso 54102 development board hardware OM13077OM13077
Open LPCXpress and select the workspace as shown below:
Select on New project option under quick start panel as shown below:
Next select the LPC54100 family and select LPC5410x (M0+) > LPCOpen- C Project as shown below:
Next select the project name
“GPIO-polling”
Next select the device:
Now we need to select an LPCOpen Chip library project within the current workspace
As this is the new workspace we need to import the library into working directory
Now select the examples archive file to import.
Browse the LPCXpresso installed location
“C:\nxp\LPCXpresso_8.1.4_606\lpcxpresso\Examples\LPCOpen” and select the zip file “lpc5410x_lpcxpresso_54102_lpcxpresso_3.01a.zip” which is our target board
Then select “lpc_chip_5410x_m0” as chip library for cortex-M0+ core and
LPC board library as “lpc_board_lpcxpresso_54102_m0” as shown below:
Now you will be able to pop down the LPCOpen Libraries as shown below
Now repeat the same for LPCOpen Board Library as shown
CMSIS DSP Library Project Selection is optional so we proceed further by clicking Next
Next in Memory Configuration Editor select default flash driver
Next in printf option page let it be as default and click “finish”
Now our project folder looks as shown below:
It has Board library and Chip library included in the project as shown
Now we will start to perform our task i.e implement polling based button sensing, if button is pressed then LED-Blue is turned on and if we release the button then Blue led is turned off
The hardware switch connection of the board is as shown below:
And the LED part is connected as shown below:
i.e SW-1 connected to Port-0-24 pin
And Blue LED is connected to Port-0-31 port pin
LED’s are defined in the file ”board.c”
ledBits[] = {29, 30, 31};
i.e RED LED connected to Port-0-29 Green to Port-0-30 and Blue to Port-0-31
Below is our code written in GPIO-polling.c file
int main(void) { SystemCoreClockUpdate(); Board_Init(); Board_LED_Set(0, false); //red led turned off Board_LED_Set(1, false); //Green led turned off Board_LED_Set(2, false); //Blue led turned off Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 24); // TODO: insert code here while (1) { //__WFI(); if(Chip_GPIO_ReadPortBit(LPC_GPIO, 0, 24)== 0){ Board_LED_Set(2, true);// turn on led } else Board_LED_Set(2, false); // turn off } return 0 ; }
Save the file and click on build button as shown above
You can see our project builds successfully as shown below
At this point of time we have two options in executing the project either by going to Flashing the builded binary file or selecting the debug option and execute it.
- Flashing the program
Note: remember to build the project first this will generate GPIO-polling.axf file
Select the Flash button as shown below
Browse and select the project *.axf file to flash the board
“C:\Users\brao\Documents\LPCXpresso_8.1.4_606\New project\GPIO-polling\Debug”
Now the board is loaded with the binary and you can reset the board and check the working
The output execution of this demo is showed in below video
Happy creating new project on LPCXPresso using NXP LPC54102 Development board