Odd EEPROM behaviour with PICKit3

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Odd EEPROM behaviour with PICKit3

Post by SHughes_Fusion » Tue Aug 19, 2014 4:20 pm

This is a very odd one, I hope someone else has seen this and found a solution!

Basically, if I use the Read or Blank Check functions in the PICKit3 programmer app to force a device reset it seems to corrupt some EEPROM values. Cycling the power works without problem.

I can't for the life of me work out what is going on! I sometimes use this as an easy way to reset the processor when I'd debugging - cycling power isn't ideal on my current system as I'm also using an RN42 Bluetooth module which I keep connected to a PC terminal. If I just reset the PIC then this stays connected, if I cycle the power I have to reconnect it.

So far it seems to be resetting locations $24 and $29 to $FF. I don't know about any others, I need to try and work out how to read the device to check the EEPROM contents without using the Read function as this is what causes the corruption!

While I would hope the unit would never see this type of reset in service I'd like to get to the bottom of the problem so I can take steps to prevent it happening in service if necessary.

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: Odd EEPROM behaviour with PICKit3

Post by Jerry Messina » Tue Aug 19, 2014 7:05 pm

I don't have a PICKit3 with me at the moment to check this out, but it's possible the device has a chance to begin running as the PK3 gets it into and out of programming mode.

Does your code do anything with the EEPROM when it first starts up? If so, try adding an initial delay at startup before the EEPROM is ever accessed... something like 'Delayms(500)' and see if that helps things.

If all you're trying to do is reset the device isn't there a "Target MCLR" checkbox or some such setting in the programming app? There was with the PICKit2...

SHughes_Fusion
Posts: 219
Joined: Wed Sep 11, 2013 1:27 pm
Location: Chesterfield

Re: Odd EEPROM behaviour with PICKit3

Post by SHughes_Fusion » Wed Aug 20, 2014 7:52 am

Hi Jerry,

(I'm beginning to think this site should be renamed 'Ask Jerry'! :)

I do access the EEPROM but only to read it. I also don't write to the locations that are being corrupted directly, they are in the middle of a string which is written (and read) in one go.

However, the suggested delay does do the trick so it appears that somehow the PIC is writing to EEPROM without WREN being enabled or that something the PICKit does enables it when it isn't expected.

The PICKit3 does have a check button for /MCLR but it doesn't appear to do anything. There is also a menu option of 'Hold device in reset' but again that does nothing. The PK3 application is basically the PK2 one with a few changes to make it work, unfortunately they don't seem to have got anything beyond the ability to program devices working and they've abandoned it in favour of the MPLab IPE even though that has even fewer features. Sometimes got to wonder who is in charge of these things at Microchip as they seem able to ignore the fact most people have problems with it.

Post Reply