HCS12_FlashProgrammer error.

cancel
Showing results for 
Search instead for 
Did you mean: 

HCS12_FlashProgrammer error.

594 Views
Contributor III

Hi when trying to reprogram a t64 variant of 9S12 i get the following error :
Programming of the target flash failed!

Reason: Internal program error - please report.

The software detects the mcu correctly and it finds that it is secured. The bus frequency is correct and i choose "mass erase" from the dropdown menu.

I am using a .s19 file.

What could be the fault?

This is the entry that i created in hcs12_devices.xml

<device family="HCS12" name="MC9S12T64">
     <clock type="External" />
     <memory type="ram">
        <memoryRange start="0x0800" end="0x0FFF" />
     </memory>
     <memory pageAddress="0x0030" registerAddress="0x0100" type="flash" securityAddress="0xFF00" sectorSize="1024" >
        <securityEntryRef ref="HCS12-default-security" />
        <memoryRange start="0x1000" end="0x3FFF" />            <!--  Fixed 0x3D partial -->
        <memoryRange start="0x4000" end="0x7FFF" />            <!--  Fixed 0x3E -->
        <memoryRange start="0x8000" end="0xBFFF" pages="64K"  pageEnd="0x3F" />
        <memoryRange start="0xC000" end="0xFFFF" />            <!--  Fixed 0x3F -->
     </memory>
     <sdid value="0x4220" />
     <flashProgramRef ref="HCS12-MMCV4-FTS-flash-program" />
     <note>Untested</note>
  </device>
0 Kudos
4 Replies

28 Views
Senior Contributor V

Hi Padelis,

Unfortunately the flash in the 9S12T64 is different to any of the currently supported devices and I don't have any similar device to test with.

Attached is a ZIP file with files you can try.  I have no way of testing these - good luck.

Copy hcs12_devices.xml to C:\Program Files (x86)\pgo\USBDM 4.10.6.120\DeviceData

Copy HCS12-MMCV4-FTS_3-flash-program.s19 to C:\Program Files (x86)\pgo\USBDM 4.10.6.120\DeviceData\HCS12

The remaining files are test files to check that the flash routines work.

bye

0 Kudos

28 Views
Contributor III

Unfortunately it doesnt work.

I can reprogram the mcu using codewarrior but i want to do the same with my standalone flasher tool.

Can i use hardware BDM commands to do it?

How can i find more information on the sequence that codewarrior uses to reprogram/erase the mcu?

0 Kudos

28 Views
Senior Contributor V

Hi Padelis,

I have no information on the algorithms used by Codewarrior.  These are proprietary.

It is possible to do some basic operations using TCL scripts with USBDM such as mass erasing the device.  More complex operations are only possible with a more complex process - this would usually be done by a control program written in C.

It is possible to do "command line" programming using Codewarrior but I have no experience of this.

If you can give me some more information on how the programmer failed I might be able to correct it, but it is a painful process.

  • What the device correctly detected by the programmer - if not the SDID value in the XML value may be incorrect.  Does the programmer report a Chip ID when asked to detect the device?
  • Do none of the test files program?  Not even the empty file with mass erase selected?
  • You can run the debug version of the programmer "HCS12_FlashProgrammer-debug" to generate a debug log in %APPDATA%/usbdm

bye

0 Kudos

28 Views
Contributor III

Hi pgo,

Yes the programmer detects correctly the mcu.

Did all tests and it all failed in the beginning.

I started writing my own custom reflash code. I upload it to ram using bdm and execute it using bdm. Seems to work ok except at the start of address 0x8000 and for the next 656 bytes. It seems that there is an issue with the ppage register setting. I will sort that out pretty soon.

Thank you.

0 Kudos