Glomation
 
Advanced Search
Welcome, Guest. Please login or register.

Login with username, password and session length
May 20, 2012, 02:24:24 AM
News: Welcome to GLomation peer support forum
Pages: [1]
Topic Tools  
Read June 17, 2011, 08:37:39 AM #0
SteveMartins

RS485 RTS line inverted on kernel 2.6.30

Hi,

I have been using kernel 2.6.30 for a while and it works fine, except that on /dev/ttyS4 (RS485 port, USART 3) the polarity of the RTS signal is incorrect, drivint the tx enable line low while transmitting, and high while not transmitting. This is on the GESGB 9260 board.

I have had a scope on the data lines and can see the data, its simply a case of incorrect polarity. Does anyone know how to change the polarity of this signal?

thanks,

Steve
 
Read June 17, 2011, 12:29:09 PM #1
admin

Re: RS485 RTS line inverted on kernel 2.6.30

Please see http://glomation.net/smf/index.php/topic,175.0.html
 
Read June 20, 2011, 06:44:21 AM #2
SteveMartins

Re: RS485 RTS line inverted on kernel 2.6.30

I have read through that thread already. I have enabled RS485 according to this, and it works except for the polarity of the RTS line. I previously used the 9260B and fitted an extra board with my own RS485 driver and inverted the RTS line, however I have a new project and am using the 9260 with the 485 chip fitted and the RTS logic is incorrect.

If I use the devmem2 0xfffd0004 w 0xc00008c1 command on the 2.6.27 kernel, it works, but if I use it on the 2.6.30 the line toggles low, but then reverts to the previous behaviour on data.

I have a vague recollection that the polarity of this signal can be set somewhere but i'm having trouble finding it.
 
Read June 20, 2011, 08:27:44 AM #3
admin

Re: RS485 RTS line inverted on kernel 2.6.30

Writing directly from user space to the USART control register to set the USART mode actually is not a proper way of controling devices.  The kernel may have a copy of register value and may overwrite the register at some point.  The best way to use the RS-485 mode on the GESBC-9260/9G20 board is to upgrade to kernel 2.6.36 or up and use the kernel built-in RS-485 driver.  Please see http://retis.sssup.it/~scordino/code/rs485.html for more information regarding Linux kernel RS-485 driver.
 
Read June 20, 2011, 09:32:41 AM #4
SteveMartins

Re: RS485 RTS line inverted on kernel 2.6.30

I have found a workaround for kernel 2.6.30 here: http://www.at91.com/forum/viewtopic.php/f,12/t,12783/

to change USART in RS-485 mode, add this line in linux/drivers/serial/atmel_serial.c , in function atmel_set_termios ,
just before the instruction "UART_PUT_MR(port, mode);" that configures the USART mode.

if (port->irq == AT91SAM9260_ID_US3) // USART3 is a rs485
{
mode |= ATMEL_US_USMODE_RS485;
}
 
Read June 20, 2011, 08:45:17 PM #5
arapoport

Re: RS485 RTS line inverted on kernel 2.6.30

We had the same problem and "solved" it calling devmem after opening the port. Will try your workaround and post the results soon.

Alejandro
 
Read June 21, 2011, 02:41:26 PM #6
arapoport

Re: RS485 RTS line inverted on kernel 2.6.30

Yes, it works ! No more devmem2...
 
Pages: [1]
Jump to:  

Theme Update by Runic Warrior Originally created by m3talc0re