Tuesday, August 22nd 2017, 12:59pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

guan

Beginner

Date of registration: Jan 30th 2013

Posts: 2

1

Monday, February 4th 2013, 7:39pm

nRF51822 evaluation kit board Mac OS X problems

I am reposting this from the other thread since that one is marked SOLVED.

I've had a lot of problems along these lines, and also a lot of great solutions.

I basically went through 3 phases with my nRF51822 Evaluation Kit board (PCA10001).

In phase 1, everything worked well, both with and without softdevice. I could use JLinkExe to download programs and I could use JLinkGDBServer with gdb to debug. This was with version 4.62, previous versions didn't work so well.

In phase 2, I could use JLinkExe to download programs using the si 1 and selemu commands first (without them it didn't work). However, the GDB server didn't work. The output was:

Source code

1
2
3
4
5
6
7
Connecting to J-Link...
Connecting to J-Link failed. GDBServer will be closed...
Restoring target state and closing J-Link connection...
Connecting to J-Link...
Connecting to J-Link failed. GDBServer will be closed...
Restoring target state and closing J-Link connection...
Shutting down...


In phase 3, JLinkExe doesn't work even with si 1 and selemu. This is the output:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
J-Link>selemu
J-Link[0]: Connection: USB, Serial number: 0, USB address: -257
Select emulator index: 0
DLL version V4.62, compiled Jan 25 2013 15:29:24
Firmware: J-Link OB-SAM3U128 V1 compiled Jan  7 2013 18:12:29
Hardware: V1.00
S/N: 480202242 
VTarget = 3.300V
Info: Could not measure total IR len. TDO is constant high.
Info: Could not measure total IR len. TDO is constant high.
No devices found on JTAG chain. Trying to find device on SWD.
Info: Found SWD-DP with ID 0x0BB11477
Info: Found SWD-DP with ID 0x0BB11477
No device found on SWD.
Did not find any core.
Failed to identify target. Trying again with slow (4 kHz) speed.
Info: Could not measure total IR len. TDO is constant high.
Info: Could not measure total IR len. TDO is constant high.
No devices found on JTAG chain. Trying to find device on SWD.
Info: Found SWD-DP with ID 0x0BB11477
Info: Found SWD-DP with ID 0x0BB11477
No device found on SWD.
Did not find any core.


So it can connect to the debugger, but not contact the device.

Throughout these phases, I've always been able to use the "Recover" command in the latest version of nRFgo Studio.

My questions are:

1. Does anyone know a sequence of commands that does the same thing as Recover in nRFgo Studio?

2. Do you have any suggestions for how to get JLinkGDBServer up and running? I was thinking that I could put some commands in a script to be launched with JLinkGDBServer, but I'm not sure what the non-interactive version of selemu is.

cmason

Beginner

Date of registration: Mar 1st 2013

Posts: 12

2

Saturday, March 2nd 2013, 5:37am

I'm having really good luck with this board now with one exception. I'm using V4.62a of the JLink software on MacOS 10.8.2.

I'll summarize below my procedure, in the hope that it will help others. This was gathered from these really helpful posts about: splitting the soft device binary, modifying this procedure for version 3 of soft device, and launching JLinkGdbServer in SWD mode,

Requires nRF51822 dongle from their $99 development kit, the download of the s100 "soft device" firmware using the download product key in the kit, and the JLink software. I'm using GCC 4.8.x to compile with a custom makefile and linker script derived from Paul Stoffregen's teensy 3 code.

Here's basically what I did (don't include stuff after # marks):


brew install libusb

#extract the two parts of the soft device (the main code section and the user control register section)
arm-none-eabi-objcopy -Iihex -Obinary --only-section .sec3 s110_nrf51822_4.0.0-2.beta_softdevice.hex s110_nrf51822_4.0.0-2.beta_softdevice_uicr.bin
arm-none-eabi-objcopy -Iihex -Obinary --remove-section .sec3 s110_nrf51822_4.0.0-2.beta_softdevice.hex s110_nrf51822_4.0.0-2.beta_softdevice_mainpart.bin

export DYLD_LIBRARY_PATH=.
./JLinkExe

device nrf51822
speed 1000
r # reset the device
w4 4001e504 2 # NVIC CONFIG EEN (erase enabled)
w4 4001e50c 1 # NVIC ERASEALL (erase all flash including UICR)
r
w4 4001e504 1 # NVIC CONFIG WEN (enable writing)
# load the soft device binary.
loadbin s110_nrf51822_4.0.0-2.beta_softdevice_uicr.bin 0x10001000
loadbin s110_nrf51822_4.0.0-2.beta_softdevice_mainpart.bin 0
r
q

./JLinkGDBServer -if SWD -device nRF51822 -speed 4000 & # runs in background

gdb program.elf # this is your executable
target remote localhost:2331
set remote memory-write-packet-size 1024
set remote memory-write-packet-size fixed
load program.elf
monitor reset #reset the chip
c # continue -- runs the program
^C
bt
# etc.


The main problem I'm having now is not being able to send/receive UART data from the nRF51822. I've posted about that here.

Hope this helps,

-c

cmason

Beginner

Date of registration: Mar 1st 2013

Posts: 12

3

Saturday, March 2nd 2013, 10:59pm

Makefile setup for nRF51822 and GCC

I've consolidated all this into a Makefile that:
  • compiles c code using GCC;
  • links as appropriate for the "softdevice" setup;
  • erases the dongle and reprograms the "softdevice"; and
  • runs GDB and stops on a breakpoint.

This seems pretty reproducible for me.
The program itself doesn't do very much yet.

http://hg.cmason.com/nrf

See README there for details.
Hope this helps,
-c

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,507

4

Tuesday, March 5th 2013, 6:53pm

Quoted


CDC functionality:
It is a limitation in the Mac OS X (!!) USB CDC kernel driver. It requests exclusive access to the device, so libusb (used by the J-Link DLL/lib) is no longer able to get access to the J-Link, so debugging is not possible.
This is why the USB CDC drivers of Mac need to be temporarily disabled. This is not a bug in the J-Link software.

Not sure what exactly is the problem here right now.
In general 2 things should be done do make sure that a connection to the nRF51 can be established:
1) ALWAYS select the device, so J-Link knows which device it connects to. The nRF51 needs some special handling.
2) Always make sure that SWD is selected as interface.

For J-Link Commander we recommend to start it as follows:
JLinkExe -if SWD -device nRF51822

For GDBServer it should look identical:
JLinkGDBServer -if SWD -device nRF51822

By the way: Selecting the device is enough to make flash programming work. Commands like "monitor flash download 1" are deprecated and not necessary anymore.

Did you try this?
Do you still see any connection issues?

If yes:
What we are looking for is a very simple reproduction scenario which for example says:
"Download this bin file into the target and J-Link will no longer connect to the CPU properly. Same works fine under Windows"


Best regards
Alex

SEGGER - Alex

Super Moderator

Date of registration: Dec 18th 2007

Posts: 1,507

5

Monday, July 28th 2014, 10:22am

Hi all,

It turned out that it was an unfortunate combination of some specifics of the Apple Mac OS X driver and some "misbehavior" of the J-Link library.
It has been fixed for V4.88 and later of the J-Link software, so now it is possible to use the CDC part in parallel with the J-Link part.

Download-Link: http://www.segger.com/jlink-software.html


- Alex