ATtiny13A: Debug Part 2

Where I continue to discus how to debug code on the ATtiny13A on a Linux computer using the Microchip Snap, bloom and avr-gdb. This entry goes into a little more detail as to how to use gdb along with Bloom to debug the ATtiny13A.

Sources#

The code for this article and other articles on the ATtiny13A can be found in the ATtiny13A repository.

Debugging the ATtiny13A — terminal TUI + Bloom Insight#

  avr-gdb  ──►  Bloom  ──►  SNAP  ──►  ATtiny13A
 (TUI in a   (debugWire ↔            (debugWire over RESET)
  terminal)   GDB server,
              Linux only)

The recommended front end is avr-gdb’s built-in terminal TUI, optionally alongside Bloom’s Insight GUI for registers/peripherals/memory. Two heavier frontends — gdbgui (browser) and Sublime + DAP — were explored and rejected; see Explored and rejected for why, so the dead ends aren’t re-walked.

ATtiny13A: Serial Communications

Where I describe the process of developing serial communications for the Microchip ATtiny13A.

Introduction#

Even with a microcontroller with limited capabilities as the ATtiny13A, it is desirable to have the ability to communicate via the serial port. The ATmega328P and others have a UART built-in which makes it much easier to integrate serial communications. With the ATtiny13A, serial communications must be performed completely in software and using assembly language makes it possible and reliable.

ATtiny13A: Multitasking

Where I describe the process of writing and debugging a multitasking program for the Microchip ATtiny13A.

Introduction#

To get the most of any microcontroller, its best to have a framework for multitasking and to ensure it will be as efficient as possible, write it in assembly code. The second aspect to developing the code is debugging it. Which can be problematic, particularly on a chip with limited resources such as the ATtiny13A. This post covers both the code for multitasking and a clever way to determine which tasks are running and for how long.

ATtiny13A: Debug Setup

Where I illustrate how to debug code on the ATtiny13A on a Linux computer using the Microchip Snap, bloom and avr-gdb.

Sources#

The code for this article and other articles on the ATtiny13A can be found in the ATtiny13A repository.

Introduction#

The Microchip SNAP is a low-cost ($11) board which is great for debugging and uploading code to an AVR microcontroller. It is supported by tools such as avrdude and Bloom. While I had attempted to use the Microchip Snap before, I had not any luck. In my attempts to solve this problem, I ran across this link to Bloom: Enabling “AVR mode” on the MPLAB Snap. The article was great for two reasons, first, it explained why the Snap wasn’t working and provided detailed instructions as to how to fix the problem. Second, if you have a Linux computer, Bloom is a great debugging tool!!

ATtiny13A: Introduction

Where I describe the process of developing code for the Microchip ATtiny13A, starting at the chip level.

Introduction#

This is the first in a series of posts describing how to begin developing at the chip level (as compared to board level). In this series, I’ll be using a Microchip ATtiny13A, which is a minimal version of an ATmega328P, the microcontroller used in the Arduino Uno R3.

The chip has the following:

ATtiny13A Development

Where I describe the process of developing code for the Microchip ATtiny13A, starting at the chip level.

This is a series of posts describing how to develop at the chip level using assembly language and C. In this series, I’ll be using a Microchip ATtiny13A, which is a minimal version of an ATmega328P, the microcontroller used in the Arduino Uno R3.

The code for this article and other articles on the ATtiny13A can be found in the ATtiny13A repository.

Developing in C for the ATmega328P: Raspberry Pi and VS Code Setup Part 1 (Trixie)

A new and improved version of where I setup the Standard C tool chain for the ATmega328P on the Raspberry Pi, however I use VS Code on my Mac (or Windows) for development and connect via SSH to the Raspberry Pi. This is the easy setup and requires the least amount of tool installation.

Note: This new, “easy” version is due to using Raspberry Pi OS Trixie, which now provides fairly up-to-date tools for the AVR microcontollers. The previous version has been deprecated. Make sure you are on the latest version of Raspberry Pi OS (which as of December 2025 is Trixie).

Developing in C for the ATmega328P: A Second Serial Port

UPDATED Where I discuss in detail, adding a second serial port to the Uno, soft_serial, and how to use it. New soft serial port has been rewritten in AVR assembly providing much higher speeds.

Introduction#

While I was developing code for a robotic arm, I realized it would be best, if I used one serial port for communicating with the arm and another serial port to accept commands for the arm. Thus I created a second serial port, called soft_serial.

Developing in C for the ATmega328P: Better Serial Input

Where I discuss how to improve on the serial input of C and the ATmega328P and adding a second serial port, soft_serial.

Introduction#

In the example serialio_string (code on GitHub or below), I demonstrate the problem with reading text from the serial port. If you use scanf(), it appears to work well, except you can easily over-run the buffer. For example, the program asks for “up to 7 char”, however, it will accept as many as you are willing to type. More than likely, after about 20 characters, the microcontroller will crash.

Developing in C for the ATmega328P: Raspberry Pi and VS Code Setup Part 3

Where I demonstrate how to use additional tools such as the serial monitor, tio, along with VS Code on your PC to develop code on your Raspberry Pi for the Arduino Uno (ATmega328P).

Introduction#

Even though VS Code has a serial monitor, in fact, in has many serial monitor extensions, I’ve found tio to be the best. The VS Code version has failed to connect too many times, while tio has been rock solid. It also has a nice configuration method and is easy to connect/disconnect.