[stamp9G20] RTS0 problem

Hi
I have connected TXD0, RXD0 and RTS0 to a max3471 driver (RS485).
In my code I have activated CRTSCTS flag.
I can see sending data on TXD0 (with a scope) but RTS stays low.

I have checked USART0 in kernel code and it seems ok (rts is correctly declared)

Any ideas to solve this problem?

Fred

Re: [stamp9G20] RTS0 problem

Putting the driver in RTS/CTS flow control mode, doesn't make it work for RS485. Here the RTS -line is used to switch between transmit and receive mode in your MAX3471 driver chip.
You have two options for RS485:
1) Use the new 2.6.35 kernel, where the at91-serial driver has RS485 support, the RTS pin will then be toggled automatically by the driver.
2) Toggle the pin manually before sending either by setting RTS via ioctl or by controlling the pin via direct gpio. You can then wait till the send buffer is empty to clear RTS. You can do this similar like this:

#include <termios.h> 
#include <termio.h>
#include <linux/ioctl.h>

set_rts(); /*implement your way */
write(fd, obuffer, len*2);
do {
    usleep(200);
    ioctl(fd, TIOCSERGETLSR, &obytes);
    } while (!(obytes & 0x01));
clear_rts();

Proposition 1) is clearly the better one.

Re: [stamp9G20] RTS0 problem

Thank you for your reply.
Where can I find a 2.6.35 kernel ? Did you ever test it for stamp9G20 board ?
Do you plan to provide it on you web site ?

Re: [stamp9G20] RTS0 problem

Stamp9G20 and PortuxG20 support is now in Linux mainline, as anounced here on our mainsite:
http://www.armbedded.eu/node/245

We have tested the support for 2.6.35.

Syndicate content