How to use -F command to burn bootloader?

Hi Everyone.

Pro Mini
ide 2.3.6
Win11

I found this link below posted by @ ptillisch.
https://forum.arduino.cc/t/use-f-to-override-this-check-how-to-do-it/1270756/3
This output line is generated during the boot load burning.

"C:\Users\mikee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\mikee\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -patmega328p -cstk500v1 -PCOM8 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m


I cannot copy the error message so here is a screenshot.

What part of this line must be copied to cmd promt?
Where to add the -F ?

The command from your screenshot does not resemble the command that you showed.

What is the > doing in your command C:\>.......? With a bit of bad luck you have overwritten some file with the content of the your C drive (I have done that in my professional life :frowning:) .

The -F option can go anywhere after the command; e.g. before or after the -v.

I did copy the full command , file or path not found error.

Then I copied the second half of the comand line and change the directory to C> drive.

The slashes should not change from a backslash to a forward slash, that is why the error message thinks the command ends after 6.3.0-arduino17

Why do you think you need to use the -F option? What is shown for the device signature when you try burning the bootloader with the IDE?

Ok , I think I did not copy the whole command line in the first try.

Then I change directory , to C drive.

After carefully copy the full command path , I got the bootloader loaded by adding the -F.

Why the -F command?

  1. I messed up my Pro Mini with a WDT test.
  2. Cannot program anymore.
  3. When I burn the bootloader from Selecting the Pro Mini board , device ID error > bootloader wants a 328P chip and the board have a 328PB.
  4. So if I use -F to over ride and burn a 328P bootloader , I could use Pro Mini board selection as intended ... BUT the id is still 328PB.

How do I know this >> I can program the Pro Mini using Mini Core and select 328PB.

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x1e9516 (probably m328pb)
avrdude: Expected signature for ATmega328P is 1E 95 0F
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

Failed chip erase: uploading error: exit status 1

The 328PB is almost identical to the 328P, but has some additional pins and functions. Often the Optiboot boot-loader will be installed for compatibility with the AVR board platform. The MiniCore board platform uses the UrBoot boot-loader instead of OptiBoot. Once the UrBoot boot-loader for the 328PB has been burned from the MiniCore platform, uploads will fail when using the standard AVR platform.

The choice then is to continue using MiniCore and benefit from the additional pins and features, or re-instate the OptiBoot boot-loader, which does require a -F to override the signature. The board will then work with the AVR library again, but without the additional features of the 328PB.

I should perhaps also mention that on some clone boards, the additional two pins are wired directly to GND or VCC and for this reason should not be enabled as outputs.... If the board does properly break these out, then they can be used.

Yes ,I could just use Mini Core.
But I would like to get it back to Pro Mini but burning the Pro Mini bootloader using -F does not make it 328P.

Have you tried to use -patmega328pb instead of -patmega328p; see your screenshot in the opening post.

I changed to ..pb , now I don't need the -F to over ride , but selecting Pro Mini to program Blink gives the same error as in Post# 7.

My memory is that the signature of the processor is also hard-coded within the bootloader. So if you can get the normal bootloader for a 328P flashed to a 328PB, the IDE will recognize it as a 328P for normal sketch uploading. But I'm not sure that works for "Burn Bootoader" because AVRdude will probably read the actual signature from the chip, not what the bootloader says it is. But I haven't tried that.

If you have the hex file of the bootloader you want to use, I think AVRdudess can be used to flash it to the Pro Mini using an Arduino_as_ISP programmer setup.

I think there is a boards package for the 328PB. You could use that, but then it would no longer be a Pro Mini. But it would have access to the extra features.

Hi Everyone.

When compiling code for the Pro Mini the processor is 328P.

-Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\mikee\\AppData\\Local\\arduino\\sketches\\2AC8EF28BD30979AA8ED3DF5F8869C86/Blink.ino.elf" "C:\\Users\\mikee\\AppData\\Local\\arduino\\sketches\\2AC8EF28BD30979AA8ED3DF5F8869C86\\sketch\\Blink.ino.cpp.o" "C:\\Users\\mikee\\AppData\\Local\\arduino\\sketches\\2AC8EF28BD30979AA8ED3DF5F8869C86/core\\core.a" "-LC:\\Users\\mikee\\AppData\\Local\\arduino\\sketches\\2AC8EF28BD30979AA8ED3DF5F8869C86" -lm

The signature is read as 0x1E9516 328PB , so how does the Uploading ignore the wrong signature?

Upload via USB uses the bootloader. Depending on the bootloader it might or might not read the signature; if not mistaken OptiBoot has the signature coded in the bootloader.

I have merged your forum topics due to them having too much overlap on the same subject matter @mikedb.

In the future, please only create one topic for each distinct subject matter and be careful not to cause them to converge into parallel discussions.

The reason is that generating multiple forum topics on the same subject matter can waste the time of the people trying to help. Someone might spend a lot of time investigating and writing a detailed answer on one topic, without knowing that someone else already did the same in the other topic.

Thanks in advance for your cooperation.

Thanks.

Using the -F in command line

and

Bootloader vs Signature.
I see this as 2 separate problems, so my thought was to create a new post.

In this case - Standard Pro Mini - signature is read but why is it ignored.

I uploaded the Pro Mini bootloader (from the Arduino IDE > Burn Bootloader) to the board and now I cannot program anymore using Pro Mini as board selection. < signature does not match >

So what was in the previous factory bootloader that could compile 328P and program 328PB?

The manufacturers of the cheap Chinese boards don't provide the source code of the bootloader they use, so it could only be answered if someone was able to reverse engineer the bootloader binary read from a board.

However, for someone whose goal is only to restore their board to functionality after bricking it as you did, the question is only academic. Just burn an appropriate bootloader to the board and you are back to progressing on your projects.

The excellent 3rd party MiniCore boards platform was already recommended to you previously in this discussion. If you decide to give it a try and have any problems or questions, just let us know and we'll provide assistance. Note that if you burn the bootloader after selecting the MiniCore board definition from Arduino IDE's Tools > Board menu, you must remember to continue to use that same board definition. Don't switch back to using the Tools > Arduino AVR Boards > Arduino Pro or Pro Mini board definition afterwards.

Now this where it gets weird.

I select Nano old bootloader and program Blink onto the Pro Mini , standard bootloader.

Led is blinking 2x slower.

But the Arduino ide reads the signature as 328P.

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\mikee\AppData\Local\arduino\sketches\2AC8EF28BD30979AA8ED3DF5F8869C86/Blink.ino.hex"
avrdude: writing flash (924 bytes):

Writing | ################################################## | 100% 0.25s

Using an AVRISP programmer the signature reads as 328PB.

Are you doing this just as an experiment? Or is there some technical reason you are trying to use the obsolete bootloaders?

I did program the Mini Core bootloader but I cannot program via the USB to Serial adaptor , that is why I am trying other bootloaders.

 Using Port                    : COM1
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "\\.\COM1": A device attached to the system is not functioning.

I am just trying to get the board back to a Pro Mini.
Your replies so far is drawing me to the light , i am now 99% for Mini Core.

For some weird reason USB to Serial programming does not work.