1

I would like to store an application's configuration in a file stored on the Circuit Playground Express (CPX) flash. The application itself needs to be able to update the configuration file. Things I need to store are basic, for example:

  • NeoPixel brightness (eg. brightness = 0.9)
  • NeoPixels on/off (eg. NP_enable = [0,0,1,0,1,0,1,1,1,1]

ArduinoJason seems appropriate, but I cannot even get to the point of writing files to the CPX. The TinyUSB libraries are supposed to give the ability to write to the CPX SPI Flash, but I cannot get any of the examples included with this library to compile. I am trying to compile the msc_external_flash example provided with the TinyUSB library. I get the following 2 errors:

In file included from /home/pi/Arduino/libraries/Adafruit_TinyUSB_Library/examples/MassStorage/msc_external_flash/msc_external_flash.ino:28:0:
/home/pi/Arduino/libraries/Adafruit_TinyUSB_Library/src/Adafruit_TinyUSB.h:31:2: error: #error TinyUSB is not selected, please select it in "Tools->Menu->USB Stack"
#error TinyUSB is not selected, please select it in "Tools->Menu->USB Stack"
^~~~~
msc_external_flash:65:6: error: #error No QSPI/SPI flash are defined on your board variant.h !
#error No QSPI/SPI flash are defined on your board variant.h !
^~~~~

The board selected is SAMD-->Circuit Playground Express. There is no Tools menu item for selecting the USB stack.

Regarding the second error, From msc_external_flash.ino:

  #if defined(EXTERNAL_FLASH_USE_QSPI)
    Adafruit_FlashTransport_QSPI flashTransport;
  #elif defined(EXTERNAL_FLASH_USE_SPI)
    Adafruit_FlashTransport_SPI flashTransport(EXTERNAL_FLASH_USE_CS, EXTERNAL_FLASH_USE_SPI);
  #else
    #error No QSPI/SPI flash are defined on your board variant.h !
  #endif

of the files named variant.h, this looks like the best candidate: /home/pi/.arduino15/packages/arduino/hardware/samd/1.8.12/variants/circuitplay/variant.h

but the file does not contain the string "EXTERNAL_FLASH", nor anything I see that is CPX specific.

Arduino version is 1.8.19, which I am running on a Raspberry Pi 3 B+ running Buster.

Thanks, Scott

5
  • please describe the problem and ask a question ... this site is not a forum
    – jsotola
    Commented Feb 23, 2022 at 0:20
  • ArduinoJson has an example that reads a configuration file from the SD card. See JsonConfigFile.ino. You can easily adapt it for any other filesystem, such as SPIFFS and LittleFS. Commented Feb 23, 2022 at 7:27
  • install the Adafruit SAMD core. it looks like you are using the Arduino SAMD core, which has only basic support for the Adaruit board
    – Juraj
    Commented Mar 5, 2022 at 6:13
  • The board selected is SAMD-->Circuit Playground Express. I can run other CPX examples, like IRNeoPixels, I assume I have the Adafruit SAMD core. Commented Mar 7, 2022 at 15:42
  • yes but you can't compile Adafruit specialties with the Arduino SAMD core
    – Juraj
    Commented Mar 8, 2022 at 5:30

1 Answer 1

3

The problem was using the Arduino SAMD board core instead of the Adafruit SAMD board core. The Adafruit SAMD board core is not visible unless you add: https://adafruit.github.io/arduino-board-index/package_adafruit_index.json

to the "Additional Boards Manager URLs:" field of the Arduino IDE preferences panel.

Once you do that... Then install the "Adafruit SAMD Boards" from the Arduino IDE Boards Manager. Then select the menu item: Tools --> Board: --> Adafruit SAMD (32-bits ARM Cortext-M0+ and Cortext-M4) boards --> Adafruit Circuit Playground Express (SAMD21)

I have not seen this procedure in any Adafruit documentation.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.