Skip to content

PICkit2

ivanwick edited this page Feb 9, 2023 · 2 revisions

ICSP pin connection

5 wires/pins must be connected between the board and the programmer.

Diagram of connection

Spacing of these holes is standard pitch that matches the PICkit pins. I was able to connect without any soldering by plugging a long pin header into the programmer and leaning it inside the holes enough to make contact.

Solderless connection setup

Verify connection

PICkit software reads the microcontroller device ID when it is connected. It should report that it detected the PIC16LF1938. If not, adjust the connection and rescan by selecting menu Tools → Check Communication.

PICkit2 screenshot showing device autodetect

Command Line

$ pk2cmd -P -I
Auto-Detect: Found part PIC16LF1938.

Device ID = 24A0
Revision  = 0003
Device Name = PIC16LF1938

Operation Succeeded

Dump Firmware Backup

Enable both Program Memory and EEPROM Data, and click the Read button. This will dump the current contents of the microcontroller which you can save to a file. Select menu File → Export Hex.

PICkit2 screenshot showing read

You can write your saved OEM dump back to the device to "factory reset" the firmware.

Command Line

$ pk2cmd -PPIC16LF1938 -GF oem_backup.hex
Read successfully.

Operation Succeeded

Write New Firmware

Select menu File → Import Hex, and open the .hex file you downloaded from the releases page.

PICkit2 screenshot showing programming successful

Enable both Program Memory and EEPROM Data, and click the Write button. Afterward, you can also click Verify to check that the write was successful.

Command Line

$ pk2cmd -PPIC16LF1938 -F bekantfirmware.v20210530.hex -M
PICkit 2 Program Report
30-7-2021, 16:55:57
Device Type: PIC16LF1938

Program Succeeded.

Operation Succeeded

$ pk2cmd -PPIC16LF1938 -F bekantfirmware.v20210530.hex -Y
PICkit 2 Verify Report
30-7-2021, 16:56:28
Device Type: PIC16LF1938

Verify Succeeded.

Operation Succeeded

Test New Firmware

Proceed to test and adjust the new firmware.