Hi,
When working with DM355 UART1, we are experiencing a strange behavior. When
calling the write function for this UART, sometimes it takes 200 ms for the
write function to complete. This happens when a write function is called right
after another write function. There is not a lot of data sent to the UART at
one time, at most 32 bytes. The UART is running at 100,000 baud and would take
at most 3.2 ms to send this data, not 200 ms.
We have tested this in non-Linux environment and found there were no delays.
Has anyone came across this issue on UART transmits on DM355 devices?
Below is simple test code that re-creates this issue.
static int halUartWrite(int fd, uint8_t* buffer, size_t s)
{
int num = 0;
if( fd != invalidHandle )
{
num = write(fd, buffer, s);
tcdrain(fd);
}
return num;
}
int main(int argc, char** argv)
{
char testString[] = "A really long test to see what happens.";
char buffer[100];
time_t currentTime;
int cartridgeSerialPortFileDevice = halUartOpen("/dev/ttyS1", 100000);
if( cartridgeSerialPortFileDevice == invalidHandle )
{
printf("ttyS1 failed\n");
exit(-1);
}
printf("Length of test string (%s) %d\n", testString, sizeof testString);
currentTime = currentTime_ms();
halUartWrite(cartridgeSerialPortFileDevice, testString, sizeof testString);
printf("Elapsed time (ms) after 1st write: %d\n", currentTime_ms() -
currentTime);
halUartWrite(cartridgeSerialPortFileDevice, testString, sizeof testString);
// 200 ms delay until this is seen
printf("Elapsed time (ms) after 2nd write: %d\n", currentTime_ms() -
currentTime);
halUartRead(cartridgeSerialPortFileDevice, buffer, sizeof buffer);
printf("Finished\n");
}
Thanks,
Prateek Bansal
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source