Problem to read out on a MC9S12C128C with USBDM

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

Problem to read out on a MC9S12C128C with USBDM

Jump to solution
9,896 Views
ProNet36
Contributor I

Hi there,

i have big trouble to read out a MC9S12C128C.

When I read out the MC9S12C128C the page function does not work.
I have in the addresses :
388000 to 38BFFF
398000 to 39BFFF
3A8000 to 3ABFFF
3B8000 to 3BBFFF
3C8000 to 3CBFFF

always the same data from the address range

388000 to 38BFFF

What am I doing wrong or can it be a hardware problem?

Sincerly

David

0 Kudos
1 Solution
9,455 Views
pgo
Senior Contributor V

Hi,

The file you provided uses a linear array for the flash rather than paged addresses (as you are probably aware).

The HCS12 programmer only supports this format for a very few devices that provide programming directly in that format in the BDM interface.

I have added an option to the HCS12 programmer to convert SREC files from linear to paged addressing when loading the hex file.  The updated software is available on sourceforge:

https://sourceforge.net/projects/usbdm/files/ 

Using this version of the programmer I was able to program the device as expected from the image.

Doing a read-back using Usbm Memorydump provided an image that verified correctly against the programmed device in the programmer.

The image does not have repeated blocks which was the start of this discussion so I have no explanation for why that occurred.

I obviously cannot verify that the program runs correctly - let me know if there is still a problem.

 

Can you tell me what software produced the image provided?

bye

 

Edit: Updated link

View solution in original post

0 Kudos
27 Replies
3,015 Views
andy_Musk
Contributor III

i have the same problem!

0 Kudos
3,007 Views
pgo
Senior Contributor V

If you have the "same problem" then the same solution should work shouldn't it?

Please post a separate query with your problem please.

bye

0 Kudos
7,974 Views
ProNet36
Contributor I

I can definitely rule that out.
I have completely deleted the flash and written it with random data from pgo.
So the flash has no secure bit active.

0 Kudos
8,280 Views
pgo
Senior Contributor V

Hi David.

I'm unclear about your problem description:

always the same data from the address range

388000 to 38BFFF

I would expect to always receive the same data!

Are you saying that you are programming different data to the flash but when read-back it is always the same?

Do you mean that the region is filled with the same repeated value?

Anyway - to check if there is a problem do the following:

  • Use the memory dump program to read the [388000 to 38BFFF] region and save to a .S19 file.
  • Load the s19 file in the HCS12 programmer and use verify to check that it agrees with the contents of the chip.

I have done something similar to check the two programs using a image that fills the entire 128K flash with random data:

Program 128k random image - read-back 128K - verify read-back image in programmer.

If you still have a problem please provide:

  • USBDM hardware version.
  • USDBM software version
  • Operating system.

bye

 

0 Kudos
8,159 Views
ProNet36
Contributor I

Sorry for the delay and thank you for your help.
I use the programmer:
Serial = USBDM-JS16-SWD-0001
Hardware version = JS16CWJ
I bought this programmer on Amazon.


I think that I have not expressed myself correctly.

If I read a HCS12 with working program, and then reload this memory dump, the device no longer works.

In the Hex Editor I have seen that in the address areas:

398000 to 39BFFF
3A8000 to 3ABFFF
3B8000 to 3BBFFF
3C8000 to 3CBFFF

the same data can be found as in the address area:

388000 to 38BFFF

398000 to 39BFFF = data from 388000 to 38BFFF
3A8000 to 3ABFFF = data from 388000 to 38BFFF
3B8000 to 3BBFFF = data from 388000 to 38BFFF
3C8000 to 3CBFFF = data from 388000 to 38BFFF

I hope it is more understandable now.

0 Kudos
8,132 Views
pgo
Senior Contributor V

One question - Are you sure the chip is a MC9S12C128 and not a smaller chip?

When creating an image for a C128 I suggest the following memory regions

388000 38BFFF 2
398000 39BFFF 2
3a8000 3aBFFF 2
3b8000 3bBFFF 2
3c8000 3cBFFF 2
3d8000 3dBFFF 2
3e8000 3eBFFF 2
3f8000 3fBFFF 2

bye

24/4/22 Corrected error in ranges given (in case someone else looks here!)

0 Kudos
8,049 Views
ProNet36
Contributor I

hi there,

yes, i'm absolutly sure.

attached you will find a Picture.

IMG_20220422_204440_edit_541837766087633.jpg

If i read out with you settings:

38BFFF 38BFFF 2
398000 39BFFF 2
3a8000 3aBFFF 2
3b8000 3bBFFF 2
3c8000 3cBFFF 2
3d8000 3dBFFF 2
3e8000 3eBFFF 2
3f8000 3fBFFF 2

i get an error:

ProNet36_0-1650703318457.png

 

If i read out the MCU with your settings:

398000 39BFFF 2
3a8000 3aBFFF 2
3b8000 3bBFFF 2
3c8000 3cBFFF 2
3d8000 3dBFFF 2
3e8000 3eBFFF 2
3f8000 3fBFFF 2

i get this file. (40.zip)

Thanks!

0 Kudos
8,043 Views
pgo
Senior Contributor V

Hi,

sorry there was an error in the 1st line:

388000 38BFFF 2
398000 39BFFF 2
3a8000 3aBFFF 2
3b8000 3bBFFF 2
3c8000 3cBFFF 2
3d8000 3dBFFF 2
3e8000 3eBFFF 2
3f8000 3fBFFF 2

This copies the entire Flash through the paged memory window (8 x 16K).

I'll have a look at the image shortly.

bye

24/4/2022 -  Corrected range error in first line

0 Kudos
8,151 Views
pgo
Senior Contributor V

Hi,

Can you try the following using UsbdmScript.exe

settarget HCS12
openbdm
reset s h
connect

# write PPAGE
wb 0x30 0x3b
rb 0x30

# read start of mapped page 0x3B
rb 0x8000 0x20

# write PPAGE
wb 0x30 0x3c
rb 0x30

# read start of mapped page 0x3C
rb 0x8000 0x20

 Compare the results of the two reads from 0x8000.

0 Kudos
8,048 Views
ProNet36
Contributor I

Hi,

if i try your script i get this answer:

% settarget HCS12

USBDM DLL Version = 4.12.1.230

BDM List:

 0 - USBDM-JS16-SWD-0001  : USBDM HCS08,HCS12,CFV1,ARM-SWD BDM

Found 1 devices

:setTarget HCS12

% openbdm

Opening USBDM-JS16-SWD-0001

BDM Version = HW=98, SW=4C

 

% reset s h

:reset 0x04(HARDWARE, SPECIAL)

% connect

:connect

BDM status => Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running

Speed = 8000 kHz (960 ticks, sync=16.0 us)

Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running

%

% # write PPAGE

% wb 0x30 0x3b

:wb 0x00000030 <= 0x3B ...

% rb 0x30

:rb =>

  0x00000030 : 3B

59

%

% # read start of mapped page 0x3B

% rb 0x8000 0x20

:rb =>

  0x00008000 : 3B 1B 9F FD 31 00 AD 81 27 05 18 05 81 31 00 1D

  0x00008010 : 02 50 10 1C 02 52 10 1D 02 50 20 1C 02 52 20 1D

29

%

% # write PPAGE

% wb 0x30 0x3c

:wb 0x00000030 <= 0x3C ...

% rb 0x30

:rb =>

  0x00000030 : 3C

60

%

% # read start of mapped page 0x3C

% rb 0x8000 0x20

Many Thanks for your help!!

0 Kudos
8,042 Views
pgo
Senior Contributor V

Hi,

You seem to be missing the last line of the result which actually has the result for the second read for comparison.

bye

0 Kudos
8,037 Views
ProNet36
Contributor I

sorry,

here the complete answer:

% settarget HCS12
USBDM DLL Version = 4.12.1.230
BDM List:
0 - USBDM-JS16-SWD-0001 : USBDM HCS08,HCS12,CFV1,ARM-SWD BDM
Found 1 devices
:setTarget HCS12
% openbdm
Opening USBDM-JS16-SWD-0001
BDM Version = HW=98, SW=4C

% reset s h
:reset 0x04(HARDWARE, SPECIAL)
% connect
:connect
BDM status => Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
Speed = 8000 kHz (960 ticks, sync=16.0 us)
Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
% # write PPAGE
% wb 0x30 0x3b
:wb 0x00000030 <= 0x3B ...
% rb 0x30
:rb =>
0x00000030 : 3B
59
% # read start of mapped page 0x3B
% rb 0x8000 0x20
:rb =>
0x00008000 : 3B 1B 9F FD 31 00 AD 81 27 05 18 05 81 31 00 1D
0x00008010 : 02 50 10 1C 02 52 10 1D 02 50 20 1C 02 52 20 1D
29
% # write PPAGE
% wb 0x30 0x3c
:wb 0x00000030 <= 0x3C ...
% rb 0x30
:rb =>
0x00000030 : 3C
60
% # read start of mapped page 0x3C
% rb 0x8000 0x20
:rb =>
0x00008000 : 3B 1B 9F FD 31 00 AD 81 27 05 18 05 81 31 00 1D
0x00008010 : 02 50 10 1C 02 52 10 1D 02 50 20 1C 02 52 20 1D
29
%

i have delete the complete flash before an try it again:


% settarget HCS12
USBDM DLL Version = 4.12.1.230
BDM List:
0 - USBDM-JS16-SWD-0001 : USBDM HCS08,HCS12,CFV1,ARM-SWD BDM
Found 1 devices
:setTarget HCS12
% openbdm
Opening USBDM-JS16-SWD-0001
BDM Version = HW=98, SW=4C

% reset s h
:reset 0x04(HARDWARE, SPECIAL)
% connect
:connect
BDM status => Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
Speed = 8000 kHz (960 ticks, sync=16.0 us)
Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
% # write PPAGE
% wb 0x30 0x3b
:wb 0x00000030 <= 0x3B ...
% rb 0x30
:rb =>
0x00000030 : 3B
59
% # read start of mapped page 0x3B
% rb 0x8000 0x20
:rb =>
0x00008000 : FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x00008010 : FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
255
% # write PPAGE
% wb 0x30 0x3c
:wb 0x00000030 <= 0x3C ...
% rb 0x30
:rb =>
0x00000030 : 3C
60
% # read start of mapped page 0x3C
% rb 0x8000 0x20
:rb =>
0x00008000 : FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0x00008010 : FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
255
%

0 Kudos
8,025 Views
pgo
Senior Contributor V

Hi

This is a pretty convincing test that shows the pages contain the same data.

This is very surprising but I can't see any other explanation for the result i.e. I can't think of a hardware or software error in the USBDM software/hardware that would lead to this result.

I have attached a binary test file that can be used to do a 'round-trip' verification of the hardware/software.

The file programs the entire 128K image through the paged address space.  It uses random data that will be different for each page.

  1. Use the HCS12 programmer to program the test file to a test chip (one you don't mind erasing).  Select image for security since it programs the security region through the paged space which is unusual and will lead to a programming error if the programmer then tries to set the security through the unpaged range.
  2. Use the MemoryDump program to read the contents back using the (corrected again!) settings given below for the full memory dump. Save to a file.

388000 38BFFF 2
398000 39BFFF 2
3a8000 3aBFFF 2
3b8000 3bBFFF 2
3c8000 3cBFFF 2
3d8000 3dBFFF 2
3e8000 3eBFFF 2
3f8000 3fBFFF 2

  • Compare the file from step 1 to step 2.  They should be identical.  If so it indicates that everything is working.

If the above works then the only conclusion is that the the result obtained from reading the original chip is valid.

bye

 

PS.  The assumption upon which this whole discussion is based is that you have an existing chip that you are trying to duplicate and when you tried dumping it you found that it had repeated pages that implied a problem with the memory dump.

If you have an original file that you are trying to program, then there may of course be other problems related to that file such as an unexpected format.  If this is the situation please provide this file.

bye

0 Kudos
8,017 Views
ProNet36
Contributor I

Hi,

Thank you very much for your time and help.
Attached you will find the flash file read back.
But it is still the same problem.
What else I noticed, with the version
USBDM_4_12_1_262_Win.msi
programming is not possible and there is always this error message:

ProNet36_0-1650786485038.png

read out and delete work, but write is absolutly not possible.

You wrote:

PS.  The assumption upon which this whole discussion is based is that you have an existing chip that you are trying to duplicate and when you tried dumping it you found that it had repeated pages that implied a problem with the memory dump.

If you have an original file that you are trying to program, then there may of course be other problems related to that file such as an unexpected format.  If this is the situation please provide this file.

Exactly I have a board where I tried to pull a dump from the processor to play it on another board.
I also have a PE Micro Cylone Pro and the original flash file.
However, the HCS12 programmer cannot do anything with the address range.

 

0 Kudos
8,013 Views
pgo
Senior Contributor V

Hi,

Could you try version 4.12.1.240 please?

That appears to be the version I have installed on the Windows VM I am using.

bye

0 Kudos
8,011 Views
ProNet36
Contributor I

Hi,

attached the result with the version 4.12.1.240

it's the same problem. I have try too many older versions...

All have the same problem.

i have also bought 2 BDM programmers like this more.

https://www.amazon.de/gp/product/B07KSD2SFF/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

All 3pcs. have the same problem.

bye

0 Kudos
7,929 Views
pgo
Senior Contributor V

Hi,

I have  uploaded a new version to sourceforge.

https://sourceforge.net/projects/usbdm/files/Version%204.12.1/Software/ 

Please update the BDM firmware.

bye

0 Kudos
7,904 Views
ProNet36
Contributor I

Hi pgo,

many thanks for your help.

Today i installed the version 270 and updated my BDM firmware.

programming works.

but when i read out a memory dump, i have the same problem as before...

 

0 Kudos
7,895 Views
pgo
Senior Contributor V

Hi Again,

OK weird results.

If the device was secured the programmer and memory dump programs would not be able to access the chip and would report it as secured.

One last possibility is that the board uses the chip in expanded mode and so would not actually use the internal flash.  The chip you have does support this mode (large pin-count version). This would explain why reading the paged memory region would return the same data every time (from external ROM).  This is controlled by pin strapping on the board

Does the board have an external rom?

Can you check the mode the chip is in - read the MODE register @0x0B.

Use the following sequence with USBDM Script to read the important registers:

settarget HCS12
openbdm
reset s h
connect

# Reports security (BDMSTS = ENBDM BDMACT ENTAG SDV TRACE CLKSW UNSEC 0) 6.3.2.1 in Manual
gs

# All important registers for reference
rb 0 32

# MODE register (MODC MODB MODA 0 IVIS 0 EMK EME) 4.3.2.9 in Manual
rb 0x0b

# MISC register (0 0 0 0 EXSTR1 EXSTR0 ROMHM ROMON) 3.3.2.4 in Manual
rb 0x13

 Edited: Fixed comment  markers in script and added manual references.

0 Kudos
7,889 Views
ProNet36
Contributor I

Hi pgo,

The board does not use external flash.
Only the internal flash is used.
There is only one serial I2C EEPROM connected to save different configurations.


Here the answer of the USBDM script:

% settarget HCS12
USBDM DLL Version = 4.12.1.270
BDM List:
0 - USBDM-JS16-SWD-0001 : USBDM HCS08,HCS12,CFV1,ARM-SWD BDM
Found 1 devices
:setTarget HCS12
% openbdm
Opening USBDM-JS16-SWD-0001
BDM Version = HW=98, SW=4C

% reset s h
:reset 0x04(HARDWARE, SPECIAL)
% connect
:connect
BDM status => Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
Speed = 7983 kHz (962 ticks, sync=16.0 us)
Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
% ; Reports security (BDMSTS = ENBDM BDMACT ENTAG SDV TRACE CLKSW UNSEC 0)
invalid command name "Reports"
% gs
POWER => Vdd-External
Target status reg => (0xC0) = ENBDM, BDACT,
BDM status => Ackn, Speed-sync, Vpp-Off, Vdd-External, RSTO=1, No Reset, CFVx-running
Speed = 8000 kHz (960 ticks, sync=16.0 us)
192
% ; All important registers for reference
invalid command name "All"
% rb 0 32
:rb =>
0x00000000 : 60 00 00 00 00 00 00 00 0F 00 00 00 90 00 01 00
0x00000010 : 09 00 01 0D 00 0F 00 10 00 05 31 02 01 C0 40 F2
242
% ; MODE register (MODC MODB MODA 0 IVIS 0 EMK EME)
invalid command name "MODE"
% rb 0x0b
:rb =>
0x0000000B : 00
0
% ; MISC register (0 0 0 0 EXSTR1 EXSTR0 ROMHM ROMON)
invalid command name "MISC"
% rb 0x13
:rb =>
0x00000013 : 0D
13
%

 

0 Kudos