After updating legato to version 19.11.5 my application stopped reading the serial port, following code used:
const char *serialPort = "/dev/ttyHS0";
int port = le_tty_Open(serialPort, O_RDWR |O_NOCTTY);
le_tty_SetBaudRate(port, LE_TTY_SPEED_9600);
le_tty_SetRaw(port, 1, 2);
//le_tty_SetFlowControl(port, LE_TTY_FLOW_CONTROL_NONE);
char *parity = "N";
le_tty_SetFraming(port, *parity, 8, 1);
do {
char buffer[1024];
int readSerial;
readSerial = read(port, buffer, sizeof(buffer)); // this line is stuck
Port permission is configured:
device:
{
// read and write acess to the UART2 port.
[rw] /dev/ttyHS0 /dev/ttyHS0
}
Does not generate any error in the log, it just gets stuck!
Has anyone experienced this problem?
Hi Anderson,
There was an update in the FX30 base release in which driver for UART1 was changed. The tty for UART1 is now:
/dev/ttyHS1
Please try changing to this tty.
Thanks,
Ian
The ttyHS1 port does not exist on the device:
`Feb 12 09:20:59 fx30s user.err Legato: =ERR= | supervisor[11868]/supervisor T=main | app.c
SetCfgDevicePermissions() 777 | Failed to set permissions (rw) for app 'fx30sSerialMqtt' on device /dev/ttyHS1'.`
The available port is still ttyHS0 according to the command below
root@fx30s:~# ls -la /dev/ttyHS0
crw-rw---- 1 root dialout 248, 0 Dec 31 1969 /dev/ttyHS0
I also tried to map ttyHS0 to ttyHS1, but it gets stuck in the read function
`[rw] /dev/ttyHS0 /dev/ttyHS1`
jyijyi
February 12, 2021, 1:48pm
4
Did you set the uart1 to be data mode in at!mapuart ?
You can also try to disable auto suspend mode before running your app
For reading data through the RS232 port, what is a valid UART configuration?
(Service to map to a UART)
• 0—UART disabled
• 1—AT command service (Note: Not available for UART2)
• 2–3—Reserved
• 4—NMEA service
• 5–15—Reserved
• 16—Linux Console
• 17—Customer Linux application
(Physical UART)
• 1—UART1 (Default)
• 2—UART2
jyijyi
February 12, 2021, 11:19pm
6
You should use
17—Customer Linux application