lpcware

Beginner: trying to learn and understand

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by mihaval on Sun Nov 04 14:18:05 MST 2012
Hi!

I'm a beginner in LPC world, having programmed microcontrollers only using higher-level languages. I have experience with Netduino (similar to Arduino) and have started learning LPC family of microcontrollers recently.

I have LPC1114 and a base board from Embedded Artists and so far, I'm working my way through examples and it is very interesting to read them and see different approaches on how to solve some basic issues.

I've gone through LPC1114 PDF and I can roughly understand most of the blinky code. I do understand the mechanics of blinky code, but I have a few specific questions regarding it:

1) where do clkconfig.c/.h, adc.c/.h, gpio.c/.h etc come from? I know I can copy/paste them to my projects, but it is better to understand where they come from, imho. Some come from CMSIS library from NXP support site, others from???? For instance, function GPIOSetDir from gpio.c/.h. Where does it come from?

2) Is there a published API, which is available which lists all of the functions like init_timer32 etc? I see it is defined in a file which has NXP's header (comment) and it is reasonably documented within the source code itself. Where does this file (i.e. timer32.h /.c) come from?

I also see that this code is functionally equivalent to this project: http://code.google.com/p/lpc1343codebase/

3) __WFI(); -- I suppose this means Wait For Interrupt and it is implemented as an assembly operation "wfi". I see that this is part of CMSIS library but I don't know where to find documentation about it

4) LPC1114/302, 303, etc. How do I know which LPC variation I have? I have bough LPCXpresso and  I don't see the variation number on the packaging. The vendor part number is OM11049.
Update: I found the mapping between part number and uC variation: it is in lpcxpresso.getting.started.pdf. Apparently, mine is /302.

5) Register descriptions (such as LPC_TMR32B0) can be found in LPC user manual under TMR32B0 for instance. Is there a documented mapping between TMR32B0MR0 register (in user manual) and LPC_TMR32B0->MR0 API?

6) In trying to understand the mechanics of timers etc, I created a new (semihosted) project where I'm trying to use a simple delay with timers. I've taken delay implementation from timer32.c and have initialized (enabled) timer using LPC_SYSCON->SYSAHBCLKCTRL |= (1<<9); The problem I seem to be having is that the timer is either not really enabled or something else is wrong, since there is no visible delay in the running program, even though there should be 1 second delay there.
Apparently, there is something missing. And even if I change the original blinky application to modify the code to use delay instead of interrupt, the delay function does not work. Code:

  while(1)
  {
  GPIOSetValue( LED_PORT, LED_BIT, LED_ON );
  delay32Ms(0, 1000);
  GPIOSetValue( LED_PORT, LED_BIT, LED_OFF );
  }


Kind regards,
Miha.

Outcomes