AnsweredAssumed Answered

Fun and games with Serial Wire Debug

Question asked by Ian Benton on Oct 17, 2017
Latest reply on Oct 30, 2017 by Ian Benton

I retracked the pcb for my LPC1517 project to move the SWD socket, and shall we say - the routing wasn't the best. The data and clock went directly, but the 0V took a round-the-houses route around the back of a little (1 Watt) buck regulator. Not the pcb tracking I'd use if I wanted -130dBV/√Hz out of a microphone preamp but for a digital signal with 1V of noise immunity, at no great speed I thought it would be OK - but no - loads of ACK, Failed to write Flash and that sort of error.  I cut the track, replaced it a piece of wire following the route of the data and clock tracks and it worked.


So, SWD is like a half-duplex version of SPI with MOSI and MISO multiplexed on to one pin, and it runs at 1MHz; so the important times are the clock transitions. Nothing else matters much. So there could be three things preventing it working - ground bounce caused by too fast an edge, jitter caused by too slow an edge, or interference getting in because the target is at quite a high impedance. So I tried a few things - 220pF across clock to ground, 1k pull-down, and 10k series impedance - 1k seemed most promising, but no real success.

The LPCXpresso crashed - I force quit it, and restarted it.
Then it all worked


So no I'm more puzzled than ever.

Another board from the same batch was prone to errors, but would work if my oscilloscope earth clip was connected to the circuit 0V.

I hear you saying that that that means the circuit should be properly earthed - but the circuit 0V is bonded to mains earth and the oscilloscope isn't.


A further puzzle is the "Target error from Commit Flash write" which says "system rejected access at location x"; but all the errors I got location x was in the RAM.


A different circuit won't connect when it is in its cabinet where it lives next to a switched mode supply. Take it out of the cabinet and it works with no problems.


I find this all very puzzling as I used SPI all the time at ten times the speed with no great considerations for pcb tracking. If it worked this badly, my LED displays would be flickering like a fluorescent tube with a duff starter.


Anyone any ideas?