Pages: [1]   Go Down
Author Topic: Bluetooth Communication errors  (Read 446 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am working on a project to get the bluetooth to accomplish tasks when it determines there is a trusted device within range (hopefully using the rssi feature of the radio).  We tried to load this simple program on the board to get the microcontroller to read info from the radio.
Code:
/*
 * Blink
 *
 * The basic Arduino example.  Turns on an LED on for one second,
 * then off for one second, and so on...  We use pin 13 because,
 * depending on your Arduino board, it has either a built-in LED
 * or a built-in resistor so that you need only an LED.
 *
 * http://www.arduino.cc/en/Tutorial/Blink
 */

int ledPin = 13;                // LED connected to digital pin 13nt
int digiIn = 12;
int RESET = 7;
int incomingByte = 0;      // for incoming serial data
void setup()                    // run once, when the sketch starts
{
  pinMode(ledPin, OUTPUT);     // sets the digital pin as output
  pinMode(digiIn, INPUT);     // sets the digital pin as input
  

  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.

                                                   // ok. First, the easy to change configuration commands:

  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 NAME KarlMarx");        // example


    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 BT PAGEMODE 3 2000 1");      // 3 == IWRAP visible and answers
                                                   // 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 CONTROL CD 80 0");           // Carrier Detect IO7 goes high
  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
}

void loop()                     // run over and over again
{

  if (Serial.available() > 0) {
            // read the incoming byte:
            incomingByte = Serial.read();

            // say what you got:
            Serial.print("I received: ");
            Serial.println(incomingByte, DEC);
  }
}


when we tried to use the serial monitor we get this error

java.lang.NullPointerException

      at processing.app.Serial.write(Serial.java:453)

      at processing.app.Serial.write(Serial.java:476)

      at processing.app.EditorStatus.actionPerformed(EditorStatus.java:521)

      at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)

      at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

      at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

      at java.awt.Component.processMouseEvent(Unknown Source)

      at java.awt.Component.processEvent(Unknown Source)

      at java.awt.Container.processEvent(Unknown Source)

      at java.awt.Component.dispatchEventImpl(Unknown Source)

      at java.awt.Container.dispatchEventImpl(Unknown Source)

      at java.awt.Component.dispatchEvent(Unknown Source)

      at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

      at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

      at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

      at java.awt.Container.dispatchEventImpl(Unknown Source)

      at java.awt.Window.dispatchEventImpl(Unknown Source)

      at java.awt.Component.dispatchEvent(Unknown Source)

      at java.awt.EventQueue.dispatchEvent(Unknown Source)

      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

      at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

      at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

      at java.awt.EventDispatchThread.run(Unknown Source)
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

In addition to this when we try to reprogram the part we get this error

Binary sketch size: 4424 bytes (of a 14336 byte maximum)


 -> /dev/com20
Error: No such file or directory

The software also gives us tons of problems trying to choose the correct port number.  The board still shows that it is properly connecting to the computer we are working on.  Anyone have any ideas of how I could fix this and get our board programmed again?  Hopefully without the use of a hardwired programmer (btw why doesn't the arduino have a usb line in addition to BT to program it that would have been a much stronger system, especially for problems like this)
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 11
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Does your BT connection show up in the device manager as com port 20?  What kinds of problems do you have trying to choose the port number?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so basically, we have uninstalled our bluetooth connection and reinstalled  a couple times trying to fix this problem.  Whenever we did this we tried different ports.  At that time it was port 20.  But it gave the same error message no matter what port we tried.  I think we tried like 16 18 and 20 at the time.

I pretty much had to manually set the port number in the preferences file because it would either not show up when trying to choose from the tools menu, or show up shortly then dissapear when we tried to upload our sketch.
« Last Edit: December 12, 2007, 03:49:05 pm by chito » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

does anyone have any ideas on what might be causing this problem, I am running out of ideas and need to get this board up and running for my senior engineering project.  Thanks
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Used a lower COM port for programming, and everything ran smoothly.  I'm ordering an ISP though.  The reliability of the bluetooth programming is not what it needs to be, and I would like to mess with the bluetooth settings, and with an ISP i won't have to worry about losing the BT functionality.  Why wasn't the BT given a USB interface for programming, and the bluetooth just used as an added feature to the system? instead of a replacement?
Logged

Pages: [1]   Go Up
Jump to: