Problem with installing bootloader on custom board. photos and diagrams linked.

I have a board i made which is a pro mini in effect.

i have used 12pf xtal caps and im hoping that isnt an issue.

the problem is uploading the bootloader. i have tried to upload the bootloader using arduino ISP using a cloned arduino. The genuine arduino i have will not accept new sketches for some odd reason so im unable to upload the ardiuno isp sketch to it.

There is an error i get from the cloned arduino when uploading the bootloader which is:
https://pastebin.pl/view/ee0c9169

so what i did instead was switched to my XGECU TL866 (with the ICSP connection)
i have connected 5v, gnd, mosi, miso, reset and sclk together respectively and the XGECU software reads the chip well - it’s blank - no fuse bits set either

i managed to buy from ebay the same chip i am using (atmega 328p-AU with arduino bootloader) and use an adapter in the ZIF socket to dump the chip so i have a BIN file.

My boards im looking to program already come pre-populated with the 328p so i have to program it using ICSP , so now that i have the bin dump i go to flash it but i get an error.
i believe it may have something to do with setting the fuse bits as if i try to set them by themselves i get similar errors.

Ive uploaded:

1.screenshot of a sucessfull read of my chip on my custom board though ISCP
2. successful write of what was previsouly read from the chip (even though its blank)
3. an error when programming the chip with an identical 328p with arduino bootloader dump
4. the fuse settings of the dump file.
5. the schematic.

lastly, im not sure it is the xtal caps ( i could be wrong) but if so as a last resort, i could remove them and upload a 8mhz bootloader to see . the issue is with that that i dont have the bin dumps of a simple blink sketch of them.

am i overlooking somthing here?
what is the problem, how come the bootloader wont upload?

Update, if i change any byte in the buffer then try to flash, it wont. could this be a crystal issue? its seems i cant write to my chip at all. unless they are all FF (which i imagine succeeds because it doesnt actually write FF it just checks what it is previously and if it is the same is skips doing any writing)

.

Update. i have desolder the 0402 12pf caps and soldered some through hole 22pf caps on (good job i have a microsope )

i have also removed r6 which a limiting resistor for the crystal and soldered a jumper over it with some solder.

so i can now say its not down to the crystal or load caps being the issue.

the board is communicating from the status LED’s when reading and programming but i cant seem to program it.

Update:

i have taken the TQFP off the board and put directly into a ZIF adapter on the XGECU and it reads and programs well.

when its soldered on the board and ICSP is used it does not program.

Update: Ive updated the board to a new version with R6 removed and the crystal load capacitors both being 22pf. It seems like the chip will read well but just not program and the fuse bits are unset to not prevent that so im going to see how this new board works (or not) and see if it can program it when it arrives. There isnt much else i can do other than spending alot of time i dont have checking continuity and for shorts.

i think it is my crystal and load caps as this is the error using arduino as isp and you can see it errors out not being able to sync

avrdude: Version 6.3-20190619 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Users\Luke\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

Using Port : COM5 Using Programmer : stk500v1 Overriding Baud Rate : 19200 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x03 AVR Part : ATmega328P Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PC2 RESET disposition : dedicated RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail :

Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack


eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 lock 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00

Programmer Type : STK500 Description : Atmel STK500 Version 1.x firmware Hardware Version: 2 Firmware Version: 1.18 Topcard : Unknown Vtarget : 0.0 V Varef : 0.0 V Oscillator : Off SCK period : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Error while burning bootloader. Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check.

avrdude done. Thank you.