1
\$\begingroup\$

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)?

\$\endgroup\$
4
  • \$\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
    Apr 20 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\$
    – HotGlue
    Apr 26 at 9:24
  • \$\begingroup\$ @hotglue - it helps to be precise. \$\endgroup\$
    – Kartman
    Apr 26 at 9:26
  • \$\begingroup\$ @Kartman Yes, it does open less opertunity for comfusion and error. \$\endgroup\$
    – HotGlue
    Apr 26 at 10:33
0
\$\begingroup\$

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.

\$\endgroup\$
5
  • 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
    Apr 29 at 4:05
  • 1
    \$\begingroup\$ Purpose is to eliminate the need of extra burn bootloader process. If I can. \$\endgroup\$
    – dharmikP
    Apr 29 at 4:07
  • \$\begingroup\$ I have added edits to the question. See above. Hopefully that answers your question now. \$\endgroup\$
    – HotGlue
    Apr 30 at 7:09
  • \$\begingroup\$ Yes got it. thanks \$\endgroup\$
    – dharmikP
    May 10 at 3:40
  • \$\begingroup\$ No worries :) . \$\endgroup\$
    – HotGlue
    May 14 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.