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:
-
EM358<----UART-B/C(X14)------>Colibri Module(VF50,Iris Carrier Board)
-
I wrote the C code for the Opening file /dev/ttyLP2 and setting baud rate B115200.
-
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.
-
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:
#include
#include
#include
#include
#include
#include
#include
#include
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);
perror("fd");
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;
}
memset(rcv_buff,0x0,sizeof(rcv_buff));
while(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);
sleep(2);
}
return 0;
}
Thank you