0

I want to use raspberry pi 4 to read some values from Mitsubishi FX1n PLC over programing port(RS232) and I use RS232-USB adapter with CH340 chip. The problem is that I have to send ASCII REQ(05 in hex) from RPI and receive ASCII ACK(06 in hex) from PLC to open the connection and this value is treated as Frame error by CH340 driver in linux.

I write "SCADA" program in C# (visual studio) and I run it with mono on RPI. I've test the program in Windows and it works fine, but on RPI, I get read timeout with same settings and same CH340 adaptor. After more tests, i've notice that RPI reset the port when receive ACK. I've try also to simulate this with arduino that also have CH340 cip and on Windows works fine, but on RPI I see RX led from arduino blinking(REQ command) and immediately after that is blinking the power led and TX led from arduino is not flashing. If I send anything else from Arduino to RPI is working fine. I also made a bridge between RX and TX on RS232 - USB adapter and I receive back what I send from RPI. So, the adapter is not defective.

So, my question: Is there a way to stop port reseting from RPI on ACK receive?

PS: Sorry for my bad English.

0

I found the problem. It was because of the power supply. I've made the tests with phone charger connected to RPI and the voltage on USB was 4,87. I've change the charger with another one and the voltage was increased to 5.1V and the RS232 adaptor is working now. However, the fault was not only the voltage, because I've tried also with another RS232 adaptor(uc232a) and it worked perfectly with low voltage and a short search on Wikipedia shows me that USB standard voltage is 5V +- 0,25, so 4,87V is still right range. It seems that LH-340 adaptor have a design problem.

1
  • If this 4,87V number comes from a multimeter, it's probably a measurement problem than a design problem. Does your multimeter show you a minimum value, or the average one? – Dmitry Grigoryev Mar 2 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.