FQBN for attiny45?

Pert!

I got me another question. I can compile a program with arduino cli for an attiny, but I am sure the computer is compiling for an Attiny85 (as the maximum programming size is over 8kb) and I want to compile for the 45

With the board listall command I found that this FQBN is to be used for the AT25, AT45 and AT85
ATTinyCore:avr:attinyx5
But like with the nano (arduino:avr:nano:cpu=atmega328old) I am guessing that I have to type to something similar behind the attiny FQBN. I have not find what I should use as FQBN for 'dem AT45.

I am guessing it is something like :mcu=attiny45 or .... (have not tried it)

Than another related point. When attempting to upload I got an error message of the baudrate not being good.
I use this line for uploading:
arduino-cli upload -b ATTinyCore:avr:attinyx5 -p COM4 -i ./build/ATTinyCore.avr.attinyx5/trainCatcher.ino.hex"

Besided a wrong FQBN, is the rest correct? Do I need to explicetly specify that I am using an arduino as ICSP programmer in this line?

Kind regards,

Bas

Hi @bask185. ATTinyCore makes extensive use of the "custom board options" feature

These are specified as part of the FQBN:

https://arduino.github.io/arduino-cli/latest/FAQ/#how-to-set-multiple-board-options

You can use the arduino-cli board details command to learn the available options for a given board, and the menu and option IDs that must be used in the FQBN to set an option:

$ ./arduino-cli board details --fqbn ATTinyCore:avr:attinyx5
Board name:            ATtiny25/45/85 (No bootloader)
FQBN:                  ATTinyCore:avr:attinyx5
Board version:         1.5.2

Package name:          ATTinyCore

Platform name:         ATTinyCore
Platform architecture: avr

Option:                LTO (1.6.11+ only)                                                                          LTO
                       Enabled                             ✔                                                       LTO=enable
                       Disabled                                                                                    LTO=disable
Option:                Timer 1 Clock                                                                               TimerClockSource
                       CPU (CPU frequency)                 ✔                                                       TimerClockSource=default
                       64MHz                                                                                       TimerClockSource=pll
                       32MHz                                                                                       TimerClockSource=lowpll
Option:                Chip                                                                                        chip
                       ATtiny85                            ✔                                                       chip=85
                       ATtiny45                                                                                    chip=45
                       ATtiny25                                                                                    chip=25
Option:                Clock Source (Only set on bootload)                                                         clock
                       8 MHz (internal)                    ✔                                                       clock=8internal
                       16 MHz (PLL)                                                                                clock=16pll
                       20 MHz (external)                                                                           clock=20external
                       16 MHz (external)                                                                           clock=16external
                       12 MHz (external)                                                                           clock=12external
                       8 MHz (external)                                                                            clock=8external
                       6 MHz (external)                                                                            clock=6external
                       4 MHz (external)                                                                            clock=4external
                       1 MHz (internal)                                                                            clock=1internal
                       7.372 MHz (external)                                                                        clock=737external
                       9.216 MHz (external)                                                                        clock=92external
                       11.0592 MHz (external)                                                                      clock=11external
                       14.7456 MHz (external)                                                                      clock=14external
                       18.432 MHz (external)                                                                       clock=184external
                       4 MHz (internal)                                                                            clock=4internal
                       16.5 MHz (PLL, tweaked)                                                                     clock=165pll
                       128 kHz (internal WDT)                                                                      clock=128internal
Option:                Save EEPROM (only set on bootload)                                                          eesave
                       EEPROM retained                     ✔                                                       eesave=aenable
                       EEPROM not retained                                                                         eesave=disable
Option:                B.O.D. Level (Only set on bootload)                                                         bod
                       B.O.D. Disabled (saves power)       ✔                                                       bod=disable
                       B.O.D. Enabled (1.8v)                                                                       bod=1v8
                       B.O.D. Enabled (2.7v)                                                                       bod=2v7
                       B.O.D. Enabled (4.3v)                                                                       bod=4v3
Option:                millis()/micros()                                                                           millis
                       Enabled                             ✔                                                       millis=enabled
                       Disabled (saves flash)                                                                      millis=disabled
Programmers:           Id                                  Name
                       usbasp                              USBasp (ATTinyCore)
                       micronucleusprog                    Micronucleus
                       parallel                            Parallel Programmer
                       arduinoasisp                        Arduino as ISP
                       diamexusbisp                        Diamex USB ISP
                       dragon                              AVR Dragon ISP mode (ATTinyCore)
                       usbtinyisp                          USBtinyISP (ATTinyCore) SLOW, for new or 1 MHz parts
                       ponyser                             Ponyser Programmer
                       stk500                              Atmel STK500
                       arduinoasisp32u4                    Arduino Leo/Micro as ISP (ATmega32U4)
                       usbtinyisp2                         USBtinyISP (ATTinyCore) FAST, for parts running >=2 MHz
                       atmel_ice                           Atmel-ICE
                       avrispmkii                          AVRISP mkII
                       avrisp                              AVR ISP

So what you can see from this is that the default "Chip" menu setting is indeed "ATtiny85". If you would like to use a different option from this menu, you must use the menu ID (chip) and option ID (e.g., 45) in the FQBN.

So the FQBN for the ATtiny45 board with all other options set to their default value is:

ATTinyCore:avr:attinyx5:chip=45

You should also check the other menus to see whether a custom option is needed. If you don't specify an option then the default value shown in the arduino-cli board details output will be used.

Custom board options are specified in a comma separated list, so for example if you wanted set the "Clock Source" menu to "16 MHz (external)", you would use this FQBN:

ATTinyCore:avr:attinyx5:chip=45,clock=16external

Use the --programmer arduinoasisp flag in your arduino-cli upload command to specify the "Arduino as ISP" programmer be used for the upload.

Thank you not-Pert :sweat_smile: You have been really helpful to me.

I have one small question. How can I determen the exact syntax for the options, for instance.

Option:                Chip                                                                                        chip
                       ATtiny85                            ✔                                                       chip=85
                       ATtiny45                                                                                    chip=45
                       ATtiny25                                                                                    chip=25
Option:                Clock Source (Only set on bootload)                                                         clock
                       8 MHz (internal) 

You typed: chip=45 But, looking at the output of arduino-cli I would be inclined to type chip= ATtiny45 instead.

And same for clock settings: the board details specify among others 8 MHz (internal) so based on what you told me I am guessing it would become clock=8internal.

Lets say that I do not want to retain EEPROM. I have no clue what to type in as option.

How can I find out what the exact syntax is for the options?

And for the bonus :wink:.
I let a python script generate the build and upload scripts whenever I assemble a software project. The scripts lists all installed FQBN and you have to enter one of these FQBN in the program. The script also pickes the last listed com port. So if you plug in an arduino or whatever in the USB port when you run the script, it is likely that the upload script will end up with the correct COM port number.

Learning about all these options, I figured it would be nice addon to have a more interactive program which does the same thing only more user friendly in the form of yes and no questions of even a GUI with which you can (un)check boxes and use dropdown menus and such.

I am propably not the first person who thinks of this. So the bonus question: Is this wheel already invented by somebody?

Kind regards,

Bas

"ATtiny45" is the human readable label for the option. But the FQBN is the machine readable name for the board, so we must use the machine identifier for the option, which is 45.

The narrow display width of the forum posts might make the ID hard to see. You must scroll the code block window over to the right to see it. It is probably easier to see in the terminal (you even get color there if supported).

That is correct. Note that this is the default selection for the clock menu, so it is not required for you to specify that in your FQBN, but you are welcome to do so if you don't feel comfortable relying on the defaults.

eesave=disable

Just look at the rightmost column of the arduino-cli board details output.

If you are curious to learn more about the custom board options system, the technical details are available in the Arduino Platform Specification:

https://arduino.github.io/arduino-cli/latest/platform-specification/#custom-board-options

But a user of Arduino CLI is not required to understand how these options are configured. That information is really only needed by the Arduino boards platform authors like DrAzzy.

Nice! You will likely find the --format json flag useful for that. This will cause the arduino-cli board details output to be in a machine readable JSON format that can easily be consumed by a Python script.

Well, it sort of sounds like the Arduino IDE. But I say go for it!

The narrow display width of the forum posts might make the ID hard to see. You must scroll the code block window over to the right to see it.

Yep, I had no clue the information was just sitting there :sweat_smile:

Well, it sort of sounds like the Arduino IDE.

Haha yes I agree, indeed it does. I am never fan of IDEs, they are ever inferior to dedicated code editors. I am a VS Code user myself. That is why I want dedicated upload and build script per project. Besides those I also have scripts to initialize git repositories and immediately push them to github.com. I have a script to make software releases. I add the date and time to the program every time when I compile. This gets printed to the monitor in setup. I recently added custom code-snippets. For every script there is a entry in tasks.json so I can do just about everything with the press on F6

As ATtiny user, it would be a nice addon for me to make the upload/build scripts more configurable.

Kind regards,

Bas

It sounds like a very cool project.

Arduino really facilitated this sort of thing by moving all the non-GUI functionality out of the original location in the Java code base of the Arduino IDE and into a command line tool. This tool can then be used directly, by both versions of the Arduino IDE, by Arduino Web Editor, and by 3rd party tools such as the Arduino extension for VS Code Microsoft made.

Some years ago, I made extensive use of the classic Arduino IDE's command line interface in automated applications and it was a bit painful to be forced to use an application that was primarily intended to be a GUI in that manner. Arduino CLI has made that sort of thing so much easier to do.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.