Discussion group dedicated to the Philips LPC2000 family of ARM MCUs
|
Folks, Anyone out there who's figured out how to properly time the de-assertion of the 485 driver enable when using the LPC21xx UART? Problem is, the driver needs to be tristated as quickly as possible after transmission of the last byte (perhaps during the stop bit would be ok?), but the LPC21xx UART doesn't really give you an indication of this. I'm sniffing down some rather obscure approaches (i.e. perhaps exploiting the published THRE interrupt initialization conditions), but wanted to see if anyone has already solved the issue. Regards, Ryan |
|
|
|
On Thursday 29 April 2004 12:15, MaxStream - Ryan Bedwell wrote: > Folks, > > Anyone out there who's figured out how to properly time the de-assertion > of the 485 driver enable when using the LPC21xx UART? Problem is, the > driver needs to be tristated as quickly as possible after transmission > of the last byte (perhaps during the stop bit would be ok?), but the > LPC21xx UART doesn't really give you an indication of this. I'm > sniffing down some rather obscure approaches (i.e. perhaps exploiting > the published THRE interrupt initialization conditions), but wanted to > see if anyone has already solved the issue. You really want to be using TEMT as the indicator (ie the holding and shift registers are empty). THRE just tells you that the holding resgister is empty [plus sone small print], there may still be data in the shift register. Since the device is supposed to be 16550 compliant, I'd expect the solution to be well known and available. Perhaps, if you have a spare timer, you could time a short period after the THRE interrupt. Perhaps, if you have a spare UART, you could pipe the one UART back into the other. When you see the rx on the second UART you know you're done with the tx on the first. -- CHarles |
|
|
|
Charles Manning wrote: >Perhaps, if you have a spare timer, you could time a short period after the >THRE interrupt. > >Perhaps, if you have a spare UART, you could pipe the one UART back into the >other. When you see the rx on the second UART you know you're done with the >tx on the first. Can't help it, the answer lies in the answer. If you leave the RS-485 receiver enabled during transmission as well as the UART (the same one, not a spare) then you can turn off the RS-485 transmit enable straight after the last character received, simple! Peter Jakacki |