Le 28/01/2016 18:49,
[email protected] a �crit :
Hello,
I am trying to develop wireless communication between host(Windows) & Target (QNX). I am using serial port RS232 to send data to host. RS232 is connected to Xbee for wireless communication. USB Xbee dongle is inserted on Host. So, Target send data to
RS232 serial port , it sends data to Xbee and Host receive data through USB Xbee . I also tried serial communication using RS232 cable. That also doesn't work.Now, I am trying to run following code on Target & send some data to host.
What kind of board uses QNX ?
---------------------------------------------------------------------------- #include <stdio.h> /* Standard input/output definitions */
#include <string.h> /* String function definitions */
#include <unistd.h> /* UNIX standard function definitions */
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <termios.h> /* POSIX terminal control definitions */ #include<sys/types.h>
#include<sys/stat.h>
#include<stdlib.h>
//'open_port()' - Open serial port 1.
int open_port(void)
{
int fd; /* File descriptor for the port */
fd = open("/dev/ser1", O_RDWR | O_NOCTTY | O_NDELAY);
if (fd == -1)
{
// Could not open the port.
perror("open_port: Unable to open /dev/ttyf1 - ");
}
else
{
printf("Port Opened\n");
fcntl(fd, F_SETFL, 0);
}
return (fd);
}
void close_port(int fd)
{
close(fd);
printf("Port closed\n");
}
int main()
{
int n, x, y;
char data[6];
n = open_port();
printf("File Descriptor for port is: %d\n", n);
x = write(n, "Ankur\r", 6);
if(x < 0)
fputs("writing failed\n", stderr);
else
printf("Total written bytes of data: %d\n", x);
y = 0;
while(y < 6)
{
y = read(n, data, 6);
printf("Bytes read: %d\n", y);
}
close_port(n);
return 0;
}
----------------------------------------------------------------------------
What error/behaviour do you have ?
I also use command "devc-ser8250", "ls /dev/ser*" on Target.
Please give the full command for devc-ser8250.
What is the output for ls /dev/ser* ?
On host side i am using "Serial Port monitor" software to check receive data. Unfortunately, i couldn't find anything on it.
Can you elaborate the procedure to help me in my project.
To eliminate problems, first use a direct link between host and device.
Once this works, then add xbee link between both.
Thanks in advance
Ankur.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)