USBDM and HCS12 9S12D64, read/write problems

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

USBDM and HCS12 9S12D64, read/write problems

ソリューションへジャンプ
8,202件の閲覧回数
potros
Contributor I

HI!

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?

MemoryDump.jpg

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.

Regards

0 件の賞賛
返信
1 解決策
5,681件の閲覧回数
pgo
Senior Contributor V

Hi Potros,

The simple answer is that the Memory dump program doesn't support paged addresses.

I have rectified this in the current version just uploaded.

I have confirmed operation with a MC9S12A64 chip which is similar to the one you are using.

  • It was tested it with a memory image that filled the entire memory (Flash+eeprom) with random data.
  • This image was programmed to the target using the MC9S12A64ALT device which locates the EEPROM@0x1000.
  • The following settings were used to read the data back using the current version of USBDM_MemoryDump

pastedImage_2.png

  • The saved image was the same as the original apart from S0/S9 records.

bye

元の投稿で解決策を見る

8 返答(返信)
5,681件の閲覧回数
vasilkostadinow
Contributor I

Dear Pgo,

I am working with MC9S08AC128 and MC09S12Q128 MCUs, but can not correctly read the memory with Memory Dump. I see You place the exaple for MC9S12A64ALT. Can You place and examples for MC9S08AC128 and MC09S12Q128 for paged memory reading?

0 件の賞賛
返信
5,681件の閲覧回数
potros
Contributor I

Hi PGO

Sorry for my late answer.

I have checked it and it works well right now :smileyhappy:

I have some doubts about specific regions, but its a matter of play and understand correctly how the uC works

Thank you very much for your help and time.

Kind regards.

0 件の賞賛
返信
5,681件の閲覧回数
pgo
Senior Contributor V

Hi Potros,

It has been quite a while since I have looked as 9S12 devices so I may be a bit foggy.

According to the memory map in the manual (p27) the D64 supports paging with 64K flash with the last page being 0x3F so I think the original entry was correct.

To read the original chip it is necessary to use paged addresses (I believe from memory!).

Possible reasons for error on programming:

  • The paging isn't the way I think it is :smileyhappy:
  • The Flash is also in banks internally and there is some manipulation necessary to program the correct bank - I may have this incorrect.
  • The memory image you are using is not in the correct format (e.g. assumes a different page mapping - it is not uncommon for this to be wrong.  For example some images assume non-implemented page register bits so the pages don't go 0x3E, 0x3F.  It may also assume a flat memory map (no paging).

Please do the following:

  • Can you post your image so I can check the paging please. 
  • Use the debug version of the programmer and post the two log files from %APPDATA%\usbdm
  • I will review the programming code tonight
  • If you are using Codewarrior you can program the device within the Codewarrior debugger and it will use an internal algorithm - not USBDM code at all so this would be a good check.

bye

0 件の賞賛
返信
5,680件の閲覧回数
potros
Contributor I

Thank you very much PGO for such quick answer.

Looking at the memory map of the uC, the region paged is just between 0x8000 and 0xBFFF, that in this particular case, have 4 pages. The first 0x0000 to 0x4000 are irrelevant.. right?

Memory-MC9S12D64.jpg

You can download the following file, where i have inlcuded the dump that I got (version 3.5), and the dump from X-Prog (version 4.5):

Dropbox - 9S12D64_firms.rar

I'm looking for the debug version of the programmer (I don't find it), and also trying to program it with codewarrior suite that it's my first contact with this enviroment, so its a bit difficult.

I will update you asap with any sucess.

Again... thanks for your time.. :smileyhappy:

Regards.

0 件の賞賛
返信
5,680件の閲覧回数
potros
Contributor I

Hi Again

Finally I program it correctly with the codewarrior debugger.

After this , i tried to work with the USBDM tools, and I have found that the "USBDM Memory Dump" don't work correctly.

  • When the first section is disabled using 0 as width, nothing is readed. This is a capture of the tool after press "Read Memory"

Captura1.jpg

  • Acording with the physical memory organization, there are 4 pages (in this case of 64kB). Two of this pages are directly linked to a fixed memory address, and the first to pages can be selected by a register, to be shown in the range 8000-BFFF. Take a look:

Captura2.jpg

This means that:

      • Range from 0x4000-0x7FFF: is liked with 0x3E8000-0x3EBFFF
      • Range from 0x8000-0xBFFF: can be linked with 0x3C8000-0x3CBFFF OR with 0x3D8000-0x3DBFFF
      • Range from 0xC000-0xFFFF: is linked with 0x3F8000-0x3FBFFF

If I try to read those four segments with the dump tool, I just get the same segment (the first one, so starting with 0x3C8000) copied 4 times.

I didn't try to write. I think is better to have a correct dump.

I hope this can help you PGO. Let me know how can I help you. I didn't find any "debug" version of your suite.

Kind regards.

0 件の賞賛
返信
5,682件の閲覧回数
pgo
Senior Contributor V

Hi Potros,

The simple answer is that the Memory dump program doesn't support paged addresses.

I have rectified this in the current version just uploaded.

I have confirmed operation with a MC9S12A64 chip which is similar to the one you are using.

  • It was tested it with a memory image that filled the entire memory (Flash+eeprom) with random data.
  • This image was programmed to the target using the MC9S12A64ALT device which locates the EEPROM@0x1000.
  • The following settings were used to read the data back using the current version of USBDM_MemoryDump

pastedImage_2.png

  • The saved image was the same as the original apart from S0/S9 records.

bye

5,680件の閲覧回数
Wuzhong
Contributor I

Hi pgo,

Could you tell me about "Initialzation"?

Initialization.JPG

Is it write 0x11 to 0x12(adress of memory)?

Thanks

Boone

0 件の賞賛
返信
5,680件の閲覧回数
vasilkostadinow
Contributor I

Dear Pgo,

I am working with MC9S08AC128 and MC09S12Q128 MCUs, but can not correctly read the memory with Memory Dump. I see You place the exaple for MC9S12A64ALT. Can You place and examples for MC9S08AC128 and MC09S12Q128 for paged memory reading?

0 件の賞賛
返信