Wellys Dev

  • Home
  • Search/Topics
  • Writings
  • About

    2025

  • 2025-06-13
    Developing in C for the 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:

  • 2024

  • 2024-07-23
    Developing in C for the ATmega328P: A Second Serial Port

    Where I discuss in detail, adding a second serial port to the Uno, soft_serial, and how to use it.

    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.

    The port didn’t need to be fast, as it would be used as a communication link between someone on a keyboard and the Uno. It needed to do the following:

  • 2024-07-19
    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.

  • 2024-06-11
    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.

  • 2024-06-09
    Developing in C for the ATmega328P: Raspberry Pi and VS Code Setup Part 2

    Where I demonstrate how to use VS Code on your PC to develop code on your Raspberry Pi for the Arduino Uno (ATmega328P).

    Introduction

    Now that you have the best setup for developing code for the Arduino Uno, how do you use it?

    Links for Reading

    Know

    • Learning the Command Line
    • Editing Remotely Using VS Code
    • Developing in C on the AVR ATmega328P: Frequently Asked Questions (FAQ)
    • Developing in C on the AVR ATmega328P: Frequently Found Errors (FFE)

    Good to Know

    • Remote Development using SSH
    • VS Code User Interface
    • Working with the Command Line

    Two programs

    You will be using two programs on your PC to interact with the Raspberry Pi, VS Code and your terminal program (Windows Terminal, macOS Terminal/iTerm/Warp) also known as your CLI. The former is your coding environment and the latter provides administrative capabilities along with some applications like a serial monitor (tio).

  • 2024-05-05
    Developing in C for the ATmega328P: Raspberry Pi and VS Code Setup Part 1

    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.

    Introduction

    This is the best setup, period. Why? It provides the most simple tool chain installation, a stable, known platform and enables hardware debugging, should you want to do so.

    Linux has always been the preferred platform for open-source embedded development, as the Standard C tools are native to Linux. macOS is second, as its Unix bloodline, enables it to resemble a Linux system quite easily. Windows is a distant third, as the hoops to jump through to build the tool chain are a pain (Note: WSL2 still can’t easily interact with the serial port).

  • 2024-04-24
    Developing in C for the ATmega328P: Make, Makefile and env.make

    Updated: Where I discuss a simplified approach to development automation using make in AVR_C, add the ability to use Arduino tools.

    Introduction

    The previous explanation provided the Makefile from Elliot Williams and can be viewed here. I have made several significant changes to the file since:

    • moved the device programming setup to env.make at the root folder
    • use one Makefile at the root folder then use “include ../../Makefile” in the file makefile, which is in each of the examples in the examples folder
    • added a DEPTH variable to each local makefile (the one in the examples folder)
    • removed some of the targets to simplify the file
    • added additional targets which help explain the make options, including make help
    • Added two variables, which allow you to use either the Arduino toolchain or the avr-gcc toolchain, OS and TOOLCHAIN

    Here are detailed instructions as to how to use make, the Makefile and env.make to configure and execute your development process.

  • 2024-03-06
    Developing in C for the ATmega328P: Buffer Overflow

    Where I use examples from “The C Programming Language”, Kernighan & Ritchie, to demonstrate string copies, using pointers and how to check for buffer overflows.

    Introduction

    I find it very helpful to periodically review/read “The C Programming Language”, Kernighan and Ritchie (K&R). In this past review, I ran across some examples provided on pages 105-6 (Second Edition) as to using pointers to copy strings. There were 4 examples provided, with the last commented as “the idiom should be mastered”, which is an implication of “this is a programming best practice”. Perhaps, for the code in question is quite simple and extremely powerful, that said, it leads to the issue of buffer overflows, for which I provide a mechanism to resolve.

  • 2024-03-01
    Arduino: Reloading Bootloaders on the Uno and the 32U4

    Where I demonstrate how to reload Optiboot on an ATmega328P (Arduino Uno) and reload the Catarina bootloader on to an ItsyBitsy 32U4 board as well.

    Introduction

    Sometimes a board’s bootloader can become corrupted or you have consciously overwritten the bootloader (See Forth on this site), and you want to reload it. This page demonstrates how to do this with the ATmega328P (Uno) and board with the AVR 32U4 (Adafruit ItsyBitsy 32U4). It also discusses the different bootloaders available for the 32U4.

  • 2023

  • 2023-10-02
    Serial Applications for Embedded Development

    Where I discuss various serial monitor applications and why I believe CoolTerm is the best one.

    Introduction

    The serial port is an invaluable, if not mandatory tool, for developing programs in embedded computing. Given the popularity of software development for embedded computers, one would think there would be a clear answer or solution. For several years, I wasn’t able to determine the best solution. However, after more work on my part to understand a specific solution, I can conclusively say use this multiplatform, free solution: CoolTerm

Page 1 of 8
Copyright © 2025 Lief Koepsel
  • Home
  • Search/Topics
  • Writings
  • About