Adding GPIO to the LPC55S69 EVK i2s Example

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding GPIO to the LPC55S69 EVK i2s Example

60 Views
Contributor I

I've added some code to the i2s_interrupt_record_playback example, to read from the USER GPIO pin.

Unfortunately, it always reads 0.

The gpio_led_output example works fine, after modifying the code to use the USER GPIO pin.

Code attached, here are the modifications to the end of main() :

gpio_pin_config_t usr_gpio_config = {
   kGPIO_DigitalInput,
   0,
};
GPIO_PinInit(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN, &usr_gpio_config);
PRINTF("Press USER button to print message\r\n");
int pinState = GPIO_PinRead(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN);
PRINTF("pinState: %x\r\n",pinState);

while (1)
{
   pinState = GPIO_PinRead(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN);
   if (pinState) {
      pinState = GPIO_PinRead(GPIO, BOARD_SW3_GPIO_PORT, BOARD_SW3_GPIO_PIN);
      PRINTF("pinState: %x\r\n",pinState);
   }
}

I'm guessing that I need to add some additional initialization code but I'm running out of things to try.

If anyone knows how to get the GPIO working then I'd appreciate the suggestions.

Thanks very much and best regards,

John

Labels (1)
Tags (2)
0 Kudos
1 Reply

14 Views
Contributor I

It turns out the solution is easy when you find it ;-)

The GPIO issue was the port mapping.
Once I mapped PIO_5 to GPIO, in the pin config tool (In MCUXpresso), then USER (GPIO3) worked fine.
There's clearly a lot I need to learn :-)

John

0 Kudos