Monday, September 28, 2020

Using USBTinyISP programmer with Atmel Studio 7 | AVR programming

In the last article I talked about Programming any AVR microcontrollers using WinAVR and USBTinyISP but recently I found that USBTinyISP can be easily used together with Atmel Studio.

Using USBTinyISP programmer with Atmel Studio

Using an external programmer in Atmel Studio 7

Friday, September 4, 2020

Program any AVR microcontrollers using WinAVR and USBTinyISP - Getting started with AVR tutorial for beginners

Nowadays Arduino is the platform of choice for programming AVR microcontrollers and for good reasons. But there are times when you want to have full control over what is added to your code. 

For example Arduino is enabling by default Timer0 for use in millis function and other functions and includes some interrupt routines that perhaps your project is not using and so adding to the code size or perhaps those interrupts can interfere with your code.

What you need:

  • ATmega328P (used in this tutorial as an example)
  • USBTinyISP programmer 
  • WinAVR software (more on this later)

What you can learn:

  • how to program an AVR microcontroller using an In-System Programmer such as USBTinyISP and WinAVR
  • some bitwise operations for handling the registers

There are two ways to program a microcontroller:

- ISP (In System Programming) using SPI protocol and a ISP programmer
- With a bootloader using UART protocol and a USB to Serial programmer. Some microcontrollers come with a bootloader already pre-programmed on them.
 
This tutorial will cover the ISP programming way.

Programming software

There are many tools for programming an AVR microcontroller such as Atmel Studio, PlatformIO, Eclipse with an AVR plugin, etc but the simplest and light weight solution that I found is using WinAVR.

Programming hardware

Apart from development software there is also the need of a hardware programmer that the software uses to communicate with the microcontroller and upload the code to it. Searching online for 'avr programmer' reveals lots of options. The most popular I believe is the USBTinyISP and is very cheap. There is also Atmel-ICE from Atmel. A bit more expensive but it has the benefit of being able to debug and see in real time what happens inside the microcontroller.


WinAVR and USBTinyISP - Getting started with AVR


Getting started with WinAVR