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" />|
|<memoryRange start="0x0800" end="0x0FFF" />|
|<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 -->|
|<sdid value="0x4220" />|
|<flashProgramRef ref="HCS12-MMCV4-FTS-flash-program" />|
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 18.104.22.168\DeviceData
Copy HCS12-MMCV4-FTS_3-flash-program.s19 to C:\Program Files (x86)\pgo\USBDM 22.214.171.124\DeviceData\HCS12
The remaining files are test files to check that the flash routines work.
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?
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.
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.