Do you want a more efficient way to program your devices than nRFgo Studio? Are you an OS X or Linux user who has struggled setting up a toolchain for nRF5x devices? Maybe you are using JLink.exe or an open source tool to program your devices or maybe you even wrote your own? If this is you READ THIS POST!
If you have already been using nrfjprog, pynrfjprog, mergehex you may want to skip to the 'Multi API' section of this post. This introduces the new feature in pynrfjprog that enables multiple devices to be controlled and selectively programmed from python (great for automated testing, scripting, workflow, etc...).
As developers our goal is to ship a great product. We have time constraints and deadlines to meet and to efficiently build our product we need to have a good workflow in place. It is key to be able to compile, run and debug applications quickly. It is proven a shorter compile & run/debug cycle leads to cleaner, less buggy code. And added efficiency here WILL ultimately lead to a better product and make you a happier developer. If it takes you over 30 seconds to build and run/debug your applications (including erasing the chip, programming soft-device & or bootloader along with your application) then you are not operating at full efficiency. From blinky to production you will do this thousands of times - take a few minutes to get this right!
#What does an ideal toolchain for nRF5x devices look like currently?
#5 minute nrfjprog quick start
nrfjprog is a command line utility that allows you to erase, flash, unlock, read/write memory etc... from the command line.
EDIT (nikolaus's comment): I've added nrfjprog (and mergehex) to Homebrew Cask, meaning they can be installed on OS X using:
brew cask install nrf5x-command-line-tools
This will automatically handle putting them in the right place, so they'll be in your PATH and immediately usable. Thanks!
Note: nrfjprog and pynrfjprog relies on SEGGER's JLinkARM.dll. This means it will only work with a debugger running SEGGER firmware (all our development kits come shipped with SEGGER software so this works by default).
mergehex.exe is in the same folder as nrfjprog.exe so just run mergehex from the command line and read the man page and you will understand how to use it.
The most common nrfjprog commands:
#5 minute pynrfjprog quick start
pynrfjprog has the same functionality of nrfjprog and more in Python! You may want to use shell scripting with nrfjprog to do many things in one command but pynrfjprog gives you finer control of the nRF5x device and gives you options like using Python's Unit Testing Framework and many of the benefits that come along with Python.
Example of pynrfjprog in use:
And most of the functions available from API.py (Just open 'C:\Python27\Lib\site-packages\pynrfjprog\API.py':
#pynrfjprog new feature: Multi API
Just a quick demo of the new feature. Very similar to what you are used to with pynrfjprog - just unlocks new possibilities.
#Where to go from here
What tools do you use? Do you use JLink.exe? Why do you use this instead of nrfjprog? What will you use these tools for? Any suggestions? What do you want to see, what isn't necessary? Official documentation on these tools is currently being edited and will be on the infocenter soon. What other documentation do you need, examples? Do you flash your softdevice/application directly from the IDE? Why not? How is your workflow efficient? done
EDIT: Do you want our tools to be open source? How would this help you?
I had to use this to install via Homebrew:
brew tap caskroom/drivers
brew cask install nordic-nrf5x-command-line-tools
It was #1, many thanks.
@Lee Daniel Crocker
nrfjprog does not enable pinreset by itself, and I am certain of that since I am the programmer. But I can think of two ways it happens:
If those are not the case, please tell and I can take a look at it.
nrfjprog version: 9.3.1
JLinkARM.dll version: 6.12g
I haven't figured out the exact way to trigger this yet, but about half the time when programming either the softdevice or bootloader from hex file, nrfjprog pre-emptively enables pinreset without being asked to in any way (no command line, and nothing in either hex file). It's quite clear--I read address 0x10001200 before the --program statement with 0xFFFFFFFF, and afterward it contains 0x00000015.
I have had to eliminate the use of nrfjprog from my Makefiles and use Segger's JLink scripts to program my device to work around this bug. But nrfjprog is handy, and I would use it if it were fixed.
The problem is that the debug port is not abkle in nRF51 to get out of debug interface mode, so some regulators and oscillators are kept on. A pin reset will stop those current drains. Perform a pin reset and measure again.
Note that this is only valid in nRF51 devices.