💬 Various bootloader files based on Optiboot 6.2
-
@Samuel235
One possible reason: the BOD setting is now 0x06, which is the value if you use the Arduino IDE to burn the bootloader and set the fuses.
Since you use AVRDUDE ditectly, the extended fuse needs a different value (the one you get from the AVR fuse calculator at ATMEL).
I'm using my phone for this reply, so can not check the actual site right now@GertSanders, you're correct in that. I encountered this issue with my first board but the avrdude still contacted the board unlike this one. To test this out would you suggest me trying to burn the bootloader with the Arduino IDE?
I will attempt this tomorrow if so.
-
@GertSanders, you're correct in that. I encountered this issue with my first board but the avrdude still contacted the board unlike this one. To test this out would you suggest me trying to burn the bootloader with the Arduino IDE?
I will attempt this tomorrow if so.
@Samuel235
I just checked the avr calculator.
The extended fuse is FE for a BOD at 1.8V
Low E2 means internal oscillator. So that should be OK.I always use an arduino as ISP programmer when loading a bootloader onto a blank atmega328.
Tomorrow I will also test a new board with the AU variant (smd) of the mcu. Should be similar to your setup.
-
Just to keep you updated on the situation @GertSanders;
I have now double checked it hasn't burnt a external 8MHz crystal fuse setting, which it hasn't. I can't check for 16MHz setting as i do not have a 16MHz crystal or a board with one on. I will be making a new board later with a fresh MCU to see if it happens all over again. I need to stock up on 0.1uF caps to make any more boards after this one today so this is my only option for the moment.
Keep me posted on your AU style board that you're assembling today :)
EDIT/UPDATE
After remaking another board, the only thing i can think i did incorrectly was burn a high fuse of 0xEE. This would disable all SPI downloads and turn on watch dog timer. Do you think this may be whats happened here?
The new board is working perfectly fine. I've burnt the correct fuses and can read the fuses back.
I have downloaded your bootloader you included above (optiboot_atmega328_08m_004800_noled.hex). I made a new directory in 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders' called gertsoptiboot and saved the .hex file inside of there. So the overall directory of the bootloader is: 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\gertsoptiboot\optiboot_atmega328_08m_004800_noled.hex'.
The board.txt file i have added your included text in there but i assumed that i need to change the bootloader file path and name, so my boards.txt entry for you looks like this;
############################################################## ## GERTSANDERS ## ############################################################## menu.mhz=CPU Speed menu.bod=Brown Out Detection 28PinBoard.name=atmega328p based - 28 pin DIL 28PinBoard.upload.tool=arduino:avrdude 28PinBoard.upload.protocol=arduino 28PinBoard.upload.maximum_size=32256 28PinBoard.upload.maximum_data_size=2048 28PinBoard.bootloader.tool=arduino:avrdude 28PinBoard.bootloader.unlock_bits=0x3F 28PinBoard.bootloader.lock_bits=0x0F 28PinBoard.build.core=arduino:arduino 28PinBoard.build.mcu=atmega328p 28PinBoard.build.board=AVR_GERTSANDERS28PinBoard 28PinBoard.build.variant=28PinBoard 28PinBoard.menu.bod.4v3=4V3 28PinBoard.menu.bod.4v3.bootloader.extended_fuses=0x04 28PinBoard.menu.bod.2v7=2V7 28PinBoard.menu.bod.2v7.bootloader.extended_fuses=0x05 28PinBoard.menu.bod.1v8=1V8 28PinBoard.menu.bod.1v8.bootloader.extended_fuses=0x06 28PinBoard.menu.bod.off=Disabled 28PinBoard.menu.bod.off.bootloader.extended_fuses=0x07 28PinBoard.menu.mhz.8Mi-38K4-D8= 8Mhz - internal - 38K4 - D8 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.low_fuses=0xE2 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.high_fuses=0xDE 28PinBoard.menu.mhz.8Mi-38K4-D8.build.f_cpu=8000000L 28PinBoard.menu.mhz.8Mi-38K4-D8.upload.speed=4800 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.file=gertsoptiboot/optiboot_atmega328_08m_004800_noled.hexI have changed the bottom two lines and will change the arduino menu name when its working. While this all like fine to me (obviously point out any errors for me here if i have done any) I'm getting a little error of "pins_arduino.h: No such file or directory". I have done a little searching around and basically i think its because i do not have a variant folder for this board/entry. I'm assuming that you have a subfolder inside of 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants' titled something like "28PinBoard"?
To fix my issue i think i either need a copy of your variant folder OR to change the variant inside of boards.txt to that of something like 28PinBoard.build.variant=arduino:standard. Would this work considering there is nothing different on my MCU to that of a arduino board?
-
Just to keep you updated on the situation @GertSanders;
I have now double checked it hasn't burnt a external 8MHz crystal fuse setting, which it hasn't. I can't check for 16MHz setting as i do not have a 16MHz crystal or a board with one on. I will be making a new board later with a fresh MCU to see if it happens all over again. I need to stock up on 0.1uF caps to make any more boards after this one today so this is my only option for the moment.
Keep me posted on your AU style board that you're assembling today :)
EDIT/UPDATE
After remaking another board, the only thing i can think i did incorrectly was burn a high fuse of 0xEE. This would disable all SPI downloads and turn on watch dog timer. Do you think this may be whats happened here?
The new board is working perfectly fine. I've burnt the correct fuses and can read the fuses back.
I have downloaded your bootloader you included above (optiboot_atmega328_08m_004800_noled.hex). I made a new directory in 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders' called gertsoptiboot and saved the .hex file inside of there. So the overall directory of the bootloader is: 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\gertsoptiboot\optiboot_atmega328_08m_004800_noled.hex'.
The board.txt file i have added your included text in there but i assumed that i need to change the bootloader file path and name, so my boards.txt entry for you looks like this;
############################################################## ## GERTSANDERS ## ############################################################## menu.mhz=CPU Speed menu.bod=Brown Out Detection 28PinBoard.name=atmega328p based - 28 pin DIL 28PinBoard.upload.tool=arduino:avrdude 28PinBoard.upload.protocol=arduino 28PinBoard.upload.maximum_size=32256 28PinBoard.upload.maximum_data_size=2048 28PinBoard.bootloader.tool=arduino:avrdude 28PinBoard.bootloader.unlock_bits=0x3F 28PinBoard.bootloader.lock_bits=0x0F 28PinBoard.build.core=arduino:arduino 28PinBoard.build.mcu=atmega328p 28PinBoard.build.board=AVR_GERTSANDERS28PinBoard 28PinBoard.build.variant=28PinBoard 28PinBoard.menu.bod.4v3=4V3 28PinBoard.menu.bod.4v3.bootloader.extended_fuses=0x04 28PinBoard.menu.bod.2v7=2V7 28PinBoard.menu.bod.2v7.bootloader.extended_fuses=0x05 28PinBoard.menu.bod.1v8=1V8 28PinBoard.menu.bod.1v8.bootloader.extended_fuses=0x06 28PinBoard.menu.bod.off=Disabled 28PinBoard.menu.bod.off.bootloader.extended_fuses=0x07 28PinBoard.menu.mhz.8Mi-38K4-D8= 8Mhz - internal - 38K4 - D8 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.low_fuses=0xE2 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.high_fuses=0xDE 28PinBoard.menu.mhz.8Mi-38K4-D8.build.f_cpu=8000000L 28PinBoard.menu.mhz.8Mi-38K4-D8.upload.speed=4800 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.file=gertsoptiboot/optiboot_atmega328_08m_004800_noled.hexI have changed the bottom two lines and will change the arduino menu name when its working. While this all like fine to me (obviously point out any errors for me here if i have done any) I'm getting a little error of "pins_arduino.h: No such file or directory". I have done a little searching around and basically i think its because i do not have a variant folder for this board/entry. I'm assuming that you have a subfolder inside of 'C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants' titled something like "28PinBoard"?
To fix my issue i think i either need a copy of your variant folder OR to change the variant inside of boards.txt to that of something like 28PinBoard.build.variant=arduino:standard. Would this work considering there is nothing different on my MCU to that of a arduino board?
So here is my update: on my board I was able to upload my boot loader for 8MHz internal oscillator, with 34K8 upload speed and a led on pin D8. Here is the board running the "blink" sketch:

To make life easier I have zipped my complete folder, which I keep under the "hardware" folder in the sketches folder:
0_1460809951141_atmega328p.zip
I started with loading the ISP sketch on my Uno compatible board (it is set up for loading boot loaders on DIL type of atmega328):

Then I choose the following settings in the Arduino IDE:

After choosing these settings I selected "Burn Bootloader", which resulted in a good loading. Since there is no sketch yet, my board cycles through a reset fase (and thus the LED blinks three times every few seconds).
After that I selected my FTDI interface and uploaded the BLINK sketch with the same settings, and bingo: blinky lights.
My next step will now be to add the radio and do a LED dimming test, to be continued ...
-
So here is my update: on my board I was able to upload my boot loader for 8MHz internal oscillator, with 34K8 upload speed and a led on pin D8. Here is the board running the "blink" sketch:

To make life easier I have zipped my complete folder, which I keep under the "hardware" folder in the sketches folder:
0_1460809951141_atmega328p.zip
I started with loading the ISP sketch on my Uno compatible board (it is set up for loading boot loaders on DIL type of atmega328):

Then I choose the following settings in the Arduino IDE:

After choosing these settings I selected "Burn Bootloader", which resulted in a good loading. Since there is no sketch yet, my board cycles through a reset fase (and thus the LED blinks three times every few seconds).
After that I selected my FTDI interface and uploaded the BLINK sketch with the same settings, and bingo: blinky lights.
My next step will now be to add the radio and do a LED dimming test, to be continued ...
@GertSanders I will test this as we speak! May I ask if there is a difference between your DIL and TQFP entries in your boards.txt?
-
@GertSanders I will test this as we speak! May I ask if there is a difference between your DIL and TQFP entries in your boards.txt?
In the boards.txt you will see additional entries for the 32 pin version. These are basically a repeat of all the inputs for the 28 pin version.
So yes, there is a difference in the boards.txt file, but the boot loaders remain the same.
-
In the boards.txt you will see additional entries for the 32 pin version. These are basically a repeat of all the inputs for the 28 pin version.
So yes, there is a difference in the boards.txt file, but the boot loaders remain the same.
@GertSanders I'm sorry, I didn't look inside of the folder your provided before i asked that question.
-
Last update on this topic to save bogging it down now, just to assist anyone else looking to use your bootloaders. I have managed to upload sketches to my MCU. I'm running the 'optiboot_atmega328_08m_004800_noled.hex' bootloader with the following boards.txt entry:
############################################################## ## GERTSANDERS ## ############################################################## menu.mhz=CPU Speed menu.bod=Brown Out Detection 28PinBoard.name=atmega328p based - 28 pin DIL 28PinBoard.upload.tool=arduino:avrdude 28PinBoard.upload.protocol=arduino 28PinBoard.upload.maximum_size=32256 28PinBoard.upload.maximum_data_size=2048 28PinBoard.bootloader.tool=arduino:avrdude 28PinBoard.bootloader.unlock_bits=0x3F 28PinBoard.bootloader.lock_bits=0x0F 28PinBoard.build.core=arduino:arduino 28PinBoard.build.mcu=atmega328p 28PinBoard.build.board=AVR_GERTSANDERS28PinBoard 28PinBoard.build.variant=28PinBoard 28PinBoard.menu.bod.4v3=4V3 28PinBoard.menu.bod.4v3.bootloader.extended_fuses=0x04 28PinBoard.menu.bod.2v7=2V7 28PinBoard.menu.bod.2v7.bootloader.extended_fuses=0x05 28PinBoard.menu.bod.1v8=1V8 28PinBoard.menu.bod.1v8.bootloader.extended_fuses=0x06 28PinBoard.menu.bod.off=Disabled 28PinBoard.menu.bod.off.bootloader.extended_fuses=0x07 28PinBoard.menu.mhz.8Mi-38K4-D8= 8Mhz - internal - 4K8 - D8 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.low_fuses=0xE2 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.high_fuses=0xDE 28PinBoard.menu.mhz.8Mi-38K4-D8.build.f_cpu=8000000L 28PinBoard.menu.mhz.8Mi-38K4-D8.upload.speed=4800 28PinBoard.menu.mhz.8Mi-38K4-D8.bootloader.file=gertsoptiboot/optiboot_atmega328_08m_004800_noled.hexI'de like to thank you for the time and effort you have put in to assist me on this problem. I will be making entries for the rest of your bootloaders that you have also kindly given to us. I'll be changing this to a faster upload speed bootloader variant to allow for quicker uploads, maybe the 'optiboot_atmega328_08M_038400_NOLED.hex'. Would you advise me to use this bootloader with the correct boards.txt entry for it, would it be okay to have on my switch node permanently or is there something in there that wouldn't make it appropriate?
After seeing the extent that you have gone to with your customization with the bootloaders, it has inspired me to get into bootloaders myself. All in due time.
Thank you once again :)
-
I have upgraded my Arduino to 1.6.8, running Ubuntu 14.04LTS and downloaded the GertSander great optiboot :-)
I use Arduino Pro mini clones from ebay. I have removed power LED and LDO, since those shall be powered from 2pcs AAA . I can read "80e" on the crystal - I assume this is 8MHz
But I get weird troubles, I can flash bootloader via TinyUSB and upload sketch via FTDI, but not the lower frequencies like 1MHz or 4MHz, my working sketch upload is with 8 MHz (I have not tried with a higer freq). I can upload both using internal and external crystal settings. I use BOD=1.8V
I have been suspecting my USB cable to MiniUSB to FTDI, but it's working when I use the 8MHz frequencey and 38K4baud rate
any good ideas? -
I have upgraded my Arduino to 1.6.8, running Ubuntu 14.04LTS and downloaded the GertSander great optiboot :-)
I use Arduino Pro mini clones from ebay. I have removed power LED and LDO, since those shall be powered from 2pcs AAA . I can read "80e" on the crystal - I assume this is 8MHz
But I get weird troubles, I can flash bootloader via TinyUSB and upload sketch via FTDI, but not the lower frequencies like 1MHz or 4MHz, my working sketch upload is with 8 MHz (I have not tried with a higer freq). I can upload both using internal and external crystal settings. I use BOD=1.8V
I have been suspecting my USB cable to MiniUSB to FTDI, but it's working when I use the 8MHz frequencey and 38K4baud rate
any good ideas?You should not flash the 4Mhz bootloader to a pro mini, because it works in 2 ways: with 8Mhz crystal or using the internal oscillator.
When using the internal oscillator, you can use it at 8Mhz (default) or at 1Mhz. In this last case, the fuse for clockdivision by 8 need to be set.
I have not experimented with a clock division by 2, which would allow the 4MHz boot loader to work.
I have some 4MHz crystals, so that is why I compiled the 4Mhz version of the boot loader.
When uploading via FTDI, you need to keep the settings at which you flashed the bootloader.
I found that when using the internal oscillator, there is a difference when you flash at 5V or at 3V3 for the same processor. If you flash the boatloader while it is powered at 5V, and then use the processor at 3V3 you may have issues with loading via FTDI at higher speeds, because the actual speed of the internal oscillator is different at 5V or 3V3.
So I think it is best to always use the crystal.
If you do need to run the processor at slower speed, keep the 8Mhz crystal setting, but use clock division. This means you need to change the fuse settings to make that work.
-
@hek I wanted to upload a ZIP file of my hardware sub folder so people can just expand that ZIP into their <sketches>\hardware directory, but the Openhardware.io site unpacks the ZIP and puts the files in various places.
Is there a way to upload a ZIP without it being unpacked ? Is a RAR file allowed (not tested this). I tried renaming the extension to .unzip_this but that "file type" is not accepted by the import function. -
Good afternoon @GertSanders, I'm over the moon with your bootloaders than you provided me. Is there anything that would make you advice me not to use your 'optiboot_atmega328_08M_038400_NOLED.hex' bootloader full time on my light switches?
-
Good afternoon @GertSanders, I'm over the moon with your bootloaders than you provided me. Is there anything that would make you advice me not to use your 'optiboot_atmega328_08M_038400_NOLED.hex' bootloader full time on my light switches?
@Samuel235
I see no reason for not using it. The fact that you do not need the led, make no difference in the actual work of the boot loader. -
I have upgraded my Arduino to 1.6.8, running Ubuntu 14.04LTS and downloaded the GertSander great optiboot :-)
I use Arduino Pro mini clones from ebay. I have removed power LED and LDO, since those shall be powered from 2pcs AAA . I can read "80e" on the crystal - I assume this is 8MHz
But I get weird troubles, I can flash bootloader via TinyUSB and upload sketch via FTDI, but not the lower frequencies like 1MHz or 4MHz, my working sketch upload is with 8 MHz (I have not tried with a higer freq). I can upload both using internal and external crystal settings. I use BOD=1.8V
I have been suspecting my USB cable to MiniUSB to FTDI, but it's working when I use the 8MHz frequencey and 38K4baud rate
any good ideas?Just to be clear for me: did you try to upload a 1Mhz bootloader and then try to send a sketch via FTDI to the same 1Mhz boot loader, and this fails ?
-
@GertSanders said:
@Samuel235
I see no reason for not using it. The fact that you do not need the led, make no difference in the actual work of the boot loader.Thank you!
-
oki I got it 4 MHz wont work on Pro Mini. but I would assume 1MHz bootloaders should be ok?
1)I have first selected board: atmega328 based 32pins TQFP, then the frequency.
2)Flashed bootloader via tiny USB
3)Then put Pro Mini to FTDI, and then tried to upload sketch. (no changes at all to which board type, speed, or BOD)(I use 1 USB port on laptop for tinyUSB and another USB port for FTDI.)
Then I change speed/frequency, and do the step 1,2,3 as above
Selecting 8MHz-crystal-38k4-D8 is working flawless.
None of the 1MHz selection is working for me... -
oki I got it 4 MHz wont work on Pro Mini. but I would assume 1MHz bootloaders should be ok?
1)I have first selected board: atmega328 based 32pins TQFP, then the frequency.
2)Flashed bootloader via tiny USB
3)Then put Pro Mini to FTDI, and then tried to upload sketch. (no changes at all to which board type, speed, or BOD)(I use 1 USB port on laptop for tinyUSB and another USB port for FTDI.)
Then I change speed/frequency, and do the step 1,2,3 as above
Selecting 8MHz-crystal-38k4-D8 is working flawless.
None of the 1MHz selection is working for me...@bjacobse
Strange, I'm using the 1mhz with 9600 upload on 2 narrow nodes. I will investigate tomorrow. -
@bjacobse
Strange, I'm using the 1mhz with 9600 upload on 2 narrow nodes. I will investigate tomorrow.@GertSanders
I it's quite strange, I believe your bootloadser are in good shape and also your boards.txt
Thats why I suspect my USB to miniUSB cable to FTDI to behave odd.
Do you have Arduino Pro Mini 3,3V 8MHz that you can try at your place? -
@GertSanders
I it's quite strange, I believe your bootloadser are in good shape and also your boards.txt
Thats why I suspect my USB to miniUSB cable to FTDI to behave odd.
Do you have Arduino Pro Mini 3,3V 8MHz that you can try at your place?I uploaded two boot loaders on a pro mini 3V3 version with 8Mhz resonator.
On this board I loaded a boot loader for 1MHz clock frequency and upload speed of 9600 baud. This worked fine. Then I tried the 4800 baud upload speed version: same thing. Both boot loaders uploaded fine, and I was able to load sketches on both with an Adafruit FTDI friend at the specified upload speeds. 4800 is really "sloooooow".
Just to be sure I also used a cheap Chinese FTDI interface: same good results. -
I uploaded two boot loaders on a pro mini 3V3 version with 8Mhz resonator.
On this board I loaded a boot loader for 1MHz clock frequency and upload speed of 9600 baud. This worked fine. Then I tried the 4800 baud upload speed version: same thing. Both boot loaders uploaded fine, and I was able to load sketches on both with an Adafruit FTDI friend at the specified upload speeds. 4800 is really "sloooooow".
Just to be sure I also used a cheap Chinese FTDI interface: same good results.@GertSanders
Thank you Gert for checking with Arduino Pro Mini 8Mhz 3V3.
Then I will try with windows laptop, different FTDI and another cable. something in my current setup is behaving weird