nRF52 - The Complete Help Guide

nRF52 - The Complete Help Guide

Fixing Jlink DLL issues with nRFgo Studio

This post serves as a collection of help tutorials that I found useful when getting started with the nRF52.

Related: Jlink not detected in nRFgo Studio, Failed to find JLINK dll. Had a spot of trouble fixing this one. However, uninstalling everything and reinstalling everything made it work again.

How to fix

  1. Uninstall Nordic, Jlink, Segger software
  2. Remove all registry keys of Nordic, Jlink or Segger software using regedit
  3. Install Segger first
  4. Followed by Nordic Command Line
  5. Test that it works nrfjprog -i in the command line. Make sure that the Jlink is detected
  6. Install nRFgo Studio.

Intermittent JlinkARM dll not found when uploading softdevice and code not updating on device even though upload is successful

This was strange because there wasn't this issue previously. However, uploading on the nrf52 DK worked, so I suspect it might be a manufacturing or power issue, as I was powering my board from a battery pack. I noticed that the light from the battery pack did not come on (although my debugger was able apparently upload code and verify it) when I connected my custom PCB and it came on when I attached the nrf52 DK.

How to fix

The solution is to switch to a more stable power source like a USB output instead of a battery pack that might not supply enough current for programming to take place.

Setting up GCC toolchain for Windows

I wanted to set up an environment that did not require me to use a IDE because all the other options (Keil and IAR) were paid.

How to Fix

  1. Download SDK from Nordic
  2. Download make
  3. Install mingw
  4. Install GCC-ARM-embedded
  5. update Makefile.windows found in nRF52_SDK_INSTALL\components\toolchain\gcc
  6. Under the armgcc folder, execute make nrf52832... in the command line.
  7. In nRFgo Studio, go to the new .hex file and program

Getting SCL and SDA to work on the Sparkfun nRF52832 breakout

  1. Go to C:\Users[Your Username\AppData\Local\Arduino15\packages\Sparkfun\hardware\nRF5\0.2.3\variants\Sparkfun_nRF52832_Breakout
  2. Open the variant.h file and change the line
#define PIN_WIRE_SDA    (20u)
#define PIN_WIRE_SCL    (21u)

to

#define PIN_WIRE_SDA    (24)
#define PIN_WIRE_SCL    (25)

Pinouts in the Arduino Core

The pinouts on the nRF52 DK using the Arduino Core follows the pinout on the Arduino UNO:

P0.15 is defined as 4 in Arduino and P0.04 is 15, as seen in the purple image above. However note that in other implementations, such as the Adafruit nRF52, the pins are defined as they are, ie P0.19 is digital pin 19. Check the documentation on Github to determine.

Antenna Issues

The design document of the nRF52 insists that you follow the exact geometry and components for the antenna to work correctly. That includes the orientation of placement, and the length of the trace. Not following this might result in the antenna not working.

How to fix

In the end I decided to buy the E73 module because it was the cheapest module available to me at $6:

Alternatively, you can also use the MDBT42 made by Raytec and sold at Digikey for about $10.

This is the model that is also used on the Adafruit nRF52 Bluefruit boards.

Finally considering the price of these modules, I might go for a cheaper one such as the CC2541 Bluetooth module made by TI. The HM-11 style is a far more compact size, and while it is not an SoC, it the space saved can certainly accommodate one. A more detailed review is also available at: http://www.martyncurrey.com/bluetooth-modules/.

Purchasing a module removed any uncertainty about the antenna design. By buying a FCC certified module it would also allow you to sell the design directly.

The problem and disadvantage is that you are tied to one supplier. However, since the nRF52 module costs $7 while the chip itself costs $5, the savings in costs and time makes a good tradeoff.

CP2104 not working

Soldering on the CP2104 was more troublesome than I anticipated. Either the modules that I bought did not work, which is possible, or I was unable to do QFN soldering to a good degree of accuracy, which is more likely.

My first try with the board resulted in a short that caused the chip to overheat and burn up. However, the next two chips that I soldered on did not work and were not detected by any system that I plugged the board into.

How to fix

I decided to scale back to the minimum system, which was to get the nRF52 working on my board. So I decided to abandon the onboard CP2104 route and went instead with a presoldered module:

I had to modify my original board to allow me to plug in this additional board to program it. Note that the CP2104 already switches the RX and TX pin. So instead of connecting RX to TX, you just connect RX to RX on the board. This took me awhile to figure out, and I was doing something completely different when I read this.

The advantage is that you don't have to solder in a QFN module for each new board, which does make it less labour intensive.

DFU device not detected

I was running into this problem in Arduino using Adafruit's nRF52 Bluefruit library.

How to fix

Check that the RX and TX lines are not swapped and try swapping them.

Software

nrfutil not found

$ cd ~/.arduino15/packages/adafruit/hardware/nrf52/[version]/tools/nrfutil-0.5.2
$ sudo pip install -r requirements.txt
$ sudo python setup.py install

Change pip2 and python2 as needed if the symlink of python is to python 3.

"pad parameter is deprecated error"

nrfutil uses Python 2.7 to run, so you'll have to change the references in /usr/bin/nrfutil to #!/usr/bin/python2.

References

  1. https://devzone.nordicsemi.com/question/4067/nrfjprog-always-fails-to-find-jlinkarmdll-even-in-the-same-folder/
  2. https://alexanderbrevig.github.io/technology/2016/01/25/nRF52-gnu-toolchain/
  3. https://devzone.nordicsemi.com/blogs/870/general-pcb-design-guidelines-for-nrf52/