Problems programming Atmega 328p-au TQFP

Russel77:
...

Pin 15: MOSI
Pin 16: MISO
Pin 17: SCK
Pin 29: RESET (connected to RESET header pin and then via a 10k resistor to +5V)

Pin 30: RXD
Pin 31: TXD

I’ve checked all the pins and outputs with a multimeter continuity check and everything appears fine, no dry joints or short circuits, all pin to pin resistances are as low as expected and resistor values correct.

I have used the ArduinoISP file, optiloader (Bill Westfield) and an alternative version of ArduinoISP from Nick Gammon (http://www.gammon.com.au/forum/?id=11637) and they all install the bootloader fine (and Nick’s program reads it back to confirm it’s on so it definitely works with the MOSI/MISO).

However, when I then try and program the MCU with a sketch using the Arduino IDE I get this error:

avrdude: stk500_getsync(): not in sync: resp=0x00

What were TxD and RxD connected to? Up to this point, you made not mention of a USB-to-serial converter. Without one or at least a serial connection to the PC (for which you would need to do level-shifting), you can't upload a sketch via the bootloader. However, you can instead program a sketch via ICSP, using the same connections you had when uploading the bootloader. You just need to select "Upload using programmer" in the menu. This is how I upload sketches on boards I build - I never use a bootloader.

Russel77:
...

I then tried with a standalone USB to serial board (http://onecall.farnell.com/ftdi/mm232r/development-kit-usb-uart-module/dp/1146037), after loading the bootloader with the above system. I connected up the board to give a 5V output (confirmed with multimeter) and then connected the RTS pin from the serial board via a series 0.1uF capacitor to my reset pin, and the serial TXD and RXD to the MCU’s RXD and TXD respectively (I also tried it the other way round on the off chance, it gave the same error).

I think the Arduino upload code is designed to pulse DTR, not RTS. Alternatively, you can use a reset button and press it at the right time.

Your ceramic resonator is fine, I use them all the time. The 1M resistor is not needed, there is already one in the mcu.