Hard time getting started with the LPCXpresso Experiment Kit

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Hard time getting started with the LPCXpresso Experiment Kit

347 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by markfink on Sun Feb 09 03:00:19 MST 2014
I am on a Ubuntu laptop and I am using gcc and plain text editors. I hope somebody on this forum has similar preferences and helps me getting started.

I bought the LPCXpresso Experiment Kit because I thought this would be an easy way to get started...

* the first obstacle is that LPCXpresso Experiment Kit framework + solutions are targeted to LPC11xx (archives include Lib_CMSISv1p30_LPC11xx). I downloaded and compiled Lib_CMSISv1p30_LPC17xx
* obviously the Lab1a solution main.c is not compatible with the LPC17xx version:

arm-none-eabi-gcc -c -Os -I. -Wall -mthumb -ffunction-sections -fdata-sections -fmessage-length=0 -mcpu=cortex-m3 -DTARGET=LPC17xx -fno-builtin -I../distr/inc -D__USE_CMSIS  -o main.o main.c 
main.c: In function 'main':
main.c:13:33: error: 'LPC_GPIO_TypeDef' has no member named 'DIR'
 #define DIR_REG_LED1   LPC_GPIO0->DIR
main.c:23:3: note: in expansion of macro 'DIR_REG_LED1'
   DIR_REG_LED1 |= (0x1<<PIO_PIN_LED1);
main.c:14:33: error: 'LPC_GPIO_TypeDef' has no member named 'DATA'
 #define DATA_REG_LED1  LPC_GPIO0->DATA
main.c:16:24: note: in expansion of macro 'DATA_REG_LED1'
 #define LED1_ON        DATA_REG_LED1 &= ~(1<<PIO_PIN_LED1)
main.c:26:3: note: in expansion of macro 'LED1_ON'
   LED1_ON;


here is the main.c for Lab1a (does anybody have a version working with LPC1769?):
#include "LPC17xx.h"

// Create defines for simpler access of LED1
#define DIR_REG_LED1   LPC_GPIO0->DIR
#define DATA_REG_LED1  LPC_GPIO0->DATA
#define PIO_PIN_LED1   2
#define LED1_ON        DATA_REG_LED1 &= ~(1<<PIO_PIN_LED1)
#define LED1_OFF       DATA_REG_LED1 |= (1<<PIO_PIN_LED1)

int main (void)
{
  // Set PIO0_2 as an output
  DIR_REG_LED1 |= (0x1<<PIO_PIN_LED1);

  // Turn LED1 on
  LED1_ON;

  while(1)
;

  return 0;
}


* once the sample will compile I still need linkscript.ld + memory.ld
* and then I need to put the fimware.bin on the target though LPC-Link (I have no clue how to do that on Linux)
  I have found about 20 different blogs on how to do that (some use cp, dd, mtools, lpc21isp, pyserial)
Labels (1)
0 Kudos
3 Replies

288 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MarcVonWindscooting on Mon Feb 10 20:28:24 MST 2014

Quote: markfink
I am on a Ubuntu laptop and I am using gcc and plain text editors. I hope somebody on this forum has similar preferences and helps me getting started.

I bought the LPCXpresso Experiment Kit because I thought this would be an easy way to get started...

* and then I need to put the fimware.bin on the target though LPC-Link (I have no clue how to do that on Linux)
  I have found about 20 different blogs on how to do that (some use cp, dd, mtools, lpc21isp, pyserial)


Welcome Mark!

Yes there are people with the same preferences ;-)

The families LPC11xx and LPC17xx are quite different. Core: Cortex-M0 versus Cortex-M3 (different instruction set!). Peripherals: LPC1100 more low power capabilities, LPC17xx more powerful peripherals. Some peripherals are similar, for example UART, but still they have different peripheral base addresses. Mapping of functionality to pins is different. And so on.

Recently, I tried to find out, if I can just buy a LPCXpresso board to use with Linux and all-free tool but I haven't come up with a positive answer so far. My impression is: the answer is no! But I can't tell for sure. I simply didn't order one.
I don't know, if the LPCXpresso boards provide a serial port emulation. Serial port emulation is what lpc21isp, pyserial, and probably others rely on. Because the LPC's have that serial ISP boot loader. Accessing via JTAG is a different thing and to my understanding, this is, what the LPCXpresso board does: providing FLASH programming and a debugger interface. I used Olimex boards for a long time or an 'mbed'. However, since the company I'm working at produces a small motor driver unit with ethernet & serial port and a zillion other goodies I resort to these boards. And yet another model is coming up soon, that adds considerable power capabilities to the motor driver (2 motors x 3 phases, 35V, 2A/phase). Will be ready until March. Can't wait for it.
A propos serial ISP boot loader...give the program mxli (www.windscooting.com/softy/mxli.html) a try and forget about the other lame options  :bigsmile:

I don't use 'professional' libraries, because the guys of NXP provide these excellent manuals. And the libraries we build ourselves are the best of course. And yes, I'd like to share my library. If you look at mxli source code, you'll see a big part of it (the c-any/ subdirectory).

Where are you from? Keep me posted about your progress with your board. Maybe I can lend you my Olimex LPC1766, if you like?
0 Kudos

288 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Mon Feb 10 15:34:33 MST 2014
if you have the 1769, programming works with the LPC17xx scheme, take examples from this directory. Lib_CMSISv1p30_LPC17xx is not actuel, take a newer one.

main.c:13:33: error: 'LPC_GPIO_TypeDef' has no member named 'DIR'
#define DIR_REG_LED1 LPC_GPIO0->DIR

If you look in lpc17xx.h you find the structur

typedef struct
{
  union {
    __IO uint32_t FIODIR;
    struct {
      __IO uint16_t FIODIRL;
      __IO uint16_t FIODIRH;
    };
    struct {
      __IO uint8_t  FIODIR0;
      __IO uint8_t  FIODIR1;
...
} LPC_GPIO_TypeDef;

the name of the member is FIODIR not DIR. Your example-code is not fitting to your library.

0 Kudos

288 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by leluno on Mon Feb 10 09:59:31 MST 2014
i think its easyer to look up the  for LED1 necassary  Register in the manual and than set them first without macros. You than can check your defines where something is missing.

PINSEL,PINMODE,PINMODE_OD,FIODIR und FIOSET.

for example LED at 3/25:
PINSEL7 | =((1+2)<<18);

PINSEL7 is a pointer to the Pin-select-register defined in  LPC176x.h. You need two bits for setting (1+2). it is position 19 and 18 (manual 8.5.6)

Sorry youd need function 0 for GPIO:
PINSEL7 & =~((1+2)<<18);
0 Kudos