Atmel 328P Help ISP Programming

Hi guys,

I have a custom PCB with the Atmel 328P SMT chip and some analog circuitry. I seem to be having a problem with my serial data translating back to the COM port. In recent posts I had some issues attempting to load the bootloader on the board (bootloader successfully loaded, but said out of sync when attempting to upload code). Instead I took the route of programming the board with ISP on the SPI (MOSI, MISO, SCK, RESET, VCC, GND) pins. By doing so I was not sure how the clock speed would be set, either way my sketch uploaded to the device. When I opened the COM port I see dots instead of ASCII characters, such as "...." I was not sure what was wrong with my board. Slowing down the program also slowed down the dots visible on the COM port (same for speeding up). My board has a FT230X 16SSOP chip that converts the 328P serial data into USB, could there be a problem with this chip such that the data is not being converted correctly?

Any help is much appreciated, this is my first time doing ISP programming hopefully I can learn from you guys!

Post a schematic.
Clock speed is set when you burn the bootloader using the IDE.
I forget to do this first all the time before using File: Upload Using Programmer for the sketch, and then scracth my head for a 1/2 hour wondering why it's running so slow.

Haven't used FT232X yet, don't expect it will be much different than FT232R tho. You have driver from ftdichip.com installed?

Here is a schematic of the chip, when the board is plugged in it discovers it on Device Manager and is assigned a COM port.

I went through the installation process of the FTDI drivers and it says the most up to date drivers are installed.

Ok here is my boards.txt file used when uploading / burning the bootloader.

I am using an Arduino UNO to send my code over SPI to my board. If I had a fresh board (no bootloader) and I loaded my program it should not work?

##############################################################

avr328.name=AVR328
avr328.upload.tool=avrdude
avr328.upload.protocol=arduino
avr328.upload.maximum_size=32256
avr328.upload.speed=9600

avr328.bootloader.tool=avrdude
avr328.bootloader.low_fuses=0x62
avr328.bootloader.high_fuses=0xD9
avr328.bootloader.extended_fuses=0x07
avr328.bootloader.unlock_bits=0x3F
avr328.bootloader.lock_bits=0x0F
avr328.bootloader.file=optiboot/optiboot_atmega328.hex

avr328.build.mcu=atmega328p
avr328.build.f_cpu=8000000L
avr328.build.core=arduino
avr328.build.variant=standard

##############################################################

So possibly the fuses are set incorrectly? My mcu speed is a 8 MHz to be consistent with the external oscillator on the schematic.

Hopefully we can narrow this down!

Ok, you have the MCU Reset tied to 3.3V. It should be connected to 3.3V via a 10K resistor. The ISP programmer needs to be able to pull it low to program the card. The FTDI chip would normally use one of its GPIO pins to create a level called DTR during a serial download, that level could connect thru a 100nF cap to Reset as well, which would kick off the bootloader & start the serial download process.
Test with an LED/resistor on pins 7, 14, 15,16.

Why do you have 27pF caps on the USB lines? That looks very odd. Series resistors, many parts need that, I can see that.
The datasheet does show caps, 47pF - but later diagrams dealing with battery charging do not.

Nolebrain:
So possibly the fuses are set incorrectly?

Correct. In a virgin chip, the CLKDIV8 fuse is set to divide the clock by 8. So your board will be running at 1MHz instead of 8MHz. You can set the fuses either by using the Burn Bootloader function, or by using avrdude directly - see the last part of Prototyping small embedded projects with Arduino | David Crocker's Solutions blog.

PS - it is a good idea to add an external pullup resistor between the atmega328 reset pin and Vcc, because the internal one is quite weak (~60K), so the pin may pick up noise unless the trace between it and the ICSP pin is really short and not routed close to other signal traces.

Nolebrain:
When I opened the COM port I see dots instead of ASCII characters, such as "...."

Wrong baud rate.

Nolebrain:
I was not sure what was wrong with my board.

Maybe nothing, only your baud-rate expectations.

The baud rate will be 1/8 of what you wanted, because of the CLKDIV8 fuse setting.