Bootloader: Wrong answer on Prepare-Command (2) (Sector 2) CMD_SUCCESS
2004-04-01 by Andreas Schwarz
Yahoo Groups archive
Index last updated: 2026-04-28 23:31 UTC
Thread
2004-04-01 by Andreas Schwarz
Hello, I'm using lpc21isp to program my LPC2106. When I try to download the test2 hex file from the Aeolus newlib example, I get the following output: (...) Writing Sector 0: ....(...) Sector 0 written Writing Sector 1: ....(...) Sector 1 written Writing Sector 2: ....(...)...Wrong answer on Prepare-Command (2) (Sector 2) CMD_SUCCESS ...and the program doesn't work (no traffic on TXD). If I change "#if 1" to "#if 0" and vice-versa (to disable the UART echo example), the program loads ok, and I can receive the "hello world"-message over the UART. What's wrong here? Thanks Andreas
2004-04-01 by Robert Adsett
At 06:41 PM 4/1/04 +0000, you wrote:
>Hello,
>
>I'm using lpc21isp to program my LPC2106. When I try to download the
>test2 hex file from the Aeolus newlib example, I get the following output:
>
>(...)
>Writing Sector 0: ....(...)
>Sector 0 written
>Writing Sector 1: ....(...)
>Sector 1 written
>Writing Sector 2: ....(...)...Wrong answer on Prepare-Command (2) (Sector 2)
>CMD_SUCCESS
>
>...and the program doesn't work (no traffic on TXD). If I change "#if 1" to
>"#if 0" and vice-versa (to disable the UART echo example), the program loads
>ok, and I can receive the "hello world"-message over the UART.
>
>What's wrong here?
Can you run the Philips ISP program? If so, does it work?
" 'Freedom' has no meaning of itself. There are always restrictions,
be they legal, genetic, or physical. If you don't believe me, try to
chew a radio signal. "
Kelvin Throop, III2004-04-01 by Robert Adsett
At 01:53 PM 4/1/04 -0500, you wrote:
>At 06:41 PM 4/1/04 +0000, you wrote:
> >Hello,
> >
> >I'm using lpc21isp to program my LPC2106. When I try to download the
> >test2 hex file from the Aeolus newlib example, I get the following output:
> >
> >(...)
> >Writing Sector 0: ....(...)
> >Sector 0 written
> >Writing Sector 1: ....(...)
> >Sector 1 written
> >Writing Sector 2: ....(...)...Wrong answer on Prepare-Command (2) (Sector 2)
> >CMD_SUCCESS
> >
> >...and the program doesn't work (no traffic on TXD). If I change "#if 1" to
> >"#if 0" and vice-versa (to disable the UART echo example), the program loads
> >ok, and I can receive the "hello world"-message over the UART.
> >
> >What's wrong here?
I tracked down the error message. It's coming from this piece of code
sprintf((char *)tmpString, "P %ld %ld\r\n", Sector, Sector);
SendComPort(tmpString);
ReceiveComPort(Answer, sizeof(Answer)-1, &realsize, 2,5000);
sprintf((char *)tmpString, "P %ld %ld\r\n0\r\n", Sector, Sector);
if(strcmp((const char *)Answer, (const char *)tmpString) != 0)
{
printf("Wrong answer on Prepare-Command (2) (Sector
%ld)\n", Sector);
OutputErrorMessage(GetErrorNumber(Answer));
exit(4);
}
The prepare command is documented as taking a start sector and an end
sector number and so something like
P 2 2
should be sent to the micro. Unless echo is turned off then that should be
echoed back followed by the return code number (which should be 0 for
CMD_SUCCESS).
It's apparently not getting that but the code is converting whatever is
received to a number and then to an error message. If you can compile the
code try inserting the following line
printf("Expected [%s] -- Received [%s]\n", tmpString, Answer);
That may help track down what is actually happening.
Robert
" 'Freedom' has no meaning of itself. There are always restrictions,
be they legal, genetic, or physical. If you don't believe me, try to
chew a radio signal. "
Kelvin Throop, III