Two-wires RS485 and the driver enable problem

The block start and end bytes are important, but if they are not unique you have to escape them in your data which implies a message handling layer in your software. Or you can use a UART that recognizes the start characters. If you use sync data transmission rather than async this is common.

How is N sync bytes equivalent to a bunch of empty frames? Is your sync byte unique?

I'm not sure I see a problem. UARTs typically see the falling edge as the start of the start bit, but check at least once in the middle of the bit to see if it was just noise. Too short a pulse and it is discarded. Long enough and it will be seen as a start bit. Since the UART starts looking for a new start bit in the middle of the stop bit (approximately) such a start bit timing discrepancy will not create a problem although this leaves no room for timing variation between the two ends. As long as point B is in the first preamble char and not the last it should be ok. But if you can be sure the driver disable will be at worst case no later than C, why can't the slave just hold of sending the start of frame for another char?

Your approach will work, but it is no better than sending chars without enabling the slave's driver in the first place. In fact, if you know when the master driver will be off the bus, you can get your message out once character more quickly by not sending the last preamble byte.

--

Rick
Reply to
rickman
Loading thread data ...

Do you know if your transmitter empty interrupt works properly or is this what prompted the entire thread?

I was looking at some of the USB dongles for RS-485 a while back and some of them make it clear that the driver is controlled directly by the transmitter empty and so the last char gets out of the module correctly.

--

Rick
Reply to
rickman

AVR micros have two transmitter interrupts: register empty and transmit complete. The transmit complete interrupt should disable the RS485 driver and it seems work well.

No, AVRs (and many many micros smaller and bigger) can't directly control the RS485 driver/direction.

Reply to
pozzugno

Sorry, I must have gotten this confused with a different thread.

--
Grant Edwards               grant.b.edwards        Yow! I'm ZIPPY the PINHEAD 
                                  at               and I'm totally committed 
 Click to see the full signature
Reply to
Grant Edwards

You'll get no arguments on that point. The trick of sending an extra byte is a way to make things work with non-ideal hardware - but better hardware is always nicer.

Reply to
David Brown

Me too. And I prefer datasheets that match the hardware, and so forth. Then, I wake up from that nice dream, and deal with reality ;-)

Reply to
Dave Nadler

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.