i am new to rs485 serial port communication. i am trying to send the differential signal and i have successfully sent out the data i want.
but somehow after my data, there will always a 1 ms logical high before it back to idle. my device suppose to send some response after sending data, i believe that this 1 ms is blocking me from getting response cuz it hold writing for 1 ms
My first idea is how you’ll be able to get any type of 2M speed out of an rs485 system. Seems awful fast, but I guess it’ll depend on your packet sizes and response needs. I personally have never run anything rs485 higher than 115200.
In the rs485 world, it’s actually a good thing to have the line driven for a time after your data is sent. This allows for any type of propagation delays you may have on the wire (long runs). Of course, if you’re running at 2M, I doubt you’re going very far.
It’s also not usual for a receiver to wait some sort of “turnaround time” before they start driving the lines and spit back out a response. Again, your system may have different requirements.
I don’t see where you flip the serial port into rs485 mode (if your serial port driver supports it.) You’ve got a few hurdles to get over regarding config there.
After that, you’ll need to pay a little attention to the device tree bindings for rs485 operation of your serial port.
Where do you have your TX ENABLE line connected? If you’re using RTS/CTS functionality to move it around automatically, you might have speed problems. You may need to move to gpio functionality there to gain finer control.