Arduino Nano firmware

Hello,
How to I get access to new Arduino Nano firmware ? How is the new firmware installed? Is it installed via the IDE?

I noticed topics on updating bootloader on a Nano (in hex format). Is this the Nano's "firmware" ? If so where do I get access to these ?

Thanks

Santanu

The real firmware is your sketch. You install it every time you upload to a Nano.

I think what you are really talking about is the bootloader, which could also be considered firmware, though nobody ever refers to it that way.

Why are you asking this question?

ghoshsn:
Hello,
How to I get access to new Arduino Nano firmware ? How is the new firmware installed? Is it installed via the IDE?

I noticed topics on updating bootloader on a Nano (in hex format). Is this the Nano's "firmware" ? If so where do I get access to these ?

The Arduino's chip has a memory called flash memory. On the Nano and Uno, it's 32KB memory. So there is some space (partition) reserved for the bootloader. It is 0.5KB reserved on the Uno, and 2KB reserved on the Nano. The board can't run without the bootloader. The Arduino Nano board's bootloader is of 2KB and Uno's bootloader is 0.5KB. When you program the board, the code you programmed is the instructions it has to read. If you program it with a code that is like a firmware, then it becomes the board's firmware. The bootloader is different than the program that it runs. Bootloader just helps to declare the pins and run the code. The program that you uploaded to the board works next.

You may have noticed that when you power on the board, then the L led flashes for some time. The bootloader runs in that time and runs the code which you programmed.

.. Arnav

ArnavPawarAA:
If you program it with a code that is like a firmware, then it becomes the board's firmware.

There is no such thing as code that is not like a firmware. Every program you upload to the Nano is firmware.

ArnavPawarAA:
Bootloader just helps to declare the pins and run the code.

and runs the code which you programmed.

This is a common misconception. The Nano's bootloader does only two things:

  • Receive data from the UART and write it to the application section of the flash memory.
  • Read data from the flash memory and transmit it via the UART. (this is used for verifying the uploaded program or for downloading the program from the microcontroller to the computer)

It doesn't declare the pins. It doesn't run the code. A Nano which doesn't have a bootloader will work exactly like a Nano with a bootloader, with the exception of the inability to upload over UART, the lack of the delay on reset caused by the bootloader, and the ability to use the entire 32 kB of flash for the application.

pert:
There is no such thing as code that is not like a firmware. Every program you upload to the Nano is firmware.

Yes I meant that. I wrote like that for the sake of the OP to understand it, if he's a beginner.

pert:
It doesn't declare the pins. It doesn't run the code. A Nano which doesn't have a bootloader will work exactly like a Nano with a bootloader, with the exception of the inability to upload over UART, the lack of the delay on reset caused by the bootloader, and the ability to use the entire 32 kB of flash for the application.

If these things would happen without a bootloader, then who would want to run a board without the bootloader?
So the board is about of no use if without a bootloader.

..Arnav

ArnavPawarAA:
who would want to run a board without the bootloader?

  • Someone who wants the use of the full 32 kB of flash for their application.
  • Someone who doesn't want the delay after reset.
  • Someone who has absolutely not use for uploads over UART.

ArnavPawarAA:
So the board is about of no use if without a bootloader.

Why do you say that? The board is of great use without a bootloader. The Nano's bootloader only provides a convenient way to upload programs to the Arduino board, but you also have the option of using an ISP programmer to do the same thing.

Ok.

pert:

  • Someone who wants the use of the full 32 kB of flash for their application.
    [/quote]

I have a small question. Does the flash memory have "accurately" 32KB (32768 bytes)? Or it is a bit less? Please tell me, I am not sure.

.. Arnav

The ATmega328 has exactly 32 kB of flash memory. As you noted above, the Nano's board definition creates a 2 kB boot section, meaning that the largest sketch you can upload is 30 kB. Although you could modify the board definition to not create a boot section, it's easier to use one of the 3rd party board platforms that already provide this configuration. The most popular is MiniCore:

which provides a Tools > Bootloader > No bootloader menu option to allow you to use the full 32 kB for your sketch:

pert:
The ATmega328 has exactly 32 kB of flash memory. As you noted above, the Nano's board definition creates a 2 kB boot section, meaning that the largest sketch you can upload is 30 kB. Although you could modify the board definition to not create a boot section, it's easier to use one of the 3rd party board platforms that already provide this configuration. The most popular is MiniCore:
GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB
which provides a Tools > Bootloader > No bootloader menu option to allow you to use the full 32 kB for your sketch:
GitHub - MCUdude/MiniCore: Arduino hardware package for ATmega8, ATmega48, ATmega88, ATmega168, ATmega328 and ATmega328PB

Ok, can we edit the bootloader and upload it again? So we can tweak it and reduce its size. Please tell.

.. Arnav

You can change the board selection to UNO and then upload the bootloader . That will upload the smaller UNO bootloader and your board will appear as a UNO instead of a nano .

Editing the bootloader is for the really advanced and not normally needed .

ArnavPawarAA:
Ok, can we edit the bootloader and upload it again? So we can tweak it and reduce its size. Please tell.

Sure, but keep in mind that the Nano's ATmega328P has fixed boot section sizes. Optiboot already fits in the minimum 0.5 kB section, so you don't free up any additional space for the application by making the bootloader smaller. In the case of Optiboot, the only reason for doing that would be to allow you to add additional features to the bootloader while still keeping the size under 0.5 kB. A lot of effort has been made to get Optiboot as small as possible, but there's always the possibility you could find a way to make it smaller. The Optiboot source code is here:

There are some alternate bootloaders which require a larger boot section and might offer a more opportunities and payoff for optimization. Here are some examples:

Thanks everyone for the excellent information. As you can see, I am a total Newbie in the Arduino world. In the past I had only tinkered with Raspberry Pies, which is very different from the Arduino devices.

I refrained from providing a complete answer to your question because I wanted to wait for you to answer my question:

pert:
Why are you asking this question?

so I could get some context to make sure I provided the best possible answer. It may be that we ended up answering your question by chance in our side tracked conversation though.

pert:
Sure, but keep in mind that the Nano's ATmega328P has fixed boot section sizes. Optiboot already fits in the minimum 0.5 kB section, so you don't free up any additional space for the application by making the bootloader smaller.

So is there any way (using AVRdude) that to change the bootloader sector size in the flash memory?

..Arnav

Hi Pert,
Actually we are trying to integrate this with a Smart Monitor (with its own OS) and trying to design a system that would measure a person's temperature (with added temperature and proximity sensors attached to the Nano).

The idea is to send the temperature data to the monitor via RS232, and the application running on the Monitor would display it. We have successfully done this i.e the monitor does display the temperature on the app running natively on the monitor when a person is close enough

But the question came of updating the f/w...there was a lot of confusion about the f/w and what exactly it is, whether it should be updated, why it should be updated etc This forum has clarified some of them.

BTW, is there any documentation for the Nano anywhere? I cannot find anything beyond the schematic on Arduino's website.

Another question....the Arduino bootloader is in hex format...correct? I believe also the sketch file can be compiled into hex code.

Also can the bootloader on Nano be updated using Xloader from a PC ? Or Additionally Do I need another other equipment when I do that ( for example a second Nano, Pocket AVR Programmer etc. ?

ghoshsn:
Another question....the Arduino bootloader is in hex format...correct? I believe also the sketch file can be compiled into hex code.

Also can the bootloader on Nano be updated using Xloader from a PC ? Or Additionally Do I need another other equipment when I do that ( for example a second Nano, Pocket AVR Programmer etc. ?

  1. The Arduino Nano bootloader is in hex format. And when you compile your Sketch to program the board, then sketch is also automatically compiled to hex format and uploaded to the board.

  2. The bootloader can be edited, and can be uploaded to the board, but you will need to have another Arduino board (any type of Arduino) to upload the bootloader. Because your Arduino itself is not sufficient to upload the bootloader to itself, thus it needs another board to do that job.

.. Arnav

Are you talking about the "Arduino Nano", or the newer "Arduino Nano Every"?
They have different CPU chips, and the "Every" doesn't have any bootloader (the whole 48k of Flash in the ATmega4809 is available for YOUR sketch.) Instead, the Every has a 2nd processor chip (an Atmel SAMD11), which DOES contain "firmware" - both code to make it act as a USB/Serial converter, and enough "device programmer" firmware to program the 4809. Plus a bootloader so that you can upgrade the SAMD11...

The bootloader and firmware for all the chips is included in source form (as well as .hex files) in the Arduino IDE install. The exact location is dependent on which chip, which OS, and how the IDE has been installed.

westfw:
Are you talking about the "Arduino Nano", or the newer "Arduino Nano Every"?

We are talking about Arduino UNO and Nano.

..Arnav

is there any documentation for the Nano anywhere? I cannot find anything beyond the schematic on Arduino's website.

What more are you looking for?
There isn't a lot TO an Arduino Uno or Nano.
There's some documentation for the bootloader on the optiboot github page and associated wiki (be aware that that code is quite a few versions beyond what is included with an actual Arduino. But the principles are the same.)