When working with a custom board with nRF52840 chip, I'm having serious problems with SWD connectivity. In many cases JLinkExe
can't connect to target at all. I did some measurements with 4-channel oscilloscope to see what is going on on the SWD pins, and noticed, that the voltage levels are pretty low. And, when they are too low, the link is not working.
In my measurements, there are 2 variables, which influenced results:
- I was using Segger Flasher ARM in half of the measurements, and Segger Flasher JLink Pro in second half
- in half of the measurements radio was listening (by loading
ot-cli-ftd
Thread example application and doingthread start
). In other half of the measurements, radio was off (thread stop
). So, basicallythread start
/thread stop
was the only difference (no reboots in meantime, etc.). I assume that those commands do mostly affect radio, but theoretically they could influence some other effect which interfered with SWD.
So, in total, I got 4 runs, 1 configuration each. Each configuration was created by running JLinkExe resetscript
with resetscript
file containing following content:
device NRF52840_XXAA
speed 1000
if SWD
connect
r
q
(basically just send a reset command to the target).
The oscilloscope screenshots are here: https://imgur.com/a/su1ZS
In all measurements, VRef (channel 3 on screenshots, purple line) was always 3.3V, never dropped a bit.
The filenames in order (the filename is printed on each screenshot on right side, just above the middle):
-
SCR24: JLink used, after
thread stop
. Reset was performed successfully. Voltage levels: 2.2V in idle mode (left and right parts of the chart), high level was 3.12V, the last few bits are 2.4V (is it the part where target is sending data back to flasher?). Clock voltage was 3.12V as well. -
SCR25: JLink used, after
thread start
. Reset was performed successfully. Voltage levels: 1.76V in idle, high level: 2.8V, last bits: 1.96V. Clock: 2.8V -
SCR26: Flasher ARM used, after
thread stop
. Reset was performed successfully. Voltage levels: 0V in idle, high level: 2.84V, last bits: 2.48V. Clock: 3.04V -
SCR27: Flasher ARM used, after
thread start
. Reset was NOT performed succesfully (Cannot connect to target
was the error message fromJLinkExe
). Voltage levels: 0V in idle, high level: 2.6V, last bits: 1.28V. Clock: 2.76V
Surprisingly, Flasher ARM experienced most of the problems, JLink always worked fine. I also did another batch of measurements, using nRF52840 PDK PCA10056 board debugging externally via P20 connector. PDK performed as badly as Flasher ARM, although voltages were significantly higher.
(PDK after thread start
had 2.8V high, and 1.88V last bits, failure, whereas thread stop
always give me success with 2.96V / 2.4V).
I have stored CSV files with oscillator samples from each run, available on request.
So, obviously for some reason the end of the transmission is using much lower voltage than expected, and in some cases JLinkExe
is barely able to connect, in some cases it is not. I was quite surprised, that PDK board and JLink had idle level quite high, whereas Flasher ARM had idle voltage set to 0V. Is that configurable somehow in JLinkExe
?
The custom board which was being measured, has SWDIO
and SWDCLK
pins running straight from CPU to 2.54 goldpin connector. There are 330pF capacitors between those lines and GND, nothing else is connected to those pins.
Any idea what is causing such low voltage? and difference between thread start
and thread stop
? I'm assuming rx on radio is causing this, but to this level? The VRef was solid 3.3V, so I'm hoping that the power supply was OK, too, but I'm not 100% sure.