I'm trying to make a USB to 20mA loop converter to connect to Siemens S5 PLC. I asked a question about selecting a good optocoupler to convert the signals here @Marko Buršič helped me with a schematic of a RS232 to S5 converter I used that circuit and replaced the Max232 chip with a CH340 (uart to USB) chip. In software when I initiate a connection to the PLC it begins to transfer and transfer some of data correctly but after a few seconds it losses its connection. I used a logic analyzer to capture the signals at the CH340 pins and it shows that in the middle of the connection it losses the connection. You can see this capture here
How can I find where the problem comes from?
PS:I used Marco's schematic and modified it to resemble my circuit.Thanks Marco Sorry I know it's shame that you draw the schematic for me.
I am using 4N25 instead of 4N37.
I used a 1.5Mohm instead of 220Kohm resistor on base of the optocoupler.
I don't have LEDs on signal lines of PLC.
PS2: I uploaded a screenshot of the error shown on S5W When I tried to connect to PLC.
PS3: Today I find my RS232 to Siemens S5 cable and captured the(Tx and RX of Max232 IC on this cable) signals during connection. I compared these signals with my prototype of USB version cable. At the beginning all the signals are the same but at the middle of the connection the signals from PC to PLC differs from when the signals on RS232 cable. I upload a picture of the moment that these signals differ(before this time all the transactions are the same). How can this problem arise?
Please Help me this cable is driving me crazy!