LPC1114 28DIP tutorials? - Page 1
Forum section: electronics / general

author: sirus20x6
author_rank: Contributor
timestamp: September 23, 2012, 03:48:00 am
content: Looking to learn how to initialize the chip, blink an led, read an sd card and such. feel like I've wasted the whole day trying to find good code tutorials for this cortex M0

author: phil_jp1
author_rank: Regular Contributor
timestamp: September 23, 2012, 10:45:09 am
content: A day - it's not much. Keep looking.

author: nctnico
author_rank: Super Contributor
timestamp: September 23, 2012, 11:26:12 am
content: You can use about any LPC1000 Cortex-M0 tutorial. When it comes to initialising the PLL and so they are all the same. With regards to the peripherals you can also use LPC2000 tutorials because most peripherals are identical or at least backwards compatible. The only major difference between the LPC1000 and LPC2000 series is that most peripherals are switched off by default in the LPC1000. So there really is tons of information out there.

author: andersm
author_rank: Super Contributor
timestamp: September 23, 2012, 12:18:30 pm
content: Have you looked around on NXP'sLPCwaresite? Your toolchain may also come with example projects.

author: sirus20x6
author_rank: Contributor
timestamp: September 23, 2012, 06:20:09 pm
content: yeah i've found some lpc1111 code that I've been looking through but not a proper tutorial on starting with cortex m0 / lpc1000 series.

author: sirus20x6
author_rank: Contributor
timestamp: September 24, 2012, 06:02:33 pm
content: oh found something good!http://www.meatandnetworking.com/tutorials/lpc1114fn28-with-open-source-tools/

author: sirus20x6
author_rank: Contributor
timestamp: September 25, 2012, 01:03:26 am
content: here is a little morehttp://www.microbuilder.eu/projects/LPC1114ReferenceDesign/FlashMagic.aspxalthough he selects 301 and my chips say 102 so I'm not sure which is correct. so far i have been unable to get the chip to respond to anything

author: sirus20x6
author_rank: Contributor
timestamp: September 25, 2012, 02:55:45 am
content: got it! had a gob of solder flux still on

author: TheDirty
author_rank: Frequent Contributor
timestamp: September 26, 2012, 01:21:09 am
content: What compiler are you using? I've used the LPC11xx a good amount. C code is interchangeable with LPC13xx devices as well. If you want some sample code for something, let me know. I use Crossworks, which is just a GCC front end. SystemInit() is from CMSIS, which is available from NXP.Here's a simple blinky program. The delays are not accurateCode:#include "LPC11xx.h" /* LPC11xx definitions */void delay_us( int);void delay_ms( int);void main( void){volatile unsigned int x, y;SystemInit();LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 6); //Enable AHB clock for GPIOLPC_GPIO1->DIR |= (0x01 << 7); // PORT 1 pin 7 set to outputwhile( 1){delay_ms( 100);LPC_GPIO1->DATA |= (0x01 << 7);delay_ms( 100);LPC_GPIO1->DATA &= ~((0x01 << 7));}}void delay_us(int delay){while(delay--){__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");__asm volatile (" NOP");}}void delay_ms(int delay){char i;while(delay--){for(i=0; i<4; i++){delay_us(250);}}}

author: andersm
author_rank: Super Contributor
timestamp: September 26, 2012, 08:06:07 am
content: If you like books, Joseph Yiu's The Definitive Guide to the ARM Cortex-M0 may be worth a look. His Cortex-M3 is a pretty good, and I assume the M0 version very similar. Obviously it only covers the core and not any specific chip or non-core peripherals, but you get that info from the datasheets.

author: nctnico
author_rank: Super Contributor
timestamp: September 26, 2012, 06:59:09 pm
content: NXP's datasheets for M0 and M3 devices contains many pages on the core. I doubt a book will give you more details.

author: andersm
author_rank: Super Contributor
timestamp: September 26, 2012, 08:27:39 pm
content: The NXP user manuals I've looked at refer to ARM's manuals for the cores beyond basic register lists, and don't cover things like the instruction sets at all. Given that the OP was specifically asking for tutorial style material, those books will be a much easier read than the architecture reference manuals.

author: sirus20x6
author_rank: Contributor
timestamp: September 26, 2012, 10:02:23 pm
content: Quote from: TheDirty on September 26, 2012, 01:21:09 amI'm using the linaro bare to metal that was linked to in one of the tutorials I foundhttp://www.meatandnetworking.com/tutorials/arm-cortex-mx-quickstart/thanks for the code. the one in the metandnetworking tutorial is quite a bit different. next up I'm looking for some sd card stuff. I found chan's fat fs and chan's petite fs.

author: TheDirty
author_rank: Frequent Contributor
timestamp: September 26, 2012, 10:38:48 pm
content: You might also find NXP's sample code bundle helpful as well. It's for Keil, but it gives decent peripheral libraries. They hide it on the NXP site.http://ics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc11xx.keil.zip

author: nctnico
author_rank: Super Contributor
timestamp: September 26, 2012, 11:13:27 pm
content: Quote from: andersm on September 26, 2012, 08:27:39 pmWhy would you be interested in the instruction set? The Cortex Mx devices can be brought up & running entirely from C. Not a single line of assembly is needed.

author: andersm
author_rank: Super Contributor
timestamp: September 26, 2012, 11:26:23 pm
content: Quote from: nctnico on September 26, 2012, 11:13:27 pmI think familiarizing yourself with the instruction set is an integral part of learning a new architecture. You learn what it's good at, what it's poor at, if it has any features that can't easily be expressed in C and so on. Not to mention it makes debugging a whole lot easier.

author: T4P
author_rank: Super Contributor
timestamp: September 27, 2012, 04:34:06 am
content: ARM Cortex was designed to run in C being a modern core not the instruction set!This is not some 20 year old architecture

author: andersm
author_rank: Super Contributor
timestamp: September 27, 2012, 09:19:41 am
content: If you're eg. writing a multitasking kernel you will still need assembly language, and some kinds of bit twiddling are much more cumbersome to do in C. Regardless, there's a difference between being told a core is "designed for C" (which practically every new core has claimed since at least the 90s, usually with some huge caveats), and verifying it yourself.