go_away

Author Topic: Bootloader problem  (Read 2392 times)

0 Members and 1 Guest are viewing this topic.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Bootloader problem
« on: October 10, 2009, 11:58:03 AM »
When going through Admin's bootloader tutorial, when I use the bootloader the first time it works just fine, but when I try to upload another program it just says this forever "COM 1 at 9600 Baud: " with the spinning /. 
My guess is that somehow uploading a program to my microcontroller wipes the bootloader off of it. Any Ideas why this would happen and what I can do to fix it?
Robots are awesome!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Bootloader problem
« Reply #1 on: October 10, 2009, 12:12:42 PM »
hmmm, and you power off the mcu before trying to use the bootloader again?

And nope, its impossible to overwrite the bootloader unless your program does jump to memory commands (impossible to do by accident)
« Last Edit: October 10, 2009, 12:14:43 PM by Admin »

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: Bootloader problem
« Reply #2 on: October 10, 2009, 12:15:58 PM »
Maybe I didn't write the bootloader correctly? I just flashed it normally with AVRDUDE.
« Last Edit: October 10, 2009, 12:24:15 PM by Trumpkin »
Robots are awesome!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Bootloader problem
« Reply #3 on: October 11, 2009, 09:38:22 AM »
edit: I said something stupid, again . . . :-X
« Last Edit: October 15, 2009, 07:36:21 PM by Admin »

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: Bootloader problem
« Reply #4 on: October 11, 2009, 12:43:20 PM »
Found out it looks like Pomprocker had the same problem over at AVR Freaks http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=62534&highlight= (scroll down about two thirds of the page) I think I should be able to figure it out from there.
« Last Edit: October 11, 2009, 12:45:40 PM by Trumpkin »
Robots are awesome!

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: Bootloader problem
« Reply #5 on: October 15, 2009, 07:05:53 PM »
Still only works once, here is the command I'm using with AVRDUDE:
Code: [Select]
avrdude -c ponyser -p m32 -P /dev/ttyS0 -e -U lock:w:0x3f:m -U flash:w:BOOTLOAD.hex -U lock:w:0x0f:m -U lfuse:w:0xff:m -U hfuse:w:0x9e:m
I'm using an Atmega32 with a 16mhz external crystal.
Robots are awesome!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Bootloader problem
« Reply #6 on: October 15, 2009, 07:52:23 PM »
This is just a top of my head theory as I'm not very familiar with AVRDUDE commands, but . . . I see what looks like two lockbit fuse settings:

lock:w:0x3f:m
lock:w:0x0f:m

Are you perhaps locking future programming? Why not use 0xff to turn off all lock bits? Shouldn't there just be one lockbit setting?


ps - apologies about my previous post, I wasn't thinking at the time . . .

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: Bootloader problem
« Reply #7 on: October 16, 2009, 02:32:18 PM »
From what I've read I thought "lock:w:0x3f:m" would unlock the bootloader section of the flash memory and then "lock:w:0x0f:m" would re-lock it.
Quote
Why not use 0xff to turn off all lock bits?
Wouldn't that just set everything to 1 (which is default).
EDIT:
Looking a bit more closely I see that 0x3f will only program the two unused bits, 7 and 6.
« Last Edit: October 16, 2009, 02:40:34 PM by Trumpkin »
Robots are awesome!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Bootloader problem
« Reply #8 on: October 16, 2009, 02:47:19 PM »
Ok, makes sense on why you are using it twice.

Is there any reason you need to lock memory? What did you intend to lock (LPM, SPM, app section, boot section, etc)?

According to AVR Studio, 0xff is the setting for unlocking everything. 0xCF is what I use to lock the boot section entirely.

Offline TrumpkinTopic starter

  • Supreme Robot
  • *****
  • Posts: 1,177
  • Helpful? 5
Re: Bootloader problem
« Reply #9 on: December 28, 2009, 08:38:31 PM »
Just a quick follow up post. I did get this working a while ago, it turned out I just needed to power the ft232rl and ATmega32 from different power sources. I powered the ft232rl from USB to keep the software happy (so it doesn't say that there isn't a COM1 port) while I reset the ATmega32 by disconnecting and then reconnecting the battery. It now works more than one time as long as I reset the ATmega32 before I program. I guess this might have been a lot easier if I had mentioned that I was using a usb to uart bridge.
Robots are awesome!

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,658
  • Helpful? 169
    • Society of Robots
Re: Bootloader problem
« Reply #10 on: January 05, 2010, 12:41:43 AM »
haha yea I had that bootloader problem when I was developing the original Axon. Took me 2 additional prototypes to get it to work right during power resets.

 


Get Your Ad Here

data_list