GPIO port difference

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

GPIO port difference

788 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by korndoerfer on Tue May 06 05:20:12 MST 2014
Hi,
I am running the LPC-1115 with complex software after conversion coming from a P89V664 used for long time before.
A lot is running fine using LCD-Display, I2C, SSP, and a lot of GPIO-bits.
The problem is that identical LPC_GPIO on different ports are not working.
The port usage is:
Port 0: I2c, SWIO,  individual GPIO
Port 1: UART, PWM,  individual GPIO
Port 2: SSP, LCD-GPIO,  individual GPIO
Port 3: individual GPIO
The individual GPIO are working only on port 2.
For test I did use in sequence portNum and bitPosi:
GPIOSetDir (portNum, bitPos, 1);set out  for output
GPIOSetValue (portNum, bitPos, 0);set low
GPIOSetValue (portNum, bitPos, 1);set high

The test using ‘MASKED_ACCESS’ did nothing change.
Is there any masking function which I did not recognize?
Thank you for helping.
Labels (1)
0 Kudos
5 Replies

644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Thu May 22 02:46:53 MST 2014

Quote: korndoerfer
... no response.



Did you enable IOCON clock before?
LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);  //set IOCON clock


I'm not sure which toolchain we are talking about, doesn'n look like LPCOpen...

Anyway, debugger should be helpful to check IOCON bit in SYSAHBCLKCTRL 

This pins are nothing special at all...

Sample (LPCXpresso 7.2.0 LPCXpresso project  & gpio driver):

/*
===============================================================================
 Name        : LPC11_Test3.c
 Author      : $(author)
 Version     :
 Copyright   : $(copyright)
 Description : main definition
===============================================================================
*/

#ifdef __USE_CMSIS
#include "LPC11xx.h"
#endif

#include "cr_section_macros.h"
#include "gpio.h"

int main(void)
{
 volatile static int i =0 ;
 volatile unsigned char flag;
 LPC_SYSCON->SYSAHBCLKCTRL |= (1<<16);  //set IOCON clock
 LPC_IOCON->R_PIO1_1 |= 0x01; //set pin function to 1 = GPIO
 GPIOSetDir(1, 1, 1);//set GPIO out
 flag =0;
 GPIOSetValue (1, 1, 0);
 while(1)
 {
  i++;
  if(i>1E6) //simple loop
  {
   i=0; //reset counter
   if(flag)
   {
flag =0;
GPIOSetValue (1, 1, 0); //reset gpio
   }
   else
   {
flag =1;
GPIOSetValue (1, 1, 1); //set gpio
   }
  }
 }
 return 0 ;
}
0 Kudos

644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by korndoerfer on Wed May 21 22:45:54 MST 2014
Hi, I did read the Chapter 7 I  and there is also defined the Digital Function Mode with Standard GPIO output.
Using the  standard "GPIOSetValue (portNum, bitPos, 0);" on those ports - no response.
Scanning the manual for "R_PIO" does not explain how to set/reset those GPIO.
Best regards
0 Kudos

644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Wed May 21 02:32:28 MST 2014
Chapter 7 of UM10398 is describing IOCON registers  :)

Names like R_PIO1_1 are indicating that this pin has an important (and default) reserved function (in this case: JTAG).

Easiest way to check /change IOCON and GPIO registers is the debugger...

0 Kudos

644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by korndoerfer on Tue May 20 23:05:28 MST 2014
Sorry, but your answer did not fit to my test system with open pins on that questioned ports.
Randomly I found in LPC11xx.h
  __IO uint32_t R_PIO0_11;              /*!< Offset: 0x074 I/O configuration for pin TDI/PIO0_11/AD0/CT32B0_MAT3 (R/W) */
  __IO uint32_t R_PIO1_0;               /*!< Offset: 0x078 I/O configuration for pin TMS/PIO1_0/AD1/CT32B1_CAP0 (R/W) */
  __IO uint32_t R_PIO1_1;               /*!< Offset: 0x07C I/O configuration for pin TDO/PIO1_1/AD2/CT32B1_MAT0 (R/W) */

  __IO uint32_t R_PIO1_2;               /*!< Offset: 0x080 I/O configuration for pin nTRST/PIO1_2/AD3/CT32B1_MAT1 (R/W) */

Exactly those are the not working outputs.
I am not using any ADC or others, just the PIO’s.
Is there an example how to use it ?

Regards
0 Kudos

644 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by xianghuiwang on Fri May 16 11:04:31 MST 2014
Hi, Korndoerfer,

I would suggest checking your hardware see if your hardware has conditions that hold the other pins at a fixed state.
Good luck!
0 Kudos