UART RTS/CTS control problem


#1

I have got UART on IoT card. Data transmission (Rx/Tx) works perfectly. However I have got problem with controlling RTS/CTS lines.

MangOH green:
Line RTS looks fine. When I change RTS on MangOH, CTS changes on connected device. BUT.
When I change RTS on connected device, CTS on MangOH does not react (It is always set).
FX30S:
Unable to control RTS/CTS.

Why FX30 and MangOH behave differently? Why CTS flag is always set?

Serial Port Setup:
//if ((FD = open("/dev/ttyHS0", O_RDWR)) == -1) return 0; //MangOH green
if ((FD = open("/dev/ttyHSL1", O_RDWR)) == -1) return 0; //FX30
struct termios attr;
//tcgetattr(FD, &oldterminfo)
memset(&attr,0, sizeof(attr));
cfsetispeed(&attr,B38400);
cfsetospeed(&attr,B38400);
attr.c_cflag &= ~PARENB;
attr.c_cflag |= CLOCAL;
attr.c_cflag |= CREAD;
attr.c_cflag &= ~CSTOPB;
attr.c_cflag &= ~CSIZE;
attr.c_cflag |= CS8;
attr.c_cflag &= ~CRTSCTS;
attr.c_iflag &= ~(IXON | IXOFF | IXANY);
attr.c_iflag &= ~(ICANON | ECHO | ECHOE | ISIG);
attr.c_cc[VMIN] = 0;
attr.c_cc[VTIME] = 0;
if (tcsetattr(FD, TCSANOW, &attr) == -1)
{
return 0;
}

RTS/CTS:

int status;

if (ioctl(FD, TIOCMGET, &status) == -1)
{
	LE_DEBUG("ERROR: %s", strerror(errno));
}

if(status & TIOCM_CTS)
{
	LE_INFO("CTS ON");
}
else
{
	LE_INFO("CTS OFF");
}

if (level)
{
    status |= TIOCM_RTS;
}
else
{
	status &= ~TIOCM_RTS;
}
if (ioctl(FD, TIOCMSET, &status) == -1) 
{
	LE_DEBUG("ERROR: %s", strerror(errno));
    return 0;
}

#2

Hi,

Can you please explain how do you do to change RTS/CTS ? are you sure that RTS/CTS is activated ( stty –F /dev/ttyHS0 –a ) ?

You can activate hardware flow control by AT commands “AT&K3” and save it by “AT&W” OR “Stty –F /dev/ttyHS0 crtscts” .

BR


#3

I have disabled CRTSCTS intentionally (please look at my code attr.c_cflag &= ~CRTSCTS;). I don’t want hardware control, I want software control. FX30 and mangOH green are unable to read CTS status. I can set up RTS line on mangOH green but I cannot do it on FX30. Please look at source code in my post.

My post https://forum.mangoh.io/t/uart-rts-cts-control-problem/1446


#4

I use WP8548 on mangOH green. Legato 16.10.3.wp85-wp75-native-x86_64-201705311410

Legato on FX30S - 16.10.1.fx30_wp85-pdk-x86_64-201706301655

FX30S has got:

/sys/devices/platform/msm_serial_hsl.1/rs_mode

/sys/devices/platform/msm_serial_hsl.1/rs485_term

/sys/devices/platform/msm_serial_hsl.0/rs_mode

/sys/devices/platform/msm_serial_hsl.0/rs485_term

Where can I find documentation for these?

Is it possible, I cannot control RTS/CTS on FX30S because of wrong rs_mode setting?

(mangOH green does not have /sys/devices/platform/msm_serial_hs.0/rs_mode )


#5

It is continued on mangOH forum

https://forum.mangoh.io/t/uart-rts-cts-control-problem/1446/13


#6

HI
I close this topic as it is handled on Mangoh forum,
best regards,


#7

#8

instead of closng this topic, put it into solved for legato forum