In this post, we'll be discussing:
- What ISP is and how it works.
- As well as the benefits of using ISP.
- The hardware and software needed to perform this programming technique.
If you hate reading then maybe a video is suitable for you so please check the above video.
Needed SuppliesTo ensure successful ISP programming of an AVR microcontroller, you will need the following essential hardware:
- USBASP Programmer: This is the primary programmer device that will be used to communicate with the microcontroller during the programming process.
- ISP Adaptor: The ISP adaptor is a crucial component that allows you to connect the USBASP programmer to the microcontroller's ISP pins. There are two options for the adaptor:
- a. 2.54mm Adaptor: This adaptor is designed for ISP pins with a 2.54mm spacing. It provides a convenient and secure connection between the programmer and the microcontroller.
- b. 1.27mm Adaptor: If your microcontroller has ISP pins with a smaller 1.27mm spacing, you will need a 1.27mm adaptor. This adaptor allows you to connect the USBASP programmer to the microcontroller's ISP pins accurately.
In the upcoming steps, I will guide you on how to produce these adaptors, ensuring that you have the necessary hardware for a successful ISP programming experience. Stay tuned for detailed instructions!
Why ISPFirst, let's start with a brief explanation of ISP. In-System Programming is a technique used in electronics to program microcontrollers or other embedded devices without requiring the removal of the chip from the circuit board. This is a very convenient and cost-effective way to program chips and update firmware or software.
One of the biggest benefits of using ISP is that it can greatly reduce development time and lower costs as you will not need extra electronics components to upload your code to the MCU.
Some microcontrollers support ISP via a standard communication protocol such as SPI or I2C, while others uses some specific protocols, the most commonly used protocol for ISP programming for AVRs is the SPI protocol where you need four pins of your microcontroller plus the two pins for power and shared ground, and since most AVRs are equipped by SPI port then this is the most reliable way for programing them.
To perform ISP, you will need the right hardware and software. This includes a programmer device, which is used to communicate with the microcontroller, as well as software that is compatible with both the programmer and the microcontroller. Considering the social media shared projects, the USBASP programmer is the most popular for AVRs and by connecting it to the microcontroller SPI pins you can easily upload codes.
What To Consider While DesigningIf you are willing to use the USBASP programmer then you need to consider this on your PCB design by providing access to the microcontroller SPI pins and make this access exposed somehow and this technique is the most suitable to keep a small programming area in the PCB layout, by placing some surface pads arranged in 2 by 3 array of 2.54mm spacing you could access the SPI port using some pogo pins, this technique requires an adaptor that you connect it to USBASP JTAG connector to link the SPI pins of programmer and the SPI pins of the microcontroller, you must consider the pins order of SPI based on the adaptor order pins.
I considered this pins array of 2.54mm spacing as example but you could go for smaller array of 1.27mm spacing and then you need a smaller programming adapter.
We can't use the USBASP itself to upload codes, but it has to be connected to the board ISP pins and since a JTAG connector is a bit big part then it will take a larger space then using ISP pins technique and in order to connect the USBASP JTAG connector to the ISP pins of our circuit design then we need an ISP adapter that has a JTAG Male connector where we place the USBASP JTAG Female connector and some pins that could touch the surface ISP pads of the circuit board,
Here I designed two adapter for the two pads spacing so the small one is for ISP pins of 1.27mm spacing and the big one is for ISP pins of 2.54mm spacing.
I get to order these adapters from JLCPCB and the small adapter size gave me the advantage to place my order for a very cheap price.
You could use these GERBER files to place an order of the same adapter and let me know in the comments section if you need any further assistance about them!
GERBER Files for 2.54mm adaptor (1.2mm PCB Thickness)
GERBER Files for 1.27mm adaptor (0.6mm PCB Thickness)
You can order the pins for the adapter and JTAG Connector by following these links:
Pogo Pins for 2.54mm ISP adaptor
Pogo Pins for 1.27mm ISP adaptor
Practicing ExampleNow that we've covered the basics of ISP, let's move on to some practical examples of ISP in action. I will use this PCB design from Alexandra Covor to program a ATtiny13 using USBASP programmer as hardware and Arduino IDE as software.
I must add the MicroCore to my boards manager in order to bring the ATtiny13 microcontroller, and her are the needed steps:
- Open the Arduino IDE.
- Open the File > Preferences menu item.
- Enter the following URL in Additional Boards Manager URLs: https://mcudude.github.io/MicroCore/package_MCUdude_MicroCore_index.json
- Open the Tools > Board > Boards Manager... menu item.
- Wait for the platform indexes to finish downloading.
- Scroll down until you see the MicroCore entry and click on it.
- Click Install.
- After installation is complete close the Boards Manager window.
Now we move to the hardware, the design has ISP pins of 2.54mm spacing so I will use my big adaptor with the programmer JTAG, the pogo pins fits perfectly on the ISP exposed pins and now I could plug my USBASP to computer to burn the ATtiny13 bootloader, I set the programmer as USBASP Slow and my target is ATtiny13 then by clicking burn bootloader I get it transferred to the microcontroller.
I will use the same code provided by Alexandra to demonstrate the programming concept, this code will alternatively glow some LEDs connected to ATtiny13, I keep the same board settings as well as the adaptor pogo pins connected to the board and simply by clicking upload I get the sketch compiled and uploaded.
To ensure successful ISP, there are some important tips and tricks to keep in mind. For example, it's crucial to ensure that the circuit is properly powered and that the programming voltage is correct. It's also important to follow the manufacturer's guidelines for the specific microcontroller you are working with.
Comments