Setting up CircuitPython and Troubleshooting

After assembly, plug your NeoTrellis into a computer (mac/PC/Linux) and look for a new flash drive in the operating system file explorer/finder program. It should be named CIRCUITPY. If you browse the files on this new drive, you'll see a file named boot_out.txt. If you see this, then you should be set. If not, go to troubleshooting below.

CircuitPython

The NeoTrellis M4 Express will be programmed using CircuitPython, the easy to use language on Adafruit's Express products. Are you new to using CircuitPython? No worries, there is a full getting started guide here, although you can start without editing any code.

The code is in text files so you can easily make changes with your favorite text editor. Adafruit suggests using the Mu editor to edit your code and have an interactive REPL in CircuitPython. You can learn about Mu and its installation in this tutorial.

This project requires CircuitPython version 4.0.0 alpha or later which does ship with NeoTrellis. Please do not use an earlier version of CircuitPython or libraries as they will not provide the functionality needed for this project.

Libraries

The code uses several libraries for helper code. Please go to the CircuitPython libraries releases page and download the zip file for CircuitPython 4.x to your computer hard drive. It will have a name similar to adafruit-circuitpython-bundle-4.x-mpy-20181211.zip but the date will most likely be different (as Adafruit adds more features),

Go into the library zip file and copy the following files to your NeoTrellis CIRCUITPY drive into a subdirectory named /lib:

  • Directory adafruit_bus_device
  • Directory adafruit_fancyled
  • adafruit_matrixkeypad.mpy
  • adafruit_trellism4.mpy
  • neopixel.mpy

Troubleshooting

You can use the serial capability in Mu or a serial terminal program to connect to the NeoTrellis M4 to interact with the CircuitPython prompt. You can see error messages, restart the program, etc. If you use a terminal program, set it to the COM port that appears when the device is plugged in. In Windows, Device Manager will show a keyboard when NeoTrellis is plugged in. Right click, Properties, Hardware will show the COM port. Connect at 9600 baud.

Problem: I don't see the CIRCUITPY drive when I plug the NeoTrellis M4 into my computer or I see a drive named TRELM4BOOT instead.

Solution: Ensure CircuitPython is installed via this guide.

Problem: The code does not run.

Solution: Check the files on the CIRCUITPY drive.  /lib should have the latest CircuitPython 4.x libraries and you have placed code.py in the main (root) directory.

Problem: Not enough disk space for all the files.

Solution: If you have files from another NeoTrellis project, you may have to remove some or all of the other project-specific files to load files specific to this project.

If you use your own phrases, you cannot use long stereo clips or songs for each button, there is not enough flash disk space. You can reduce the number of files below 32. You can trim your clips to make them shorter. You should ensure all your clips are mono instead of stereo. 

Problem: My board isn't booting up!

Solution: Make sure your /lib folder is set up with the libraries in the 4.0 latest release and includes adafruit_trellism4.mpy in its contents.

Problem: I'm not hearing any sounds!

Solution: Ensure you have copied the sound files to the appropriate directories: /animal holds the 32 animal ABC files and /electronics holds the 32 "E is for Electronics" book sound files. The files are in GitHub in a ZIP when you download the code.

Ensure you have headphones or powered speakers plugged into the sound output jack and that the volume is set appropriately. If you have put custom sounds on the NeoTrellis, check that all your files are formatted as Mono 16-bit, 22,050Hz, PCM. 

Problem:

AttributeError: 'WaveFile' object has no attribute 'channel_count'

Solution: You should update the NeoTrellis firmware as described in https://learn.adafruit.com/adafruit-neotrellis-m4/circuitpython.

This guide was first published on Dec 11, 2018. It was last updated on Dec 11, 2018. This page (Setting up CircuitPython and Troubleshooting) was last updated on May 10, 2020.