用jLink读取nRF52832的mac地址

直接用nrfjprog命令读取

nrfjprog -f NRF52 --memrd 0x100000a4 --n 8
0x100000A4: ACAFE032 7AC54CAF


这里的mac地址是 0xCCAFACAFE032. 其中4C变成了CC,这是因为蓝牙协议规定静态mac地址的2 MSBit必须是11(Bluetooth Core v4.0, Vol 3, Part C, chapter 10.8.1) 如果想省事一点,也可以用adalink这个python脚本。直接获取芯片信息

adalink nrf52832 -p jlink --info
Hardware ID : 0x52832
Variant : 0x41414530
Package : QFxx - 48-pin QFN
SRAM : 64 KB SRAM
Flash : 512 KB Flash
Device Addr : E0:A3:38:95:23:66
Device ID : BA74FBE3D9A8A03C
NFC Pins : NFC

Simple script for J-Link RTT viewer

I debug NRF52 chip with JLink real time terminal. It’s pretty to use J-Link RTT viewer on my macOS. For example, I ran this command for open a RTT viewer window.

you@yourcomputer:~$JLinkExe -device nRF52 -speed 4000 -if SWD -autoconnect 1

SEGGER J-Link Commander V5.10u (Compiled Mar 17 2016 19:06:22)
DLL version V5.10u, compiled Mar 17 2016 19:06:19

Connecting to J-Link via USB...O.K.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Mar 15 2016 18:03:17
Hardware version: V1.00
VTref = 3.300V


Type "connect" to establish a target connection, '?' for help

We can use JLinkRTTClient to check the RTT output. But sometimes JLinkRTTClient will not reconnect if the JLinkExe reopened. A simple script can do this job

while true; do nc localhost 19021; sleep 2; done;

I’ve written this line in my makefile.