LPC11U68 – external device (e.g. LED)

Using on board LED is all nice and dandy, but to really communicate with the world we need to connect something from the “real” world to the board.

The simplest idea is of course – LED

Yes, I know … again? Well, at least we’ll get visual easily. Right?

So let’s try:

I’ll use the pins presented as Arduino compatible pins – not that we’ll be coding in Arduino environment. Just to easier name them (pins, that is). Let’s use 10k resistor and LED and connect everything as on the schema.

You can use +5V and GND pins from the board and connect J1 to the pin 5 on the Arduino digital connector. If you check board schema of the board check J1 under Digital. Pin 5 is 13 SCK or PIO1_29-SSP0_SCK.

Screen Shot 2014-09-22 at 11.04.20

 

And the code to use (mind you I really didn’t put much effort to it – just to get blinking LED) is:

#include "chip.h"

int main(void) {
    int j = 0 ;
    int i = 0 ;
    Chip_IOCON_PinMuxSet(LPC_IOCON, 1, 29, (IOCON_MODE_PULLUP |  IOCON_DIGMODE_EN));
    Chip_GPIO_SetPinDIROutput(LPC_GPIO, 1, 29);
    // Enter an infinite loop, just incrementing a counter
    while(1) {
        j = 0;
        while (j < 65000) {
            i = 0;
        	while (i < 100) {
        		i++;
        	}
        	j++;
        }
        Chip_GPIO_SetPinState(LPC_GPIO, 1, 29, false);
        j = 0;
        while (j < 65000) {
        	i = 0;
        	while (i < 100) {
        		i++;
        	}
        	j++;
        }
        Chip_GPIO_SetPinState(LPC_GPIO, 1, 29, true);
    }
    return 0 ;
}

As you can see from the code we are using external pull-up resistor.

LPC16U68 – the start

After installing LPCXpresso I wasn’t sure how to compile anything, how to use or program the board, so it took me some time to light the 3 colour LED on the board (RGB). After checking the schema I found out you can get the LEDs to light up when addressing pins.

The RGB LED is connected to port 2 and the colours are: pin 16 – green, pin 17 – red and pin 18 – blue.

So, you have to connect the cable from USB port on the PC to port Link. After that type in (or copy) the following code:

#include "chip.h"

int main(void) {

// Force the counter to be placed into memory

volatile static int i = 0 ;

Chip_IOCON_PinMuxSet(LPC_IOCON, 2, 18, IOCON_FUNC7); // can be anything from IOCON_FUNC1 to IOCON_FUNC7

// Enter an infinite loop, just incrementing a counter

while(1) {

i++ ;

}

return 0 ;

}

And build the code by using Build ‘<project name>’ [Debug] in Quick menu. Pay attention to the name of the project. It should be the one you used for the code.

If everything is ok you will get the axf file in Binary sub directory. After that click on the icon ‘Program Flash’ Screen Shot 2014-09-22 at 11.56.57 and if everything goes well you will see the blue LED light up.

LPC16U68 dev board

After testing the old LPC2013 I thought – why not go back to ARM platform and try some new things in NXP space. Went to their web page and searched for the nice example to use as my new development platform.

One of the things was also using the platform available on the Mac OSX and it looked like LPCXPRESSO was the thing to use.

So what is the available hardware to use? I hate dev boards with too much hardware (e.g. LCD, wifi …) – they are expensive and I more or less already have  those at home. So the LPC11U68 showed as a nice little platform to use and the price was not that steep.

Immediately contacted our local SILICA shop since people there are really nice and thing can get available pretty quickly (at least budget wise). Anyway after few emails and phone calls they promised to send me the dev board for free and gave me a link to wifi/Bluetooth module to use.

The LPCXPRESSO dev board is in the house and I have managed to send code to the board via USB port and LpcXpresso dev environment.

Will be posting my findings in following posts.