Tag Archives: avr

ATmega168 documentation uses word addressing, avrdude uses byte addressing

I was programming USBaspBootloader into a metaboard with an Atmel AVR ATmega168 microcontroller. I always got this error: usb 6-2: device descriptor read/64, error -71 … usb 6-2: device not accepting address 21, error -71 1. USBaspBootloader’s Makefile specifies atmega168 and BOOTLOADER_ADDRESS=3800 by default. This is in hex addressing a byte, i.e. 0×3800. avrdude uses [...]

Atmel AVR timer/counter examples

Here’s the catch: the timer/counter is capable of operating on a completely hardware level, no software interaction required. A nice explanation is given here (section 2). This page starts with an introduction using a software counter. Which shows how tedious that is, especially counting the clock durations yourself. Another page at AVRfreaks here deals exclusively [...]

Atmel’s assembly: branch to address, not label

Say you had this code to wait for n iterations, where n is stored in register arg. You could write: wait: dec arg brne wait ; step back to dec ret Which would be OK. But if you didn’t have that much free registers, you would probably pass n using the stack. In which case [...]

Making my own USBasp programmer

I’ve been trying to make some for the last two weeks (yes, two weeks). I didn’t use the provided designs, that’s why it took so long: first, I wanted to get apprehended with the UNIX electronics CADs; then, as one should expect, I ran into design trouble of a layout that hasn’t been tested. So [...]

First tryout of AVRs

I bought a few programmers some time ago. On eBay, for around 16 dollars american. They’re a copy of Thomas’ Fischl’s USBasp. Now I’m toying around with them – a part of my summer internship. First off, I tried connecting one working programmer to the other and see how it goes. Well, FreeBSD couldn’t recognize [...]

Follow

Get every new post delivered to your Inbox.