Code Monkey home page Code Monkey logo

avr-tqfp-programmer's Introduction

Program TQFP AVR's easily without soldering

Moving image!

So, you designed a board that incorporates a SMD AVR and forgot to break out ISP pins. How you gonna upload your code/(if you have serial pins available)bootloader on your microcontroller?

This was my problem. Instead of adding test points to relevant signals, reordering PCBs and messing with pogo pins, I preprogrammed the chips using a TQFP adapter. Here's how I do it.

You'll need:

  • An AVR ISP programmer. You can use a dedicated programmer (Atmel MKII, Atmel ICE3, USBasp etc.) or you can use an Arduino as ISP. If you are not sure, read here: https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader
  • A TQFP to DIP adapter. I'm using this.
  • ISP to TQFP-DIP adapter board. This board goes between your ISP programmer and TQFP adapter. You can get the adapter board from pcbs.io or make the board with files provided in this repo and using your favorite method (toner transfer, photoresist etc.)

Order from PCBs.io

If you prefer using another PCB manufacturer, feel free to use provided Gerber files.

If your programmer has a ZIF socket (like most Chinese programmers), you don't need that adapter board, you can directly put the TQFP-DIP adapter to your programmers' ZIF socket.

How to program your device:

The exact avrdude command varies with your programmer and chip type. avrdude is a fairly flexible and powerful utility, please don't blindly copy/paste the commands provided below, read the avrdude manual beforehand. You can disable your chip with avrdude if you mess up fuses and don't know what are you doing.

Word on disabling: You can effectively disable the ISP interface while using an ISP programmer. If you do this, you can't program your chip over ISP anymore, and it appears dead. You'll need a real (i.e. high voltage) programmer for restoring at this point (in some situations avrdude can fix that, but do not rely on it). Please don't mess with debugWIRE and RESET fuses if you don't know it. More information can be found at http://www.avrfreaks.net/forum/tutsoft-recovering-locked-out-avr

After you connect your ISP programmer and adapter, you are ready to program your chip with avrdude. Here is the valid command for ATMega328P and USBasp programmer.

avrdude -v -patmega328p -cusbasp -e -Ulock:w:0x3F:m -Uefuse:w:0x04:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m -B100
avrdude -v -patmega328p -cusbasp -e -Ulock:w:0x0F:m -Uflash:w:yoursoftware-withbootloader.hex:i

There is 2 seperate commands. First commands only sets the fuse bits and prepares ATMega328P for the actual programming. It sets the crystal, brownout level, disables any locks and does all of it slowly (-B100), because a factory-new ATMega328P comes with its 1MHz internal clock fuse set and USBasp, by default, tries pushing data faster than 250KHz. (ISP frequency is MCU clock/4.)

Second command is actually programs your hex file and sets the lock fuse to prevent modifying bootloader in your application. It's important, because if you don't set this; you can overwrite/corrupt your bootloader in your application. If you don't use bootloader, you'll need to modify it by your needs.

Lock bits explanation: There are "fuse bit calculators" on Internet. Here is a example that explains what is going on within the first command. http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega328p&LOW=FF&HIGH=DE&EXTENDED=04&LOCKBIT=3F

Batch file

I have a batch file to speed up programming multiple AVR's in order. You can see it working on my video. It is very basic, only has a loop and a counter. It serves to my needs and you should customize it if your needs is different. Note that it can't work out of the box, at least the paths needs to be changed.

3D-Printed Case for original PCB

A simple 3d-printed case: https://www.thingiverse.com/thing:4529554

Extended PCB

This is an extension of the original PCB to make it possible to connect sensors and things for testing. PCB files are found in the EASYEDA folder and the home project for this version is located here: https://easyeda.com/sbsivertsen/avr-tqpf-programmer

avr-tqfp-programmer's People

Contributors

datamann avatar hazarkarabay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

avr-tqfp-programmer's Issues

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.