GPIO0 problems on LPC1758

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

GPIO0 problems on LPC1758

1,065 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raimond on Mon Mar 08 01:34:00 MST 2010
Hi,

I have a problem with pins P0.16, P0.22 which I use as chip selects for SSP0. It's very weird because they don't function as GPIO at all, at least not as outputs.

The last thing that I done was:

LPC_GPIO0->FIODIR2 = 0x41;
lcd_puts(hexByteToStr(LPC_GPIO0->FIODIR2));

The LCD printing is 0x00 !

So I can't set the pins as outputs!

The corresponding MASK is 0, the functions are 00 (GPIO), everything seems to be OK :confused:

I checked the errata sheet, no luck.

Any help would be appreciated,
thanks
0 Kudos
Reply
5 Replies

1,045 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raimond on Tue Mar 09 02:21:51 MST 2010
The mistery is resolved :)
The PCONP register has some reserved bits which I set to zero when enabling only my used peripherals. But this is wrong, because one of these bits I suppose turned off some GPIO functionality.

From the manual:
"Power saving oriented systems should have 1s in the PCONP register only in positions
that match peripherals really used in the application. All other bits, declared to be
"Reserved" or dedicated to the peripherals not used in the current application, must be
cleared to 0."

Well, it's not true. Now I turn on/off bits in the PCONP register only with |= &= operators, not touching the reserved bits. And it works!

Raimond
0 Kudos
Reply

1,045 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raimond on Mon Mar 08 22:54:50 MST 2010

Quote: IanMorris
Are you using the SPI or SSP interface? If so then my guess is that this interface is taking over the P0.16 pin and using it as an output (for chip select). I'm not sure if  it is possible to use P0.16 as a GPIO if you are using the SPI or SSP interface....



I'm not sure you're right, every pin has up two 4 functions, selected by 2 PINSEL bits, 00 being plain GPIO.

Anyway, even if it's true, the other pin, P0.22 is not tied to SSP0. And I don't use either UART1 or CAN1.

Raimond
0 Kudos
Reply

1,045 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanMorris on Mon Mar 08 15:08:26 MST 2010
Are you using the SPI or SSP interface? If so then my guess is that this interface is taking over the P0.16 pin and using it as an output (for chip select). I'm not sure if  it is possible to use P0.16 as a GPIO if you are using the SPI or SSP interface....
0 Kudos
Reply

1,045 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by raimond on Mon Mar 08 11:50:31 MST 2010
As I said, the pins are configured as GPIO (PINSEL bits are 00 = GPIO).
Anyway, this is the default after reset, but I double checked, displaying this info too on my LCD.

Anyway, it's weird because I write bits on the DIR register, but when I read the DIR back, the bits are zero... This have nothing to do with the PINSEL functions... Seems that the DIR bits are hard wired to zero...

Can this be a bug? :(

By the way, P0.16 is SSEL0, and it works ok if I set it with the SSEL0 function. But if I want to use it as GPIO... 

Raimond
0 Kudos
Reply

1,045 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jnd on Mon Mar 08 02:40:58 MST 2010
Make sure the PINSEL register is set to GPIO.


Quote:
The PINSEL1 register controls the functions of the upper half of Port 0. The direction
control bit in the FIO0DIR register is effective only when the GPIO function is selected for
a pin. For other functions the direction is controlled automatically.


UM, chapter 8
0 Kudos
Reply