Reply by jayasooriah February 27, 20072007-02-27
My notes were from source for LPC2105 Boot Loader Version 1.52 which
can be found here:

http://www.cse.unsw.edu.au/~jayas/esdk/files/lpc/2105.s

Mark, Adrian and Bob, you are right in that the value 13 is listed in
the ISP error codes as ADDR_ERROR - Address is not on a word boundary.
Why should IAP 51 call return this error code?

According to the OP:

--- In l..., "ylavoie66" wrote:
> I found my bug...Thanks to everyone that helped.
>
> My command stack was not built properly (see code bellow with the
> faulty line marked with an arrow)
>
> printf("\n\r IAP : Copy RAM to FLASH sector 15 : ");
> aui32Cmd[0] = 51; // Copy RAM to FLASH command
> aui32Cmd[1] = 0x00040000; // Destination FLASH address
> aui32Cmd[2] = (UINT32)aui8BufferWr; // Source RAM address
> aui32Cmd[3] = 256; // Number of bytes
> --> aui32Cmd[3] = 58982; // System clock (in KHz)
> vbslMcuIapCmd(aui32Command, aui32Result);
> printf("0x%08X", aui32Result[0]);
> The system clock frequency was overwriting the number of bytes.
> So, the code 0x0D meant either: invalid number of bytes, or invalid
> speed

Invalid number of bytes should return error code 6 (COUNT_ERROR).
There is no error code for "invalid clock speed". So what actually
happened?

The answer can be found by studying iapProc51() and argCheck()
procedures in my source code. In iapProc51(), the first call to
argCheck() uses 101 as the third argument when it should be 100.

There are other anomalies in this version of the boot loader it appear
these have propagated to later versions of the LPC family, including
those with CRP feature.

At best this means that the testing regime for the Boot Loader is
non-exhaustive. Given CRP is a Boot Loader feature (not found in Boot
Loaders prior to 1.61) one would have thought an exhaustive testing
regime is a pre-requisite.

Jaya

An Engineer's Guide to the LPC2100 Series

Reply by adrianunderwater February 27, 20072007-02-27
Hi..

In document UM10120

IAP error codes are the same as ISP error codes, up code 11.

After ISP codes are as follows:

12 = PARAM_ERROR
13 = ADDR_ERROR (Address is not on a word boundary)
14 = ADDR_NOT_MAPPED
15 = CMP_LOCKED
16 = INVALID_CODE
17 = INVALID_BAUD_RATE
18 = INVALID_STOP_BIT
10 = CODE_READ_PROTECTION_ENABLED

Maybe for some reason you are getting an ISP error code???

Adrian
Reply by bobtransformer February 27, 20072007-02-27
"ylavoie66" wrote:
> Thanks,
> But the code 13 is missing from your list !!??

I see those other return codes from the ISP return code list.
I wonder if they also apply to IAP ?? I hope so because they
could be applicable, like the missing return code 13:
13 ADDR_ERROR Address is not on word boundary.

boB
Reply by ylavoie66 February 27, 20072007-02-27
I found my bug...Thanks to everyone that helped.

My command stack was not built properly (see code bellow with the
faulty line marked with an arrow)

printf("\n\r IAP : Copy RAM to FLASH sector 15 : ");
aui32Cmd[0] = 51; // Copy RAM to FLASH command
aui32Cmd[1] = 0x00040000; // Destination FLASH address
aui32Cmd[2] = (UINT32)aui8BufferWr; // Source RAM address
aui32Cmd[3] = 256; // Number of bytes
--> aui32Cmd[3] = 58982; // System clock (in KHz)
vbslMcuIapCmd(aui32Command, aui32Result);
printf("0x%08X", aui32Result[0]);
The system clock frequency was overwriting the number of bytes.
So, the code 0x0D meant either: invalid number of bytes, or invalid
speed
Thanks to all again
Yves
Reply by ylavoie66 February 27, 20072007-02-27
> > I dont think so. My notes relating to error codes:
>
> @ ERROR 0: CMD_SUCCESS
> @ ERROR 1: INVALID_COMMAND
> @ ERROR 2: SRC_ADDR_ERROR
> @ ERROR 3: DST_ADDR_ERROR
> @ ERROR 4: SRC_ADDR_NOT_MAPPED
> @ ERROR 5: DST_ADDR_NOT_MAPPED
> @ ERROR 6: COUNT_ERROR
> @ ERROR 7: INVALID_SECTOR
> @ ERROR 8: SECTOR_NOT_BLANK
> @ ERROR 9: SECTOR_NOT_PREPARED
> @ ERROR 10: COMPARE_ERROR
> @ ERROR 11: BUSY
> @ ERROR 12: PARAM_ERROR
> @ ERROR 14: ADDR_NOT_MAPPED
> @ ERROR 15: CMD_LOCKED
> @ ERROR 16: INVALID_CODE
>
> Jaya

Thanks,

But the code 13 is missing from your list !!??

By the way, where did you get this list of error codes?
This is not in the LPC213x user's manual, nor is it in the
application note AN10256.

Yves
Reply by jayasooriah February 26, 20072007-02-26
> Without doing a lot of research on this I think the error code is an
> "Address Error" (Address is not on a word boundary).

I dont think so. My notes relating to error codes:

@ ERROR 0: CMD_SUCCESS
@ ERROR 1: INVALID_COMMAND
@ ERROR 2: SRC_ADDR_ERROR
@ ERROR 3: DST_ADDR_ERROR
@ ERROR 4: SRC_ADDR_NOT_MAPPED
@ ERROR 5: DST_ADDR_NOT_MAPPED
@ ERROR 6: COUNT_ERROR
@ ERROR 7: INVALID_SECTOR
@ ERROR 8: SECTOR_NOT_BLANK
@ ERROR 9: SECTOR_NOT_PREPARED
@ ERROR 10: COMPARE_ERROR
@ ERROR 11: BUSY
@ ERROR 12: PARAM_ERROR
@ ERROR 14: ADDR_NOT_MAPPED
@ ERROR 15: CMD_LOCKED
@ ERROR 16: INVALID_CODE

Jaya
Reply by Mark Crow February 26, 20072007-02-26
Without doing a lot of research on this I think the error code is an
"Address Error" (Address is not on a word boundary).
Reply by ylavoie66 February 26, 20072007-02-26
Sorry to bother everyone with this rethorical topic.

I get : 0x0D as the return code from a "Copy RAM to FLASH" IAP command.
This value is not documented (highest value is 11 in NXP docs).

Any expert advise on this?
Regards,

Yves