GPIO Pin Interrupts on LPC4357 LPCOpen v2.xx

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

GPIO Pin Interrupts on LPC4357 LPCOpen v2.xx

2,401 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amorgan on Tue Oct 20 10:28:37 MST 2015
I have a question about the differences between chips and have not been able to find the answer. I am using a LPC4357 and am trying to understand how to use the GPIO Pin Interrupts.

In pinint_18xx_43xx.h there is a function:

STATIC INLINE void Chip_PININT_Init(LPC_PIN_INT_T *pPININT) {}

Similar to gpio_18xx_43xx.c for:

void Chip_GPIO_Init(LPC_GPIO_T *pGPIO)
{
}

Are those functions supposed to be empty? We have an existing code base that was using LPCOpen drivers 1.x.x and we have upgraded to 2.x.x (which is not working). That is one reference point. Also I have a LPCXpresso 4337 and am referencing the pinint project, which works. In Board_Init of the 4337 example, calls:

/* Initializes GPIO */
Chip_GPIO_Init(LPC_GPIO_PORT);

but looking into that shows the above, where no action occurs within the function. I would like to avoid calling functions that are not needed for the sake of removing code smell.

Any help in understanding this, is appreciated.

Thanks,
Labels (1)
0 Kudos
Reply
3 Replies

1,659 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by amorgan on Thu Oct 22 09:14:42 MST 2015
I resolved my issue.

When setting up the GPIO, I needed to use:

Chip_SCU_GPIOIntPinSel(0, 5, 18);

whereas I was using:

Chip_SCU_GPIOIntPinSel(PININTCH0, 5, 18);

Notice that PININTCH0 is actually defined as (1<< 0). This caused the issue.

I would still like to know why both Chip_PININT_Init() and Chip_GPIO_Init() are empty and why Chip_GPIO_Init() is called in the LPC4337 board examples and not noted that it is not required for that board (or if it is, why?)

Thank you.

1,659 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi LPC WARE,

    About your question : Why both Chip_PININT_Init() and Chip_GPIO_Init() are empty and why Chip_GPIO_Init() is called in the LPC4337 board examples and not noted that it is not required for that board (or if it is, why?)

  I think it is used for the different project compatibility.

  Normally, if customer just have one project, they can put all the GPIO init code in Chip_GPIO_Init(), but to lpcopen which contains a lot of projects, not all the project need to initialize the GPIO, or different project need to initial different GPIOs, so the code put the GPIO init code in the main, not directly in Chip_GPIO_Init(), Chip_PININT_Init() is the same. Chip_PININT_Init() and Chip_GPIO_Init() is the API function, it is the sample code structure, so if customer just use one project with the lib, they can put all the GPIO init code to the Chip_GPIO_Init(), eg: calling Chip_GPIO_SetPinDIRInput, Chip_SCU_GPIOIntPinSel code.

Wish it helps you!


Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,659 Views
shantanudhar
Contributor III

I am having a similar problem with LPC1549 while using GPIO interrupt. I am uding PININTCH0 as given in the sample code and even in the guidelines. I will try  with your solution.

But, tell me one thing, weren't you using PININTCH0 in other API calls as well ?

0 Kudos
Reply