I’ve had an on-going problem getting these two devices to play well. I’m likely missing something basic, but need pointed in the right direction. I just purchased a new device of each to be sure nothing is wrong with the hardware, but I’m having the same issues. I’ve configured the RN-XV countless times via a USB cable, so I’m very comfortable with the settings.
I’d like to simply send serial data from the Fio to the WiFly device and thought I could do so simply via Serial.print statements. In fact, I had hoped I could create a simply Arduino program to put a basic configuration on the RN-XV in the same fashion, but with no luck. In the long run, I want to programmatically control the RN-XV so I can get to its real time clock and then use the time to update a web service. All in all, it’s a pretty simple concept, but…
I have a tried the simple following program, but to no avail. Ironically, snippets of this code will work at times in other programs, so that makes it even more confusing.
The three $$$ should put the device into CMD mode. The following lines should set the SSID, password, save the config and reboot it. All this works via a breakout board and FTDI cable. Is there something I further I need to do within the Fio code/hardware so the two will talk?
Thanks for any guidance!!!
void setup()
{
Serial.begin(9600);
delay(500);
Serial.print(“$$$”);
delay(100);
Serial.println(“set wlan ssid mywirelessssid”);
delay(100);
Serial.println(“set wlan pass ********”);
delay(100);
Serial.println(“save”);
Serial.println(“reboot”);
}
void loop()
{
}
So…it turns out there really is no problem with these two playing well together if you realize:
-
The XBee socket is accessed via Serial1, not Serial. I had tested this proposition earlier, but was fooled by the second issue. Also, it’s not documented anywhere I can find above in the product description - something I’ve suggested Sparkfun may want to consider. Based upon reviewing these comments as well as the ones in the forum, lots of folks have stumbled on this issue when trying to talk to Xbee socket devices of various flavors.
-
When putting the WiFly RN-XV into command mode, provide sufficient time for the commands to execute and respond. Once I allowed 1 second to elapse after each sent command before reading any output from the WiFly device, I was in great shape.
I hope this feedback helps someone else facing the same apparent dilemma.
On a final note, Sparkfun Tech Support was very helpful in working through the issue with me via email. My thanks in particular to Michelle who even took time to mock up what I was attempting and came to the same conclusion, coincidentally at just about the same time.
Hi, thanks for posting about your troubleshooting experiences!
I’m in a very similar spot, and wondering if you could please provide some additional detail about “Serial1” - I can’t find any mentions of this in the FIO documentation, so I’m assuming you just set up a SoftwareSerial instance using two other pins.
However, I really thought that the TX and RX pins on the xbee port (that we’re plugging RN-XVs into) were the same as digital pins 0 and 1 (ie, the standard Serial, not SoftwareSerial, ports).
Could you please let me know what I’m missing here? At present, I’m able to power up the device and get it into a mode where the WiFly board slowly blinks D1 green (which I think means that it has an IP address) - however, no data is being sent from my board, so I’m wondering what is going wrong…
Thanks for any help or insight you can provide!
AKA
Hi, I’m not the OP, but I can answer your question.
The Arduino Fio v3 uses the ATmega32u4, which unlike the ATmega328 on the Uno, has multiple Hardware Serial pins. So the ‘Serial1’ is a HARDWARE serial, not software serial. So you just add ‘1’ after ‘Serial’ in your code.
This is the same how the Arduino Leonardo works, as well as the Mega. Check those out if you are unsure about Serial1,etc.