Adding GPIO to the LPC55S69 EVK i2s Example

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Adding GPIO to the LPC55S69 EVK i2s Example

1,137件の閲覧回数
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,091件の閲覧回数
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 件の賞賛
返信