Hello Guest it is March 28, 2024, 02:55:37 PM

Author Topic: USB RS485 modbus to X200  (Read 4915 times)

0 Members and 1 Guest are viewing this topic.

USB RS485 modbus to X200
« on: August 07, 2014, 06:21:46 PM »
I have an X200 spindle, and a cheap USB-to-RS485 adapter:

http://www.ebay.com/itm/PL2303HX-Chip-USB-to-RS485-485-Converter-Adapter-Support-For-Win7-Linux-XP-Vista-/181488771511?pt=US_USB_Cables_Hubs_Adapters&hash=item2a4192e1b7

I saw the problem that the RJ45 connector selects 2 pins which are not traditionally a twisted pair with one another.  I cut the connector a few inches away and wired to the green/greenstripe twisted pair for the rest of a ~3ft cable.  These are the only 2 signal wires going to the X200.

I programmed the X200 for 8n1 19200 baud slave addr1.

I installed a "Modbus plugin" for Mach3. 

Under "Serial Modbus Test", Mach3 can open this Com port.  However, any Read operation gets me "CRC Error". 

I am not 100% sure I have the + and - pins of the Modbus correct, so I swapped them, then I get "Receive Timeout".  I am guessing this is outright the wrong polarity, but I'm not certain.

Any help?  I'm stuck.  I need basic communication to proceed.  I've spend considerable time diddling around with it and I have nothing to go on from here.
Re: USB RS485 modbus to X200
« Reply #1 on: August 08, 2014, 10:40:31 PM »
Well I began to realize that "Coil" could be read and written ok.  Well I can read 8 values, and write the bits and read them back and there's no errors.

However,  once I try to Read or Write a Holding Register, I get either "Receive Timeout" or "CRC Error", sometimes "Illegal Address".  And I do have Receive Timeout upped to 200mS.

Once I've gotten that error, Read or Write to a  Coil register becomes unreliable for a few minutes, prone to "Receive Timeout".

I have seen the Holding Registers read successfully a few times.  

I'm also getting a problem where- usually after hitting Read or Write a few times in succession, but not rapidly, per se- I get a lockup inside of Mach3 and a Windows msg that Mach3 has crashed.  Then Mach3 can't reload again.  It brings up the Loader screen and it acts like it's gonna load Mach3 but never does. And Mach3 wasn't hanging around as a zombie process, Windows Task Manager doesn't show Mach3 as still loaded before then.
Re: USB RS485 modbus to X200
« Reply #2 on: August 08, 2014, 11:54:52 PM »
Tried dropping to 9600 baud, no change.
Re: USB RS485 modbus to X200
« Reply #3 on: August 18, 2014, 12:46:24 PM »
I found the problem on a scope.  The X200 is pretty high on common-mode noise because the ground goes all over the place, even without the output on, and tying the ground into transceiver ground doesn't fix much.  RS485 is differential and can reject common-noise but only within its common-mode range.  What I measured was well outside that.

I fixed it with an optoisolated RS232/RS485 converter.  Then the X200's ground can do whatever it wants, it could even have a ground 1000vdc away from the PC's ground and would still comm.