Here’s how to get it to work.
- edit
/Users/krupagj/.platformio/packages/framework-arduino-avr-digistump/libraries/DigisparkCDC/DigiCDC.cpp
line 211, changechar
intounsigned char
(fixes "narrowing int to [signed] char error) - edit
/Users/krupagj/.platformio/packages/framework-arduino-avr-digistump/libraries/DigisparkCDC/usbdrvasm.asm
and remove or comment out theend
statement - fix your
main.cpp
code by replacing it with this
#include <DigiCDC.h>
extern "C" void setup() {
SerialUSB.begin();
}
extern "C" void loop() {
SerialUSB.println("Hello world");
SerialUSB.delay(1000);
}
- because
setup()
andloop()
need to use C-linkage to be able to be found by thestartup.c
code. also the header file forDigiCDC
does declare the existence of abegin(unsigned long)
function, but it’s not implemented, so calling it will results in afunction not defined
error. (Also, a baudrate for a USB CDC is pointless)
You should then see
Building .pio\build\digispark-tiny\firmware.hex
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [==== ] 43.0% (used 220 bytes from 512 bytes)
Flash: [===== ] 54.1% (used 3252 bytes from 6012 bytes)
There are still however a lot of warnings regarding the re-definition of the BIN
macro (e.g. used in Serial.println(value, BIN);
by the original Atmel device header. So I’m not sure if that’s going to work and you shouldn’t use it probably.
The USB D+ and D- pins seem to be port B pins 4 and 3 if I read DigiCDCDevice::usbBegin()
correctly. Since I don’t have the board I have no idea if it’s going to work.