AnsweredAssumed Answered

Lost chars on uart TX

Question asked by OldNick on Jul 16, 2012
Latest reply on Jul 19, 2012 by OldNick

Using MQX370 on Kinetis. 

ITTYE at 115,200 no handshake.

 

BSP_DEFAULT_IO_OPEN_MODE                          (pointer) ( IO_SERIAL_RAW_IO | IO_SERIAL_NON_BLOCKING)

 

A single task looks every 10mS to see if any chars have come in, and reliably detects them all.

 

A series of calls to _io_write() from within the same task will intermittently fail to transmit the chars.

 

Buffer size is set to 64, and we never get close to filling that.

 

Lowest level call (_io_serial_int_putc_internal) appears to offer a pass/fail return, but I think MQX throws that away half-way up the stack?  As usual, the documentation is pathetic.

(From the IOUG)

The serial device driver provides these services:
API
Calls              Interrupt-driven               Polled
_io_fopen() _io_serial_int_open() _io_serial_polled_open()
_io_fclose() _io_serial_int_close() _io_serial_polled_close()
_io_read() _io_serial_int_read() _io_serial_polled_read()
_io_write() _io_serial_int_write() _io_serial_polled_write()
_io_ioctl() _io_serial_int_ioctl() _io_serial_polled_ioctl()

 

Well that was useful!

 

This used to be simple - an IRQ for RX chars, and a blocking call waiting on TXBuffEmpty to transmit them was 100% reliable.

 

But there is no setting for "non-blocking on RX only" in the MQX driver.

 

Anybody got any ideas?  Maybe use IOControl calls to see if it is safe to send?  look for the rval on _io_write, and do what?  Flush the bufffer on every character transmit?

Thanks in advance

OldNick

Outcomes