Author Topic: Digispark (Pro) CDC (Serial over USB) Beta Library  (Read 33242 times)

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Digispark (Pro) CDC (Serial over USB) Beta Library
« on: August 21, 2014, 12:03:19 am »
Attached is the Beta release of the long awaited CDC library for the Digispark and Digispark Pro.

Feedback is welcome, but we are not yet providing full support for this, so please be patient with any issues.

To Use: Install the DigiCDC folder (inside the zip) in your Arduino libraries folder.

The download includes SIGNED drivers that are required for windows - please let us know if they work for you. Running Install Drivers.bat in the DigiCDC Driver folder should bring up a wizard to install the drivers. Windows users can also run the ChangeCDCSpeed.vbs script to improve the reliability of the communications.


gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #1 on: August 23, 2014, 09:09:31 am »
I tried the example on two systems:  Win7 x64 and x32 just with the same result: The driver installs without any problems, After loading the echo example the COM ports gets immediatley detected.  However I am not able to see any communication!

I tried both settings for the CDC: reliable and fast. I configured the terminal program between 9600 and 57600 nothing changed.  As far as I know, the baud rate of the terminal program has no influence to CDC communications.

Any hints?  I will try it on my linux boxes as well later.


Robert

  • Newbie
  • *
  • Posts: 2
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #2 on: August 25, 2014, 08:03:19 pm »
Hi,

I am probably doing something wrong but trying this on a surface pro. The drivers seemed to install just fine but when I try to run echo, I get the following when compiling:

In file included from C:\Users\Robert\Desktop\arduino-nightly-windows\arduino-nightly\libraries\DigiCDC/DigiCDC.h:11:0,
                 from Echo.ino:1:
C:\Users\Robert\Desktop\arduino-nightly-windows\arduino-nightly\libraries\DigiCDC/usbdrv.h:519:29: error: variable 'usbDescriptorHidReport' must be const in order to be put into read-only section by means of '__attribute__((progmem))'
 char usbDescriptorHidReport[];
                             ^

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #3 on: August 26, 2014, 12:15:05 am »
Same with me, so I went to my 1.05 setup. Forgot to mention that.

As my PRO is still unreliable with too weak USB signals (http://digistump.com/board/index.php/topic,1455.0.html)  I tried that library with my original digispark. So there is no need for the 1.5.7.


gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #4 on: August 28, 2014, 06:23:20 am »
I tried the echo example now also on Linux (Ubuntu 14.04 LTS) in both 32 and 64 bit:
Same things as with windows:  The serial port is immediately detected, however no communication possible. I tried screen, minicom and putty as terminal program.

Can it be, that it is dependent ob some other libraries, whoch are not up to date?
As I wrote before, I compile the example from my 1.05-IDE, as it is not compiling with the 1.5.7.

I really wonder about this beta phase. Seems really dead. No informations about micronucleus changes, no reaction on my questions about weak USB signals.

Is someone else trying the CDC-lib? 

gogol

  • Sr. Member
  • ****
  • Posts: 398
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #5 on: August 29, 2014, 12:23:12 am »
Is it working for someone? When yes, which OS, which IDE, which libraries?

kehribar

  • Newbie
  • *
  • Posts: 18
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #6 on: August 29, 2014, 01:06:03 am »
Hi All,

I've downloaded the IDE from this link: http://sourceforge.net/projects/digistump/files/DigisparkArduino-Win32-1.0.4-May19.zip/download After fresh install I copied the library to the appropriate folder. My OS is 32 bit Win7 and I can confirm that Echo example is working with the original Digispark.

I also downloaded the library and drivers from the Erik's attachment.

Best,
ihsan.

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #7 on: September 03, 2014, 01:31:23 am »
This should work on anything 1.5.x pre 1.5.7 - the issue isn't the library its the update to Arduino which switched to a newer version of GCC - the issue affects all of the Digispark Pro USB libraries

A fixed version will be out tomorrow

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #8 on: September 04, 2014, 12:18:33 am »
A new Digistump Arduino Addons is now ready for download: https://sourceforge.net/projects/digistump/files/Digistump1.5Addons-v091.zip/download

This fixes the libraries including DigiCDC for 1.5.7 - it also includes signed windows drivers for windows 2000-8.1 x86 and x64 for all Digistump devices (Digispark, Pro, DigiX, DigiUSB, DigiCDC)

Wiki page for the pro has been updated to reflect that nightly version of the IDE is no longer needed, 1.5.7 or better will work: http://digistump.com/wiki/digispark/tutorials/connectingpro

Mac and Linux packages have not been updated yet - just download the updated windows one and copy over the older Mac and Linux files.

Please let me know if anyone is still having issues with this library.

Thanks,
Erik

mschorer

  • Newbie
  • *
  • Posts: 8
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #9 on: September 07, 2014, 11:49:07 pm »
with v0.91 I keep getting an error when compiling (even blink!) for the digispark:
Code: [Select]
Build options changed, rebuilding all
In file included from C:\dev\arduino-1.5.7\hardware\digistump\avr\cores\tiny\WConstants.h:1:0,
                 from C:\dev\arduino-1.5.7\hardware\digistump\avr\cores\tiny\WInterrupts.c:36:
/arduino-1.5.7/hardware/tools/avr/avr/include/math.h:426:15: error: expected identifier or '(' before 'double'
 extern double round (double __x) __ATTR_CONST__;
               ^
C:\dev\arduino-1.5.7\hardware\digistump\avr\cores\tiny\wiring.h:136:22: error: expected ')' before '>=' token
 #define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

after commenting out line 136 in wiring.h, i can compile:
Code: [Select]
...
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
//#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD)
...


digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #10 on: September 08, 2014, 11:36:19 am »
Looks like we had a few more changes to get the original Digispark to work with the new version of AVR GCC - those errors are now fixed: http://sourceforge.net/projects/digistump/files/Digistump1.5Addons-v092.zip/download

mes

  • Newbie
  • *
  • Posts: 9
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #11 on: December 06, 2014, 07:28:16 pm »
I cannot get DigiCDC to work on Linux. I have successfully compiled and loaded the DigiCDC Echo program, but there is no response in the serial monitor. However, it does work on a 32bit Windows machine using the program that was loaded on the Linux machine. It appears that libusb on the Linux machine is not playing nicely with the Digispark Pro. dmesg shows that there traceback from the kernel. Here is part of the dump


[
Code: [Select]
16261.605497] WARNING: CPU: 1 PID: 1057 at drivers/usb/core/urb.c:450 usb_submit_urb+0x1fd/0x5c0()
[16261.605500] usb 2-1: BOGUS urb xfer, pipe 3 != type 1
[16261.605502] Modules linked in: cdc_acm fuse ip6t_rpfilter cfg80211 rfkill ip6t_REJECT xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle iptable_security iptable_raw nvidia(POE) snd_hda_codec_idt snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel snd_hda_controller snd_hda_codec snd_hwdep snd_seq nv_tco snd_seq_device snd_pcm snd_timer snd soundcore drm powernow_k8 kvm_amd kvm i2c_nforce2 i2c_core edac_core dcdbas shpchp serio_raw edac_mce_amd k8temp nfsd auth_rpcgss nfs_acl lockd sunrpc uas usb_storage b44 mii ata_generic ssb pata_acpi mmc_core
[16261.605554]  sata_nv
[16261.605559] CPU: 1 PID: 1057 Comm: in:imjournal Tainted: P        W  OE 3.16.7-200.fc20.x86_64 #1
.
.
.
[16261.605702] ---[ end trace 06facd733a5b8e65 ]---
[20603.314924] perf interrupt took too long (2511 > 2500), lowering kernel.perf_event_max_sample_rate to 50000


Here is my configuration:
Fedora 20 Linux
libusb 0.1.5
libusbx 1.0.19

tewarfel

  • Newbie
  • *
  • Posts: 2
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #12 on: December 18, 2014, 05:19:54 pm »
A few comments:
I have successfully gotten both the DigiCDC (serial port) "echo" and DigiUSB "echo" examples to work with the DigiSpark Pro on a Mac running OSX 10.9 (Mavericks). 
Of note:
 1) I needed to install Xcode and its command line tools, then install the homebrew package manager, then "brew install libusb libusb-compat"
 2) I've used both the Arduino 1.5.8 (as well as built the 1.6.x from source)
 2) I used the "Digistump1.5Addons-v09Mac.zip package and put the "hardware" folder in ~/Documents/Arduino/ per the instructions.
 3) The DigiCDC app compiled without complaint.  I hit the "upload" button, then plugged the device into a USB 2.0 hub plugged into my iMac.  I could then see the device appear on the Arduino Tools -> Port menu as both /dev/tty.usbmodem141111 and as /dev/cu.usbmodem141111   Connecting as the tty device, I could type a line of characters, hit "send" and see them echo back to me.

 4) The DigiUSB examples needed some editing:
    I needed to add a "const" before several of the arrays in ~/Documents/Arduino/hardware/avr/libraries/DigiUSB/usbdrv.c so that the declaration in usbdrv.h matched what was in usbdrv.c, e.g.   changing  "PROGMEM char usbDescriptorString0[] " to "PROGMEM const char usbDescriptorString0[]", etc.  The error messages in the IDE at compile time give you the line numbers to change.

   I also needed to comment out the following lines in  ~/Documents/Arduino/hardware/avr/libraries/DigiUSB/DigiUSB.cpp
 #if F_CPU != 16500000L
  #error "You must use Digispark (Tiny Core) board to use USB libraries"
#endif

Those lines were a holdover from the original DigiSpark.

On the Mac side, the DigiUSB device is not immediately visible.  There was an old program provided in the DigisparkArduino-MacOSX-1.0.4-May19 package under DigiUSB Programs/source/monitor called digiusb.cpp.  Using the current libusb-compat installed by homebrew I can build it with:
   g++ -I/usr/local/Cellar/libusb-compat/0.1.5/include  /usr/local/lib/libusb-0.1.4.dylib  -lncurses -O -g -D MAC_OS -D_DARWIN_USE_64_BIT_INODE=1 -o digiusb digiusb.cpp

The text of digiusb.cpp on the host side is at:
  http://sourceforge.net/projects/digistump/files/DigisparkArduino-MacOSX-1.0.4-May19.zip
in DigiUSB Programs/source/monitor/digiusb.cpp

This builds and runs, and also does simple character echo back to the screen what I type (and hit return) for.

The other DigiUSB-based examples require similar minor patching to run with the current gcc-avr compiler included in Arduino.

I hope this is of some help to the other folks here who were commenting about difficulties getting the examples to run.

TimO

  • Newbie
  • *
  • Posts: 36
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #13 on: December 21, 2014, 09:40:51 am »
Is there any informative documentation on using the Serial CDC?  With the current (1.5.8B) Windows Arduino IDE installation, it appears to work with example code, but I can't get much beyond that.

I've got the Echo example working, but whenever I do something significantly different to that, it doesn't seem to work.

I presume that somewhere there is something that explains what the limitations of the V-USB CDC serial functions are, but I haven't managed to Google it.

Even a simple program to just display character every seconds won't work.

Code: [Select]
#include <DigiCDC.h>

void setup()
{               
  SerialUSB.begin();
}

void loop()
{
  Serial.write(65);
  SerialUSB.delay(1000);
}

That complies and uploads correctly. and the serial port appears, but if I connect to it using either the IDE's Serial Monitor, or Putty, nothing appears.  It's the sort of thing which would be very useful for sending debugging or informative information over the virtual serial link.

I suspect I've got a fundamental misunderstanding of how the Serial CDC works, but I'm damned if I know what it is!

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Digispark (Pro) CDC (Serial over USB) Beta Library
« Reply #14 on: December 21, 2014, 02:18:29 pm »
There are some bugs we are working on with performance/loss of connection but in your examples

Serial.write(65);

would write to the serial port not the USB CDC port

you'd need:

SerialUSB.write(65); to do that

Serial = serial port on pin 6 and 7
SerialUSB = USB CDC driver