I'm attempting to bring up a new board of ours that has a K22DN512VLH5 on it.
We are using Keil uVision4 with a ULink-me programmer.
When we try and program the chip, I get a "SWD communications fail" error. Scoping the SWD and reset lines, I see:
1) reset asserted
2) line reset (50 clock cycles, data high)
3) JTAG to SWD switch.
4) line reset
5) 8 low clock cycles
6) SWD read DP addr 0 (idcode reg), ACK, correct data.
7) ... more stuff that I haven't decoded. Probably checking the MDM-AP status register and setting C_DEBUGEN and CV_VECTORRESET in the AHB-AP.
8) deassert reset
9) 200ms gap
10) SWD write DP addr 4 (ctrl/status reg) --- unlike before the target does not ACK, nor send WAIT or FAIL, it just doesn't respond.
11) line reset --- recover from error
12) 8 low cycles
13) 6) SWD read DP addr 0 (idcode reg), --- Again no response at all.
... more attempts but the target never replies.
Reasons I can think of for this behavior based on searching are:
1) Protection bits -- Pretty sure this isn't my problem because when I accidentally protect something, I get asked if I want to do a mass erase when programming.
2) Invalid code causing target to reset continuously breaking SWD connection -- Pretty sure this isn't my problem either as I've scoped the reset line and don't see it changing except for when we drive it low with the programmer.
So I'm out of ideas really. Any suggestions on what to try would be fantastic. I have the ability to read / write DP / AP without using the programmer, so I can add in custom calls to read states of anything you think could be helpful.