HC12A512 Mass Erase

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HC12A512 Mass Erase

2,028 Views
GreenCode
Contributor I
Hi, I'm using the Mass Erase command on the Flash from a bootloader running in RAM. There are no errors reported, and the Erase Verify command also gives the appropriate 'Erased' feedback. However, the Flash content remains unchanged!?!?
 
If I use the same sequence of instructions via the BDM, it works as it should. Are there timing issues that are not listed in the data sheets?
 
Labels (1)
0 Kudos
6 Replies

542 Views
kef
Specialist I
Are you using write protection? Mass erase won't work if there are write protected regions. You can mass erase all memory banks (not pages, but banks), except one where you have your bootloader.
 
Did you do Erase Verify on all memory banks, or just one? S12A512 has 4 memory banks, I think.
0 Kudos

542 Views
GreenCode
Contributor I
I erase and erase verify each block in the order of (3, 2, 1, 0). Both protection and security are disabled for each block.
 
When I do it via the BDM, reading the FSTAT reg when the CBEIE if set following the erase verify command it returns $C0, then I read the FSTAT again and it returns $C5 (I would expect $C4)... There is about a 10mS dwell between the two reads.
 
I had to put a similar deadwait in my bootloader code too...
 
Are there any timing issues not documented?
 
 
0 Kudos

542 Views
kef
Specialist I
Hm, how do you determine that flash contents remains unchanged? Hiwave debugger caches flash contents! Are you sure debugger isn't fooling you?
0 Kudos

542 Views
dkelly
Contributor I
But if the Hiwave BDM debugger cached FLASH contents that would have made it appear as if the erase did NOT work on the debugger, the opposite of what is observed.

I am having similar problem trying to unlock an NE64. It works perfectly page by page on the BDM but only the unlocked pages outside of 0xf800.ffff when running off the BDM.

Am afraid that I have read somewhere the trivial backdoor key of all 0xff was disallowed in newer S12's, and that might apply to me as well.
0 Kudos

542 Views
GreenCode
Contributor I
... about the unlocking... I read in one of the Mask Set Errata thingys from Freescale of issues in that area. I've not had an issue with the unlocking with the HC12Axxx, but I've always had a meaningfull value in the 'backdoor'... 
0 Kudos

542 Views
GreenCode
Contributor I
I've got it to work! Simple in hindsight!
 
I did the BDM version a couple of years time ago, just followed a procedure from an app note - worked...
 
So, to do it from a bootloader - just do the same thing - doesn't work...
 
The bootloader version MUST do a 16 bit write to the flash block for it to actually erase something. The fact that it didn't complain, and reported it as 'blank' had me looking in all the wrong places...
 
This extra operation is a real pain! I've only got a very small patch of RAM to safely work in, and I want it work for a several HC12 sizes A128... A512...
 
Thanks for your help
 
0 Kudos