Sorry if this is in the wrong sub-forum, I wasn't entirely sure where to put it.
I have recompiled the bootloader with an additional option for the Nano board (different fuses). I have also modified boards.txt with my new Nano option. I opened the Arduino IDE, but my new board is not visible in the menu. Please can someone explain what else I have to modify to make it appear in the IDE as an option?
I changed the EFUSE to FD, because the 05 value in the original Nano entry I copied gives errors during bootloader installation. As you can see, at the moment this is mainly just a test to get my own board option to appear in the Arduino IDE, after which I will make further changes to the bootloader.
I suspect the problem is you're not editing the boards.txt that is actually being used by the Arduino IDE. When you update Arduino AVR Boards in Boards Manager it installs to the Arduino15 folder and the boards.txt in the Arduino IDE installation folder is no longer used. To find the boards.txt file in use do this:
Select an Arduino AVR Boards board from the Tools > Board menu.
File > Examples > EEPROM > eeprom_clear
Sketch > Show Sketch Folder
Move up 4 folder levels and you will reach the location of boards.txt for the active version of Arduino AVR Boards.
The problem with editing Arduino AVR Boards is you will need to redo it every time you update to a new version of Arduino AVR Boards/Arduino IDE. Much better would be to create your own hardware package in {sketchbook folder}/hardware. You should only need to reference the Arduino AVR Boards core by changing:
pert: I suspect the problem is you're not editing the boards.txt that is actually being used by the Arduino IDE. When you update Arduino AVR Boards in Boards Manager it installs to the Arduino15 folder and the boards.txt in the Arduino IDE installation folder is no longer used. To find the boards.txt file in use do this:
Select an Arduino AVR Boards board from the Tools > Board menu.
File > Examples > EEPROM > eeprom_clear
Sketch > Show Sketch Folder
Move up 4 folder levels and you will reach the location of boards.txt for the active version of Arduino AVR Boards.
Thanks, it worked great as soon as I put it in the active folder.
pert: The problem with editing Arduino AVR Boards is you will need to redo it every time you update to a new version of Arduino AVR Boards/Arduino IDE. Much better would be to create your own hardware package in {sketchbook folder}/hardware. You should only need to reference the Arduino AVR Boards core by changing:
nano_2.build.core=arduino
to:
nano_2.build.core=arduino:arduino
and
nano_2.build.variant=eightanaloginputs
to:
nano_2.build.variant=arduino:eightanaloginputs
Thanks, I suspected it would all get wiped when I updated. If you have a spare moment, please could you give a little more detail? It sounds like you're saying I should create a folder called 'hardware' in my sketchbook. But what should the file in there be called? Should I just name it boards.txt? And will the code I posted earlier with your modifications be sufficient without anything else?
Finally, I'm not sure where the bugs notification goes, but this is the avrdude error when the value of 05 is written to the extended fuse of a Nano board. As I said in my previous post, to give the same result without an avrdude error, the value should be FD.
avrdude: reading input file "0x05" avrdude: writing efuse (1 bytes): Writing | ***failed; ################################################## | 100% 0.03s avrdude: 1 bytes of efuse written avrdude: verifying efuse memory against 0x05: avrdude: load data efuse data from input file 0x05: avrdude: input file 0x05 contains 1 bytes avrdude: reading on-chip efuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: WARNING: invalid value for unused bits in fuse "efuse", should be set to 1 according to datasheet This behaviour is deprecated and will result in an error in future version You probably want to use 0xfd instead of 0x05 (double check with your datasheet first). avrdude: 1 bytes of efuse verified
Beedoo: If you have a spare moment, please could you give a little more detail?
It's easiest for me to just put the hardware package together for you. There is a bunch of information on this at:
Create a folder named hardware in your sketchbook folder. The sketchbook folder location can be found at File > Preferences > Sketchbook location.
Download the attached file.
Copy the folder nano_2 from the downloaded zip file to {sketchbook folder}/hardware
Copy your ATmegaBOOT_168_atmega328_2.hex to {sketchbook folder}/hardwarenano_2/avr/bootloaders/atmega
Restart the Arduino IDE if it's running.
It's possible to create a very minimal hardware package like this one because you can reference parts of other hardware packages. In this case the nano_2 hardware package is referencing Arduino AVR Boards' arduino core, eightanaloginputs variant, and avrdude tool. It is also using the default platform.txt included with the Arduino IDE. It doesn't require any custom programmers. So all you need is the hardware definitions in boards.txt and your modified bootloader. It's not possible to reference bootloaders from another package.
Beedoo: Finally, I'm not sure where the bugs notification goes, but this is the avrdude error when the value of 05 is written to the extended fuse of a Nano board. As I said in my previous post, to give the same result without an avrdude error, the value should be FD.
This is well known. See:
The Arduino developers added that warning. All it means is that at some point in the distant future they may remove the workaround they added to AVRDUDE to make the old fuse values work with the changed handling of unset fuse bits in AVRDUDE 6.2. They will also update the fuse settings in Arduino AVR Boards boards.txt before or at that time. The warning is only there to warn custom hardware package authors that the fuse values that work now may not at some point in the future. The problem is changing them will break compatibility with the old AVRDUDE versions. You need to understand the difference between an error and a warning. So if that's the sole purpose of your custom board then it's unnecessary but it's still good to learn how the hardware definition system works and how to create your own packages.
Sorry for flagging up a known issue. And thanks for showing me where the Arduino project lives on github.
pert: So if that's the sole purpose of your custom board then it's unnecessary but it's still good to learn how the hardware definition system works and how to create your own packages.
My primary objective is to experiment with different clock sources, clock speeds and associated parameters. I was going to write the fuses using command line and my USBasp, but I'm a believer in 'do once, use many times', and so I thought it would be useful to create and store some Nano variants in the Arduino IDE. I'm a beginner, so my first step was the task of getting a variant to appear in the IDE. Now I've done that with your help, I can move onto modifying the variant I have, and creating other variants. Hopefully this thread will also be useful to others who want to create variants and have them appear in the IDE menu.
Great! As I said I think it's a very useful skill to learn. You might want to use GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB as well as the hardware specification I linked in my last post as a reference for some more advanced stuff you can do. By adding custom Tools menu items (such as the Tools > Processor menu shown when Nano is selected) you can really make a hardware package feature rich while keeping your boards.txt file pretty elegant and avoid clogging up the Boards menu with tons of boards.
pert: Great! As I said I think it's a very useful skill to learn. You might want to use GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB as well as the hardware specification I linked in my last post as a reference for some more advanced stuff you can do. By adding custom Tools menu items (such as the Tools > Processor menu shown when Nano is selected) you can really make a hardware package feature rich while keeping your boards.txt file pretty elegant and avoid clogging up the Boards menu with tons of boards.
Thanks, I will have a read of that as it looks very useful.