Elastic Sheep

Because elasticdog was already taken

Elastic Sheep header image 1

Bluetooth module firmware dump

June 28th, 2012 · Uncategorized

With a parallel-SPI adapter and the BlueSuite tools you can dump the firmware of your Bluetooth module.

Firmware dump

Firmware dump is done with the BlueFlash utility.

  • Stop the processor: if the connection with the module is successful, information about the device will be displayed.
  • Click Firmware ID to display the loader and stack version.

  • Click Dump to dump the content of the firmware. Two files will be created: a XPV file and a XDV file.

The Bluecore chip family uses a XAP2 processor, a 16-bit RISC core designed for use in ASIC, with a Harvard architecture (separate data and instruction bus).

BlueFlash outputs one file for the data memory (XDV) and one file for the program memory (XPV).

Module settings dump

The settings of the module are stored in a persistent key-value store accessible with the PSTool software.

  • Launch PSTool
  • Select SPI BCCMD / LPT1 for transport protocol

Once connected you can browse all the module settings (radio calibration, protocol stack and application parameters).

  • To dump the settings, click File/Dump and set a target PSR file.

The resulting file is a text file containing the value associated to each key in the persistent store. Here is for example the content of the application key USR1. This key contains my device current name “Shanghai” in ASCII.

Firmware update

The Bluetooth module firmware can be updated with the same tools: firmware download with BlueFlash and parameters update/merge with PSTool. The original XDV, XPV and PSR files of your module should be kept aside in case of a bad update. You should be able to restore your original firmware with those 3 files.

Also one must be careful with the radio calibration settings when updating a Bluetooth module. Radio settings are factory-calibrated to account for variability in the manufacturing process and thus are unique for each module. Overwriting those settings could really degrade the radio quality.

→ 1 CommentTags:

Bluetooth module parallel-SPI interface

June 28th, 2012 · Uncategorized

The BC417143-based module can be programmed through its SPI interface using a simple parallel port interface.

I am using the circuit published on Byron’s blog.

The SPI protocol is bit-banged on the parallel port of the PC. The 5V to 3.3V level adaptation is done using resistor dividers.

The SPI pins are accessed through a right-angle header on the bottom of the breakout board I designed.

The 3.3V power supply is supplied by a 3.3V Teensy2 that is also used as a serial-to-USB interface.

The difficult part is to find a PC with a parallel port :) . CSR also distributes an USB-SPI interface that should be more convenient with a modern laptop but that is also a little more expensive than a DB25 connector and some wires.

The Bluetooth module can now be programmed/configured using the BlueSuite tools. BlueSuite can be downloaded from the CSR support website after registration (Click Browse category tree…/Bluetooth PC Software).

→ 1 CommentTags:

New toy

June 18th, 2012 · Uncategorized

I have been interested by the FPGA technology for some time so finally here is a new toy that joins my workbench: a DE0-Nano board from Terasic. Smaller than an Arduino but with the same spirit of a platform opened to experimentation and not constrained by too much pre-wired peripherals. It’s up to you what you will do will the 40-pin headers.

What is on the board:

  • Altera Cyclone IV EP4CE22F17C6N
  • 32 MB SDRAM
  • EPCS16 configuration device
  • Integrated USB Blaster (Programmer and JTAG interface)
  • Some peripherals: digital accelerometer, A/D converter, EEPROM, some leds and switches

A simple board powerful enough to get started with soft-core processors. My plan is to test system design based on the LEON3 GPL core from Gaisler Research.

→ 2 CommentsTags:··

Babyphone hardware design

January 25th, 2012 · Uncategorized

Here are some details about the hardware design of my babyphone project.

Case reuse

One of the project goal was to reuse as much of the original speakerphone case as possible, including the power switch, volume control potentiometer, front leds and keyboard. I though that as the box already contained amplifiers circuits for the speaker and the internal microphone, I could try to reuse those as well and design my project around them…

I first poked inside the existing circuit to find a way to simply insert my circuit in the amplifier paths. But I quickly realize I would use more time trying to reverse-engineering the design instead of building my own.

Then the only constraint was to keep the existing PCB footprint to ease the integration with the original switches.


Here is the breadboard prototype in its final stage:

The design is build around an ATMEGA328 connected to an SD card through the SPI interface. Like in my previous audio player circuit, audio samples are played on a PWM output. The signal is filtered with an RC circuit and amplified by a LM386 to drive a 0.3W speaker.

The sound from the electret microphone is amplified by a simple transistor circuit found on Sparkfun.com and then connected to an ADC input of the microcontroller to be sampled.

The circuit is powered by a single 9V battery that provides a “high” voltage for the LM386 amplifier. A 3.3V regulator provides the digital power supply to the microcontroller and to the SD card.

I am using a 16MHz crystal for the extra speed bump despite the 3.3V voltage that would qualify this as “overclocking”.

High current draw from the SD card

One difficulty I met was having spike noise in the audio recorded by the microphone on the SD card. It appears the SD card draws a high level of current during write operations and this was affecting the stability of the microphone amplifier power supply.

Here is a capture of the signals on an oscilloscope while writing sectors on the SD card. The blue signal is the output of the microphone and the yellow signal is the input of the ADC pin:

I tried to add decoupling capacitors around the SD card VCC and around the microphone amplifier to no avail. One solution I finally found in an application note from Actel: use separate regulators for the digital and analog domains.

So I added a second 3.3V regulator to provide an AVCC power supply to my microphone amplifier and an AREF reference voltage for the microcontroller.

No more noise, problem solved.

Connection of the matrix keyboard

The keyboard of the phone is on a separate PCB including two leds. This keyboard is using a matrix configuration with 19 keys arranged in 5 columns and 4 rows. The handsfree key is surprisingly wired separately. Four separate wires allow to control 2 front leds, a green one and a red one.

The keyboard PCB was connected to the main PCB through to a 17-wire ribbon cable. I reuse this cable by soldering a 0.1” header on it.

Fitting the circuit inside the phone

Considering the project is a one-shot, I choosed to use veroboards to solder my circuits.

The big one will be the main board supporting the microcontroller, the SD card slot and a female header for the keyboard connection.

The upper-right board will be a power board supporting the two voltage regulator and the main power switch.

The lower-right board will be the analog board containing both amplifiers circuits and a slide potentiometer to adjust the speaker level. It will be connected to the microphone already molded into the case and from whom you can see the black and red wires on the picture.

The 9V battery will fit at the bottom of the case.

To ease the maintenance of the circuit, the boards will be connected together by wires secured by screw terminals.

Building the boards

Here is the power supply board:

The amplifier board connected to the power supply board:

The amplifier in action playing a sinus signal coming from my laptop audio output:

And here is the main board. The SD card slot is a holder for a microSD. It is soldered on a right angle pin header.

The main board has been cut to fit the prominent speaker magnet.

At the end everything fit together inside the case:

Wires everywhere. In fact I am not really a fan of veroboards. It is a little tedious to assemble without proper planning…

Hardware schematic

You could find the EagleCAD schematic along the source code files on the project repository: http://github.com/elasticsheep/babyphone

Coming next

The next post will details the software design side of the project. Stay tuned…

→ No CommentsTags:····

Babyphone audio playback

January 21st, 2012 · Uncategorized

The final circuit has been built inside the phone enclosure, including amplifiers for the speaker and the microphone.

Playback and record modules are developped an tested but the application code only supports playback for the moment.

Next I need to improve the matrix keyboard driver to allow multiple key detection to trigger the record of a new sound. The key combination should be hard enough to prevent the boy from erasing existing message.

→ No CommentsTags:·