Connect ME to RS485 issues--Close, but no cigar

Since Digi has agreed that the RTS pin on the Connect ME does not function correctly, I have done a work-around. I have the Connect ME .Net Micro version working on my own board, using an RS232 chip to create a full DB9 serial port, then an RS232 to RS485 converter device. So I now have Connect ME to RS-485, my original requirement. However, it’s quite kludgy.

I got a transceiver chip from Maxim, a MAX13487E, that features “AutoDirection Control” which is supposed to take the RXDTTL and TXDTTL of the Connect ME and give me RS485. The good news is, it works. The bad news is, it doesn’t work right.

Although my serial data looks good when I sniff it from a PC, both on the RS485 side and on the Connect ME side at Pins 7 & 8, something is happening to the data that fouls things up. The Connect Me is programmed to take the incoming data, parse it and format it and insert it into a remote database. On the development board and on the above-described prototype board, all data is parsed, formatted and inserted correctly. Using the new board with the Maxim transceiver, only every 15th attempt is successful. So 14 strings of incoming data are parsed, formatted and an attempt is made to send to the database, but are unsuccessful. The 15th attempt is successful. I have tried to set up a way to look at the TCP/IP packets to see if I can see any anomalies, but so far I’ve been unsuccessful.

I’m looking for ideas for where to look for what might be going wrong, or more straight forward–how to fix it.

Are you using 2-wire RS-485? If so, I’d suspect that you’re not allowing enough ‘turnaround time’ for the transmitter to be disabled.

I’ve been using the RTS pin to enable an RS-485 transmitter succesfully on the ME for a long time. Its a bit of a kludge, but I just configure the RTS pin as an ordinary output, and use the following transmit code:

						set_RTS(RTS_ACTIVE);
						oneFd = write(port_handle,tx_wrap_buffer,tx_wrap_len);
				  tcdrain(port_handle);			// Wait until all the data sent
						  tx_thread_relinquish();		// Do something else for a moment otherwise RTS sometimes goes inactive too soon 
						  								// ... by about 2msec. This way its held for 2-10msec
						  set_RTS(RTS_INACTIVE);

I get the impression that tcdrain() doesn’t work properly either - it doesn’t wait until the characters in the transmit shift register have been sent.

Note that this is a bit reliant on processor speed - while it works on the ME, its too fast for the ME9210 (but RTS can be made to work within the UART hardware anyway on the ME9210)