/**************************************************************** UART INIT ******************************************************************************************/
void ConfigureModubusUART6(void)
{
// Enable the GPIO Peripheral used by the UART.
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
// Enable UART6.
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART6);
// Configure GPIO Pins for UART mode.
GPIOPinConfigure(GPIO_PP0_U6RX);
GPIOPinConfigure(GPIO_PP1_U6TX);
GPIOPinTypeUART(GPIO_PORTP_BASE, GPIO_PIN_0 | GPIO_PIN_1);
// TODO: Previous Buad rate: 115200
// Initialize the UART for console I/O.
UARTConfigSetExpClk(UART6_BASE, SYSTEMCLOCK, 115200,(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
}
/**************************************************************************************************************************************************************/
I have set up UART as per above init function. I have set the baud rate to 115200. Theoretically at a baud rate of this, time needed to transmit 8 bits can be around (8/115200 =) 69usec. Hence to transfer 600 bytes this time can be around 42msec. But in my case it is taking 128 to 200 msec to transmit 600 bytes. We are using modbus-RS485 communication, hence we have to toggle the direction pin whenever we transmit or receive.
We are measuring this time between S-RX-1 and S-RX-2 in the below code
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_3, GPIO_PIN_3);
UART0print("S-RX-1\r\n");
/* Slave data Request from master: LED ON */
GPIOPinWrite(GPIO_PORTK_BASE, GPIO_PIN_1 , GPIO_PIN_1);
FPGAincomingData[1] = slaveCommandRxBuf[1];
// TODO: SysCtlDelay(SYSTEMCLOCK/100);
softDelay(3);// MUST Delay larger then master send data and also give delay to receive
/* Sent to mBus-UART */
UART6print((const char *)FPGAincomingData);
/* Sent to Debug-UART */
UART0print("S-TX-2 > "); UART0print((const char*)FPGAincomingData); UART0print("\n");
UART0print("S-TX-3 > \r\n");
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Regards,
sagar