I am having trouble communicating with my SSC-32U board while using a pair of XBee S2C Pro devices. One XBee is connected to my Windows PC while the other is connected directly to the SSC-32U. I have attached a picture of my setup. It’s not complicated.
I used the XCTU utility to configure my XBee devices and they communicate between themselves when they are both connected to the USB port of my windows machine using XBee Explorer devices. I have written python code using the XBee Python Library and this works fine. I have only tested the simplest read and write functionality, as well as network discovery and the things like that.
Now for my problem. I have worked on this for many hours coming at it from many different directions. I suspect the problem is in how I have configured the XBee devices but I just don’t know. The following code snippet captures the issue:
This works perfectly up until the query in the third last line. My servos move as expected. However, I’m not sure if the send_data command is received at the far end because the read_data command times out. This is just an example of my problem. To summarize:
I can write to the XBee connected to my computer, and the XBee connected to my SSC-32U receives the information perfectly and executes the command. However, the XBee on the SSC-32U never responds by sending any data back.
By the way, if I remove the XBee devices and connect through USB directly to the SSC-32U, the queries are always answered.
Let me know if you need any additional information.
thanks!
Lets see if we can figure this one out…
First, we should go over some assumptions about the situation:
Both XBee carrier boards are working and configured for 9600 baud rate. They are also configured to the same network. When used on a USB breakout with a XBee socket they can communicate with each other (how is that verified? Putty or some other terminal utility connected to each virtual port?)
The SSC-32U is powered appropriately.
The XBee on the SSC-32U can receive commands and transfer them successfully to the SSC-32U. This is confirmed by the RC servomotor on channel 1 moving from said commands.
When trying to read a reply from the SSC-32U to a query (“Q” command), no reply is obtained (timeout after 2 s ?).
Here’s a few ideas to try out and see if you get different results:
After line response = device.read_data(timeout=2), add another command to send out, such as #1P1500T1000 and see if the RC servomotor on channel 1 moves as expected.
Swap the two XBees from SSC-32U and USB adapter. Try the sample code again and see if that changes the results.
Check in XCTU the following settings: PAN ID, channel, source and destination (and any other addressing related settings). What are the values currently set? Please post screenshots for each.
With XCTU can you use the XBee on the USB breakout board to detect the XBee on the SSC-32U? If so, please post a screenshot of this.
With XCTU enter the “terminal” mode so you can send and receive commands from your USB breakout XBee and send a few commands to control the RC servomotor on channel 1. Does it moves as expected? If this works, then send a few query commands such as “VER”, “Q”, “VA”, etc. and see if you receive replies in the XCTU terminal interface.
Please let me know if I made any false assumptions (or forgot something important! ) and if I didn’t (and everything seems complete) try the 5 steps above and post your results.
I started addressing the points within your response and it gave me a couple of ideas to try. It turned out that this was all that was required. I had set up my XBee devices in API mode so I could use the digi-python libraries. Once I converted them to AT mode, all was well. Everything now works as expected.
Can you confirm for me that the XBee devices must be operated in AT mode? If so, I’ll quit trying API.
I have not personally used the API mode in any of my projects, so I couldn’t say. It may be possible that it works in API mode (clearly you were able to send data to the SSC-32U properly) but maybe some settings / methods were not setup right for it to allow receiving the data back.
I recommend that you look online for more examples. I have a strong feeling it should work but you are simply missing a small detail.