Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] IAP problems (LPC2131)

2006-04-19 by Tom Walsh

adelacruz01 wrote:

>4) Change MEMMAP to use RAM space instead of user flash since IAP 
>disallows any access of flash memory while IAP is active
>
>  
>
That has nothing to do with disallowing RAM access.  MEMMAP set to "User 
RAM Mode. Interrupt vectors are re-mapped to Static RAM."  means exactly 
that.  The first 32 bytes (the VECTOR TABLE) is mapped as the first 32 
bytes of the RAM.  This allows you to override the VECTORS in the Flash 
memory and replace them with values in the RAM.

MEMMAP does not prevent you from doing a COPY TO RAM IAP operation.

>Now, this IAP routine is supposed to execute when it receives a 
>proper frame via the serial bus (UART0), and it does so (I've 
>verified this). Now, if I attempt to do the copy RAM to flash IAP 
>process in the startup sequence (IE. interrupts & watchdog not yet 
>enabled), I can see that the RAM -> flash process was successful by 
>viewing the bytes on the destination sector. Yet, it doesn't seem to 
>work while everything else is running. Possible interrupt problem? If 
>you have any thoughts to share on this, it would be very much 
>appreciated. Thanks for your time.
>
>  
>
Yes, it probably is.  There are two things to remember:

1. the Flash memory is unavailable while the Flash is being programmed.  
Thus, you cannot have anything running (interrupts) while the Flash is 
being programmed via IAP.  It simply is not there until the IAP is done 
with it.

2. There is a small portion of RAM being used during the IAP call.  From 
the LPC2138 manual: "Flash programming commands use the top 32 bytes of 
on-chip RAM. The maximum stack usage in the user allocated stack space 
is 128 bytes and it grows downwards."

You have to make sure that your stack is set below that point!  
Otherwise, you may have a return address on the stack that got trashed 
during the ISP call.  Usually just reduce the RAM lenght in the linder 
script file:

================= begin LPC2138ROM.ld ===============
/* Memory Definitions */
MEMORY
{
  ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000
  RAM (rw) : ORIGIN = 0x40000000, LENGTH = 0x00007fe0
}

/* Section Definitions */
SECTIONS
{
  /* first section is .text which is used for code */
  .text :
  {
    *crt0.o (.text)            /* Startup code */
    *(.text)                   /* remaining code */
    *(.rodata)                 /* read-only data (constants) */
===================== snip ======================

Note the "0x00007fe0" ?


There is more, but that'll get you going.

TomW


-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.