EmbeddedRelated.com
Forums

IAP with LPC2148

Started by Sutton Mehaffey June 24, 2009
Now that I got my SD card working (and I'll mention again that Axelson's
book was the best documentation I've seen - it took me roughly 2 days to
clean up all the issues I didn't understand and recode them - works
perfect), I am looking at being able for the user to update the firmware
with the SD card, without access to the circuit board.

I'm assuming that I should have my bootloader code at address 0 and the
working code at address 8K or somewhere like that. I can do that by the
compiler. I'm guessing that I need some memory location that indicates
that the upload was successful, that is overwritten when the upload
starts. That way, if there is an error, crash, or otherwise a failure,
the bootloader will continue to run the upload code (at address 0) until
a successful transfer happens. At which time, I will overwrite the
special memory location (valid code), and I will run the code (PC) from
this location until the next upload.

Is this the proper mechanism? Anything else to look out for? I'm
trying to avoid the user doing anything (pressing reset on the circuit
board, etc.) except for inserting the SD card.

On the 512K 2148, I might have double space to hold 2 versions of code,
but not sure yet. Code space is only 170K right now.
--
Sutton

An Engineer's Guide to the LPC2100 Series

Hi

have u done SPI communication with LPC2148?

--- In l..., Sutton Mehaffey wrote:
>
> Now that I got my SD card working (and I'll mention again that Axelson's
> book was the best documentation I've seen - it took me roughly 2 days to
> clean up all the issues I didn't understand and recode them - works
> perfect), I am looking at being able for the user to update the firmware
> with the SD card, without access to the circuit board.
>
> I'm assuming that I should have my bootloader code at address 0 and the
> working code at address 8K or somewhere like that. I can do that by the
> compiler. I'm guessing that I need some memory location that indicates
> that the upload was successful, that is overwritten when the upload
> starts. That way, if there is an error, crash, or otherwise a failure,
> the bootloader will continue to run the upload code (at address 0) until
> a successful transfer happens. At which time, I will overwrite the
> special memory location (valid code), and I will run the code (PC) from
> this location until the next upload.
>
> Is this the proper mechanism? Anything else to look out for? I'm
> trying to avoid the user doing anything (pressing reset on the circuit
> board, etc.) except for inserting the SD card.
>
> On the 512K 2148, I might have double space to hold 2 versions of code,
> but not sure yet. Code space is only 170K right now.
> --
> Sutton
>

I think that's the only way to communicate with an SD card, isn't it?

raju_nem wrote:
>
> Hi
>
> have u done SPI communication with LPC2148?
>
> --- In l... ,
> Sutton Mehaffey wrote:
> >
> > Now that I got my SD card working (and I'll mention again that Axelson's
> > book was the best documentation I've seen - it took me roughly 2 days to
> > clean up all the issues I didn't understand and recode them - works
> > perfect), I am looking at being able for the user to update the firmware
> > with the SD card, without access to the circuit board.
> >
> > I'm assuming that I should have my bootloader code at address 0 and the
> > working code at address 8K or somewhere like that. I can do that by the
> > compiler. I'm guessing that I need some memory location that indicates
> > that the upload was successful, that is overwritten when the upload
> > starts. That way, if there is an error, crash, or otherwise a failure,
> > the bootloader will continue to run the upload code (at address 0) until
> > a successful transfer happens. At which time, I will overwrite the
> > special memory location (valid code), and I will run the code (PC) from
> > this location until the next upload.
> >
> > Is this the proper mechanism? Anything else to look out for? I'm
> > trying to avoid the user doing anything (pressing reset on the circuit
> > board, etc.) except for inserting the SD card.
> >
> > On the 512K 2148, I might have double space to hold 2 versions of code,
> > but not sure yet. Code space is only 170K right now.
> > --
> > Sutton
> >

--
Sutton Mehaffey
Lookout Portable Security
4040 Royal Dr.
Kennesaw, GA 30144
770-514-7999, 800-207-6269
Fax: 770-514-1285
http://www.lookoutportablesecurity.com
s...@lookoutportablesecurity.com

Hi Sutton,

the other way would be to have very primitive "bootloader" (which would fit
in 4kB, because no SD/FAT code), after that the main app and after that the
place for new version of new app, and after that some registry (special
memory loc.). If the registry says the new version is there and is valid,
the bootloader would copy it over the main app. The main app would be
responsible for downloading the new version from SD card to the flash. I am
using this way, but I think your way will work too. Both have some pros and
cons.

With regards,
Jan
----- Original Message -----
From: "Sutton Mehaffey"
To:
Sent: Wednesday, June 24, 2009 3:27 PM
Subject: [lpc2000] IAP with LPC2148
> Now that I got my SD card working (and I'll mention again that Axelson's
> book was the best documentation I've seen - it took me roughly 2 days to
> clean up all the issues I didn't understand and recode them - works
> perfect), I am looking at being able for the user to update the firmware
> with the SD card, without access to the circuit board.
>
> I'm assuming that I should have my bootloader code at address 0 and the
> working code at address 8K or somewhere like that. I can do that by the
> compiler. I'm guessing that I need some memory location that indicates
> that the upload was successful, that is overwritten when the upload
> starts. That way, if there is an error, crash, or otherwise a failure,
> the bootloader will continue to run the upload code (at address 0) until
> a successful transfer happens. At which time, I will overwrite the
> special memory location (valid code), and I will run the code (PC) from
> this location until the next upload.
>
> Is this the proper mechanism? Anything else to look out for? I'm
> trying to avoid the user doing anything (pressing reset on the circuit
> board, etc.) except for inserting the SD card.
>
> On the 512K 2148, I might have double space to hold 2 versions of code,
> but not sure yet. Code space is only 170K right now.
> --
> Sutton

On Wed, 24 Jun 2009 09:27:09 -0400, you wrote:

>Now that I got my SD card working (and I'll mention again that Axelson's
>book was the best documentation I've seen - it took me roughly 2 days to
>clean up all the issues I didn't understand and recode them - works
>perfect), I am looking at being able for the user to update the firmware
>with the SD card, without access to the circuit board.
>
>I'm assuming that I should have my bootloader code at address 0 and the
>working code at address 8K or somewhere like that. I can do that by the
>compiler. I'm guessing that I need some memory location that indicates
>that the upload was successful, that is overwritten when the upload
>starts. That way, if there is an error, crash, or otherwise a failure,
>the bootloader will continue to run the upload code (at address 0) until
>a successful transfer happens. At which time, I will overwrite the
>special memory location (valid code), and I will run the code (PC) from
>this location until the next upload.
>
>Is this the proper mechanism? Anything else to look out for? I'm
>trying to avoid the user doing anything (pressing reset on the circuit
>board, etc.) except for inserting the SD card.
>
>On the 512K 2148, I might have double space to hold 2 versions of code,
>but not sure yet. Code space is only 170K right now.

Another approach is to add an external SPI flash memory - these are really cheap now.
That way you can copy the new image from SD (or wherever) to flash, and only when you have copied
and verified it, you copy from SPI flash to main flash. This avoids having to locate all the FAT, SD
etc. stuff in a bootloader area.
I have directories on the SD card, so I would need FAT data in the
bootloader - not terribly hard. However, Mike's option of an extra
flash (I2C or SPI) solely for a transfer sounds intriguing. Might do that.

Sutton

Jan Vanek wrote:
>
> Hi Sutton,
>
> the other way would be to have very primitive "bootloader" (which would fit
> in 4kB, because no SD/FAT code), after that the main app and after that the
> place for new version of new app, and after that some registry (special
> memory loc.). If the registry says the new version is there and is valid,
> the bootloader would copy it over the main app. The main app would be
> responsible for downloading the new version from SD card to the flash. I am
> using this way, but I think your way will work too. Both have some pros and
> cons.
>
> With regards,
> Jan
>
> ----- Original Message -----
> From: "Sutton Mehaffey" > >
> To: >
> Sent: Wednesday, June 24, 2009 3:27 PM
> Subject: [lpc2000] IAP with LPC2148
>
> > Now that I got my SD card working (and I'll mention again that Axelson's
> > book was the best documentation I've seen - it took me roughly 2 days to
> > clean up all the issues I didn't understand and recode them - works
> > perfect), I am looking at being able for the user to update the firmware
> > with the SD card, without access to the circuit board.
> >
> > I'm assuming that I should have my bootloader code at address 0 and the
> > working code at address 8K or somewhere like that. I can do that by the
> > compiler. I'm guessing that I need some memory location that indicates
> > that the upload was successful, that is overwritten when the upload
> > starts. That way, if there is an error, crash, or otherwise a failure,
> > the bootloader will continue to run the upload code (at address 0) until
> > a successful transfer happens. At which time, I will overwrite the
> > special memory location (valid code), and I will run the code (PC) from
> > this location until the next upload.
> >
> > Is this the proper mechanism? Anything else to look out for? I'm
> > trying to avoid the user doing anything (pressing reset on the circuit
> > board, etc.) except for inserting the SD card.
> >
> > On the 512K 2148, I might have double space to hold 2 versions of code,
> > but not sure yet. Code space is only 170K right now.
> > --
> > Sutton
> >
> >

--
Sutton Mehaffey
Lookout Portable Security
4040 Royal Dr.
Kennesaw, GA 30144
770-514-7999, 800-207-6269
Fax: 770-514-1285
http://www.lookoutportablesecurity.com
s...@lookoutportablesecurity.com

I am trying to communication between TWO lpc2148 boards using spi protocol.

AT Maste side, i am entering the character(in hyperterminal of pc),it will trasfer to LPC 2148 (master) using UART0.

COMMUNICATION will takes place USING spi.

At slave side,i am receiving that character from master, then i am displaying on Hyperterminal of PC using UART0.
It is not executing.
Can we use UART AND spi in same application?
can u help? tHANKS for advance.

--- In l..., Sutton Mehaffey wrote:
>
> I think that's the only way to communicate with an SD card, isn't it?
>
> raju_nem wrote:
> >
> >
> >
> > Hi
> >
> > have u done SPI communication with LPC2148?
> >
> > --- In l... ,
> > Sutton Mehaffey wrote:
> > >
> > > Now that I got my SD card working (and I'll mention again that Axelson's
> > > book was the best documentation I've seen - it took me roughly 2 days to
> > > clean up all the issues I didn't understand and recode them - works
> > > perfect), I am looking at being able for the user to update the firmware
> > > with the SD card, without access to the circuit board.
> > >
> > > I'm assuming that I should have my bootloader code at address 0 and the
> > > working code at address 8K or somewhere like that. I can do that by the
> > > compiler. I'm guessing that I need some memory location that indicates
> > > that the upload was successful, that is overwritten when the upload
> > > starts. That way, if there is an error, crash, or otherwise a failure,
> > > the bootloader will continue to run the upload code (at address 0) until
> > > a successful transfer happens. At which time, I will overwrite the
> > > special memory location (valid code), and I will run the code (PC) from
> > > this location until the next upload.
> > >
> > > Is this the proper mechanism? Anything else to look out for? I'm
> > > trying to avoid the user doing anything (pressing reset on the circuit
> > > board, etc.) except for inserting the SD card.
> > >
> > > On the 512K 2148, I might have double space to hold 2 versions of code,
> > > but not sure yet. Code space is only 170K right now.
> > > --
> > > Sutton
> > >
> >
> > --
> Sutton Mehaffey
> Lookout Portable Security
> 4040 Royal Dr.
> Kennesaw, GA 30144
> 770-514-7999, 800-207-6269
> Fax: 770-514-1285
> http://www.lookoutportablesecurity.com
> sutton@...
>