How to send and receive data using UART2 (RS232) interface


#1

Hi
I am having mangOH green board (WP8548) with legato Developer studio 5
I want to send and receive some data through UART2 (from RS232 terminal)
Which api need to be used in Developer studio or any sample code for Uart2 communication ?


#2

Hi,
I am using le_tty api for uart communication.
out of these api, first I am using le_tty_open() method and then other api methods to set all baudrate, flow control, parity, stop bits etc.
after that I have used write method to send data and read to receive data.

But my application get stopped at

le_tty_Open("/dev/ttyHSL1",O_RDWR);

with error:

LE_FILENAME le_tty_Open() 231 | Error opening serial device ‘/dev/ttyHSL1’: No such file or directory

I have also tried with /dev/ttyAT , but same error.
I have also tried below command on terminal and then executed application, but same error persist.

echo -e “AT!MAPUART=17,1\r” > /dev/ttyAT
reboot

where I am doing wrong ? please suggest me solution


#3

Hi @rups

If you’re running the app as ‘sandboxed’, you will need to request read/write acces to the device in your .adef file.

requires:
{
    device:
    {
        // read and write access to the UART2 port.
        [rw]    /dev/ttyHSL1   /dev/ttyHSL1
    }
}

Alternately, you can try running the app unsandboxed:

sandboxed: false

Cheers,
Raf


How to configure my component to access le_tty functions?