Alt. bootl. Ard.BT works but can't upload anymore

Hi all,

In an attempt to reduce the erratic and too large latency’s of the ArduinoBT I was adviced to alter the configuration of the Bluegiga on board the ArduinoBT (by Mikko from Bluegiga). I figured out that to do that I had to change the bootloader and I did. And… It worked. The Arduino is now a master device and it looks for connection with the computer by itself. Only problem… I cannot upload anything new anymore to the arduino. It now continuously runs the bootloader program and that is not very interesting.

I used Arduino0011 to upload the bootloader and thusfar this always worked fine.

The bootloader code I used is that of Massimo Banzi with a few alterations. These alterations are highlighted in bold in the code.

Resetting the board and uploading the code normally goes flawlessly. But now I get the following message:

Binary sketch size: 2864 bytes (of a 14336 byte maximum)
avrdude: ser_open(): can’t open device “/dev/tty.ARDUINOBT-BluetoothSeri-2”: Resource busy

Sometimes I also get a pop-up window:
A bluetooth failure has occurred
Failed to open an RFCOMM serial channel.
Check if authentication needs to be enabled in your device.

In the bluetooth preferences panel of my MACbook I can see that the device is connected but if I want to set up the device as a new device it is not found.

This are the added and altered lines of the original code:

Serial.println(“SET CONTROL AUTOCALL 1101”); // The device starts sending to find a paired device.
Serial.println(“SET BT PAGEMODE 0 2000 1”); // 0 == Set device to master
Serial.println(“SET BT SNIFF 2 2”); // This enables sniff power saving mode, but when used with minimum
// parameters it actually reduces the latency down to ~10ms.

The last line has already worked fine.

Does anyone know how I can talk with my Arduino again?

Help is much appreciated, best, Hans.

/* Arduino BT Configuration File  Feb 05 2007
* ------------------
* Upload and run this file <<once>> to configure the name or other variables of your BT module.
* Don't forget to reset your module so that the new commands are executed.
* ------------------
* Massimo Banzi
*/

int LED = 13;                                     // select the pin for the LED
int RESET = 7;                                    // BT module uses pin 7 for reset

void setup() {
  pinMode(LED,OUTPUT);                            // declare the LED and BT RESET pins as output
  pinMode(RESET,OUTPUT);  

  Serial.begin(115200);                           // connect to the serial port

  digitalWrite(RESET, HIGH);  
  delay(10);
  digitalWrite(RESET, LOW);
  delay(2000);

                                                   // the following "SET BT" commands are one-time commands 
                                                   // that only need to be uploaded to your BT module and run 
                                                   // when you want to change the BlueGiga's configuration.

    Serial.println("SET BT NAME Arduino_BT");      // you can change the name of your module here. 
                                                   // No spaces allowed in the name; names can be up to 256 charcters.


    Serial.println("SET BT AUTH * 12345");         // 12345 == 0 to 16 digit Bluetooth passkey/PIN code

//  Serial.println("SET BT AUTH * 987654321");     // example


                                                   // And now the tricky configuration commands. 
                                                   // Change these only if you know what you're doing. 
                                                   // See the IWRAP manual for details.

  Serial.println("SET CONTROL BAUD 115200,8n1");   // set the BT module serial rate to 115200. Don't change this.

  Serial.println("SET CONTROL AUTOCALL 1101");     // The device starts sending to find a paired device.

  Serial.println("SET BT PAGEMODE 0 2000 1");      // 0 == Set device to master
                                                   // 2000 == 5120ms timeout
                                                   // 1 == iWRAP is connectable every 1.28 sec

  Serial.println("SET BT ROLE 0 f 7d00");          // 0 == allows master-slave switch when calling; 
                                                   // f == enable sniff, park, hold and role switch modes; 
                                                   // 7d00 == keep connection  alive 20 seconds
  
  Serial.println("SET BT SNIFF 2 2");              // This enables sniff power saving mode, but when used with minimum
                                                   // parameters it actually reduces the latency down to ~10ms.

  Serial.println("SET CONTROL ECHO 0");            // don't echo back module commands

  Serial.println("SET CONTROL ESCAPE - 00 1");     // - == character to escape from comand mode to data mode; 
                                                   // 00 == DTR bitmask; 1 == return to command mode when DTR dropped


}

                                                   // and now a few blinks of the  LED, 
                                                   // so that we know the program is running.

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

Hi all,

I still have the same problem. If somebody can please set me in the right direction.. I already bought a mini to USB serial adapter. I can connect to the serial port. Both through the Bluetooth and through the serial pins I can see that the program is working (serial monitor), but I can't sent any command to the ATMEGA chip. I get mostly programmer not responding back when I try to upload something to the ATMEGA or out of sync etcetera. The "ciao" in the above code comes through clearly so I think my connection is good.

Should I disconnect the Bluetooth module? How can I do that?

Is there some kind of abort command that I can sent through the serial monitor of the ARDUINO0011 programmer?

I am stuck here.......

Best, Hans.

hi all,

I have similar problems with BT.

My best solution up to now is: 1. Deinstall the bluetooth module in windows. 2. Via ICSP I uploaded the software of the ATMEL for the BT bluegiga module, to set its properties. I have inserted in the software a RESET command which is proposed by the documentation of the iWRAP. I suggest that the PIN7 is not needed?. Run once. 3. After this I uploaded the bootloader again on the ATMEL 4. Then disconnect ISCP. Reconnect Windows with BT module by searching for it. Normally it adds automatically two COM Ports.

best andi

Hi all,

You still owed my solution of the ArduinoBT problem I had.

In the end it turned out to be quite simple.

I borrowed an USBtinyISP. Anyway, a parallel programmer of sorts that is supported by the Arduino program should do the trick.

I uploaded the sketch!!! that is named ArduinoBT bootloader from Massimo but is not real bootloader code, but should be named BlueGiga initialisation sketch or something like that. In that sketch I added one command:

SET CONTROL AUTOCALL.

This command makes sure that when the BlueGiga chip on the arduino board is in Autocall mode it is turned off!!!*

To upload a sketch using a parallel programmer you have to change the preferences.txt file in the Arduino folder (MacOSX). Change ‘upload.using=bootloader’ into ‘upload.using=name of your programmer’. Be sure to do that after you quit the Arduino program.
It did not work at first. But after using only lowercases in the name (‘usbtinyisp’) it went flawlessly. You don’t have to use the reset button on the arduino for uploading with a parallel programmer.
After that you can upload the normal bootloader with the parallel programmer as well, change the preferences.txt back to its original and your ArduinoBT can be programmed in the normal way through the bluetooth serial port.

  • I think the command “SET CONTROL AUTOCALL” should be part of the normal bootloader code for the ArduinoBT
    (now it is only “SET BT PAGEMODE 3 2000 1” and “SET BT ROLE 0 f 7d00” that are part of that code) . (I tried to add but I have not had succes with compiling the c-code into HEX thus far).

Hi all,

@Hans_Leeuw: thanks a lot for posting the solution. It helped to me get my board working again.

However, for me (using Win7) it was not necessary to modify the preferences.txt. So, following steps:

1)Just connect the Arduino BT with the USBTinyISP AVR programmer. 2) Then, open in Arduiono IDE the BT initialization code from Massimo (link see next post). 3)Select from menu: Tools->Burn Bootloader-> w/USBtinyISP. 4)Then below a message will appear that the burning process will take about 1 min; during this process the red LED will also blink indicating that the AVR programmer is busy. 5)1min passed...Done! (Maybe you need to restart, for me it worked without).

there we go: http://arduino.cc/en/Main/ArduinoBTInitializationSketch

(explaination) The post before was my first one in this nice forum. To put a link in a post requires to have posted at least one post.)