auto-detect if bootloader is present

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone,

 

I am using this Xmega bootloader to upload a hex to my 128A1U using AVRdude.

Sometimes, when I am not very careful, I override the bootloader and upload the hex directly to the chip using JTAG and the ICE.

Is there a way I can check if the bootloader is present on the chip prior to using AVRdude to upload the program ?

 

Thanks

AJ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Use avrdude to read out the flash (esp the bootloader section) and just see if it is all 0xFF or not.

 

Might be easiest in "terminal mode" (-t) where you can just say "dump flash N M" where N is the start address of the BLS and M is something like 16. You should be able to tell from the first 16 bytes whether there's something valid there or not.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess one can do most things in hardware or software, (reminds me of another recent Thread...).

 

Since the Xmega128 has soooo many I/O pins, you could add a resistor and an LED.

 

When you turn the power on, the micro typically starts with the Bootloader code, to see if it is required to download new software, or if it should just run the currently loaded software.

So why not have the Bootloader just turn on an LED as it starts up?

 

If the Bootloader is present, the LED is on.

If the Bootloader is not present, the LED is off.

 

When you are done developing your code, you can remove the extra two lines of code...

 

Fast, easy, no keyboard or PC connection required...

 

JC

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know all the ways of using avrdude.  If it talks directly to the bootloader via USB or a serial port, it will let you know in a hurry if there is a bootloader on your device.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you everyone for your suggestions.

I will work on implementing both, I will first try to do read the flash with AVRdude and try to detect the presence of the bootloader as clawson suggested.

I am using the boot loader in found here : http://www.avrfreaks.net/forum/t...

It should be easy enough to add an output pin dedicated to this purpose.

 

Thanks

AJ