USB log messages with NRF52DK


#1

How can I monitor log message output from the ruuvitag application running on the ruuvitag? I am using the Ruuvi arduino connector with a NRF52DK. Before plugging in the ruuvitag arduino connector with ruuvitag attached I can download example apps to the NRF52DK and monitor the log using the JLINK usb serial port. When I plugin the ruuvitag arduino adapter I can build and download ruuvitag applications but I still only get the debug log messages from the app running on the NRF52DK.


#2

Hello,

I assume you’re writing your own firmware? Please check that NRF_LOG_ENABLED is set to 1 and NRF_LOG_BACKEND is RTT.


#3

Do I need to copy a sdk_config.h from one of the nRF52DK examples? In the ruuvitag_fw examples, there is no sdk_config.h as there is in all of the nRF52DK SDK examples. I used the ruuvitag_fw current git repository to build the bootloader/ruuvitag_b_debug/armgcc and the unmodified ruuvitag_firmware example. I also made sure the bootloader sdk_config.h has the NRF_LOG_ENABLED set to 1 and NRF_LOG_BACKEND RTT. I put all the hex output including the s132_nrf52_3.0.0_softdevice.hex soft device in the packet.hex and used the usb JLINK drive to transfer the packet.hex to the ruuvitag mounted on the nRF52DK ruuvi arduino connector. The ruuvitag_firmware app is working correctly as the LEDs work as they should and I am able to access the sensor via a python web script or the android ruuvitag app. The only serial debug output I am getting on the linux /dev/ttyACM0 serial port is from the nRF52DK
ble_app_blinky example which I build using the nRF5_SDK_15.0.0_a53641a which is running on the nRF832 processor on the nRF52DK.


#4

Hello,

I’d recommend you to use SD 3.1.0, available from Nordic Semiconductor.
You need to use JLinkRTTViewer or SES debug window to view the logs.


#5

NRF_LOG_xxx are macros and are compile time enabled.

consider adding these defines to your main.c
#define NRF_LOG_ENABLED 1 // requires ruuvi dev kit(including Nordic kit) to see log messages
#define NRF_LOG_DEFAULT_LEVEL 4 // 4 debug: see everything via jlink & /usr/local/bin/JLinkRTTClient or telnet localhost 19021
#define NRF_LOG_USES_COLORS 1
#define NRF_LOG_ERROR_COLOR 2 // RED
#define NRF_LOG_WARNING_COLOR 5 // BLUE


#6

Thank you. This looks like what I am looking for. First pass I don’t see anything from JLinkRTTClient. Maybe I need to also configure bootloader sdk_config.h. For now I have been able to monitor the RTT debug output and debug the ruuvitag app using the Segger embedded studio.


#7

I have found getting JLinkRTTClient started unpredictable.
Once it gets going it’s great.
If you don’t see output from it, other than dots, try killing it and starting it again.
I have not modified Bootloader.sdk_config.h and I can see all expected LOG messages (once it gets going) even ones that occurred earlier and have been queued!


#8

Depending on your development environment, you might need to start JLinkExe and connect to the target board as the JLinkRTTClient will connect on JLinkExe on Mac OSX and Linux. I think Windows doesn’t need starting up JLinkExe separately, but I’m not 100% sure.


#9

otso, I am now running JLinkExe and when I attempt to connect I get the following. I am new to nRF52 DK/SDK so I am not sure what works using the nRF52DK without a JTAG which I don’t have. I am using JLink usb through the nRF52DK usb connection:

J-Link>connect
Device “NRF52832_XXAA” selected.

Connecting to target via JTAG
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
TotalIRLen = ?, IRPrint = 0x…000000000000000000000000
Cannot connect to target.
J-Link>
When I connect to the target ruuvitag mounted on the nRF52DK using the ruuvi arduino adapter using usb 0 I get:
J-Link>usb 0
Disconnecting from J-Link…O.K.
Connecting to J-Link via USB…O.K.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 12 2018 11:44:41
Hardware version: V1.00
S/N: 682620304
VTref=3.300V
J-Link>
Try the SWD:
J-Link>SWDSelect
Select SWD by sending SWD switching sequence.

****** Error: Debugger tries to select target interface SWD.
This interface is not supported by the connected emulator.
Selection will be ignored by the DLL.

****** Error: Could not transfer JTAG data.

****** Error: Not supported by current CPU + target interface combination.

****** Error: Not supported by current CPU + target interface combination.

****** Error: Not supported by current CPU + target interface combination.

****** Error: Not supported by current CPU + target interface combination.
J-Link>

I still don’t see any log output from either JLinkExe or JLinkRTTClient although now JLinkRTTClient does not show dots but that it is connected to process JLinkExe:

###RTT Client: Connection closed by J-Link DLL. Going to reconnect.
###RTT Client: Connecting to J-Link RTT Server via localhost:19021 . Connected.
SEGGER J-Link V6.34c - Real time terminal output
J-Link OB-SAM3U128-V2-NordicSemi compiled Jul 12 2018 11:44:41 V1.0, SN=682620304
Process: JLinkExe


#10

Hello,

Here’s my log. Interface is SWD.

Otso-MacBook-Pro:~ ojousima$ JLinkExe
SEGGER J-Link Commander V6.22f (Compiled Jan 12 2018 16:19:34)
DLL version V6.22f, compiled Jan 12 2018 16:19:24

Connecting to J-Link via USB…O.K.
Firmware: J-Link OB-SAM3U128-V2-NordicSemi compiled Jan 12 2018 16:05:20
Hardware version: V1.00
S/N: 682971638
VTref = 3.300V

Type “connect” to establish a target connection, ‘?’ for help
J-Link>connect
Please specify device / core. : NRF52832_XXAA
Type ‘?’ for selection dialog
Device>NRF52832_XXAA
Please specify target interface:
J) JTAG (Default)
S) SWD
TIF>S
Specify target interface speed [kHz]. : 4000 kHz
Speed>4000
Device “NRF52832_XXAA” selected.

Connecting to target via SWD
Found SW-DP with ID 0x2BA01477
Found SW-DP with ID 0x2BA01477
Scanning AP map to find all available APs
AP[2]: Stopped AP scan as end of AP map has been reached
AP[0]: AHB-AP (IDR: 0x24770011)
AP[1]: JTAG-AP (IDR: 0x02880000)
Iterating through AP map to find AHB-AP to use
AP[0]: Core found
AP[0]: AHB-AP ROM base: 0xE00FF000
CPUID register: 0x410FC241. Implementer code: 0x41 (ARM)
Found Cortex-M4 r0p1, Little endian.
FPUnit: 6 code (BP) slots and 2 literal slots
CoreSight components:
ROMTbl[0] @ E00FF000
ROMTbl[0][0]: E000E000, CID: B105E00D, PID: 000BB00C SCS-M7
ROMTbl[0][1]: E0001000, CID: B105E00D, PID: 003BB002 DWT
ROMTbl[0][2]: E0002000, CID: B105E00D, PID: 002BB003 FPB
ROMTbl[0][3]: E0000000, CID: B105E00D, PID: 003BB001 ITM
ROMTbl[0][4]: E0040000, CID: B105900D, PID: 000BB9A1 TPIU
ROMTbl[0][5]: E0041000, CID: B105900D, PID: 000BB925 ETM
Cortex-M4 identified.
J-Link>


#11

Yes, I get the same thing. I neglected to specify the device name and SWD after the connection. Now I am getting all of the debug output using JLinkRTTClient after connecting with JLinkExe.