Adding GPIO to the LPC55S69 EVK i2s Example

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Adding GPIO to the LPC55S69 EVK i2s Example

1,626 次查看
jedwards1
Contributor II

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

标签 (1)
标记 (2)
0 项奖励
回复
1 回复

1,580 次查看
jedwards1
Contributor II

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 项奖励
回复