User Tools

Site Tools


projects:avrprogrammer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
projects:avrprogrammer [2013/01/16 15:00]
mkucia [BOM]
projects:avrprogrammer [2013/01/16 15:00] (current)
mkucia [AVR programmer for begginers]
Line 1: Line 1:
 +====== AVR programmer for begginers ======
  
 +<WRAP center box >
 +This project is for educational purposes only. 
 +
 +I AM NOT RESPONSIBLE FOR ANY INJURY OR DAMAGE CAUSED BY USE OF THIS INFORMATION.
 +</​WRAP>​
 +
 +Currently popular programmers have the following disadvantages: ​
 +
 +  * Relatively expensive
 +  * Complicated - Presented programmer requires minimum amount with functionality tradeoff.
 +  * Require another programmer to start working!
 +
 +The code is based on project that is a part of LUFA framework (Lightweight USB Framework for AVRs by Dean Camera): [[http://​www.fourwalledcubicle.com/​AVRISP.php]]. The board is my design.
 +
 +===== Programmer advantages =====
 +  * Thanks to build-in USB bootloader another programmer is not required to get the device running.
 +  * Allows powering target device.
 +  * All parts are in SMT technology, therefore PCB does not require drilling
 +  * Only 5 elements require special attention to package direction (harder to make mistake)
 +  * Works with AVR Studio or AVRDUDE (selectable by firmware)
 +  * Low cost
 +  * Small
 +  * 4 [MHz] rescue clock output
 +  * ISP, PDI and TPI programming interfaces
 +  * True USB (unlike USBASP)
 +
 +===== Schematics =====
 +{{:​pl:​avrc:​art:​avrisp_schematic.png?​600|}}
 +{{:​pl:​avrc:​art:​board_kolory.png?​600|}}
 +
 +===== BOM =====
 +
 +^ Element ^ Wartość ^ Opis ^  ​
 +| IC1 | AT90USB162 | microcontroller | 
 +| USB | - | solder field for USB wire | 
 +| F1  | 500 [mA] | Polymer fuse |  ​
 +| R1 R2 | 22 [Ω] | USB-line impedance-match resistors |  ​
 +| C1 | 1 [uF] | 3V3 USB voltage stabiliser capacitor ((for AVR USB peripheral)) | 
 +| C3 C4 | 33 [pF] | oscillator capacitors | 
 +| Y1 | 16 [MHz] | quartz oscillator | 
 +| C2 | 100 [nF] | power bus decoupling capacitor | 
 +| C5 | 10 [uF] | power bus decoupling capacitor | 
 +| R3 | 1 [kΩ] | pull resistor | 
 +| R4 | 1 [kΩ] | bootloader line pullup resistor | 
 +| R5 R6 | 1k ÷ 220 [Ω] | LED resistors | 
 +| LED1 LED2 | Signal LEDs | 
 +| | | Goldpin headers | 
 +
 +===== Launching =====
 +  - Check all components and connections
 +
 +==== Software ====
 +
 +1. Download required tools:
 +  * [[http://​sourceforge.net/​apps/​trac/​libusb-win32/​wiki|The most recent libUSB-win]]
 +  * [[http://​www.fourwalledcubicle.com/​LUFA.php|Most recent LUFA release]] (requires modification)
 +  * [[http://​www.atmel.com/​dyn/​products/​tools_card.asp?​tool_id=3886|Atmel FLIP]] (windows) or [[http://​dfu-programmer.sourceforge.net/​|DFU-programmer]] (Linux)
 +  * (Extra) [[http://​www.ftdichip.com/​Support/​Utilities.htm|USBView]]
 +Linux users should download appropriate tools and use them accordingly to their OS.
 +
 +<WRAP center important >
 +Code from LUFA requires modification:​ pin PB4 must be inactive (high impedance mode). To reduce board layer count one trace crosses one pin. Pin is unused in this application and must remain floating. Therefore user must modify IOs initialization code.
 +</​WRAP>​
 +
 +2. Connect device to the PC. You should see a new device using __Device Manager__ or __USBView__. Linux users can use ''​lsusb''​
 +
 +3. Install DFU drivers from Atmel FLIP directory. (Linux users should follow instructions for DFU programmer).
 +
 +4. If user compiled the firmware on his own, he can use a make script to program the device. If user use precompiled code:
 +  - Run Atmel FLIP
 +  - Select __Device__->​__Select__...->​__AT90USB162__->​OK
 +  - Select __Settings__->​__Communication__->​__USB__
 +  - When window __USB Port Connection__ opens choose __Open__
 +  - Select __File__->​__Load HEX File...__ and open appropriate file
 +  - In the __Operations Flow__ tab click __Run__
 +  - Close Atmel FLIP
 +
 +5. Reset programmer trough re-plugging it from PC USB port. Among USB devices user should see a new device. Drivers for it are located in the libUSB-win directory.
 +
 +6. If our system does not accept unsigned driver user need to generate appropriate INF file using __inf-wizard__ ​ application from libUSB-win directory.
 +
 +<WRAP center tip>
 +If you have AVRStudio installed your system most likely has [[http://​www.jungo.com/​st/​windriver_usb_pci_driver_development_software.html|Jungo WinDriver]] drivers installed. This programmer will not work with those drivers, you need to force using [[http://​www.societyofrobots.com/​robotforum/​index.php?​topic=6664.0|libUSB drivers]].
 +</​WRAP>​
 +===== How to use programmer =====
 +If you use AVRDude please use following scheme:
 +<​code>​avrdude -pXX -cavrispmkii -P usb</​code>​ where XX put target device name (ex. -pm8 for ATmega8). Useful argument is <​code>​-B 4</​code>​ that sets the period of clock signal (in this case 4 [us] → 250 [kHz])
 +
 +
 +===== Firmware upgrade =====
 +MCU manufacturer uploads bootloader to the chip during fabrication process. Bootloader code is located at the end of program memory. After reset PC (program counter) is "​jumping"​ over NOP-filled (NO Operation) memory till it reaches the bootloader code.
 +After firmware upload bootloader does not start automatically. We can force MCU to jump directly into bootloader code after reset. To do so:
 +  * Pull-down HWB (HardWare Boot) line to the ground [1]
 +  * Reset MCU trough pulling reset line to the ground. [2] (HWB must be pulled down during reset!)
 +Schematic below shows point you should short (programmer must be connected to the PC during the process).
 +
 +{{:​pl:​avrc:​art:​avrisp_boot.jpg?​direct&​700|}}
 +
 +Metal tool such as callipers can be used. One of the signals can be pulled using GND wire from the programmer pin header.
 +
 +<WRAP center important >
 +Take attention to the procedure. Accidental shorting of power line to the ground might influence your PC. I have marked the power line by red, ground plane by colour blue and signal lines to be pulled-down by violet.
 +</​WRAP>​
 +
 +===== Files =====
 +  * {{:​pl:​avrc:​art:​programmer_v3.zip|}} Schematics ([[http://​www.cadsoftusa.com/​|Cadsoft Eagle 6]])
 +  * {{:​pl:​avrc:​art:​avrisp-mkii2.zip|MCU code}} Maj 2012
projects/avrprogrammer.txt · Last modified: 2013/01/16 15:00 by mkucia