Author Topic: Upload issue Linux  (Read 9873 times)

illwill

  • Newbie
  • *
  • Posts: 8
Upload issue Linux
« on: January 14, 2013, 04:38:34 pm »
Finally got the IDE working but when I try to upload the sketch , it prompts me to plug in and it gets to 70% and fails. Tried 2 different digistumps and both are the same

erasing: 79% complete
>> Abort mission! -1 error has occured ...
>> Please unplug the device and restart the program.
« Last Edit: January 14, 2013, 04:38:34 pm by illwill »

Bluebie

  • Sr. Member
  • ****
  • Posts: 486
Upload issue Linux
« Reply #1 on: January 14, 2013, 06:02:57 pm »
That kind of error happens because the computer has crashed the USB link during the upload by trying to send USB requests to the device while it was accepting a program upload. Make sure you quit the Digispark arduino software completely and don\'t have any other digispark related software running, then open a terminal and run \'sudo killall -9 micronucleus\' then try reopening the software, do an upload, plug in the spark, and see if that helps. My suspicion is there is some other digispark related software running in the background interfering with the upload.

If this doesn\'t help, try unplugging as many other USB devices as you can during the upload, and don\'t unplug or plug anything in during the upload.

Can you post the entire upload log? Particularly just after the connecting section, I\'d like to see these lines:

> Device looks like ATtiny85!
> Available space for user application: 6010 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94
> Erase function sleep duration: 752ms

If it doesn\'t say that precisely, there maybe an earlier communications error and my advice above maybe not helpful. If it says exactly that and is getting in to the erasing section I expect the device and usb port are fine.

Another thing which could possibly cause this crashing are variances in clock speed due to extreme temperature changes during upload, if you\'re exposing the digispark to a computer exhaust fan or taking it from a chilled or very hot environment. Another thing which might cause issue is if the power supply from your computer is not very regular - you could try connecting it through a powered usb hub to check this.
« Last Edit: January 14, 2013, 06:03:07 pm by Bluebie »

illwill

  • Newbie
  • *
  • Posts: 8
Upload issue Linux
« Reply #2 on: January 16, 2013, 05:14:32 pm »
this was just booting up into ubuntu and warm inside

Binary sketch size: 756 bytes (of a 6,010 byte maximum)
Running Digispark Uploader...
Plug in device now...
> Please plug in the device ...
> Press CTRL+C to terminate the program.
> Device is found!
connecting: 20% complete
connecting: 23% complete
connecting: 27% complete
connecting: 30% complete
connecting: 34% complete
connecting: 40% complete
> Device looks like ATtiny85!
> Available space for user application: 6010 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94
> Erase function sleep duration: 752ms
parsing: 40% complete
parsing: 60% complete
> Erasing the memory ...
erasing: 60% complete
erasing: 60% complete
############################REMOVED A BUNCH###########################
erasing: 79% complete
erasing: 79% complete
>> Abort mission! -1 error has occured ...
>> Please unplug the device and restart the program.
« Last Edit: January 16, 2013, 05:15:00 pm by illwill »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Upload issue Linux
« Reply #3 on: January 16, 2013, 05:20:30 pm »
Have you tired the various items in the troubleshooting section on the wiki - using rear ports if desktop, trying different ports, extension cable or hub, etc?

ryneches

  • Newbie
  • *
  • Posts: 1
Upload issue Linux
« Reply #4 on: January 19, 2013, 10:32:19 pm »
Hmm. I seem to be getting this problem too :

[russell@peregrin arduino-1.0.3 ]$ ./arduino
Experimental:  JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
Binary sketch size: 756 bytes (of a 6,010 byte maximum)
Running Digispark Uploader...
Plug in device now...
> Please plug in the device ...
> Press CTRL+C to terminate the program.
> Device is found!
connecting: 40% complete
> Device looks like ATtiny85!
> Available space for user application: 6010 bytes
> Suggested sleep time between sending pages: 8ms
> Whole page count: 94
> Erase function sleep duration: 752ms
parsing: 60% complete
> Erasing the memory ...
erasing: 79% complete
>> Abort mission! -1 error has occured ...
>> Please unplug the device and restart the program.



dhylands

  • Newbie
  • *
  • Posts: 5
Upload issue Linux
« Reply #5 on: January 19, 2013, 11:20:24 pm »
I ran into this particular issue and came up with 3 different ways of resolving it.
I think that the problem is caused by an interaction with Virtual Box and libusb.

I added the udev rules file. I then decided to check the permissions on the USB device nodes.

So I ran lsusb, which produces a bunch of output. This line corresponds to the digispark:

Bus 001 Device 076: ID 16d0:0753 GrauTec

Note: with my brand new never programmed digispark, it would only show up in lsusb for 5 seconds. Once I was able to program it once, then it stays around as long as the DigiSpark is plugged in.

So I did:

find /dev -name 076 -ls

(the 076 part will change each time you plug the DigiSpark in). What I saw as output from the find command was this:

10367836    0 crw-rw----   1 root     vboxusers          Jan 19 22:57 /dev/vboxusb/001/076
10367827    0 crw-rw-rw-   1 root     root              Jan 19 22:57 /dev/bus/usb/001/076

So the /dev/bus/usb/001/076 gets its permisions set from the udev rules on the troubleshooting page.

Solution 1: I ran arduino as root (sudo arduino) and then it was able to program my DigiSpark fine.

Solution 2: Given that running as root worked, I surmised that libusb was picking the wrong node and using it or something. I discovered that /etc/udev/rules.d contained a 10-vboxdrv.rules, and one of the lines was:

SUBSYSTEM==\"usb\", ACTION==\"add\", ENV{DEVTYPE}==\"usb_device\", RUN+=\"/usr/share/virtualbox/VBoxCreateUSBNode.sh $major $minor $attr{bDeviceClass}\"

So I took a look in the /usr/share/virtualbox/VBoxCreateUSBNode.sh script, and sure enough, it has a line:

mknod \"$devpath\" c $1 $2 -m 0660 2>/dev/null

I changed the 0660 to 0666 and then ran arduino as a normal user, and I was able to program my DigiSpark. Reseting the 0666 back to 660 and I got the error again.

Solution 3: (not for the faint of heart). You can screw things up if something goes wrong, and don\'t expect me to know how to fix it - you\'re on your own. I downloaded the latest libusb from sourceforge, built it and installed it, and that also allowed arduino to run as non-root and program succsessfully. Reverting to the original libusb and I get the error back.

Here\'s what I did to dowload and install libusb. My machine is setup for development (I\'m a software developer), so you may need to install additional packages to get these steps to work.

wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2
tar xf libusb-1.0.9.tar.bz2
cd libusb-1.0.9
./configure
make
sudo make install
cd ..
wget http://sourceforge.net/projects/libusb/files/libusb-compat-0.1/libusb-compat-0.1.4/libusb-compat-0.1.4.tar.bz2
tar xf libusb-compat-0.1.4.tar.bz2
cd libusb-compat-0.1.4
./configure
make
sudo make install

This will install some files into /usr/local/lib
The ones with the system (I\'m running 64-bit ubuntu) are in /lib/x86_64-linux-gnu

So I made a backup:
cd /lib/x86_64-linux-gnu
sudo mkdir libusb-orig
sudo mv libusb*.so* libusb-orig

and copied the ones from /usr/local/lib:

sudo cp -P /usr/local/lib/libusb*.so* .

and now running arduino as non-root and the programming work perfectly.

You can revert back to the original libs:

sudo rm libusb*.so*
sudo cp -P libusb-orig/* .

Dave Hylands

dhylands

  • Newbie
  • *
  • Posts: 5
Upload issue Linux
« Reply #6 on: January 19, 2013, 11:39:18 pm »
And go figure, after writing all of the above, now I can\'t get anything to upload properly - Sigh.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Upload issue Linux
« Reply #7 on: January 20, 2013, 01:19:03 am »
@ryneches and @dhylands - are you trying with nothing plugged into the Digispark (no shields or anything - at least for testing if it works)?

@ryneches - have you tried running it as root, and the other items in the troubleshooting section?

dhylands

  • Newbie
  • *
  • Posts: 5
Upload issue Linux
« Reply #8 on: January 20, 2013, 10:32:15 am »
I have a bare digispark.

I\'m using a ZaReason laptop running Linux Mint 14.

I can get it to work sometimes, and not others (both as root and as a regular user). I will try moving to a different USB port and I\'ll also try powered and unpowered hubs.

I saved off a couple of the .hex files and tried programming directly from the command line (using avrdude). Sometimes, while doing the command line version, I was able to just leave the DigiSpark plugged in and redo the avrdude command and it would work the second time.

I had to file the edges of the digispark slightly to get it to fit when plugging directly into my laptop, but it plugs in fine when using a USB extension cable.

dhylands

  • Newbie
  • *
  • Posts: 5
Upload issue Linux
« Reply #9 on: January 20, 2013, 10:53:40 am »
I also observed that often times, if I plug in the digispark directly that it doesn\'t get recognized. It  gets powered always, but won\'t always show up in lsusb.

Using an extension cable makes it get recognized (shows up in lsusb) much more reliably.

dhylands

  • Newbie
  • *
  • Posts: 5
Upload issue Linux
« Reply #10 on: January 20, 2013, 11:53:38 am »
I figured out the problem with it not working when plugged in directly.

I took a couple of pictures here:
https://picasaweb.google.com/115853040635737241756/DigiSpark?authkey=Gv1sRgCIeD_cvi3ubaLQ

The laptop case, combined with the sholders on the digispark causes the digispark to not seat fully, so the D+/D- signals just barely (or sometimes not) make contact.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Upload issue Linux
« Reply #11 on: January 20, 2013, 11:55:49 am »
@dhylands - we have made the plug longer for the next revision, thanks for sharing all of your tips and your patience with getting them to work!

DiogoPontes

  • Newbie
  • *
  • Posts: 1
Re: Upload issue Linux
« Reply #12 on: January 29, 2013, 11:30:00 am »
Hi everyone!


I was having the EXACT same problem.


I did what user dhylands did, and it helped to see that the udev rules were being implemented...

However, I still got the "79% erasing / error -1: aborted" error.

So, after getting a (non-powered) usb hub, the problem (so far) went away, and I was able to upload the "Start" script!

Hope this gives some users with the same problem some hope :)

RussNelson

  • Newbie
  • *
  • Posts: 23
Re: Upload issue Linux
« Reply #13 on: January 29, 2013, 05:45:38 pm »
My Compaq laptop using an extension cable has zero success on any of the 3 internal ports, and zero success using an unpowered hub. I have the DS plugged into a USB extension cable for all of these trials, which eliminates any possibility of the problem being too-short pins. The only time I can successfully program it is when I plug it into a 7-port Belkin powered hub.

chut

  • Newbie
  • *
  • Posts: 3
Re: Upload issue Linux
« Reply #14 on: January 30, 2013, 11:41:50 am »
@RussNelson, are you using Linux on the laptop? Here is another thread with some additional tips: http://digistump.com/board/index.php/topic,192.0.html




Does your laptop have USB3? But it seems that the universal linux fix appears to be a powered USB hub. The length issue is a possibility but I had a problem with one of my hub ports where the DS wouldn't plug all the way in, and nothing would happen. Power light on, but the IDE wouldn't find it and it didnt show up in my lsusb or dmesg. So I feel like the failing halfway must be some other type of issue.