#circuitpython-dev

1 messages · Page 66 of 1

solar whale
#

On mine I get 81K free after reload ( that is with wifi connected via settings.toml)

crimson ferry
#

ok, mine was without connection... wow that's a lot

#

I guess the wifi module is pretty big imported

solar whale
#

I'll try w/o wifi

tulip sleet
#

it's not the importing per se, it's a native module, it's the setup it does to reserve RAM for its purposes.

solar whale
#

138K free w.o wifi !!

crimson ferry
#
Adafruit CircuitPython 9.1.0-beta.0 on 2024-03-28; Raspberry Pi Pico W with rp2040
>>> import gc
>>> gc.mem_free()
126160
>>> import wifi
>>> gc.mem_free()
125808
>>> import os
>>> gc.mem_free()
125504
>>> wifi.radio.connect(os.getenv("WIFI_SSID"), os.getenv("WIFI_PASSWORD"))
>>> gc.mem_free()
124624
``` # corrected
solar whale
#

hmm now I am getting 138K free even with wifi....

crimson ferry
#

is that with thw two modules removed? I have to correct my output above, I had a repl.py active

solar whale
#

Yes -- with PICODVI and USB_HOST removed

crimson ferry
#

ah ok, mine is the regular build

#

so 14K difference, approx

solar whale
#

From the build -- removing them reduces the RAM usage by about 14K

crimson ferry
#

so maybe there's 2K of other 8-->9 diffs

solar whale
#

a basic wifi_test works OK but I cannot connect to AIO to access a feed -- even without the modules.

short tendon
#

Sounds good. I have time this week

#

Is there any technical reason the ESP32SPI can't connect to a ntp server?

crimson ferry
#

shouldn't be... it can be a UDP client

manic glacierBOT
#

The situation about what constitutes an end of line for input is complicated. CircuitPython is reading characters either from a host computer or a UART port. Unlike CPython ("regular" Python) which knows what it's running on, we cannot know which kind of host computer (Windows, Linux, macOS, etc.) we are receiving input from. Or, we might be receiving input from a UART, or a raw keyboard.

We inherited the input() behavior from MicroPython. So I believe the current behavior is deliberate:...

wraith crow
crimson ferry
#

tthere's an old version of the adafruit_circuitpython_ntp library that works with esp32spi

short tendon
#

The old one used a built in method

wraith crow
#

I guess I was actually using adafruit_esp32spi.ESP_SPIcontrol.get_time()

short tendon
#

I was looking to see if I could get it to work for both native and esp32spi. I can cheat and use:

self._pool._interface.get_time()

But can't tell why the normal code doesn't work

#

If fails at connect

crimson ferry
#

wifi.connect, or socket.connect (a misnomer due to the non-standard NINA implementation)?

#

I can try playing with that again to make sure nothing broke

#

just tested it on PyPortal

short tendon
#

Well cool. Why is the connection different in the official ntp library...

crimson ferry
#

wifi or socket connect? are you meaning v2 of NTP lib?

short tendon
#

No v3 of the ntp lib

crimson ferry
#

ESP32SPI / NINA doesn't comply with that API

#

I tried mapping NINA/Arduino to standard socket calls once upon a time, but it was... not clean

short tendon
#

Ahhh

#

Okay, I can run with this.

crimson ferry
short tendon
#

Hahaha

crimson ferry
#

I don't know how people who do real development all day remember all. the. things.

short tendon
#

Where do most people get examples? GitHub or from the bundle?

crimson ferry
#

(I really don't know ...I tend to look for learn guide or github examples)

short tendon
#

I have this idea - for Internet libraries, templating the examples. And so:

code
code
{{ connection_method }}
code
code

Makes multiple examples replacing the {{ connection_method }} for each supported method...

crimson ferry
#

we could even add dummy connect into WIZnet ...but maybe that's just too painful

#

(then all three could be the same)

short tendon
#

I actually wish it had it. I find it frustrating that I can't create the object if it's not plugged in

crimson ferry
#

oh, hadn't thought about actually separating it

#

it does all this DHCP stuff

short tendon
#

I have 😉

crimson ferry
#

it might break user expectations, where plugging in is magical

short tendon
#

If it were me, I would add a param to creation like require_link=True and so if you didn't want to require it, you could set that to false. And then connect would do that if not already done...

crimson ferry
#

that makes sense... conceptually it should be straightforware to split that stuff out into a connect function, and call it from either init or userland

short tendon
#

Yup

short tendon
#

I was able to get the code done today, but found out my trial expired. So I need to re-setup everything. I should still have it up tomorrow(ish)

orchid basinBOT
manic glacierBOT
#

Thanks for your reply. The problem I had today was solved by using stdin.read(1) and managing my buffer to deal with newline. It works well for my job and I'm done with it at least for now.

More thought about this. If I use a serial monitor or my own code, as long as I can fully control the data, it can be fine to just send \r. However, here is a case that is worth some improvement for other users:

I have a code similar to this:

while True:
    if time.monotonic() - previousLight...
manic glacierBOT
#

We'll think about this, thanks. I'm not sure it can be perfect, in case the \n is delayed. But if it's there, we could discard it.

For your own purposes, sending data, as I mentioned, there is a secondary CDC channel which you can enable which transmitsand receives bytes, and has no extra printing or REPL handling. See https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/circuitpy-midi-serial#usb-serial-console-repl-and-data-3096590

short tendon
#

@crimson ferry thank you! I have merged the 2 NTP methods and will be opening up a PR tomorrow. 1 more library that doesn't care!

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@tannewt Do you think we should just turn off picodvi and usb_host on the Pico W? Or make a separate build?

I think we should leave the Pico W build as-is. Turning off picodvi and usb_host prevents anyone from using them. The build as-is has soft memory limits to what it can do but that will always be true. In the long term we can make more of this memory use dynamic (probably not the ram functions) so that one can turn off features (like USB MIDI) to save ram.

manic glacierBOT
#

With these changes I can successfully play a 48kBit/s, 22.5kHz, mono test file on the Adafruit Feather ESP32-S3 TFT using a max98357 breakout, which takes less than 10% of available CPU times. I have not tried higher bit rates, stereo playback etc., so I don't know the performance limits.

There are occasional audio glitches, which mostly correlate with the charging LED. I think this is a HW problem but it's difficult to be sure.

This also fixes the problem that all I2S output was in a...

solar whale
#

@danh FYI -- I am able to get the picow with the PICODVI and USBHOST removed to connect to AIO by switching to the .mpy versions of all the libraries. I've even sent my first images from the camera... progress

manic glacierBOT
short tendon
#

@tulip sleet on 9210 espressif: add user-specified socket connect() timeout, did it work for you on an S2?

tulip sleet
#

OOPS, I forgot about that. I'll test and fix if needed.

manic glacierBOT
tulip sleet
#

I opened the issue above ☝️

short tendon
short tendon
#

@tulip sleet I really want to dig into this Nina + Google SSL thing. Working sometimes and not others. Is there a way to know what cert it's validating against?

tulip sleet
short tendon
#

I think part of the issue is I'm getting different ones from different servers

#

And so wanted to compare that against when code works

tulip sleet
slender iron
#

@tulip sleet do you think anyone is relying on the storage extend stuff? I'm tempted to rip it out. (I just had a warning when I switched to one ota partition on c6)

tulip sleet
slender iron
#

it makes it way harder to protect where the user filesystem is

tulip sleet
#

reading...

#

i think you just need to disable dualbank and the warning should go away. Are you saying that we shouldn't bother to extend CIRCUITPY into the OTA partition, or are you saying we shouldn't bother to have OTA?

slender iron
#

I'm going to remove ota1 in favor of extending ota0 for more cp code on c6 and h2 (and probably c3)

#

that has the nice property of leaving user flash as-is

short tendon
tulip sleet
tulip sleet
short tendon
slender iron
tulip sleet
#

the default is it's on, and it remembers the current state. It will only mess things up if people use the second arg in erase_filesystem()

#

and I have never heard of anyone doing that

slender iron
tulip sleet
#

right

short tendon
#

@tulip sleet will the debug version give me any more detail by default?

short tendon
#

Fair. I'll try it and see

slender iron
tulip sleet
#

this is the situation as I understand it:

  1. on boards with two OTA partitions, dualbank is compiled in, but the second OTA partition is by default made part of CIRCUITPY. In that state, dualbank raises an error that you can't do OTA. It will only become an OTA partition if you call storage.erase_filesystem(extended=True)
  2. So OTA support is latent, but it's there, for anyone who wants to use it, and the user gets a nice large CIRCUITPY.
  3. If we turned that off, then CIRCUITPY would be noticeably smaller, and some people would complain.
  4. If we just ditched OTA, then the few people who need OTA would complain and give up on us.
  5. For 4MB or smaller boards, makes sense to say "no OTA for you!". For larger boards, a few but non-zero number of people may want OTA. If the number of people who want OTA is < 10 on earth, well maybe it's not worth it.
slender iron
#

I think OTA for 8MB + makes sense

#

but it doesn't make sense to limit features for 4mb boards

tulip sleet
#

right, I agree for that, and so dualbank and extend should be disabled on 4MB boards, and enabled on >= 8MB boards

slender iron
#

that'll break anyone using extended storage already though

#

so I'll probably only do C6 and H2

tulip sleet
#

using extended storage on which boards?

#

almost everyone is using extended storage now on boards that support it

slender iron
#

right, which is why I won't do C3

tulip sleet
#

ok, so we might drop the OTA partition on 10.0, on those 4MB or smaller boards

slender iron
#

for C3 yes

#

and probably S3

#

if it weren't for this extended storage, we could drop it without disrupting the user fs

tulip sleet
#

yes, i agree with that. we have already done partition size changes, and people lived with that through alphas and betas. We just warned them.

tulip sleet
slender iron
#

I'm looking to change the partition layout for the C6

#

but I'll leave the "user fs" one as-is

tulip sleet
#

do you mean like an 8MB board is like (made up numbers) 2MB OTA0, 2MB OTA1, 4 MB non-extended CIRCUITPY, but 4+2MB extended CIRCUITPY

slender iron
#

right so I'm removing OTA1 and replacing it with a 4mb OTA0

tulip sleet
#

so on C6, we haven't shipped anything yet, so it can just be OTA0 + CIRCUITPY, and extended is not functional

slender iron
#

right

#

I'll just break the few people with C6 already

tulip sleet
#

i don't think we are disagreeing.

slender iron
#

I'm lamenting the extended storage making things complicated

tulip sleet
#
boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.h
boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.h
boards/unexpectedmaker_tinyc6/mpconfigboard.h
boards/weact_esp32c6_n4/mpconfigboard.h
boards/weact_esp32c6_n8/mpconfigboard.h
#

^^ these are the C6 boards:
i think the mistake was making OTA partitions for these small boards in the first place.

slender iron
#

ya, agreed

#

we may want to unify partition size between 4mb and 8mb then

tulip sleet
#

so you are just correcting that. I don't mind telling people, watch out, your CIRCUITPY is going to be smashed

#

but we need to update tinyuf2 for all these also

slender iron
#

ota0 + ota1 may be bigger than 8mb ota0

#

no tinyuf2 because they don't have native usb

#

so it's up to us

tulip sleet
#

OH, yes, sorry

#

I am fine with "hey, in 9.1, these boards will have smashed CIRCUITPY, watch out"

slender iron
#

ota0 is 2048k for 8mb

tulip sleet
#

so it's not ripping out extended, it's just setting the compile options right, and fixing a non-far-sighted partitioning decision

slender iron
#

ota0 for 4m is 2816m without ota

tulip sleet
#

on like S3?

short tendon
#

Side question, I hadn't seen this extended storage before. Will I get more space if I set that to true? Or is it configured on the board by default?

tulip sleet
#

it defaults to true on boards with two OTA partitions (that is one partition for firmware and one for OTA)

#

so you are already getting it

slender iron
#

gotta run now though

onyx hinge
#

@slender iron so far 2 c6 boards failing for lack of space; maybe once I can merge or rebase onto your c6 partition fixes it'll all be OK, but of course there might also be more failures to come. fingers crossed, and will look at it tomorrow. goodnight.

short tendon
manic glacierBOT
#

For anyone who might be interested.
After a while I managed to configure the chip and listen to the sound. The clock was supplied by PWM, the target frequency was 12MHz (according to the "USB mode"), but the real frequency is between 11.834 and 11.695, which seems ok. It's not necessary to have an exact frequency, I've tried different ones and they work. Probably has some effect, but not important in non-critical applications.

stuck elbow
#

I'm trying to compile the uf2 bootloader for my board, and I'm getting a weird error, anybody knows what's wrong?

/home/sheep/dev/circuitpython/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: build/pewpew_lcd/bootloader-pewpew_lcd-v3.16.0-4-gd728aa1-dirty.elf section `.text' will not fit in region `rom'
/home/sheep/dev/circuitpython/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: section .binfo LMA [0000000000001ff0,0000000000001fff] overlaps section .text LMA [0000000000000000,000000000000202b]
/home/sheep/dev/circuitpython/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `rom' overflowed by 0 bytes
collect2: error: ld returned 1 exit status
make: *** [Makefile:161: build/pewpew_lcd/bootloader-pewpew_lcd-v3.16.0-4-gd728aa1-dirty.bin] Error 1
onyx hinge
#

looks like there's just too much code. the text section would have to fit under 0x1ff0 but it doesn't.

stuck elbow
onyx hinge
#

I don't know why it says 0 bytes. I'm looking at these lines:

section .binfo LMA [0000000000001ff0,0000000000001fff] overlaps section .text LMA [0000000000000000,000000000000202b]
tame creek
#

maybe the linker script declares a rom region that’s all of the rom? text is still too big, and overlaps bininfo

tulip sleet
stuck elbow
#

yeah, it looks like it doesn't like the HAS_CONFIG flag

#

I don't see any samd21 using it, so it's probably too small

onyx hinge
#

@tulip sleet do you know if it's really still using travis ci? should it be updated to use GA?

tulip sleet
#

should just remove the .travis.yml

short tendon
tulip sleet
burnt tangle
#

Hi all, I'm learning to develop new modules and I'm wondering is the source to guides like https://learn.adafruit.com/building-circuitpython and https://learn.adafruit.com/extending-circuitpython in a repo somewhere? So far I've looked in circuitpython, Adafruit_Learning_System_Guides, and circuitpython-org. Thanks!

Adafruit Learning System

How to build CircuitPython yourself on different platforms

Adafruit Learning System

Turn the dials to 11 by writing CircuitPython modules in C.

slender iron
slender iron
#

I'm thinking I may change the default partition table for everything and override it for existing boards

burnt tangle
slender iron
#

you too!

slender iron
#

copilot makes printf debugging easier 🙂

#

it's decent at adding debug prints

tulip sleet
#

the overall idea is fine but there are many changed details

burnt tangle
manic glacierBOT
#

CircuitPython version

Installed in venv:

circuitpython-stubs==9.0.3
mypy==1.10.0
mypy-extensions==1.0.0
nodeenv==1.8.0
pyright==1.1.361
setuptools==69.5.1
typing_extensions==4.11.0

Code/REPL

n/a

Behavior

n/a

Description

My editor is configured to use pyright lsp and mypy for type checking. I'm working in a virtualenv with mypy, pyright, and micropython-stubs installed. I'm currently having the following issues:

pyright...

manic glacierBOT
manic glacierBOT
#

The build as-is has soft memory limits to what it can do but that will always be true.

It's just unfortunate that adding features makes existing projects stop working, and Pico W is more affected than other RP2040 boards because so much memory is reserved for WiFi. I wonder how much Bluetooth will need. If you do later add the ability to reclaim some dynamically, that will surely help.

manic glacierBOT
manic glacierBOT
#

Although @tannewt is correct that removing picodvi and usb_host would prevent (most) users from using it, this does not imply that we cannot have a second build that has more available memory.

My personal guess is that more users are hit by the memory limits than would be hit by removing picodvi/usb_host, but having two builds with a choice for users would certainly be a valid option.

spare jacinth
#

im trying to test my changes to the setboard command, however im pretty sure i need to go through setup.py for this "resource" thingy to work...
running pip install git+https://github.com/elpekenin/circuitpython@feat/stub/list will take a year because it will clone every single submodule
can i install/test in some other way? 😅

tulip sleet
lone axle
#

I'm not sure if / how many of the submodules would have been required because it was a repo I also use for building the core so I did have all of them at the time most likely, but it didn't download them specifically for installin the stubs AFAIK.

#

and if you use -e then you can just build new versions of the stubs as you make changes and the venv that you installed it into will automatically see the latest built version.

spare jacinth
# tulip sleet I don't understand why it would clone the submodules. But would `pip install --d...

it does, that's all i can say 🙃 ```
$ pip install git+https://github.com/elpekenin/circuitpython@feat/stub/list
Collecting git+https://github.com/elpekenin/circuitpython@feat/stub/list
Cloning https://github.com/elpekenin/circuitpython (to revision feat/stub/list) to /tmp/pip-req-build-fmlubuhb
Running command git clone --filter=blob:none --quiet https://github.com/elpekenin/circuitpython /tmp/pip-req-build-fmlubuhb
Running command git checkout -b feat/stub/list --track origin/feat/stub/list
Switched to a new branch 'feat/stub/list'
branch 'feat/stub/list' set up to track 'origin/feat/stub/list'.
Resolved https://github.com/elpekenin/circuitpython to commit 933efe082e80e16f44d6125cb2e8d4553a9a4f0c
Running command git submodule update --init --recursive -q
^CERROR: Operation cancelled by user

#

i left it run for like 5/10 mins the first time after giving up on waiting 🤣

spare jacinth
manic glacierBOT
spare jacinth
#

that worked perfectly, thx foamy!

manic glacierBOT
#

FYI - When I removed the two modules AND switched to using .mpy version of the libraries, I am able to connect to and interact with AIO as I had desired. However, when I try to add in any use of the ov5640 camera, I quickly run into memory issues again. I may try removing even more modules to see if I can get anywhere but I don't think the picow is a viable candidate for the projects I have in mind.

tulip sleet
#

@lone axle all (or nearly all) the library conf.py files contain this:

# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = "1.0"

This causes the HTML < title > tags to contain "1.0", which shows most noticeably on search engine results for various libraries.

This is wrong. Where do you suggest I open an issue for this? in the bundle repo or in the cookie cutter repo (where this comes from), or somehwere else. I found some suggestions for gettin the version dynamically

lone axle
tulip sleet
#

thanks, I'll open an issue there.

short tendon
#

sooo many cookie-cutter patches...

spare jacinth
#

@short tendon 🥳

$ circuitpython_setboard -l
Available boards are: 
 * 01space_lcd042_esp32c3
 * 0xcb_helios
 * 42keebs_frood
 * 8086_commander
 * ADM_B_NRF52840_1
 * Seeed_XIAO_nRF52840_Sense
 * TG-Watch
 * adafruit_esp32s3_camera
... and the list goes on beyond infinity ...
#

any suggestions for another formatting (eg use - instead) and/or how to make the list friendlier than needing a > file for Ctrl+F'in that file? 🤣

short tendon
# spare jacinth <@1152454697614069811> 🥳 ``` $ circuitpython_setboard -l Available boards are:...

You could regex on the __init__.py file. Example:

"""
Board stub for 0xCB Helios
 - port: raspberrypi
 - board_id: 0xcb_helios
 - NVM size: 4096
 - Included modules: _asyncio, _bleio, _pixelmap, adafruit_bus_device, adafruit_pixelbuf, aesio, alarm, analogbufio, analogio, array, atexit, audiobusio, audiocore, audiomixer, audiomp3, audiopwmio, binascii, bitbangio, bitmaptools, bitops, board, builtins, builtins.pow3, busdisplay, busio, busio.SPI, busio.UART, codeop, collections, countio, digitalio, displayio, epaperdisplay, errno, floppyio, fontio, fourwire, framebufferio, getpass, gifio, hashlib, i2cdisplaybus, i2ctarget, imagecapture, io, jpegio, json, keypad, keypad.KeyMatrix, keypad.Keys, keypad.ShiftRegisterKeys, locale, math, memorymap, microcontroller, msgpack, neopixel_write, nvm, onewireio, os, os.getenv, paralleldisplaybus, pulseio, pwmio, qrio, rainbowio, random, re, rgbmatrix, rotaryio, rp2pio, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, synthio, sys, terminalio, time, touchio, traceback, ulab, usb, usb_cdc, usb_hid, usb_host, usb_midi, usb_video, vectorio, warnings, watchdog, zlib
 - Frozen libraries: 
"""

So you could grab what's after the Board stub for

spare jacinth
#

yeah, more info is nice, BUT! the list is already terribly long, and that info could be seen by user on the stub (or docs)

manic glacierBOT
manic glacierBOT
#

@bablokb re #9085 (comment), so when you did turn them off, are you able to do all the things you did in 8.x.x?

No. It helps, but using wifi and displayio still uses too much memory even after simplifying what I write to the display.

That is why I tried to move the tinyusb-code back to flash. But that did not change the memory available to python-programs (see above).

I also deactivated all other stuf...

#

I don't think the picow is a viable candidate for the projects I have in mind.

For a number of projects I have switched to the Waveshare ESP32-S3 Pico. It has the form-factor and pinout of the Pico. I have my own "compatibility" build for that board using Pico-W pin-names and all my programs for the Pico work without change.

But although this board is cheap compared to other S3 boards, it is much more expensive than the Pico-W, so not suitable for this other project which is deployed...

short tendon
spare jacinth
#

gotta love automod's false positives!

#

anyway... i already parsed the file structure, no need to write another file

slender iron
short tendon
#

just thought that way you could make a file that was:

Available boards are: 
 * 0xcb_helios: 0xCB Helios
... and the list goes on beyond infinity ...
spare jacinth
# spare jacinth anyway... i already parsed the file structure, no need to write another file

made it list by port 😉

    if args.list:
        port_boards = defaultdict(list)

        for board in resources.files("board_definitions").iterdir():
            # NOTE: For the hand-crafted finding of port and prettified name in 
            #       the docstring, its format is assumed to be:
            #
            # <empty line>
            # Board stub for ...
            #  - port: ...
            #  - board_id: ...
            #  - NVM size: ...
            #  - Included modules: ...
            #  - Frozen libraries: ...
            #

            lines = get_doc_or_raise(board).split("\n")
            port = lines[2].split("-")[1].split(":")[1].strip()

            port_boards[port].append(board)

        sys.stdout.write("Available boards are: \n")
        for port, boards in port_boards.items():
            sys.stdout.write(
                header(port)
                + "  * "
                + "\n  * ".join(boards)
                + "\n\n"
            )

        sys.exit(0)
short tendon
#

also would be cool if you coud do --list m4 and get boards with that name...

spare jacinth
#

hehe, that was next step

#

no idea how to define that in argparser tho hahahah

spare jacinth
short tendon
#

fair

spare jacinth
#

you can see how my comment still has the "pettified name", oopsie

#

now grouped by port, and both the ports and the boards for each port are sorted ^^ ```
...

renode

  • renode_cortex_m0plus

stm

  • espruino_pico
  • espruino_wifi
  • feather_stm32f405_express
  • meowbit_v121
  • nucleo_f446re
  • nucleo_f746zg
  • nucleo_f767zi
  • nucleo_h743zi_2
  • openmv_h7
  • pyb_nano_v2
  • pyboard_v11
  • sparkfun_stm32_thing_plus
  • sparkfun_stm32f405_micromod
  • stm32f411ce_blackpill
  • stm32f411ce_blackpill_with_flash
  • stm32f411ve_discovery
  • stm32f412zg_discovery
  • stm32f4_discovery
  • stm32f746g_discovery
  • swan_r5
  • thunderpack_v11
  • thunderpack_v12
#

search/filter will be later today or during weekend, leaving now. code here if anyone curious

short tendon
#

🚀

manic glacierBOT
#

I don't think the picow is a viable candidate for the projects I have in mind.

For a number of projects I have switched to the Waveshare ESP32-S3 Pico. It has the form-factor and pinout of the Pico. I have my own "compatibility" build for that board using Pico-W pin-names and all my programs for the Pico work without change.

But although this board is cheap compared to other S3 boards, it is much more expensive than the Pico-W, so not suitable for this other project which is...

tulip sleet
#

@onyx hinge I am debugging a storage issue with ssl sockets, and have some questions about the (now shared) SSL implementation, particularly about wrap_socket. Do you have time for a text or audio or video chat? I have to be afk in about 45 minutes

onyx hinge
#

@tulip sleet sorry, I was out of the house and didn't see your message. will you be back later

#

(I'm still 15 minutes away from home)

tulip sleet
#

won't be back online until tomorrow

#

no problem - i can talk about it later. The essence of the q is why mbedtls is re-inited on every socket wrap, instead of just being set up once when ssl context is created.

#

i can fix this if it is not what you meant, don't need for you to work on it yourself

onyx hinge
#

Ok, I won't be online much this weekend. We can catch up next week maybe?

tulip sleet
#

sure

onyx hinge
#

@tulip sleet you mean

    mbedtls_ssl_init(&o->ssl);  

? Yeah I was actually wondering about that myself while working on ssl-anything. It seems like some of those things that are in the ssl socket struct might belong on the ssl context struct in C.

tulip sleet
#

Yes. I am going to try moving them. Might fix some other storage problems we are seeing. I was getting Memory Error on S2 but not S3 and tracked it down to this. I’m already out

onyx hinge
#

OK. lmk if you want me to take it over, it looks like a problem of my making. I was confused what you meant by "storage" at first (thought you meant like CIRCUITPY drive storage) but this makes sense.

spare jacinth
manic glacierBOT
#

As per title, this PR adds support for --list/-l as argument to the command, which will print all the available stubs.

Furthermore, a filter can be used, eg: circuitpython_setboard -l feather to find a board without having to scroll that much.

As a side effect, the PR reworks hand-crafted parsing of arguments sys.argv into using argparse, and also changes both explicit and implicit return None with sys.exit of 0 or 1 to flag the command's success/failure

Example...

spare jacinth
#

heading to bed, will check feedack tomorrow 😜

manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.4 on 2024-04-16; Raspberry Pi Pico with rp2040
Board ID:raspberry_pi_pico

Code/REPL

# Raspberry Pi Pico

import board,busio
from time import sleep
from adafruit_st7735r import ST7735R
import displayio
import terminalio
from adafruit_display_text import label

mosi_pin = board.GP11
clk_pin = board.GP10
reset_pin = board.GP17
cs_pin = board.GP18
dc_pin = board.GP16

displayio.release_displays()
...
manic glacierBOT
#

You mispelled root_group when you're assigning the main group (you have root_groun). Not sure why that's not giving you an error.
It's usually very instructive to add print() statements at various points in the code to see a) if the code is actually being run and b) how far it gets. It may be freezing for some reason at a particular point and a couple of print() statements will help you narrow down where that is.

manic glacierBOT
#

I noticed that root_group typo but idk why it wasn't giving error for that, it happened during copy pasting it here.

But its still not working, i saved the code as code.py and i also used print statements, even till the end those print statements are working which can be seen in the ss below and lcd isn't showing any signs.
image

What if this is some driver issue or some issue with cir...

#

It all looks good from where I can see. I would double check the wiring between display and Pico. It's easy to get wires crossed, and since there's no communication back from the display, it's hard to know if you're actually talking to it. (For example, your code will work just fine with no display plugged in at all. And the display will show white when powered but nothing hooked up to it)
Do you have a link to the exact display you bought? It may not actually have an ST7735 chip.

#

It all looks good from where I can see. I would double check the wiring between display and Pico. It's easy to get wires crossed, and since there's no communication back from the display, it's hard to know if you're actually talking to it. (For example, your code will work just fine with no display plugged in at all. And the display will show white when powered but nothing hooked up to it) Do you have a link to the exact display you bought? It may not actually have an ST7735 chip.

I just...

manic glacierBOT
#

I had a reset overnight, but it didn't come back up in safe mode. Unfortunately I didn't have my USB-TTL adapter hooked up so I have no capture of what the bootloader did, but the USB came up as this:

PORT    VID     PID     DESCRIPTION
----------------------------------------------------------------------
COM33   239A    011B    USB Serial Device (COM33) [TinyUF2 CDC]

Instead of this:

PORT    VID     PID     DESCRIPTION
---------------------------------------------...
manic glacierBOT
#

With this PR, after every reload the current working directory will always change back to root.
With this, if the code exited while in a different directory (or autoreload was run, interrupting the code), reloading will run the code again.

Up until now, if the code had changed the working directory, CircuitPython would try to find a code.py in the working directory in the next reload.
This is exceptionally problematic for when autoreload is enabled, since the code may be interrupted wi...

manic glacierBOT
#

Oh I was remembering the old behavior hadn't retested in a good bit..

Still the cwd when only using REPL isn't reset.

Adafruit CircuitPython 9.1.0-beta.1-17-g9ab8831d38 on 2024-05-02; DFRobot FireBeetle 2 ESP32-S3 with ESP32S3
>>> import os;os.getcwd();os.chdir("/Beryllium");os.getcwd()
'/'
'/Beryllium'
>>> 
soft reboot

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

You are in safe mode because:
You pressed the BOOT button at start up
Press reset ...
manic glacierBOT
manic glacierBOT
#

@alhafoudh that's a nice idea and would work in some cases, but I think most of the people interested in this issue would like to use some project which uses Adafruit's bluetooth libraries and wouldn't be easy to port. Or they might just want to write code that supports all CircuitPython boards, without requiring users to install firmware, libraries, etc.

KMK for example needs imports from adafruit_ble to work.

manic glacierBOT
#

Currently analogbufio.BufferedIn blocks until the number of samples requested have been collected. I'm working on a non-blocking ring buffered version which will enable continuous data transfer. It could work like this:

>>> length = 60
>>> mybuffer = array.array("H", [0x0000] * length)
>>> rate = 10
>>> # create a RingIn object and start reading the ADC into it via DMA
>>> adcbuf = analogbufio.RingIn(board.GP26, sample_rate=rate, mybuffer) 
>>> adcbuf.count
25
>>> adc...
#

Is the resolution to this issue exactly to make sure that all of these classes call deinit() in their __del__ method? Or is more required? Looking at the classes above, it looks like some do this and some do not. And, as far as documentation, am I right that explicit calls to deinit() should be de-emphasized? You indicate that sometimes explicit calls can be useful to control the timing of the deinit(), but this is not usually necessary, right?

manic glacierBOT
#

The resolution is to make all these objects have finalizers and have __del__() call deinit(). In addition we can then remove the bulk reset operations like pulsein_reset() (already removed).

You can also use a context manager to do the deinit on context exit.

The only previous reason to call deinit() was if you wanted free up a piece of hardware that was being held by a native class. That is still true. All the hardware was also supposed to be freed up when the VM shut down and ...

short tendon
#

@tulip sleet for Monday: I was updating a personal project and noticed 9.0.4 of circuitpython-stubs didn't release. Guessing a build problem?

#

Which is strange, since 9.1.0b1 did and it was released after 9.0.4...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.1.0-beta.1-17-g9ab8831d38 on 2024-05-02; Adafruit Feather ESP32-S2 TFT with ESP32S2

Code/REPL

import time
import board
import usb
import max3421e

import adafruit_usb_host_midi

spi = board.SPI()
cs = board.D10
irq = board.D9

host_chip = max3421e.Max3421E(spi, chip_select=cs, irq=irq)

while True:
   midi_usb_device = None
   for device in usb.core.find(find_all=True):
      try:
         midi...
tulip sleet
short tendon
tulip sleet
#

maybe I'll jsut copy 9.0.3 as 9.0.4

short tendon
#

I'm sure would be fine, or just wait for 9.1.0

tulip sleet
#

if it's easy to find the latest version, then yes, probably won't bother to do anything

short tendon
#

yeah, pip install works just fine. I was setting up a requirements.txt and had assumed it existed

manic glacierBOT
grizzled raven
#

Any reason that pwmio might interfere with pulseio? I'm trying to talk to an IR receiver while driving motors with PWM. A 100% duty cycle has no problems. But anything less and I start to get errors from adafruit_irremote : "Pulses outside mark/space"; "Both even/odd pulses differ"; and "Too short";

I am doing a nonblocking decode from within an async task, and the IR receiver scanning's in a different task.

devout jolt
grizzled raven
devout jolt
#

That’s typically how larger motor noise issues are solved: by having separate power. The easiest is two totally separate supplies like what you got. You may be able to get by with filter capacitors near the affected devices (try 10uF and 0.1uF). You also could try having a separate voltage regulator off your main power supply to create a “second” power source. It’s not an easy problem to solve generally, as it really depends on your setup

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Yep, with 9.0.4 it's going into flash mode after the reset. Guess I'll get another issue opened and try 9.1.0-beta.1

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037cd5e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x1734
load:0x403c9700,len:0x4
load:0x403c9704,len:0x1184
load:0x403cc700,len:0x3090
entry 0x403c9a80
I (31) boot: ESP-IDF v5.1.1 2nd stage bootloader
I (31) boot: compile time Mar 22 2024...
#

CircuitPython version

Adafruit CircuitPython 9.0.4 on 2024-04-16; Waveshare ESP32-S3-Zero with ESP32S3
Board ID:waveshare_esp32_s3_zero
UID:437BAD95C6CE

Code/REPL

N/A

Behavior

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037cd5e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x1734
load:0x403c9700,len:0x4
load:0x403c9704,len:0x1184
load:0x403cc700,len:0x3090
...
manic glacierBOT
lone axle
#

Would it be possible or desireable to include in boot_out.txt a list of frozen modules that are available in that build of the core system? I find myself not keeping up with which ones are frozen on which devices and sometimes getting bitten by thinking I'm using one version of a library that I've copied over to my device when it's actually not using the one I copied because it's got a frozen one.

If there were a quick easy place to check on the CIRCUITPY drive itself I would definitely check there as a first step in troubleshooting. I know where to find them in the core repo, but the quicker access (and availability to non developers) would be appreciated I think.

manic glacierBOT
#

Do I need to wait possibly hours for it to happen?

It was two full days between this last crash and getting it going again from the previous crash. It had sometimes happened in less time on 9.0.2 but around two days has been consistent. Nothing was happening with the motor.

I've made two more of these setups, minus the actual motor and switch on GPIO11, that I can try to run simultaneously with code trimmed out. Are there particular areas you think are the most likely suspects? The ne...

manic glacierBOT
#

Are there particular areas you think are the most likely suspects? The network stuff? i2c bus?

I think the network stuff and async are the most likely. The I2C and motor control are pretty unlikely, as is the minimal display code. So you code take those out to start and leave the network and async and see what happens. That is, remove the actual motor control but leave all the motor timing code in. And when it's quiescent, not much is happening except NTP every 4 hours. You could speed t...

burnt tangle
#

Hello experienced devs, I see that micropython uses a blizzard of types, many of which are generated by intricate macros. It is starting to make sense, but I am wondering, are there any tools you use to help make sense of this, or do you just, you know, suck it up? For instance, wondering if the preprocessor output sheds any light, or if looking at the memory while the code is running is helpful in revealing the structure.

tulip sleet
#

I don't think looking at the preprocessor output will help you a lot. Many macros are casts or struct-creating macros

tulip sleet
lone axle
#

Ahh, I think I've seen that before but had forgotten about it. Thank you.

tulip sleet
#

we could mark the frozen ones more clearly. help("modules") on CPython has a bunch of extra verbiage (try it), so I don't think adding a few markers or making the frozen list separate would be terribly incompatible.

lone axle
#

I will try it in a more limited venv a little while later. I tried in my main python instance. It outputed several warnings about Future, Deprecation, and UserWarning things and then eventually crashed with Aborted (core dumped) I've got a decent list of stuff installed in that main python instance that could be causing issues

tulip sleet
#

i was just trying it not in a venv

burnt tangle
tulip sleet
#

yes, that one is recent, and really bumped up into the limitations of cpp.

manic glacierBOT
#

I tested this successfully by building stubs from this branch locally and installing with pip install .

I don't necessarily see a need to print out the board information when it's set. I don't have a problem with it either, but I could go either way on it's inclusion.

Really nice touch that you can further filter the list by passing keywords after --list like circuitpython_setboard --list feather One thing that would be a good potential improvement to that is if the search term matc...

onyx hinge
#

@tulip sleet the ref is e8a4c1dd537c7ccfba92936c6eee9d5cf529be9e

tulip sleet
#

I can put in the state statistics

onyx hinge
#

I didn't realize I was hosting either 😅

#

<@&356864093652516868> hey y'all! turns out the weekly meeting is in 20 minutes and I'm the host! please add your notes if you can, and I look forward to seeing you in the voice channel at the top of the hour.

tulip sleet
#

@onyx hinge want me to do commuinty news while you set up?

onyx hinge
#

@tulip sleet If you want to grab another item or two that'd be dandy!

#

@tulip sleet @gilded cradle @lone axle can y'all grab the usual "state of" sections today?

tulip sleet
#

sure

lone axle
#

Yep

gilded cradle
#

@onyx hinge my internet keeps going in and out, so if it's offline at the time, could you read it?

onyx hinge
#

@gilded cradle sure, or if it's easier on you I could just plan to read it no matter what

gilded cradle
#

I should be getting a new cable modem tomorrow.

onyx hinge
#

sorry you're having internet troubles 😕 and hope that it's solved soon

gilded cradle
#

Yeah, modem was supposed to be here Saturday, but shipping delays...

#

Well, they just rescheduled it for later today.

lone axle
midnight ember
#

18 people opened 100 issues??? huh.

ornate breach
midnight ember
#

If they're regulars then I can believe it sure. Just wondering if there was some kind of PyCon sprint for finding bugs.

#

ahhh

#

i moved you up dan hope that's ok

#

Justin 👏

#

sampling single pixels and returning them

#

Nice work Jerry!

thorny jay
#

Maybe the Raspberry Pi foundation is working on a new RP2040 like microcontroler... let's cross the finger. It could have more memory. 😉

plucky tulip
#

Thanks, I remember it used to work back in 8.x

#

on PicoW

#

I see, thanks for explaining 🙂

midnight ember
#

Thank you for hosting @onyx hinge

lone axle
#

Thanks for Hosting Jeff. Have a great week everyone!

short tendon
#

Thanks!

thorny jay
#

People add memory on DE-10 (FPGA) to have more memory for more "emulation" (That is MiSTer FPGA).

midnight ember
#

Where there is a will there is a way but the chip has to support it.

onyx hinge
#

someone sufficiently advanced could write a high performance ARM-to-ARM JIT that treats the internal RAM as a cache and has a software/PIO PSRAM drier....

#

just a matter of sufficient dedication right?

midnight ember
#

You'd have to completely hack the firmware to shreds I guess... if someone is willing to do that for a pico w go for it.

#

yeah

#

If you would have told me when the pico came out that it would eventually run HDMI I wouldn't have believed it.... stranger things have happened.

manic glacierBOT
#

NTP isn't actually happening with the code, probably I'd disabled it to validate that the DS3231 was providing time. Re-familiarizing myself with the code, once it has started the only things happening are:

  • Wi-Fi.
  • The Web API is enabled but not being used.
  • Some functions await-ing on async_button.button.wait() that wouldn't be doing anything when crashes occur.
  • Some functions await-ing on asyncio.sleep() that wouldn't be doing anything when crashes occur.
  • DRV8833 faul...
manic glacierBOT
#

Well, the original crashed again already. And come up again in flash mode, this time cycling the motor, which has not happened before and now has me concerned for leaving that running unattended. I may have inadvertently changed bootloaders when I was upgrading it to 9.1.0-beta.1 because it came up with the FTHRS3BOOT drive instead of just the TinyUF2 CDC serial port.

TinyUF2 Bootloader 0.18.2 - tinyusb (0.15.0-566-gf1e006d09)
Model: Adafruit Feather ESP32-S3
Board-ID: ESP32-S3...
manic glacierBOT
manic glacierBOT
onyx hinge
#

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

pallid creek
#

Does that mean there will no longer be an immediate mode graphics api for CP?

pallid creek
#

I realize that displayio is the right API for most cases, but there are times when it is useful to have more control. In particular I'm thinking about partial updates for eInk displays.

manic glacierBOT
misty garnet
#

anyone else get complaints about the build process with adafruit_ticks:
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/adafruit_ticks.py", line 31, in
_TICKS_MAX = const(_TICKS_PERIOD - 1)

TypeError: unsupported operand type(s) for -: 'const' and 'int'
#

this is during the automated build process for a pull request

onyx hinge
#

(that is, the last CI inside adafruit_ticks)

misty garnet
#

Pull request for adafruit_minimqtt

onyx hinge
#

OK

#

I can help with that

#

during the build process you're getting this:```
File "/home/runner/work/Adafruit_CircuitPython_MiniMQTT/Adafruit_CircuitPython_MiniMQTT/adafruit_minimqtt/adafruit_minimqtt.py", line 39, in <module>
from adafruit_ticks import ticks_ms, ticks_diff
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/adafruit_ticks.py", line 31, in <module>
_TICKS_MAX = const(_TICKS_PERIOD - 1)
~~~~~~~~~~~~^
TypeError: unsupported operand type(s) for -: 'const' and 'int'

#

this occuring during the build of the documentation

#

this occurs because pydoc creates fake versions of modules that can't be imported, and sometimes these fake objects don't behave in the necessary way.

#

if that still doesn't get you un-stuck please @ me on the bug and I'll try to take a peek in tomorrow

#

er on the PR

misty garnet
#

Ok, I'll give it a try and let you know how it goes, thanks for the help

short tendon
#

So, I see that Adafruit has already allowed codecov into its organization. Any issues with me adding it to a repo for coverage to see how it looks (would probably try with ConnectionManager)?

tulip sleet
#

no objections

lone sandalBOT
onyx hinge
#

@misty garnet second guess, remove micropython from the explicit mock list in docs/conf.py: docs/conf.py:autodoc_mock_imports = ["micropython", "microcontroller", "random"]

#

it's micropython.const that's getting incorrect behavior via being "mocked"

misty garnet
#

I'll give it a try later today

manic glacierBOT
#

Noticing that the RP2040 port of monotonic_ns() only has millisecond precision - the subtick value is not used:

https://github.com/adafruit/circuitpython/blob/781c577745338128e1994d0b63fe95d75f3ef786/ports/raspberrypi/supervisor/port.c#L268-L271

This seems to work for a fix:

uint64_t port_get_raw_ticks(uint8_t *subticks) {
    uint64_t microseconds = time_us_64();
    if (subticks != NULL) {
        *subticks = (uint8_t) (((microseconds % 1000000) % 977) / 31);
    }    
 ...
manic glacierBOT
misty garnet
#

@onyx hinge removing micropython import from docs/conf.py did the trick, thanks for the help

manic glacierBOT
manic glacierBOT
#

The RP2040 port of monotonic_ns() only has millisecond precision - the subtick value is not used:

https://github.com/adafruit/circuitpython/blob/781c577745338128e1994d0b63fe95d75f3ef786/ports/raspberrypi/supervisor/port.c#L268-L271

Added 7234375e806f101673f3c91bf649442260588d97 to fill in the subtick field. Testing with this code to look at deltas between successive calls to monotonic_ns():

import time
def test_ns(n=200):
    t0 = time.monotonic_ns()
    for i in r...
manic glacierBOT
alpine holly
#

When creating a new board inside espressif ports for circuitpython, is there a standard way to define the serial mapping of DTR and RTS pins to the ESP32 reset and GPIO0 ? While the build itself doesn't care, other tools definitely need to know this (e.g. the online flash tool, serial emulators, upload/download scripts, etc)... I'm doing the port for the popular "ESP32CAM": does anyone else know another board which has hardware serial which also wires DTR (data terminal ready) and RTS (request to send) to the ESP32 reset and gpio0 pins (i.e. so I can see if/how they supported this?)

tulip sleet
#

for instance esptool.py doesn't need external flow control

onyx hinge
#

but yeah, to date we have not identified a need for this, as the "standard reset sequence" is so widely supported by esp boards in the wild.

ornate breach
#

Does circuitpython support BLE audio streaming on nRF52840?

onyx hinge
#

@ornate breach no

ornate breach
#

Darn

#

I had an idea

alpine holly
#

@onyx hinge thanks, great pointers and good idea. @tulip sleet some boards (ESP32CAM most notably) physically wire the hardware serial chip flow control lines to the ESP32 reset and GPIO0 lines (and do not use them for flow control of course)... this allows software programmers to automatically "hardware reset" the board, and optionally put it into firmware-upload mode, even when the last uploaded-sketch might be crashing. I'm not familiar with how other boards handle that (probably force you to manually press a button?), but the issue with these automatic ones is that there's a 50%/50% chance that your non-arduino terminal emulator (and/or command-line tools like "ampy" etc for talking to micropython) is not going to work for these boards, because the tools (or if not the tools, the windows/mac/linux/wsl1/wsl2/etc operating system itself when the tools do not specify otherwise) incorrectly (from the point of view of the ESP32CAM, which is really "correctly" from the point of view of something expecting hardware flow control) set the state of these flow-control pins (even when you tell the tools you're not using flow control). Long story short - this seriously "trips up" most people trying to use an ESP32CAM (and similar - I think Freenove and esp32-wrover-dev do this too)

stuck elbow
#

but that's not something that has anything to do with circuitpython, is it?

onyx hinge
#

or to put it another way, can you clarify what CircuitPython would do with this information?

manic glacierBOT
tidal kiln
#

would this need updating for latest CP UF2? (due to UF2 file size)

TinyUF2 Bootloader 0.14.0-5-g45bc2fc - tinyusb (0.15.0-331-ge3b3229d6)
Model: Adafruit MatrixPortal S3
Board-ID: ESP32-S3-MatrixPortal-revB
Date: May 18 2023

not finding the summary of what versions work for what UF2 file sizes, etc.

devout jolt
#

Hi! Both you and @tulip sleet have run into this problem. I'm trying to make a library using cookiecutter and getting this AttributeError: module ‘pkgutil’ has no attribute ‘ImpImporter error when committing. I'm using Python 3.12 and have many other dependencies on it. Is there a way to tell pre-commit and its tools to use Python3.11, which I also have installed?

manic glacierBOT
#

@XenonFlits @dhalbert Happened to be recently working on understanding I2CTargets so I took what I learned and created some additional documentation. If you have a moment, could you review and see if there are additional gaps that I haven't explained clearly?

Also, I believe there is a bug in 9.04 that prevents the full example (as well as the original example) from working: durin...

tulip sleet
devout jolt
tulip sleet
manic glacierBOT
#

oh, and you'll need this snippet of code to get the output to work correctly. I'll remove this dependency before submitting a pull request for this documentation

import adafruit_logging as logging


class NamedStreamHandler(logging.StreamHandler):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

    def format(self, record):

        return f"{record.created:<0.3f}: {record.levelname} - {record.name} : {record.msg}"
lone axle
#

The core module hashlib seems to only support the sha1 algorithm. Inside of the core code I found that it's including things from mbedtls/ssl.h https://github.com/adafruit/circuitpython/blob/main/shared-module/hashlib/__init__.c#L30 I found mbedtls inside of lib/ and what I'm guessing is the ssl.h it's referring to: https://github.com/Mbed-TLS/mbedtls/blob/981743de6fcdbe672e482b6fd724d31d0a0d2476/include/mbedtls/ssl.h Is anyone able to confirm that is actually the correct ssl.h? And secondarily I'm interested in trying to make a build that has sha256 enabled inside of the core hashlib. I see many references to sha256 inside that ssl.h file and the mbedtls include directory, is it just a matter of adding a bit more code to hashlibs shared-module and shared-bindings __init__.c files? Or is there more a lot more to it than that?

onyx hinge
#

There may be changes necessary to other build or configuration files, but I don't know. py/circuitpy_defns.mk names files related to the implementation sha1 and sha512. fwiw without a real good reason I wouldn't include md5 or sha1, they are both considered cryptographically broken.

#

wait, the one we have is sha1? oof

alpine holly
#

@stuck elbow yes, because (for example) https://code.circuitpython.org/ - giving people a board they can't use because no tools can connect to it isn't a nice thing to do to them 🙂 [ hence my original question: is there a standard way to define the serial mapping of DTR and RTS pins to the ESP32 reset and GPIO0 ]

tulip sleet
# alpine holly <@351136009922019331> yes, because (for example) https://code.circuitpython.org/...

I am not sure what you mean by "define the serial mapping". are you saying that external tools (e.g. a USB-serial converter, driven by some software) want to attach to those pins? Are you saying that the CircuitPython REPL should be paying attention to the DTR and RTS pins? When I use a usb-serial converter, normally do not connect the DTR and RTS pins. I know that the standard terminal block includes those. But suppose you don't connect them, and only connect TX and RX. What functionality are you losing by not DTR and RTS, and does the external software assume those connections (esptool does not, for instance).

#

If DTR and RTS are tied to ESP32 RESET and GPIO0, then the state of those pins will allow external resets, etc., as you say. But that is way before CircuitPython even starts. CircuitPython pays no attention to flow control for the REPL on any pins. And indeed, since one of the the pins is reset, it cannot be used for flow control, since toggling it will reset the board.

#

what is it that you can't do right now with these boards?

lone sandalBOT
alpine holly
#

@tulip sleet "CircuitPython" is an ecosystem not just a firmware image. Other things need to talk to the firmware, and those need to know when these DTR/RTS features are available, so they can (a) use them, and (b) not cause everything to "not work" because they're ignoring them. While the things that use these pins (mu, vonny, https://code.circuitpython.org/, ampy, vscode, etc) are what's supposed to honor this, the most logical place for where this info should be authoritatively recorded, is someplace inside the board definitions. It is because circuitpython (the company) also has a product which is not working on account of this info not being recorded anyplace that I'm asking questions about this in here. It's a chicken-and-egg problem. https://code.circuitpython.org/ isn't going to get perfectly fixed unless ports/espressif/boards/* documents when this is required (which it isn't doing, because https://code.circuitpython.org/ doesn't look) ...

alpine holly
#

It's actually a somewhat larger issue - some tools work (e.g. arduino itself, micropython online flash components, the https://code.circuitpython.org/ REPL when you pick "circuitpython" - which makes no sense since these boards do not support USB FS, so https://code.circuitpython.org/ isn't usable when you do that), but most other tools fail. I've fixed the bug everywhere I can find (ampy, mpuremote, and a bunch of others) and provided workarounds for the root cause of the problem (python itself, which on some (but not all) operating systems does not allow serial constructors to specify what to do with those pins, and defaults to pulling them low - which locks boards in either reset or DFU states - I filed the relevant bug reports and someone there seems to be looking at it... the workaround it to manually construct a serial connection before telling it what port to use, set the pins as needed, then specify the port.). Confusing things even more - some boards wire reset this way using a capacitor (thus always see momentary resets) and others use a transistor (so pulling reset low locks up the board indefinitely)

stuck elbow
#

circuitpython is not a company

#

I still don't see what you want us to do with that information

alpine holly
#

@stuck elbow sorry, I mean adafruit, the owners of the circuitpython trademark and who run circuitpython.org website I still don't see what you want us to do with that information => my original question: is there a standard way to define the serial mapping of DTR and RTS pins to the ESP32 reset and GPIO0 I

stuck elbow
#

no

alpine holly
#

WOO HOO!!! Got the ESP32CAM working almost perfectly. Camera - YES! SD-Card - YES! LED+Flashlight - YES,YES!

#

Huge marathon... I've sat here for 12 hours on that... Just gotta test wifi. What's the developer ettiquette on this channel? Do n00b geeks like me get flamed for asking dumb questions? I'm wondering a bunch of stuff (like whether or not I should use the "AI Thinker" trademark in my board - they deisgned it, but I'm working on clones and have no idea if an original would work...)

#

Is this even the right channel for board devs ?

stuck elbow
#

this is the right channel for the firmware development and adding support for new boards, but we might be a bit lacking in legal knowledge about trademarks

#

I'm not a lawyer, but it seems that only the owner of a trademark should use their trademark

#

if you use someone else's trademark without permission, they can sue you

alpine holly
#

What, if any, procedure exists for including "tools" for a board? e.g. code samples for taking photos, mounting SD card, illuminating the flashlight, etc ? While some existing things work ( https://learn.adafruit.com/capturing-camera-images-with-circuitpython/example-qr-code-scanner ) others do not, and most of those require unnecessary (internet accounts)/unsupported(LCD screens) features and don't make it easy for new users to get started.

Adafruit Learning System

Using parallel cameras like OV2640

#

Another question (sorry! getting my ducks-in-a-row before creating a new-board PR...) - does anyone know how to use SD_Card in 4-pin (SDIO) mode, instead of 1-pin SPI mode - or if it's even possible? Seems a shame to limit the speed to 25% when all pins are soldered...

stuck elbow
#

for adafruit boards this is usually the shop page and/or the learn guide for that board

#

for third party boards this is the website of the manufacturer

alpine holly
#

Thanks... I find they've called it SDMMC in the source, so I'm working on that now.

empty salmon
#

Looking for guidance: Default state of enable pins
I am working on an RP2040 board with built-in epaper display, neopixels, and sound.
When using sleep modes, I want to reduce power. The three mentioned features each have an _EN pin.
When the board first boots up, should the enable pins be “active” or should the documentation and example code always include setting these pins to turn on the features?
When I look at the Adafruit MagTag, they default to not setting their enable pins at startup.

alpine holly
#

I am NOT an expert, but, I've been "saved" in the past when I need to connect lots of things to boards with not-many-spare by simultaneously wiring pins to multiple devices, and using software to carefully control them and not use things that need the same pins at the same time... if stuff was getting "enabled" by default, that would mess me up. On a philosophical note: users can "enable" (not not!) anything they want during boot in their code.py, however, if you did that for them, you've denied them the chance to have the option... Semi-relatedly, I notice that if my wifi settings are not inside settings.toml, the wifi does not aautomatically get set up... that's another possible option for you ?

empty salmon
#

There is the question of "usability". With the CircuitPython focus on "ease of use and learning", pre-enabling is one less thing to remember and means the existing learning guides "just work".
By contrast, not pre-enabling is more power conscious.
Using MagTag and a single point of reference suggests there is precedence to no enable in the firmware.
(I can talk myself into anything. I'm very convincing 😜)

manic glacierBOT
#

This adds support for the cheap-and-popular ESP32-CAM boards.

Board Feature			Circuitpython Status
=============                   ====================
Take photos with camera		Tested + Working
Mount SD card			Tested + Working
Wifi				Tested + Working
Inbuilt RED LED (back of board)	Tested + Working
Flashlight (front of board)	Tested + Working
ESP32-CAM-MB Button		Tested + Working
Bluetooth			Not tested
Others				There are no other features I know of

Here is my workin...

alpine holly
#

Nobody can use any of these boards without creating settings.toml (usually to add wifi credentials), so one of (a) making enablement an option in there, or at least (b) making "do not enable at all" (taking care not to enable first, then disable, since that's going to break stufffor anyone who diodn't want it enabled in the first place) at least a possible option in there, seems to make the most sense?

tulip sleet
#

we are working on making code.circuitpython.org work on boards that do not present CIRCUITPY, but instead only present a REPL through a serial port.

#

files will be read/written through the REPL, as with ampy, etc.

alpine holly
#

@tulip sleet Those pins are connected for a reason - so programming is possible without humans needing to manually push buttons. There's millions of these boards out there - possibly more esp32-cam boards exist than any other esp32 or even circuitpython compatible boards - they're crazy-cheap, and often sold in the hundreds.

tulip sleet
#

the reset pin is not under control of CircuitPython so it is not part of the board definition. GPIO0 could be used for GPIO and is sometimes included

#

yes but those board break the definition of what DTR and RTS are usually for

#

if you want features to be added the the host-computer tools that know about the non-standard uses of those pins, that's ok, but it doesn't really have to do with CircuitPython

alpine holly
#

"we are working on making code.circuitpython.org work on boards that do not present CIRCUITPY, but instead only present a REPL through a serial port." - that's browser-based scripting. It already works (for micropython). That script needs to know this option. That's the whole point of me writing here about it.

tulip sleet
#

it has to do with those tools. To the extent that we control any of those tools, we're happy to entertain requests for such features.

alpine holly
#

the micropython firmware-upload stuff works fine. the adafrut copy of it does not. someone broke this specific issue when they cloned that...

#

I'm happy to fix that for them later, if that's something they accept PRs on.

#

Quick question: whose job is it to fix a lint error of a single missing space in my PR? I assume either some tool, or whoever merges it, does that ?

tulip sleet
#

we're happy to entertain PR's on anything

alpine holly
#

it's C, not python.

tulip sleet
alpine holly
tulip sleet
#

you can make the change manually and push a new commit, or use pre-commit locally and have it clean up your code before you commit

#

it is an "error" from the point of view of the PR submission checks, so it's something for the submitter to fix, like a compilation error.

alpine holly
#

(p.s. "code.circuitpython.org" already has the feature you are talking about. You just select "micropython" instead of "circuitpython", and the extra buttons show up in the UI. All you need to do is give circuitpython users an option skip selecting a folder, and then show those buttons, and it's ready... except for the broken RTS/DTR issue on some boards of course)

tulip sleet
alpine holly
#

LOL - SORRY - I got "Mu" mixed up with that (too many new tools in one day!!). ping me if you need help - I've re-written ampy, mpremote, and pyboard for those things (and made ampy compatible with circuitpython today) as well as written my own emulator too... I've got a fair whack of experience with the ugly mess that is serial management of these boards. They're horribly dumb, and time-out when anything unexpected or unusual happens... and I fixed all of that.

#

Do you happen to knw what "C" lint or formatter is being used? It's blocking my PR inside a .h file, and the messages don't give me any clue as to what program they used to do that.

#

The "check-your-code" link only mentions python and "black" - but "black" simply exits with no message (so I assume it's happy?)

tulip sleet
#

micropython uses uncrustify, and since we are downstream, we adopted their conventions

#

they are switching to ruff for Python code; we will probably go that direction eventually

tulip sleet
alpine holly
#

Yes, I submitted PRs for mpremote, ampy, pyboard, and python itself.

#

Unrelated - I really don't want to mess this up: I've got uncrustify working and "fixed" (ruined the readability by erasing the indent... but that's another story...) my header file. What are the steps to fix the PR? Do I do another "git add" and "git commit" and finally a push? I'm guessing it's more complicated - do I need to withdraw the PR first, or something ?

tulip sleet
#

it's fine to have multiple serial commits to a PR. That's part of the point.

#

a PR doesn't have to be perfect when it's first submitted

#

by the way, the indentation change is because you were using tabs for indentation. Since there are multiple standards for how many spaces a tab is, we use spaces.

alpine holly
#

All checks have passed - thanks HEAPS @tulip sleet holding my hand through that jungle was a HUGE help.

#

I've got a stack of about 10 new ESP32 boards here (mostly different sized displays, but a couple of camera boards too, plus some bare chips inside programming holders)... I'd like to get a production-line going, so I can push out support for all these things. LVGL is too bloaty, and I've already got them working in micropython (which has some weird complex-number bugs)... sorting out that lint nightmare has totally made my day!

manic glacierBOT
#

This may already be clear but since you said this was your first board, I just wanted to be sure... The silkscreen does show the actual GPIO names IO14, etc so a programmer can access them by those names using microcontroller.pin, although most CircuitPython users will be looking for the silk screen name in board.xxxx (board.IO14). In order to support that you would need to add a second line for each of the silk screened pins with both the logical name and the silk screened name.

    ...
alpine holly
#

I'm reluctant to introduce a whole pile of non-standard non-portable aliases simply to drop the leading "G" off everything... while I can see where you're going with that, I would very much prefer NOT to encourage that kind of thing. I'm working currently on the ESP32-WROVER-DEV board which (minus the SD card) is almost identical. Code written for either will run fine, unchanged, on the other... so long as people don't use silly pin names. The latter drops the "IO" prefix on its silkscreen, which will add a whole extra level of extreme confusion if I go down this route ... { MP_ROM_QSTR(MP_QSTR_16), MP_ROM_PTR(&pin_GPIO16) will resolve to an int instead of a string in those cases...

#

That said - I'm happy to keep you happy. This is my first time doing this stuff.

manic glacierBOT
#

... The silkscreen does show the actual GPIO names IO14, etc

I'm reluctant to introduce a whole pile of non-standard non-portable aliases simply to drop the leading "G" off everything (and waste memory and add confusion)... while I can see where circuitpython is going with that, I would very much prefer NOT to encourage that kind of thing. I'm working currently on the ESP32-WROVER-DEV board which (minus the SD card) is almost identical. Code written for either will run fine, unchanged...

tulip sleet
alpine holly
#

Excellent reference - that suggests that my hunch is what they want: "Try to make the names correspond closely enough to the board silkscreen that it is self-evident which pins correspond to which silkscreen markings. It's fine to expand abbreviations, such as LED for L. You don't have to match the silkscreen exactly, since the silkscreen names are often constrained by the space available." ... I think "GPIO16" is exactly what "it's fine to expand abbreviations" is talking about (since it';s clear the silkscreen simply left off the "G" because there's no room to fit that there) https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython/pin-and-device-names

Adafruit Learning System

Add your new CircuitPython compatible board to CircuitPython!

wraith crow
#

I'm just sharing some pin naming hurdles I've encountered, don't worry about making me happy 😁 It seems like you've considered the issues. Just one more thought, I believe a lot of the ESP32 boards do use the IOxx pin naming standard (I'm not home to confirm that right now) so porting code between this board and other ESP32 boards may be impacted by your naming choice

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.4 on 2024-04-16; Challenger RP2040 LTE with rp2040

Code/REPL

import board
from i2ctarget import I2CTarget

import adafruit_logging as logging
from logging import NamedStreamHandler


# https://www.i2c-bus.org/repeated-start-condition/
# https://learn.adafruit.com/working-with-i2c-devices/repeated-start#whats-the-issue-3111703
def emulate_mma8451():
    logger = logging.getLogger('i2ctarget')
    lo...
#

This adds support for the ESP32-WROVER-DEV boards (alternatively named ESP32-WROVER-CAM by other manufacturers)

Board Feature			Circuitpython Status
=============                   ====================
Take photos with camera		Tested + Working
Wifi				Tested + Working
Inbuilt RED LED                 Tested + Working
ESP32-CAM-MB Button		Tested + Working
Bluetooth			Not tested
Others				There are no other features I know of

Here is my working sample script which takes a ...

alpine holly
#

@wraith crow - yeah - you utterly nailed that one!!!

[cnd@cdc:~/.../ports/espressif/boards]$ grep -r -l -P 'MP_QSTR_IO\d' . | wc
110 110 3550
[cnd@cdc:~/.../ports/espressif/boards]$ grep -r -l -P 'MP_QSTR_GPIO\d' . | wc
4 4 114

#

I'll fix this tomorrow - it's 4am, I've been going for 20hrs nonstop and I'm getting vague...

alpine holly
#

nah.. did it now, before I forget, so it's in a state ready to be accepted if someone like it.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

The flashlight on the front is very bright, looking at the espressif esp32-eye board, maybe the following would set initial state of the flashlight off so it doesn't blind you :grin:

#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/gpio/include/driver/gpio.h"
#include "components/hal/include/hal/gpio_hal.h"
#include "common-hal/microcontroller/Pin.h"

void board_init(void) {
    reset_board();
}

bool espressif_board_res...
tulip sleet
#

I wrote that page

alpine holly
#

@tulip sleet (you wrote in a different channel) ...or remove OTA instead... There's (0x7000-17568) 11,104 spare bytes after the end of the bootloader on ESP32 right now. I would love to try my hand at at a new kind of OTA which facilitates updating a running system without needing any OTA partition by (a) first storing the new firmware inside the existing VFS or SD file system, (b) halting circuitpython and switching the a new OTA stub in the bootloader which (c) SWAPS the current firmware partition with the new new one (i.e. overwrites (a) from the old firmware as it writes to flash), (d) sets some flags in the new OTA stub, (e) reboots into a new "firstboot" stub which updates those flags and sets a watchdog timer then attempts to run the freshly flashed firmware, which itself will update those flags and disable the watchdog when the boot works, and (f) the watchdog OTA stub which (if called) loops back to (b) in order to replace the new broken firmware with the original working one. new firmware can be stored inside the VFS (if the user makes enough space for it) or on an SD card (potentially allowing many other ones to exist at the same time - featurecreep - grub-like UI to let people pick...). In very-low-VFS-space-situations, some kind of web-helper to temporarily "move" VFS things to some cloud the the update, then replace them upon workingness might be nice. it might even be possible to code a standalone VFS binary that's far smaller than the existing circuitpython firmware which would be callable form the OTA and be able to connect wifi or ble and manage the firmware update using the same process, but using "cloud" (or some BLE or phone app) instead of VFS for holding the actual image ... so many cool possibilities. I got a long way down this planning path and started on experiments in micropython back in January (before mpy' instability made me realize that's unsuitable for my production use...)

#

hmm. the same idea would facilitate an "undo" option that does not use up any extra time for users when they're flashing locally as well (like over serial or from the web flashing UI in chrome etc).

manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.1.0-beta.1-18-g781c577745-dirty on 2024-05-10; M5Stack AtomS3 with ESP32S3

Code/REPL

import board
import pulseio
import adafruit_irremote

pulsein = pulseio.PulseIn(board.D1, maxlen=1020, idle_state=True)
decoder = adafruit_irremote.GenericDecode()

while True:
    pulses = decoder.read_pulses(pulsein,max_pulse=91000)
    print(len(pulses))

Behavior

prints "128"

Description

It is possi...

manic glacierBOT
#

Hi all! Not sure what the current status of progress is on this, but for a set of boards I'm working on, we've needed to get SPI communication between two SAM D51 boards running CircuitPython.* Our code is a bit of a mess right now since it's just for our internal project, but (admittedly not having looked through the commits mentioned here) it might be helpful developing this feature, if there's anyone else still interested in getting it running. Namely, I've noticed some talk in the issue l...

manic glacierBOT
manic glacierBOT
#

CircuitPython version

main

Code/REPL

n/a

Behavior

As reported by multiple users, with the power-on default tx_power, the board does not successfully connect to wifi (https://github.com/adafruit/circuitpython/issues/6540 https://github.com/adafruit/circuitpython/issues/9058#issuecomment-2104612719 and probably others) but does work if boot.py executes wifi.radio.tx_power=8.5.

Description

No response

Additional information

The board...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

The usb.core.Device.read() also blocks on RP2040 PIO USB host too.

Here's an example that should print out "doing UI things" every 0.1 seconds but blocks on read().

import time
import board
import usb.core
import usb_host
import adafruit_usb_host_midi

usb_host.Port(board.MOSI, board.MISO)  # GP3,4 on QTPy RP2040; GP16,17 on RP2040 USB Host Feather

print("Looking for midi device")
raw_midi = None
while raw_midi is None:
    for device in usb.core.find(find_all=Tru...
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.1.0-beta.1-18-g781c577745 on 2024-05-05; Adafruit QT Py RP2040 with rp2040

Code/REPL

import time
time.sleep(0.1) # Wait for USB to become ready

print("Hello, Pi Pico!")

print("0.004 = ", 0.004)
print("1000 = ", 1000)
print("0.004 * 1000 = ", 0.004 * 1000)
print("int(0.004 * 1000) = ", int(0.004 * 1000))
print('"%f" % (0.004 * 1000) = ', "%f" % (0.004 * 1000))

Behavior

Prints out a "3" inst...

manic glacierBOT
alpine holly
austere acorn
manic glacierBOT
#

Remove that last two bits for what CircuitPython has. As I mentioned in discord, the CircuitPython default for objects is OBJ_REPR_C. MicroPython defaults to OBJ_REPR_A. See https://github.com/adafruit/circuitpython/blob/d8ca8421a09b1e5fee8fd29213c3ccc7914f5d8c/py/mpconfig.h#L105-L107
and following.

See also #5802, #1220, #566, #230, and the MicroPython issues those issues reference.

This is always going to be a problem with floats. It's worse the fewer bits of precision you have. Micr...

manic glacierBOT
alpine holly
#

board-porting question: How do the LCD drivers get into the firmware? I purchased one-each of every one of these eps32 LCD boards ( https://www.aliexpress.com/store/1100192306 )... 11 in total. They mostly use different LCD drivers ( EK9716, GC9A01, ILI9341, ILI9341V, ILI9485, ILI9485, ILI9488, St7262, ST7735S-G6, ST7789, ST7796 ) There's 3 already board ports for these done (sunton_esp32_2424S012 sunton_esp32_8048S070 sunton_esp32_2432S028) which have EK9716, GC9A01, or ILI9341 LCD drivers in them. Looking at boards/sunton_esp32_2432S028/* reveals no mention at all of the driver (besides a comment) and it implements only display_init() - yet somehow the compiled firmware works fine (show shows the REPL on the screen at boot), and I can draw circles etc using board.DISPLAY ... how did the plumbing work that out ??? I firstly want to fix the ridiculously slow scrolling ( ILI9341 has hardware assist for this, which is clearly not being used), and then build a port for all those other boards.

stuck elbow
alpine holly
#

interesting! So the SPI commands to set pixels, clear screen, scroll, etc etc are identical, regardless of which LCD you're using ? Seems slightly implausible?

#

I notice my ILI9341 (320x240) scrolls crazy-slow, but my EK9716 (800x480) is really fast, and I notice the latter scrolls sideways even faster... suggesting there's some hardware support for scroll in only one of those drivers ?

#

(by "scroll" - I mean how the REPL shows up when I boot and upload files etc over serial)

manic glacierBOT
#

More info about these cool "Cheap Yellow Display" aka CYD boards here: https://www.aliexpress.com/item/1005005865107357.html

I've tested wifi, serial, the 3-color LED, display, display backlight - all good.

Has ambient light detection, speaker, SD card, buttons, ports, and what looks like power/battery related circuitry - still need checking.

There's 2 models of this - capacitive touch (the one I've got) and restive. touch still needs testing, and so does the "power off" of the scree...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.4 on 2024-04-16; Adafruit CLUE nRF52840 Express with nRF52840

Code/REPL

### displayio or bitmaptools bug with missing pixels
### perhaps related to dirty region code for efficient screen updates?

### Demonstrated on Adafruit CLUE with 9.0.3 and 9.0.4

import array
import time

import board

import displayio
import bitmaptools


p1 = [(170, 120), (168, 105), (160, 91), (149, 80), (135, 72), (120...
midnight ember
# alpine holly interesting! So the SPI commands to set pixels, clear screen, scroll, etc etc a...

Some drivers do not read/write registers to tie into any hardware acceleration the driver chip might have. This does vary display to display. The init sequences for displays are the basic data commands for writing to the display. The init sequences are different for each display but yes the way displayio uses them remains consistent across displays that use displayio. That's one of the advantages of displayio is consistency across displays. Some drivers are more refined than others so you might see different performance depending on the driver setup. There are tons of features a display might have that are never tapped into. Compatibility with displayio is prioritized over fine tuned performance per display. Even if hardware acceleration is available on a display driver chip doesn't necessarily mean it's being used. Someone can correct me if I'm wrong but this is my current understanding of displayio init sequences vs driver libraries that require register read/write.

short tendon
#

@tulip sleet with the ConnectionManager updates, we lost the Error connecting socket: error 2, first error: error 1. Are we okay with that? I haven't seen a case where the two are different, but I can imagine the case where it's a MemoryError the first time and then a different one the second...

tulip sleet
#

rather than put it in the exception, I think adding some logging at some point would be more helpful when debugging a problem. e.g. "This succeeded; this succeeded; this failed."

short tendon
manic glacierBOT
short tendon
manic glacierBOT
manic glacierBOT
#

Unfortunately, adding a try/except for usb.core.USBTimeoutError doesn't work. I've modified adafruit_usb_host_midi to accept a timeout in its constructor that it passes to usb.core.Device.read(), and the USBTimeoutError is thrown once then a USBError is thrown.

Full gist here: https://gist.github.com/todbot/07a2ef16ec9ee83eb8980f8a128d660b
Tested on a Feather TFT ESP32-S2 with MAX3421E FeatherWing.

lone sandalBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I'm curious if anyone has ideas on a name for this idea?

I started working on this utility over the weekend, I am in the very beginning stages so far.

I am envisioning it supporting these commands:

  • ls: list files and directories on the device optionally filter by the given directory or partial filepath
  • rm: delete files and directories (with -r) on the device
  • get: download files and directories from the device to the local computer
  • put: upload files from the loc...
slender iron
#

<@&356864093652516868> Reminder: Our community meeting is in 7 minutes or so. Please get any notes in you'd like me to read. Talk to you soon!

midnight ember
#

Will there be a live stream or recording?

onyx hinge
#

@midnight ember pycon talks are posted later in the year, at least have been in past years

lone axle
turbid radish
#

,998 readers, I need 2 more for 11k

#

10,998

manic glacierBOT
midnight ember
#

uh oh no mic 😦

#

The struggle with pylint typing is real.

#

S2 can make multiple SSL connections now?

#

🙌

lone axle
#

This file is part of the CircuitPython project, http://circuitpython.org/ Sees like a good line to me, I can't think of anything to change with that.

#

Reuse (which is run by pre-commit for us) validates those SPDX headers for us on library repos.

onyx hinge
#
>>> math.acos(2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: math domain error
```value error: 2 is not within the set of proper arguments for acos

```py
>>> math.abcdef
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'math' has no attribute 'abcdef'
```attribute error: there's no attribute (property) on the object with this name
midnight ember
#

Thank you for hosting @slender iron Have a wonderful week everyone!

gilded cradle
#

Thanks

onyx hinge
#

👋

short tendon
#

Thanks!

lone axle
#

Thanks for hosting Scott. Have a great week everyone 👋

slender iron
midnight ember
#

No... I thought a display of that size would require a bigger driver chip? 🤦

slender iron
#

I don't think so. The ESP32-S3 should be able to do it directly via dotclock iirc

midnight ember
#

I would need to figure out the 40-pin connector directly to an MCU. With 100 pins wouldn't even know where to begin. Only reason I'm taking this approach is Lady Ada's RA8875 is a proven design.

midnight ember
#

I do like the idea of having the hardware accelerator for some uses too. It really is like 100x faster at drawing rectangles with the hardware accelerator.

slender iron
#

I believe that

midnight ember
#

Ahh, thank you will look into that!

#

I believe the qualia boards 40-pin isn't compatible with the 7" display. I would still have to wire it from scratch or make a qualia-like board specifically for the 7" display.

#

They're both 40 pin but in different orders.

#

in the ra8875 product page There are other 40-pin displays that have different pinouts or backlight management and these may not work - they may even damage the driver or TFT if the boost converter pushes 24V into the display logic pins! For that reason, we only recommend the displays we've tested and sell here.

slender iron
#

👍 It is good to check the pinout

onyx hinge
#

yeah that particular combo doesn't seem to be compatible

midnight ember
#

yup that's where i'm going to right now to pull up a side by side schematic.

onyx hinge
#

the great thing about standards 😕

midnight ember
#

can you post up next weeks notes doc so i can go ahead and give you an early hug report for your advice? 🤗

tulip sleet
slender iron
#

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/19GmXK8VzVgchFclJTfG4C6ejqNsg9emYgCgpcv1PVZ4/edit?usp=sharing

midnight ember
#

yeah the dotclock qualia 40 pin is definitely different from the ra8875 40 pin. the 24V backlite pinouts are the same so it won't toast it with 24v thankfully but enough pins are different so that all communication would be broken. incompatible. will have to decide which route to take. i'll stick with the ra8875 for the hardware accelerators.

#

i've drawn a full 800x480 bmp on the display without hardware accelerators and it takes about 3 mins to draw. even though the s3 can dotclock it directly a display of that size would still be too slow for any appreciable use with displayio.

#

For a weather display that only updates every 15 minutes it's doable so it really depends on the usage. Because I only need slow redraws it's very tempting and I will likely design another PCB in the future to try it out.

midnight ember
manic glacierBOT
#

The build in #9240 may be helpful for further diagnosis. I tried to mark each site in the source that might be throwing the USBError exception with a different string. so, what string is shown with the 2nd exception that "should have been" USBTimeoutError?

Thanks. I tried it the artifact from PR #9240 and the result is usb.core.USBError: tuh_edpt_xfer() failed after one usb.core.USBTimeoutError.

short tendon
#

@tulip sleet what are your thoughts on this idea:

adding an empty class CPythonRadio: to connection manager, and then when passed in as a radio to get_radio_socketpool and get_radio_ssl_context it would return the native socket and ssl.create_default_context(), allowing connection manager to be used in CPython?

tulip sleet
manic glacierBOT
#

Generally I like the model of allocating the large chunk of memory outside of the object. That way you can reuse it in a different object if you really want to.

In the Python API, I would expose the indices though. Instead, make an iterator available to get the next value. Take a look at PulseIn for an example.

I'd also suggest adding this to a new module so we don't need to include it everywhere analogbufio is.

#

Wow, that's a huge change. Thank you for keeping this alive, and the (obviously huge) effort to make ESP32 boards have full BLE capability in CircuitPython! I know it's not ready yet, but it's not too early to say "THANK YOU!"

:-) Feel free to test it out. It isn't perfect but testing would be helpful. Note, it doesn't have bonding and pairing support so HID may not fully work with another device.

manic glacierBOT
#

Its been a little while since I wrote this code. I think my intent was to limit the maxlen to the amount the RMT peripheral can buffer. I didn't want to assume PSRAM was accessible when PulseIn was running. (Writing the filesystem will disable it temporarily.)

I think some RMTs can use multiple channels worth of memory if needed. That could improve things.

Note each RMT word stores two "pulses" one active and one inactive. That's why 64 words give a length of 128.

slender iron
#

@tulip sleet do you want to take a stab at the asyncio microdot server stuff? I might be able to fix it

#

(if not)

#

I've been poking asyncio more with cpython

tulip sleet
#

if you'd like, sure. I don't know if there's something missing internally that it needs (stream support or something), but the naming stuff seems pretty easy to fix

#

i am working on redoing headers and include guards at this very moment

slender iron
#

I can take a stab at it tomorrow when I'm off and on

manic glacierBOT
#

I think we'll need @hathach to look into this because we try to abort the pending transfer when we reach the timeout: https://github.com/adafruit/circuitpython/blob/ca2a24e8d0f4dcc1b9e5fa28e029bf2ffad19dbc/shared-module/usb/core/Device.c#L201-L204

This should allow the subsequent call to work ok. It may be weird because our transaction is being NAKed by the device each SOF.

The USBTimeoutError is pyusb behavior it does here:
https://github.com/pyusb/pyusb/blob/4a433a5fddd6dcbc632454d53...

slender iron
short tendon
#

I can work on that this week

manic glacierBOT
#

Do you know if they made it?
None of my boards say "Freenove" on them, except one that came with a robot dog I bought - the brand of which is Freenove. As far as I can tell, this is an espressif reference design, manufactured by a bunch of different places?
I've written to Freenove to ask them if they designed this or not - better to get the attribution correct than guess :-)

tiny peak
#

@slender iron remember how you made a comment during one of your recent Deep Dive streams about a patch-panel MIDI controller? I liked that idea and started planning some stuff out last week. Ordered some parts. Got some of them. Still waiting on others. Might need to order more. In the mean time, I've been planning out the software. Been taking some notes on github (patch-thing repo). If it goes well, I'll probably write up a guide on the new Playgrounds thing. Also possible I might be able to generalize some of it into a patch-panel module.

midnight ember
#

That sounds neat, I'd read that.

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.1.0-beta.1 on 2024-04-19; Adafruit Camera with ESP32S3

Code/REPL

import io
import os
import board
import espcamera
import wifi
import adafruit_requests
import adafruit_connection_manager
from adafruit_io.adafruit_io import IO_HTTP, AdafruitIO_RequestError

if input('Create espcmera object? (Y/N): ').upper() == 'Y':
    cam = espcamera.Camera(
        data_pins=board.CAMERA_DATA,
        external_clo...
small comet
manic glacierBOT
manic glacierBOT
#

CircuitPython version

# all since PR #9140

Code/REPL

while display.time_to_refresh() > 0:
  time.sleep(display.time_to_refresh())

Behavior

endless loop

Description

In many of my programs I have the above conservative code snippet. Since PR #9140 this results in an endless loop, since the "fix" will always add 0.1.

When I change my code to

if display.time_to_refresh() > 0:
  time.sleep(display.time_to_refresh())

I don't ha...

#

I would really like to see rsync (based on put and ls) as an additional command. This command should upload all files changed locally and (like the --delete option of rsync) remove files on the device that have been deleted locally. You could name it like you like, e.g. mirror, but the rshell-utility has this rsync command as well.

Regarding the name of the utility: I like wwshell as proposed by @dhalbert, since this puts the utility in the tradition of tools like rshell.

manic glacierBOT
onyx hinge
manic glacierBOT
manic glacierBOT
#

The switch must be in the boards/[board_name]/mpconfigport.mk file because:

  1. Some boards are already equipped with a custom display (such as adafruit_feather_esp32s2_tft) without EVE chip, so user may not need _eve module there (Because _eve module only works with an EVE chip).
  2. Some boards fail to compile when the _eve module is enabled (Build CI jobs) due to an error: Too little flash (Such as [adafruit_feather_esp3...
manic glacierBOT
slender iron
slender iron
#

I was thinking the 1/8th inch cables would carry uart signals that carry an id number

#

so it can work across "modules" and be plugged one to many as well

manic glacierBOT
#

@tannewt how do you feel about this addition?

I'm happy to see eve enabled on espressif.

I agree with you that the enabling should be refactored into mpconfigport. The other thing to consider is whether it is on by default for future boards.

  1. Some boards are already equipped with a custom display (such as adafruit_feather_esp32s2_tft) without EVE chip, so user may not need _eve module there (Because _eve modul...
manic glacierBOT
#

Ok ... Per your PR comments, seems only ESP32-S3 is likely to work yet?

A couple of questions:

  1. I searched both your source branch's Actions and the PR #9222 actions, but neither one appears to have proceeded to build. Where would be the place to pull build artifacts for ... (pulls out shelved project) ... an ESP32-S3 Reverse TFT board?

  2. Should issues be filed at https://github.com/tannewt/circuitpython/issues instead of https://github.c...

devout jolt
#

I have sort of a general Python question. (this in the context of PyUSB compatibilty that usb.core is doing that @slender iron & @onyx hinge were talking about in issue #9226): Are exceptions not "expensive" in Python? Are they more just an alternative return value?
My previous experience with exceptions in other languages is they're pretty expensive (blow stack frames, kill pipelining, etc) and meant to be used for substantive errors and not for expected logic flow. But in the underlying use case needed to make #9226 work, a try/except block will be in the core read() loop because most of the time usb.core.Device will be throwing timeout exceptions

tulip sleet
stuck elbow
#

setting up a try block costs a bit

devout jolt
#

okay so it sounds like (Circuit)Python exceptions are not the 100x as expensive as return values like in C++ & Java

tulip sleet
#

I would say not

stuck elbow
#

return values are practically free, especially if the function is inlined

#

what costs is the if branch that checks for the error

tulip sleet
#

i would say try a simple test of doing something simple that raises an exception over and over vs jsut returns. Check the timing and check the storage consumption with gc. Are you saying you are going to busy-wait on this with no delay?

#

The point of using the exception is to mimic pyusb, which I am not really familiar with.

devout jolt
stuck elbow
#

catching an exception involves checking its inheritance chain to see if it qualifies for the given except block, so if you have a lot of nested try-except blocks, things can get expensive

devout jolt
#

(and we usually want to use a timeout on the read so we can do otherthings with our code like read buttons, update display, etc)

tulip sleet
#

so are you going to busy-wait on that?

devout jolt
tulip sleet
#

then if you are going to call read() say 10-100 times second, maybe it's not an issue

#

I agree that maybe pyusb's choice is not the greatest

devout jolt
#

This seems to be not an issue as much in PyUSB for whatever reason. I cannot find many examples that do reads-with-timeout to compare against

tulip sleet
#

are you seeing a problem now, or is this a hypothetical?

#

right now the problem is the bug

devout jolt
#

it's a problem in that in #9226, the underlying max3421e driver appears to not implement read-with-timeout and the underlying TinyUSB call crashes. The PIO-USB host driver on RP2040 works as expected and throws the timeout exception. And that got me wondering if I'll be loading up another footgun and killing performance by doing read(timeout=0.001) like I do with UARTs, because I've been trained by decades of C++ & Java that exceptions are very expensive

tulip sleet
# devout jolt it's a problem in that in #9226, the underlying `max3421e` driver appears to not...

I think the way to confirm or allay your fears is to do measurement. We don't think of exceptions as very expensive, and we don't go out of our way not to raise them. There is some philosophy about exceptions in Python: "easier to ask forgiveness than permission" https://stackoverflow.com/a/66792207/142996.
But using exceptions to substitute for normal return values is not great API design. I once designed an API like that when I first started using C++, and it was a mistake.

devout jolt
devout jolt
tulip sleet
manic glacierBOT
#

Originally, the only (non-debug) way to make an LFO calculate its value was to associate it with a playing synthesizer.

This posed a problem for LFOs that had "power on values" other than 0, and where the value was used other than to internally drive a note property.

Now, an initial, possibly non-zero value is calculated at object construction time:

>>> l = synthio.LFO(offset = 1)
>>> l.value
1.0

Note that this happens just once at construction; it does not happen wh...

slender iron
#

@tulip sleet new header looks good to me too. I'd just double check that reuse is ok with it

manic glacierBOT
#

Ok ... Per your PR comments, seems only ESP32-S3 is likely to work yet?

A couple of questions:

1. I searched both your source branch's Actions and the PR [Add ESP BLE GATT server support #9222](https://github.com/adafruit/circuitpython/pull/9222) actions, but neither one appears to have proceeded to build.   Where would be the place to pull build artifacts for ... (pulls out shelved project) ... an [ESP32-S3 Reverse TFT](https://www.adafruit.com/product/5691) board?

I'l...

tiny peak
# slender iron I was thinking the 1/8th inch cables would carry uart signals that carry an id n...

hmm... yeah, I've been wondering about how to deal with expansion to more patch points. The UART thing might work. Have you ever messed with 1-wire stuff? It might work to solder TO-92 or SOT-23 1-wire EEPROMs directly onto "output" jacks, and then use 1-wire scanning on "input" jacks (or vice versa). Seems like 1-wire EEPROMs are pretty cheap and relatively robust against ESD. Might save on a lot of soldering and GPIO pins. 1-wire parts have serials, the bus can handle multiple parts (e.g. piggyback cables or splitters), plus, the EEPROM would allow for custom tagging.

#

I'm not sure how it would work to do piggyback connections (n outputs to 1 input) with regular TTL async serial. To handle multiple patch points joined together, seems like you might need pullups with open-drain transceivers, plus some kind of protocol to handle contention and addressing? (e.g. 1-wire)

slender iron
#

I was thinking of using a cheap stm32 micro for output and input

#

then you'd read the input ids via i2c

#

and maybe set the output ids

tiny peak
#

so, one stm32 per jack?

#

for I2C, I guess you'd need to use stereo patch cables then?

slender iron
#

I was thinking "per module"

#

i2c would be the backplane via stemma connectors

#

the trs would be just gnd and uart

#

I may be getting ahead of myself 🙂

tiny peak
slender iron
#

yup

tiny peak
#

I could see that. might work.

slender iron
tiny peak
#

is that the thing you were talking about in relation to some kind of dynamic compilation of IO coprocessing tasks?

#

Can't remember how you phrased it, but I think you mentioned the StemmaG0 thing in relation to build system stuff

slender iron
#

ya, that's the hardware where a library would load the c binary onto it

#

the build system would theoretically make it easier to create those libraries

tiny peak
#

interesting. I'd been thinking of a small scale thing (<= 16 GPIO pins) where there would be maybe 8 outs, 8 ins, and you'd just raise one of the outs, scan the ins, then repeat that for each of the other outs.

#

It wouldn't expand well, but, you'd end up with a byte for each ouput, which would translate pretty nicely to sending as a MIDI CC value (sorta... only 7 bits to work with for MIDI CC)

#

For patch points, if you start getting into n:m mappings for n or m > 7, then it becomes potentially a lot more challenging to translate the graph of patch cables into something that can be represented as MIDI CC.

short tendon
#

@tulip sleet tell me if this is too much.

I love tests. I love coverage. Many of the CP libraries can't really be tested without a lot of mocking.

For something like MiniMQTT, we could have the tests spin up a mqtt server and test most methods for real. Is this something that would be interesting?

manic glacierBOT
#

Good call @tannewt ! They wrote back.

I'll convert this PR into a draft while I work fix all the ID codes and perform the re-naming of things.

Dear customer,

Thank you for choosing Freenove. We are fully responsible for any concerns.

The one with our logo on it is ours, which is the original design.
The ones without logo are counterfeit.

If you have any concerns, please feel free to contact us.

Have a great day!

Best regards,
Shaynee
Freenove Support Team
----...
manic glacierBOT
#

I noticed there are two small typos in the parameters for the _bleio.Adapter.start_advertising() method. In the Parameters list, two lines had the parameter name and data type values switched. The data type should be listed after :param and before the parameter's name.

The two parameters are currently listed as:

  • int (tx_power) – transmitter power while advertising in dBm
  • Address (directed_to) – peer to advertise directly to

The data type should be in the parentheses, not t...

manic glacierBOT
tulip sleet
midnight ember
#

@tulip sleet Tested ESP32-S2 Feather 4NR2 (no bme 280) with multiple sequential SSL connections successfully with the latest updates. Installed new 9.0.4 stable and 9.x bundle from today. Is there an open issue to confirm? I have one open for the S2 which can now be closed and I imagine a lot of S2 socket/SSL errors are now fixed. Very nice!

tulip sleet
#

I am glad this was a simple fix -- it wsn't something internal

midnight ember
#

I think there are many S2 bug reports that will now be cleaned up.

manic glacierBOT
midnight ember
#

Will leave it up to you or Scott to close. You've earned it. Well done. 👏

midnight ember
#

S2 is back on the menu.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@michalpokusa Thanks. Currently when you call create_default_context() it creates an SSL context with all the root certificates loaded, etc., which uses up a lot of RAM. It may be that loading the server cert info pushes things over the top. I did some work on refactoring that, but I'm not sure it's going to help. There are also some ESP-IDF LWIP settings that could be changed.

In CPython, create_default_context() takes an optional argument that describes whether the context is going t...

manic glacierBOT
#

@dhalbert Would it be possible to create a ssl context without loading the root certs? I understand it is necessary when we want to request website on public internet, but when creating a local server maybe it might be reasonable to use it with self-signed certs?

I may also be completely wrong about how this works, in that case please correct me.

manic glacierBOT
#

Would it be possible to create a ssl context without loading the root certs?

Exactly, that's what might help here, if create_default_context() took the right arg. See purpose in the CPython version: https://docs.python.org/3/library/ssl.html#ssl.create_default_context. In the HTTPS server example, your certs are self-signed, and you don't need the regular root certs for the client of the server to connect. Is that right? Or, you only need one root cert.

lone axle
#

Is it possible to customize the Bootloader section for devices on circuitpython.org page?

I've noticed some devices have different instructions for accessing bootloader (M5stack cardputer is press/release reset once, then press / release boot btn once. Double press reset does not work, and hold boot + press reset goes to ROM bootloader not UF2.). I'm pretty sure I've run across other devices like this before too, but don't recall which ones specifically.

I looked in https://raw.githubusercontent.com/adafruit/circuitpython-org/main/_board/m5stack_cardputer.md but the bootloader section content doesn't appear in here.

manic glacierBOT
#

This looks good to me, I've done some basic testing and everything seems to work fine. I'm actually using the latest artifact in a project that allows me to snap a photo of the charge state of my solar batteries using adafruit.io. That allows me to turn on/off the inverter when I'm away from home depending on the charge state. I first tried using the Memento but ran into an issue so it was fortunate that this PR was in place :grin:

tulip sleet
# lone axle Is it possible to customize the Bootloader section for devices on circuitpython....

it's configurable by port right now (that's all mushed into the bootloader text file now), but I don't know that we've done it by board. There could be an include or something that came from the board directory. Sounds like an issue for the circuitpython-org repo.

This gets into how much doc to provide and where for third-party boards where the mfr is not doing support for CIrcuitPython.

lone axle
#

I do agree it's tricky for 3rd party devices that don't use the defaults. I think it'd be great to at least have a mechanism that is a boolean "uses default bootloader behavior" flag that can be switched to false for ones that don't follow the norm so that the page at least won't contain incorrect instructions.

But having a way to for people to submit PRs that change or include updates to the text on a per board basis would be best IMO, then anyone who notices can submit a change with the correct info for that device.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Hi @hathach, thanks for the patch! It fixes the issue so now max3421e USB host mode behaves the same as usb_host.Port PIO USB host mode on RP2040.

To test, I make a local build of CircuitPython for adafruit_feather_esp32s2_tft incorporating this update to tinyusb and @jepler's labeled USBErrors. My test code now times out in the same manner as similar code using usb_host and does not error out.

I guess when CircuitPython updates TinyUSB next, this issue can be closed.

slender iron
manic glacierBOT
slender iron
#

@devout jolt want to make a PR to update tinyusb?

manic glacierBOT
tiny peak
# slender iron I didn't think so far as MIDI CC. I was mostly thinking synthio

yeah, if you wanted to do all the synthesis in CircuitPython, handling more patch points would probably be easier compared to MIDI CC. That, or perhaps using a network stack to send OSC messages. For me, the interesting thing would be to have a USB MIDI controller that lets me play with Faust or SuperCollider patches in a way that's more tactile.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 9.1.0-beta.2
slender iron
orchid basinBOT
tiny peak
# slender iron Do they have an API for setting patch connections?

SuperCollider lets you write arbitrary code to implement event handlers for incoming CC messages. Faust is more about functional DSP data flows, so it lets you attach CC control channels to numeric UI elements (e.g. hslider), which you can then use in functional declarations to do whatever you want (subject to your ability to articulate what that is in functional style)

#

In my limited experience so far, playing with CC controls in Pd, Faust, and SuperCollider, implementing patchboard style functionality is not easy. The limiting factor for me is keeping straight in my head what's going on. For small numbers of controls, CC is convenient. But, particularly with Pd's graphical box and wire data flow stuff, things get really complex, really fast, as you start trying to scale up the number of controls.

slender iron
#

I believe it!

#

My brain was thinking only about virtual eurorack sims where you could make physical equivalents of the front panel for hopefully less money than the original

#

back in a bit, going for a short walk

slender iron
#

(back)

tiny peak
# slender iron (back)

I think I'm gonna detour for a bit to try a breadboard prototype of a MIDI CC to synth patch thing

slender iron
tiny peak
#

I've got a Feather M4 on hand. If I leave A0-A5, SCL, SDA, and 13 free, that gives me 6 pins on each side for making a tiny little breadboard and DuPont wire patch panel. I want to see if I can get something useful happening with a 6:6 routing matrix on the Feather talking MIDI CC to Pd or Faust.

midnight ember
#

@short tendon I upgraded my main project (feather weather) with 9.0.4 stable and uses minimqtt. Everything working fine so far. I do have a lot of error handling so I think that issue report is just a matter of the person not having error handlers. In an ideal world error handlers shouldn't be necessary because they're beyond the ability of beginners. That would be a nice goal to set. I would love to be able to rip out all error handling from my script and just have it work.

#

I can get it to manually republish by switching pages then back to the home screen. Confirmed it's publishing to AdafruitIO broker.

short tendon
midnight ember
#

Yeah, just wanted to let you know there's no problems that cropped up with a known good working minimqtt script updating to 9.0.4 and latest connection manager.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I've a similar problem.

We are using a i2S Adafruit microphone to acquire sound for a Raspi4B. We use arecord sentences according to the following link https://learn.adafruit.com/adafruit-i2s ... iring-test

We acquire audio signal every 3 seconds for instance, that is saves as a wavfile. The popping/clicking audio happens every start of the signal and sometimes also at the end.

I found some clues related with PWM of Raspi https://www.lightbluetouchpaper.org/201 ... pberry-pi/

Ther...

manic glacierBOT
tiny peak
#

The code is a bit involved because I switch back and forth from everything pulled low (drain stray charge) to most the pins in high-z (avoid unintentional resistor networks making voltage dividers). I've got it wired up with 10k resistors on all the ins and outs as a cheap and dirty attempt of ESD and short protection. I think with the resistance that high, perhaps the capacitance of the DuPont wires and breadboard actually matter? Anyhow, the current code seems to work pretty well for mapping connections without glitching. Touching one end of the DuPont wire seems okay. Hooking up more than one input to the same output seems okay.

#

The Faust DSP patch doesn't do much other than just displaying the incoming CC values and using them to adjust the volume of some pink noise

#

...but, I think this breadboard circuit and code.py should be enough to enable some experimentation with better software synth patches that might hopefully kind-sorta resemble a modular synth setup.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Looks like jepler did test a WIZnet dev board (Pico + WIZnet):
https://github.com/adafruit/circuitpython/pull/8954#issuecomment-2077545160
So I suspect the issue is the extra memory on a Pico W taken up for wifi-related code. But I'll do some variations and add to this comment later. At the moment I'd say ESP32-S3 + WIZnet is the best combination... it can run native wifi + multiple WIZnet interfaces and multiple ESP32SPI (Airlift) interfaces simultaneously.

slender iron
manic glacierBOT
orchid basinBOT
#

Bumps rexml from 3.2.5 to 3.2.8.

Release notes
Sourced from rexml's releases.

REXML 3.2.8 - 2024-05-16
Fixes

Suppressed a warning

REXML 3.2.7 - 2024-05-16
Improvements

Improve parse performance by using StringScanner.

GH-106

GH-107

GH-108

GH-109

GH-112

GH-113

GH-114

GH-115

GH-116

GH-117

GH-118

GH-119

GH-121

Patch by NAITOH Jun.

Improved parse performance when an attribute has many <s.

GH-124

Fixes

XPath: Fixed a b...

slender iron
#

@devout jolt are you looking into the timeout issue?

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.1.0-beta.2 on 2024-05-15; LILYGO T-DECK with ESP32S3
Adafruit CircuitPython 9.0.4 on 2024-04-16; LILYGO T-DECK with ESP32S3
Adafruit CircuitPython 9.1.0-beta.2 on 2024-05-15; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3

Code/REPL

import board
from adafruit_bus_device.i2c_device import I2CDevice

# Featherwing TFT
import adafruit_ili9341
import fourwire
import displayio
spi = board.SPI()
c...
tulip sleet
#

@slender iron how are you running an older vesion of uncrustify on Arch? Did you build it yourself? The ubuntu 24.04 version is too new (lots of config file changes). pybricks repo has no builds for 24.04.

#

I see there is an older version in an Arch archive. I may just build it myself. And will contact the pybricks maintainer.

manic glacierBOT
#

What happens with shorter timeouts?
Any timeout less than 100ms results in a 100ms timeout.
Does it work correctly on RP2-PIO USB host? The timeout code is the same (but background tasks or timekeeping could be messing us up.)

Ignore my reported 100ms timeout error. The error was in the todbot (me), not the code.

Both the RP2 PIO USB Host (usb_host.Port) and the MAX3421E USB Host (max3421e) now heed a timeout in usb.core.Device.read(). Yay! With this and adding t...

slender iron
tulip sleet
#

for now I will just build it, I guess

plucky tulip
#

Does circup support installing .py versions of libraries? I cannot find anything about it.

slender iron
#

it definitely does

plucky tulip
# slender iron I think it is `--py`

Oh my god, you are right, I didnt see the option under circup --help, but it is present under circupt install --help. I'm sorry, it's 1am where I am at. Maybe enough for today...

#

Thanks👍

orchid basinBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.4 on 2024-04-16; LILYGO T-DECK with ESP32S3

Code/REPL

# Playgif 

import sys
import supervisor
import board
import gifio
import bitmaptools
import displayio
import time

if 'DISPLAY' in dir(board):
    display = board.DISPLAY
else:
    try:
        import framebufferio
        import dotclockframebuffer
    except:
        import adafruit_ili9341

    displayio.release_displays()

    if ...
manic glacierBOT
manic glacierBOT
manic glacierBOT
short tendon
#

@tulip sleet do you have a rough idea on when CP 9.1.0 will release? I wanted to try to get the AttributeError/ValueError fixes in requests before it does so it would be frozen in

tulip sleet
manic glacierBOT
#

The "Explorer Badge" is an RP2040 based CircuitPython board with integrated features to provide an all-in-one learning device.

The board includes:

  • 1.54" ePaper display
  • neopixels
  • touch sensors
  • accelerometer
  • IR (receiver and emitter)
  • I2C STEMMA-QT
  • sound (both PWM and I2S support)

There is also a tutorial series associated with the Explore Badge to get users started with Python and then CircuitPython with the integrated hardware. The badge has been tested with the re...

manic glacierBOT
#

I think the CircuitPython core elements are in place for this, though it may need some changes in the ESP32SPI-related libraries. The native ssl module is only installed on certain boards though.

Tested config:

  • UnexpectedMaker FeatherS3 Adafruit CircuitPython 9.1.0-beta.2 on 2024-05-15; FeatherS3 with ESP32S3
  • Adafruit Airlift FeatherWing (NINA v1.7.1)

This code simulates an HTTPS Request over ESP3...

#

Tried a version where all the async functions except async_monitor_fault & async_monitor_current had their while(True) loops flipped to False so they'd exit and still saw crashes fairly quick. So I removed them and this version of the code takes 4-5 days to crash:

import time
import board
import busio
import supervisor
from digitalio import DigitalInOut, Direction, Pull
from pwmio import PWMOut
from adafruit_motor import motor as Motor

import gc
import rtc
import di...
empty salmon
#

@slender iron - I committed the change. Do I need to resubmit the PR?

slender iron
#

nope, if you commit through the UI then it'll update

#

PR's track the state of a branch

manic glacierBOT
#
  • Find files that are CircuitPython-specific and change their headers to say they are part of the the CircuitPython project, not the MicroPython project. This helps distinguish upstream files that we use vs. files of our own. This change was discussed with the MicroPython folks. The new language is This file is part of the CircuitPython project: https://circuitpython.org.
  • Change copyright and license lines to be SPDX-compliant. General format tested with reuse lint. There are still man...
manic glacierBOT
manic glacierBOT
slender iron
#

@tulip sleet want me to merge your change? it looks ok to me

manic glacierBOT
#

We'll likely need to do a subsequent pass as we merge in other PRs.

I will definitely do that.

Looks like we'd need fsfe/reuse-tool#512 fixed in order to run reuse over our files.

Yup, I first tested by copying files and LICENSES/* into a temp directory and specifying that as --root-dir. Later I did a little more testing (not of the whole tree at all) just by ignoring some of the errors.

tulip sleet
manic glacierBOT
#

Is this lib/tinyusb submodule change a regression? I thought it was bumped forward in another PR.

This bumps it further add definitions for the C2.

Just some other questions. I did not test. I will put the "this and that don't work" in the release notes. When this is merged, could you add issues addressing the ports that don't work? Thanks.

I'm not sure what you mean by this. I hope it all works but I expect folks to find issues.

manic glacierBOT
#

I don't have time to set this up and test it but just for background GIF_playFrame will return 1 for good more frames, 0 for good no more frames, or -1 for an error.

But quickly looking I'm not 100% sure the code will work exactly or you may get 0 at times.

Based on the fact you could re-save the GIF and that version works maybe a type of GIF the library does not handle and poor error handling in OnDiskGif (oops). Exposing GIF_Reset may also have some value in case of errors.

manic glacierBOT
manic glacierBOT
orchid basinBOT
orchid basinBOT
#

It might be worth adding and enforcing a rule about what the .md file is supposed to be called (and documenting that).

The following boards exist, but do not have .md files for them:-

  • adafruit_feather_rp2040_rfm
  • crcibernetica-ideaboard
  • devkit_xg24_brd2601b
  • explorerkit_xg24_brd2703a
  • flipperzero_wifi_dev
  • heiafr_picomo_v2
  • renode_cortex_m0plus
  • sparkfun_thingplus_matter_mgm240p_brd2704a
  • wemos_lolin32_lite

The following .md files do not have any corresponding circ...

orchid basinBOT
#

This section:-

board_id
This should be the name of the board for example "feather_m4_express".

probably needs expanding to explain what "board_id" means, and the purpose of this - as best I can tell, this is the name of the folder that the board firmware definition files live in ? and I think it's probably used as a name inside some website build process the generates the firmware binaries, so this line tells the website which firmware goes with the board, right?

alpine holly
alpine holly
#

Possibly not - the template we're told to copy from, "unknown.md", and many other boards also do as well?

vocal bridge
#

I only checked a few but they ones I saw didn't have it

alpine holly
#

Yup - failed despite fixing that.

#

Any idea how/where I can look at the code that's running that check? Someplace there must be defined a file of acceptable features, but I can't find it...

vocal bridge
#

Do you need to have 2 spaces before each - in the list of board URLs?

alpine holly
#

Thanks for the clues... I Found it: - I forgot to close the quote on the end of the board name: name: "Ai Thinker ESP32-CAM

vocal bridge
#

Aha

#

It's so easy to miss stuff like that

#

I once spent the better part of a day chasing down a :/; typo

#

Oh yeah, also it looks like the other files in that directory are named with _ but yours is with -

manic glacierBOT
alpine holly
#

I agonized over the _ or - issue myself; all the other ai-thinker boards use hyphens in their build folder names, and most places online do that as well, so that's what I picked; but yes - I did (later) notice that most of the other ports don't do that.

manic glacierBOT
tulip sleet
#

when I review PR's, if I notice, I steer people in that direction

manic glacierBOT
#

CircuitPython version

adafruit-circuitpython-raspberry_pi_pico-en_GB-9.0.4

Code/REPL

import time
import board
import touchio
import usb_midi
import adafruit_midi
from adafruit_midi.note_on import NoteOn
from adafruit_midi.note_off import NoteOff

# Define the touch pins
touch_pins = [board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7, board.GP8, board.GP9, board.GP10, board.GP11, board.GP12, board.GP13, board.GP1...
manic glacierBOT
short tendon
#

@tulip sleet can I lower the pystack value to cause it to error?

tulip sleet
#

Let’s wait and see what the person with the issue says about reproducing.

alpine rapids
#

Hi again! Question for y'all: I'm working on adding this board, an ESP32-S3, and I'm unsure about the USB PID/VID thing - I've requested one from espressif in the past and understand that process, but is that needed for this specific board? The reason I ask is because the board doesn't have a typical USB port, however I believe native USB is still supported when using the usb add-on. From the factory it uses a vid/pid of 303a:1001, which is a generic ESP32 identifier. Should I still request a fresh one from espressif for circuitpython?

ornate breach
urban knoll
#

Hey, wondering if y'all have a feeling for which CP ports have the most users, vs. ones that are less active? Want to focus on where the action is

ornate breach
#

Not sure about least though

urban knoll
#

Are those stats accessible somewhere?

ornate breach
#

I’m not certain, I think Scott pulled them from aws or the circuitpython.org backend

devout jolt
midnight ember
#

Just me or does that ribbon cable look like it's going right on top of the S3? With such a tiny board, the S3 might melt that cable. Looks like they assembled the ribbon connector backwards. :/

vocal bridge
manic glacierBOT
tulip sleet
#

@urban knoll @ornate breach @devout jolt @midnight ember Yes, the boards are sorted by download count. The download counts are in here: https://github.com/adafruit/circuitpython-org/blob/main/_data/files.json. When a release is made, we generate download counts by doing a query on the AWS download logs. The release CI script generates a automated PR to circuitpython-org with zero downloads. Then we (usually I) run a small script that updates the download counts, push that commit, and merge the release PR.

Right now the query counts 8.x and 9.x releases. As the releases progress, I change the query slightly. I also clean up the logs from time to time. I think it's 2023-present right now.

burnt tangle
#

@danh thanks for the data. Here's what it looks like.

stuck elbow
#

bots

burnt tangle
#

Yeah probably can't read much into any but the big numbers. There's a very long tail

tulip sleet
#

yes, don't take this as anything all that indicative of popularity

devout jolt
devout jolt
manic glacierBOT
manic glacierBOT
#
  • Add #pragma once to any CircuitPython-specific files that didn't have existing #include guards.
  • Convert all CircuitPython-specific include files to use #pragma once instead of regular #include guards.

I was greatly aided in this by the https://github.com/cgmb/guardonce tool

#9257 had previously marked all CircuitPython-specific .c and .h files in their headers. I then applied this recipe:

# Add #pragma once to any .h files that didn't have it or regular 
ag --hh ...
short tendon
#

@crimson ferry when you have a moment, I would be curious your thoughts on this: https://gist.github.com/justmobilize/f236f332fa798fce520d01154b624f5e

I haven't fully tested it, but threw this together as a thought I've had in the back of my head.

one could just:

radio = get_radio()
pool = adafruit_connection_manager.get_radio_socketpool(radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(radio)
requests = adafruit_requests.Session(pool, ssl_context)

And not need to think about anything else.
It defaults to FeatherWing pins, but one could set then real pins in settings.toml...

Regardless, I'm going to finish it up and use it (it's from a few helpers I already use)

crimson ferry
#

@short tendon Looks nice, helps to encapsulate the often-messy non-native radio setup. Are you envisioning (people) using old versions of ESP32SPI (there's a bit of code associated with those conditionals)? But yeah, pins get to be the tricky part for ESP32SPI and Ethernet, with so many form factors for those peripherals.

#

You and I already talked about the idea of WIZnet init not requiring a network connection, so that could obviate all the connect_needed checks, and connect then happens regardless of radio type.

#

And if we design each connect() to be negligible processing time if already connected (like for native wifi), there's not a lot of need for some of that checking.

#

Some of the other init kwargs add complexity too for some projects... MAC address, static IP, DHCP, debug, etc.

short tendon
# crimson ferry <@1152454697614069811> Looks nice, helps to encapsulate the often-messy non-nati...

So, I thought about requiring CP9.1.0, because until that's released the esp32spi frozen library doesn't have them (and I've been doing a lot of pyportal help...).
Right now, this is very much a draft/proof of concept and will get cleaned up.
Ideally I'd like to require/warn for an old Nina firmware as well
It might be worth bringing up / drafting a PR for the wiznet. Although it isn't frozen, getting it closer (if people are good with that) would be good.

crimson ferry
#

right, forgot about the frozen thing

short tendon
#

But the release should happen eventually... 😉

manic glacierBOT
crimson ferry
#

I can open an issue on WIZnet, not sure about getting into the weeds on DHCP and all that... that library is kinda scary to me

short tendon
short tendon
crimson ferry
#

I do lightly scan that channel, but don't use those services so don't usually have much to add

short tendon
#

There "bug" we found makes me want to cry

crimson ferry
#

do you remember where we talked about wiznet "connection"?

short tendon
#

Dang, was just about to share that

crimson ferry
#

just glancing at the library, maybe it's just set_dhcp(), and if that's the case we have it now... call the init with is_dhcp=False, then user code calls set_dhcp() ...maybe?

#

I can test it out tomorrow

manic glacierBOT
crimson ferry
#

@short tendon I think it's already baked in...py radio = WIZNET5K(spi, cs, reset=rst, is_dhcp=False) radio.set_dhcp() this works if the cable is connected, doesn't fail until radio.set_dhcp() if the cable is unconnected (ConnectionError: The Ethernet connection is down)

#

but maybe a connect() alias for consistency, and .connected and .ipv4_address

crimson ferry
#

oh yeah, but does it really take 5 seconds to detect link, that seems like a lot