Pages: [1]   Go Down
Author Topic: A couple bootloader modification questions  (Read 562 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Okay, I have 2 AtMega88s here, unprogrammed.

I need to burn a bootloader to them. Now, I need the sketch to start as soon as the chip turns on, with as minimal a delay as possible. How would I go about doing this? Would it be possible to make it so that if a button is held down on boot, then the sketch will delay and allow reprogramming? I have no clue about bootloaders so I REALLY need help with this one.

Another thing is that I need these to run at 4MHz, using either an external or internal Crystal. I have external ones if I HAVE to use them, but I'd prefer internal clock.
Would someone be able to help me, or guide me, with changing the bootloader so that the chip runs at 4MHz? I need this so I can utilize the 1.8v voltage requirement.

I really appreciate any help you guys give!
Thanks!

Edit:
Can I just burn an extremely minimalistic "bootloader" that just sets the fuses? And then program using the Arduino IDE directly? Would I be able to use the Arduino commands (such as digitalWrite()) still, or would I definitely need a (modified) Arduino bootloader?
« Last Edit: December 13, 2009, 10:57:27 am by pspkicks » Logged

ottawa, canada
Offline Offline
God Member
*****
Karma: 5
Posts: 989
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could eliminate the bootloader and burn the chip with a programmer.
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Would I still be able to use Arduino commands? Like digitalWrite(), analogWrite(), etc?
Or do I NEED the bootloader for that?

How would I go about changing the clock speed then...?

edit:
I tried editing the make file and such, but I just don't get this stuff. I'm not used to messing with bootloaders.

I need to know how to make a bootloader for the AtMega88, set it to 4MHz clock, and reduce the delay time to 0 to go straight to a sketch...
Can ANYONE help me?
« Last Edit: December 13, 2009, 03:45:12 pm by pspkicks » Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You've got a lot of questions there, I'll try to answer a few, and set you on the way to finding the answers to the rest of them yourself.

First of all, you are going to need an external ICSP programmer. Examples include the simple parallel port version, or the more powerful USBtinyISP from ladyada.

The fuses are NOT set by the bootloader. The arduino "system" burns the fuses at the same time as the bootloader, but the bootloader itself does not affect the fuses.

Here's some more info on fuses...
http://www.ladyada.net/learn/avr/fuses.html

You can use a fuse calculator on the web to determine what fuses you need for a 4MHz clock. Then you'll use avrdude and your external programmer to burn the correct fuses on your micro.

Here's ladyada's tutorial on avrdude...
http://www.ladyada.net/learn/avr/avrdude.html

To use a 4Mhz clock, you'll need to create a new entry in the Arduino's Tools->Board menu. This new entry will specify that you are using a 4Mhz clock, and adjust the timing to suit.

You'll then write your code using all the usual digitalWrite() commands. When you compile your sektch, using the "play" button, the arduino IDE creates a compiled version of your sektch in machine-language, an intel-format .hex file.

Since you'll have no bootloader, you'll then use avrdude and your external programmer to upload the compiled sketch to your micro.

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm... so modifying a bootloader isn't necessarily needed. I guess the past few hours were for nothing  smiley-grin

I'll look into that. I took the time to start understanding the fuses for my mega, and wrote an entry in the makefile. I highly doubt it would've worked, anyway. Haha.

I didn't realize the Arduino IDE recompiled the sketch into a HEX file.
I thought interpretation was done using the bootloader on the mega. Boy was I wrong.

Thanks so much! I'll definitely look up on those.
Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's more info than you need on the Arduino build process

http://www.arduino.cc/en/Hacking/BuildProcess

Here's how to upload directly from the Arduino IDE using an external programmer. Note you don't have to do this if you are willing to use the command-line avrdude process

http://arduino.cc/en/Hacking/Programmer

Here's how to make your parallel programmer, if you go the cheapest way...
http://arduino.cc/en/Hacking/ParallelProgrammer

Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Already made the programmer, but I'm waiting for the sparkfun usb programmer to be in stock (cheapest place between price and shipping) and I'll get that.

Thanks so much for the help!
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 53
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Where does the hex file get saved...?
I saved a sketch to a folder, then compiled. No hex file.

edit:
Had to hit upload (even though I'm not using the IDE to upload) to get it to compile.
« Last Edit: December 16, 2009, 07:33:52 pm by pspkicks » Logged

0
Offline Offline
God Member
*****
Karma: 0
Posts: 572
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What version of the IDE are you using?
Logged

Pages: [1]   Go Up
Jump to: