Hello, I'm working on my first PCB design, where I'm using an Atmel 168A as the MCU. As I've always done projects on breadboards and perfboards, this question never arose before. Once the MCU is soldered onto the PCB, how do I program it? Or even change the code if necessary?
After researching, I found out that I can burn the bootloader and upload the code using an FTDI chip through the Tx and Rx ports, or using MISO, MOSI... to load the code. To do this, I would need to design a connector on the PCB that allows me to connect to these MCU ports with an external programmer.
My question is, if I use ISP and leave connectors on the PCB to be able to reprogram the MCU, and additionally use SPI to communicate with peripherals in the normal operation of the PCB, will this connector affect the SPI lines?
Thanks!
And does having those pins connected to the MOSI, MISO, SCK lines not affect SPI communications that are being used? In my case, I would use SPI to communicate with an NRF24, which is quite sensitive
You would have to be sure the circuits using the programming pins do not load down the programmer.
I just found this device that could be used if you didn't want to install an actual connector.
I don't typically connect power through the ISP connector, just my personal decision.
The presence of unloaded program pin headers has no effect on the SPI bus.
Some devices (e.g. some SD card adapters) do not share MISO and MOSI correctly, so you may need to disconnect those devices to program the MCU with the ISP programmer.
Your NRF24 is most likely also using the MOSI, Miso and SCK lines, like the ISP programmer does. What I do in such a situation is designing some extra pinheaders with jumpers on these 3 lines. Normally the jumper caps are on there, so the SPI connection between the MCU and the NRF24 is available. When I want to program with ISP I pull the jumper caps to break the connection to the NRF24 and use the now available pinheaders to connect MOSI, MISO and SCK to my ISP programmer.