Programming the Butterfly fuses or bootloader

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

I have the Butterfly. It's easy to program with just an RS232 cable and WinAVR. At least that's what I thought.

Now I need to program it so it will run my program after a reset, instead of running the "bootloader" program.

It seems I could do that by changing a fuse or changing the "bootloader". If I understand the situation correctly I will need to buy some hardware to do this. Like the stk500.

Is this correct?

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

Yes, you do need a programmer. The stk500 might be overkill (but is nice to have I guess). Check the Tools/Programmer section here, you can get a serial programmer for < $10. For a bit more, $40 or so, you can get a JTAG type device that also supports debugging.

/Lars

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

I thought that it would be possible to program the AVR butterfly using only RS232. There are several web sites suggesting that this is true.

For example:

Isn't this correct?

David

(Anxiously awaiting the AVR Butterfly that he is hoping to program using only RS232 connections!)

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

Quote:
I thought that it would be possible to program the AVR butterfly using only RS232

It is, through the bootloader, but pls note that OP wants to get rid of the bootloader:

Quote:
instead of running the "bootloader" program

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

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

dtlinker wrote:
I thought that it would be possible to program the AVR butterfly using only RS232. There are several web sites suggesting that this is true.

For example:

Isn't this correct?

David

(Anxiously awaiting the AVR Butterfly that he is hoping to program using only RS232 connections!)

Yes you can program the Butterfly with the serial port. I have done so. But when you reset the thing (or power it on), it always runs the "bootloader". To exit the bootloader and run your code, you must press the joystick. This is okay for many uses but for some uses it is necessary that the Butterfly run the user's program automatically at power-on.

The Atmel chips are complicated beasts. The only reason you can program it with the serial port is because there is a small "bootloader" program that is resident in a special part of the program memory (flash). You can't change this program via the serial port. There is a "fuse" in the chip that specifies whether the reset interrupt vector for the bootloader is used, or the reset interrupt vector for the user program is used. You can't change the fuse via the serial port either.

I'm not an expert, and if I'm wrong, please correct me.

I don't really want to get rid of the bootloader. I just want it to run my program when it's powered on. I think there are at least two ways to do this and both require some programming hardware.

I can change the fuse so it will run my program after reset. I can then get to the bootloader from my program by jumping to it when I want to update the software. If my program gets corrupted, I can use the programming hardware to change the fuse back to the original setting.

Another approach would be to change the bootloader program. If it would check a joystick switch initially, and jump to the user program if the switch wasn't closed, this would work and would allow use of the bootloader by pressing and holding the joystick when resetting the board.

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

SteveN wrote:
Hi,

I should have added to my first post to not forget to order some header pins. You will need to add the dual row 6 (2 x 3) pin header to the Butterfly to connect the ATAVRISP.

Regards,
Steve

I already have the header pins, but thanks for the reminder. I do think I will buy the ATAVRISP.

There is a JTAGAVR device selling for $37.95 that looks interesting but unless someone here will recommend it, I'll stick with Atmel's ISP thing.

I never used JTAG and I don't need it, but it would be nice to have if it works. But the procedure and hardware required to update the microcode has scared me off of that thing.

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

steve17, I you just need to get out of the bootloader it might be enough to ground PB6 which is where the "UP" switch is connected. Works for me here. You can no longer use UP in your application though.

/Lars

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

Naa. That's too easy :D

Now why didn't I think of that?

It looks like a simple jumper would do it. PB6 is next to ground at the port B header connector.

Thanks.