EmbeddedRelated.com
Forums
Memfault State of IoT Report

erasing 256k flash memory with mc9s12dp256

Started by Micro m6net September 5, 2002
Hi,

With a self programmed bootloader which runs in Ram, we have some trouble to erase memory flash block with mass_erase command.

But if we send two times the function, we have a correct erasing.

Therefore, same function but in writing mode works properly after erasing with BDI.

Thanks by advance.

Florent.



Hi Florent.

I have already seen that you sent this question in the list but I am afraid
that people won't be able to reply if you don't provide more program details.

Do you know that there are some free flash drivers available from Motorola
for the DP256?

http://e-www.motorola.com/webapp/sps/site/prod_summary.jsp?code=MC9S12DP256B
&nodeIdM0ym4t3ZGM0zGQK100

Check "Software" section:

HCS12SGF25NVMSSD HCS12 SGF NVM Standard Software Driver
Flash program/erase software driver for embedded applications and BDM
programming tools.

Regards,

Gilles At 09:50 AM 9/5/2002, you wrote:
>Hi,
>
>With a self programmed bootloader which runs in Ram, we have some trouble
>to erase memory flash block with mass_erase command.
>
>But if we send two times the function, we have a correct erasing.
>
>Therefore, same function but in writing mode works properly after erasing
>with BDI.
>
>Thanks by advance.
>
>Florent. >
>-------------------- >
>">http://docs.yahoo.com/info/terms/




Thank you Gilles for your information, we are regarding if we can answer to
our problem with motorola website.

----- Original Message -----
From: "Gilles Blanquin" <>
To: <>
Sent: Thursday, September 05, 2002 10:41 AM
Subject: Re: [68HC12] erasing 256k flash memory with mc9s12dp256 > Hi Florent.
>
> I have already seen that you sent this question in the list but I am
afraid
> that people won't be able to reply if you don't provide more program
details.
>
> Do you know that there are some free flash drivers available from Motorola
> for the DP256?
http://e-www.motorola.com/webapp/sps/site/prod_summary.jsp?code=MC9S12DP256B
> &nodeIdM0ym4t3ZGM0zGQK100
>
> Check "Software" section:
>
> HCS12SGF25NVMSSD HCS12 SGF NVM Standard Software Driver
> Flash program/erase software driver for embedded applications and BDM
> programming tools.
>
> Regards,
>
> Gilles > At 09:50 AM 9/5/2002, you wrote:
> >Hi,
> >
> >With a self programmed bootloader which runs in Ram, we have some trouble
> >to erase memory flash block with mass_erase command.
> >
> >But if we send two times the function, we have a correct erasing.
> >
> >Therefore, same function but in writing mode works properly after erasing
> >with BDI.
> >
> >Thanks by advance.
> >
> >Florent.
> >
> >
> >
> >
> >
> >
> >--------------------
> >
> >
> >
> >">http://docs.yahoo.com/info/terms/ >
> -------------------- >
> ">http://docs.yahoo.com/info/terms/




Maybe you are not clearing your error flags in both banks. Something
like this below. This code is for a DP128 so your number of banks
may vary.

void FlashStaClr(void)
{
FCNFG &= ~BKSEL; // select bank 0
FSTAT |= (PVIOL | ACCERR); // clear errors
FCNFG |= BKSEL; // select bank 1
FSTAT |= (PVIOL | ACCERR); // clear errors
}

Also, make sure to follow the datasheet sequence precisely.
--- In 68HC12@y..., "Micro m6net" <micro.plus@m...> wrote:
> Hi,
>
> With a self programmed bootloader which runs in Ram, we have some
trouble to erase memory flash block with mass_erase command.
>
> But if we send two times the function, we have a correct erasing.
>
> Therefore, same function but in writing mode works properly after
erasing with BDI.
>
> Thanks by advance.
>
> Florent. >





There is also an errata on the mass erase command. Here is a quote
from it:

If the Erase Verify ($05) command is issued on an array that is not
erased as indicated by the FSTAT/ESTAT BLANK bit not being set upon
command completion, the execution of the Sector Erase ($40) or Mass
Erase ($41) command will not properly erase the intended region. The
Program ($20) command will execute properly.

Workaround
If the Erase Verify ($05) command is issued on an array that is not
erased, subsequent Sector Erase ($40) or Mass Erase ($41) commands
must be issued twice before the intended region is properly erased. --- In 68HC12@y..., "s_spears_2000" <sspears30@h...> wrote:
> Maybe you are not clearing your error flags in both banks.
Something
> like this below. This code is for a DP128 so your number of banks
> may vary.
>
> void FlashStaClr(void)
> {
> FCNFG &= ~BKSEL; // select bank 0
> FSTAT |= (PVIOL | ACCERR); // clear errors
> FCNFG |= BKSEL; // select bank 1
> FSTAT |= (PVIOL | ACCERR); // clear errors
> }
>
> Also, make sure to follow the datasheet sequence precisely. >
> --- In 68HC12@y..., "Micro m6net" <micro.plus@m...> wrote:
> > Hi,
> >
> > With a self programmed bootloader which runs in Ram, we have some
> trouble to erase memory flash block with mass_erase command.
> >
> > But if we send two times the function, we have a correct erasing.
> >
> > Therefore, same function but in writing mode works properly after
> erasing with BDI.
> >
> > Thanks by advance.
> >
> > Florent.
> >
> >
> >




Thanks, it was a problem of Bank.
Florent. ----- Original Message -----
From: "s_spears_2000" <>
To: <>
Sent: Thursday, September 05, 2002 3:45 PM
Subject: [68HC12] Re: erasing 256k flash memory with mc9s12dp256 > Maybe you are not clearing your error flags in both banks. Something
> like this below. This code is for a DP128 so your number of banks
> may vary.
>
> void FlashStaClr(void)
> {
> FCNFG &= ~BKSEL; // select bank 0
> FSTAT |= (PVIOL | ACCERR); // clear errors
> FCNFG |= BKSEL; // select bank 1
> FSTAT |= (PVIOL | ACCERR); // clear errors
> }
>
> Also, make sure to follow the datasheet sequence precisely. >
> --- In 68HC12@y..., "Micro m6net" <micro.plus@m...> wrote:
> > Hi,
> >
> > With a self programmed bootloader which runs in Ram, we have some
> trouble to erase memory flash block with mass_erase command.
> >
> > But if we send two times the function, we have a correct erasing.
> >
> > Therefore, same function but in writing mode works properly after
> erasing with BDI.
> >
> > Thanks by advance.
> >
> > Florent.
> >
> >
> >
> -------------------- >
> ">http://docs.yahoo.com/info/terms/





Memfault State of IoT Report