MC9S12DJ64

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

MC9S12DJ64

3,809 Views
wheelmonitor
Contributor II
I am using the MS9S12D64 MCU and it says in the data sheet that it has 4K RAM but it only spans from $400 to $1000 in the memory map and the .prm file which is only 3K (including the 1K EEPROM).  does anyone know how to access the full 4K RAM???
Labels (1)
0 Kudos
4 Replies

530 Views
wheelmonitor
Contributor II

hi there

i am not sure what AN you are referring to?

I checked for AN2881 and can't find it anywhere on the freescale site.

I wasn't able to find the conditional code u r referring to either.

i am attaching the start12.c file i am using and the prm file as well.

can u have a look and see what else can be done.

thanks for your help

0 Kudos

530 Views
CompilerGuru
NXP Employee
NXP Employee
Well, when searching for "AN2881.pdf" I did only find this thread :smileysad:.

Search for just AN2881, and there it is:
http://www.freescale.com/files/microcontrollers/doc/app_note/AN2881.pdf?srch=1

I was also refering to the startup code of the HC12 V4.5 release, which is located in the lib\hc12c\src directory.
Yours is derived from a previous release of CW.
(which is fine, it just does not contain the serial monitor code)

Here the two snippets from the start12.c file (the second one has to be done before Init is called):

#ifdef _HCS12_SERIALMON
/* for Monitor based software remap the RAM & EEPROM to adhere
to EB386. Edit RAM and EEPROM sections in PRM file to match these. */
#define ___INITRM (*(volatile unsigned char *) 0x0010)
#define ___INITRG (*(volatile unsigned char *) 0x0011)
#define ___INITEE (*(volatile unsigned char *) 0x0012)
#endif


#if defined(_HCS12_SERIALMON)
/* for Monitor based software remap the RAM & EEPROM to adhere
to EB386. Edit RAM and EEPROM sections in PRM file to match these. */
___INITRG = 0x00; /* lock registers block to 0x0000 */
___INITRM = 0x39; /* lock Ram to end at 0x3FFF */
___INITEE = 0x09; /* lock EEPROM block to end at 0x0fff */
#endif

Daniel
0 Kudos

530 Views
wheelmonitor
Contributor II

The application note was very helpfull.

Thank you very much for your help.

sincerely,

Jatinder

0 Kudos

530 Views
CompilerGuru
NXP Employee
NXP Employee
Out of Reset, the lowest 1k of the ram is hidden behind the registers from 0..3ff. So in order to access the whole 4K, you have to remap the ram or the registers.
One setup which works for all HCS12's is used by the serial monitor, and the start12.c startup code actually contains this setup already.
In the start12.c search the code conditionally compiled with "defined(_HCS12_SERIALMON)" and enable it for your code too (defined(_HCS12_SERIALMON) || 1) (even if you are not using the serial monitor).
Then, in the prm file use 0x3000 TO 0x3FFF as ram area instead of 0x0400 TO 0x0FFF.

Check the AN2881.pdf from the Freescale website for details (as HCS12 example, it even uses the DJ64).

Daniel

Message Edited by CompilerGuru on 2006-06-13 11:39 PM

0 Kudos