Posts: 3419
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: Multi-function RS-485 remote sensor

Fri Jul 13, 2018 12:44 am

I have a TTL to RS485 converter like you
Which one? I post a lot of them!

I suppose that GPIO17 is your direction of your signal. This will never works for two reasons.

1 - There is a buffer in the transmit data. The data are still transmitted when the function ser.write() returns. Then there is no chance that the unit returns something since the full packet is never received.
2- Even if the packet is received there is a good chance that the direction won't be set in times. The python is quit slow and it is possible that the O.S. will do something else and add a delay because it will do other task. Then the direction bit will be too late .

If you read my post I used a build in USB to RS-485 with automatic handling transmit/receive direction. Or I used a little cpu to handle the direction.

What is your device b.t.w. ?

Return to “Interfacing (DSI, CSI, I2C, etc.)”