Digistump Forums

General Discussion => Official Announcements => Topic started by: digistump on August 21, 2014, 12:03:19 am

Title: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: digistump 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.

Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: gogol 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.

Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: Robert 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[];
                             ^
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: gogol 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.

Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: gogol 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? 
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: gogol on August 29, 2014, 12:23:12 am
Is it working for someone? When yes, which OS, which IDE, which libraries?
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: kehribar 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.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: digistump 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
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: digistump 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
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: mschorer 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)
...

Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: digistump 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
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: mes 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
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: tewarfel 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.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: TimO 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!
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: digistump 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
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: TimO on December 26, 2014, 11:51:29 am
Well, that was odd, because Serial.write obviously wouldn't even compile correctly, let alone fail when uploaded (since it wouldn't ever get that far!).

Changing that one line obviously solves the compiling error, and then it works as expected. <doh>

I'm really not sure what I was doing before, that compiled, uploaded, and then didn't work?!

Oh well, c'est la vie.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: TimO on December 26, 2014, 01:54:45 pm
OK, some of the that confusion was caused by me having the DigiX board selected rather than the Digispark Pro, the Serial.write will work with Digispark Pro, but throws a compiler error with the DigiX.

I'm still getting some slightly odd and unexpected behaviour from SerialUSB, mostly when I try and do anything vaguely complicated (and hence useful), although careful insertion of SerialUSB.delay can sometimes cure that.  It does appear to sometimes be very sensitive to timing though.  I'll start a thread in Digispark Pro Support, where it's probably more appropriate and useful, and post a few working vs non-working examples.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: defragster on December 26, 2014, 10:44:45 pm
I'm just seeing this 'Beta' thread - I saw DigiCDC on another and documented what I saw - 1.5.8B compiles and functions until you try to extend the example.  http://digistump.com/board/index.php/topic,1597 (http://digistump.com/board/index.php/topic,1597)

Work is coming on this for an update.  Hoping a change to underlying USB will fix what I saw on DigiMouse too.

Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: digistump on January 03, 2015, 02:55:00 pm
To clarify: DigiMouse is updated in next release for bug in it - it was unrelated to any CDC bugs.

These CDC bugs are being investigated and there will be some updates in the next release to hopefully solve them.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: mes on February 24, 2015, 03:29:07 pm
The problem I had with CDC in Fedora 20 has been partially rectified with the latest kernel, 3.18.7-100.fc20. The CDC_LED example now works. However, SerialUSB.write does not appear to work. I get the first character of a string, then nothing more.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: Materdaddy on July 15, 2016, 12:39:52 am
Has anybody gotten a digispark talking to linux?

I cannot get this working with a 3.16.0-4-amd64 kernel from debian jessie.  I receive the types of urb errors mentioned by "mes" previously.

Code: [Select]
[2133473.100292] ------------[ cut here ]------------
[2133473.100296] WARNING: CPU: 0 PID: 685 at /build/linux-lqALYs/linux-3.16.7-ckt25/drivers/usb/core/urb.c:450 usb_submit_urb+0x1f0/0x5a0 [usbcore]()
[2133473.100297] usb 2-1: BOGUS urb xfer, pipe 3 != type 1
[2133473.100298] Modules linked in: radio_ma901 videodev media btrfs xor raid6_pq ufs qnx4 hfsplus hfs minix ntfs msdos jfs xfs libcrc32c crc32c_generic cdc_ether binfmt_misc vboxpci(O) vboxnetadp(O) vboxnetflt(O) vboxdrv(O) cdc_acm nfnetlink_queue nfnetlink_log nfnetlink cp210x asix usbnet libphy nls_cp437 vfat fat bnep bluetooth 6lowpan_iphc md4 hmac nls_utf8 cifs rpcsec_gss_krb5 nfsv4 dns_resolver pci_stub nfsd auth_rpcgss oid_registry nfs_acl nfs lockd fscache sunrpc pl2303 usbserial arc4 rt2800pci rt2800mmio rt2800lib rt2x00pci x86_pkg_temp_thermal rt2x00mmio rt2x00lib eeprom_93cx6 mac80211 cfg80211 intel_powerclamp intel_rapl coretemp iTCO_wdt kvm_intel kvm snd_hda_codec_hdmi crc_ccitt crc32_pclmul rfkill snd_hda_codec_realtek snd_hda_codec_generic iTCO_vendor_support snd_hda_intel cryptd i2c_i801
[2133473.100322]  evdev serio_raw pcspkr snd_hda_controller shpchp mei_me mei lpc_ich mfd_core snd_hda_codec snd_hwdep snd_pcm snd_timer snd soundcore tpm_infineon tpm_tis tpm processor wmi fuse parport_pc ppdev lp parport autofs4 hid_belkin hid_generic usbhid hid usb_storage ext4 crc16 mbcache jbd2 dm_mod sg sr_mod sd_mod cdrom crc_t10dif crct10dif_generic crct10dif_pclmul crct10dif_common crc32c_intel psmouse ahci libahci xhci_hcd i915 i2c_algo_bit video libata drm_kms_helper ehci_pci ehci_hcd scsi_mod r8169 drm mii usbcore i2c_core usb_common thermal_sys button [last unloaded: vboxdrv]
[2133473.100342] CPU: 0 PID: 685 Comm: screen Tainted: G        W  O  3.16.0-4-amd64 #1 Debian 3.16.7-ckt25-2
[2133473.100344] Hardware name: Gateway DX4860/IPISB-VR, BIOS P02-A2 10/31/2011
[2133473.100344]  0000000000000000 ffffffff8150e835 ffff8800131c3ae8 0000000000000009
[2133473.100346]  ffffffff810677f7 ffff880527437dc0 ffff8800131c3b38 00000000000000d0
[2133473.100347]  0000000000000003 0000000000000000 ffffffff8106785c ffffffffa0051b78
[2133473.100349] Call Trace:
[2133473.100351]  [<ffffffff8150e835>] ? dump_stack+0x5d/0x78
[2133473.100353]  [<ffffffff810677f7>] ? warn_slowpath_common+0x77/0x90
[2133473.100355]  [<ffffffff8106785c>] ? warn_slowpath_fmt+0x4c/0x50
[2133473.100361]  [<ffffffffa003b816>] ? usb_hcd_submit_urb+0xa6/0xa60 [usbcore]
[2133473.100363]  [<ffffffff813adbcd>] ? rpm_resume+0x40d/0x5d0
[2133473.100370]  [<ffffffffa003d1d0>] ? usb_submit_urb+0x1f0/0x5a0 [usbcore]
[2133473.100372]  [<ffffffffa0a0a147>] ? acm_submit_read_urb+0x37/0x80 [cdc_acm]
[2133473.100374]  [<ffffffffa0a0a1c8>] ? acm_submit_read_urbs+0x38/0x50 [cdc_acm]
[2133473.100376]  [<ffffffffa0a0d087>] ? acm_port_activate+0x127/0x1b3 [cdc_acm]
[2133473.100378]  [<ffffffff813703fe>] ? tty_port_open+0x8e/0xe0
[2133473.100379]  [<ffffffff81366ed6>] ? tty_init_dev+0xb6/0x1e0
[2133473.100381]  [<ffffffff81367ae4>] ? tty_open+0x174/0x5d0
[2133473.100382]  [<ffffffff811acd22>] ? chrdev_open+0xa2/0x180
[2133473.100384]  [<ffffffff811acc80>] ? cdev_put+0x30/0x30
[2133473.100386]  [<ffffffff811a62a2>] ? do_dentry_open+0x1f2/0x330
[2133473.100388]  [<ffffffff811a65ad>] ? finish_open+0x2d/0x40
[2133473.100389]  [<ffffffff811b72ca>] ? do_last+0xaaa/0x1200
[2133473.100390]  [<ffffffff811b38a6>] ? link_path_walk+0x286/0x8a0
[2133473.100392]  [<ffffffff811b7adb>] ? path_openat+0xbb/0x680
[2133473.100394]  [<ffffffff811b884a>] ? do_filp_open+0x3a/0x90
[2133473.100395]  [<ffffffff811c48ac>] ? __alloc_fd+0x7c/0x120
[2133473.100397]  [<ffffffff811a7ae9>] ? do_sys_open+0x129/0x220
[2133473.100399]  [<ffffffff81514a0d>] ? system_call_fast_compare_end+0x10/0x15
[2133473.100409] ---[ end trace f7bb0a9006813c92 ]---

I also cannot get DigiUSB working as it never actually shows up in udev.  When monitoring udev with proper rules set up, I see the device show up for programming (the 5 seconds for the bootloader) and then nothing.  When trying DigiUSB I see errors like this:
Code: [Select]
[2133758.463588] usb 2-1: device descriptor read/64, error -110
[2133758.567414] xhci_hcd 0000:01:00.0: WARN urb submitted to disabled ep
[2133758.567420] xhci_hcd 0000:01:00.0: WARN urb submitted to disabled ep
[2133758.567422] xhci_hcd 0000:01:00.0: WARN urb submitted to disabled ep
[2133758.679523] usb 2-1: device descriptor read/64, error -2
[2133758.895288] usb 2-1: new low-speed USB device number 76 using xhci_hcd
[2133774.002376] usb 2-1: device descriptor read/64, error -110
[2133774.106250] xhci_hcd 0000:01:00.0: WARN urb submitted to disabled ep
[2133774.106255] xhci_hcd 0000:01:00.0: WARN urb submitted to disabled ep
[2133774.106257] xhci_hcd 0000:01:00.0: WARN urb submitted to disabled ep
[2133774.218348] usb 2-1: device descriptor read/64, error -2
[2133774.434136] usb 2-1: new low-speed USB device number 77 using xhci_hcd
[2133774.435533] usb 2-1: Device not responding to setup address.
[2133774.640455] usb 2-1: Device not responding to setup address.
[2133774.842006] usb 2-1: device not accepting address 77, error -71
[2133774.953974] usb 2-1: new low-speed USB device number 78 using xhci_hcd
[2133774.956367] usb 2-1: Device not responding to setup address.
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: jonathanscottjames on August 13, 2016, 01:17:54 pm
since xp deliberately set to reject it from when it's plugged in to installing it's bastardized anti-xp driver  won't work on xp

i think the best way is either buy a pi zero from microcenter for 5$ and install the free win 10 or buy a 20$ laptop from the junk pile in a used computer store and install an eval copy of some douce win sys
Title: Re: Digispark (Pro) CDC (Serial over USB) Beta Library
Post by: mena on July 18, 2019, 03:28:54 am
Great. เกมยิงปลา (https://www.168slotxo.net/slotxo-%e0%b9%80%e0%b8%81%e0%b8%a1%e0%b8%a2%e0%b8%b4%e0%b8%87%e0%b8%9b%e0%b8%a5%e0%b8%b2/)