Coder Social home page Coder Social logo

avr-breadboarding's Introduction

AVR example programs

Most of these programs are closely based on, or at least inspired by, examples from the book Make: AVR Programming by Elliot Williams (github page). I tended to put comments and names into my own words for self-education. The book has been a fun read, and is needed for circuit diagrams and code explanations.

Build tools and Makefile

I used avrdude, avr-gcc, and the rest of the toolchain from Crosspack for AVR as my programming environment on OSX.

The Makefile is a modification from the reference above. I acquired several different ATMega328 chips and boards, and used various hardware setups to program them. The default Makefile settings are for my breadboard setup, which is an ATMega328P programmed over USB+ISP using a usbtiny FTDI programmer (I used a Sparkfun pocket AVR programmer). I also played with programming different arduino Uno-type boards over the USB line. For those, I did something like make uno, make nano, etc. (the serial port URIs are hard-coded in the Makefile). However, many examples are expecting a 1 MHz cpu clock frequency, and won't work correctly on a 16 MHz clock source without code adjustments.

Serial communication

I went ahead and reinvented the wheel by writing simpleterm, which is almost certainly crappier and less feature-rich than any other serial terminal program out there. (How's that for a raving endorsement?) It depends on ncurses and libserialport, which are both small, easy-to-install c libraries.

My troubleshooting experience

  • When I receive garbage symbols in my terminal from the USART peripheral, the first thing I check for is a baud rate mismatch.
  • With a new hardware setup, I flash blink.c with a 1-second blink rate. This immediately identifies any obvious clock speed misconfigurations in the software. make debug is sometimes useful too.
  • Uploading code to arduino boards over USB requires a specific upload rate (the -b option to avrdude). Getting it wrong often results in stk500_recv() or stk500_getsync() messages. Note that this has nothing to do with the BAUD parameter (that's for USART interaction). It can be helpful to upload code from the arduino IDE with the verbosity switched on, in order to see what it uses.

avr-breadboarding's People

Contributors

andrewadare avatar

Watchers

 avatar  avatar  avatar

Forkers

systams iooi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.