PlatformIO Community

Adafruit circuit playground fails to compile

Hello,
I’m trying to use platformio instead of arduino to work with the Adafruit Circuit Playground Classic board.
I’m using the Atmel AVR platform (1.15.0) in the arduino framework and I’ve installed the Adafruit Circuit Playground library (1.9.0),
Even with an empty project:

#include <Arduino.h>
// Let's include the Adafruit CP library
#include <Adafruit_CircuitPlayground.h>
// This function will be executed only once at startup   
void setup() {
} 
// This function will be executed repeatedly with no pause between the calls 
void loop() {   
}

When I compile, I get the following error:

> Executing task: platformio run <

Processing circuitplay_classic (platform: atmelavr; board: circuitplay_classic; framework: arduino)
---------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/circuitplay_classic.html
PLATFORM: Atmel AVR 1.15.0 > Adafruit Circuit Playground Classic
HARDWARE: ATMEGA32U4 8MHz, 2.50KB RAM, 28KB Flash
PACKAGES: toolchain-atmelavr 1.50400.190710 (5.4.0), framework-arduinoavr 4.1.2
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Adafruit Circuit Playground> 1.9.0
|   |-- <HID> 1.0
|   |-- <SPI> 1.0
|   |-- <Wire> 1.0
Compiling .pio/build/circuitplay_classic/src/main.cpp.o
Compiling .pio/build/circuitplay_classic/lib421/Adafruit Circuit Playground_ID602/utility/IRLibRecvPCI.cpp.o
/Users/andreavaccari/.platformio/lib/Adafruit Circuit Playground_ID602/utility/IRLibRecvPCI.cpp: In constructor 'IRrecvPCI::IRrecvPCI(uint8_t)':
/Users/andreavaccari/.platformio/lib/Adafruit Circuit Playground_ID602/utility/IRLibRecvPCI.cpp:32:36: error: 'digitalPinToInterrupt' was not declared in this scope
   intrNum=digitalPinToInterrupt(pin);
                                    ^
Compiling .pio/build/circuitplay_classic/FrameworkArduino/wiring_digital.c.o
Compiling .pio/build/circuitplay_classic/FrameworkArduino/wiring_pulse.S.o
*** [.pio/build/circuitplay_classic/lib421/Adafruit Circuit Playground_ID602/utility/IRLibRecvPCI.cpp.o] Error 1
============================================ [FAILED] Took 2.09 seconds ============================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

The same code and library level within the official Arduino IDE compiles.

Any suggestion?

How did you manage to get it installed on the Arduino IDE? Adafruit’s board support package doesn’t have any listing for the Playground Classic for some reason

As far as the error, it’s because digitalPinToInterrupt is not defined in the circuitplay32u4 pins_arduino.h board support variants, hence missing when IRLibRecvPCI the utility library compiled. It looks like PlatformIO’s variants file is an old one, and has stuff missing.

Short term workaround - Replace your /Users/andreavaccari/.platformio/packages/framework-arduinoavr/variants/circuitplay32u4/pins_arduino.h with this one (or copy and paste the contents). Can you let me know the results - it compiles fine for me. If it works for you, I’ll submit a PR so it can be included in the next atmelavr platform update.

I can confirm it does compile for the Playground Classic on Arduino 1.8.10 with the latest board libraries loaded as of 20191009 without fail.

However it does fail to compile on Platform.IO out of box with every library version from 1.9.1 all the way down to 1.6.10. I stopped testing lower versions because the amount of red lines for build failures grew with ever version tried.

I didn’t try the recommended solution, but I’ll give that a go now.

I tried replacing the contents of pins_arduino.h with the linked version and a build with 1.9.1 succeeded on Platform.IO.

I took a peek at the diff between the two files and there is a huge number of lines different between the two. I’ll be getting the Express version of the Circuit Playground so I’ll be testing another build using this file version as well as the out of box installed version to see if its just a Classic problem.

1 Like

Thanks for that. It looks like the the PlatformIO Express Circuit Playground variant packages was updated in June, and Adafruit last updated it in April, so it should be up to date. It’s only the Classic version that wasn’t updated, and just lucked out… the last modification by Adafruit was onon May 13, 2016, and the PlatformIO version seems to be from March 20, 2016 :smiley: :smiley:

Edit: I just spotted this issue on the framework-arduinoavr issue tracker, confirming that the pins_arduino.h update seems to work.

Thanks everyone! and sorry for the late reply. The short term workaround worked for me as well.

RE: how did I get it installed on Arduino IDE, I searched for “Circuit Playground” in the library manager.

Great :slight_smile:

I actually meant the board support package… I’m guessing you have to install it manually as it doesn’t appear to have a board manager package link…

Somehow the Adafruit Circuit Playground Classic is tucked under the “Arduino AVR boards”:

1 Like

ah… that makes… (no) sense… :laughing:

Didn’t realise that the Adafruit Circuit Playground had been added to the Arduino AVR boards package… probably added as part of the partnership deal when Adafruit started manufacturing boards for Arduino.

Thanks! :slightly_smiling_face: