#circuitpython-dev

1 messages · Page 416 of 1

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.2.0 on 2022-02-24; Adafruit Matrix Portal M4 with samd51j19
Board ID:matrixportal_m4

Code/REPL

import time
import board
import traceback

from adafruit_matrixportal.matrixportal import MatrixPortal
from secrets import secrets

matrix_portal = MatrixPortal(status_neopixel=board.NEOPIXEL, debug=True)
network = matrix_portal.network
display = matrix_portal.graphics.display

url = "http://example.com"
...
manic glacierBOT
ionic elk
#

trying to get back up to speed with circuitpython main and I'm running into about a billion of these errors:

error: submodule git dir '/Users/hierophect/Firmware_Projects/circuitpython/.git/modules/ports/stm/st_driver/CMSIS_5' is inside git dir '/Users/hierophect/Firmware_Projects/circuitpython/.git/modules/ports/stm/st_driver'
fatal: refusing to create/use '/Users/hierophect/Firmware_Projects/circuitpython/.git/modules/ports/stm/st_driver/CMSIS_5' in another submodule's git dir
Failed to clone 'ports/stm/st_driver/CMSIS_5'. Retry scheduled
#

is something borked with the ST submodule? I don't see any issues for it

viscid pine
#

St sub modules were moved around a bit

ionic elk
#

Do I just need to re-clone the whole project? It is wholly screwed up for me

viscid pine
#

That’s the quickest way

ionic elk
#

blegh

#

I wish there was an easier way to tell Git to just force something to match upstream

#

no matter what

viscid pine
#

if you start over, do make fetch-submodules instead of any other submodule commands the first time

ionic elk
#

instead of having to do a billion manual submodule changes

viscid pine
#

it fetches a lot less

manic glacierBOT
tulip sleet
#

for 6196, and same for 6202

onyx hinge
#

I was noticing the same thing, and there's nothing on githubstatus. thanks.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Hi, I'm pretty interested in using decompression in CircuitPython. What remaining steps need to happen for this to make it into the next release? If there are things I can help with, let me know.

Are there any specific parts of this you are looking for? Short term I want to get at least zlib.decompress() working. Longer term is time permits getting the gzip module working would be ideal but takes some more work.

manic glacierBOT
manic glacierBOT
#

Hi @gamblor21 ! I'm implementing over-the-air software installation for a MatrixPortal M4, and my hope is to be able to unpack a downloaded zip file full of Python files. I know that zipfile support might be a long way off, but even having basic decompression (such as zlib) would get me pretty far; perhaps I could implement a subset of tar format in plain Python for example.

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 7.3.0-alpha.0-64-gdd7318244-dirty on 2022-03-27; ESP32-S3-Box-2.5 with ESP32S3
Board ID:espressif_esp32s3_box

Code/REPL

import wifi
from secrets import secrets

for network in wifi.radio.start_scanning_networks():
    print("network [{}], ssid [{}], channel [{}]".format(network, network.ssid, network.channel))
wifi.radio.stop_scanning_networks()

print("WiFi Init: ssid [{}]".format(secrets["ssid"]))
wifi...
#

Is the debug console accessible on that device? If you do a DEBUG=1 build, you can then use https://github.com/adafruit/circuitpython/blob/main/ports/espressif/tools/decode_backtrace.py to narrow down where it fails.

That's a good question. I haven't done any debugging on the ESP32 series before so I'm not sure what to look for. I do see that the PMOD headers include a pair of UART pins though, which map to GPIO44 (rx)/GPIO43 (tx) according to the [schematic](https://github.com/e...

manic glacierBOT
manic glacierBOT
#

I just double-checked with DEBUG=1 builds on my other two S3 boards - a DevKitM-1 with a mini module and a DevKitC-1-N8R2 with a very similar WROOM-1 module - and both connect to the network without any odd behavior in the debug output.

The only obvious differences I can see between the esp-box and the DevKitC hardware are size differences in flash and PSRAM (8 vs 16 MB and 2 vs 8 MB respectively).

On a possibly related note, the debug output for the esp-box seems to ind...

manic glacierBOT
#

I wouldn't think flash would be the issue unless the board file is misconfigured or it's some slightly-different flash variant. The PSRAM looks promising as the enabling variable. You should be able to get some module names and line numbers from Backtrace:0x40386810:0x3fcae9800x4038706e:0x3fcae9a0 0x403799c5:0x3fcae9c0 0x403799d9:0x3fcD using the [decode_backtrace.py](https://github.com/adafruit/circuitpython/blob/main/ports/espressif/tools/decode_backtrace.py) utility.

mental nexus
#

I'm working to add the RGB LCD display support to the ESP32-S3 builds, and I'm trying to figure out how to get the linker to realize I need some files from the esp-idf. In particular, I need the files in a component called esp_lcd. I found a way of creating the #include statement where it could find the header file, but when it goes to link it fails to find the files I need.

#

Any pointers on how to direct the linker to find the correct files over in esp-idf/components/esp_lcd/?

stuck elbow
#

add -l to cflags?

mental nexus
#

I assume that will be in the Makefile

stuck elbow
#

they files should be in the path already

#

yeah in the makefile

mental nexus
#

I see this, which mentions other "components" but when I add esp_lcd it gives an error.

ESP_IDF_COMPONENTS_LINK = $(IDF_TARGET_ARCH) app_update bootloader_support driver efuse esp_adc_cal esp_common esp_event esp_hw_support esp_ipc esp_netif esp_pm esp_phy esp_ringbuf esp_rom esp_system esp_timer esp-tls esp_wifi freertos hal heap log lwip mbedtls mdns newlib nvs_flash pthread soc spi_flash vfs wpa_supplicant
#

Error: ninja: error: unknown target 'esp-idf/esp_lcd/libesp_lcd.a'

stuck elbow
#

no idea about ninja, sorry

#

maybe make a symlink ;-)

proven garnet
#

Does CircuitPython support f-strings yet? The MagTag example uses them but my understanding was that they weren't supported yet.

mental nexus
jaunty juniper
proven garnet
#

Ah, got it, thanks!

manic glacierBOT
crimson ferry
mental nexus
#

In the Makefile in the ports/espressif folder.

manic glacierBOT
#

I've just noticed the following:

Audio file is 2 minutes long
audio file plays only for 1 minute before entering another function
speaker.stop() is used as 1 minute left on previous audio file
next audio file starts and you hear an audible pop as well as labels flicker

Audio file is 2 minutes long
audio file plays for 2 minutes before entering another function (no repeat)
speaker.stop() is used
next audio file starts and the labels flicker

Audio file is 2 minutes long
audio fi...

manic glacierBOT
#

Follow up to #5468, which don't include espressif support.

I have tested this on a QT Py ESP32-S2 with this type of rotary encoder, which requires divisor=1. I've also tested with divisor=2 and divisor=4, and a pulse is registered every 2 and 4 detents respectively as expected.

I had to change the order in shared-bindings/rotaryio/IncrementalEncoder.c as the divisor value needs to be known before con...

jaunty juniper
#

I see some libraries where the docstring :params ...: are not properly displayed on RTD because there is a missing new line above it, and ..code-block:: python are also not properly displayed because they are missing a space after ..

#

is that because of a sphinx update or a configuration change ?

#

do they have to be updated by adding the missing space or is there a parameter that could fix it ?

orchid basinBOT
orchid basinBOT
solar whale
#

Does anyone use MakeCode on the CPX -- I have what I think is a simple quesion <#help-with-makecode message> but have not gotten any replies

orchid basinBOT
manic glacierBOT
#

Badger2040 has a 3V3 enable like that it can set high to keep itself awake, or set low to turn off. The 5 front buttons wake the board up.

The intention was that the user would press a button, then user code would kick in to enable the pin to keep the board awake from thereon. However, it seems that CircuitPython takes a while to set itself up, requiring the user to hold one of the front buttons for over 10 seconds.

I have now moved the pin initialisation and enabling into board_init,...

digital shoreBOT
manic glacierBOT
tulip sleet
jaunty juniper
#

'k I'm at 12 and counting 😉

#

missing init parameters because they are documented in __init__ instead of at the class level too

idle owl
#

<@&356864093652516868> Greetings! This is your reminder about the CircuitPython Weekly meeting. It happens in just over an hour. Remember to add your hug reports and status updates to the notes doc, whether or not you're planning to attend and participate. Looking forward to talking with you soon! https://docs.google.com/document/d/1fJ0odbK7m4jWHTnKL1medCeZAGBTZiNIW0np6nOd4hc/edit?usp=sharing

jaunty juniper
#

any idea on a friendlier way to display module level constants on RTD ?

idle owl
tulip sleet
idle owl
#

I added docstrings to all of them.

#

Which I would suggest for your example.

jaunty juniper
#

ah it might just look different because of how it renders locally with sphinx, I get some differences with the online version

idle owl
proven garnet
#

And mazel tov @slender iron!

solar whale
#

@idle owl What do you do in your spare time? 😉

mental nexus
#

ESP32-S3 and display question: My example code shows no life (dot clock does not wiggle at all). How can I add print debug in a esp-idf "component" library to verify it's not falling into an error in the esp-idf code? Possibilities: 1) mp_printf doesn't compile if I add it into the esp-idf code 2) Does monitoring the UART port show the ESP-LOGD outputs?

crimson ferry
#

(2) yes, those messages get added to the debug console, along with the normal esp messages. compile with DEBUG=1, include static const char *TAG = "tagname"; in the module, then ESP_LOG*(TAG, "hello world"); as desired

mental nexus
#

Cool. "TAG" is already there. Where do I turn on DEBUG=1, somewhere in the CircuitPython toplevel Makefile?

crimson ferry
#

make BOARD=* DEBUG=1

mental nexus
#

Even easier. I'll give it a shot.

proven garnet
#

As a previously primarily windows user, I always had to use WSL and copy it over to windows afterwards, so exciting!

tulip sleet
#

@onyx hinge received this from GitHub support re unicorns when trying to display job status:

Our engineering team has developed a fix for this issue that we expect to be deployed this week. I will follow-up here once this fix has been released.

If you need to access logs in the meantime, you can edit the job link param check_suite_focus from true to false. This isn't a solve-all as it will need to be edited each visit to a job's URL for a run, but you should have access to the job's logs from making that change.

(i.e https://github.com/adafruit/circuitpython/runs/5705450743?check_suite_focus=false )

onyx hinge
#

@tulip sleet the pull request makes some of the names better but there are still {{}}s .. e.g., {{ cookiecutter.__dirname }}/{{ cookiecutter.__libprefix }}{{ cookiecutter.__libname }}.py vs "{{ cookiecutter and 'tmp_repo' }}/examples/{{ cookiecutter.library_name | lower | replace(\" \", \"_\") }}_simpletest.py"

candid sun
#

thanks folks!

mental nexus
#

See y’all!

onyx hinge
#

it's not that much shorter I guess

proven garnet
#

Thanks!!

manic glacierBOT
mental nexus
jaunty juniper
#

got a couple of CI errors due to just released click 8.1.0 and black
a new black release fixed it a minute ago, but our version of black is pinned I believe ?

onyx hinge
#

@jaunty juniper link to the actions run? i'll check into it

onyx hinge
#

pre-commit pins black, but black probably doesn't transitively pin click

jaunty juniper
#

yeah that's what I think

onyx hinge
#

click's release is 8.0 -> 8.1, so it's unfortunate that they introduced at least two different incompatibilities as well

proven garnet
#

Uh oh, happening in the libraries I merged too. 🥲

onyx hinge
#

This is a feature release, which includes new features and removes previously deprecated features. The 8.1.x branch is now the supported bugfix branch, the 8.0.x branch will become a tag marking the end of support for that branch. We encourage everyone to upgrade, and to use a tool such as pip-tools to pin all dependencies and control upgrades.

#

well they knew they are breaking changes, but just don't follow semver

proven garnet
onyx hinge
#

@proven garnet for libraries? Probably. if there's a release of black that works.

onyx hinge
#

black 22.3.0 does work with click 8.1.0

#

@idle owl hey not sure if you are still around but are you reading this?

proven garnet
#

@idle owl I figure this is something adabot can do but let me know if you want any help

#

Happy to script something up

onyx hinge
#

20.8b1 -> 22.3.0 is going to be .. interesting, at a minimum.

idle owl
onyx hinge
#

I think it just got more urgent 😕

idle owl
#

Dan noticed it a couple of weeks ago.

#

Ok.

#

I'm on "misc" so, I can slot that in first.

onyx hinge
#

well, we can always merge with pre-commit failing, it just feels bad

idle owl
#

Need Eva to be around though. I think she is.

onyx hinge
proven garnet
#

There's a Yiddish saying that translates to "Man plans and God laughs" and it feels appropriate headdesk

onyx hinge
#

there's a reason they don't merely call it "version heck"

proven garnet
#

For the doc patches by @jaunty juniper is it worth holding off until this is patched?

idle owl
#

@onyx hinge Wait, isn't click specific to CP?

proven garnet
#

They won't materialize in RTD in the meantime, I believe

idle owl
#

For the libraries, what's failing specifically?

onyx hinge
idle owl
#

Oh.

onyx hinge
#

click is used indirectly by black

idle owl
#

Ahhhh.

#

OK.

tulip sleet
#

this is causing the CircuitPython builds to fail too, i think

#

not just library

idle owl
#

Right.

onyx hinge
#

click is also used indirectly by cascadetoml, used by the circuitpython build

#

but each one will need a different fix

idle owl
#

Starting on the patch now.

jaunty juniper
mental nexus
#

Clearly I have failed to reach peak enlightenment:

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
idle owl
#

@onyx hinge Oof, 22.3.0 was released 39 minutes ago.

idle owl
#

I'm reading it as only if you want to use an older version of Black.

manic glacierBOT
jaunty juniper
#

and then to see if circup needs an update too

lone axle
#

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/1em2Z3EF5T_eaz04e-XdesuIZrxCEB_3plFVzBiat_jc/edit?usp=sharing

manic glacierBOT
#

I've got the basic code compiling now and am using make DEBUG=1 and printing to UART to debug the ESP code. I can print to the ESP UART console log using ESP_LOGI(TAG, "esp_lcd_new_rgb_panel 7.2");.

I am getting a crash when the esp_lcd_new_rgb_panel goes to allocate memory for the display framebuffer, right after this line:

rgb_panel->fb = heap_caps_aligned_calloc(psram_trans_align, 1, fb_size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT);

Error message:

Guru Meditation ...
mental nexus
#

ESP32-S3 display code: Whenever the code allocates the display framebuffer in PSRAM, I get a crash. I suspect that CircuitPython has already claimed all the available PSRAM space, so there isn't enough available. I updated the issue above. Two options I can think of: 1) I need to tell CP to leave some memory for the framebuffer, or 2) write a custom esp_lcd_new_rgb_panel function for the ESP-IDF with an input parameter of a framebuffer, where CP allocates the framebuffer RAM and passes it to the esp-idf.

idle owl
#

(╯°□°)╯︵ ┻━┻

manic glacierBOT
idle owl
#

This PR for the patch is failing because of Black. So I updated Black on Adabot, and when it runs remotely, pre-commit Black is failing on a specific file. It passes locally. I tried running Black on that specific file locally, no change.

#

The remote version is different than my local. I viewed raw on GitHub, pasted into my local version, it showed modified on git status, ran Black, and it updated the file.

#

I did a pull before starting any of this... So I have no idea.

#

Then caused merge conflicts. Oof. Fixed, but oi.

#

Survey says..........

#

PASSED.

stuck elbow
#

did the computers go too far?

idle owl
#

Here goes something. Applying my first Adabot patch.

#

My fancy Git setup made it fail entirely. 😄 Trying again.

onyx hinge
#

ironically my change to cascadetoml failed because of black because of click

proven garnet
idle owl
#

@onyx hinge @jaunty juniper @proven garnet Patch completed! (Finally!) You should be able to update your PRs, which should rerun them. I also think if you rerun the Actions on the releases, it should use the updated files.

proven garnet
#

Sounds great, thank you!

tulip sleet
#

@onyx hinge I did not see the cascadetoml fix until just now. If you are not immediately working on a PR to circuitpython, I can do that now.

#

maybe there's nothing to be done? black and click are now compatible?

onyx hinge
tulip sleet
onyx hinge
#

Oh did click make a release too?

tulip sleet
#

I thought 22.3.0 is now compatible with click 8.1.0?

#

or black has to update?

#

I am not following that closely

onyx hinge
#

Oh sorry, names... It's typer that also would need a release

#

That's how click is brought into cascadetoml

tulip sleet
#

typer is used in ports_windows

#

and in requirements-dev.txt

onyx hinge
#

Okay that all may need updated too

#

I can look after dinner if it is still problematic

#

So many interrelated parts

tulip sleet
#

I'll see, and see if typer is on the ball about this or not

#

ok, got it, typer has not had a release since 2021

onyx hinge
#

to be fair it's barely 2022 by months

#

but yeah it is better to plan for resolution that is not swift, imo

tulip sleet
#

there are two pages of PR's that have not even been released to run CI

manic glacierBOT
onyx hinge
#

P(each networked step completes successfully) has to be pretty high when you have hundreds of networked steps per CI run. ugh.

#

E: Failed to fetch http://azure.archive.ubuntu.com/ubuntu/pool/main/libc/libcroco/libcroco3_0.6.13-1_amd64.deb 503 Service Unavailable [IP: 52.147.219.192 80]

tulip sleet
#

that particular IP is a very typical point of failure

onyx hinge
#

merge if ^^mostly^^ green 😕

tulip sleet
#

green with spots

manic glacierBOT
#

I found in the espressif port where the heap pointer is allocated.

https://github.com/adafruit/circuitpython/blob/c6bfe54dc8c52574bec7dae4ec1e8113f1e427c7/ports/espressif/supervisor/port.c#L197

It appears that the heap pointer starts at the beginning of the SPI PSRAM. I don’t see any indications of a mechanism to leave some memory space for other functions to allocate memory from. I’m unsure how this can be modified to leave some room for a framebuffer. I need to keep digging.

mental nexus
#

I’m stuck and could use some guidance on allocating memory on the ESP32-S3 in CircuitPython. I think that CP grabs all the PSRAM for the heap, so when I go use heap_caps_aligned_calloc to create a big display framebuffer, it causes a crash.

#

Is there a “CP-friendly” way to malloc and get some SPI-PSRAM for a framebuffer?

crimson ferry
#

@mental nexus what size memory chunk do you need?

mental nexus
#

800 x 480 x 16 bits (RGB565 color)

#

768 000 bytes

crimson ferry
#

oh, wow, yeah I don't know the psram side of things but my understanding is like you found that it's all cp heap

#

S3 has 250-300k free internal sram, but you need a lot

#

there must be a way to allocate from heap

mental nexus
#

In the RGB display code I think that the esp-idf uses low level code to try to allocate ram in the PSRAM, but CP allocated all of it.

#

Unfortunately that means I’ll need to make a separate version of the ESP-IDF. But if it works, I’ll do it.

#

Can I do just a normal malloc in CP for this large of a chunk?

crimson ferry
#

i don't know, jepler or danh or one of the other core devs would know if there's a way

#

pure malloc takes from esp-idf internal sram

#

keypad uses a structure called ring_buf, which uses gc_alloc, but I'm really reaching

mental nexus
#

Ok, and the code in the esp-idf uses some kind of “alignment” which I’m not exactly sure what that does.

#

Ok I’ll ping those two tomorrow during normal hours. Scott was giving me pointers but he’s going to be needing parenting pointers himself these days!

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

CircuitPython has an espidf module for measuring memory parameters for this build.

If I run the latest version for the Devkit-N8R8 (8MB flash, 8 MB of PSRAM), I get these values. Based on this measurement, the PSRAM is not accessible (I'll raise a separate issue):

Adafruit CircuitPython 7.2.3 on 2022-03-16; ESP32-S3-DevKitC-1-N8R8 with ESP32S3
>>> 
>>> import espidf
>>> print(espidf.heap_caps_get_to...
#

It's now failing for a different reason; there's a compile error, for example: https://github.com/adafruit/circuitpython/runs/5735590430?check_suite_focus=true#step:9:159

Re your pin query: In principle, I don't think there's a problem exposing an already-created DigitalInOut the way you have. You could also just initialize the pin the way you want, using the HAL GPIO operations (or the common_hal_digitalio operations) and have the user create the object if they wanted it.

If you do...

#

Now the build error is related to your change. Please take a look. I added an additional comment at the spot that may be the cause of this error, but didn't do any additional building or testing. Thanks!

make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/raspberrypi'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
/usr/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: build-pimoroni_...
solar whale
#

I finally had a need to use microcontroller.OnNextReset so I could reset to the Bootloader on a device that does not have easy access to the Reset Button -- worked perfectly!

tulip sleet
stuck elbow
#

I always use it, I have a 'bootloader.py' on my boards that I import from the repl, so that I don't have to type it all

crimson ferry
#

@mental nexus the Espressif example is (perhaps conveniently) 480 x 272 x 2 = 261,120 bytes, which fits in available internal SRAM on the S3 ...although it does look like they are allocating from PSRAM

proven garnet
#

@jaunty juniper I'm happy to rerun CI on the libraries I merged the other day to make sure the documentation updated, but don't know how to see that list, want to ping me on the ones that failed after merging?

manic glacierBOT
#

I haven't used decode_backtrace before, and in my environment it wouldn't run - couldn't find the addr2line utility at first. So I did some digging and read up on the idf.py monitor function. It looks like monitor will do the same decode on the fly.

After setting the dev environment target to esp32s3 then copying the firmware.elf output to build/circuitpython.elf I ran the monitor utility (idf.py -p /dev/ttyUSB0 monitor) and got this idf-parsed output from the debug console...

#

Re your pin query: In principle, I don't think there's a problem exposing an already-created DigitalInOut the way you have. You could also just initialize the pin the way you want, using the HAL GPIO operations (or the common_hal_digitalio operations) and have the user create the object if they wanted it.

I tried doing the HAL solution first, but think I encountered issues when the user code created the DigitalInOut object, which would reset the pin back to a default state before e...

#

I had to change the order in shared-bindings/rotaryio/IncrementalEncoder.c as the divisor value needs to be known before configuring the peripheral. I don't think this will cause issues for other ports as the set_divisor function only sets a value on a struct, so the order of operations shouldn't matter.

Rather than change the order, let's add the divisor argument to _construct, and change the other ports to handle that. Then we are not dependent on the being valid for all ports.

gloomy shuttle
stuck elbow
#
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
microcontroller.reset()
#

a bit of a mouthful

orchid basinBOT
solar whale
mental nexus
tulip sleet
#

is the IDF doing the malloc, or do you hand it a buffer?

mental nexus
#

On a possibly-related note, I had to turn on a sdkconfig flag so that the ESP-IDF code will allocate from PSRAM CONFIG_SPIRAM_USE_MALLOC. But it raised the same kind of crash when I called the module espidf espidf.heap_caps_get_largest_free_block. I feel like I'm doing something wrong....

#

The IDF is doing the malloc.

tulip sleet
#

ah, ok, that's bad, I'm not sure how to get around that. Is there any other API for this functionality where you pass it the memory instead?

mental nexus
#

Not that I see. If I have to pass it some memory, I'll have to rewrite the ESP-IDF component code that I need, so that it will accept a buffer address.

#

I'm unsure if I can "fake" it by letting the IDF create a tiny dummy buffer, and then redefine it later in the CP core code.

tulip sleet
#

any malloc call is going to overlap with the heap. Or is there a way to specify the memory region for heap_caps_aligned_calloc() earlier, so that it respects some bounds?

#

we could pre-allocate a space for their heap, and for ours. I wonder if we are doing this already in some way. I would imagine there are other things that malloc stuff, and we figured out how to get around that, but I'm not familiar at all with storage allocation sharing with the IDF

mental nexus
#

Not sure I could call it earlier, since this would be happening whenever someone wants to instance one of these displays. If it grabbed memory before CP identified its heap, it would have to be "locked into" the CP build somehow.

tulip sleet
#

yes, I do mean that, you'd have to guess what size is reasonable to reserve

mental nexus
#

Doing it that way would mean the build would have to know it was going to have this specific kind of display attached. Doesn't seem very "circuitpython-y", if that's a word.

#

Any way to ask CP to shrink its heap to allocate some space for an IDF malloc call?

#

I don't really understand how CP manages memory and how it interact with the ESP-IDF. Any idea who I could ask about this?

tulip sleet
#

looking at supervisor/port.c for espressif:

// Heap sizes for when there is no external RAM for CircuitPython to use
// exclusively.
#ifdef CONFIG_IDF_TARGET_ESP32S2
#define HEAP_SIZE (48 * 1024)
#endif
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define HEAP_SIZE (176 * 1024)
#endif
#ifdef CONFIG_IDF_TARGET_ESP32C3
#define HEAP_SIZE (88 * 1024)
#endif
mental nexus
#

Or would it be better to just go the route of letting CP allocate the space and pass it to the IDF?

tulip sleet
#

so maybe we use PSRAM all to ourselves

mental nexus
#

Down lower there's a separate part for PSRAM.

tulip sleet
#

honestly, I would just be looking at the same code as you. Maybe @onyx hinge knows this off the bat.

#

I don't know why you are seeing crashes, because it looks to me that if there is PSRAM, and we use the whole thing, then you can ask their display code to allocate in regular RAM

onyx hinge
#

my impression is that we allocate the whole psram for circuitpython heap

mental nexus
#

I think there's something weird even in the baseline build, because gc.mem_free shows all 8.7MB the memory, but the espidf module memory size reader only shows 330kB.

onyx hinge
#

and leave the non-psram for the idf heap

tulip sleet
#

that's what I gleaned, thanks

mental nexus
#

Ok, that's what it seems like.

#

If I reduce the CP heap size, will that "automagically" leave it for the ESP-IDF to access?

tulip sleet
#

is it failing because there is not enough memory?
ESP_GOTO_ON_FALSE(rgb_panel->fb, ESP_ERR_NO_MEM, err, TAG, "no mem for frame buffer");

mental nexus
#

Yes, it has 8MB of PSRAM.

onyx hinge
#

for the other framebuffer display types (e.g., rgbmatrix), it has to be able to both allocate the framebuffer on the gc heap, and allocate the framebuffer as a "supervisor allocation". but both assume the circuitpython is in charge of the allocation in one way or another.

mental nexus
#

It crashes with a Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.

onyx hinge
#

it is a bit messy, but it was the best compromise I could come up with since displays need to (A) be created before the VM starts, on particular boards and (B) the display needs to persist after the VM is reset

tulip sleet
#

so we use that for heap, so you should set it to use regular RAM, and it should just work, because we don't use the regular rAM heap

onyx hinge
#

a DEBUG=1 build might show better information on the debug console

mental nexus
#

I need more space than will fit in RAM.

tulip sleet
#

@onyx hinge what is happening here is that the esp_lcd code in the ESP-IDF is doing its own malloc

tulip sleet
mental nexus
#

I got an error of where the memory access caused a crash, EXCVADDR: 0xe0191061 LBEG . I'm suspecting this is in lala-land.

tulip sleet
#

right, i would not expect this to work at all

#

there is no way to get this to work without modifying their code. Did you look to see if there was an issue about this? Is anyone else asking for a more flexible API?

mental nexus
#

Sounds like I should find a way to malloc inside CP and hand it to the IDF. That means I'll have to diverge from the ESP-IDF to grab 768kB for my framebuffer.

#

I haven't seen any issues specifically related to LCD framebuffer malloc's, but I'll go look again broader.

tulip sleet
#

IF you can tell its malloc to use a certain section of PSRAM only, and same for us, then it would work, but that's static partitioning of the PSRAM

#

are you saying you would not use esp_lcd_new_rgb_panel() and just do it yourself?

mental nexus
tulip sleet
#

we do fork the IDF to fix things that we are waiting on from them, we have always been able to go back to their repo eventually

mental nexus
#

With CP, if I ask for such a big chunk, can I guarantee that it will be in PSRAM?

tulip sleet
#

if we are using PSRAM for the heap, then it will be in PSRAM

#

I don't think we allocate some in RAM and some in PSRAM.

mental nexus
#

In CP, can I hook up the DMA and also call the CacheWriteBack, or will that cause problems? Also, the esp_lcd_new_rgb_panel() sets up some interrupts, will that be expected to conflict any with CP?

tulip sleet
#

i don't know, if we use interrupt allocation mechanisms from the IDF, then there should not be a conflict

mental nexus
#

Ok, let me explore rewriting the esp_lcd_new_rgb_panel() and see if I can at least get a hack to run.

#

Thanks for all the suggestions and sanity checks!

tulip sleet
#

sure, np!

tidal kiln
tulip sleet
tidal kiln
#

@tulip sleet thanks. has any issue been created anywhere for tracking? or is it just discussion in various places?

tulip sleet
#

I don't know of one, so it would be good to search, both in the lib and in core.

dusk mauve
#

does anyone else have an ESP-BOX device on hand? I ran into a bug (filed as issue 6206) where wifi.radio.connect() triggers a crash. Would be helpful if someone else could do a fresh build and flash on their own device to make sure its not my build environment, maybe

manic glacierBOT
#

Digging into the backtrace didn't point to a smoking gun. Brought back memories of dealing with memory issues in past lives...

So I decided to disable PSRAM altogether in sdkconfig. After doing that the build succeeded and the error was gone, everything worked properly.

That seems to narrow this down to either a sdkconfig issue or an issue with esp-idf relating to PSRAM allocation, maybe? Beside having 8 MB (vs 2 MB) of PSRAM this board also has a display that gets initialized on ...

dusk mauve
#

alternatively, if anyone with a known-good esp32-s3 dev environment could build a fresh espressif_esp32s3_box binary from main that might help rule out my dev environment 🙂

proven garnet
#

There's an issue for the requests library about multiple cookies, and after looking into it, it seems like the two solutions are to either add multiple cookies to the Set-Cookie header delimited by , or to implement Response.cookies. I'm not super duper knowledgeable on requests but willing to take it on but not sure which is the better option.

#

Well, for full CPython compatibility my understanding is that if Response.cookies is done the other should also be, but adding the cookies probably requires more infrastructure and I'm not sure what the constraint is on the library for minimizing memory usage.

manic glacierBOT
#

The esp_lcd code in the ESP-IDF allocates a buffer from the heap:
https://github.com/espressif/esp-idf/blob/c29343eb94d2f2ca17b3a5b38c82452e556147f2/components/esp_lcd/src/esp_lcd_rgb_panel.c#L134
(thanks @kmatch)
@anecdata @kmatch is this the cause of this problem?

@fivesixzero is this duplicative of the discussion I was having with @kmatch in #circuitpython-dev just recently?

crimson ferry
#

@tidal kiln fwiw, I do routinely get Timed out waiting for SPI char and other wifi-related exceptions on PyPortal. I don't use wifimanager, so the tactic after a couple of retries is esp.reset(). There's always reload and reset for further escalation.

tidal kiln
tulip sleet
crimson ferry
#

yes, since forever, but I am running 7.2.0, latest libs, and NINA 1.7.4

tulip sleet
#

and it happened in, say, 7.1.0 and before?

tidal kiln
crimson ferry
#

I don't know, I've just built up a series of exceptions to catch over the years, and a system of retries and escalations, so I don't really track it anymore in detail. I just check the serial periodically.

tidal kiln
#

if it's a "feature", then having a guide cover all that ^^ would be helpful

tulip sleet
#

the MatrixPortal has been around for a while, but we're seeing this more often? Or maybe people are just doing longer-living projects? I don't know.

crimson ferry
#

as far as I recall, these exceptions have been around for a long time, but they are intermittent and can usually be recovered

#

I have not seen hard crashes

idle owl
#

@proven garnet How are lib things going? Did the update work?

manic glacierBOT
crimson ferry
#

In some applications I just disconnect wifi on espressif and esp32spi (and reset esp on esp32spi) between each transaction, so it's always clean. But still there are exceptions.

proven garnet
#

Managed to rerun most of the failed PRs in the libraries

tidal kiln
proven garnet
#

New black is angry with some libraries now and I've been submitting PRs for those but the error we were getting beforehand is gone and it's back to being sensible, fixable things!

idle owl
proven garnet
idle owl
#

Let me ask Eva.

#

She updated Adabot recently.

#

@onyx hinge Looking at cascadetoml, it needs a setup.py for PyPI to work.

idle owl
onyx hinge
#

Weird, it's been released before .

idle owl
onyx hinge
#

Yes

idle owl
#

Maybe it was manually released?

onyx hinge
idle owl
#

Hmm.

onyx hinge
#

Yes I'm pretty confident that Scott ran some commands on his local computer in the past

idle owl
#

Well, the only PyPI release thing I know how to do is add a workflow that runs to release it to PyPI.

jaunty juniper
#

pypi has different methods that I'm not well versed in, but it looks like cascadetoml uses the pyproject.toml file

idle owl
#

So if he did some other magic, I don't know how to make the repo do that.

#

OK looking into the pyproject.toml file.

jaunty juniper
#

not sure if that's the magic file, I find all that very confusing

onyx hinge
#

Me too

idle owl
#

Um... I think this is for running pip within the directory.

#

But I could certainly be reading it wrong

#

though immediately below it it says setup.py (legacy)

#

So I guess it is the file. I have absolutely no idea how to build that into a workflow.

#

I am evidently not the person to help you with this @onyx hinge

onyx hinge
#

Ok, it'll keep as we have a (different) workaround in place

#

Thanks for looking

idle owl
#

I mean now I want to know how to do it.

#

But...

#

I'll give my self 30 minutes to look into it.

onyx hinge
#

You can totally leave it be for now

idle owl
#

Ok.

#

Done and done.

idle owl
manic glacierBOT
#

CircuitPython version

7.2.1 and later

Code/REPL

import board
uart = board.UART()

Behavior

on reload:

>>>
soft reboot

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

You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Attempted heap allocation when VM not running.
Please file an issue with the contents of your CIRCUITPY drive at 
https://github.com/adafruit/circuitpython/issues

###...

proven garnet
#

Want me to PR or patch to main?

idle owl
# proven garnet Want me to PR or patch to `main`?

Hmm. I'm going to say for this one, if it's because of the Black update, patch to main. If it's including anything else, PR. I'm always a little concerned about pushing directly to main, but that's a lot of PRs.

proven garnet
#

Sounds good, I'll only push a pure black reformat to main!

idle owl
#

Thanks!

manic glacierBOT
solar whale
#

I just cloned a fresh copy of CP and am trying to build on MACOS -- when I try to build mpy-cross I am getting this ```jerryneedell@Mac-mini circuitpython % make -C mpy-cross
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
mkdir -p build/genhdr
GEN build/genhdr/moduledefs.h
QSTR updated
../py/vm.c:742:25: error: array index -3 refers past the last possible element for an array in 64-bit address space containing 64-bit (8-byte) elements (max possible 2305843009213693952 elements) [-Werror,-Warray-bounds]
sp[-MP_OBJ_ITER_BUF_NSLOTS + 1] = MP_OBJ_NULL;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
../py/vm.c:269:13: note: array 'sp' declared here
mp_obj_t *sp = code_state->sp;
^

similar errors removed
4 errors generated.
make: *** [build/py/vm.o] Error 1
jerryneedell@Mac-mini circuitpython %

#

It builds fine on Linux.

onyx hinge
#

@solar whale micropython has already selectively disabled -Warray-bounds diagnostics for the "javascript port" I found this comment .. ports/javascript/Makefile:# Disable errors for array-bounds warnings on "sp[-MP_OBJ_ITER_BUF_NSLOTS + 2]" access. ports/javascript/Makefile:$(BUILD)/py/vm.o: CFLAGS += -Wno-error=array-bounds so I imagine it'll turn out that macs need the same treatment for some reason.

idle owl
#

@proven garnet I have a mission for you, should you choose to accept it.

solar whale
onyx hinge
#

@solar whale I assume that mac changed

#

likely the c compiler was updated or something

solar whale
#

Thanks for the pointer to the issue...

onyx hinge
#

you should feel free to file an issue, it'll affect us sooner or later in ci builds

#
diff --git a/mpy-cross/mpy-cross.mk b/mpy-cross/mpy-cross.mk
index 642fe9b5a..c7bd91ad1 100644
--- a/mpy-cross/mpy-cross.mk
+++ b/mpy-cross/mpy-cross.mk
@@ -29,6 +29,8 @@ INC += -I$(BUILD)
 # compiler settings
 CWARN = -Wall -Werror
 CWARN += -Wpointer-arith -Wuninitialized
+# Disable errors for array-bounds warnings on "sp[-MP_OBJ_ITER_BUF_NSLOTS + 2]" access
+CWARN += -Wno-array-bounds
 CFLAGS = $(INC) $(CWARN) -std=gnu99 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
 CFLAGS += -fdata-sections -ffunction-sections -fno-asynchronous-unwind-tables
 
``` you could also try with this change manually applied
solar whale
#

Thank you -- I was also curious if anyone else had run into this ....

#

I though I had messed up my system -- hence the re-install of brew so I thought it was just something I did.

#

I have to go offline now, but I will try your suggested fix in the morning and file an issue if it works or I guess if not as well...

jaunty juniper
#

I haven't run into this, but I'm still on Catalina

#

so like, not relevant at all (sorry)

warm flame
#

Anyone knows what the beta status of the ESP32-c3 really mean for dev ?

idle owl
#

@warm flame It means that likely not all the features are fully implemented, and there may be instability.

#

But we wanted to get it out there for folks to use, so we call it beta to be clear that it's not 100% ready.

warm flame
#

Great

#

Just found the lilygo t-oi plus that is made of a ESP32-C3 and has all the features I want

#

I know it's not the rp2040 I wanted but it got the size I need

idle owl
#

I'm uncertain of the specifics for the C3 build, i.e. I don't know specifically what features aren't completely ready or what makes it unstable. But it's definitely worth trying. I'm also not sure if we have it specifically for that board. Meaning anything you load on it may not have the proper pins available, if it's not specific to that board.

warm flame
#

Then I will have to test all the pins

idle owl
#

I believe we have a guide on adding a board to CircuitPython. If you're up for it, you're welcome to put together a board definition for it and submit a PR to CircuitPython. (I have no idea what your Git/GitHub skill level is.)

warm flame
#

I will have to wait this supper

#

summer

#

Industrial Automation advanced programming is taking most of my time

idle owl
#

No rush! We'll be here when you're ready. 🙂

proven garnet
#

@idle owl I was doing these manually before I remember that computers are a thing. Automating the bulk of checking and commiting the pre-commit reformatting errors, but I'll go through and manually check them and push them tonight for repos that don't require anything else

idle owl
#

Great!

tulip sleet
#

@onyx hinge re unicorn-ing CI status pages, I just got this:

Our engineering team deployed a fix for this behavior today (March 29th), so we expect no further page timeouts to occur when accessing Actions runs.

idle owl
#

@proven garnet I have a different mission for you, if you're up for it.

idle owl
idle owl
# proven garnet I'm all ears

Ok, we have made a number of updates to the libraries over the last however long, and we've been really bad about updating cookiecutter. Your mission, should you choose to accept it, is to run a diff on the CI files in the generated cookiecutter content (i.e. not the CI for cookiecutter itself) against an updated library CI file set, and see if there's anything we missed.

proven garnet
#

Ooo sounds fun, yeah I can give that a shot

idle owl
#

Ok great! It's mostly CI things, but I'm about to update a badge, which I can submit a PR for.

#

But we kind of got behind with updating cookiecutter in general.

proven garnet
#

I'll try to generate a list of repos and maybe some key differences ASAP if that helps

idle owl
#

The repos should, in theory, all be the same. But I guess some of the most recent ones might not be. 😕

#

A list would be good too.

proven garnet
#

Wait, are you asking to see if the generated cookie cutter CI files match what were actually using?

idle owl
proven garnet
#

Ooooh

#

Okay

#

Got it

idle owl
#

So you should be able to diff them against an older library without generating anything with cookiecutter to check.

#

They're in the generating directories, but they should be standard.

proven garnet
#

Got it, will report back when I get a chance to start it

idle owl
#

Thanks!

jaunty juniper
#

speaking of cookiecutter I remember updating an outdated gitignore in adafruit_debouncer

idle owl
#

That's another good one to check.

#

OK, time for food here!

warm flame
#

Risk-V ... what the

#

I am just freaking out for nothing ?

tulip sleet
#

why are you freaking out?

proven garnet
#

Thanks for the reply @idle owl, I submitted an alternative PR but no worries about getting to it tonight. I'll continue patching everything else in the meantime. If that PR is the correct solution, it's probably what's wrong with the ones that need more than black rerun, is my guess.

#

Most of these new black reformatting needs are either changing:

x ** y

to

x**y
#

or stripping spaces on either side of docstrings like " Leading space would be removed"

tulip sleet
#

@idle owl @jaunty juniper @onyx hinge Re pyproject.toml: it is more modern. This is a good explanation: https://stackoverflow.com/questions/62983756/what-is-pyproject-toml-file-for. When I looked into it a while ago, its one deficiency seems to be what is mentioned several places there: that it didn't (originally) support "editable installs" (pip install -e .), which make it easy to develop a project that is locally pip-installed. However, see a new comment that says:

Update 2022: PEP 660 is implemented in pip (from 21.3.0) and some backends, e.g. flit. However no progress in setuptools. –
kap
Jan 8 at 13:50

#

PEP-660 is "editable install support for pyproject.toml". I think when I last looked, that was not true. So maybe pyproject.toml is ready for prime time now, and might be easier to maintain

lone sandalBOT
manic glacierBOT
#
  • Fixes #6213.

  • UART deinit might happen when there is no VM, during reset_board_buses(), so check before trying to free a UART ringbuf that is on the heap. This UART deinit possibility was introduced in #5422.

  • There was a lot of inconsistency about how and whether a buffer could be supplied as the UART ringbuf. Make the code consistent across multiple ports.

  • ringbuf_init() should have been used several places where it was not. There is a fine distinction between the ringbuf buf...

warm flame
manic glacierBOT
lone sandalBOT
manic glacierBOT
solar whale
manic glacierBOT
#

On my M1 Mac Mini running MacOS 12.3

I did a fresh clone of CircuitPython and attempted to build mpy-cross but it fails with this:

jerryneedell@Mac-mini circuitpython % make -C mpy-cross      
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
mkdir -p build/genhdr
GEN build/genhdr/moduledefs.h
QSTR updated
../py/vm.c:742:25: error: array index -3 refers past the last possible element for an array in 64-bit address space cont...
slim portal
#

Is there also a Discord for MicroPython? What is used the most CircuitPython or MicroPython and what are the main differences?

solar whale
#

What version of black should we be using -- I am running into this conflict with the required version of "click" for CP ```Collecting click==7.1.2
Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.8/82.8 KB 1.1 MB/s eta 0:00:00
Installing collected packages: click
Attempting uninstall: click
Found existing installation: click 8.0.4
Uninstalling click-8.0.4:
Successfully uninstalled click-8.0.4
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
black 22.3.0 requires click>=8.0.0, but you have click 7.1.2 which is incompatible.
Successfully installed click-7.1.2

#

I can build CP, but I can't run black...

jaunty juniper
#

what could be the source of click==7.1.2

solar whale
#

It is part of the requirements for building CP

#
sudo apt install python3-pip

# Install needed Python packages from pypi.org.
pip3 install -r requirements-dev.txt

# Force a particular version of click. It does not get updated to the
# proper version sometimes
pip3 install --upgrade click==7.1.2```
jaunty juniper
#

ah in the guide

#

that needs to be updated

solar whale
#

yes -- I see that on Linux black is version 20.8b1

#

It won't work with the most recent click....at least, I don't think so.

jaunty juniper
#

@tulip sleet we need to remove click==7.1.2 in the "Building Circuitpython" guide

#

yeah the requirements-dev.txt pins click to 8.0.4 now

solar whale
#

ah -- I'll try that

#

I see - it was 8.0.4 then it went back to 7.1.2

#

now black is happy

manic glacierBOT
solar whale
#

and I can still build CP

solar whale
#

@jaunty juniper Thanks -- there are so many things to keep track of in the build process....

slim portal
#

Do you run out of RAM quickly when creating a larger MicroPython file? Or can you do quite some larger projects too

stuck elbow
#

we don't really have much MicroPython experience here

#

you can compile files to .mpy to avoid memory overhead of parsing them

#

and of course there is a huge difference in memory available between samd21 and, say, rp2040

jaunty juniper
#

personally I really prefer the CP workflow to MP, having to upload files through the same serial as the REPL is a constant annoyance in MP, and I don't find the dedicated tooling like Thonny to be very good, but other than that it's perfectly fine and it might have features that CP doesn't, or match your workflow better

slim portal
#

Thanks for the answers! (I notice I'm in the wrong channel so I will move to #help-with-circuitpython for further questions 🙂 )

tulip sleet
solar whale
#

On Linux I ran iton an issue with an old version of gitlint -- still wanting click 7.1.2 but I just did pip install --upgrade gitlint and it is now happy -- does the requirements-dev.txt also update gitlint?

onyx hinge
#

@solar whale mpy-cross uses "whatever the system compiler for the local CPU is", so there's a great variety. you just got an upgrade or something, that nobody else had reported yet. doesn't mean nobody else had a problem yet, either.

solar whale
#

Life was simple when everyone used MS-DOS and Borland C....

#

Not really -- it was a nightmare then as well 😉

#

especially when you had to reload the complier from 31 floppy disks...

stuck elbow
#

let's face it, computers are a mistake

solar whale
#

or at least -- using computers isa mistake...

tulip sleet
stuck elbow
solar whale
tulip sleet
#

it would be nice if there was a simple --upgrade-all for pip, but they don't have that. Same for pip list; I have no idea why you can't say pip list click and find out just about click

solar whale
#

pyocd and awscli complained

#

But I don't know why I have them installed

#

they were well out of date -- upgraded and everything seems happy -- or happier

proven garnet
#

@idle owl, @trim elm libraries are all reformatted! I'll do that few that need other touchups next.

proven garnet
manic glacierBOT
winter mortar
manic glacierBOT
#

Okay, finally I am able to put some more time on this.

When using MPLAB X this is the initialize clock settings for when a crystal is expected.

static void OSCCTRL_Initialize(void)
{

    /****************** XOSC1 Initialization   ********************************/

    /* Configure External Oscillator */
    OSCCTRL_REGS->OSCCTRL_XOSCCTRL[1] = OSCCTRL_XOSCCTRL_STARTUP(0) | OSCCTRL_XOSCCTRL_IMULT(3) | OSCCTRL_XOSCCTRL_IPTAT(2) | OSCCTRL_XOSCCTRL_XTALEN_Msk | OSCCTRL_XOSCCTR...
dusty spade
#

Anybody use the circuitpython extsnion for VSCode? I can't get it to run any of the commands from the command palette. Is there some trick to setting it up other than just installing the extension?

proven garnet
proven garnet
#

Was plug and play for the most part on Windows. Sometimes I have to close the window and reopen it to get it to work though.

dusty spade
#

Well, I am on Ubuntu and the command palette items for the extension don;t work

dusk gull
#

I am trying to gather up information on using external clocks, and I am trying to understand why the focus has been on SAM OSC32 source and not the OSC0 and OSC1 sources. In my experience these are the main ones used and the 32K is only when you need higher precision RTC. I am worried I am missing something and I want to make sure I understand. A good example is the Feather M4 CAN, which higher speed CAN (which is how it is mostly used now) want/requires something better than the typical 2% internal clock source. But it does not have an external crystal or oscillator for the OSC0 or OSC1, but it does have a 32K.

idle owl
idle owl
tulip sleet
idle owl
proven garnet
#

That's how I feel about packaging as a whole. I'm trying to learn more and get into it, but sometimes it feels like a hodgepodge of different solutions ConfusedDog

idle owl
#

Packaging is its own special creature.

manic glacierBOT
#

The extern thing made the CI happy @jepler!

I am surprised at your 10-second delay. Have you tried doing this in boot.py rather than code.py? If code.py is large, I guess the compilation might take a while.

Further to this. It does seem like the 10 second delay was just due to the example I was using. I wrote a simpler example and that kicks in within 2 seconds (not accurately measured), so I tried setting the pin in boot.py as suggested. Unfortunately, for whatever reason either the ...

#

So good thing so far is it does look like it is really only one mask bit change.

The hard part is I am not familiar with how this repo is setup, and what pulls from where... so I am doing a lot of digging and trying to piece this together.

Looks like this is where some of the initial clock configs for XOSC0 and XOSC1 are done. It is in the asf4 sub module.
https://github.com/adafruit/asf4/blob/84f56af13292d8f32c40acbd949bde698ddd4507/same51/hpl/oscctrl/hpl_oscctrl.c

What feels ver...

misty garnet
#

@dusty spade like Tekktrik, I often have to close and reopen the program for the CircuitPython commands to work properly in Windows

idle owl
#

@tulip sleet Is it possible to successfully demonstrate asyncio with two NeoPixel rings and one button? Instead of multiple buttons and one ring.

#

Feels like maybe not.

tulip sleet
#

sure, you can make two neopixel tasks. They just have to async.wait(0) frequently

idle owl
#

Oh.

#

Nice! Ok.

tulip sleet
#

you can have three or more tasks

#

tasks are not expensive

idle owl
#

That would simplify the wiring setup, because a bunch of these boards have one built in button.

#

OK, thanks. I will almost certainly need help with the code, but I'm not quite there yet.

#

Not sure if I've ever soldered headers onto a QT Py RP2040.

idle owl
#

@tulip sleet I still don't have headers or rings hooked up (waiting on a meeting that apparently might not be happening... the other person is now 25 minutes late). But I have a question - if I'm using only one button, do I still want to use keypad for its other features? Or do I not bother at that point? The pressed/released feature might come in handy.

tulip sleet
idle owl
orchid basinBOT
idle owl
#

Oof. Forgot to tone down the brightness, because I was initially working with the onboard NeoPixel... just got two full-brightness 16-pixel rings to the face.

#

goes back to code to back it down

blissful pollen
#

Ouch, funny enough I just had 1 full brightness 16 pixel ring to my face and that's bad enough

manic glacierBOT
warm flame
#

I just ordered a dev board with a esp32-c3 on it. And 5 t-oi lilygo (20 to 40 days shipping)

#

I'll get the dev board by tomorroe

#

Tomorrow

idle owl
#

@tulip sleet I made asyncio do different things on two rings that changes while the button is held!

#

No idea if I did it properly.

#

But I made it do Things.

#

Rainbow and blink: button press rainbow reverses and blink speeds up, button release rainbow goes back to forward and blink slows back down

blissful pollen
#

One thing I think could be helpful in a guide is showing people how to stop one or more tasks and move to new tasks. Like a button to move from phase 1 to phase 2. It's not too hard but took me a bit to find

manic glacierBOT
#

Well, according to the Espressif ESP IDF reference manual (at https://docs.espressif.com/projects/esp-idf/en/v4.4/esp32/api-reference/system/esp_err.html#_CPPv49esp_err_t) the ADC on an ESP32S2 is only going to be accurate up to 2500mV. My tests seem to show that past that point the IDF returns a max value. In my tests, applying a voltage of 4.0 to a GPIO pin attached to ADC1, I saw a computed voltage of 5.17395 even going back as far as CircuitPython 6.3.0. So, I'm not sure that the value re...

idle owl
# blissful pollen One thing I think could be helpful in a guide is showing people how to stop one ...

This is going to be an asyncio template to go in all guides. (Which I just realised means I can't use the built-in button, or I need to make two templates.) I don't quite understand what you mean, but I am super not familiar with asyncio, which is to say, I basically know nothing. If it makes sense to put in this template, I'm happy to add it. But I think this is supposed to be simple, so it might make more sense in Dan's guide.

#

Or one template without embedded code, and you have to choose the right example to use an external button versus a built-in button. Anyway, this is template logistics, not specific to asyncio.

manic glacierBOT
blissful pollen
idle owl
blissful pollen
#

if you ever need some examples or such just let me know. I'm still loving asyncio

jaunty juniper
#

I did a test case of running a series of sounds, and pressing a button cancels them. I don't know if task cancelation is supposed to be used/work like that, I was trying to learn about it.
Well it's actually a mock-up, it prints instead of playing sounds

idle owl
idle owl
#

Because I bastardised this code pretty hard to make it do things. There might be WAY better ways to do this.

blissful pollen
idle owl
#

Thanks!

blissful pollen
idle owl
#

In a meeting, or I'd send the code now. It's currently working, and I should probably show it off.

proven garnet
#

@idle owl I'm prepping for the cookiecutter activity. Do you want diffs on just the workflows in the .github folder, or are you looking for more extensive diffs on all the library infrastructure like .pre-commit-config.yaml and things like that?

idle owl
#

@blissful pollen Limor likes the demo. So I should plan to stick with the practical functionality. But that obviously doesn't mean the code can't be changed.

#

Need to dinner soon though.

manic glacierBOT
idle owl
#

Also I realise I could have done that with the LED Animation library, but Limor really wanted a raw NeoPixel asyncio example with two NeoPixel things happening on two separate rings or whatever.

#

Ok, afk for a bit at least.

manic glacierBOT
#

Isn't r->heap supposed to track if the ring buffer is heap allocated? can we re-use that flag instead? I wonder if a quick discord video/audio chat tomorrow would be good to get through the review on this PR @dhalbert feel free to ping me after 10 your time or so.

We were checking r-heap to only free a heap-allocated before, but there was a new possibility introduced by #5422 that deinit() was getting called after the VM stopped. So if you call gc_free() at that time, it throws an ...

manic glacierBOT
proven garnet
#

Got all the git diffs on these libraries, now to just parse them

#

Hopefully faster. Maybe. shrug

lone sandalBOT
timber mango
#

hi I am working with the ST25DV16K, this Adafruit board is wonderful, but it turns out that I have problems to read with android cell phones, it does not recognize the message and says it is empty. But with the Iphone it works, could someone help me to see what the problem is?

timber mango
#

i found 🙂

stuck elbow
#

what was it?

marble hornet
#

@mental nexus , saw your stemma qt socket on the hackaday news letter, very cool!! (And congrats on getting featured😊)

blissful pollen
proven garnet
#

@idle owl I wrapped up the diff comparison! I have the results, but maybe you want to meet briefly either in a voice or thread channel today to go over it so I can communicate it better?

#

Edited but also happy to do a a dog comparison, honestly cooldoge

manic glacierBOT
#

We might consider making that attribute read-only, since as you say, it's not clear why you'd want to change it. We could make it read-only just on espressif, but we try to avoid chip-specific idiosyncrasies if they are avoidable. This is an incompatible API change so we we might make it read-only on espressif now and then read-only on all ports in 8.0.0.

@jepler do you have an opinion about this?

manic glacierBOT
#

I don't mind if you do this. I can't think of any super plausible reasons to change it at runtime (but https://hackaday.com/2022/03/13/haptic-smart-knob-does-several-jobs/ is cool! and probably not something you'd implement in CircuitPython)

The alternative is to always use the "count every quadrature transition" mode and slightly refactor shared_module_softencoder_state_update into two parts: the one that takes care of acting on transitions, and the one that takes care of maintaining th...

onyx hinge
tulip sleet
#

I think the main other bug is in the broadcom port, which is not crucial to fix at all

#

maybe also stm

onyx hinge
#

oh the non-use of "ringbuf_init"?

tulip sleet
#

no, missing checks of allocated_buffer

onyx hinge
#

I wonder why ringbuf_free has to do anything, it could just NULL the pointer and let GC take care of it.

tulip sleet
#

it's not re-running when I re-point the base. I don't trust this to work right. I will put it back, close it, and do cherry picks

#

it could, I was thinking of that, but I thought not to do it. Let me remember why, which may take a few minutes

onyx hinge
#

OK, and maybe you can try again to tell me why allocated_ringbuf is needed, when there's r->heap, because I have still not understood it I guess.

manic glacierBOT
tulip sleet
#

@onyx hinge let's talk about this in a few minutes; I need to eat breakfast

mental nexus
tulip sleet
#

@onyx hinge ok ready to talk, audio channel?

onyx hinge
#

sure

timber mango
timber mango
# stuck elbow what was it?

I am sending data to the NFC st25dv16k , to then read it with the cell phone, all the time I read it with the iphone 10, and I had no problem, but then I tried it with the android and it didn't work. I tried to find the error but it was not easy. In the end I added a space to the url and then it works for both iphone and android.

manic glacierBOT
timber mango
tulip sleet
#

@onyx hinge nothing is ever easy. It turns out the static board. objects were not being gc'd.

#

not in the root pointers list or part of a _gc_collect() routine

onyx hinge
#

uh oh, so the buffers could get freed anyway? ouch

tulip sleet
#

yes, and I managed to hit that while testing

onyx hinge
#

hooray for testing

#

it would have been easy to write a test program that didn't generate enough garbage, or that you wouldn't notice 😕

tulip sleet
#

my test ran for 867 iterations, and then always stopped

#

crashed

onyx hinge
#

https://blog.adafruit.com/2022/03/31/compose-with-markdown-in-google-docs-on-web-google/ hum I wonder if this'll complicate our deliberate insertion of markdown in the notes document

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

In Google Docs, you can now select “Automatically detect Markdown” from Tools > Preferences to enable auto correcting for Markdown syntax, a lightweight markup language for applying formatting u…

crimson ferry
#

When we freeze in libraries, I wonder if there are ways we can advertise this to- new and existing users... update the guides, include a statement on the libraries page on .org , readthedocs, other?

tulip sleet
#

like we have a list of included native modules?

crimson ferry
#

yes, there was some confusion helping someone with a PyPortal (and I didn't even know my PyPortal had frozen libs)

#

and it has changed over time, so that's going to be a point of confusion

tulip sleet
#

I think there may even be an issue for this in circuitpython-org or circuitpython

crimson ferry
#

OK, thanks, I'll look

#

we need to train people about putting libraries in root for library features newer than the circuitpython release

orchid basinBOT
#

I think it may be a broader issue than this. Frozen libraries may change over time, and this may be a point of confusion for new and existing users (we had confusion over this with a PyPortal issue on Discord).

Perhaps Learn Guides, readthedocs, and circuitpython.org all need prominent notices about frozen libraries. And we may need to train people to put libraries in the root of CIRCUITPY if they need a library feature that's newer than the most recent (stable?) release.

#

I think it may be a broader issue than this. Frozen libraries may change over time, and this may be a point of confusion for new and existing users (we had confusion over this with a PyPortal issue on Discord).

Are you referring to the fact that we may have CircuitPython 7.2.3 on a board with one set of frozen libraries and 8.0.0-alpha1 with a different set?

orchid basinBOT
idle owl
idle owl
#

@tulip sleet I guess it's probably easiest if I make a PR to Learn with my asyncio code? Then you can literally review it instead of me simply pushing it to my fork and you telling me what you think (which was my first plan).

tulip sleet
idle owl
#

Thanks!

proven garnet
idle owl
proven garnet
#

No, I uploaded everything needed to a public folder in my Google drive

#

I'll get setup

idle owl
#

Nice ok

idle owl
#

@proven garnet So we're not sure what level of access is needed to run patches. Good chance write access is enough. But easy enough to find out by having you try. So we'll teach you how to do it, and have you give it a try. Might need admin access though, in which case it will fail for you. 🙂 We'll set up a time soon, maybe once you have the list of patches ready.

#

@tulip sleet I'm documenting this code. How do I describe Controls? py class Controls: def __init__(self): self.reverse = False self.wait = 0.0 self.delay = 0.5

tulip sleet
#

@onyx hinge reason for PR delay: the problem I am seeing is not GC, it's that the default UART tx pin is pin 0 😕 😬

idle owl
#

Also, am I right in thinking that even an external button doesn't need digitalio if using keypad?

tulip sleet
#

right, you give keypad pins, not digitalio's

idle owl
#

perfect. Makes this template code a lot easier to sort out.

#

Thoughts on documenting Controls?

tulip sleet
#

it is the "knobs" you can vary to change the animation. You could call it AnimationControls, if that makes it clearer

idle owl
#

That would be good. Thank you.

idle owl
tulip sleet
idle owl
tulip sleet
#

ah got it

idle owl
#

So, when the template code is submitted for the template usage, it doesn't have instructions in it.

tulip sleet
#

@idle owl on CPB, the builtin buttons are active high, is that right (I remember that from CPX, maybe I'm wrong)

idle owl
#

Is that the only board for which that is true?

#

I can make two examples, and refer to both in one template, as a "Choose the one that matches your buttons"

#

I feel like FunHouse is like that or something.

tulip sleet
#

I dunno, maybe check magtag? Not sure what else

idle owl
#

Maybe I'm wrong.

tulip sleet
#

right maybe funhouse

idle owl
#

Ok. I'll look into it and create a second example.

tulip sleet
#

so it changes only while the button is held down

#

for that, you don't even need debouncing, cause there's no real state

idle owl
#

I'm confused then

tulip sleet
#

but maybe leave in because it's more transferable to other examples

idle owl
#

keypad?

tulip sleet
#

yes

idle owl
#

Ok

#

I'll change line 61, right? value_when_pressed=False would be True ?

onyx hinge
idle owl
#

I mean, I'm probably the only person using this, so I can probably add an instruction in the docstring to change it for certain boards.

#

And not have whole second example.

tulip sleet
#

right, that's for CPB. but I'm talking about the example in general. It does slow reverse only while the button is held down

#

lines 65-70

idle owl
#

right

#

oh you mean this in general didn't need keypad?

tulip sleet
idle owl
#

I totally agree leaving it in makes more sense so folks can add more buttons more easily. Or whatever.

tulip sleet
#

press once to reverse. Press again to go back to original state

idle owl
#

Hmm.

#

I think this is ok.

tulip sleet
#

I think so too

#

less complicated, I just wanted to make sure the intent is that you have to hold the button down

idle owl
#

Yeah that's what I was doing.

#

(I'm adding more instructions to the example though for active high buttons)

tulip sleet
#

I will not necessarily fix that now. I'm still trying to figure out why GPIO0 for TX is making it crash hard

#

I don't see any obvious problems. I did find a bug in .in_waiting that didn't re-enable the IRQ when trying to guard the ringbuf. Looks like a copy pasta bug

#

oh, wait, yes, there is a bug... if there is more than one UART it will not GC the second one

idle owl
#

OK so wait, if setting up the button is a Pull.DOWN, is it active low? The FunHouse lib is Pull.UP, magtag and CPB are Pull.DOWN. So I am a bit confused.

tulip sleet
#

if you ground the button when you it's pressed, then you would use pull.up

idle owl
#

ohhhhh.

#

I can't seem to ever remember this. As in, I have to ask every time. Sigh. 😕

tulip sleet
#

i do a mini-rederive in my head every time. If the pin is not pushed, then it is unconnected, so the pull should be opposite of what the other end of the button is connected to

#

so if the button is connected to ground (low), then without being pushed, it should be default high

#

basically I am thinking voltages

idle owl
#

hmm ok

tulip sleet
#

the pull gets overriden by the hard "pull" of closing the button when it's pushed. Pushing the button is like connecting a zero-ohm resistor to either ground or +v

#

the pin pull is a non-zero resistance

#

more current goes through the zero-ohm resistor, so it wins

gloomy shuttle
tulip sleet
#

@onyx hinge see slack if you have not already

onyx hinge
#

thanks, answered

idle owl
tulip sleet
#

@idle owl maybe we need board.BUILTIN_BUTTONS_ACTIVE_HIGH True or False or something like that. Or the active low buttons should be called BUTTON_INVERTED

idle owl
#

Hmm.

stuck elbow
#

board.NOT_BUTTON

idle owl
#

That could apply to literally every other pin.

tulip sleet
#

If the former, then you can query the board and set your pulls appopriately.

stuck elbow
#

board.MAYBE_BUTTON

tulip sleet
#

board.UPSIDE_DOWN_BUTTON

stuck elbow
#

UNBUTTON

tulip sleet
#

boards.BUTTONS_ARE_OPPOSITE_OF_WHAT_YOU_THINK

stuck elbow
#

THIS_IS_NOT_THE_BUTTON_YOU_ARE_LOOKING_FOR

#

just call it board.GOTCHA

jaunty juniper
idle owl
jaunty juniper
#

the MagTag uses pull ups, but in the mean time we discovered that deep sleep wake-on-pin works better with pull down, which is why the FunHouse has pull downs

#

the pull is the rubber band that holds it in the default position until you activate it

idle owl
#

I also didn't know the term "default" was in the mix until today.

#

I'm hoping now having a term for both statuses will make it stick in my head.

#

Not holding my breath though.

jaunty juniper
#

but wait for it, if it has an external pull, it will overcome the internal one, and then the value of button.pull becomes irrelevant

idle owl
#

@tulip sleet Do you want to do an official review on that PR? Or not concerned about it?

crimson ferry
#

(assuming the external pull is lower resistance than the internal... likely)

tulip sleet
#

I was just finishing, multi-tasking too much

idle owl
#

Ok thanks, Anne was asking as she would merge it if needed.

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 7\.2\.4
onyx hinge
#

thanks Dan!

manic glacierBOT
idle owl
#

@tulip sleet So..... I had a variation of this line of code (ring_two[:] = [(0, 0, abs(ring_two[0][2] - 255))] * num_pixels) from part of a guide explaining NeoPixel blink on a CPX to show the difference usually shown using standard red LED blink code and led.value = not led.value red LED blink code. But because the code was using NeoPixels, I felt the need to show it using NeoPixels. I, um... clearly had help writing that line of code, and had help updating it to blink a whole ring instead of a single LED. In the guide I pulled it from, I explained abs, but totally glossed over the code that cycles the blink animation. Which figures because I don't really understand it now, meaning I definitely didn't understand it then. So, I'd like your thoughts: Do I gloss again since the point of the example is to use asyncio, not explaining blink animations? Or should I explain it?

tulip sleet
#

You could do blink by filling with a color and then another color (or black). That would be a lot easier to comprehend

idle owl
#

I don't know why.

tulip sleet
#

it should work, there is some other issue, then

idle owl
#

It wouldn't blink.

#

Hmm. I'll try it again.

jaunty juniper
#

the issue is that you have to save the state to know what color to switch to

#

making it more complicated than not

idle owl
#

I must be doing it wrong.

tulip sleet
#

i have to be afk but will be back

idle owl
#

It's not blinking this time either.

#

Ok.

#

Added another show() and now it is mostly blue, and flickers off for a moment intermittently.

#

So it's not blinking really.

#

But at least it turned on....

jaunty juniper
#

I can take a look

idle owl
#

Let me try moving the first show

#

That fixed it.

jaunty juniper
#

👍

idle owl
#

Normally one show() in a single function works. I didn't expect to need two.

#

Or know they needed to be inside the asyncio.sleep() bits.

#

Pressing button successfully blinks faster.

#

Ok, I'll do this instead.

#

I like my fancy line of code, but don't relish explaining it.

jaunty juniper
#

I wouldn't expect to need two

idle owl
#

It doesn't work without both.

#

This works. py async def blink(animation_controls): """Blink animation on ring two.""" while True: ring_two.fill((0, 0, 255)) ring_two.show() await asyncio.sleep(animation_controls.delay) ring_two.fill((0, 0, 0)) ring_two.show() await asyncio.sleep(animation_controls.delay) await asyncio.sleep(animation_controls.wait)

#

Otherwise, it seems to ignore one part or the other.

jaunty juniper
#

oh ok yeah that's normal, i thought you were doing something similar to the previous version by "switching the color" in a single place

idle owl
#

No.

#

That's what I took out 😄

#

Because it's not as understandable.

#

This is "typical" blink code.

#

And therefore will not need a specific explanation.

manic glacierBOT
jaunty juniper
#

yeah and that's the thing with asyncio, since it's its own loop on the side, you can write it as a linear code, without having to bother with having something else happen in-between

idle owl
#

hmm

#

I will almost certainly need help explaining the asyncio part of this example. I don't understand it at all.

#

Getting close to that point.

blissful pollen
#

Is there a specific part you're looking for help explaining?

idle owl
#

Well... I explained everything up to the async def rainbow_cycle(animation_controls:) I realised I was about to gloss over the async part of it, and say something like "here's the animation code" but that kind of defeats the purpose of the template.

#

Let me get the updated code onto GitHub so I can send you the latest version of it.

blissful pollen
#

Sure, reading back a bit I just got home

idle owl
#

I might have to bail soon for dinner, I'm not sure what the plan is there.

#

In fact, let me afk for a moment to check to see if we came up with anything. BRB.

#

No plans. And everyone in the house is busy with something or other. So maybe it's snack dinner. 🙄

blissful pollen
#

No problem, I can put some thoughts down. I really liked Dan's guide (I learned from it to start). So it has lots of good info.

I think to break it into parts is good. You create tasks, you start co-routines and you pass control information around. Kinda backward to the layout of the code, as the tasks are created last in the code (but first when running if that makes sense).

idle owl
#

It doesn't make sense, but I can see it in the code.

#

I mean, it kinda makes sense.

#

But I can see it practically speaking in the code.

blissful pollen
#

The way I think of it, is when I create a task I start that function running. So I create a task for every function I want to run concurrently (glossing over the fact they're not actually running simultaneously). And then the asyncio.gather(...) function will run until all the tasks have finished (beginner guide so ignore that you could cancel tasks for now)

idle owl
#

Run and repeat, right?

blissful pollen
#

So the main function creates everything I want to run at the same time and then waits until each function finishes (or in this case never does finish)

#

The await keyword to me really just says "Hey I'm taking a break let someone else run for now". In most of the example it is calling sleep (sleep(0) when it just wants to give up control politely like giving someone else a turn vs actually needing to sleep)

idle owl
#

hmm

#

Ok

blissful pollen
#

And probably worth mentioning putting async in front of the functions is just a way of saying "this function uses asyncio" (It probably means more technically - I don't know 🙂 )

idle owl
#

I like that explanation

#

@proven garnet Wow. That's massive.

#

@proven garnet Do you know what all of that is referring to or is a bunch of it out of your wheelhouse?

proven garnet
#

Haha yeah, a bunch of it probably comes from one-offs, I could do some more digging if need be

idle owl
#

Because, it would be worth dividing it up with comments as headers to sort of make it more readable. But only if you kind of know what everything does so you even know what headers to make.

#

Some of this can go, as well, imo. I'll review it tomorrow.

proven garnet
#

To be honest? Not much of it. Some things I know, others I could guess, and most is beyond me haha

idle owl
#

Leave it in draft for now.

#

Ok, no worries.

proven garnet
#

Sounds good. Is the best way to PSA this via In The Weeds? Didn't think pinging was a good idea haha

idle owl
proven garnet
#

Sweeeeeet

#

Thanks!

blissful pollen
#

brb

idle owl
idle owl
#

Apparently I should read this more thoroughly. 😕

blissful pollen
#

It took me a while to really get it myself

idle owl
#

Also need to find out if I should be copying info from this guide into the template page, or if I'm simply glossing over most of it and linking to the guide at the end. Or something in between.

#

Will find out tomorrow.

#

@blissful pollen I pasted your notes into a notes section for myself to have for the guide template if it makes sense. Thank you for the explanations.

blissful pollen
idle owl
#

Agreed. The in betweeny method.

#

@blissful pollen Are the animation code blocks functions or methods? I'm.... fuzzy on the distinction.

blissful pollen
#

I believe they are functions as they do not belong with an object (class)

idle owl
#

Ohhh.

#

Got it. Thanks!

tulip sleet
#

and the blinking is really obvious

idle owl
#

Needed more show() in the right places, was why it didn't work before.

#

So it's a little different than normal when async is involved, apparently.

#

But I figured it out.

tulip sleet
#

if you replaced all those with time.sleep()'s, it would still blink

#

you just couldn't control it as easily

idle owl
#

exactly.

#

Which is almost what I did the very first try, but realised that was blocking and couldn't be the right way to do it.

#

So I pulled more from your code.

#

Feel free to merge the PR.

#

Thank you!

#

And I can forever be annoyed that I misspelled "simplify" in my commit message until I have to update the example again.

#

Should have amended it when I noticed, but eh. I let it ride.

#

Fixed the PR title anyway.

idle owl
#

@blissful pollen You said this the other day: I wonder if a note or something about "what if my program ends when you said it runs forever". I have a feeling a mistake that will get made a lot is where a coroutine ends (say the while True loop is forgotten) and then things stop. I just foresee that question coming up a lot. I'm wondering exactly how to word this note in the guide?

blissful pollen
#

Give me a minute I'll think about it

idle owl
#

@tulip sleet Thanks for the feedback on the .gitignore PR. I'm bringing it up In the Weeds on Monday. It is intended to be a group decision.

manic glacierBOT
#

CircuitPython version

All CircuitPython versions: 721, 722, 723, absolute newest, ...20220331-d9418fb.uf2

Code/REPL

none

Behavior

After copy of cp 72x onto S3DKC1BOOT and reboot, device remains in boot mode.

see https://forums.adafruit.com/viewtopic.php?f=60&t=189819

Description

No response

Additional information

SEPARATE ISSUE

Board INDEX.HTM needs revision:

points to user-guide-devkitm-1.html

should be user-guide...

idle owl
blissful pollen
# idle owl Thanks. I have a notary coming in 5 minutes, then dinner was worked out, so I'll...

My program ended? What happened?
await.gather(...) runs until all the listed tasks have finished. If gather returns that means all the tasks listed have finished.
The most common causes of a task ending are: an exception occurred causing the task to end, or the task function finished. If you want to ensure the function executes forever have a loop that never ends in the function (e.g. a while True loop)

Still may need some massaging in the wording. Or even a short over simplified example of a async function with a while True loop.

idle owl
#

Thank you!!

manic glacierBOT
idle owl
#

or is that too simple.

#

and not actually valid.

blissful pollen
idle owl
#

Ah ok

#

Thanks!

blissful pollen
#

I think most people will get that example

idle owl
#

Right on. I really appreciate your help!

blissful pollen
#

No problem. I just went through all this myself so that's helping me explain it

idle owl
#

I'm happy to leverage that! 😄

blissful pollen
#

I never want to write a main loop with all sorts of time.monotonic() - last time > 0.1 to try to coordinate timing of several tasks again 🙂

idle owl
#

Hah that's fair. I might have to break out of that too.

jaunty juniper
#

your code here

idle owl
#

I can't say I grasp this more than superficially with what I explained.

#

But this template is getting pretty solid, I think

#

Might include Dan's summary from his guide.

#

Covers the basics in a bullet list.

tulip sleet
idle owl
#

Thanks for doing the release, @tulip sleet!

blissful pollen
#

I think you can really see the power if you try to write non-asyncio code to do the same as your demo, rotate a ring and blink another at different rates. The timing becomes a nightmare

idle owl
#

I'm not sure it's worth including in this template. I'll link folks to his guide for that in depth stuff.

#

Need to get a GIF, add a few more notes, and link to Dan's guide before this template is ready for primetime.

blissful pollen
#

Yup it's a good thought exercise if nothing else. At least helped me when I started writing it before going "let's see what this asyncio does"

idle owl
#

I think I'll get two GIFs, one for a built in button, one for external button, and upload them to GitHub, and then embed them directly from there, if that's even possible. I'll find out.

#

Otherwise the GIF won't match. I'm not supposed to do one for every board guide, but I feel like it should at least look like the wiring setup in the guide.

#

I'm grateful to only do it once (or twice).

idle owl
#

Alright I think dinner is home and in need of reheating, so I am headed out.

#

Thanks again for all the help!

blissful pollen
#

Enjoy! You are welcome

manic glacierBOT
#

I hacked the ESP-IDF to use m_malloc and now I can draw pixels to the screen (hard coded in the init function). I will now try to get draw function working in CircuitPython.

Note: One observation after drawing some pixels to the screen, is that everytime I enter a command in the REPL, the display shifts. I suspect something is going weird with the timing of the RBG signals but I haven’t looked on the scope. Add this to the to-do list.

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 7\.3\.0\-beta\.0
orchid basinBOT
#

Automated website update for release 7.3.0-beta.0 by Blinka.

New boards:

  • adafruit_qtpy_esp32c3
  • espressif_esp32s3_usb_otg_n8
  • lilygo_ttgo_t8_esp32_s2_wroom
  • espressif_esp32s2_devkitc_1_n4
  • hexky_s2
  • lilygo_ttgo_t-01c3
  • lilygo_ttgo_t8_s2
  • adafruit_feather_esp32s3_nopsram
  • espressif_esp32s3_devkitm_1_n8
  • challenger_840
  • ssci_isp1807_micro_board
  • ssci_isp1807_dev_board
  • pimoroni_badger2040
  • pimoroni_servo2040
tulip sleet
manic glacierBOT
manic glacierBOT
onyx hinge
#

@tulip sleet the (pico-specific?) rp2040 uart gpio00 bug, did you file an issue yet? I wasn't sure how to reproduce, but wanted to look at it

#

[about to step away for an hour, but I'll read back]

tulip sleet
jaunty juniper
#

I'm not clear on the "never reset" thing. In status_led.c we do this for each color component:

        if (PWMOUT_OK == red_result) {
            common_hal_pwmio_pwmout_never_reset(&rgb_status_r);
        }
tulip sleet
#

this means don't reset the pin to a known state (usually GPIO input, often floating, sometimes not) when restarting the VM

#

just leave it alone. That is, its state is persistent across VM instantiations

jaunty juniper
#

it only does that for the PWM pins it seems

#

and I get that on the C3 if I enable the status LED (which is PWM)

Traceback (most recent call last):
  File "code.py", line 17, in <module>
  File "adafruit_rgbled.py", line 107, in __init__
RuntimeError: All channels in use
#

after a reload (it works on the first run)

tulip sleet
#

in this case the PWM objects should be preserved and reused so they can be used for status. It sounds like something is not noticing that and is trying to re-create them

jaunty juniper
#

shouldn't the PWM objects be deinited like the pins are, with the current way of doing the status LED ?

tulip sleet
#

maybe so. I haven't looked at that bug yet

jaunty juniper
#

keeping the PWM object when the status LED is not used by CP on the C3 would terribly starve the user code of PWM peripherals, wouldn't it ?

tulip sleet
#

i agree, it should probably just shut down the status LED. Or it could steal the peripherals away when needed.

#

this is not the qt py, right, it is one of espressif's boards?

jaunty juniper
#

the AI Thinker board, with PWM status LED

tulip sleet
#

so how would we report status issues that are normally reported via neopixel colors, etc.? How many PWM periphs are there?

jaunty juniper
#

I assume like the others, setup the peripheral when we need it, deinit it when the user code runs ?

tulip sleet
#

and grab it back when there's an exception, etc. to indicate

jaunty juniper
#

we don't "never_reset" the neopixel data pin for example

tulip sleet
#

try it the other way, and see if it works out, is what I would do

proven garnet
#

@idle owl depend on adabot's capabilities, I've checked out this library and it's pretty good at editing YAML files. Would need some massaging afterward, but whatever adabot can't path for those I'm extremely confident should be doable that way.

https://pyyaml.org/wiki/PyYAMLDocumentation

jaunty juniper
tulip sleet
#

try writing a program that raises an exception

#

or otherwise has an error (syntax error, etc.)

jaunty juniper
#

ctrl-C gets the LED to blink red

tulip sleet
#

sounds good

jaunty juniper
#

I get the green one, it's not white in the REPL

orchid basinBOT
solar whale
#

Is the QTPY ESP32C3 build still having known issues with the REPL? I am having trouble accessing it via rshell. Via screen or tio, I get to the REPL, but seem to be dropping some characters... I was curious if you wanted issues files on this yet or if it just needs more time. It is not a problem, I was just trying it out. The ESP32C3 devkit works well with rshell (modified to us binascii) but the QTPY ESP32C3 hangs when connecting to the REPL.

jaunty juniper
#

The LED PWM controller can generate independent digital waveform on six channels

solar whale
#

note the messy formating on teh REPL ```tio 10:59:29] tio v1.32
[tio 10:59:29] Press ctrl-t q to quit
[tio 10:59:29] Connected
Adafruit CircuitPython 7.3.0-beta.0 on 2022-04-01; Adafruit QT P
Adafruit CircuitPython 7.3.0-beta.0 on 2022-04-01; Adafruit QT Py ESP32C3 with ESP32-C3FN4

help('modules')
future collections neopixel_write terminalio
main digitalio onewireio time
_asyncio displayio os touchio
_bleio errno pulseio
adafruit_bus_device espidf ulab
adafruit_bus_device.i2c_device fontio rainbowio ulab
adafruit_bus_device.spi_device framebufferio random ulab.fft
adafruit_pixelbuf gc re ulab.linalg
analogio getpass rgbmatrix ulab.numpy
array gifio rtc ulab.scipy
atexit i2cperipheral sdcardio ulab.scipy.linalg
audiocore io select ulab.scipy.optimize
audiomixer ipaddress sharpdisplay ulab.scipy.signal
json socketpool ulab.scipy.special
bitbangio keypad ssl ulab.utils
bitmaptools math storage uselect
board mdns struct vectorio
builtins microcontroller supervisor watchdog
busio micropython synthio wifi
canio msgpack sys
Plus any modules on the filesystem

jaunty juniper
#

hmmm I haven't noticed something like that on the AI thinker C3 (yet)

solar whale
#

No isses on the esp32c3 devkit wither

#

REPL is clearly funky. Tryin to cut/paste into it is losing characters.

onyx hinge
#

I can't imagine why any c3's usb/repl would behave differently than another. it's a good puzzle.

solar whale
#

there is some stuff about Serial/JTAG that seems to be unique to the QTPY

jaunty juniper
#

we have pasting issues with tio on NRF52

solar whale
#

it seems better in screen -- import wifi seems to kill it.... just hangs

jaunty juniper
solar whale
#

still not right in screen either. but import wifi is clearly broken.

#

I also had problems with wifi on the QTPY ESP32C3 with Micropython.

jaunty juniper
#

are the wifi issues specific to the QTPY too ?

solar whale
#

yes -- works ok on the ESP2C3 devkit.

#

That's why I just was curious if the QTPY was not yet ready for users.

#

I don't want to create issues before it is appropriate.

manic glacierBOT
#

Started playing again with circuitpython on the Teensy 4.1, and one of things on the todo list was to be able to set the arm clock with the python sketch. So far I converted the Teensy 4 clocks.c set_arm_clock function to work and compile with circuitpython without errors, updated clocks.h and processor.c in commonbindings. See: https://forum.pjrc.com/threads/59040-CircuitPython-on-Teensy-4!?p=303483&viewfull=1#post303483 but looks like I have to edit processor.h and processor.c in shared-b...

tulip sleet
jaunty juniper
#

ok, so far I tested the version without never_reset on the AI thinker C3, Pimoroni tiny2040 and Xiao BLE sense and it seems to do the color blinking as expected, or at least not worse on the NRF52 than it did in issue 6061 (in which I did test removing the never_reset too at the time, with a minor effect of making "All timers in use" happen a few pins later)

onyx hinge
tulip sleet
#

i was also working on spirals

jaunty juniper
#

.si ti yaw eht tcefrep s'ti kniht I

lone axle
#

I'm kind of tempted to make something that will parse and execute CircuitousPython.

onyx hinge
#

https://en.wikipedia.org/wiki/Boustrophedon This literally was a thing in the past

Boustrophedon is a style of writing in which alternate lines of writing are reversed, with letters also written in reverse, mirror-style. This is in contrast to modern European languages, where lines always begin on the same side, usually the left.

The original term comes from Ancient Greek: βουστροφηδόν, boustrophēdón, a composite of βοῦς, b...

tulip sleet
#

latest Segger J-Link release (V7.64) says it fixes:

  • [DLL]: Raspberry RP2040: Reset did not work properly. Fixed.
onyx hinge
#

I especially liked getting to raise (-1) to a power

onyx hinge
#
#!/usr/bin/python3                                                              
# a legal boustrophedon program #                     # margorp nohtpy lagel a #
(lambda f=open(__import__("sys").argv.pop(1)):exec("\n".join(line[::(-1)**i]   
       
    for i, line in enumerate(f.read().split('\n')))))()                         

and also a version that can go in a #!-line on linux systems (and maybe others) so that you can invoke your .by files directly:

#!/usr/bin/python3 -c(lambda f=open(__import__('sys').argv.pop(1)):exec('\n'.join(line[::(-1)**i]for i, line in enumerate(f.read().split('\n')))))()#!```
proven garnet
#

Speaking of obvious improvements on April 1st, I had the misfortune of visiting Stack Overflow today and ow my eyeballs.

dusk gull
#

I think I have hunted down most of what I need to know and where to get started related to suggesting change to clock setup to allow more options for XOSC0 and XOSC1 and whether or not they are crystals.

I do feel like having somebody that worked more in CircuitPython give more direct feedback would help with context and making sure am headed down the right path.

If somebody that had more knowledge of the clock setup sections of the SAM chips had even 10 minutes I feel like that would help me a great deal.

#

I also understand everybody's time is valuable and I am happy to be invoiced for effort.

stuck elbow
tulip sleet
dusk gull
# stuck elbow sounds like a good subject to bring up in the "in the weeds" section of the week...

Just keep in mind I am not an Adafruit employee. I have worked with Micropython but has moved mostly to SAM chips now (specifically E51) and have clients wanting Circuitpython. I am new to CircuitPython but have been working with Micropython for years. I am not a super strong C developer, so I am always nervous to do pull request, however I have a pretty good idea on what I want and need.

I am also assuming that most people just use adafruit boards, but I am looking for Circuitpython to be flexible enough custom boards is easy. I have worked with Micropython and Damien to help move things that way but still see limitations on the Circuitpython side.

Short answer I am not sure I could be in that meeting, but want to help and willing to contribute even if it is just money to help more advanced designers/developers have features they need.

tulip sleet
#

it is not money at all, it is time and resources (people)

stuck elbow
#

the most precious resource: human attention

#

shockingly, most people here are not Adafruit employees

dusk gull
# tulip sleet I suggest you just go ahead and make a PR. We have certainly worked on that code...

Totally understand, not that I have a lot of money, but I also have more money than time. Freelancer working on multiple development projects. I just know it can be easier to focus when it is not a favor and paid for.

I am mostly trying to figure out design intent. There is some things that happened that is limiting, so I worry that doing it well would be a much bigger project, over just getting it to work.

Definitely some of this is me being hesitant to break something and not know it.

tulip sleet
#

for me at least, it is a lot easier to offer suggestions about how to modify a proposed change than to do it from whole cloth

dusk gull
# tulip sleet for me at least, it is a lot easier to offer suggestions about how to modify a p...

Very true, and I would agree. I think I am still wrapping my head around what is there and why, so I know how best to modify it. That said sometimes you just need to start tearing into it.

I guess that is really more of what I am asking, if somebody had a little time to go over what is there and how it works now, so I can make my suggested edits.

Again totally understand people are busy and this is just not something anybody here can/wants to worry about.

tulip sleet
#

I am not sure they are still correct, but see the top few lines in circuitpython/ports/atmel-samd/asf4_conf/samd51/hpl_gclk_config.h, and see ports/atmel-samd/peripherals/samd/clocks.c and peripherals/samd/sam_d5x_e5x/clocks.c. ALso see this PR: https://github.com/adafruit/circuitpython/pull/888

dusk gull
dusk gull
dusk gull
tulip sleet
dusk gull
tulip sleet
dusk gull