Linux Kernel 3.0 stopped ArduinoISP working

It seems to me that with distros based on new Kernel 3.0 the Arduino as ISP programmer stopped working.

I mean that I have 2 computers with Xubuntu 11.04.
I used an Arduino UNO with ArduinoISP sketch to flash my Tiny micros over some boards (with Optifix bootloader).
Before the upgrade everything worked fine...

After upgrading to Xubuntu 11.10 the first one and Arch Linux the second one, with both of them I started to have problems using Arduino as ISP.
The sketchs compiled but when I tried to upload them to the destination micros I got:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x11
avrdude: failed to write flash memory, rc=-4
avrdude: stk500_getsynch(): not in synch: resp=0x15

Now the curious thing is that both of those systems use the relatively new Kernel 3.0.
If I try to use the Arduino as an ISP programmer from the terminal with avrdude, i strangely get that the sketch is written on the Arduino itself and not to the destination micro!

I still be able to use the USBtinyISP programmer, so this is not related to other HW but only to Arduino.

Other users have similar problems (i.e.: read here)

Hey, have you tried installing the Arduino IDE through Ubuntu Software Center?

It's not a problem related to "where" the Arduino software comes, but to the OS itself.
On my Xubuntu 11.04 I used Arduino IDE from Arduino site; after upgrading the system, ArduinoISP stopped working.

On my brand-new laptop, bought 10 days ago, I installed Arch Linux, and the ArduinoISP doesn't work too.
Both of them, curiously, use Kernel 3.0: Xubuntu 11.04 used 2.6.38.

Today I tried a Luigino328 on my Arch system and it showed the same error. Then I tried my UNO on a netbook with Mint Linux with kernel 2.6.38 and... it worked!!!

At work, I have a PC with Ubuntu 10.4 (kernel 2.6.xx) and ArduinoISP works.... so the problem is related to most recent distros with new kernel.

I mean, ArduinoISP isn't compatible with something from that kernel, something different that drives the USB ports, but I don't know what.

Ah sorry I made the mistake of skimming through your post, I haven't tried using my Arduino as an ISP programmer with 11.10 yet. I am writing an exam in a couple of hours so I will try write after that!

Just as a matter of interest can you upload sketches such as 'Blink' to your board? Basic compiling and all communication to my board were the first problems since I upgraded to 11.10

I have the same problem =(, I have managed to find fixes for all the other problems with my 11.10 so far but can't find anything on this.

Do you know if the problem is strictly with the Arduino as an ISP programmer, or are there problems with other ISP's too?

I have an USBtinyISP programmer and the bug does NOT affect it.
So it's a problem related to Arduino as ISP only.

Update.
Yesterday I installed the Kernel 2.6.32 LTS from Arch repo and... nothing changed!
Strange to me, but it seems that the kernel doesn't matter so it could be a problem to the OS itself....

I noticed that the ArduinoISP does fuses operations but does NOT flash sketches. I'm starting to think that it could be related to the fact that Arch Linux uses bugged versions of binutils-avr and gcc-avr and to have them working I had to downgrade them to previous versions (as reported in this thread).

It does not sound like this has anything to do with avr-gcc and avr-libc. If the other programmer is working, then the program is being compiled correctly. Have you tried the code with the USB/bootloader?

Just a warning: Be careful about the version of avr-libc you downgrade to. You could be adding more problems to your situation.
When you went back to a previous version, did you back up to avr-libc-1.7.0, that has a bad delay() bug?
Or avr-libc-1.6.9 that won't start the serial function?
I think v1.6.8 is the only other recent version that works.

Another bit of tests.

On Ubuntu/Kubuntu/Xubuntu 11.10 I got the same errors.
ArduinoISP compiled correctly and uploaded without problems. But when I try to use it, I got a strange thing. I noticed that ArduinoISP is able to read/write microcontrollers' fuses (Atmega328/Attiny85/Attiny84 etc...) but when it comes the time to flash the Flash memory the out of synch error comes up.

With Ubuntu/KUbuntu/Xubuntu 11.04 no errors. ArduinoISP is compiled correctly and it works perfectly.

More over, I got an Arduino UNO with ArduinoISP compiled and flashed under Kubuntu 11.04 and it worked PERFECTLY as ISP under Kubuntu 11.10. So I can tell for sure that something under Ubuntu/Kubuntu/Xubuntu 11.10 and Arch Linux is wrong (and the only thing that they share is kernel 3.0).

Is the "11.10" hex file different from the "11.04" hex file?

I didn't check it :roll_eyes: and I don't have Ubuntu 11.10 anymore...
Tomorrow I can check the differences from the hex generated under Arch and under Kubuntu 11.04 : I think it's the same thing 'cause neither the sketck compiled under Arch works.

@ leo72; going back to 11.04 seems to have fixed the ISP problems I was having too.

GregN:
@ leo72; going back to 11.04 seems to have fixed the ISP problems I was having too.

Thank for your 2 cents :smiley:

They ARE different. Attached at this post you will find 2 different hex files.
ArduinoISP_working.cpp.hex, compiled under Ubuntu 11.04 (librxtx 2.2pre2-3, gcc-avr 4.3.5-1, binutils-avr 2.20.1-1)
ArduinoISP_NOT_working.cpp.hex, compiled under Arch Linux (librxtx 2.2pre2-2, gcc-avr 4.6.0, binutils-avr 2.20.1)

Wait for your reply :wink:

ArduinoISP_working.cpp.hex (13.2 KB)

ArduinoISP_NOT_working.cpp.hex (13 KB)

Unfortunately, to compare them for the nitty-gritty details, you will need to post the elf files. I apologize for not saying so earlier.

Don't worry. I will send them as soon as possible.

Here they are...

PS:
I was talking with a friend of mine this afternoon and he tried ArduinoISP under Ubuntu 11.10.
He found that it's not working too. But he has more electr. tools than me and he investigated on the problem and finally he told me that it seems that there is a timings problem: he misured a difference of 8% on the serial speed of the ArduinoISP, not too much but enough to let the timings go wrong...

ArduinoISP_NOT_working.cpp.elf (79.4 KB)

ArduinoISP_working.cpp.elf (75.4 KB)

Any news?

It's clear the compilers are different. This is the top of loop from the NOT working...

000009ca <loop>:
     9ca:	80 91 30 02 	lds	r24, 0x0230
     9ce:	90 91 31 02 	lds	r25, 0x0231
     9d2:	00 97       	sbiw	r24, 0x00	; 0

From WORKING...

00000956 <loop>:
     956:	80 91 1e 01 	lds	r24, 0x011E
     95a:	90 91 1f 01 	lds	r25, 0x011F
     95e:	89 2b       	or	r24, r25

The way they are used, the sbiw instruction and the or instruction are interchangeable so the code is fine. But, the code is different.

The linker must also be different. Data and code chunks are in a different order.

I think the code in the NOT working spi_transaction sets up an exception handler stack frame (the "rcall .+0")...

00000244 <_Z15spi_transactionhhhh>:
     244:	df 93       	push	r29
     246:	cf 93       	push	r28
     248:	00 d0       	rcall	.+0      	; 0x24a <_Z15spi_transactionhhhh+0x6>
     24a:	0f 92       	push	r0
...
     27c:	0f 90       	pop	r0
     27e:	0f 90       	pop	r0
     280:	0f 90       	pop	r0
     282:	cf 91       	pop	r28
     284:	df 91       	pop	r29
     286:	08 95       	ret

I wonder if some default compiler option changed?

write_flash in the NOT working version is short a few machine instructions from the WORKING version. And at least one of the instructions is significant. I wonder if the NOT working version was built by a NOT working compiler?

The NOT working version was built on a machine (ubuntu 11.10) that apparently DO work, compiling sketchs that run. If I compile any kind of sketch and upload it onto my Arduino or my Luigino328, it work perfectly. But if I try ArduinoISP it does NOT work.
A friend of mine told me that he found different timings (8% diff) between serial timings of the working ArduinoISP and the NOT working ArduinoISP. I cannot confirm this 'cause I don't have a DSO.

You can check that ArduinoISP does not work if it's compiled under Ubuntu 11.10 just installing it from scratch and then compiling on that system ArduinoISP. This sketch won't work even on Ubuntu 11.10 nor on other Linux systems nor on Windows nor on nothing else.

different timings (8% diff) between serial timings

Serial? As in, the TTL serial port? Or as in, Serial Peripheral Interface (SPI) bus?