Finally AttoDuino connected with Linux? Sometimes, yes!

As I wrote back im May 2015, I couldn’t connect to AttoDuino using Linux (AttoDuino Getting started). In the past months I browsed the internet a lot, but without finding anything helpful. As it seems the Bluetooth stack’ documentation can be improved a lot …

So a sat again on my laptop and tried my luck again. After reconsidering the steps in my old post, I turned Bluetooth on and tried this command as root (address and channel I knew through bluetoothctl and sdptool search SP):

# rfcomm connect /dev/rfcomm0 00:04:3E:08:7B:69 1
         ^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^
         command    device    bluetooth address channel

In return I got this on my screen:

Connected /dev/rfcomm0 to 00:04:3E:08:7B:69 on channel 1
Press CTRL-C for hangup

Well I thought that looked promising, no errors and such!

Attoduino was already flashed with this small sketch (using Windows, as I described in my initial post):

#include <AttoDuino.h>

#define PR(x) Serial.print(x)

void setup() {}

void testAnalogIn() {
  // set A11 as analog input
  pinMode(11, INPUT);

  // note, can use either "A0" or just "0" to refer to a pin
  PR( "BATT: " ); PR( 2.0 * analogReadVolts( A11 ) ); PR( "\n" );
  digitalWrite( RED_LED, 1);
  delay( 1000 );
  digitalWrite( RED_LED, 0);

void loop() {

Now I opened another console and entered a simple cat /dev/rfcomm0 as root and a long column of battery voltage values appeared:

BATT: 3.68
BATT: 3.77
BATT: 3.68
BATT: 3.68
BATT: 3.84
BATT: 3.69
BATT: 3.78
BATT: 3.78
BATT: 3.78

No need to recharge the LiPo yet 😉

So I gave it a try and started Arduino IDE. The IDE  sees the serial port but unfortunately I had a typo in a configuration file that caused an error. After correcting that, it connected to AttoDuino but only to the point where it erases the flash but it did not download the new code:

Application : /tmp/build8528236682300334749.tmp/AttoBluetooth.cpp.bin
Program Address: 0x2800
COM Port: /dev/rfcomm0
Baud Rate: 115200
Erasing Flash:
Failed to Send Download Command

The flash was actually erased: my test sketch was gone. That means that the basic connection works, so now I’m looking why it couldn’t send the download command.

Back to the start …

I re-flashed my test sketch through windows but couldn’t see any difference or information that I could use under Linux. I therefore tried my receipt above but only to find out, that it doesn’t work anymore 🙁

I have absolutely no idea what happened, but now when I try to connect to AttoDuino I get an error:

# rfcomm connect /dev/rfcomm0 00:04:3E:08:7B:69 1
Can't connect RFCOMM socket: Permission denied

Looking into my log files revealed that I get a kernel oops each time I try to connect …

To do

  • Find out why it doesn’t work anymore
  • Find the reason why sflash doesn’t work (and maybe try it with a replacement, i.e. lm4flash)