3

I'm looking at the possibility of using an attiny2313 as a very simple controller chip, and I've used avrdude before with a parallel port to program one of these. Now I don't have a parallel port, and according to the avrdude page it seems "extra circuitry" is required to do the same from my PC's serial port (I don't get why, when the parallel port was just directly connected).

I've seen "usbasp" programmers which appear to do this, and heard that it's possible to use an arduino as a programmer, but I'd like to use the Pi to do this if possible.

I found a complicated description at Steve Marple's blog, but the complications seem to come from protecting the pi from +5V, whereas for an attiny everything can be 3.3V so it sounds to me like it can just be directly connected. As long as avrdude is "patched".

I have no clue about the arduino world apart from that there are a million and one variations on boards and processors and form factors. If I stick to an attiny2313 and only want to program that, is it possible from the Pi's GPIO pins without worrying about output buffering and voltage mismatch (and frying my Pi!).

If not, then would it be better to go for a usb programmer to program the attiny2313 (which is itself an atmega!) or would it be easier to forget the attiny2313 and replace it with a cheap teensy clone (if that would be easier to program either from the PC or from the Pi)?

  • Looks like linuxgpio was just fixed for RPi but needs testing: savannah.nongnu.org/bugs/?40748 – lossleader Feb 7 '14 at 13:33
  • 1
    The attiny will accept the 3.3v, but if it's power using 5V is will send 5v signals back (possibly frying your Pi). But since you're just starting with AVRs, I'd suggest starting with the less bare-bone systems like the teensy, arduino uno, or arduino micro. Those also support serial communication making debugging a lot easier. – Gerben Feb 7 '14 at 13:50
  • So if I power the attiny with 3.3v, then there's no risk to the pi? In that case I can't see the advantage of a 30USD uno over a 2USD attiny. Teensies look neat but it's not clear that that would be any easier to deal with than the attiny. – francis Feb 7 '14 at 13:58
  • The Teensy's have a bootloader, and so don't require a programmer. I've used the Teensy 3 series, and really love the ARM processors with the huge amount of RAM and Flash on them. – NomadMaker Aug 1 '18 at 9:47
2

Maybe, the following is better suited in a comment, but anyway:

  • USB Programmers are less expensive than a Raspberry Pi, mine was about 15 Euro.
  • The programmers are well supported under Linux and whatnot.

Unless I would know what I'm doing (and right now, I would not), I would definitely go for a USB programmer.

If you don't mind the nitpicking: ATTiny is not ATMega. To my knowledge, all Tiny variants lack SPI and I2C in hardware.

From my hobbyist point of view, they have their merits nevertheless and I like the idea to use the smallest microcontroller possible for a particular task.

  • 1
    Thanks, yes I understand that attiny is not atmega. And I fully agree with your last point, which is why I'm looking at an attiny rather than an arduino! :) – francis Feb 7 '14 at 13:53
  • I bookmark this answer so that I can downvote it when I've got enough reputation. OP asked how to do something - not for the explanation why not to do it. – Tomáš Zato - Reinstate Monica Jun 27 '14 at 23:20
  • If you are patient and willing to wait for shipping from china, you can even get one for just 1 Euro. aliexpress.com/item/… – kwasmich Aug 1 '18 at 9:49
1

AVR and ATTiny programmer can be quite expensive (first price I found is 35€ for a complete setup). In my opinion if you already have a RPI and a bunch of resistor, it doesn't worth the price.

When I had to make the ATTiny clock project to learn about AVR controllers, I used the rototron site. This is really a great starting point to make everything works.

0

AVRdude is capable of using the linux spi device found at /dev/spi* for programming. Which I used for some time. But it was a bit messy to set up the clock speed correctly.

Anyway. Adafruit has a tutorial for bit banging the GPIO in order to program the AVR MCU.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.