Errors running the demo

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
pmartel
 
Posts: 18
Joined: Thu Nov 08, 2018 6:21 pm

Errors running the demo

Post by pmartel »

I loaded Circuit Python and the libraries onto the Clue. I ran several of the demos with no problem.
(I have a system that avoids having to overwrite code,py, just use import)

Code: Select all

# Importing a file lets you run it
# without having to overwrite code.py

#import bubble
#import clue_slideshow
import ble_adafruit_clue
To play with BLE, I loaded the Bluefruit Play app onto my phone,
When I loaded ble_adavruit_clue.py ( and the additional libraries adafruit_ble and adafruit_ble_adafruit )
and connected, the app showed a "Connecting Services" box then a list of services then a "perhipheral disconnected" box.
The Clue displayed an error "buffer is too short by 6 bytes at line 122 in adafruit_ble_adafruit/addressabie_pixel_service.py"
I got the source for the addressabie_pixel_service library and added 6

Code: Select all

        if self._pixel_packet_buf is None:
            self._pixel_packet_buf = bytearray(
                self._pixel_packet.packet_size  # pylint: disable=no-member
                +6 #attempt to fix bug
            )
After this, the services all ran (very nice demos) except the Tone Generator.
When I run that and press one of the piano keys I get an error li line 82 of tone_service.py
saying the buffer is too short by (2550 - it varies) bytes. Just adding bytes to the buffer causes a different error
"buffer size must match format". Any suggestions?

User avatar
quixote1024
 
Posts: 4
Joined: Wed Mar 21, 2018 11:26 pm

Re: Errors running the demo

Post by quixote1024 »

Hi, I have been having similar issues. In trying to run ble_adafruit_clue.py example, it connects and loads in the Bluefruit Dashboard, but as soon as I try to set the neopixel or trigger the tone, the script exits with a "Buffer too short .." error.

ValueError: Buffer too short by 6 bytes (Neopixel error)
ValueError: BUffer too short by 47098 bytes (Tone error)

In addition, if I use Mu Editor, the Dashboard connects but never loads and I have no output past "code.py output:" in the serial console. I don't have this problem when editing in Notepad++.

It looks like it is having difficulties passing data from the PC client to the CLUE; data seems to be read from the CLUE fine.

FYI.

User avatar
pmartel
 
Posts: 18
Joined: Thu Nov 08, 2018 6:21 pm

Re: Errors running the demo

Post by pmartel »

Hi quixote1024,
My errors were a bit different. As I said, when I tried connecting my phone to the Clue using the Bluefruit Play app, I got a "Peripheral disconnected" box right away. Once I grabbed the library source by going to https://circuitpython.org/libraries and downloading adafruit-circuitpython-bundle-py-20200801.zip (I have an earlier date. I'll try downloading the latest) I was able to toad the source file addressible_pixel_service.py into the \lib\adafruit_ble_adafruit folder on the clue. The uncompiled file takes precedence, so I was able to modify that file then everything but the tone generator worked.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: Errors running the demo

Post by adafruit_support_carter »

Can you link to the specific guide or example that is not working.

For libraries, you should generally use the .mpy versions that are in the main Bundle zip:
https://circuitpython.org/libraries

The .py version is not intended for general use.

User avatar
pmartel
 
Posts: 18
Joined: Thu Nov 08, 2018 6:21 pm

Re: Errors running the demo

Post by pmartel »

Hi For reference the REPL puts out <Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit CLUE nRF52840 Express with nRF52840> when it starts
The library version I installed was adafruit-circuitpython-bundle-5.x-mpy-20200629.zip. I unzipped it and followed the directions in https://learn.adafruit.com/adafruit-clue to install the libraries.
I loaded the program ble_adafruit_clue.py (https://github.com/adafruit/Adafruit_Ci ... it_clue.py) which required the adafruit_ble and adafruit_ble_adafruit libraries I don't have a link handy, but the date was also 6/29. These libraries are folders with .mpy files in them I brought in the two .py files I mentioned in my original post to try to worl around the bugs mentioned in the post.

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: Errors running the demo

Post by danhalbert »

adafruit_ble_adafruit really requires a CircuitPython 6.0.0-something version to work properly. It was a mistake to recommend 5.3.x. Could you try the demo with the latest alpha?

User avatar
quixote1024
 
Posts: 4
Joined: Wed Mar 21, 2018 11:26 pm

Re: Errors running the demo

Post by quixote1024 »

Hi and thanks for the tip to try and run with 6.0.

FYI, I have been testing actively with both CircuitPython 5.3 and 5.4 beta releases. I have been using the latest libraries downloaded from github. I have been testing the CLUE capabilities, comparing Arduino and Python functionality. I am using both WIn10 and the Web Dashboard, and an Android phone (S10) and the Bluefruit Connect app for testing.

I have been using the "ble_adafruit_clue.py" example file (included with the libraries), and the bluefruit_playground and neopixel example sketches in Arduino (File->Examples->Adafruit Bluefruit nRF52 Libraries->Peripheral).

FYI: for the neopixel sketch, I just needed to modify line 34 to work correctly with the CLUE -

#if defined(ARDUINO_NRF52840_CLUE) || defined(ARDUINO_NRF52840_CIRCUITPLAY)

I will post again when I have re-run with CircuitPython 6.0.x/ Thanks again.

User avatar
quixote1024
 
Posts: 4
Joined: Wed Mar 21, 2018 11:26 pm

Re: Errors running the demo

Post by quixote1024 »

Hi again,

That worked. The Bluefruitconnect_uart.py and the ble_adafruit_clue.py examples are working. I have serial input/output working between the CLUE and the Mu Editor. The Web Bluetooth Dashboard can now change the neopixel. The only issue now is the tone generator is not working correctly (I hear it click, but no tone is generated), but I think I can figure this one out. :-)

So to summarize: use CircuitPython 6.0.x (I am using 6.0.0-alpha2) for BLE.

Thanks again.

User avatar
pmartel
 
Posts: 18
Joined: Thu Nov 08, 2018 6:21 pm

Re: Errors running the demo

Post by pmartel »

Thanks. With CircuitPython 6.0.0 and the CircuitPython 6 library, the Bluetooth services all work. The tones are very faint, but I assume that's an issue with the tiny speaker.

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

Return to “CLUE Board”