Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] RS485

2005-09-19 by Peter Jakacki

Gilles,
If you don't disable the 485 receiver or the UART rx itself you can 
monitor the bytes that are transmitted. There are variations on this 
scheme but it means that you could simply turn off the 485 transmitter 
when you receive the last character that you transmitted.

Also, as Grzegorz pointed out you could use a timer, that is if you have 
one to spare.

Both of these are practical real-time solutions and easily implemented.

BTW, Yves sample code seems to be switching the PINSELs which has got to 
be totally redundant and unnecessary. Just keep the rx and tx alive and 
you only need to drive the 485's TE pin.


Gilles FAURIE wrote:

>Yes i could do that but i don't want to wait in my interruption routine 
>during character transmission which could be about 1ms (at 9600 baud).
>
>
>----- Original Message ----- 
>From: "Yves Rondeau" <op173039@...>
>To: <lpc2000@yahoogroups.com>
>Sent: Monday, September 19, 2005 11:17 AM
>Subject: RE: [lpc2000] RS485
>
>
>
>>Hello ,
>>
>>I had the same problem on ISO7816 communication.
>>At the end of TX I switch back in input mode then lost the 2 last bytes.
>>
>>Add those lines at the end of your TX routines
>>
>>while (!(U1LSR & 0x40));   /* Wait if U1THR & U1TSR not empty */
>>
>>
>>    /* we need to wait for the 2 Tx Buffer */
>>   /* to be empty */
>>   /* or we can lost the 2 bytes switching
>>*/
>>   /* in input */
>> PINSEL0 = 0x00040000;    /* RX UART1 Enable -TX Disable */
>>
>>
>>
>>Yves
>>
>>-----Original Message-----
>>From: lpc2000@yahoogroups.com [mailto:lpc2000@yahoogroups.com] On Behalf 
>>Of
>>gfaurie1
>>Sent: segunda-feira, 19 de Setembro de 2005 7:44
>>To: lpc2000@yahoogroups.com
>>Subject: [lpc2000] RS485
>>
>>Hello,
>>
>>I try to develop a RS485 driver, but i have a problem.
>>
>>As you know, you must stay in reception and when you have to transmit,
>>you change direction to be in transmission only during transmission.
>>When the last character has been transmitted you turn back in
>>reception.
>>
>>Problem is that i have no interruption on shift register empty. I have
>>an interruption when transmitter is empty but if i change direction at
>>this time, character which is in shift register is not transmitted,
>>and i lose it.
>>The only solution that i suppose is to check state of shist register
>>(LSR) in polling but i'd like to find a more real time solution
>>
>>Who can help me ?
>>
>>Thank
>>

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.