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

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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