In file included from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/Stream.h:24:0,
from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/TinyDebugSerial.h:31,
from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/WProgram.h:18,
from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/arduino.h:4,
from src\main.cpp:2:
C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/Print.h:37:0: warning: "BIN" redefined
#define BIN 2
^
In file included from c:\users\nh5\.platformio\packages\toolchain-atmelavr\avr\include\avr\iotn85.h:38:0, from c:\users\nh5\.platformio\packages\toolchain-atmelavr\avr\include\avr\io.h:428,
from c:\users\nh5\.platformio\packages\toolchain-atmelavr\avr\include\avr\interrupt.h:38,
from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/WProgram.h:8,
from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/arduino.h:4,
from src\main.cpp:2:
c:\users\nh5\.platformio\packages\toolchain-atmelavr\avr\include\avr\iotnx5.h:55:0: note: this is the location of the previous definition
#define BIN 7
^
Archiving .pio\build\digispark-tiny\libFrameworkArduinoVariant.a
In file included from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\cores\dtiny/wiring_private.h:32:0,
Compiling .pio\build\digispark-tiny\FrameworkArduino\TinyDebugSerial.cpp.o
from C:\Users\NH5\.platformio\packages\framework-arduino-avr-digistump\variants\digispark\pins_arduino.c:38:
c:\users\nh5\.platformio\packages\toolchain-atmelavr\avr\include\avr\delay.h:36:2: warning: #warning "This file has been moved to <util/delay.h>." [-Wcpp]
Compiling .pio\build\digispark-tiny\FrameworkArduino\TinyDebugSerial115200.cpp.o
#warning "This file has been moved to <util/delay.h>."
Edit: I’ve tried and get the USB-CDC working with help from DigiSpark compilation failure using CDC library - #2 by maxgerhardt but it doesn’t seem to be working anymore – Windows just reports a USB device error (getting descriptor failed). Maybe you have more luck or insights.
Thanks Norman.
You are right, the delay() is not recommended any more. I use milies(), but when I need to check something and not for “production”, I get lazy and use delay().
I didn’t know there is a delay.h lib, I will search for it.
Now that upload is completed, and my sketch is working. Thanks !
I might have too happy too soon. I installed the drivers and did the first programming, I cant up load any more. When I press (within VS code) upload, I don’t get the “please plug the device” message.
What am I doing wrong?
Only shows up during Verbose Upload I discovered. But the firmware will still upload as normal with “Upload”, just doesn’t show you a message to plug it in.
The upload keeps failing, I changed the leds blink (3 colors) and it is still the same old blink mode.
How do I set the “verbose”? Didn’t find on PlatformIO/VScode.
The error:
Configuring upload protocol…
AVAILABLE: micronucleus
CURRENT: upload_protocol = micronucleus
Uploading .pio\build\digispark-tiny\firmware.hex
> Please plug in the device …
> Press CTRL+C to terminate the program.
> Device search timed out
*** [upload] Error 1
Seems like it couldn’t find the USB device or the driver is screwing up. There’s a timeout of 60 seconds. Have you unplugged the device before the upload and then plugged it in?
You can also open the Windows device manager. If you plug the device in (and the drivers are installed), you must see
Thanks for the verbose guidance. I can see it now.
As for the driver - you are probably right - when I plug it, it is recognized as “unknown USB device”. I tried re-installing the drivers , re-boot - so far no luck.
I followed the video (exactly as I did before), and I still get the same (A request for the USB device descriptor failed.).
Perhaps the bootloader within the Attiny is somehow damaged? The part that is communicating with the Windows USB when plugged in?
Problem (partially) solved.
It looks like I did the basic mistake of wrong assumptions - I added an ultrasonic sensor, using pins 4 as Echo (input) and 5 as trig (output). Looking at the datasheet, pin 4 is USB- and 3 is USB+. So probably pin 4, driven by the sensor, corrupts the USB connection. Once removing it, the driver is working well, and I can program it properly.
Perhaps I need to get used to programming the Attiny with external socket. if I need the pins, or make sure pins 3’4 will not drive any value for start (put a delay in setup?)
I think having the ultrasonic sensor attached alone to the board has caused this. The sensor will need extra current at startup and might be pulling the supply low, or the input pin of the sensor has some pull-down/pull-up logic which messes with the criticial USB- line which has some pullup/down network attached to it (see https://s3.amazonaws.com/digispark/DigisparkSchematicFinal.pdf on USB_M signal). If that’s the case then a delay will also not help because it doesn’t alter that the USB- line is loaded electrically differently now.
Re-allocating to a different pin or unplugging it before a new upload should solve it.
Because of these warnings and the fact that there is no EEPROM library coming with the digistump package I switched the core package to (native?) tiny. If you are interested you can have a look at the work in progress project at IoT-Universal-Socket-Strip/software/relay at master · anno73/IoT-Universal-Socket-Strip · GitHub. So far everything went well aslong you take care of some things (like already mentioned using USB lines for your purpose).
I’m using the Digispark ATTiny85 but have an issue with the drivers.
Here’s what I see in PlatformIO
Building in release mode
Checking size .pio\build\attiny85\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 1.8% (used 9 bytes from 512 bytes)
Flash: [= ] 5.7% (used 464 bytes from 8192 bytes)
Configuring upload protocol...
AVAILABLE: micronucleus
CURRENT: upload_protocol = micronucleus
Uploading .pio\build\attiny85\firmware.hex
*** [upload] Error 3221225781
You can see that the message Please plug in the device... is missing
Going to the device manager I don’t see any unknown device under Other devices
How do I make sure any prior drivers are removed and how do I install the correct drivers for the ATTiny85? Could it be that the bootloader is missing on the ATTiny85?
This status code is STATUS_DLL_NOT_FOUND tells you that the uploader executable couldn’t even execute because you’re missing DLLs it needs.
You can use http://dependencywalker.com/ to try and detect what DLLs it needs and which one you don’t have. It may be something like Visual C/C++ redistributables.
Or well, just locating the micronucleus.exe executable in C:\Users\<user>\.platformio\packages\tool-micronucleus and running it should also tell you what it needs, in my case,