I've been messing around with Bluetooth Low Energy on a few projects lately. There's some fun stuff out there, but like a lot of embedded stuff it can be a bit tricky in a non-Windows environment (I run Linux whenever I can.)

The BL-600SA

One module I've come across is the Laird Technologies BL-600 Series. The BL-600SA is a complete, FCC module certified, Bluetooth Low Energy systems-on-a-chip. It costs $13US in single quantity at Digikey.

BL600-SA Modules

Inside the metal can the BL-600SA is actually a Nordic nRF51822 Cortex M0 microcontroller with built in Bluetooth Low Energy, bundled with its supporting components and a chip antenna.

Here's the breakout I made for my BL-600, a sort-of-prototype for a miniature BLE tag tracking application:

The terrible soldering and bent pins are included at no charge! The terrible soldering and bent pins are included at no charge!

"Blemiboard"

I haven't published this board design as it's pretty terrible, knocked together in an evening. Its mechanical dimensions only allow you to use either the coin cell battery or solder on the breakout headers, never both. Oops!

If you're looking for a nicer development board which breaks out the pads on the BL-600SA, fellow Melbournite Luke Weston has a very nice open source BL-600SA breakout board with onboard USB-Serial.

Luke Weston's BluetoothModule Luke Weston's BluetoothModule

Programming Options

Ideally, you'd program the BL-600 the same as its host nRF51822 processor. The in-circuit SWD programming & debugging interface of the nRF51822 is broken out on the module's pads. As far as I can tell if you have access to the (non freely available) Nordic SDK then you can program it directly.

For the rest of us, Laird provide a freely available (though proprietary) programming environment just for the BL-600 - "SmartBASIC". It feels a lot like a hardware vendor making software. The BASIC-derived syntax is weird and unforgiving. A shame, when there are options like Lua, MicroPython and Python-on-a-chip out there under permissive licenses.

The program used to interact with the BL-600 modules is Windows only. It hides the mouse pointer when in focus(!), uses contextual menus as its main interface, and feels like it was not usability tested on anyone outside the core programming team.

Despite the poor software environment, SmartBASIC does have many redeeming features. It allows you to program nearly all the available hardware (I couldn't seem to use the Watchdog Timer, which I think would allow the absolute lowest power consumption.) It has quite a neat "virtual filesystem" abstraction over the internal flash, allowing multiple programs and "data files" to be uploaded and downloaded independently over a serial link. The documentation for SmartBASIC is fairly comprehensive. The Laird people have been very friendly and helpful.

Introducing blutil.py

Although Laird's SmartBASIC software is Windows only, the actual BASIC cross-compilers are simple standalone command line Windows executables that the main GUI calls out to. I've written a small Python script "blutil.py" to allow the BL-600SA to be programmed in SmartBASIC from the command line. "blutil.py" can transparently use wine to run the compilers under Linux, and it should work with wine under OS X as well. At this stage it's only been tested in Linux.

To use blutil.py

  • Install Python 3 for your platform. {=html} </p>

  • Install Pyserial for your platform, as it's not part of Python itself. The Debian/Ubuntu package to install is "python3-serial".

  • Visit the Laird BL-600 series home page, click on the Software Downloads tab half-way down the page, and download "Laird UW Terminal version 6.93 including Xcompiler". EDIT: You now need to register and log in for this download, it used to be freely available.

  • Clone the blutil.py repository from github, or just save the single blutil.py file directly.

  • Unzip the contents of the zip file into the same directory as blutil.py. There should be a bunch of executables with names like "XComp_BL600r2_4E68_C700.exe".

  • Connect your BL600 serial port to your computer somehow.

  • Test blutil.py from a command line by listing any existing "files" stored on the module

<!-- -->
blutil.py -p /dev/ttyACM0 --ls

Replace /dev/ttyACM0 with the name of the serial port (something like COM3 on Windows.)

Output should look like:

Resetting board via DTR...
Listing files...

</code>

  • Create a new "SmartBasic" file, helloworld.sb, in a text editor:
<!-- -->
print "Hello World"
  • Compile, load and run the SmartBasic file:
<!-- -->
blutil.py -p /dev/ttyACM3 --run helloworld.sb

Output will look like:

Resetting board via DTR...
Detected model BL600r2 CA0D 1DA6
Performing compile, load, run for helloworld.sb...
Compiling helloworld.sb with XComp_BL600r2_CA0D_1DA6.exe...
Compilation success
Uploading helloworld.uwc as helloworld
Upload success
Running helloworld...
Output:
Hello world

Program completed successfully.

Yay!

  • Use --help to see the other options - there are options to just compile or upload files to the device, list files, remove files and "format" the uploaded files area. There are still lots of SmartBASIC "interactive commands" not supported, see the SmartBASIC documentation for details. Although a lot of them are probably better used from inside a terminal program. {=html} </p>

  • Find a bug? Please raise an issue. Have an improvement/fix? Pull Requests welcome!.

To branch out further, the Laid BL-600SA firmware download comes with many SmartBASIC example programs to work from. You have to register for that download, but it's also free.

Thoughts on “Laird BL-600 modules outside Windows