EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Programming FLASH on the Freescale Coldfire

Started by Randy Yates May 4, 2016
Folks,

We need to store some non-volatile parameters across power-ups and I'm
trying to determine how to programmatically write to FLASH in the
MCF52235 Coldfire V2 processor (256KB). From the reference manual it
looks like reads from the ENTIRE FLASH are disabled when updating
(erasing/programming) any part of the FLASH, even if you're just
updating one of the 32 8 KB sectors. But I'm not absolutely certain
this is true. Could someone please verify?
-- 
Randy Yates, DSP/Embedded Firmware Developer
Digital Signal Labs
http://www.digitalsignallabs.com
On 4.5.16 17:59, Randy Yates wrote:
> Folks, > > We need to store some non-volatile parameters across power-ups and I'm > trying to determine how to programmatically write to FLASH in the > MCF52235 Coldfire V2 processor (256KB). From the reference manual it > looks like reads from the ENTIRE FLASH are disabled when updating > (erasing/programming) any part of the FLASH, even if you're just > updating one of the 32 8 KB sectors. But I'm not absolutely certain > this is true. Could someone please verify?
That is common with embedded flash units. You have to code the inner core of the programming loop so it can be run from RAM, and remember to disable interrupts and other surprises for the programming time. -- -TV
On Wed, 04 May 2016 21:40:23 +0300, Tauno Voipio wrote:

> On 4.5.16 17:59, Randy Yates wrote: >> Folks, >> >> We need to store some non-volatile parameters across power-ups and I'm >> trying to determine how to programmatically write to FLASH in the >> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >> looks like reads from the ENTIRE FLASH are disabled when updating >> (erasing/programming) any part of the FLASH, even if you're just >> updating one of the 32 8 KB sectors. But I'm not absolutely certain >> this is true. Could someone please verify? > > > That is common with embedded flash units. You have to code the inner > core of the programming loop so it can be run from RAM, and remember to > disable interrupts and other surprises for the programming time.
Yup. Fun-fun. And if there's anything that'll go "Phzzzt!" for lack of attention while flash is being written, put it in a safe state. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tauno Voipio <tauno.voipio@notused.fi.invalid> writes:

> On 4.5.16 17:59, Randy Yates wrote: >> Folks, >> >> We need to store some non-volatile parameters across power-ups and I'm >> trying to determine how to programmatically write to FLASH in the >> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >> looks like reads from the ENTIRE FLASH are disabled when updating >> (erasing/programming) any part of the FLASH, even if you're just >> updating one of the 32 8 KB sectors. But I'm not absolutely certain >> this is true. Could someone please verify? > > > That is common with embedded flash units. You have to code the inner > core of the programming loop so it can be run from RAM, and remember > to disable interrupts and other surprises for the programming time.
Tauno, Thanks for the confirmation. Other surprises? Like what? -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On 5.5.16 06:51, Randy Yates wrote:
> Tauno Voipio <tauno.voipio@notused.fi.invalid> writes: > >> On 4.5.16 17:59, Randy Yates wrote: >>> Folks, >>> >>> We need to store some non-volatile parameters across power-ups and I'm >>> trying to determine how to programmatically write to FLASH in the >>> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >>> looks like reads from the ENTIRE FLASH are disabled when updating >>> (erasing/programming) any part of the FLASH, even if you're just >>> updating one of the 32 8 KB sectors. But I'm not absolutely certain >>> this is true. Could someone please verify? >> >> >> That is common with embedded flash units. You have to code the inner >> core of the programming loop so it can be run from RAM, and remember >> to disable interrupts and other surprises for the programming time. > > Tauno, > > Thanks for the confirmation. > > Other surprises? Like what?
Tim already responded - calm down external hardware that could not like the lack of attention during programming. -- -TV
On Thu, 05 May 2016 10:34:48 +0300, Tauno Voipio wrote:

> On 5.5.16 06:51, Randy Yates wrote: >> Tauno Voipio <tauno.voipio@notused.fi.invalid> writes: >> >>> On 4.5.16 17:59, Randy Yates wrote: >>>> Folks, >>>> >>>> We need to store some non-volatile parameters across power-ups and >>>> I'm trying to determine how to programmatically write to FLASH in the >>>> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >>>> looks like reads from the ENTIRE FLASH are disabled when updating >>>> (erasing/programming) any part of the FLASH, even if you're just >>>> updating one of the 32 8 KB sectors. But I'm not absolutely certain >>>> this is true. Could someone please verify? >>> >>> >>> That is common with embedded flash units. You have to code the inner >>> core of the programming loop so it can be run from RAM, and remember >>> to disable interrupts and other surprises for the programming time. >> >> Tauno, >> >> Thanks for the confirmation. >> >> Other surprises? Like what? > > > Tim already responded - calm down external hardware that could not like > the lack of attention during programming.
I've worked on systems that would twitch, or at least go "tick" when you saved parameters. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Tim Wescott <seemywebsite@myfooter.really> writes:

> On Thu, 05 May 2016 10:34:48 +0300, Tauno Voipio wrote: > >> On 5.5.16 06:51, Randy Yates wrote: >>> Tauno Voipio <tauno.voipio@notused.fi.invalid> writes: >>> >>>> On 4.5.16 17:59, Randy Yates wrote: >>>>> Folks, >>>>> >>>>> We need to store some non-volatile parameters across power-ups and >>>>> I'm trying to determine how to programmatically write to FLASH in the >>>>> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >>>>> looks like reads from the ENTIRE FLASH are disabled when updating >>>>> (erasing/programming) any part of the FLASH, even if you're just >>>>> updating one of the 32 8 KB sectors. But I'm not absolutely certain >>>>> this is true. Could someone please verify? >>>> >>>> >>>> That is common with embedded flash units. You have to code the inner >>>> core of the programming loop so it can be run from RAM, and remember >>>> to disable interrupts and other surprises for the programming time. >>> >>> Tauno, >>> >>> Thanks for the confirmation. >>> >>> Other surprises? Like what? >> >> >> Tim already responded - calm down external hardware that could not like >> the lack of attention during programming. > > I've worked on systems that would twitch, or at least go "tick" when you > saved parameters.
I guess keeping an eye on watchdog timers (i.e., disabling such) would be one type of attention required... -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com
On 06.5.2016 &#1075;. 05:58, Randy Yates wrote:
> Tim Wescott <seemywebsite@myfooter.really> writes: > >> On Thu, 05 May 2016 10:34:48 +0300, Tauno Voipio wrote: >> >>> On 5.5.16 06:51, Randy Yates wrote: >>>> Tauno Voipio <tauno.voipio@notused.fi.invalid> writes: >>>> >>>>> On 4.5.16 17:59, Randy Yates wrote: >>>>>> Folks, >>>>>> >>>>>> We need to store some non-volatile parameters across power-ups and >>>>>> I'm trying to determine how to programmatically write to FLASH in the >>>>>> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >>>>>> looks like reads from the ENTIRE FLASH are disabled when updating >>>>>> (erasing/programming) any part of the FLASH, even if you're just >>>>>> updating one of the 32 8 KB sectors. But I'm not absolutely certain >>>>>> this is true. Could someone please verify? >>>>> >>>>> >>>>> That is common with embedded flash units. You have to code the inner >>>>> core of the programming loop so it can be run from RAM, and remember >>>>> to disable interrupts and other surprises for the programming time. >>>> >>>> Tauno, >>>> >>>> Thanks for the confirmation. >>>> >>>> Other surprises? Like what? >>> >>> >>> Tim already responded - calm down external hardware that could not like >>> the lack of attention during programming. >> >> I've worked on systems that would twitch, or at least go "tick" when you >> saved parameters. > > I guess keeping an eye on watchdog timers (i.e., disabling such) would > be one type of attention required... >
Just servicing it during programming might be easier than disabling it I think (but I don't remember how I did it on the MCF52211, it's been a while). Dimiter
On Fri, 06 May 2016 07:06:47 +0300, Dimiter_Popoff wrote:

> On 06.5.2016 &#1075;. 05:58, Randy Yates wrote: >> Tim Wescott <seemywebsite@myfooter.really> writes: >> >>> On Thu, 05 May 2016 10:34:48 +0300, Tauno Voipio wrote: >>> >>>> On 5.5.16 06:51, Randy Yates wrote: >>>>> Tauno Voipio <tauno.voipio@notused.fi.invalid> writes: >>>>> >>>>>> On 4.5.16 17:59, Randy Yates wrote: >>>>>>> Folks, >>>>>>> >>>>>>> We need to store some non-volatile parameters across power-ups and >>>>>>> I'm trying to determine how to programmatically write to FLASH in >>>>>>> the MCF52235 Coldfire V2 processor (256KB). From the reference >>>>>>> manual it looks like reads from the ENTIRE FLASH are disabled when >>>>>>> updating (erasing/programming) any part of the FLASH, even if >>>>>>> you're just updating one of the 32 8 KB sectors. But I'm not >>>>>>> absolutely certain this is true. Could someone please verify? >>>>>> >>>>>> >>>>>> That is common with embedded flash units. You have to code the >>>>>> inner core of the programming loop so it can be run from RAM, and >>>>>> remember to disable interrupts and other surprises for the >>>>>> programming time. >>>>> >>>>> Tauno, >>>>> >>>>> Thanks for the confirmation. >>>>> >>>>> Other surprises? Like what? >>>> >>>> >>>> Tim already responded - calm down external hardware that could not >>>> like the lack of attention during programming. >>> >>> I've worked on systems that would twitch, or at least go "tick" when >>> you saved parameters. >> >> I guess keeping an eye on watchdog timers (i.e., disabling such) would >> be one type of attention required... >> >> > Just servicing it during programming might be easier than disabling it I > think (but I don't remember how I did it on the MCF52211, it's been a > while). > > Dimiter
Seems to be wiser, too, somehow. One way or another, having the processor reset in the middle of an EEPROM write would be a Bad Thing. -- Tim Wescott Control systems, embedded software and circuit design I'm looking for work! See my website if you're interested http://www.wescottdesign.com
Dimiter_Popoff <dp@tgi-sci.com> writes:

> On 06.5.2016 &#1075;. 05:58, Randy Yates wrote: >> Tim Wescott <seemywebsite@myfooter.really> writes: >> >>> On Thu, 05 May 2016 10:34:48 +0300, Tauno Voipio wrote: >>> >>>> On 5.5.16 06:51, Randy Yates wrote: >>>>> Tauno Voipio <tauno.voipio@notused.fi.invalid> writes: >>>>> >>>>>> On 4.5.16 17:59, Randy Yates wrote: >>>>>>> Folks, >>>>>>> >>>>>>> We need to store some non-volatile parameters across power-ups and >>>>>>> I'm trying to determine how to programmatically write to FLASH in the >>>>>>> MCF52235 Coldfire V2 processor (256KB). From the reference manual it >>>>>>> looks like reads from the ENTIRE FLASH are disabled when updating >>>>>>> (erasing/programming) any part of the FLASH, even if you're just >>>>>>> updating one of the 32 8 KB sectors. But I'm not absolutely certain >>>>>>> this is true. Could someone please verify? >>>>>> >>>>>> >>>>>> That is common with embedded flash units. You have to code the inner >>>>>> core of the programming loop so it can be run from RAM, and remember >>>>>> to disable interrupts and other surprises for the programming time. >>>>> >>>>> Tauno, >>>>> >>>>> Thanks for the confirmation. >>>>> >>>>> Other surprises? Like what? >>>> >>>> >>>> Tim already responded - calm down external hardware that could not like >>>> the lack of attention during programming. >>> >>> I've worked on systems that would twitch, or at least go "tick" when you >>> saved parameters. >> >> I guess keeping an eye on watchdog timers (i.e., disabling such) would >> be one type of attention required... >> > > Just servicing it during programming might be easier than disabling > it I think (but I don't remember how I did it on the MCF52211, it's > been a while).
Perhaps 6/half dozen, but to service it you'd then need to ensure the interrupt handler is also in memory. -- Randy Yates, DSP/Embedded Firmware Developer Digital Signal Labs http://www.digitalsignallabs.com

The 2024 Embedded Online Conference