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

asked Feb 22, 2022 at 21:02
5
  • please describe the problem and ask a question ... this site is not a forum 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 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 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.

Juraj
18.3k4 gold badges31 silver badges49 bronze badges
answered Mar 15, 2022 at 16:58
1

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.