Did manage to program the PIC16F1765
using this hack.
Although the Pickit2 will recognize the correct Device ID
something is up as I'm getting the following message when I load my HEX file: no configuration words in hex file use file export to save
After manually setting up the configuration bits
and writing a test firmware to the PIC I managed to make an LED start blinking at a fixed rate.
As suggested by Scasis, I went debugging the Device Id Read Script( scriptNumber=3 [MR_RdDevID1
] ) only to realize it appears to be pointing to the correct memory address:
0 0xAAEE tx LOAD CONFIGURATION COMMAND (0x00) -> sets the address to 0x8000
3 0xAAF2 delay 8 clock cycles (tx 8 clear bits)
5 0xAAF2 delay 8 clock cycles (tx 8 clear bits)
7 0xAAEE tx INCREMENT ADDRESS COMMAND (0x06) -> sets address to 0x8001
10 0xAAE9 LOOP -> repeats the INCREMENT ADDRESS COMMAND 5 times and sets the address to 0x8006
11 0xBB03 index offset to loop to = 3 (jumps to 7)
12 0xBB05 loop iterations = 5
13 0xAAEE tx LOAD DATA FROM PROGRAM MEMORY COMMAND(4) -> puts 14bit data in the DATA line
16 0xAAF0 READ 14 bit data LSB and put it in the DATA line, advance the pointer
17 0xAAF0 READ 14 bit data MSB and put it in the DATA line, advance the pointer
(Total of 64 bits sent)
Not sure about How the Revision ID
is being read, I did try to create a version of the above code where I repeat the process twice, but setting the latter address to 0x8005
instead of 0x8006.
This did not make any difference.
From here I went on debugging the script scriptNumber=34 [MR_CfgRd2.1
] but this is also pointing to the right memory of 0x8007 and reading two words (14 bits long each) using the above method, but adding an extra loop in order to read one more word.
In my PkDeviceFile.dat
, I have the following fields setup according to the PIC programming specs
In my test firmware, my configuration bits are setup as follow:
; __config 0xC984
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
; __config 0xDCFB
__CONFIG _CONFIG2, _WRT_OFF & _PPS1WAY_OFF & _ZCD_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_LO & _LPBOR_OFF & _LVP_OFF
Any ideas on why the configuration bits ARE NOT being found/loaded by the PicKit2 software?
I mean, could this be due to the lack of the process of reading the Revision ID, or something I'm missing in the PkDeviceFile or ASM?
Any help is greatly appreciated.