First Steps with the MtM Kit

Before I can start work on developing my own software for the MtM motion sensor kit, I need to connect the hardware to my laptop via USB tethering.  The interface board (MtAid01) provides a micro USB port, but this is purely used to supply power and does not implement a debugging connection.  However the MtAid01 board does provide a Segger J-Link ‘Serial Wire Debug’ interface to which J-Link capable hardware can be connected.

As it happens, the Nordic nRF51-DK, which I have previously worked with, includes a J-Link chipset and provides a serial wire debug interface to enable it to be connected to an external module, bypassing the onboard ARM SoC.  Therefore, my working setup consists of a USB connection between my laptop and the nRF51-DK board; then a serial wire connection to the MtAid01; into which is plugged the MtConnect04S module containing the actual chip to be programmed!

mtmsetup1

Fortunately, MtM provide a useful overview of setting up the wiring for this in their blog post:  ‘Connect MtConnect03 with nRF51 DK’.  The revision of the base board shown is an older model of the MtAid01 than the one I have, but it is close enough to work out the correct connections as the pins are consistently labelled.

To actually use this connection to flash the nRF51822 on either the nRF51-DK or the MtConnect04S requires software to transfer the system binary image.  On Ubuntu, the operating system automatically shows a mounted volume called JLINK when J-Link hardware is plugged into a USB port.  This can be used to flash the chip by simply copying the binary image ‘hex’ files to this mount point!

However, for more fine grained control over the flashing process and to be able to write command scripts, I have opted to install two additional command line utilities: nrfjprog and mergehex.  These programs are available from Nordic Semiconductor for Linux, Windows and OSX.  In my case I downloaded the RF5x-Command-Line-Tools-Linux64.  I copied these programs to ‘/opt/nRF5x-Tools’ which I temporarily add to my system PATH when I need them.

To test this is all fully working I downloaded the sample ‘blinky application’ provided in the MtM blog article ‘How to program the flash of MtConnect04S’. along with the S110 Nordic Semiconductor SoftDevice to provide BLE services. Using these, I was able to successfully flash a MtConnect04S with the following script:

PATH=$PATH:/opt/nRF5x-Tools/nrfjprog/:/opt/nRF5x-Tools/mergehex/
rm -f temp.hex
mergehex -m s110_nrf51822_7.3.0_softdevice.hex 
                                  20160105_blinky_arm.hex -o temp.hex
nrfjprog --recover -f NRF51
nrfjprog --program temp.hex --verify --chiperase -f NRF51
nrfjprog --rbp ALL -f NRF51
nrfjprog -r -f NRF51

Here mergehex prepends the BLE softdevice (s110_nrf51822_7.3.0_softdevice.hex) to the application (20160105_blinky_arm.hex) and then copies them to a temporary file (temp.hex).  This is then flashed to the target system with nrfjprog.  Finally, to test the unit disconnected from the nRF51-DK, I attached the coin battery module (MtAid02) to the now flashed MtConnect04S processor module.  When switched on, this successfully continued to run the LED blinking software.

mtmsetup2

Leave a Reply