I love to use on board debugger of FRDM to debug off-board microcontroller. Today I found an issue of WRONG SWDIO.
I used to MDK since it can be used to read chip IDCODE in debugger configuration Window. The target is M0+, MKL25Z. I have multiple boards. Some boards can be read as regular as:
SWDIO: 0x0BC11477 for MKL25Z128 (M0+)
SWDIO:0x2BA01477 for MK20DX128 (M4)
0BC11477->00001011110000010001010001110111
Some other boards will be read as:
FC0E001B->11111100000011100000000000011011
05E08A3B->00000101111000001000101000111011
Due to wrong IDCODE, MDK refuses to download.
I guess it is hardware related issue. Is there anything I can do? Shorter cable? Layout issue?
God only helps peple who helps himself.
I guess I got it.
The target board is powered by USB. It must have small Magnetic beads on both 5V and GND. Due to PCB layout issue, I use 0R to replace them. As a result, the noise from PC comes through whole ground and power supply, I believe noise in ground is more important.
Now I add a choke coil (TDK from SONY DC) on USB cable. It works on every tested board, although I haven't test all.
Here comes new question.
Before adding choke coil, some boards always failed with wrong IDCODE. After adding, then every tested board works. Even I removed the choke, they still work.
I bought a MKL25Z board from the market, which has dedicated SWD port. The debugger always reads out wrong IDCODE from SWD port. Now I connect debugger to dedicated port, it works fine. Switching back to SWD, it works again.
So maybe it is not 100% noise issue, improper connection could be another one. If I adjust the jumper wires, sometimes it works.
However, it implicts that the device should be reviewed by a prefessional hardware engineer. I am a software engineer who is trying to make own board. :smileyplain: