Wanted to post this… just for reference as I couldn’t find an explicit answer although many asked the question.
I’ve returned to my Spider after indulging with the Electric Imp for some time. I wanted to port in a functional sense, my Electric Imp/Sparkfun RS485 solution to the Spider. I tried to get a RS485 Gadgeteer but no one seems to hold stock in Europe, so I resorted to using the Sparkfun interface.
The challenge really was around RTS signalling. I first thought I could use the Handshake feature of COM2 (socket K), but it transpires this is more about flow control (and buffers). I set Handshake to None. The Sparkfun interface has an RTS input that essentially either enables receive or transmit (as RS485 is half duplex).
After reading the EMX User Guide, I established the RTS pin on the COM2 port was IO31. Therefore, to toggle RTS you need the following code:
RTS_Pin = new outputPort ((Cpu.Pin) GHI.Pins.EMX.IO31, true);
and then use;
So, the sequence would be: o Raise RTS o Write () buffer on serial port o Flush () buffer on serial port (waits for last bit to exit) o Lower RTS o Wait for bytes to be received Success.. I'm now retrieving information from my RS485 Heatmiser PRT-EN thermostats.