I have tried two different USBtinyISP programmers, 4 attiny45-s and one attiny85 - to rule out bad chip theory
Connetion between USBtinyISP and chip I have tried two methods - connectors soldered to perfboard and connected with wire and 6 pin connector to 8 pin chip connector connected with short loose wire.
I do have selected the correct board from tools - board menu. I have tried both tools - burn bootloader and avrdude with the help of fusecalculator on AVR® Fuse Calculator – The Engbedded Blog
Outcome:
Arduino IDE always gives me error when comparing data written to chip with compiled program. Address is always different but not bigger than 0x0200 or so.
avrdude: verification error, first mismatch at byte 0x0100
0xd0 != 0xc8
The strange thing is that I can upload this same file using command line and avrdude with no problem. Compare is always OK. (using the instruction on AVR Tutorial - AVRDUDE)
Program behaviour:
When programming with Arduino I have seen only once that blink program started working, all other times - no function
When using avrdude from command line, simple programs work. e.g. servo8bit controls servo OK. I hoped to get software serial to get working this way with no luck. all i get is gibberish from serial.(I have double checked the baud rates in serial monitor and in progarm)
MAIN QUESTION:
How to configure Arduino IDE so I can upload programs to attiny45/85 and make them work?
Amigone:
The strange thing is that I can upload this same file using command line and avrdude with no problem. Compare is always OK. (using the instruction on AVR Tutorial - AVRDUDE)
Post the command line and output. If you are using Windows, from the system menu you can click Edit, Select All, Edit, Copy to copy the contents of the command shell window. Please use </mark> <mark>[code]</mark> <mark>
Amigone:
Arduino IDE always gives me error when comparing data written to chip with compiled program. Address is always different but not bigger than 0x0200 or so.
avrdude: verification error, first mismatch at byte 0x0100
0xd0 != 0xc8
Post the verbose output. Please use </mark> <mark>[code]</mark> <mark>
Amigone:
Arduino IDE always gives me error when comparing data written to chip with compiled program. Address is always different but not bigger than 0x0200 or so.
avrdude: verification error, first mismatch at byte 0x0100
0xd0 != 0xc8
I've seen that when I have other things connected to the I/O pins when uploading. Try disconnecting everything except the programmer.
#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); // RX, TX
void setup()
{
// set the data rate for the SoftwareSerial port
mySerial.begin(1200);
mySerial.println("Hello, world?");
}
void loop() // run over and over
{
mySerial.write("tere");
delay(100);
}
The picture of the used hardware for connecting attiny to USBtinyISP. USB A socket on perfboard is for extra power from another USB port, this didn't change a thing. Capacitor is 0,1 uF for supply voltage stability (it was recommended on one forum) the perfboard has both male and female connector, so it can be connected directly to USBtinyISP or to the cable (the other USBtinyISP had its connector oriented so that cable had to be used)
If this is wiring problem, how do you explain the fact that using avrdude from commandline works? I can go over all the connections one more time, just fur fun of it =)
EDIT
one more round with my fluke multimeter and all the connections are solid from chip to chip.
Just for infromation, the results of command line:
C:\Users\tanels\AppData\Local\Temp\build4990552546878447088.tmp>avrdude -c usbti
ny -p t45 -U flash:w:serialtest.cpp.hex
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9206
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "serialtest.cpp.hex"
avrdude: input file serialtest.cpp.hex auto detected as Intel Hex
avrdude: writing flash (3232 bytes):
Writing | ################################################## | 100% 6.08s
avrdude: 3232 bytes of flash written
avrdude: verifying flash memory against serialtest.cpp.hex:
avrdude: load data flash data from input file serialtest.cpp.hex:
avrdude: input file serialtest.cpp.hex auto detected as Intel Hex
avrdude: input file serialtest.cpp.hex contains 3232 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 4.95s
avrdude: verifying ...
avrdude: 3232 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Doesn't look to me like you're verifying the data from the command line.
It's the verifying that's the problem, which is why I pointed the finger at MISO. Even if the multimeter shows a connection there might be a weird wire or solder joint.
What's the resistance, exactly from ISP to MISO pin? Is there any voltage on the chip socket if you remove the ATtiny?
avrdude: verifying flash memory against serialtest.cpp.hex:
avrdude: load data flash data from input file serialtest.cpp.hex:
avrdude: input file serialtest.cpp.hex auto detected as Intel Hex
avrdude: input file serialtest.cpp.hex contains 3232 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 4.95s
avrdude: verifying ...
avrdude: 3232 bytes of flash verified
I can't read out of this anything else but the fact that flash is read back and verified against the serialtest.cpp.hex file.
I did the measurements and all pins had resistance of 0,35 to 0,4 ohm on my work Fluke multimeter that is calibrated yearly. (leads connected resistance was 0,15) I measured the resistance from the socket for attiny to the component on the USBtinyISP.
When removing attiny from socket, i remove the cable from USBtinyISP first.
Still with no clue, but thankful for your time.
EDIT
for instance, I have a tiny sketch to output serial data - print Hello World. If i upload it using Arduino IDE, I get nothing on the serial line. If I do the same thing on command line with avrdude, I do get gibbrish on serial line "Heìlÿ?תwor¶ôý" - this is supposed to be "Hello World?", so Arduino IDE fails to program the chip and it seems, also fails to compile the program correctly.
I can replicate your error if I use a USBAsp programmer, and a fresh Attiny85
It is possible because i have not updated the firmware like described in this thread
I do have different avrdude versions, as I installed WinAVR in the process of debugging. Command line version is 5.10 and arduino uses 5.11. So newer version can't handle it?
Also I have tried to change the fuses both with arduino IDE and with avrdude, as specified in my first post - with no success.
My guess is that arduino IDE either mishandles avrdude, giving it wrong parameters, or doesn't take into account the speed or other specific parameters of the attiny chip - problem in some config files?
Amigone:
My guess is that arduino IDE either mishandles avrdude, giving it wrong parameters, or doesn't take into account the speed or other specific parameters of the attiny chip - problem in some config files?
Easy enough to prove. Copy the avrdude command line from the Arduino IDE status window and paste it into a command shell.
Ok, I finally gave up, and ripped apart my Arduino Mega 2560 project and configured it as ISP.
Now the writing is success. but my softwareserial is still not working. I do get information over specified intervals but it is gibbrish as before with avrdude and command line.
I have checked my serial converter with my arduino mega, and it is working, so no wiring or other problems in that hardware.
So it remains a mystery why USBtinyISP wont work and why software serial wont work.
If anyone has some more insight to why USBtinyISP won't work, your ideas are welcome, but I guess I simply remove USBtinyISP from my attiny projects hardware list.
For the SoftwareSerial issue I suggest starting another thread (this forum section is a reasonable choice). With the two topics this thread could easily get messy and confusing.