Serial output all ÿ, but code was working before

I’m connecting a Venus GPS chip over UART to an Arduino Uno Rev 3.

Uno <-----> Venus
3.3v <-----> +
GND <-----> -
D2 <-----> TX

I’m using the following code:

#include <SoftwareSerial.h>
SoftwareSerial gps(2,3);
void setup() {
  Serial.begin(4800);
  gps.begin(4800);
}
void loop() {
  if(gps.available() > 0) {
    char c = gps.read();
    Serial.write(c);
  }
  if(Serial.available()) {
    gps.write(Serial.read());
  }
}

Now, this Venus chip has been a bit difficult at times. The manufacturer’s interface software is EXTREMELY buggy, and it can be hard to reset the chip’s settings, even harder to make it store them past a reboot. I’ve also got 2 of them, and I haven’t kept track well enough of which one has which settings.

That said, I’ve always been able to tinker around and determine what the GPS chip’s baud rate settings are. Once I determine that, I’ve been able to consistently and reliably get data to print out in my Serial Monitor.

This time, thought I’ve gone through the entire range of all baud rate settings I’ve used (4800, 9600, 19200, 38400, 57600, 115200), which includes the default factory setting (115200), but each and every time I load up the Serial Monitor, the only output I get is a huge, fast string of “ÿ” characters.

Before you ask, yes, I DO change the baud rate settings in my sketch each time I’m trying a different setting. I match the input (SoftwareSerial) rate with the board’s Serial rate and make sure that I change the baud rate on the Serial Monitor, too.

I know that the “ÿ” character is supposed to be the way that the Serial Monitor prints “-1”, (or maybe just -1), but my understanding was that my check for

if (gps.available() > 0)

would preclude return values of invalid data (-1).

More frustrating still, this is the first time in months that this hasn’t worked perfectly! It just doesn’t make any sense to me!

Does anyone see the flaw in my setup?

Ok, this is weird, so I wanted to post it here in case it might help others.

So, my entire setup is the GPS chip, an RN-42 bluetooth chip (from Roving Networks) and a couple of different boards. One of the Uno boards is being powered over USB from my computer (also serving as the COM connection), the other is being powered by a power cord from a RadioShack parts kit.

I noticed that my GPS board was getting power from the non-USB-powered Uno, so I pulled the RN-42 out of the setup completely and plugged the power cables for the GPS chip into the Uno that is getting power from USB. Immediately, it started working!

I'd love someone to explain what's going on to me! I was assuming that my Uno was able to regulate power and send a good 3.3v signal whether it's power source was from the USB port or from the power port. (I also tried serving the power through a Netduino hooked up to the power cord, with the same results). What gives?

So you were getting VCC from a board that was powered by a wallwart, but were trying to connect it to a different board that was getting USB power? I'm guessing the grounds of these two boards weren't connected?

try the read over a hardware serial and the write over the software serial.

Forgive my ignorance, but SHOULD the grounds be connected?

I'm a desktop/mobile programmer by trade, so I'm definitely not up on electrical engineering.

The basic problem I'm having is that I need to power 2 devices with 3.3V. When I tried to connect both to the same 3.3V pin on one board, it didn't seem to work. Not sure why, but my guess is that the voltage was right but the amperage (guessing here) was wrong/insufficient. Thus the attempt with 2 boards.

Do you have a suggestion (with explanation, if you don't mind) of how to get both accessories hooked up?

Thanks so much!!!

mbm29414:
Forgive my ignorance, but SHOULD the grounds be connected?

3.3V isn't an absolute value, it's 3.3V from some reference point, usually ground. If the two grounds are different, then 3.3V may be an entirely different energy level amongst the devices. Without the grounds connected it would be like trying to determine if somebody is taller than you while they are standing on a stool. If two devices are trying to communicate and are have separate power supplies, their grounds need to be connected.

The basic problem I'm having is that I need to power 2 devices with 3.3V. When I tried to connect both to the same 3.3V pin on one board, it didn't seem to work. Not sure why, but my guess is that the voltage was right but the amperage (guessing here) was wrong/insufficient. Thus the attempt with 2 boards.

You need to look up, or measure the current draw of the two devices that you are powering. You then need to make sure it's under the rated maximum of the 3.3V regulator.

So, it sounds like I could get my setup to work (using 2 Uno boards as power sources), as long as I connect the grounds between the boards. Am I understanding you correctly?

Can you give any additional explanation on why this is true? Thanks!

So, I tried it and it works! Connecting the ground between the two devices gets the entire system working as expected! Thanks for the lead. I'd still love to understand what's going on. Is it some sort of current leveling or something? It doesn't inherently make sense to me that connecting them up allows them to communicate better. I love to learn, so please instruct! (Seriously, I wouldn't even know how to google this topic, so you're like a gold mine to me!)

Device 1 is sending either 3.3V or 0V relative to its GND to Device 2. What happens when Device 1's GND is 5V higher than Device 2's GND? Device 2 will read 8.3V and 5V which would both be interpreted as HIGH. That is why the grounds need to be connected.