I am using PIC32MX Clicker (PIC32MX534F064H microcontroller) for transmitting data through UART and receiving the same on PC using a USB to serial converter at baudrate 115200.
When I try to send the data through PIC32 and read on my PC, I recieved data but, which are different. Please see below for code snippets. It would be great if anyone could suggest me what to modify to get the uart working. Thanks
#define GetSystemClock() (80000000ul)
#define GetPeripheralClock() (GetSystemClock()/(1 << OSCCONbits.PBDIV))
#define GetInstructionClock() (GetSystemClock())
void initSerial(){
UARTConfigure(UART5,UART_ENABLE_PINS_TX_RX_ONLY);
UARTSetFifoMode(UART5, UART_INTERRUPT_ON_TX_NOT_FULL
| UART_INTERRUPT_ON_RX_NOT_EMPTY);
UARTSetLineControl(UART5, UART_DATA_SIZE_8_BITS | UART_PARITY_NONE | UART_STOP_BITS_1);
UARTSetDataRate(UART5, GetPeripheralClock(), 115200);
UARTEnable(UART5, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));
}
void writeSerial(uint8_t c){
while(!UARTTransmitterIsReady(UART5));
UARTSendDataByte(UART5, c);
while(!UARTTransmissionHasCompleted(UART5));
}