Re: internal programmin of flash

"blogsyndrome" <[email protected]> Tue, 26 Jun 2007 17:20:19 -0000
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
I'm trying to use CMF_B as permanent storage for user preferences.


Questions:
1)
I am trying to make use of the structs provided by freescale: m_flash.h

On page 664 of the user manual it talks about setting row, column, and
byte address when reading or programing but I cannot find inside the
struct those variable locations.  Example: where is ADDR as specified
in the user manual?

The only thing i can find in the struct is the block specification:
CMF_B.CMFCTL.B.BLOCK = 0b00000001;  // program or erase the first 32k
block [*a]


2)
Suppose i need to iterate through the addresses manually since i can't
find them in the struct.

Since B module address starts at 0x040000 and ends at 0x06FFFF

Where does block 2 start and end?

block 1:
start = 0x040000;

end = ?? 0x040000 + 32k ??  = 0x047D00;
or
end = ?? 0x040000 + (0x06FFFF-0x040000)/6 ?? = 0x047FFF;


would you recommend iterating as follows:

char *i;
CMF_B.CMFCTL.B.BLOCK = 0b00000001;
for(i=start; i<=end; i+=8)
{
//program/erase byte  *i
}



[*a]
Since i'm using cmf_b the blocks access are:
CMF_B.CMFCTL.B.BLOCK = 0b00000001; // 1st 32k block
CMF_B.CMFCTL.B.BLOCK = 0b00000010; // 2nd 32k block
CMF_B.CMFCTL.B.BLOCK = 0b00000100; // 3rd 32k block
CMF_B.CMFCTL.B.BLOCK = 0b00001000; // 4th 32k block
CMF_B.CMFCTL.B.BLOCK = 0b00010000; // 5th 32k block
CMF_B.CMFCTL.B.BLOCK = 0b00100000; // 6th 32k block
is this correct?



Hopefully someone can provide some assistance with these questions.


Leblanc Meneses





--- In [email protected], lesellier michel <m_lesellier@...> wrote:
>
> Hello Girish,
> 
> Thanks a lot for your explanations.
> I did what you said and now i can program or erase
> internal flash of MPC555 without using GMD drivers.
> 
>      Michel LESELLIER
> 
>  --- girish7501 <girish7501@...> a écrit : 
> <HR>
> <html><body>
> 
> 
> <tt>
> hello michel,<BR>
> check out the users manual of &quot;general market
> driver for MPC555&quot; from<BR>
> motorolas web site. follow the program algorithms in
> appendix A2 of<BR>
> this manual together with procedure described in CDR
> MoneT FLASH<BR>
> &gt; EEPROM Rev. 15 October 2000.<BR>
> u should be able to prgram then...i implemented it a
> few weeks back<BR>
> with this algorithm..<BR>
> <BR>
> with best regards<BR>
> Girish karpur<BR>
> ETAS GmbH<BR>
> diplomarbeit student<BR>
> <BR>
> --- In MPC500@y..., lesellier michel
> m_lesellier@y... wrote:<BR>
> Sirs,<BR>
> <BR>
> I'd like to work with the internal flash of a
> MPC555<BR>
> (version 1K83H).<BR>
> The hardware has been verified and all is correct.<BR>
> And I meet a probleme in programming the internal<BR>
> 448kb.<BR>
> All the flash is blank.<BR>
> Please find below the description about what I do
> and<BR>
> the result I get:<BR>
> <BR>
> The internal flash is mapped from 0.<BR>
> I 'd like to write &quot; HELLO EVERYBODY&quot; at
> address<BR>
> 0x48000 ( CMF_B BLOCK1 offset 0).<BR>
> All the code I execute is in RAM but the problem
> is<BR>
> same if I put the code in CMF_A.<BR>
> <BR>
> I follow the procedure described in CDR MoneT
> FLASH<BR>
> EEPROM Rev. 15 October 2000.<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I deactivate
> protections on Blocks<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I initialise timing
> parameters<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( system clock is
> 40MHZ<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SCLKR = 101b<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLKPE = 00b (pe|csc =
> 0)<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CLKPM = 0000111b<BR>
> I select Block ONE&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMFCTL[BLOCK] = 0100
> 0000b<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMFCTL[PE] = 0b<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMFCTL[SES] = 1b<BR>
> <BR>
> At this step, the values of registers are:<BR>
> CMFCTL = 0x28074022<BR>
> CMFMCR = 0x81000000<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then, I write 16 bytes
> from address 0x48000<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (at this step, I notice
> that all unchanged bits are 0<BR>
> but the other are 1<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  In addition, inside
> 32Kb block, all bytes belonging<BR>
> to a same column are same )<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; After this, I apply a
> pulse<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMFCTL[EHV] = 1b<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wait until CMFCTL[HVS]
> = 0<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CMFCTL[EHV] = 0b<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To verify the
> programming, I read the programmed<BR>
> words:<BR>
> I notice that all unchanged bits are 0 but the
> other<BR>
> are 1<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In addition, inside
> 32Kb block, all bytes belonging<BR>
> to a same column are same)<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When I put CMFCTL[SES]
> = 0 and I read back the flash,<BR>
> all the bit are 1.<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Please, could you
> explain me what is wrong in my<BR>
> process and give me a solution to<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Resolve this
> problem.<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thank you in
> advance.<BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Best regards.<BR>
> <BR>
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Michel LESELLIER<BR>
> <BR>
> <BR>
> <BR>
> </tt>
> 
> <br>
> 
> <!-- |**|begin egp html banner|**| -->
> 
> <table border=0 cellspacing=0 cellpadding=2>
> <tr bgcolor=#FFFFCC>
> <td align=center><font size="-1"
> color=#003399><b>Yahoo! Groups Sponsor</b></font></td>
> </tr>
> <tr bgcolor=#FFFFFF>
> <td align=center width=470><table border=0
> cellpadding=0 cellspacing=0> <tr> <td
> align=center><font face=arial
> size=-2>ADVERTISEMENT</font><br><a
>
href="http://rd.yahoo.com/M=237459.2675695.4055211.2225243/D=egroupweb/S=1706554205:HM/A=1267611/R=0/*http://ad.doubleclick.net/jump/N2524.Yahoo/B1071650;sz=300x250;ord=1039010771169306?"
> target =_blank><img
>
src="http://ad.doubleclick.net/ad/N2524.Yahoo/B1071650;sz=300x250;ord=1039010771169306?"
> alt="" width="300" height="250"
> border="0"></a></td></tr></table></td>
> </tr>
> <tr><td><img alt="" width=1 height=1
>
src="http://us.adserver.yahoo.com/l?M=237459.2675695.4055211.2225243/D=egroupmail/S=:HM/A=1267611/rand=361149263"></td></tr>
> </table>
> 
> <!-- |**|end egp html banner|**| -->
> 
> 
> <br>
> <tt>
> -----------------------------------------------------------<BR>
> To unsubscribe from this group, send an email to:<BR>
> [email protected]<BR>
> <BR>
> To learn more about Motorola Microcontrollers, please
> visit<BR>
> <a
> href="http://www.motorola.com/mcu">http://www.motorola.com/mcu</a><BR>
> <BR>
> </tt>
> <br>
> 
> <br>
> <tt>Your use of Yahoo! Groups is subject to the <a
> href="http://docs.yahoo.com/info/terms/">Yahoo! Terms
> of Service</a>.</tt>
> </br>
> 
> </body></html>
>  
> 
> ___________________________________________________________
> Soyez solidaire soutenez l'action du Téléthon avec Yahoo! France.
>
http://www1.telethon.fr/030-Espace-Relais-Dons/webtirelire1.asp?hebergeur_id=1309
>