I have built a custom Uno that uses a ATMEGA328PB, however I can't seem to upload the bootloader to it. I have tried using the MINICORE core (following the instructions on GitHub), however I get this error:
avrdude: AVR device initialized and ready to accept instructions
avrdude: device signature = 0x000000 (retrying)
avrdude: device signature = 0x000000 (retrying)
avrdude: device signature = 0x000000
avrdude main() error: Yikes! Invalid device signature.
avrdude main() error: expected signature for ATmega328PB is 1E 95 16
Double check connections and try again, or use -F to override
this check.
(I have no idea where to enter "-F" so I haven't done that, should I??
I don't see why not. It's a change to one of the fuse bits. The minicore docs say that it will run at 8MHz (or lower) using the internal clock.
If the PB is the same as the P (excluding extra ports), then you may have problems if you have programmed the fuses for an external clock, and the external clock isn't running.
What crystal are you using? I don't see any capacitors - 22pF or so to GND - that are normally present. See the minimal setup schematic in the docs.
EDIT: Ah didn't read your posts properly - you are using a resonator.
I might be wrong here, but if you've programmed the chip (i.e. set the fuses) for an external clock, and the clock isn't running, then you can't reprogram the chip until you provide an external clock. There was a post somewhere on here about using an UNO to generate a 4MHz clock for a chip where that happened.
Your resonator circuit provides a clock source. I would expect it to work fine as shown in your schematic but your results do indicate that the microcontroller is not being clocked from the external source. I recommend triple checking your resonator circuit. If you have a spare resonator, try swapping out the current one in case the original component was bad.
It works beautifully on an Internal 8mHz, do I need the resonator?
My goal is to create a pro Mini with some added functions. 8mHz will be slower, but will it make a noticeable difference?
My main problem now is working out how to upload code to my board using FTDI
Other than the lower speed, the concern with using the internal RC oscillator is that it is less accurate. You can see the accuracy data in table 33.5.1 of the ATmega328PB datasheet:
You can compare that to the data that will be provided in the datasheet for the specific resonator you are using.
If the clock is significantly off it can affect timing sensitive code. For example, you might find there is some corruption of serial communication by your sketch code or uploads via the serial port fail.
But it is common to use the internal RC oscillator and I think most people don't encounter any problems.
The Tools > Programmer menu selection is only used when you are doing Tools > Burn Bootloader or "Upload Using Programmer". When you're doing a standard "Upload", the Tools > Programmer menu selection is completely ignored. So it makes no difference at all what you have selected from the Tools > Programmer menu.
You might see the term "programmer" mentioned in error messages from a failed upload (e.g., "programmer is not responding"), but these error messages are not referring to the same thing as the programmers listed in the Arduino IDE Tools > Programmer menu.
I can see from the screenshot and avrdude output in your post #9 that you had the Tools > Bootloader menu set to "No bootloader". That is the appropriate setting for when you are going to be using an ISP programmer to upload your sketches, in which case a bootloader is not needed. But a bootloader is required for you to upload via the FTDI module. So you'll need to repeat the "Burn Bootloader" operation, but this time with the appropriate configuration of the Tools > Bootloader menu:
Connect your ISP programmer to the ATmega328PB, as you did before.
Select Tools > Bootloader > Yes (UART0) from the Arduino IDE menus.
Select Tools > Burn Bootloader from the Arduino IDE menus.
Wait for the "Burn Bootloader" operation to complete successfully.
Disconnect the ISP programmer from the ATmega328PB.
Connect the FTDI module to your computer.
Select the port of the FTDI module from the Tools > Port menu in Arduino IDE.
Select Sketch > Upload from the Arduino IDE menus.
The Pro Mini does come in an 8 MHz version, but this uses an external clock so you would need to solve the problem with the external resonator before you could use the Pro Mini board definition.
But you should also be aware that the Pro Mini board definition is significantly inferior to the one provided by MiniCore. The benefit of using MiniCore is it provides you with the state of the art Optiboot bootloader that only requires a 0.5 kB boot section in the flash memory of your ATmega328PB microcontroller. The Pro Mini board definition uses an antiquated "ATmegaBOOT" bootloader that requires a 2 kB boot section. This means you would have 1.5 kB less precious flash memory for your sketch program if you switched to using the Pro Mini board definition.
In addition, the "ATmegaBOOT" bootloader has a bug that causes it to go into an infinite loop after a watchdog timer reset. This means you can't use the watchdog timer to reset the microcontroller (e.g., as a safety measure to automatically recover the device from a hang) when you have that bootloader installed on the microcontroller. The Optiboot bootloader handles watchdog timer resets properly.