microchip-pic-avr-tools / pymcuprog

a Python utility for programming various Microchip MCU devices using Microchip CMSIS-DAP based debuggers
MIT License
104 stars 22 forks source link

nEDBG custom PIC18LF27K40 invalid device ID #41

Closed diorcety closed 9 months ago

diorcety commented 9 months ago

I attached to a pic18f47k42 curiosity nano a PIC18LF27K40 and try to use it using pymcuprog. I fall on strange issue:

2024-02-24 17:00:11,713 - MainThread - debuggerbase - INFO - Device ID read: 3520 2024-02-24 17:00:11,713 - MainThread - debuggerbase - ERROR - Unexpected device ID! (expected: 6960 read: 3520)

According to datasheet PIC18LF27K40 device id is 0x6A40 with is 0x3520 << 1. Is there a bit shift somewhere?

diorcety commented 9 months ago

I confirm: i read eeprom from a programmed chip: EEPROM: 0xDE 0xAD Read: 0x6F 0x56

diorcety commented 9 months ago

Problem found: At really low voltage (1.8V) a ICSP_CLOCK_PERIOD_NS of 200 (ns) seems to quick. Increasing it to 300 seems to solve the issue