When I try to flash code to the Atmega328p-mu QFN on my custom pcb, it appears to be running at the wrong clock speed. I was able to fix this on some boards buy creating a new board in the IDE and flashing it with that parameter, with 1.6mhz instead of 16mhz. But not all boards are working correctly that way, and it seems like a bad fix.
I don't see any reason why this is happening, as there is no issue flashing my other atmega328p processors, which were in either QFP or DIP packages. Not to mention that it has an external 16mhz resonator that should be forcing it to run at that speed (and I have tried replacing the resonator and that does nothing).
I should add that these are totally blank chips from the factory.
Any ideas on how I can stop this behavior?