S12DJ128 - BDM stop problem

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

S12DJ128 - BDM stop problem

2,581 Views
grutozoid
Contributor I

When I try to stop a HC12dj128, it's goes immediately running few second later.

I want to stop a working program to force execution of another one to change values in eeprom then return to the original one.

Any ideas?

Alban Edit: please mention Part Number in subject.

Message Edited by Alban on 2007-03-22 09:34 PM

Labels (1)
0 Kudos
7 Replies

571 Views
kef
Specialist I
Are you trying to "hotplug" through BDM to working system and stop it? If so, and if that succeeds (part isn't secured ant indeed stopps) but "runs" after few seconds, then I guess that COP is enabled and that COP timeout period is a few seconds. Is your dj128 old HC12 or new HCS12? It's weird why are you breaking all the runtime and changing eeprom in so odd way.
 
 
0 Kudos

571 Views
grutozoid
Contributor I
Thank's Kef, I will try that.

I know it's strange way to do that but I have a special task to do... and I'm a Intel specialist, but I had worked with Motorola CPU's 20 years ago... I have to return to school!!!

Somethings are quite similar with Intel but details... and what a documentation monster for HC12 series! I dont say that to tell you Intel is the best, I have no choice to work with, decision was taken before I come to Microtec Technologies... Now I'm consultant and use all kind of CPUs.

I downloaded a special routine in ram with code warrior I have to find a way to force my routine to execute without resetting cpu as he flushes ram when restarting. I imagine a way to do that if I push or change last return address corresponding to the start of my routine. Even if I loss the real last return address, I dont care as when some eeprom values will be modified I could reset the hole thing and I'm done. Is it science fiction?

Some things arent documented or difficult to find... like $ff07 with value or register relocation... is it possible to know more on BDM code in order to do more inhabitual or "indecent" moves?

Louis
0 Kudos

571 Views
Alban
Senior Contributor II
Bonsoir Louis,
 
Motorola/Freescale microcontrollers are still in the same spirit as they were 20 years ago.
This should smooth the learning curve.
 
It is not science fiction and is possible to stop execution at any time by plugging a BDM cable in Hot Plugging mode.
The MCU must not be secure for this to work.
 
You will then be able to change the RAM content (download an S-Record = S19...) and if you change the PC (program counter), as soon as you press GO, it will execute your code.
 
EDIT: I've got a doubt. You say HC12DJ128. Do you mean MC9S12DJ128? In this case, we call them S12. HC12 refers to an older technology. 
 
Cheers,
Alban.

Message Edited by Alban on 2007-03-22 09:37 PM

0 Kudos

571 Views
grutozoid
Contributor I
Merci, Alban.

I have another question about code warrior Command window.

When we connect to target, lot of things are listed in that window.

I guess the "read_data_values()..." are to refresh Memory screen if opened and for Assembly window, but some commands are weird, like "read_db_byte(0xFF07)" which is calling inside an area reserved for backdoor key string???

And strangely, it reads register relocation value and finds all others required to do debug work. It smells undocumented stuff again...

I read AN2104 and I saw READ_BD_BYTE cmd... are we talking of same thing? And how could I initiate that myself? And note that difference "_DB_" in code warrior and "_BD_" in AN2104 BDM doc...

It's quite confusing... ahhh! and why Motorola decided to follow Intel in that annoying relocating memories... it remembers me long debugging nights with 80186...

Louis

P.S. I have a S12...
0 Kudos

571 Views
Alban
Senior Contributor II
Louis,
 
By default, the Memory window is opened so the debugger reads the memory to refresh that component.
 
In the command window, if you type "help" you will get some basic commands.
To retrieve memory content from the command window, the command to use is "DB Address".
DB stands for display byte I think.
 
READ_BD_BYTE is a MCU hardware command. It is not the same as the CW one because CW and/or the debug cable can also refresh other locations in the same time.
The way to send very low level commands like READ_BD_BYTE is either to create your own cable, or use for instance the TBDML (see dedicated board) where you have access to the full cable firmware.
 
BD must mean Background Debug.
 
What do you mean by "Register relocation" ?
 
Cheers,
Alban.
0 Kudos

571 Views
grutozoid
Contributor I
>What do you mean by "Register relocation" ?

I forgot to add a word, I was thinking about "register ADDRESS relocation"...

The way we have to deal with memory, fixed address or variable addresses.

Why do you need to assign a particular address value for your ram at $0 or $1000, registers a $2000 instead of $4000 and Eeprom at $3000 or $6000???

Waste of time, another way to complicate header files adding possibility to have avoidable bugs like assigning on a bad boundary, adding lot more defines...

I dont care to have all fixed adresses for them... and you may save code...

First thing to do at init() is not to put some values in INITRM, INITRG and INITEE to separate them as they are all mixed over at reset?

Only acceptable exception is if you exceed 64K range like Flash memory, no choice to work with pages but it could be also linear, starting just after $FFFF!

That way everybody knows that with a given CPU, register is at $0, ram is just after, and so on!

My credo is "simple is beautiful"!

Louis.
0 Kudos

571 Views
Alban
Senior Contributor II
I see what you mean now.
 
Not everyone uses the MCU the same way.
While some people want to have access to the EEPROM, some other may not really care but would like to see the maximum of RAM possible.
 
That is why you can move the areas and map different amount of the type you want.
 
Simple is not enough here...
 
Alban.
0 Kudos