Yahoo Groups archive

Lpc2000

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

Thread

pb with rs485

pb with rs485

2005-06-09 by sebfr74

Hi,
I use UART1 to make a rs485 with GPIO0.10 for the direction.
I've got a problem, when I look the transmission with an oscilloscope 
the sens go to level 0 just before the last character.
I do this :
("p" is a pointer to the string to transfer and "n" the number of 
characters)

do{
   while (!(U1LSR & 0x20)) watchdog(); 
   U1THR = *p++;
} while (--n);

while (!(U1LSR & 0x20)) watchdog(); //wait last character transmit 
					
IOCLR0=SENS; //SENS=Rxd --> rs485 in reception

Re: pb with rs485

2005-06-09 by Angel Sanchez

--- In lpc2000@yahoogroups.com, "sebfr74" <seb.jacquemard@9...> wrote:
> Hi,
> I use UART1 to make a rs485 with GPIO0.10 for the direction.
> I've got a problem, when I look the transmission with an oscilloscope 
> the sens go to level 0 just before the last character.
> I do this :
> ("p" is a pointer to the string to transfer and "n" the number of 
> characters)
> 
> do{
>    while (!(U1LSR & 0x20)) watchdog(); 
>    U1THR = *p++;
> } while (--n);
> 
> while (!(U1LSR & 0x20)) watchdog(); //wait last character transmit 
> 					
> IOCLR0=SENS; //SENS=Rxd --> rs485 in reception

The UART has double buffer, so you must do the test:
 
while (!(U1LSR & 0x60)) watchdog(); //wait last character transmit

for the REALLY end of transmision

Re: pb with rs485

2005-06-09 by relentless_6995

Try waiting for ((LSR & 0x60) == 0x60) to be true before switching 
your driver. That may help.

You still may have to start a timer and wait for an interrupt from 
that timer to actually reverse driver direction.


--- In lpc2000@yahoogroups.com, "sebfr74" <seb.jacquemard@9...> 
wrote:
> Hi,
> I use UART1 to make a rs485 with GPIO0.10 for the direction.
> I've got a problem, when I look the transmission with an 
oscilloscope 
Show quoted textHide quoted text
> the sens go to level 0 just before the last character.
> I do this :
> ("p" is a pointer to the string to transfer and "n" the number of 
> characters)
> 
> do{
>    while (!(U1LSR & 0x20)) watchdog(); 
>    U1THR = *p++;
> } while (--n);
> 
> while (!(U1LSR & 0x20)) watchdog(); //wait last character transmit 
> 					
> IOCLR0=SENS; //SENS=Rxd --> rs485 in reception

Re: pb with rs485

2005-06-10 by relentless_6995

Strike my comment about the timer - LSR & 0x60 will complete the job.

--- In lpc2000@yahoogroups.com, "relentless_6995" <bobd@c...> wrote:
> Try waiting for ((LSR & 0x60) == 0x60) to be true before switching 
> your driver. That may help.
> 
> You still may have to start a timer and wait for an interrupt from 
> that timer to actually reverse driver direction.
> 
> 
> --- In lpc2000@yahoogroups.com, "sebfr74" <seb.jacquemard@9...> 
> wrote:
> > Hi,
> > I use UART1 to make a rs485 with GPIO0.10 for the direction.
> > I've got a problem, when I look the transmission with an 
> oscilloscope 
> > the sens go to level 0 just before the last character.
> > I do this :
> > ("p" is a pointer to the string to transfer and "n" the number 
of 
> > characters)
> > 
> > do{
> >    while (!(U1LSR & 0x20)) watchdog(); 
> >    U1THR = *p++;
> > } while (--n);
> > 
> > while (!(U1LSR & 0x20)) watchdog(); //wait last character 
transmit 
> > 					
> > IOCLR0=SENS; //SENS=Rxd --> rs485 in reception

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.