#circuitpython-dev
1 messages ยท Page 85 of 1
Fix pin definitions for these two board. The respective definitions within pins.c for board.SDA and board.SCL are correct btw.
getting the latest changes from adabot and awesome-circuitpython.
@tulip sleet I walking up on the error now with JTAG. It's happening very early in esp-idf initialization, somewhere in newlib STDIN, STDOUT, STDERR console initialization, or soon after.
https://github.com/adafruit/circuitpython/pull/10277 is ready for review. It improves audio playback on rp2 and prevents playing random memory
It's internal: https://github.com/adafruit/circuitpython/blob/443f829262c7f2083779187b9b70e47b7b714419/ports/raspberrypi/common-hal/picodvi/Framebuffer_RP2350.c#L65 Setting that to 71 will lead to 70hz refresh rate
@lone axle do you have a version of pathlib to use with the launcher?
@tulip sleet The failure is occurring during an attempt to fopen() STDERR. This is where things get a little strange. The reason this code runs at all is because CP is taking the default CONFIG_VFS_SUPPORT_IO=y. I'm thinking that's possibly not correct.
yes, here it is. fwiw I think that some other parts of this that aren't used by the launcher wouldn't work. glob() in particular I think is expecting different behavior from os.listdir(), perhaps other parts too.
Do you think we whould make an adafruit_pathlib library from this?
Yup, we should make our own
ah... okay. I just got my rev B board today. Was kinda planning to just roll with 320x240 or 640x480 and do some Playground guide projects using IR and I2C peripherals. If you want me to try a custom uf2 build to see what happens against my capture card, I could do that. 640x480 is good enough for me though.
I'm curious to see if it works
ok sure. if you've got a build you want me to try, I can do that. I'll go find the capture card.
lemme build one
CircuitPython ReadTheDocs question: is there a way to link to the expanded "Available on these boards" list? Alternatively, is there another place I can link to that has this list for any particular core module?
This makes sense to me, and most importantly, you've tested it under tough conditions. Thanks!
it's a different page and the format is a lot more expanded, so perhaps less convenient to look/scroll through, but the support matrix allows you to pass a filter URL parameter i.e. https://docs.circuitpython.org/en/latest/shared-bindings/support_matrix.html?filter=tilepalettemapper then the first column is a list of devices that support that module.
that may work, thanks!
anchor tags could be added to https://github.com/adafruit/circuitpython/blob/main/docs/autoapi/templates/python/module.rst
note that we have micropython's ilistdir in storage.VfsFat
It's poorly documented in CP, but I believe it should be the same as
https://docs.micropython.org/en/latest/library/os.html#os.ilistdir
(it returns an iterator with additional data)
working on getting a tested build for you
fixing a bug with something I just merged
https://github.com/adafruit/circuitpython/pull/10263 is ready for review
Bug introduced in #10278 and I missed it in review. A debug build with assertions caught a double free quickly.
@tiny peak fj rev b
with extended back porch to slow refresh rate of 720x400 to 70hz
@anecdata thank you for the testing! I'm marking this ready for review now.
capture card saw the signal but displays its "Not Supported" message.
which card is it?
AverMedia GC551G2
same one that I dumped the EDID info for in comments at https://github.com/adafruit/circuitpython/issues/10242
based on what I've read in forums and seen in reviews, this card doesn't do particularly well at handling older CRT style video modes. But, it is readily available, has HDMI passthrough, and isn't super expensive.
it does seem like the xr1 lite is discontinued
also, the latency is pretty low and compression doesn't introduce too many artifacts (unlike some of the cheapest cards)
I don't think it is worth fixing unfortunately
we'll want our demos to work at both 720x400 and 640x480
yeah, 640x480 at 60Hz is fine
as long as it's actually 60 Hz instead of something drastically faster
might be worth putting a caution box in the docs about how TVs are generally pretty tolerant of video modes but capture cards can be more picky.
oh, actually, I'm gonna go test your firmware build on my old Samsung TV to see if it likes it. I'm expecting it probably will
@slender iron works great on the old Samsung TV.
Thank you for researching into this, @todbot! I think all of us synthio folks have been aware of this problem for a while. I'd love to push the filter harder, but it doesn't take long to run into this error. I'm sure that audiofilters.Filter is implementing summing slightly better, but I'd be very interested to see what your research within audiofreeverb.Freeverb can do for this issue, @gamblor21.
That's 640x480. Are you forcing it? Is it a 4:3 TV?
Darn copy & paste ๐คฆโโ๏ธ Thanks for fixing this, @tannewt!
no, that's just how it came up when I plugged it in and turned it on
yeah... I mean, it looks great
@tulip sleet this is ready for review too https://github.com/adafruit/circuitpython/pull/10263 I'll need the size changes for the gc PR
one thing about that TV though is it will take a fairly wide range of refresh rates and bin them as "60Hz", "70Hz", "72Hz" or whatever
it's a lot more forgiving than the capture card
I'll look at the wifi power PR now
thaks
That's a great idea. I just tried the simple approach (adding an id attribute to summary or the ul) and it doesn't work. Appears that expanding a <details> block would require some JS.
does it jump to the right place but not expand?
Interesting that the .. normalization was done for LFS here: https://github.com/micropython/micropython/commit/d3ea28d04a7df9ca536a9002c8fda2f6e3a88f09. Too bad it's not in a general place.
I don't see any issues, but I think you could write some tests for this with a toy filesystem as is done in some other MicroPython tests. There are a lot of edge cases here. Not asking you to do this now, but it would be worth it when writing similar kind of code in the future.
Thanks!
I think it'd be good for us to setup some C level unit tests. There's no reason to run it through the Python VM.
The unix port is more MicroPython than CircuitPython, which makes it hard too.
Ooh, nice. Thank you, I did not know about that.
Some devices have very long USB configuration descriptors due to the number of interfaces they offer. For instance, enabling the USB CDC data stream on CircuitPython (usb_cdc.enable(console=True, data=True)) pushes the descriptor to 284 bytes, which is greater than CircuitPython currently allocates. This change will allow devices with long descriptors to be recognized by the USB host module.
Tested on a Feather RP2040 with USB Type A Host.
The downside is that this uses more memory. I...
I found that in my files, I don't use it but I remember needing ilistdir() once to go through a (very) long list of files on an SD card on a small board where listdir() wouldn't fit in memory
@mortal kernel I ended up checking out the source from https://github.com/eightycc/circuitpython/tree/issue-10191 to test with ESP-IDF 5.4.1. The loliin_s2_mini firmware works fine so far, but so far I haven't been able to get the lolin_s3_mini to work. I restart in uf2 mode (getting LOLIN3MBOOT instead of CIRCUITPY), copy in firmware.uf2, and after reset neither CIRCUITPY nor the USB REPL are accessible. I went back and built lolin_s3_mini from the main source (with ESP-IDF 5.3) and it starts up fine after copying in that frrmware.uf2. FWIW I'm testing with actual Lolin/Wemos boards from the Wemos online shop. Somewhere around here I have an ancient USB JTAG adapter that I managed to get working with an ESP32 C++ build a while back, but I haven't tried setting it up for CircuitPython yet (and I'm not even sure the S3 Mini makes all the pins available).
@tulip sleet I've tracked down the component causing the double fault. It's ESP-IDF's vfs, which as far as I can tell CP does not use and never registers. But, it's getting included in the build and as part of its initialization ESP-IDF attempts a call to fopen SYSERR on /dev/console. This attempt results in a double fault. By commenting out the fopen, CP successfully starts. Unless there's a reason for vfs to be included that I'm missing, stripping it out will clear up this problem.
it was included in the 5.3.2 builds, though, right, and didn't crash there
btw I am working on the TLS issue right now. Not so clear it is cert format change. That change was minor. But I have good logging in mbedtls in both 5.3.2 and 5.4.1 and will compare the logs
Uninitialized memory can cause build-dependent failures.
I can believe that. I think I I saw some mysterious stuff about this in NINA-FW, which I just removed as not needed.
https://github.com/adafruit/nina-fw/blob/dfc0c299719891002a8b99c187c6532f2d1ce8f9/main/sketch.ino.cpp#L64 all this stuff about stdin stdout and stderr
maybe it's unrelated but it soudned familiar
See https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/storage/vfs.html for a description of the vfs component. I'm thinking CP never needed it, but it got included by default.
if it builds without it great, great sleuthing!
you still get debug logs without it, hopefully
resolving static initialization order ambiguity for C++ startup (pre-main) code can be ... challenging
I've not yet tested with it completely stripped. That's my next step.
I would not be surprised if the problem with the lolin board you just mentioned has the same root cause.
if there's something quirky in the initialization, even a minor tool chain update can let latent bugs run loose, and IIRC ESP-IDF 5.3 to 5.4.1 moves from GCC 13 to GCC 14 - much more than a minor update. OTOH, it's only the S3 build that's failing to start - the lolin_s2_mini build in the exact same local repo (checkout from your fork with ESP-IDF 5.4.1) and even in the same shell instance (i.e. only one call to . esp-idf/export.sh) works fine, so if it is the same problems it's probably subtle.
But of course sometimes that's exactly where the unitialized memory matters - accessing a global instance before it's constructor gets called might not cause noticeable problems if the RNG pixies left the right bits in the right spots...
@tulip sleet This gets more intriguing. The long-standing double fault problem with sockets might also be related. On my first build with vfs completely stripped, I'm finding CP socket code that hooks itself up to vfs file descriptor events. Let me see why that's there...
I've noticed that CP appears to do some "man behind the current" magic with sockets - the most obvious impact is you have to import socketpool instead of import sockets, and then work with a "there can be only one" (pool per radio) constraint (which actually makes sense for most things one would be doing with CP). Plus rigging up all the web based workflow bits.
So is the vfs support in CP only for external storage like SD cards (i.e. the support for uf2/CIRCUITPY flash file system access goes through something other than vfs) ?
The naming is confusing. CP has a vfs abstraction that it inherits from MicroPython. The underpinning is oofatfs, a light-weight fat fs implementation. Both external and internal flash CP filesystems use these. The ESP-IDF vfs component provides an abstraction for IDF tasks to access a filesystem or filesystem driver provided by another or the same IDF task. ESP-IDF is very much a small OS in its own right. It uses FreeRTOS as its kernel.
Another bug introduced in #10278. Likely didn't incur a noticeable effect on RP2350, but could potentially cause buffer allocation issues on RP2040 devices.
This is a module wrapping TinyUSB's class/cdc/cdc_host library into a pyserial-like API so that a CircuitPython board with a USB Host can talk to other devices with CDC interfaces over USB.
It is possible to talk CDC using only the usb.core.Device.read/.write methods. However, this only works in blocking mode. I tried setting up asynchronous communication by supplying a timeout to .read(), but when I tested my code I missed data.
As I understand, CDC reads are performed by sending...
I havenโt used the S3 version of the MatrixPortal yet, but suspect that the default color bit depth is set to two bits, just four levels of color brightness, limiting the granularity of intensity. When instantiating the display in CircuitPython, the bit depth can be set to 6-bits which increases the brightness granularity โ at a price of needing more memory to hold the display buffer. If you are using CircuitPython displayio objects, you could apply something like PaletteFader to help. ht...
@dhalbert My earlier thought that ESP-IDF component vfs was not needed was incorrect. After studying the doc and the code I now see that it is used internally by IDF for console and socket support. Debugging is also a learning experience.
Through a process of setting hardware breakpoints, I've narrowed the point of failure down to a binary routine in the ESP32 ROM. The routine itself is __swsetup_r at 0x40058cc8. It is getting invoked by this code in sp_newlib_init_global_stdio:
voi...
This looks similar to the code in https://github.com/adafruit/nina-fw/blob/dfc0c299719891002a8b99c187c6532f2d1ce8f9/main/sketch.ino.cpp#L64 I mentioned in discord, which I had to turn off because it was causing an early crash. Might be worth looking in esp-idf issues to see if there are similar reports.
@dhalbert The blob you reference tickles exactly the same spot: early initialization of /dev/console in the IDF vfs component. This makes me think that the subsequent double fault out of ROM routine __swsetup_r is a secondary effect of damage already done in the earlier fopen. I'm taking another scan through ESP-IDF issues with this in mind.
Thanks for the explanation, that clear things up a bit. Most of the embedded C++ work I've done lately has been with the Arduino framework APIs, I haven't done much directly with the ESP-IDF apis or FreeRTOS yet.
Here's the exact issue, now closed: https://github.com/espressif/esp-idf/issues/7980. I'm now looking for something stale CP's ESP-IDF config.
Not sure there's much I can effectively help with tracking down initialization (i.e. anything that happens before boot.py/code.py) issues without being able to run under a (presumably JTAG?) debugging environment. I have a rather old (https://www.olimex.com/Products/ARM/JTAG/ARM-USB-OCD/) JTAG interface, but I don't see any obvious matching configurations in the $OPEN_OCD_SCRIPTS/interfaces. I could theoretically get it working, as I've used it to debug ESP32 C++ firmware with PlatformIO, but as I suspected the JTAG pins aren't available on the Lolin S2/S3 mini boards. I have other S3 boards that provide access to the JTAG pins, so I could try those - they might reproduce the issue I'm seeing with the lolin_s3_mini. But that would probably be a non-trivial amount of fiddling to get everything set up, so...
@mortal kernel
- Would it make sense to first pull and build from the head of your circuitpython fork and see if that helps?
- Does that have the vfs mods (or are they hacks in the ESP-IDF code)?
- Any recommendations on a relatively affordable usb JTAG interface that works well with CircuitPython and ESP32-* controllers?
it seems like readthedocs.org may be experiencing issues. I am seeing a default NGINX page instead of the normal site at the root URL.
have you tried the built in USB JTAG interface?
This is the JTAG setup Iโm using. The board under test is an Adafruit Feather Huzzah ESP32. The probe is a J-link Mini. I made the small breakout board from a 10-pin cable, a couple of headers, and a miniature prototype board.
ummm.... didn't even know about that.
OTOH that looks familiar....
When I've done ESP32-S3 stuff with Zephyr, it was able to handle all the programming and debugging over the regular USB port
not sure exactly how the config worked under the hood, but I expect openocd has config for it, maybe?
It looks like it does, but it doesn't appear to be in the ESP-IDF 5.3 or 5.4.1 installs for CircuitPython.
@full plume We have other issues aplenty to debug if you don't want to get involved this deep in this particular chain. ๐
https://github.com/orgs/micropython/discussions/11695 mentions starting openocd with ../esp32s3-builtin.cfg, but there isn't anything like that in $OPENOCD_SCRIPTS/interface
when I've had trouble with missing config files for openocd, the solution often involved changing my PATH to make sure that I was running the openocd binary from a specific toolchain, from a system package, or from a particular version of openocd that I installed locally. It's been my experience that openocd binaries will have hardcoded search paths for config files, and the config file I need may be somewhere else. Also, the openocd may be the wrong version (or not a particular vendor fork) and incompatible with the config file anyway.
I've actually got a rather long history and mild affection for C++ initialization issues, and I know I'll eventually want the ability to run CircuitPython under a debugger, so it's less a matter of if than when
got it. I think you could mock the lolin boards on a regular dev board with all the available pins, and see if you can duplicate the problem. I'm not sure why these problems should be lolin-specific
In this case, both the openocd binaries and support/interface config files are part of a dedicated install of the specified ESP-IDF toolchain version required by the CircuitPython espressif port.
eightycc I think was trying openocd originally, with several roadblocks. Switching to J-Link helped, if i remember right.
So I'm pretty sure that's the one we should use, although finding a config file for the build in ESP32-S3 usb jtag support and adding it in might make sense.
hmm, looks like I was lookin in the wrong place and it might already be there, just under $OPENOCD_SCRIPTS/board/esp32s3-builtin.cfg instead of $OPENOCD_SCRIPTS/interface/..
Synthio has one (and likely more) spots where it is possible to overflow the int32_t used as an intermediary while doing fixed point math.
This function multiplies an int32_t by int16_t which can exceed the 32 bit size.
There are likely other cases as well.
The probable fix is to add a function to ensure the values are saturated after every calculation.
`audiofre...
I now have openocd connecting to an Freenove WROOM ESP32-S3 over USB/JTAG while running under WSL. It's a rather tedious process, but should be manageable by anyone who'd be trying to run CircuitPython under debug in the first place...
The down side is that this is one of those boards with dual USB-C connectors, only one of which shows up as a USB JTAG/serial debug unit.
I don't know how/if you can access the S3's built in USB-JTAG support on a board with a single USB like the Wemos/Lolin S2/S3 mini boards
did he hit roadblocks before or after getting openocd working at least a little bit with the S3's built in USB-JTAG support?
@mortal kernel look at the cmake file changes in the IDF around vfs. there are -u (IIRC) defines that are used to force linking in init code
@mortal kernel I've got an S3 N8R2 Devkit-C board that is at least initially connecting to openocd over USB-JTAG. I'm building your branch for espressif_esp32s3_devkitc_1_n8r2, hopefully that will let me step through the startup/initialization code.
I just suggested he use the J-Link and its software instead of openocd. I have found it to be more reliable. There's a fuse to set to be able to use JTAG on ESP
https://github.com/adafruit/circuitpython/pull/10264 (gc selective collect) passed CI and is ready for review
JLINK looks nice, but I'm not ready to drop $500+ on a jtag interface at the moment.
non-commercial price is $60:
Thanks for submitting a pull request to CircuitPython! Remove these instructions before submitting.
See https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github for detailed instructions.
- Consider whether to submit this PR against
mainor against (if it exists) the branch for the current stable release or an upcoming minor release. The branch will be namedi.j.x, for example,9.2.x. Bug fixes and minor enhancements can be submitted against the stable release b...
I have other C++ projects I'd want to use it for, which I might end up releasing under a commercial (or at least semi commercial dual) license someday. And while I'll probably be doing embedded development just for fun even after I'm retired, I currently still make my living as a developer. Feels a bit off to get a non-commercial license as a professional developer.
Although if I can't get openocd working, I might eventually consider picking up a non-commercial JLink license just for CircuitPython
I think this is fine. Boards with USB Host will have more RAM.
We've talked about adding malloc support to TinyUSB but haven't started that work yet.
Fix for #10286 and #10200.
There may still be more locations where fixed point could be handled better in synthio but this fix hits two big ones that I discovered so worth fixing those now.
Also refactored sat16 that will shift a fixed point result back into 16 bits out of audiofreeverb and into synthio to be used by any audio module that needs it. Potentially worth moving this to a generic "audiohelper" type module in the future in case someone builds without synthio but still ...
#10288 fixed this for me @todbot if you have a chance I'd love you to give it a try.
[adafruit/circuitpython] New comment on pull request #10288: Fix for fixed point overflow in synthio
I updated the tests as this change breaks most of them. I looked and as far as I could tell it is small rounding differences due to how I fixed this issue. I also listened but would appreciate it if someone else can confirm that things sound right. The rounding changes were about 1 (for ints) or less then 0.0001 for floats so not large for audio.
[adafruit/circuitpython] New comment on pull request #10288: Fix for fixed point overflow in synthio
Potentially worth moving this to a generic "audiohelper" type module in the future in case someone builds without synthio but still wants audio effects.
Not that it's necessary for this PR, but would audiocore be a reasonable location in the future?
Looks clean so far. I haven't yet tested it, but I will extensively soon.
This should be BIQUAD_SHIFT instead of 15.
This is a big change but is a very good idea.
I tried to do complete // CIRCUITPY-CHANGE labelling, partly for my own benefit at the next upstream mege, and partly for the reader.
As I discussed in two comments, I think it might be safer to force conscious choice between the _with_collect() and _without_collect() versions of things by eliminating the old ambiguous name, or else make the old name do the safer thing of assuming collecting.
// CIRCUITPY-CHANGE
#define MICROPY_ENABLE_SELECTIVE_COLLECT (1)
// CIRCUITPY-CHANGE
mp_uint_t *mem = m_malloc_items(nq + no);
// CIRCUITPY-CHANGE
context->constants.obj_table = m_malloc_items(n_obj);
// CIRCUITPY-CHANGE
emit_t *emit = m_new_struct_with_collect(emit_t, 1);
// CIRCUITPY-CHANGE: calculation of how much to grow the heap
size_t total_new_blocks = (failed_alloc + BYTES_PER_BLOCK - 1) / BYTES_PER_BLOCK;
// CIRCUITPY-CHANGE
// If this config is set then the GC clears all memory, so we don't need to.
// CIRCUITPY-CHANGE
res = mp_obj_malloc(mp_obj_array_t, &mp_type_memoryview);
// CIRCUITPY-CHANGE
mp_obj_t *args2 = m_malloc_items(2 + n_args + 2 * n_kw);
// CIRCUITPY-CHANGE
buf = m_malloc_with_collect(size);
I wonder if it would be safer to do one of the following:
- Remove
malloc()altogether and requiremalloc_with_collect()ormalloc_without_collect(). Then it's a conscious decision each time. - Or, make
malloc()collect by default, so anymalloc()s that were missed are collected, which is safer.
As with the malloc family of macros above, I think it would be safer to require m_new_with_collect() and m_new_without_collect(), and similarly for related macros, and get rid of plain m_new(), etc., or else make the old names imply _with_collect.
Was this a bug, or is just an optimization? Could someone have a reference to the old obj?
CircuitPython version and board name
Adafruit CircuitPython 10.0.0-alpha.2 on 2025-04-04; Pimoroni Pico Plus 2 with rp2350b
Adafruit CircuitPython 10.0.0-alpha.2-36-g53a856b67a on 2025-04-23; Pimoroni Pico Plus 2 with rp2350b
Code/REPL
# Not applicable
Behavior
Adafruit CircuitPython 10.0.0-alpha.2 on 2025-04-04 (and 9.2.7 on 2025-04-01); Pimoroni Pico Plus 2 with rp2350b
Everything works as intended.
. For our purposes, I think we can live without it.
I am able to reproduce the issue, the gamepad somehow return 0 bytes in the 1st get device descriptor. Not sure why, I am in the middle of improving/enhancing host/hub driver. Will try to troubleshoot this as well
@tulip sleet Spotted where we started to pick up the ROM mismatch: The fix for #9486 manually adds esp32.rom.newlib-time.ld to the link for esp32, overriding the current newlib functions in question with their out of date ROM versions.
Yes. That's the one.
I don't see an updated newlib (I see more variants), but I do see the REGISTRATION_FUNCTIONS addition there
The newlib in question is an ESP-IDF component, so its versioning is out of our control.
so newlib-foo was added for various foo, and it's one of those?
Yes, in our ports/espressif/Makefile.
I've elided it, and getting a clean build. Now for a test...
Adafruit CircuitPython 10.0.0-alpha.2-36-g53a856b67a on 2025-04-23; Adafruit Fruit Jam with rp2350b
reinit_display.py:
from displayio import release_displays
import picodvi
import board
import framebufferio
SIZE = (640, 480)
# initialize display
release_displays()
fb = picodvi.Framebuffer(
SIZE[0],
SIZE[1],
clk_dp=board.CKP,
clk_dn=board.CKN,
red_dp=board.D0P,
red_dn=board.D0N,
green_dp=board.D1P,
green_dn=board.D1N,
blue_dp=board.D2P,
b...
No, from here, around line 241:
ifeq ($(IDF_TARGET),esp32)
LDFLAGS += \
-Tesp32.rom.newlib-data.ld \
-Tesp32.rom.newlib-funcs.ld \
-Tesp32.rom.newlib-time.ld \
-Tesp32.rom.spiflash_legacy.ld
Removed the esp32.rom.newlib-time.ld
I wonder what the utility of using the ROM functions is, except to save space.
is there a necessity for some of them?
That's what I think. Sort of harkens back to patching Mac ROM routines to save space.
Although I would not recommend removing others without careful consideration...
@tulip sleet Yes! Now it boots. What a journey that was!
Looks like we have the same issue in esp32s2, and esp32c3.
Probably copy and paste.
I'll post my boot.py shortly that I have backed up. May need to cut some traces to revive my fruit jam
The playback issue sounds like one I was seeing too
I've done a lot of cleanup in the animation code, once I've got your latest one I'll merge this together and submit a PR to the repo with the new version that is cleaned up and had a few of the other final tweaks from the basecamp thread that hadn't made it into the repo yet.
CP was including *.rom.newlib-time.ld in ESP32, ESP32-C3, and ESP32-S2 builds, causing a mismatch between the ESP-IDF component newlib and an older version in ROM. This was causing stack corruption leading to a double fault early in ESP-IDF initialization of STDIN, STDOUT, and STDERR.
This one still uses enumerate() in the main loop. I've chagned that in mine to this:
for i in range(len(coordinator["steps"])):
step = coordinator["steps"][i]
is the target_frames_per_second necessary? It seems like using this sometimes causes the very last frame of the second blink sprite animation not to be rendered, so the eyes remain larger than the should be (the frame before the last one has larger eyes). With that removed and just using display.refresh() all of the animations look smooth to me, and I have never seen the same issue with the eyes remaining on that 2nd to last frame.
Without target_frames_per_second you may actually run faster than you need
weird that you miss one last frame. is there a refresh call after it?
yes, the code is the exact same except for removing target_frames_per_second argument. So if there weren't a refresh call after the sprite is updated I think it wouldn't be shown in either case.
it doesn't happen everytime. Anecdotally, it might be tied to the audio in some way. I feel like it's nearly 100% rate of occurance when the audio plays successfully. But occurs less frequently when the audio doesn't play, though I have still seen it several times without audio too.
@dhalbert @tannewt I think the implementation of mp_stack_fill_with_sentinel() disappeared with f1c6cb7725960487195daa5c5c196fd8d3563811 ? It still features in
https://github.com/adafruit/circuitpython/blob/33777650049d17fc7c624c23f11fc6f17f0d24c6/main.c#L174
Intentional?
My guess is that this was introduced in #10263. Any chance you can test a build from S3 before that?
I think this is intended now. supervisor.runtime isn't reset when the display is reinit. So, you are trying to set the attribute on the None object.
I really like the pyserial approach! I'd go 100% into it and match APIs exactly and then call it serial. That way code will just work in CPython too.
You'll want to conditionalize enabling it so that builds without USB Host don't enable it. That should fix the CI.
[adafruit/circuitpython] New review comment on pull request #10283: Serial (CDC) module for USB Host
Instead of adding a new message, reuse "%q must be of type %q, not %q". (I'd search for where it is used to copy it's example.)
[adafruit/circuitpython] New review comment on pull request #10283: Serial (CDC) module for USB Host
Don't add a find. Instead, match pyserial exactly with: https://pyserial.readthedocs.io/en/latest/tools.html#serial.tools.list_ports.comports
[adafruit/circuitpython] New review comment on pull request #10283: Serial (CDC) module for USB Host
Likely needs to match the other whitespace.
Is it possible to access the manually initialized display any time after the code file that initialized it is complete?
If it's not possible I think it poses some challenges like if the code that initialized it set auto_refresh to False then it will be stuck in that state until re-initialized again.
Or for the launcher -> app -> back to launcher flow, if the app were to manually re-init the display then when the launcher takes back over it won't be able to set the new root_group. I thin...
Oh! I see now that you can set supervisor.runtime.display = display also which makes this work how I was thinking that it would before.
@lone axle can you assign it? I didn't think you could but that is the long term intention
it seems to me like you can. with reinit_display.py like this:
import supervisor
from displayio import release_displays
import picodvi
import board
import framebufferio
SIZE = (640, 480)
# initialize display
release_displays()
fb = picodvi.Framebuffer(
SIZE[0],
SIZE[1],
clk_dp=board.CKP,
clk_dn=board.CKN,
red_dp=board.D0P,
red_dn=board.D0N,
green_dp=board.D1P,
green_dn=board.D1N,
blue_dp=board.D2P,
blue_dn=board.D2N,
color_depth=8,
)
display = framebufferio.FramebufferDisplay(fb)
supervisor.runtime.display = display
and the second file like this:
import supervisor
display = supervisor.runtime.display
print(f"isNone? {display is None}")
display.auto_refresh = False
print(f"size: {display.width},{display.height}")
I see False for is None and I do see the size printed.
does it work across reloads?
If I press ctrl-D after importing both of the above scripts it goes back to the animation and runs it successfully (it's in code.py). That code just accesses supervisor.runtime.display so it seems to if you mean the ctrl-C / ctrl-D kind of reload.
cool! I didn't think we allowed setting it yet
Optimization. Nope, the list sort just parses the args. Could be on the stack too.
@tulip sleet would it make sense to define a CIRCUITPYTHON_SOURCE macro that we could use in the micropython header to limit the allocation APIs?
thinking about a way to "opt in" code to the "new" API
That is interesting. There is already a CIRCUITPY macro which is always 1
That is set for all source code though. I'm trying to think of a way of having everything in shared-bindings/, shared-module/ and common-hal/ not be able to use m_malloc after I make it collect by default.
oh, i see, that makes sense. so the idea of getting rid of allocators that don't specify collect/no-collect is appealing?
could that just be defined in py/circuitpy_mpconfig.h ? Is that included in any micropython-origin code?
I think it is still implicit with py/mpconfig.h
I don't need to do it. With the build system (aka python) that zephyr uses, it'd be easy to change the cflags for those files
trickier to do in make
I think I will change the defaults to collect
that way I don't break ulab
the old default is always collect, is that right? so the idea is to disallow unlabeled alloc macros/functions in code that's exclusively ours
it could be more specific, like MICROPY_DISALLOW_UNSPECIFIED_ALLOCS
or ALLOW_UNSPECIFIED_ALLOCS or... best, i think, MICROPY_REQUIRE_SPECIFIED_ALLOCS.
maybe there's a better word than SPECIFIED. DISALLOW could be a double negative, confusing
the challenge is how to mark the CP source for it
short of adding an #include or a #define in all those source files, I don't see how.
or myabe just in the .h
#define would have to be guarded, so an include that does an #ifndef is a single-line solution
the other approach I could see is just a python script that can be run to check it
more of a soft check
a linting
yup
a pre-commit check
doesn't even need to be that really
i did already redo all the headers in the circuitpython-specific C files to be // This file is part of the CircuitPython project...
I think this is the better, safer, default
yup, agreed
and I can put m_malloc_without_collect in strategic spots instead
I'm leaving m_malloc_items change because I like it ๐
is items always collect?
ya, because they are mp_obj_t
That's the one! I've tested it, and you're exactly right.
Works: adafruit-circuitpython-pimoroni_pico_plus2-en_US-20250422-main-PR10271-ba69a59.uf2
Doesn't work: [adafruit-circuitpython-pimoroni_pico_plus2-en_US-20250422-main-PR10263-492f6e9.uf2](https://adafruit-circuit-python.s3.amazonaws.com/bin/pimoroni_pico_plus2/en_US/adaf...
@lone axle want a test build that does the gc optimization?
may not impact the animation because it shouldn't collect
I've done 2 and changed many CP and a few MP m_mallocs to m_malloc_without_collect.
I've also modified MICROPY_ALLOC_GC_STACK_SIZE from 64 to 128. It alone drops GC times from 200+ms to ~110ms without selective collect. Selective collect without the stack increase drops to ~25ms. With the stack increase it drops further to ~15ms.
This is when testing https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/3013/files on Fruit Jam (RP2350 with PSRAM).
has CircuitPythonLibrarians not been added to Adafruit_CircuitPython_Pathlib yet ? Or however that works ?
Fixed! added librarians as a collaborator
I stepped away for a bit. Sure if you've got one handy I'll try it out. If you're done or winding down for the day it's okay though, I could try to build it from the PR branch.
check slack. I set it to jp there
Just a FYI for now, Cooper and me have both started to notice a "clicking" in audio that seems to occur with the GC calls. He has been working on isolating and testing more. I'm going to try to look into it this weekend.
Interesting enough it does not occur is "something" (in my case a single midi note) is playing.
@mortal kernel I know what's going wrong with TLS now. I had been spending a while looking for a bug or config setting in esp-idf, but there was no bug.
For some reason we have our own copy of bundle handling in lib/mbedtls_config. Jeff did this some time ago when refactoring the ssl code so it could be shared between Pico W and Espressif. But now that the bundle format has changed, the cert handling code in there is wrong. I'll have to see why that code was factored out into our own copy, instead of depending on the code in each SDK.
This also explains why, when I set logging inside those routines in ESP-IDF, the logging never got printed out. I thought there was something wrong with the logging setup, but it was just that code was never called.
OK, I think I follow what's going on. ESP-IDF is compiling its own mbedtls component, butports/espressif/Makefile is pulling in lib/mbedtls_config/crt_bundle.c.
exactly
I had forgotten about mbedtls_config, but I did look at it relatively recently for some other reason.
for instance, there is a function pointer you set for the bundle attachment, and it's hooked into the mbetls_config
tomw I'll look at this and figure out what to do. it's late here now
Here, too. I'll leave you with some good news: everything I'm trying with ESP-IDF 5.4.1, except for tls, is working.
main thing is that the problem is now diagnosed, instead of being a head-scratcher
Yes, it's good to take out the mystery part. Speaking of which, why are there merge conflict lines in lib/mbedtls_config/mbedtls_config_port.h?
It fixes the problem for me! Thank you for resolving the issue. :)
sounds like a bug, and sounds like nothing else actually includes that. I'll take a look at that too.
Do you know what's going on with the '.dram0.bss' will not fit in region 'dram0_0_seg' on ESP32? I've seen it come up for other recent PRs, but it doesn't seem like this PR would have any effect on flash storage or ram usage.
With a
DEBUG=1build flashed onto a Feather Huzzah ESP32, double faulting early in startup:~I am getting the same problem on the tip of
mainfor Feather Huzzah32, so this appears not to be a v5.4.1 problem. I'll do a bisect between there and alpha.2, which works OK.~It turned out this double faulting crash only occurs with
DEBUG=1onmainand10.0.0-alpha.2for Feather Huzzah ESP32. It also occurs with aDEBUG=1build onmainand10.0.0-alpha.2are f...
Something of more general interest, but related to CP builds. I've upgraded my development machine from an older Intel I5 10th gen 8 core (16 thread) box running Debian Bookworm to a Mac Mini M4 Pro using homebrew ports of the tools I was using on Linux. I expected build times to be faster, but they were noticeably slower by about 2x. I then installed Debian Bookworm in a Parallels virtual machine (allocated 6 cores and 16GB) and ran a few CP builds there. Surprisingly, the builds were not only faster than native MacOS builds, they were also about 2x faster than my older Intel box running on all 8 of its cores. So, even with virtualization in play, the M4 is significantly faster in this case.
I'm curious, does it properly use the available cores when running natively ?
(I have a MacMini 2018 ๐ฌ so i can't compare timings)
It appears to looking at htop. I suspect it's homebrew related, possibly some AMD64 object code getting run on Rosetta.
I'm actually happy using virtualization for now. It has advantages. I can clone VMs for different build setups. Similar to Docker containers, but not as fussy to set up.
Testing results:
Adafruit Feather Huzzah32:
- Web Workflow: file browser, file editor, and serial terminal all OK.
- BLE: Serial echo test OK.
- CircuitPython Internet Test: Scan, ping, http client OK. https client known tls certificate failure.
Do you know what's going on with the
'.dram0.bss' will not fit in region 'dram0_0_seg'on ESP32 S2? I've seen it come up for other recent PRs, but it doesn't seem like this PR would have any effect on flash storage or ram usage.
It's an issue where the size of iram resident routines (routines that cannot be run from flash) plus CP static RAM allocations overflow the DRAM 0 area. It is resolved for ESP32-S2 parts in this commit: https://github.com/adafruit/circuitpython/pull/10267/com...
@eightycc Thank you for the clarification!
@lone axle just went to test the keyboard with your guide an realized the example code doesn't setup the usb host
I guess the two boards you use have it on my default
I don't think I know what you mean setup the usb host
# Initialize USB host power if available
if hasattr(board, "USB_HOST_POWER"):
usb_power = digitalio.DigitalInOut(board.USB_HOST_POWER)
usb_power.switch_to_output(value=True)
print("USB power on")
# Initialize USB host port with D10 and D11
usb_port = usb_host.Port(board.D11, board.D10)
Ah, no I don't think I've ever seen code like that. I haven't done that for any of the USB guides or examples that I have worked on I don't think.
that's for working on a board that doesn't have designated pins
Should I add it as commented out to the examples?
maybe as a page to mirror into guides?
A page detailing how to wire and initialize it for a board without the builtin pins / port?
yup, if we don't have one already
I will try to wire it up, I've only tested any of the examples on the 2 devices in the guide, plus fruitjam for some of them.
๐ I'm trying with a rp2350 feather now
Roughly how long does a full (for one platform - ideally Espressif) CP build take on your system? Mine seem unusually slow compared to other builds. I'm wondering if it has something to do with the CP build running under WSL2 (Ubuntu) on a Windows 11 system.
WSL filesystem access is pretty slow (WSL1 was worse)
are you doing make -j<n> ?
where n is available cores?
metro esp32-s3 clean build is:
real 1m49.771s
user 8m19.294s
sys 3m29.030s
on my I7-8700, 6 cores
On Debian Bookworm running in a 6 core 16GB virtual machine under MacOS on an M4 Mini:
time make BOARD=adafruit_feather_huzzah32 DEBUG=1 -j6
________________________________________________________
Executed in 34.52 secs fish external
usr time 116.30 secs 234.00 micros 116.30 secs
sys time 38.95 secs 408.00 micros 38.95 secs
So, that's about 34.5 seconds wall clock time.
(Did a clean first)
@mortal kernel I have a fix for the TLS problem. I wrote a wrapper to use the espressif code and not the older copied code in lib/mbedtls_config. I removed that unused .h with the merge junk in it
it had appeared there during a merge and should have just been deleted
should I just push to your PR?
that is with ULAB and camera code turned oof?
Please push the PR. Things have gone a bit sideways with ESP32-C6.
No, that's tip of main unmodified.
On ESP32-C6 I'm seeing safe mode restarts.
wow... timing a build of lilygo_tdisplay_s3 to get an actual number, but it feels like my builds have been closer to 30 minutes than 30 seconds.
how many cores and how much ram in your WSL instance?
and are you working in the local filesystem in WSL?
and that's running -j14 on an SMG Ryzen 9 7950X 16 core processor at 4.5GHz
AMD 5950X w Arch Linux: ```
time make BOARD=adafruit_feather_huzzah32 DEBUG=1 -j32
Executed in 25.63 secs fish external
usr time 261.85 secs 614.00 micros 261.84 secs
sys time 168.48 secs 343.00 micros 168.48 secs
Honestly haven't done anything to configure WSL, it's just running defaults which has been fine for the few times I've used it before now
You might consider installing VBOX and running a linux distro under that. I've not heard anything positive re: WSL performance.
But I am seeing at least 8 cores running 50%+
Yeah, I'm thinking VBOX might be the way to go.
Let me crank it up to 12 cores to see what it will do full throttle...
@mortal kernel I pushed a commit
When I tried builds in WSL1, it was about 4x slower than native Linux.
With all 12 cores and 32GB:
time make BOARD=adafruit_feather_huzzah32 DEBUG=1 -j12
________________________________________________________
Executed in 26.39 secs fish external
usr time 146.26 secs 295.00 micros 146.26 secs
sys time 54.96 secs 99.00 micros 54.96 secs
So the 5950X native with 32 threads is just a tad faster than 12 virtualized M4 cores. At least on this test.
Yep, something's definitely off. My build is about 15 minutes in and still running.
Short and sweet. Thank you, Dan!
I was surprised it was so easy. I'm wondering if the lib/mbedtls_* stuff should move back to raspberrypi. The espressif port does not use the shared lib/mbedtls, and now doesn't use the other mbedtls stuff under lib any more.
the shared-module/ssl is still a good idea
I think that it should, if only to avoid future confusion. Plus, Raspberry Pi really wants versions of lwip and mbedtls that track the Pico SDK. I haven't seen difficulties up to now, but I don't believe we're doing it quite right trying to use a "one size fits all" approach.
i'll open an issue about this, then. This was all done several years ago and things have changed
FWIW, I'm generally a huge fan of portable single source builds. However, even I consider some areas best left to platform-specific configurations, and anything dealing with TLS or certificates usually falls into that category.
Oh, and my build is still going...
so, is your build directory local to WSL, or is it something mapped in C:
yeah, it's mapped in C (under my windows home directory)
I think that's going to be really slow, because it has to do filesystem translation. But the homedir in WSL is in the WSL filesystem, I think. That should be faster
i wrote this warning in the guide long ago:
Warning: Don't build in a shared folder (in /mnt/c). You'll probably have filename and line-ending problems.
I didn't consider slowness at the time. are you building in /mnt/c
WSL USB support has also not been great, though it might be better now
yeah, I'm going to try tweaking the .wslconfig settings and cloning / building under the local (WSL Ubuntu) file tree
@mortal kernel have you pushed your tls related changes yet (and if so, where) ?
i pushed them to the PR, so they are in the branch that the PR references
Thank you @andibing and @hexthat!
Itโs not really. I spent some time fighting it a while back. I use windows to actually connect / flash to usb if required.
it is weird that 8 s2 builds are failing for every PR now
I bet it was #10281
the scheduler is bad at scheduling .h changes
for CI testing
Ok, this is more like it...
FWIW, the only changes I made were building out of the local Ubuntu file system and setting (creating) .wslconfig in my windows user home directory to
[wsl2]
memory=64GB
processors=14
swap=0GB
guiApplications=false
nestedVirtualization=false
So maybe I can hold off on VBOX at least for now.
Did you get it working at all? I've gotten to the point of successfully connecting to an ESP32-S3 Devkit C through openocd and the ESP32-S3 built-in USB JTAG support, but I haven't actuall tried running gdb yet.
Wondering how much further I want to push into that rabbit hole before giving up on trying to debug CP under WSL2
Do you have a general idea how many developers (%) are building CP under WSL?
I think with openocd you can connect to an IP so I ran it on WSL but had another process on windows. That was over a year or two ago so I forget the details.
I never spent too long on it overall. WSL2 isn't great for USB support. There are some resources on forwarding it via IP but the documentation is sparse
not really, but a lot of people doing casual builds will use WSL, since it's really easy to set up and is Linux from the command line. I personally found VBOX to be more trouble to set up compared with VMWare Player. But my dev machine is native Linux. I don't use Windows unless I have to. I have several micro-form-factor machines (bought as off-lease refurbished). When i need to use windows, I use connect to a Windows box through NoMachine
I do use it as my primary (only) environment. The main frustration is the USB ports
some people do dev on RPi's but they are very patient. RPI5 might not be too terrible
meanwhile, my 2018 Mac Mini 3 GHz Intel Core i5 6ย cores takes 5:34 for
gmake BOARD=adafruit_feather_huzzah32 -j6 DEBUG=1
Yeah, I initially only used WSL for builds, then used UF2 to upload firmware and windows serial usb (typically Thonny) for REPL. But now I'm trying to get a gdb/JTAG/debugging setup for CP going.
If I was smart I would have wrote down what I did... I am not smart. But I believe with openocd you can connect via TCP/IP ports. So I ran it on windows and then connected a matching process on WSL to that IP
a used odler Optiplex MFF or similar can be had for $100-$200. I usually bought from dellrefurbished.com but they are very low on stock now, maybe due to panic buying. Lotsa laptops there, though. Also ebay etc.
@mortal kernel With firmware built from git clone https://github.com/eightycc/circuitpython.git (as of about twenty minutes ago), the lolin_s3_mini build of firmware.uf2 is now booting up and successfully providing USB REPL / CIRCUITPY drive. So whatever you did appears to have fixed that too.
I put together a $500 Intel box for a friend a few weeks back. Here are the specs:
H610M S2H V2 Motherboard
Core i7-12700K 12-core
32GB 3200 DDR4 RAM
1TB Blue SN580 NVMe
CX650 650W (way overkill) ATX power supply
Core 1100 Mini-Tower Case
All new. Ran like a bandit, would make a great development box. Running Linux, of course.
My main dev system has traditionally been Linux, but for the last year or two it's been Windows. One of the main extra twists I deal with is that I typically run four or five 4K monitors, and keeping the video drivers / configuration for multi-monitor Linux systems up to date has been a bit of a pain over the years. Plus my local system has often just been a smart terminal for RDP/NoMachine remote access anyhow, although all my ESP32 embedded work has been local builds.
I've still got a few older Linux systems I could use. If I can't get a reasonably stable debug setup going under WSL, I might be tempted to try getting my local WSL CP build directory remote mounted on a modest Linux box and just use it for running GDB, keeping all the actual builds on my main system.
I'm interested in hearing whether you get JTAG over USB serial working, and if so how you did it. I tried, but gave up in favor of the J-link connected to JTAG pins.
But even before I have a working debug setup, now that my builds are going over 100x faster it's much easier for me to do some basic testing of the ESP5.4.1 branch on other S2/S3 targets (probably even some non-UF2 targets like vanilla ESP32, H and C variants. Beyond successfully booting up into REPL and file system access (+CIRCUITPY on supported builds), are there any recommended code.py + test module code to get a bit better test coverage?
This frees up more RAM for other things.
RAM started overflowing with #10281
been keeping notes (not necessarily because I'm smarter, just lazy and been doing this long enough to learn which little extras payoff in the long term) so if it ends up working reasonably well I should be able to put together a decent writeup. And even if I can't get the USB / JTAG stuff reliable, I still might consolidate some pointers on just building CP under WSL (at least what's worked for me)
The C variants are where the pain is right now.
If, by any chance, you've got ESP32-P4, that would be very helpful. I've got a note next to it in my notebook: "Unoobtainium"
Looks good to me pending it building (but several of the failing builds passed now so believe the rest will)
wasn't there something at some point about the issue where the CDC input buffer is filled (by Mu generally) causing ctrl-C to be ignored (on SAMD21) ?
Oh my goodness, yes! Thank you. The #10288 patch makes the filter distortion non-existent! Much easier to do chords other other multi-note stuff now too.
ah yeah that https://github.com/adafruit/circuitpython/pull/7227
Will downsizing the USB CDC buffer make #4817 happen on the S2 like it does on the SAMD21 ? (which also uses 128)
Where the buffer is filled fast and that makes ctrl-C ignored.
Will downsizing the USB CDC buffer make #4817 happen on the S2 like it does on the SAMD21 ? (which also uses 128) Where the buffer is filled fast and that makes ctrl-C ignored.
Yes, that will happen on the S2 just like on SAMD21.
I have a lolin_c3_mini, lilygo_ttgo_t-oi-plus (C3), and a few others that don't yet have their own boards definition ( Lilygo T7-C6, generic C6 "SuperMini" ). I'll try getting those built and loaded, plus I still plan on doing more thorough testing on the lolin_s3_mini . I also have a TenStar Robot H2 SuperMini, which I might try with espressif_esp32h2_devkitm_1_n4
Looks like there are already ten supported (at least included in boards/* ) C6-based boards, so I should be able to find something worth trying for the two C6 controllers.
mbedtls for CYW43 (Pico W) is provide by lib/mbedtls. For Espressif, we use the ESP-IDF component/mbedtls. But since pico-sdk 1.5.0, mbedtls is included as a submodule in pico-sdk, and an API was added.
#8926 moved ssl to shared-module, which was welcome, allowing a lot of shared code.
ESP-IDF changed the in-flash root cert list format (see https://github.com/adafruit/circuitpython/pull/10267/commits/62d16ce61fdd1ec8cfb0d70a6240ad877c12df21), which necessitated going back to ESP...
I don't have an ESP32-P4 yet, but it definitely looks interesting
CircuitPython version and board name
Adafruit CircuitPython 10.0.0-alpha.2-38-g8a28033587 on 2025-04-25; Pimoroni Pico Plus 2 with rp2350b
Code/REPL
import time
import board
import busio
import audiobusio, audiocore, audiomixer, synthio
import audiofreeverb, audiofilters
CHANNELS = 2
SRATE = 48000
i2s_bclk, i2s_lclk, i2s_data = board.GP2, board.GP3, board.GP4
audio = audiobusio.I2SOut(bit_clock=i2s_bclk, word_select=i2s_lclk, data=i2s_data)
mixer = audiom...
I have to look more but if you aren't releasing the notes synthio can only play so many at once. Does this occur with any other effects?
The limit on RP2350 is 24 notes. Under normal circumstances, the notes are either ignored or the oldest notes are dropped. In this situation, audio stops altogether.
I've tested it with audiodelays.Echo, but was unable to recreate the issue.
Hi is this where to ask questions when testing alpha/S3 builds?
This is mainly a channel for development, if your trying to make a build, or trying to ask about something planned or cutting edge yes here is good. If it's more about how to do something with an existing feature or device then #help-with-circuitpython is best.
CircuitPython version and board name
Adafruit CircuitPython 10.0.0-alpha.2 on 2025-04-04; Adafruit Feather ESP32-C6 4MB Flash No PSRAM with ESP32C6
Code/REPL
n/a
Behavior
USB connection using code.circuitpython.org succeeds, but directory displays garbage. Subsequently disconnecting from code.circuitpython.org, connecting with minicom, then hitting ctrl-D results in:
soft reboot
Auto-reload is off.
Running in safe mode! Not running sav...
Additional notes:
- Flash completely erased between tests
- Similar behavior with Thonny
Changes
I tried to fix a parsing error in the py/parsenum.c file.
Tests:
Before: print(complex('-9e-17+1j')) # prints (-9e-17-1j) wrong
After: print(complex('-9e-17+1j')) # prints (-9e-17+1j) correct
It's pretty simple, I just made it so it resets dec_neg upon restarting the parse for complex numbers so it doesn't carry through to the imaginary part. dec_neg gets applied to the real part before moving on to the imaginary, so resetting it doesn't change the sign of th...
Bisecting 62 commits from tags 9.2.7 to 10.0.0-alpha.2.
Thanks for this! Submitting on main is fine: we are not planning further 9.2.x releases except for egregious errors.
This code comes from MicroPython, so it would be appropriate to submit this upstream, to https://github.com/micropython/micropython. It's worth looking to see if the code there has already been fixed or is different in some way.
Yeah I was looking at MP and I see the same in the code, and same results when trying on 1.25.
>>> complex("1+j")
(1+1j)
>>> complex("-1+j")
(-1-1j)
Thanks for this! Submitting on
mainis fine: we are not planning further 9.2.x releases except for egregious errors.This code comes from MicroPython, so it would be appropriate to submit this upstream, to https://github.com/micropython/micropython. It's worth looking to see if the code there has already been fixed or is different in some way.
Should I submit a PR over there too then?
Should I submit a PR over there too then?
Yes, submit there first. If they accept it (and they might change it a bit), then we'll take their change as it is merged there, so the sources match. If they don't do it promptly, we can merge it here and then catch up with what they do.
Should I submit a PR over there too then?
Yes, submit there first. If they accept it (and they might change it a bit), then we'll take their change as it is merged there, so the sources match. If they don't do it promptly, we can merge it here and then catch up with what they do.
Ok, thanks!
Another thing to do is to add a test: add it to tests/float/complex1.py. You can just add a few more cases to the set of print statements at the beginning. The standard test automation runs the test in micropython and in regular CPython, and the results should be the same. (It's also possible to specify the expected results with a .exp file, but I think the first case should be fine here for simple floats with e notation that can be represented exactly.)
@danh Where can I find the repo for code.circuitpython.org. I want to understand the protocol between the webpage and the USB serial device.
Melissa is the main person to work on this
There's something coming over the serial connection from code.circuitpython.org when I hit the open button that's crashing just the ESP32-C6. That's with a commit that reads as if it's unrelated to serial com, although it does touch terminal. The feedback in the file directory panel looks like console output from the safe mode restart after the crash. I think I'll need to resort to my friend JTAG again.
which commit is it?
#10208
@mortal kernel just built and uploaded lolin_c3_mini. On connect (in Thonny) I see
You're likely seeing the issue I'm working through now with ESP32-C6.
entering help("modules") at the REPL lists a bunch of modules but then appears to crash :
board json socketpool vectorio
builtins keypad ssl warnings
busdisplay locale storage watchdog
busio lvfontio struct wifi
canio math supervisor zlib
codeop max3421e synthio
Plus any modules on the filesystem
ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0xc (RTC_SW_CPU_RST),boot:0xd (SPI_FAST_FLASH_BOOT)
Saved PC:0x40382ab0
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x120
load:0x403cc710,len:0x900
load:0x403ce710,len:0x2178
entry 0x403cc710
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/circuitpython/issues.
Press reset to exit safe mode.
Adafruit CircuitPython 10.0.0-alpha.2-37-gf9ab642fdd on 2025-04-25; Wemos Lolin C3 Mini with ESP32-C3FH4
>>>
Oh, that is very helpful. What you're seeing is the crash that's breaking tools that rely on the serial USB connection. Thank you for showing a simple means of reproducing it!
I'm currently at
james@peppy:~/git/circuitpython/ports/espressif$ git show
commit f9ab642fddc034f55f40a7cd8357374c6081d7b3 (HEAD -> main, origin/main, origin/HEAD)
Merge: 53a856b67a 28856dbbcb
Author: Scott Shawcroft <scott@adafruit.com>
Date: Wed Apr 23 13:07:55 2025 -0700
Merge pull request #10281 from rianadon/enumeration-bufsize
Increase CFG_TUH_ENUMERATION_BUFSIZE so that USB devices with long descriptors are recognized
Thanks for the feedback!
I was thinking some more about the tradeoffs between implementing the low level endpoint API vs high level serial API, and I changed my mind and am leaning more towards the EndpointStream for a few reasons:
- An API that dynamically allocates a fifo for reading from an endpoint would support infinite endpoints. However, with TinyUSB's CDC class, the number of USB communication ports supported on the host depends on
CFG_TUH_CDC. You can increase it to deal with d...
@mortal kernel let me know when you'd like me to pull and rebuild lolin_c3_mini.
Will do. It might not be until later today or tomorrow.
You could try building with CIRCUITPY_LVFONTIO = 0 to see if there's some bug introduced in the font lvfontio code. Also, supervisor/shared/display.c has some code reorganization; that possibly could be an issue
That's fine, I'm using the ESP-IDF 5.4.2 lolin_s2_mini build for now to work on my project. I have noticed one odd thing - when I try opening a file in Thonny from the "Circuitpython device" instead of CIRCUITPY drive I'm getting
everything looks like a directory, and you can't open the files.
Interesting, that could be related. I'm going to follow up on Dan's suggestion, set CIRCUITPY_LVFONIO = 0 to see what that does. It does look like on ESP32 parts that don't crash, we're getting extraneous characters on USB serial.
I haven't been able to duplicate this with https://code.circuitpython.org/ , because I haven't been able to get it to use the "device" file access - it only lets me use CIRCUITPY. (Maybe this is normal behavior? I haven't used the online editor much).
are you using it over wifi or over USB?
for boards where CIRCUITPY is available over USB, via MSC, it will do file read/writes. For boards like C3 without full native USB, it sends invisible commands to the REPL to read/write files
So far almost always over USB. I've tried WiFi just to check that it worked (although not with 5.4.1 builds yet)
Sounds right - notice the "root" directory being shown as ๐ณ A
@tulip sleet CIRCUITPY_LVFONTIO = 0 didn't make a difference. I need to blow a fuse and strap to start using JTAG...
@mortal kernel I have espressif_esp32c6_devkitm_1_n4 running on a C6 "SuperMini". No CIRCUITPY ( AFAIK that's only supported on ESP32 S2 or S3? ) appears. When I try to open a file in https://code.circuitpython.org/, I get
(got a chuckle out of that)
Yes. Same bug. What you're seeing are the messages on USB serial from the re-boot into safe mode. And right, no CIRCUITPY MSC on the C6.
Thonny actually shows a normal looking directory, but attempting to load code.py fails.
@tulip sleet Here's a backtrace from one failure instance that I've been unable to reproduce. I recall seeing message traffic about oddly truncated messages, but have had no luck finding a corresponding issue.
this looks like some corrupted object, because the qstr it's trying to find seems to be out of range.
i think it's some second-order bug due to a memory smash, say,
Yes, that's probably the case.
these weird repl bugs remind me of https://github.com/adafruit/circuitpython/issues/8038, which we never figured out, but something really bad was happening.
I just reproduced 8038 in 9.2.7 and 10.0.0-alpha.2, so it's still there.
The CP / Espressif debug story for RISCV has some gaps. CP's Espressif Makefile sets -DNDEBUG and -Os for RISCV targets. I don't know why it was setup like that. Also, I'm not getting any ESP-IDF tracing with DEBUG=1. And also, panics fly through reset without stopping, making trapping the fault problematic. Finally, the RISCV build of gdb doesn't support Python, so the FreeRTOS thread tools don't work.
Still reproducible with 9.2.7 and 10.0.0-alpha.2. Note that simplifying this to say, the imports plus uart = busio.UART(board.TX, board.RX, parity=EVEN) does not provoke the error. So this particular sample of code is tickling a bug.
I'm going to take one more stab at trapping the fault in the handler with a hardware breakpoint. After that, I'll put it aside until Monday.
-Os was needed, I think, because the RISC-V code is larger than with, say, -O2.
I have used gdb-multiarch successfully instead of the ARM version to get the Python support.
Thonny is doing something or other under the covers that is provoking this bug. Just typing that code into the REPL via a terminal program does not cause the problem. Since Thonny and code.circuitpython.org operate similarly, I'm wondering if these are all related. The SAMD21 port is easy to debug and much simpler than Espressif
Interesting thought.
But I don't know whether diagnosing that bug would lead to this bug or not.
and this bug was originally discovered because it was so bad that it caused an unprotected bootloader to get smashed (so something was writing flash)
If you try this on a SAMD21 board, update the bootloader from the matching update-bootloader*.uf2 in https://github.com/adafruit/uf2-samdx1/releases/tag/v3.16.0, not because you need a new bootloader, but because the bootloader updater is careful to make sure the bootloader is protected. There were some boards that shipped with unprotected bootloaders
I'm not sure whether #8038 fails on all SAMD21, or just ones with no external flash, etc.
but this is for later, you are on a roll right now
This looks like it's a 10 blocking bug, so I'll make it my priority on Monday. I'll continue with the ESP32-C6 debug until I hit a wall, then I'll go for the SAMD21 bug.
well, it's a very obscure bug, and most people don't hit it, so it's been long term. And most people don't use Thonny. I don't think this would fail on code.circuitpython.org because SAMD21 exposes CIRCUITPY, so USB is going to be the CIRCUITPY-supporting version, not the no-CIRCUITPY version
but i'll try it
I can't provoke the bug with code.circuitpython.org with a QT Py SAMD21, but not surprised
this bug you're seeing, I forget, is it provokable via Thonny too?
I need a build past alpha.2, right?
You mean the SAMD21 bug. The ESP32-C6 bug blocks programming the part. I suppose one could code a setup.toml through the REPL and then switch to Web workflow, but as @full plume showed, even REPL isn't stable.
REPL isn't stable even with a terminal program, is that right?
sorry I am asking you to summarize instead of going back to look
Thonny will provoke it. The bug is in alpha.2. Right, REPL can fail, too.
I bisected it to pull #10208, but now I suspect that's not really responsible, it's just provoking a latent bug that's been there for a while...
I just tried help("modules") on the espressif C6 DevKit board with 8MB flash, and it didn't crash with alpha.2. Do you see a crash with that on the C6 you're using? Which C6 is it
James was seeing it on a C3. I wasn't able to get that failure on a C6 either.
I don't have a C3 board here, do you?
i have a qt py c3 and a devkit C3
trying those
@full plume what were you building that you saw the help("modules") failure on the lolin C3 mini? Was it the tip of main or was it eightycc's PR? I'm trying to reproduce on other boards
Trapped the panic! It's in exc_add_str. The stack's corrupt, but it gives me a place to work backwards from.
I just reproduced the junk in the directory listing on the QT Py C3
I've worked back to mp_obj_new_exception_msg_vlist, so we're handling a Python exception along the path to the panic. I'm going stop there for today.
Another thing to do is to add a test: add it to
tests/float/complex1.py. You can just add a few more cases to the set of print statements at the beginning. The standard test automation runs the test in micropython and in regular CPython, and the results should be the same. (It's also possible to specify the expected results with a.expfile, but I think the first case should be fine here for simple floats withenotation that can be represented exactly.)
There are already tests the...
There is no test like complex("-1+1j") (negative followed by positive) in complex1.py. That seems to me to be just an oversight.
It would be fine to add more tests, and that's the right file to add them in. Won't hurt.
code.circuitpython.org sends a small Python program to display the root directory:
import os
import time
contents = os.listdir("/")
for item in contents:
result = os.stat("/" + item)
print(item, result[0], result[6], result[9])
This triggers one of two failures, one is trapped by a hardware breakpoint on _panic_handler, the other is trapped by a hardware breakpoint on mp_obj_new_exception_msg.
(gdb) hb mp_obj_new_exception_msg
Hardware assisted breakpoint 2 at...
@tulip sleet Good morning, Dan. I took a second look and made some progress trapping #10296. It fails in one of two ways, it seems to be about 50/50 which way it fails. Something I see that perhaps you can explain is that although the small program inducing the failure is injected through REPL, it is presented to the parse_compile_execute as a single vstr. Typing directly into REPL presents the same code as a series of separate vstr's. How is this difference in behavior triggered?
Also, an earlier problem I shot (double fault early in ESP-IDF initialization) was due to an incorrectly included .ld fragment. Thinking #10296 might have a similar root cause, I went back and looked into how ESP-IDF handles inclusion of .ld fragments. There is a single CMake file, ports/espressif/esp-idf/components/esp_rom/CMakeLists.txt that does all the heavy lifting for that process. Along with deciding which .ld fragments to include, it also provides patches for various ROM routines.
it is probably sent to the REPL using "raw" mode in the REPL
ctrl-B or ctrl-E I forget. There is paste mode and there is raw mode
Thank you, let me see if I can induce the bug from the command line.
sorry, ctrl-A is raw mode
"raw REPL". ctrl-A to enter, ctrl-B to finish
ctrl-E is paste mode; it suppresses auto-indent, so you can paste multiple lines from an editor, etc.
Back to ROM: CP does some of what the ESP-IDF CMake file does in its ports/espressif/Makefile, but not all and it doesn't entirely match. Also, CP is completely missing the patches (at least I can't find them).
yes, certainly a lot easier than dealing with code.circuitpython.org or thonny
definitely worth fixing; the Makefile was snapshotted taken from ESP-IDF 3 or 4, and though we tried to update, I can believe there are missing things
As you can see from the gdb output in the issue, I've been able to turn on full debugging for the C6 builds where there's enough flash space to handle it. That's helping.
Another bug that may or may not be related to all this: https://github.com/adafruit/circuitpython/issues/10002
not related to serial stuff, but might be related to startup bugs you already fixed or will fix
Shiny. I'm going to take a wild leap and fix the .ld fragments and patches for the C6 to see if it helps #10296.
(I honestly don't think parse_compile_execute is broken.)
well, it could be some kind of buffer overflow: the accumulated raw REPL buffer is not allocated properly
That's possible, too. I believe I've (almost) eliminated bad code gen by building with various -O settings and getting the same results.
For instance, the SAMD21 bug occurs with a longer busio.UART() call; I didn't reproduce with a shorter call. I'll see if I can make it happen in the raw REPL.
[adafruit/circuitpython] New comment on pull request #10288: Fix for fixed point overflow in synthio
Todbot has tested this (comment on #10200) and it fixes the issue he was having as well.
I can now reproduce #10296 using raw REPL.Trapping and tracing through the USB serial code, I'm not seeing any buffer overflows. In usb_serial_jtag.c:_copy_out_of_fifo() there is a fixed sized buffer on the stack, but it is protected by a length ceiling check.There is UART driver patch code in ESP-IDF that CP is missing, so I'm going to look into that next.
One other thing that may be a clue: To reproduce the problem I have to run two small programs. The first is:
try:
import storage
print(storage.getmount("/").readonly)
except ImportError:
print(False)
I run this twice followed by 1 or more iterations of:
import os
import time
contents = os.listdir("/")
for item in contents:
result = os.stat("/" + item)
print(item, result[0], result[6], result[9])
Until the fault occurs.
The fault is a secondary effect of a spurious Unimplemented error that's getting thrown.
Here's the REPL of a failure:
Adafruit CircuitPython 10.0.0-alpha.2-31-gd5f89a1760-dirty on 2025-04-27; Adafruit Feather ESP32-C6 4MB Flash No PSRAM with ESP32C6
>>>
raw REPL; CTRL-B to exit
>OKFalse
>OKFalse
>OKsd 16384 0 946685558
settings.toml 32768 0 946685558
code.py 32768 22 946685560
lib 16384 0 946685560
boot_out.txt 32768 226 946685562
>OKsd 16384 0 946685558
settings.toml 32768 0 946685558
code.py 32768 22 946685560
lib 16384 0 946685560
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
SPIWP:0xee
mode:DIO, clock div:2
load:0x40875730,len:0x128
load:0x4086c110,len:0xc34
load:0x4086e610,len:0x2458
entry 0x4086c110
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/circuitpython/issues.
Press reset to exit safe mode.
is it actually necessary to use the raw REPL to provoke it, or if you used the regular REPL, would it also happen?
and suppose you defined a function to run the listdir, and then you called that function multiple times?
James provoked it with regular REPL yesterday on a C3. I've been using raw, but I don't think that the method of getting the code into the interpreter is a factor. I've repeated the failure enough times that I can see it fail each time on a different random permutation of the iterator over the os.listdir result.
I tried the listdir on a SAMD21 several times, no crash.
Did you run the storage.getmount code I just mentioned?
Yes. Which is unexplained, at least.
does it happen if you don't include the try-catch in the first part?
Didn't try. That's an interesting thought, let me try...
and if it needs try-catch, then would any uncaught try-catch work? (it should be uncaught, since storage is present)
Still fails w/o the try/catch.
Let me repeat w/o it altogether just to be sure...
It fails w/o the storage.getmount. My bad.
on a C3 QT Py, I am not provoking the problem with an unguarded getmount() (twice), and then the listdir loop multiple times (using paste mode: ctrl-E)
He provoked it with help("modules")
ok, just got it to happen with the listdir on the first try, and nothing else, in raw mode, right after a hard reset
also provoked with ctrl-E paste mode first time
It moves around and has moods.
provoked leaving out the print()
provoked leaving out the import time
provoked first time every time after a hard reset in the above
import os
contents = os.listdir("/")
for item in contents:
pass
does NOT provoke
Any idea what it might be? I've got very reliable JTAG up, so I'm open for testing ideas.
i've gotta take my son to swim practice
not really! but look at os.stat code. Also if it's on the first iteration of the loop. and does it happen if you just call os.stat multiple times without the loop
could be some iterator setup issue
or some issue with os.stat result building or something
All good thoughts. I'll let you know what I find. Thank you for your help on this. I know we'll nail it.
also try it all on one line with semicolons:
import os; contents ...; for ...: print()
and try just assigning the result instead of printing it
or not even that, just calling os.stat
it was eightcc's CP fork
I tried this on the latest nightly build (Adafruit CircuitPython 10.0.0-alpha.2-40-gfa9b9746f9 on 2025-04-26; Raspberry Pi Pico 2 with rp2350a) and it worked normal for me. All notes played.
As I typed this I tried it a couple more times and had inconsistent results. This may be related to the issue being worked on when audio DMAs are not working. I cannot think of any part of Freeverb that would cause audio to stop in this manner as it does not base any functionality on Notes just the audio...
@mortal kernel OK, here is a really simple reproducer:
Adafruit CircuitPython 10.0.0-alpha.2 on 2025-04-04; Adafruit QT Py ESP32C3 with ESP32-C3FN4
>>> [type ctrl-E]
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== for x in 2: pass
=== [type ctrl-D]
ESP-ROM:esp32c3-api1-20210207...
has to be in paste mode
notice there is an error here
but there doesn't have to be:
import os
for item in [1,2,3,4]: os.stat("/")
in paste mode will do it too. But the list has to be at least 4 items long
oops, I'm called away to play Sorry
Yes, it doesn't take much. I can get the NotImplementedError: opcode failure with import os; os.listdir("/").
I have an idea; tell you in a bit
all these things have something to do with exceptions, including for loops, which raise StopIteration when finished
and the problem is on the RISC-V boards, so I am thinking there is something wrong with the nlr code py/nlr*.*
there are assembly language impls for most architectures, but not for riscv
ls nlr*
nlraarch64.c nlr.c nlr.h nlrmips.c nlrpowerpc.c nlrsetjmp.c nlrthumb.c nlrx64.c nlrx86.c nlrxtensa.c
Brilliant! That's a strong idea.
the non-impl-specific code uses setjmp I think
I don't have time to debug this now, but I think it's a lead
I'll take a look. The other threads I was pulling all lead nowhere. The patches are not an issue. The .ld fragments made no difference when I brought them up to date. I've learned a lot about how the interpreter works, but it hasn't gotten me any closer to solving this one.
did 5.4.1 update the riscv gcc? Maybe there is some change there. Also worth checking out PR's and issues in micropython, because they did the same upgrade recently
they may have addressed this already
hmm, well, this manifests before 5.4.1, I forgot
but still, same idea, check upstream on this for riscv especially
I'll look into any gcc changes. Just gonna say that.
There is no test like
complex("-1+1j")(negative followed by positive) incomplex1.py. That seems to me to be just an oversight.It would be fine to add more tests, and that's the right file to add them in. Won't hurt.
Whoops, I thought I saw something like that, anyways I'll go ahead and add those. Thanks!
Micropython implements native nlr for riscv. They're just getting started on ESP-IDF 5.4.1: https://github.com/micropython/micropython/pull/16760 . Nothing of substance in the PR yet.
@tulip sleet The PR adding native NLR for riscv is pretty much self contained. As an experiment, I'll add it to CP. The Micropython PR is here: https://github.com/micropython/micropython/pull/15094 .
Reproducible on ESP32-C3 and ESP32-C6:
A code error during paste mode or raw mode causes a hard crash when exiting the mode with ctrl-D.
Simplest example:
@mortal kernel ๐ the simplest example is just an unassigned variable, like
paste mode; Ctrl-C to cancel, Ctrl-D to finish
=== x
=== [type ctrl-D here]
or 1/0 , which raises ZeroDivisionError
I think your idea about nlr might be the answer. I'm pulling in the MicroPython riscv native support now...
i could not reproduce on other serial-only boards like plain ESP32
(I added some stuff to the issue post)
either that or it is something about CIRCUITPY_ESP_USB_SERIAL_JTAG = 1 in particular. That is not set on the ESP32 boards
there are also some C3/C6 boards where CIRCUITPY_ESP_USB_SERIAL_JTAG = 0
notably espressif_esp32c3_devkitm_1_n4, which I have and will test for the crash (I think it did crash)
yup, it crashes too, with 10.0.0-alpha.2. This board has a separate USB-serial chip and does not use the native C3 USB-serial capability
@tulip sleet I merged native riscv native nlr, made certain that MICROPY_NLR_SETJMP was forced to 0, built clean, flash erased, but the failure persists.
ahhhhhhh ๐ฆ
I heard that all the way here on the left coast.
I'm going out for my walk and a deep think. I'll be back shortly.
It appears that the update-bundles workflow on adabot has failed the last few days https://github.com/adafruit/adabot/actions/runs/14700701652 I am looking into it to see if I can figure out why
@mortal kernel @tulip sleet Did you try https://github.com/adafruit/circuitpython/pull/10291 ? That is a fix for thonny
Giving it a try now...
the bug we are looking it is replicable in 10.0.0 alpha.2, I think before the working-dir changes
I think we reduced #10296 to #10298
The bug you are fixing may be provoking #10296, but I think it's due to the for loop raising StopIteration
and not due to the filesystem
is the idf 5.4.1 update in?
you mean is it merged?
yup. this bug seems like a distraction from the idf merge
it originally looked like it wsa due to the merge. we can continue with the merge
if it's been around but not many folks are hitting it, then I don't think its a super high priority
<@&356864093652516868> the weekly meeting will occur here on discord in about 1 hour at the usual time 11am US pacific / 2pm US eastern. We look forward to hearing from everyone. You can add your notes to the doc ahead of time if you'd like: https://docs.google.com/document/d/1kT1f2pPZgEUXu0J9QgaDrGnV59SNDoVBhh-sEESoSoQ/edit?usp=sharing
Google Docs
CircuitPython Weekly Meeting for April 28, 2025 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates before the meeting, alphabetically by your username. During the meeting, we go through them in order. If you canโt make the meeting and would ...
I just applied the commit Scott suggested, and so far I can't get a fail. I have no idea why this would be the case, but there it is.
I'm going to test with code.circuitpython.org now...
you mean with just x in paste mode?
@tulip sleet @slender iron No, that didn't fix it. I just hadn't tested it enough times.
do you think the 5.4.1 merge is in good enough shape to merge? The C3/C6 problem is older than that, so it's not a blocker on the merge
It's blocking tests of boards based on those parts, but otherwise I think it's good to go. I'll need to push the new 5.4.1 branch to the Adafruit ESP-IDF repo first, and then finalize the PR to CircuitPython so that it picks up that repo for ESP-IDF.
could try to finish that off and then go back to the C3/C6 thing
not sure if I would do an alpha.3 tomw or not
Just FYI, when I copy firmware.uf2 to the UF2 loader drive (S2MINIBOOT after special boot, not CIRCUITPY) from my Windows 11 WSL mapped drive ( "\wsl.localhost\Ubuntu\home\james\git\circuitpython\ports\espressif\build-lolin_s2_mini\firmware.uf2" ) using Windows Explorer drag & drop, I get the following error :
However, it does appear to successfully install (boot_out.txt shows correct build date and it starts successfully), and if I copy the same firmware.uf2 to a normal Windows drive/directory, and then copy that file to S2MINIBOOT, I don't see the error. I suspect this is probably some weird interaction between Windows UF2 magic and WSL in general, as opposed to anything directly related to CP, but thought it worth mentioning.
the drive goes away rather suddenly after you load something onto the BOOT drive, and it may be upset about that
windows an the BOOT drive is often a source of pain, especially with third-party drivers and utilities of various kinds. See https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#bootloader-boardnameboot-drive-not-present-2978448 and following, which you may have reviewed already. Not necessarily anything mentioned there, but there are unexpected nuisances
@mortal kernel OTOH, with that build (lolin_s2_mini, pulled from your fork, commit f9ab642fddc034f55f40a7cd8357374c6081d7b3 (HEAD -> main, origin/main, origin/HEAD) from April 23 ) some of my project code is failing :
File "code.py", line 6, in <module>
File "/lib/TerrainTronics/Demos/Cilgerran/SimpleTest.py", line 48, in demoMain
File "/lib/TerrainTronics/Demos/DemoBase.py", line 23, in run
File "/lib/LumensalisCP/Main/Manager.py", line 379, in run
File "asyncio/core.py", line 350, in run
File "asyncio/core.py", line 249, in create_task
AttributeError: 'TaskQueue' object has no attribute 'push_head'
Code done running.
The asyncio I'm running is from adafruit-circuitpython-bundle-9.x-mpy-20250307, do I need to get (or build) an updated adafruit-circuitpython-bundle?
push_head was recently removed https://github.com/adafruit/Adafruit_CircuitPython_asyncio/pull/71
You need the latest version. I removed push_head and some other deprecated methods. It's just push now.
you always want latest (or use circup)
weekly meeting starting in three minutes in CircuitPython voice channel. See pinned messages for notes document
Ready to jump into embedded systems without the C/C++ learning curve?
In this video, Malcolm, an embedded software engineer at SparkFun, walks you through the basics of MicroPython: a lean, efficient implementation of Python that runs directly on microcontrollers. Whether you're new to hardware or a seasoned developer looking to prototype faster...
GitHub
Setup, Use and Examples for using Python/MicroPython on SparkFun Products - sparkfun/sparkfun-python
Gotta learn when and how to use claude code just like any other tool.
I'm working to fix an issue where the audio buffers stop ping ponging to each other. This can happen if the second buffer completes while the first is being filled.
I suspect that the time it takes to compute the audio buffer may influence whether this happens. The longer it takes to fill the buffer, the more likely it is to happen.
Yes, please pass good content to me through the week cpnews@adafruit.com
It's up to you what you'd like to implement.
I'd lean against EndpointStream because it'd be a new unique API. This higher level has the advantage of matching the existing pyserial api. The low level core APIs match pyusb in CPython.
Is there a pyusb version of EndpointStream?
int16_t wi = (ring_waveform[idx] * out_buffer32[i]) / 32768; // consider for synthio_sat16 but had a weird artifact
One typo you may want to fix first. I don't really care so I approved.
Thanks Dan!
Thanks for hosting Dan, have a great week everyone.
thanks all for attending!
is the Google doc wiped every week, or is there some archive?
That was fast.
archive is here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting
docs are left as-is with edit permissions revoked from the link
they're also linked from the YouTube description
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/1doBXpUIa2VdBVaOj7NF-u8x41KzRPwHtfXAFTn63_2A/edit?usp=sharing
Thanks I'll catch it my next time. It mostly is a note to remind myself to look at it more in the future anyways.
#10288 should have caught most of the cases. Will keep this issue open short term to see if others show up (unless others think we should close it, in case feel free).
this is great!
Requiring upgrading to the 10.x bundle for CP 10.x firmware is certainly reasonable. Pruning deprecated methods is good, although that method was still in use in the 9.x bundle as of two months ago I might have to upgrade my CIRCUITPY lib/* "deployment process" (which is inevitable) sooner rather than later to deal with multiple bundle versions. But that's only a very minor inconvenience since I haven't officially released anything yet - mostly I just tend to be a bit obsessive about backwards compatibility.
the bundles are identical, the 9/10 difference is only the mpy format (which is also identical with 9/10)
the removed methods were deprecated in 9, they are removed in 10. Meaning the latest version of the library supports both 9 and 10. That makes the bundle backward compatible, not forward compatible (older versions of the bundle might not be compatible with latest CP, latest version of the bundle is compatible with currently supported versions of CP, which are 9 and 10).
note that "version" here refers to bundle releases. The latest release is 20250425 right now.
so:
adafruit-circuitpython-bundle-9.x-mpy-20250425.zip
adafruit-circuitpython-bundle-10.x-mpy-20250425.zip
Circup always uses the latest.
Good point. There's nothing existing, and it seems pyusb is blocking only. You'd need to use threads to do USB communication in the background. There is a PR to pyusb to make it async and add a submit_read/submit_write that return asyncio.Future objects, but it's not very far along. It seems by far the simplest and more Pythonic, but from my understanding there's very few modules in CircuitPython leveraging asyncio, so maybe it's not a good fit here.
I can continue to work on the pys...
huh TIL that python socket library can be used for CAN https://docs.python.org/3/library/socket.html#socket.AF_CAN https://www.kernel.org/doc/html/v4.17/networking/can.html -- for circuitpython we (I) just made a custom API.
I'm working on developing a the definition for a board which features an SSD1306-compatible OLED. I'm able to get it working within a script using the following code:
spi = board.SPI()
dc = digitalio.DigitalInOut(board.OLED_DC)
reset = digitalio.DigitalInOut(board.OLED_RESET)
cs = digitalio.DigitalInOut(board.OLED_CS)
oled = adafruit_ssd1306.SSD1306_SPI(72, 40, spi, dc, reset, cs)
But I'm having trouble getting it to initialize as a busdisplay within board.c. Any advice as to how best to initialize the display?
what's the problem exactly?
I'd like the display to initialize automatically (ie: board.DISPLAY) like it does with the MacroPad RP2040 and other boards with built-in displays.
Right now, that doesn't work at all. ๐คท
I probably need to study the display_init_sequence closer to make sure that's happening correctly, but I just wanted to probe to see if anyone had better luck with SSD1306 OLEDs within board definitions.
I don't think there is anything special for the ssd1306, you just pass the same parameters as you would to the busdisplay call
Okay. I'll keep playing around with it. ๐
here is an example of a board.c for a board with an ssd1306 display: https://github.com/adafruit/circuitpython/blob/main/ports/espressif/boards/01space_lcd042_esp32c3/board.c
except that one uses i2c not spi
but the init sequence will be the same
I messed up one of the address registers. ๐คฆโโ๏ธ Thank you for pointing me in the right direction!
@mortal kernel I did a git pull from your fork and rebuilt lolin_s3_mini, and it's back to failing to start (no CIRCUITPY). Tried again after installing the new bootloader.bin and still fails. Tried installing using the online installer at https://circuitpython.org/board/lolin_s3_mini/ for 10.0.0-alpha2 and it also failed.
@slender iron I'm working on FruitJam OS and thinking about ways we could store the icon and app title. Right now the title gets automatically set from the folder name, but that leads to long titles that can include other device names like "Metro" since the guides launched "disquised" as metro projects.
We currently automatically look for theapp/icon.bmp for its icon. I am thinking we could also check for theapp/apptitle.txt or similar, and if it exists use its contents for the title in the launcher. That way it can be configured to be just "Snake" or "Matrix" etc. without having to make different folder structures with more generic names inside the learn repo. Or would it makes sense to do something like metadata.json and it can contain the title and an icon filepath that way if an app wanted to define their icon as something other than icon.bmp specifically they could?
ya, I think json is more extensible
@slender iron I've merged tip of main into my branch for the ESP-IDF 5.4.1 update and I'm seeing an unrelated CI zephr-cp failure: https://github.com/adafruit/circuitpython/pull/10267
let me re-run that, it looks like a CI failure, maybe. Or you can rerun it. https://github.com/adafruit/circuitpython/actions/runs/14736412000/job/41363987479?pr=10267 choose "Re-run jobs", click for ddropdown, choose "Re-run failed jobs"
Re-running failed job...
Worked on the re-run. Now I know that with CI if at first you don't succeed...
Just for completeness, I'll be running some spot checks with the current build artifacts, then it should be good to go.
Probably obvious since similar things already happen with settings.toml , but IMHO "both" is even better. Use the same type of automatic naming already in place for defaults, but allow them to be overridden by a configuration file ( for which .json is often a great choice ).
I have a challenging board I want to make a port of circuitpython for. I've hit a roadblock porting it the traditional way -- it uses the W channel of LP5562 RGBW controller to control its LCD backlight. Zephyr has a driver for that controller. I guess what I'm asking is, how far along is the zephyr port? Is it currently capable of delivering all the bells and whistles that come with builds of circuitpython for LCD-equpped ESP boards?
The reference docs for M5Stack products. Quick start, get the detailed information or instructions such as IDE,UIFLOW,Arduino. The tutorials for M5Burner, Firmware, Burning, programming. ESP32,M5StickC,StickV, StickT,M5ATOM.
Thanks! I think pyserial is best. It feels like the defacto way to do host serial.
The zephyr port builds but most functionality has not be hooked up yet. It will be a while. Can you make a separate driver library that does the right thing for brightness?
Worth looking at https://github.com/adafruit/circuitpython/issues/9365 and https://github.com/adafruit/circuitpython/pull/10019. pyserial has some idiosyncrasies in its API which are not the greatest, so I ended up doing something slightly different for usb_cdc.
I could, it would take a lot of learning
I meant in Python, not C, though
so the LP5562 is just for the backlight?
Can a python library be hooked to do stuff independently from user code, like for the stuff that normally goes into board.c?
it could be used in user code to adjust the brightness
The funky part is that it's an RGBW controller split into RGB and W. There's an RGB LED and backlight. So the code to make it work would be just for this board.
So, a screen will be dark until user code is ran
if it's as simple as writing an I2C register to set the output it could be set to a default on boot
(maybe)
Alright, will try some "dumb" solutions. Ideally though, I was hoping I could produce a port I could upstream
a python library could be frozen into the board and provide the base access to the hardware
Is there such thing as a reverse binding, as in, can it be hooked into the C code somehow?
you can run python functions from c code, but not inside interrupts
what protocol do you talk to the rgbw controller?
it's an I2C chip
I found a driver there https://github.com/rickkas7/LP5562-RK it has a starting sequence that sets current levels and default PWM values and a bunch of things (it can apparently run a program that's a sequence of animations)
but then we'd only need that for the backlight
void LP5562::setW(uint8_t white) {
(void) writeRegister(REG_W_PWM, white);
}
Just do busio_i2c from board_init then
Yes, I found this example
what do you want an example of?
these files all do something with i2c:
ports/espressif/boards/lilygo_twatch_s3/board.c
ports/espressif/boards/m5stack_core2/board.c
ports/espressif/boards/m5stack_cores3/board.c
ports/espressif/boards/m5stack_stick_c/board.c
ports/espressif/boards/m5stack_stick_c_plus/board.c
This will hopefully make it more reliable. I think the failure to play was due to a latent interrupt from the previously interrupted playback.
@tulip sleet I'm hitting a new snag with ESP32-WROOM-32E, TLS, and ESP-IDF 5.4.1: -12288 error. Investigating...
Decodes as MBEDTLS_ERR_X509_FATAL_ERROR
i will try a build
The board is an Adafruit Feather Huzzah32.
@tulip sleet Despite the Huzzah32 being a 4M flash board, there is plenty of room for _bleio. I enabled it for testing, is there any reason I shouldn't leave it enabled in the PR?
you can leave it enabled, but is there an ota1 partition?
is this the old HUZZAH32 or the ESP32 V2?
The ESP part is labelled ESP32-WROOM-32E. There's no labeling that would indicate it's a V2. How would I tell?
on the bottom of the board
Just Huzzah32. The Adafruit part number on the packaging is 3405. I've had it for quite a while.
this is the current partition table, so yes, you can leave it on:
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs,data,nvs,0x9000,20K,
otadata,data,ota,0xe000,8K,
ota_0,app,ota_0,0x10000,2M,
user_fs,data,fat,0x210000,1984K,
but, I had trouble with BLE on, on the C3 board. It would bootloop
Yes, I've noted that issue. There are a bunch of BLE related .ld fragments we're currently not including. Of course, the C3/C6 boards aren't working yet with 10.
<
I am not seeing this error, either on HUZZAH32 or Feather ESP32 V2. I am running the attached file, with a populated settings.toml, and adafruit_connection_manager.mpy and adafruit_requests.mpy in lib/
I built from the latest commit in your issue-10191 branch
getting the libraries onto the board is a pain. I use the Thonny package manager.
Weird. I'm running that exact Python code. The only differences are that I copied the libraries with code.circuitpython.org and enabled BLE.
i would say disable BLE and try again
i couldn't get code.circuitpython.org to see the board for some reason :/
I've had intermittent trouble, too. And not with just that board. Sometimes powering down and rebooting everything does the trick.
Code looks good. I could not get the audio to fail in my testing. I'll approve and up to you if you want to wait for anyone else to try to "break" it.
Thanks for the fix! I know from experience how crazy chasing audio race conditions is.
@tulip sleet It was having _bleio enabled. With it disabled, no bug. I'll be leaving it off for now.
Submit your questions to Ladyada for Ask an Engineer https://discord.com/channels/327254708534116352/1280611628081221785/threads/1367150445193203752
@mortal kernel what is the state of the idf update? I want to grab dev boards today I'll need to help fix it up.
CircuitPython version and board name
Adafruit CircuitPython 9.2.7 on 2025-04-01; Oxocard Galaxy with ESP32
Board ID:oxocard_galaxy
Code/REPL
CircuitPython: board.c
display_init(void)
Behavior
After Power-up, the upper third of the Display shows random pixels (not initialized).
Description
When flashing the Oxocard Galaxy with the binary for "Oxocard Connect", the display is working as expected.
The difference in display_init() is only one l...
Itโs good to go. Iโm on the road , but will be back home in an hour. C3/C6 continue to have the interpreter crash, but itโs not related to 5.4.1.
@slender iron I am thinking of making a helper function that offers an easy one-line API to initialize the display at a given size. As I'm working on the launcher I'm realizing that different apps leave the display in a state that the launcher is not expecting which can cause it to break.
I intend to do a pass through all of the learn project apps and work on some tweaks that will make their integration with the launcher go smoother. But ultimately the launcher can't really gurantee that the apps are going to leave the display in a state that it expects, so it will need logic to re-initialize it in case it was released. Realistically any app could need similar logic since they also cannot be certain that the display will be initialzied or in the mode they expect when they're launched. Making a request_display_config(height, width) or similar helper that contains all of the boiler plate to initialize it and set it onto the supervisor.runtime instead of having to copy/paste that into the launcher and other apps seems convenient to me. I am imagining it having hard-coded pins so it it would only work for FruitJam and Metro RP2350, or any future devices that share their pin naming.
Do you have any thoughts about this plan generally, or about where this code should live?
both awesome-circuitpython and adabot have some updates this week.
I think we'll want a fruit jam library. kinda like the portal libraries
it can init audio then too
kk, will review it when I have time
gonna make sure I have esp devkits in my backpack for testing too
@mortal kernel what's next on your list?
The C3/C6 interpreter failure. Of course I'm open to anything else you think is a higher priority.
That's fine just pick a time cap for yourself. I'll try and look over the 10.x issues tomorrow to have a better feeling. I'm going to start working from there too. Email and reviews will be higher priority though.
OK, how about the rest of today and if it's not resolved by tomorrow afternoon I'll move on to something else.
k, sounds good. I'm hoping to have time tomorrow afternoon during nap. Definitely look at the 10.x issues for other things.
Images automagically compressed by Calibre's image-actions โจ
Compression reduced images by 41.2%, saving 172.60 KB.
| Filename | Before | After | Improvement |
|---|---|---|---|
| assets/images/boards/large/red-s2-wroom.jpg | 78.89 KB | 78.04 KB | -1.1% |
| assets/images/boards/large/waveshare_esp32_s3_touch_lcd_2.jpg | 105.56 KB | 60.85 KB | -42.4% |
| assets/images/boards/original/w... |
@slender iron I've found the code change that is causing the C3/C6 interpreter failure. I'm updating the issue (#10298) with the details. In a nutshell, it looks like a small change to parse_compile_execute is tickling a Risc-V code gen bug in gcc. I'm going to spend a bit more time looking at the generated code so that I can see if there's anything in gcc bug reports that matches.
I do have a change that moves a declaration/assignment out of the scope of a conditional that has the same effect as the failing code but does not provoke the error. I'll submit that as a PR.
Bisected from working 9.2.7 to failing 10-alpha.2. Found this commit was causing the failure: https://github.com/adafruit/circuitpython/pull/10208/commits/04622e7c03eea5123473696edd43aa25c7b85eb7. There are two changed lines in shared/runtime/pyexec.c:parse_compile_execute() that add protection against running a function that failed to compile. The first change adds the assignment of mp_const_none to the definition of module_fun.
Including this change alone from the commit causes the f...
Workaround for gcc compiler code gen problem when targeting Risc-V.
Resolves issue #10298.
[adafruit/circuitpython] New comment on issue #10300: Oxocard Galaxy: Display initialization problem
Sure, I will test it on a recent oxocard and fix it
It's a user error, sorry for the trouble.
I had a few more lines - it seems that if a line gives an error, all lines behind those won't run.
The lines were for button handling, which were set wrong.
I think the GPIOs which were set by me are used by the display, as such those lines error out with the result that my supervisor settings did not work.
I'll close this issue then.
This PR fixes the issue #10300
[adafruit/circuitpython] New comment on issue #10300: Oxocard Galaxy: Display initialization problem
I was able to replicate the problem :
.
[adafruit/circuitpython] New comment on issue #10300: Oxocard Galaxy: Display initialization problem
I opened the PR #10302 to fix this issue.
Advice Animal answers the question of what do we do after running cookiecutter, or how to we avoid telling people we support to run a sed script.
https://github.com/advice-animal/advice-animal
I wonder if this would have any application to circuitpython libs use of cookiecutter
Converted back to draft. Testing this workaround with ESP-IDF 5.4.1 updates (#10267) the failure has returned.
The Thumby and Thumby Color are two tiny, nostalgia-inducing game consoles which are powered by the RP2040 and RP2350, respectively. Both consoles support MicroPython with their built-in firmware, but I figured it would be fun to be able to port over some CircuitPython games.
The Thumby board definitions were based on the open source schematic. Some but not all functionality has been tested (display + buttons). There are two major revisions of this board which are identified by pull down r...
Added a new audiofilters.Phaser. Based on the Godot AudioEffectPhaser with the following modifications:
- Direct frequency control (ideally with a
synthio.LFO) - Variable filter stages
depthrenamed tomixand limited to1.0
@gamblor21 for interest
Tested on pyportal titano with adafruit-circuitpython-pyportal_titano-en_US-20250428-main-PR10288-1e4d766.uf2
using this reproducer code
import time
import supervisor
from displayio import Palette
from tilepalettemapper import TilePaletteMapper
import board
import terminalio
import displayio
display = supervisor.runtime.display
time.sleep(1)
p = Palette(8)
p[0] = 0x000000
p[1] = 0xffffff
bbox = terminalio.FONT.get_bounding_box()
main_group = displayio.Group()
display.root_group = ma...
I have bisected this further and found that this is the most recent build that is behavior as expected:
adafruit-circuitpython-pyportal_titano-en_US-20250425-main-PR10292-e115623.uf2
and this is the first build where there behavior is broken (the next one in S3)
adafruit-circuitpython-pyportal_titano-en_US-20250426-main-PR10264-fa9b974.uf2
The PR from that build is #10264 which was selective collect for memory allocations, so this does further point towards something weird go...
resolves: #10305
I'm not certain if this is the proper fix, but it does seem to successfully make TilePaletteMapper behave as expected. If it would be better to use m_malloc_helper or something else I'm happy to change this to whatever is best.
I wouldn't say that I have a complete understanding of the recent memory / GC improvements, but I think that I understand the basic gist of it. My theory is that self->tile_mappings was changed to being allocated as "without pointers" but it...
I'm looking to add these two boards, the Thumby and Thumby Color by TinyCircuits: https://github.com/adafruit/circuitpython/pull/10303. The original devices use the USB VID/PID of 0x2E8A/0x0005 for the standard MicroPython firmware. Should I go through the process of requesting a PID from the Raspberry Pi Foundation on TinyCircuits' behalf, or should I reach out to them to do that process? If the later is the case and they are not interested in pursuing this, does that halt the process of adding those devices to CircuitPython? Thanks!
I'm not sure of the Raspberry Pi Trading (not the foundation) policy for third party requests. It would fit with pid.codes though
@mortal kernel Thanks for looking into that crash. Bummer it still happens with 5.4.1. I think it'd be best to do something else. Maybe more info will crop up later. I'll take a look at issues and let you know what would be good for you next
Thanks! You are right. I did a bulk change and didn't look for pointer allocations. Will take a look again now.
For now, I've sent out a message to the company for comment.
Thank you! I assume this applies to all versions of these boards.
[adafruit/circuitpython] New comment on issue #10300: Oxocard Galaxy: Display initialization problem
Fixed by #10302. Thank you both!
Looks great! Thanks for the update.
I think this is ready. If not, we can follow up with fixes.
Since the Python interpreter crash was attributable to the gcc Risc-V code gen, it's likely that 5.4.1's change from riscv32-esp-elf-13.2.0_20240530 used by 5.3 to riscv32-esp-elf-14.2.0_20241119 is the cause of the crash with the workaround.
I'm surprised that code gen is the culprit
don't we see the error without 5.4.1 too?
Please retest with https://github.com/adafruit/circuitpython/pull/10299 included. It tweaks how the buffers ping pong back and forth.
Moving to long term because the non-standard speed works with most things.
Thinking about this more, it is intentional because you can attach an SD card breakout to it. The drive without a medium present is intentional in this case.
I'm surprised that code gen is the
@mortal kernel these other c3 bugs may be good to tackle since you are in that brain space
@eightycc Where did you end up on this?
I don't have a C3 board on hand. Maybe I could get one over-nighted for Monday?
@slender iron I've been working a little on the editor today. In doing so I noticed that with lvfontio.OnDiskFont if I use the font.bitmap from it on a TileGrid and then try to set tiles like tg[0,0] = 45 or similar it doesn't result in anything visible in the TileGrid. Doing the same thing with a TileGrid and terminalio.FONT does result in visible glyphs.
Is there some way to get the OnDiskFont to work directly with TileGrid? I have gotten it working with Terminal and hooked that up to the editor code, but the refresh / react to keyevent rate is quite slow, I'm brainstorming ways it might be able to be sped up by re-making the editor in different ways which led me to trying to use TileGrid with OnDiskFont.bitmap directly.
Not that urgent but: https://a.co/d/f4Q9gIs
@tannewt It got pushed out by other stuff. I'd meant to make a more comprehensive fix, but that got complicated fast. I do have a smaller fix that addresses the original issue without increasing resolution to delays less than 0.01 second.
OK, I've got some other stuff in my Amazon basket. I'll take them up on their Prime 30 day offer and then cancel it immediately.
could do digikey too if you want
theres no rush to do c3 though
there are other 10 issues you can do
OnDiskFont is trickier because it does reference tracking. I'd just use a normal font for now
I'd expect typing to be fast but scrolling slow
Okay, I'll go back to default font and see how it does with tat. So far typing is quite slow. If I type "circuitpython" it takes on the order of 15-20 seconds for it to finish typing out each letter 1 by 1 on the display. It may be made worse by some of the things I tried to do to resolve it though, I'll back up a few steps with the default font and try to get a better baseline tomorrow.
I'll have the C3 middle of next week. In the meantime, I'll pick up with the less comprehensive #9693 on Monday. I'll take on the remaining 10 issues from easiest to hardest then, too.
that seems really bad. I feel like when I poked it it wasn't so slow. Maybe is doing a full redraw of something
loading the terminal at the start it over a second of time
I've drafted 10.0.0-alpha.3 notes. Will release it tomorrow
@tannewt Yep, that fixes the problem I was running into. The provided demo works without the error now. ๐ฏ
Great detail here guys!
Does dualbank.flash() now automatically detect which of the two OTA partitions is active and writes at the given offset from the start of the passive OTA partition?
The Dualbank documentation now says:
"Writes one of the two app partitions at the given offset."
Otherwise, I guess that you would have to detect which OTA partition is active and then adjust the offset based on that? As you will start at OTA_0, then run from OTA_1 until you update again, then run from ...
I have two C3 boards - a Lolin C3 Mini and a LilyGo Mini D1 Plus. I can at least do simple testing if you have anything you'd like me to try while you're waiting.
9.2.7 does still hard fault when keys are pressed sometimes. 10.0.0-alpha.2 seems like it will not hard fault, I have tested it and pressed away on the keyboard for a while and never got one. With 9.2.7, and originally in 9.2.4 when this was submitted it occurs fairly fast within dozen or so key presses.
None of the versions successfully read the keys and print them on Metro RP2350 connected to USB host pins, but that is less problematic than the hard fault.
Just tried out this Phaser effect. It sounds awesome. Upvote.
Thanks! Iโll let you know, probably Monday.
Ok, @hathach not a high priority but next time you order from the Adafruit shop please get https://www.adafruit.com/product/857 to test with.
@slender iron I am back to default font now and the editor is much more responsive. I had also started converting the cursor to use TilePaletteMapper but am finding that is noticably slower than the existing "1 character label on top" cursor. Looking back into TPM I realize it causes the whole TileGrid to refresh with each change instead of just 1 tile. The easiest solution that comes to mind for me is to have TPM accept the TileGrid as an init argument, TileGrid already has mechanics inside of it for handling dirty area based on changes to single tiles, so TPM can make use of that on behalf of its TileGrid. a new tilegrid argument could replace width, and height arguments since they can be obtained from it.
I'm not sure if this is the best approach though, one bit that seems like it could get awkward is there would be a circular reference between them. TPM holds a reference to TileGrid and TileGrid holds a reference back to the TPM, code trying to follow them could go infinite. Do you have thoughts or ideas on how best to make TPM more effecient than causing a full refresh for each change?
I think tying the two together is a good idea. The circular reference should be fine. It'll still get cleaned up if neither is referenced by something else.
okay cool, I'll start working in that direction.
One more unrealted question, how hard do you think it would be to implement sys.argv for use with set_next_code_file()? In the short term I am intending to hack something together with temporary hidden files on CPSAVES that hold a list of arguments, but in the longer term it might be nice to share the CPython API for arguments.
Interesting! I hadn't thought of doing it that way. I don't think it'd be too hard. We could allocate a json encoded string with port_malloc and then parse it when reading it back into the new VM
I'm looking at msgpack for the temp files, it should be slightly more compact than JSON if it matters.
I doubt it does. Three characters "", per string isn't much. I'd expect json to be enabled on more boards than msgpack
there's 504 boards with json, 501 with msgpack, 500 with both
this is fine ill test as-is
CircuitPython version and board name
Adafruit CircuitPython 10.0.0-alpha.3 on 2025-05-02; Adafruit Fruit Jam with rp2350b
Code/REPL
Larsio Paint Music https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/3013
Behavior
after soft reset (ctrl-D, saving file, etc.) Error initializing TLV320 DAC: I2C peripheral in use Hard reset will fix it.
Description
No response
Additional information
No response
@tannewt I put the issue we discussed here
I am also seeing this on Adafruit CircuitPython 10.0.0-alpha.3 on 2025-05-02; Raspberry Pi Pico with rp2040 with the sample code below. On reset, the audio plays. Then if you Ctrl-C and Ctrl-D to restart, the error following error appears:
File "code.py", line 14, in <module>
ValueError: I2C peripheral in use
This does not happen on Adafruit CircuitPython 10.0.0-alpha.2 on 2025-05-02; Raspberry Pi Pico with rp2040
Sample code:
import...
Is there a possibility to make this feature optional? It is a PITA for me.
I'm having this error on Adafruit CircuitPython 10.0.0-alpha.3 on 2025-05-02; Pimoroni Pico Plus 2 with rp2350b with the following code:
import board, busio
i2c = busio.I2C(scl=board.GP19, sda=board.GP18)
Which results in:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ValueError: I2C peripheral in use
The board-specific I2C is GP4/GP5 which is I2C0, whereas GP18/GP19 is I2C1. i2c = board.I2C() works without error.
Brute force testing revealed that adafruit-circuitpython-...-20250426-main-PR10264-....uf2 is the first build to trigger this error. It must stem from the changes in #10264, and is related to garbage collection? Hopefully that'll get you something to start with, @tannewt.
The following code also triggers an error on the #10264 build:
import board, pwmio
led = pwmio.PWMOut(board.LED)
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
RuntimeError: Internal resource(s) in use
The workaround described above stopped working with the introduction of gcc 14.2.0 by ESP-IDF 5.4.1. The reason this happened was a change in the ordering of generated RISC-V instructions in function parse_compile_execute when compiled with gcc 14.2.0:
0x42057e62 <parse_compile_execute+100>: lw a4,28(sp)
0x42057e64 <parse_compile_execute+102>: li a5,1
0x42057e66 <parse_compile_execute+104>: lw s3,0(s1)
0x42057e6a <parse_compile_execute+108>: beq a4,a5,0x42057f90 <parse_compile...
Please try this branch: https://github.com/tannewt/circuitpython/tree/fix_finalisers
I think I broke finalisers in that change. I only have time to compile it now.
Now working correctly with ESP-IDF 5.4.1. Tested on Adafruit Feather ESP32-C6 board.
hiya just FYI the WM8960 is totally end of line / disco'd - we're making a breakout for the tlv320aic3100 (& maybe friends) and thats what we should probably target long-term :)
Yep, seems to have fixed it. My above test code on RP2040 works a second time after Ctrl-C, Ctrl-D, as well as a version of @relic-se's much simpler example of just creating a busio.I2C().
hiya just FYI the WM8960 is totally end of line / disco'd - we're making a breakout for the tlv320aic3100 (& maybe friends) and thats what we should probably target long-term :)
@ladyada I agree. Plus, I find the noise level in the output of that IC not ideal. I'm glad to hear y'all are working with that codec. I'll definitely want to try it out.
As for the rest of the family, have you considered the TLV320AIC3104? It adds stereo to the ADC and balanced line output, but loses the spea...
yes, @tannewt this is fixed for me now too. Fruit Jam sucessfully re-initializing DAC on I2C after soft resets (both from file save and ctrl-D).
Flag for finaliser didn't do anything. This causes "in use" issues after reload.
Fixes #10307
Code looks good to me, didn't test on hardware but see others in the issue have.
Thank you! I assume this applies to all versions of these boards.
Yes, it does. Thank you for the feedback.
sure thing, will get it next order
Added an end method to the MixerVoice class within the auidomixer library.
Calling this method will set the object's loop flag to False. This is different than the stop method, which ends the sample immediately, and instead allows any looping sample to play thorugh its entirety before ending.
This feature was added to fix a problem where samples ended via stop created a loud clicking sound from the connected speaker. By allowing the samples to play out fully, the clicking doe...
yep TLV320AIC3104 is one of the 'friends' :)
Hi,
Can you add a function under board where the user can get the description of the CP OS in use?
board.os_id looks a lot like board.board_id to keep format. Both are derrived from the OS.
Bruce
Hi, that's not information related to the board, it is found in the os and sys modules.
For example:
>>> import os
>>> os.uname()
(sysname='ESP32S3', nodename='ESP32S3', release='10.0.0', version='10.0.0-alpha.2-11-gb9f631e219 on 2025-04-14', machine='ESP32-S3-Box-2.5 with ESP32S3')
>>> import sys
>>> sys.implementation
(name='circuitpython', version=(10, 0, 0, ''), _machine='ESP32-S3-Box-2.5 with ESP32S3', _mpy=774)
@Neradoc,
OH, I didn't know that. Thank you.
Bruce
<@&356864093652516868> We'll have our weekly meeting in about 90 minutes from now in this text channel and in the circuitpython voice channel. Please take the time to add your notes in advance to the document: https://docs.google.com/document/d/1doBXpUIa2VdBVaOj7NF-u8x41KzRPwHtfXAFTn63_2A/edit?tab=t.0
Google Docs
CircuitPython Weekly Meeting for May 5, 2025 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates before the meeting, alphabetically by your username. During the meeting, we go through them in order. If you canโt make the meeting and would still...
@mortal kernel is that crash because a pointer to collect is being stored in a register?
The pointer to the compiled function is temporarily held in a callee-saved register across the call to gc_collect. The disassembled code is in #10298.
We should make sure and collect those pointers. On other architectures we do
New issue?
OK, I'll create one. For now, though, the fix I pushed works well for the RISC-V case that was biting us.
That is small enough I may be able to pick it up too
It is possible, as demonstrated by #10298, for a live memory pointer to exist only in a register when gc_collect is called. ports/espressif/mphalport.c:cpu_get_regs_and_sp() implements register spill for Xtensa processors. Similar spilling needs to be implemented, in a processor-dependent fashion, for other target processor architectures.
Automated website update for release 10.0.0-alpha.4 by Blinka.
New boards:
- pycache
- adafruit_crickit_m0
- adafruit_feather_rp2350_adalogger
- blues_cygnet
wait for somebody to actually make a board called "pycache" (like a treasure box with a microcontroller in it or something)
that's what I get for running the script locally ๐
I removed it from the pr
along with crickit m0
We need to sync the adabot fork first.
An independent podcast with the people in and around CircuitPython. Created and hosted by Paul Cutler.
CircuitPython Synthio Tutorial
Getting started with sound synthesis in CircuitPython and synthio
CircuitPython Synthio Tutorial
Getting started with sound synthesis in CircuitPython and synthio
Thanks for hosting Liz, have a great week everyone.
Here is the notes document for next Mondayโ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/1SeffJXPObzSCRRPUpaYE8T5QIz8m8bc2UfMYpH9Rop0/edit?tab=t.0
Google Docs
CircuitPython Weekly Meeting for May 12, 2025 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 att...
Sorry for the late response, but the alpha.4 update fixes the bug for me too. Thanks @tannewt !
I'm working on improving our download logging. Here is the language breakdown of requests since this morning: ```en_US 128
en_GB 21
fr 15
de_DE 9
ru 6
it_IT 5
es 3
nl 2
tr 2
pl 1
ja 1
ID 1
Version breakdown: 9.2.7 168 10.0.0-alpha.4 23 10.0.0-alpha.2 2
Why is an extra drive a pain?
@candid sun I never PRed a fix to the TLV driver. It needs a tweak to how it reads registers
it needs to call write_then_readinto (iirc) instead of separate write and read
otherwise it won't do it right
static mp_obj_t audiomixer_mixervoice_obj_end(mp_obj_t self_in) {
Thank you for the PR! One suggestion to fix the compile and you'll want to tweak the formatting to get a minimal diff. Thanks!
I don't think RISC-V needs spilling because it doesn't have register windows. Instead, we'll want to copy out of the RISC-V registers.
I don't think RISC-V needs spilling because it doesn't have register windows. Instead, we'll want to copy out of the RISC-V registers.
I think we mean the same thing. I was using the term spill in its more general sense, meaning to move register contents to RAM.
@tannewt,
Yes, I have a bunch of MCUs running and if each uses two drives I will run out of drives. I will admit I am an unusual case, but here I am. A:, B:, C:, D:, E:, F:, G:, Y:, Z: are used by my system. That leaves 17 drive letters, H: through X:. At two drives per MCU that sets the limit to 8 MCUs. I can't guarantee MCU 9 will get a letter or an empty. This will lead me to not adopt CP 10.x.x.
Some MCUs are running clocks (GPS and NTP), decoration, calibration (time, temperature...
@slender iron Hi, I'm the developer who submitted this recent PR that you commented on: https://github.com/adafruit/circuitpython/pull/10309
This is my first attempt at trying to contribute to an open project on GitHub, so please forgive any mistakes I may be making in the process, I may need some handholding.
It still looks like my PR is not passing the automated tests (its still failing 6 checks). I'm not familiar with what these checks are, or what I changes I can make to ensure they pass. Can you give me some guidance here?
My code updates only touch three files, and the compiled version with the updates works as expected, so I'm not sure where all these checks would be failing based on my updates.
one error is in the docs, try make html at the root of the repository to see (it's a little long). The docs are python docs inside C comments, there is at least a syntax error where you used "" instead of """ for the multiline dosctring.
And I'm not sure how you get it to compile locally ? There's a missing }, on line 156, also leading to everything after it being indentend
Hi, I've been doing a lot of audio work lately and can probably help guide you (as can others here). I probably won't have a chance to really look in detail for a couple days though. Offhand the doc is likely failing due to "" instead of """ on line 84 of the shared-bindings MixerVoice.
I think I see the other issue as well. I will try to add a review comment.
//| """ Sets looping to False if sample is playing, allowing current looped
//| sample to finish before looping again """
{ MP_ROM_QSTR(MP_QSTR_end), MP_ROM_PTR(&audiomixer_mixervoice_end_obj) },
to find out, you can go to the checks tab or click on the failing checks and scroll through the output to see the errors, like this:
Traceback (most recent call last):
File "/home/runner/work/circuitpython/circuitpython/tools/extract_pyi.py", line 189, in convert_folder
tree = ast.parse(fragment)
File "/opt/hostedtoolcache/Python/3.13.3/x64/lib/python3.13/ast.py", line 54, in parse
return compile(source, filename, mode, flags,
_feature_version=feature_version, optimize=optimize)
File "<unknown>", line 25
"" Sets looping to False if sample is playing, allowing current looped
^^
that's the docs issue
and this:
../../shared-bindings/audiomixer/MixerVoice.c:159:7: error: expected โ}โ before โ{โ token
159 | {
-e See https://learn.adafruit.com/building-circuitpython; Adafruit Discord #circuitpython-dev
| ^
../../shared-bindings/audiomixer/MixerVoice.c:156:5: note: to match this โ{โ
156 | { MP_ROM_QSTR(MP_QSTR_end), MP_ROM_PTR(&audiomixer_mixervoice_end_obj)
| ^
../../shared-bindings/audiomixer/MixerVoice.c:163:84: error: expected โ}โ before โ;โ token
163 | { MP_ROM_QSTR(MP_QSTR_loop), MP_ROM_PTR(&audiomixer_mixervoice_loop_obj) }, };
| ^
that's the missing },
https://github.com/adafruit/circuitpython/actions/runs/14849585502/job/41690655663?pr=10309#step:7:44
those logs can be a bit difficult to navigate and read, they can be long and the actual issue is not at the end (like in this case the docs error is literally at the top, with an additional "Error: Failed to parse a Python stub from shared-bindings/audiomixer/MixerVoice.c" somewhere in the middle
You don't need drive letters in Windows to mount something. You can just mount to an existing directory. This is not well known, but Google is your friend.
No problem! You are at the right place for help. Thanks to mark and neradoc for their help!
@blissful pollen @jaunty juniper Thank you for the information and suggested edits.
The compiling worked on my end, but then I ended up copy/pasting my edits into a newly created branch to attempt a PR. There were some errors in that copy/paste that missed the } - Iesson learned
CircuitPython version and board name
Adafruit CircuitPython 10.0.0-alpha.4 on 2025-05-05; Raspberry Pi Pico with rp2040
Board ID:raspberry_pi_pico
UID:E6635C08CB228427
Code/REPL
print("Hello)
Behavior
The serial connection to COM7: is dropped.
Description
CIRCUITPY drive is visible.
Console serial connection on COM7: is immediately dropped because COM7: is used by "Standard Serial over Bluetooth Link"
%BOARD_80F4% CircuitPython (80F4:00) (COM...
I disabled the conflicting Bluetooth link (COM7) which solves the problem because I do not use that port.
It looks like the suggested changes, and little reformatting has got it down from six to one failing checks: https://github.com/adafruit/circuitpython/pull/10309
- Failed: Build CI / docs (pull_request) - The error is showing
"Error reading SVG /home/runner/work/circuitpython/circuitpython/_build/doctrees/images/66d35c9c51e5252a3e72cb7306d23d236b7dca79/svg-badge.svg: XML parse error: Error domain 1 code 5 on line 1 column 2 of data: Extra content at the end of the document"
Not sure about this one, as my updates don't touch any SVG files
GitHub
Added an end method to the MixerVoice class within the auidomixer library.
Calling this method will set the object's loop flag to False. This is different than the stop method, which ends t...
I do not think the SVG issue is related to your change. I'm looking into it now. It seems that file the error is referencing has something wrong with it
Here is an example of an action that failed due to this issue: https://github.com/adafruit/circuitpython/actions/runs/14861943022/job/41734534030?pr=10309#step:10:2610
I believe the root cause is an anti-scraping measure implemented by a server that hosts one of the svg files downloaded as part of the pdf docs build.
The error trace in the actions log above notes an error parsing an SVG file. I ran a latex build locally and found that in place of that SVG file is actually an html file:
...
@short marsh this issue ^ is created for what I think is the root cause of that SVG error. I don't think there is anything for you to do about it in your PR branch for now. We'll have to resolve that within the docs build somehow I believe.
Improves resolution of mp_hal_delay_ms() from ticks (1/1024 sec.) to subticks (1/32768). This PR also corrects port_get_raw_ticks() for these ports:
- broadcom: Adds calculation and return of subticks. Adopts calculation used for Espressif port.
- cxd56: Returns subticks only when pointer parameter is non-null.
- litex: Return zero for subticks when parameter is non-null. This port does not resolve time below integral ticks.
- raspberrypi: Correct tick/subtick calculation. Adopts calcul...
has the flash utilization gone up with the latest circuitpython release?
my builds are 7kb over after rebasing
(on espressif)
ESP-IDF 5.4.1 consumes more flash. Which parts are brimming over?
For clarity, would this also be affecting anyone else trying to submit a PR, shouldn't all PRs be failing this if it is a larger issue?
I believe it can affect other PRs. Any PR that runs the Build CI / docs action will fail because of this issue I believe.
I think there is some logic that determines which action tasks run for the PR based on what files are changed, I'm not sure where it lives, but a PR could skip the docs build such as https://github.com/adafruit/circuitpython/pull/10315 in which case it wont cause the PR check itself to fail it seems.
Resolved boot loop with ESP-IDF 5.4.1 and additional loader fragment esp32c3.rom.eco3_bt_funcs.ld. Build was missing ROM routine entry point addresses causing it to link some incorrect BLE code for the ESP32-C3.
Due to insufficient space in flash for BLE, I had to change to the single OTA partition map for flash to allow testing.
ESP-IDF component esp_rom contains a patch to longjmp for Xtensa that creates a critical section around modification of the register window's start register. CircuitPython does not incorporate this patch.
Comments from the code in esp-idf/components/esp_rom/patches/esp_rom_longjmp.S:
"This file contains a modified version of the original Xtensa longjmp implementation. In this modified version, setting WINDOWSTART = 1 << WINDOWBASE is done inside a critical section.
This is necessary b...
This PR adds support for the new generation of six-color e-ink displays ("Spectra6").
Tested with a Pico2W and the Pimoroni InkyImpression 7.3 (2025). I will publish the actual driver once the six-color support is merged into CP.
Post your questions to Adafruit in the chat solicitation for tonight's Ask an Engineer broadcast https://discord.com/channels/327254708534116352/1369396567261315072
?showtimes
Desk of Ladyada - Sunday Evening
JP's Product Pick of the Week - 4pm ET Tuesdays
3D Hangouts - 11am ET Wednesdays
Show & Tell - 7:30pm ET Wednesdays
Ask an Engineer - 8pm ET Wednesdays
John Park's Workshop - 4pm ET Thursdays
Deep Dive w/ Foamyguy - 5pm ET Fridays
FoamyGuy's CircuitPython Stream - 11am ET Saturdays
Test on Raspberry Pi Pico 2:
Adafruit CircuitPython 10.0.0-alpha.4-dirty on 2025-05-06; Raspberry Pi Pico 2 with rp2350a
expected 10000 us, got 10007.1 us
expected 10000 us, got 10004.7 us
Test on Adafruit Metro ESP32-S3:
expected 10000 us, got 12.015 us
expected 10000 us, got 12.17 us
*** Test failing on ESP32-S3, investigating.
ESP32-S3 failure also occurs with 10.0.0-alpha.4 without this PR and with 9.2.7. This eliminates this PR and ESP-IDF 5.4.1 as potential causes of the failure.
I'm no longer able to compile with debug mode to use the JTAG
I guess I will remove some modules while testing. Any suggestions on which ones will free up the most flash?
ulab
Since you're rebuilding, the easiest thing to do is to change the flash partition map. I'm guessing you're targeting a 4M flash device.
CIRCUITPY_LEGACY_4MB_FLASH_LAYOUT = 0 in the mpconfigboard.mk will do the trick. Be sure to completely erase the flash, and if it's a uf2 capable device, flash the latest uf2 loader.
Ready for review. The ESP32-S3 failure was a typo in the test.
I'm trying to run an RP2040 program that uses sleep_memory to pass data between resets and between boot.py and main program, but doesn't actually use any of the low-power features. Not sure if this is a common situation or not.
It's likely that this issue was resolved by #10027. Needs re-test.