第二版原理图,芯片STM32F103C8T6,KEIL开发环境,JLINK V8仿真器,VCC/GND/SWD/SWI四线仿真模式,出现的问题是能下载程序也能正常运行,但是不能调试,一旦调试,就会出现下面报错:
***JLink Error: CPU is not halted
**JLink Warning: CPU could not be halted
***JLink Error: Can not read register 15 (R15) while CPU is running
***JLink Error: Can not read register 16 (XPSR) while CPU is running
***JLink Error: Can not read register 0 (R0) while CPU is running
***JLink Error: Can not read register 1 (R1) while CPU is running
***JLink Error: Can not read register 2 (R2) while CPU is running
***JLink Error: Can not read register 3 (R3) while CPU is running
***JLink Error: Can not read register 4 (R4) while CPU is running
***JLink Error: Can not read register 5 (R5) while CPU is running
***JLink Error: Can not read register 6 (R6) while CPU is running
***JLink Error: Can not read register 7 (R7) while CPU is running
***JLink Error: Can not read register 8 (R8) while CPU is running
***JLink Error: Can not read register 9 (R9) while CPU is running
***JLink Error: Can not read register 10 (R10) while CPU is running
***JLink Error: Can not read register 11 (R11) while CPU is running
***JLink Error: Can not read register 12 (R12) while CPU is running
***JLink Error: Can not read register 13 (R13) while CPU is running
***JLink Error: Can not read register 14 (R14) while CPU is running
***JLink Error: Can not read register 15 (R15) while CPU is running
***JLink Error: Can not read register 16 (XPSR) while CPU is running
***JLink Error: Can not read register 17 (MSP) while CPU is running
***JLink Error: Can not read register 18 (PSP) while CPU is running
***JLink Error: Can not read register 20 (CFBP) while CPU is running
网上有很多中说法,有说复位电路问题,换电阻、电容解决了的(阻容匹配不好引起的问题吗?);有换驱动版本解决的;有将复位设置成Core and Peripherals解决的;有说下载线太长的缘故;有说是BOOT0、BOOT1管脚的问题,一动BOOT1后就出现这些报错,有说降低速度解决的。
最初我是将复位改成Core and Peripherals,问题解决,如下图
随后又进行了换短下载线的测试,将Reset选项换回Normal模式,将下载线换成4根短线进行了测试,问题也解决,能正常调试了(在第一版中,做了个20cm转接4线的转接下载线,加上仿真器自带的20cm的20线下载线,共40cm长的下载线,在第一版中使用正常,到这第二版就出了问题了)。
接着又换回40cm长的下载线,再debug,Reset选项依然是Normal模式,也不报错了,能正常下载调试了,呵呵,不明白的多了去了,追究不了,就这样吧,呵呵
过了一晚上再来过,呵呵,原来昨天的是幻觉,即便将Reset选项设置为Core and Peripherals,调试依然是报错,偶尔能好那么一下下,但是很快又是报错,雅蠛蝶,只好把下载线重新做成短的试试,做了根15cm长4线的,再调试,ok,整个世界清静了。