Can't get group interrupt to work on port 2 (LPC1549)

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

Can't get group interrupt to work on port 2 (LPC1549)

962 Views
marcokuysterman
Contributor I

I want to use port 2.4 to be part of the group interrupt 0:

 Chip_GPIOGP_Init(LPC_GPIOGROUP);         
 Chip_GPIO_SetPinDIRInput(LPC_GPIO, 2, 4);
 Chip_GPIOGP_SelectHighLevel(LPC_GPIOGROUP, 0 ,2, 1 << 4);   
 Chip_GPIOGP_EnableGroupPins(LPC_GPIOGROUP, 0, 2, 1 << 4);
 Chip_GPIOGP_SelectOrMode(LPC_GPIOGROUP, 0);
 Chip_GPIOGP_SelectEdgeMode(LPC_GPIOGROUP, 0);
 Chip_GPIOGP_ClearIntStatus(LPC_GPIOGROUP, 0);
 NVIC_EnableIRQ(GINT0_IRQn);
‍‍‍‍‍‍‍‍

However when I look at PORT_POL[2] and PORT_ENA[2] both are 0 and stay 0. If I change the code to port 1.4, the value for PORT_POL[1] = 0xFFFF FFFF and PORT_ENA[1] = 0x0001 0000. Am I missing something?  

Labels (1)
0 Kudos
6 Replies

802 Views
marcokuysterman
Contributor I

Thank you for you answer.

I tried both suggestions but still PORT_POL[2] and PORT_ENA[2] are 0 and stay 0. No change.

I also looked at your example but I do not see any clues why 

As a workaround I am polling port 2.4, but imho an interrupt will fit much better.

Greetings Marco

0 Kudos

802 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Marco,

I will test it on my side after I get this board.

How about the demo "periph_grouped_int"? 

This default demo is for Port0, pin 17, Select Low Level interrupt  on this pin :

/* GPIO pin for GROUPED GPIO interrupt.  This is SW1-WAKE button switch input. */
#define TEST_BUTTON_PIN         17    /* GPIO pin number mapped to PININT */
#define TEST_BUTTON_PORT        0    /* GPIO port number mapped to PININT */

    Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUP, 0, TEST_BUTTON_PORT, 1 << TEST_BUTTON_PIN);

after download it ,check the register of PORT_POL[0], bit 17.

Then change to port2- pin4, how about the register of PORT_POL[2] ?


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

802 Views
marcokuysterman
Contributor I

Sorry for my late answer, but here are the results of my tests:

In case of pin 0.17:

 Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO2);
 Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO0);
 Chip_GPIOGP_Init(LPC_GPIOGROUP);
 Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 17, (IOCON_DIGMODE_EN | IOCON_MODE_INACT) );;
 Chip_GPIO_SetPinDIRInput(LPC_GPIO, 0, 17);

 #define TEST_BUTTON_PIN 17 /* GPIO pin number mapped to PININT */
 #define TEST_BUTTON_PORT 0 /* GPIO port number mapped to PININT */

  Chip_GPIOGP_SelectLowLevel(LPC_GPIOGROUP, 0, TEST_BUTTON_PORT, 1 << TEST_BUTTON_PIN);

Result:

2019-03-12 11_57_00-.png

And indeed the pin polarity is set correctly.

In case of pin 2.4:

2019-03-12 11_58_20-.png

But now the whole register stays 0 (POL[0] and POL[1] are both Binary:11111111111111111111111111111111)

I am confused, the only conclusion I can make is that this whole thing does not work for Port 2.

Greetings Marco

0 Kudos

802 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Marco Kuystermans

Please check how many pins in your chip refer to Data sheet, or you can tell me the part number , I help you check it.

If 48 pins or 64 pins, there isn't GPIO port 2, only 100 pin chip have:

pastedImage_4.png

Hope it helps,


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

802 Views
marcokuysterman
Contributor I

Alice,

good thinking, but I am using the LPC1549JBD100 which is a 100 pin device.IMG_5491.jpg

Greetings, Marco

0 Kudos

802 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Marco Kuystermans,

Please check whether enable GPIO2 clock :

  Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO2);

and whether set pin back to GPIO :    

STATIC INLINE void Chip_IOCON_PinMuxSet(LPC_IOCON_T *pIOCON, uint8_t port, uint8_t pin, uint32_t modefunc)

I recommend you first try to the demo "periph_grouped_int" under LPCopen:

LPCOpen Software for LPC15XX | NXP 


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos