Go Down

Topic: How to manage when transmit buffer is empty?! (Read 146 times) previous topic - next topic



I am working with Arduino Due connected to a meter via RS485. (RXD2 and TXD2 or arduino connected to RO and DI of ISL83485 IC; A and B of ISL83485 connected to the meter).

At the first, I send a packet to the meter and after receiving an specific response, send another packet.

Through this task, I have to manage the suitable time to send or receive data to/from the meter (controlling DE and /RE pins); otherwise I will miss sent or received data.

I am searching the way which solve my problem . (a library, manipulating a register, adding a delay after sending the packet, a sample code or etc.)

Could you please help me out?


The best way I have found to do this is to take a measurement of Serial.availableForWrite() just after Serial.begin(). Whenever you see this value, you know that the outgoing Arduino serial buffer is empty and the hardware buffer is transmitting the last byte. Add a timeout to this which is longer than a byte and then you can disable the transmitter.

The Teensy has hardware pins to control RS485 chips but when I tested it I could not make it work. The software solution is a little crude but good enough for my project. I don't remember if the Due has similar hardware pins.
GoForSmoke: "What GShield? You never mentioned a shield."


Hi and thank you for the response.

I found some useful websites which help me a lot.



I could manage the RE port via RTS (put serial2 on RS485 mode), but I have not been able to connect to my rs485 device.

My device works with 300/7E1 and I'm not sure how to set in on RS485_non_blocking protocol.

could you please help me out with this problem?!

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131