I am working on a board using the ATmega328P. It is not complicated, just reading 13 tactile switches ringing a buzzer, dimming some LEDs and keeping track of the battery charger and the voltage level. I had the boards made by JLCPCB and took advantage of their assembly service to add the components on the boards. Unfortunately due to a miscommunication on my side, I added the ATMega328PB to the BOM instead of the 328P that I used to base the design on. Anyway, after an inspection of the board and reviewing the 328PB datasheet I could not find a reason why the 328P design wouldn't work so I soldered the 6 pin ICSP header and prepared to load the prototype firmware using the ATMEL-ICE. My first step was to attempt to change the fuses to prepare the MCU for the firmware written in AS7, so I switched the device from 328P to 328PB but ran into the message indicating that the programmer could not establish a connection with the SPI interface. I checked power, cables, connector polarity, etc, even tried connecting to the breadboard 328P which did connect (although I got the expected signature mismatch message). I considered that the IC was bad.
On a moment of frustration and out of desperation I switched the interface from SPI to debugWire AND IT CONNECTED! So I am able to compile and link, then upload the firmware to the MCU using debugWire. I can even debug the program, which has been helpful in moving along the testing but I cannot change the fuses nor program the EEPROM with the configuration tables I need for the firmware.... I must add that I CAN exit debugWire mode normally from the AS7 interface, no errors reported and I believe this succeeds because when I try to go back to debugging I will receive the warning about enabling the DWEN fuse bit. However I CANNOT get the SPI interface to connect.
I have embedded here the schematic and pictures of the copper on the board in hopes that someone spots something indicating a wiring issue that would lead to conflicts with the SPI programming mode. The schematic is for the 328P but the difference with the 328PB is that pins 3 and 6 are IO pins that now happen to be connected to GND and VCC directly. I have 5 of these boards, I tried a second one with similar results. My next step is to give it a go with the high voltage programmer just to see if it will change anything but I wanted to ask others for a second set of eyes and any advice in case someone had run into this case before.
Thank you for your time.
Copper top, ICSP connects on this side.