Go Down

Topic: IDE V1.0 and later (Read 1 time) previous topic - next topic

Platypus

I generally use IDE V23 - no problems uploading using a programmer (usbtiny)

But newer versions have an issue - at least on all three of my PCs (two with XP, one with Win7) when using a programmer.

I think it might be an issue with Avrdude.

Take V1.0.2
- on startup there is a message on the IDE lower window frame
- example  Arduino Uno on COM1 or some other board previously selected
- it seems to remember the last board selected
- when using a programmer and V23 - there is no board message as above

But this message occurs even if nothing is attached to any USB - no programmer or board.

When a sketch is uploaded to a Leonardo - using the usbtinyisp and just pressing the Upload button - this message;
- Couldn't find leonardo on the selected port.

When a sketch is uploaded by pressing Shift/Upload - the programmer lights up and uploads code.
I know the code changed even though the Rx/Tx leds do not light as usual during upload, but the code is corrupted.
However this message;
Avrdude:verification error, first mismatch at byte 0x0580
0xe2 !=0x0a
Avrdude: Verification error, content mismatch.

I have asked Sparkfun about this and they tell me they have no problems with the newer IDE's

Does anyone know what could be causing this problem.

We had the same issue on one of our PCs.  The error came up 8 times out of 10.  Only on the one PC though.  We narrowed it down to the new version of avrdude that comes with release 1.0 and we got in touch with Joerg Wunsch on the avrdude development team and worked with him on it for a while but never got it resolved.  Joerg suspected it to be a timing problem.  He suggested that it was not reported enough to justify him diverting his efforts from bigger problems to resolve it.  At the time we were the only ones to report the problem.  We also tried to get Adafruit to look into it too (it was their USBTinyISP) but they refused to even look at the problem.  We tried to reproduce the error on two other machines (one slower and one faster) and could not.

In the end we got around the problem by working with one of our suppliers to design a programmer that meets our needs and uses a Arduino and the ArduinoISP sketch.  We figured that we could fix that ourselves easily enough if worse came to worse.  That's what we use exclusively now and the USBTinyISP gathers dust.
Facts just don't care if you ignore them.

Nick Gammon

I am uploading code to a board with the same processor as the Leonardo (Atmega32u4) on a daily basis. I am using the sketch and hardware described here:

http://www.gammon.com.au/forum/?id=11638

I'm not surprised you can't upload "normally" with a pre 1.0.1 IDE because that is the one that added code for the Leonardo. It detects the USB port (not the serial port) in a different way.

If you want to continue using avrdude, try adjusting the bit rate by running the command from a command (console) window.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Platypus

Thanks to both of you for your helpful replies.

Of course, V1.01 and later is needed for the 32U4 or Leonardo, I was aware.

I also use the WINAVR Programmers Notepad to program the 32U4, 2560, and 328P that I have - using the same programmer.

Using a small piece of code as a test - just to light a LED on a particular PORT - changed the PORTing to prove the code took with each avr chip.

No problems at all..the same programmer was used, proving a bug exists in the Arduino IDE.

I need to produce a commercial solution for programming chips in the lab and field on the fly, if and as necessary - once this embedded project is done there will be thousands of chips to program and verify, so there is a need for a tidy solution.

Nick, your website is great and was very interesting.

So it seems that the newer Arduino versions including the Wiring IDE do not pay attention to hardware compatibility with programmers such as the Usbtiny.

If it is a hit and miss as it seems to be then you are right - these programmers will gather dust if anyone tries to use them with these new IDE's.

I started using Arduino as it seemed to be a reasonably quick entry into an embedded solution - my project is commercial - but I now see many shortcomings with Arduino and a distinct hobby approach, which in essence,it is.

To further evaluate my prospects I recently attended an Atmel Tech on Tour workshop in Sydney - there were about 25 people there - we all wanted to learn more about using Atmel Studio6 using the XMega-A3BU Xplained board and JTagIce3.

Very interesting day and we all learned a lot about the software and hardware.

It was obvious that getting your head around Studio6 was on another level - and the reason most mortals use the simple Arduino system - well at least when it works!

However if Arduino refuse to fix known bugs then eventually many, will by necessity move away from that platform.

Nick, can you contact me - directly, not via this forum.

Platypus

I thought this information might help with any issues that you might think you have with these later versions.

Well I'm no expert so it took some work getting this sorted out.

First check that the preferences.txt file that the IDE initially creates is set to upload.using=bootloader

The file sits in the Windows directory under your user name, Appdata, Arduino
To view the hidden files click on Folder options, View, uncheck the Hidden files and folders

With versions 1.0 and later all you need to do to upload with a programmer is select it from the list under programmers. if you are using more than one programmer type just check the one in use at any time.

You will need to remember to hit SHIFT/Upload - else it won't be seen and as you have upload.using=bootloader the IDE will think there is a problem and will give the error message Couldn't find the 'say' Leonardo on selected port. So, press SHIFT/Upload and it will work..

A note about syntax for the usbtiny and Atmel Avrisp mk2.
If you feel the need to change the preferences file, upload.using=
then use "usbtinyisp" or "avrispii" (that's two lower case i's, and don't ask why but if you use a 2 it won't work)


Also there is a difference in upload between the Sparkfun usbtiny and the Atmel Avrisp Mk2
The files upload ok but, at least on my PC's with the tiny, led 13 and the the Tx ans Rx leds stay on after upload.
With the Avrisp mk2 only led13 and the Tx led stays on after upload.
And this applies to sketches that don't use led13.

Bootloader gives no such issue.
Bootloader takes about 10 seconds to burn - tested on Uno and Leonardo

Unsure why, maybe someone has an explanation.

Apparently Studio 6's avrisp mk2 driver interferes with the Arduino driver and needs to be rolled back and the Arduino driver installed, see links below.
Here are helpful link/s..
How to configure the Atmel AVRISP MKii to work with Arduino IDE - Arduino Forum_files

and  MightyOhm » Blog Archive » AVRISP mkII libusb drivers for Windows 7   Vista x64_files

I guess that the only thing to do, as usual with coding, is to test the !!!?## out of your program and don't just expect it to work the way you think it will work. Then when you find it is working test it again and again - at least for critical coding purposes. Perhaps also use failsafe techniques if the code fails - eg activate a buzzer if the code does not pass a point in right time etc

Good luck.


Platypus

In this post
Strange behaviour from Leonardos and usbtiny
Atmel Avrisp mkii - the choice for a programmer

Using IDE V1.0.2

Burn Bootloader
3/3 Leonardos with Sparkfun usbtiny as isp
Time 1min 56secs
Three usbtiny's used - all gave same result
Verification error, content mismatch

Upload sketch (Fade) Using Usbtiny as isp
3/3 Leonardos - same result
Upoad time 8secs
Fade sketch used as a test - port 11 or any pwm port only, else it just blinks, not fades
No upload errors, sketch works perfectly. but Leds 13 and Tx stay on

Upload with bootloader - Leonardos
Time 13secs
Fade sketch - works perfectly, no errors, no error leds on, just power led.

Comparison with a Freetronics Eleven (V1.0)
2/2 Elevens (yes only had 2 of these)

Burn Bootloader
Sparkfun Usbtinyisp (2/2) - time 2mins 6secs, no errors
Atmel Avrispmk ii (1/1, yes had only 1) - time 11secs, no errors

Upload Fade sketch to Eleven With;
Bootloader - time 6secs, no errors, sketch works
Avrispmk ii - time 6secs, no errors, sketch works
usbtiny - time 8secs, verification error, content mismatch - V1.0.2 only-sketch does not work
but V23 gives no errors and sketch works and repeatable

Interesting thing with this last test - immediately after using usbtinyisp and getting a failure (V1.0.2), I uploaded with Avrispmkii (V1.0.2) and had success, everytime - repeated it a number of times.

Repeatable success with Avrispmkii
Using V1.0.2 and Fade and changing pwm ports to test output changes and repeatability - the avrispmkii gave success everytime.
Then I repeated the upload with IDE V23 - but change preferences.txt to upload.using=avrispmkii
Success there as well, repeated a number of times and perfect everytime.

Check the debug code dump (lower IDE window) for the Avrisp mk ii and compare to the usbtiny.

I hope these tests help you to choose a programmer.

The Avrisp mkii is available from Atmel for $34 + DHL freight (about$21) or Element14 for $44, no freight.

From the tests the choice for a programmer (for me) is the Atmel Avrisp mkii
It is more expensive than the usbtiny, but as they say...

Platypus

In this post

A note about the Atmel Avrisp mkii programmer
Other programmers - Atmel JTagIce3

This information could be put elsewhere but it seems to follow this thread, so here goes.

Both of these programmers
There is no power supplied to the ICSP header - you need to supply power for your board, either a usb cable (to usb) or other such as 5V to 12V on Vin and a ground (0V)

Connection to ICSP header
Avrisp mkii
Pay close attention to the small arrow on the plug - it goes to pin 1 (small white dot ot white line)

JTagIce3
Select the correct plug from the breakaway strip of connectors - attach paying attention to the small white dot - goes to pin 1 (also white dot/line) of your ICSP header.

All Atmel programmers and debuggers are data only, but the Avrisp mkii is all that is configured for the Arduino IDE - and they look for power on the ICSP header of your board or breadboard microcontroller setup and will not operate without powerup on the board.

Avrisp mkii
There is a multicolour led  on top of the Avrisp mkii which is RED (no power) and changes to GREEN (power supplied).

When in upload mode there is a green Led inside which will blink as data is transferred.

IDE V23 allows you to see the debug(upload of the hex code) happening, but it seems V1.0.2 does not have this feature.

Atmel JTagIce
Atmel have another, but it's classified as a debugger (see Atmel website), however it does ISP, PDI and JTag programming - it auto senses which connection is active. However it will not work on Arduino boards even in the Atmel Studio 6 IDE.

A good thing about the Studio 6 programming interface is that by using one of Atmels debuggers/programmers you can check your Arduino board for all it's chip parameters (fuses, lock bits etc) and whether it is going to work - if the device ID matches the chip then you will get a message - 'OK'.

If you connect your board to AtmelStudio 6 - Program device - you must select your chip, press voltage button, press the frequency Set button (any setting on the frequency slider works but you want about half way and it needs to be less than 1/4 of you MCU frequency, which it will be for most chips).

Of course  you can also upload a C++ coded program providing it's written and compiled by the IDE.

Programmers Notepad is also a very useful IDE - see WINAvr in your "All Programs" or download and install WinAVR 5.5

Thanks for the information Platypus.
Facts just don't care if you ignore them.

Go Up