UART_B/C Reading Failed

Hi guys,
I have connected EM358 Zigbee chip with the Colibri VF50 via UART.but there was colibri module unable to read the data from serial line.

Just Highlight what I did:

  1. EM358<----UART-B/C(X14)------>Colibri Module(VF50,Iris Carrier Board)

  2. I wrote the C code for the Opening file /dev/ttyLP2 and setting baud rate B115200.

  3. I used write system call and wrote the data onto the UART line and there was I have already putted code in EM358 chip for loopback mechanism.whatever you send to uart line you will get back that data.

  4. Read system call failed to read on UART line

so I am confused,where is exactly problem in that?

could you share helpful information regarding this issue.

C code snippet:


int main()
        char snd_buff[20]= "^KANJI~";
        char rcv_buff[30];
        struct termios tty;
        int fd;
        int flags = O_RDWR | O_NOCTTY | O_NONBLOCK;

        fd = open("/dev/ttyLP2", flags);
        tcgetattr(fd, &tty);

        tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;
        tty.c_cflag |= B115200;

        if (tcsetattr (fd, TCSANOW, &tty) != 0)
            fprintf (stderr, "error %d from tcsetattr", errno);
            return -1;


                printf("**************Hi I am sending data to EM358\n");
                printf("Write Bytes: %d \n and Write data: %s \n",write(fd,snd_buff,strlen(snd_buff)+1),snd_buff);

                printf("Hi I am reading data from EM358***************\n");
                printf("Read Bytes: %d \n Read data: %s \n", read(fd,rcv_buff,sizeof(rcv_buff)),rcv_buff);
        return 0;

Thank you :slight_smile:

Note that X13 and X14 on the Iris Carrier Board are true RS232, which means +/-13V and not TTL UART! I am not sure what serial interface the EM358 Zigbee chip requires, but quite likely that it actually requires TTL…

You can access all UART pins at TTL level on header X16. However, you should disable the RS232 transceiver if you use TTL UART on X16. The note in chapter 2.2.9 “STD/BT RS-232 header (X14)” of the Iris data sheet contains more information. To disable RS232 transceiver for the X14 pinheader, you need to drive SODIMM_104 low (Linux GPIO 66), e.g. using the sysfs interface:

echo 66 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio66/direction
echo 0 > /sys/class/gpio/gpio66/value

Hi stefan.agner,
You are right. EM358 serial UART connection with TTL logic.

Thank you :slight_smile: