Bootloader回放是我的第一个嫌疑犯,但是我已经过了CyoDE,没有任何东西可以在任何范围内提出任何不同的地址,所有的地址看起来都是完全独立的。用PICTIT2/CMD读回,确认上面的0x4000看起来像是0x00,表明芯片级别机制在起作用。用PICTIT2/PK2CMD擦除和回放显示内存在那里,0xFF到处都是从0x00到0x8000。所以基本上AFAIS有以下原因:内存读回为0x00 .1)错误的芯片-检查(除非它是伪造的,不要这样认为)2芯片问题-测试了几个芯片,勘误表提到,注意三)EBTR机制是踢(CPN在正常模式AFAIU没有影响),所以我把注意力转向配置位和这个这就是我发现的问题:PK2CMD没有正确地编程CPN、WRTN和EBTNNIT。我像这样编程芯片:有什么不对吗?另一个问题是:我也有了CIPIT3,这是我一生中使用过的一次,因为我不喜欢MPLAB IPE。但是,为了调试这个问题,我尝试了它,却一无所获。它声称,当连接到同一个ICSP报头时,它不能检测目标VDD,其中PICTIT2没有问题。这两个程序员在ICSP中需要的是不同的还是我的PICTIT3损坏了?现在,我试图回忆过去,我似乎记得原来的PKC2M不支持PIC18F45 K50,我清除了PK2DEVICE文件。这可能是问题所在吗?如果有的话,想知道在哪里得到一个功能文件或修复?(300007)除300007以外的所有数据都与数据表完全一致。根据数据表300007未实现并应读取为00(它确实如此),但数据表还列出默认值/未编程值,如FF;必须是文档错误,FF未被校正为其他未被标记的位。D读00
以上来自于百度翻译
以下为原文
The bootloader readback was my first suspect also but I've been over the
code and there is nothing that would suggest anything different for
addresses in any range, everything seems to be totally independent
of the address. Reading back with PICKit2/cmd just confirmed that
the above 0x4000 looks like 0x00 suggesting that a chip level
mechanism is at work.
Erasing with PICKit2/pk2cmd and reading back shows that the memory is there,
0xFF everywhere from 0x0000 to 0x8000.
So basically AFAIS there are the following reasons for memory reading back as 0x00.
1) Wrong chip -- checked (unless it is a counterfeit, don't think so)
2) Chip problem -- tested with several chips, errata mentions noting like that
3) EBTR mechanism is kicking in (CPn has no effect in normal mode AFAIU)
So I turned my attention to the CONFIG bits and this is what I found:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D
-----------------------------------------
00 25 5F 3F 00 D3 A5 00 0F C0 0F E0 0F 40 -- after pkcmd -e (bulk erase) (*)
23 68 5F 3C -- D3 81 -- 00 80 0F 80 0F 00 -- CONFIG bits in bootloader.hex file
23 68 5F 3C 00 D3 81 00 01 80 03 80 03 00 -- after pgramming bootloader.hex with pkcmd
23 68 5F 3C 00 D3 81 00 01 80 03 80 03 007 -- after bootloader has programmed the chip
So I guess the problem is that the pk2cmd does not program the CPn,WRTn and EBTRn
bits correctly.
I program the chip like this:
./pk2cmd -b. -fbootloader.hex -pPIC18lf45k50 /m /e /j /r
Anything wrong with that?
A side question: I've also got PICKit3 which I've used like once in my life cause I do not like the MPLAB IPE.
But to debug this problem I tried it and got nowhere fast. It claims that it cannot detect target VDD when
connected to the same ICSP header where PICKit2 has no problems. Do those two programmers differ in
what they require from the ICSP or is my PICKit3 damaged?
Now that I try to recall the past I seem to remember that originally pkc2m did not support PIC18F45K50
and I scavenged the PK2DeviceFile.dat to do that from somewhere in the interweb ... could that be
the problem? If so any idea where to get a functional file or fix that?
(*) All except 300007 look exactly as per data sheet.
According to data sheet 300007 is not implemented
and should read as 00 (which it does) but the data
sheet also lists the default/unprogrammed value as FF;
must be documentation error and the FF is not correct
as all other bits marked as unimplemented read 00