Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Bootloader questions, basic to advanced...

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR
View previous topic :: View next topic  
Author Message
AdrianJ

Bascom Expert



Joined: 16 Jan 2006
Posts: 2477
Location: Queensland

australia.gif
PostPosted: Sun Jul 06, 2008 11:42 pm    Post subject: Bootloader questions, basic to advanced... Reply with quote

A 'Bootloader' is a piece of code you write ( or copy ) into a special area of Flash called the boot block within the main Flash of an AVR - usually at the top of Flash. Various options ( fuses ) exist for setting the size. The Bootloader can contain any means you like for talking to the outside world, UART, TWI, SPI, etc. And all it has to do is *reliably* read the data in that you send, and write it into normal Flash program area. That then becomes the ( new ) main program.

Several options exist for updating a program to a new one in the field.

1> You can set a port pin, eg with a dipswitch or link, to a high ( or low ) state, detect this from within the main program, and jump into the boot loader, then wait there for the new program to be sent. That relies on having the main program running, and the user doing 'something' to fall into the bootloader.

2> You can set another fuse ( in the factory ) to force the chip to go first to the boot code after reset. Then in your boot code, you wait for some special byte sequence in your input line, and if its sent, accept the rest of the bytes as new program. If its not sent, you jump into a normal reset for your application. That way you dont need any switches, and even if the main program fails, you can still upgrade or reload it.

If you have multiple AVRS in the device, you presumably already have some sort of network so they all talk to each other. So then you can use one as a master, receive a new program from the outside, and pass it to the correct slave, with some way of invoking the bootloader in that slave.

_________________
Adrian Jansen
Computer language is a framework for creativity
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum