digidotcom / xbee_ansic_library

A collection of portable ANSI C code for communicating with Digi International's XBee wireless radio modules in API mode.
204 stars 116 forks source link

POSIX Samples - Configuration #13

Closed ericwilliamsneu closed 6 years ago

ericwilliamsneu commented 6 years ago

I"m attempting to test the POSIX library in an Ubuntu 16.04 environment using the atinter program. I'm able to build cleanly by running "make" in the samples/posix/ directory and an executable atinter binary is created. Upon running it, and entering /dev/ttyUSB2 (where the XBee radio is mounted), I get an "Error -110 waiting for query to complete." and the reported HV, VR, IEEE, and NET values are all zero. I am positive the device is functioning properly because I can communicate with it using minicom using that same /dev/ttyUSB2. Any advice?

tomlogic commented 6 years ago

Make sure you have the correct baud rate and the module is configured for API mode (ATAP=1). You might also want to make sure the flow control settings (DIO6 and DIO7) are enabled.

ericwilliamsneu commented 6 years ago

Still struggling with the same error. The following is the a log of the minicom console:

+++OK
ATAP
1
ATNI
BASE_STATION
ATD6
1
ATD7
1
ATBD
3

Anywhere else I can look?

tomlogic commented 6 years ago

And you set the baud rate to atinter for 9600 on the command line? I think it defaults to 115200. You could try xbee_term sample program to see if the library's serial routines are working correctly.

ericwilliamsneu commented 6 years ago

xbee_term does indeed seem to work. I really appreciate you taking the time to help me with this @tomlogic

tomlogic commented 6 years ago

You could do a clean build of atinter with XBEE_SERIAL_VERBOSE defined and you might get some clues as to what's happening with the communication. Which kind of XBee module is it?

ericwilliamsneu commented 6 years ago

XBee PRO SX on the Development Board. No change in behavior with rebuilt binaries with #define XBEE_SERIAL_VERBOSE included in atinter.c

ericwilliamsneu commented 6 years ago

Argh! Somehow I had ATAP2 set. ATAP1 with Hardware Flow Control now works! Thanks you again so much for your help.

tomlogic commented 6 years ago

ATAP2 requires escaping of certain characters, and I didn't write the library to support that. A big reason for that decision is that it simplifies moving serial data around. Glad you figured it out -- I was going to have you test in XCTU next.

qxy12 commented 5 years ago

Argh! Somehow I had ATAP2 set. ATAP1 with Hardware Flow Control now works! Thanks you again so much for your help.

My xbee module don't work, can you give me some advice? it shows this:(atinter) Waiting for driver to query the XBee device... Error -110 waiting for query to complete. XBee on /dev/ttyUSB0: HV=0x0 VR=0x0 IEEE=00-00-00-00-00-00 net=0x0000

help This list of options. scan Initiate active scan. quit Quit the program.

Initiating active scan...

when i revise the configuration as yours ,it is still not work.(ATAP2 ATD6 1 ATD7 1 ATBD 7)

tomlogic commented 5 years ago

You can try running xbee_term to see if you can send the escape sequence (pause 1 second, type +++, pause 1 second and hopefully see OK back from the XBee).

I assume your primary tests are with ATAP1 and not ATAP2, since the library does not work with ATAP2.

qxy12 commented 5 years ago

(1) As the condition of ATD6 1 ATD71, When I type +++.it response nothing. (2) As the condition of ATD6 0 ATD71, When I type +++.it response nothing, and then I type any button , it appears ok.

it shows as follows:

amov01@ubuntu:~/Desktop/github/samples/posix$ ./xbee_term /dev/ttyUSB0 115200 Simple XBee Terminal
CTRL-X to EXIT, CTRL-K toggles break, CTRL-R toggles RTS, TAB changes bps.
[115200 bps][set RTS][CTS cleared]
+++[cleared` RTS]OK

(3) There is a strange phenomenon,when I set ATD6(RTS)1, then I cant't scan the xbee module in XCTU. I must reset the module , then I can scan the module again and configure it.

ejurquet commented 5 years ago

I'm encountering the same issue. The following is the log of the com console :

+++OK
ATD61
OK
ATAP
1
ATBD
7
ATD71
OK
ATWR
OK

And then when using atinter, I get the following :

Connect to which device? /dev/cu.usbmodem14101
Waiting for driver to query the XBee device...
Error -60 waiting for query to complete.
XBee on /dev/cu.usbmodem14101: HV=0x0  VR=0x0  IEEE=00-00-00-00-00-00  net=0x0000
Can't display menu for this hardware/firmware combination.

Can you help me please ?

tomlogic commented 5 years ago

@ejurquet: If you enable XBEE_SERIAL_VERBOSE for your build, do you see any communication with the XBee module? If you run with ATD60 does it work (if so, there's a possible problem with your RTS wiring)? What is the hardware interface you're using to adapt the XBee module to a USB port? Does it include TX, RX, CTS and RTS connections?

ejurquet commented 5 years ago

@tomlogic Hello and thank you for your reply.

I get the same thing with verbose activated and ATD60, it seems there's no sign of communication.

Connect to which device? /dev/cu.usbmodem14201
Waiting for driver to query the XBee device...
Error -60 waiting for query to complete.
XBee on /dev/cu.usbmodem14201: HV=0x0  VR=0x0  IEEE=00-00-00-00-00-00  net=0x0000

Can't display menu for this hardware/firmware combination.

Valid command formats (AT prefix is optional, CC is command):

 [AT]CC 0xXXXXXX (where XXXXXX is an even number of hexadecimal characters)
 [AT]CC YYYY (where YYYY is an integer, up to 32 bits)
 [AT]NI "Node ID String" (where quotes contain string data)

xbee_frame_dump_modem_status: status: hardware reset (0x00)

To be precise, I'm using an XBee S6B Wi-Fi module with a wireless SD shield on an Arduino UNO.

tomlogic commented 4 years ago

Just a quick note that I've updated the POSIX serial driver. Please try the new code open new issues if you're still having serial problems.

And note to @ejurquet: I think you should be using the /dev/tty.usb... device instead of the /dev/cu.usb... device. And that xbee_frame_dump_modem_status indicates receipt of a good API frame.