I am using atmega328P IC in my project. Currently my process to upload a code is to burn the bootloader according to my requirements and then upload using programmer USBasp .
Now from what I read is when you upload using ICSP you will overwrite the bootloader. I have a .hex file with and without bootloader I generated by compiling in arduino-cli.
Can I change the fuse settings and upload the code both from one .hex file directly ? Even if the fuse settings are different (different clock)?
-
\$\begingroup\$ AVRs use ISP. ICSP is for PICs. As to whether the USBASP can program the fuses depends on what software you're using to drive it, so to answer that question, read the documentation. You'll want to make sure that the fuse settings align with what the bootloader expects otherwise the result will be sub-optimal. \$\endgroup\$Kartman– Kartman2021年04月20日 12:13:13 +00:00Commented Apr 20, 2021 at 12:13
-
\$\begingroup\$ @Kartman Yes, ISP and ICSP are different but they are still often used interchangeably even though they are for very different micro-controllers. Even Arduinos have ICSP written o their board. \$\endgroup\$Artichoke– Artichoke2021年04月26日 09:24:11 +00:00Commented Apr 26, 2021 at 9:24
-
\$\begingroup\$ @hotglue - it helps to be precise. \$\endgroup\$Kartman– Kartman2021年04月26日 09:26:37 +00:00Commented Apr 26, 2021 at 9:26
-
\$\begingroup\$ @Kartman Yes, it does open less opertunity for comfusion and error. \$\endgroup\$Artichoke– Artichoke2021年04月26日 10:33:46 +00:00Commented Apr 26, 2021 at 10:33
1 Answer 1
This bit isn't quite clear:
Can I change the fuse settings and upload the code both from one .hex file directly ? Even if the fuse settings are different (different clock)?
You can use an AVR fuse calculator to work out what fuses to set and then use Avrdude (or Avrdudess for a GUI version) to set them. I would just overwrite the bootloader and upload using a programmer.
Not really sure if this answers your question but I am not quite clear on what you are trying to ask. If you fix the question I might be able to help a bit more.
EDIT:
You can set the fuse settings to the chip, then upload a hex file using a programmer like AVR ISP or USBASP if you want to avoid the bootloader. I'm pretty sure when you upload the hex file, it will not and can not do anything to the fuse settings, so do the fuses first. Also, you can upload your code straight from the Arduino IDE using a programmer by holding the shift key down during upload. However you can not set the fuse settings with it so better to just use avrdude or a GUI for it.
-
1\$\begingroup\$ Thank you for your interest. Let me put it straight, Can I over write fuse settings and upload main program both from one HEX file ? \$\endgroup\$dharmikP– dharmikP2021年04月29日 04:05:59 +00:00Commented Apr 29, 2021 at 4:05
-
1\$\begingroup\$ Purpose is to eliminate the need of extra burn bootloader process. If I can. \$\endgroup\$dharmikP– dharmikP2021年04月29日 04:07:14 +00:00Commented Apr 29, 2021 at 4:07
-
\$\begingroup\$ I have added edits to the question. See above. Hopefully that answers your question now. \$\endgroup\$Artichoke– Artichoke2021年04月30日 07:09:35 +00:00Commented Apr 30, 2021 at 7:09
-
\$\begingroup\$ Yes got it. thanks \$\endgroup\$dharmikP– dharmikP2021年05月10日 03:40:33 +00:00Commented May 10, 2021 at 3:40
-
\$\begingroup\$ No worries :) . \$\endgroup\$Artichoke– Artichoke2021年05月14日 06:22:25 +00:00Commented May 14, 2021 at 6:22
Explore related questions
See similar questions with these tags.