Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC

Ads

Discussion Groups

Discussion Groups | 68HC12 | EEPROM of MC9S12DP256

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

EEPROM of MC9S12DP256 - Roger Schaefer - Feb 2 8:16:00 2003

Hello All,

I have written an assembly routine to write one byte to the EEPROM of
the MC9S12DP256. The routine is called with the destination address
in the index register and the data in REG A. Since the "EEPROM" on
the MC9S12DP256 is a small sector FLASH this requires making a copy
of the destination aligned sector in RAM, changing the required byte
and rewriting the four byte RAM buffer to EEPROM. I understand that
the sector in EEPROM is first erased and the two aligned words are
written.

My problem is that the subroutine works fine the first time I call it
but fails the second time; the third time the routine is called it
works but not the forth and so on. It doesn't matter if I am writing
sequential bytes or random bytes within the EEPROM area.

Has anyone else had similar problems with the Command State Machine
of the MC9S12DP256?

Roger Schaefer
http://www.ezl.com/~rsch/





(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: EEPROM of MC9S12DP256 - djsimpson100 - Feb 3 18:24:00 2003

Hi Roger,

You must program an aligned word to the EEPROM of the DP256.
Attempting to program a misaligned word or a byte will cause an
ACCERR error. This is explained in the EETS4K block guide Section
4.1.4.

David

--- In , "Roger Schaefer <rsch@e...>"
<rsch@e...> wrote:
> Hello All,
>
> I have written an assembly routine to write one byte to the EEPROM
of
> the MC9S12DP256. The routine is called with the destination
address
> in the index register and the data in REG A. Since the "EEPROM" on
> the MC9S12DP256 is a small sector FLASH this requires making a copy
> of the destination aligned sector in RAM, changing the required
byte
> and rewriting the four byte RAM buffer to EEPROM. I understand
that
> the sector in EEPROM is first erased and the two aligned words are
> written.
>
> My problem is that the subroutine works fine the first time I call
it
> but fails the second time; the third time the routine is called it
> works but not the forth and so on. It doesn't matter if I am
writing
> sequential bytes or random bytes within the EEPROM area.
>
> Has anyone else had similar problems with the Command State Machine
> of the MC9S12DP256?
>
> Roger Schaefer
> http://www.ezl.com/~rsch/




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: EEPROM of MC9S12DP256 - Roger Schaefer - Feb 6 15:23:00 2003

Hi,
I found my problem; it was not that I was writing to non-aligned
words or not setting flags in the correct order but rather it was a
problem with my main program. It was writing to the EEPROM area and
reading back the same location to check if it was RAM or ROM. This
started the State Machine. The solution was to write a couple of
instructions at the beginning subroutine to write a zero to ESTAT
then clear the error flag of ACCERR.

Hope this helps someone else.

Roger

--- In , "Roger Schaefer <rsch@e...>"
<rsch@e...> wrote:
> Hello All,
>
> I have written an assembly routine to write one byte to the EEPROM
of
> the MC9S12DP256. The routine is called with the destination
address
> in the index register and the data in REG A. Since the "EEPROM" on
> the MC9S12DP256 is a small sector FLASH this requires making a copy
> of the destination aligned sector in RAM, changing the required
byte
> and rewriting the four byte RAM buffer to EEPROM. I understand
that
> the sector in EEPROM is first erased and the two aligned words are
> written.
>
> My problem is that the subroutine works fine the first time I call
it
> but fails the second time; the third time the routine is called it
> works but not the forth and so on. It doesn't matter if I am
writing
> sequential bytes or random bytes within the EEPROM area.
>
> Has anyone else had similar problems with the Command State Machine
> of the MC9S12DP256?
>
> Roger Schaefer
> http://www.ezl.com/~rsch/




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )