^

AR# 33102 11.1 EDK, uartns550_v1_12_a - The UartNs550 driver (version v1_12_a) does not work when an external clock (xin) is used

Keywords: driver, UART, xps_uart16550, BaudRate, baud

The UartNs550 driver has a parameter named CLOCK_HZ which was used for baudrate calculations in earlier versions of the driver. This parameter has been deprecated in v1_12_a version of the driver, and system bus frequency is used for baudrate calculations. Hence, the driver does not work correctly.

Please follow the steps below to work around this problem:

1. In the application, look for the UartNs550 initialization code, similar to the one below.

ConfigPtr = XUartNs550_LookupConfig(DeviceId);
if (ConfigPtr == (XUartNs550_Config *)NULL) {
return XST_DEVICE_NOT_FOUND;
}

ConfigPtr->DefaultBaudRate = XPAR_DEFAULT_BAUD_RATE;

2. Add the following line, after the code listed in previous step.

ConfigPtr->InputClockHz = <external_clock_frequency>

where <external_clock_frequency> is the frequency of the clock source connected to the port "xin" in MHS.

3. Initialize the XUartNs550 instance, such that it is ready to be used.

XUartNs550_CfgInitialize(InstancePtr, ConfigPtr,

ConfigPtr->BaseAddress);

4. Rebuild the application so that the correct frequency is used for baudrate calculations.

5. If the application uses XUartNs550_Initialize(), instead of XUartNs550_LookupConfig() and XUartNs550_CfgInitialize(), replace the call to XUartNs550_Initialize in the application with the code listed in steps 1-3, and rebuild the application.

As an example, let us assume that a 50 MHz external clock is connected to the "xin" port of a UartNs550 device. The Device ID is XPAR_UARTNS550_0_DEVICE_ID. The application can be updated to use the correct frequency by the following code.

XUartNs550_Config *CfgPtr;
ConfigPtr = XUartNs550_LookupConfig(XPAR_UARTNS550_0_DEVICE_ID);
if (ConfigPtr == (XUartNs550_Config *)NULL) {
return XST_DEVICE_NOT_FOUND;
}
ConfigPtr->DefaultBaudRate = XPAR_DEFAULT_BAUD_RATE;
/* Update the correct frequency */
ConfigPtr->InputClockHz = 50000000;

/* Initialize the UartNs550 device so that is uses the correct frequency */
XUartNs550_CfgInitialize(InstancePtr, ConfigPtr, ConfigPtr->BaseAddress);


AR# 33102
Date Created 07/07/2009
Last Updated 07/13/2009
Status Active
Type
Feed Back