Arduino Forum

Using Arduino => Installation & Troubleshooting => Topic started by: leo72 on Oct 20, 2011, 05:56 pm

Title: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Oct 20, 2011, 05:56 pm
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:
Code: [Select]
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 (http://arduino.cc/forum/index.php/topic,75619.msg574731.html#msg574731))
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: GregN on Oct 22, 2011, 05:22 pm
Hey, have you tried installing the Arduino IDE through Ubuntu Software Center?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Oct 23, 2011, 10:57 pm
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.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: GregN on Oct 24, 2011, 01:27 am
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

Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: GregN on Oct 24, 2011, 03:52 pm
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?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Oct 24, 2011, 03:57 pm
I have an USBtinyISP programmer and the bug does NOT affect it.
So it's a problem related to Arduino as ISP only.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 02, 2011, 10:50 am
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 (http://arduino.cc/forum/index.php/topic,66710.msg489632.html#msg489632) thread).
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: SurferTim on Nov 02, 2011, 11:15 am
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.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 04, 2011, 04:58 pm
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).
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Nov 04, 2011, 09:47 pm

Is the "11.10" hex file different from the "11.04" hex file?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 05, 2011, 12:14 am
I didn't check it  :smiley-roll-blue: 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.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: GregN on Nov 05, 2011, 01:06 pm
@ leo72; going back to 11.04 seems to have fixed the ISP problems I was having too.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 05, 2011, 03:35 pm

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

Thank for your 2 cents  :D


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

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  ;)
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Nov 05, 2011, 07:27 pm

Unfortunately, to compare them for the nitty-gritty details, you will need to post the elf files.  I apologize for not saying so earlier.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 05, 2011, 10:49 pm
Don't worry. I will send them as soon as possible.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 05, 2011, 11:26 pm
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...
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 08, 2011, 09:34 am
Any news?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Nov 08, 2011, 10:24 am

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

Code: [Select]
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...

Code: [Select]
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")...

Code: [Select]
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?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 08, 2011, 10:32 am
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.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Nov 08, 2011, 10:48 am
Quote
different timings (8% diff) between serial timings


Serial?  As in, the TTL serial port?  Or as in, Serial Peripheral Interface (SPI) bus?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 08, 2011, 02:30 pm
I don't know exactly.
The post is this one:
http://arduino.cc/forum/index.php/topic,75619.msg588805.html#msg588805

I translate it for you:
Quote
Lo confermo pure io, oggi ho trovato un pochino di tempo per provare e con Ubuntu 11.10 non c'è verso di far funzionare lo sketch isp.
Il problema è la velocità della seriale, dello sketch isp, che non è corretta, se non ho sbagliato a misurare ha un errore maggiore del 8%, quanto basta per far fallire la comunicazione tra avrdude e lo sketch.


Quote

I confirm it [the issue]. Today I found a bit of time to make a test and with Ubuntu 11.10 I didn't find a way to let the ISP sketch working.
The problem is the serial speed, the ISP sketch speed, that is non correct: if I did no mistakes to make misurerements, it has an error that is more than 8% [of the correct speed], that is enough to let the communication between Avrdude and the sketch fail.

The user is astrobbed. Try to contact him.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Nov 08, 2011, 08:32 pm
Quote
The user is astrobbed. Try to contact him.


You'd like me to contact him?  Unless he can read and write Texan, I'm afraid that is not going to go very well.  The only non-English I know is a very very tiny bit of French from High School.  That was, well, let's say a few years ago and I didn't take the class to learn French.   :D

Which version of the Arduino IDE are you using?  1.0 beta?  0022?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 08, 2011, 10:00 pm
The 0022 downloaded from Arduino.cc but I got the same issue using Arduino from Ubuntu's repos.
Same for Arch, using the binaries from Arduino.cc or the Arduino package from repos.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Nov 10, 2011, 09:26 pm

The elf files you posted are dramatically different from the ones I generated here (Windows Vista, Arduino 0022 and rc2).  I'd like to make certain we're starting from the same point.  Please attach a copy of your ArduinoISP sketch.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 11, 2011, 02:09 pm
This is the ArduinoISP sketch in my installation (as I said before, it comes from Arduino.cc).
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Nov 15, 2011, 11:41 pm
Any news... (sorry for the UP but I'm very interested in this thing, as I would like to upgrade my OS)
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Dec 24, 2011, 09:46 am

Are you using Arduino 1.0?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Dec 25, 2011, 07:15 am
No, I don't. I use Arduino 0022.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Coding Badly on Dec 25, 2011, 07:23 am

So much for that theory.  When I have time, I'll take another look at the files you sent.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Dec 25, 2011, 07:27 am
Thank you. I appreciate the time you spend for me  ;)
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: bperrybap on Dec 25, 2011, 06:11 pm


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!



This sounds like a very big clue.
It seems to indicate an issue with AutoReset.
How are you disabling the autoreset on your UNO?

I'm wondering if the USB timing or virtual comm port timing
on the new kernel is such that it is now somehow causing auto reset to fail?

There are many things in the IDE and hardware related to autoreset and disabling autoreset
that are all working to together that kind of just barely work.

It would be very interesting to see a scope picture of the reset line on AVR in the
UNO being used for the ISP.

I bet it looks different in the cases where it is not working.

--- bill






Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Dec 26, 2011, 05:52 pm

This sounds like a very big clue.
It seems to indicate an issue with AutoReset.
How are you disabling the autoreset on your UNO?

I'm using Optifix/Optiboot 4.4 loaded on my Arduino.

Quote

I'm wondering if the USB timing or virtual comm port timing
on the new kernel is such that it is now somehow causing auto reset to fail?

This as alien stuff for me  :smiley-sweat:

Quote

There are many things in the IDE and hardware related to autoreset and disabling autoreset
that are all working to together that kind of just barely work.

It would be very interesting to see a scope picture of the reset line on AVR in the
UNO being used for the ISP.

I bet it looks different in the cases where it is not working.

Sorry, I don't have an oscilloscope in my toolset.
I just know that I have to use an old version of Linux to let the ArduinoISP sketch working.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: bperrybap on Dec 26, 2011, 10:22 pm


This sounds like a very big clue.
It seems to indicate an issue with AutoReset.
How are you disabling the autoreset on your UNO?

I'm using Optifix/Optiboot 4.4 loaded on my Arduino.



But how are you disabling auto reset on your Arduino?

--- bill
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Dec 26, 2011, 11:20 pm
With Optifix 4.4 I don't need to disable the auto-reset.
But to be sure that this was not the problem, I remember that when I did those tests I tried with a capacitor between RST e V5 too, but it didn't solve.

Bu
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: kfreak on Dec 28, 2011, 11:34 pm
I'm having the same problem, can't use Arduino ISP to burn bootloader using Ubuntu 11.10.

Luckily I have a mobile computer with 2.6.35 kernel and it works with that (arduino 021). The master is a duemilanove board (Atmega on that board either with Duemilanove or Uno bootloader) and the target is an Uno board. Cabling as described here http://arduino.cc/en/Tutorial/ArduinoISP

I don't need to burn bootloader often, but this has to be fixed asap, or at least arduino should check for kernel version and show a warning, so users don't get frustrated.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: kfreak on Dec 29, 2011, 02:03 am
This also affects this method of uploading arduino code to AtTinys: http://hlt.media.mit.edu/?p=1229

With kernel 3.0+ => Errors
With kernel 2.6.35 => works as described
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Dec 29, 2011, 09:34 am

I'm having the same problem, can't use Arduino ISP to burn bootloader using Ubuntu 11.10.

So I'm not the only one having this problem, now  :smiley-sweat:

Quote

Luckily I have a mobile computer with 2.6.35 kernel and it works with that (arduino 021).

I chose to install 11.04 because I didn't have a PC with an older version of Linux.

Quote

I don't need to burn bootloader often, but this has to be fixed asap, or at least arduino should check for kernel version and show a warning, so users don't get frustrated.

Best thing is that Arduino team fixes this issue  :smiley-sweat:
I discovered the problem just after the release of the new Ubuntu but since then no official fix for this has been released/announced.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: bperrybap on Dec 29, 2011, 08:24 pm

With Optifix 4.4 I don't need to disable the auto-reset.
But to be sure that this was not the problem, I remember that when I did those tests I tried with a capacitor between RST e V5 too, but it didn't solve.

Bu

using a cap or resistor to disable autoreset doesn't always work.
The autoreset circuit is quite fragile and there are issues with the design such as
ringing on the line that can cause issues.

The only way to really diagnose the issue is to look at the reset signal going into the AVR chip
and that requires a scope.
My guess is that the timing or behavior of the DTR signal has slightly changed and is now causing
the autoreset circuit to go bonkers.

--- bill
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Dec 31, 2011, 12:33 pm
I think the issue isn't in the autoreset. Let me explain you.

When I use the Arduino with the ArduinoISP sketch directly via a terminal window (I'm talking about Linux), I use avrdude to flash the sketch on the standalone micro, the operation DOES fail if:
1) the ArduinoISP sketch has been compiled and flashed under a Linux machine with kernel 3.0 (i.e. Kubuntu 11.10 or ArchLinux)

The operation DOES NOT fail if:
1) the ArduinoISP sketch has been compiled and flashed under a Linux machine with a kernel <=2.26.xx (i.e. Kubuntu 11.04)
2) the ArduinoISP sketch has been compiled and flashed under a Windows machine (tried with Windows XP)

Let me add some more infos.
I also have an USBtinyISP from Adafruit.
This programmer has NEVER failed both under Linux kernel 3.0 or Linux kernel 2.26.xx because its firmware has been compiled and flashed byt Ladyada and I never changed it. So it's the original firmware and it works correctly with any OS I tried.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: bperrybap on Dec 31, 2011, 07:53 pm
That is not enough information to reach the conclusion that it is a kernel issue.

There is also the version of avrdude and what commandline options you are using
particularly given that when using avrdude from the commandline vs from the IDE
the behavior of the signals used for driving the AutoReset (DTR and RTS) signal lines
will behave differently. (IDE toggles the lines before calling avrdude)

You also have to be careful when using avrdude from the commandline because
the IDE will use the avrdude and config file supplied with the IDE and if avrdude from the
linux distribution is installed you can end up running that avrdude or a different config file
than the avrdude that gets used with the IDE.

It could also be a tool set issue on a particular distribution release.


For example, you have not stated were your gcc tools are coming from on the
two different linux verions.
This very important as the Arduino IDE on linux does not supply the avr gcc toolset
like it does on Windows.

The Windows avr gcc toolset (WinAVR) is updated fairly regularly
and is even available from Atmel, which is what the Arduino team uses.
Linux is left flapping in the wind and so the avr tools that are provided with
each distribution are different and typically are not up to date.

As a result, there are several linux distributions that contain bad avr-gcc toolsets in their
repositories that will generate non working code (easy to notice) or broken code that works incorrectly
(harder to detect)
This is especially the case on LTS releases which tend to have very stale versions
of software in general and especially for little used tools like the avr-gcc toolset.
A few years ago the avr-gcc in the Ubuntu repository didn't properly save registers on interrupts,
so interrupt routines that called a C function would corrupt registers.
There was another one where the compilers low level integer multiply routine
accidentally stomped on a register that it wasn't saving.
Neither of these were immediately obvious. You ended up with very subtle errors that only
occasionally showed up, depending on your code.
More recently the AVR libC had a broken set of low level delay routines and that made it out
to some of the debian packages.

I've been burned by this kind of stuff in the past and now I will not use any AVR toolset
provided by the linux distrubution, especially on Ubuntu.

Most linux avr-gcc packages are not updated with the latest bug patches and some
of the distributions are using very out of date sources to build their avr gcc tools.
The only way to ensure that you have an up to date avr-gcc toolset is to
avoid using the avr-gcc tools that are provided with the linux distribution
and instead either build the compiler from its sources or use a pre built
.deb package from a place that is maintained by the AVRfreaks user bingo.
See this AVRfreaks thread for more information on that:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=111691 (http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=111691)
He also provides a set of build scripts that can be used to build to the tools from
sources if you want to go that far or have a distribution that can't use a .deb image.


I went back and re read all the earlier posts and it seems to be pointing at the tools
or a interaction between the tools and the ArduinoISP sketch.
First it was reported as 3.0 is broken and 2.6.xx was working.
Then a 2.6.32 LTS from Arch was reported as broken.
Then there is a ArduinoISP sketch binary that works and one that doesn't.

All this seems to be pointing in direction of a toolset issue or at least a tool set interaction
with the ArduinoISP sketch.

There are few combinations of testing that are missing for example:

- once a "good" ArduinoISP sketch has been burned, can you use it
 from a 3.0 kernel, to successfully update another AVR chip?
  If it works, then it is not a kernel issue nor an avrdude issue and points to a sketch building issue
  more than likely related to the avr-gcc toolset.

- When avrdude from the commandine fails, does using the IDE work?


This should be tracked down, because if it is a avr-gcc toolset issue, it
won't necessarily be a problem for jujst the ArduinoISP sketch it
may affect other things as well.

--- bill
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: madworm on Dec 31, 2011, 10:03 pm
My machine runs the 3.1.4-1-default kernel and I don't have any issues with ArduinoISP (1.0 IDE) - after I increased the serial buffers to 128 bytes (HardwareSerial.cpp).

My avr toolchain is a self-compiled one using the build script from avrfreaks.net - I didn't get ATtiny4313 support via distribution repo back then - and the patches are still not in there after ... a year? I would like to help them, but the spec-files just creep me out.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Jan 03, 2012, 09:38 pm
The AVR toolchain I used is specified in one of my first posts:
http://arduino.cc/forum/index.php/topic,76138.msg588661.html#msg588661

BTW right now I'm using Kubuntu 11.04 with no issues and the AVR toolchain I use is the one from the official Ubuntu repos, nothing different. Same thing when I tried Ubuntu 11.10.

ArchLinux was a more complicated issue because I had to patch AVR tools found in the official repos to let them correctly work.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: Martend on Jan 03, 2012, 11:13 pm
Hello, I was browsing as a new Arduino user this forum and was surprised
to see the topic, that Arduino is not working with the 3.0 Kernel.
Currently I am running Linux centauri 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686 i686 i386 GNU/Linux
manix@centauri:~$ with an Arduino Uno.
I installed the Arduino IDE through my terminal, I did the first few tutorials (blink / knight rider) and everything is working fine.
Hope it helps a bit to solve the problem.

M
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Jan 04, 2012, 12:51 am
Sorry, but you misunderstood:

to see the topic, that Arduino is not working with the 3.0 Kernel.

It's: the sketch ArduinoISP isn't working, not the entire Arduino.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: maniacbug on Jan 14, 2012, 07:53 am

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)


I suspect avr-gcc here.  4.6.0 is known to have problems, like this one: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45263

EDIT: Er, nevermind.  I just built a whole new 4.6.2-based toolchain, and the problem remains.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: kfreak on Jan 16, 2012, 10:48 pm
Hi,

I hooked up the arduino ISP to a 2 Channel Oscilloscope. Duemilanove board with Uno chip as ISP, and Uno board as target. I had a computer running a 2.6 kernel and arduino 021, and one with ubuntu 11.10 with 3.0 kernel. AVR compiler from repository.

In short my findings:




Arduino ISP (021, 2.6)Arduino ISP (1.0, 3.0)
linux 2.6 control computer, 021
success (0, 1)
fail (6)
linux 3.0 control computer, 1.0
success(2,3)
fail (4,5)



attached are the traces. The number in brackets in the table above correspond to the trace filename. The oscilloscope is an Agilent without an digital capture option. I used the reset as a trigger, channel two is one of the data connections between the boards.

I did not have a close look at the traces yet, but something must go wrong after initial negotiation.

It seems that you need to compile and upload the ISP sketch using 2.6. This can then be used on a 3.0 kernel system. So keep one spare atmega328 as ISP around.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: kfreak on Jan 16, 2012, 10:49 pm
more traces. Seems I forgot to save trace 7, but nothing impressive there.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: madworm on Jan 16, 2012, 11:15 pm
What about 021 on 3.0 ?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: kfreak on Jan 17, 2012, 12:20 am
Getting an

Code: [Select]
avrdude: error while loading shared libraries: libusb-0.1.so.4: wrong ELF class: ELFCLASS64
when trying to copy the ISP. Don't have time to debug this now.

But I remember that I tried with a different version (023?) on 3.0 before and it failed.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: madworm on Jan 17, 2012, 04:10 pm
Well, as others, I still believe it is a compiler / toolchain issue. It would be interesting if you could install a 3.0 kernel on your older 2.6 system (the one with a working toolchain).

If the kernel of an OS actually had an influence on the outcome of a compilation run... that would be hilarious / insane / madness...

I could understand if the actual transmission were broken (serial driver issues).
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: maniacbug on Jan 17, 2012, 04:33 pm

Well, as others, I still believe it is a compiler / toolchain issue. It would be interesting if you could install a 3.0 kernel on your older 2.6 system (the one with a working toolchain).

If the kernel of an OS actually had an influence on the outcome of a compilation run... that would be hilarious / insane / madness...


In fact, we can presume it's a toolchain problem, and that the kernel rev is a red herring.  No evidence has been presented that it has anything to do with the kernel.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: kfreak on Jan 28, 2012, 09:31 am
Hi,

I cannot install a 3.0 kernel on my 2.6 machine without dist-upgrade, which I don't want to do at this moment.

Would it help to post the .hex of the working sketch? Or do you need file versions? I can zip all the avr-relevant files and upload somewhere. (but maybe binary, which would be of little help)

Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Jan 29, 2012, 11:20 pm
I tried a similar test when I used Arch Linux. I installed a kernel from 2.6 branch but got the same errors.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: maniacbug on Feb 03, 2012, 06:15 am
I found a reasonable work-around for this problem.  This now works for me on Ubuntu 11.10 64-bit, where it did not previously, simply by changing the baud rate to 9600. Also it works to change the SERIAL_BUFFER_SIZE to 72 in HardwareSerial.cpp.

It seems that the ISP is hanging in fill() getting a buffer overrun.
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: leo72 on Feb 14, 2012, 05:49 pm
Sorry, but where did you change the serial speed to let the ArduinoISP sketch working?
Title: Re: Linux Kernel 3.0 stopped ArduinoISP working
Post by: maniacbug on Feb 14, 2012, 09:42 pm
Line 69 in https://github.com/rsbohn/ArduinoISP/blob/master/ArduinoISP/ArduinoISP.ino

and

Line 35 in https://github.com/maniacbug/mighty-1284p/blob/master/bootloaders/optiboot/Makefile