I have referred http://microchipdeveloper.com/harmony:example-usart-dynamic-wf32 to configure the UART and send/receive data between PC(Putty) and my PIC32MZ.
The demo program in the link receives the data, adds one to it and transmits it back to putty.
case APP_STATE_RX: // USART receive state
{
// if byte received in USART instance pointed to by myUSARTHandle (USART1 in this case)
if (!DRV_USART_ReceiverBufferIsEmpty(myUSARTHandle))
{
appData.rx_byte = DRV_USART_ReadByte(myUSARTHandle); // read received byte
appData.tx_byte = appData.rx_byte + 1; // modifying received byte confirms it was received
appData.state = APP_STATE_TX; // change state to TX
}
break;
}
case APP_STATE_TX: // USART transmit state
{
// make sure the transmit buffer is not full before trying to write byte
if(!(DRV_USART_TRANSFER_STATUS_TRANSMIT_FULL & DRV_USART_TransferStatus(myUSARTHandle)) )
{
DRV_USART_WriteByte(myUSARTHandle, appData.tx_byte); // send modified byte
appData.state = APP_STATE_RX; // change state to RX and wait for next received byte
}
}
However, whenever I enter (transmit) any data from Putty to PIC, the PIC reads it as "ý";0xff.
The PIC code adds 1 to 0xff and sends NULL;0x0 back.
The putty screen is always blank.
How can I transmit/receive proper data between my PIC and pc?
Thanks in advance!
Edit:- I double-checked the clock settings for the UART etc, however every-time I send something from puty (characters or numbers) all I receive in UART_Rx buffer is "ý";0xff.