Q2698 and OpenUart events

Hiya,

Using UART2 on a Q2698 to act as a RS485 master an communicate via a MAX485 converter. I’m trying to use the RTS output to control the direction of the MAX485 (i.e. have connected DE & ~RE together and am driving them with the RTS output).

My aim is to leave the MAX485 in receive mode most of the time (i.e. RTS is asserted/low/0V) and only de-assert/high/1v8 it at the beginning of a transmission and assert it again when TX is finished.

To get access to the RTS control and other UART interrupts I’m using the OpenUart API, rather than the FCM API.

I can de-assert RTS before starting the write using the Uart io_control request. However, neither of the asynchronous TX events seem to be firing at the appropriate time so I can assert RTS at the end of the transmission.

According to the doco, the On TX Complete handler is supposed to notify the application when the last byte of the block is being transmitted by the UART, and the On TX Empty handler is supposed to notify the application when the last BIT of the block is being transmitted by the UART. I’ve tried using either of these events to send a message (via adl_msgSend()) to the application to indicate that the transmission is complete and to re assert RTS (because you can’t use an io_control in the event handler). I’ve been looking at the TX data and the state of RTS using a CRO and it appears that RTS is being asserted (after the appropriate event is being fired) at some random time after the start of transmission.

With a set TX block of data of 17 bytes @ 19200 baud (approx 8.7mS to TX) I’ve observed the TX complete or TX empty events being fired (i.e RTS being asserted) at anywhere between 5mS and 30mS after the start of transmission - and rarely within either a byte or bit time of the last data being transmitted.

This is causing data corruption as more often than not the last bytes of the transmission are being truncated as the MAX485 transmitter is being disabled. I can’t put a adl_ctxSleep() to delay the RTS control as the sleep resolution is 18.5mS and I will miss the response from the slave device I’m trying to talk to.

Yes, I’m aware that I can only use either the OnTXComplete OR OnTXEmpty events - neither are appearing to do anything remotely like they are supposed to.

Has anyone used the OpenUart events and io_control on the Q2698? Have I missed something in the doco, or are there some issues in the Q2698?

Output of ATI9:

ati9
"DWL"," SWI6200T_02.02.04.16BT R3288 CNSZXD00000132 2014/05/15 17:29:47","","Sierra Wireless",0,"","00000000","00000000"
"FW","FW_752_28_A1_12.Q268Fx","R7.52.0.A1.201401021703.Q2698","Sierra Wireless",1770396,"010214 17:03","ae3e7f98","10002020"
"MODEM 3G+","Revision: SWI6200T_02.02.04.07AAP R2881 CNSZXD00000132 2013/12/20 10:57:19"
"OAT","1.0.0.20140705165432","MyApplication","Renfell Technology Pty Ltd",78488,"070514 16:54","be18195d","10700000"
 -"Developer Studio","3.0.0.201403101015"
 -"Open AT Application Framework package","2.52.0.A1.201401061044"
 -"Open AT OS Package","6.52.0.A1.201306271522"
 -"Firmware Package","7.52.0.A1.201401021703"
"ROM","8400000"
"RAM","4000000"
"OATRAM","800000"
"DWLNAME","Q2698"

OK

Any thoughts would be greatly appreciated.

ciao, Dave

Hiya,

I’ve spent another few hours looking at this, and what I believe is happening is that the OnTxComplete and OnTxEmpty events are being fired when the last byte or bit (respectively) is going into the FIFO, not when it’s going out the wire. This event can be many bits before the actual end of transmission - especially when the number of bytes is small.

Looking at the Open UART doco, there is an io_control (IOC_UART_FD) that can be used to manipulate the UART FIFO buffers. On UartOpen(), a read of the io_control returns fifo rx_size of 0, and a fifo mode of 2 (UART_FD_BOTH_ON). I can set these to rx_depth = UART_FD_DEPTH_0 and mode = UART_FD_BOTH_OFF using the io_control - and reading them back confirms that they have been set - but this appears to make absolutely no difference to when the OnTx events are fired.

How to I disable the Tx FIFO completely on the Q2698 - using OpenUart or any other method. AT+WHCNF=6,1 doesn’t work as the UART is already controlled by Open UART.

Again, all thoughts and ideas gratefully accepted.

ciao, Dave

Hiya,

Some more investigation has proved that the code runs correctly on a Q2668G running FW 7.47 … so it looks to me that there is an implementation issue with the FIFO OnTxEvent in the Q2698.

ciao, Dave

do you have rest Q2687 in stock , i want buy 300pcs