Salamek / picpro

PIC K150 programmer software written in Python 3
GNU General Public License v2.0
11 stars 2 forks source link

Checksum calculation error and verification issue #3

Open colbro51 opened 2 years ago

colbro51 commented 2 years ago

Hi, me again :-) I do not know how the checksum reader is working for you but it does not handle Intel Hex File Format as described in https://microchipdeveloper.com/ipe:sqtp-hex-file-format.

I have examined the code in HexFileReader.py and can understand that it follows the spec in interpreting the line parts, it is the checksum code that is in error. The line "for x in range(1, len(line) - 4, 2):" should be "for x in range(1, len(line) - 3, 2):". The -3 is one for the starting colon and 2 for the 2 hex checksum bytes. If you try the most trivial file (just eof) consisting of ":00000001FF" and put a print statement on the check for EOF Record you will see the result.

After correcting this in my HexFileReader.py I was able to do some verification checks. I tested against a clean unprogrammed chip. A read of the chip gives all locations as FFF except for the last factory pre-programmed location containing a MOVLW XX instruction of C74 in this instance (this can be used for calibrating the internal clock oscillator). Note that this last program location should not be overwritten in normal use.

So my first verification test was against a hex file of 64 words of FFF. It failed - presumably because of the last instruction. This is not useful - the verification should only check useful user-writable words (ie not the last location). My next test was with a hex file of 511 words of FFF and one word of C74. It passed.

The issue I have is that if I program a chip with say a 75 word program, will it "fail" because the software detects this "unwritten" non-blank word in the last location. If so, I guess I will just have to ignore the picpro response, do a read after programming and do my own "verification" of the chip. Cheers Colin

Salamek commented 2 years ago

Hmm i have to look on this when i get some time, i would like to drop that custom IntelHex parser in HexFileReader anyway and replace it with https://pypi.org/project/intelhex/ if possible (~no reason to maintain custom parser when there is whole lib for that)

colbro51 commented 2 years ago

OT: By the way, I came across this video: https://www.instructables.com/FixIt-PIC-K150-Programmer-TS8900-K150/ about how to fix a hardware issue with the TS8900-K150. I read a related comment elsewhere that the plastic socket could be carefully levered off without having to unsolder it to get to the track underneath.