I am using a PIC32MX795F512L controller for my project. I need to restart the UART3 module using 32-bit peripheral library code. I am able to restart UART1 and UART2 successfully using the following code.
CloseUART1();
Idle_Timeout(1);
UARTConfigure(UART1, UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetFifoMode(UART1, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS | UART_STOP_BITS_1 | UART_PARITY_NONE);
UARTSetDataRate(UART1, GetPeripheralClock(), 115200);
UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
INTEnable(INT_SOURCE_UART_RX(UART1), INT_ENABLED);
INTSetVectorPriority(INT_VECTOR_UART(UART1), INT_PRIORITY_LEVEL_1);
INTSetVectorSubPriority(INT_VECTOR_UART(UART1), INT_SUB_PRIORITY_LEVEL_1);
Idle_Timeout(1);
In above code CloseUART1(); function turns off the UART1 module. But when I use the same function for UART3 it gives "Undefined reference error".
CloseUART3();
UARTConfigure(UART3, UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetFifoMode(UART3, UART_INTERRUPT_ON_TX_NOT_FULL | UART_INTERRUPT_ON_RX_NOT_EMPTY);
UARTSetLineControl(UART3, UART_DATA_SIZE_8_BITS | UART_STOP_BITS_1 | UART_PARITY_NONE);
UARTSetDataRate(UART3, GetPeripheralClock(), 9600);
UARTEnable(UART3, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
INTEnable(INT_SOURCE_UART_RX(UART3), INT_ENABLED);
INTSetVectorPriority(INT_VECTOR_UART(UART3), INT_PRIORITY_LEVEL_3);
INTSetVectorSubPriority(INT_VECTOR_UART(UART3), INT_SUB_PRIORITY_LEVEL_1);
Please guide me to turn off the UART3 module and restart the module using 32-bit peripheral library code.