NXP driver library GPIO port and pin naming conventions

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

NXP driver library GPIO port and pin naming conventions

488 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wlamers on Mon Apr 08 06:49:09 MST 2013

While wrinting the firmware for a LPC4357, without having the board yet, I face a naming convention issue.


The NXP driver library (latest from GIT), uses the function scu_pinmux (in LPC43xx_scu.c) to the the pin's function and mode. Let's, for example, say I want to set pin PD.9 to a GPIO output (LED):


#define LED1_PORT           0xd
#define LED1_BIT            9


scu_pinmux(LED1_PORT, ((uint32_t)1<<LED1_BIT), GPIO_PDN, FUNC4);


This should works. I have checked the according registers in the UM.


But when I want to use some of the GPIO functions (in lpc43xx_gpio.c) I have to switch to the GPIOn[m] naming conventions instead of the normal pin names (is seems at least). PD.9 = GPIO6[23]


GPIO_SetDir(LED1_PORT, ((uint32_t)1<<LED1_BIT), PIN_OUTPUT);  -> WRONG because it should be: GPIO_SetDir(6, ((uint32_t)1<<23), PIN_OUTPUT); now


Same for:


GPIO_SetValue(LED1_PORT, BITVAL(LED1_BIT));


etc.


While not being a really large problem.... This is quite confusing in my opninion. The root cause is the register layout in the uC itself. The SCU is using the pinnames while the GPIO 'controller' uses the GPIO names...


Can someone confirm the above?

Labels (1)
0 Kudos
1 Reply

416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amoehl on Tue Apr 09 19:28:43 MST 2013

Hello wlamers,


yes, it is a little bit confusing. You not alone with this. It is, because you have so many options. Another thing is, that
GPIO is sometimes FUNC0 or another FUNCx. Thats stupid, because i have to look into the datasheet for every pin.


Why the don't use FUNC0 for GPIO only?

0 Kudos