ATMega328PB programming fuses

Had a quick question regarding programming fuses and settings for the new 328PB.

Im having some boards produced, and I figured it would be easiest for me to just send the company the full hex file with boot loader, and they can burn it for me, saving me the time of sitting there with an ISP for each board to put the Arduino boot loader in there.

The PCB company sent me this, and I was wondering if anyone could confirm that this is correct for the 328PB? Im using the “Elektor Uno R4” boot loader for the 328PB.

(My project needs the extra pins of the 328PB, which is why Im using the new chip as opposed to the standard old 328P)

Last stupid question…I assume I just go to “Sketch—>export compiled binary”, and send the PCB assembly place that outputted hex file?



bump...any ideas?

Figured Id bump this again…no one?


I'm going to help you help yourself... or just rant a lot... let's see how this goes.

The bootloader you used is this one (I'm only guessing)?

They seem to have a batch file to make it on Windows (I'm sensing pain). The make rule it runs is "elektor_uno_r4_all". So you have to find how that rule is used.

Makefiel.custom has two rules for it. So now I'm looking for "elektor_uno_r4", or "elektor_uno_r4_8mhz" rules.

elektor_uno_r4: TARGET = $@
elektor_uno_r4: CHIP = atmega328pb
	$(MAKE) $(CHIP) AVR_FREQ=16000000L LED=B5
	mv $(PROGRAM)_$(CHIP).hex $(PROGRAM)_$(TARGET).hex
	mv $(PROGRAM)_$(CHIP).lst $(PROGRAM)_$(TARGET).lst

So the elektor_uno_r4 rule will build the hex file, the other rule is next. And bellow that is where your fuse setting.

As an FYI the elektor_uno_r4_isp rule will set values (e.g. HFUSE, LFUSE, EFUSE) and then run the "isp" rule.

I wish Arduino would have there IDE create a makefile for the project and then use it to build. Once I learned some stuff about makefiles I was able to use whatever editor was convenient (nano on Pi, gedit on Ubuntu) and also building remotely over SSH without any sort of GUI, a real build tool is awesome.

Good luck.

The fuses in your original message are almost certainly incorrect; they specify the use of the internal clock and the div8 fuse for a final clockrate of 1MHz, they have the wrong bootloader size, and they don't set the fuse that "enables" the bootloader. I'm pretty sure that the 328PB uses the same fuses as the 328P, so you should be able to copy the fuse values from the Elektor "boards.txt" file.

As of recent versions of the IDE, the build process has been producing TWO .hex files, one of which contains both the sketch and the bootloader. I don't know if the "export binary" copies both of them, though.

As of recently versions of avr-libc and/or avr-gcc, there is a mechanism for including the fuse values in the .elf file. I don't know whether this extends to .hex files or not. I also don't know if the various device programmers and their associated software have started supporting this (I don't think that avrdude does.)