Author Topic: LPC1114 28DIP tutorials?  (Read 10737 times)

0 Members and 1 Guest are viewing this topic.

Offline sirus20x6Topic starter

  • Contributor
  • Posts: 11
LPC1114 28DIP tutorials?
« on: September 23, 2012, 03:48:00 am »
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
 

Offline phil_jp1

  • Regular Contributor
  • *
  • Posts: 103
  • Country: ua
Re: LPC1114 28DIP tutorials?
« Reply #1 on: September 23, 2012, 10:45:09 am »
A day - it's not much. Keep looking.
http://JumperOne.com - Electronic projects, tutorials, hacks, etc.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27665
  • Country: nl
    • NCT Developments
Re: LPC1114 28DIP tutorials?
« Reply #2 on: September 23, 2012, 11:26:12 am »
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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: LPC1114 28DIP tutorials?
« Reply #3 on: September 23, 2012, 12:18:30 pm »
Have you looked around on NXP's LPCware site? Your toolchain may also come with example projects.

Offline sirus20x6Topic starter

  • Contributor
  • Posts: 11
Re: LPC1114 28DIP tutorials?
« Reply #4 on: September 23, 2012, 06:20:09 pm »
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.
 

Offline sirus20x6Topic starter

  • Contributor
  • Posts: 11
Re: LPC1114 28DIP tutorials?
« Reply #5 on: September 24, 2012, 06:02:33 pm »
 

Offline sirus20x6Topic starter

  • Contributor
  • Posts: 11
Re: LPC1114 28DIP tutorials?
« Reply #6 on: September 25, 2012, 01:03:26 am »
here is a little more http://www.microbuilder.eu/projects/LPC1114ReferenceDesign/FlashMagic.aspx although 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
 

Offline sirus20x6Topic starter

  • Contributor
  • Posts: 11
Re: LPC1114 28DIP tutorials?
« Reply #7 on: September 25, 2012, 02:55:45 am »
got it! had a gob of solder flux still on
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: LPC1114 28DIP tutorials?
« Reply #8 on: September 26, 2012, 01:21:09 am »
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 accurate
Code: [Select]
#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 GPIO

  LPC_GPIO1->DIR |= (0x01 << 7);  // PORT 1 pin 7 set to output

  while( 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);
    }
  }
}
« Last Edit: September 26, 2012, 11:32:50 am by TheDirty »
Mark Higgins
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: LPC1114 28DIP tutorials?
« Reply #9 on: September 26, 2012, 08:06:07 am »
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.

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27665
  • Country: nl
    • NCT Developments
Re: LPC1114 28DIP tutorials?
« Reply #10 on: September 26, 2012, 06:59:09 pm »
NXP's datasheets for M0 and M3 devices contains many pages on the core. I doubt a book will give you more details.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: LPC1114 28DIP tutorials?
« Reply #11 on: September 26, 2012, 08:27:39 pm »
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.

Offline sirus20x6Topic starter

  • Contributor
  • Posts: 11
Re: LPC1114 28DIP tutorials?
« Reply #12 on: September 26, 2012, 10:02:23 pm »
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 accurate
Code: [Select]
#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 GPIO

  LPC_GPIO1->DIR |= (0x01 << 7);  // PORT 1 pin 7 set to output

  while( 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);
    }
  }
}

I'm using the linaro bare to metal that was linked to in one of the tutorials I found http://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.

 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: LPC1114 28DIP tutorials?
« Reply #13 on: September 26, 2012, 10:38:48 pm »
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
Mark Higgins
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27665
  • Country: nl
    • NCT Developments
Re: LPC1114 28DIP tutorials?
« Reply #14 on: September 26, 2012, 11:13:27 pm »
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.
Why 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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: LPC1114 28DIP tutorials?
« Reply #15 on: September 26, 2012, 11:26:23 pm »
Why 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.
I 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.

Offline T4P

  • Super Contributor
  • ***
  • Posts: 3697
  • Country: sg
    • T4P
Re: LPC1114 28DIP tutorials?
« Reply #16 on: September 27, 2012, 04:34:06 am »
ARM Cortex was designed to run in C being a modern core not the instruction set!
This is not some 20 year old architecture
 

Offline andersm

  • Super Contributor
  • ***
  • Posts: 1198
  • Country: fi
Re: LPC1114 28DIP tutorials?
« Reply #17 on: September 27, 2012, 09:19:41 am »
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.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf