AVR Drivers: Difference between revisions

Jump to navigation Jump to search
No edit summary
(add some AVRDUDE stuff about downloading and uploading settings)
Line 86: Line 86:


Communication with the Atmel chip is via Serial Peripheral Interface (SPI, see [http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus Wikipedia article]) with the ISP programmer a Master and the Atmel on the driver board a Slave. SCK is Serial Clock so they are in sync. The ISP programmer talks on the MOSI line (Master Ouput, Slave Input) while the Atmel talks back on the MISO (Master Input, Slave Output) line. RST is reset.
Communication with the Atmel chip is via Serial Peripheral Interface (SPI, see [http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus Wikipedia article]) with the ISP programmer a Master and the Atmel on the driver board a Slave. SCK is Serial Clock so they are in sync. The ISP programmer talks on the MOSI line (Master Ouput, Slave Input) while the Atmel talks back on the MISO (Master Input, Slave Output) line. RST is reset.
===Test the connection===
Now everything is installed and set up. You should be able to plug in your USB programmer with the cable leading to the clip. Attach the clip to the Atmel chip right-side up with at least the 4 critical pins wired correctly.
Now open a command window in Windows (or whatever you are in) and typing this command at the C: prompt:
  avrdude -p t13 -c usbasp -n
The command above calls up avrdude. "-p t13" means you are talking to an Atmel ATTiny13A chip. "-c usbasp" says you are using the USBASP controller. "-n" means no writing, since we're not actually doing anything yet. With USB, you shouldn't have to enter the port number, but some people have to go find out what port the USB is assigned to and if it is Port 2, they add "-P com2" after usbasp. This should generate a message that the AVR device is initialized and ready to accept instructions. If the connection is not working, you will get something like
  avrdude: warning: cannot set sck period. please check for usbasp firmware update
  .
  avrdude: error: programm enable: target doesn't answer. 1
  avrdude: initialization failed, rc=-1
        Double check connections and try again, or use -F to override
        this check.
  avrdude done.  Thank you.
So if you get that, check your clip wiring and make sure your clip is getting a good connection. The clips are very finicky and sometimes needs some repairs. You can check continuity with a DMM from the tooth back to the pad on the USB board. Once you get the message that everything is working, you can move on to the next section.


==Download settings==
==Download settings==
Use the software and hardware to download the existing program from the Atmel chip on the flashlight driver. You will need this if your programming doesn't work and you want to reset the driver to how it was originally. Get fuse settings too.
Use the software and hardware to download the existing program from the Atmel chip on the flashlight driver. You will need this if your programming doesn't work and you want to reset the driver to how it was originally. Get fuse settings too.
<PRE style="white-space:normal;">avrdude -pt13 -c usbasp -u -Uflash:r:flash-dump.hex:i -Ueeprom:r:eeprom-dump.hex:i -Ulfuse:r:lfuse-dump.hex:i -Uhfuse:r:hfuse-dump.hex:i</PRE>
The command above will create 4 files on your hard drive for the flash memory contents, eeprom, high fuses, and low fuses.


==Upload new settings==
==Upload new settings==
Open a command window in one of the BLF-VLD subdirectories: "Fixed Modes", "Programmable", or "Simple". With everything hooked up, enter this command:
Open a command window in one of the BLF-VLD subdirectories: "Fixed Modes", "Programmable", or "Simple". With everything hooked up, enter this command:


<CODE>
<PRE style="white-space:normal;">avrdude -p t13 -c usbasp -u -Uflash:w:BLF-VLD.hex:a -Ueeprom:w:BLF-VLD.eep:a -Ulfuse:w:0x79:m -Uhfuse:w:0xef:m</PRE>
avrdude -pt13 -c usbasp -P com2 -u -Uflash:w:BLF-VLD.hex:a -Ueeprom:w:BLF-VLD.eep:a -Ulfuse:w:0x79:m -Uhfuse:w:0xef:m </CODE>


==Other Issues==
==Other Issues==