EmbeddedRelated.com
Forums
Memfault Beyond the Launch

Problem getting out of built-in bootloader

Started by acetoel December 26, 2009
Hello,

I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.

What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.

Is there any way I can download a new version? Can this fix my problem?

Thanks!

Ezequiel

An Engineer's Guide to the LPC2100 Series

--- In l..., "acetoel" wrote:
>
> Hello,
>
> I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.
>
> What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.
>
> Is there any way I can download a new version? Can this fix my problem?
>
> Thanks!
>
> Ezequiel
>

Looking at the documentation for the latest version of Flash Magic, I don't see where it will compute and place the 2's complement of the other vectors at 0x0000 0014. I thought it used to compute this automatically.

So, perhaps it is up to you to know the checksum and just put it at the proper address. When you have it correct, the sum of all the vectors will total 0.

For the 2148, section 21.4.2 "Criterion for valid user code" in the User Manual describes the requirement.

FWIW, lpc21isp does this automatically.

Ordinarily, the vectors branch through a table of indirect addresses. As a result of this and the fact that the table usually immediately follows the vectors, the checksum is a constant because the vectors are constant. Once you have it figured out, you are good to go as long as you don't change the front end of the startup file.

Richard

hi,
try using keil version 40.0 or 3.The signature automaticaly calculated and inserted duringcompilation

              Thanks & Regards,

P. ALAGAPPAN
VASEE ELECTRONICS, SALIGRAMAM, CHENNAI -93. www.vaseee.com

--- On Sun, 27/12/09, acetoel wrote:

From: acetoel
Subject: [lpc2000] Problem getting out of built-in bootloader
To: l...
Date: Sunday, 27 December, 2009, 4:23 AM

 

Hello,

I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.

What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.

Is there any way I can download a new version? Can this fix my problem?

Thanks!

Ezequiel

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
hi,
try using keil version 4.0 or 3.The signature automaticaly calculated and inserted duringcompilation

              Thanks & Regards,

P. ALAGAPPAN
VASEE ELECTRONICS, SALIGRAMAM, CHENNAI -93. www.vaseee.com

--- On Sun, 27/12/09, PERUMAL ALAGAPPAN wrote:

From: PERUMAL ALAGAPPAN
Subject: Re: [lpc2000] Problem getting out of built-in bootloader
To: l...
Date: Sunday, 27 December, 2009, 9:41 AM

 

hi,
try using keil version 4.0 or 3.The signature automaticaly calculated and inserted duringcompilation

              Thanks & Regards,

P. ALAGAPPAN
VASEE ELECTRONICS, SALIGRAMAM, CHENNAI -93. www.vaseee.com

--- On Sun, 27/12/09, acetoel
wrote:

From: acetoel
Subject: [lpc2000] Problem getting out of built-in bootloader
To: lpc2000@yahoogroups .com
Date: Sunday, 27 December, 2009, 4:23 AM

 

Hello,

I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.

What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.

Is there any way I can download a new version? Can this fix my problem?

Thanks!

Ezequiel

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
hi,
try using keil version 40.0 or 3.The signature automaticaly calculated and inserted duringcompilation

              Thanks & Regards,

P. ALAGAPPAN
VASEE ELECTRONICS, SALIGRAMAM, CHENNAI -93. www.vaseee.com

--- On Sun, 27/12/09, PERUMAL ALAGAPPAN wrote:

From: PERUMAL ALAGAPPAN
Subject: Re: [lpc2000] Problem getting out of built-in bootloader
To: l...
Date: Sunday, 27 December, 2009, 9:41 AM

 

hi,
try using keil version 40.0 or 3.The signature automaticaly calculated and inserted duringcompilation

              Thanks & Regards,

P. ALAGAPPAN
VASEE ELECTRONICS, SALIGRAMAM, CHENNAI -93. www.vaseee.com

--- On Sun, 27/12/09, acetoel
wrote:

From: acetoel
Subject: [lpc2000] Problem getting out of built-in bootloader
To: lpc2000@yahoogroups .com
Date: Sunday, 27 December, 2009, 4:23 AM

 

Hello,

I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.

What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.

Is there any way I can download a new version? Can this fix my problem?

Thanks!

Ezequiel

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
So you think that FlashMagic is not correctly programming my devices, and that leads to an error when trying to run the code from flash?

I will try LPC21ISP, and also contact FlashMagic.

Thanks

--- In l..., "rtstofer" wrote:
>
> --- In l..., "acetoel" wrote:
> >
> > Hello,
> >
> > I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.
> >
> > What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.
> >
> > Is there any way I can download a new version? Can this fix my problem?
> >
> > Thanks!
> >
> > Ezequiel
> > Looking at the documentation for the latest version of Flash Magic, I don't see where it will compute and place the 2's complement of the other vectors at 0x0000 0014. I thought it used to compute this automatically.
>
> So, perhaps it is up to you to know the checksum and just put it at the proper address. When you have it correct, the sum of all the vectors will total 0.
>
> For the 2148, section 21.4.2 "Criterion for valid user code" in the User Manual describes the requirement.
>
> FWIW, lpc21isp does this automatically.
>
> Ordinarily, the vectors branch through a table of indirect addresses. As a result of this and the fact that the table usually immediately follows the vectors, the checksum is a constant because the vectors are constant. Once you have it figured out, you are good to go as long as you don't change the front end of the startup file.
>
> Richard
>

Hi,
did you measure the voltage on pin 0.14 to make sure it is on a high level during reset? You said to pulled it up, I understand my question is whether you verified with measurements.
Flash Magic for the LPC2138 has been out for many years. There is a very minor chance that a new version does not perform correctly with an older device but rather unlikely.
IMHO something else is wrong. How do you know it is programming correctly? can you read back the program? If so, please check location 0x14, if it reads "0" or "0xff" that's the reason the bootloader starts every time. If not, your program will start at address "0x0000" There should be a branch to you initialization and after that a branch to main.

Richard,
whether to document the feature about filling in the 2's complement on address 0x14 has always been a discussion because it confuses more people and creates questions than it does clarify things. This test of valid program has been a invention of Philips/NXP and it is in there and will stay in there for compatibility reasons probably until the end of days. In many parts of the documentation it is simply omitted to avoid confusion for the software engineer.

Cheers, Bob

--- In l..., "acetoel" wrote:
>
> So you think that FlashMagic is not correctly programming my devices, and that leads to an error when trying to run the code from flash?
>
> I will try LPC21ISP, and also contact FlashMagic.
>
> Thanks
>
> --- In l..., "rtstofer" wrote:
> >
> >
> >
> > --- In l..., "acetoel" wrote:
> > >
> > > Hello,
> > >
> > > I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.
> > >
> > > What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.
> > >
> > > Is there any way I can download a new version? Can this fix my problem?
> > >
> > > Thanks!
> > >
> > > Ezequiel
> > >
> >
> > Looking at the documentation for the latest version of Flash Magic, I don't see where it will compute and place the 2's complement of the other vectors at 0x0000 0014. I thought it used to compute this automatically.
> >
> > So, perhaps it is up to you to know the checksum and just put it at the proper address. When you have it correct, the sum of all the vectors will total 0.
> >
> > For the 2148, section 21.4.2 "Criterion for valid user code" in the User Manual describes the requirement.
> >
> > FWIW, lpc21isp does this automatically.
> >
> > Ordinarily, the vectors branch through a table of indirect addresses. As a result of this and the fact that the table usually immediately follows the vectors, the checksum is a constant because the vectors are constant. Once you have it figured out, you are good to go as long as you don't change the front end of the startup file.
> >
> > Richard
>

Hello,

I had erased the MCU, and read back..everything was 0xFF.

Then I programmed with my Code, and then read it... These are the first lines...
00000000 18F09FE518F09FE518F09FE518F09FE5 ................
00000010 18F09FE5845F20B9F0FF1FE514F09FE5 ....._ .........
00000020 40000000740700006007000074070000 @...t...`...t...
00000030 74070000380700004C07000000000000 t...8...L.......
00000040 78009FE5DBF021E300D0A0E1040040E2 x.....!.......@.
00000050 D7F021E300D0A0E1040040E2D1F021E3 ..!.......@...!.
00000060 00D0A0E1040040E2D2F021E300D0A0E1 ......@...!.....
00000070 040040E2D3F021E300D0A0E1040040E2 ..@...!.......@.
00000080 DFF021E300D0A0E134109FE534209FE5 ..!.....4...4 ..
00000090 34309FE5030052E10400913404008234 40....R....4...4
000000A0 FBFFFF3A0000A0E320109FE520209FE5 ...:.... ... ..
000000B0 020051E104008134FCFFFF3A880100EA ..Q....4...:....
000000C0 DC7E0040880700000002004000020040 .~.@.......@...@

--- In l..., "Bob T" wrote:
>
> Hi,
> did you measure the voltage on pin 0.14 to make sure it is on a high level during reset? You said to pulled it up, I understand my question is whether you verified with measurements.
> Flash Magic for the LPC2138 has been out for many years. There is a very minor chance that a new version does not perform correctly with an older device but rather unlikely.
> IMHO something else is wrong. How do you know it is programming correctly? can you read back the program? If so, please check location 0x14, if it reads "0" or "0xff" that's the reason the bootloader starts every time. If not, your program will start at address "0x0000" There should be a branch to you initialization and after that a branch to main.
>
> Richard,
> whether to document the feature about filling in the 2's complement on address 0x14 has always been a discussion because it confuses more people and creates questions than it does clarify things. This test of valid program has been a invention of Philips/NXP and it is in there and will stay in there for compatibility reasons probably until the end of days. In many parts of the documentation it is simply omitted to avoid confusion for the software engineer.
>
> Cheers, Bob
>
>
> --- In l..., "acetoel" wrote:
> >
> > So you think that FlashMagic is not correctly programming my devices, and that leads to an error when trying to run the code from flash?
> >
> > I will try LPC21ISP, and also contact FlashMagic.
> >
> > Thanks
> >
> > --- In l..., "rtstofer" wrote:
> > >
> > >
> > >
> > > --- In l..., "acetoel" wrote:
> > > >
> > > > Hello,
> > > >
> > > > I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.
> > > >
> > > > What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.
> > > >
> > > > Is there any way I can download a new version? Can this fix my problem?
> > > >
> > > > Thanks!
> > > >
> > > > Ezequiel
> > > >
> > >
> > > Looking at the documentation for the latest version of Flash Magic, I don't see where it will compute and place the 2's complement of the other vectors at 0x0000 0014. I thought it used to compute this automatically.
> > >
> > > So, perhaps it is up to you to know the checksum and just put it at the proper address. When you have it correct, the sum of all the vectors will total 0.
> > >
> > > For the 2148, section 21.4.2 "Criterion for valid user code" in the User Manual describes the requirement.
> > >
> > > FWIW, lpc21isp does this automatically.
> > >
> > > Ordinarily, the vectors branch through a table of indirect addresses. As a result of this and the fact that the table usually immediately follows the vectors, the checksum is a constant because the vectors are constant. Once you have it figured out, you are good to go as long as you don't change the front end of the startup file.
> > >
> > > Richard
> > >
>
In the Hex file generated by the compiler (GNUARM) I see this
:1000000018F09FE518F09FE518F09FE518F09FE5C0
:1000100018F09FE50000A0E1F0FF1FE514F09FE558

There is a 0x00 at 0x14, but when I program the MCU, in the memory dump I see somethings different from 0x14 to 0x17.

--- In l..., "acetoel" wrote:
>
> Hello,
>
> I had erased the MCU, and read back..everything was 0xFF.
>
> Then I programmed with my Code, and then read it... These are the first lines...
> 00000000 18F09FE518F09FE518F09FE518F09FE5 ................
> 00000010 18F09FE5845F20B9F0FF1FE514F09FE5 ....._ .........
> 00000020 40000000740700006007000074070000 @...t...`...t...
> 00000030 74070000380700004C07000000000000 t...8...L.......
> 00000040 78009FE5DBF021E300D0A0E1040040E2 x.....!.......@.
> 00000050 D7F021E300D0A0E1040040E2D1F021E3 ..!.......@...!.
> 00000060 00D0A0E1040040E2D2F021E300D0A0E1 ......@...!.....
> 00000070 040040E2D3F021E300D0A0E1040040E2 ..@...!.......@.
> 00000080 DFF021E300D0A0E134109FE534209FE5 ..!.....4...4 ..
> 00000090 34309FE5030052E10400913404008234 40....R....4...4
> 000000A0 FBFFFF3A0000A0E320109FE520209FE5 ...:.... ... ..
> 000000B0 020051E104008134FCFFFF3A880100EA ..Q....4...:....
> 000000C0 DC7E0040880700000002004000020040 .~.@.......@...@
>
> --- In l..., "Bob T" wrote:
> >
> > Hi,
> > did you measure the voltage on pin 0.14 to make sure it is on a high level during reset? You said to pulled it up, I understand my question is whether you verified with measurements.
> > Flash Magic for the LPC2138 has been out for many years. There is a very minor chance that a new version does not perform correctly with an older device but rather unlikely.
> > IMHO something else is wrong. How do you know it is programming correctly? can you read back the program? If so, please check location 0x14, if it reads "0" or "0xff" that's the reason the bootloader starts every time. If not, your program will start at address "0x0000" There should be a branch to you initialization and after that a branch to main.
> >
> > Richard,
> > whether to document the feature about filling in the 2's complement on address 0x14 has always been a discussion because it confuses more people and creates questions than it does clarify things. This test of valid program has been a invention of Philips/NXP and it is in there and will stay in there for compatibility reasons probably until the end of days. In many parts of the documentation it is simply omitted to avoid confusion for the software engineer.
> >
> > Cheers, Bob
> >
> >
> > --- In l..., "acetoel" wrote:
> > >
> > > So you think that FlashMagic is not correctly programming my devices, and that leads to an error when trying to run the code from flash?
> > >
> > > I will try LPC21ISP, and also contact FlashMagic.
> > >
> > > Thanks
> > >
> > > --- In l..., "rtstofer" wrote:
> > > >
> > > >
> > > >
> > > > --- In l..., "acetoel" wrote:
> > > > >
> > > > > Hello,
> > > > >
> > > > > I have two LPC2138, I'm using a MAX2323 for programming them using FlashMagic with the built-in bootloader. I can program them without errors, and at any baudrate, they are programmed very well. But I cannot exit the bootloader. Even If I put P0.14 to VCC using a 10KOhm (or 22KOhm) resistor, and "press" reset several times. If then I go to FlashMagic and read the Device signature, it is read correctly. So I think that the device enters ISP Mode but never exit it.
> > > > >
> > > > > What can I do? I'm usign Olimex LPC2138 board as reference, and my PC2138 firmware versions are 2.0 and 2.2. While FlashMagic version is the lastest one.
> > > > >
> > > > > Is there any way I can download a new version? Can this fix my problem?
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Ezequiel
> > > > >
> > > >
> > > > Looking at the documentation for the latest version of Flash Magic, I don't see where it will compute and place the 2's complement of the other vectors at 0x0000 0014. I thought it used to compute this automatically.
> > > >
> > > > So, perhaps it is up to you to know the checksum and just put it at the proper address. When you have it correct, the sum of all the vectors will total 0.
> > > >
> > > > For the 2148, section 21.4.2 "Criterion for valid user code" in the User Manual describes the requirement.
> > > >
> > > > FWIW, lpc21isp does this automatically.
> > > >
> > > > Ordinarily, the vectors branch through a table of indirect addresses. As a result of this and the fact that the table usually immediately follows the vectors, the checksum is a constant because the vectors are constant. Once you have it figured out, you are good to go as long as you don't change the front end of the startup file.
> > > >
> > > > Richard
> > > >
> > >
>

--- In l..., "acetoel" wrote:
>
> In the Hex file generated by the compiler (GNUARM) I see this
> :1000000018F09FE518F09FE518F09FE518F09FE5C0
> :1000100018F09FE50000A0E1F0FF1FE514F09FE558
>
> There is a 0x00 at 0x14, but when I program the MCU, in the memory dump I see somethings different from 0x14 to 0x17

That's good because your programmer calculated and inserted the checksum for you.

Now, if you break out the first 8 words and add them up, they should total 0x00000000.

I didn't try that.

Richard


Memfault Beyond the Launch