#circuitpython-dev
1 messages · Page 22 of 1
Closing this for now. Please comment if you have further problems.
I added cmake to the Building CircuitPython guide prerequisities. Thanks @rperwinski.
@jepler is your last comment a suggestion? We can move this away from Support.
Closing after a month. Please comment if your problem persists.
They have alluded to potentially being able to disable the pre oct2020 behavior on their end. If it's an option maybe it'd be nice to have them switch all of the older projects over to use the newer behavior that way it's level across the board for us.
I can step in tomorrow as soon as I get in.
Because we have a significant number of projects that will need it. 🙂
I'll check Jeff's list to get a number, as well as being able to provide it to them if they are willing.
The greater-than does seem successful. I put sphinx-rtd-theme>=1.0.0 and checked the build logs, it did download 1.1.1 which is the newest non-rc build.
Good to know. Keep an eye on the issue, and we can decide what to do once that's sorted.
Ok, I'll ping them about the other projects, but it looks like they can do it on their end. Already done for irremote.
@tulip sleet @onyx hinge I'm around a bit while ari naps. Need anything from me?
@bill88t Is this still an issue for you?
@rdagger Were you able to reproduce this on other displays?
Closing this after two months. Feel free to comment again if you want to reopen.
@dennis97519 Were you able to retry with an 8.0.0 beta?
@musimasami Does this answer your question?
I've got several bugs to investigate further. I was thinking of doing a beta.7 this week if we are not on the verge of rc.0. Is there anything specific you would want to go in?
not that I know of. I know I have a few still assigned to me that I will hopefully get to later this week
I may wait until later in the week to get more fixes in. I can reconsider on Wednesday or so.
kk. I hope to check in like this when I have a chance
i will keep any q's in mind
you can email or ping me and I'll get back when I can
No. I've had an SSD1309 OLED 128×64 display running for a week without issue. I did have to modify my program to fit the smaller size.
I've also been able to get reliable results from the original SSD1322 OLED 256x64 display by performing garbage collection on every loop and automatically soft rebooting the QT PY once a day. Since implementing these changes I've yet to see the dots appear.
One thing different about my SSSD1322 display is that it requires colstart=112 on initializatio...
CircuitPython version
Adafruit Circuitpython v8.0.0-beta.6;
Adafruit Circuitpython 20230106-037bfb3;
Code/REPL
N/A
Behavior
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
Description
Clean tinypico with
esptool.exe --chip esp32 --port COM9 erase_flash
then flash circuitpython via
esptool.exe --chip esp32 --port COM9 write_flash -z 0x1000 ..\adafruit-circuitpython-unexpec...
My understanding is that esptool.exe is obsolete. We use esptool.py. I am not sure what esptool.exes command line args are but, we flash CircuitPython starting at 0x0000, not 0x1000. Could you try that?
@night tundra this is the best place for help getting a board going
looking at the output for esptool.exe it is just a wrapper for the python script for windows
.\esptool.exe --chip esp32 --port COM9 write_flash -z 0x1000 ..\tinypico-20220618-v1.19.1.bin
esptool.py v4.4
Just in case though i did install esptool from pip and ran that with the 0x0000 and that seems to be working so it might of just been the 0x1000 vs 0x0000 difference.
I am able to connect via putty serial and hello world completes but i do not see the circuitpy drive, according t...
I am able to connect via putty serial and hello world completes but i do not see the circuitpy drive, according to the cricuitpython getting started that should appear once connected
The TinyPico is a plain ESP32, which does not have native USB, so it cannot present a CIRCUITPY drive. You'll have to use Thonny or similar to load files onto it. The REPL is via the USB-serial converter cip.
I see, thanks for all the info. Ill go ahead and look into what i can use for this and use Thonny to start my search. Looks like you solved all my issues so i can go ahead and close the ticket, thanks for the speedy help
Anything new on the esp32s3 ble front?
Glad things are working. Check out https://learn.adafruit.com/circuitpython-with-esp32-quick-start for help with such boards. It does not mention Thonny (but maybe it should). It talks about using the web workflow which is new and a bit experimental.
work hasn't started yet but I did look a bit more into it
I'll need to circle back on it soon
I've been using this a while on my side (thanks Arch) and don't remember any issues except the newlib-nano size. Arch compiles it with -Os and arm does with -O2 iirc.
Describe my specific problem.
The esp32 c3 initially generates enough voltage to turn on the LED( with 1kΩ resistor ). This does not change when running
pulsein = pulseio.PulseIn(board.D0, maxlen=600, idle_state=True).
Running
ir_led_pulse = pulseio.PulseOut(board.D1, duty_cycle=21845, frequency=38000)
turned off the led.After this.
run
ir_led_pulse.deinit()
the led will light up.
ir_led_pulse is working but pulsein is not.
I don't have a way to see the waveforms, so I can't t...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit Feather ESP32 V2 with ESP32
Board ID:adafruit_feather_esp32_v2
UID:8EF9D6427042
Code/REPL
# ------------------------------------------------------------------------------------------
# Example:
# Success reading DS18X20 sensors on Feather RP2040(s)
# *** Failure reading all DS18X20 sensors on Feather ESP32-V2(s) ***
# -I've tested two of each model Feather (RP2040 & E...
There was a small fix in bitmaptools recently here: https://github.com/adafruit/circuitpython/pull/7407/files. If you are not using bitmaptools, then never mind.
@dhalbert Not using bitmaptools. My project is posted on my website if you would want to look at the code:
https://www.rototron.info/projects/sms-display/
Always has been, and always will be unless we do something about it.
I have tried to resolve it by myself in the code, however was unable to.
When I find time I need to present further data.
Yes, I think a simple change could improve the error message
fix buy links
add an esp32 quick start link
Is it useful/helpful to have a link to the esp32 quick start web on the info on the esp32 board download pages?
Closing because this isn't a bug.
It's fine for now, but I'm working on an easier way to get it installed.
aeios.AES.rekey() is not documented. The arg checking could be canonicalized, too.
Where CP can write the file system. Useful for provisioning wifi data.
@dhalbert @ladyada This has been updated and I build-tested locally, but I don't have the right HW for testing.
This sounds like we may not be sending a new copy of the title bar. Or it is sent before the usb connection is active.
good to merge now, will update later if needed!
Fixes #7238, but does a lot more also.
- Per @jepler's suggestion, expands
%q must be of type %qto%q must be of type %q, not %q. - Adds a new validator for objects in a collection:
object in %q must be %q, not %q. Used a lot for pin lists. - Adds
arg_nameto a lot of pin validation routines. - Adds
arg_nameto SPI bus validation routine. - Adds
arg_nametocp_enum_valueto use when validati...
Build failures look like CI trouble. We can wait until it finishes and then re-run the failed jobs.
Could this play into a possible major version API change to allow async network actions, like in the present case: async wifi connection (rather than blocking for several seconds)?
I've seen SSL related hardfault on QtPy with ESP32-S2, trying to connect to a MQTT broker on port 8883 with TLS. When I Ctrl-C'd the program, it sometimes resulted in hard fault. Even though I had no time to isolate this further, the problem could be related to this issue.
GitHub now has organization-wide required workflows in public beta! Could be interesting to see how we could use it and if it even makes sense. Could take some of the burden off of some of the cookiecutter and/or composite actions.
I'll look into it and share next week, but saw that on their roadmap a while ago, glad it's in beta.
hum it looks like pico-w may not be able to connect to an open network
This may require an update of a submodule: https://github.com/georgerobotics/cyw43-driver/pull/45
It probably also requires an update of the core, as the authorization mode CYW43_AUTH_WPA2_AES_PSK is always specified.
Aha! I thought it worked. This may be @broken hedge 's problem: he was not able to connect to a passwordless network that used MAC address authorization
not an issue, but multiple discussions in #help-with-circuitpython
oh -- there was a forum thread about it
i didn't get to that email yet, sure, I have met JohnG in person and gone to an event for a class he teaches at Boston College
replied and moved thread to CIrcuitPython subforum
Now, open wifi works on Pico W, so this closes #7438.
For the web workflow it's now OK to either
- specify an empty password string (as before)
- not have the CIRCUITPY_WIFI_PASSWORD key at all (new functionality)
thank you!
debugging leftover?
mp_printf(&mp_plat_print, "Note: getting password result=%d\n", result);
arg yes thank you
fixed (force push)
Thank you!
ok, we'll ping JohnG about this and get him to test!
Hi,
We're working on a new RP2040 board at Pimoroni, that makes use of two IO expander chips (TCA9555) to offer more pins than the typical 30 (there's a good reason for this that'll remain a secret for now). The board is a good while away still, but I wanted raise this draft PR now to start discussions with the CPy team about the direction I'm going in.
Inspired by the support added for the Pico W's LED (https://github.com/adafruit/circuitpython/pull/6933), I am hoping I can do similar ...
For your use case, is it necessary that these appear as genuine digitalio.DigitalInOut objects, or could you implement them in Python and duck-type them to look like DigitalInOuts?
I would say that the CYW43 pin stuff was done the way it was due to the idiosyncrasies of these pass-through pins and their use cases.
I am not sure we would want to expand on that style for I/O expanders in general. If we wanted a more general solution, generalizing either microcontroller.Pin or `Digi...
seems like github is having a bad day today
Thanks for the quick reply.
The main thing that took me down this path was that a few of the expander pins are intended for (slowly) controlling the secondary lines of SPI displays (CS, DC). I managed to cobble some python code together for testing, but had to do it without the usual SPI display classes as they require Pin objects. These classes could be hacked to support an IOExpander object I suppose, but having them accept a pin as normal seemed far easier and cleaner for the user.
...
Looks good to me! Thanks!
I seem to get this in the full web ui even if I can write CIRCUITPY from Python: Warning: File System is in read only mode. Disable the USB drive to allow write access.
storage.remount("/", False)
```this is not enough?
I thought Melissa was still working on the full web ui, do you mean code.circuitpython.org or whatever?
are you seeing that message in the browser?
same with the non-full UI, werid
It seems like the web workflow needs the drive disconnected regardless of the remount setting
dismounted....
from the host I mean 🙂
is that how it should be, or how it is?
the web workflow tests for USB mounted, doesn't care about read/write mode
(it's not writing "from python")
if the web workflow changes files out from under a mounted drive, then the user looking at CIRCUITPY via USB will be seeing stale data. So that's a reason not to do allow that.
I suppose, CircuitPython has been designed so that it copes OK with the filesystem changing out from under it, but PCs haven't been
Spudgers.
I'm going to close this because we have CIRCUITPY_SKIP_SAFE_MODE_WAIT and the safe mode blinks are skipped after waking from deep sleep.
@rdlaner I believe your delay may be coming from display initialization. (I'm seeing the delay on an ESP32-S3 USB OTG.) Please file an issue if you have a proposal for display behavior when waking from deep sleep. Thanks!
has anyone made a spudger spudger spudger spudger song ?
The IDF's wakeup cause is only for deep sleep. Without ignoring it, light sleep will wake up too early when done after a deep sleep wake.
Fixes #7300
I don't think it should be that way. The point of changing that mount status is to change the filesystem regardless of the connected host OS. Its a bug on my part because I tested it by disabling the drive all together.
I feel like it would be more confusing, but to be fair the point of making the drive writeable is already to modify it (from python) even if it's mounted, host OS data synced or not
I'm ok adding additional pin types like the CYW43 code does. This makes them available to CP when the VM may not be running. If its only needed by user code in the VM, then I'd push more to make it Python-only.
I wouldn't add it to microcontroller.pin though. That's a lie. :-) If you want to expose them directly then you could expose the expander class through board. Kind of like the built in display.
Thanks for the diagnosis and fix!
I'm looking into the possibility of using mypy withipre-commit, and I seem to have a memory of there potentially being downsides to using stub files (.pyi) but can't find anything by searching Discord. Is that correct, and if so, what was it? If there aren't any, it may be worth bringing it up in the weeds as typing continues and gets closer to being completed.
Tested with a spare router set up with an open network. Works! Thanks very much. Also retested regular connectivity.
[I've removed myself as a reviewer. I find this stuff difficult to reason about and as a result I end up being unfairly negative about such changes]
As an evolution of a use case, this is probably similar to other audio requests...
I will be honest in that this may be ambitious for Python on an an S3, though my hunch now is that it could work. That S3 hums along....
The idea is to take in audio, encode it into a
smaller byte stream, and connect to a gateway on the internet. It's ham radio over internet in this case.
The internet side already exists with hundreds of thousands of users. ( android example included...)
Bei...
Sounds good. I will see what I can address. Hopefully I will update the PR before the start of next week.
This, I would say, is a bug and is not consistent with the documentation. Until it is fixed, there should be a note to that effect in the documentation with a work-around, but then that will cause the user's code to fail when the bug is fixed.
If there are, e.g. 3 entries in the FIFO, and they are to be read into an array of uint32, starting at element 1,
dest = array.array('L', [99]*10)
wordsize=4
sm.readinto(dest, start=1*wordsize, end=(1+sm.in_waiting)*wordsize)
is the w...
You definatly do not need two cores to stream audio over the Internet. It can be done using cooperative multitasking. The Python asyncio package on one core would work, assuming the one core is fast enough. With audio streaming you trade latency for glitches. Each end has a buffer of audio samples queued up so if a task is blocked for less than the length of the buffer the sound is still OK.
User interface don't have to block, they are usually callback based. You do need a fast ...
@chrisalbertson We are not able to do realtime audio processing and perform internet connection at the same time on a single core because fixed resources required to record and encode audio and fill the transmission buffer and that’s impossible to add unpredictably long network operations on the same core. DMA allows to output the prepared buffer but for network transmission we need to have a second core.
We've been porting a new board to CP following these instructions: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython
We rebuilt and flashed CP for an existing board (the ESP32S3 Feather with 4mb flash 2mb psram) and verified that it worked fine, but now that we're porting to our own board (that uses ESP32S3 8mb flash / 8mb psram) we're seeing a bootloop early in the boot process, e.g.:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x28 ...
@chrisalbertson When we talk streaming, perhaps enough optimization might get there, though it's not trivial. When you add encoding which can be viewed as the use of computing resources to optimize and reduce the size if the stream to fit through a narrow wireless modem, that makes it harder. That is what M17 is all about.
There are 2 versions of this board differing in what is connected to the USB-C port. This PR clarifies that the board definition is intended to target the newer version using the ESP32-C3 built-in USB-CDC/JTAG pins rather than via a CH343 UART to USB chip.
where are you running this code?
I'm using an ESP32-CAM with the ESP-EYE firmware: https://circuitpython.org/board/espressif_esp32_eye/
But i'm getting error while using such IO ports: AttributeError: 'module' object has no attribute 'IO35'
Thanks for working on this. Should we set this as a draft for now, since you're still tuning it?
I am still interested in using partial clones, either treeless or blobless. They transparently appear to contain the entire commit history but don't fetch everything. Fetches are done on demand, as necessary. I think it may eliminate the depth calculations, and perhaps remove the need to do github API calls, because the info is all local (not sure about that).
Have you looked at https://gith...
Escape the . in .github:
r"^(?:\.github/workflows/|docs|extmod/ulab|(?:(?:ports/\w+/bindings|shared-bindings)\S+\.c|conf\.py|tools/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$"
I don't think you need to escape /. I don't see it as any kind of special char in the Python doc.
r"^(?:\.github/workflows/|docs|extmod/ulab|(?:(?:ports/\w+/bindings|shared-bindings)\S+\.c|conf\.py|tools/extract_pyi\.py|requirements-doc\.txt)$)|(?:-stubs|\.(?:md|MD|rst|RST))$"
The regex works fine either way, escaping / makes it more language neutral plus it keeps regex linters happy.
Should we set this as a draft for now, since you're still tuning it?
This should be good to merge now.
I am still interested in using partial clones, either treeless or blobless.
The partial-clone functionality is awesome and I'd like to look into it but maybe in a subsequent PR.
Good catch! Thanks for pointing it out.
(that uses ESP32S3 8mb flash / 8mb psram)
Might be similar to #5999. See: https://github.com/adafruit/circuitpython/pull/5999#issuecomment-1320807909
Recently I found a hack on a website (sorry - I forgot the name) which works fine in my environment:
@BeatArnet I would like to track this down to read about this technique in context. Do you remember if the author did the original coding in CircuitPython, MicroPython, regular Python (e.g., on RPi), or Arduino, or something else? Thanks.
Please clean and rebuild CircuitPython with DEBUG=1 That should enable debug prints from CP and the ESP-IDF's second stage bootloader which should appear after the ESP-ROM print. (TinyUF2 runs after the second stage bootloader when present. It isn't needed for CircuitPython to run though.)
Awesome! Thanks for improving error messages!
do we want to do https://github.com/adafruit/circuitpython/issues/4988 for 8.0?
it changes start= and end= behavior to account for the element size of the given buffer
Yes, this seems like a bug that we should fix
First of all I believe it would be best to 'by-default' prohibit overclocking.
A typo could be very problematic..
One extra digit is all it takes for the rp2040 to become a potato chip.
Ideally an cpu.safety/cpu.overclock/cpu.cook_mah_pi kind of property should be made available.
I think it's good to try to implement this so that all the modules are ready for any future rp2 chips with different frequencies.
Also, @Lanzaa, to fix the pre-commit check run `pip install pre-commit ...
I did not mean dual core is not helpful, just that logically it is not required if the single core is fast enough.
I have an application running now where I use both core of the RP2040. The same code also runs on the dual core ESP32. I am evaluating which is best.
When I found that circuitpython did not allow use of the second core, I switched to micropython.
If transcoding on the RP2040 is slow, try an ESP32. The ES32 is a little fastr and it has hardware floating point so it ...
The comment says it is buffer[start:end] but it assumed elements were a single byte long. Now it correctly does multibyte elements from array.array.
Fixes #4988
I only compiled it. I'm hoping @dmopalmer and @dmcomm will give it a try.
Fixes #7369
@anecdata Mind testing and reviewing?
@makermelissa circuitpython is merged 🥳
@tulip sleet were you going to look at 7431?
I am unfamiliar with the workflow here. Is the compiled version (for this unmerged change) in the main downloads directory at
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/vcc_gnd_yd_rp2040/en_US/
and specifically the filename ending 20230111-75241c4.uf2
Or do pull-request generated artifacts go somewhere else?
Build artifacts are: go to "checks" (at the top here) > "Build CI" (on the left) and scroll to the list of artifacts.
That should be a direct link to that list: https://github.com/adafruit/circuitpython/actions/runs/3897703093
I was thinking about it 🙂 but was going to look at what changed (if anything) between 7.3.3 and 8.0.0.
CIRCUITPY_contents.zip
Was learning how to use numpy on a basic script. Then got an error message requesting I send a copy of my CIRCUITPY drive. I hope this helps community improve. I zipped my entire drive and attached.
Summary: Reading into arrays of 16,32 bit values with start=, end= arguments works. Reading into slices of arrays doesn't.
There is also a regression in that the rp2pio.StateMachine() pin arguments: first_{out,in,set,sideside}_pin and jmp_pin are no longer accepted, and must be specified as a Pin. (Of type Pin, rejecting int pin numbers as well).
TypeError: first_set_pin must be of type Pin, not NoneType
Details:
For the test for reading 3 FIFO entries i...
Thanks. Could you try the 8.0.0-beta.6 build here: https://circuitpython.org/board/feather_stm32f405_express/ ?
There have been some fixes to ulab (and many other things).
@tulip sleet I looked briefly today and got a stack overflow error on the socket select task. Not sure when I added it but it seems like something I did relatively recently
i was thinking of doing a bisect. Do you want to take that or do you have other stuff to work on first.
I’ve gotta follow up on the prs I did today. I suspect you’ll end up on one my prs at the end of the bisect
Adafruit CircuitPython 8.0.0-beta.6-36-gc93d6d5e6 on 2023-01-12; Adafruit QT Py ESP32S2 with ESP32S2
🟢 ESP32-S2 (QT Py) - Web Workflow ENABLED
Code from #7326 runs, and finds other CircuitPython mDNS devices
🔴 ESP32-S2 (QT Py) - Web Workflow NOT ENABLED
Code from #7326 starts to run, but board enters Safe Mode early, timing doesn't seem exactly consistent:
[tio 21:16:34] Connected
=========================
Starting mDNS server...
Connecting to wifi AP... IPv4=19...
i'll try to reproduce and then bisect and then ask you if the cause seems mysterious
Went back to a recent pre-PR version and re-verified that:
Adafruit CircuitPython 8.0.0-beta.6-25-gbb3a1c0a2 on 2023-01-04; Adafruit QT Py ESP32S2 with ESP32S2
will find mDNS devices whether Web Workflow is enabled or not.
Similarly:
Adafruit CircuitPython 8.0.0-beta.6-25-gbb3a1c0a2 on 2023-01-04; Raspberry Pi Pico W with rp2040
will find mDNS devices when Web Workflow is not enabled.
@tulip sleet kk. I did manage to reproduce it today. The stack overflow happened after a keyboard interrupt exception was printed
I've cleared/passed the error. I think it was due to initializing an empty
array. As my temporary workaround I pre-allocated an array of zeros.
ulab.numpy.array() #caused error
ulab.numpy.array([]) # caused soft boot from fatal crash.
ulab.numpy.array((0,0,0)) # is my workaround.
Haven't got the time to do beta 8x.
On Wed, 11 Jan 2023 at 21:08, Dan Halbert @.***> wrote:
Thanks. Could you try the 8.0.0-beta.6 build here:
https://circuitpython.org/board/feather_stm32f405_express/ ...
I am not sure what you're trying to do with the concatenate(). You have:
big_array=np.concatenate((sensor.acceleration), axis=1)
sensor.acceleration is a 3-tuple, like (2.0, 4.0, 6.0). np.concatenate() takes a sequence of arrays as its first argument, but you passed it a sequence of scalars. In desktop Python, the above causes this error:
>>> np.concatenate((2.0,4.0,6.0), axis=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<__arr...
Heads up @v923z - the "ulab" label was applied to this issue.
I've cleared/passed the error. I think it was due to initializing an empty array. As my temporary workaround I pre-allocated an array of zeros.
ulab.numpy.array() #caused error
ulab.numpy.array([]) # caused soft boot from fatal crash.
ulab.numpy.array((0,0,0)) # is my workaround.
@teejay0909 It's not quite clear to me, whether these errors are really errors, or part of the bug report on the concatenate function. In any case, if there is anything that bugs you (pun...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit QT Py ESP32S2 with ESP32S2
Code/REPL
import time
import traceback
import alarm
import supervisor
def main():
print("Sleeping for 10 seconds")
time.sleep(10)
sleep_period = 15
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + sleep_period)
print(f"Entering deep sleep for {sleep_period} seconds")
alarm.exit_and_deep_sle...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit QT Py ESP32S2 with ESP32S2
Code/REPL
import wifi
import supervisor
import time
import traceback
from secrets import secrets
try:
wifi.radio.connect(secrets["ssid"], secrets["password"], timeout=10)
# send some data to MQTT broker here, not sure if this matters
except Exception:
print("Code stopped by unhandled exception:")
print(traceback.format_e...
CircuitPython version
I can write to the 4MB of flash from begininnig to end without a failure (tested with a small .bin from /dev/urandom and verify_flash)
After powercycle i can read it out correctly.
After erase_flash i can read 4MB of 0xff correctly.
After flashing tinyuf2 bootloader i can correctly read all 4 MB back.
Than i install circuitpython 8.0-beta6 (or any other version from 7.1 up)
than executes and works as expected.
But now i can not read the flash any...
Thanks, with DEBUG=1 I get:
Invalid image block, can't boot.
(Not sure if this is relevant, but I only get serial output if I flash circuitpython-firmware.bin; nothing if I flash firmware.bin.)
@v923z I can reproduce something funky when passing a wrong-type argument to ulab's concatenate. Instead of a proper exception, it cuases a segmentation fault on Unix (which would typically be a hardfault on hardware):
$ ./ports/unix/micropython-coverage
MicroPython 8.0.0-beta.6-20-gcc16bd3d53-dirty on 2023-01-04; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import ulab.numpy as np
>>> np.concatenate((0,0,0), axis=1)
Segmentation fault
Debugger says
...
ah I missed that, thanks @dhalbert !
ah I missed that, thanks @dhalbert !
Yes, sorry, for not calling that out explicitly in a comment. It was on this page as a cross-reference but not so obvious.
I got a little further :)
I made a few more changes to board config and can now get CIRCUITPY to appear if I flash circuitpython-firmware.bin from my build. The serial output is this though:
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file...
This issue also seems to block any deep sleep efforts which is my main concern.
I have a design for a small display that Mandalorian cosplayers use in their gauntlets. I am trying to add a feature where you can put the system into deep sleep and wake it up with a button press later.
The problem that I am having is that once I make the alarm call to put the system to sleep (and I turn off the backlight) the system shows the console and more importantly it turns on the backlight to 100%...
@tulip sleet at my desk now while Ari naps if you need anything
haven't started working on that bug yet; i will now
kk, I'm getting through my email and then getting back to the PRs I made yesterday
could you just upload or paste your reproduction program?
#7431 uses httpserver but want to see if that is necessry
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Board ID:adafruit_feather_esp32s3_4mbflash_2mbpsram
Code/REPL
displayio.OnDiskBitmap("compressed.bmp")
Behavior
The system displays an image, but it is corrupted and looks like it is not using the proper scan line width or something. I see the right colors, but displayed incorrectly
Description
I have tried mak...
Is there any way to keep the backlight off? Maybe a deep sleep option that does not exit to the console?
The latest beta versions of CircuitPython have a way to preserve pins when going into deep sleep. https://docs.circuitpython.org/en/latest/shared-bindings/alarm/index.html#alarm.exit_and_deep_sleep_until_alarms
Why do you think this is a CircuitPython bug? It isn't running CircuitPython as far as I can tell. We don't do anything to protect the flash. What chip is this?
Debug builds on ESP should stop in the ESP-IDF panic handler and give you a backtrace. Did you stop making a DEBUG build?
I've been investigating this in the forum thread. It's an esptool.py bug, but it's very strange. I'll close this and we'll continue there.
@tulip sleet is it reading flash after CP runs? could be flash chip config
The bug is reproducible from a power-up directly into bootloader mode, so CircuitPython never runs. And it works fine on macOS, but not Windows or Linux. See https://forums.adafruit.com/viewtopic.php?t=197730 also with links to other similar esptool issues in the esptool repo
Thank you so much for the testing! Sounds like I forgot to handle the case where web workflow is compiled in but not enabled.
cool cool #notmyproblem
I have reproduced this problem with Chrome, with the minute-long stall (didn't measure exactly, but it's long). Firefox, stalls too, but the stall is only 5 seconds. In both cases, it takes a few fetches to cause a stall, as if it's using up available sockets. Repeating a curl fetch every second causes no problems.
@anecdata Thanks for the thorough testing. I've fixed it and tested on ESP32-S3 so far. Will find my Pico W now and follow up once I test it.
Thank you for the tip. Will this be available on the Feather? I'm using the Feather M4 Express as well as the ESP32S3. Unfortunately, it looks like preserving the I/O on those boards is not yet available, but I'll put the code in anyway and see what happens.
Limitations: preserve_dios is currently only available on Espressif according to the docs
Doesn't look like its fully working on Pico W so don't bother reviewing yet. Thanks!
I went ahead and added the code and hit another issue. I passed in the I/O pin to the display manager and let it control the backlight level:
ST7789(display_bus, rotation=270, width=240, height=135, rowstart=40, colstart=53, auto_refresh=False, backlight_pin=board.D10, brightness=0)
When I try to put the system into deep sleep I get and error that the I/O pin is in use:
alarm.exit_and_deep_sleep_until_alarms(time_alarm, preserve_dios=[digitalio.DigitalInOut(board.D10)])
Traceback ...
i just bought the same counterfeit boards.
the differences are visible on silkscreen, marking on MCU and no ENIG finish on the PCB

the fake ones lack PSRAM you can see this when you put the board in flash mode (press O and RST, release RST)
than run
esptool.py chip_id
Chip is ESP32-S2FH4 (revision v0.0)
Features: WiFi, Embedded Flash 4MB, **No Embedded ...
'Files changed' is all you need to go ahead and make custom builds. They work a-ok.
i just left this here so other people who run into the same problems can find more information.
but i agree, this venture is not worth the lifetime.
With DEBUG it gives me:
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x28 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40043ac8
SPIWP:0xee
mode:DIO, clock div:1
load:0x3c120020,len:0x4a0a8
load:0x3fc9cdb0,len:0x5edc
load:0x40374000,len:0x64
load:0x42000020,len:0x11d70c
Invalid image block, can't boot.
ets_main.c 329
Ok, should be good now. :crossed_fingers:
There's one part of this that is confusing to me and may merit a comment if it's intended. No testing performed.
Clearing the inited flag in construct seems weird. If this is correct, can you add a comment?
This is a total aside but I recently learned that in C you can use sizeof("char literal") in this context!
typedef struct whatever {
char default_hostname[sizeof("cpy-XXXXXX")];
} whatever;
this includes the terminating '\0' byte.
@slender iron I have some socket q's now, if you have any time
@tulip sleet yup!
I'm in the marie curie channel
Tested the artifacts. mdns.Server finds other CircuitPython mDNS devices on both espressif and raspberrypi, after reset and after reload. ✓, ✓, ✓, and ✓... LGTM.
Thank you for the thorough testing!
Summary: Reading into arrays of 16,32 bit values with
start=,end=arguments works. Reading into slices of arrays doesn't.
Slices of arrays are copies. In order to pre-slice it, you'll need to wrap the array in a memoryview(), which will ignore the type iirc.
There is also a regression in that the
rp2pio.StateMachine()pin arguments:first_{out,in,set,sideside}_pinandjmp_pinare no longer accepted, and must be specified as a `Pi...
Thanks for fixing the None regression! Sorry - oops!
Should I return a bool instead? That was my other option. The web workflow is a bit of a weird world where we have static memory and having it deinit on failure is convenient for later use.
Thanks for fixing the None regression! Sorry - oops!
Here is my test script for SPI.readinto():
import array
import busio
import board
import bitbangio
import time
# Wait for usb
time.sleep(10)
for sck in dir(board):
if not sck.startswith("G"):
continue
sck = getattr(board, sck)
for miso in dir(board):
if not miso.startswith("G"):
continue
miso = getattr(board, miso)
try:
spi = busio.SPI(clock=sck, MISO=miso)
break
except Va...
Adafruit CircuitPython 8.0.0-beta.6-25-gbb3a1c0a2 on 2023-01-04; Raspberry Pi Pico W with rp2040
>>> (-1).to_bytes(1, 'big', signed=True)
b'\xff'
>>> int.from_bytes(b'\xff', 'big', signed=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: signed=True
>>> int.from_bytes(b'\xff', 'big')
255
"[// TODO: Support signed param (assumes signed=False at the moment)](https://github.com/adafruit/circuitpython/blob/72f4a8ebbc67a40e01...
Oops, yeah. It's for the DevkitM. I probably copied the text and changed the values to be correct, but overlooked the board name itself.
While I know this issue was closed several months ago, I am having this exact same problem.
In my case, I am using a Feather RP2040 running CircuitPython 7.3.3, and using a Prop-Maker feather as my amplifier. I have downloaded the stereo.mp3 file that folks in this thread say works for them, and it has a lot of static for me. My code is pretty generic:
`import board
import audiomp3
import audiopwmio
import digitalio
audio = audiopwmio.PWMAudioOut(board.A0)
enable = digitali...
@analog bridge Does gpio11 actually function properly on your C3 board in circuitpython?
I noticed you didn't have anything in your board.c to take it out of the default vdd_spi mode and change it to alt gpio mode.
Hi, @spiral elk GPIO11 isn't used and it should be removed from pins.c along with io 12 to 17. Thanks for pointing it out.
I was going through all the c3 boards and looking for ones with gpio11 defined, as its an odd pin, not gpio by default.
I kind of suspect that its not functional on any of the boards that have it broken out either, as none have any mode setting in board.c
Sorry, I couldn't find the author of the code. But I did not even have to adapt the code.
perfect, it went onto the C and functioned but it was much happier on the M. lol
Are you saying that the code you took is exactly as you wrote in https://github.com/adafruit/circuitpython/issues/6311#issuecomment-1295812087 ? If so, then I will do a websearch for that.
Same code, but I did not find on the Web…
Ah, I seem to have peeled another layer off the onion! This looks more interesting:
I (421) esp_image: segment 4: paddr=00173118 vaddr=40378434 size=14150h ( 82256) load
I (440) esp_image: segment 5: paddr=00187270 vaddr=600fe000 size=0002ch ( 44) load
I (440) esp_image: segment 6: paddr=001872a4 vaddr=600fe030 size=01010h ( 4112) load
I (456) boot: Loaded app from partition at offset 0x10000
I (457) boot: Disabling RNG early entropy source...
I (469) opi psram: vendor id : 0x0...
Hi, I’m not sure if there is something I could do. I had a PR in blinka which was left to die without any comments for more than a year. A month ago, another user needed the same functionality and made an improved version on my PR (https://github.com/adafruit/Adafruit_Blinka/pull/637). However it also didn’t get any feedback. I’m afraid it will also be left to rot and I feel it’s a shame because it’s really useful.
@tidal kiln ☝️
@candid granite this is a good place to ask about it. Please don't assume we're mal-intent on our part though. Its tough to keep up with all of the PRs
@MicroDev1 what did you just change?
@MicroDev1 what did you just change?
Nothing! I am experimenting with caching and partial-clone on my fork and accidentally pushed to this branch.
Yes for sure, It’s hard to convey state of mind in a small message but I’m not here to complain 😁, I’m good with any outcomes.
It looks like this has been fixed as of 2 days ago by using liquid 4.0.4 (see https://github.com/jekyll/jekyll/issues/9231#issuecomment-1379146408), so I think unpinning is all that is needed.
That and running bundle update to update the Gemfile.lock.
Thank you for the tip. Will this be available on the Feather? I'm using the Feather M4 Express as well as the ESP32S3. Unfortunately, it looks like preserving the I/O on those boards is not yet available, but I'll put the code in anyway and see what happens.
Limitations: preserve_dios is currently only available on Espressif according to the docs
I don't know of anyone adding preserve pin support to the SAMD51 (aka M4). Generally its deep sleep support is less refined.
When I try to put the system into deep sleep I get and error that the I/O pin is in use:
Deinit the display and then try.
We don't support compressed BMPs with OnDiskBitmap. We'd need to add support.
Those errors are normal because we're resetting devices that haven't been used. This looks like it is starting up correctly to me.
@lone axle any android code editor suggestions?
Android Studio is what I use
It's definitely more on the fully feature IDE side of things though. I'm not sure what options are available that are closer to basic text editor.
Closes: #1121 (if it builds :grinning:)
Oh, I see. That Glider app is the only one I'm aware of for BLE editing. Web workflow should theoretically work from a mobile browser on Android, I'm pretty sure I did the most basic test of that from my phone at one point, nothing super fancy though.
glider should be making the files available to other apps too
I don't edit from the phone frequently, the most recent one I used for it was this: https://play.google.com/store/apps/details?id=com.rhmsoft.code&hl=en_US&gl=US I've used a few others, but honestly none of them enough to get a good feel for any of them.
On my current phone I can actually connect via USB with an OTG cable and edit code.py from that app as well. (older Android didn't support the right filesystem type I think)
protobuf also isn't able to support ruby 3.2.0 yet: https://github.com/protocolbuffers/protobuf/issues/11538
I've progressed down the CYW43 Pin approach, and am honestly rather happy with the user experience! Having the pins for LEDs and buttons just being accessed using board.LED_A and board.USER_SW for example, feels quite magical. I even updated displayio.FourWire to support these expander pins for DC and CS, and although slow, seeing the REPL on screen using the usual example code was rather exciting!
Newest code added to this PR if anyone wants to look. I also tried a technique in `boa...
it comes in as an indirect dependency related to sass, I don't understand why
Must be getting closer :)
I rebuilt without the DEBUG flag and now I get a drive appearing, though it is empty and labelled "6MB Volume".
On serial I'm back to the Hardfault_Handler:
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
P...
I don't know about the HardFault_Handler safe mode issue, but try doing this to re-create CIRCUITPY:
>>> import storage
>>> storage.erase_filesystem()
These errors are innocuous. They show up on every port:
E (1260) I2S: i2s_driver_uninstall(2047): I2S port 0 has not installed
E (1270) I2S: i2s_driver_uninstall(2047): I2S port 1 has not installed
All of a sudden I can no longer reproduce this problem. I'm not sure why at all, but Chrome recently got upgrade to Version 109.0.5414.74 .
I am still seeing an odd thing where at the beginning the poll() is being called constantly but after one or more fetches, it is being called only once after each fetch. I am suspicious there is still an issue.
I tried HTTPServer 2.1.0 and 2.2.0 to make sure there was not an accidental fix on the HTTPServer side.
Since I don't understand what it's doing, I can't really say how I'd like you to fix it. It just feels weird that "construct" would ever set a flag called "inited" to False and I'm trying to understand what's going on.
What does the "self->inited" flag mean? Is there a better name for it, or a comment that could explain it?
Since it tests out good, probably a different name or a comment explaining what's going on would be helpful, rather than changing the flow of the code.
Thanks, but I don't get a REPL and code.py isn't recognised. The drive that pops up when the device boots contains nothing :(
It appears that it's so that it can handle protocol relative urls like url(//circuitpython.org)
An rp2pio.StateMachine has .background_write() which lets the user queue up large quantities of data to be sent to the Statemachine automatically, refilling in the small FIFO buffer as the data is consumed.
However, there is no equivalent capability to read the FIFO in the background, so after the StateMachine generates 4 (or 8) data values, it is blocked or loses data. Therefore, the user program must constantly poll the input to see if there is anything available to read.
It wou...
@onyx hinge what was your conclusion about pico + sigrok?
@slender iron Until there are windows & mac binaries for people to download it's a bear to get going, and i wouldn't try to send anyone down that road. Additionally, there are bugs/limitations. One of the scorpio's pins can't be used without modifying the firmware (I think because it controls the power supply mode on the actual pi pico board). one of the bugs requires you to keep all "lower numbered" pins enabled to capture higher numbered pins (this may also be a protocol limitation of the sigrok<->pico firmware communication, a protocol that the FW author invented) so you are stuck at lower sample rates. Adding proper scorpio pinout support would end up being a separate pull request.
But once you get it going you can decode i2c traces and that's pretty cool!
if I could clone myself and a real webdev I'd say let's make a fresh digital scope app that runs in the browser with webserial, nothing to install.
I also wonder whether there's some other protocol the rp2040 could implement instead, so it works with unmodified sigrok. I didn't go through the list of protocols and find out, though.
I have verified on the current version that it works on signed and unsigned 8, 16, and 32 bit destination arrays.
(And agree that it should not 'work' on array.array slices. I was mislead by experience with numpy semantics where a simple slice is a memoryview.)
I also verify that the current version has fixed the regression on the pin arguments.
A feature request #7452 for non-polling read is not part of this merge request, but if enacted would probably be best addressed while this pa...
This was my motivation for this GH issue: https://github.com/wavedrom/vcdrom/issues/31
I was hoping the tinylogicfriend protocol could be used for this but its also stalled. I still think the best use of time would be getting a second backend into pulseview that uses python plugins for hardware support
yeah I haven't looked at it from that angle .. like, can you take out the sigrok from pulseview?
my need for this isn't particularly acute, since I not only have an 8-channel saleae but also a 4 channel + 16 digital channel scope, so I'm not too motivated to throw my own time at it
it sure could help folks though
I assume its not too tightly coupled. looks kinda dead though too... https://github.com/sigrokproject/pulseview
there is a small amount of activity on that PR, but even if it is merged ... the last release of libsigrok was in 2019 so 3+ years ago
yeah... pretty dead
https://github.com/glscopeclient/scopehal-apps is a different direction we could go
I understand the appeal of the web but I like python too much
and plugins are a good way to unblock hardware and protocol support
its gui is glscopeclient
and there is a quick start link there I think
I gotta run. baby timer is expired 🙂
see ya
https://hackaday.com/2019/05/30/glscopeclient-a-permissively-licensed-remote-oscilloscope-utility/ a bit of an overview of how the project stood in 2019
In PR CI, will it be viable to only build a single language (e.g. en_US) and build subsequent languages if the free space is less than a certain threshold level (e.g. 10KB)?
I think we don't have a good handle on what that threshold is. We could build the largest known language, but it varies from board to board a bit. Also, if the PR is changing the message or translation code, we want to build them all to test that. Or, the PR submitter or a tester may want a different language available in the artifacts.
I'm understanding you want to speed up the PR development cycle. We have thought a bit about how to make the builds faster: don't rebuild a .o if you don't need to, etc. I have thought a bit about how to make substituting a language be a link-time-only operation, but that is pretty hard. If the compressed-string handles were the same across all the languages, that would help, but I think that requires an extra level of indirection.
As of a year ago, Libsigrok seems to be relatively inactive. I never got the TinyLogicFriend PR merged, but to be honest my code probably wasn’t the cleanest. My approach was to make a few commands that could be relatively generic. I never found an existing driver that I thought would fit the bill to convert run length encoding (RLE) from the microcontroller board to streaming data on the PC side. Perhaps others can think of another way of using the drivers that already exist on the sigrok side. In fact if you want to do direct streaming it may be easier to do but will have to find a board with enough speed and fast USB to meet those needs.
@mental nexus any idea how hard it’d be to write a python driver for it?
Are "private" variables intended to behave different in CircuitPython than CPython?
i.e. I have this in a file called scope_learning.py:
from micropython import const
PUBLIC_CONSTANT = const(0x3)
_PRIVATE_CONSTANT = const(0x5)
And this in code.py:
import scope_learning as learning
print(f"public {learning.PUBLIC_CONSTANT}")
print(f"PRIVATE {learning._PRIVATE_CONSTANT}")
On a microcontroller that resultes in an AttributeError, but in CPython it executes successfully.
This contains the following CI enhancements:
- Cache common submodules:
extmod/ulab,lib/andtools/. - Share CP version across jobs to avoid fetching tags in each and every job.
- Change submodule fetching strategy:
- tags[Y]: use
git submodule update --initfor frozen. - tags[N]: use
git submodule update --init --depth=1for everything else.
- tags[Y]: use
- Only build
mpy-crosswhen required by the board. - Refactor and alphabetically arrange matrix jobs.
- Use python
3.xfor ...
global _ const()s are optimized out, let me find you the best reference
Thank you!
@lone axle this saves space and time: space because the dictionary entries are not needed; time because no runtime lookup need be done
Nice, makes sense to deviate from "suggestion only" in order to make the most of the resources available on this scale. Appreciate the knowledge and reference
Not sure what you mean by Python driver. You mean something in between the microcontroller and the sigrok software? When I looked at sigrok I only looked at the USB connections to get data. Maybe it has other ways of getting in data?
One good thing about pulseview is it has gui buttons to setup and trigger measurements. Perhaps something in the middle could fake it but I don’t know if the existing drivers can accommodate that.
Something besides sigrok to get the data
Currently there appears to be no support for microphones using audiobusio.PDMIn or analogbufio, and analogio sampling rate is too slow.
Are there any workarounds or plans to support mic input? Using either PDM or analog input.
Fixes #7431.
- The new client socket returned by
accept()was not set toO_NON_BLOCKall the time, causing it to block until a request was made. Now ensure that it is always set to blocking.
Other fixes:
write()s toeventfds should always be 8 bytes. There was a write that was only 4 bytes (writing thefd). This should actually return an error, but it wasn't checked. @tannewt I don't see that the results of these writes are used anywhere, so I think this change is OK, but...
We have no immediate plans, but it's something we'd like to do long term. analogbufio is quite new.
Related issues:
- #6969
- #5456
@dhalbert thanks. Are there any workarounds to be able to utilize any type of microphone with Espressif?
Not right now, sorry, without external hardware. Adding an implementation of analogbufio for Espressif is probably the easiest thing to do, PDMIn maybe somewhat less so. I2SIn would need some API definition. Would you be interested in working on that? We mentor folks who would like to contribute implementations to CircuitPython.
@dhalbert yes, I would be interested in helping if you can provide some direction?
Sure! It looks like you already have had success building CircuitPython, based on your repos. For this particular thing, what you need to do is reimplement what is in ports/raspberrypi/common-hal/analogbufio/ for ports/espressif. The Python API side of the work is already done, in shared-bindings, so you won't need to reimplement that.
So you can start by making a branch in your fork, and copying over the common-hal sources mentioned above. Then you will replace the insides :slight...
CircuitPython version
8.0.0-beta.4
8.0.0-beta.5
8.0.0-beta.6
Code/REPL
In boot.py:
import usb_cdc
usb_cdc.enable(console=True, data=True)
code.py:
import usb_cdc
import time
usb_cdc.data.timeout = 5.0
while(1):
if usb_cdc.data.in_waiting > 0:
starttime = time.monotonic()
print(str(usb_cdc.data.read(1)))
print(str(time.monotonic() - starttime))
Behavior
usb_cdc.data.read(1) times out (time is printe...
I reproduced the issue on the pico, but there is a twist, the read(1) proceeds as expected if a terminal (like tio) is connected to the data port. If no terminal is connected to the port, nothing is read.
A burst of data like this adds the data to the buffer, and triggers a read or two.
echo "12345" > /dev/cu.usbmodem1234
I can confirm that in my testing on ESP32-S2 TFT Feather, these changes seem to fix the blocking behaviour in Chrome. Thanks @dhalbert!
The adafruit/Adafruit_CircuitPython_HTTPServer#32 was an experimental way to fix the issue before fix in CircuitPython itself. Right now it is indeed not needed anymore.
@dhalbert This should be fixed by https://github.com/v923z/micropython-ulab/pull/575, which has been merged into master.
Anyone seen any code that allows a Bluetooth arduino to act as a ble hid host. Ie receive ble keypress
You will likely find more help in the #help-with-arduino channel.
@mscreations Does your experience match what @Neradoc reported? How are you sending characters on the host computer side?
I will do a bisect and track this down.
Here is the script I'm using to send data to the macro pad.
https://github.com/mscreations/CircuitPython_Macropad/blob/master/Macropad.ps1
I'm confused about the difference between the bootloader(s) that a CP build creates and TinyUF2.
Might it help for me to port my board to tinyuf2?
TinyUF2 is a secondary bootloader. It is started by the initial bootloader, and knows to start the "main" application if it is present.
You don't need to do that right now. Get the .bin version working.
Looking at your https://github.com/adafruit/circuitpython/compare/main...hamishcunningham:circuitpython:unphone diffs, the size of flash and PSRAM is still 4MB/2MB, not 8/8, as you say your board is. Also take a look at the 8MB/0MB boards we support. You may need to change the qio to `...
Thanks for working on this! I saw the build time of the main jobs as 1 hr 10min, which seems like a big improvement, but it's hard to compare with other runs, whose times include delays waiting for runners.
One query inline.
Did you test partial clone with --filter=tree:0 vs depth 1 for the large repos like esp-idf and the broadcom firmware repo?
If we used a partial clone for the main repo, would that make it easier to do the "what is changed checks" without invoking deeper and ...
This is repeated a bunch of places. Is it possible to factor it out into a definition at the top of the file or something like that, in case we want to change the list of cached submodules?
Thanks! But I think I've already made those changes...? E.g.:
Our chip is an ESP32S3 N8R8 so I've tried to match settings with the [Espressif N8R8 devkit](https://github.com/hamishcunningham/circuitpython/tree/unphone/ports/espressif/board...
Ah, I was looking at the oldest commit instead of the newest commit, sorry!
Do you have a DevKit N8R8 or N8R2 in hand, to test whether the definitions we have work for those boards? If those work and the board files are very similar to yours, then I'd guess the issue is just what differs between your board and those. But I may be saying the obvious - if so, sorry. I'm wondering about strapping pins, etc.
I have a DevKit N8R2 but not an N8R8. I will add it to my next staff order.
Aha, I tweaked some more pindefs and now it works! Whahey!
Adafruit CircuitPython 8.0.0-beta.6-38-gfd7f36ee69-dirty on 2023-01-15; unPhone with ESP32S3
THanks for your help, much appreciated :)
Given that I've done a "make all" and a .uf2 has been generated and then (I think) combined with the (first stage?) bootloader.bin, does that mean I'm now running UF2, or is that another step?
Thanks again!
Fantastic!
If you are loading a .bin, then you are not using UF2. You need to load combined.bin from a TinyUF2 build onto the board (after erasing it completely). Then TinyUF2 will run after the built-in bootloader. If you do a double-click, it would go into UF2 mode and present a BOOT drive as an MSC USB device, and you would copy the UF2 onto it.
UF2 is a special format that contains information about "put this block of data here", etc.
You may be able to start with https://githu...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Raspberry Pi Pico W with rp2040
Code/REPL
import time
import busio
import board
import displayio
import terminalio
from adafruit_display_text import label
import adafruit_uc8151d
displayio.release_displays()
# This pinout works on a Raspberry Pi Pico
spi = busio.SPI(board.GP18, MOSI=board.GP19, MISO=board.GP16) # Uses SCK and MOSI
epd_cs = board.GP17
epd_dc = board.GP2...
If I build without the SPI RAM everything works great (except there's not much RAM :grin:). The Micropython build also works fine so I've been comparing the sdkconfig files and one thing I've noticed is that CircuitPython configures the CONFIG_SPIRAM_SPEED_40M=y parameter regardless of whether I set CONFIG_SPIRAM_SPEED_80M=y in the boards/unexpectedmaker_tinypico/sdkconfig or not.
The Micropython build looks to me like it's using the 80M setting so I'd like to try a build with that setting...
This new behavior is caused #7100, which fixed a worse problem: #6018: if an attempt was made to read from a CDC device when USB was not (yet) connected, TinyUSB could read from the wrong endpoint and everything would crash.
I noticed this because when I enabled usb_cdc.data and tried 8.0.0-beta.3 or earlier, bad things happen for me when the board tries to come up. It crashes right away, and appears dead. I thought at first there was something wrong with those builds. But I think wheth...
The script I use to send data to the macropad does not close the serial port immediately after writing. It only closes the port if the script exits abnormally or on Ctrl+C. I did find something else which is that the device is not seeing that the serial port has a connection when I connect using my script. I added in a line to skip getting serial input if the port is not connected (eg usb_cdc.data.connected). This at least allows the device to not throw an exception or sit waiting indefinitel...
@mscreations You can check whether TinyUSB thinks it is still connected by doing usb_cdc.data.connected, which will return True or False. So you could print this out in the your loop (instead of checking in_waiting).
Note also this interesting note, which I had forgotten about, in our documentation:
connected:bool
True if this Serial is connected to a host. (read-only)...
Bingo. I was just coming back to report that all the code I've tried and used isn't asserting DtrEnable by default. Once I did that my code runs perfectly (well mostly. still have some code bugs from new v8 changes unrelated to this serial issue.) I am going to close this as it is resolved as far as I'm concerned.
That's fantastic, thanks for the follow-up!
Original issue which caused us to add the documentation note: https://github.com/adafruit/circuitpython/issues/4345
I still think that the fact that read(1) times out when data.in_waiting > 0 (but disconnected) is a problem. Is it the expected behavior ? Should the buffer be reset on disconnect ? If you reconnect, the current content is not dropped, so what couldn't be read but was kept now can be read.
In fact the example I gave of sending data in bursts with echo things > port is a method that I've used, is it weird to want to read the remaining buffer after a disconnection ? It was a successful t...
@Neradoc -- these are good questions. I agree that we shouldn't have data.in_waiting > 0 if we are disconnected and the data can't be read. But the data is in the TinyUSB buffers, I think, and they may be considered invalid once the connection has gone away. In that case, dropping the connection should really clean things up and discard the data. Or, the buffer and channel state should be clean before and after a connection, so that attempts to read won't cause problems. It wasn't, which ca...
Hey all, is this the best channel for finding some help for porting/interacting with a new display driver? I've got a different one and I feel like I'm close but its just not quite there. I had to port CircuitPython to a new baord for this too so I'm not even sure where to start to make sure things work
Mhmm, this is the best place for help working with the internals of CP [but I'm not helpful outside of telling you that XD]
are you writing the Python driver, or is this a board with an integral display and you want to set up the display in board.c?
what kind of display and what is the controller chip?
So I've got a WT32-SC01-Plus - which has a ESP32s3. The display on it has a ST7796UI driver (which is apparently similar to a regular ST7796). http://www.wireless-tag.com/wp-content/uploads/2022/11/WT32-SC01-Plus-V1.3-EN.pdf
I got CP ported over to the board, added the stuff neccessary for ParallelDisplay, and it builds and works - https://github.com/adafruit/circuitpython/compare/main...brewneaux:circuitpython:add-wt32-sc01
Projects using LoyvanGFX work just fine with the board (https://github.com/sukesh-ak/ESP32-TUX/blob/master/main/devices/conf_WT32SCO1-Plus.h), using the Panel_ST7796, so I borrowed the init sequence from that (https://github.com/lovyan03/LovyanGFX/blob/master/src/lgfx/v1/panel/Panel_ST7796.hpp)
This is my test script - the backlight turns on, but nothing displays: https://gist.github.com/brewneaux/a42728ceb3b711ba11e385fccb264aaf
Sorry, I have to be afk for a while. But this is good information.
it's hard to compare with other runs, whose times include delays waiting for runners...
Yes, comparing two check suites won't paint the correct picture, I have even noticed a difference of seconds-to-minutes for the same task between runners. I suggest you to take look at individual steps of a job.
Did you test partial clone with --filter=tree:0 vs depth 1 for the large repos like esp-idf and the broadcom firmware repo?
Yes, without tags --depth=1 is better and with tags `--fil...
I am not sure how to achieve this. An environment variable seems like an obvious solution and likely the only one but it would require two env variables as path doesn't seem to take a sequence or a string of space delimited paths.
I tried remembering whether there ever was a connection using a boolean that was set and remained set even if the connection went away. Confusingly, this did not work, and I could not read characters, even though the code change was very simple. I spent a while trying to track down what was going on, but it wasn't clear. I'm going to give up on this for now.
If I do a printf as a dirty hack in a src file, I should get that in the serial console, right?
do mp_printf(&mp_plat_print, "blah %d\n", i);
alternative on Espressif is to use the ESP_LOGx() macros. #include "esp_log.h" and then do ESP_LOGI("tag name", "% str", args...);. You need to be compile with DEBUG=1. Your image may be too big, so turn off ulab temporarily. In mpconfigbard.mk, do CIRCUITPY_ULAB = 0. That will make the image considerably smaller.
That output will go to the standard debugging UART TX line, so you can see what's going on before USB comes up, etc.
ah thanks!
Ive spent most of the day looking at this. It appears the 8080 driver I borrowed from Espressif is getting initialized. I'm starting to think the issue is in the black magic of the DMA that it is doing
I may attempt to build a translation layer to LovyanGFX, which seems to support a bit more, unless someone thinks thats a bad idea.
hey guys - #help-with-circuitpython channel sent me here. I'm trying to get a custom version of CPy to compile, but I'm getting an error on setup, when running "make -C mpy-cross"
`dbj1906@DESKTOP-V5TAK2F:~/circuitpython$ make -C mpy-cross
make: Entering directory '/home/dbj1906/circuitpython/mpy-cross'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
File "<fstring>", line 1
(offstart=)
^
SyntaxError: invalid syntax
../py/py.mk:272: recipe for target 'build/genhdr/compression.generated.h' failed
make: *** [build/genhdr/compression.generated.h] Error 1
make: Leaving directory '/home/dbj1906/circuitpython/mpy-cross'
any ideas?
If you type: echo $PATH what is displayed?
a lot... don't worry about it... I just set up a linux machine in the AWS cloud
everything seems to be compiling there
I'm sure there some step I missed in my set-up on my Windows machine
I have changed common_hal_mcu_processor_set_frequency to a void return and improved the documentation:

First of all I believe it would be best to 'by-default' prohibit overclocking. ... Ideally an
cpu.safety/cpu.overclock/cpu.cook_mah_pikind of property should be made available.
Any advice on where to put these properties?
In this c...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6-40-gcc6dbb373 on 2023-01-16; Adafruit QT Py ESP32S2 with ESP32S2
# and earlier betas... not sure when it started, but at least back to October or so
Code/REPL
import time
import random
import traceback
import board
import digitalio
import neopixel
import wifi
import socketpool
import ssl
from adafruit_httpserver.server import HTTPServer
from adafruit_httpserver.request import HTTPRequest
...
Those logs are likely coming from the boot rom and there behavior is controlled by permanent setting of eFuse bit(s).
From: https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32s2/api-reference/kconfig.html#config-boot-rom-log-scheme
CONFIG_BOOT_ROM_LOG_SCHEME
Permanently change Boot ROM outputFound in: Boot ROM Behavior
Controls the Boot ROM log behavior. Th...
Hi folks, I've made an asyncio button library: https://github.com/furbrain/CircuitPython_async_button/.
it allows you to do code like: ```
import board
from async_button import SimpleButton, Button
simple = SimpleButton(board.D0, value_when_pressed=True)
await simple.pressed()
button = Button(board.D1, value_when_pressed=False)
clicks = await button.wait([button.DOUBLE, button.LONG])
if button.DOUBLE in clicks:
print("Double click")
elif button.LONG in clicks:
print("Long click")
I'm planning to submit it to the community bundle, but do you think it would be useful enough to go in the adafruit bundle?
BLE support is not complete. It supports GATT client but not GATT server.
Is anyone working on this, to implement the GATT server to ESP3-S3 or C3? if so, I can help doing some tests.
The Adafruit bundle is for Adafruit supported libraries, so since you'd be overseeing its development, it should be in the Community Bundle. The different bundles aren't a designation of importance or utility, only maintainer 🙂
Ok, no worries, I'll submit a request to the community bundle
@anecdata Can you do it with a debug build and reply with the backtrace?
<@&356864093652516868> We'll have our weekly meeting in about 90 minutes from now in this text channel and in the circuitpython voice channel. Please take the time to add your notes in advance to the document: https://docs.google.com/document/d/1aNx4nRN0TXR7JaEv5dAu139IgZDz8aMCPL-wS6WICZI/edit# -- I look forward to everyone's updates!
CircuitPython Weekly Meeting for January 17, 2023 Here is the notes document for next Tuesday’s CircuitPython Weekly meeting. The meeting is Tuesday due to a US holiday on Monday. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please ad...
I have changed
common_hal_mcu_processor_set_frequencyto a void return and improved the documentation:
Thanks for the note! Please make it generic. The same clock caveat will apply across all micros. Please add a suggestion that one sets the frequency before starting to using anything else. That way they should be able to adjust to the new clock.
Any advice on where to put these properties?
Don't add them. Frequency is enough. The common_hal code should verify the value is so...
I haven't been set up to build for almost a year, but I can work on that when I get back from my upcoming trip.
Here's wht the serial interface said:
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
Press any key to enter the REPL. Use CTRL-D to reload.
I'll attach all files from the device drive, except for the "secrets.py" file, which I'm not us...
Thanks, what version of CircuitPython are you using?
Did this happen after an extended period of running, or does it happen reliabily right away (or after a specific series of events)?
Congrats on the working PCB's!
FoamyGuy's TR-Cowbell code https://github.com/FoamyGuy/TR_Cowbell_Sequencer_Software
Today is the last day for the #CircuitPython2023 wishlist. We’ve gotten a number of #CircuitPython2023 posts so far! Thank you all! It’s not too late to post your own. Please post yours by January 18th and email circuitpython2023@adafruit.com to let us know.
Hi Dan,
Thanks for the quick reply. I'm a hobbyist and unfamiliar with the process
of reporting an issue, so please bear with me.
I'm running Adafruit CircuitPython 8.0.0-beta.6-28-g6013cde6a on
2023-01-05; Adafruit Matrix Portal M4 with samd51j19
I use the Mu editor on Windows 11 to update and debug my code, as I have
for several years. The pattern is a predictable one of starting the Mu
editor session, opening the code.py window and the serial window, and then
repeatedly changing the c...
Thanks Liz!
Thanks.
Thank you for hosting Liz.
thanks liz!
thanks everyone!
Thanks, have a great week!
I found this in French about CP2023 and that is strange, who made that, is it human translation? https://zephyrnet.com/fr/circuitpython-en-2023-circuitpython2023-python-circuitpython/
no idea; there are a number of other translated posts from https://blog.adafruit.com
Thanks! Didn't test; grateful to @anecdata for testing.
I've progressed down the CYW43 Pin approach, and am honestly rather happy with the user experience! Having the pins for LEDs and buttons just being accessed using
board.LED_Aandboard.USER_SWfor example, feels quite magical. I even updateddisplayio.FourWireto support these expander pins for DC and CS, and although slow, seeing the REPL on screen using the usual example code was rather exciting!
Awesome! Sounds like the right approach.
Because of both these things, for my u...
Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1yqZABCU8BjP_njl0_8fed1P2dkDmNqw5o42qjZzLxqc/edit?usp=sharing
CircuitPython Weekly Meeting for January 23, 2023 Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be...
Hi Dan,
I should add that when this fails (doing a Save) the "busy" Windows icon
appears on my screen at the cursor/mouse position. This spins for about 30
seconds before the serial window shows the text I sent you (crashed, safe
mode, etc). I had never seen this ever before, and at first assumed that I
should just wait for the Save to finish.
I suppose this could or could not be indicative of a problem with the "USB
drive" (not the proper term, I know) on the Matrix Portal M4? Failing o...
shush dyno I typed too fast !
I didn't finish my sentence 😛
the one in https://github.com/micropython/micropython might be static ?
in the readme
👍
- there's a debug message remaining in
raspberrypi:found service 0x********
I fixed this in #7445
I'm looking at the reliability issue now.
Here's my #CircuitPython2023: https://blog.adafruit.com/2023/01/05/scotts-circuitpython2023-tannewt/
Meant to add them in #7445 in response to @jepler's review.
Adding my vote as well. Blocking on request is one of the core use cases for async.
I'm not able to reproduce this on pico w or samd21 qtpy with tio on Linux.
The status bar is updated before and after code.py runs. It is also updated by request when USB CDC is connected:
I tried to reproduce this on an ESP32-S3 USB OTG but after 30 minutes it was still finding the other CP device. Any idea how many total results you got before it crashed? Maybe we're leaking them. Would you mind testing with a DEBUG build to get the backtrace? Thanks!
@xav-e Is it still happening?
I'd guess something on the order of half dozen results every 15 seconds batch in the loop, sometimes more, sometimes less.
I haven't done much with mDNS recently, but I didn't see it during testing of "Share the web workflow MDNS object with the user" and other recent mDNS changes. I'll try first to just set it up and see if it's still happening. If it is, I can queue it up after 7459, the ESP32-S2 safe mode issue.
@crimson ferry I'm happy to do debug builds for you
ok, I appreciate that. I'm only here through Thursday then traveling for a bit. Priority (for me) is the ESP32-S2 safe mode, it's pervasive across a bunch of projects I've been trying to do.
to capture the trace... that's debug serial (right?), so DevKit is best? N4R2 would match the QT Py best (most of my testing has been on QT Py, but I'd be very surprised if it differed between any -S2)
but I have a variety of -S2 if something else is easier
what would we do without issues? 😉
yes, of course
one trick with the backtrace is that you'll want the elf file for the version you get the backtrace for
for that utility, I vaguely remember
yup yup
Watchdogs are used to reboot out of the bootloader. There is a scratch register for user watchdogs. So use sdk functions to better distinguish these.
Related to #7346
I've fixed the reset reason issue with #7462.
I wasn't able to reproduce the MDNS dropping over the long term. I missed one or two scans but then it came back without any intervention from me. MDNS is unreliable so this is ok by me.
I loaded the 7462 artifacts and I'm still seeing the PicoW drop from the list of devices after the test code from above runs...
Is it possible to 'catch' an exception that is raised from in the core with something like this: mp_raise_ValueError_varg() I'm trying to catch an exception raised by that inside the core, check a few more things and then re-raise the same exception if some conditions are false, but consume the error and return something else if some conditions are met.
It is, where is it being thrown from? like there are some nlr_push(?) commands to put commands and stuff on the stack.
in my case it's raised from inside of validate_obj_is_free_pin() which itself calls assert_pin_free(pin); which is the function that has mp_raise_ValueError_varg() inside of it.
I may not need to be able to catch the exceptions though. Upon thinking it over a bit further I realized I could rearrange my logic a bit and not need to catch the exception. Still gotta figure out how to actually make the other conditions I'm interested in though 😅
Oh yeah in that case trying to catch it before is probably the best bet. I'm not quite sure you could otherwise actually. I think busdevice when it calls the I2C/SPI functions does catch/throw exception (or could been too long since I wrote that)
you are just going to do try: ... except ValueError ...
I'm trying to catch it from in the C code though, before it makes it into circuitpython code. Can that work from C?
Ah, OK, I would suggest you just call the actual "pin is free" routine and bypass all that
common_hal_mcu_pin_is_free()
will return a boolean
the only purpose of the throwing routines is to propagate the error to Python
I see, thank you! I'll look into that one
Hey all. I compiled a custom version of CPy (latest build) for my ESP32S2_feather. I only made one change: adding the ability to use 2 displays - added #define CIRCUITPY_DISPLAY_LIMIT (2) to the mpconfigboard.h file. I loaded the UF2 file to the board, and have tested that it works with two displays. The issue I have now is that I get a core crash every time I make a save to my code.py file. the REPL says
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
NLR jump failed. Likely memory corruption.
any thoughts on what I'm doing wrong? or if there is another change needed?
note - the code seems to run as expected on it's first run. I only get the error when I make a change to code.py and said. I usually have to manually unlug/replug to board to get the code to rerun (exit safe mode)
That's all I think there is to change but I never did try two displays on any ESP32* chip. At the start of your code do you have a release_displays call? Re-allocating them or having them free improperly could easily result in a crash like that (saw it when I did some other displayio stuff)
yes, I release the displays at the beginning. I am using the same SPI (different DC and CS pins for each board). I was looking at the code for the Monster_M4sk - it looks like that code has a separate SPI for each TFT.... so I guess I can try that....
maybe the release is what crashes ?
if you could get a debug build and the debug output
not exactly sure how to get a debug build and output....
code seems to run fine when there is only 1 display... I'll keep playing around with it
you make with DEBUG=1 and possibly disable some modules to make it fit
so "make DEBUG=1 BOARD=adafruit_feather_esp32s2"
There are apparently two RTC interfaces in the mimxrt10xx dev kit. The low power interface access the battery backed up hardware.
I've tested this on the Teensy41 and it seems to fix issue #4574
and typically CIRCUITPY_ULAB = 0 in mpconfigboard.mk if it doesn't fit
ok, I'll give that a try
too little flash!!! even with the CIRCUITPY_ULAB = 0 in the mk file
ok.. looks like I need to remove some frozen modules.... tomorrow
is anyone aware of a method to minimize the size of a uf2? I've pulled the full binary off of a custom rp2040 board and I'm left with a working 8 meg uf2. I'd really like to be able to get that down to a smaller file since we have to flash so many boards. my hex editing attempts don't work very well
hmmmmm a UF2 is composed of blocks of 512 bytes. You can probably remove most if not all of the blocks that only contain FF in its data payload (especially in the drive part). It should be possible to automate that.
Here is the format specification, find the size in each block, find the actual data, and test if it should be copied, if not, skip that block, if yes, add it to your output file.
https://github.com/microsoft/uf2
GPIO11 on the ESP32-C3 is by default dedicated as the VDD pin for external SPI flash.
This board does not use the pin for that purpose, instead directly connecting it to the 3.3V bus and breaks GPIO out to a board pin. In order to actually use it as a GPIO in Circuitpython requires setting an efuse on the chip (and beyond that will require modifications to ports/espressif/common_hal/microcontroller/Pin.c) and building a custom image. I removed the GPIO from pins.c in https://github.com/ada...
@slender iron when you are available could we talk a bit about the remaining 8.0.0 bugs? Trying to get a sense of what to work on and whether we have any theories.
I set the backlight to 0, and then called displayio.release_displays(), and the result was the backlight was left on.
After the displayio.release_displays() call I setup I/O pin D10 and set it low (driving the backlight), but I received the same error that the GPIO was in use when exit_and_deep_sleep_until_alarms() was called:
backlight = digitalio.DigitalInOut(board.D10)
backlight.direction = digitalio.Direction.OUTPUT
backlight.value = False
Traceback (most recent cal...
I loaded up modified test code from above (mostly a more robust connect, and bumped the mDNS timeout to 10 seconds) onto an S2 TFT with Adafruit CircuitPython 8.0.0-beta.6-44-g936ecdd2b on 2023-01-18:
import time
import traceback
import wifi
import mdns
from secrets import secrets
MDNSFINDTIMEOUT = 10
def connect():
while not wifi.radio.ipv4_address:
try:
wifi.radio.connect(secrets["ssid"], secrets["password"])
except ConnectionError as ...
Hi all! I'm new here. I'm a software engineer by trade and would like to spend some of my free time working on community projects, like CircuitPython. I would love to know if you have any major feature requests that you're looking for someone to take the lead on. Thanks!
Check out the circuitpython GitHub, pick an issue, fork the repo and start working 🙂
Come here and chat, comment on the issue of you need clarity investigating, etc..
There are issues that are linked to milestones like version 9 release or enhancements, etc..
Welcome @timid bolt!
We're just about to get 8.0.0 released so it'll be a great time to add new features to CP.
What hardware do you have?
I have a RP2040 and ESP32-?? (don't remember the model). Happy to get more hardware if needed. (If they are in stock!)
I'm also in seattle so I could get you stuff too. Any particular interests?
Happy to work on an issue to unblock release to get my feat wet.
The list is here: https://github.com/adafruit/circuitpython/issues?q=is%3Aopen+is%3Aissue+milestone%3A8.0.0 but I think we're pretty much going to punt on them
they aren't simple
looks at rp2040 issues
I have particular interests in async/parallel programming, RP2 PIO, USB PD. But my main goal is to do whatever's most useful for the community.
You act like the RP2040 has issues or something 🙂
Great chip, but lots of weird bugs
I do love it though. It’s been great for learning
This might be a good start: https://github.com/adafruit/circuitpython/issues/7452
Interesting. I gotta get better at issue filtering. 😀
(though I hate to fix a new issue instead of an old one. 🙂 )
we're pretty good about labeling issues with what port and subsystem they are
If you get this solved I can make a circuitpython oscilloscope 😅
the sleep stuff will need a ppk2 or other power monitor (and probably not worth it on rp2040)
10-100kHz range 😬
@tulip sleet's been the person thinking about async most
usb host and using the second rp2040 core is probably my next big thing
we also just did CircuitPython2023 which is our longer-term brainstorming we do each year
build instructions are here https://learn.adafruit.com/building-circuitpython
Cool. I've had this issue myself. TBH, I had a lot of trouble writing real-world PIO programs in CP. I would want to refactor the API, but dunno if that's the sort of thing you'd want newcomers doing.
(fyi I worked at google seattle just before you and did road traffic when I started in 2009)
how would you refactor it?
Love it! There
imx rt will likely be the next platform to get polish from us
's lots of interesting stuff here for me! Let me know what's most important and I'll get started.
I think #7452 is a good place to start
Wow, amazing! Small world.
we've been considering bring async apis to more of the core as well but aren't sure how
async requests would be good too (see dan's cp23 post)
making digitalinout awaitable would be nice
so that all those int pins could be utilized
(Scott - we are doing CE meeting now)
async requests would be a combo of Python code and also some internal stuff, I think. There is already latent support because Micropython does it
Hello and welcome! Glad to see you joined us. 🙂
The code did eventually start looping with
Traceback (most recent call last):
File "code.py", line 12, in connect
ConnectionError: No network with that ssid
So maybe something is getting messed up in wifi-land, but it's recoverable with a reload.
Probably would be good to get you on the circuitpythonistas role 🙂
The part I think is missing is async support is the ability to register an interrupt handler and have it run as a task in the async loop. With that building block, things like await on digital IO pin become more straightforward.
@timid bolt Are you interested in being added to the circuitpythonistas Discord role? We send a couple of notifications per week to let folks know when our community meeting is happening. It's typically on Mondays at 2pmET/11amPT, here on Discord. It would definitely be great to have you there, but it's not at all required.
Welcome!
we don't have raw interrupt handlers in CircuitPython, unlike MicroPython. But there is a Event thing in MicroPython that you can await on
I imagine the actual user interface would be similar to alarms
(it is a deliberate choice not to have those interrupt handlers)
safemode.py could be useful too: https://github.com/adafruit/circuitpython/issues/5956
maybe you would actually await on an alarm...
you could await on a pin change. The alarm pin stuff is pretty tied to sleep, though maybe we could break it away.
ararmio 👀
@ jepler has done low-level asyncio stuff recently as well; he is off this week
Sure. Why not.
like having a general way to specify a pin change, and then use it both in alarm and async?
Done!
we already have countio, you can specify edge or level
could await on a countio transition
So I think we can close this issue? If safe mode or extended no-results arise again, this or a new issue can be opened. And leave the quirks and platform differences to future testing.
I'm not sure we need to close, just re-milestone it.
I am out of stamina for debugging MDNS for the time being.
like on AVR ;-)
It's not really a "raw" interrupt because it doesn't run in the ISR frame and executes milliseconds after the hardware signal in a proper Python context.
i thought they have both hard and soft interrupts. The soft interrupt is what you described. We still avoided it for ease-of-use and support reasons. A writeup here: https://learn.adafruit.com/cooperative-multitasking-in-circuitpython-with-asyncio#faq-3106700
we've avoided interrupting other python code too
however, my line has always been that I'd merge it if someone wanted to add and maintain it. I just don't think its a priority for adafruit-funded folks
The concern I have with countio is that it is still polling. I believe it keeps rescheduling itself on the looper until its done.
Agreed. Trying to run Python user code in an ISR or between Python opcodes is crazy. What I'm suggested in a disciplined way to bring interrupts into cooperative multitasking.
it could be implemented with an interrupt internally
do you mean in the C code or how we use it in asyncio tasks now?
In the async Python code. I'd seen an example of awaiting on a GPIO pin using countio.
yes, that's just because we don't have awaiting on a countio-related Event yet. That is very much a thing to add.
There are a bunch of library issues that may need core support: https://github.com/adafruit/Adafruit_CircuitPython_asyncio/issues. https://github.com/adafruit/circuitpython/issues/6736 is relevant, or more generally https://github.com/adafruit/circuitpython/labels/async
I see. MicroPython has this uasyncio module, which I believe is where the Event class you mention comes from. What's the status of that module in CircuitPython?
our asyncio library was copied from the Python uasyncio model and modified it slightly. But we just made it a library instead of freezing it. And the native _uasyncio MicroPython support is _asyncio in CircuitPython. A noticeable difference is that a contributor added genuine __await__() support to CircuitPythoin, so there is some low-level stuff that is slightly different.
it may be worth reading the closed issues and pull requests related to async/await and asyncio
Cool. Amazing. I didn't know CircuitPython was doing something like MP's uasyncio.
the language core is pretty much the same; we merge regularly from MicroPython
Yeah, but for some reason I thought you weren't following their asyncio approach because of the differences in your interrupt philosophies. But sounds good. I'll check out the commits on CP asyncio.
i've got to go to another meeting, sorry. Thanks very much being interested on working on CircuitPython. We really appreciate it, and appreciate your expertise as well.
The PyPortal doesn't have the ssl module, so this issue regarding not being able to use adafruit_azureiot on it is true, right? If so, is this truly an issue, or a case of board/library incompatibility?
https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/issues/55
Thanks for a great discussion. I've really enjoyed it. I'll follow up in a few days with my thoughts on the PIO background read issue.
library. The ESP32SPI library does ssl internally without a separate module for it
Sounds good. This is the best place to find us. We're here during the work week and others are here weekends too.
ESP_SPIcontrol.TLS_MODE
Might be worth taking a look at ThreadSafeFlag in MicroPython:
https://docs.micropython.org/en/latest/library/uasyncio.html#class-threadsafeflag
It allows you to await on an event in cooperative context but set the event in ISR context. Example here:
https://github.com/peterhinch/micropython-async/blob/master/v3/docs/TUTORIAL.md#36-threadsafeflag
Before this, it was impossible to interrupt a running program over BLE.
I tried to reproduce this with the test program above, with the URL's you gave, and also with some of my own. I ran trials for several hours.
I couldn't reproduce, but I have pretty reliable wifi. I also shortened the fetching interval a lot, to see if that made any difference, and tried just http and just https. So maybe it is due to some external failure?
Whenever I use mkdir to create a file it says no such file / directory
I have pretty robust commercial-grade wifi. Signal strengths are good and disconnections are very rare. I've been battling this for months on a range of projects, most common theme is httpserver + requests client, it's very reproducible for me.
I also split up the test program above: 4 QT Py ESP32-S2, one running exactly as above, one running the HTTP URL only, one running the HTTPS URL only, and one doing both each loop. Oddly, the one doing only HTTPS has not crashed at all (almost two d...
Its kind of annoying because I have been trying to solve this issue for 3 hours and the literal error is what I am trying to solve. But its broken because it wont let me create the file or directory
you mean in CircuitPython?
Yeah
are you trying to create a single dir or a multi-directory path?
This is the directory I am trying to create "OTATest/Folder"
Should there be a slash at the begging and end also?
Note that os.mkdir() is going to raise OSError: Read-only filesystem normally. Is that what you are seeing?
No, I solved that by saving the code on my usb port then disconnecting after its done and using a battery to power it
If you have done .remount to make it read/write, then create the OTATest directory first, then create the subdiretory
you can't create the whole path at once. In regular Python, for instance:
>>> import os
>>> os.mkdir("a/b/c/")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'a/b/c/'
>>> os.mkdir("a/b")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FileNotFoundError: [Errno 2] No such file or directory: 'a/b'
>>> os.mkdir("a")
>>>
Ok, ill try this. Thank you!
@anecdata thanks for the detailed reply. Here is a QT Py ESP32-S2 debug build from the current tip of main, 1ab1cd3.
qtpy_esp32s2_debug.zip
previouse = ""
for i in dr.split("/"):
os.mkdir(previouse + "/" + i)
previouse = previouse + "/" + i
I got it working with this
thanks for the help
for any future readers searching through discord for answeres. Put this in a try except statement also
The part inside the for loop
specifically the line os.mkdir
lol
dan, are you still around? pins 19 & 20 aren't exposed on the QT Py that I could see, but I think I need that for debug serial? I have most flavors of DevKit-C-1... N4R2 (adafruit-circuitpython-espressif_esp32s2_devkitc_1_n4r2-...), N8R2, N8R8
Looks good except for a missing line, I think, in the espressif impl.
I don't see that watch_for_interrupt_char is saved in this _construct() routine. It's just ignored. Did you want to save it?
@tulip sleet uart pins needed?
eh, right, hold on
you don't have a metro ESP32-S2, do you?
or something with the default ones broken out already?
adafruit-circuitpython-espressif_esp32s2_devkitc_1_n4r2-...?
i can build for the qt py with custom pins, and if that doesn't work right away I'll build for the devkit
ok, i'll dig out my usb-serial cable
ok, rebuilding for GPIO5 and GPIO16 (TX and RX on the QT Py). I will test before uploading
I've got the pins right (because TX is in use when I try to grab it with board.UART(), but seeing no output...
building for a different board might require other modules disabled? the devkit also has 4MB flash
can you ID the debug pins on the DevKit? Should be GPIO8 (TX), I think?
It has 2 USB connectors for 19/20, or I can access every pin
oh, right, never mind. Let me build that, instead of debugging the QT Py
i have only done custom pins on plain ESP32, so maybe I am missing a setting. Copied from one of those sdkconfig's
should be a standard devkit build -ulab + debug?
yes, just starting
gotcha, thank you, I really appreciate it, hopefully I'll be self-sufficient again soon 🙂
no problem, these infrequent faults are really bugging me 🙂
i really appreciate it as well
i don't have that board, I think. I have the old saola boards
if you build it, I will test
I can tell you right away if it's working
otherwise... tomorrow, getting late out east
i am out east 🙂
I'm midwest
ok, will load...
did you happen to save the elf file? that's needed for the utility to backtrace... I'll find the instructions for that later
oh, it's there, n/m
ports/espressif/tools/decode_backtrace.py
thanks, debug printing is working, I'll post to issue if/when I get something
Peplink
I need multi-wan router since any one internet option here is so bad
(no broadband)
@slender iron, @tulip sleet - does that mean it should be patched, or is this just the way it is? I don't know too much about SSL or how it would get patched if it even can effectively.
the ESP32SPI library API is non-standard. A wrapper library could be written, I guess. I think I made an issue about that, but I didn't know about the TLS/SSL stuff when I wrote that
better to write a wrapper than do something with all the client libraries. Or not a wrapper maybe, but just more API calls (two ways to do the same thing)
I'm not sure I understand - so you would wrap the problematic function calls in the AzureIoT library, or something else?
I want something like:
wifi, pool, ssl = adafruit_esp32spi.setup(spi, etc.)
# from then on, use the same code as for builtin wifi
That would be nifty
and then make proxy modules named wifi, socketpool and ssl that act like those same objects and auto-setup with board.* objects if they exist, freeze them on the pyportal and boom ! builtin wifi ! (As far as the python modules are concerned)
I believe this would make the Arduino Nano Connect much more compatible as well, I've had some difficulty getting a working socket for NTP purposes with the existing esp32spi
yeah the ntp library was changed to native wifi, because ESP32SPI has a builtin thing that works by interrogating the nina module, which retrieves the time on its own
you can pull an old version from the NTP library repo that was written for esp32spi
or esp.get_time()
I need to add that to my samples
def get_ntp_time(esp):
# get_time will raise ValueError if the time isn't available yet so loop until
# it works.
now_utc = None
while now_utc is None:
try:
now_utc = time.localtime(esp.get_time()[0])
except OSError:
pass
rtc.RTC().datetime = now_utc
Prep DevKit N4R2 debug build: esptool erase flash, storage.erase_filesystem(), esptool firmware.bin, install code and support files, microcontroller.reset().
Having some trouble with TLS connecting. This works:
Adafruit CircuitPython 8.0.0-beta.6-45-g1ab1cd3ba on 2023-01-19; ESP32-S2-DevKitC-1-N4R2 with ESP32S2
but not this debug build:
Adafruit CircuitPython 8.0.0-beta.6-45-g1ab1cd3ba-dirty on 2023-01-18; ESP32-S2-DevKitC-1-N4R2 with ESP32S2
I'll let it keep running with HTTP site...
Getting this error with XIAO ESP32C3 Circuitpython 8.0.0 beta 6 and KMK firmware
code.py output:
Booting
Traceback (most recent call last):
File "code.py", line 4, in <module>
File "kmk/kmk_keyboard.py", line 12, in <module>
File "kmk/hid.py", line 2, in <module>
ImportError: no module named 'usb_hid'
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.```
Hi! I would like to use this https://www.aliexpress.com/item/32868365660.html?spm=a2g0o.order_list.order_list_main.5.1a271802KuMKjz Nordic nRF52840 with KMK for a keyboard... is it possible to flash CircuitPython on it?
as long as it has nrf52840, yes, but it may be some work to prepare custom firmware, and you will need a programmer to flash it
I flash it with a J-Link device... any hint for building a custom fw for CircuitPython?
@sick hemlock note that you will need to add some components to that module to make it work – at least the power circuit
Yes, I am already using it with daughterboard and rechargeable battery
excellent
I think maybe the pinout mapping is the one to get right... will read the docs and try
Because of both these things, for my use-case I don't think it's even necessary to have an IO Expander object that's exposed. @tannewt, I'm guessing that for your "wouldn't add it to
microcontroller.pin" comment, I would need such an object to exist? That wouldn't have any impact on thepin_type? Rather just change them to appear astca9555.pinfor instance? Which directory should I place such an object in?I don't think you need a separate object if all useful pins are acce...
The amount of work to get this going (install bootloader, custom build), etc. is high. You might consider buying an existing nRF52840 board that is already supported, for a few dollars more.
Yeah, I imagined it. I would have liked something without embedded usb-c connector
Adafruit ItsyBitsy is quite small but plenty of pins. You could use a Nordic PCA10059, which is tiny (maybe not enough pins for you), and already supported. But it still requires installing the bootloader. The USB jack is very convenient to get code onto the board, since it will present CIRCUITPY
Is there any kinda of reference guide for tinkering with bootloader/custom fw?
https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md for flashing a new bootloader. https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython as mentioned above for adding boards.
I would still suggest considering the Itsy nRF52840. You can mount it at the edge of your keyboard board so the USB connector is flush with a small case opening, and then make a small hole in the case to hit the reset button. So the keyboard software will be easily maintainable without disassembly. It also has a level-shifted 5V output pin ideal for driving addressable RGB LEDs.
Is this feasible to do? I don't know what the space constraints are on all the boards, but I'd be willing to try and tackle this at some point in the future if it's useful. I know a lot is changing with connectivity these days.
Hi @dhalbert. I just wanted to let you know that I had some merge conflicts come up due to your recent arg_name changes in: https://github.com/adafruit/circuitpython/commit/a974402542f71fde63043da5725e3777c95b6861
Specifically, I needed to change these 3 functions from the validate versions to common_hal ones, which in your commit did not have arg_name as a parameter.

...
Perhaps you will want to do a separate commit with this change to
common_hal_digitalio_validate_pinin? It will be a while until this PR is ready to be merged.
That's a good improvement, thanks. I will add this.
Ultimately I think making the AirLift API match the native WiFi API is what we want. That could be a wrapper for now, or a rewrite of that library. It could even be a new library, so that old code still works, and we could deprecate the old library but leave it around.
Sounds good, I'll keep that in mind!
-
I also am seeing https failing on the DEBUG build, on a Metro ESP32-S2. I tried another https host, same thing. I think this is an important clue, indicating maybe there is some uninitialized variable, or we're ignoring error returns at a crucial point, or something.
-
I would like to speed up trying to get the crash happen. Your test program has a 5 minute cycle. I tried faster and that speed. Do you think trying faster might prevent the crash for some reason (no socket timeout, etc.)?
Coming back to the idea of using uasyncio Event or ThreadSafeFlag to implement non-polling awaitable pins: how would you call the "set" methods on these classes from CP. The ThreadSafeFlag example uses MP's interrupt API, which I'm guessing should not be available in CP.
I'm not sure, I wondered that last night and sped mine up for a time, but didn't notice anything. Very unscientific.
BTW, the debug build is still running on the DevKit from last night, exceptions on the HTTPS url but success on the HTTP adafruit url. Odd, since the original runs HTTPS-only fine but safe modes on HTTP-only. Could even be a data size / alignment issue somewhere?
I'm going to load up one of my earlier more complex projects and see if I can cause safe mode.
how about just having an __await__ method on the countio.Counter object, so you can just do await countio.Counter(pin)?
Right, something like that is the goal. My question is more about how to get there.
I imagine the __await__ method would install an interrupt corresponding to the Counter object settings, that would flip the Event object that it returned, or something like that, but I have to admit I'm not greatly familiarized with the _asyncio module yet
I had thought about passing an Event into things like countio.
you mean explicitly, on the Python side?
yes, but maybe I am missing something
so a single event might be triggered by multiple things, might be convenient
so it would be something like:
event = asyncio.Event()
counter = countio.Counter(pin)
counter.register(event)
await event.wait()
to await on a pin?
I think that could work. My thought is that just waiting on a state change of a pin in a much simpler operation than what countio provides, and perhaps this functionality should belong in digitalio instead.
For example, looking at the rp2 impl of countio: it needs a pwm pin. But maybe on other hardware not every pin supports pwm, but likely more pins would support simple gpio interrupts.
The GPIO interrupt mechanism on RP2040 is all pins, all changes, without breaking it out per pin or kind of change: https://forums.raspberrypi.com/viewtopic.php?t=343058#p2055582. I'm not sure if this is why the implementer of countio (https://github.com/adafruit/circuitpython/pull/4254) chose PWM. We could ask him.
Also, it looks to me like RP2040 countio only uses the interrupt routine when the count register wraps around. Otherwise I think it is completely in hardware.
to do it with DigitalInOut you would still need to select on which kind of change it's triggered
I think a per-transition interrupt for countio could be added, so we could trigger, but a DigitalInOut interrupt might be better. It just has to demultiplex the interrupt.
that would be a third place where an Edge object is defined
maybe should move edge to DigitalInOut
Any chance of Pi Pico W (CYW_43) support?
or share it, after it's all compiled in
yes
so something like
event = asyncio.Event()
dio = digitalio.DigitalInOut(board.pin)
dio.register(event, edge=digitalio.Edge.RISING)
await event.wait()
possibly also with some way of deregistering
yeah, something like that
For digitalio, I think you'd want to await on high/low, more so than rise/fall. Rise/fall can be prone to "time of check, time of use" bugs.
you really want a choice of all four
depending on the use case
Possibly. I'd like to see an example of the rise/fall use case.
int pins on sensors
generally anything where you care that the pin changed at any moment, not what its state is right now
We depend on https://github.com/georgerobotics/cyw43-driver for the Pico W, so we'd await that. It's not clear to me whether just defining some more authmode constants will work or it needs further support.
Right, but specifically where you'd need rise/fall instead of high/low.
anywhere where it can change by the time you get to it
if sensor.idle():
await sensor.wait_for_rise()
Is actually wrong because the pin can rise between lines of python code. Whereas:
if sensor.idel():
await sensor.wait_for_high()
Is robust against that race.
the event would register the change anywhere from the moment it was registered on the pin
e.g. want to trigger low to high. External peripheral has a line that is already high, you want to reset the peripheral, which will make it low, but not before you set things up. When some event happens the peripheral makes the line high
e.g. some kind of latching peripheral interrupt line
another example, want to respond to a key being released. Undepressed key is low, depressed is high. Set up interrupt to trigger on high-to-low transition
can't set up on just low, becuase it's already low
I think you do want to revamp it as a separate library. That way you don't need to fix all of the reverse dependencies. We also discussed doing the new library natively so that web workflow could work with esp32spi.
I see what you mean. That would work.
Thinking about the end-user programming experience though, I would strive to get rid of the Event object. I think Events are not on the entry level of the Python async model, and many python async APIs work without them.
sensor_ready = DigitalInOut(...)
while await sensor_ready.wait_for_high():
talk to sensor
I think this code looks a lot cleaner without events. But it would be good to examine some real world code to understand the use case better.
I don't think we'll want to add to the existing apis. I think we'll want async versions of them
There is no way to implement a C native async def method
- currently
so it would be asyncio.PinChange(pin, edge) or something like that?
I don't think I would do that, but my point was I was trying to figure out how to do something async with native modules. I can't await on a native method, but I can pass it something that is awaitable.
native async methods it probably the right way to go about it
i don't think MicroPyton has this now, though
tbh the whole async stuff both in the big python and especially micropython really feels bolted on
found an MPy discussion issue on this: https://github.com/micropython/micropython/discussions/9131
I don't think you need native async methods. The native method gets passed down some sort of object (like Event) that it can use to schedule callbacks in the Python event loop. That's how it is implemented. My suggestion is more about how it is exposed to users. I think there are usability advantages to not exposing the Event object to users, even if an implementation uses one.
it has evolved in a very tortuous path over years and years, yes.
they could have just said that Twisted is the standard
that was what I was thinking of, but how do we await dio_object.something(). Instead we need a wrapper library
I think that had its own issues. trio semantics are very good, they have really moved in that direction with TaskGroups and the cleanup of the asyncio API (don't mess with event loops yourself, etc.)
that Mpy discussion seems very relevant...
have you found anything that explains why we can't do native async?
the scheduling is all in the asyncio python code, except for some optional helpers in _[u]asyncio
ah
I'm having trouble parsing your message. Do you mean how do we implement await dio_object.something()?
is there a reason to keep the scheduling in the python vm?
right. a_digitalinout.some_method() is a native Cmethod, but there is no way to await a native method
dio.awaitable_event(LOW_TO_HIGH), for example, could return a native Event-ish object, maybe. But right now Event is a class defined in Python in the asyncio library
no, we wouldn't want to move the scheduling. it's much easier done in Python, and it depends on a lot of Python code
Right, in big Python this method would return an asyncio.Future object.
and you want to maybe subclass, etc. I wouldn't want to maintain that.
maintain the scheduling?
maintain the whole library. Huge parts would need to be native
I think there would be a HAL functions that associates an irq with an asyncio Future. The native code is huge because it is different for every port. But the native code for any one port should not be huge.
right so the native api returns a future that we modify in a native interrupt
we use native interrupts in many places
right now there is no Future class in MPy/CPy asyncio
i think we can get away without having it.
or maybe not, but I feel in the CPython world it is partly a legacy.
there are too many kinds of things you can await on
Right, this leads me to a higher point about micro asyncios in general. I agree big Python's asyncio history is tortured but it looks to me like it has reach a sort of plateau of stability now. So what is the thinking about embracing big Python's asyncio interface warts and all. On one hand it gives a lot of cross-compatibility with big Python (which I believe is a goal of CircuitPython), and re-use of code maintained by CPython. Are there concerns that the code size is too big for micro?
but my point about passing Events in rather than constructing them is that it could be more flexible. It allows the same Event to be shared and triggered by multiple things. (Maybe that is bad, not sure). I think it is very much worth studying what the MPy folks are doing here; they have much more experience writing async code, particularly peterhinch and jimmo
hmm, if CPython world it is partly a legacy, what is the future? (no pun intended)
we should definitely talk to damien and jim before doing anything major
they've been thinking about this too
i spent a long time trying to understand asyncio thoroughly. The early styles of use were kind of terrible. I really agree with Nathaniel Smith about the problems with the unconstrained early stuff
I'd be happy if we didn't need an .irq() equivalent
I would have preferred having a trio library instead of an asyncio library, but it seemed difficult to port. And the MPy library was available for our use with minimal changes needed. In the CPy asyncio guide, I really tried to show a style of use that was clean and simple.
now TaskGroup is in CPython 3.11, but it had exception groups as a prerequisite. It took 3 years for that to get implemented. exception groups are a lot of new implementation for MPY and I don't think MIcroPython is going there any time soon. But we can still have TaskGroups with some (slightly incompatible) wrapper for exceptions in tasks or something like that.
Does CPython mean CircuitPython or the standard implementation of "big" Python?
CPYthon means "regular Python". We try to say "CPy" for CIrcuitPython. The ambiguity is a problem. So I usually say "regular Python" to the average user
"CircPy" never caught on
i have to go grocery shopping before it starts to rain, but this has been really interesting, and I need to read that MPy discussion (and it points to further documents).
Yes, we had some brief discussions before with Damien and Jim, but more would be better, since they have progressed in their planning now (and maybe have even done some impl we haven't seen yet).
I think the use of Event like that is valid. But I also think using asyncio.wait (https://docs.python.org/3/library/asyncio-task.html#asyncio.wait) is a more typical way to wait for multiple signals.
The CPython folks are much more concerned with async for network stuff. Arbitrary external events are not something they have thought about a lot. We talked with Nate Smith about this in hallway at PyCon several years ago, but reached no conclusions.
I don't know if you have seen the trio "manifesto"-like doc, but I liked it: https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
Problem on the DEBUG build is that sock.connect((connect_host, port)) in _get_socket() in adafruit_requests for the https request. The same connect() succeeds on non-DEBUG build. I will pursue that further for at least a while.
There is a reason for it: it may be easier to provide line end which is out of bitmap than to compute its intersection point with bitmap border.
Got a halt rather than safe mode, looks like the address is corrupted though, decode_backtrace can't decode it:
Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception).
Debug exception reason: BREAK instr
Core 0 register dump:
PC : 0x400283c0 PS : 0x00060a36 A0 : 0x3ffd98a4 A1 : 0x3ffd98ac
A2 : 0x3f4c0058 A3 : 0x00000001 A4 : 0x80036348 A5 : 0x3ffe7b40
A6 : 0x00060023 A7 : 0x00000003 A8 : 0x00060023 ...
This patch fixes two issues relating to microcontroller.on_next_reset() on NRF boards.
- Issue #5353. Using the SDK function sd_power_gpregret_set() instead of directly setting NRF_POWER->GPREGRET eliminates
the problem of immediately resetting the board. - Issue #6975. Adding a test for a runmode of RUNMODE_UF2 in addition to RUNMODE_BOOTLOADER avoids the system firmware failure assertion.
I want to add CircuitPython to the Flipper Zero WiFi Dev Board. What existing board should I copy?
@solid juniper start with one that has the same esp module
that way the flash and ram should be setup correctly
So something like the Saola 1 w/WROVER?
I don't know what the flipper has so I don't know
I wonder if it's the tio connection delay.
It has an ESP32-S2-WROVER-N4R2. The Saola should have the same, since it has an ESP32-S2-WROVER that has 2MB PSRAM and 4MB Flash.
@solid juniper https://www.espressif.com/en/products/modules
Do I need to change any of the pins before I build the first build?
generally, microcontroller will have all of the pins, and board will have the pins exposed on your board (with name aliases matching silk, where applicable)
VID / PID need to be worked out
eaxample of a Saola-like board: https://github.com/adafruit/circuitpython/pull/5998 but it duplicates the Saola VID / PID since it's also made by Espressif and has the same functionality
I'm sure there are other examples... maybe there's a closer board to yours in https://circuitpython.org/downloads?mcufamilies=esp32s2
Q: When the filesystem has been extended, is the former dualbank parition preserved as part of the filesystem simply by virtue of nothing being written to it, or is there some more active protection for when a new UF2 is installed?
I'm not sure if there is a better board.
The first build of CircuitPython for the WiFi Dev Board built successfully. But how do I get it onto the board?
adding a boad to tinyuf2 is usually easier, it doesn't care about the PSRAM configuration or the pins setup
I used the online Adafruit ESPTool. The build worked. I can access the REPL and the CIRCUITPY drive appeared.
I'll do that as well.
How can I get the LED(s) working?
This would imply/dictate a 'standard' config - so that you could identify the differences.
Both Hardware and possibly software - on the software there already is a list of modules
for each board -
When DEBUG=1, there is something wrong with the certificate verification (same errors as in the previous post):
E (13018) esp-x509-crt-bundle: PK verify failed with error FFFFBD70
E (13018) esp-x509-crt-bundle: Failed to verify certificate
E (13018) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x3000
E (13028) esp-tls: Failed to open new connection
@anecdata, when you saw the cert errors shown in your post, was DEBUG=1?
I think I have narrowed it down to some differe...
Yes, those messages only come up in the debug build (the one you sent).
This could be a completely different issue than the safe mode then.
Yes, I think so. I'm now trying to turn on the log messages without turning on the other DEBUG stuff.
@crimson ferry I am getting fried. WIll give up for the evening. I was just trying to see if the cert errors disappeared completely in the regular build (but still turning on the logging). This is mysterious but not necessarily related. On the other hand, if it's a use-after-free or something, it could manifest in different ways.
OK, I'm out until late next week, I can pick it up again then.
i am not sure we will hold up 8.0.0-rc.x and the final release to get this fixed, since it's hard to reproduce
though you seem to hit it reliably
right, and doesn't seem to be affecting anyone else
THere is also https://github.com/adafruit/circuitpython/issues/7405 and https://github.com/adafruit/circuitpython/issues/6791 but they are S3
thanks for all the testing, and hope your trip goes well
thank you too, I hope to be underwater for much of the trip 🙂
🤿 (rec)
that's what I hoped, as opposed to submarine duty
Please note library releases shouldn't be made until https://github.com/adafruit/adabot/pull/332 is merged and the patch run, as all releases done beforehand won't attach release assets to the GitHub Release.
CircuitPython version
CP800b6 daily
Adafruit CircuitPython 8.0.0-beta.6-43-g1c1cf1cf5 on 2023-01-18; Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w
Code/REPL
negative number of bytes to read: -115
Behavior
use: CP800b6 latest ( from 14. and 18. ) ( with bundle /lib/ from 15. and 17. )
on a PICO_W ( nuked )
to connect to a local broker ( RPI mosquitto) OK
BUT
to a remote broker TLS ( HIVEMQ ) ERROR
always get error at subscri...
Libraries are all patched, with a few ones that need work tagged with issues I'll get to this weekend (I don't believe any are in the Bundle). It's late so I won't tag, but if you see this thanks Dan for the quick review so I could do this on the off hours!
And with that, the libraries have moved away from deprecating actions!
Could someone check if espefuse.py in the esptool idf component is working for them?
ESP-NOW is a proprietary wireless communication protocol which supports direct communication between espressif devices.
This would be of particular interest for low-power wireless communication requirements.
This PR is based on the previous work by @nickzoic, @shawwwn, @glenn20 and contributions from @zoland, including:
@MicroDev1 Thank you for taking this on! We certainly have gotten a lot of call for it.
I realize this is a draft, and you know there are things left to do, so many of my comments are more just to make a TODO list that can be checked off.
Targeting this for 9.0.0 might make sense, since then we can use ESP-IDF v5.0 from the start. I will set it to that milestone for now.
We have ringbuf_num_empty() and ringbuf_num_filled() already. These compute free and available differently, but do you need them? Did they come from someone else upstream?
This and ringbuf_write() are very similar to ringbuf_get_n() and ringbuf_put_n(), with some additional return values. Did they come from upstream or did you add them?
I'd rather they take uint8_t* instead of void *. Do the casting on the calling side; that ensures the user knows what they take.
These could wrap the get and put routines, and could be get_all and put_all or something like that.
This is generally useful and could move to some py/obj*.h file.
Convert to inline doc.
I wonder if it's the
tioconnection delay.
I'm using tio too so I don't think its that.
@tulip sleet is https://github.com/adafruit/nvm.toml/pull/12 on your radar?
I missed that! will review
np
I thought I'd do usb host next but then immediately started updating my watch code
and then thought about the 7 color epaper because its also 4 bits a pixel
plus I've been thinking about eink a bunch
The Pimoroni Inky Impression? Or is there something else?
@idle owl yeah, it’d include that. I have a version from waveshare with the same display
It looks amazing. Would the intention be to hack it onto a micro? Or use it with Blinka on a Pi?
What does the WaveShare one look like?
I’m making the circuitpython low level stuff work for it like our other eink
Ah
This is what I have https://www.waveshare.com/product/displays/e-paper/epaper-1/5.65inch-e-paper-module-f.htm
5.65inch Colorful E-Paper E-Ink Display Module, 600×448 Pixels, ACeP 7-Color
You can find it on Amazon too
Ya, I’m excited to see how it looks. They are slow to update though (like 30 seconds a refresh)
Oh that's exciting! I (had as of this weekend thanks to a couple of dumb accidents) a couple of waveshare 7.5in screens in just the standard single black color, but I've been eyeing the color ones for a few years
I think I have an old 7 inch one too but the protocol is weird. I’m curious about the 7 inch color one too
They apparently have a v3 of that screen now so it's possible the protocol has improved.
@rugged spindle Hello! Do you go by the same user ID on GitHub as you do here?
I do indeed
Congratulations! 🎉 You submitted the 400th CircuitPython library to our collection!
That's a combination of Adafruit libs and Community libs. 🙂
Whoa. And by accident!
Couldn't have planned it, for sure. 😄
Do you mind if I DM you?
That's fine
I was playing with HID lately and I was wondering if it is possible to create a dual gamepad or dual mouse-like device. Looking at some custom HID devices it seems that it is possible to create a HID device with 2 gamepads every one with and report and report_id, but I was not able to use the .send_report() including an report_id
short answer, yes, the Mouse or ``Keyboard` device knows its report id. I am about to eat but will get back to you
did you have trouble specifying a report id here? https://docs.circuitpython.org/en/latest/shared-bindings/usb_hid/index.html#usb_hid.Device.send_report
Quick question. I noticed one thing Anne mentioned for CP2023 was a native gif player. Would this be useful? May be something I could work on. Though putting some thought into how this fits into displayio
man I'm looking into a question on watchdog in the support forum, and it's... tricky to use on RP2040: because it's a hardware watchdog that can't be deinited limited to 8s max, a simple autoreload might trigger it if the timer is shorter than the time it takes your code to reload and get back to the point where it sets and feeds the watchdog...
That actually led to drive corruption within minutes of me testing different parameters to it.
Maybe the flash write routines in particular should pet the watchdog, or maybe the watchdog should (on any system) only be available unless CIRCUITPY is fully read only
I can't get any of the 3 LEDs on the Flipper Zero WiFi Dev Board to turn on as the status LED.
that's an interesting idea, the core could feed the microcontroller.watchdog during USB writes, and maybe during autoreload or something ? The watchdog must not be fed if the code exits, because that's kind of the point (one use is to reset the board when it dies of an unexpected exception) but auto-reload could be a special case (with maybe an option to opt out)
and watchdog.deinit() could be simulated on RP2040 by increasing the delay to the max and feeding it in the core ticks ?
What do I need to do in order to add them?
what kind of leds are they ?
if it's a single monochrome LED, you do it like that:
https://github.com/adafruit/circuitpython/blob/9c066825a7c2127f69da90e80de5eb94e2d92a00/ports/raspberrypi/boards/raspberry_pi_pico/mpconfigboard.h#L4
if you have a neopixel you do it like that:
https://github.com/adafruit/circuitpython/blob/9c066825a7c2127f69da90e80de5eb94e2d92a00/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.h#L4
if you have a PWM RGB LED, you do it like that (this one is inverted)
https://github.com/adafruit/circuitpython/blob/9c066825a7c2127f69da90e80de5eb94e2d92a00/ports/raspberrypi/boards/pimoroni_tiny2040/mpconfigboard.h#L4-L7
CircuitPython 8.0.0-beta.6
Board - Adafruit Feather ESP32s2
Error message:
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
NLR jump failed. Likely memory corruption.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
Code:
import board
import displayio
import vectorio
import terminalio
from adafruit_simplemath import map_range
from adafruit_display_text import bitmap_l...
I think it is PWM because there are three LEDs. Blue is connected to GPIO4, Green is connected to GPIO5, and Red is connected to GPIO6.
well you would follow that example then
Thanks, it worked. Now I need to add the rest of the pins, USB VID and PID, and make a pull request.
Yes, I had a problem there but I think it was my bad, I was trying to use two gamepads on one rp2040 but it seems that using a custom HID descriptor is not recognized easy on win10, in the device manager it appears as a unrecognized hid device. And trying to use different report_id on the send_report function showed me an error of invalid report_id. The problem was the find_device function that looks for a device with a usage_page and usage, but in this case my gamepad1 and gamepad2 was getting the same device, so I bypassed the find_device and assigned the usb_hid. devices directly, like usb_hid. devices[0] and [1] that way it works nice now. The find_device function should have and optional variable of report_ids if someone wants a duplicate HID device on a single micro
sorry forgot to add the reply, the answer is up. thanks for your help 😀
Adds support for the ULP Finite State Machine present on ESP32, ESP32-S2 and ESP32-S3.
import alarm
import espulp
ulp = espulp.ULP(arch=espulp.ULPArch.FSM)
# ulp = espulp.ULP(arch=espulp.ULPArch.RISCV)
print(ulp.arch)
with open("ulp_main.bin", "rb") as f:
ulp.run(f.read())
ulp_alarm = espulp.ULPAlarm(ulp=ulp)
alarm.exit_and_deep_sleep_until_alarms(ulp_alarm)
Thanks for making the requested changes.
Awesome! Thanks for working on this @matemaciek!
I tried this out successfully, but do have a suggestion about possibly changing the types of the arguments used for the points. Let me know your thoughts on switching that to a list or a tuple (or perhaps a list of tuples) instead of using the bytes buffer types.
xs and ys are typed as ReadableBuffer here, but the same arguments are marked as int in the list of params a few lines below here.
I was able to test this successfully on a PicoW with EYESPI connected ST7789 display using code like this:
xs = bytes([4, 101, 101, 19])
ys = bytes([4, 19, 121, 101])
bitmaptools.draw_polygon(color_bitmap, xs, ys, 3)
I think it would be best if the arguments xs and ys could be a list or tuple instead of needing to be specifically the...
int in :params list is a mistake, I forgot to change it there.
I think it would be best to allow both List[int] and ReadableBuffer as argument, as first is easy to use, and second allows for optimisations such as using not only bytes but also array of shorts for less memory usage, or even memoryview over such to avoid data copying. I'll try to make it accept both versions (-:
Folks, apologies if this isn't the right place to ask, I hope it is.
what could possibly happen if it isn't
Ah dang, too much slack, keep hitting wrong keys...
I have a Seeed XIAO nRF52840 Sense, but I can't seem to figure out how to use the on board IMU, their examples are arduino ones, and looking into them I can see that they are using I2C to talk to the IMU, and if I look here in the CP source https://github.com/adafruit/circuitpython/tree/main/ports/nrf/boards/Seeed_XIAO_nRF52840_Sensee
I can see this in pins.c
`{ MP_ROM_QSTR(MP_QSTR_IMU_PWR), MP_ROM_PTR(&pin_P1_08) },
{ MP_ROM_QSTR(MP_QSTR_IMU_SCL), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_IMU_SDA), MP_ROM_PTR(&pin_P0_07) },
{ MP_ROM_QSTR(MP_QSTR_IMU_INT1), MP_ROM_PTR(&pin_P0_11) },`
But there's nothing in the mpconfigboard files... looking at their datasheet here:
https://view.officeapps.live.com/op/view.aspx?src=https%3A%2F%2Ffiles.seeedstudio.com%2Fwiki%2FXIAO-BLE%2FXIAO-nRF52840-Senese-pinout_sheet.xlsx&wdOrigin=BROWSELINK
They seem to say that the SDA/SCL are on D16/17 (but also reference pin07/27) but if I try to use board.D16/D17 in CP it just says they aren't defined.... Am I missing something? Is there any way to reference these pins without recompiling the source and editing?? (Alas I'm not super familiar with C++ or compiling CP myself)
Is it just a matter of copying the other files pointers to the pins into the mpconfigboard file like the others?
Ah some folks kick off if you post in the wrong place, but sometimes it's not super clear, so I like to ask.
you have the names of those pins right there in what you pasted, you can refer to them as board.IMU_PWR, board.IMU_SCL, board.IMU_SDA and board.IMU_INT1
you have to create your i2c bus yourself with busio.I2C
Ah cool, thanks, sorry, I didn't know how to reference them like that.
the qstr thing looks a bit weird if you are not used to it
it's how constant strings are defined in micropyton and circuitpython
also, no need to apologize
the worst case, we would have told you you would get better answers somewhere else
Appreciate it, @stuck elbow thanks for your help... I'm clearly still missing something as the I2C seems to create ok:
from adafruit_lsm6ds.lsm6ds33 import LSM6DS33
i2c = busio.I2C(board.IMU_SCL, board.IMU_SDA)
sensor = LSM6DS33(i2c)
But still getting No pull up found on SDA or SCL; check your wiring ... this seems to work with no wires from arduino without additional wiring so maybe I am wrong.
https://github.com/Seeed-Studio/Seeed_Arduino_LSM6DS3/blob/master/examples/HighLevelExample/HighLevelExample.ino they don't do much special here (that I can spot)
https://github.com/Seeed-Studio/Seeed_Arduino_LSM6DS3/blob/master/LSM6DS3.cpp they do mention a cs pin(10) here, but I've only ever used cs pins with SPI stuff, never I2C, so I don't know if that's relevant
There's a power pin you need to pull:
import board
import busio
import time
from digitalio import DigitalInOut
from adafruit_lsm6ds.lsm6ds3 import LSM6DS3
power = DigitalInOut(board.IMU_PWR)
power.switch_to_output(True)
i2c = busio.I2C(board.IMU_SCL, board.IMU_SDA)
sensor = LSM6DS3(i2c, address=0x6A)
while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f radians/s" % (sensor.gyro))
time.sleep(1)
(that does work on my board btw)
ah cool, I found this on page 3 of google behind a pile of dusty books. I've never heard of circup before. Thanks @jaunty juniper I would always much rather do things like that myself so I have a bit more sight of whats going on, I'll be using your solution for my project. Thanks again to both of you, would not have figured that one out for a long time!
https://pypi.org/project/circuitpython-seeed-xiao-nrf52840/1.0.0/
oh it's in the community bundle, nice !
those libraries are useful resources to look into to understand some of the inner workings
Yeah, I checked the adafruit bundle but not the community one.
and yeah circup is very useful
Everyday's a school day! ... all this effort for the stupidest project ever.... putting a microcontroller into a zippo lighter case 😂
Signing off here, thanks again @jaunty juniper and @stuck elbow

Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Board ID:adafruit_feather_esp32s3_4mbflash_2mbpsram
UID:4F21AFA5124C
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
I'm using an external 1.14" display with the ESP32S3 detailed here - ht...
@darianbjohnson you can disable things by setting 0 to some variables inside of mpconfigboard.mk.
You can see an example that disables some things here: https://github.com/adafruit/circuitpython/blob/9c066825a7c2127f69da90e80de5eb94e2d92a00/ports/atmel-samd/boards/matrixportal_m4/mpconfigboard.mk#L15-L19
@Breazile that may be a different issue I think. Your device is ESP32S3 and seems to only use 1 display. But this issue is for an S2 device and using two displays.
It may be best to create a seperate issue for yours instead of posting here.
The Broadcom chips apparently don't have an RTC, so this PR uses the timer to add dummy RTC responses and allow resonable results from time.localtime() as well as setting the time and date while the board is powered. I believe this fixes #5790
I'm having issues with my Cytron Maker PI RP2040 timing issues https://github.com/CytronTechnologies/MAKER-PI-RP2040/issues/5
SO I wanted to use a Adafruit Feather Express M0 as an I2C slave for my HC-SR04 (sonar) unit [robot project]
^
I found this PR https://github.com/adafruit/circuitpython/pull/1064 but that was for version 4 - afaict.
I don't see anything in the 'docs' weblink - just the standard busio.I2C api.
^
Bitbangio was mentioned as a possible alternative - whi...
You are looking for the i2ctarget module (or i2cperipheral in CP7).
https://docs.circuitpython.org/en/latest/shared-bindings/i2ctarget/index.html
It is however not available on any M0 build currently, you would have to build it manually by adding CIRCUITPY_I2CTARGET = 1 in mpconfigboard.mk but it's not gonna fit on the trinket unless you disable other modules. It should fit in an express board though.
However, your original issue seems to be a timing problem on RP2040, have you...
I tried your original test program on both a Cyrton Maker PI RP2040 and a Raspberry Pi Pico with version 7.3.3 of Circuitpython and didn't see your timing issue. What version of Circuit Python are you running?
Adafruit CircuitPython 7.3.3 on 2022-08-29; Cytron Maker Pi RP2040 with rp2040
>>> import time
>>> for x in range(6):
... print(x)
... timestamp2 = time.monotonic_ns()
... timestamp = time.monotonic()
... time.sleep(.25)
... timestamp1 = time.monotonic...
Thank you both:
@RetiredWizard
on the Cytron it was 7.3.3
BUT
I ran it from code.py not the REPL window - with the Serial monitor on
@Neradoc
thanks for the link - will follow up on that
Strange, I still get good time output:
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 7.3.3 on 2022-08-29; Cytron Maker Pi RP2040 with rp2040
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disab le.
code.py output:
0
0.25
250000000
1
0.25
250000000
2
0.25
250000000
3
0.250977
250000000
4
0.250977
250000000
5
0....
Thank you - I had considered Mu / Win10 an issue , but the Feather is good !!
I have the I2Cresponder/target information ,
will consider this closed - the Cytron issue already has a 'Issue' filed
@MicroDev1 Thanks also for taking this on. I confess I couldn't work out where to get started porting this to circuitpython. If there is anything I can do to help, let me know.
@dhalbert Yes they came from me upstream as the equivalent in micropython did not have these. For circuitpython it would make sense to update ESPNow.c to use the existing functions.
Current project ongoing, also requires multicores.
I want to listen to CAN (Adafruit MCP2515 lib), for instructions for LED settings.
While also reading analog, and digital inputs and send those over can.
Obviously the adafruit libs are very handy, but the no access to both cores makes it "not very usefull"
CircuitPython version
NA
Code/REPL
$ ports/espressif/esp-idf/components/esptool_py/esptool/espefuse.py
Behavior
imports fail due to referencing a class alias that was removed in bitstring library 4.0. The version needs to be forced to 3.1.9 in the build environment.
Description
No response
Additional information
No response
Should probably be addressed upstream but the building document should mention it at least in the meantime.
@stuck elbow I'm curious if you're open to the idea of factoring the Buttons helper inside ugame (i.e. https://github.com/python-ugame/circuitpython-stage/blob/4124dfbdaadce1966f457d7d6c6984e9832999bf/pybadge/ugame.py#L49) into it's own file so that it could be imported independently of the display functionality.
I think at some point in the past it was possible to use that button helper with displayio, but it isn't any longer, when you import it the display gets taken for use by stage. If this helper where in it's own file like ugame_buttons.py it would be possible to import it separately from stage.
Id be willing to work on splitting it out and make a PR if you're open to that change.
There is a number of gaming devices available that run CircuitPython, and so when a new game is made, it is desirable to make it run on all of them, or at least as many as possible. However, each d...
@lone axle @turbid radish says the newsletter is ready for you to grab a preview
in short, I think there should be a library independent from stage/ugame for that, possibly also with sprite loading helpers and so on
Interesting conversation , thank you I hadn't seen that. The idea of working it into board somehow does seem like a nice solution
I'll brainstorm a bit and see if there is some way to set it up there within my cababilities.
as tannewt observed, a lot of this could be guessed from the pin naming
so maybe we don't even need separate files per board, just a couple of naming conventions to try
aliases inside of board to make pins like board.GAME_BTN_A, board.GAME_BTN_UP etc... that have correct definitions for each board would go a long way. That could cover all of the cases except the joystick ones (assuming pins are connected directly and not through some expander), which definitely does get more complicated.
even just a standard to follow for new boards would be swell
Is it possible to have "blanks" inside of a keypad.Keys object? it assigns a number for each key which is then checked later on to figure out which one has been pressed. Is there a way that it could skip say indexes 0-3, they won't associate with real pins and will never actually register presses but they will still "consume" those numbers of 0-3?
no
but the library could provide named constants for the numbers
so it doesn't matter what the numbers actually are
I was thinking along the lines of the mentioned board.KEYS() that could return an initialized keypad object. One issue with that that is mentioned is different devices have different number of buttons. But if there could be blanks maybe that could help equalize it across devices with different buttons. So that at least the consistent ones can work the same across all.
to be honest, we just need a game framework