With reference to similar issue: SPI device prevents ISP programming
I have 2 ATMEGA328Ps with MOSI MISO and SCK permanently connected on the same board. At the time of printing the board my thoughts were to only connect the RST of the SPI to be programmed at a given time, therefore only reprogramming one chip via SPI header.
Turns out this was not a clever move. If both RST lines are connected to the programmer, both chips successfully reprogram simultaneously with the same identical sketch (not that useful having identical code on both chips).
But if either ATMEGA chip is disconnected from the programmers RST, neither chip will reprogram as the MOSI MISO and SCK from the other chip seem to interfere. I cannot fathom why.
Thinking along the lines of the opposite chip could be transimiting out of MISO interfering with the reprogramming, I flashed both chips (since I can do both at the same time) with a sketch that set MOSI, MISO and SCK as floating inputs and looped doing nothing else. but this did not seem to make any difference when then attempting to reprogram just one chip again.
I'm currently stumped on how to upload different sketches to the 2 integrated chips, as I cannot for the life of me see why the opposite chip could be interfering.
The top ATMEGA has 2 pull-up resistors to the right of it that are one for each ATMEGA reset holding each chip RST line high. 5 and 6 of the DIP-Switch between the two connect each RST1 and RST2 to the main RST (the idea being to toggle a switch during reprogramming disconnecting the RST from the chip that was NOT being re-programmed) but this fails as nether chip will program if eater 5 or 6 is toggled OFF.
Any suggestions on how I could try programming these chips with different code would be welcome. It's only really a learning curve but I would rather not abandon £80 of circuit boards without trying.
I also tried cutting the VCC track to the top ATMEGA with a Stanley knife (since that is exposed on the top side) but that failed as the chip still half powered off AVCC and still conflicted with programming the bottom ATMEGA.
This is a successful reprogram of both chips at the same time with the same sketch starting from RST falling low
This is a failed reprogram of the top chip (while the bottom chip RST is held high)
I have not really paid much attention to reprogramming ISP bits until now so in not sure if it helps.
EDIT: I am starting to feel like I am barking up the wrong tree, if I probe MOSI MISO and SCK. SCK is defiantly floating, I can inject 5v into it through a 3k resistor and it changes from high to low. yet MOSI and MISO both stay low, even when the RST to both ATMEGAs is held low. I think I need to check the MOSI MISO tracks some how before updating.