Anyone very experienced with Modbus & RS-485???
My task is to control a DC motor using micro PIC24. The motor setting like the angle, delay, start/stop, duty cycle, etc will be sent from PC using Modbus to PIC24.
The system is like this:
PIC24 -> UART -> IC MAX3471 -> RS-485 to RJ-45 converter -> RJ-45 to USB -> PC (running modbuspoll tool)
The Modbus format used is Modbus RTU.
At first, the Modbus read holding register function and write single register function is working. But after I send some of the motor settings using Modbus write single register function then the motor start running, it was then the Modbus communication always timeout error.
And once the timeout error happens, the next time I turn on the system again it will keep giving timeout error. I've tried changed UART baud rate from 9600 to 115200. Try changing the RS-485 to RJ-45 converter board (just in case it broke), the phenomena just repeat.
Can someone give me some advice on what could be the possible cause?
Also, I'm not sure about this, in Modbus RTU format, at the start and end there should be 28 bit (at least 3 1/2 character length), but should the micro firmware code care about this since at the PC use modbuspoll tool?
I've tapping the A & B signal using logic analyzer, if I send some character from uC to RS-485 (but not connected to PC), the character showing correctly on A & B line. But if I tapping the A & B line signal when I send read holding register function from PC using modbus poll (give timeout error) I got some weird signal:
So it seems the problem is not in the uC firmware code, but rather either one of them: USB to RS-485 converter, straight ethernet cable, or RS-485 interface board. Here's the USB to RS-485 converter that I used: