EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2478 IAP

Started by kunilov January 18, 2012
Hi everybody,I develop firmware updating module (via IAP) on LPC2478.
Flash memory is divided into 2 sectors - main (0x0-0x60000) and updater
(0x60000-0x80000). Firstly, new firmware binary is placed into RAM, then
I call the IAP fuctions in loop. After that, I validate the firmware
using ISP, and validator says that everything is correct. But after
restart the device hangs...
Here is my code update function:void UpdateFirmware(){ DWORD irq_buf;
DWORD i=0,j=0; volatile DWORD p=0; BYTE r[BUFFER_SIZE];
irq_buf=VICIntEnable; VICIntEnClr=0xFFFFFFFF;
IAP_PrepareSec(0,18); IAP_EraseSec(0,18);
for(i=0;i<0x600;i++) { memcpy(r,BIG_BUFFER,0x100)
IAP_PrepareSec(0,18); IAP_CopyRAMToFlash(i*0x100,r,0x100); }
VICIntEnable=irq_buf; return; }
Any ideas? Let me mention again, that verification AFTER IAP passes
correctly


An Engineer's Guide to the LPC2100 Series

On 18.01.2012 13:57, kunilov wrote:
> ... After that, I validate the firmware
> using ISP, and validator says that everything is correct. But after
> restart the device hangs...

Do you have a correct checksum in the binary. Your flashing tool may calculate
that for you but your update code not, so...

--

Timo
--- In l..., tike64@... wrote:
>
> On 18.01.2012 13:57, kunilov wrote:
> > ... After that, I validate the firmware
> > using ISP, and validator says that everything is correct. But after
> > restart the device hangs...
>
> Do you have a correct checksum in the binary. Your flashing tool may calculate
> that for you but your update code not, so...
>
> --
>
> Timo
>

Hello, tike64

Thanks a lot for your responce!

How can I check the checksum in the binary? Is it described anywhere? I use hex2bin utility to generate binary from hex file. Has it some options to calculate this checksum?

On 19.01.2012 08:50, kunilov wrote:
> How can I check the checksum in the binary? Is it described anywhere? I use
> hex2bin utility to generate binary from hex file. Has it some options to
> calculate this checksum?

It is explained in Users' Manual chapter Flash memory programming firmware,
30.5.1.1. in my version.

I don't know about hex2bin utility - sounds like so generic that probably it
doesn't know anything about LPC2K.

For example, IIRC, openocd complains about wrong checksum but kindly writes a
correct one.

--

Timo
Millions of thanks, tike64! It works!

There is a checksum on address 0x14. It is complement to zero of interrupt vectors sum. You must set it manually in binary file. Interrupt vector table is situated at first 32 bytes.


The 2024 Embedded Online Conference