Extern RAM with MC9S12DP256B

Started by ventre ludovic March 21, 2005
hello,
I am working with MC9S12DP256B and i would like to
communicate with Extern RAM.
If somebody know how is it possible Please? Tell me
Sincerly

Ludo
PS: I'm sorry for my english

Douvrez le nouveau



Ludo,

Bienvenue la liste HC12!
(Welcome to the HC12 list!)

Interfacing external RAM to the 9S12D series is quite difficult.
These parts are designed for single-chip operation. The external bus
is an afterthought useful primarily for emulator vendors.

Doron Fael has written a bit about what the bus interface requires.
There are particular problems, such as negative setup times, that make the
design quite challenging. You might like to take a look in the archives
for messages from Doron in the last few months. Not coincidentally,
Doron is an emulator engineer.

If you just need storage, and can accept slow access, you can hang the
RAM off port pins and implement the bus signals in software.

Stephen

--
Stephen Trier
Technical Development Lab
Cleveland FES Center


Stephen,

I have configured my regiter
PORTK = 0xFF
DDRK = 0xFF
MISC = 0x02
PEAR=0x0C
MODE=0xE0
EBICTL= 0x01

but nothing is occuring.

Thanks
Ludo

> Ludo,
>
>Bienvenue la liste HC12!
>(Welcome to the HC12 list!)
>
>Interfacing external RAM to the 9S12D series is quite difficult.
>These parts are designed for single-chip operation. The external bus
>is an afterthought useful primarily for emulator vendors.
>
>Doron Fael has written a bit about what the bus interface requires.
>There are particular problems, such as negative setup times, that make the
>design quite challenging. You might like to take a look in the archives
>for messages from Doron in the last few months. Not coincidentally,
>Doron is an emulator engineer.
>
>If you just need storage, and can accept slow access, you can hang the
>RAM off port pins and implement the bus signals in software.
>
>Stephen
>
>--
>Stephen Trier
>Technical Development Lab
>Cleveland FES Center



Ludo,

Do you have an oscilloscope? If so, write a little program to generate
activity on the RAM (reading or writing one location over and over, for
example), and look at the bus activity with the oscilloscope to see what
is happening. Start by looking at the control signals: ECLK and R/W on
the HC12, and the corresponding /CE (or /CS), /OE, and /WE pins on the
RAM chip. If you're convinced those are correct, you can trace out the
data and address bus activity.

I have never attempted to add external RAM to the 9S12D series, so I
cannot tell you if those register settings are appropriate. Perhaps
someone else on the list can help with that.

Stephen

--
Stephen Trier
Technical Development Lab
Cleveland FES Center
sct@sct@...



Stephen,
I have an oscilloscope. Iam working with Noice
Debugger and i launch my program.
I am seeing in the oscilloscope the /CS(it's 16bits)of
my Ram and the ECLK signal and the Adress bus and data
Bus (DB15-DB0) , the result is the following:
it 's happening something on the the Adress bus and
data Bus (DB4) nothing is happening.
The /cs signals are correct but the ECLk clock is
arriving late when the data is alredy on the bus. I
don't understand, normally the adress or the data
could be lacthed at the ECLK failing edge.

when i am in noice debugger, My program start in
$4000 but it's anything. However, when i 'am touching
my arrows on my keyboard, in the oscilloscope i 'have
my signal which are moving as the noice is reaiding
in external memory.

how i can write in my'external RAm? What is it the
instruction to write into the RAM?

Thanks you for your help.

Ludo

--- Stephen Trier <sct@sct@...> wrote:

---------------------------------
Ludo,

Do you have an oscilloscope? If so, write a little
program to generate
activity on the RAM (reading or writing one location
over and over, for
example), and look at the bus activity with the
oscilloscope to see what
is happening. Start by looking at the control
signals: ECLK and R/W on
the HC12, and the corresponding /CE (or /CS), /OE, and
/WE pins on the
RAM chip. If you're convinced those are correct, you
can trace out the
data and address bus activity.

I have never attempted to add external RAM to the
9S12D series, so I
cannot tell you if those register settings are
appropriate. Perhaps
someone else on the list can help with that.

Stephen

--
Stephen Trier
Technical Development Lab
Cleveland FES Center
sct@sct@...

---------------------------------
Yahoo! Groups Links

To

__________________________________________________________________
Douvrez le nouveau



Ludo,

Here are a few notes on your configuration:

>MISC = 0x02

This will turn off the internal Flash. Do you really want to turn it off. I
think it is more likely you want to configure MISC to 0x03 or 0x01 to keep
the Flash turned on, to allow your code to execute out of the internal Flash.

Also, this MISC settings is for 0 wait-states access to the external RAM. I
suggest to set at least 1 wait-state to begin with, and only later try to
reduce to no-wait-states.

>MODE=0xE0

Do you connect any of the PORTK pins as address signals for the external
RAM? If so you need to set the EMK bit of the MODE register. This will
configure PORTK so it is used as the extended address outputs, and the ECS
signal.

>PEAR=0x0C
>EBICTL= 0x01

These settings for the PEAR and EBICTL registers are good.

Apart from this, your problem can very likely be in the hardware side of
the external bus interface. As Stphen indicated earlier, the HCS12 bus is
really not user freindly.
You should probably read carefully an application note I wrote on the
subject, which is available on the Nohau web-site (under the below link, in
the HC12 Application notes area)

Hope this helps,
Doron
Nohau
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html At 04:42 29/03/2005 -0500, you wrote:

>Stephen,
>
>I have configured my regiter
>PORTK = 0xFF
>DDRK = 0xFF
>MISC = 0x02
>PEAR=0x0C
>MODE=0xE0
>EBICTL= 0x01
>
>but nothing is occuring.
>
>Thanks
>Ludo
>
> >
> >
> >
> > Ludo,
> >
> >Bienvenue la liste HC12!
> >(Welcome to the HC12 list!)
> >
> >Interfacing external RAM to the 9S12D series is quite difficult.
> >These parts are designed for single-chip operation. The external bus
> >is an afterthought useful primarily for emulator vendors.
> >
> >Doron Fael has written a bit about what the bus interface requires.
> >There are particular problems, such as negative setup times, that make the
> >design quite challenging. You might like to take a look in the archives
> >for messages from Doron in the last few months. Not coincidentally,
> >Doron is an emulator engineer.
> >
> >If you just need storage, and can accept slow access, you can hang the
> >RAM off port pins and implement the bus signals in software.
> >
> >Stephen
> >
> >--
> >Stephen Trier
> >Technical Development Lab
> >Cleveland FES Center




Doron ,

i would use external memory only to write and to read
data into.( The external memory is there only to store
data)

My configuration is
>MISC = 0x07
>PEAR=0x0C
>EBICTL= 0x01
>MODE=0xE2 (Normal Expanded Wide)
>
I have read your application node : HCS12 Expanded
Mode bus-design and HCS12 ICE use in Expanded-Modes
guide
But I don't understand how is it possible to write
into the external memory.
the EMK in Mode register is used in Emulation Mode ,
No?
I think the Emk register is used to transfert
automatically the value from the PPAGE Register to
the POTK Register.

Thnaks for your help.
Sincerly
Ludo

--- Doron Fael <doronf@doro...> wrote:

---------------------------------
Ludo,

Here are a few notes on your configuration:

>MISC = 0x02


This will turn off the internal Flash. Do you really
want to turn it off. I
think it is more likely you want to configure MISC to
0x03 or 0x01 to keep
the Flash turned on, to allow your code to execute out
of the internal Flash.

Also, this MISC settings is for 0 wait-states access
to the external RAM. I
suggest to set at least 1 wait-state to begin with,
and only later try to
reduce to no-wait-states.

>MODE=0xE0

Do you connect any of the PORTK pins as address
signals for the external
RAM? If so you need to set the EMK bit of the MODE
register. This will
configure PORTK so it is used as the extended address
outputs, and the ECS
signal.

>PEAR=0x0C
>EBICTL= 0x01

These settings for the PEAR and EBICTL registers are
good.

Apart from this, your problem can very likely be in
the hardware side of
the external bus interface. As Stphen indicated
earlier, the HCS12 bus is
really not user freindly.
You should probably read carefully an application note
I wrote on the
subject, which is available on the Nohau web-site
(under the below link, in
the HC12 Application notes area)

Hope this helps,
Doron
Nohau
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html At 04:42 29/03/2005 -0500, you wrote:

>Stephen,
>
>I have configured my regiter
>PORTK = 0xFF
>DDRK = 0xFF
>MISC = 0x02
>PEAR=0x0C
>MODE=0xE0
>EBICTL= 0x01
>
>but nothing is occuring.
>
>Thanks
>Ludo
>
> >
> >
> >
> > Ludo,
> >
> >Bienvenue la liste HC12!
> >(Welcome to the HC12 list!)
> >
> >Interfacing external RAM to the 9S12D series is
quite difficult.
> >These parts are designed for single-chip operation.
The external bus
> >is an afterthought useful primarily for emulator
vendors.
> >
> >Doron Fael has written a bit about what the bus
interface requires.
> >There are particular problems, such as negative
setup times, that make the
> >design quite challenging. You might like to take a
look in the archives
> >for messages from Doron in the last few months. Not
coincidentally,
> >Doron is an emulator engineer.
> >
> >If you just need storage, and can accept slow
access, you can hang the
> >RAM off port pins and implement the bus signals in
software.
> >
> >Stephen
> >
> >--
> >Stephen Trier
> >Technical Development Lab
> >Cleveland FES Center


---------------------------------
Yahoo! Groups Links

To

__________________________________________________________________
Douvrez le nouveau



Ludo,

The EMK bit of the MODE register is write-once in Normal expanded mode. It
is used to enable the high-order page address bits to an external memory
device. You need it usually if you want to access more than 16K of external
memory, and use the PPAGE register in order to access different 16K pages
in the external RAM.

How big is your external RAM?
How big is the portion of the external memory you want to access?

The settings of MISC to 0x07 should allow accessing 16K of the external
memory through the 0x4000 - 0x7FFF window (if all the external memory
interface hardware is tuned and set correctly).

If you set EMK to 1, you should be able to also access many 16Kbyte pages
of the external RAM through the 0x8000 - 0xBFFF window, by setting the
PPAGE register to different values. If you would like to use this method,
please note that you need a special external memory access function that
sits in the un-paged Flash area somewhere in the 0xC000 - 0xFFFF range, so
the PPAGE register can be changed in the beginning of the function, and be
restored in the end of the function, without changing the execution of the
code in the paged Flash that also use the PPAGE register to execute in
different Flash pages. (Since the CALL and RTC instructions modify the
PPAGE value to execute code in different Flash pages). In this method, the
Flash occupies the high PPAGE pages from 0x3F and down, and the external
RAM occupies the low PPAGE pages from 0x00 and up.

Apart from the above, how important is the speed of your accessing of the
external memory. If speed is not very important, you should consider
operating in Normal Single-Chip mode, and accessing the external RAM by bit
banging PORT A, B, E and K pins as General-purpose I/Os. This method
produce slower accesses to the external memory, but the timing on the
external bus interface is much more relaxed and easy to meet (no danger of
negative hold times etc.).

Hope this helps,
Doron
Nohau
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 14:33 30/03/2005 +0200, you wrote:

>Doron ,
>
>i would use external memory only to write and to read
>data into.( The external memory is there only to store
>data)
>
>My configuration is
> >MISC = 0x07
> >PEAR=0x0C
> >EBICTL= 0x01
> >MODE=0xE2 (Normal Expanded Wide)
> >
>I have read your application node : HCS12 Expanded
>Mode bus-design and HCS12 ICE use in Expanded-Modes
>guide
>But I don't understand how is it possible to write
>into the external memory.
>the EMK in Mode register is used in Emulation Mode ,
>No?
>I think the Emk register is used to transfert
>automatically the value from the PPAGE Register to
>the POTK Register.
>
>Thnaks for your help.
>Sincerly
>Ludo




Doron,

Thanks you for your explanation.

I understand in what the EMK is used.

For example, i would like to write the data 0x0001 in
address 0:8002 (PPAGE =0x00), i wrote :

#define externalMEM *(unsigned int *)(0x8002)
PPAGE = 0x00;
externalMEM = 0x0001;

After this, nothing are occuring into my external
Memory.

My configuration is the following: MISC = 0x0D
( Only want to access at external memory between
$8000-0xBFFF )
PEAR = 0x0C

MODE = 0xE3

EBICTL = 0x01
I don't know this configuration is appropriated.

However, when i flash my program in external memory
all operare very well.
MISC = 0x0F (ROMHM =1 to access at 0x4000-0x7FFF).
I can execute my program in the external memory
(0x4000-0x7FFF). Thanks you
Ludo
--- Doron Fael <doronf@doro...> wrote:

---------------------------------
Ludo,

The EMK bit of the MODE register is write-once in
Normal expanded mode. It
is used to enable the high-order page address bits to
an external memory
device. You need it usually if you want to access more
than 16K of external
memory, and use the PPAGE register in order to access
different 16K pages
in the external RAM.

How big is your external RAM?
How big is the portion of the external memory you want
to access?

The settings of MISC to 0x07 should allow accessing
16K of the external
memory through the 0x4000 - 0x7FFF window (if all the
external memory
interface hardware is tuned and set correctly).

If you set EMK to 1, you should be able to also access
many 16Kbyte pages
of the external RAM through the 0x8000 - 0xBFFF
window, by setting the
PPAGE register to different values. If you would like
to use this method,
please note that you need a special external memory
access function that
sits in the un-paged Flash area somewhere in the
0xC000 - 0xFFFF range, so
the PPAGE register can be changed in the beginning of
the function, and be
restored in the end of the function, without changing
the execution of the
code in the paged Flash that also use the PPAGE
register to execute in
different Flash pages. (Since the CALL and RTC
instructions modify the
PPAGE value to execute code in different Flash pages).
In this method, the
Flash occupies the high PPAGE pages from 0x3F and
down, and the external
RAM occupies the low PPAGE pages from 0x00 and up.

Apart from the above, how important is the speed of
your accessing of the
external memory. If speed is not very important, you
should consider
operating in Normal Single-Chip mode, and accessing
the external RAM by bit
banging PORT A, B, E and K pins as General-purpose
I/Os. This method
produce slower accesses to the external memory, but
the timing on the
external bus interface is much more relaxed and easy
to meet (no danger of
negative hold times etc.).

Hope this helps,
Doron
Nohau
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html

At 14:33 30/03/2005 +0200, you wrote:

>Doron ,
>
>i would use external memory only to write and to read
>data into.( The external memory is there only to
store
>data)
>
>My configuration is
> >MISC = 0x07
> >PEAR=0x0C
> >EBICTL= 0x01
> >MODE=0xE2 (Normal Expanded Wide)
> >
>I have read your application node : HCS12 Expanded
>Mode bus-design and HCS12 ICE use in Expanded-Modes
>guide
>But I don't understand how is it possible to write
>into the external memory.
>the EMK in Mode register is used in Emulation Mode
,
>No?
>I think the Emk register is used to transfert
>automatically the value from the PPAGE Register to
>the POTK Register.
>
>Thnaks for your help.
>Sincerly
>Ludo


---------------------------------
Yahoo! Groups Links

To

__________________________________________________________________
Douvrez le nouveau



Doron,

Thanks you for your help i have succeded to write and
read into the external memory.

I really thank you for your kindness.

Sincerly
Ludo
--- Doron Fael <doronf@doro...> wrote:

---------------------------------
Ludo,

Here are a few notes on your configuration:

>MISC = 0x02

This will turn off the internal Flash. Do you really
want to turn it off. I
think it is more likely you want to configure MISC to
0x03 or 0x01 to keep
the Flash turned on, to allow your code to execute out
of the internal Flash.

Also, this MISC settings is for 0 wait-states access
to the external RAM. I
suggest to set at least 1 wait-state to begin with,
and only later try to
reduce to no-wait-states.

>MODE=0xE0

Do you connect any of the PORTK pins as address
signals for the external
RAM? If so you need to set the EMK bit of the MODE
register. This will
configure PORTK so it is used as the extended address
outputs, and the ECS
signal.

>PEAR=0x0C
>EBICTL= 0x01

These settings for the PEAR and EBICTL registers are
good.

Apart from this, your problem can very likely be in
the hardware side of
the external bus interface. As Stphen indicated
earlier, the HCS12 bus is
really not user freindly.
You should probably read carefully an application note
I wrote on the
subject, which is available on the Nohau web-site
(under the below link, in
the HC12 Application notes area)

Hope this helps,
Doron
Nohau
HC12 In-Circuit Emulators
www.nohau.com/emul12pc.html At 04:42 29/03/2005 -0500, you wrote:

>Stephen,
>
>I have configured my regiter
>PORTK = 0xFF
>DDRK = 0xFF
>MISC = 0x02
>PEAR=0x0C
>MODE=0xE0
>EBICTL= 0x01
>
>but nothing is occuring.
>
>Thanks
>Ludo
>
> >
> >
> >
> > Ludo,
> >
> >Bienvenue la liste HC12!
> >(Welcome to the HC12 list!)
> >
> >Interfacing external RAM to the 9S12D series is
quite difficult.
> >These parts are designed for single-chip operation.
The external bus
> >is an afterthought useful primarily for emulator
vendors.
> >
> >Doron Fael has written a bit about what the bus
interface requires.
> >There are particular problems, such as negative
setup times, that make the
> >design quite challenging. You might like to take a
look in the archives
> >for messages from Doron in the last few months. Not
coincidentally,
> >Doron is an emulator engineer.
> >
> >If you just need storage, and can accept slow
access, you can hang the
> >RAM off port pins and implement the bus signals in
software.
> >
> >Stephen
> >
> >--
> >Stephen Trier
> >Technical Development Lab
> >Cleveland FES Center


---------------------------------
Yahoo! Groups Links

To

__________________________________________________________________
Douvrez le nouveau