Author Topic: What is the process for downloading code to the digispark?  (Read 4357 times)

MichaelMeissner

  • Full Member
  • ***
  • Posts: 166
What is the process for downloading code to the digispark?
« on: December 04, 2012, 10:50:24 am »
I realize the digistump folk will probably answer this in due time when the digisparks start shipping, but what is the mechanism that will be used to downloading code to the digispark under Linux?  I've heard that avrdude will not be used.  The reason I asked, is I also backed the teensy 3.0 project, and I find I can't download code in my default configurations, and I wanted to be sure what the download path was like on the digispark.

Evidently when you press the reset/programming button on the teensy, it switches the USB type from a CDC modem to a HID device, the Linux kernel creates a /dev/hidraw device, the IDE then unloads the HIDRAW driver and loads its own driver to do the download.  Unfortunately, on my systems, I have other HID devices and Linux refuses to unload the driver.  I can download it on one system, if I unplug the UPS (which is a HID device), but not on the other system which uses HID devices for the keyboard and mouse (PS/2 -> USB adapters, and also bluetooth adapters).  Hopefully, digispark doesn't do the downloads in this fashion.
« Last Edit: December 04, 2012, 10:52:26 am by MichaelMeissner »

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
What is the process for downloading code to the digispark?
« Reply #1 on: December 05, 2012, 08:41:09 pm »
Everything is crossplatform, but the linux install involves a few extra steps right now.

Here\'s the high level for linux:
1) Compile and copy code uploader executable into Arduino sub folder.
2) Compile and copy avrdude dummy program into Arduino sub folder, renaming original avrdude to avrdude_original
3) Copy other provided files into Arduino directory (core files, board files, examples, etc)
4) Select the Digispark in Arduino, hit upload, plug in the Digispark when prompted - enjoy!

How it works:
avrdude dummy program routes any Digispark upload commands to digispark code uploader, send the rest through to avrdude_original

digispark code uploader starts and waits until it detects the connection of the VID/PID of the Digispark

uploads code when it does and then starts running uploaded program which causes the device to appear detached (and reattached as another device if your code uses the USB functions)

I\'m sure 1-3 will be quickly reduced to one step once some different.binaries/packages/installers get worked out for Linux (we\'ll have them for OS X and Win from the start, maybe even some common distros)

MichaelMeissner

  • Full Member
  • ***
  • Posts: 166
What is the process for downloading code to the digispark?
« Reply #2 on: December 06, 2012, 05:32:12 am »
It sounds painful.  Also, you would have to remember to redo the steps if your stock arduino sw is updated (via yum or some such).

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
What is the process for downloading code to the digispark?
« Reply #3 on: December 06, 2012, 01:09:19 pm »
Michael - what part sounds painful? The compiling? I\'m sure someone, if not us, will take care of that quickly with some packages/binaries, but for now it is all just a make command.

Or is it the overwriting files? The easy solution is a separate install for the Digispark - but Arduino doesn\'t update very often and only the avrdude file would need to be replaced when updated.

I guess it would be simpler if we wrapped it into a shell script - would that help? Download script to Arduino folder, run command, good to go?

I\'m certainly all ears for any other suggestions!

Thanks for the feedback

MichaelMeissner

  • Full Member
  • ***
  • Posts: 166
What is the process for downloading code to the digispark?
« Reply #4 on: December 07, 2012, 10:21:32 am »
I was thinking of the update part if you need to replace system files.  The solution is not to install Arduino from the OS repositories, and install it separately.  Depending on the build, this can create some problems with different shared library versions.

However, IMHO, the Arduino tar files that have a 4 year old compiler in them have their own set of problems.  And I\'ve discovered that Fedora has their own twist on avrdude that makes things \'interesting\'.  It took me some amount of time to find all of the appropriate incantations to get avrdude to work on my older Fedora system (the problem is Fedora changed the locking directory).  It gets even worse if you have other non-arduino boards.  Right now, I have an Uno, a Teensy 3.0, and soon a digispark....