Using Adafruit’s Bluefruit nRF52 Feather bootloader on a cheap chinese board.

I have one of these E73-TBB Test Board for an nRF52832 module. The board is only U$S10 and Ebay was handing out U$S5 off coupons, so it ended costing me the same as the bare bluetooth module. The board comes with a USB-to-serial converter, a couple of leds and a couple of switches, nothing too fancy. I don’t have a programmer for this board but I bought it anyways thinking that it could be possible to use with the Arduino environment.

E73 TBB Board with main components highlighted

The module itself is a E73-2G4M04S1B (for which there is a manual available) but there isn’t much information about the board. As a first step I had to figure it out how everything is connected, from that I got this schematic:

E73-TBB Test Board For nRF52832 schematic

The layout is quite similar to other boards like SparkFun’s nRF52832 Breakout or Adafruit’s Bluefruit nRF52 Feather. There is even a board whit the same module with the leds, switches and UART wired as a Bluefruit nRF52, this allows them to use Adafruit’s bootloader without any modifications. What I’m lacking is a switch on the reset line but that is not such a big isuue.

I started with Sparkfun bootloader whitout much luck, not sure what the problem was, and then with Adafruit’s bootloader. Thankfully the people at Adafruit have make it really easy to use it and modify it with a superb documentation.

E73 board coneected to a J-Link EDU through an adapter board we made at work.

The only files I had to modify is the Makefile (just to correct path to some tools) and the board.h file for the nrf52832 feather. In this last file you’ll find the definition of the pins used for the leds, switches and UART. So, It was just a matter of changing the values to match the wiring on my board.

Original and modified

Now, I can’t say the rest of the process went smoothly. I could flash the bootloader in the board (using a J-Link from work ūüėČ ) but the Arduino software didn’t recognize it whenever I tried to flash something on it.

I was trying different things until I found a sequence of events that make it work. You have the possibility to update the bootloader in Adafruit’s board in Arduino using a J-Link.

I tried that and worked great , but now I had the wrong bootloader in the board. I immediately flash the modified bootloader directly with the J-link

And that somehow made the trick. Not sure why this is, if somebody have any idea please comment.


Now I have a board “Bluefruit nRF52 Feather compatible”. To enter bootloader mode I’m currentely shorting the RST pin to GND with a cable while holding the DFU button. There are a couple of modifications that I migth make in the future to make things easier:

  • I’m using one of the buttons as DFU and the other one as FRST. This last one isn’t used that much, you don’t even have a dedicated button in the Bluefruit nRF52 Feather, so I might modify the PCB in order to use it as a RST button.
  • The Bluefruit nRF52 Feather also has the DTR line from the USB-to-serial converter wired thorugh a capacitor to the RST line, this way you can normally enter bootloader mode and flash new firmware whit out haveing to press buttons.


As massimiliano mentioned on the messages section there is a mistake in the image showing both board.h files, it should be 13 and 14 instead of 28 and 29 in the switch pins definitions.


I lost the files and repo so I repeated the process again. This time (as I mentioned to Norbert on the messages section) I used nRF Connect Programmer. Here is the updated bootloader, I interchanged the definitions for the pins, now SW1 is DFU, press it while connecting RST to ground and the device will enter bootloader mode (LED 1 with a slow “breath” pattern)


Freescale’s sensors breakout boards

A few more PCBs, this time for¬†Freescale’s sensors.


The MMA8451Q is a  low-power, three-axis accelerometer with 14 bits of resolution. It communicates over I2C,  has built in tilt/orientation detection and also tap detection.

To make the PCB I downloaded the Eagle files from Sparkfun breakout board and modified it to make it single sided. I had to add a couple of 0 ohm resistors as jumpers.

Freescale sensors

To test it I used Adafruit Library for Arduino



The FXOS8700CQ combines a 14-bit accelerometer and a 16-bit magnetometer. It also has some programmable acceleration event functions, like tap and orientation detection, and includes programmable magnetic event functions: Threshold detection, Vector-magnitude change detection, etc.

Freescale sensors

It  can communicate using i2c or SPI. I used this library to test it.



The MPL3115A2 is a pressure sensor that provides altitude data to within 30cm. It has a I2C interface and the outputs are digitized by a high resolution 24-bit ADC. The MPL3115A2  can measure:

  • Pressure: 20-bit measurement (Pascals)
  • Altitude: 20-bit measurement (meters)
  • Temperature: 12-bit measurement (degrees Celsius)

Freescale sensors

I also used Sparkfun’s Eagle files to make the board and I tested using Adafruit Library.


According to Google Maps the height where I live is 64.13 m. I was testing the device on a first floor, I¬†would say it’s pretty accurate.

Logic Level Converter

All this sensors are 3V devices. I tried first to connect them to a MSP430 Launchpad using Energia but I couldn’t make them work.

The I2C protocol defines a so-called repeated start condition. After having sent the address byte (address and read/write bit) the master may send any number of bytes followed by a stop condition. Instead of sending the stop condition it is also allowed to send another start condition again followed by an address (and of course including a read/write bit) and more data1.

Freescales’s sensors use this Repeated Start command and as I found out, Energia doesn’t support it. As I don’t have any 3.3V Arduino I needed a logic level converter.

I downloaded Sparkfun files for their  Bi-Directional Logic Level Converter and modified it to make it single sided. I used some 2N7002 transistors I had around.

Freescale sensors

EDIT 19/01:

As requested, here is the file for the MPL3115A2 breakout board. It is based on Sparkfun board but I changed the connector pinout in order to make it easier to design a single sided PCB.


1. Repeated Start Condition

Programando dispositivos HC08

Hace unos a√Īos (varios, unos 6….) consegu√≠ por medio del programa de Muestras Gratis de Freescale unos micros de la linea HC08. Comenc√© a investigar de que forma programarlos, que interfaz de programaci√≥n construir, que software utilizar, etc. En el proceso camb√≠√© la PC de esctitorio con XP por una notebook con Windows 7. Esto trajo varios probemas: en primer lugar, le√≠ en su momento que no iba a haber soporte del CodeWarrior (el IDE de desarollo de Freescale) sobre Windows 7, lo pod√≠a solucionar con una maquina virtual que corra XP, pero me parec√≠a medio engorroso.

Otro problema era la falta de un puerto serie en mi notebook. Tenía intenciones de utilizar la interfaz MON08 para la programación de los micros. Es una interfaz sencilla que requiere pocos componentes. Leí en su momento comentarios contradictorios acerca del uso de conversores Serie-USB.

As√≠ que los micros estuvieron juntando tierra todos estos a√Īos. Entre tanto Freescale (ahora NXP, si han habido algunos cambios…) di√≥ de baja la linea HC08.

Hace unas semanas me encontré de casualidad (no recuerdo que estaba buscando) con este post que explica como instalar CodeWarrior 6,3 en Windows 7 x64 bits. Seguí los pasos y en un rato estuvo andando sin problemas.

Comenc√© luego a buscar informaci√≥n relacionada al uso de conversores USB y encontr√© un par de post interesantes. Uno donde muestra una placa de desarrollo para micros HC08 y utiliza un FT232RL. Y otro donde se muestra un programador para micros HC08, de la familia JL y JK, y utiliza un conversor MCP2200. Este √ļltimo usaba¬†como software de desarrollo WinIDE.

Tambi√©n encontr√© este video en el que utilizan un conversor PL2303 para la programaci√≥n de un micro HC08, expec√≠ficamente un QY4. En este caso se usa CodeWarrior 6.3 en una m√°quina virtual y por alg√ļn motivo menciona que el puerto virtual creado debe ser el COM1.

Otro problema era la dificultad de conseguir donde vivo un cristal de 9.8304MHz, aunque seg√ļn este post ser√≠a posible utilizar cristales de frecuencias cercanas y m√°s f√°cil de conseguir, como por ejemplo 10MHz.

Comencé con unas pruebas sencillas en una protoboard. Armé el circuito que se muestra en el esquemático, para los 9V necesarios para entrar en modo programación (Normal Monitor Mode) utilizo una fuente externa. El microcontrolador es un MC68HC908JL8 y el oscilador es de 10 MHz.


Ac√° se puede ver el circuito armado en una protoboard.

Programming HC08 devices

Las primeras pruebas las hice con un PL2303. El conversor tenía asignado el COM44 y el software de programación no lo reconocía. Luego lo cambié al COM1, elegí un baudrate de 9600 y como interfaz  la Clase 3.


luego de conectar con el microcontrolador, el software pide resetear el procesador:


y después pide apagar y encender el microcontrolador:


El apagado del micro es necesario para pasar el chequeo inicial de seguridad y acceder a la memoria flash del microcontrolador.  Un simple reset no es suficiente; para pasar la verificación de seguridad es necesario forzar al procesador a pasar por un POR (power-on reset)1.

Busqu√© alg√ļn firmware que me permitiera probar el funcionamiento del programador y d√≠ con esta p√°gina. Tiene varios ejemplos para microcontroladores JL16 que son compatibles con el JL8, y utilic√© el jl16-0.c que simplemente cambia el estado de uno de los pines. La descripci√≥n en la cabecera del archivo menciona un per√≠odo de 4.5 microsegundos utilizando un cristal de¬†¬†9.8304MHz, como utilic√© uno de 10Mhz el per√≠odo que obtuve es ligeramente menor:


Entre los archivos que hab√≠a descargado¬†hace unos a√Īos¬†ten√≠a el esquem√°tico de un programador¬†HC908GS de la empresa Firtec.¬†Es un programador por puerto serie y agrega la circuiter√≠a necesaria para generar el POR mediante el software y as√≠ ahorrarse unos pasos durante la programaci√≥n. ¬†Este es el circuito que implement√© en la peque√Īa protoboard roja:


El software utiliza la linea DTR para controlar la alimentación del microcontrolador y ahora la interfaz que se debe seleccionar en el software es la Clase 1:

Sin título

Cambié el conversor Serie-USB. Utilicé un FT232RL soldado en una placa adaptadora que me permite acceder al pin DTR.

Programming HC08 devices


  • Es posible instalar y utilizar CodeWarrior 6.3 en Windows 7 x64 siguiendo estos pasos.
  • Es posible programar dispositivos HC08 con conversores Serie-USB¬†con¬†CodeWarrior 6.3 en Windows 7 x64.
  • Es posible utilizar un cristal de 10MHz.




INA219 Current Sensor DIY Breakout board

Another small board, this time for a INA219. The INA219 is a high-side current shunt and power monitor with an I2C interface.


For testing I used Rei VILO library with a MSP430G2553 and Energia, and I measured the power consumption for this simple circuit:

2 001-001

Nothing fancy, just a led and a resitor. The INA219 should measure around 9.6 mA and got this:


The current measurement is slightly off. I need to play a litlle more with the calibration routines.


SHT21S DIY Breakout board

I made a little board for a SHT21 humidity and temperature sensor from Sensirion.  There are several versions with I2C interface, PWM output and SMD/analog interface.

I’ve got the one with Sigma Delta Modulation (SMD) output, ¬†is a bit-stream of pulses; the more high pulses the higher the value in the full measurement range.¬†A¬†low-pass filter convert the pulse stream to an analog voltage signal.

It has a control pin (SCL) to select between humidity or temperature output. SCL high yields humidity output, SCL low yields temperature output.


I made a simple sketch in Energia to test it out using an MSP430G2553. P1.6 selects between humidity or temperature and P1.0 is used as the ADC input.


…and logged both temperature an humidity.

Sin título

That’s it, a simple and nice sensor…

DIY ez-FET lite…ghetto style

I have a few MSP430G2955 around but non of my Launchpads are capable of programming this MCU. Texas Instruments released a while back all the informtation needed to build the new ez-FET lite. The eZ-FET lite is a low cost USB-based on-board emulation solution for MSP430 microcontrollers. This debuger supports all MSP430 devices compatible with SBW programming and I could use it to program the MSP430G2955.

The hardware is based on an MSP430F5528 and I used a QFN version with an adapter board:



it ain’t pretty…

In order to program the MSP430F5528, I tried first using the FET-Pro430 from Elpotronic. I was able to flash the BSL firmware:


despite an error dialog about code size:


…then, I programmed the ez-FET firmware:


After reseting the programmer all the drivers were installed:


But every time I tried to program a device with CCS I would get this error message:


ok, fail…let’s start over.

According to this post the error might be caused by the the custom BSL portion of the ezFET firmware being not properly flashed.  I did read this other post in 43oh about flashing the firmware with MSP430Flasher, I just wanted to see if the Elpotronic software would work.

I tried ¬†to re-program the MSP430F5528 using MSP430Flasher but I get this “BSL memory segments are protected” error.


According to this post I have to add options to unlock  BSL memory as well as the INFO A memory. I added for that -b and -u:


Success!! At least the BSL.  Then I attemped a firmware update with MSP430Flasher:


More success!!! I should have tried this in first place…

Anyway, I tested the programmer with the old and beloved “blink” and It’s working. I still need to test the UART¬†interface but this should work as well.


Avalanche pulse generator- part 2

I build a more permanent version of the pulse generator with some changes. The comparator wasn’t working very well with the 1V reference I was using. I made some measurements with different voltage references and got this:

Vref Vfeedback Vout(measured) (R2/R1+1) Vout(calculated) Error[%]
0,282 1,1 76,8 69,03 19,47 -294,5
0,759 1,087 76,6 69,03 52,39 -46,2
0,953 1,092 77 69,03 65,78 -17,0
1,218 1,258 88,7 69,03 84,08 -5,5
1,243 1,283 90,3 69,03 85,80 -5,2
1,499 1,505 106,3 69,03 103,47 -2,7

The feedback loop was working and the converter regulating but the output value didn’t correspond to the one set it with the feedbacks resistors. The difference between the reference voltage (Vref) and feedback voltage (Vfeedback) is lower with a reference above 1,2V (another source of error is the lack of precision resistors in the feedback divider). and increasing the reference value gives a lower error (difference between the measured and the calculated Vout).  At the end I just put a potentiometer to regulate the reference and tweaked until the converter output was near 90[V].

I started with the oscillator


Then added the step-up

step up added

And test it

testing the step up

Added the voltage doubler

voltage doubler added

… and test it again‚Ķ

voltage doubler test

I made a mistake while connecting the oscillator to the step-up. I soldered a cable to the wrong output and was using the inverted signal with a short ON time and a longer OFF time. After changing the output the voltage increased a bit, but  not that much (something like 115[V]). Then soldered in the reference and the comparator.


Then I connected all together, put the resistor divider to get the voltage feedback and set it to 80V

dc-dc converter set it to 80[V]

Finally soldered the transistor, 50 ohm termination and BNC

Avalanche pulse generator

The board with the different blocks labeled,

Avalanche pulse generator

and finally made some measurements.

Avalanche pulse generator

The formula to calculate the bandwidth based on the rise time is BW=0.35 / rise time [ns], I measured somewhere near 2.5 [ns], but that is a bandwidth of 140 MHz. That’s a lot higher from what I was expecting (I have a DS1052E without the bandwidth hack, so it’s 50Mhz). I’m probably doing something wrong but I don’t know what…

Avalanche pulse generator- part 1

I wanted to make a fast pulse generator like the one designed by the great Jim Williams1. Unfortunately, the required chip for the high voltage power supply (LT1073) is not available where I live. I found several similar circuits using different approaches to generate the required voltage. I particularly liked the one in Dangerous Prototypes2,¬†in which an astable multivibrator made with transistors is used to drive a step-up and It got me thinking ¬Ņcould be possible to “make” the entire LT1073 with transistors?

I looked for the datasheet3 and found a block diagram of the device.


Figure 1. LT1073 internal block diagram.

Comparator A1 compares the feedback pin voltage (Fb) with the internal voltage reference. When the feedback drops below 212mV the comparator A1 switch on the oscillator. The driver amplifier boosts the signal level to drive the output NPN power switch Q1. The switch cycling action raises the output voltage and the feedback pin voltage. When the feedback voltage is high enough the comparator turn off the oscillator.


I made the oscillator with an astable multivibrator (like the one in DP). I opted for the version with waveform correction4.


Figure 2. Astable multivibrator with diodes for edge correction and a transistor to control it.

I added a transistor to control the oscillator. When the feedback voltage is lower than the reference the comparator goes low and the oscillator is activated in order to rise the output voltage. According to the datasheet the oscillator is set internally for 38¬Ķs ON time and 15¬Ķs OFF time. I calculated the resistors needed using a 1nF capacitor but later on I tweaked the values in the breadboard until I got close enough to the required ON and OFF time.


Figure 3. Oscillator output.

Voltage reference

For the reference I made a variable zener with a pair of transistors5.


Figure 4. Variable zener.

I set it to 1V and made some measurements to see how stable the reference was:

Figure 5. Reference voltage (yellow) with power supply variations (blue)

The measurements were done with the converter working making the reference voltage quite noisy. Without a 1uf capacitor between Vref and ground (not shown in the schematic) it looked even worse:


Figure 6. Voltage reference without the 1uf capacitor.

These are the measured values in a much compact graph:

Ref output_vs_vcc

Figure 7. Voltage reference output with variations in voltage supply


I build the simplest comparator I could find:


Figure 8. Comparator schematic.

For testing I connected the (-) input to a potentiometer and the other input to the oscillator output:


Figure 9. Comparator test setup.

Moving the potentiometer up and down changes the comparator output width:


Figure 10. The comparator output is the yellow trace, the potentiometer value is at the top left corner and the blue trace is the oscillator output.

It is not the best comparator you could find but it is good enough for this application. I’m not using hysteresis like the comparator inside the Lt1073 does.

Switching transistor

Tried first with a single BC548 but couldn’t get more than 30V, adding a 2N2222 in a Darlington configuration I could reach a little more than 50V:


Figure 11. Output Darlington switch.

I also added a diode-capacitor voltage step-up network (as in the original circuit with the LT1073) and this is what the final circuit looks like:


Figure 12. Complete schematic.

and the block diagram of my version:


Figure 13.

Then did some test to see if the whole thing was regulating properly and how the output changed with voltage supply variations.


Figure 14. Output (yellow) vs power supply (blue).

Again the values from the previous oscilloscope captures in a single graph:

HV output_vs_vcc

Figure 15. High voltage output from the converter with variations in the power supply. The converter is configured to output a little bit more than 82V.

I also made some captures of the output from the oscillator as the supply voltage decrease:

osc(blue)_HV output(yellow)_variable VCC

Figure 16.

It can be seen how the pulse trains increase with the reduction of voltage supply. With voltages lower than 1,7 V the converter can’t regulate properly.

I was able to source locally the 2N2369 used in the original application. I connected it in the protoboard to see if the converter could get it to avalanche. The blue trace (Figure 16) shows the voltage in the capacitor, it charges until the voltage is high enough to avalanche the transistor rapidly discharging and generating a fast rising pulse shown in the yellow trace.


Figure 17.

All this testing was done on the protoboard so is no surprise that the pulse looks like crap:


Figure 18. Collector capacitor discharge (blue) and pulse from the avalanche transistor (yellow). It can be seen that the breakdown voltage is around 67[V]

I used a 22pF capacitor but even without using one the parasitic capacitance in the protoboard where high enough to make it work anyway. Now I need to build a proper board.


1. Application Note 72, APPENDIX B, Measuring Probe-Oscilloscope Response
2. Avalanche pulse generator, and some scope porn
3. LT1073 Micropower DC/DC Converter Adjustable and Fixed 5V, 12V
4. Transistors Tutorial, Part 7: ‚ÄúOscillators‚ÄĚ
5. Simple Transistor Circuits For Experimenting, Fun and Education. Variable Zener Diode

Constant Current Electronic Load

I’m building a power supply and an electronic load might be useful for testing it, so I made one.

Electronic Load/ Carga electrónica

The design is based on some of the various diy electronics loads out there (like the one from Dave Jones). The mosfet is a P45N03LT¬†, most likely I took it from some of the PC power supply I‚Äôve ‚Äúrecycled‚ÄĚ. ¬†I‚Äôm using two 25k potentiometers, one for coarse adjustment and the other for fine adjustment (10 turn pots are kind of expensive‚Ķ). The control voltage varies between 0 and 5 volts and is divided by two with a couple of 10k resistors. The op-amp is an OPA2336, It has rail to rail output so the load can sink roughly up to 2,5. The op amp is powered with a 7805.

Electronic Load/ Carga electrónica

The sense resistor is made with a series of 10 0.1 ohm, 1[w], 1% resistors. I made two “resistors” soldering 5 of them and then I put these two back to back and used kapton tape to keep them electrically isolated.

Electronic Load/ Carga electrónica

Finally a heat sink (scavenged form a PC supply as well) for the mosfet and some female banana plugs. The heat sink is too small and it gets really hot, I will have to find a bigger one or put some kind of cooler fan.

Electronic Load/ Carga electrónica

A few components for a very handy piece of equipment.

Electronic Load/ Carga electrónica

MSP430 and a HC-SR04 Ultrasonic Ranging Module

A while back I bought an¬†HC-SR04. It sat in a box until yesterday when I tried to use it with an MSP430G2553¬†but unfortunately it wasn’t working. I used Energia to program the Launchpad but I wasn’t getting any response from the device. I hooked up my Logic analyzer to see what was going on and….

hc-sr04…the trigger pulse (channel 1) is there but the¬†device will produce essentially¬†the same echo (channel 0), regardless of¬†whether I put an object in front of the module or not. It wasn’t working.

A quick visual inspection and a comparision with other boards photos showed that two components where missing, a capacitor and a SOT-23 device.


The capacitor was easy to replace. The device near it is a MAX232 used to drive the piezo tranducer and the capacitor is connected between GND and the VCC pin. Acording to the datasheet a 1uF decoupling cap is used.


For the SOT device I made a search looking for a module similar to the one I have but I needed a photo in which the device markings were readable. Eventually I found one with the marking J3Y which turned out to be a S8050LT1 NPN transistor and I replaced it with a PMBS3904.


A quick test with the Launchpad and….It’s working!!!!…¬†now the module responds (now is channel 1) to the trigger (channel 0) with a longer pulse proportional to the distance being measure and the MSP430 is sending data.¬†The Analyzer is showing an echo of 7,206 mS and that translate to 124,24 cm, quite a difference with the value calculated with the Launchpad. The MSP430 is using the internal oscilator as the main clock and is not as accurate¬†as the crystal used for the clock in the Logic analyzer. The error quoted in the datasheets for the MSP430 give the calibrated DCO frequencies a tolerance over temperature and any other changes of¬†¬Ī3%. ¬†The difference in this case is close to 10% and I don’t think it can be entirely explained by¬†the clock source.