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