I am trying to switch the GPIO pins of UART2 so I can send and receive data on PA6,7 and switch to pins PD4,5 to send and receive data.
void switch_uart2(bool mode)
{
if (mode == 0)
{
//Computer Pins
//UART 2 Config:
ROM_GPIOPinConfigure(GPIO_PA6_U2RX);
ROM_GPIOPinConfigure(GPIO_PA7_U2TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);
}
else
{
//Slave MCU Pins
ROM_GPIOPinConfigure(GPIO_PD4_U2RX);
ROM_GPIOPinConfigure(GPIO_PD5_U2TX);
ROM_GPIOPinTypeUART(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
}
}
When I try to switch from PA6,7 to PD4,5 data is still sent on PA6,7. Is it possible to switch GPIO pins of UART2?
//Switch UART2 GPIO Pins. switch_uart2(1); //Send slave measure command. ROM_UARTCharPutNonBlocking(UART2_BASE, 'M');
Thanks,
Allan