facchinm / avrdude

mainline avrdude imported from svn://svn.savannah.nongnu.org/avrdude/trunk
GNU General Public License v2.0
32 stars 14 forks source link

using avrdude with an attiny402 #4

Closed synaption closed 5 years ago

synaption commented 5 years ago

I've got a new error. this is progress. I compiled your version of avrdude from github and this is what I get when I try to flash my code via an arduino isp

synaption@synaption:~/avrdude$ sudo avrdude -c avrisp -p attiny402 -U flash:w:blink.hex -P /dev/ttyACM0

avrdude: AVR device initialized and ready to accept instructions

Reading | | 0% 0.00savr_read(): error reading address 0x0000 read operation not supported for memory "signature" avrdude: error reading signature data for part "ATtiny402", rc=-2 avrdude: error reading signature data, rc=-2

avrdude done. Thank you.

synaption commented 5 years ago

ok, now I'm like 3 errors ahead of this and things are looking better I guess my question is does spi work for the 402 or am I supposed to be using updi somehow?

facchinm commented 5 years ago

Hi @bobwmcgrath , the new tiny series uses UPDI ad programming mode (https://www.microchip.com/wwwproducts/en/ATTINY402). You can build your own programmer using another arduino by following these instructions (https://hackaday.io/project/134831-atmega4809-developing-board-project/log/145848-arduino-uno-as-updi-programmer-for-atmega4809) and then flash using any modern version of avrdude (also the one included in megaAVR official Arduino core)

synaption commented 5 years ago

Thanks. That helps a lot. I still have not got the thing to program though. Using Atmel studio as suggested in the hackaday article was not working so I switched over to avrdude (on linux). This is the error I'm getting:

sudo avrdude -c stk500 -p attiny402 -U flash:w:blink2.hex -P /dev/ttyACM0 -F -D

avrdude: stk500v2_ReceiveMessage(): timeout avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_program_enable(): program enable instruction not defined for part "ATtiny402" avrdude: initialization failed, rc=-1 avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0xf05b90 avrdude: Expected signature for ATtiny402 is 1E 92 23 avrdude: stk500v2_ReceiveMessage(): timeout

avrdude done. Thank you.

I'm not sure what I'm doing wrong.

synaption commented 5 years ago

Also according to the doc the signature code for the 402 should be 1E 92 27

facchinm commented 5 years ago

You may want to give a chance to this project then https://github.com/mraardvark/pyupdi . It simply uses a USB-to-serial adapter so there's no chance to get hot by the UNO autoreset or stuff like that. Hope it helps!

per1234 commented 5 years ago

It looks like avrdude.conf has the ATtiny202 signature for the ATtiny402: https://github.com/facchinm/avrdude/blob/55c65c04c755d5c80352b99ff8505296d9dd9cb9/avrdude.conf.in#L15406-L15412 clipboard01


The ATtiny202 definition's signature in avrdude.conf matches the datasheet.