#circuitpython-dev
1 messages Β· Page 25 of 1
and the nightly links are 404 π€
it hasn't changed much
ok, so pip install pysigrok-hardware-raspberrypi-pico
should be version 0.1.0
ok to use venv?
should also install pysigrok
yup
it should pull in pyserial too
but I may not have the deps set right
$ python3 -m pip install pysigrok-hardware-raspberrypi-pico
Collecting pysigrok-hardware-raspberrypi-pico
Downloading pysigrok_hardware_raspberrypi_pico-0.1.0-py2.py3-none-any.whl (5.3 kB)
Installing collected packages: pysigrok-hardware-raspberrypi-pico
Successfully installed pysigrok-hardware-raspberrypi-pico-0.1.0
maybe not?
ah ya...
can just work around it for now. anything else other than pyserial?
U-ing π (-U)
that worked. also grabbed click looks like
pysigrok-cli -d raspberrypi-pico:conn=/dev/ttyACM2 -C GPIO16 --samples 1000 -c samplerate=1000000 -o test.sr
yup click is needed for pysigrok
pysigrok-cli --list-serial to find the right name
/dev/ttyACM2 - Pico - Board CDC is mine
the first command will capture to the test.sr file which you can then open in pulseview
pysigrok-cli --list-supported may be helpful too
ModuleNotFoundError: No module named 'importlib_metadata'
what version of python?
i could upgrade too. no reason i'm at 3.8 other than just haven't upgraded.
I can add importlib-metadata as a dep and it should work back to 3.7
ok. i'll hold off then. can be your test case for <3.10
ok, pushed a new pysigrok version
$ pysigrok-cli --list-serial
Available serial ports:
/dev/ttyS4 - n/a
/dev/ttyS0 - ttyS0
/dev/ttyACM0 - Pico - Board CDC
that sets min python to 3.7 and adds importlib dep
just confirming it works with a manual install of metadata lib
i'm going to just dump this venv and start over to test the deps.
(should I make a pysigrok channel?)
yep - agrees with dmesg π
it has the pyserial bug that we fixed 2 years ago but was never merged but I would use discotool to find the serial port anyway π
ok, looks like the dep stuff is working ok now.
(where on mac the ports have the same name)
let's move there
With the help of the decoder I have deducted that yea pystack cannot be resizable.
The value is stored in bss.
Not sure what that is, but doesn't sound fun to play with.
And btw main wasn't happy either with getenv included.
It's up to you guys.
I am not putting any more time into this.
Thanks for looking into it @brazen hatch
Based on internal discussions, this is also affecting Arduino. Internal testing indicates that reducing the drive strength on the #16-23 pins to 2mA seems to fix it.
LiPoly chip changed from LC709203 to MAX17048.
It also breaks this part of the guide: https://learn.adafruit.com/adafruit-esp32-s2-tft-feather?view=all#measuring-battery-3122383
I've been doing some tests on displayio speed ups tangentially to the GIF work I've been doing. Is there a pre-existing issue where I could post about my results? If not I can create a new one.
I couldn't find one search so just checking as I know jepler did some work previously looking at this.
This appears to fix the scorpio problem (closes #7515) and only mildly affected a direct-drive LED example.
Simple fix for now, and we can revisit later if we add user-configurable drive strengths.
So this would go in an 8.0.1? I think I will make a backport milestone.
so that is puzzling:
latest on ξ main [$] via C v14.0.0-clang via π v3.9.6
β― git status
fatal: cannot chdir to '../../../../../../ports/espressif/certificates/nina-fw': No such file or directory
fatal: 'git status --porcelain=2' failed in submodule lib/certificates/nina-fw
I'll just reclone, but what a weird error
Any circuitpython devs looking for work? I need help with programming for my new toy project.
Simple fix for now, and we can revisit later if we add user-configurable drive strengths.
Changed to use 8.0.x as base, as I had intended.
I think we'll want this in a separate module so we can enable/disable it separately from displayio.
I could move it to gifio. Maybe it would be clearer for users to have it in displayio but still make it able to be turned on/off in the build config? I think that's possible.
I followed the "Get Setup to Add Your Board" to create a new board called COSMO-Pico. Please confirm.
I wonder if play_frame could just return the delay to the next frame.
I looked at the options and decided your idea was the best. Thanks!
Ok, thanks for the insights @kmatch98.
At the moment displayio makes many assumptions on the format of the display controller commands, limiting the controllers it can support.
In my particular case I tried to create a driver for the Waveshare 1.54inch e-Paper V2 display (datasheet). While the display has a 200x200 pixels resolution, the row addressing commands (0x45 and 0x4F) use a two byte, LSB first, parameter for the row. Function displayio_displa...
@A-Spork do you have the same error if you attempt to build something other than esspressif port?
Are you building from current main branch or something older / different?
@onyx hinge I remember you doing some work on displayio speeds. Could you let me know where you posted it? Sorry I canβt recall and I wanted to compare it to what Iβve been looking at.
@blissful pollen maybe https://github.com/adafruit/circuitpython/pull/7147
Yes that was it I think. Somehow I missed it searching the PRs. Thanks!
I am building from the current main. The circuitplayground_express used in the example does work with and without adafruit-circuitpython-bitmap_font installed.
(I edited a comment to use the triple-backticks method of formatting code so that line breaks and white space were preserved)
Closed issues are not a good place for support questions.
It looks like the content you have in the file tools/bitmap_font/adafruit_bitmap_font/bdf.py does not match what we have in git. For instance, your error pertains to line 229 of that file, while the current version contains only 109 lines.
You need to investigate why your system has different content in the tools/bitmap_font/adafruit_bitmap_font/bdf.py file and resolve it.
$ git submodule status tools/bitmap_font/
62d...
Are the translations 4-bytes aligned on every board?
Good catch. I had to check where you got the info from and noticed it was in fact updated on https://www.adafruit.com/product/5345, which is where I originally pulled this from.
do you mean build-*/genhdr/compression.generated.h arrays?
the const compressed_string_t translation0... in the auto-generated build-*/py/translations-en_US.c
I looked at the metro m4 express build, and it looks like it is packing those only on byte boundaries. From firmware.elf.map:
.rodata.translation0
0x00000000000600d8 0xd /tmp/firmware.elf.D3xoxR.ltrans0.ltrans.o
0x00000000000600d8 translation0
.rodata.translation1
0x00000000000600e5 0x7 /tmp/firmware.elf.D3xoxR.ltrans0.ltrans.o
0x00000000000600e5 translation1
.rodata.translation10
0x00000000000600ec 0xe /tmp/firmware.elf.D3xoxR.ltrans0.ltrans.o
0x00000000000600ec translation10
.rodata.translation100
0x00000000000600fa 0x9 /tmp/firmware.elf.D3xoxR.ltrans0.ltrans.o
0x00000000000600fa translation100
...
@analog bridge ^^
but the ones in an espressif build (I only have the 32n8 build built right now) do look like they are 4-byte aligned. Sounds like some compiler flag we don't know about
I think its ok, there is plenty of space free for now. I only looked at it because I am trying to estimate the translation size without performing the expensive link step in ci.
it's a bit weird
I saw the 4-byte alignment on Metro ESP32-S2. It was being compiled with -O2. If I change that to -Os, it packs the structures tightly as with the Metro M4 I mentioned above.
Looks good! I'd like to wait until the PID is published by raspberry pi.
I think we'll want this in a separate module so we can enable/disable it separately from displayio.
I could move it to
gifio. Maybe it would be clearer for users to have it in displayio but still make it able to be turned on/off in the build config? I think that's possible.
gifio is good for me. I think its confusing to have parts of a module turn off and on separately from the module as a whole.
//| odg = displayio.OnDiskGif('/sample.gif')
//| """Loads frames straight from disk. This minimizes memory use but can lead to
I think this should be updated. My impression is that you are loading one frame into memory at a time.
What do you mean by play here?
@slender iron @onyx hinge there is now an 8.0.x milestone, right now populated with the scorpio fix
It looks like this display is using an SSD1681: https://www.good-display.com/product/208.html
We have a CircuitPython driver for it here: https://github.com/adafruit/Adafruit_CircuitPython_SSD1681/blob/main/adafruit_ssd1681.py
The main trick is that you can set ram width >256 but then say this display is only 200 wide. That'll use the two byte form but only compute 200 pixels wide.
Closed issues are not a good place for support questions.
Its much better to open a new issue and reference this issue from there.
It looks like this display is using an SSD1681: https://www.good-display.com/product/208.html
We have a CircuitPython driver for it here: https://github.com/adafruit/Adafruit_CircuitPython_SSD1681/blob/main/adafruit_ssd1681.py
The main trick is that you can set ram width >256 but then say this display is only 200 wide. That'll use the two byte form but only compute 200 pixels wide.
I actually tried that before opening this issue... It does not work because the byte order fo...
Ah ok. @makermelissa wrote that driver and can let us know why it is that way. We could add a flag for byte order if needed.
@onyx hinge I think the nrfutil thing is that the pc-ble-driver-py switched to "built distributions" from "source distributions" in the older version. I don't know why msys2 pip won't install a "built distribution" though
Probably because there's not one? The msys one would not use the same file as a Windows one if there's compiled code in the mix.
ah. I don't know what msys is...
CircuitPython version
Adafruit CircuitPython 8.0.0 on 2023-02-06; Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w
Code/REPL
not available
Behavior
when edit 'settings.toml'
directly on the CIRCUIPY drive
using Raspberry Pi OS
editors
-
-
- GEANY
-
-
-
- NANO
-
drive vanish & never show up again ( also not under windows )
( must nuke and CP800 again )
Description
the default 'recommended software' Raspberry Pi for PICO ...
Hi, I am looking to load the Adafruit ESP32-S3 TFT( 4 MB Flash + 2 MB of PSRAM) with Micropython but i am not able to find the .bin file for it. Appreciate if anyone can share the file or link. Thanks
they seem to have only the generic builds (other than the UM boards)... one of those might work https://micropython.org/download/?mcu=esp32s3
you could try the MicroPython Discord or forums (GutHub Discussions) for better support
and did nrf build any mingw64_nt_ wheels? (it appears not: https://pypi.org/project/pc-ble-driver-py/#files) -- this is why binary-only releases are bad.
yup
there are normal windows releases there
but I don't know my windows tooling options
@slender iron in order to move on I'd recommed just not installing it and not trying to build that board on Windows. It's nice if building as many things as possible on windows works, but there's a clear barrier here and it's not affecting many boards
and put a documentation note if there's an obvious spot to hang it
@slender iron this doesn't affect building nrf boards generally ,does it? I didn't look at the wip
send a request to nrf for a build of the package that installs on msys python π you never know, they might provide it
I wonder if we could build it using a github package location instead of pypi
but I don't really want to sink time into finding out
they deprecated their python version of nrfutil anyway
so moving to the newer version is probably the best way to go
pc-ble-driver is the new version of nrfutil?
I saw this merge queue thing; not sure if the CI needs to be updated or not.
It looks like the releases have empty lists for the asset key and so aren't building anything but the header: https://github.com/adafruit/circuitpython-org/blob/0400b3cc84a786baf233cd181ef2a2a9c3435018/assets/javascript/stats.js#L16-L25
Is this because it's trying to use the GitHub Release assets? Since the downloads from the website now use http://downloads.circuitpython.org and not assets attached to the GitHub Release as it seems it used to, is this even a viable strategy anymore?
@tulip sleet Where are we with ESP32-S3 and LC709203? The tracking issue is still open, but we thought it was fixed.
I revised the library to do retries. It worked for me, but one user said it didn't work for them.
i was still trying (unsuccessfully) for an actual fix instead of doing retries as a workaround
it's also the case that the MAXwhatsis needs retries
Hmm fair enough
Looking at it now, looks neat!
Well if it works....
Hi Mellisa:
Thanks for adding the temporary .md file etc. to circuit-python.org. It
looks like I should be getting my final boards delivered next week. I've
already started working on the description
etc. on my fork of the CircuitPython-org repository. So, the plan is to get
this all wrapped up by next week (hopefully!).
bye for now,
On Mon, Feb 6, 2023 at 5:35 PM Jeremy Littler @.***> wrote:
Hi Mellisa:
If you could hide it for now I would really appreciate it. It won't be f...
No, we haven't uploaded assets to GitHub for years. The download stats we use for sorting which boards are most popular are generated by me, using AWS Athena, every time we do a release. That goes into the download counts in the board json.
If you want me to do other queries that update periodically I could, but it would be work to do this dynamically. Generating the download counts for all the boards takes about 15 seconds (and maybe costs about 15 cents). Maybe we should just get rid ...
it is a dep
did 8.0 do something to change the left hand offset on pyportal TFT? it's different now. text used to be indented a little more to the right.
may be due to status bar code; do you mean, compared to 7.3.3?
is the change good or bad? π
bad-ish. interferes with pyportal case.
one sec. responding. will link forum thread...
could be something in https://github.com/adafruit/circuitpython/pull/6473/files there was rework of the terminal area
@tidal kiln in the 7.3.3 version, would the blinka icon be covered up by the case frame?
yes. a little.
I think maybe the offset was corrected, without realizing the case frame did not go to the edge of the screen. There is probably a sw fix for this. I wonder whether we should just change it on the PyPortal, since we sell that case.
Could you open an issue?
sure
there isn't any trick like reversing the direction of the frame is there? :/
ok, tnx, too bad
CircuitPython version
Adafruit CircuitPython 8.0.0 on 2023-02-06; Adafruit PyPortal with samd51j20
Code/REPL
n/a
Behavior
n/a
Description
Left hand edge of display gets cutoff when using the PyPortal with the Desktop Stand case:
https://www.adafruit.com/product/4146
Looks OK with 7.3.3.
Additional information
See related forum thread here:
https://forums.adafruit.com/viewtopic.php?p=959876
This may be due to status bar (title bar) changes, maybe in #6473?
fyi, I updated my async branch with the following interesting changes:
https://github.com/adafruit/circuitpython/pull/7554
- Move the loop code to its own module.
- I copied the CPython code for the asyncio module and started deleting stuff until it worked on CP. FWIW, it's 28k compiled.
- I copied the CPython code for the asyncio module and started deleting stuff until it worked on CP.
It's just temporary that you put it here, I assume, but you could fork https://github.com/adafruit/Adafruit_CircuitPython_asyncio and put it in a branch there. We wouldn't store a version in the CircuitPython source tree (even though that's what MicroPython did, and I should just delete that from our fork).
I don't really know why they put it in their source tree, since it's really optional.
interesting about _asynciomodule.c
Yeah, I didn't know where to put it. I should do it as a CP library as you say. I need to work out the workflow with frozen modules/git sub-modules, etc.
i don't think we would freeze it, unless it was on a board that would always use it. It uses up space we want for something else. And we generally only freeze things because there's not enough RAM (e.g. on Circuit Playground Express, with only 32kB).
yeah, there is already a module called _asyncio. But I found that out at the very end. So I just changed the name of the module to _loop and kept the source code name as _asyncio. π
we can clean that up later. _asyncio is a catchall for C stuff, and it's not to be used by the end user
anything with _ like that, like _bleio
we don't guarantee those things have a stable API that you should think is a good idea to use
could you stuff _loop in _asyncio or does it need to be separate for some reason?
I don't think it should necessarily be frozen either, but fwiw Adafruit_CircuitPython_asyncio currently is.
stuff in frozen is not always frozen, it's just available to be frozen. It's only frozen on the boards that want to freeze it. I think some third-party board wanted to freeze it, but we wouldn't have recommended that
but their choice
neopixel si there so CPX can freeze it, for exampel
it is technically possible
right, so if I'm editing a library that is under frozen, do I edit it in the circuitpython repo under frozen, or do I get it in the library's own repro and some how pull it into the circuitpython repo?
you always edit itin the library's repo, and update the submodule commit when it's ready. Everything in frozen/ is a submodule (or maybe nearly eeverything, again maybe some third-paryt weirdness)
in the top-levle makefile there is make update-frozen-modules target which brings them all up to date
we do that before significant releases
MicroPython traditionally froze a few things, but mostly as .py, not .mpy. The pyboard has plenty of flash. The ESP8266 needed a lot of initialization setup. We were much more constrained by internal flash size space on the SAMD21, our first port, so we improved the tooling of frozen modules (FROZEN_MPY_DIRS instead of FROZEN_MPY_DIR). THen later the MPy folks introduced the idea of manifests, which we haven't taken in (yet?).
just one board freezes in Adafruit_CircuitPython_asyncio but we also happen to use it during build-time for testing
tests/run-tests.py: base_path("../frozen/Adafruit_CircuitPython_asyncio"), run-tests uses this copy of asyncio preferentially
Thanks, the PID has been filed with the Raspberry Pi Foundation. It will be published soon.
We have some support for .env files in the Python extension for VS Code, but we have noticed some shortcomings with .env files based on user feedback. After getting some inspiration from CircuitPython and thinking about it a bit, I think I might have a nice solution to the problems
Shout out to cp
Fixes an issue when displayio.I2CDisplay raises an exception because of a bad address for example. The reset pin (if any) remains "never reset" (ironically) and raises a "pin in use" error on subsequent reloads.
Deinits self before raising the exception.
Is this the right way to do that ?
Example code:
import board
import displayio
import adafruit_displayio_ssd1306
displayio.release_displays()
reset = board.D9
i2c = board.I2C()
bus = displayio.I2CDisplay(i2c, device_a...
what is going on with the CI ??
apparently sh 2.0.0 was just published on pypi and changes how sh.contrib works ?
the error in the CI is:
Run python3 -u build_release_files.py
Traceback (most recent call last):
File "/home/runner/work/circuitpython/circuitpython/tools/build_release_files.py", line 30, in <module>
sha, version = build_info.get_version_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/circuitpython/circuitpython/tools/build_board_info.py", line 61, in get_version_info
sha = git("rev-parse", "--short", "HEAD").stdout.decode("utf-8")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'stdout'
Error: Process completed with exit code 1.
like sh.contrib.git(...) now returns a string ?
Due to today's release of sh 2.0.0, the CI fails in build_board_info.py
see https://github.com/adafruit/circuitpython/actions/runs/4140380646
Run python3 -u build_release_files.py
Traceback (most recent call last):
File "/home/runner/work/circuitpython/circuitpython/tools/build_release_files.py", line 30, in
sha, version = build_info.get_version_info()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/circuitpython/circuitpython/tools/build_board_...
Same problem here, with Seeed Xiao RP2040, with Circuitpython 8.
The sound distorts and breaks the code.
CircuitPython version
8.0.0 on Waveshare RP2040-Zero
8.0.0 on Luatos Core ESP32C3
Code/REPL
#
# This code freeze the board when run after second REPL restart / after code.py autoreload
#
def gen():
while True:
yield 0
while True:
g = gen()
print(next(g))
g.close()
Behavior
The bug occurs after restarting the Python machine. Just after reset / boot code works well. The second run freeze the board.
Descrip...
Tagged for backporting to 8.0.x
It looks like the bug related with f3169246b, b499275bb.
When I build 8.0.0 with MICROPY_CPYTHON_EXCEPTION_CHAIN=0 the freeze is gone.
Please open a new issue, thanks, with a simple test program.
@tulip sleet what should the directories look like in #7534
something like mpy-cross/windows/... linux-amd64, linux-raspbian, linux-aarch64, maybe? or linux/amd64, with more subdirectories? I hadn't really thought about it in detail. I cleaned out a lot of the older builds, which helped, but the naming is still kind of confusing
the names don't alphabetize well, with "static" and "amd64" first rather than last in the filenames
maybe just changing the order of the modifiers would help enough
mpy-cross-<version>-<os>-<architecture>, maybe
mpy-cross-<os>-<architecture>-<version> is probalby better
"raspbian" is now an outdated name.
I can put older stuff in "OLD/", and or I can rename the current files as well
cool... i am doing some tweaks and i can get it in
mpy-cross-<os>-<architecture>-<version> looks good
sounds good, and I will clean up the current directory and write some script to rename according to your choices later
thanks for doing this
Thanks, that's excellent information @gelsrc !
If an exception's chain or context can refer to a pointer from a different VM, a crash would typically result.
This couldn't turn up on UNIX testing because the VM is never torn down and rebuilt like it is on hardware.
Testing performed: Ran the original reproducer on a Feather RP2040 Scorpio and verified the reported behavior. Ran with the fix and it no longer reproduced.
While I think that WatchdogException could have led to similar behavior, and made fixes for this, I didn't test ...
Warning, my knowledge on C and board internals is sevely limited, take the following data with a large chonk of salt.
It seems pystack cannot be configured in runtime. In it's current form at least.
Starting from main.c:125:
#if MICROPY_ENABLE_PYSTACK
static size_t PLACE_IN_DTCM_BSS(_pystack[CIRCUITPY_PYSTACK_SIZE / sizeof(size_t)]);
#endif
This is the first reference of _pystack, this symbol is not present in any other files. (ctag were used)
Wikipedia says bss i...
@onyx hinge we need to backport https://github.com/adafruit/circuitpython/pull/7564 to 8.0.x, to prevent 8.0.x PR's from failing. I'll do this right now unless you already started.
@tulip sleet do you want me to add it to that PR I just opened? it should be easy
Sure! you can just cherry-pick the 7564 commit, you would need to resubmit anyway. tnx
how's that look @tulip sleet ?
successful builds! I will approve and merge when done.
thank you Dan!
BTW will we merge 8.0.x to main or do I need to prepare versions of these bug fix PRs for main?
we will merge back to main regularly, if you want to do it, fine.
should I move #7563 to 8.0.x ?
that would be good. It's easier to merge from 8.0.x to main than vice versa
thanks
don't do it until I merge Jeff's PR, to pick up the sh 2.0.0 thing
I"m re-running failed jobs in 7563
ok
@kamtom480 if you change the base of this to the 8.0.x branch, we can get it into 8.0.1.
@onyx hinge what does the '0' signify in mp_obj_exception_initialize0?
@timid bolt hm maybe I should rename it. Initially I wrote a function which received the "args" object (and was named without the "0"), then i noticed I was frequenty passing the empty argument tuple so I created the "0" variant that passed the empty arg tuple to mp_obj_exception_initialize. (this probably saves a few bytes of code, though I didn't measure) Then I ended up with the only caller to mp_obj_exception_initialize being mp_obj_exception_initialize0 so I removed mp_obj_exception_initialize.
at best the 0 is very unclear
but 0 meant "empty argument tuple", basically
general point: I've been bitten a lot by this "re-initialize after reset" problem too. It is somewhat of a bug farm. Some exploratory questions:
- do we really need soft reset?
- is there a more systematic way we could address the problem? (e.g., re-zeroing bss on soft reset)
Next we go to
main.c:162:#if MICROPY_ENABLE_PYSTACK mp_pystack_init(_pystack, _pystack + (sizeof(_pystack) / sizeof(size_t))); #endifSo it seems to init the stack here. So this means the allocation is here, right? No.
This is what we'd have to change. We'd need to make it use a supervisor allocation instead because that'd be dynamic. The heap is already done this way (except it takes all remaining space.)
Would you mind switching this change to 8.0.x (using rebase and then changing the base here) so that we can release it sooner? Thanks!
This was a deliberate change I made. We used to leave a blank column below blinka because the terminal's top left corner was to the right of it. Now, with 8.0, the title bar terminal is to the right of blinka and the regular terminal can now be positioned below it.
I don't know what we'd want to change in CP for this.
Are you pressing the reset button after editing the file? Those editors may not sync immediately and leave a bad file system.
So I have to try to deduct CIRCUITPY_PYSTACK_SIZE from the allocation of the heap, make the alloc in this func and remove all the bss stuff right?
@bill88t Currently _pystack is a statically allocated array stored as a global. ("bss" is the name of the section of memory that contains zero-initialized global variables. (idk why it is called bss))
You need to change _pystack to be just a pointer and then dynamically allocate the array before mp_pystack_init is called. As @tannewt suggests, it would make the most sense to allocate this memory from the supervisor heap. That will involve a bit of refactoring moving things between `m...
You will use allocate_memory(uint32_t length, bool high, bool movable) to allocate the pystack. Probably as allocate_memory(pystack size, false, false) but I haven't doubled checked those parameters.
You need to do this before calling allocate_remaining_memory() which allocates the pyheap.
@tannewt
no, no RESET connected / used
and it not looks like accidental, the PICO_W ( with CP800 ), more like bricked 4 times in a row with GEANY
2 people same project different continents
use / 3 RPI / 3 PICO / several USB cable / 2 win PC ( for check if CIRCUITPY drive come up there later? but NO )
at save of 'settings.toml' PICO should just restart like with every file-change ( *.py usually done by MU editor )
inhowfar that file is treated differently ( from code.py... )
a...
soft reset is meant to get back to a known state before rerunning python code. it isn't just bss. its also all of the peripherals
This contains the following CI enhancements:
- Use
mpy-crossartifact instead of building it repeatedly. - Use composite actions to factor out common and reusable steps.
- Move build steps of
boards,mpy-crossandteststo reusable workflows. - Run
mpy-crossandtestsin parallel.
Geany and Nano are both known to not flush the whole file out immediately to CIRCUITPY, and are disrecommended for that reason. See https://learn.adafruit.com/welcome-to-circuitpython/recommended-editors#editors-that-are-not-recommended-3104729, and read the whole page.
I don't think it's a micropython core issue, as they haven't (to my knowledge) taken the chained-exception patch, nor do they reset the VM the way we do
yeah, it's more complicated than I thought. Indeed the exception object at the root of jepler's change is not even in bss. π€¦ββοΈ
just for argument's sake, what is the advantage of soft reset over hard reset? (assuming there is always only one vm)
web workflow and ble workflow would be restarted after every reset: have to reconnect, etc. auto-reload would force a USB re-enumeration.
display would get cleared
any state you wanted to maintain across VM's would not be possible
ok makes sense, I wasn't familiar with those features
Thank you @ladyada - I'm going to close this out. There are plenty of other options now in your 366 (!) supported boards!
any other state beyond sleep memory?
i'm not sure sleep memory is maintained after a hard reset (button push)
it could vary
I was just wondering whether other things besides sleep memory are designed to live across reloads
(other than what you listed above: workflow, display, USB)
I have started working onto it on another branch https://github.com/bill88t/circuitpython/tree/settings-toml-pystack
Currently it does not work, and I have no idea why, I have plugged the debug pins and with openocd & gdb I see it's stuck in enable_interrupts.
I will switch the PR branch to that once it's somewhat working..
Progress:
- [ ] Allocate dynamically
- [ ] Test if alloc is good.
- [ ] Fetch value from settings.toml
- [ ] Convert value to a multiple of stack frames.
You could probably search the code for all the times a pin is set to never reset. ESP32 camera seems to do that
I guess that would only apply across a reload, and not during a reset (?)
nvm survives reset
I'm trying to figure out what state survives reload, haven't found any consolidated docs about that
(re: reset... my assumption has always been that microcontroller.reset() is roughly equivalent to pushing the reset button, with caveats for deep sleep)
there is a bit of state surviving, because you can reset to a bootloader
If this is related to my earlier question, by soft reset I mean ctrl-D. Afaik microcontroller.reset() does a hard reset.
yes, reload vs. reset
it's a little clearer (to me) what survives reset vs what survives reload
I'd guess that uses rtc memory or similar, not flash
the stuff danh mentioned is for surviving reload (soft reset). Nothing really survives reset (hard reset) except non-volatile storage (i.e., the flash).
microcontroller.on_next_reset survives reset (as deshipu noted)
I'm not sure about the onboard rtc across ports
it might be that that kind of reset is doing the action of going to bootloader, rather than resetting and remembering that it had to go to bootloader ?
yeah, I don't know those mechanisms
things that are setup through supervisor will survive reload, the previous traceback is saved somewhere, set_next_code_file, etc.
that's a good distinction (supervisor)
a bit confusingly though... ports/{port}/supervisor/port.c has a lot of the reset behavior
right, that "reset" is the reload π
Could someone point me to why there are only a fixed number of sockets? The only reason I could find is open_socket_objs in Socket.c, however I think this could be made into a dynamic array.
afaict, it's a memory thing. the CYW43 driver defines 8 (but we don't really get 8 currently into userland - there's an issue for that), espressif has a compile flag
in espressif, sockets use onboard espidf memory, competing with pystack, monitor, AP connections, possible future ble features, etc (there are a number of related issues and PRs)
[outside the core, wiznet limits sockets to 4 (W5100S) or 8 (W5500), and ESP32SPI / Airlift has a limit of 10 in the NINA firmware]
espressif does retain the onboard rtc time across microcontroller.reset() π
raspberrypi does not
I'm not familiar with the ESP ports. So does ESP-IDF == FreeRTOS + ESP SDK? Is that how the esp ports of CP run: with ESP-IDF on top of an RTOS?
I think that's a fair characterization
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Raspberry Pi Pico with rp2040
Code/REPL
some parts of code
.....
display = ST7789(display_bus, rotation=270, width=320, height=240, backlight_pin=board.GP20, backlight_pwm_frequency=500)
.....
display.brightness = 0.001
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + timeInLightSleep)
pin_alarm = alarm.pin.PinAlarm(LORA_INT, value=True, pull=True)
alarm.light...
Clearly some timing issue here, though I cannot see where. Putting a "mp_hal_delay_ms(1500);" at the top of common_hal_socketpool_socket() in ports/raspberrypi/common-hal/socketpool/Socket.c makes everything work, but that's quite a hack.
I'd say FreeRTOS is an integral part of the ESP-IDF. They have modified it for their own needs as well.
Agree'd that would be nice and likely expected behavior. I'll plan to make another pass for python QoL stuff like this after I've made it through the validation.
changed in the latest commit to use range and remove the seperate if statement.
the latest commit contains the change to consolidate these by using range. Thank you for the hint about how calculate the max value.
was the presence of FreeRTOS useful or interesting when porting CP to Espressif?
we took advantage of the task mechanism
but only in a limited way, for some monitoring tasks. THere is one major CPy task
we also had to find and fix bugs due to some assumptions ESP-IDF had inadvertantly made about what ran in which task and on which CPU (on the dual-CPU chips). Scott found those at least twice, I think.
they were PR'd upstream
This is handled now in the latest commits using range and a max of 32767. Thank you!
There's already range checking code on lines 242-52.
the latest commits contain a change that uses the arg validation functions and removes the seperate logic check. This limits the bounds to a smaller number to get rid of the issue of it going over the max and wrapping around as well as consolidates the check into a single place when it first saves the argument.
(I wonder if there is some invalid content or filesystem condition that causes an exception to be thrown outside the vm or otherwise create an unexpected failure condition; that could land you in a boot loop or otherwise 'bricked'-ish device)
(we SHOULD be working at a level without the possibility of an nlr exception but you never know)
@dhalbert
Geany and Nano are both known to not flush the whole file out immediately to CIRCUITPY, and are disrecommended for that reason.
so until there is a MU editor on RPI what is able to edit 'settings.toml'
you recommend ? THONNY ?
or you say the file should be edited OFFLINE and copy to CIRCUITPY ?
resources show no info about that file handling:
https://docs.circuitpython.org/en/latest/docs/environment.html
https://learn.adafruit.com/scrolling-countdown-timer/c...
Some recommended editors are here: https://learn.adafruit.com/welcome-to-circuitpython/recommended-editors#recommended-editors-3104731. Can you use gedit? If it's not installed already on the RPi, you should be able to apt install it. VS Code is also fine, but is more complicated.
or you say the file should be edited OFFLINE and copy to CIRCUITPY ?
That could also be done. When copying, do a sync immediately afterwards to insure the file was fully copied, e.g.
$ cp settin...
Mood.
It still ain't booting, but at least I am able to debug it.
I am trying to have it boot with a dynamic alloc instead of the bss thingy that it was.
Once that is done, the rest should be easy.
though I do not quite understand how the original allocation worked so it's all a guestimation.
rp2_common still seems to expect _pystack to be in bss
(gdb) watch _pystack
Hardware watchpoint 6: _pystack
(gdb) r
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000178 msp: 0x20041f00
[New Thread 2]
Thread 1 received signal SIGTRAP, Trace/breakpoint trap.
bss_fill_test () at sdk/src/rp2_common/pico_standard_link/crt0.S:252
252 bne bss_fill_loop
(gdb) s
bss_fill_loop () at sdk/src/rp2_common/pico_standard_link/crt0.S:249
249 stm r1!, {r0}
It seems the code still expects ...
Yea this stuff is pure assembly. I am bailing out. Branch is staying to stackless since this thing actually works..
My minimal progress onto dynamically allocating pystak is available here once again.
If someone wants to continue it be my guest.
I will create a fragmentation test to see as to if stackless is actually problematic or not.
It should be possible to do volume control on an I2S output by doing 24/32 bit audio, and multiplying each sample by an integer on the way out. Then the amplifier gain would set the maximum volume, and more reasonable volumes could be set as a number between 0 and 1.
This should be ready for review now that the PID.codes PR (pidcodes/pidcodes.github.com#815) is merged.
These changes fix adafruit/circuitpython#5947. I've tested on both the zero2w and the pi4b (The 4b didn't exhibit the original issue) and the boards now behave properly with 1 to 30 pixels. I've run a 30 pixel animation on the zero2w for 8+ hours without a hang.
Original corrupted rgb transmission:

Early Fix, not using transmission queue:

led.direction = digitalio.Direction.OUTPUT
led.value = 1
# Edit
cap = 1000 # Max possible target level
# Do not edit
limit = 100000 # Stop when you have done a total of 'this number' allocations
allocs = 0 # Cur...
I just tested this on a zero w rather than the zero2w and it works but it looks like the code is getting stuck more frequently than the other tested board in the loop that checks for an empty queue. I'm not sure that's a problem if I reduce the loop abort counter but I want to test on the three models I have. I'll update once I've finished testing.
so it's official, pi cow has bluetooth now
Is it now recommended to use "settings.toml" to set all of the things we used to do via "secrets"? for example. to access my AIO username and key should I set them in settings.toml and then retrieve them with os.getenv?
Is the "settings.toml" file processed for all boards?
Supported by CP?
no, it just appeared, give it some time
Like esp32Sx? π
yes
@solar whale Unofficial answer: yes I believe so, though there are so many examples out there with secrets.py. My take: settings.toml is useful for pre-boot.py values and for the ease of os.getenv(). But it doesn't bring in Python objects, so it can be more work, especially for more complex data. My personal strategy is to stick to pre-boot.py use, and put the rest in a .py file (or download it).
If I want to add support for another Arduino board, what would be the recommended source for VID/PID numbers? The MKR Vidor is very similar to MKR Zero. Fairly straightforward port, just need new IDs. Should I request from PID.codes?
For MKR Zero, we assigned Adafruit PID's. I'm not sure that Arduino has a mechanism for asking for additional PIDs, but I don't know whether we would continue that or not. You could submit a pull request and we can discuss it there. Will there be differences besides the name in the board definition?
The SD card pins become JTAG pins. Might eventually include different libraries for FPGA.
The battery sense pin moved
certainly noticeably different, got it
I've grabbed a couple of Feather ESP32-S2 boards and they too appear to fail with the ds18b20 sensors on the onewire bus in the same way as the Feather ESP32-V2. I've not yet looked closely at the timings on these boards using a logic analyzer or scope.
Tested on 4b, zero2w and zero w. Runs without glitches or crashes.
Minor fixes I noticed in the bug report template while creating one for the libraries.
I would keep the python rendering as is. It prettifies the text. What is the issue you encountered?
I just saw that the syntax wasn't actually Python and was highlighting "random" parts so I just removed it, but there weren't any actual issues really.
Hi, im having issue with BLINKA_U2IF vs BLINKA_FT232H, epd gives error on U2IF - SPI write_readinto Not implemented
example based on
So works fine on FT322H but not PICO
GC9A01A round display works but only without RESET line defined (No picture with reset)
SDD1327 without reset no good picture showing at all
CircuitPython version
Adafruit CircuitPython 8.0.0 on 2023-02-06; SparkFun Pro Micro RP2040 with rp2040
Board ID:sparkfun_pro_micro_rp2040
Code/REPL
> sudo fatrace -c
md5sum(141934): RO /run/media/user/KEYBOARD-L/code.py
md5sum(141934): C /run/media/user/KEYBOARD-L/code.py
Behavior
Code stopped by auto-reload. Reloading soon.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Description
_No ...
Added other sources of documentation for users to reference when using the CircuitPython modules #6326
The built-in modules that were changed include:
-audiobusio
-audiomixer
-audiopwm
-camera
-ipaddress
-rainbowio
-rgbmatrix
-sdcardio
-usb_cdc
-usb_hid
-usb_midi
-wifi
I'm definitely not the main consumer of the bug reports, so happy to do whatever is best for those that do.
I may be mistaken but in several cases it seems like the link you are adding is to the documentation generated from these very docstrings.
This guide is MQTT-specific, and could be confusing since it also includes Airlift instructions, perhaps not the best example. Unfortunately, I'm not aware of a generic native wifi Learn Guide. There are some for other specific applications like HTTP Server, AdafruitIO, etc. There are native wifi pages mirrored in the primary guides for various wifi boards, e.g., https://learn.adafruit.com/adafruit-qt-py-esp32-s2/circuitpython-internet-test
Could you explain the scenario? Did you do any writes slightly before this auto-reload? Or was the board quiescent for a long time?
Auto-reload is triggered when a write command comes down from USB. The code waits 0.75 seconds after the last write received before triggering an auto-reload, to allow multiple writes in quick succession.
So something is arriving from the host that is a write. The way to check this would be to use wireshark or similar to see what is actually arriving.
Th...
I'm sorry, I meant "last accessed time", not "last modified". I've modified my original comment. I would expect the OS to try to update that metadata after each open on the file.
Minimally reproducible scenario:
- Unplug, re-plug the board.
- Open Mu and connect to serial console.
- The drive label has been changed to something else than "CIRCUITPY", so Mu is not able to interfere with the drive.
- Wait for a while: nothing happens.
cat /path/to/drive/code.py.- After a few s...
I tried to reproduce this on Ubuntu 22.04. My code.py is just the print("Hello, world!") you get on a fresh filesystem.
I did not rename the drive. I connect to the board either with Mu or with tio /dev/ttyACM0. I see "Auto-reload is on..." Nothing happens. I cat /media/halbert/CIRCUITPY/code.py. Nothing happens after that.
So something is happening on your particular system that is causing a write. Do you have any indexing programs or other scanning utilities running? Do you see ...
Is there a way to see the human readable source code for the built in libraries in Circuitpython? I am building an MP3 player on a pico and I would like to improve the bit rate and other things that might require me to view the source code for built in libraries such as audiobusio and audiocore. I did not see any of the built in libraries in the Python Source Bundle.
I tried to get this to happen from Debian 11 on my Sparkfun RP2040 Thingplus but rather than Mu, I used tio as the terminal. I'm not auto mounting the CIRCUITPY drive so I manually mounted after plugging in the board.
I couldn't get the reload to occur by just performing the cat /media/user/code.py but the board did reload when I perform the mount or unmount. I also noticed that the reload only occurred if I had a python script running. If I was at the REPL prompt mount/umount did not caus...
Okay, I just use cat on a larger file and while I was typing in that last message the board did an auto-reload. It was much more than a few seconds though, probably closer to a minute after I typed out the file..
If I use the command cat /media/user/filename.py; sync the reload happens immediately, but only the first time I cat the file and only if a script is running.
@ruby walrus I suspect the audio libraries you're looking at are not frozen python libraries but implemented in C++.
C++ is fine. Do you know how I can look at the code.
Is been my experience that most other languages let you inspect the contents of all their libraries.
I think the modules you want to see are in this directory: https://github.com/adafruit/circuitpython/tree/main/shared-bindings
There doesn't seem to be many of the Adafruit folks on tonight, but if you have questions or want specific help this is the right place to ask about those modules.
The board specific parts of what you're looking for are probably in this directory: https://github.com/adafruit/circuitpython/tree/main/ports/raspberrypi/common-hal
@dhalbert I changed the base of this branch to the 8.0.x branch.
My understanding is that you've reproduced the problem. If that's not correct, let me know and I'll try to provide an easy way to reproduce the issue.
@Roming22 How large is your code.py, and was it running when you cat'd it?
You can disable auto-reload, if it is interfering with your work:
import supervisor
...
supervisor.runtime.autoreload = False
I do believe all the mp3 stuff is built in. You can find most of it: https://github.com/adafruit/circuitpython/tree/main/shared-bindings/audiomp3
and
https://github.com/adafruit/circuitpython/tree/main/shared-module/audiomp3
Some other audio library information is port specific so you would find it in:
https://github.com/adafruit/circuitpython/tree/main/ports/PORT/common-hal (replace port with the specific family)
Fixes issue with PyKey87 where Neopixels are not all reset on CP restart.
Also updated the number for 2 other boards in order not to reset an excessive amount.
I think updating the page to dynamically read the boards.json file via JavaScript should be possible and likely not too difficult. Automatically regenerating as static page via adabot or some similar mechanism doesn't seem practical since there would be a new PR every day that somebody would need to merge. I think the nature of this issue is as the title states the page is broken and it should just be redone if it's useful for people. I imagine something like this shouldn't take more than a c...
Oof, I just realized it was by CP version and not by board like I was thinking when I just wrote that. I think removing this altogether actually page makes more sense. I think as Dan stated, it costs money and time to generate and I doubt it that's useful for most people. I seems more like a fun fact.
Want me to handle the PR to remove it?
Hey <@&356864093652516868> , the pinned message says the meeting is today but the calendar says tomorrow (due to Lincoln's brithday in the US). Any objections to doing it today (in 2ish hours) and ignoring the calendar? I suspect that's what we all expected.
I thought it was today so no problems here
Same here, today is good for me.
π
Wait, today is a holiday?
I wish every Monday was a holiday

Oh, @lone axle - the CI update to specify the Python version is ready if you want to use that for your PyGameDisplay library.
Evidently somewhere that doesnβt totally keep up; pretty sure no individual presidential birthdays are βcelebratedβ anymore because we have Presidentβs Day (next week) to celebrate them all at once
I felt that most US Holidays are on Monday's... or you (USA people) really have a lot of holidays (I don't believe that).
ya, next week's meeting is shifted
I will not make it to the meeting, and if I have notes it will be done in less that 10 minutes on a phone. π
Don't worry for me, go ahead.
You've got time.
I am interested in that Can you point me toward how to set it up? Or want to PR there with the change for it?
And thank you for working on that configurability!
I think most fixed holidays are indeed Mondays, lol. Or the βobservedβ usually is (like, Christmas is on a Sunday, the βobservedβ (and thus day off) is Monday)
Yup! There's a new note at the bottom of the README for the actions that details how to use it: https://github.com/adafruit/workflows-circuitpython-libs
@lone axle in case you were wondering I did get the party parrot gif going. Long story short every frame have to blank the background (plus the alignment issues). There was an issue on the AnimatedGif library talking about it. You can solve it but memory or CPU time go up a lot
You can use that python-version argument for the build and both release actions
Nice! Thank you! 
Oh, good find, it does make sense the transparency would add lot of complexity vs. being able to repaint all pixels each frame.
I wonder how hard it would be to make a script to "fill in" the transparency with some color on each frame.
It's not even the transparency (which should work). It is the disposal method. If set to "2" the decoder is supposed to draw the GIF and then restore the background before drawing the next frame.
If you overwrite that pixel in the next frame - doesn't matter. But if the next pixel is now transparent the previous pixel matters. But now you have to buffer almost 3 frames of data
It would be pretty simple if wanted. The code almost checks/skips transparent pixels. Just have to add a replace transparent with feature.
Oh interesting, I was thinking of modifying the source gif. If it could be an argument in code to replace it with another color that would be very convenient too.
You can modify the source GIF too I think. ezgif I think has an option like that
Does the GIF use a displayio.Palette? If so, it could be manipulated as well.
No it doesn't. Most GIFs change the palette frame to frame.
It would be possible to add a new mode to not preconvert and have a bitmap with a palette but not sure on the speed of that.
As I poke deeper into displayio there are a lot of speed vs memory type choices. Been thinking of ways more of the choice could be given to the user, without bloating the code too much
Perhaps disable the palette extraction phase after the GIFβs initial frame palette is determined, keeping only a single palette? Could that reduce some of the cycles needed per frame?
The GIF palette itself changes frame to frame so the code would have to update the displayio.Palette object every frame still.
But I'll admit I didn't look too closely at that processing
Hmm. I wonder how often the frame palette content actually changes during an animated GIF. Donβt think that any Iβve created have changes frame to frame. Will have to take a look.
Ya, we use TileGrid for it and we could resize it. But, I like that it can show more text than if it is scooted over.
I meant our "micropython core". Maybe we need to use an upstream tag in addition to this one.
@blissful pollen Is the In the Weeds topic yours? (There's no name on it. π )
Yes, sorry I thought I put my name there but it is Monday π
No worries! We're not there yet anyway π
Same problem here with an Adafruit MagTag. Connects fine until the device is moved more than about 20'/6m from the AP. Will definitely connect when within that distance.
Please use && in your conditions instead of &. & is a bitwise test and && is boolean logic.
while ((port_get_raw_ticks(NULL) < next_start_raw_ticks) &&
while ((CM_PWM->CS_b.BUSY == 0) && (icnt++ < 1000)) {
I need to miss today's meeting. Would have had to miss it tomorrow as well if we moved it, so nothing lost. π
_pystack is the statically allocated version. When switching to the supervisor allocation, you'll want to delete the _pystack variable. It shouldn't be used then.
@tekktrik This should be good to merge with the two python changes backed out.
@slender iron FYI. You'll need to read Libraries, or see if someone else is interested. I made a note in the doc about it needing to be read.
I can. No problem
Thanks
brb
Well renamed the variable onto that branch, it's not like a name change is going to affect the fact it won't bo- HOLDUP.

Why did it work now?????
It also erased the internal filesystem for some reason..
there are two palettes, a global one and a per frame one
Listening only. (is someone speaking yet? I only get beep from discord when someone join)
nobody talking yet
Perfect thanks
πΌ
good luck trying to silence a cat
ya, I haven't spoken for quite a while π
same
Please subscribe at www.adafruitdaily.com
That Tulip CC looks pretty much like my #CP2021 and #CP2023, but in MP rather than CP.
Just a moment...
go ahead and read it
I think I fixed audio. Discord changed sources on me.
seems that David's jiggler moves in an octagonal pattern: list = [(0,1), (1,1), (1,0), (1,-1), (0,-1), (-1,-1), (-1,0), (-1,1)]
(note: pylint probably wouldn't like using list as the name of a variable, since it is replacing a built-in)
I've also had to build in a screwdriver slot to pry parts apart before
my parts never fit that exactly. π¬
circuit python plant guides coming? i'd love to see that.
excited for the auto installer from circuitpython.org, awesome stuff Melissa.
Thanks
CI efficiency updates nice!
I am surprised the red from RGB are the right "frequency" for plant... There are specialized LED for that. I guess this can be checked with spectrometer.
Keep multi language for the "release" and alpha and beta, ...
" randomly add one language at each PR"
"randomly" could be a selected sequences.
Successfully built on Linux x86-64 and runs on board with Wi-Fi tested.
That kind of policy sounds aimed more towards small/tiny projects and not major projects. Seems geared to avoid excessive forking of popular smaller projects.
Yeah that's a big decision that's an Adafruit Folks and company level thing.
Thanks! π
Thanks for hosting @slender iron β€οΈ
Thanks Scott for hosting!
Thank you all! That last topic was properly in the weeds! Hope everyone has a great week
Great discussions, lot of cool stuff happening in 2023. π
Looking forward to playing with pysigrok someday.
The wavelength of the red and blue LEDs on the RGB DotStars peaks within the desired range for plants. I figured it was worth trying.
There's a plan for a guide, anyway. π
Is this the same for other RGB that Adafruit carries ?
Here is the notes document for next Tuesday's CircuitPython Weekly meeting. It is 24 hours later than normal at 11am Pacific / 2pm Eastern on Tuesday the 21st 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/1CmvwiKPFPOibcQyH-xomxXlqLq3m5JrL8zcmr3qE5Qw/edit?usp=sharing
CircuitPython Weekly Meeting for Tuesday February 21st, 2023 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canβt make the meeting and would still l...
I just learned that CircuitPython code can be updated over Wi-FI on supported devices. (Thatβs awesome BTW!). The guide says it needs to be connected to a network with internet access to work. Are there plans to have a workflow where the CP device acts as an access point so the updates are as portable as from a USB cable?
Sorry if this is the wrong place to ask
@proud ember we are hearing folks want that. I generally dislike using AP mode but it shouldn't be too hard
It can work on a network without internet but it doesn't currently support if the ESP is the AP
Are you talking about firmware updates or workflow? They're easy to confuse the two.
this is the best place to ask
I was thinking about updating main.py. Not sure what the right term is
Ah, good to know! The use case Iβm thinking of is being able to update the code in an underground lab (with poor network connectivity) where things have to be sealed, so things with USB ports sometimes arenβt allowed.
That would be part of the wifi workflow which I thought could run locally without the need for an internet connection.
only /code/ needs internet
web workflow won't start the AP automatically but might be on that interface already. I haven't tried it
is web workflow and wifi workflow 2 different things?
i have yet to try either :/
no, I think of them as the same
I don't think "wifi workflow" is a thing
ohhh
its web workflow but only over wifi now π
got it
k, lunch time for me
it is possible to make your own custom way to update files automatically or manually by running a server on AP that would replace a local file that main imports for example
I want to see a library for that, that people can just setup and call in a loop
could you setup an esp to both act as the server and AP? that would be interesting.
yeah python code, like httpserver, should work in client or AP mode
entire local network on a chip, neat.
maybe you can
a person made a MP script called ugit that syncs the drive with the contents of a git repo, but I'm trying to make it easier to use and configurable
https://github.com/Neradoc/ugit-for-circuitpython/tree/circuitpython
also testing AP mode is really really annoying π
The CircuitPython AP channel is limited to the channel the station previously used to connect to the external AP. (if the station connects first)
you can have a device act as wifi AP and wifi station simultaneously, and as network client and network server simultaneously (note that there are some limitations on Pico W https://github.com/adafruit/circuitpython/pull/7101#pullrequestreview-1188988867)
Can you elaborate? I might be doing this at some point
well, you need a computer that connects to the AP to do the tests, the AP goes away when the board reloads since it's not implemented in settings.toml (yet), which might force you to reselect it manually every time, and your computer might not have internet access during that unless you have also an ethernet cable or something
but that's just when testing AP mode, most of the dev time you can be in station mode
and the CircuitPython IP address is 192.168.4.1, and that may conflict with your LAN, so you may not be able to have Ethernet enabled on your computer
I still plan on better implementing picow wifi stuff, but I really am out of free time.
It's buried down in my tasks list right besides the esp32-c3 serial issue
realizing we may be limited by the cyw43 driver
yea I plan on reading the source directly to figure out what to do
rpi docs really do not help here
my sense is that the Pico W SDK is not as mature and granular as espressif
Eh, it's still not even a year since picow was released
I presume in 2-3yrs it will be equally as mature.
The problem is than no other boards may utillise it.
rp2040's are used everywhere, but that wifi chip, only on picow
there is an open issue for web workflow over AP https://github.com/adafruit/circuitpython/issues/6795
is that right though? you can buy the wifi module, and I read the license on the driver and it allows other use
but does anybody ?
not that I know of
Father RP2040 W when ? π¬
that would be nice
father π
the granddad of picow
I tried it and coulnd't get it to work, maybe at least due to the AP starting after the web workflow bind
well now I have to leave the typo in, thanks π
jokes aside, a esp01 + sdcard hat for the pico form factor would be very powerful
I may make it in the summer
thanks for trying it @crimson ferry. it doesn't seem like it'd be that much work. π
it might work if starting AP was a settings.toml
Overall this looks like a good reorg! One question about the msgfmt.py added.
What LICENSE is this file?
having a way to start/stop the web workflow manually (that sticks on reloads) could allow for network hopping, and also double as a security feature (start the workflow on button press)
ah but that would also require making wifi connection stick during reloads too
well if setting.toml stuff run on every reload it really shouldn't be an issue
(which, I think is a feature we should have btw, settings.toml is too static)
if web workflow is on, I think the connection lives across reload
KeyboardInterrupt:
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 8.0.0-rc.1 on 2023-01-30; Adafruit QT Py ESP32S2 with ESP32S2
>>> import wifi
>>> wifi.radio.ipv4_address
192.168.6.179
what I'm saying is, if you wifi.radio.connect() to a different ssid, I don't think it sticks on reload ?
ah, right
sounds like something in need of a rewrite to me.
It feels like it should connect exactly the same way as setting.toml wifi stuff does
init'ing connection and web_workflow
there is no reason or benefit for the code to be different.
well, maybe there is actually.. not all ports that have wifi have web-workflow
but that could be solved by a simple #else
you mean non-native esp32spi?
Oh I was talking about the wifi module connections?
I was wondering which wifi port didn't have web workflow
Oh idk. I just assumed there are some
the thing is, in CP it's unusual to make things in python be persistent between reloads, but wifi access is worth it IMO, and is basically already there, it just needs python access to the feature
just how picow was a bit ago
sounds like a free pr to me
if only I had time
No idea, I only checked the DotStars. This is because they're the only ones that Adafruit carries that have fully-white LEDs, vs RGBW, which isn't enough brightness on the white for it to work, as far as I know. So if I'm already using the white DotStars, I might as well be using the RGB ones as it will be easier to wire up.
I verified things with research and LED datasheets. I'm sure you can do the same for other LEDs. Unless the datasheet is useless. π
Ah okay, cool! Iβll dig up the sk6812 data sheet as thatβs what I have laying around
web workflow (aka supervisor) and "code.py"/repl (aka python vm) are strangely independent consumers of the same wifi resource. So it would be weird if their wifi settings are in conflict. The supervisor gets its wifi settings from settings.toml at hard reset. The vm gets its settings from whatever is passed to wifi.radio.connect. I think the most predictable behavior is if the vm has to agree with the supervisor. So if web workflow is turned off, the vm can connect to anything. However if web workflow is on, the vm can only connect to the same wifi as in settings.toml (which is a no-op) and connecting to any other wifi is an error.
this is cool: https://github.com/community/community/discussions/16925
@tulip sleet I think it could be a "how to port" guide
and contain links to the test examples
though we should have them in the cp repo
not much there; I started doing it one way (more board-specific), but was asked to make it more general
interesting that its very test structured
I wonder if we could automate it by pairing with a known good port/board
the idea is that it would be a set of tests to help bring up a new board, to make it easy to test the functionality
or I could use this pysigrok code and have it logic analyze on the other side
I thought I was going to write a test for each and every pins, etc, but was asked to test basic functionality instead (does I2C work, etc.?). At least I think that's what I remember
Fixes #5956.
Fixes #2694.
- Add
safemode.py, which is executed first, beforeboot.py, but only if the board has been reset due to going into safe mode. safemode.pyhas no access to USB. Its output is not written toboot_out.txt, unlikeboot.py, to minimize possible problems. Ifsafemode.pyexits normally, the safe mode will remain in effect, andboot.pyandcode.pywill not be executed. The safe mode reason will be reported in the console as usual.safemode.pyca...
Will the safe mode reason persist into boot.py and code.py?
Will microcontroller.ResetReason change as a result of entering safe mode before boot.py, it's almost like a reset to enter safe mode then boot.py (?)
Will supervisor.RunReason continue to show as STARTUP?
Will alarm.sleep_memory survive the transition from safemode.py to boot.py (and to code.py)?
Will the safe mode reason persist into
boot.pyandcode.py?
You can't enter boot.py or code.py if you are in safe mode, so that is moot. But if you get into the REPL, then supervisor.runtime.safe_mode_reason is preserved.
Will
microcontroller.ResetReasonchange as a result of entering safe mode before boot.py, it's almost like a reset to enter safe mode then boot.py (?)
Will
supervisor.RunReasoncontinue to show asSTARTUP?
ResetReason and RunReason are ...
Thanks, Dan. (I currently track reset and reload reasons and stats, using alarm.sleep-memory to carry data from boot.py to code.py, so I'm mainly trying to figure out when and how to know that a safe mode occurred and persist some data about it, and count it only once - maybe set a flag on disk in safemode.py, and clear it in boot.py.
maybe set a flag on disk in
safemode.py, and clear it inboot.py(after themicrocontroller.reset()).
You might able to use SleepMemory for this, even without alarms. Or nvm might work, if you don't get into some tight loop that writes flash too often. I have thought about some kind of nvm-ish thing that's just a block of RAM (special in a hardware sense or not) that's preserved over resets. On some ports that's how SleepMemory is implemented, but SleepMemory could also b...
So I misunderstood what COMPLETE_MEMORY_READS was doing and clearly over used it in the update for the zero w. I've pulled all the calls I added for that update out and I'm testing it now. The only one remaining that I added was at the very end of the code just before the PWM function of the pin is turned off. I feel like that one might be needed but I guess I'll do some tests.
I don't think sleep_memory survives reset, at least on espressif currently, and it's not available in all ports (e.g., raspberrypi). But yes, nvm sounds good as a viable alternative to CIRCUITPY for infrequent occurrences, thanks.
after a UF2 is loaded (espressif), time.localtime() seems to be randomized / undefined (rather than 2000 01 01, as after a reset), and can be outside the representable limits of time.mktime() - is this expected?
when it restarts after dropping a UF2 ? I wonder what could possibly cause that !
yes, and I don't recall that happening until recently (it started triggering an exception due to some time processing I do in boot.py)
struct_time(tm_year=1943, tm_mon=1, tm_mday=27, tm_hour=3, tm_min=46, tm_sec=46, tm_wday=2, tm_yday=27, tm_isdst=-1)
that is unexpected !
I don't think it used to do that
espressif keeps time across microcontroller.reset, so some execution path is different from that
Thanks for the help
Updated this (and the other doc) to be more specific to what it does.
Just a comment on this: I removed it as the unix port was not building with OnDiskGif compiled in now as part of gifio. The only test I saw using this was the one on which modules were built in. If I'm missing something please let me know.
https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code#workaround-for-pre-commit-issues-on-ubuntu-and-debian-3086216 @tulip sleet I think that they eventually put in a workaround for this within setuptools, it might be worth checking whether the section is still necessary .. or maybe it's better to leave it because someone might still have an affected version on some system they're using
That is neat -- circuitpython/tools/convert_release_notes.py may want to recognize this.
While trying to undo safemode.py on a board this morning, I realized that my safemode.py was catching USER safemode, which is when you press the reset button during boot to deliberately going into safemode.
One solution to this is to not run safemode.py if it's a USER-initiated safe mode. The other is to assume that safemode.py is going to let that safe mode pass through. Any opinions?
Is there any relationship between the circuitpython and micropython i2s systems? Seems like they were developed at about the same time?
one might have cribbed from the other, but generally the peripheral-level API and C code is different on CircuitPython and MicroPython
if I'm trigging a user safe mode I assume it's because I can't get to the REPL any other way. Could a casually written safemode.py block that?
If I'm trigging a user safe mode I assume it's because I can't get to the REPL any other way. Could a casually written safemode.py block that?
Yes, if it did a microcontroller.reset() without checking if supervisor.runtime.safe_mode_reason == supervisor.SafeModeReason.USER.
CircuitPython version
Adafruit CircuitPython 8.0.0 on 2023-02-06; ESP-C3-32S (2M)
Chrome + Adafruit ESPTool
Thonny 4.0.2
Code/REPL
# no code yet
Behavior
I tried several different languages versiona of the ROMs and it appears to be the same for 8.0.0
But when I turned to 7.3.2, it worked as expected.
I use Chrome and Adafruit ESPTool for burning and Thonny as serial monitor. when the device boot up, LED blinked as expected, but then the seri...
I was trying to understand how to extend the circuitpython implementation to do 32-bit-per-sample i2s, it's tricky
which chip?
we have enough trouble getting non-glitchy audio in some circumstances. Higher-resolution audio did not seem like a high priority
are you trying to do high-fidelity, or are you using I2S for some non-audio data purpose?
there are clicks and pops sometimes at start and stop; we would like to address all this, but it probably requires a revamp of audio handling in general
I noticed the micropython version has its own 256-sample DMA buffer, and the circuitpython one seems to be a little more abstracted. All I wanted to do was to bit-shift the audio to do volume control. Using the RP2040 and soon the ESP32C3 plus the MAX98357A DAC. Since the ARM chips tend to have a single-cycle multiplier, you could multiply the samples before copying them into a DMA buffer to do all the necessary bit shifts or overall volume control. (I opened an issue to propose this)
There's also supervisor.SafeModeReason.PROGRAMMATIC (from microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE)?) that could be used in code to bypass filtering of supervisor.SafeModeReason.USER.
I've been testing safemode.py and everything has been working as expected. It can write to nvm or the filesystem to retain some info about the safemode, do a microcontroller.reset() to proceed with the boot.py and code.py sequence. For those intermittent safe mode occurrences, it will keep the device running. Very nice!
If safemode.py can write a new boot.py file... being able to modify storage.remount options by using the "safe mode" button sounds like it could be useful. Perhaps a case for a supervisor.set_next_boot_file feature :grin:
I'm using storage.remount() to write a safemode_out.txt file.
Updates CI to use actions running on Node.js 16 to avoid deprecation
anyone know what this may indicate?```
boot.py output:
...
it's not something I'm explicitly printing
Looks like dependencies have been merged now.
It looks like this has been sitting around for over a year. Any plans to finish, is it maybe done already, or should we scrap this?
@crimson ferry ```c
#ifdef CIRCUITPY_BOOT_OUTPUT_FILE
if (boot_output != NULL) {
// Ensure boot_out.txt is capped at 1 filesystem block and ends with a newline
if (len + boot_output->len > 508) {
vstr_add_str(boot_output, "...\n");
thanks!
if there are good reasons the cap can probably be increased.
didn't have \n
I don't have a strong preference, the cap is easy enough to work around at that level, can write to another file
also note how it doesn't try to print the partial message, so if you're printing just one large thing that comes to a single call in mp_hal_stdout_tx_strn it'll just get turned to "...", not the first ~500 character and then "...".
I was bringing some data forward from safemode.py
Build artifacts are here: https://github.com/adafruit/circuitpython/actions/runs/2032460774. Click on the lilygo "Details" link above, then click on "Summary", and then scroll down.
These have expired and are no longer downloadable, is there anyway to get this?
Pushing an empty commit should trigger a rebuild.
It appears LilyGo won't provide a PID, @raspberrypi said LilyGo is the only one that can request it from them but they'd look into it.
It sounds like @tannewt is o...
I noticed that the board_id and board filename don't match the actual board's id: lilygo_t_display_rp2040. This must be older than the additional checks we added in last year or it likely wouldn't have passed.
One solution to this is to not run
safemode.pyif it's aUSER-initiated safe mode.
I implemented this on the latest commit, because I believe the expectation would be that user-initiated safemode should prevent anything from running, so you can do code repair. Also documented this.
The README.rst could use more work in long run to make it more comprehensive. It sometimes takes a "this is different than MicroPython" viewpoint, and should probably stand on its own. (That's true ...
we should fix this
so that print("x" * 1024) in boot.py will print ~500 "x" then "...\n"?
if (len + boot_output->len > 508) {
+ vstr_add_strn(boot_output, str, ??? arithmetic ???);
vstr_add_str(boot_output, "...\n");
yes, somethign like that, or maybe even say [truncated due to length].
perhaps I even meant to do that when I wrote that code
maybe you did π
yup, it was you https://github.com/adafruit/circuitpython/pull/5536
did we discuss the selection of the 1-block maximum? I'm not actually sure the motivation.
- write any partial message
- instead of "..." show a sensible (translatable) message
This does slightly lower the amount of data that can be printed, and makes the exact amount dependent on the language. However, if boot.py intentionally needs to produce larger amounts of output, it can deliberately mount the filesystem in RW mode and perform any writes needed. In that case it's up to the boot.py to choose an appropriate way to limit the number of writes if needed for the application.
This picks up any bug fixes that were initially made on the 8.0.x branch into the development version.
@tylerdcooper @kattni this is largely done, do we want to push this out after validating it's OK?
hello everyone, it's been a long time since I tried some custom circuit python.
I'm currently exploring a way to produce a dedicated port for the Lilygo T-embed ESP32-S3
The build setup documentation has a dedicated chapter for espressif (even if it's strange to see it after all other chapters)
My issue is that during the esp-idf/install.sh step, I encounter an error:
ERROR: This script was called from a virtual environment, can not create a virtual environment again
I always work on my python projects from venv python and I don't know if there is a known way to install esp-idf anyway
@onyx hinge my [truncated due to length] suggestion was a mild one, and makes for extra code and translations. Maybe it's not worth it?
@onyx hinge different topic: https://forums.adafruit.com/viewtopic.php?t=198806 are ESP32-CAM and ESP32-EYE different things? It's a strange error
idf creates its own venv which is activated when you do source esp-idf/export.sh
so I have to exit my venv, use this one then install again the general build requirements. Maybe a quick note at the beginning of the setup documentation will help.
Thanks
This function is expected to be implemented by the port. Without it, it results in a link error if it is needed.
@tulip sleet yes esp32-eye and esp32-cam are different products. someone tried to add support for esp32-cam but we never got the camera to work iirc. closed PR https://github.com/adafruit/circuitpython/pull/6827
Support for the ESP32-CAM board from AI-Thinker (http://www.ai-thinker.com/pro_view-24.html)
Tested:
Wifi, including web workflow
Both onboard LEDs (on IO4/IO33)
IO0/2/12-15
Onboard microSD card vi...
I forget, it seemed like the esp32-eye had some limitations too but I am confident the camera worked at a minimum basic level.
I belatedly notice about the code here that the i2c bus is left locked when the camera constructor is called. This is incorrect and should result in an exception. It should now result in an OSError with the errno value of EWOULDBLOCK. But at the time this PR was in progress, the problem might not have been detected.
We can always tweak it later with an additional PR if it's not perfect.
@tulip sleet because Q2's gate is pulled up to 3V3, does that cause it to conduct or not to conduct by default when CAM_PWR is not otherwise driven?
(that's from the esp-cam's datasheet)
there's no sw control of the camera's actual powerdown or reset pins π¦ just this control over its regulators
i get confused by FET schematic symbols, looking...
me too, thank you
https://www.vishay.com/docs/70611/70611.pdf it seems it has to be pulled LOW to conduct
phone call...
np
I think that's consistent with how the esp32-camera library treats the power down pin ```c
if (config->pin_pwdn >= 0) {
ESP_LOGD(TAG, "Resetting camera by power down line");
gpio_config_t conf = { 0 };
conf.pin_bit_mask = 1LL << config->pin_pwdn;
conf.mode = GPIO_MODE_OUTPUT;
gpio_config(&conf);
// carefull, logic is inverted compared to reset pin
gpio_set_level(config->pin_pwdn, 1);
vTaskDelay(10 / portTICK_PERIOD_MS);
gpio_set_level(config->pin_pwdn, 0);
vTaskDelay(10 / portTICK_PERIOD_MS);
}
this is esp-cam related too: https://forums.adafruit.com/viewtopic.php?p=960484#p960484
yeah that is the same author as the thread dan led with -- did they double post it?
Here's what I have so far for a reply.
The esp32-eye and esp32-cam are different products, the eye is from espressif and the cam is from AI-Thinker (and possibly other vendors). It might load to work the bin file for a different board but it also might not.
A community member also tried to get the camera to work on the esp32-cam with a new board definition but failed with the same error: https://github.com/adafruit/circuitpython/pull/6827 -- we were unable to resolve their problem.
I notice that in your example, the "external clock" pin (clock input into the camera module) is not specified. Unless the camera is fitted with its own clock source this is required for the camera to operate. However, since some camera modules are fitted with their own clock sources (such as the Adafruit ov5640 breakout) we do not treat failure to specify the pin as an error.
Another possible problem is power and reset control of the camera. In the schematic, you will see that CAM_PWR is connected to p-channel mosfet Q2. This pin must be pulled LOW in order for Q2 to conduct and supply power to the camera module. This GPIO should be specified as the powerdown_pin= in the camera constructor.
I'll check it out again today to make sure there are no regressions, and request a review. Tyler is good with it still as well.
allocate_memory doesn't return a pointer to the memory directly. It returns a pointer to a struct that includes info about it. https://github.com/adafruit/circuitpython/blob/main/supervisor/memory.h#L65
I'd probably make it work more like the heap and have it passed around instead of a global.
Sounds good. I just fixed the merge conflict.
@onyx hinge I think your interpretation is correct. There are few clear explanations but this is one: https://circuitjournal.com/which-mosfet-should-you-use-with-arduino
OK, posted
Backported to 8.0.x as part of #7566.
@slender iron @onyx hinge I am going to do an 8.0.1 release. It has the Scorpio fix, i2CDIspaly deinit fix, exception chaining fix, sh module 2.0.0 fix, and Spresense SDK update. I don't see any other outstanding PR's to include. Sound ok to you?
that sounds like a good round-up of stuff!
We should probably start doing spdx in the core files
@analog bridge is your CI PR ready?
Without reading too far into this, I think it's fine. Like Melissa said, we can always tweak it later if necessary.
This looks really good. Thank you! Just a couple comments on getting it enabled everywhere.
Does this mean we don't have it on trinket m0?
Let's leave it on everywhere. As I said in the meeting, this board can be made smaller by turning off terminalio for ru,ja,ko translations where we don't have the font characters anyway. (we do this on samd21 already)
It doesn't fit on most M0 non-external-flash boards. On Trinket M0 it just barely fits. Other boards have more pins and push the builds over the edge.
@deshipu This would mean adding the below to pewpew_m4/mpconfigboard.mk and leaving CIRCUITPY_SAFEMODE_PY on. Does this align with what you want for this board?
# We don't have room for the fonts for terminalio for certain languages,
# so turn off terminalio, and if it's off and displayio is on,
# force a clean build.
# Note that we cannot test $(CIRCUITPY_DISPLAYIO) directly with an
# ifeq, because it's not set yet.
ifneq (,$(filter $(TRANSLATION),ja ko ru))
CIRCUITPY_TERMINA...
Getting images for this yet, just have placeholders right now
FYI, this does not fix issue 7333. It unblocks my debugging of that issue. That's how it is in my issue_7333 branch.
Examples: arduino_zero has 848 bytes free for the fr translation without CIRCUITPY_SAFEMODE_PY, it too big, with -12 bytes free with it enabled. feather_m0_basic withde_DE` has only 124 bytes with it enabled. And I expect the ones that barely fit to grow when the shortened messages are retranslated for the more verbose languages.
CircuitPython version
Adafruit CircuitPython 8.0.0 on 2023-02-06; Kaluga 1 with ESP32S2
Board ID:espressif_kaluga_1.3
Code/REPL
# SPDX-FileCopyrightText: Copyright (c) 2023 Jeff Epler for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
This demo is designed for the Kaluga development kit version 1.3 with the
ILI9341 display. It requires CircuitPython 8.
This demo needs multiple settings properly configured in settings.toml:
CIRC...
The demo is intended to be a 'webcam' that refreshes every 5 seconds.
I don't know if it's because of some wifi / camera interaction, or because of the repeated requests, or what.
I have the httpserver streaming mjpeg from the camera on esp32s2 working, and didn't see any hardfaults. The only difference is that I never close the socket, since it's mjpeg.
Oh, and no pwm for the master clock, I use an external crystal.
Re https://github.com/adafruit/circuitpython/issues/7333
It is because of code missing MICROPY_PY_LWIP_ENTER/EXIT blocks.
The is a lot of code missing these blocks. In lieu of a better solution, should I go nuts adding these blocks everywhere they are required?
the particular code responsible for the issue is mdns_server_construct, but inspecting elsewhere there are a lot of other places (e.g. in socketpool).
@onyx hinge ^^
@timid bolt I think so, but Jeff has the last word on this. Could you paste a comment saying the above to the issue?
sounds great, I love it when bugs are fixed.
Fixes #713
Fixes #1136
@timid bolt is it missing mainly in bind-listen-accept? I can do client sockets 'til the cows come home with no safe mode
Not particularly. The bug is not deterministic. Most of the time everything will be fine.
qq: why do we use the "raw" lwip interface, instead of the higher-level and thread-safe "socket" api?
@timid bolt sorry I thought you were talking about the espressif issue... ignore my "client sockets" comment
(7333 rp hardfaults is very reproducible; 7459 espressif hardfaults is sporadic)
In rp2040? The code was mostly taken from the MicroPython impl
One was <p> and one was <div>. I made them both <div> for consistency, but that was a bad idea.
I think the higher level API requires an RTOS
Automated website update for release 8.0.2 by Blinka.
CircuitPython version
Adafruit CircuitPython 8.0.0 firmware, Raspberry Pi Pico W with rp2040
Code/REPL
import os
import time
import ssl
import socketpool
import wifi
import adafruit_minimqtt.adafruit_minimqtt as MQTT
try:
# Localhost broker address and port
MQTT_BROKER = '192.168.0.42'
MQTT_PORT = 1883
# WiFi network configuration
WIFI_SSID = 'my-wifi-ssid'
WIFI_PASSWORD = 'my-wifi-password'
# Define the callba...
I can reproduce the issue with very little code. Here's an example, where I hit ctrl-c as soon I see the reload happening.
> ls -lR /run/media/user/KEYBOARD-R/
/run/media/user/KEYBOARD-R/:
total 4
-rw-r--r--. 1 user user 158 Dec 31 2019 boot_out.txt
-rw-r--r--. 1 user user 0 Feb 12 12:29 boot.py
-rw-r--r--. 1 user user 76 Feb 14 21:17 code.py
> md5sum /run/media/user/KEYBOARD-R/* ; time sleep infinity;
4a0087c900ac9ba765eb7ff94962a656 /run/media/user/KEYBOARD-R/boot_out....
The socket API requires freertos too
At least that's what I recall
I got it.
Adafruit CircuitPython 8.0.0-4-g1f1a495e26-dirty on 2023-02-15; Raspberry Pi Pico with rp2040
>>> import os
>>> a = "exec(a)"
>>> exec(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line ...
@slender iron @onyx hinge @tulip sleet I asked scott to enable merge queue but on further reading the docs, I am not sure it will work as expected with the current ci/repo configuration and I need to test it first. Please disable it before merging any PRs.
Uhh so you guys.. I made the whole settings.toml logic..
it works
it's just that..
getenv doesn't work
even after boot
int's don't work??
Ah nvm filesystem was corrupt
Now I only need to test stackless via settings.toml and we are good.
Yea stackless isn't working by just not allocating..
I will have to figure that out
But yea let's first get the commits up and the branch changed.
This pr is the replacement for #7396.
It aims to provide a way to configure pystack size after the build.
It also will provide a way to use stackless without rebuilding.
Currently working:
- [x] pystack is now a supervisor allocation.
- [x] Resize via settings.toml
- [ ] Support stackless by setting value to 0.
Closing in favor of #7585.
@slender iron @tulip sleet I have turned the setting back off for the main branch. (it's under branch protection rules, it took me a bit to find it)
@onyx hinge re the MicroPython ticks_diff email I sent. Deeper in the discussion is this: https://github.com/orgs/micropython/discussions/10723#discussioncomment-4977540 where it's pointed out that the more complicated diff is for differences < 32 bits, which is true for our case. So never mind, I believe, though it's interesting.
Are the non-release builds wiped from S3 bucket on a new release?
@tulip sleet probably knows
@analog bridge I do it by hand with aws s3. I didn't mean to delete the very latest PR builds last night: I mistyped a glob pattern. I usually try to keep a couple of weeks of PR releases around so that people can do simple bisecting.
I have thought of automating it, but it's easy, and I can apply some judgment to the current situation.
[huh I haven't really used github discussions before. on an initial look I'm finding it REAL HARD to differentiate between the text of a reply, and quoted text, due to the presence of those vertical bars to indicate them]
you mean the leftmost vertical stripe is confusing?
@timid bolt TaskGroup PR for MicroPython: https://github.com/micropython/micropython/pull/8791 I am not sure we would have the async with problem that is being discussed: we don't use "native emitters"
yeah there are a bunch of vertical things of differing thicknesses, and some of them indicate quoting and some don't
so a strip that starts at an avatar pic is a reply. You could open an issue or a discussion on GitHub about this. They seem receptive to fixing various UI things.
could be a different color or a dashed line, etc
the whole background is diff color now, so not sure of the purpose of the line
I agree, it's possible to figure it out when 'looking globally', and probably once you're proficient with the site. but for a person looking for the very first time, the entirety of jimmo's most recent post "looked like" something to skip over because it was (A) greyer than the rest and (B) had a vertical line, commonly used to indicate quotation. I'm just being a bit of a complainer, not really looking for a solution.
so yeah just wanted to complain
I guess nested replies is a bit helpful, but I always wonder where to reply in these kinds of sturctures
yeah I used to swear by threading in my messaging apps (trn, mutt) but now I'm more convinced that there's something good about the way forced-linearization of gmail threads & github issue discussions work actually. I wonder how you'd research such a topic
(because deeply nested and now very off-topic sub threads were a fact of life with the threaded way, and are broadly discouraged with the linearized way)
If all goes well, pushing in 5, ready for review.
Stackless will not be implemented with this pr as it would require modification of every gc function call.
And honestly there isn't much benefit to that since adjustments can be made on-the-fly.
Also, the settings.toml variable CIRCUITPY_PYSTACK_SIZE will be multiplied by size_t, so that the user cannot give invalid sizes (pystack_size % sizeof(size_t) == 1)
it would require modification of every gc function call
Could you explain why this is? Could you use a global instead?
It's all good. I already fixed it with CSS and combined it in the CP Installer I'm working on, which is why I self-assigned.
Sure, gc_collect_start initially defined in py/gc.h:61 and populated in py/gc.c:365 contains the problematic piece of code:
#if MICROPY_ENABLE_PYSTACK
// Trace root pointers from the Python stack.
ptrs = (void **)(void *)MP_STATE_THREAD(pystack_start);
gc_collect_root(ptrs, (MP_STATE_THREAD(pystack_cur) - MP_STATE_THREAD(pystack_start)) / sizeof(void *));
#endif
This code block is disabled on stackless.
However, leaving it in, when a pystack is not allocated and initial...
Although passing the stack allocation as a parameter is a sensible thing to do, the trouble here is that that parameter is dependent on MICROPY_ENABLE_PYSTACK. I don't think it is neat to #ifdef the function signature. So I would probably move the heap and stack allocation calls inside start_mp to minimize #ifdefs and duplicated code.
getenv.c should be usable from pure C code. I think it only depends on Python for throwing exceptions. The exception handling code can be moved to shared-bindings/os, then shared-module/os/getenv.c can be used from pure C. This avoids the trouble of re-allocating the python stack once python is up.
If I set the gcc flag -Og (optimizations for debug), the variables _ld_dtcm_data_size and _ld_dtcm_bss_size in ports/raspberrypi/supervisor/port.c are bogus. Does anyone know why?
what is the rule for using main versus the 8.0.x branch ?
something that is a bug fix that should get in soon should be on 8.0.x. It is easier to merge from 8.0.x to main than to to cherry-pick from main to 8.0.x.
new boards ?
new boards can be in main. I will make a 8.1.0-beta.0 soon enough and it will have the new boards.
I want to make one within a week or even this week. would have safemode.py and maybe the bangle.js
a lot of people are afraid to use something not marked as "stable"
ok
I cannot see any obvious reason. If you compile -O2 vs -Os, or -O1 or -O0, do you see problems also? Is it optimization, or is it the addition of debugging info? How are they bogus?
-O1 seems to work and is debuggable. So I can go with that.
$2 = 16843009
(gdb) p _ld_dtcm_bss_size
$3 = 4286773247```
I looked at the .ld files but there was nothing obvious to me
Yeah, it's definitely bizarre. π€·ββοΈ
I was kind of in a hardcrash frenzy due to the filesystem. I will have to revalidate it later.
In stackless, pystack is being passed uninitilized. The warning is suppressed with a #pragma.
The function decleration is not #ifdef'ed.
Also, start_mp is being run multiple times. Meanwhile the way I am doing it, the pystack is allocated once.
Perhaps it would be good to try to have it in start_mp regardless, so that it gets resized on reload.
Got rp2040js working with CircuitPython with a filesystem!
@timid bolt I notice
>>> hex(16843009)
'0x1010101'
Is _ld_dtcm_bss_size in RAM? does something else write to it? maybe a watchpoint would be enlightening.
(and should it be in RAM? can it be made a constant that lives in flash instead?)
Thank you so much for persevering on this! You are getting there. I added a few suggestions around the structure.
Why remove this attribute? It doesn't seem related to this change.
I do think you want to pass in the pystack allocation because you'll want to free it after mp completes. You don't need to pass in the size though because you can do get_allocation_length() like is done for the haep.
This is extra and done at a deeper level. You'll want to do the pystack deeper as well so that its size can be changed between reloads.
In my case:
- wait for safe mode flashes the led
- the led on a pico-w needs the cyg43 driver
- the cyg43 driver prints to console that it loaded
- print crashes since uart is not initialized
This only happens if the console uart is enabled, which it is not on production builds of this board.
The md5sum won't consider file metadata. There may be writes to the FAT filesystem itself rather than the files in it. You could add a print within circuitpython if you are really curious about what block is being written to trigger the reload.
Does other code work with the jupyter kernel? 8.0.0 added status bar updates from circuitpython that the kernel may not know to ignore. (Thonny does)
I have this change in #7497 already too.
Hrm. I agree it'll likely grow with the new error messages. This feels like something that should be available everywhere. We can leave it disabled for now and enable it later when we figure out how.
interesting @proven garnet ! what do you plan to do with it?
The original inspiration was using it in CI, specifically for seeing RAM usage changes when libraries are updated, but I'm sure there's a bunch of things that could be done with it.
π
yeah that's a thing I would love to see, and getting memory dumps and learn more about the behavior of memory in general, make graphs (videos) like that π
https://youtu.be/baa5ILZTRkQ?t=856
Live stream of @tannewt debugging memory issues in CircuitPython.
Visit the Adafruit shop online - http://www.adafruit.com
LIVE CHAT IS HERE! http://adafru.it/discord
Adafruit on Instagram: https://www.instagram.com/adafruit
Subscribe to Adafruit on YouTube: http://adafru.it/subscribe
Join our weekl...
WTG @proven garnet
I can create actions for setting it up in the CI and then have it be modular from there. I'm thinking that'll feed into those other things. I'm going to PR this upstream with instructions in the README, so I can post here for those interested in trying it out locally.
Yea I kinda reworked it a bit, now it realloc's on reload (if needed) and it no longer multiplies the value it gets by sizeof(size_t). It got too confusing to calculate, even for me who wrote it.
Ended up turning them back to globals in hopes of simplifying.
Pystack has to be allocated before heap, so this means it will have to be allocated before start_mp, hence the function I made.
Well with how I did it now, neither is needed
Circuit Python in a browser!
Browser in Circuit Python.
I will eventually make a tui browser.
I have rewritten nano, how much harder can it possibly be.
First I should make a proper html renderer though.
If I can render it to a file it should be as simple as wrapping less and giving it a bottombar
lynx seems like a natural progression from nano
Now all are done right before heap allocations and are free'ed on vm cleanup.
Yea it works a-ok without heap. Big oops from me. Fixed it.
note that rp2040js is the wokwi emulator, if you haven't seen it
https://wokwi.com/projects/new/circuitpython-pi-pico
I could discard pystack_size huh
Imma do that too.
every byte counts
So. What should I do when the setting.toml value is invalid??
currently the code just defaults back to build default
Maybe print a message? Or trigger safemode?
And perhaps it's not wise running the resizable pystack code in safemode
For now making it a message.
It's not a fatal error really, we can just fallback to build default
However I should make checks as to if the alloc failed
if it failed it should redo the build default.
No idea how to check but fine
I will try it out, gdb will show which alloc failed.
@brazen hatch I'd use the build default
Oh it does use it in any and all errors, I'm just talking about the error message.
I wouldn't add an error but it might be worth making it possible to read the value from python code
that way you could verify it worked
kk
Added error messages, and safety for allocation failures. Now it's pretty much perfect.
All done.
Hello,
I hope I'm not being nitpicky, I appreciate all the work that you do and love your products.
The feather 2040 board neopixel is too bright, it has that kind of led intensity that it can create a bright spot in your vision for an hour, I don't think that can be good for the vision long term without any diffuser.
And this wouldn't be a problem if it weren't on by default right as you flash it and run hello world.
It is also inconvenient that in order to turn it off I have to ...
No you are not the only one who feels like neopixels are brighter than the sun.
Honestly they should never be used with a value > 5/255.
My eyes are sensitive to light and I work in pure darkness.
Night turns to day once I plug a neopixel board.
And god forbid I open the repl.
I use the waveshare_rp2040_zero.
You can change it from Python code with supervisor.runtime.rgb_status_brightness = 0
With 8.0.0 the LED should only blink unless you are in the REPL. Default brightness is 50
I think we can look at changing the default brightness. It is 63 for neopixels, 50 for dotstars. (Out of 255)
It should remain visible in well lit environments by default though.
Maybe we can also change the REPL behavior ?
@timid bolt Hi - are you preparing a PR to add MICROPY_PY_LWIP_ENTER/EXIT, or are you working on something else? Fixing 7333 would be great. This could be an 8.0.x PR
if you are busy someone else can do this
With "getenv" being used so far down in the stack, I think we should acknowledge that os_getenv is a mandatory module now.
The problem here is that pystack is not defined if not MICROPY_ENABLE_PYSTACK, which is a compile error.
Unfortunately the #define really makes a mess of what is otherwise simple code. Idk, the best solution, but you might consider creating a struct that contains heap and pystack if enabled. Return this struct from start_mp and pass it to stop_mp. This way all the MICROPY_ENABLE_PYSTACK nonsense is contained to this struct and those functions.
Do you need `noinline? I'm not sure why it is needed on other functions.
I would write this as:
if (getenv_err != GETENV_OK) {
serial_write_compressed(translate("\nWARNING: Invalid CIRCUITPY_PYSTACK_SIZE, defaulting back to build value.\n\n"));
pystack_size = CIRCUITPY_PYSTACK_SIZE;
}
pystack_size = MAX(pystack_size, CIRCUITPY_MIN_PYSTACK_SIZE);
Because:
- You need to check for a parsing error in
common_hal_os_getenv_int. - I don't think
pystacknot being modsizeof(size_t)is a real error. Just let integer division round it d...
I am working on it. It turned out MICROPY_PY_LWIP_ENTER wasn't the solution to the issue. It was something else, which I'll send a PR for, and an explanation in the PR. I will send a PR for MICROPY_PY_LWIP_ENTER too since it is still technically needed.
great, thanks!
my two cents, it is bright, If I need to look to a pin silk forget it.. I need to put my finger in the LED. btw 90% of the time I work in the REPL :) But, just a disclaimer I need glasses to see small things
Personally, I feel like super-slim builds still have their place.
getenv isn't needed in those.
- No, if for any reason it fails, it will not update the value. The same thing was done on web workflow (from which I copypasta'ed).
- Uhh, it sure could be rounded down, as a matter of fact imma do it right now.
- Yea, a guestimation on my part. Wouldn't call it the ideal value but fine. Someone should test that.
An excellent idea, doing it.
I have absolutely, not a single fragment of a clue as to what it does.
But.. It looks cool, so I put there.
As a short term work around:
import board
import neopixel_write
import digitalio
pin = digitalio.DigitalInOut(board.NEOPIXEL)
pin.direction = digitalio.Direction.OUTPUT
pixel_off = bytearray([0, 0, 0])
neopixel_write.neopixel_write(pin, pixel_off)
import supervisor
supervisor.led_status_brightness = 0
will turn it off (as mentioned by @tannewt above).
https://docs.circuitpython.org/en/latest/shared-bindings/supervisor/index.html#supervisor.Runtime.rgb_status_brightness
@wraith crow I don't want to add to the thread, but note that changing the LED in code does nothing, it's off by default, and the core takes control of it anyway, I believe the OP was talking about the REPL (hence the one-liner they posted)
maybe someone using Thonny (which sits in the REPL until you press "run", not the CP normal workflow, but one used by some people)
I was just working with the neopixel_write module so it was fresh in my mind π€· I was thinking it would be an option to type/paste in the REPL
yeah a little long though
Clearly Scott's/Dan's suggestion is the way to go π
@tannewt Correct. Here's another test that hopefully shows that the metadata has not been modified as well.
> stat /run/media/rarnaud/KEYBOARD-R/* >before.txt; cat /run/media/rarnaud/KEYBOARD-R/code.py; time sleep infinity;
from time import sleep
print()
while True:
print(end=".")
sleep(2)
^C
real 0m37.156s
user 0m0.000s
sys 0m0.002s
17:31:39 - MBA-FEDORA:~
> stat /run/media/rarnaud/KEYBOARD-R/* >after.txt; diff before.txt after.txt
How would I acti...
It should remain visible in well lit environments by default though.
I'm guessing the white led signals that the board is working correctly.
But it is very bright, specially the white which is all at the same time. So I would either suggest lowering the brightness significantly or having that as an optional documented feature that you could enable easily rather than blinding unexpected people right after the flashing reboot sequence.
if I remember correctly, the default for dotstar was influenced by the FunHouse having 5 LEDs on top of it, which was not fun when in the REPL π‘ π‘ π‘ π‘ π‘
The metadata can be something invisible to you via the filesystem, such as the dirty bit. Or it may be that the host is doing a write that does not actually change a block.
The way to do the print is to be able to build CircuitPython yourself, and then insert an mp_printf(&mp_plat_print, ...) at the right place in the code. An alternative to this is to use wireshark and look at the USB traffic, which does not require a rebuild. wireshark I think will be able to parse the SCSI-like comman...
The proximate cause of this issue here, where this memory allocation fails.
timeout = (struct sys_timeo *)memp_malloc(MEMP_SYS_TIMEOUT);
This raises two questions:
- Why did the memory allocation fail?
- Why wasn't the failure more fatal (e.g., crash instead of continue as usual)?
Why did the memory allocation fail?
LWIP uses statically sized arrays from which it ...
Implemented struct stacks that contains pystack and heap.
If stackless only heap.
or maybe I just got used to it π π§βπ¦―
we have had sample variability in the status LED's. I can't remember if it was just dotstars -- it was some tiny ones. It's hard to pick a standard brightness
I was thinking it could be a define that can be overridden per board, especially for boards that have multiple LEDs
that would be a good idea; in the case i mentioned, it was the same board that had wildly varying brightnesses based on manufacturer or batch
hmm
I think we could come up with a better name for this. I suggest:
stacks -> vm_memory_t (the _t suffix is the convention for typedefs in C)
alloc_stacks -> allocate_vm_memory
combo -> vm_memory
I don't think you meant to have the #if around this function.
You should build this change without MICROPY_ENABLE_PYSTACK to ensure it still builds.
Re #1: but then the user doesn't get an error message about their settings file being bad
If it's not required then remove it.
It tells the compiler not to inline this function, which is something you usually don't care about.
Tested and confirmed that this fixes issue #7333
@gneverov Could you change the base to 8.0.x and I will get this in the next 8.0.x release? Thanks!
CircuitPython version
Adafruit CircuitPython 8.0.0-6-g58c0c2212 on 2023-02-14; Adafruit QT Py ESP32S2 with ESP32S2
Code/REPL
# after setting the internal rtc
>>> import time
>>> time.localtime()
struct_time(tm_year=2023, tm_mon=2, tm_mday=15, tm_hour=17, tm_min=4, tm_sec=22, tm_wday=2, tm_yday=46, tm_isdst=-1)
>>>
>>> import microcontroller ; microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE) ; microcontroller.reset()
[17:04:54.884]...
@tannewt ok it fits on all the enabled builds now!
I don't think I'll add X channel support because it'll limit frequencies to the prescaler capable ones. VAL1 is used for top value usually but then it leads to a low pulse every cycle on X. This would prevent 100% duty cycle.

What do I have to do to make the 8.0.x branch appear in my fork on github?
git fetch adafruit 8.0.x:8.0.x assuming adafruit is your name for the upstream remote. I think it used to be there automatically. I was puzzled why it was so hard.
i had to do a lot of websearching to find this for myself yesterday
I don't think we need to benchmark but we should confirm we are in high speed mode. (I can with a Beagle.)
but your q is on github, oops, that I haven't researched yet
maybe if you just do it locally and then push
well, I have the 8.0.x branch appearing in my github repo, however if I rebase my commit to be on top of 8.0.x, I cannot push it back to my github repo
what branch are you trying to push to? whats the error? @timid bolt
I want to rebase gneverov/issue_7333, the branch of this PR (https://github.com/adafruit/circuitpython/pull/7589) to be off gneverov/8.0.x instead of gneverov/main, where gneverov=https://github.com/gneverov/circuitpython.git
and you have it rebased locally? you can likely do --force-with-lease when pushing to github
it allows you to force but only if your local copy of a branch matches the remote
Great, that worked! The PR is ready for approve/merge now.
would you like the lwip enter/exit changes in main or 8.0.x?
If you think it is clearly a bug fix, and will do some testing, I think 8.0.x is good.
Sounds good. I tested it as part of my #7333 changes. I think it is a low-risk change as adding unnecessary enter/exits should be harmless.
Here is a bunch of changes that I found potentially helpful while debugging issue #7333. If you think they are useful too, I can PR all of part of this. Either way it is not a big deal.
- Change debug optimization level to O1 to make code more debuggable.
- I use CIRCUITPY_FULLBUILD = 0 as a cheesy way to get faster builds. Doing this introduced some missing dependencies, so I added them to mpconfig mk/h files.
- In order for a build to fail sooner on a missing dependency, I added thi...
Pretty much every call to an LWIP function (when in "pico_cyw43_arch_lwip_threadsafe_background" mode) needs to be surrounded by a MICROPY_PY_LWIP_ENTER/EXIT section. Although the chance of an issue is small, and it is known to be causing issues, the code is technically necessary.
This change adds a bunch of missing enter/exit sections. An unnecessary enter/exit section should be harmless.
In another change, I will turn on runtime asserts for missing sections for debug builds only. Howe...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6
Code/REPL
import displayio
import board
import busio
displayio.release_displays()
FREQ = 80_000_000
spi = board.SPI()
spi.try_lock()
spi.configure(baudrate=FREQ)
spi.unlock()
Behavior
The frequency returned will always be what the baudrate parameter was, even if the bus could not be set to that frequency.
Description
spi.frequency always returns the value it was set t...
BTW, it turns out the LWIP_PLATFORM_ASSERT secondary issue is already fixed in the upstream pico-sdk. Perhaps you want to update the circuitpython submodule.
Hi, Scott
Sample code for lighting up the system light is working in Jupiter
Notebook. Anything related to network has issue, for example,
adafruit_request is not working in Jupyter Notebook too.
Sean
On Wed, Feb 15, 2023, 11:20 AM Scott Shawcroft @.***>
wrote:
Does other code work with the jupyter kernel? 8.0.0 added status bar
updates from circuitpython that the kernel may not know to ignore. (Thonny
does)β
Reply to this email directly, view it on GitHub
<https://gi...
This aws warning makes no sense:
warning: Skipping file /home/runner/work/circuitpython/circuitpython/mpy-cross/mpy-cross.static/. File does not exist.
Error: Process completed with exit code 2.
https://github.com/MicroDev1/circuitpython/actions/runs/4190046131/jobs/7263056567#step:10:461
It says file does not exist but the file is right there as shown by the logs from tree mpy-cross above.
This appears to have been fixed by pr #7589
You can now create a custom board build in your fork. ππ
Steps: (See: https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow)
- Fork the
adafruit/circuitpythonrepository. - Activate GitHub Actions in your fork.
- Select "Custom board build" workflow.
- Click on "Run workflow".
- You will be presented with the following menu.

