Huge error in NXP's team example

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

Huge error in NXP's team example

117 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by fjrg76 on Thu Nov 22 14:19:40 MST 2012
While trying to use this small driver for LPC1227 GPIOs:

[B]small_gpio.h[/B]

#ifndef SMALLGPIO_H_INCLUDED
#define SMALLGPIO_H_INCLUDED

#include "lpc122x.h"

// InitGPIO() turns on the GPIO and IOCON clocks
#define InitGPIO() LPC_SYSCON->SYSAHBCLKCTRL |= ((1<<6) | (1<<16))

#define PORT_BIT_COUNT 12 // up to 12 I/O lines per port
#define PORT_COUNT 4 // up to 4 ports

...


I found these mistakes:

#define InitGPIO() LPC_SYSCON->SYSAHBCLKCTRL |= ((1<<6) | (1<<16))


(1<<6) turns on the CRC module
(1<<16) turns on the IOCON module

#define PORT_BIT_COUNT 12 // up to 12 I/O lines per port


Port 0 is up to 32 I/O lines

#define PORT_COUNT 4 // up to 4 ports


LPC1227 has only 3 ports


What a nightmare for the newbies :mad:


What's wrong with those guys at NXP!!??
0 Kudos
0 Replies