I believe the XCTU performs something magical while adding a radio module because I realized that my application programs (reading and writing) coded in C can work after the XCTU have added them.
I compared the USB file flags of my two programmable XBee S2Cs (/dev/ttyUSB0 and /dev/ttyUSB1) before and after the XCTU have added them in order to make sure that thay all are equal. They were equal but the XBees are unable to communicate before the XCTU have them added. Then, I added them to the XCTU (Shift+Ctrl+A), then they are able to communicate to each other. That’s why I believe the XCTU performs something else background and I want to know what it is.
Serial interfacing options are given below:
BD = 9600
NB = No Parity
SB = One stop bit
RO = 3
D7 = CTS flow control //I tried Disable as well but no change
D6 = Disable
AP = Transparent mode
AO = Native
To clarify the question, I give the port opening and port initializing codes below:
int open_port(){
int fd;
fd = open(“/dev/ttyUSB0”/or /dev/ttyUSB1/, O_RDWR | O_NOCTTY);
// fd control code
return fd;
}
int initport (int fd){
int portstatus=0;
struct termios options;
memset (&options, 0, sizeof options);
//some control code
if(cfsetispeed(&options, B9600)<0 || cfsetospeed(&options, B9600)<0){
//error code
}
options.c_cflag &= ~PARENB;
options.c_cflag &= ~CSTOPB;
options.c_cflag &= ~CSIZE;
options.c_cflag |= C8;
options.c_cflag &= ~CRTSCTS;
options.c_cc[VMIN] = 1;
options.c_cc[VTIME] = 0;
options.c_cc[VSWTC] = 'p';
tcflush(fd, TCIFLUSH);
if(tcsetattr(fd, TCSANOW, &options) == -1){
//error code
}
return portstatus;
}