spi/ftdi header for pcb program with 328P

looking at several schematics and reading several articles i am still rather confused about spi and/or ftdi headers.

i design and build my own pcb's with a 328P mcu's. i am currently having to remove and replace every time if i want to update programming on the 328.

do i need both headers to upload new programming? if i read correctly on articles, the spi is only for the boot-loader onto chip and then used to control other chips from 328P. the ftdi is then used to program the update to the 328P.

Is this correct?

can i use a usb ftdi cable or do i need a converter board to use ftdi for uploads?

can someone point me in the direction i need or help me somehow to understand more clearly?

how do i incorporate into board when controlling other devices?

SPI forms part of an In Circuit Serial Programmer or ICSP. You can burn a bootloader with it, and you can't program a chip without a bootloader without ICSP. However you can also burn a whole program and set fuses so if you have an ICSP programmer you don't need to use anything else to program the chips if you don't want to.

If you wish to use a USB to serial converter just to upload a program to 328 with a bootloader you can also do that. In which case you need to wire up RX, TX and reset via a 0.1uF capacitor and a 10K pullup resistor.

ok, i understand that part now, i think. - i can use either versions but icsp is more for internal chip settings and BL. the usb only does uploads AFTER BL is burned.

so, if i have the spi ports doing other functions, besides spi - say ouptputs, can i still incorporate icsp into the pcb with control wiring and upload without a lot of complex circuitry or once the chip has a BL, can i just use the usb to simplify things to upload.

i tried to look at Sparkfun's tutorial but still not sure how to "tie" into schematic with existing pin functions. im thinking the usb would be the easiest after burning the chip

i ordered a ftdi so i guess i will either brick (unlikely), blow out or have success.

thank you very much.

I uploaded the bootloader to a blank 328 which was plugged into a breadboard and I used an Uno to do the uploading. Then I installed the 328 in a piece of perfboard that has some pins on it to which I can connect an FTDI cable when I need to upload a program or download data.

...R

Read this. http://www.gammon.com.au/forum/?id=11637

You can do both either bootloader burning or full sketch loading with ICSP. With a serial header, you need a bootloader first, but it may be easier in the field.

If you are using either serial or SPI on your actual board, for simplicity I would use the other method. If you are using both you may wish to install a jumper to disconnect serial for programming.

As long as your external circuits don't interfere with the SPI pins (example, having only inputs to other devices connected to D11,12,13) then the ICSP programming can happen on board. If you outputs from other devices, make sure they have active low output enables, and the enables are pulled high so that when Reset is asserted by the SPI Programmer, the outputs are not impacting D11,12,13.