arduino BT Serial Comms issue

Hi, I'm using the following code on the arduino BT, with no bootloader:

===================================================================================== /* BT test 01 * ------------------ * Massimo Banzi * */

int LED = 13; // select the pin for the LED int RESET = 7;

void setup() { pinMode(LED,OUTPUT); // declare the LED's pin as output pinMode(RESET,OUTPUT); // declare the LED's pin as output Serial.begin(115200); // connect to the serial port digitalWrite(RESET, HIGH); delay(10); digitalWrite(RESET, LOW); delay(2000); Serial.println("SET BT PAGEMODE 3 2000 1"); Serial.println("SET BT NAME BLUETEST"); Serial.println("SET BT ROLE 0 f 7d00"); Serial.println("SET CONTROL ECHO 0"); Serial.println("SET BT AUTH * 12345"); Serial.println("SET CONTROL ESCAPE - 00 1"); printString("SET CONTROL BAUD 115200,8n1"); }

void loop () { digitalWrite(LED, HIGH); delay(100); digitalWrite(LED, LOW); Serial.println("ciao"); delay(1000);


Everything worked well the first time I ran it. I then changed the serial speed setting, to see how fast I can make it run: ....... Serial.begin(921600); .... printString("SET CONTROL BAUD 921600,8n1"); .................

O.K. These settings didn't work. I got garbage characters returned when looking at the output in hyperterminal.

Then, I tried to return to the original configuration. It does not work. Still getting garbage characters. I tried to change the name of the bluetooth device, however the only the original one comes up on BlueSoleil. This indicates that the bluetooth initialization code is not being correctly executed on the blueGiga WT11 .

Does anyone know if there is a way to set the blueGiga WT11 back to defaults? I can't see any information about it in the manuals. Does BlueGiga WT11 start with a default configuration or does it start immediately with the last configured settings? Again, the manuals are not very helpful.

Thanks and regards, Chris Spooner.


when you changed the serial speed in the above code to 921600, this got loaded on the Atmega and the first time it ran, it configured the Bluegiga module for that speed. the only way I can think of to correct this is to use the ICSP pins and an appropriate programmer to reload the default code and speed. Sorry, no happy answers. :(


Addding to daniel's correct answer,

You should have placed the Serial.begin(921600); after ("SET CONTROL BAUD 921600,8n1");

because when the module came up the speed was 115200 then you started communicating at 921600 which would have resulted in the BT module getting very confused.

if the board shows up still with the old name this is due to the fact that the BT software on your machine has cached the old name and hasn't updated it after you changed it.

if you go through the pairing process again you should see the new name.

try to reprogram the software that was working at 115200 , since you're not using a bootloader you can recover the board pretty easily


Hi, if only it was that easy!

I actually haven't explained what I was doing very well. I was setting 115200 before executing the initialization commands, then setting the bit rate again, to 921600 after the SET CONTROL BAUD command.

Serial.begin(115200); .... ("SET CONTROL BAUD 921600,8n1"); Serial.begin(921600); ...

I've tried all sorts of serial port settings without any success.

I checked whether the name of the device was being cached. Disconnect, unpair, search for BT devices. Still the old name of the arduino BT. This indicates that commands sent to the WT11 are not being executed.

Thanks and regards, Chris Spooner.


Serial.begin 115200 // this sets the Atmega Uart speed

SET CONTROL BAUD // this sets the Bluegiga speed

If you can still pair with the Bluegiga module, that is good news... can you figure out what speed you're communicating with it at? How are you programming the BT if you have no bootloader?


Hi, Yeah, I have no way of knowing what serial speed the WT11 is expecting at start up. I think what is happening is that it trying to run at a rate that is faster than what the ATMega168 & WT11 can handle. That is presuming that WT11 stores its configuration in its flash memory, which is retrieved after resets. Has anyone had any success in using the Arduino BT at higher baud rates?

I'm using avrdude with the bsd parallel port programmer to program the firmware. I didn't have much success with the BT bootloader programming over the BT virtual serial port (I had one successful programming per about 100). Similarly, usip didn't work for me either.

Regards, Chris Spooner.


I'm thinking that if you can delete the BT profile form your computer, and then find it and re-associate it, that means the Bluegiga is working properly... but at a speed that's too fast for the Atmega.

The answer would seem to be this: reprogram the Atmega with the set up program, withthe SET BAUD command and the Seria.Begin command both at 115K. Program this, reset the module and let it run once to configure the Bluegiga, and then the Bluegiga and the Atmega will both be running at 115K.


this is the first thing I tried once the BT serial connection wasn’t working properly. Trying to set everything back to 115200 doesn’t work.

I’d expect that there is some way of making the WT11 use default settings. I’m waiting to get access to the BlueGiga forums (takes 2 business days to get access).

Chris Spooner.


I'm having the same problem. I can reprogram the Atmega but I cannot change the Bluegiga configuration.

The question is how to restore WT11 default settings?


Hi, what I'm going to try next is building a programmer for the WT11. The BlueGiga tech support site is full of useful information and software for programming the WT11. The FAQ includes a description of what you need to to do to set the WT11 serial port back to defaults. The only problem is that I'll need to do some soldering on the arduino BT board. Not looking forward to such delicate work! At least there are already holes for the SV1 and SV2 though.

I'll let you know if I have any success.

Regards, Chris Spooner.

Hi, I've managed to get the WT11 module working with the ATMega again. I designed and built my own WT11 programmer using the PC parallel port. This programmer is simpler than the one shown on the BlueGiga site and uses more readily available components.


There is a tool provided by BlueGiga that allows you to view the WT11 configuration called PSTool. To my surprise, the PStool showed that the module's serial port speed was the default (115200), however correct comms was not occurring. The next thing I tried was using the iWRAP Update Client, which allows you to upgrade the WT11's firmware. After upgrading the firmware, the commands sent from AtMega to Wt11 started to work again.

I'd still like to run the Wt11 serial link at a higher baud rate. BlueGiga suggest that using CTS/RTS handshaking is required at higher baud rates. In fact they strongly recommend this at any baud rate, as it prevents data loss.

Regards, Chris Spooner.

Hi, I wanted to include a schematic of the programmer I built. How can I do this? I can include the img tags, but I can't find an opportunity to upload the image.

Thanks and regards, Chris Spooner.


I don't think you can upload in here... but one trick is to upload to the playground, and then link to the image there.


I've added an entry to the playground describing my WT11 programmer:

Regards, Chris Spooner.