Hi everyone, I was building a board with atmega1248p via isp, I loaded the bootloader and already here I'm not sure if I chose the right one, but above all how do you set the fuses? Thanks
Hi @antoniosuper.
When you perform a "Burn Bootloader" operation using Arduino IDE, it actually performs two different operations:
- Set the fuses in the target microcontroller according to the configuration specified in the definition of the selected board.
- Flash the bootloader to the target.
So if you used Arduino IDE to do this, then you already set the fuses.
The 3rd party boards platform (e.g., MightyCore) you are using to add support to Arduino IDE for the ATmega1284P probably gives you control over the relevant fuse settings. This is done by selecting the desired configuration from the "custom board options" submenus under Arduino IDE's Tools menu.
Thanks ptillisch I never think about this procedure.
so i use Arduino uno in ISP mode right?
Perfect!
One question, how i load the .hex file?
Thanks
Yes, if you perform a "Burn Bootloader" operation using an "Arduino as ISP" programmer, it will set the fuses on the target microcontroller in addition to flashing the bootloader.
I'm not sure I understood correctly what you mean by ".hex file".
Is the .hex file the bootloader?
Or is the .hex file the sketch program you compiled using Arduino IDE?
Or is the .hex file a precompiled program file you obtained from some other source?
Please provide a more detailed description of what you mean by this in a reply on this forum topic to help us to understand it.
Yes I have already the compiled file .hex I want just burn in the target
Thanks
You can not use Arduino IDE to upload precompiled program binaries. Arduino IDE is a tool for developing Arduino sketch projects, so uploading precompiled program binaries is out of scope for this tool.
So you will need to use an alternative tool to upload precompiled program binaries.
Arduino IDE does not actually upload the compiled sketch binaries itself. Instead, it uses a helper tool for that purpose. The helper tool used to upload to ATmega1284P chips is named AVRDUDE.
If you like, you can use Arduino IDE to generate the appropriate avrdude command for uploading a precompiled program binary .hex file. I'll provide instructions you can follow to do that:
A. Generate Model Command
First, we're going to upload an arbitrary sketch using Arduino IDE in order to get it to generate an appropriate command for flashing compiled program binaries to the ATmega1284P:
- Select File > New Sketch from the Arduino IDE menus.
A basic sketch will open in a new Arduino IDE window. - Plug the USB cable of the "Arduino as ISP" programmer into your computer.
- Select your board from Arduino IDE's Tools > Board menu.
- Select the port of the ISP programmer from the Tools > Port menu.
- Select Tools > Programmer > Arduino as ISP from the Arduino IDE menus.
- Make any other configurations to the additional submenus under Arduino IDE's "Tools" menu.
- Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open. - Check the box next to "Show verbose output during: ☐ upload" in the "Preferences" dialog.
- Click the "OK" button.
The "Preferences" dialog will close. - Select Sketch > Upload Using Programmer from the Arduino IDE menus.
- Wait for the upload to finish successfully.
- Scroll up the black "Output" panel at the bottom of the Arduino IDE window until you see the
avrdudecommand that was generated for the upload.
It will look something like this:"C:\Users\username\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude" "-CC:\Users\username\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf" -v -V -patmega32u4 -cavr109 "-PCOM24" -b57600 -D "-Uflash:w:C:\Users\username\AppData\Local\Temp\arduino\sketches\2550236D1AAA5295D4F743C245319248/sketch_aug7a.ino.hex:i" - Select the full text of the upload command.
- Press the Ctrl+C keyboard shortcut.
This will copy the selected text to the clipboard.
B. Adjust Command
The command you obtained via the procedure above is configured to upload the .hex file generated from the arbitrary sketch you had open in Arduino IDE when you performed the "Upload Using Programmer" operation.
Next, you need to adjust that model command so that it will instead upload your precompiled .hex program file to the ATmega1284P:
- Start any text editor program.
- In the text editor window, Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the command you copied while following the instructions above into the text editor. - The end of the command will look something like this:
This is the flag that tells AVRDUDE which"-Uflash:w:C:\Users\username\AppData\Local\Temp\arduino\sketches\2550236D1AAA5295D4F743C245319248/sketch_aug7a.ino.hex:i".hexfile to upload.
Replace the path in that flag with the path to the precompiled.hexprogram file you want to upload. - If the paths in the command contain spaces, make sure they are wrapped in quotes.
- Press the Ctrl+A keyboard shortcut (Command+A for macOS users) to select all the text of the command in the text editor.
- Press the Ctrl+C keyboard shortcut (Command+C for macOS users) to copy the selected text to the clipboard.
C. Run the Command
Now that the command is all prepared. It's time to run it!
- Open a command line terminal.
I'll provide some links to instructions for doing that on each operating system: - If you are using Windows PowerShell, type a
&character at the command prompt. - Press the Ctrl+V keyboard shortcut (Command+V for macOS users) in the terminal window to paste the command you copied while following the instructions above at the command line prompt.
- Press the Enter key.
- Wait for the command to finish successfully.
The ATmega1284P will now be running the program from the .hex file you specified in the command.
Thanks ptillisch again thanks you are very helpful tomorrow I will do something.
Best regards
Antonio
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.