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?
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
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.
-------------------------------------------------------------------------------
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:
And indeed the pin polarity is set correctly.
In case of pin 2.4:
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
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:
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.
-------------------------------------------------------------------------------
Alice,
good thinking, but I am using the LPC1549JBD100 which is a 100 pin device.
Greetings, Marco
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.
-------------------------------------------------------------------------------