EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: belzrebuth on November 02, 2021, 03:30:33 pm

Title: Difference between PIC18F2420 and PIC18LF2420
Post by: belzrebuth on November 02, 2021, 03:30:33 pm
Hi all,
I've read the hex file from a PIC18LF2420 and wrote it to a PIC18F2420 but the latter does not work as expected.
When I put the original PIC18LF in its place the circuit works fine.
What would be the so critical difference between these two?
I read that the LF has an eeprom type rom vs a flash on the F.
Can one work in place of the other or they're incompatible?
Thanks.
Title: Re: Difference between PIC18F2420 and PIC18LF2420
Post by: oPossum on November 02, 2021, 03:40:58 pm
LF can operate at lower voltages then F. See page 26.1 of the data sheet.

Did you read the config memory (fuses)?
Title: Re: Difference between PIC18F2420 and PIC18LF2420
Post by: belzrebuth on November 02, 2021, 03:42:54 pm
I think the board is 5V throughout so no problem with that I guess.
I didn't read any config though..
Just read the pic with my pickit3 saved the .hex and wrote that to the other pic.
Title: Re: Difference between PIC18F2420 and PIC18LF2420
Post by: oPossum on November 02, 2021, 03:47:00 pm
That could be the problem. The config memory sets the oscillator type, watchdog, brownout and other stuff. See 23.0 of the data sheet.

Reading the data memory (EEPROM) too would be a good idea.
Title: Re: Difference between PIC18F2420 and PIC18LF2420
Post by: belzrebuth on November 02, 2021, 06:29:20 pm
Not sure if I'm doing something wrong here but it seems that I'm actually reading:
a) program memory
b) configuration memory
c) EEdata memory
When writing the .hex I can see those three being programmed to the target PIC.

If my original PIC was locked would I be able to read the .hex file?
I don't know if it's locked or not but the target PIC does not seem to work if I write the original's PIC .hex into it.
Title: Re: Difference between PIC18F2420 and PIC18LF2420
Post by: oPossum on November 02, 2021, 09:25:27 pm
A commercial product will typically be code protected (locked). A PIC can be read if it is code protected, but the read will typically be all 0xFF or garbage.

Check the configs bits to determine if it is code protected. The config bits themselves are not protected.
Title: Re: Difference between PIC18F2420 and PIC18LF2420
Post by: belzrebuth on November 02, 2021, 11:01:13 pm
It's indeed code protected as seen in the configuration values.
All I can see in the program data tab is zeroes.
So I don't think I can clone it to another chip after all..