FX30 - UART on IoT expansion card slot

FX30 -- Legato programmable gateways

FX30 - UART on IoT expansion card slot

Postby RafalZ » Wed Apr 19, 2017 1:17 pm

Hello all,
How to set up UART on FX30 IoT expansion card slot in my own application ?
What I do wrong, still I have 115200bps linux console ?

I made AT command AT!MAPUART=17,1 by USB AT port.
In my Component.cdef file I added:
requires:
{
device:
{
[rw] /dev/ttyHS0 /dev/ttyHS0
}
}

UART initial code:

#define BAUDRATE B19200
struct termios newtio;
int tty_fd = -1;

bool serial_OpenPort ( void )
{
tty_fd = open("/dev/ttyHS0", O_RDWR | O_NOCTTY);
if(tty_fd < 0) {
return false;
}

bzero(&newtio, sizeof(newtio));
cfmakeraw(&newtio);
newtio.c_cflag = BAUDRATE | CS8 | ~CRTSCTS | CLOCAL | CREAD;
newtio.c_iflag = IGNPAR;
newtio.c_oflag = 0;
newtio.c_lflag = 0;
newtio.c_cc[VTIME] = 0;
newtio.c_cc[VMIN] = 5;
tcflush(tty_fd, TCIFLUSH);
tcsetattr(tty_fd, TCSANOW, &newtio);

write(tty_fd, "TEST", 4);

return true;
}
RafalZ
 
Posts: 2
Joined: Sun Aug 29, 2010 1:01 pm
Has thanked: 0 time
Have thanks: 0 time

Re: FX30 - UART on IoT expansion card slot

Postby RafalZ » Thu Apr 20, 2017 8:42 am

I have little progress, I find that the default on IoT expansion slot is connected with UART 2 then:

1) I chenged UART2 mode to: AT!MAPUART=17,2
2) In file Component.cdef changed to: [rw] /dev/ttyHSL1 /dev/ttyHSL1
3) In function: tty_fd = open("/dev/ttyHSL1", O_RDWR | O_NOCTTY);

Now I can send chars to the UART 2 and observe on Tx my sended chars, but the speed is incorrect is about 4 000 000 bps no 19200.
Unfotunetly I find next problem with GPIO service when I change UART 2 mode, my application report the error:

Jan 6 00:02:22 | gpioService[538]/sysfsGpio T=main | gpioSysfsUtils.c ExportGpio() 106 | Failed to export GPIO 47. Error Operation not permitted
Jan 6 00:02:22 | gpioService[538]/sysfsGpio T=main | gpioSysfsUtils.c gpioSysfs_SessionOpenHandlerFunc() 1061 | Unable to export GPIO gpio47 for use - stopping session

I finds some information on forum about muxCtrlService but I dont know how to use this on FX30 gateway
Please any help.
RafalZ
 
Posts: 2
Joined: Sun Aug 29, 2010 1:01 pm
Has thanked: 0 time
Have thanks: 0 time


Return to Programmable IoT Gateways

Who is online

Users browsing this forum: No registered users and 1 guest