Reputation: 173
I am trying to program/halt/boot/erase etc. a Nordic Semi MCU. This is the ARM-Cortex M4 in nRF52. I am using the SWD pins of the chip and can achieve this if I use the commercial J-Link with the nrfjprog command-line tool or their Segger windows utility.
However, I want to control the nRF52 from another MCU via GPIO pins of the second MCU and write my own SWD driver by connecting the 3 wires to the nRF52 - SWCLK, SWDIO and GND.
These wires are now driven by a host and I am using the ARM reference manual for SWD. The protocol is relatively straight-forward for what I am trying to achieve. The following PDF have some details: http://hackipedia.org/Hardware/CPU/ARM/pdf,%20Cortex/IHI0031A_ARM_debug_interface_v5.pdf and https://www.silabs.com/Support%20Documents/TechnicalDocs/AN0062.pdf
I manage to send the initial packet header (START, APnDP, Read, Addr, Stop, Parity etc.). However, after that, the SWDIO never turns around. My host MCU floats the SWDIO and is ready to receive input. However, it appears that the nRF52 never starts driving the SWDIO line with the ACK.
I guess that must be because the NRF52 never saw the data packet header or didn't like something that I sent but I can't figure out what. Has anyone experienced this or have any clue why this might be happening? By the way, the SWDCLK transitions happen at 100 kHZ. (clock period of 10 us).
Any help appreciated.
Upvotes: 2
Views: 2039
Reputation: 173
For anyone else who comes here, the trick for me was to do the following:
Send 50+ clocks with SWDIO as high Send the JTAG-to-SWD switch pattern Read the DP ID register After that I am able to get a response from the Nordic just fine.
Upvotes: 0