Go Down

Topic: [SOLVED] Digispark Keyboard not working (Read 4035 times) previous topic - next topic

MrMinemeet

Aug 26, 2018, 03:55 pm Last Edit: Aug 27, 2018, 11:09 am by MrMinemeet
Hi,

I try to get my Digispark working agian. I reinstalled the Arduino IDE completly and followed the install guide on their page. http://digistump.com/wiki/digispark/tutorials/connecting

The first example sketch (LED Blink) works fine but when I try the Keyboard example sketch it throws some errors.

Here is the code:
Code: [Select]

#include "DigiKeyboard.h"

void setup() {
  // don't need to set anything up to use DigiKeyboard
}


void loop() {
  // this is generally not necessary but with some older systems it seems to
  // prevent missing the first character after a delay:
  DigiKeyboard.sendKeyStroke(0);
 
  // Type out this string letter by letter on the computer (assumes US-style
  // keyboard)
  DigiKeyboard.println("Hello Digispark!");
 
  // It's better to use DigiKeyboard.delay() over the regular Arduino delay()
  // if doing keyboard stuff because it keeps talking to the computer to make
  // sure the computer knows the keyboard is alive and connected
  DigiKeyboard.delay(5000);
}


and here is the Error:

Quote
Arduino: 1.8.6 (Windows 10), Board: "Digispark (Default - 16.5mhz)"

In file included from c:\users\alex\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\io.h:99:0,

                 from C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbportability.h:121,

                 from C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrvasm.S:19:

C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrv.h:662:33: error: operator '*' has no left operand

 #       define USB_INTR_PENDING GIFR

                                 ^

C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrvasm.S:74:5: note: in expansion of macro 'USB_INTR_PENDING'

 #if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */

     ^

exit status 1
Error compiling for board Digispark (Default - 16.5mhz).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

I tried reinstalling the Board but sadly nothing.
Any ideas what is wrong?

pert

#1
Aug 26, 2018, 04:18 pm Last Edit: Aug 26, 2018, 04:18 pm by pert
This is a bug in the Arduino IDE 1.8.6 or some part of the toolchain that happens with comments and macros on the same line.

The workaround:
  • Open C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrvasm.S in a text editor.
  • Change line 74 from:

Code: [Select]
#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */
to:
Code: [Select]

/* This is an I/O address, use in and out */
#if USB_INTR_PENDING < 0x40

  • Save the file

MrMinemeet

#2
Aug 26, 2018, 05:14 pm Last Edit: Aug 26, 2018, 05:31 pm by MrMinemeet
Doesn't seem to have worked.

Stil this error(more information):
Quote
Arduino: 1.8.6 (Windows 10), Board: "Digispark (Default - 16.5mhz)"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Alex\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Alex\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Alex\Documents\Arduino\libraries -fqbn=digistump:avr:digispark-tiny -ide-version=10806 -build-path C:\Users\Alex\AppData\Local\Temp\arduino_build_851831 -warnings=none -build-cache C:\Users\Alex\AppData\Local\Temp\arduino_cache_245494 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.micronucleus.path=C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\tools\micronucleus\2.0a4 -prefs=runtime.tools.avr-gcc.path=C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5 -verbose C:\Users\Alex\Documents\Arduino\sketch_aug26a\sketch_aug26a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Alex\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Alex\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Alex\Documents\Arduino\libraries -fqbn=digistump:avr:digispark-tiny -ide-version=10806 -build-path C:\Users\Alex\AppData\Local\Temp\arduino_build_851831 -warnings=none -build-cache C:\Users\Alex\AppData\Local\Temp\arduino_cache_245494 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.micronucleus.path=C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\tools\micronucleus\2.0a4 -prefs=runtime.tools.avr-gcc.path=C:\Users\Alex\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5 -verbose C:\Users\Alex\Documents\Arduino\sketch_aug26a\sketch_aug26a.ino
Using board 'digispark-tiny' from platform in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7
Using core 'tiny' from platform in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7
Detecting libraries used...
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10806 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\cores\\tiny" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\variants\\digispark" "C:\\Users\\Alex\\AppData\\Local\\Temp\\arduino_build_851831\\sketch\\sketch_aug26a.ino.cpp" -o nul
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10806 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\cores\\tiny" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\variants\\digispark" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard" "C:\\Users\\Alex\\AppData\\Local\\Temp\\arduino_build_851831\\sketch\\sketch_aug26a.ino.cpp" -o nul
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10806 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\cores\\tiny" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\variants\\digispark" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard" "C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard\\oddebug.c" -o nul
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10806 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\cores\\tiny" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\variants\\digispark" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard" "C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard\\osccal.c" -o nul
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10806 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\cores\\tiny" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\variants\\digispark" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard" "C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard\\usbdrv.c" -o nul
"C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10806 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\cores\\tiny" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\variants\\digispark" "-IC:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard" "C:\\Users\\Alex\\AppData\\Local\\Arduino15\\packages\\digistump\\hardware\\avr\\1.6.7\\libraries\\DigisparkKeyboard\\usbdrvasm.S" -o nul
In file included from c:\users\alex\appdata\local\arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5\avr\include\avr\io.h:99:0,

                 from C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbportability.h:121,

                 from C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrvasm.S:19:

C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrv.h:662:33: error: operator '*' has no left operand

 #       define USB_INTR_PENDING GIFR

                                 ^

C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrvasm.S:75:5: note: in expansion of macro 'USB_INTR_PENDING'

 #if USB_INTR_PENDING < 0x40

     ^

Using library DigisparkKeyboard in folder: C:\Users\Alex\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard (legacy)
exit status 1
Error compiling for board Digispark (Default - 16.5mhz).
Here are the files that might cause the error:
https://pastebin.com/5xWjAiRQ
https://pastebin.com/kRULaeKS

pennsylforniageek

FWIW, I had a very similar issue on Linux and I solved it:

https://forum.arduino.cc/index.php?topic=565616.msg3853561#msg3853561

MrMinemeet

FWIW, I had a very similar issue on Linux and I solved it:

https://forum.arduino.cc/index.php?topic=565616.msg3853561#msg3853561
Yep that was my problem. On my laptop I was using 1.8.6 and on my PC 1.8.5
I guess the latest version is not always the best ;)

oqibidipo

This is not right...

Detecting libraries used...

···

"C:\\Users\\Alex\\···\\avr-gcc\\4.8.1-arduino5/bin/avr-g++"
 -c
 -g
 -Os
 -w
 -fno-exceptions
 -ffunction-sections
 -fdata-sections
 -w
-x c++
 -E
 -CC
 -mmcu=attiny85
 -DF_CPU=16500000L
 -DARDUINO=10806
 -DARDUINO_AVR_DIGISPARK
 -DARDUINO_ARCH_AVR
 "-IC:\\Users\\Alex\\···\\cores\\tiny"
 "-IC:\\Users\\Alex\\···\\variants\\digispark"
 "-IC:\\Users\\Alex\\···\\libraries\\DigisparkKeyboard"
 "C:\\Users\\Alex\\···\\libraries\\DigisparkKeyboard\\usbdrvasm.S"
 -o nul


The library detector is treating an assembly language file as C++ source.
The way processor registers are defined in C/C++ is not valid in assembly.

pert

But here's the same command in the successful compilation using Arduino IDE 1.8.5:
Code: [Select]
"C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.8.1-arduino5/bin/avr-g++" -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections  -w -x c++ -E -CC -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10805 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR  "-IC:\Users\per\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\cores\tiny" "-IC:\Users\per\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\variants\digispark" "-IC:\Users\per\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard" "C:\Users\per\AppData\Local\Arduino15\packages\digistump\hardware\avr\1.6.7\libraries\DigisparkKeyboard\usbdrvasm.S" -o "nul"

oqibidipo

The error was already there, but it was silently ignored.


https://github.com/arduino/arduino-builder/commit/fcc9c5d31d48b428ce4d6f41e019ce02d473e60c
(included in arduino-bulder 1.4.0 which is in IDE 1.8.6)


        Improve error handling in include detection

        For include detection, the preprocessor is run on all source files,
        collecting #included filenames from the stderr output, each of which are
        then resolved to a library to include. A caching mechanism is used to
        only run the preprocessor when needed.

        This commit improves the error handling during include detection in a
        number of ways:

         - When the preprocessor runs succesfully, processing stops for the
           current file. Previously, it would always look at stderr to find a
           missing include filename and only stop if none was found.

         - When the preprocessor fails, but no filename can be found, show the
           error preprocessor error. Previously, it would assume that the
           process was done and stop processing the file without any error.


         - When no library can be found for a missing include, show the stored
           error output instead of running the preprocessor again. Previously,
           the preprocessor would be run a second time, to (re)generate the
           error message.

Go Up