External RAM For An ATmega128

Those who are familiar with Atmel’s line of 8-bit AVR microcontrollers should already know that some of them have support for external RAM. But have you ever actually used this feature? We haven’t. Now you can learn how it’s done by reading through this guide. It touches on all of the hardware, but doesn’t dwell on it. Instead, you’ll get the background you need on how to write to, read from, and test an external module like the one sticking up in the image above. The test routine shows how to make sure everything’s working correctly with your memory mapping before you begin developing firmware around this increased capacity.

[Thanks Spman]

AVR Programming 04: Writing Code, Etc.

Welcome back to this fourth and final installment of the series. The first three parts should have been enough to get you off the ground, but a few more learning examples wouldn’t hurt. It’s also a good time to discuss some of the other things these little chips can do. Join me after the break to:

  • Expand the sample code, adding features to our simple program while I challenge you to write the code yourself.
  • Discuss AVR fuse bits, how to use them, and what to watch out for
  • Touch on some of the peripherals you’ll come across in these chips

As a grand flourish to the series, I’ve used the example hardware from this final part to build a bicycle tail light. Hopefully this will inspire you to create something much more clever.

Series roadmap:

Continue reading “AVR Programming 04: Writing Code, Etc.”

AVR Programming 03: Reading And Compiling Code

In the last installment of our tutorial series we built a simple circuit on a breadboard and programmed an ATmega168 to make it run. That proves that you know how to follow directions, but the eureka moments of doing everything yourself are on the way. This time around you will get down and dirty with the datasheet, learning where each line of the sample code came from, and give your recently installed compiler a test drive. We will:

  • Talk about bitwise operators and how they work when coding for microcontrollers
  • Discuss C code shorthand
  • Review the sample code from Part 2 and talk about what each line of code does
  • Learn to compile code

If this is the first you’ve heard about our AVR Programming series, head back to Part 1 and start from the beginning. Otherwise, take a deep breath and we’ll being after the break.

Series roadmap:

Continue reading “AVR Programming 03: Reading And Compiling Code”

AVR Programming 02: The Hardware

You may be able to write the most eloquent code in the history of embedded systems but without a way to run it on the hardware it will be worthless. In this installment of the tutorial series we will:

  • Look at some of the available AVR programmer options
  • Place the microcontroller on a breadboard and connect it to a power supply and a programmer.
  • Use programming software to send some example code to the microcontroller

If you missed Part 1 take a few minutes to review that portion of the tutorial and then join us after the break.

Series roadmap:

Continue reading “AVR Programming 02: The Hardware”

AVR Programming 01: Introduction

We love looking at hardcore electronics projects with a beefy microcontroller and hundreds, if not thousands, of lines of code at its center. But everyone needs to get there somehow.

This tutorial series aims to make you comfortable programming the Atmel AVR line of microcontrollers. Whether you’ve never touched a microcontroller before, or you’ve cut your teeth with dozens of Arduino projects, this will help you get right down to the hardware and give you the confidence to build anything.

Series roadmap:

Continue reading “AVR Programming 01: Introduction”

AVR8 Virtual Processor On FPGA

[Jack] wrote in to let us know about a project that creates a virtual microprocessor core based on the ATmega103 by using a Field-Programmable Gate Array. Great, we thought. Here’s another rather esoteric project like the NES on a FPGA, but what’s the motivation behind it? We asked [Jack] and he provided several scenarios where this is quite useful.

Implementing the AVR core allows code already written for the chips to be easily ported to an FPGA without a code rewrite. This way, if your needs outpaced the capabilities of the microcontroller long after the project has started, you can keep the code and move forward from that point with the added capabilities of the gate array. Having the core already implemented, you then only need to work with HDL for the parts of the project the AVR was unable to handle. He also makes the point that having an open source AVR core implementation provides a great tool for people already familiar with AVR to study when learning VHDL.

With products like the Butterfly that this project is based around, or the Maple we’ve seen in the past, programmable logic for the recreational hacker is starting to get a little easier.

How To Write Udev Rules

Since the adoption of Kernel 2.6, Linux has used the udev system to handle devices such as USB connected peripherals. If you want to change the behavior when you plug something into a USB port, this section is for you. As an example, we will use a USB thumb drive but these methods should translate to any device handled by udev. As a goal for this exercise we decided to create a symlink and execute a script when a specific thumb drive was loaded. The operating system we used for this exercise is Ubuntu 9.04 Jaunty Jackalope. Continue reading “How To Write Udev Rules”