AnsweredAssumed Answered

USBDM and HCS12 9S12D64, read/write problems

Question asked by potros potros on Jan 19, 2016
Latest reply on Apr 27, 2019 by Boone Lu



I would like to ask for help as i'm a bit desperated. I will try to be as clear and short as possible.


My task is to upgrade a 9S12D64 with a newer version of software (no matter about what). My first idea was to read the unit (to have a backup), and I did it without problems with the memory dump utility, reading from 0x0000 to 0xFFFF (in reality I read from 0x4000 as the first part is RAM area). It generates a good loking S19 file, but I looking inside the file, it's strange to find that the adress from 0x4000 up to 0x5000 was empty (0xFF)... it sound like a mistake in the read procedure from my side.. perhaps i did something wrong... can someone tell me if I get a correct (and complete) dump?




After get different readings, believing that I had a backup of it, I tried to write back the same data (from the .s19 file)... I didn't success, and soon I get realized that the HCS12 must be erased, so I did it.


Finally it started to write data on the device, but at the 2/3 of the process it stops and launch an error because the memory was not empty. After some time, I get realized that:


  • The memory from 0x0000 up to 0x7FFF is correctly written
  • The memory from 0x8000 up to 0xBDDD is written starting in the address 0x5000, and as it was previusly written, now is not empty, so the error appears
  • The memory from 0xC000 up to 0xFFFF is correctly written


So as it seems it's a remap problem, I dig into the HCS12 programmer, and in found where the device is defined (hcs12_devices.xml), and I changed this line:


<memoryRange start="0x8000" end="0xBFFF" pageReset="0x3E" pages="64K"  pageEnd="0x3F" />


for this other:


<memoryRange start="0x8000" end="0xBFFF" />


And now, I can write the device without error... but I guess this is a big mistake, and the definition of the device was Ok, and i'm a stupid.


Finally.. i tried to write the device with a new firmware that was readed by x-prog hardware, and I have two files. One for the flash (from 0x0000 to 0xFFFF, 64k), and another for the eeprom (just 1K). I wrote the flash part (without problems but with the modification in the hc12_devices.xml file), but no idea how can I write the Eeprom file.


Obviusly, right now I have a device that makes nothing... not sure if it's because the eeprom was not written, or because the way to program it was not correct (probably both)


Probably this is a very basic and noob problem but I thank you very much if you can help me, explaining me what i'm doing wrong, or the correct procedure to do it.


Thanks in advance for your time and attention.