Recently installed bootloader on a breadboarded mega8 but it was from a 16 mHz 328. westfw had me change upload speed in boards.txt to 9600 so now I can upload sketches. Serial now runs at half speed, no problem. Delay is twice as long, no problem. But 18 seconds start up is a big pain. I think it was for chips without power on reset? I have searched everywhere but the only solution I can find is a totally new bootloader .hex file.
Does anyone know a way I can get a fast start up with my present bootloader?
Thanks
That sounds about right. That's an OLD bootloader from before the automatic reset, and it was designed to wait about 10 seconds for upload traffic. Since you're running at half-speed, it takes about twice as long.
You could put optiboot on your mega8. It would run faster, implements the adafruit no-wait mod, and give you an additional 512bytes of code space. But you'd need to burn a new bootloader, and you'd need to modify boards.txt...
Trying to load optiboot ATmega8 to the standalone mega8 chip using Optiloader sketch on a Uno. Using the same wiring I used before, wiring the Uno directly to the target, using the standard 10, 11, 12 & 13 pins with 10 going to reset on the target, to load bootloaders only this time I'm wiring target chip's Vcc to pin 9 of the Uno for power to the target.
I've selected the optiboot for the mega 8 on the board's menu. I have arduino as ISP selected for programmer. I only get "Target power on - Starting Program Mode - Failed, result = 0. every time I hit reset. I've tried three different chips. They all have bootloaders on them but I want to use the Optiboot so I don't have to wait 20 seconds to reset.
Thanks for the reply. I cannot flash, get Failed - result = 0x00. Do you mean the boards.txt upload speed? I tried both 19200 and 9600. I made the boards.txt entry for the optiboot. Don't know if it's correct as I don't know what I'm doing there. Is that needed for flashing with Optiloader? I'm using SPI, wired as I wrote in my previous post, post #6. My boards.txt entry for the optiboot is attached.
What you have done is set the fuses in that .txt file to use 'External Oscillator'.
If you don't have a crystal attached (i.e. internal osc), it is not possible to program the chips. In order to set the fuses back to use the internal oscillator, you will need to either add a 16MHz crystal and caps to your circuit, or feed an 8MHz clock signal in to the chip.
It is possible to modify the Optiloader sketch to output an 8MHz square wave, so that is your best approach.
You will then need to change the fuse settings in your boards.txt file.
You also need to change the frequency in your boards.txt file to 8000000L if you are using the internal oscillator as otherwise all of your delays/baud rates will be out.
EDIT:
I have also attached an 8MHz version of the optiboot bootloader for the atmega8. This one has an upload speed of 57600 baud. If this proves too fast for an untuned internal oscillator I can compile one with a lower baud rate.
OK, thanks. I copied that boards.txt entry from the old atmega.name from Arduino NG or older w/ ATmega8 to match that in my Uno boards menu for the optiboot and changed the bootloader.path and bootloader.file. Did not change the fuse settings, or anything else. Those fuse settings worked on internal RC before, so I'm confused, as usual. I don't understand the fuses, so I need more research there.
I can get a 8mHz clock. I'll write a sketch for my MiniPro to supply it. so I'll try that because I can see activity on target's clock, pin 13 but nothing on either MISO or MOSI on the target.
Another thing just occurred to me. mega8Target takes 20 seconds to run after reset and I'm getting Vcc off of pin 9 of the Uno. Maybe I should have it powered up 20 seconds before optiloader tries to query it.
Optiloader isn't looking at the bootloader, it uses ISP. It wouldn't matter if the bootloader takes 20 seconds or 2 hours to run as the chip is held in reset for ISP programming anyway.
i think the only boards.txt entries that matter for isp are fuses and the line that points to the bootloader file. the other stuff is for serial download after bootloader is flashed. i prefer to use avrdude directly from the command line to avoid the extra level of complication.
ive been using that opti from tom for a long time now and it works great. out of several thousand chips programmed only a handful were off enough to reach the danger zone. by calibrating internal clock it was 100%. in fact the only way to guaranty reliable 115k baud operation at 8mhz is to use internal rc clk. using an 8mhz crystal is right on the edge of failure and dont work with some external equipment. not many realize that sometimes the rc is more reliable&accurate than a crystal.
Great information, thanks. When I get some time, I'm going to bring my signal generator in from the shop and use it for an 8 mHz clock. It is extremely accurate and has a 5 volt square wave available.
OK, I got optiboot on my mega8 by using an external 8 mHz clock. It doesn't use the fuse bits Low E4 that I have in the boards.txt file. It restores the fuse bits that were present before, apparently. It is now set for crystal, low 0xBF, high 0xCC. Now I have to find a way to change those fuses to internal 8 mHz RC with low 0xE4 and (I assume) high 0xCA. I have no idea how the chip got low BF because it was running fine before on internal 8 mHz RC.
I suppose I could temporarily modify optiloader to change the saved fuses before it restores them unless someone here can tell me a better way. Any help would be greatly appreciated...
Thanks again. I edited the boards.txt file with E4 & DC as you suggested and tried optiloader again (after closing the sketch and re-downloading it). It's still not using boards.txt, same result with low byte BF and high byte CC. My boards.txt file is in C:\program files (X86)\arduino\hardware\arduino\boards.txt
None of the board.txt entries have the low BF and high CC. It's a mystery as to where these bytes came from..
Ah, its hardcoded into optiloader as is the hex file.
The simplest way to burn the bootloader is using ArduinoISP. Download the ArduinoISP sketch to your programing Arduino (you may have to modify it to add the 8MHz clock output lines as I mentioned before). Then select from the boards menu the entry for the Atmega8. Then set the programmer to be 'ArduinoISP'. Finally click 'Burn Bootloader'.