#circuitpython-dev

1 messages · Page 55 of 1

spare jacinth
#

it is just saying "you can run it" as in "i've finished settings things up, the idf.py build command can now work"

#

and the way you will (indirectly) run it, is by make BOARD=<whatever>

pulsar sleet
#

I know. So make should work but it doesn't

spare jacinth
#

instead of "doesnt work" you should show what the error is, dont you think?

#

not paraphrase to cause confusion, but a straight copy-paste

pulsar sleet
#

I am getting the same exact error as this message

spare jacinth
#

hmmm, i thought the export.sh script checks that everything is installed, maybe it doesnt

#

there was something like idf.py install... maybe? did you run that?

pulsar sleet
#

no.

#

I did try to install xtensa-esp32s3-elf-gcc but downloading the archive and copying all the bin files so that may be a issue

spare jacinth
pulsar sleet
#

No I didn't. I will follow that now

#

Same error

spare jacinth
#

make BOARD=<...> clean just in case

#

if you ran install.sh and gotten esp-idf to run export.sh without complaining mid-way, i have no idea what could be missing, tbh

pulsar sleet
#

it works after removing xtensa-esp32s3-elf-* that I manually downloaded

spare jacinth
#

kewl

pulsar sleet
#

what type do I use for a arg wanting a python int

tulip sleet
pulsar sleet
#

In C I have a function that needs a python int

tulip sleet
#

is this in a constructor?

pulsar sleet
#

yes. I am trying to add the proto arg to the socket but I don't know what type to use

tulip sleet
#

you would specify the type as MP_ARG_INT. See for example busio_spi_configure() in shared-bindings/busio/SPI.c

pulsar sleet
#

Ok thank you

tulip sleet
#

that will automatically do type checking that it is an int, and you can give a default value too. .u_int = 0, etc.

pulsar sleet
#

Can I just do a cast to int with that or does it work just like a int

#

aka how can I use that as a int in C

tulip sleet
#

args[ARG_proto].u_int will return an mp_int_t

#

look at at that configure code. It shows how to set up the arg list, give names to the args using the enum, and do range checking: mp_arg_validate_int_range()

#

all kinds of examples in there.

#

Generally, steal the idiom from an existing call that is like what you want.

#

if it's a required keyword arg in CPython, ues MP_ARG_KW_ONLY, otherwise omit that

spare jacinth
# pulsar sleet aka how can I use that as a int in C

those values use a union so that you can pass the same type (compiler's POV) and have polymorphism(ish) inside it
there are a bunch of bits on that args[ARG_proto] can that be interpreted in different ways, in this case, by using .u_int you say "hey, these bits are an int" (for other args you would "interpret" them as a float or whatever)

tulip sleet
#

in this case, u_ means union (not unsigned)

slender iron
#

the ble workflow will use some bleio apis when the vm isn't active

pulsar sleet
#

do the args have to be a list or can I just add a arg like
mp_arg_int proto = 0

tulip sleet
#
STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
    enum { ARG_family, ARG_type };
    static const mp_arg_t allowed_args[] = {
        { MP_QSTR_family, MP_ARG_INT, {.u_int = SOCKETPOOL_AF_INET} },
        { MP_QSTR_type, MP_ARG_INT, {.u_int = SOCKETPOOL_SOCK_STREAM} },
    };
    socketpool_socketpool_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
#

you are going to add something to the enum, and to the allowed_args list., and then validate the args[ARG_proto].u_obj value that you fetch.

#

also update the inline documentation that's above that

tulip sleet
#

shared-bindings/socketpool/SocketPool.c

spare jacinth
#

moving here from #help-with-circuitpython message, i wont be looking at this for the following days either, so not a moving thing right now (maybe not in a few days either), just dropping a little idea

it feels like a bunch of the time is spent resolving the circuipython.local name to an actual IP (as the browser shows nothing at all), but i have no way of confirming this, any ideas how to measure such thing?

  • if that's the case, i dont think we can do much on that end
  • if resolution is fast, but the actual loading of front page is slow, we could maybe send a very simple HTML so that the user sees some movement rather than a dead loading screen... as of now, from a user perspective myself, it just looks like the device is dead or just barely alive 😛
mortal kernel
#

(Or similar. The BT workflow implementation makes me think so.)

manic glacierBOT
pulsar sleet
#

whenever I try to build circuitpython for the pico w I get a permission denied error

make: cmake: Permission Denied
crimson ferry
#

@pulsar sleet I can test Pico W once artifacts build, do you have starter code you can share?

pulsar sleet
#

Right now I can't build for the pico

#

But I can message you when I get a build

mortal kernel
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit Feather M4 Express with samd51j19
Board ID:feather_m4_express
with bootloader v3.15.0.uf2

Airlift Featherwing

Code/REPL

Full code for the project I was working on is [here](https://github.com/DJDevon3/My_Circuit_Python_Projects/tree/main/Boards/atmel-samd/Adafruit%20Feather%20M4%20Express/Adafruit%20Airlift%20Featherwing/64x32%20Matrix%20Panel)

Behavior

I did ctrl+s i...

manic glacierBOT
#

This happens when CircuitPython is unable to mount CIRCUITPY. It assumes it's corrupt or empty and reformats it. This generally happens unwantedly when the power supply sags enough for long enough that the external flash does not respond properly. Or it happens when something has corrupted CIRCUITPY so badly that it cannot be mounted, even read-only.

What host computer and OS are you using?

Are you powering the matrix through USB or separately?

manic glacierBOT
#

Thanks for both of your assistance here.

Indeed, I have a serial interface into the boards that do not appear as volumes. And can successfully run storage.erase_filesystem(). However, upon trying to "save" via the CP editor, I am met with a Disk Error.

Error saving file to disk. Ensure you have permission to write the file and sufficient disk space.

Also, no luck restarting my Mac machine.

Upon trying on a Windows machine same story. Not showing up as a removal dri...

manic glacierBOT
#

Windows 10. Powering the 5mm pitch 64x32 matrix panel separately with a Meanwell 5V 18A PSU. Same one that I use to power 6 panels in my 12 panel matrix project. I removed 1 panel and 1 PSU to make this 1 panel project. This project started out with helping someone in the Adafruit Circuit Python Forum... and I ended up running into multiple issues with 2 different Feather M4's. I don't use boot.py or have variables for web workflow. Fairly...

manic glacierBOT
#

You mentioned a few posts back that CIRCUITPY is not appearing on multiple disparate boards, not just the nRF52840. Is the CIRCUITPY drive could not be found or created only on one board or multiples? There may be multiple issues here.

If you do storage.erase_filesystem() on the Windows machine for each different board, and then wait for the board to reset and come back, does CIRCUITPY reappear on Windows? Have only one board at a time plugged in. After that result, let's talk about ma...

manic glacierBOT
#

Power sag could be possible. While I was making the wiring schematic I noticed I hadn't plugged in pin D4. So I plugged it in while the matrix panel was still powered instead of turning off the power to the matrix panel first via a rocker safety switch.

This is actually the same process that I believe killed the first Feather M4. I plugged in D4 while the matrix panel was on with the first feather m4 too. Because it killed that feather I unplugged D4 as I thought that pin might be a deb...

manic glacierBOT
#

It just happened again this morning. I was working as normally in Mu. Did ctrl+s to save the file. It gave a memory allocation error because I added a couple more labels and ran over the RAM limit. Nothing unusual there as a ctrl+s usually works again, frees up some memory, and code.py works again.

Except when this condition happens it presents two back to back dialogs. There is no serial log as it closes REPL completely as the device is detached.

![Capture](https://github.com/ada...

#

CircuitPython version

It's exactly the same on 8.x and 9.x so it's not related to idf5

Code/REPL

import analogio, board, time; iadc = analogio.AnalogIn(board.any_adc_pin)
while True:
    print(iadc.value)
    time.sleep(0.1)

Behavior

Connect any potentiometer. First pin to 3v3, middle pin to the adc pin of the board, and the third pin to GND.

As we spin it around it should change it value.
The maximum should be 65535 and the minimum 0.
Wi...

manic glacierBOT
manic glacierBOT
#

I'm not quite sure of the sequence of events after the ctrl-S. So did it save and restart? When it restarts, do the matrix panels start illuminating completely? Did you see any flash of illumination before it failed?

Could you recheck the wiring to the panels? Are you using a Matrix FeatherWing? Which one, 3036 or 4702? There are two versions. Are you connected through the barrel jack to the Meanwell power supply?

Is the pullup mentioned here, https://learn.adafruit.com/rgb-matrix-feath...

tulip sleet
lone axle
tulip sleet
#

i was wondering if it was an issue with the debouncer library

#

i don't know whether the bundler looks at requirements.txt

lone axle
#

The only two things I can think of as possible causes would be: 1) debouncer not having ticks in it's requirements.txt, but it does and it seems to be correct https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/blob/main/requirements.txt or 2) ticks not being in the bundle (if the learn project bundler relies on the built library bundles which I assume it does, but could be wrong.) But that isn't the case either, I double checked the bundle and ticks is definitely in there.

tulip sleet
#

yes, I would look for some similarly transitive dependency and see if the bundle for that works. have you seen adafruit_ticks missing before?

lone axle
#

I don't recall seeing it missing before

#

tbh I don't recall ever seeing a bundle that was downloaded from learn be incomplete or missing anything.

tulip sleet
#

maybe it is just this bundle. I will look for other examles in the learn guide and see how their bundles are

lone axle
#

I worked on the screenshot generator so I am more familiar with it's operation. I can try looking into it later on in the screenshot generator context and if I discover the root cause it may be the same as for the project bundler.

tulip sleet
#

pip thinks the dependency is OK:

$ pip3 install adafruit-circuitpython-debouncer
Defaulting to user installation because normal site-packages is not writeable
Collecting adafruit-circuitpython-debouncer
  Using cached adafruit_circuitpython_debouncer-2.0.8-py3-none-any.whl (5.7 kB)
Collecting adafruit-circuitpython-ticks
  Using cached adafruit_circuitpython_ticks-1.0.13-py3-none-any.whl (5.4 kB)
[...]
#

it doesn't look inside adafruit_debouncer.py, does it?

#

The import there is a from..import: from adafruit_ticks import ticks_ms, ticks_diff

#

debouncer has an optional_requirements.txt, which I have not seen before.

lone axle
tulip sleet
#

(re my previous post) never mind, they all have optional requirements.

lone axle
#

or at least does in our case only do one level. It wouldn't have access to the library .py file easily that I know of so it couldn't really recurse to check for imports that came from libraries.

tulip sleet
#

i had no idea we used that tool

lone axle
#

The screenshot generator does. And I think maybe I heard that the project bundler does back when I was working on the screenshot one, but I am not certain.

tulip sleet
#

says it is olde than setuptools, so maybe it doesn't even look at requirements.txt.

#

I would have thought the bundler and the screenshot tool would both rely on pyproject or setuptools and would be using requirements.txt at least indirectly

#

but I guess I am wrong

lone axle
#

I'm trying to think of other instances of 2 levels like Project depends on Library1 and Library1 depdends on Library2 like this. I'm sure there are other cases but I am drawing a blank at the moment.

#

Learn guide project code doesn't always have a pyproject.toml or requirements.txt though I don't think.

tulip sleet
#

i guess I would think findimports on the learn guide code and then requirements.txt subsequently

#

ok, well...

halbert@cod:~/repos/adafruit/Adafruit_Learning_System_Guides/GemmaM0_Pinball$ findimports
./code.py: could not find adafruit_hid.keyboard.Keyboard
./code.py: could not find adafruit_hid.keycode.Keycode
code:
  adafruit_debouncer
  adafruit_hid.keyboard.Keyboard
  adafruit_hid.keycode.Keycode
  board
  digitalio
  usb_hid
#

no mention of debouncer adafruit_ticks

stuck elbow
#

the first one?

tulip sleet
#

sorry, no mention of adafruit_ticks

stuck elbow
#

maybe because it uses "from" import?

lone axle
#

I did come up with a 2 level dependency chain Adafruit_IO depends on Adafruit_MiniMQTT. But the constructor for adafruit_io actually needs to have an instantiated mqtt object to pass in to it, so the project code ends up importing adafruit_mqtt in adition to adafruit_io therefore it doesn't end up suffering from the same problem.

tulip sleet
#

hmm so do pyportal bundles omit portalbase??

lone axle
#

It's not an ideal solution, but based on the way that adafruit_io and adafruit_mqtt interact and end up working with the screenshotter and bundler it would seem a temporary workaround could be to add import adafruit_ticks to the project code.

tulip sleet
#

for example

lone axle
#

Ah good thought those should make a dependency chain with multiple levels I'll check one of those

#

In that case it works when users try it in most cases because they device they'd be running on has portalbase frozen in I think so they don't end up missing an import even though it wasn't included.

tulip sleet
#

so the way the whole thing works now is ... poorly

lone axle
#

Unless I'm misunderstanding it, it definitely does seem prone to missing any dependencies past the first level. And we've kind of just have been mostly lucky that in the cases it misses the libraries it missed were included due to being frozen in.

tulip sleet
#

circup does a fine job:

$ circup install adafruit_debouncer
Found device at /media/halbert/CIRCUITPY, running CircuitPython 8.2.9.
Searching for dependencies for: ['adafruit_debouncer']
Ready to install: ['adafruit_debouncer', 'adafruit_ticks']

Installed 'adafruit_debouncer'.
Installed 'adafruit_ticks'.
#

it's doing the right thing

lone axle
#

circup does reference either requirements.txt or pyproject.toml I belive.

I think it'll need to have a second "stage" added to the operation to work through the libraries it finds on the first pass and find thier dependencies based on one of those files as well.

Perhaps the code from circup can be re-used in the screenshot generator for that. I don't know how the backend of the bundler works or if it is python though.

tulip sleet
#

it looks in requirements.txt

#

the bundle itself has a requirements directory with adafruit_debouncer/requirements.txt, etc.

lone axle
#

One thing to consider is if we do want to take into consideration the list of frozen libraries as well. i.e. should the screenshot and bundle actually end up including portalbase since most of the time they'll be frozen in?

#

although consistency between circup and the other tools would be ideal. So whichever we land on, all should behave the same.

tulip sleet
#

the bundler is not specific to a board, so what's frozen can vary. circup does not check for frozen, it always installs all the requirements

short tendon
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@dhalbert very grateful for your willingness to help!

You mentioned a few posts back that CIRCUITPY is not appearing on multiple disparate boards, not just the nRF52840

I actually have multiple custom PCBs that all use the same nRF52480 mcu. This project was prototyped with the ItsyBitsy so figured might as well run with the nRF52840 :)

If you do storage.erase_filesystem() on the Windows machine for each different board, and then wait for the board to reset and come back, does ...

#

In the original post:

I've tested Pico W, QT Py ESP32-S2, Feather M4, and RP2040. In each case, the first one or two will mount, then subsequent similar devices won't mount at all or won't mount properly: They don't show up in Finder. They may not show up in ls -l /Volumes, and if they do, they may not show up properly.

Is that still the case with the non-nRF boards after you updated and did storage.erase_filesystem()? (Windows and/or macOS).

manic glacierBOT
#

The older API docs show a curve (ESP32-S2) that is reasonably linear (when calibrated), except that it doesn't go to zero, and it doesn't go to 3.3V (iirc 2.6V when using 11dB attenuation):
https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/api-reference/peripherals/adc.html
The APIs have changed, and the chart no loner appears that I can find, but I suspect the underlying hardware limitation hasn't changed.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Do you have a .uf2 file for the test build?  If so, I could test it out for you.Sent from my iPhoneOn Dec 24, 2023, at 4:09 PM, Carson @.***> wrote:
Could you provide some code or test the pull request for me. I tried but networking is not for me

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I took a good read through the s2 technical manual and the attenuation stuff.
(Actually managed to 100% understand the analogio code!)

Also, C6 is perfectly 0-3.3V. I did it both outside (esp-idf) and inside CP, and it works on both.

    return voltage * ((1 << 16) - 1) / 3300;
}

float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
    return 3.3f;
}

I still do not quite understand why I shouldn't go and just and #define the ...

manic glacierBOT
manic glacierBOT
#

It might be tough to state an exact maximum achievable voltage for a particular variant, since it depends on the per-chip internal vref (110mV±100mV). And the docs seem to have stripped out the linear voltage range details at some point.

(Also we may want to allow attenuation as a param at some point to give more precision (same bit width over a smaller voltage range), though there may be not much accuracy benefit to this.)

pulsar sleet
#

Does circuitpython support warning. I am working on adding the proto argument to sockets and I want to show a warning if proto is set put the socket is not a SOCK_RAW sock

spare jacinth
#

there is a subset of it, warnings.warn should work (not all the same options that you get on computer)

#

or, if you need to call it from C, it would look something like:

warnings_warn(&mp_type_FutureWarning, translate("%q moved from %q to %q"), MP_QSTR_Display, MP_QSTR_displayio, MP_QSTR_busdisplay);
(extracted from https://github.com/adafruit/circuitpython/pull/8524)

translated to human that is:

warnings_warn(type_of_warning, message)

  • message is a format string with variadic args.... which in this case is equivalent of "%s moved from %s to %s" % ("Display", "displayio", "busdisplay")
pulsar sleet
#

what is a future warning

spare jacinth
#

you'd likely want (if implemented) something a UserWarning i guess

pulsar sleet
#

How can I build with CIRCUITPY_WARNINGS enabled or is it enabled by default with just a make BOARD=

spare jacinth
#

Check the PR i linked

#

Since it added the thing, it also has to have added the flag that controls enabling it (at the Makefiles)

#

(which likely defaults to true)

lone sandalBOT
tulip sleet
#

warnings is on by default on all boards, I think, except maybe the absolute smallest

mortal kernel
#

To activate BT workflow on the nrf52 boards the reset button is pressed while the neopixel rapidly blinks blue. The RP Pico W has only a green LED. Any thoughts on an activation sequence for these boards?

#

The RP Pico W also lacks a reset button.

midnight ember
#

a getenv() special variable? if it works for enabling web workflow then could be used to enable bt workflow?

stuck elbow
midnight ember
#

how do they do it currently with web workflow? I have no idea, never used one in that way.

spare jacinth
#

They still have serial, dont they?

stuck elbow
#

not on an ipad

#

the whole idea with the bluetooth workflow is that you can use it on a phone or a tablet

mortal kernel
#

From a CP development perspective it may be useful to have both a button press at reset and a settings.toml variable that can activate BT workflow.

midnight ember
#

If you want a button press with a Pico W you'd have to use a Pico W Bell, then maybe.

stuck elbow
#

maybe there could just be a separate firmware with the bluetooth workflow enabled

#

I just realized that you need usb anyways, to flash the firmware

mortal kernel
stuck elbow
spare jacinth
#

It does, using it at runtime is possible but quite hacky (and probably flaky), wouldnt do it

#

At boot, if it is shorted to GND, RP2040 goes to bootloader, otherwise gets configured as the CS for flash

mortal kernel
stuck elbow
#

I have it connected to an additional pin with some resistors, so I can sense it without messing with the cs pin on my board, but not sure how pico has it

mortal kernel
#

Pico has it through a 1K to ground.

#

The reason given in the docs for the nrf52 behavior (BT workflow off by default) is security. I wonder if security really is an issue?

stuck elbow
#

you don't want random people under your window to connect to your device

mortal kernel
#

How about this: BT is off by default (current behavior), but can be activated by a setting in settings.toml?

stuck elbow
#

I can see all of my neighbour's bt devices perfectly fine

mortal kernel
stuck elbow
#

imagine a classroom

mortal kernel
#

OK, I'm starting to understand why it is like it is. Back to my question: BT workflow off by default but activated in settings.toml?

tulip sleet
#

The BLE workflow was conceived of before either MSC or serial worked at all with tablets, either Android or iOS. We can reconsider how it works now. It was designed to be simple to use, and originally boards like CPB were the target. Whether this still makes sense or not I don't know. I don't think we have much if any data about how it's being used now.

#

I would say just pick something for now, and we can change it later if we want.

manic glacierBOT
#

It might be tough to state an exact maximum achievable voltage for a particular variant

Well, CP uses the calibs. We do not have to bother with the chip variance (theoretically).

The technical reference manuals for esp32, esp32s2 and s3 state that:
image

But vref is not defined anywhere in this document.
Assuming it's 3v3, it would mean it's 3300÷4095×3300=~2660.

But that clear...

manic glacierBOT
#

I read through some documentation, both hardware and software. The clearest explanations are in the ESP-IDF V4.x manuals, such as https://docs.espressif.com/projects/esp-idf/en/v4.3/esp32s2/api-reference/peripherals/adc.html. There, the actual maximum voltage and the attenuations are explained. The ESP-IDF v5 documentation is less clear: https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32s2/api-reference/peripherals/adc_oneshot.html?highlight=adc#introduction.

When we originally de...

manic glacierBOT
#

I do think there is a bit more value than convenience to this api, as it could be used to fetch many more readings, as the conversion logic would be in C. It would also be more beginner friendly.

Considering this should add almost no strings, it shouldn't take too much space.

However I do not think .reference_voltage should remain useless.
If we were to put the effort to revamp the api, shouldn't we at least make it settable and leave the default to be 3v3 as is?

But considering t...

#

Also just making a setter for the ref voltage could be a tiny tiny change that would not affect any existing apps.

But you want it to affect the returned .value, right? It's not just informational.

Default would always be 3v3, as it currently is.
If changed, the math at the value return statement would change yea.
If unchaged, the math will be identical to how it is now.

manic glacierBOT
#

The circtuitpython-stubs package is great, and along with the improved typing in the bundles you can get pretty good hinting in tools like VSCode.

The one missing piece is the pins for specific boards. The circuitpython-stubs package for board only has hints for the I2C, SPI, and UART functions and the board_id. So you don't get autocomplete and possibly warnings for the board specific features.

@joedevivo who maintains a VSCode extension for Circuit Python does some good s...

slender iron
slender iron
manic glacierBOT
mortal kernel
manic glacierBOT
lone sandalBOT
proven garnet
#

@lone axle do you want me to merge and release those PRs related to unpinning sphinx and adding sphinx-rtd-theme for RTD? I resurfaced now that the semester is over and am catching up on things.

onyx hinge
#

hi @proven garnet ! good to see you

hollow gazelle
#

my MEMENTO pycamera arrived
the installed firmware displays images from the camera on the tft display
double clicking reset brings up a
PyCamera
0.16.0-27-g3d79e6c
firmware.uf2 -> CAMERABOOT
circuitpython.org

screen, but the computer (windows 11) doesn't show a CAMERABOOT drive - so that seems out to be able to download new circuitpython firmware

I also tried to follow the instructions on
https://learn.adafruit.com/adafruit-memento-camera-board/install-circuitpython
and made further progress after switching from an external hub to not using the hub and directly connect to a port on the computer

( thanks for the note about avoiding the hub from the boot loader, I'll do some more research and get back here )

Adafruit Learning System

Capture all of your favorite memories with MEMENTO

proven garnet
lone axle
proven garnet
#

You too! I think I got the last remaining handful!

hollow gazelle
# hollow gazelle my MEMENTO pycamera arrived the installed firmware displays images from the came...

well, I now have
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Adafruit Camera with ESP32S3
Board ID:adafruit_esp32s3_camera
installed, and am going through the https://learn.adafruit.com/adafruit-memento-camera-board

there seem to be a lot of references to board.LED, (probably generic instructions )

There is a warning that says

The KB2040, QT Py and the Trinkeys do not have a built-in little red LED! There is an addressable RGB NeoPixel LED. The above example will NOT work on the KB2040, QT Py or the Trinkeys!

should this also mention the MEMENTO ?

at least there is a link to the NeoPixel blink example!

If you're using a KB2040, QT Py or a Trinkey, please download the NeoPixel blink example. https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Welcome_to_CircuitPython/code.py

Adafruit Learning System

Capture all of your favorite memories with MEMENTO

GitHub

Programs and scripts to display "inline" in Adafruit Learning System guides - adafruit/Adafruit_Learning_System_Guides

manic glacierBOT
manic glacierBOT
#

I find the widely used

while not i2c.try_lock(): pass

construct problematic (or even catastrophic in boot.py) because it will just get the code into an endless loop if try_lock() is unsuccessful.
It would be nice to have an optional timeout argument so that an exception will be raised if the lock cannot be acquired within a certain timeframe. Currently, I would even opt for the timeout to have a default value of maybe 1 or 2 seconds.

manic glacierBOT
empty salmon
#

in the current code for raspberrypi boards in common_hal/digitalio/DigitalInOut.c the code appears to set output pins to 12mA using PADS_BANK0_GPIO0_DRIVE_VALUE_12MA.

In the Issues, there appeared to be some debate.

Is this intended to persist or might it change?

In my board_init() I need to set one pip as OUTPUT HIGH and it needs to be capable of the 12mA max (although I don't anticipate it will ever be required to deliver that much)..

stuck elbow
#

I think we set max driving strength on all boards by default

#

there are some bugs where we don't, that should be fixed

empty salmon
#

thanks

empty salmon
#

Thanks @tulip sleet. Those were the “issue” discussions I was referring to in my original question.

It appears the core will continue to set the output to the max allowed on the raspberrypi boards.

tulip sleet
#

we are talking about how to make setting drive strength more flexible. It may involve some fundamental rethinking of DigitalInOut and Pin.

#

in general we would like max drive strength to be the default, because it is the most useful for the novice user

empty salmon
#

Well, I’m taking advantage of the pin being max drive strength now 😉

short tendon
tulip sleet
short tendon
empty salmon
#

What extra steps do I need to do when setting a GPIO pin in my board_init() such that the pin is still available to the end user to change in the code.py?

I copied the code from the Adafruit RP2040 USB Host board.c:

digitalio_digitalinout_obj_t _host_power;

void board_init(void) {
    common_hal_digitalio_digitalinout_construct(&_host_power, &pin_GPIO18);
    common_hal_digitalio_digitalinout_never_reset(&_host_power);
    common_hal_digitalio_digitalinout_switch_to_output(&_host_power, true, DRIVE_MODE_PUSH_PULL);
    ... 
}

Is my problem the never_reset() call or something else?

tulip sleet
empty salmon
#

I want to have a pin which I set as output HIGH to start. the user may need to change it to LOW (and or HIGH) from their circuitpython code.

#

in my usecase its an "enable" pin

tulip sleet
#

set the pin to high without using common_hal_digitalio routines. Just use the pico-sdk GPIO routines

manic glacierBOT
#

CircuitPython version

MicroPython 9.0.0-alpha.6-8-g9ac250aa3b on 2023-12-27; linux [GCC 11.4.0] version

(this is my custom build of the UNIX port of CircuitPython, the executable is also named `micropython`, it looks like you haven't renamed this port)

Code/REPL

>>> class D(dict):
...     def __setitem__(self, k, v):
...         super().__setitem__(k, v)
...
...
>>> d = D()
>>> d['foo'] = 'bar'

Behavior

Traceback (most recent ...
empty salmon
#

thanks @danh. I will see if I can find an example as to what I need to include and what calls I will make.

tulip sleet
#

Take a look at some other boards that setup various pins in advance -- there are a numbe of such cases

empty salmon
#

OK. all of the examples I found were using the common_hal_digitalio_*() calls. I will dig deaper.

tulip sleet
#

or was it hidden?

#

calling the common_hal routines claims the pin

empty salmon
#

no. all of the examples I have found within the CP code is very simialr to the adafruit RP2040 USB board.

#

I'll dig

mortal kernel
manic glacierBOT
empty salmon
#

thanks @mortal kernel - I want to set the pin from the firmware before the user sees it so it has a smart default state

manic glacierBOT
#

Do you have `adafruit/circuitpython as a remote, e.g.:

$ git remote -v
adafruit	https://github.com/adafruit/circuitpython.git (fetch)
adafruit	https://github.com/adafruit/circuitpython.git (push)
origin	https://github.com/dhalbert/circuitpython.git (fetch)
origin	https://github.com/dhalbert/circuitpython.git (push)

It might be called upstream instead. If not add it as a remote.
So, to rebase:

$ git fetch adafruit
$ git rebase adafruit/main
tulip sleet
main furnace
#

About to do some broadcom testing on Pi zero W and Pi zero 2W. Have heard reports that the CIRCUITPY drive isn't mounting for > 8.0.5. I'll be trying latest 9x builds first.

manic glacierBOT
#

@carson-coder Thank you. Will attempt to test in 1 to 2 hours and let you know.  Sent from my iPhoneOn Dec 27, 2023, at 11:41 AM, Carson @.***> wrote:
https://github.com/adafruit/circuitpython/actions/runs/7315146763/artifacts/1133347374 Here @300bps

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

empty salmon
#

thanks @tulip sleet. I was close. needed the code from DigitalInOut.c to set the output strength and needed to not do the never_reset()

const uint8_t pin = gp_pin->number; // the VCC enable pin
gpio_init(pin);
gpio_set_dir(pin, GPIO_OUT);
hw_write_masked(&padsbank0_hw->io[pin],
                PADS_BANK0_GPIO0_DRIVE_VALUE_12MA << PADS_BANK0_GPIO0_DRIVE_LSB, 
                PADS_BANK0_GPIO0_DRIVE_BITS);
// Turn on "strong" pin driving (more current available).
gpio_put(pin, 1);
// common_hal_never_reset_pin(gp_pin);
manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Raspberry Pi Zero W with bcm2835

Code/REPL

None

Behavior

Prints the version, Board ID, and UID on the HDMI screen, then stops.
The status line is visible:

:snake: Done | 8.2.9

Description

On the Raspberry Pi Zero W it doesn't seem to boot fully. The CIRCUITPY drive is not mounted. Windows complains of an unknown USB device.

Additional information

Last known goo...

manic glacierBOT
#

For background, the reason I'm doing this is that I'm trying to get my Microdot web framework to run under CircuitPython. My test suite runs on the UNIX port, and while I have been testing MicroPython releases for a long time this problem is currently preventing me from running my tests on CircuitPython.

Just in case and to be 100% sure, I tested this on a few older releases of MicroPython.

MicroPython v1.19.1 on 2023-12-27; linux...
manic glacierBOT
manic glacierBOT
empty salmon
#

@tulip sleet - thanks again for the pointers and replies on my GPIO questions. The results are working exactly as I had hoped.

This resolved the prior discussion of “REPL output to an integrated ePaper display”.

The new code means the default behavior will be “just like every other board” and the user has the option to enable/disable the ePaper display as often as they like with the default behavior being the display is active.

manic glacierBOT
lone axle
#

How is the UID that gets put into boot_out.txt generated? I've never paid close attention, does it stay the same across formatting the storage? Is there anything a typical user might run into that would cause it to change on their device?

manic glacierBOT
#

@carson-coder: Kudos! My first tests of the changes that you implemented appear to work! Note that this is the "happy path" -- I haven't proceeded to more exhaustive testing including potential edge cases, but I was pleasantly surprised that the first test works (that almost never happens ;)! I'll do some more testing and update you with more results.

Can you link me to your fork that includes the source for these changes? I can examine that as well.

spare jacinth
manic glacierBOT
#

Should this also be added to the ESPI32SPI Library to keep them similar?

@justmobilize I took a quick look at the ESPI32SPI file you mentioned and it looks like that one already accepts and attempts to use the 'proto' parameter to the 'socket' call -- at least at that level. I didn't dig deeper to see what happens further down the stack of turtles, though ;)

spare jacinth
# lone axle How is the UID that gets put into boot_out.txt generated? I've never paid close ...

im lazy enough to not create the equivalent link to github ```c
// Write version info
mp_printf(&mp_plat_print, "%s\nBoard ID:%s\n", MICROPY_FULL_VERSION_INFO, CIRCUITPY_BOARD_ID);
#if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH > 0
uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH];
common_hal_mcu_processor_get_uid(raw_id);
mp_cprintf(&mp_plat_print, MP_ERROR_TEXT("UID:"));
for (size_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) {
mp_cprintf(&mp_plat_print, MP_ERROR_TEXT("%02X"), raw_id[i]);
}
mp_printf(&mp_plat_print, "\n");
port_boot_info();
#endif

manic glacierBOT
spare jacinth
#

eg, for RP2040 it pretty much just calls (imma guess Pico-SDK function that does the internal stuff to read it) function: ```c
void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
pico_unique_board_id_t retrieved_id;
pico_get_unique_board_id(&retrieved_id);
memcpy(raw_id, retrieved_id.id, COMMON_HAL_MCU_PROCESSOR_UID_LENGTH);
}

lone axle
#

so it looks like this populates it common_hal_mcu_processor_get_uid(raw_id);

#

okay, cool. Thank you. I did just test storage.erase_filesystem() and it does not result in the UID changing. I'm going to validate a few other scenarios but it looks like it can serve the purpose I have in mind.

spare jacinth
#

from a quick look, it has to be defined (ie there's no defined(COMMON_HAL_MCU_PROCESSOR_UID_LENGTH)) and no port defines it to 0 (or negative) so every port does (currently) implement it

#

welp, STM port apparently only covers F4, so probably you get a no-op for other families

manic glacierBOT
#

The rest of the program won't run if an unhandled exception is raised. But it gives the developer a clear indication of what the problem was (or the program a way to handle it). One instance where this is particularly helpful is in boot.py. If try_lock goes into an endless loop, the cp module will simply not boot and remain completely inaccessible (i.e. with no USB drive mounted and no REPL connected). The only way to get out of that is to manually boot into safe mode by pressing the reset ...

#

I agree that the while loop used in the examples may not be the best way to use the try_lock function and for new users may lead to issues.

Much of the core is still over my head so it's dangerous for me to make conclusions after looking at the C code, but when I look at the common_hal_busio_i2c_try_lock function (rp2040), it doesn't look to me like there is any advantage to calling the try_lock function a second time if the first call returns a False. Is it possible the while loop was us...

#

Much of the core is still over my head so it's dangerous for me to make conclusions after looking at the C code, but when I look at the common_hal_busio_i2c_try_lock function (rp2040), it doesn't look to me like there is any advantage to calling the try_lock function a second time if the first call returns a False. Is it possible the while loop was used in the examples because in the limited context of the example there was no difference between infinite looping and simply exiting the code?...

#

You don't need my_busio, just use busdevice, it handles the locking correctly for you.

I dare to disagree. try_lock is a method of the bus object, which you have to specify to instantiate a bus device. The bus device will use the try_lock method of the bus object - and end up in an indefinite loop if it fails to acquire the lock

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; M5Stack M5Paper with ESP32

Code/REPL

import board
board.DISPLAY.refresh()

Behavior

Serial console setup

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circ...
manic glacierBOT
manic glacierBOT
#

While I do like the idea of a timeout on try_lock() and I already do this in most of my code, the cause-and-effect is one of legacy examples.

As @bludin notes, there are so many examples that show the while not i2c.try_lock(): pass code snippet that users see it as a best practice. If the try_lock() throws an exception and the examples showed a try: except code block, then much of the angst and head scratching would go away.

I recognize this is a case of _"water under the brid...

manic glacierBOT
manic glacierBOT
#

With 9.0.0 Alpha 6 on the Zero W, plugged into the inside USB connector many "read sector" errors are reported, presumably while attempting to mount the CIRCUITPY drive.

...
read sectors result 8 when reading block 7772138 for 1
read sectors result 8 when reading block 7772140 for 1
read sectors result 8 when reading block 7772142 for 1
read sectors result 8 when reading block 524288 for 1
read sectors result 8 when reading block 524289 for 1
read sectors result 8 when reading bl...
manic glacierBOT
manic glacierBOT
#

@bludin how many users do you think are going to put an i2c scan in their boot.py and make the exact same mistake as you, and do you think preventing this is worth removing some built-in library from the smallest boards to make room for the extra code this will require? Do you already have an opinion about which built-in module would be best to remove?

short tendon
manic glacierBOT
#

It wiped itself again. I dismantled the entire project and put my Matrix Portal S3 on there instead which of course works splendidly because it was built exactly for that purpose.

I think attempting to manually wire up a Feather M4 Express & Airlift to a matrix panel is just a bad idea. It was an experiment. It doesn't work very well even when it does work. A lot of artifacts and glitching because it's using breadboard wires. It's a better idea and more fruitful use of time to use a Mat...

manic glacierBOT
#

@justmobilize To my knowledge, you can't use an RGB Matrix Featherwing with both a Feather M4 Express and an Airlift featherwing. That's why I had to manually wire it in the first place. The RGB Matrix Featherwing requires some of the same pins used by the Airlift. I could cut traces but I really don't feel like doing that if I'll need it again in the future. Hence wiring around it manually which turned out to be a bad idea.

#

@bludin how many users do you think are going to put an i2c scan in their boot.py and make the exact same mistake as you, and do you think preventing this is worth removing some built-in library from the smallest boards to make room for the extra code this will require? Do you already have an opinion about which built-in module would be best to remove?

@deshipu if that's indeed the only conceivable scenario where the real benefit (as opposed to the esthetic one) is significant, we might ...

manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4
Board ID:seeed_xiao_esp32c3
UID:43588170B08D

Code/REPL

http://circuitpython.local does not respond MDNS

Behavior

I have 4 Seeed Studios Xiao ESP32C3 processors on the network, running 8.2.8 and 8.2.9. When I attempt to get to get to http://circuitpython.local or /code/ I get a timeout. Wireshark shows no response to MDNS request packets...

manic glacierBOT
manic glacierBOT
#

I've been testing the Raspberry Pi Pico version of this build (some comments were in the associated issue). The results are:

  1. These code changes in this build SUCCESSFULLY allow me to create a raw ICMP (ping) socket by passing proto=1. Previously, this was not supported.
    import socketpool
    import wifi

    IP_HEADER_PROTOCOL_ICMP = 1
    sp = socketpool.SocketPool(wifi.radio)
    sp.socket(family=socketpool.AF_INET, type=socketpool.SOCK_RAW, proto=IP_HEADER_PROTOCOL_ICMP...
manic glacierBOT
#

CircuitPython version

adafruit-circuitpython-luatos_core_esp32c3-en_US-8.2.9
and also 9.0.0-alpha.6

Code/REPL

none

Behavior

The led always blink 3 times on every reset (both on push rst button or re-plug usb cable), maybe in a safemode but repl doesn't say why.

Description

It's a fresh install by the web installer. WIFI was configured by web installer too. I tried to use a external USB to TTL adapter to connect the esp32-c3 for more logs, ...

#

I think socketpool.SocketPool.IPPROTO_ICMP could be added:

>>> help(socketpool.SocketPool)
object <class 'SocketPool'> is of type type
  socket -- <function>
  getaddrinfo -- <function>
  gaierror -- <class 'gaierror'>
  AF_INET -- 2
  AF_INET6 -- 10
  SOCK_STREAM -- 1
  SOCK_DGRAM -- 2
  SOCK_RAW -- 3
  TCP_NODELAY -- 1
  IPPROTO_TCP -- 6
  IPPROTO_IP -- 0
  IP_MULTICAST_TTL -- 5
  EAI_NONAME -- -2

https://github.com/adafruit/circuitpython/blob/6627bd7826fc7bbcddb...

manic glacierBOT
manic glacierBOT
#

Some Lilygo TTGO T-Display ESP32 are sold with a 4 MByte (32MBit) flash chip. The current firmware for the 16 MByte version is not compatible.

To enable the build there is literally only one line to change: in the mpconfigboard.mk change one line to 4MB:

CIRCUITPY_ESP_FLASH_SIZE = 4MB

After that the build runs without any issues and the produced firmware works on the 4M version of the T-Display out of t...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; LILYGO T-DISPLAY with rp2040

The behaviors was tested with all versions from the first support at 8.1.0 to the latest 9.0.0-alpha6 and is consistent across all versions. It even applies to the similar T-PicoC3. Details below

Code/REPL

# 23 Jun 2022 - @todbot / Tod Kurt
import time, random, board, displayio, vectorio, rainbowio

display = board.DISPLAY
maingroup = displayio.Group()
dis...
#

I can at least tell you why the rotation is different (and I suspect the rotation is at least in part responsible for the slowdown). In the initialization sequence for the display, in the MADCTL register there are some bits that decide how the display is going to be rotated respective to its internal memory – on the side of the display chip. The board.c code has this:

    0x36, 1, 0x08,

and if you glance at the ST7789 driver code, it seeming has the same:

    b"\x...
manic glacierBOT
manic glacierBOT
pulsar sleet
#

I am adding the proto arg to socketpool.socket and I want to know what oonstants should I add for IPPROTO_.

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
turbid radish
digital shoreBOT
#
adafruit
Owner

.adafruit

Members

38,336

Roles

38

Category Channels

8

Text Channels

63

Voice Channels

7

Threads

21

Boost Count

22 Boosts (Tier 3)

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-29; ESP32-S3-DevKitM-1-N8

Code/REPL

>>> import espulp
>>> ulp = espulp.ULP()
Traceback (most recent call last):
  File "", line 1, in 
NotImplementedError:

Behavior

In CircuitPython 9 it is no longer possible to instantiate a ULP object. In CircuitPython 8 this still worked.

Description

The reason for this seems to be the new preprocessor directives that were introduc...

#

Since the RP2040 preserves RAM when in the dormant (deep sleep) state, is it not possible to resume the program after a PinAlarm, without resetting the board? This would make it significantly easier to preserve state while dropping into lower power modes.

@ghubcoder's blog post describes how to recover from the dormant state by resetting clocks. This was implemented for MicroPython in [modpicosleep.c](https://github.com/ghubcoder/micro...

manic glacierBOT
#

The init sequence in board.c had one additional auto_brightness setting in the common_hal_busdisplay_busdisplay_construct() of the display_init() function that caused a one pixel noise line at the bottom of the display and a slow refresh rate from below 1 Hertz. Described in https://github.com/adafruit/circuitpython/issues/8765

Removing this line solved the issue.

Furthermore the init sequence from the Adafruit Feather esp32s3 tft was copied to rotate the refresh of the display t...

manic glacierBOT
#

These settings can be replicated directly in Circuitpython. Instead of using the compiled adafruit_st7789.mpy I used the regular adafruit_st7789.py and changed one line with _MADCTL. The additional _MADCTL line can indeed be removed, no change here. And the file has only some 20 lines of code, anyway, so here is the adjusted init sequence from this file:

_INIT_SEQUENCE = (
    b"\x01\x80\...
manic glacierBOT
#

Sorry, not dismissed. But I found one error that was not obvious with B/W text but with the use of color. The D3 bit of MADCTL changes the color information. It was initially zero and therefore RGB but with the change to 0x68 we set it to one and therefore BGR. The change to 0x60 switches the order back to RGB and is consistent with the use in T-Display ESP32. So the change from the original 0xC0 only changes the orientation and refresh direction to allow for rotation=0

manic glacierBOT
#

Performs a similar calculation as in HTTPServer web sockets:
<details>
<summary>EXPAND...</summary>

import time

GUID = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
ITERATIONS = 10_000

def hashme():
    key = "dGhlIHNhbXBsZSBub25jZQ=="
    start = time.monotonic_ns()
    for _ in range(0, ITERATIONS):
        response_key = hashlib.new("sha1", key.encode())
        response_key.update(GUID)
    return time.monotonic_ns() - start

import hashlib
duration = hashme()
print...
manic glacierBOT
#

I don't have the hardware to test #8772 but the S2 version of the board was rotating the screen 90 degrees and I do have that board so I stole @kreier's changes and tested them on the Lilygo ttgo T8 S2 ST7789.

I did run a color test and the 0x68 on board.c line 44 results in the proper colors being displayed.

I changed the row start to 53 to remove the bottom noise line that showed up when rotation was set to zero.

manic glacierBOT
#

I have since found out that the location where CONFIG_ULP_COPROC_TYPE_FSM should be defined is in ports/espressif/esp-idf-config/sdkconfig-*.defaults.

The issue seems to be that idf.py menuconfig only allows either CONFIG_ULP_COPROC_TYPE_FSM or CONFIG_ULP_COPROC_TYPE_RISCV to be defined but not both at the same time. This is despite the ESP32S2 and S3 having both the FSM and RISCV ULPs...

It looks like this issue has to be fixed upstream in the espressif toolchain. In the mean...

manic glacierBOT
manic glacierBOT
#

usb_hid packages support keyboard, mouse, consumer_contol features based on tinyusb. The examples of tinyusb can support wakeup in host sleep mode but Circuitpython usb_hid packages has no code to support it. I added some code from tinyusb example to Circuitpython usb implementation code. I tested this modification on esp32s2 board and works fine as I expected.

Here are the diff file.

diff --git a/shared-module/usb_hid/Device.c b/shared-module/usb_hid/Device.c
index b28de9c1b1..7d0e6e...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9-18-gee8b6f4e9b on 2023-12-30; Adafruit MatrixPortal S3 with ESP32S3

Code/REPL

import board
import displayio
import framebufferio
import rgbmatrix

DISPLAY_WIDTH = 64
DISPLAY_HEIGHT = 32

matrix = rgbmatrix.RGBMatrix(
    width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT, bit_depth=3,
    rgb_pins=[
        board.MTX_R1,
        board.MTX_G1,
        board.MTX_B1,
        board.MTX_R2,
        board....
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I have this new code that does the same thing ```import board
import displayio
import framebufferio
import rgbmatrix

displayio.release_displays()
matrix = rgbmatrix.RGBMatrix(
width=64, bit_depth=4,
rgb_pins=[
board.MTX_R1,
board.MTX_G1,
board.MTX_B1,
board.MTX_R2,
board.MTX_G2,
board.MTX_B2
],
addr_pins=[
board.MTX_ADDRA,
board.MTX_ADDRB,
board.MTX_ADDRC,
board.MTX_ADDRD
...

atomic summit
#

Advanced happy new year to everyone here (I live in the future). Thanks all for the amazing work on CP and excellent support to the community in 2023.

manic glacierBOT
manic glacierBOT
empty salmon
#

list of preferred pin names?
Is there a list of preferred or recommended names to use for pin on boards with I2C, SPI, I2S, UART, analog pins, digital pins, and buses?

manic glacierBOT
tulip sleet
empty salmon
#

@tulip sleet - unique form factor. RP2040.

tulip sleet
#

then I would suggest using GPnn, and taking other cues from the Pi Pico board def

empty salmon
#

I thought the PICO use GPnn ?

empty salmon
#

Ideally, I’d like the pin labels to align with most of the Adafruit tutorials.

tulip sleet
#

yes sorry

spare jacinth
#

Imo something like "SPI" (ie default config for the bus) doesnt make sense unless you have some special connector, because pretty much any set of pins can output SPI (same thing with I2C)

empty salmon
#

For the generic pin labels, I am using the GPnn format.

tulip sleet
#

it's up to you how you are doing the silkscreen on the board. We recommend providing pin names that match the silk. You can also add pin aliases that make sense

empty salmon
#

The RP2040 does have pins for I2C, UART, etc. I assume, when exposing them I could use both labels (if space allows)

#

OK. I’ll look thru a bunch of boards to get a consensus on label names.

tulip sleet
empty salmon
#

e.g. for SPI, using MISO, MOSI, SCK, etc and for I2C using SCL and SDA. For power enable, I currently use *_EN corresponding to whatever it is powering.

tulip sleet
#

For a Feather, a Qt Py, a Metro shape, etc. yes, there are standard locations for those pins, so we label SCL and SDA, etc. For your board, there is no standard, unless you want to make one. If you have a STEMMA or Grove connector, certainly yes

empty salmon
#

I just wasn’t sure if there was a recommendation list somewhere. Sounds like the answer is “no”.

tulip sleet
#

use similar boards as a guide, since we have reviewed those choices

empty salmon
#

It does have a STEMMA QT connector.

tulip sleet
#

so you could label those pins as SCL and SDA, unless you ALSO want other pins to be designated for non-STEMMA I2C

empty salmon
#

It also has the analog pins so I will alias those as well.

#

All I2C are on the same pins so I will use SCL and SDA

stuck elbow
atomic summit
stuck elbow
#

oh no

orchid basinBOT
manic glacierBOT
#

I hate to do the "me, too" thing because I have a problem that's either identical or totally different. :-) I'm on a Adafruit MatrixPortal S3. Once the boot sector gets clobbered and you have to restore it, it goes flashy-flash and then:
➜ git:(mps3) ✗ cp ~/Downloads/MatrixPortal_S3_FactoryReset.uf2 /Volumes/MATRXS3BOOT/
cp: /Volumes/MATRXS3BOOT/MatrixPortal_S3_FactoryReset.uf2: fcopyfile failed: Input/output error
cp: /Volumes/MATRXS3BOOT/MatrixPortal_S3_FactoryReset.uf2: fchmod failed: ...

manic glacierBOT
#

Sorry, my mistake. The correct value for MADCTL is 0x68. I checked three values in different builds and the impact on the screen:

  • 0x08 is the old value used prior to this pull request. colors are fine, refresh from left to right
  • 0x60 flips the D3 bit of MADCTL. Colors created by adafruit_display_text are not affected, RGB values submitted with the color attribute in Label render the RGB color as intended and before. But colors used as color_palette[0] in `displayio.Palet...
manic glacierBOT
#

@robertlipe It's the same problem. It's not actually specific to CircuitPython or even USB, it happens with any small FAT12 (and I think FAT16 but I've honestly lost track at this point) filesystems with Sonoma.

It appears to be a bug in the new user-space FAT filesystem implementation that Sonoma has.

You can work around it by remounting the MATRXS3BOOT drive the way remounting CIRCUITPY works. This oddly forces the old kernel filesystem code to run instead, which still works properly....

manic glacierBOT
#

Thanx for confirming. Ejection in this case happens upon mostly successful
write of the utf file when upgrading firmware. The device "eats" the file
and then resets itself, which forces an abrupt removal and thus
destruction/re-enumeration of the device.

In my second day of ownership, I'm finding the MATRXS3 is already really
flaky on a boot; S3's using MTP seem to already hang on boot
https://github.com/espressif/arduino-esp32/issues/6762, with no fix in
sight. (My fleet of ones ...

manic glacierBOT
#

Of course, this is the month after my Applecare expired, so I can't report it. :-/

There's no problem reporting it - it's an OS bug. You can use the Apple Feedback tool and refer to other Feedback numbers that are listed above.

If only macOS did implement MTP -- it would be a more reliable solution, and we could use a better filesystem underneath. But the iPod-only attitude meant they never did it.

manic glacierBOT
onyx hinge
#

Howdy folks & happy new year. Remember that there's no meeting today -- instead, it'll be tomorrow (about 25 hours from now). I'm looking forward to hearing what everybody's been up to! <@&356864093652516868>

manic glacierBOT
#

I guess this falls under feature request:

I've been looking into implementing a more responsive debouncing algorithm for
the keypad module. The motivation should be obvious: the current implementation
is a scan rate limiter which effectively implies a random input delay between 0
and interval seconds, which can be undesirable in various applications.

What I have implemented and tested as a minimum impact improvement is an
additional parameter debounce_cycles to the scanner initi...

slender iron
#

Happy new year everyone! Here is the kickoff post for #CircuitPython2024. I set the deadline at the end of the month because I'll be out the next two weeks to visit family. I'll try to blog up folks' posts though while I'm there. https://blog.adafruit.com/2024/01/01/circuitpython-in-2024-circuitpython2024-python-circuitpython/

Adafruit Industries - Makers, hackers, artists, designers and engineers!

Happy 2024! As the year starts, let’s take some time to share our goals for CircuitPython in 2024 and beyond. Just like past years (full summary 2019, 2020, 2021, 2022, and 2023), we’d like e…

manic glacierBOT
short tendon
#

Random question on .mpy files and typing. I've noticed (although not dug in too deep) that when typing information is defined in .py files, that it takes up space in the .mpy file. Is it possible to make that not happen?

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit MatrixPortal S3 with ESP32S3
Board ID:adafruit_matrixportal_s3
UID:84722ED31008

Code/REPL

import board
from digitalio import DigitalInOut, Direction
# from adafruit_debouncer import Debouncer

class InvertedDigitalInOut(DigitalInOut):
    """A class that provides an inverted version of DigitalInOut pins."""

    def __init__(self, pin):
        super().__init__(pin)

    ...
manic glacierBOT
blissful pollen
onyx hinge
# short tendon Random question on `.mpy` files and `typing`. I've noticed (although not dug in ...

The import and try/except will unfortunately take up space no matter what. The annotations themselves do not take up space. I have experimented with re-writing Python code automatically before mpy-compiling to recognize common idioms , but never came up with anything good enough to ship. https://gist.github.com/jepler/9ae2dbe8fda6ee5ff9e9360efe3bc157 #circuitpython-dev message

We've also discussed various ways to minimize the extra mpy space but I don't know that we've written up a best practices guide. Folks just kind of do whatever they've seen somewhere else.

I think the ideal solution IS some kind of ast-manipulation one PLUS a best-practices document so people can get a clear statement of how to ensure their type annotations have as little overhead in CircuitPython as possible.

Gist

GitHub Gist: instantly share code, notes, and snippets.

onyx hinge
#

@lone axle @gilded cradle let me know if you can read your usual sections in the meeing today.

lone axle
onyx hinge
#

@lone axle that's exactly why I checked. No worries.

#

If any other meeting regulars would like to take a turn reading the library update let me know! otherwise I've got it covered.

onyx hinge
#

thanks Melissa

thorny jay
#

Hi, no CP activity since the last meeting, so I will not write anything in the notes.

This would have been my busy "Non CP" section:

  • Turning a Pi4 into a Home Assistant server
  • Connecting the smart doorbell (ESP HOME)
  • Reading power consumption from the electricity smart meter (P1 interface) connected to an ESP HOME
  • Reading temperature/humidity from 4 LYWSD03MMC (flashed) using Bluetooth relay from ESP HOME
  • Setting up a Pi5 + Pineberry PCIe bottom + SSD + Plex Server
  • Growing my UniFi network with manageable switches and a VPN to France with dedicated Vlan/Wifi
  • Got a PowKiddy RGB30 for Xmas and I installed my Pico8 licence to have a physical "virtual" console

(don't hesitate to ping me, maybe DM, if you have questions about any of those)

Have a good 2024.

onyx hinge
#

<@&356864093652516868> meeting in about 8 minutes, sorry for the late notice.

blissful pollen
#

Lurking today, no notes

orchid basinBOT
silver tapir
#

This is inaturalist
https://www.inaturalist.org

#

I'll certainly write about cpy24, but wifi with bt on esp32 families that have it, which is already being worked on.

OTA updates with uf2 might be very very cool as well. (or at least an update via the cpy site installer that works via wifi)

#

Thank you for hosting jepler.

gilded cradle
#

Thanks, have a good week too

onyx hinge
#

Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1Z2eoPQUUiMq5NK6sINJRZ-byxr5CSbZQm2u0cEehjkU/edit?usp=sharing

proven garnet
short tendon
manic glacierBOT
orchid basinBOT
pseudo idol
#

I'm having a problem where 4 different circuitpython boards (ESP32C3 by Seeed) used to perform flawlessly, but have recently stopped responding to the web workflow, and even to pings to their ip addresses. I would think they were dead, but they continue to post sensor data to an MQTT server. I'm now trying to understand the network services that live under the REPL and handle stuff like MDNS replies, web workflow, etc. Can I get a pointer to the circuitpython repo area that does that bit of service code?

lone axle
slender iron
pseudo idol
#

@lone axle Thanks, I'll check. @slender iron 8.2.8 and 8.2.9. But this issue survives a power-cycle and other resets.

slender iron
#

oh! surviving a power cycle is weird!

pseudo idol
#

Tell me about it. 🙂

#

I thought maybe my code was interfering, so I cleared flash and installed 8.2.9 from scratch. Only patched up settings.toml to get on wifi, and it still fails.

#

Does the bootloader get involved? I've checked my network. I can see the MDNS request go out from my browser, and other MDNS replies from the printer and Tivo come back, so the multicast appears to be working.

manic glacierBOT
#

If it helps anyone, this is the script I've been using lately. Taken from comments above. Works with bootloader disks by giving it the diskname as argument (remount-circuitpy.sh FEATHERBOOT)

#!/bin/bash
# remount-circuitpy.sh -- remount a FAT disk, usually CIRCUITPY, so it works
#
# Works around bug where macOS 14.x causes file corruption on small FAT
# filesystems. The remount apparently causes older kernel FAT driver
# to be loaded. see https://github.com/adafruit/circuitpyth...
slender iron
#

is it just MDNS that is broken?

pseudo idol
#

That worked for a while, at least as far as asking for log-in info.

#

But no longer. No ping response either given a numeric IP.

#

I don't understand the web workflow well, but circuitpython.local seems to make the MDNS request, which is unfulfilled

slender iron
#

hmm, can you get serial output over usb?

#

correct .local is mdns

#

ip should work too if mdns doesn't

pseudo idol
#

that takes me to cpy-<mac addr>.local which was intermittant (when I could get there.) If I go direct, that also fails the MDNS request.

#

I can get to serial over usb cable. I'm unfortunately becoming adept at writing file read and write utilities over the REPL

slender iron
#

that's good. you could build your own CP and add print statements in then

#

do you see the ip in the serial terminal title bar?

pseudo idol
#

yes

slender iron
#

but it doesn't respond when you visit?

pseudo idol
#

nope. ping <numeric ip> doesn't respond either. (should it? I thought it did in the past....)

slender iron
#

I'm not sure ping will work

#

http should

#

you can add debug prints into the code and they'll go out the serial link

pseudo idol
#

I misspoke: ping does work if you give it long enough. 9 fails, then reliable

slender iron
#

hrm

pseudo idol
#

and now http://ip brought me to the welcome page. full code editor link takes me to http://ip/code/ and wi-fi dialog again takes me to cuitpython.local/code/ which doesn't respond

slender iron
#

.local is mdns

#

so maybe that isn't working

pseudo idol
#

I'm wiresharking the network, and I do see MDNS traffic from other units on the network, but no response for circuitpython.local.

#

which implies to me that it's not a firewall issue on my computer

slender iron
#

hmm, all cp devices should respond to circuitpython.local

pseudo idol
#

agreed.

sick creek
#

yeah that would be base to respond for sure

pseudo idol
#

in web_workflow.c, I see CIRCUITPY_WEB_INSTANCE_NAME is used in MDNS

slender iron
#

I've gotta run. I think you are looking in the right portion of code

sick creek
#

later tannewt

slender iron
#

ports/espressif/common-hal/mdns will have mdns calls into the ESP-IDF too

#

a debug build make BOARD=foo DEBUG=1 will turn on IDF logging which could help too

#

may go out a different uart from the one on the internal converter

pseudo idol
#

If I set that to anything other than it's cpy-<mac> (which I have) could that be it?

slender iron
#

ya perhaps. I haven't tested it much with overriding from user code

pseudo idol
#

@slender iron Thanks for the pointers so far. I'm trying to avoid learning to build cpy from scratch, but if a cleaned up settings.toml doesn't do it, I can see a "fun" evening ahead.

slender iron
sick creek
manic glacierBOT
pulsar sleet
#

where does the matrixportal s3 put debug data when building with DEBUG=1

manic glacierBOT
pulsar sleet
#

The printed out data. Does it show on the uart to usb converter or do I need to connected up a uart reader on different pins

manic glacierBOT
#

Hi,
I wrote a program that fit in an rp2040 featherwiing, then added features, then got this error:

Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.

I then stopped calling the added code, but it still crashed, I then started commenting out the code
that wasn't called, and eventually I could again run the program (with limited features).

I'm thinking that so...

stuck elbow
lone axle
#

I read it with a USB serial adapter

pulsar sleet
#

I got a KB2040 I got for free because I spent a certant about on money and I use that as a uart to usb converter (just printing uart input)

#

where is the script to debug the DEBUG pin. I tried to find it online but no luck.

lone axle
#

I think <board> argument should be the same name used when making a build for that device. It's been a while since I used it though I could be misremembering. Then you paste the hex or whatever was output on the debug pin into the prompt from this script.

manic glacierBOT
pulsar sleet
#

I think I am doing something wrong becuse in putty I am getting
0�ßÕ· !1H�¤&9�¥�§�¶)!)§�í¬��!�!)���!�í�§��!�§))))�í�)!äÿ­�1¤)9)=1!)©���
maybe wrong baud rate

lone axle
#

yeah, it should be legible characters I'm pretty sure.

pulsar sleet
#

looking online the bause rate should be 115200bps

#

running a debug build with code that hard crashes (looks like it) doesn't go into safe mode. The circuitpy drive isn't mounting and there isn't a port to connect to. Connecting to the uart with a external device shows just the crash. It looks like it just doesn't reset after crashing

#

actually it did connect but I can't get into safe mode by pressing the reset butting while the neopixel is yellow.

manic glacierBOT
pulsar sleet
crimson ferry
#

@pulsar sleet sometimes the trace you get on the debug console is corrupted, but if it isn't you can decode it using ports/espressif/tools/decode_backtrace.py

manic glacierBOT
manic glacierBOT
#

This is a fascinating question that involves some of great questions of computer science! Which unfortunately isn't likely to be solved on an RP2040 :)

In formal computer science, this is called "the halting problem" - I'll paraphrase, but it's believed that there's no more efficient way to determine the behavior of a program than to actually run the program. While there are some trivial cases that are simple to recognize, we're not able to ...

short tendon
#

@lone axle sorry for the direct ping, but trying to learn the flow. You reviewed and tested my requests header fix PR, is there a next step?

lone axle
short tendon
#

Cool. Thank you

manic glacierBOT
#

macOS Sonoma 12.3 beta2 out today, no improvement.

Filed updated feedback including the new information about the filesystem implementation and a suggestion that Apple simply disable the new implementation. Include links to this whole issue and to the detailed trace. Requested they simply disable the user space filesystem until they have the bandwidth to fix the real problem.

My latest feedback ID is FB13513401, referencing FB13469123 FB13468526 FB13269327 FB13428357 FB13416096 FB132266...

vital dune
#

Hello folks. Newbie question. I am trying to install CircuitPython on a particular ESP32-S3 module. Is there an easy way to see if a build is premade for a specific variant?

gusty siren
#

This might not be the right place, but I was hoping someone on the adafruit team could take a look at https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/pull/184 and https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/issues/148 ?

GitHub

Hi folks -- I've run into this issue on the Feather RP2040: #148
Not too sure if this is the proper fix for everyone, but this unblocked our team so I thought I'd share a PR. Happy to fix a...

GitHub

CircuitPython version W5500-EVB-Pico board adafruit-circuitpython-wiznet_w5500_evb_pico-en_GB-8.0.0-beta.6.uf2 adafruit-circuitpython-bundle-8.x-mpy-20230126 Code/REPL import board import busio fro...

manic glacierBOT
#

HI,

My understanding is that the halting problem is the indeterminacy of whether a program will or will not halt,
not whether it will run out of resources.

There's a bit difference between knowing the future over the long term and predicting what will happen on the next step.

Why aren't there runtime calls that can be used to check for heap and stack space before allocation, like C's malloc?

It's interesting that a warm boot doesn't find the problem but a cold boot (power cycle...

manic glacierBOT
crimson ferry
#

If your particular variant is not there, you can make a PR for it (in some cases, there may be a board that's close enough: ram size, flash chip type and size, etc)

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I tried with 8.2.4 and also 8.2.9

I'm not sure its responsible to recommend running code labeled "alpha.-dirty"

I tried 3 different levels of code excision because at first I thought it was code execution (me at fault) and not code loading (maintainers missing something), but only the last level, removal of unexecuted code prevented hard crashes
level 1. removing libraries, conditional imports (disable features)
level 2. conditional execution (more disable features)
level 3. co...

proven garnet
#

@lone axle the work you did on RTD, did that include updating the web hook? I just got an email saying that those need to be updated on some of the projects I created on RTD.

#

Apologies if I'm waaaaay behind.

lone axle
spare jacinth
#

just saw #7305 and thought it would be interesting to dive into it

in order to achieve it, im looking for the piece of code that creates the new class at C level after parsing Py's source (still havent found), during my little trip across the code i've seen mp_obj_is_native_type but im not sure if that would be the best function to use (maybe some checking needs to be crafted into a new function instead)

also, my idea so far is to emit a Warning when code tries to inherit from a native class. ie: not actually crash the program but let the user know it may be a bad idea.

  • reason not to actually raise being that some native classes (or at least some particular inherits) might be safe (?) .... and i dont know (maybe just lack of knowledge about the codebase) it there's a good way in which classes could note "hey, im fine being inherited from" (in which case we could default to Exception for all types, but emit a Warning for the "safe" classes, probably)
  • downside being that crashes would not be prevented without a raise 🙃
manic glacierBOT
#

here's my theory, circuitypy sets a sentinal (checksum result?) but only checks it on soft reset after a bad program load,
and regenerates the sentinel on a power cycle

scenario 1. reboot, loads good small code.py, everything is ok

scenario 2. bad large program is copied to code.py after previous ok program (scenario 1),
soft reboot, loads too big program but too-big program / sentinel is not checked,
program runs until power cycle and hard boo...

proven garnet
manic glacierBOT
manic glacierBOT
lone axle
manic glacierBOT
manic glacierBOT
#

I asked about Sonoma, because there is a pretty bad bug in it right now, which corrupts the filesystem. My hypothesis was that maybe with the bigger file it doesn't get all written to the filesystem before the reset, so the file gets corrupted and that then causes a crash when CP tries to execute it. But if it was on Catalina, then I have no idea.

How Python in general executes files is two-stage: first, it parses the file and compiles it into bytecode, and then the bytecode is getting exe...

mortal iris
onyx hinge
#

ooh synthio has art now

manic glacierBOT
#

@schaefer01 That's a great point about the "halting" part of the halting problem, but it's not just about the indeterminacy of whether a program will halt. In the abstract, the halting problem is about the general indeterminacy of the program's behavior. From a formal computer science perspective, again vastly simplifying, you can map any program to a halting program. The focus on halting is just to make the problem manageable. So again, it's believed in formal computer science that you can't...

knotty trail
#

If I wanted to add a board, that had a library specific for that board, would I put the library in the main circuitpython project? Or would I fork and compile it and create a frozen module?

It’s a C driver for an RP2040 that is specific to the board I made. It also has a python part that is higher level stuff, but relies on the C driver

Just not sure if it makes sense to put a board specific driver in the circuit python repository

knotty trail
#

Some more context: I made a RP2040 based board with a MCP2515 CAN controller on it. I know that Adafruit has (basically) the same combo, but my board has headers/features specific for my application.

I am not really satisfied with the Adafruit MCP2515 CAN driver because it uses blocking calls for CAN, and waits until a message is received or timeout to return the message. This is inconvenient because it prevents other timing-critical tasks like driving NeoPixels, displays, etc. What my driver does is dedicates the RP2040's second core to managing CAN, and stores every message in an array, and updates the array with the most recent message. It also has a queue for transmitting messages, creates a system for messages to repeat (helpful in automotive applications), and other small features helpful for me. The circuit python side (still in development) basically just communicates with the lower level CAN driver in a way that doesn't use blocking calls. I plan on using it for robotics and for automotive uses, so I will have features in the CircuitPython relevant to that as well.

Unfortunately, my CAN driver is specific to the RP2040 and MCP2515, and really my board's wiring, so it wouldn't necessarily work on the RP2040 Feather CAN (I haven't checked though), and it wouldn't be applicable for any other boards.

With that being said, I am wondering where the best place to put the library is. I am not sure if it's wise to put it in the circuitpython repo because it's so specific, but I also want to be able to sell this board in the future, and the requirement for my board to be able to use CircuitPython (https://github.com/adafruit/circuitpython#branding), it has to be supported by the primary CircuitPython branch. Plus, I want to be able to contribute to it if/when I do more development

GitHub

CircuitPython - a Python implementation for teaching coding with microcontrollers - GitHub - adafruit/circuitpython: CircuitPython - a Python implementation for teaching coding with microcontrollers

manic glacierBOT
#

I would like to use the following Waveshare EPaper display with CircuitPython.

https://www.waveshare.com/product/displays/e-paper/epaper-1/7.3inch-e-paper-g.htm

It is a 4-color display (Red/Yellow/Black/White).
4 pixels per byte are transmitted (= 2 bit color depth).

Black: 00b
White: 01b
Yellow: 10b
Red: 11b

I have seen in the current C source code that the 7-color display from Waveshare is already supported. Unfortunately, I am not able to contribute C code for the 4-color v...

#

romkey, good point.

I've thought more and believe that there's two kinds of halting problems, the first is when the program is known to be correct, i.e. is the end condition ever reached?

The second is, is the program correct?, i.e. is there a bug? I've got the second kind of halting problem. There definitely is a bug, but where is it, in circuitpy itself, or in the host os, or in the interaction in interface between the host os and the featherwing during program load?

Computer sc...

manic glacierBOT
#

On behalf of all of us with this issue, our thanks for staying on top of this.
On Jan 3, 2024 at 8:03 PM -0500, John Romkey @.***>, wrote:

macOS Sonoma 12.3 beta2 out today, no improvement.
Filed updated feedback including the new information about the filesystem implementation and a suggestion that Apple simply disable the new implementation. Include links to this whole issue and to the detailed trace. Requested they simply disable the user space filesystem until they have the b...

onyx hinge
#

@knotty trail we don't currently have a solution for shipping native code routines that are not "in the core".

#

so you would hypothetically add your routines in shared-bindings and shared-modules (or ports/raspberry-pi/common-hal if it relies on rpi specific hardware features) + a new frozen library

#

that said, we are unlikely to want to offer multiple incompatible APIs for canbus within the core. is there any way to evolve the current API so that it is more suited to your use cases? mcp2515 is pure python code outside the core, while we have canio for some mcus with built-in can peripherals.

knotty trail
#

@onyx hinge I was looking at evolving the existing canio interface but my implementation isn’t as nice as the existing canio interface. Also, it is somewhat specific for the rp2040. Maybe I could create an rp2040 specific canio interface but I’m not sure if that will work for all projects since it uses the second core to constantly monitor the MCP2515 and that could affect other libraries.

I will look further into evolving the canio module later. I think for now, the best option may be to just fork circuit python and list my board as CircuitPython-compatible. That kind of sucks because I’d like for it to be listed on the circuit python site, but it is what it is

onyx hinge
#

can you say a little bit more about how it's specific to rp2040, when the mcp2515 is just a SPI connected device?

#

oh the second core, hmm

knotty trail
# onyx hinge oh the second core, hmm

Yes. Basically all the second core does is poll the MCP2515 as fast as possible. I tried using interrupts but after trying to read/store over 1000 messages/sec, it locks up.

With continuous polling, I’m able to process over 8000 messages per second, which is basically a 1MB/s CAN bus near 100% utilization. I haven’t tried more than that but I’m sure it can handle it.

I also have a message transmit queue so you can queue up to 32 messages to be transmitted instead of only 3 (tx buffers). I also save the count and timestamp of each message. I also have a mechanism to send messages every x milliseconds, even if the data wasn’t updated. This is useful for vehicles or devices that require a constant stream of messages and would set a fault/dtc if it didn’t receive a message on time.

What’s also nice is that since it uses the other core, the first core doesn’t have to do any busy waiting. This use useful if you have any neopixel animations or other sensors you are polling

It’s really useful for gateway-ing messages, Robotics, and I even have plans to use it on a solar hybrid inverter

The limitations on the python MCP2515 implementation is that it doesn’t save every message, it will wait until a message is received before returning, which can mess up neopixel animations and other sensor reading routines, and it has no method to continuously send CAN frames every x milliseconds

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@schaefer01 This isn't really a great place to chat without bugging everyone else who may have posted on this issue or be monitoring CircuitPython issues. If you want to chat more about it, Adafruit has a very friendly Discord server. That's also a great place to seek support next time you need it.

Since your problem was identified, I'd suggest closing this issue, but I'm not one of the maintainers.

short tendon
#

Pre-planning. Does anyone know if the right people will be in this coming up Monday meeting to talk about ConnectionManager?

short tendon
#

Also, if this gets accepted, if a board has frozen requests, this would also need to be frozen in, yes?

onyx hinge
#

yes about the freezing. I am not sure when Dan and Scott are back.

short tendon
#

Thanks. If it's given the go ahead, I'll open ALL the pull requests...

slender iron
tulip sleet
#

i just got back

slender iron
short tendon
#

Should I then wait until the 22nd (the first Monday both are back)?

bright robin
#

Is it possible to use 16-bit commands with DisplayIO's API? I'm trying to write a board.c file, but it seems like common_hal_displayio_epaperdisplay_construct is hardcoded to use one byte commands, then immediately send the data.
I'm thinking maybe I can setup everything in the display_start_sequence and then just set all the commands to NO_COMMAND ?

#

Actually, sequences work fairly well, it would be great if all the command parameters just used a sequence rather than a byte.

#

(I might trying making a pull request for that...)

lone sandalBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
#

Technically it only needs a change of one line in mpconfigboard.mk with the adjusted CIRCUITPY_ESP_FLASH_SIZE = 4MB and now CircuitPython runs on versions with a smaller flash chip. I have several boards here and they are still available to order.

While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using `displayio.Pal...

manic glacierBOT
#

The CI found a duplicate creation ID, you'll probably want to change CIRCUITPY_CREATION_ID to be something like 0x00320004 (https://github.com/creationid/creators/blob/main/creations/lilygo.md). You'll also want to make a PR against https://github.com/creationid/creators to add the new creation ID.

From the How to add a new Board learn guide:

Creator/Creation IDs
For boards th...

manic glacierBOT
#

I confirmed this issue exists on TFT screens as well with a Feather ESP32-S2 TFT.

Here is some reproducer code that can run on any device with a built-in display:

import board
import displayio
import vectorio

main_group = displayio.Group()

palette = displayio.Palette(2)
palette[0] = 0x00ff00
palette[1] = 0x000000

display = board.DISPLAY

display.rotation = 180

print(f"width: {display.width} height: {display.height}")

border_rectangle = vectorio.Rectangle(pixel...
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Cytron Maker Pi RP2040 with rp2040

(issue also occurs with CircuitPython 9.0.0-alpha.6)

Code/REPL

n/a

Behavior

When using Windows with Samsung Magican (SSD utility) installed (actually it's the SamsungMagicanSVC running) the board boots using the out-of-box demo code that comes with the Maker PI RP2040 but hard faults after a few seconds. The CIRCUITPY drive gets listed in Windo...

gaunt bolt
#

I would like to suggest adding a method to the module "wifi.Radio" for getting information about connected devices when the board configured as an access point (i haven't found a way to get this info). Should I write it on Github?

crimson ferry
#

@gaunt bolt yes, you can create an issue on the circuitpython repo

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit Macropad RP2040 with rp2040
Board ID:adafruit_macropad_rp2040
UID:DF61B0C28717182F

Code/REPL

# N/A; this is a bug in the HID Report Descriptor as seen by a host, but here is the code.py, which is one of the MacroPad demos

# SPDX-FileCopyrightText: Copyright (c) 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
Rainbow LED grid layout demo ...
tame creek
#

wow that formatting came out weirdly

manic glacierBOT
#

The core module wifi.Radio does not provide any method to know if there is any device connected to the board when it is configured as access point. I would like to suggest the development of the following method:

  • .connected_clients -> list of of connected devices
  • connected_clients[].IP -> IP address of a particular connected device

For applications when we have to transmit sensor data to connected devices (e.g. musical controllers), this is radically important. We usually do not re...

empty salmon
#

@slender iron - I recall an open issue regarding the use of the second core on dual-core MCUs. The options quickly became untenable.

I like the idea of having a CircuitPython core level capability since the second core is a hardware capability, having the board’s CircuitPython firmware has appeal.

For my board, I struggle to see what makes sense to go on the second core because everything has “end-user” applications - e.g. neopixels, touch sensors, and SPI display, audio (often used with synthio).

To take advantage of any of these, a portion of the existing core code would need to be shunted over to the second core; then the user calls would need to be routed according.

Like before, things get complex quickly.

manic glacierBOT
manic glacierBOT
ornate cave
#

@ és Alex ( @night canyon )

#

@night canyon

night canyon
#

#general-chat Itt megy a beszéd itt fejlesztés/ hibabejelentés megy
(sorry)

manic glacierBOT
manic glacierBOT
#

The CI found a duplicate creation ID, you'll probably want to change CIRCUITPY_CREATION_ID to be something like 0x00320004 (https://github.com/creationid/creators/blob/main/creations/lilygo.md). You'll also want to make a PR against https://github.com/creationid/creators to add the new creation ID.

From the How to add a new Board learn guide:

Creator/Creation IDs For ...

manic glacierBOT
#

Can you describe the user case more? Are all connected stations equivalent, with the same packets going out to each, or is there some other way to know what each one can do?

I think the event handler process is more complex since stations connecting (and then obtaining an IP address) and later disconnecting means state for each station will have to be tracked in real time and persist until the next change.

The latter alternative above is a call to get a list of the IPs (and potentially ...

manic glacierBOT
#

Some esp32s3 boards like lilygo t-display-s3 come with a display connected via 8080 interface, so having parallelbus back on ESP would be nice....

I started working on a port for the LILYGO T-Display S3 and ended up here. Its feasible to get the display working inside the build. However, my cursory look leads me to believe the new ESP drivers are quite different from the old ones. I don't have the smarts to try and tackle it myself, but I'd be more than happy to test any feature branches...

knotty trail
manic glacierBOT
#

In my opinion it doesn't matter if different packets go to different clients if an enough informative event handler is created. In the past, I coded these applications in Arduino using similar code to this: https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino

The device transmiting would implement the following event handlers:

``

manic glacierBOT
lone sandalBOT
orchid basinBOT
marble hornet
#

blinkaHi all 😁👋 it's been a hot sec

#

I've been encountered a build problem (maybe🤷‍♂️🧐) on main* and, if someone has a few minutes, I wonder if it's worth a sanity check?
(typing...)

#

Oop! never-mind it looks like it's because there was a space in a directory that was part of the path to circuitpython 😅 .... 🤦‍♂️

#

I'll see if it's easy to add a check or fix to makeversionhdr.py (where the error occurred) hopefully before the meeting.

manic glacierBOT
empty salmon
#

Which arm-none-eabi?
This may be an obscure configuration but here it is: Using VMWare Fusion for Ubuntu guest (ARM64) on MacOS host (Apple Silicon). I am not sure which toolchain to download.

tulip sleet
#

The host is macOS; the target is AArch32 bare metal (arm-none-eabi)

tulip sleet
#

this may also be in homebrew, but I don't know

mortal kernel
#

(That's for running the toolchain on your Ubuntu guest)

tulip sleet
#

whoops sorry, yes, bob is right, I was looking at the macOS host, not Ubuntu guest on VMWare

empty salmon
#

I tried arm64-arm-none-eabi.tar.xz and I cen an exec format error cannot execute binary

#

So perhaps the aarch64-arm then?

mortal kernel
empty salmon
#

Thanks. We are all landing on the same conclusion concurrently 👍🏼

tulip sleet
#

there are boldface categories

#

but they are hard to spot

empty salmon
#

Irony is the bold category labels are a slightly smaller font from the sub-category labels 🫣

#

we have a winner!

mortal kernel
#

@danh I'd like to take up reviving the CP fork of the CYW43-driver.

empty salmon
#

The aarch64-arm is what I needed
(appreciation to @tulip sleet and @mortal kernel)

mortal kernel
#

How do we go about it? It needs to be re-synched, branched, and have a couple of local pulls merged. I'd be happy to do it with if you can give me repo privileges.

tulip sleet
candid sun
manic glacierBOT
blissful pollen
#

No notes, just lurking today

onyx hinge
#

compared to last week this meeting is hopping 🦗

lone axle
turbid radish
#

☺️

candid sun
#

@stuck elbow i think you need to mute

stuck elbow
candid sun
#

all good!

errant grail
#

WaveViz in action

onyx hinge
#

[I keep hearing "wave biz". Hey, I make money in the wave biz.]

blissful pollen
#

That is really cool @errant grail haven't had a chance but wanted to try more with WaveTables and being able to see it is great

errant grail
#

One of the symptoms of the bad and misbehaving SD card.

onyx hinge
#

😦 😦 so many folks with covid right now.

tulip sleet
#

wastewater COVID results tell the tale. North Boston region:

gilded cradle
#

I'm open to using something besides threads if it works as well.

tulip sleet
lone axle
#

I think the threads work nicely, but if I come up with any other ideas I'll make an issue to propose them. PyGameDisplay had actually used Threads prior to the Blinka Displayio update and I think having both making threads was causing trouble. But the latest working revision I have actually removes the threading from PyGameDisplay and relies on just the threading in Blinka_DisplayIO which makes PyGameDisplay much less complex. Just gotta find and hammer out the last few quirks.

onyx hinge
#

I'm sure you'll get it!

#

@proven garnet Adafruit also got a message about a bunch of repos. I tried this with some of the adafruit repos and it did not seem to work; my assumption is that either something's not right at the organization level or my access level is not sufficient.

#

appreciate that Dan!

#

fwiw I do have the ability to log into readthedocs as adabot but it didn't work

#

yes we could do the manual process for them all but it'd be nice not to:)

candid sun
#

i'm also happy to help if repetitive actions are needed

onyx hinge
#

That sounds great, somebody just needs to implement it and make it fit on as many devices as possible.

lone axle
#

The specifics of handling that section of storage is over my head. But the functionality of having that traceback or perhaps other diagnostic info in an easy-to-access file sounds awesome to me.

mortal kernel
#

The big issue with a logging file/filesystem is host OS filesystem caching. Once a filesystem is mounted, the host OS will not see updates reliably or at all.

short tendon
#

Would be great to add logging in there too, so we have some breadcrumbs of what happened

mortal kernel
#

USB events are a possible solution, but I'm unclear whether USB events can be limited to just one filesystem. I believe the event in question forces a remount.

stuck elbow
onyx hinge
#

@tulip sleet fwiw I found that adabot can't do the necessary operation on readthedocs, but if I add myself as a mantainer first [logged into readthedocs as adabot] and then re-sync the webhook [logged into readthedocs as myself] it works. It doesn't matter if I sign in to readthedocs with github or not. maybe we can elevate adabot's permissions on github so that it can administer webhooks?

#

thank you Liz!

gilded cradle
#

Thanks everyone

mortal kernel
#

Thanks all!

short tendon
onyx hinge
#

Next week's meeting is on the 16th (tuesday)

stuck elbow
lone axle
#

Hope everyone has a nice week. Thanks for hosting Liz!

errant grail
#

Thanks to Liz for being an excellent host and for reading the text-only sections.

wraith crow
#

Thanks 😄

candid sun
#

thanks folks!

short tendon
#

Thanks!

short tendon
stuck elbow
tulip sleet
stuck elbow
#

and most of the time it doesn't change

short tendon
#

Ahhh, could the logs be stored in ram, and then only written if there is an exception?

onyx hinge
#

@tulip sleet it tells you "Webhook activation failed. Make sure you have the necessary permissions." on RTD if it didn't work.

stuck elbow
candid sun
#

Here is the notes document for next Tuesday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1BnXAE4EqNirRCWa8SfC291593gxhsrIrJBOcdCfqEeM/edit?usp=sharing

cold oar
#

Hey all - is there a document that lists Adafruit's pin name recommendations for common built-in buses, sensors, etc? I think I've tracked down a lot of them, but haven't found a list of recommendations anywhere.

crimson ferry
manic glacierBOT
#

Addresses issue #8681, enabling the Raspberry Pi Pico/Pico W to swap audio channels A and B in the audiopwmio library.

Notes:

  • Adjust the stereo condition, checking both channels are defined.
  • Remove error handling if the left channel is assigned to pin channel B since the channels can be swapped.
  • Introduce a new variable, swap_channel.
  • Update the code inside I2SOut.c to align with audio_dma_setup_playback and set the swap_channel to false."

Can you help review this?
...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Raspberry Pi Pico with rp2040

Code/REPL

import board
import busio
import digitalio
import displayio
import os
from adafruit_ssd1680 import SSD1680
from terminalio import FONT
from adafruit_bitmap_font.bitmap_font import load_font
from adafruit_display_text.label import Label

# EQUIPMENT
# Raspberry Pi Pico https://www.adafruit.com/product/4864
# 2.13" Diagonal E-Ink DIspl...
manic glacierBOT
#

Thank you!

This seems fine. However, I didn't test anything.

I note that the new swap_channel flag assumes the output data is stored in a 16-bit data type. While this appears to always be true, it's worth mentioning that there does seem to be some (unused) code for 8-bit resolution samples. If we actually do use 8 bit samples in the future, the channel swap code will need to be revisited.

proven garnet
#

I looked into getting rid of inline type annotations, but the only way to provide them per PEP 561 is if the distribution is a package - there is no option for modules. So for any of the modules we would just be stuck with the status quo. There is a draft PEP for this issue that was started a year ago, but no development on it since, it seems.

proven garnet
#

You can trick Pylance in VS Code into finding it with a hack to data-files in pyproject.toml, but not mypy as easily.

manic glacierBOT
#

While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using displayio.Palette() so I kept bit D3 of MADCTL at zero.

And I added the missing pins GPIO36 and GPIO39 even though they can only be used as input. And renamed the buttons to BUTTON_L and BUTTON_R to be consistent with the rp2040 version of this b...

manic glacierBOT
#

While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using displayio.Palette() so I kept bit D3 of MADCTL at zero.
And I added the missing pins GPIO36 and GPIO39 even though they can only be used as input. And renamed the buttons to BUTTON_L and BUTTON_R to be consistent with the rp2040 version of this b...

manic glacierBOT
manic glacierBOT
#

The button name change could break existing code although this PR is against MAIN so it may not show up until 9.x, that being said, the only board that uses BUTTON0 and BUTTON1 is the LIlygo_t_display_esp32_16m. BUTTON1/2/3... is used by a few NRF boards. BUTTON_L/BUTTON_R is only used by the Lilygo_t_display_rp2040 but I'm not sure the L/R (presumably Left/Right) have much meaning for that particular board layout. Several other boards do use BUTTON_LEFT/BUTTON_RIGHT.

I don't think the bu...

manic glacierBOT
#

Biweekly check-in, sad trombone: macOS Sonoma 12.3 beta3 is out today and still broken.

Maybe we could get the attention of one of the Mac new sites? That might get Apple's attention. Though they're probably all hands on fixing bugs for Vision Pro at this point.

Feedback filed, new set of ids is FB13528351 FB13513401 FB13469123 FB13468526 FB13269327 FB13428357 FB13416096 FB13226668 FB13306896

manic glacierBOT
manic glacierBOT
#

Thanks for your feedback!

I appreciate your observation regarding the 8-bit resolution samples. I'll carefully review the code to ensure compatibility with 8-bit samples if needed in the future.

Regarding testing, I have successfully tested PWMAudioOut on hardware, and it's working as expected. However, I haven't tested I2SOut on hardware yet. I'll make sure to perform the test and update you on the results.

manic glacierBOT
mystic flume
#

However, circuitpython still links to commit 3f55e49 of nrfx

#

I've tested just updating nrfx_uarte.c - and that works fine. However trying to compile circuitpython against the most recent nrfx fails with multiple errors - and I'm concerned that it could break other peripherals.

#

I suppose the question is whether I should create a branch of nrfx with just the uarte updates - just a handful of lines are changed, and link CP to that, or some other solution?

mystic flume
#

Looking further at the circuitpython history, the commits after 3f55e49 have never been used in circuitpython

#

I have now successfully compiled circuitpython against a slightly altered nrfx from the latest commit on that branch - and it seems to work. Not sure what a good testing strategy would be however.

tulip sleet
mystic flume
#

Is there a process for testing these changes?

#

I'm thinking something like unit testing but with hardware. Or is it a question of asking people to beta test and report failures

tulip sleet
mystic flume
#

I might struggle to test the SPI stuff, but I think my device uses pretty much all the other peripherals

#

So if my thingy works, likely most of everything else will. I'm just wary having broken USB MSD with a UART fix!

#

I'll have a play and submit a couple of PRs - one to nrfx and one to CP.

onyx hinge
#

I've been seeing a lot of safe mode resets when writing to CIRCUITPY today on my pycamera / memento with latest-ish 9.0-pre code.

#

I have a pile of local changes but none that would affect msc or flash intentionally

tulip sleet
candid sun
#

i'm currently working on a new library (https://github.com/adafruit/Adafruit_CircuitPython_MCP3421) and stuck on a CI issue. i keep hitting this error:

Run circuitpython-build-bundles --filename_prefix adafruit-circuitpython-mcp3421 --library_location . 
Traceback (most recent call last):
  ...
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/scripts/build_bundles.py", line 267, in build_bundles
    build_bundle(libs, bundle_version, zip_filename, package_folder_prefix,
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/scripts/build_bundles.py", line 171, in build_bundle
    build.library(library_path, build_lib_dir,  package_folder_prefix,
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/build.py", line 301, in library
    _munge_to_temp(full_path, temp_file, library_version)
  File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/build.py", line 174, in _munge_to_temp
    with open(original_path, "r", encoding="utf-8") as original_file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/Adafruit_CircuitPython_MCP3421/Adafruit_CircuitPython_MCP3421/adafruit_mcp3421.py'

which makes sense because that file does not exist. the library structure is adafruit_mcp3421/mcp3421.py and adafruit_mcp3421/analog_in.py is there a setting that i'm missing somewhere? i'm looking at the CI script to see if there's something in there. the initial commit passed because it had the cookiecutter structure with that default setup. i deleted that workflow run in case maybe something had been cached but that didn't fix it

GitHub

CircuitPython driver for the MCP3421 analog to digital converter - GitHub - adafruit/Adafruit_CircuitPython_MCP3421: CircuitPython driver for the MCP3421 analog to digital converter

stuck elbow
#

to make that directory a package

onyx hinge
candid sun
#

okay, thank you! i'll add that

spare jacinth
#

and some path may be wrong on part of the setup too?
no idea how this stuff works, but Adafruit_CircuitPython_MCP3421 appears twice, maybe it is pointing to the folder while it should point at its parent (and the library's name gets added)

candid sun
#

same error with the included init.py

onyx hinge
#

@candid sun researching, I'll have an answer for you in a moment

onyx hinge
#

@candid sun please try changing pyproject.toml: ```diff
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -41,7 +41,7 @@ dynamic = ["dependencies", "optional-dependencies"]
[tool.setuptools]

TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,

CHANGE py_modules = ['...'] TO packages = ['...']

-py-modules = ["adafruit_mcp3421"]
+packages = ["adafruit_mcp3421"]

[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}

candid sun
#

ah! i knew it was something like that 😅 thank you!

#

that did it, thank you @onyx hinge

onyx hinge
proven garnet
#

I played with ruff last night for formatting and linting my circuit python related stuff and it blew my mind how fast it was.

#

It would require changing the pylint disables to the equivalent style for ruff, but it's speed plus that it combined black, pylint, and for me pydocstyle made it a really good switch. Plus it has a pre-commit hook.

#

Not sure the libraries would gain much though given pylint and black don't take that much time for something that size, plus it only changes downloading two hooks into one. Plus the changing of linting disables is a pain.

onyx hinge
#

I have also been using ruff in some personal (non circuitpython) software & like it

#

ruff also auto-fixes more things

proven garnet
#

Oh that's awesome that it can automatically handle more stuff

onyx hinge
#

~2400 lines or so

trim lion
#

Unable to upgrade ST-Link, need help

onyx hinge
#

@trim lion to get official help with hardware purchased from adafruit, use the forum: https://forums.adafruit.com/viewforum.php?f=19 -- since the product is from ST, you can also use their support methods, which I am not familiar with.

This particular channel in discord is for discussing development (coding) of circuitpython.

gilded cradle
#

Hello @crude blaze I hear you may be back from holiday and that you figured out a good fix for the rotation/offset with the ST7789 display on the pi.

onyx hinge
trim lion
#

thank you @onyx hinge

crude blaze
gilded cradle
crude blaze
#

@gilded cradle cool let me upload the overlay somewhere, should mostly need pin changes

gilded cradle
#

Ok

crude blaze
#

it works fine but the value for the touchscreen probably need some tweaking but for just a screen all is working, its only draft because of the TSC stuff

gilded cradle
crude blaze
# gilded cradle BrainCraft uses ST7789 rather than ILI9341. Will I need a different overlay for ...

ah didn't realize, yea that needs a different driver.
There is a DRM driver for it but it uses the same compatible string as the fbtft driver so not sure which one would get loaded as both seem to be enabled in the Kernel.

https://github.com/raspberrypi/linux/blob/rpi-6.1.y/drivers/gpu/drm/panel/panel-sitronix-st7789v.c

Otherwise they had recently merged that generic panel-mipi-dbi driver recently where someone had success using that under wayfire with the ST7789V I believe (and also their custom driver but not sure if that got merged into the kernel)

https://forums.raspberrypi.com/viewtopic.php?t=355870

gilded cradle
#

Ok yeah. I've had success with the panel driver, but only if I used X11 instead of Wayland.

crude blaze
#

then it loaded the fbtft driver in that case

gilded cradle
#

Ah

crude blaze
#

panel-mipi-dbi seems to be the way to support SPI based drivers in the future, I think you had added a version of that to the pi scripts repo too but now its included "officially" so that makes it easy to use.
There are a couple good threads on the forum by 6by9 and aBUGSworstnightmare on using that with different panel ICs

gilded cradle
manic glacierBOT
manic glacierBOT
manic glacierBOT
short tendon
#

Random question... Looking at adafruit_portalbase/network.py there is this method get_local_time that does all this crazy breaking up of "%Y-%m-%d %H:%M:%S.%L %j %u %z %Z" to make a time.struct_time. Any reason it's not something simpler like:

TIME_SERVICE_FORMAT = "%Y,%m,%d,%H,%M,%S,%j,%u,0"

which would return

'2024,01,11,16,50,58,011,4,0'

which we could do:

now = time.struct_time([int(value) for value in response.text.split(",")])

and removing 9 lines of code?

lone sandalBOT
tulip sleet
short tendon
#

I'll test around with it a bit more and open a PR if it makes sense. Found it when I was looking to do something similar without reinventing the wheel

covert vine
#

Hi, I'm working on adding board support for a custom ESP32 board. I managed to successfully configure the files, build the firmware and flash it to the board, but I can't get Web Workflow working. The board is connected to the same wifi as my laptop and I can ping the board, but trying to access it via mdns or directly accessing the ip from a browser doesn't work (tried on Firefox and Chromium on PopOs and Firefox on Android phone). I also attached my settings.toml with replaced ssid and passwords, but it should be the same as the instructions... Any suggestions would be welcome, thanks!

tulip sleet
#

Hi, I'm working on adding board support

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.8 on 2023-11-16; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3

Code/REPL

import time
import rtc

now = time.struct_time((2024, 1, 12, 21, 51, 40, 4, 12, 0))
print(now)
rtc.RTC().datetime = now
now = time.localtime()
print(now)

Behavior

struct_time(tm_year=2024, tm_mon=1, tm_mday=12, tm_hour=21, tm_min=51, tm_sec=40, tm_wday=4, tm_yday=12, tm_isdst=0)
`struct_time(tm_year=2024,...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM with ESP32S3
Board ID:adafruit_qtpy_esp32s3_4mbflash_2mbpsram
UID:4F21AFA53806

Code/REPL

class ClassB:
    def __init__(self, bb=None, cc = None, packet_callback = None):
        None

class ClassA(ClassB):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(packet_callback=self.processReceivedPacket, *args, **k...
manic glacierBOT
manic glacierBOT
#

Erreur lors de l'envoi des données: (-8576, 'MBEDTLS_ERR_X509_INVALID_FORMAT')

This is the type of error i get with my program in circuitpython (8.2.9) using PI Pico W and SSL.
SSL is used to secure communication between Pico W and a Flask server running on a Raspberry pi 4.

The certificate looks valid (no weird caracter), was put at the root of the pico W and was generated using this command : openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes.
I don...

manic glacierBOT
manic glacierBOT
#

it seems this let me pass to next step :

Charger le certificat auto-signé

with open("cert.pem", "r") as cert_file:
cert_data = cert_file.read()
ssl_context.load_verify_locations(cadata=cert_data)

but now i got this message :
Données JSON à envoyer : {'eCO2': 400}
Type d'erreur: RuntimeError
Message d'erreur: Sending request failed
with this

print("Données JSON à envoyer :", data)
# Envoi des données à l'API REST via une requête POST
try:
response = ht...

manic glacierBOT
manic glacierBOT
#

(edited code formatting, hope you don't mind)

Do you get Sending request failed consistently? If not, some retrying could help, or skip until the next loop.

You may want to use the traceback module to get the full exception trace, with the lines in the library where errors occur, something like:

import traceback

# ...

    try:
        # some stuff ...
    except Exception as ex:
        traceback.print_exception(ex, ex, ex.__traceback__)
crimson ferry
#

someone please reassure me that raising an exception to pass an interrupt from C code to Python code is way too kludgy to even think about

slender iron
#

What are you trying to do?

crimson ferry
#

it was just a crazy thought

slender iron
#

🙂

manic glacierBOT
#

It seems that the error occur due to the new submodule libraries is still not available.

Do I need to PR the new submodule libraries first before adding the board?

It looks to me like you added the submodules to .gitmodules, but did not actually do a git submodule add for all the new submodules, because the submodules are not showing up https://github.com/CytronTechnologies/circuitpython/tree/add-edu-pico/frozen yet. You shouldn't need to do that in a separate PR, but this PR ...

manic glacierBOT
#

Looking over the product information it looks to me like this board would work with either the Pico or the Pico W. It seems like the plan is to market it for use with the Pico W but you might want to allow for a future version of the CircuitPython firmware built for the Pico by renaming this port to "Cytron EDU PICO W" and updating MICROPY_HW_BOARD_NAME and possibly
USB_PRODUCT (assuming you can get a unique USB_PID, which I believe Adafruit would prefer)

The Pico version would be very ...

manic glacierBOT
manic glacierBOT
#

I'm thinking predefined pins for the detachable Grove modules may not make sense as they may not be present or moved between Grove ports, but the motor controls, logging switch and USB Relay output are permanent so you could also add the following pin defintions:

    { MP_ROM_QSTR(MP_QSTR_MOTOR_1_A), MP_ROM_PTR(&pin_GPIO8) },
    { MP_ROM_QSTR(MP_QSTR_MOTOR_1_B), MP_ROM_PTR(&pin_GPIO9) },
    { MP_ROM_QSTR(MP_QSTR_MOTOR_2_A), MP_ROM_PTR(&pin_GPIO10) },
    { MP_ROM_QSTR(MP_QSTR_MOTOR...
#

If you decide to add the board.SD object from the mpconfigboard.h above then you might want to also add the corresponding CS pin definition and to be complete, I would add all the SD card SPI pins:

// SPI Pins for SD Card
    { MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO16) },
    { MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO17) },
    { MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO18) },
    { MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO19) },
manic glacierBOT
#

Looking over the product information it looks to me like this board would work with either the Pico or the Pico W. It seems like the plan is to market it for use with the Pico W but you might want to allow for a future version of the CircuitPython firmware built for the Pico by renaming this port to "Cytron EDU PICO W" and updating MICROPY_HW_BOARD_NAME and possibly USB_PRODUCT (assuming you can get a unique USB_PID, which I believe Adafruit would prefer)

The Pico version wou...

manic glacierBOT
#

Thanks you Anecdata !
Yes consistently. I thought of a timeout issue or something...

Pico work i can connect to network and send ping to google for exemple.
It seems i have issue with this : response = http_session.post(url, json=data) in ssl context (https)
I simplified the data check the format of the data.
I will try your proposal. I fi can't see clearer i will go to http to see if it works.

Thanks again

manic glacierBOT
#

here is the result of the traceback :

Connected to WiFi
Type de temperature: <class 'float'>
Température: 28.8 C
Type de co2eq: <class 'int'>
CO2eq: 400 ppm, TVOC: 0 ppb
H2: 13815, Ethanol: 19668
Données JSON à envoyer : {'eCO2': 400}
Type d'erreur: RuntimeError
Message d'erreur: Sending request failed
Traceback (appels les plus récents en dernier) :
Fichier "adafruit_requests.py", ligne 515, dans _get_socket
OSError: (-9984, 'MBEDTLS_ERR_X509_CERT_VERIFY_FAILED')

L'except...

cobalt grail
#

Not sure what is going on, but Weblate seems broken to me.

  1. It stopped mailing me notifications.
  2. The suggestions tab is totally broken.
#

Loads of the suggestions is just "%" or similar nonsense.

#

Is this a known issue? We are looking into using weblate in another open source project.

tulip sleet
manic glacierBOT
onyx hinge
#

yikes I had not realized how close to full esp32s3 4MB parts are.

#

bitmapfilter is only ~7kB but it's enough to overflow qtpys & feathers -- camera fits but only because of stuff like audio being turned off.

#

<@&356864093652516868> just a reminder -- there is no meeting today due to the obervation of Martin Luther King Jr. Day. We will meet 24 hours later than usual this week.

tulip sleet
tulip condor
#

Im not seeing #defines for esp32 that is why I dont think it takes advantage of flash memory encryption aes and/or aes hardware acceleration features on the esp32s

onyx hinge
#

@tulip condor our implementation of aesio is in https://github.com/adafruit/circuitpython/blob/main/shared-module/aesio/aes.c and is just a software C implementation. It does not use microcontroller-specific facilities to work.

I don't think the module's API is compatible with CPython. However, it should comply with the AES standard. We test it against several test patterns from the AES specification in tests/circuitpython/aes.py.

GitHub

CircuitPython - a Python implementation for teaching coding with microcontrollers - adafruit/circuitpython

#

aesio vs pycrpyotodome: ```py
CircuitPython:

import aesio
key = b"Sixteen byte key"
inp = b"CircuitPython!!!" # Note: 16-bytes long
outp = bytearray(len(inp))
cipher = aesio.AES(key, aesio.MODE_ECB)
cipher.encrypt_into(inp, outp)
outp
bytearray(b'\xab\xb1\xa1\xf9\x8fW@\x9eEZ\xc0nqS_\xfe')

Python3 with PyCryptoDome:

from Crypto.Cipher import AES
key = b'Sixteen byte key'
inp = b"CircuitPython!!!" # Note: 16-bytes long
outp = bytearray(len(inp))
cipher = AES.new(key, AES.MODE_ECB)
cipher.encrypt(inp)
b'\xab\xb1\xa1\xf9\x8fW@\x9eEZ\xc0nqS_\xfe'

tulip condor
#

thanks a lot !

onyx hinge
# tulip condor thanks a lot !

if you want to dive into low level microcontroller code and add support for AES instructions, that'd be awesome. it's just not anything we've prioritized yet.

For espressif it looks like "just" shifting to using the mbedtls implementation of AES would get you hardware AES support. Which might be a good idea to do in general, similar to how it was done recently with hashlib

tulip condor
#

hum Id have to figure out first if it is supposed to be used directly. It is in the mbedtls implementation of esp-idf but it's not used directly. Even the arduino esp32-arduino library dont use it

#

Also using flash encryption has a lot of side effects and is irreversible

manic glacierBOT
#

CircuitPython version

Main branch

Code/REPL

import sys
print(sys.version)

Behavior

It reports back 3.4.0; MicroPython 9.0.0-alpha.6-17-g2c453390ec on 2024-01-09.
Should this really be left to be reported as MicroPython?

Shouldn't it be something like:
3.4.0; CircuitPython 9.0.0-alpha.6-17-g2c453390ec on 2024-01-09; M5Stack Timer Camera X with ESP32?
to match the repl prompt somewhat?

If this is intentional feel free to immediately c...

cobalt grail
onyx hinge
#

@cobalt grail If the weblate website isn't working properly for you, it's appropriate to open issues on weblate's github: https://github.com/WeblateOrg/ -- you can mention that you are using CircuitPython which is a paid account, not sure if it makes a difference to how they triage issues. It seems they did change something about e-mail notifications recently: https://github.com/WeblateOrg/weblate/pull/10659 it was supposed to work the same as before but you might just go look at your profile and check the notification settings anyway..

GitHub

Weblate, the web-based continuous localization system. - Weblate

GitHub

Proposed changes
This makes the history more clear (it doesn't start with "String changed in the repository") and allows to trigger new string notification on such event.
See #10651

...

#

fwiw I also see problems with automatic suggestions from libretranslate, suggesting just "%" as a translation. oof.

#

As for translations, I guess ...

There used to be a site-wide configuration at Hosted Weblate, but it is now gone for several reasons. So the project has to configure own if it is desired to use machine translation. https://github.com/WeblateOrg/weblate/issues/9689

#

I have deactivated LibreTranslate as we do not have an API key for it.

cobalt grail
#

So what translation services are supposed to be working?

onyx hinge
#

none.

cobalt grail
#

Oh, there were a bunch of them when I first started to use Weblate.

onyx hinge
# cobalt grail Oh, there were a bunch of them when I first started to use Weblate.

It seems like they've found them too costly to provide, or something. Personally, I have no idea if it's helpful or unhelpful. Sounds like you found it helpful, though. When you used it, was there one translation service that was better than the others? I can check into price and find out if Adafruit wants to pay for a translation API key on an ongoing basis.

#

that is, "[hosted weblate] found them too costly"

cobalt grail
#

Not sure which ones was available, but there was two that was helpful. Mostly needed it when the error message used an unfamiliar term. If I recall correctly it was the Google and Microsoft services.

cobalt grail
tulip condor
#

seems that adafruit could self-host libratranslate

#

there is a flag to enable api keys or not that probably means that libretranslate is charging the bandwidth to do this which isnt a problem if self-hosted

manic glacierBOT
tulip condor
#

besides pins availability / hardware capability what detrermines what modules are available for a board ? Is it the way the shared modules are included or not for each board as well? Does this mean one could recompile the circuitpython image for a board with some libraries the official download doesnt provide and without some libraries the official download provide ? I assume that if a board has X amount of space in KB that some choices have to be made for its circuitpython image ?

crimson ferry
#

Flash, RAM, port / board capabilities, (and whether a specific feature has been ported), determine what modules are included. Yes, decisions are made when flash (or RAM requirements) are constrained (which is often). Custom builds are possible to delete some modules and add others, provided the other constraints are met.

tulip condor
#

so if I dont see some defines for a board in the init.c/init.h or even an include of board.h or the board supervisor or the pins macros used are available according to my board config file (mpconfig and pins.h) I could assume the module doesnt have any board-specific limitations and it's just a question of including it on the image ?

crimson ferry
#

Someone else will have to answer that one. But my general sense is that when possible, if flash permits, all applicable ported modules are included. When flash doesn't permit, some priorities had to be decided to include some modules at the expense of other(s).

#

Separate question... I'm a little confused (or recall wrong) about some info on https://github.com/adafruit/circuitpython/tree/main/ports/espressif for ESP32-S2 and ESP32-S3:
It says pin 20 (D+) and pin 19 (D-) are used:

to access the CircuitPython drive
and that
A USB to UART converter can be used for connecting to ESP32-S2 to get access to the serial console and REPL and for flashing CircuitPython.
using pins 43 (RX) and 44 (TX).
But doesn't the drive and normal serial console / REPL both use the native USB, and the USB-to-UART is for the debug console (and flashing) and not the REPL (at least in standard builds)?

tulip condor
#

I see . By porting I guess someone would have to write it in esp-idf so that it works on esp32. So if it's not in the image it may simply mean that nobody has ported it yet for that platform not necessarily that the esp32 cant run it

#

or in whatever api/sdk the samd21 uses in its firmware

crimson ferry
#

if it's ported, there will be something in common-hal (or in shared-modules if it doesn't require port-specific code)

#

shared-bindings (the common API as documented in readthedocs) will typically make calls to common_hal_{something}, and those functions are (usually) either in common-hal (or shared-modules)

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

in case anyone is here from vim/neovim land trying to find board specific stubs.

you can also find your board in this project under ports. i.e. /ports/raspberrypi/boards/adafruit_kb2040

and find the pins definition to just add a few more type stubs to the typings/board-stubs/__init__.pyi where needed.

import microcontroller
D6: microcontroller.Pin
D9: microcontroller.Pin
def STEMMA_I2C(): -> busio.I2C:
    ...

kind of hacky but i've just been spending 3 minu...

onyx hinge
#

Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode because:
CIRCUITPY drive could not be found or created.
Press reset to exit safe mode.

Adafruit CircuitPython 9.0.0-alpha.6-42-g029c6c2f0c-dirty on 2024-01-16; posix with amd64
>>> print(3+3)
6
>>> ^C
```It's not _actually_ working yet but it's close!
#

It's becoming more and more of a hack to incorporate some circuitpython modules into the "unix" port for testing purposes, so this is an ongoing attempt to build something that runs on a POSIX system but is built "just like circuitpython".

lone axle
#

<@&356864093652516868> The weekly meeting is set to occur here on discord in about 30 minutes. We're on Tuesday this week due to the US holiday yesterday. We look forward to seeing folks for the meeting!

#

Notes doc is in the pinned message feel free to fill in status updates / hug reports before the meeting if you can.

midnight ember
errant grail
# midnight ember

Extremely useful design documentation. Nice overall UI design, too.

slender iron
#

when you have many labels, are they in a subgroup?

midnight ember
#

some are main groups only, some are subgroups but overall yes. remove and append makes a performance difference.

slender iron
#

hrm, so hidden stuff is costly still

midnight ember
#

🐱 meowsic!

#

I meant to but had covid for past 2 weeks. I'll submit one.

slender iron
#

Oh no! Have you fully recovered?

midnight ember
#

as of yesterday yup feeling much better.

slender iron
#

yay!

#

took me a while too

midnight ember
#

What is a Pico B2? Haven't heard of that one.

slender iron
#

could be a version

candid sun
#

thanks @lone axle !

slender iron
#

of the pico bootrom

#

thanks for hosting!

midnight ember
#

Thank you for hosting @lone axle

#

Welcome back @slender iron hope everything is going well

slender iron
#

thanks! excited to dig into CP things again

lone axle
#

Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1hvExFQWMsV78bORs1uBxon_bncchrHPV96r4cAWEhcA/edit?usp=sharing

short tendon
#

Would next week be a good time to talk about the connection manager?

devout jolt
# midnight ember What is a Pico B2? Haven't heard of that one.

@slender iron RP2040B2 is a hardware revision to the RP2040. It fixes two issues with USB ("USB device fails to exit RESET state on busy USB bus." and "USB device endpoint abort is not cleared.") This is described in the "Errata" section of the RP2040 datasheet (See section "4.1.2.6.5. Errata") And these issue I believe have work-arounds in the Pico-SDK

midnight ember
#

Had no idea. Thanks!

spare jacinth
#

As an extra: B1 (second version) has a software fix on the SDK for an issue too, not sure if one of those or a third one

onyx hinge
#

Yay, I just marked bitmapfilter out of draft mode.

manic glacierBOT
lone axle
orchid basinBOT
manic glacierBOT
manic glacierBOT
#

Looks like dynamic service support has been added to ESP nimble and is in IDF 5.1.2: espressif/esp-idf@94ad8f1

@tannewt I saw you managed to get IDF 5.1.2 into CircuitPython 9.0.0-alpha.6 🙇 so I went to give it a try and spotted that for the Seeed Xiao ESP32C3, it's now missing the _bleio module that was previously in 8.2.9 and is needed for BLE .

I did but I haven't improved bleio on ESP...

short tendon
manic glacierBOT
#

When you set the RTC, the number of seconds since some start date (the "epoch") is recorded. All the other info is discarded. One of tm_isdst's main uses is to disambiguate times that fall near the boundaries of the date-time when DST starts or stops. See https://stackoverflow.com/a/47333019/142996.

Since the timezone and location info are note saved in the RTC, the DST state is not really interesting. You could save the timezone and location info if needed. Note that the timezone does n...

#

I also see this issue on a Magtag under certain circumstances. I tested a few different things with somewhat perplexing results.

This basic label test adapted from the code pasted above does seem to reliably reproduce the issue. When this runs the display does not refresh at all. It will continue showing whatever was on it previously. It does print "after refesh()" but nothing happens on display

import time
import busio
import board
import displayio
import fourwire
import adaf...
main furnace
#

Thanks Tim!

manic glacierBOT
#

After a little more tinkering and testing I think that this line is somehow relevant to the behavior.

FONT = load_font("/fonts/Arial-12.pcf")

I found that if I comment this line out and use the built-in font the label will show properly.

I also tested commenting this out and showing a blank Group, and CIRCUITPYTHON_TERMINAL which both also showed successfully while this line was commented out.

I took a guess that maybe somehow clobbering the name FONT could be proble...

gilded cradle
crude blaze
gilded cradle
#

I'll try updating

crude blaze
gilded cradle
crude blaze
#

newer than 65 should be fine

gilded cradle
#

Still nothing on the 2.4". I'll try the 2.2".

crude blaze
#

you might need to do a cold boot with power removed. I had some issues during development with warm reboots where there was no power cycle of the display

gilded cradle
#

Ah, I'll try that next. I just hooked up me 2.2"

#

Same deal on 2.2". I'll try 2.4" with cold boot.

#

@crude blaze ok, 2.4" initialized from a cold boot, but no desktop on display. Basically same as 2.2".

crude blaze
#

do you have an HDMI display connected at the same time?

gilded cradle
#

Wait, wrong driver...

#

Yes I do

crude blaze
#

then make sure you have
dtoverlay=vc4-kms-v3d
max_framebuffers=2

#

but its default in newer distro releases

gilded cradle
#

Yeah, that's the settings I have in my config

#

I'm double checking my wiring. Weird that the 2.2" inited the 2.4" but the overlay with correct gpios is still white.

crude blaze
#

if it stays white then I would double check wiring and maybe double check that the overlay is unmodified. Otherwise unsure what the difference could be

gilded cradle
#

🙂