I am working on a project that uses the RS-485 bus to poll some info from slaves. Because I have quite some experience with RS-232 I’d reckon this a no-brainer. However, my system didn’t work. On the RS-232 bus, with a 232/485 converter, no problems. But, with the slaves connected directly to the device’s 485 port, I received a lot of noise in the reception of my data.
So, back to the drawing board and most importantly, get more information! A little research on the internet learned me (or actually, made me realise) that I am using a two-wire bus, which implies I cannot send and receive at the same time. My code enables the receiver all the time, so it seems I am re-reading what I am sending. However, all information I found online either caters to generic serial programming using the RS-232 port or on RS-485 hardware and wiring. Some talk a little on the electrical properties, but nowhere did I find a programming example on how to do the half-duplex right. Result: this blog post.
Well, I blew up some main components (bad power supply) and have to wait for new ones. This post will continue. …
Update (2010-07-13): apparently, using a Variac (which connects the net-mains to one of the output leads) is not a smart idea when connecting sensitive electronics. Replaced the board and the power supply, and everything works now. I had a few slient times before and after sending, but they don’t seem to make any difference (it also works without them). I guess the device’s firmware/UART takes care of that.