LPC2138 very slow after IAP command (write to flash)

Hi,

I try to write values in the LPC2138 flash, but after IAP call, my software is executing very, very, very slow, slower than running without PLL. I have the same behaviour when only erasing a sector.

Using google, I foud a lot of exemple, but also contradictive infos:

  • PLL settings: some says it must be off, but I found examples for full speed CPU (using CCLK)

  • Supervisor/System mode: ???

My system is running Freertos and I disable/enable interrupts by changing bits in CPSR register.

The 32 bytes on top of ram needed by IAP are not usable. I removed them in the .LD file

The flash sectors are declared in the .LD file and my flash variables are located using a compiler directive. Everything is ok.

Using Eclipse and OpenOCD, I stepped in the code and found that writing is working. My values are in the flash, I can re-read them restarting the code. Same for erasing, all bytes are returned to 0xFF.

I then tried to disable the PLL, write or erase, re-enable the PLL. The flash contains my values, but CPU still very slow.

Before I decide to use the SD card, has anyone an idea or tips ???

Angelo

How about single stepping with a JTAG interface when your target has a problem.

If I had to guess I would think your problem is related to some interrupt that is taking your processor time !

Problem found :smiley:

The IAP commands are working perfectly, just disable interrupts when using them. No need to disable PLL.

The problem was due to a missing timer compare event with interrupt disabled.

Angelo