A log of slapdash experiments…

December 11, 2009

Here’s how u make a bootloader

Filed under: AVR Bootloader,Uncategorized — adwaitsdeshpande @ 3:14 pm

I’m assuming that the readers know what microcontroller bootloaders are.. (Or else they wouldn’t so interested to read this particular post..)

Among different communication interfaces, i chose the serial interface for the obvious reason that it’s ‘the’ most easiest port to work with. (Actually i really feel sad that it is now termed as a legacy port and now even some desktop manufacturers choose to exclude it.. )

The reason why i wanted to write a bootloader was that i wanted to interface avrstudio to one of our avr development boards.  AVRSTUDIO has programmer interfaces like STK500 and AVRprog.  The idea of writing a program and burning it using the same software is appealing and easy for my students (as i have mentioned earlier, i conduct workshops)

So i went about reading the protocol of both the interfaces AVRprog and STK500.. At first the AVRprog protocol seemed way easier than stk500.. So i went about writing the code for it.. The protocol is explained in the avr109 application note..

It’s really nothing different.. you recieve some command bytes via USART, decode those commands and execute the appropriate operation. Some standard operations are Page erase, Page load, Page write, Page read etc.. The datasheet of the device explains clearly how to accomplish all of these tasks..

now, i finished this code in very less time and after some debugging, it worked perfectly well with winavr’s avrdude utility..  B-)

Now as went off to boast about it in the avrfreaks forum,  i learnt that avrprog is no more supported(or something to that effect). :’(

i needed some work to do in order to make my bootloader compatible to avrprog. But i scraped the idea and thought of writing a stk500v2 compatible bootloader.

After a long break, i started doing that. No new concepts are needed here, just the protocol is a little long..

It is described in the avr 068 app note

I have almost finished it but there is still a problem.. It does not work perfectly at the baud rate of 115200.. i’ve tried baudrates lower than that and it works fine..  B-)  B-)

So here’s the story till now.. Although i’m in a fix, i think some of you who are going to attempt writting bootloaders might get some kind of idea what they are about to do.. Its great fun doing it.. and when you finish, you’ll want to boast.. comment on this post if i’m wrong.. ;)

October 5, 2009

My Brand new avr bootloader… In assembly!

Filed under: AVR Bootloader,Uncategorized — adwaitsdeshpande @ 2:55 pm
Tags:

I just want to mark this day to remember when i developed my bootloader.

But i’m tired( and very hungry) so, i’ll mention the details tomo.. But ya, though “writing a boot loader” seems an intimidating task, its actually very easy…

btw: i have started programming in assembly again and i feel nostalgic..

also, i have developed this code from scratch(well, with help of couple of scratches from here and there!) in 3 days.

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.