[En-Nut-Discussion] Half Duplex RS485 Behaviour

Alexander Baranov baranov at intech21.com
Sat Jan 29 00:12:47 CET 2005


Hi, Douglas.
I had been using RS485 before it appeared on Ethernut board and had to
realize it on an extension board. I use a bit of PORT D to control the
direction. My piece of program looks like:

  Uart1_TxE;  //transmit enable macros
  _write(_fileno(uart1), src, xmit_len);
  fflush( uart1 );
  NutDelay( 1 );
  _read(_fileno(uart1), 0, 0);  // if 485 - Discard rx buffer because of
there is only echo
  Uart1_RxE;
  while( (rx_bytes=_read(_fileno(uart1), uart_buff+len,
UART_BUF_LEN-len))>0)
  {
   len += rx_bytes;
   if( (replength>0) && (len >= replength) ) break;
   NutDelay( 65 );
  }

It works more or less reliably on 9600 and 19200. I never had an equipment
with higher baud rate.
Regards, Alexander.
----- Original Message ----- 
From: "Douglas Pearless" <Douglas.Pearless at pearless.co.nz>
To: "'Ethernut User Chat (English)'" <en-nut-discussion at egnite.de>
Sent: Friday, January 28, 2005 5:40 PM
Subject: [En-Nut-Discussion] Half Duplex RS485 Behaviour


> Hi team,
>
> I have been tracing down a very elusive problem over the last month
whereby
> intermittently the RS485 half duplex mode does not switch quickly from
> transmit to receive.
>
> It appears that on an occasional basis, NutO/S seems to be taking a bit
> longer to process the bit that toggles the direction of the RS485 driver.
>
> Has anyone else experienced this?
>
> Changing the baud rate seems to make no real difference, I have to retry
up
> to three times, on an occasional basis.
>
> I am using a minimum of functions, just UART0 (115k), UART1 (115k), and
> timers 1 (1 second) and 2 (1.028kHz) which I have used for timing to debug
> this problem, it occurs with this timer disabled.
>
> Has anyone lese experienced this?
>
> Cheers Douglas
>
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.0 - Release Date: 27/01/2005
>
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>





More information about the En-Nut-Discussion mailing list