I have a custom board with device LPC1768. While every other functionalities (such as LCD on SPI, Ethernet, I2C EEPROM, etc.) are OK, for some reason, while I can turn ON and OFF LEDs on the GPIO2 but I can't do the same for the pins on the GPIO1. Maybe I shouldn't blame whole GPIO1 (or myself) but at least the part I try to use.
If I connect a button on one of the the GPIO1 pins (with internal pull-ups and as an OUTPUT) I can read the button inputs as it should be.
Here is the definition part as per the user manual;
#define FIO_BASE_ADDR (0x2009C000) #define FIO1CLR (*(volatile unsigned int *)(FIO_BASE_ADDR + 0x3C)) #define FIO2CLR (*(volatile unsigned int *)(FIO_BASE_ADDR + 0x5C)) #define FIO1SET (*(volatile unsigned int *)(FIO_BASE_ADDR + 0x38)) #define FIO2SET (*(volatile unsigned int *)(FIO_BASE_ADDR + 0x58))
While a LED on the pin P2.5 turns ON and OFF as it should be;
FIO2SET = (1uL << 5); // P2.5 FIO2CLR = (1uL << 5); // P2.5
A LED on P1.18 doesn't turn ON;
FIO1SET = (1uL << 18); // P1.18
In order to test all the LEDs connected to the GPIO1 pins, I wrote two lines of code using
LPC17xx.h and then proofed that it works, all the LEDs are turning ON and OFF accordingly.
LPC_GPIO1->FIOSET = 0xffffffff; LPC_GPIO1->FIOCLR = 0xffffffff;
Any input highly appreciated.
User contributions licensed under CC BY-SA 3.0