Cannot load or use adafruit_circuitplayground library with my CPX boards

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
randychs
 
Posts: 2
Joined: Wed Nov 20, 2019 5:43 pm

Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by randychs »

Hey folks, I'm trying to write my first CircuitPython programs, but they are not running as expected. Using https://code.circuitpython.org/, I can run a simple print(‘hello world’) program which displays output in the console. However I cannot seem to use adafruit_circuitplayground library. Running this simple program which just lights up to neopixels:

Code: Select all

SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
SPDX-License-Identifier: MIT
"""This example lights up the first and second NeoPixel, red and blue respectively."""
from adafruit_circuitplayground import cp

cp.pixels.brightness = 0.3

while True:
    cp.pixels[0] = (255, 0, 0)
    cp.pixels[1] = (0, 0, 255)
gives this error:
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 5, in <module>
File "adafruit_circuitplayground/init.py", line 12, in <module>
File "adafruit_circuitplayground/express.py", line 75, in <module>
File "adafruit_circuitplayground/express.py", line 58, in init
File "adafruit_circuitplayground/circuit_playground_base.py", line 98, in init
File "adafruit_lis3dh.py", line 424, in init
File "adafruit_lis3dh.py", line 119, in init
File "adafruit_lis3dh.py", line 162, in data_rate
RuntimeError: maximum recursion depth exceeded

Code done running.
Even just trying to use the adafruit_circuitplayground library from the REPL gives a similar error:

Code: Select all

from adafruit_circuitplayground import cp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_circuitplayground/init.py", line 12, in <module>
File "adafruit_circuitplayground/express.py", line 75, in <module>
File "adafruit_circuitplayground/express.py", line 58, in init
File "adafruit_circuitplayground/circuit_playground_base.py", line 98, in init
File "adafruit_lis3dh.py", line 424, in init
File "adafruit_lis3dh.py", line 110, in init
File "adafruit_lis3dh.py", line 363, in _read_register_byte
RuntimeError: maximum recursion depth exceeded
>>>
I've loaded the most recent stable CircuitPython runtime for the CPX. Here's my boot.txt:
Adafruit CircuitPython 8.1.0 on 2023-05-22; Adafruit CircuitPlayground Express with samd21g18
Board ID:circuitplayground_express
UID:E5D6F93B504352504A312E312A0403FF
Looking at the latest docs: https://docs.circuitpython.org/projects ... stallation, I shouldn't need to load any extra libraries for the above code. Even when I do put the latest adafruit_circuitplayground libs from adafruit-circuitpython-bundle-8.x-mpy-20230527 into the CPX /lib folder, I get the same results.
I also get the same results with the MU editor on my Windows machine.
Here's screenshop of my mounted CPX:
Image

User avatar
mikeysklar
 
Posts: 13979
Joined: Mon Aug 01, 2016 8:10 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by mikeysklar »

Are you running the 3.15 bootloader (bottom right corner of the page).

Can you run this example:

Code: Select all

from adafruit_circuitplayground import cp

while True:
    if cp.button_a:
        print("Temperature:", cp.temperature)
    cp.red_led = cp.button_b

User avatar
lkdl
 
Posts: 3
Joined: Sun May 03, 2020 12:25 am

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by lkdl »

I'm seeing the same error, I get it even from only the import line =(

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by tannewt »

This is likely a combination of CP core changes and the libraries changing. I've filed an issue for it here: https://github.com/adafruit/circuitpython/issues/8053

User avatar
jimk572
 
Posts: 6
Joined: Mon May 01, 2023 11:55 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by jimk572 »

I have the same problem with my CPX. It has been acknowledged that there is a problem, but obviously we, the owners of non-functional boards, don't know where that problem is in the que of things needing to be fixed. Also, obviously, it used to work. Would it be helpful to us in the short term to step back to the 7.1.UF2 boot loader in the hopes that we could at least get the board functioning so we can learn what it does?

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by tannewt »

Yup, using an older version of CircuitPython could help you experiment with the hardware. That won't work if the library code itself got bigger. I'm not sure what the issue is.

User avatar
jimk572
 
Posts: 6
Joined: Mon May 01, 2023 11:55 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by jimk572 »

So, I found the repository on GitHub with all the (recent) previous versions. I downloaded version 7.3 and installed it on my circuit playground express. Maybe I didn't have to go back that far, but - by using 7.3 - I could then access the version 7 libraries. As a result, the ''from circuitplayground.express import cpx'' is working. Now I can progress through all the features of the board. HooRay! Thanks for your help.
'

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by tannewt »

I started looking into this yesterday and 8.0.0 also worked for me. 8.1.0 and 8.2.0-beta.0 don't work.

User avatar
tannewt
 
Posts: 3305
Joined: Thu Oct 06, 2016 8:48 pm

Re: Cannot load or use adafruit_circuitplayground library with my CPX boards

Post by tannewt »

I just merged in a fix. In a couple hours it'll be available here as an "Absolute Newest" build: https://adafruit-circuit-python.s3.amaz ... ess/en_US/

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”