Trouble programming an MC9S12A64 with USBDM - says flash was not erased

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

Trouble programming an MC9S12A64 with USBDM - says flash was not erased

816 Views
tambrose
Contributor II

I'm trying to update a pool controller that has an MC9S12A64.  I have a .s19 file from the manufacturer.  

When I try to update the flash with my USBDM, it looks like it is working, but then fails during verification with a message about the flash was not erased.

I can no longer boot the controller, so I know that at least some of it was erased.

7 Replies

751 Views
pgo
Senior Contributor V

Hi,

It is likely that the file format is not expected by the programmer.

There is some variation in how paged addresses are represented e.g. linear vs paged programming. It is also complicated by EPROM and possibly EEPROM banking.

The error you are seeing is likely caused by the same page being programmed twice.  When it programs the second page it finds it is not blank, hence the error (which is a bit misleading).  This is from my recollection and as it's a long time since I played with 9S12s I may be misremembering.

Anyway, if you can provide the original file provided by the supplier I can have a look at why it is not programming correctly.

Don't provide the converted files please.

bye

0 Kudos
Reply

717 Views
tambrose
Contributor II

Thanks.  I've attached a zip of the original .s19 file.

Let me know if you see any issues there.

0 Kudos
Reply

698 Views
pgo
Senior Contributor V
Hi,
I have only had a quick look at this and I haven't searched for the hardware to test this but could you try the following:
- Select 'linear image' before loading the file
- Security - 'Image'
- Programming Erase Mode = 'EraseMass'
If this doesn't work I will look for a chip and programmer to test with.

bye

Info - The image appears to be 0xF0000 -> 0xFFFFF. Selecting linear will map this to paged addresses 0x3C8000-0x3CBFFF, 0x3D8000-0x3DBFFF etc. You need to select Image for security to prevent the security area being programmed twice through the paged area and the unpaged area.
0 Kudos
Reply

680 Views
tambrose
Contributor II

That did it!!!

I got some bad advice before and was trying to convert the linear format to block/page.  Clearly that didn't work.

Thank you so much.  What a relief.

0 Kudos
Reply

809 Views
tambrose
Contributor II

ok - played around a bit more.

I can read out the flash using the memory dump tool.  I can see that if I do a MassErase, it is actually erased.  Then I can write the .s19 file and read it out with the memory dump tool.

I am confused about the s19 files.  The original one (from the manufacturer) was for an older programmer and linear.  I was told to convert it using SRecCvt to the MC9S12A64 blocked format.  Then write that to the controller and read back.

All three look very different.  Here are the first few lines of each:

Original-

S2140F00003B1B96E6F012C0082706C0082717204BA2
S2140F0010C6036B87E68B876C85CE00641810046565
S2140F0020026387202AC6056B87EC8F6C85CE271058
S2140F003018100465026387EC85CE03E81810046574
S2140F0040026387EC85CE006418100465026387ECA4
S2140F005085CE000A18100465026387180A87886918
S2140F006082E6F016042107E6F014E0876B82E6F0CE
S2140F007014E188240E6B88E6F016042106E688E065

Converted-

S2243C80003B1B96E6F012C0082706C0082717204BC6036B87E68B876C85CE0064181004657E
S2243C8020026387202AC6056B87EC8F6C85CE271018100465026387EC85CE03E81810046563
S2243C8040026387EC85CE006418100465026387EC85CE000A18100465026387180A87886973
S2243C806082E6F016042107E6F014E0876B82E6F014E188240E6B88E6F016042106E688E00A
S2243C8080876B82876A89E6823BCC00203BCC34C04A6AC73E1B84E6826B82068138C6206B6A
S2243C80A0EA34C0E687638704010E0401100401120401140401162019CC00012012CC000AC9
S2243C80C0200DCC00642008CC03E82003CC27106C83ED8303AD85223DE6F0162609E682E1A6
S2243C80E0882508E6F016042113E682B796EC85EE831810B754C300306BEA34C0EC85EE837E

Read back after writing to controller-

S113400087C77C331ACC01E87C32D887C77C32D688
S1134010CC49F07C32D4CC00027C32D2CC01E87C96
S113402032DC87C77C32DAC67A7C32ECC77C32EA6F
S1134030C6F47C32E8C77C32E6CC01E87C32E48703
S1134040C77C32E2CC03D07C32E087C77C32DECC42
S113405005DC7C32F087C77C32EECC3C347C32F415
S1134060CC00027C32F23D87B746C60104460459AF
S11340700436FCFA331BBA331A7C331A3D87B7462D

 

0 Kudos
Reply

807 Views
tambrose
Contributor II

I spent some more time with the s19 files and am now thinking that the files are ok.  I definitely read out the wrong address ranges for the post.

Things are starting to make sense now...at least a bit.

I'm still not sure why it won't verify correctly.

0 Kudos
Reply

780 Views
tambrose
Contributor II

Interesting new data....

I did a Mass Erase Now and then read back the flash.  Here is the first entry in the read back:

S2143C82F0FFFFFFFFFFFFFFFFFFFFFFFF000000FF4A
Type: S2 (A record containing the 3-bytes address at which the code/data is to reside)
Length: 0x14
Address: 0x3C82F0
Data:  0x3C82F0 FF FF FF FF FF FF FF FF - ????????
            0x3C82F8 FF FF FF FF 00 00 00 FF - ????????
CheckSum: 0x4A

Here is the where the data read back after updating starts to not match:

S2143C83000AC1902604C60E3100000020E9E680E053
Type: S2 (A record containing the 3-bytes address at which the code/data is to reside)
Length: 0x14
Address: 0x3C8300
Data:  0x3C8300 0A C1 90 26 04 C6 0E 31 - ???&???1        <---- this is correct
           0x3C8308 00 00 00 20 E9 E6 80 E0 - ??? ????         <---- this is completely wrong
CheckSum: 0x53

All of the data after this is incorrect.

It seems odd that the bad data is just past the area that didn't erase, but that seems to mess it all up.

 

So, any ideas?  Is it a bad part?  Is there a way to truly erase it?

Thanks

0 Kudos
Reply