NRF52 SDK

From ElectroDragon
Jump to navigation Jump to search

Setup Toolchain

Folder Examples

  • PCA10040 for NRF52832, NRF52810
  • PCA10056 for NRF52840
  • PCA10028 for NRF51

For ARM GCC

  • Set in /home/he/nrf/components/toolchain/gcc/Makefile.posix
  • Set GNU_INSTALL_ROOT ?= /usr/bin/

Compile Blink

  • locate file at example folder: /nrf/examples/peripheral/blinky/pca10056/blank/armgcc
  • make directly, and output
...
Compiling file: nrf_memobj.c
Compiling file: nrf_ringbuf.c
Compiling file: nrf_strerror.c
Compiling file: nrfx_atomic.c
Compiling file: main.c
Compiling file: system_nrf52840.c
Linking target: _build/nrf52840_xxaa.out
   text	   data	    bss	    dec	    hex	filename
   1592	    108	     28	   1728	    6c0	_build/nrf52840_xxaa.out
Preparing: _build/nrf52840_xxaa.hex
Preparing: _build/nrf52840_xxaa.bin
DONE nrf52840_xxaa

Blink

Keil

MDK Demo code

  • Demo code folder at C:\MDKARM_v5\ARM\PACK\NordicSemiconductor\nRF_Examples\11.0.0-2.alpha

Example

  • Blink demo C:\MDKARM_v5\ARM\PACK\NordicSemiconductor\nRF_Examples\11.0.0-2.alpha\peripheral\blinky\pca10040\blank\arm5

Board definition file

  • C:\MDKARM_v5\ARM\PACK\NordicSemiconductor\nRF_Examples\11.0.0-2.alpha\bsp
  • Define all perpherial here, includes LEDs, buttons, etc.

Programmer

LPCLINK MSC Drag-n-drop (most preferrable)

  • LPCLink can be found in our store

nrfjprog (command line) + nRFgo Studio

Try command line Check J-Link Interface

  • nrfjprog -i

Flash

  • nrfjprog -f nrf52 --program C:\MDKARM_v5\ARM\PACK\NordicSemiconductor\nRF_Examples\11.0.0-2.alpha\peripheral\blinky\pca10040\blank\arm5\_build\nrf52832_xxaa.hex --sectorerase

Reset target

  • nrfjprog -f nrf52 --reset

More command line see at:

nrfutil python

  • pip3 install nrfutil
  • nrfutil pkg generate --help
  • nrfutil pkg generate --hw-version 52 --sd-req 0x00 --application-version 1 --application app.hex app_dfu_package.zip

Compiler

Keil

Setup for DAPLINK for NRF52832

  • tick reset and run
  • RAM for algothirum, start at 0x20000000, size 0x2000
  • Add programming as image

old

  • NRF52 Series in Keil
  • Project add core and startup
  • Options for target: 16mhz, tick "use microLB"
  • IROM1: start 0x0 size 0x80000
  • IRAM1: 0x20 000 000, size 0x10000

Arduino Support

https://github.com/sandeepmistry/arduino-nRF5

  • Require J-Link or DK board, intall mbed driver
  • Use sketch -> upload via programmer

https://forum.mysensors.org/topic/9266/guide-nrf5-nrf51-nrf52-for-beginners

  • Use mysensor arduino board (ebyte) and arduino nRF5

Error and Bugs

For Keil

For Arduino Upload Error

  • Check if the board in DFU mode, LED blink in 'timebome' sequence
  • Disconnect and reconnect FTDI cable

Demo Video

Reference