Hello
I have an nRF51822 serving as s supervisory micro for an embedded Linux board. Two GPIO pins from the main CPU are hooked up to the nRF51822 to implement SWD for the purpose of upgrading the nRF.
I have written all the SWD code and the upgrade mechanism works fine, all except for one thing....
Occasionally, maybe one of of 10 times, the DIF does not appear to switch out of normal mode and the nRF seems to see the first changes on the SWDIO line as a reset.
The reason I believe their is a reset happing is that one of the GPIO pins I am monitoring changes from output to input.
I send a preample of:
- Drive SWDIO line high. (it is already high anyway).
- Send 150 strobes on SWDCLK, ending with SWDCLK high. Since this is driven by software, the frequency is 1.7MHz, but there are some stalls.
- Send JTAG->SWD magic code. This is what occasionally triggers the reset.
- Send 150 more 1 bits. ...
Even though the JTAG to SWD code triggers a reset, the device still enters debug mode and access to the internal debug is fine. It appears that the DIF is passing though the SWD signals, yet it still triggering a reset.
Are there any subtleties to getting the DIF to correctly leave Normal mode?