Re: Program variable on the internal flash of MPC566 on runtime

"crbtfp" <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>

Thank you Allan, I realize about the timing so that's I'm worring 
about how many times can I write to flash,In manual show only 1000 
times. 

But I still can not write to flash memory at all now. I did tried 
follow the steps in reference manual but it 's not clear how to 
program to "program data latch" and "address data latch". Below is 
the sample code that I tried to write constant 5 to flash memory 
moduleA in block 7. When I debug it,it seemed like I can not get EHV 
bit go high(=1).

If you have any sample code how to write to flash memory. It will be 
great.

	volatile int *wf;
        wf=(int *)0x70000;
      	UC3F_A.UC3FMCR.B.PROTECT=0b00000000;
	UC3F_A.UC3FMCR.B.DATA=0b00000001;
	UC3F_A.UC3FCTL.B.BLOCK=0b00000001;
	UC3F_A.UC3FCTL.B.PE=0;
	UC3F_A.UC3FCTL.B.SES=1;
	
	
	*wf=5;

	UC3F_A.UC3FCTL.B.EPEE=1;
	UC3F_A.UC3FCTL.B.EHV=1;
	

	while(!((UC3F_A.UC3FCTL.B.HVS==0)&& 
(UC3F_A.UC3FCTL.B.PEGOOD==1)));

	UC3F_A.UC3FCTL.B.EHV=0;
	UC3F_A.UC3FCTL.B.SES=0;	

Thank you very much
PS


--- In [email protected], Dobbin Allan-r11834 
<Allan.Dobbin@f...> wrote:
> What you are trying to attempt sounds tricky.  You will need to 
buffer the results in as much SRAM as you can afford and then this 
defines your minimum programming interval.  You have to calculate 
your programming time and make sure you can re-program before your 
RAM buffer refills.  Additionally, you probably require two RAM 
buffers - one for the currently programming data and another for new 
results from QADC whilst the programming operation is happening.
> 
> You can program FLASH while your code is running and taking QADC 
conversions.  You have to run your code from one of the two FLASH 
arrays while programming the other i.e. your FLASH programming code 
and QADC fetch routines will all resdide in one FLASH array (or 
SRAM) while programming the 2nd FLASH array.
> 
> You will have to ensure the FLASH array is erased before you kick 
all this off to save time otherwise your RAM buffer (for QADC 
results) has to be even larger.
> 
> If you are really struggling, you can compress the 10-bit result 
so as not to waste 6-bits per conversion in your RAM buffer.  
> 
> Sounds like a strange application.
> 
> Good luck,
> Allan
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On 
Behalf Of Paiboon Sriwilaijaroen
> Sent: Thursday, April 21, 2005 10:56 AM
> To: [email protected]
> Subject: RE: [MPC500] Program variable on the internal flash of 
MPC566 on runtime
> 
> 
> 
> Hi
> I want to save total 64Kbyte(SRAM on chip only 36 Kbyte) of data 
in the 
> internal flash. Actually I want to save result from 32 channels 10 
> bits/channel from QADC  for every 1 ms for 1 sec to flash memory 
in runtime
> 
> Can I program data to flash in runtime?
> 
> Thank you
> PS
> 
> >From: Dobbin Allan-r11834 <Allan.Dobbin@f...>
> >Reply-To: [email protected]
> >To: "'[email protected]'" <[email protected]>
> >Subject: RE: [MPC500] Program variable on the internal flash of 
MPC566 
> >on
> >runtime
> >Date: Thu, 21 Apr 2005 07:37:38 -0700
> >
> >Are you saying that you want to save the QADC conversion result 
to 
> >FLASH
> >just because the SRAM is too small?  This sounds like quite a lot 
of work 
> >just to save a couple of bytes of SRAM.  If you want to store 
this result 
> >in FLASH so that it is available after reset, that is a valid 
reason.  But 
> >if you want to save it to FLASH just to save a few bytes of SRAM, 
that 
> >sounds unreasonable and you may want to reconsider.
> >
> >Regards,
> >Allan
> >
> >-----Original Message-----
> >From: [email protected] [mailto:[email protected]] On 
Behalf 
> >Of
> >crbtfp
> >Sent: Wednesday, April 20, 2005 2:22 PM
> >To: [email protected]
> >Subject: [MPC500] Program variable on the internal flash of 
MPC566 on 
> >runtime
> >
> >
> >
> >
> >Hi
> >
> >I have axiom 566EVM. I use Code Warrior 8.0. I do the sampling of 
> >analog signal by QADC64E. Because SRAM is too small.I want to 
save this 
> >result in internal flash memory on runtime. Can I do that? I 've 
tried 
> >to program to flash on runtime by save the output result of 
QADC64E to 
> >a variable in SRAM then I want to program that variable to 
internal 
> >flash on runtime. The mpc566 ref. manual is unclear, how to write 
to 
> >address data latch and how to program to program data latch of 
MPC566. 
> >I can not make EHV bit go high(=1) Does anyone have 
recommendations?
> >
> >And Does anyone know how many times can I program to the internal 
flash 
> >memory? one manual said 1000 times another manual said 100000 
times
> >
> >
> >Thank you very much
> >PS
> >
> >
> >
> 
> 
> 
> 
> -----------------------------------------------------------
> To learn more about Freescale Microcontrollers, please visit 
http://www.freescale.com/mcu
> 
> 
>  
> Yahoo! Groups Links





-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/MPC500/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.