Click on images to enlarge them

Thursday, March 17, 2016

Eddystone beacon firmware on TrackR hardware

So I was able to write new firmware for the TrackR and program it into the TrackR's flash memory.  This new firmware implements Google's "Eddystone" beacon. The firmware is available on my github project.

The basic operation is fairly simple.  For the first 20 seconds after battery-insertion the TrackR device advertises in connect mode.  During this time the blue LED will slowly flash.  This allows the user the option to change the beaconing URL  If no connection is made and the 20 seconds timeout happens, the TrackR enters true Eddystone beaconing mode. Only by power-cycling (battery removal/insertion) will the device enter update mode again.  I have set the default URL to Google's Eddystone documentation, but again, the URL can be changed.

The utility I recommend for changing the URL is Nordic's Master Control Panel (MCP).  This Android app allows you to connect to a Bluetooth Low-Energy device.  Once you establish a connection, the blue LED will true solid.  Below is a screenshot showing the Eddystone Service and Characteristics.  Clicking on the up-arrow icon on the right side of the URL characteristic, a pop-up dialog will allow you to enter a new URL.  Select "Text" type and then enter the shortened URL string.  This string must be 17 characters or less.  The recommended way to shorten the URL is through an online URL Shortener utility, such as Google's or others.

Once you disconnect from device, there will be a 20 second timeout, after which the TrackR will enter Eddystone mode and begin beaconing the new URL.





You can use Google's Physical Web app, available in PlayStore, to listen for Eddystone devices.  This app is also available in the PlayStore.

Below is a screenshot showing the Physical Web app recognizing my TrackR + Eddystone beacon in tabular form.



Below is another useful Android app: the Eddystone Validator.  Again, it's in the PlayStore.  This app will show all three info items beaconed  by Eddystone:  UID, URL, and TLM.  The TLM info contains the TrackR's temperature, which should be close to the ambient temperature: 18.0C in this case.  The battery voltage is also available, in millivolts:  2892mV in this case.







While developing the firmware, I really wanted the ability to display debug output via a serial interface.  The nRF51822 has two UARTs, but the TrackR doesn't have any connection points specifically for console support.

My solution was to repurpose the two buzzer lines and use them for the UART's TX and RX lines.
An overview of this is shown below. The USB-to-Serial-ttl module is a FTDI FT232RL based designs, sold through SparkFun.






Friday, March 04, 2016

Establishing a SWD Connection to the TrackR

This posting shows how to connect and use the Segger “JLink.Exe” utility to connect to the TrackR device. Below is an overview photo of how I established a SWD connection to the TrackR. Much of the components on the left side of the photo may be substituted for your own equipment: Standard JLink or other SWD compatible adapter could be used. The important concern is to get the SWD related lines mapped into the connector cable.


TrackR to SWD Adapter Connection Overview

Details on these SWD mappings are shown in the following photo.




After you have physically connected the SWD adapter to to the TrackR, start the JLink program on the system connected to the SWD (JLink) adapter. Using a command line shell, you should be able to connect to the TrackR by following the red hi-lited sequence in the listing below.

knots:~ robin$ JLinkExe -if SWD -device nrf51822_xxab -speed 1000
SEGGER J-Link Commander V5.10f (Compiled Dec 22 2015 14:25:20)
DLL version V5.10f, compiled Dec 22 2015 14:25:14

Connecting to J-Link via USB...O.K.
Firmware: J-Link ARM Lite V8 compiled Oct 29 2014 09:03:16
Hardware version: V8.00
S/N: xxxxxxxxx
License(s): GDB
Emulator has Trace capability
VTref = 2.957V


Type "connect" to establish a target connection, '?' for help
J-Link>connect
Device "NRF51822_XXAB" selected.


Found SWD-DP with ID 0x0BB11477
Found Cortex-M0 r0p0, Little endian.
FPUnit: 4 code (BP) slots and 0 literal slots
CoreSight components:
ROMTbl 0 @ F0000000
ROMTbl 0 [0]: F00FF000, CID: B105100D, PID: 000BB471 ROM Table
ROMTbl 1 @ E00FF000
ROMTbl 1 [0]: FFF0F000, CID: B105E00D, PID: 000BB008 SCS
ROMTbl 1 [1]: FFF02000, CID: B105E00D, PID: 000BB00A DWT
ROMTbl 1 [2]: FFF03000, CID: B105E00D, PID: 000BB00B FPB
ROMTbl 0 [1]: 00002000, CID: B105900D, PID: 000BB9A3 ???
Cortex-M0 identified.
J-Link>h
PC = 000119CE, CycleCnt = 00000000
R0 = 20000103, R1 = 00000032, R2 = E000E200, R3 = 00000032
R4 = 00000000, R5 = 20002AB4, R6 = 00000000, R7 = 00000000
R8 = FFFFFFFF, R9 = FFFFFFFF, R10= 0001CFF0, R11= 0001CFF0
R12= FFFFFFFF
SP(R13)= 20003AF0, MSP= 20003AF0, PSP= FFFFFFFC, R14(LR) = 0000116B
XPSR = 61000000: APSR = nZCvq, EPSR = 01000000, IPSR = 000 (NoException)
CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
J-Link>s
000119CE:  40 BF              SEV
J-Link>s
000119D0:  20 BF              WFE
J-Link>s
000119D2:  41 78              LDRB    R1, [R0, #+0x01]
J-Link>s
000119D4:  03 78              LDRB    R3, [R0]
J-Link>s

000119D6:  43 70              STRB    R3, [R0, #+0x01]

Thursday, March 03, 2016

A Tear-down of TrackR Device, a Bluetooth-Low-Energy Based Locator Fob

For Christmas, my wife gave me a TrackR device (see photo below).  I played with it for a while and then put it aside, as I got busy with other things.

Yesterday I noticed it again on my dresser and began wondering what Bluetooth Low-Energy chipset was being used in it...you can already tell this isn't going to end well for the TrackR device.

Anyway, one thing lead to another and I am now pushing out a simple tear-down of the TrackR device.

The TrackR Locator Fob

Above is a photo of the intact TrackR device.  It's really quite small and thin.  There are apps for both Android and iOS.

To open the shell case, use an X-acto knife and gently slide the blade between the aluminum shell and the middle black plastic casing.  The shell adheres to the casing with double-sided tape, and should be relatively easy to open.  A little prying is needed, but be careful as the aluminum shell is soft and easily deformed if you're not careful.

Once you have completely remove the middle black casing, you can clean the sticky tape from the shell with alcohol or the like.  Again, be gentle with the shell as it can be bent easily and the hinge can suffer from metal fatigue easily.


Major Parts of the TrackR

Above shows the major components after the shell has been removed. It is a surprisingly nice design/layout for such a relatively inexpensive device.

Close-Up of TrackR Internals

Above is a close up of the casing with the PCB board inserted.

Annotated TrackR PCB Board (Front Side)

The above annotated photo shows many of the interesting features for the TrackR PCB board. I was pleasently surprised to see that the nRF512822 (QFABC0) was used. This is the smallest (memory-wise) chip in the nRF51822 series, with 128K of flash, 16K RAM, and an ARM Cortex-M0 processor.

Annotated TrackR PCB Board (Back Side with Pogo Pin Pads)

The above photo shows the back side of the TrackR PCB board.  Notice the several circular metallic dots (pads) exposed.  There are probably pogo-pin pads used during manufacturing.

The SWDxxx pads are ICP (In Circuit Programming), e.g. loading the firmware onto the device.

The other pads are probably for QA testing during manufacturing to insure the boards works properly.  This allows the components which are more likely to fail during the manufacturing process to be tested:  Buttons and buzzer are items which often are faulty.

TrackR Aluminum Shell Case
(Note Non-Anodized Area for Antenna Contact)

The above photo shows the aluminum shell's inside.  The most significant feature is the non-anodized (silvery) area.  This is where the antenna connector (spring-finger) contacts the shell.  In other words, the shell is acting as the antenna.

NOTE:  When you put the TrackR back together, and use double-sided tape to secure the shell to the casing again, be especially sure that this non-anodize are is not covered by the tape, otherwise the antenna spring finger will not contact the shell.


Later, given some time, I might attempt to reprogram the TrackR with, say, Eddystone firmware.  This will allow the TrackR device to participate in the Google's "Physical Web" initiative.  There are apps for Android and iOS which interact with Eddystone devices.  I suggest reading about Eddystone and the Physical Web, if you're interested.  My github site has a project for Eddystone firmware of the Nordic PCA1001 board, which should be a good starting point for porting to the TrackR board.