Forums

Crashing in iap function

Started by cynergized November 8, 2011
I've been using iap functions with great success, including reflashing the user app on my device and writing various device settings. However, now that I am using them more extensively I find that I occasionally crash in or returning from an iap function that erases a sector. In this event, the program counter is lost and some memory may be corrupted. In the past I'd seen this behavior if I didn't have all interrupts disabled. But I've verified that the IRQ and FIQs are globally disabled. I understand that IAP uses RAM addresses 0x40007fe0 to 0x40007fff. I've created a special IAP RAM section in my memory map such that I don't use this section for my own purposes. By writing a pattern into the iap section prior to the iap entry, I've verified that the iap ram is modified after the iap function. When I don't crash, I never get any iap errors: when it works it works perfectly. Any ideas on why iap crashes occasionally?

An Engineer's Guide to the LPC2100 Series

When do you re-enable interrupts? If you've erased a sector that contains
an interrupt routine, or you've erased the sector containing the vector
table, you can't re-enable them until you have valid routines written.

On Tue, Nov 8, 2011 at 3:53 PM, cynergized <
c...@silicondesigns.com> wrote:

> **
> I've been using iap functions with great success, including reflashing the
> user app on my device and writing various device settings. However, now
> that I am using them more extensively I find that I occasionally crash in
> or returning from an iap function that erases a sector. In this event, the
> program counter is lost and some memory may be corrupted. In the past I'd
> seen this behavior if I didn't have all interrupts disabled. But I've
> verified that the IRQ and FIQs are globally disabled. I understand that IAP
> uses RAM addresses 0x40007fe0 to 0x40007fff. I've created a special IAP RAM
> section in my memory map such that I don't use this section for my own
> purposes. By writing a pattern into the iap section prior to the iap entry,
> I've verified that the iap ram is modified after the iap function. When I
> don't crash, I never get any iap errors: when it works it works perfectly.
> Any ideas on why iap crashes occasionally?
>
>
>


I'm not erasing the sector with my vector interrupt table. The sector I'm erasing has a devoted purpose. Thanks though.

--- In l..., Frank wrote:
>
> When do you re-enable interrupts? If you've erased a sector that contains
> an interrupt routine, or you've erased the sector containing the vector
> table, you can't re-enable them until you have valid routines written.
>
> On Tue, Nov 8, 2011 at 3:53 PM, cynergized <
> cynthia.taylor@...> wrote:
>
> > **
> >
> >
> > I've been using iap functions with great success, including reflashing the
> > user app on my device and writing various device settings. However, now
> > that I am using them more extensively I find that I occasionally crash in
> > or returning from an iap function that erases a sector. In this event, the
> > program counter is lost and some memory may be corrupted. In the past I'd
> > seen this behavior if I didn't have all interrupts disabled. But I've
> > verified that the IRQ and FIQs are globally disabled. I understand that IAP
> > uses RAM addresses 0x40007fe0 to 0x40007fff. I've created a special IAP RAM
> > section in my memory map such that I don't use this section for my own
> > purposes. By writing a pattern into the iap section prior to the iap entry,
> > I've verified that the iap ram is modified after the iap function. When I
> > don't crash, I never get any iap errors: when it works it works perfectly.
> > Any ideas on why iap crashes occasionally?
> >
> >
> >
>
>

I am having a similar problem. We are using the 2378, and have
a field update procedure that fails occasionally. In that procedure,
we find that the processor locks up while writing/erasing the
internal flash. It happens for arbitrary sectors; there seems
to be no pattern as to which sector is involved.

There was traffic on here a few years ago about settings in the
MAM affecting the flash erase routine; I am trying some experiments
now with different MAM settings to see if the problem can be
solved that way, but initial results are not clear yet.

--- In l..., "cynergized" wrote:
>
> I'm not erasing the sector with my vector interrupt table. The sector I'm erasing has a devoted purpose. Thanks though.
>
> --- In l..., Frank wrote:
> >
> > When do you re-enable interrupts? If you've erased a sector that contains
> > an interrupt routine, or you've erased the sector containing the vector
> > table, you can't re-enable them until you have valid routines written.
> >
> > On Tue, Nov 8, 2011 at 3:53 PM, cynergized <
> > cynthia.taylor@> wrote:
> >
> > > **
> > >
> > >
> > > I've been using iap functions with great success, including reflashing the
> > > user app on my device and writing various device settings. However, now
> > > that I am using them more extensively I find that I occasionally crash in
> > > or returning from an iap function that erases a sector. In this event, the
> > > program counter is lost and some memory may be corrupted. In the past I'd
> > > seen this behavior if I didn't have all interrupts disabled. But I've
> > > verified that the IRQ and FIQs are globally disabled. I understand that IAP
> > > uses RAM addresses 0x40007fe0 to 0x40007fff. I've created a special IAP RAM
> > > section in my memory map such that I don't use this section for my own
> > > purposes. By writing a pattern into the iap section prior to the iap entry,
> > > I've verified that the iap ram is modified after the iap function. When I
> > > don't crash, I never get any iap errors: when it works it works perfectly.
> > > Any ideas on why iap crashes occasionally?
> > >
> > >
> > >
> >
> >
> >
>