TinyCircuits Forum

TinyCircuits Products => TinyDuino Processors & TinyShields => Topic started by: mestrada on June 12, 2014, 08:43:42 PM

Title: Bluetooth Module -- receiving garbage on serial port
Post by: mestrada on June 12, 2014, 08:43:42 PM
Having some trouble with the Bluetooth module, despite it being significantly more straightforward than the BLE shield.

I am paired and connected between my TinyDuino Bluetooth shield and my Macbook. This shows up on my laptop, and I can connect through the Arduino IDE serial port. The TinyDuino receives my keystroke from the computer, as indicated by LED blinks. However, the "Hello World" I try to print from the TinyDuino in response comes back as nonsense.

Pitfalls that I've ruled out:

I've already tried on the same setup on a Windows machine, complete with an explicit Bluetooth 2.1 dongle and third party serial monitor. It came out to the same result. If I had to guess, I suspect some baud rate mismatch--though this seems hard to mess up with a simple "  Serial.begin(57600); " command.

Any tips on what to check next?

Cheers,
Matt
Title: Re: Bluetooth Module -- receiving garbage on serial port
Post by: wymiata3 on June 16, 2014, 02:07:00 PM
Hello there,
For the past few days I wasn't able to sleep properly cause either my InputStream would freeze or it would give me garbage...
At this point I'm powering TinyDuino from PC, and serial communication speed of 9600.

With the code below I'm still getting some errors here and there like:
"test;test;test;ttst;test;;test;;testest;..."
but it's not garbage anymore. YMMV tho. I'm going to add some CRC on TinyDuino's side.

Hope this helps in any way,
w3

Code: [Select]
void setup()

  Serial.begin(9600);
}

void loop()
{
  Serial.write("test");
  Serial.write(";");
  delay(200);
}
Title: Re: Bluetooth Module -- receiving garbage on serial port
Post by: mestrada on June 17, 2014, 12:53:36 AM
Problem solved, thank you wymiata3! My Bluetooth serial communication is now up and running by switching to a baud rate of 9600.

Very misleading, considering the Using Bluetooth TinyShield page explicitly instructs:
Quote
By default, the Bluetooth TinyShield will power up at 57600 baud, so the TinyDuino processor needs to be configured at this baud rate in order for communications to work.

My board is a Rev2, for what it's worth. Seems that it powers up to a baud of 9600.
Title: Re: Bluetooth Module -- receiving garbage on serial port
Post by: Pratip on June 19, 2014, 06:00:09 AM
Hi,
I am trying to use tinyduino bluetooth module for sending EEG data, but if I use any baud rate other than 9600 for sending data (as baud rate 9600 is too low), it receives garbage values in the PC. Any idea how to use baud rate higher than 9600?

Regards,
Pratip.
Title: Re: Bluetooth Module -- receiving garbage on serial port
Post by: Pratip on June 20, 2014, 03:45:20 AM
Hello,
I solved the problem, the GPIO pin 7 was pulled high by a 1K resistor(R4), which defaults the baud rate to 9600 regardless of the baud you provide.
If you want to use the software selected baud rate, disolder the Resistance R4, and it will work with whatever baud you give.

Regards,
Pratip Ghosh.