Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

Uart behaviour after recovering from timeout error

$
0
0

Hello,

I am using UART from PSP 1.30.01 to communicate with a computer with packets very similar to those described in this post : http://e2e.ti.com/support/embedded/bios/f/355/t/111541.aspx and I have problems making Uart work after a timeout error (IOM_ETIMEOUTUNREC).

Here is a test function I have written to understand how UART works :

GIO_Handle hInput;
size_t size;
unsigned char buffer[50];
int i =0;
int status;
memset(buffer, 0, sizeof(buffer));

... // Create hInput : interrupt mode, 19200 bps

hInput->timeout = SYS_FOREVER;
size = 1;
status = GIO_read(hInput, buffer+0, &size);
// 1) DSP waits for me. I send 'A' on serial link using Tera Term

// Here, status==IOM_COMPLETED
// and buffer = ['A', 0, 0, 0, 0 ...]
hInput->timeout = 1000;
size = 1;
status = GIO_read(hInput, buffer+1, &size);
// 2) I wait for timeout to expire (~1s)

// Here, status==IOM_ETIMEOUTUNREC
// and buffer = ['A', 0, 0, 0, 0 ...]
GIO_control(hInput, Uart_IOCTL_RESET_RX_FIFO, 0);
GIO_control(hInput, Uart_IOCTL_CANCEL_CURRENT_IO, 0);

hInput->timeout = SYS_FOREVER;
size = 1;
status = GIO_read(hInput, buffer+2, &size);
// 3) I don't send any character, but DSP does not wait for me and goes on without error !!!

// Here, status==IOM_COMPLETED
// and buffer = ['A', 0, 0, 0, 0 ...]

hInput->timeout = SYS_FOREVER;
size = 1;
status = GIO_read(hInput, buffer+3, &size);
// 4) DSP waits for me. I send 'B' on serial link using Tera Term

// Here, status==IOM_COMPLETED
// and buffer = ['A', 0, 'B', 0, 0, ....]     instead of  ['A', 0, 0, 'B', 0, ....]

I don't understand why program goes on in 3) although timeout is FOREVER and why 'B' is written at index=2 instead of index=3.

Thanks in advance if someone has an explanation,

Romain

PS : CCS 3.3  -   DSP/BIOS 5.41.13.42    -    CGT 6.1.21   -  LogicPD's OMAP-L138 SOM-M1


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>