#circuitpython-dev
1 messages · Page 66 of 1
ok, mine was without connection... wow that's a lot
I guess the wifi module is pretty big imported
I'll try w/o wifi
it's not the importing per se, it's a native module, it's the setup it does to reserve RAM for its purposes.
138K free w.o wifi !!
Adafruit CircuitPython 9.1.0-beta.0 on 2024-03-28; Raspberry Pi Pico W with rp2040
>>> import gc
>>> gc.mem_free()
126160
>>> import wifi
>>> gc.mem_free()
125808
>>> import os
>>> gc.mem_free()
125504
>>> wifi.radio.connect(os.getenv("WIFI_SSID"), os.getenv("WIFI_PASSWORD"))
>>> gc.mem_free()
124624
``` # corrected
hmm now I am getting 138K free even with wifi....
is that with thw two modules removed? I have to correct my output above, I had a repl.py active
Yes -- with PICODVI and USB_HOST removed
From the build -- removing them reduces the RAM usage by about 14K
so maybe there's 2K of other 8-->9 diffs
a basic wifi_test works OK but I cannot connect to AIO to access a feed -- even without the modules.
Sounds good. I have time this week
Is there any technical reason the ESP32SPI can't connect to a ntp server?
shouldn't be... it can be a UDP client
The situation about what constitutes an end of line for input is complicated. CircuitPython is reading characters either from a host computer or a UART port. Unlike CPython ("regular" Python) which knows what it's running on, we cannot know which kind of host computer (Windows, Linux, macOS, etc.) we are receiving input from. Or, we might be receiving input from a UART, or a raw keyboard.
We inherited the input() behavior from MicroPython. So I believe the current behavior is deliberate:...
I have connected to a ntp server using ESP32SPI
tthere's an old version of the adafruit_circuitpython_ntp library that works with esp32spi
https://github.com/adafruit/Adafruit_CircuitPython_NTP/releases/tag/2.2.6 any v2 should work; v3 was the switch to native
The old one used a built in method
I guess I was actually using adafruit_esp32spi.ESP_SPIcontrol.get_time()
I was looking to see if I could get it to work for both native and esp32spi. I can cheat and use:
self._pool._interface.get_time()
But can't tell why the normal code doesn't work
If fails at connect
@short tendon something like this, but with the NTP specifics? https://github.com/anecdata/Socket/blob/main/examples/udp_client_CircuitPython_ESP32SPI.py link corrected
wifi.connect, or socket.connect (a misnomer due to the non-standard NINA implementation)?
I can try playing with that again to make sure nothing broke
oh, here's one ready to go: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/main/examples/esp32spi_udp_client.py
just tested it on PyPortal
Well cool. Why is the connection different in the official ntp library...
wifi or socket connect? are you meaning v2 of NTP lib?
No v3 of the ntp lib
ESP32SPI / NINA doesn't comply with that API
I tried mapping NINA/Arduino to standard socket calls once upon a time, but it was... not clean
oh lol I forgot I wrote that
Hahaha
I don't know how people who do real development all day remember all. the. things.
Where do most people get examples? GitHub or from the bundle?
(I really don't know ...I tend to look for learn guide or github examples)
Oh that's easy. I've been at the sample place for 6 years. I remember everything
I have this idea - for Internet libraries, templating the examples. And so:
code
code
{{ connection_method }}
code
code
Makes multiple examples replacing the {{ connection_method }} for each supported method...
we could even add dummy connect into WIZnet ...but maybe that's just too painful
(then all three could be the same)
I actually wish it had it. I find it frustrating that I can't create the object if it's not plugged in
I have 😉
it might break user expectations, where plugging in is magical
If it were me, I would add a param to creation like require_link=True and so if you didn't want to require it, you could set that to false. And then connect would do that if not already done...
that makes sense... conceptually it should be straightforware to split that stuff out into a connect function, and call it from either init or userland
Yup
I was able to get the code done today, but found out my trial expired. So I need to re-setup everything. I should still have it up tomorrow(ish)
Images automagically compressed by Calibre's image-actions ✨
Compression reduced images by 47.8%, saving 1.01 MB.
| Filename | Before | After | Improvement |
|---|---|---|---|
| assets/images/boards/large/adafruit_feather_esp32c6_4mbflash_nopsram.jpg | 297.22 KB | 157.17 KB | -47.1% |
| assets/images/boards/large/makergo-esp32c3-supermini.jpg | 83.59 KB | 62.89 KB | -24.8% |
| assets/... |
Thanks for your reply. The problem I had today was solved by using stdin.read(1) and managing my buffer to deal with newline. It works well for my job and I'm done with it at least for now.
More thought about this. If I use a serial monitor or my own code, as long as I can fully control the data, it can be fine to just send \r. However, here is a case that is worth some improvement for other users:
I have a code similar to this:
while True:
if time.monotonic() - previousLight...
We'll think about this, thanks. I'm not sure it can be perfect, in case the \n is delayed. But if it's there, we could discard it.
For your own purposes, sending data, as I mentioned, there is a secondary CDC channel which you can enable which transmitsand receives bytes, and has no extra printing or REPL handling. See https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/circuitpy-midi-serial#usb-serial-console-repl-and-data-3096590
@crimson ferry thank you! I have merged the 2 NTP methods and will be opening up a PR tomorrow. 1 more library that doesn't care!
I have quite a few of these devices and some are running continuously and I never had any problems. So I assume this is an issue of the specific device.
What I did notice is that time_to_refresh never reaches zero but is stuck at 0.1. But maybe this is a misunderstanding of what this attribute does.
#8776 also seeks BLE support for plain ESP32.
Duplicate of #7170. Thanks @vladak!
What I did notice is that
time_to_refreshnever reaches zero but is stuck at 0.1. But maybe this is a misunderstanding of what this attribute does.
This may be a bug due to the rounding we added to prevent it from being too low.
It isn't clear that this problem is CircuitPython related at all. If you purchased Adafruit hardware then please post to the support forum: https://forums.adafruit.com/viewforum.php?f=60 Otherwise, ask the manufacturer of your hardware.
@tannewt Do you think we should just turn off picodvi and usb_host on the Pico W? Or make a separate build?
I think we should leave the Pico W build as-is. Turning off picodvi and usb_host prevents anyone from using them. The build as-is has soft memory limits to what it can do but that will always be true. In the long term we can make more of this memory use dynamic (probably not the ram functions) so that one can turn off features (like USB MIDI) to save ram.
With these changes I can successfully play a 48kBit/s, 22.5kHz, mono test file on the Adafruit Feather ESP32-S3 TFT using a max98357 breakout, which takes less than 10% of available CPU times. I have not tried higher bit rates, stereo playback etc., so I don't know the performance limits.
There are occasional audio glitches, which mostly correlate with the charging LED. I think this is a HW problem but it's difficult to be sure.
This also fixes the problem that all I2S output was in a...
@danh FYI -- I am able to get the picow with the PICODVI and USBHOST removed to connect to AIO by switching to the .mpy versions of all the libraries. I've even sent my first images from the camera... progress
@psitem I wired this up with a QT Py ESP32-S3 4/2 and all the same I2C devices that you have here. I am not pushing any buttons. You said "Eventually the board reboots into safe mode.". How long is eventually, and do I need to provoke it by pushing various assigned buttons.
@tulip sleet on 9210 espressif: add user-specified socket connect() timeout, did it work for you on an S2?
OOPS, I forgot about that. I'll test and fix if needed.
One question about what boards to enable on. Good otherwise.
Why S3 only? I'd probably only enable it on boards with more than 4mb flash. There others are tight on space and this is a new feature.
I only tested on S3. Do you want me to test on other boards, or just enable widely?
Discovered by @justmobilize, socket.connect() timeout is not working on ESP32-S2. This was discovered during testing of #9210, but the problem actually extends back to 9.0.4 or earlier. In 8.2.10, there is a 20-second timeout (it might be 10 * 2).
The failures occur much more quickly on ESP32-S2 on 9.x. Using this test program:
default success: 0.601997
default fail: 0.00299835
ti...
So... the timeout problem you found with ESP32-S2 is actually present in 9.0.4. It is not present in 8.x.x.
I opened the issue above ☝️
Awesome. Glad to know I'm not crazy
@tulip sleet I really want to dig into this Nina + Google SSL thing. Working sometimes and not others. Is there a way to know what cert it's validating against?
you can just put the base url into a browser and look at the cert chain. It's a little easier to read in Firefox than Chrome. Click on the lock icon
I think part of the issue is I'm getting different ones from different servers
And so wanted to compare that against when code works
but I think it is a memory problem or something on NINA-FW. I need to do some testing on https://github.com/adafruit/nina-fw/pull/62
@tulip sleet do you think anyone is relying on the storage extend stuff? I'm tempted to rip it out. (I just had a warning when I switched to one ota partition on c6)
it defaults to extended, is that right? I don't know, the author probably is. non-extended people would be using OTA
it makes it way harder to protect where the user filesystem is
reading...
https://github.com/adafruit/tinyuf2/issues/227 is also related
i think you just need to disable dualbank and the warning should go away. Are you saying that we shouldn't bother to extend CIRCUITPY into the OTA partition, or are you saying we shouldn't bother to have OTA?
I'm going to remove ota1 in favor of extending ota0 for more cp code on c6 and h2 (and probably c3)
that has the nice property of leaving user flash as-is
Is this ready in theory? I can also test
it's ready to test, it does have some issues
this makes sense, but then you don't need to remove extend, it should just work if the compile options are set up right. Maybe the makefile option setting/testing needs a little interking
Okay, I'll play with it and see what happens
Ya, it does but it'll mess up the fs for folks who inadvertently used it
the default is it's on, and it remembers the current state. It will only mess things up if people use the second arg in erase_filesystem()
and I have never heard of anyone doing that
extend is default on though right?
right
@tulip sleet will the debug version give me any more detail by default?
i don't remember!
Fair. I'll try it and see
The "my spi flash isn't all just CIRCUITPY" isn't a problem we can solve
this is the situation as I understand it:
- on boards with two OTA partitions, dualbank is compiled in, but the second OTA partition is by default made part of CIRCUITPY. In that state,
dualbankraises an error that you can't do OTA. It will only become an OTA partition if you callstorage.erase_filesystem(extended=True) - So OTA support is latent, but it's there, for anyone who wants to use it, and the user gets a nice large CIRCUITPY.
- If we turned that off, then CIRCUITPY would be noticeably smaller, and some people would complain.
- If we just ditched OTA, then the few people who need OTA would complain and give up on us.
- For 4MB or smaller boards, makes sense to say "no OTA for you!". For larger boards, a few but non-zero number of people may want OTA. If the number of people who want OTA is < 10 on earth, well maybe it's not worth it.
I think OTA for 8MB + makes sense
but it doesn't make sense to limit features for 4mb boards
right, I agree for that, and so dualbank and extend should be disabled on 4MB boards, and enabled on >= 8MB boards
that'll break anyone using extended storage already though
so I'll probably only do C6 and H2
using extended storage on which boards?
almost everyone is using extended storage now on boards that support it
right, which is why I won't do C3
ok, so we might drop the OTA partition on 10.0, on those 4MB or smaller boards
for C3 yes
and probably S3
if it weren't for this extended storage, we could drop it without disrupting the user fs
yes, i agree with that. we have already done partition size changes, and people lived with that through alphas and betas. We just warned them.
I don't understand that - which boards do you mean?
I'm looking to change the partition layout for the C6
but I'll leave the "user fs" one as-is
do you mean like an 8MB board is like (made up numbers) 2MB OTA0, 2MB OTA1, 4 MB non-extended CIRCUITPY, but 4+2MB extended CIRCUITPY
right so I'm removing OTA1 and replacing it with a 4mb OTA0
so on C6, we haven't shipped anything yet, so it can just be OTA0 + CIRCUITPY, and extended is not functional
i don't think we are disagreeing.
I'm lamenting the extended storage making things complicated
boards/adafruit_feather_esp32c6_4mbflash_nopsram/mpconfigboard.h
boards/espressif_esp32c6_devkitc_1_n8/mpconfigboard.h
boards/espressif_esp32c6_devkitm_1_n4/mpconfigboard.h
boards/unexpectedmaker_tinyc6/mpconfigboard.h
boards/weact_esp32c6_n4/mpconfigboard.h
boards/weact_esp32c6_n8/mpconfigboard.h
^^ these are the C6 boards:
i think the mistake was making OTA partitions for these small boards in the first place.
so you are just correcting that. I don't mind telling people, watch out, your CIRCUITPY is going to be smashed
but we need to update tinyuf2 for all these also
ota0 + ota1 may be bigger than 8mb ota0
no tinyuf2 because they don't have native usb
so it's up to us
OH, yes, sorry
I am fine with "hey, in 9.1, these boards will have smashed CIRCUITPY, watch out"
ota0 is 2048k for 8mb
so it's not ripping out extended, it's just setting the compile options right, and fixing a non-far-sighted partitioning decision
ota0 for 4m is 2816m without ota
on like S3?
Side question, I hadn't seen this extended storage before. Will I get more space if I set that to true? Or is it configured on the board by default?
it defaults to true on boards with two OTA partitions (that is one partition for firmware and one for OTA)
so you are already getting it
partition layout is agnostic to the chip. only* depends on flash size
gotta run now though
OK, the current build should enable it on anything with 4MB+
I could not come up with a better patch. Closing PR.
@slender iron so far 2 c6 boards failing for lack of space; maybe once I can merge or rebase onto your c6 partition fixes it'll all be OK, but of course there might also be more failures to come. fingers crossed, and will look at it tomorrow. goodnight.
@tulip sleet when you have a chance, can you please look at https://github.com/adafruit/Adafruit_CircuitPython_AzureIoT/pull/65? I want to make sure I get the requirements added correctly
For anyone who might be interested.
After a while I managed to configure the chip and listen to the sound. The clock was supplied by PWM, the target frequency was 12MHz (according to the "USB mode"), but the real frequency is between 11.834 and 11.695, which seems ok. It's not necessary to have an exact frequency, I've tried different ones and they work. Probably has some effect, but not important in non-critical applications.
I'm trying to compile the uf2 bootloader for my board, and I'm getting a weird error, anybody knows what's wrong?
/home/sheep/dev/circuitpython/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: build/pewpew_lcd/bootloader-pewpew_lcd-v3.16.0-4-gd728aa1-dirty.elf section `.text' will not fit in region `rom'
/home/sheep/dev/circuitpython/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: section .binfo LMA [0000000000001ff0,0000000000001fff] overlaps section .text LMA [0000000000000000,000000000000202b]
/home/sheep/dev/circuitpython/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: region `rom' overflowed by 0 bytes
collect2: error: ld returned 1 exit status
make: *** [Makefile:161: build/pewpew_lcd/bootloader-pewpew_lcd-v3.16.0-4-gd728aa1-dirty.bin] Error 1
looks like there's just too much code. the text section would have to fit under 0x1ff0 but it doesn't.
I can't tell for sure but it seems like uf2-samdx1 is still using travis-ci !? and if so it's using gcc 9 still https://github.com/adafruit/uf2-samdx1/blob/master/.travis.yml#L18
yeah, but is says it's overflowed by 0 bytes?
I don't know why it says 0 bytes. I'm looking at these lines:
section .binfo LMA [0000000000001ff0,0000000000001fff] overlaps section .text LMA [0000000000000000,000000000000202b]
maybe the linker script declares a rom region that’s all of the rom? text is still too big, and overlaps bininfo
can you compile other existing boards?
yeah, it looks like it doesn't like the HAS_CONFIG flag
I don't see any samd21 using it, so it's probably too small
@tulip sleet do you know if it's really still using travis ci? should it be updated to use GA?
travis doesn't run, as far as I know. When I make a new release I build the assets and upload them by hand. It would be nice to update it. Upstream doesn't have CI either.
should just remove the .travis.yml
@tulip sleet for https://github.com/adafruit/nina-fw/pull/62, is it possible to retrigger a build? The artifacts have been deleted...
I pushed an empty commit to re-run. It appears that once the artifacts and logs have expired, there's no way to re-run.
Hi all, I'm learning to develop new modules and I'm wondering is the source to guides like https://learn.adafruit.com/building-circuitpython and https://learn.adafruit.com/extending-circuitpython in a repo somewhere? So far I've looked in circuitpython, Adafruit_Learning_System_Guides, and circuitpython-org. Thanks!
The source isn't on github unfortunately. Learn has its own database
We can merge your changes and I can enable it with the partition table updates.
I'm thinking I may change the default partition table for everything and override it for existing boards
mmm, I was thinking that might be the case. Cut and paste it is! Nice meeting you yesterday BTW
you too!
The extending circuitpython is out of date in a number of ways
the overall idea is fine but there are many changed details
Yes, thanks! Right now I'm looking at the code for analogbufio and audiopwmio for the real truth. I just wanted to be aware of what documentation exists and where it lives.
CircuitPython version
Installed in venv:
circuitpython-stubs==9.0.3
mypy==1.10.0
mypy-extensions==1.0.0
nodeenv==1.8.0
pyright==1.1.361
setuptools==69.5.1
typing_extensions==4.11.0
Code/REPL
n/a
Behavior
n/a
Description
My editor is configured to use pyright lsp and mypy for type checking. I'm working in a virtualenv with mypy, pyright, and micropython-stubs installed. I'm currently having the following issues:
pyright...
@eightycc Do you have a repo somewhere with your code? Your clone of CircuitPython on Github does not seem to contain your work on _bleio. Maybe you could add a branch to your repo?! Making your efforts public will enable others to help.
I found a solution. Use Micropython and load in https://github.com/adafruit/Adafruit_Blinka to get the Circuitpython nice stuff. For BLE stuff use Micropython BLE code.
This helped me: https://www.youtube.com/watch?v=l254lxm78I4
The build as-is has soft memory limits to what it can do but that will always be true.
It's just unfortunate that adding features makes existing projects stop working, and Pico W is more affected than other RP2040 boards because so much memory is reserved for WiFi. I wonder how much Bluetooth will need. If you do later add the ability to reclaim some dynamically, that will surely help.
After the first time it happened, it was about 2 days before the next occurrence. Subsequent occurrences were sooner and some were with no interaction with the buttons.
I've had this set aside for a bit but I've now updated to 9.0.4 and the 20240503 library bundle and will leave it running.
Although @tannewt is correct that removing picodvi and usb_host would prevent (most) users from using it, this does not imply that we cannot have a second build that has more available memory.
My personal guess is that more users are hit by the memory limits than would be hit by removing picodvi/usb_host, but having two builds with a choice for users would certainly be a valid option.
@bablokb re https://github.com/adafruit/circuitpython/issues/9085#issuecomment-2078702631, so when you did turn them off, are you able to do all the things you did in 8.x.x?
im trying to test my changes to the setboard command, however im pretty sure i need to go through setup.py for this "resource" thingy to work...
running pip install git+https://github.com/elpekenin/circuitpython@feat/stub/list will take a year because it will clone every single submodule
can i install/test in some other way? 😅
I don't understand why it would clone the submodules. But would pip install --dry-run help?
I think when I was working on that I would just build the stubs locally and then install with pip install -e . in the directory of the generated stubs.
I'm not sure if / how many of the submodules would have been required because it was a repo I also use for building the core so I did have all of them at the time most likely, but it didn't download them specifically for installin the stubs AFAIK.
and if you use -e then you can just build new versions of the stubs as you make changes and the venv that you installed it into will automatically see the latest built version.
it does, that's all i can say 🙃 ```
$ pip install git+https://github.com/elpekenin/circuitpython@feat/stub/list
Collecting git+https://github.com/elpekenin/circuitpython@feat/stub/list
Cloning https://github.com/elpekenin/circuitpython (to revision feat/stub/list) to /tmp/pip-req-build-fmlubuhb
Running command git clone --filter=blob:none --quiet https://github.com/elpekenin/circuitpython /tmp/pip-req-build-fmlubuhb
Running command git checkout -b feat/stub/list --track origin/feat/stub/list
Switched to a new branch 'feat/stub/list'
branch 'feat/stub/list' set up to track 'origin/feat/stub/list'.
Resolved https://github.com/elpekenin/circuitpython to commit 933efe082e80e16f44d6125cb2e8d4553a9a4f0c
Running command git submodule update --init --recursive -q
^CERROR: Operation cancelled by user
i left it run for like 5/10 mins the first time after giving up on waiting 🤣
oh, i had tried -e root/setup.py-stubs, lets see
I just encounter this issue with PWM based sound after loading alarm.
Additionally, I edited my code.py to no longer use alarm and the problem remained until I power cycled the board. Once I power cycled the board, the PWM sound worked as expected.
that worked perfectly, thx foamy!
FYI - When I removed the two modules AND switched to using .mpy version of the libraries, I am able to connect to and interact with AIO as I had desired. However, when I try to add in any use of the ov5640 camera, I quickly run into memory issues again. I may try removing even more modules to see if I can get anywhere but I don't think the picow is a viable candidate for the projects I have in mind.
@jerryneedell could you add the camera in CP 8?
If the board order on the circuitpython.org downloads page is any indication, Pico W is a very popular board. I tend to agree that memory is a high priority for network users.
@jerryneedell could you add the camera in CP 8?
If the board order on the circuitpython.org downloads page is any indication, Pico W is a very popular board. I tend to agree that memory is a high priority for network users.
I have not tried it with CP8 -- The new camera boards are specifically for the pic0/picow and I've just started working with them.
@lone axle all (or nearly all) the library conf.py files contain this:
# The short X.Y version.
version = "1.0"
# The full version, including alpha/beta/rc tags.
release = "1.0"
This causes the HTML < title > tags to contain "1.0", which shows most noticeably on search engine results for various libraries.
This is wrong. Where do you suggest I open an issue for this? in the bundle repo or in the cookie cutter repo (where this comes from), or somehwere else. I found some suggestions for gettin the version dynamically
I think either cookie-cutter or bundle repo is fine. Ultimately we'll need a bit of work in both places. a PR to cookie-cutter to correct it for new libraries, and some kind of patch run on the bundle to update the existing ones.
thanks, I'll open an issue there.
sooo many cookie-cutter patches...
@short tendon 🥳
$ circuitpython_setboard -l
Available boards are:
* 01space_lcd042_esp32c3
* 0xcb_helios
* 42keebs_frood
* 8086_commander
* ADM_B_NRF52840_1
* Seeed_XIAO_nRF52840_Sense
* TG-Watch
* adafruit_esp32s3_camera
... and the list goes on beyond infinity ...
any suggestions for another formatting (eg use - instead) and/or how to make the list friendlier than needing a > file for Ctrl+F'in that file? 🤣
You could regex on the __init__.py file. Example:
"""
Board stub for 0xCB Helios
- port: raspberrypi
- board_id: 0xcb_helios
- NVM size: 4096
- Included modules: _asyncio, _bleio, _pixelmap, adafruit_bus_device, adafruit_pixelbuf, aesio, alarm, analogbufio, analogio, array, atexit, audiobusio, audiocore, audiomixer, audiomp3, audiopwmio, binascii, bitbangio, bitmaptools, bitops, board, builtins, builtins.pow3, busdisplay, busio, busio.SPI, busio.UART, codeop, collections, countio, digitalio, displayio, epaperdisplay, errno, floppyio, fontio, fourwire, framebufferio, getpass, gifio, hashlib, i2cdisplaybus, i2ctarget, imagecapture, io, jpegio, json, keypad, keypad.KeyMatrix, keypad.Keys, keypad.ShiftRegisterKeys, locale, math, memorymap, microcontroller, msgpack, neopixel_write, nvm, onewireio, os, os.getenv, paralleldisplaybus, pulseio, pwmio, qrio, rainbowio, random, re, rgbmatrix, rotaryio, rp2pio, rtc, sdcardio, select, sharpdisplay, storage, struct, supervisor, synthio, sys, terminalio, time, touchio, traceback, ulab, usb, usb_cdc, usb_hid, usb_host, usb_midi, usb_video, vectorio, warnings, watchdog, zlib
- Frozen libraries:
"""
So you could grab what's after the Board stub for
yeah, more info is nice, BUT! the list is already terribly long, and that info could be seen by user on the stub (or docs)
digitalio stubs are provided in https://pypi.org/project/circuitpython-stubs/ along with all of the other native modules. board is a special case because its contents change depending on the board. It takes extra setup: https://learn.adafruit.com/welcome-to-circuitpython/pycharm-and-circuitpython#device-specific-board-stubs-3168661
@bablokb re #9085 (comment), so when you did turn them off, are you able to do all the things you did in 8.x.x?
No. It helps, but using wifi and displayio still uses too much memory even after simplifying what I write to the display.
That is why I tried to move the tinyusb-code back to flash. But that did not change the memory available to python-programs (see above).
I also deactivated all other stuf...
I don't think the picow is a viable candidate for the projects I have in mind.
For a number of projects I have switched to the Waveshare ESP32-S3 Pico. It has the form-factor and pinout of the Pico. I have my own "compatibility" build for that board using Pico-W pin-names and all my programs for the Pico work without change.
But although this board is cheap compared to other S3 boards, it is much more expensive than the Pico-W, so not suitable for this other project which is deployed...
The other option is that in https://github.com/adafruit/circuitpython/blob/main/tools/board_stubs/build_board_specific_stubs/board_stub_builder.py, you could also build a file that is included with the stubs that it just prints out
gotta love automod's false positives!
anyway... i already parsed the file structure, no need to write another file
try again. I removed the rule you hit
just thought that way you could make a file that was:
Available boards are:
* 0xcb_helios: 0xCB Helios
... and the list goes on beyond infinity ...
made it list by port 😉
if args.list:
port_boards = defaultdict(list)
for board in resources.files("board_definitions").iterdir():
# NOTE: For the hand-crafted finding of port and prettified name in
# the docstring, its format is assumed to be:
#
# <empty line>
# Board stub for ...
# - port: ...
# - board_id: ...
# - NVM size: ...
# - Included modules: ...
# - Frozen libraries: ...
#
lines = get_doc_or_raise(board).split("\n")
port = lines[2].split("-")[1].split(":")[1].strip()
port_boards[port].append(board)
sys.stdout.write("Available boards are: \n")
for port, boards in port_boards.items():
sys.stdout.write(
header(port)
+ " * "
+ "\n * ".join(boards)
+ "\n\n"
)
sys.exit(0)
also would be cool if you coud do --list m4 and get boards with that name...
and i thought about printing the .split("stub for ")[1] which is a prettier name, but i think it is counter productive since users will have a 50% chance of using the wrong name (real id vs friendly) 🤣
fair
you can see how my comment still has the "pettified name", oopsie
now grouped by port, and both the ports and the boards for each port are sorted ^^ ```
...
renode
- renode_cortex_m0plus
stm
- espruino_pico
- espruino_wifi
- feather_stm32f405_express
- meowbit_v121
- nucleo_f446re
- nucleo_f746zg
- nucleo_f767zi
- nucleo_h743zi_2
- openmv_h7
- pyb_nano_v2
- pyboard_v11
- sparkfun_stm32_thing_plus
- sparkfun_stm32f405_micromod
- stm32f411ce_blackpill
- stm32f411ce_blackpill_with_flash
- stm32f411ve_discovery
- stm32f412zg_discovery
- stm32f4_discovery
- stm32f746g_discovery
- swan_r5
- thunderpack_v11
- thunderpack_v12
search/filter will be later today or during weekend, leaving now. code here if anyone curious
🚀
I don't think the picow is a viable candidate for the projects I have in mind.
For a number of projects I have switched to the Waveshare ESP32-S3 Pico. It has the form-factor and pinout of the Pico. I have my own "compatibility" build for that board using Pico-W pin-names and all my programs for the Pico work without change.
But although this board is cheap compared to other S3 boards, it is much more expensive than the Pico-W, so not suitable for this other project which is...
@onyx hinge I am debugging a storage issue with ssl sockets, and have some questions about the (now shared) SSL implementation, particularly about wrap_socket. Do you have time for a text or audio or video chat? I have to be afk in about 45 minutes
@tulip sleet sorry, I was out of the house and didn't see your message. will you be back later
(I'm still 15 minutes away from home)
won't be back online until tomorrow
no problem - i can talk about it later. The essence of the q is why mbedtls is re-inited on every socket wrap, instead of just being set up once when ssl context is created.
i can fix this if it is not what you meant, don't need for you to work on it yourself
Ok, I won't be online much this weekend. We can catch up next week maybe?
sure
@tulip sleet you mean
mbedtls_ssl_init(&o->ssl);
? Yeah I was actually wondering about that myself while working on ssl-anything. It seems like some of those things that are in the ssl socket struct might belong on the ssl context struct in C.
Yes. I am going to try moving them. Might fix some other storage problems we are seeing. I was getting Memory Error on S2 but not S3 and tracked it down to this. I’m already out
OK. lmk if you want me to take it over, it looks like a problem of my making. I was confused what you meant by "storage" at first (thought you meant like CIRCUITPY drive storage) but this makes sense.
yay, that only took a couple lines of code 🤓
As per title, this PR adds support for --list/-l as argument to the command, which will print all the available stubs.
Furthermore, a filter can be used, eg: circuitpython_setboard -l feather to find a board without having to scroll that much.
As a side effect, the PR reworks hand-crafted parsing of arguments sys.argv into using argparse, and also changes both explicit and implicit return None with sys.exit of 0 or 1 to flag the command's success/failure
Example...
heading to bed, will check feedack tomorrow 😜
Enable BLE where we can. Switch 4MB, non-USB board default partitioning over to a single 2MB firmware bank. Old boards override this setting to keep the same behavior.
This also adds alpha support for the ESP32-C2 (aka ESP8684).
Fixes #5926 and #7170
Seems to work on S3. Connecting hangs on C6. C2 runs out of memory with wifi on. C3 is untested. ESP32 crashes with watchdog timeout.
CircuitPython version
Adafruit CircuitPython 9.0.4 on 2024-04-16; Raspberry Pi Pico with rp2040
Board ID:raspberry_pi_pico
Code/REPL
# Raspberry Pi Pico
import board,busio
from time import sleep
from adafruit_st7735r import ST7735R
import displayio
import terminalio
from adafruit_display_text import label
mosi_pin = board.GP11
clk_pin = board.GP10
reset_pin = board.GP17
cs_pin = board.GP18
dc_pin = board.GP16
displayio.release_displays()
...
You mispelled root_group when you're assigning the main group (you have root_groun). Not sure why that's not giving you an error.
It's usually very instructive to add print() statements at various points in the code to see a) if the code is actually being run and b) how far it gets. It may be freezing for some reason at a particular point and a couple of print() statements will help you narrow down where that is.
I noticed that root_group typo but idk why it wasn't giving error for that, it happened during copy pasting it here.
But its still not working, i saved the code as code.py and i also used print statements, even till the end those print statements are working which can be seen in the ss below and lcd isn't showing any signs.
What if this is some driver issue or some issue with cir...
It all looks good from where I can see. I would double check the wiring between display and Pico. It's easy to get wires crossed, and since there's no communication back from the display, it's hard to know if you're actually talking to it. (For example, your code will work just fine with no display plugged in at all. And the display will show white when powered but nothing hooked up to it)
Do you have a link to the exact display you bought? It may not actually have an ST7735 chip.
This is the display lcd: https://click.daraz.pk/e/_CXh1bd
Also for exact wiring this tutorial can be checked as reference as i did exactly what he did and his display was also same as mine.
It all looks good from where I can see. I would double check the wiring between display and Pico. It's easy to get wires crossed, and since there's no communication back from the display, it's hard to know if you're actually talking to it. (For example, your code will work just fine with no display plugged in at all. And the display will show white when powered but nothing hooked up to it) Do you have a link to the exact display you bought? It may not actually have an ST7735 chip.
I just...
You should take this to the #help-with-circuitpython Discord channel. There are more people there that may have experience with this setup This repo is for core CircuitPython stuff, you may also want to open up this issue in the adafruit_st7735r driver repo as those folks may have experience with the "s" variant.
I had a reset overnight, but it didn't come back up in safe mode. Unfortunately I didn't have my USB-TTL adapter hooked up so I have no capture of what the bootloader did, but the USB came up as this:
PORT VID PID DESCRIPTION
----------------------------------------------------------------------
COM33 239A 011B USB Serial Device (COM33) [TinyUF2 CDC]
Instead of this:
PORT VID PID DESCRIPTION
---------------------------------------------...
With this PR, after every reload the current working directory will always change back to root.
With this, if the code exited while in a different directory (or autoreload was run, interrupting the code), reloading will run the code again.
Up until now, if the code had changed the working directory, CircuitPython would try to find a code.py in the working directory in the next reload.
This is exceptionally problematic for when autoreload is enabled, since the code may be interrupted wi...
Oh I was remembering the old behavior hadn't retested in a good bit..
Still the cwd when only using REPL isn't reset.
Adafruit CircuitPython 9.1.0-beta.1-17-g9ab8831d38 on 2024-05-02; DFRobot FireBeetle 2 ESP32-S3 with ESP32S3
>>> import os;os.getcwd();os.chdir("/Beryllium");os.getcwd()
'/'
'/Beryllium'
>>>
soft reboot
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
You pressed the BOOT button at start up
Press reset ...
I've been away. Yes, just read through and it's clear, I like the use of an illustrated example.
I'd say the LFO in its current state isn't usable for certain cases. If this was analogue electronics it might be glitchy in an interesting way but it creates harsh transitions from value spurious value of 0.
I have opened an issue on the link you provided, I also messaged on Disocrd community so i will wait for their reply, thanks
@alhafoudh that's a nice idea and would work in some cases, but I think most of the people interested in this issue would like to use some project which uses Adafruit's bluetooth libraries and wouldn't be easy to port. Or they might just want to write code that supports all CircuitPython boards, without requiring users to install firmware, libraries, etc.
KMK for example needs imports from adafruit_ble to work.
Currently analogbufio.BufferedIn blocks until the number of samples requested have been collected. I'm working on a non-blocking ring buffered version which will enable continuous data transfer. It could work like this:
>>> length = 60
>>> mybuffer = array.array("H", [0x0000] * length)
>>> rate = 10
>>> # create a RingIn object and start reading the ADC into it via DMA
>>> adcbuf = analogbufio.RingIn(board.GP26, sample_rate=rate, mybuffer)
>>> adcbuf.count
25
>>> adc...
Is the resolution to this issue exactly to make sure that all of these classes call deinit() in their __del__ method? Or is more required? Looking at the classes above, it looks like some do this and some do not. And, as far as documentation, am I right that explicit calls to deinit() should be de-emphasized? You indicate that sometimes explicit calls can be useful to control the timing of the deinit(), but this is not usually necessary, right?
The resolution is to make all these objects have finalizers and have __del__() call deinit(). In addition we can then remove the bulk reset operations like pulsein_reset() (already removed).
You can also use a context manager to do the deinit on context exit.
The only previous reason to call deinit() was if you wanted free up a piece of hardware that was being held by a native class. That is still true. All the hardware was also supposed to be freed up when the VM shut down and ...
@tulip sleet for Monday: I was updating a personal project and noticed 9.0.4 of circuitpython-stubs didn't release. Guessing a build problem?
Which is strange, since 9.1.0b1 did and it was released after 9.0.4...
CircuitPython version
Adafruit CircuitPython 9.1.0-beta.1-17-g9ab8831d38 on 2024-05-02; Adafruit Feather ESP32-S2 TFT with ESP32S2
Code/REPL
import time
import board
import usb
import max3421e
import adafruit_usb_host_midi
spi = board.SPI()
cs = board.D10
irq = board.D9
host_chip = max3421e.Max3421E(spi, chip_select=cs, irq=irq)
while True:
midi_usb_device = None
for device in usb.core.find(find_all=True):
try:
midi...
There was a problem building the stubs, which was fixed post 9.0.4 by https://github.com/adafruit/circuitpython/pull/9186. I can't just re-run the job because the version would be different but maybe I could manually upload it. Where is it you're getting the stubs from? From pypi?
Yup. Although looking there aren't any new boards or pin changes, so It wouldn't be any different from 9.0.3
maybe I'll jsut copy 9.0.3 as 9.0.4
I'm sure would be fine, or just wait for 9.1.0
if it's easy to find the latest version, then yes, probably won't bother to do anything
yeah, pip install works just fine. I was setting up a requirements.txt and had assumed it existed
Any reason that pwmio might interfere with pulseio? I'm trying to talk to an IR receiver while driving motors with PWM. A 100% duty cycle has no problems. But anything less and I start to get errors from adafruit_irremote : "Pulses outside mark/space"; "Both even/odd pulses differ"; and "Too short";
I am doing a nonblocking decode from within an async task, and the IR receiver scanning's in a different task.
Any time you have motors you have noise. Try running your code again but with the motors physically disconnected. If you get the same errors, then you're getting noise on your power bus from the motors
It looks like you may be right - the problem seems to disappear if I power the L9110 board from a separate set of batteries with a common ground. Any idea on other approaches that might fix it?
That’s typically how larger motor noise issues are solved: by having separate power. The easiest is two totally separate supplies like what you got. You may be able to get by with filter capacitors near the affected devices (try 10uF and 0.1uF). You also could try having a separate voltage regulator off your main power supply to create a “second” power source. It’s not an easy problem to solve generally, as it really depends on your setup
thanks for submitting this, @todbot I'm trying to add button presses for the ESP32-S3 reverse TFT Feather's D0, D1, D2 buttons for thinks like UI and to send MIDI panic, while using the USB MIDI Host function on the attached MAX3421e Feather Wing
@jedgarpark Are you using keypad for the buttons? That will work if the MAX3241e reads don't suppress interrupts: I would assume they don't.
Yep, with 9.0.4 it's going into flash mode after the reset. Guess I'll get another issue opened and try 9.1.0-beta.1
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037cd5e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x1734
load:0x403c9700,len:0x4
load:0x403c9704,len:0x1184
load:0x403cc700,len:0x3090
entry 0x403c9a80
I (31) boot: ESP-IDF v5.1.1 2nd stage bootloader
I (31) boot: compile time Mar 22 2024...
CircuitPython version
Adafruit CircuitPython 9.0.4 on 2024-04-16; Waveshare ESP32-S3-Zero with ESP32S3
Board ID:waveshare_esp32_s3_zero
UID:437BAD95C6CE
Code/REPL
N/A
Behavior
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x3 (RTC_SW_SYS_RST),boot:0xb (SPI_FAST_FLASH_BOOT)
Saved PC:0x4037cd5e
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3818,len:0x1734
load:0x403c9700,len:0x4
load:0x403c9704,len:0x1184
load:0x403cc700,len:0x3090
...
Could you copy this info back to #9173, since it's related? I would like to close this issue after that.
As I mentioned above I was unable to reproduce this. I have no motors connected. When this happens quiesecently, are the motors doing anything?
We would be really interested in a minimal version of this that provokes the behavior. If you can turn off various aspects of the program to see what happens, that would be helpful. Do I need to wait possibly hours for it to happen?
The problem is that code flow entirely blocks on .read(). If there’s no incoming data, the call to keys.events.get() never gets called.
Would it be possible or desireable to include in boot_out.txt a list of frozen modules that are available in that build of the core system? I find myself not keeping up with which ones are frozen on which devices and sometimes getting bitten by thinking I'm using one version of a library that I've copied over to my device when it's actually not using the one I copied because it's got a frozen one.
If there were a quick easy place to check on the CIRCUITPY drive itself I would definitely check there as a first step in troubleshooting. I know where to find them in the core repo, but the quicker access (and availability to non developers) would be appreciated I think.
Do I need to wait possibly hours for it to happen?
It was two full days between this last crash and getting it going again from the previous crash. It had sometimes happened in less time on 9.0.2 but around two days has been consistent. Nothing was happening with the motor.
I've made two more of these setups, minus the actual motor and switch on GPIO11, that I can try to run simultaneously with code trimmed out. Are there particular areas you think are the most likely suspects? The ne...
Are there particular areas you think are the most likely suspects? The network stuff? i2c bus?
I think the network stuff and async are the most likely. The I2C and motor control are pretty unlikely, as is the minimal display code. So you code take those out to start and leave the network and async and see what happens. That is, remove the actual motor control but leave all the motor timing code in. And when it's quiescent, not much is happening except NTP every 4 hours. You could speed t...
This issue can be closed, problem was discovered in Discord discussion, and it's not code related.
Same applies for the 2 referenced library issues.
It looks like this was due to unsoldered headers.
Hello experienced devs, I see that micropython uses a blizzard of types, many of which are generated by intricate macros. It is starting to make sense, but I am wondering, are there any tools you use to help make sense of this, or do you just, you know, suck it up? For instance, wondering if the preprocessor output sheds any light, or if looking at the memory while the code is running is helpful in revealing the structure.
Most of the macros are not so terrible, except for one set having to do with building object types. The use of most of the macros is very idiomatic, so rather than try to understand exactly what they are generating, reviewing the skeletal structure of a particular module will get you pretty far.
I don't think looking at the preprocessor output will help you a lot. Many macros are casts or struct-creating macros
The frozen modules are included in help("modules").
Ahh, I think I've seen that before but had forgotten about it. Thank you.
we could mark the frozen ones more clearly. help("modules") on CPython has a bunch of extra verbiage (try it), so I don't think adding a few markers or making the frozen list separate would be terribly incompatible.
I will try it in a more limited venv a little while later. I tried in my main python instance. It outputed several warnings about Future, Deprecation, and UserWarning things and then eventually crashed with Aborted (core dumped) I've got a decent list of stuff installed in that main python instance that could be causing issues
i was just trying it not in a venv
Yes, that's the one, MP_DEFINE_CONST_OBJ_TYPE. Ok, I won't dwell, thanks!
yes, that one is recent, and really bumped up into the limitations of cpp.
I tested this successfully by building stubs from this branch locally and installing with pip install .
I don't necessarily see a need to print out the board information when it's set. I don't have a problem with it either, but I could go either way on it's inclusion.
Really nice touch that you can further filter the list by passing keywords after --list like circuitpython_setboard --list feather One thing that would be a good potential improvement to that is if the search term matc...
@tulip sleet the ref is e8a4c1dd537c7ccfba92936c6eee9d5cf529be9e
i didn't realize you were hosting, sorry for taking that time
I can put in the state statistics
I didn't realize I was hosting either 😅
<@&356864093652516868> hey y'all! turns out the weekly meeting is in 20 minutes and I'm the host! please add your notes if you can, and I look forward to seeing you in the voice channel at the top of the hour.
@onyx hinge want me to do commuinty news while you set up?
@tulip sleet If you want to grab another item or two that'd be dandy!
@tulip sleet @gilded cradle @lone axle can y'all grab the usual "state of" sections today?
sure
Yep
@onyx hinge my internet keeps going in and out, so if it's offline at the time, could you read it?
@gilded cradle sure, or if it's easier on you I could just plan to read it no matter what
I should be getting a new cable modem tomorrow.
sorry you're having internet troubles 😕 and hope that it's solved soon
Yeah, modem was supposed to be here Saturday, but shipping delays...
Well, they just rescheduled it for later today.
We are celebrating 11 years today!
Learn more about the latest news about MicroPython on the official MicroPython youtube channel.
There is a Meetup every month!
https://t.co/sHR947hw5L
Recently, the Adafruit Learning System surpassed 3,000 guides! Thank you to the entire team at Adafruit who builds and makes learn.adafruit.com, one of the best resources online for learning. Thank…
18 people opened 100 issues??? huh.
Some people just do so much with circuitpython 😊
If they're regulars then I can believe it sure. Just wondering if there was some kind of PyCon sprint for finding bugs.
ahhh
i moved you up dan hope that's ok
Justin 👏
sampling single pixels and returning them
Nice work Jerry!
Maybe the Raspberry Pi foundation is working on a new RP2040 like microcontroler... let's cross the finger. It could have more memory. 😉
Thanks, I remember it used to work back in 8.x
on PicoW
I see, thanks for explaining 🙂
Thank you for hosting @onyx hinge
Thanks for Hosting Jeff. Have a great week everyone!
Thanks!
People add memory on DE-10 (FPGA) to have more memory for more "emulation" (That is MiSTer FPGA).
Where there is a will there is a way but the chip has to support it.
someone sufficiently advanced could write a high performance ARM-to-ARM JIT that treats the internal RAM as a cache and has a software/PIO PSRAM drier....
just a matter of sufficient dedication right?
You'd have to completely hack the firmware to shreds I guess... if someone is willing to do that for a pico w go for it.
yeah
If you would have told me when the pico came out that it would eventually run HDMI I wouldn't have believed it.... stranger things have happened.
NTP isn't actually happening with the code, probably I'd disabled it to validate that the DS3231 was providing time. Re-familiarizing myself with the code, once it has started the only things happening are:
- Wi-Fi.
- The Web API is enabled but not being used.
- Some functions
await-ing onasync_button.button.wait()that wouldn't be doing anything when crashes occur. - Some functions
await-ing onasyncio.sleep()that wouldn't be doing anything when crashes occur. - DRV8833 faul...
Well, the original crashed again already. And come up again in flash mode, this time cycling the motor, which has not happened before and now has me concerned for leaving that running unattended. I may have inadvertently changed bootloaders when I was upgrading it to 9.1.0-beta.1 because it came up with the FTHRS3BOOT drive instead of just the TinyUF2 CDC serial port.
TinyUF2 Bootloader 0.18.2 - tinyusb (0.15.0-566-gf1e006d09)
Model: Adafruit Feather ESP32-S3
Board-ID: ESP32-S3...
@dhalbert I was using debouncer, but didn't try keypad. I tried doing it with asyncio as well, but still was being blocked until a MIDI message came through.
Debouncer will not try to read the switch until its async task runs. keypad will read the switch transition immediately and save it in the queue, but to read the queue, you still have to wait and not be blocked.
Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/11WCg1nhwS0UgcSXYWZjla7fmye8TP3Y8f_N9kDZCVHo/edit?usp=sharing
I just noticed that the GFX library is going to be deprecated. https://docs.circuitpython.org/projects/gfx/en/latest/
Does that mean there will no longer be an immediate mode graphics api for CP?
I realize that displayio is the right API for most cases, but there are times when it is useful to have more control. In particular I'm thinking about partial updates for eInk displays.
@dhalbert ok, i've set it to use keypad. it now can show me a queued button press occurred the next time i play a MIDI note. not useable for how i'm planning to use buttons in this MIDI monitor project, but good to know keypad can queue up presses
anyone else get complaints about the build process with adafruit_ticks:
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/adafruit_ticks.py", line 31, in
_TICKS_MAX = const(_TICKS_PERIOD - 1)
TypeError: unsupported operand type(s) for -: 'const' and 'int'
this is during the automated build process for a pull request
@misty garnet that's not ringing a bell, and the last CI in there (5 months ago) was green. the type of const(1) should be int, so subtracting 1 from it shouldn't be a problem. Where are you seeing this message?
_TICKS_PERIOD = const(1 << 29)
_TICKS_MAX = const(_TICKS_PERIOD - 1)
(that is, the last CI inside adafruit_ticks)
Pull request for adafruit_minimqtt
OK
I can help with that
during the build process you're getting this:```
File "/home/runner/work/Adafruit_CircuitPython_MiniMQTT/Adafruit_CircuitPython_MiniMQTT/adafruit_minimqtt/adafruit_minimqtt.py", line 39, in <module>
from adafruit_ticks import ticks_ms, ticks_diff
File "/opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/site-packages/adafruit_ticks.py", line 31, in <module>
_TICKS_MAX = const(_TICKS_PERIOD - 1)
~~~~~~~~~~~~^
TypeError: unsupported operand type(s) for -: 'const' and 'int'
this occuring during the build of the documentation
this occurs because pydoc creates fake versions of modules that can't be imported, and sometimes these fake objects don't behave in the necessary way.
because adafruit_ticks is installable on standard python, the solution is to list it in docs/requirements.txt, so that it is installed during the CI build process, as was done with adafruit-floppy for instance: https://github.com/adafruit/Adafruit_CircuitPython_floppy/blob/main/docs/requirements.txt
if that still doesn't get you un-stuck please @ me on the bug and I'll try to take a peek in tomorrow
er on the PR
Ok, I'll give it a try and let you know how it goes, thanks for the help
So, I see that Adafruit has already allowed codecov into its organization. Any issues with me adding it to a repo for coverage to see how it looks (would probably try with ConnectionManager)?
no objections
@misty garnet second guess, remove micropython from the explicit mock list in docs/conf.py: docs/conf.py:autodoc_mock_imports = ["micropython", "microcontroller", "random"]
it's micropython.const that's getting incorrect behavior via being "mocked"
I'll give it a try later today
Noticing that the RP2040 port of monotonic_ns() only has millisecond precision - the subtick value is not used:
This seems to work for a fix:
uint64_t port_get_raw_ticks(uint8_t *subticks) {
uint64_t microseconds = time_us_64();
if (subticks != NULL) {
*subticks = (uint8_t) (((microseconds % 1000000) % 977) / 31);
}
...
Noticing that the RP2040 port of
monotonic_ns()only has millisecond precision - the subtick value is not used:
Good catch. Feel like filing a PR against our main branch to fix it?
@onyx hinge removing micropython import from docs/conf.py did the trick, thanks for the help
Noticing that the RP2040 port of
monotonic_ns()only has millisecond precision - the subtick value is not used:Good catch. Feel like filing a PR against our main branch to fix it?
Yes, will do.
Any updates on this? This would be undoubtedly a significant feature to add... plus simple tensorflow lite models can run on most Adafruit boards.
The RP2040 port of monotonic_ns() only has millisecond precision - the subtick value is not used:
Added 7234375e806f101673f3c91bf649442260588d97 to fill in the subtick field. Testing with this code to look at deltas between successive calls to monotonic_ns():
import time
def test_ns(n=200):
t0 = time.monotonic_ns()
for i in r...
Wow, that's a huge change. Thank you for keeping this alive, and the (obviously huge) effort to make ESP32 boards have full BLE capability in CircuitPython! I know it's not ready yet, but it's not too early to say "THANK YOU!"
When creating a new board inside espressif ports for circuitpython, is there a standard way to define the serial mapping of DTR and RTS pins to the ESP32 reset and GPIO0 ? While the build itself doesn't care, other tools definitely need to know this (e.g. the online flash tool, serial emulators, upload/download scripts, etc)... I'm doing the port for the popular "ESP32CAM": does anyone else know another board which has hardware serial which also wires DTR (data terminal ready) and RTS (request to send) to the ESP32 reset and gpio0 pins (i.e. so I can see if/how they supported this?)
All the time I've been using serial on Espressif chips, we have never used DTR/RTS. We simply use TX/RX. Any flow control is handled by the protocol of what's going over the serial lines
for instance esptool.py doesn't need external flow control
esptool can support a "custom reset sequence" https://github.com/espressif/esptool/blob/1deb1c65c140363bbfa16fbd889cff8e6d33b8c0/docs/en/esptool/configuration-file.rst#custom-reset-sequence via an esptool.cfg file. We have not needed to add support for such a file on a per-board basis, but putting esptool.cfg in the board AND setting the relevant environment variable ESPTOOL_CFGFILE for make flash and make flash-circuitpython-only would seem like one approach.
but yeah, to date we have not identified a need for this, as the "standard reset sequence" is so widely supported by esp boards in the wild.
Does circuitpython support BLE audio streaming on nRF52840?
@ornate breach no
@onyx hinge thanks, great pointers and good idea. @tulip sleet some boards (ESP32CAM most notably) physically wire the hardware serial chip flow control lines to the ESP32 reset and GPIO0 lines (and do not use them for flow control of course)... this allows software programmers to automatically "hardware reset" the board, and optionally put it into firmware-upload mode, even when the last uploaded-sketch might be crashing. I'm not familiar with how other boards handle that (probably force you to manually press a button?), but the issue with these automatic ones is that there's a 50%/50% chance that your non-arduino terminal emulator (and/or command-line tools like "ampy" etc for talking to micropython) is not going to work for these boards, because the tools (or if not the tools, the windows/mac/linux/wsl1/wsl2/etc operating system itself when the tools do not specify otherwise) incorrectly (from the point of view of the ESP32CAM, which is really "correctly" from the point of view of something expecting hardware flow control) set the state of these flow-control pins (even when you tell the tools you're not using flow control). Long story short - this seriously "trips up" most people trying to use an ESP32CAM (and similar - I think Freenove and esp32-wrover-dev do this too)
but that's not something that has anything to do with circuitpython, is it?
or to put it another way, can you clarify what CircuitPython would do with this information?
Hey,
Thanks for the replies so far, sorry for responding late.
The board is a badger2040, let me report back when I tried a different one.
would this need updating for latest CP UF2? (due to UF2 file size)
TinyUF2 Bootloader 0.14.0-5-g45bc2fc - tinyusb (0.15.0-331-ge3b3229d6)
Model: Adafruit MatrixPortal S3
Board-ID: ESP32-S3-MatrixPortal-revB
Date: May 18 2023
not finding the summary of what versions work for what UF2 file sizes, etc.
Hi! Both you and @tulip sleet have run into this problem. I'm trying to make a library using cookiecutter and getting this AttributeError: module ‘pkgutil’ has no attribute ‘ImpImporter error when committing. I'm using Python 3.12 and have many other dependencies on it. Is there a way to tell pre-commit and its tools to use Python3.11, which I also have installed?
@XenonFlits @dhalbert Happened to be recently working on understanding I2CTargets so I took what I learned and created some additional documentation. If you have a moment, could you review and see if there are additional gaps that I haven't explained clearly?
Also, I believe there is a bug in 9.04 that prevents the full example (as well as the original example) from working: durin...
it's only older nRF bootloaders that had a problem that I know of. UF2 file size is larger than the firmware size by a lot
To answer my own question, looks like the solution is to add this to the top of .pre-commit-config.yaml:
default_language_version:
# force all unspecified python hooks to run python3.11
python: python3.11
I think if you bump the pylint version in .pre-commit-config.yaml to 3.something, that may work
oh, and you'll need this snippet of code to get the output to work correctly. I'll remove this dependency before submitting a pull request for this documentation
import adafruit_logging as logging
class NamedStreamHandler(logging.StreamHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def format(self, record):
return f"{record.created:<0.3f}: {record.levelname} - {record.name} : {record.msg}"
The core module hashlib seems to only support the sha1 algorithm. Inside of the core code I found that it's including things from mbedtls/ssl.h https://github.com/adafruit/circuitpython/blob/main/shared-module/hashlib/__init__.c#L30 I found mbedtls inside of lib/ and what I'm guessing is the ssl.h it's referring to: https://github.com/Mbed-TLS/mbedtls/blob/981743de6fcdbe672e482b6fd724d31d0a0d2476/include/mbedtls/ssl.h Is anyone able to confirm that is actually the correct ssl.h? And secondarily I'm interested in trying to make a build that has sha256 enabled inside of the core hashlib. I see many references to sha256 inside that ssl.h file and the mbedtls include directory, is it just a matter of adding a bit more code to hashlibs shared-module and shared-bindings __init__.c files? Or is there more a lot more to it than that?
There may be changes necessary to other build or configuration files, but I don't know. py/circuitpy_defns.mk names files related to the implementation sha1 and sha512. fwiw without a real good reason I wouldn't include md5 or sha1, they are both considered cryptographically broken.
wait, the one we have is sha1? oof
@stuck elbow yes, because (for example) https://code.circuitpython.org/ - giving people a board they can't use because no tools can connect to it isn't a nice thing to do to them 🙂 [ hence my original question: is there a standard way to define the serial mapping of DTR and RTS pins to the ESP32 reset and GPIO0 ]
I am not sure what you mean by "define the serial mapping". are you saying that external tools (e.g. a USB-serial converter, driven by some software) want to attach to those pins? Are you saying that the CircuitPython REPL should be paying attention to the DTR and RTS pins? When I use a usb-serial converter, normally do not connect the DTR and RTS pins. I know that the standard terminal block includes those. But suppose you don't connect them, and only connect TX and RX. What functionality are you losing by not DTR and RTS, and does the external software assume those connections (esptool does not, for instance).
If DTR and RTS are tied to ESP32 RESET and GPIO0, then the state of those pins will allow external resets, etc., as you say. But that is way before CircuitPython even starts. CircuitPython pays no attention to flow control for the REPL on any pins. And indeed, since one of the the pins is reset, it cannot be used for flow control, since toggling it will reset the board.
what is it that you can't do right now with these boards?
For anyone else arriving here, this appears to be replaced by settings.toml now - see https://learn.adafruit.com/scrolling-countdown-timer/create-your-settings-toml-file and https://docs.circuitpython.org/en/latest/docs/environment.html
@tulip sleet "CircuitPython" is an ecosystem not just a firmware image. Other things need to talk to the firmware, and those need to know when these DTR/RTS features are available, so they can (a) use them, and (b) not cause everything to "not work" because they're ignoring them. While the things that use these pins (mu, vonny, https://code.circuitpython.org/, ampy, vscode, etc) are what's supposed to honor this, the most logical place for where this info should be authoritatively recorded, is someplace inside the board definitions. It is because circuitpython (the company) also has a product which is not working on account of this info not being recorded anyplace that I'm asking questions about this in here. It's a chicken-and-egg problem. https://code.circuitpython.org/ isn't going to get perfectly fixed unless ports/espressif/boards/* documents when this is required (which it isn't doing, because https://code.circuitpython.org/ doesn't look) ...
It's actually a somewhat larger issue - some tools work (e.g. arduino itself, micropython online flash components, the https://code.circuitpython.org/ REPL when you pick "circuitpython" - which makes no sense since these boards do not support USB FS, so https://code.circuitpython.org/ isn't usable when you do that), but most other tools fail. I've fixed the bug everywhere I can find (ampy, mpuremote, and a bunch of others) and provided workarounds for the root cause of the problem (python itself, which on some (but not all) operating systems does not allow serial constructors to specify what to do with those pins, and defaults to pulling them low - which locks boards in either reset or DFU states - I filed the relevant bug reports and someone there seems to be looking at it... the workaround it to manually construct a serial connection before telling it what port to use, set the pins as needed, then specify the port.). Confusing things even more - some boards wire reset this way using a capacitor (thus always see momentary resets) and others use a transistor (so pulling reset low locks up the board indefinitely)
circuitpython is not a company
I still don't see what you want us to do with that information
@stuck elbow sorry, I mean adafruit, the owners of the circuitpython trademark and who run circuitpython.org website I still don't see what you want us to do with that information => my original question: is there a standard way to define the serial mapping of DTR and RTS pins to the ESP32 reset and GPIO0 I
no
WOO HOO!!! Got the ESP32CAM working almost perfectly. Camera - YES! SD-Card - YES! LED+Flashlight - YES,YES!
Huge marathon... I've sat here for 12 hours on that... Just gotta test wifi. What's the developer ettiquette on this channel? Do n00b geeks like me get flamed for asking dumb questions? I'm wondering a bunch of stuff (like whether or not I should use the "AI Thinker" trademark in my board - they deisgned it, but I'm working on clones and have no idea if an original would work...)
Is this even the right channel for board devs ?
this is the right channel for the firmware development and adding support for new boards, but we might be a bit lacking in legal knowledge about trademarks
I'm not a lawyer, but it seems that only the owner of a trademark should use their trademark
if you use someone else's trademark without permission, they can sue you
What, if any, procedure exists for including "tools" for a board? e.g. code samples for taking photos, mounting SD card, illuminating the flashlight, etc ? While some existing things work ( https://learn.adafruit.com/capturing-camera-images-with-circuitpython/example-qr-code-scanner ) others do not, and most of those require unnecessary (internet accounts)/unsupported(LCD screens) features and don't make it easy for new users to get started.
Another question (sorry! getting my ducks-in-a-row before creating a new-board PR...) - does anyone know how to use SD_Card in 4-pin (SDIO) mode, instead of 1-pin SPI mode - or if it's even possible? Seems a shame to limit the speed to 25% when all pins are soldered...
I would say that the board usually has its own website somewhere, and you can link to it from the circuitpython.org page
for adafruit boards this is usually the shop page and/or the learn guide for that board
for third party boards this is the website of the manufacturer
Thanks... I find they've called it SDMMC in the source, so I'm working on that now.
Looking for guidance: Default state of enable pins
I am working on an RP2040 board with built-in epaper display, neopixels, and sound.
When using sleep modes, I want to reduce power. The three mentioned features each have an _EN pin.
When the board first boots up, should the enable pins be “active” or should the documentation and example code always include setting these pins to turn on the features?
When I look at the Adafruit MagTag, they default to not setting their enable pins at startup.
I am NOT an expert, but, I've been "saved" in the past when I need to connect lots of things to boards with not-many-spare by simultaneously wiring pins to multiple devices, and using software to carefully control them and not use things that need the same pins at the same time... if stuff was getting "enabled" by default, that would mess me up. On a philosophical note: users can "enable" (not not!) anything they want during boot in their code.py, however, if you did that for them, you've denied them the chance to have the option... Semi-relatedly, I notice that if my wifi settings are not inside settings.toml, the wifi does not aautomatically get set up... that's another possible option for you ?
There is the question of "usability". With the CircuitPython focus on "ease of use and learning", pre-enabling is one less thing to remember and means the existing learning guides "just work".
By contrast, not pre-enabling is more power conscious.
Using MagTag and a single point of reference suggests there is precedence to no enable in the firmware.
(I can talk myself into anything. I'm very convincing 😜)
This adds support for the cheap-and-popular ESP32-CAM boards.
Board Feature Circuitpython Status
============= ====================
Take photos with camera Tested + Working
Mount SD card Tested + Working
Wifi Tested + Working
Inbuilt RED LED (back of board) Tested + Working
Flashlight (front of board) Tested + Working
ESP32-CAM-MB Button Tested + Working
Bluetooth Not tested
Others There are no other features I know of
Here is my workin...
Nobody can use any of these boards without creating settings.toml (usually to add wifi credentials), so one of (a) making enablement an option in there, or at least (b) making "do not enable at all" (taking care not to enable first, then disable, since that's going to break stufffor anyone who diodn't want it enabled in the first place) at least a possible option in there, seems to make the most sense?
The boards that use DTR and RTS for non-standard functions such as reset I believe are ill-designed. The reset problem you describe is not related to the firmware running on the board. The solution in this case is not to connect all the pins of the USB-serial adapter to the board.
We don't control what third-party software does in its "CircuitPython" mode.
we are working on making code.circuitpython.org work on boards that do not present CIRCUITPY, but instead only present a REPL through a serial port.
files will be read/written through the REPL, as with ampy, etc.
@tulip sleet Those pins are connected for a reason - so programming is possible without humans needing to manually push buttons. There's millions of these boards out there - possibly more esp32-cam boards exist than any other esp32 or even circuitpython compatible boards - they're crazy-cheap, and often sold in the hundreds.
the reset pin is not under control of CircuitPython so it is not part of the board definition. GPIO0 could be used for GPIO and is sometimes included
yes but those board break the definition of what DTR and RTS are usually for
if you want features to be added the the host-computer tools that know about the non-standard uses of those pins, that's ok, but it doesn't really have to do with CircuitPython
"we are working on making code.circuitpython.org work on boards that do not present CIRCUITPY, but instead only present a REPL through a serial port." - that's browser-based scripting. It already works (for micropython). That script needs to know this option. That's the whole point of me writing here about it.
it has to do with those tools. To the extent that we control any of those tools, we're happy to entertain requests for such features.
the micropython firmware-upload stuff works fine. the adafrut copy of it does not. someone broke this specific issue when they cloned that...
this works: https://esphome.github.io/esp-web-tools/
this does not: https://code.circuitpython.org/
I'm happy to fix that for them later, if that's something they accept PRs on.
Quick question: whose job is it to fix a lint error of a single missing space in my PR? I assume either some tool, or whoever merges it, does that ?
the formatting is checked by pylint. This PR run fails if the formatting is not right. You can use pre-commit to check the formatting before you submit the PR. https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code
we're happy to entertain PR's on anything
it's C, not python.
I am saying we are working on adding that feature to code.circuitpython.org
It (https://github.com/adafruit/circuitpython/pull/9231) actually shows the diff of where the extra space needs to go - is there something I can do to "accept" that and let it make the change ?
you can make the change manually and push a new commit, or use pre-commit locally and have it clean up your code before you commit
it is an "error" from the point of view of the PR submission checks, so it's something for the submitter to fix, like a compilation error.
(p.s. "code.circuitpython.org" already has the feature you are talking about. You just select "micropython" instead of "circuitpython", and the extra buttons show up in the UI. All you need to do is give circuitpython users an option skip selecting a folder, and then show those buttons, and it's ready... except for the broken RTS/DTR issue on some boards of course)
where is the "micropython" mode button you are talking about on code.circuitpython.org? Could you show me a screenshot?
i am talking about https://code.circuitpython.org
LOL - SORRY - I got "Mu" mixed up with that (too many new tools in one day!!). ping me if you need help - I've re-written ampy, mpremote, and pyboard for those things (and made ampy compatible with circuitpython today) as well as written my own emulator too... I've got a fair whack of experience with the ugly mess that is serial management of these boards. They're horribly dumb, and time-out when anything unexpected or unusual happens... and I fixed all of that.
Do you happen to knw what "C" lint or formatter is being used? It's blocking my PR inside a .h file, and the messages don't give me any clue as to what program they used to do that.
The "check-your-code" link only mentions python and "black" - but "black" simply exits with no message (so I assume it's happy?)
it is uncrustify. And you have to use a specific version. black is for python code
micropython uses uncrustify, and since we are downstream, we adopted their conventions
they are switching to ruff for Python code; we will probably go that direction eventually
ok, now I understand. We no longer maintain ampy. Did you submit a PR to micropython for mpremote?
ugly mess that is serial management of these boards
🙂 yes, that's what I was despariing
Yes, I submitted PRs for mpremote, ampy, pyboard, and python itself.
Unrelated - I really don't want to mess this up: I've got uncrustify working and "fixed" (ruined the readability by erasing the indent... but that's another story...) my header file. What are the steps to fix the PR? Do I do another "git add" and "git commit" and finally a push? I'm guessing it's more complicated - do I need to withdraw the PR first, or something ?
Yes, add and commit and push
it's fine to have multiple serial commits to a PR. That's part of the point.
a PR doesn't have to be perfect when it's first submitted
We have a guide on the process: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
by the way, the indentation change is because you were using tabs for indentation. Since there are multiple standards for how many spaces a tab is, we use spaces.
All checks have passed - thanks HEAPS @tulip sleet holding my hand through that jungle was a HUGE help.
I've got a stack of about 10 new ESP32 boards here (mostly different sized displays, but a couple of camera boards too, plus some bare chips inside programming holders)... I'd like to get a production-line going, so I can push out support for all these things. LVGL is too bloaty, and I've already got them working in micropython (which has some weird complex-number bugs)... sorting out that lint nightmare has totally made my day!
It probably varies from board to board but you might consider adding aliases for the pins that are silk screened.i.e.:
{ MP_ROM_QSTR(MP_QSTR_SDIO_CLK), MP_ROM_PTR(&pin_GPIO14)},
{ MP_ROM_QSTR(MP_QSTR_IO14), MP_ROM_PTR(&pin_GPIO14)},
I don't know if any of these pins are usable but they are broken out and silkscreened:
{ MP_ROM_QSTR(MP_QSTR_U0TXD), MP_ROM_PTR(&pin_GPIO1) },
{ MP_ROM_QSTR(MP_QSTR_U0RXD), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO16), MP_ROM_PTR(&pin_GPIO16) },
Good idea - the silk screen contains the actual GPIO names, which are already defined, and only now I just noticed that there's 2 which are different (U0T and U0R).
For what it's worth - here's my "notes" (a cobbled-together copy/paste from assorted places which seems correct):
This may already be clear but since you said this was your first board, I just wanted to be sure... The silkscreen does show the actual GPIO names IO14, etc so a programmer can access them by those names using microcontroller.pin, although most CircuitPython users will be looking for the silk screen name in board.xxxx (board.IO14). In order to support that you would need to add a second line for each of the silk screened pins with both the logical name and the silk screened name.
...
I'm reluctant to introduce a whole pile of non-standard non-portable aliases simply to drop the leading "G" off everything... while I can see where you're going with that, I would very much prefer NOT to encourage that kind of thing. I'm working currently on the ESP32-WROVER-DEV board which (minus the SD card) is almost identical. Code written for either will run fine, unchanged, on the other... so long as people don't use silly pin names. The latter drops the "IO" prefix on its silkscreen, which will add a whole extra level of extreme confusion if I go down this route ... { MP_ROM_QSTR(MP_QSTR_16), MP_ROM_PTR(&pin_GPIO16) will resolve to an int instead of a string in those cases...
That said - I'm happy to keep you happy. This is my first time doing this stuff.
... The silkscreen does show the actual GPIO names IO14, etc
I'm reluctant to introduce a whole pile of non-standard non-portable aliases simply to drop the leading "G" off everything (and waste memory and add confusion)... while I can see where circuitpython is going with that, I would very much prefer NOT to encourage that kind of thing. I'm working currently on the ESP32-WROVER-DEV board which (minus the SD card) is almost identical. Code written for either will run fine, unchanged...
@alpine holly maybe you have seen this already: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython. Includes discussion of pin names.
Excellent reference - that suggests that my hunch is what they want: "Try to make the names correspond closely enough to the board silkscreen that it is self-evident which pins correspond to which silkscreen markings. It's fine to expand abbreviations, such as LED for L. You don't have to match the silkscreen exactly, since the silkscreen names are often constrained by the space available." ... I think "GPIO16" is exactly what "it's fine to expand abbreviations" is talking about (since it';s clear the silkscreen simply left off the "G" because there's no room to fit that there) https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython/pin-and-device-names
I'm just sharing some pin naming hurdles I've encountered, don't worry about making me happy 😁 It seems like you've considered the issues. Just one more thought, I believe a lot of the ESP32 boards do use the IOxx pin naming standard (I'm not home to confirm that right now) so porting code between this board and other ESP32 boards may be impacted by your naming choice
CircuitPython version
Adafruit CircuitPython 9.0.4 on 2024-04-16; Challenger RP2040 LTE with rp2040
Code/REPL
import board
from i2ctarget import I2CTarget
import adafruit_logging as logging
from logging import NamedStreamHandler
# https://www.i2c-bus.org/repeated-start-condition/
# https://learn.adafruit.com/working-with-i2c-devices/repeated-start#whats-the-issue-3111703
def emulate_mma8451():
logger = logging.getLogger('i2ctarget')
lo...
This adds support for the ESP32-WROVER-DEV boards (alternatively named ESP32-WROVER-CAM by other manufacturers)
Board Feature Circuitpython Status
============= ====================
Take photos with camera Tested + Working
Wifi Tested + Working
Inbuilt RED LED Tested + Working
ESP32-CAM-MB Button Tested + Working
Bluetooth Not tested
Others There are no other features I know of
Here is my working sample script which takes a ...
Be aware of a common hardware fault on some of these - the power regulators are backwards ...
You may need to swap the 2 power regulators (65BX and 54FK) which got soldered in the wrong way around! See pic - cheap copy at top, original at bottom :-
@wraith crow - yeah - you utterly nailed that one!!!
[cnd@cdc:~/.../ports/espressif/boards]$ grep -r -l -P 'MP_QSTR_IO\d' . | wc
110 110 3550
[cnd@cdc:~/.../ports/espressif/boards]$ grep -r -l -P 'MP_QSTR_GPIO\d' . | wc
4 4 114
I'll fix this tomorrow - it's 4am, I've been going for 20hrs nonstop and I'm getting vague...
nah.. did it now, before I forget, so it's in a state ready to be accepted if someone like it.
Turns out a very large number of other ESP32 ports introduce IOnn aliases... so in the interests of letting those folks run their code unchanged on this port, I added the aliases.
Things seem to be worse with 9.0.4: if I have a settings.toml, Thonny cannot connect to the ESP.
As I research further (and read more carefully), IC_SLV_RESTART_DET_EN is a value set when configuring Synopsis's I2C core used on the RP2040.
Since it's listed as...
I loaded up the artifact from this PR and tested WiFi, SD Card, LED and Camera operations. I didn't find any issues other than the annoyingly bright "flashlight" led defaulting to on.
The flashlight on the front is very bright, looking at the espressif esp32-eye board, maybe the following would set initial state of the flashlight off so it doesn't blind you :grin:
#include "mpconfigboard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "components/driver/gpio/include/driver/gpio.h"
#include "components/hal/include/hal/gpio_hal.h"
#include "common-hal/microcontroller/Pin.h"
void board_init(void) {
reset_board();
}
bool espressif_board_res...
From the guide also:
GPIOn pin names are typically abbreviated as IOn on Espressif boards.
I wrote that page
@tulip sleet (you wrote in a different channel) ...or remove OTA instead... There's (0x7000-17568) 11,104 spare bytes after the end of the bootloader on ESP32 right now. I would love to try my hand at at a new kind of OTA which facilitates updating a running system without needing any OTA partition by (a) first storing the new firmware inside the existing VFS or SD file system, (b) halting circuitpython and switching the a new OTA stub in the bootloader which (c) SWAPS the current firmware partition with the new new one (i.e. overwrites (a) from the old firmware as it writes to flash), (d) sets some flags in the new OTA stub, (e) reboots into a new "firstboot" stub which updates those flags and sets a watchdog timer then attempts to run the freshly flashed firmware, which itself will update those flags and disable the watchdog when the boot works, and (f) the watchdog OTA stub which (if called) loops back to (b) in order to replace the new broken firmware with the original working one. new firmware can be stored inside the VFS (if the user makes enough space for it) or on an SD card (potentially allowing many other ones to exist at the same time - featurecreep - grub-like UI to let people pick...). In very-low-VFS-space-situations, some kind of web-helper to temporarily "move" VFS things to some cloud the the update, then replace them upon workingness might be nice. it might even be possible to code a standalone VFS binary that's far smaller than the existing circuitpython firmware which would be callable form the OTA and be able to connect wifi or ble and manage the firmware update using the same process, but using "cloud" (or some BLE or phone app) instead of VFS for holding the actual image ... so many cool possibilities. I got a long way down this planning path and started on experiments in micropython back in January (before mpy' instability made me realize that's unsuitable for my production use...)
hmm. the same idea would facilitate an "undo" option that does not use up any extra time for users when they're flashing locally as well (like over serial or from the web flashing UI in chrome etc).
Fixed (and tested)! Brilliant help - thanks so much. Scary how something so obvious simply didn't even occur to me.
I also added all the IOnn pin aliases to keep this compatible with the other 44 ESP32 boards that do the same.
FYI... More handy info about these boards is here: https://randomnerdtutorials.com/esp32-cam-ai-thinker-pinout/
CircuitPython version
Adafruit CircuitPython 9.1.0-beta.1-18-g781c577745-dirty on 2024-05-10; M5Stack AtomS3 with ESP32S3
Code/REPL
import board
import pulseio
import adafruit_irremote
pulsein = pulseio.PulseIn(board.D1, maxlen=1020, idle_state=True)
decoder = adafruit_irremote.GenericDecode()
while True:
pulses = decoder.read_pulses(pulsein,max_pulse=91000)
print(len(pulses))
Behavior
prints "128"
Description
It is possi...
Hi all! Not sure what the current status of progress is on this, but for a set of boards I'm working on, we've needed to get SPI communication between two SAM D51 boards running CircuitPython.* Our code is a bit of a mess right now since it's just for our internal project, but (admittedly not having looked through the commits mentioned here) it might be helpful developing this feature, if there's anyone else still interested in getting it running. Namely, I've noticed some talk in the issue l...
When an issue is tagged "long term", Adafruit isn't prioritizing work on it. But we're always happy if a community member can contribute something!
Ok with the proper boot.py, the web workflow starts:
import wifi
wifi.radio.tx_power=8.5
CircuitPython version
main
Code/REPL
n/a
Behavior
As reported by multiple users, with the power-on default tx_power, the board does not successfully connect to wifi (https://github.com/adafruit/circuitpython/issues/6540 https://github.com/adafruit/circuitpython/issues/9058#issuecomment-2104612719 and probably others) but does work if boot.py executes wifi.radio.tx_power=8.5.
Description
No response
Additional information
The board...
is_restart on an I2CTargetRequest wasn't getting set properly because the incorrect register mask was being used.
also, added documentation with two different examples of how to create an I2CTarget
I tried out the latest version of this and everything is looking good to me. Thanks for adding this functionality!
The usb.core.Device.read() also blocks on RP2040 PIO USB host too.
Here's an example that should print out "doing UI things" every 0.1 seconds but blocks on read().
import time
import board
import usb.core
import usb_host
import adafruit_usb_host_midi
usb_host.Port(board.MOSI, board.MISO) # GP3,4 on QTPy RP2040; GP16,17 on RP2040 USB Host Feather
print("Looking for midi device")
raw_midi = None
while raw_midi is None:
for device in usb.core.find(find_all=Tru...
CircuitPython version
Adafruit CircuitPython 9.1.0-beta.1-18-g781c577745 on 2024-05-05; Adafruit QT Py RP2040 with rp2040
Code/REPL
import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
print("0.004 = ", 0.004)
print("1000 = ", 1000)
print("0.004 * 1000 = ", 0.004 * 1000)
print("int(0.004 * 1000) = ", int(0.004 * 1000))
print('"%f" % (0.004 * 1000) = ', "%f" % (0.004 * 1000))
Behavior
Prints out a "3" inst...
@todbot I do see if I remove that last bit of mantissa (which CP doesn't have) it's 0.0039999997, which would match your results...
Do we have to do something to request a review of our PR's ? e.g. https://github.com/adafruit/circuitpython/pull/9233
Yes. You have to try to be patient.
Remove that last two bits for what CircuitPython has. As I mentioned in discord, the CircuitPython default for objects is OBJ_REPR_C. MicroPython defaults to OBJ_REPR_A. See https://github.com/adafruit/circuitpython/blob/d8ca8421a09b1e5fee8fd29213c3ccc7914f5d8c/py/mpconfig.h#L105-L107
and following.
See also #5802, #1220, #566, #230, and the MicroPython issues those issues reference.
This is always going to be a problem with floats. It's worse the fewer bits of precision you have. Micr...
I loaded up the artifact with the flashlight fix and everything seems good, no more bright light :grin:
board-porting question: How do the LCD drivers get into the firmware? I purchased one-each of every one of these eps32 LCD boards ( https://www.aliexpress.com/store/1100192306 )... 11 in total. They mostly use different LCD drivers ( EK9716, GC9A01, ILI9341, ILI9341V, ILI9485, ILI9485, ILI9488, St7262, ST7735S-G6, ST7789, ST7796 ) There's 3 already board ports for these done (sunton_esp32_2424S012 sunton_esp32_8048S070 sunton_esp32_2432S028) which have EK9716, GC9A01, or ILI9341 LCD drivers in them. Looking at boards/sunton_esp32_2432S028/* reveals no mention at all of the driver (besides a comment) and it implements only display_init() - yet somehow the compiled firmware works fine (show shows the REPL on the screen at boot), and I can draw circles etc using board.DISPLAY ... how did the plumbing work that out ??? I firstly want to fix the ridiculously slow scrolling ( ILI9341 has hardware assist for this, which is clearly not being used), and then build a port for all those other boards.
they only differ in the init sequence, if you look at the python drivers you will see that they also only have init
interesting! So the SPI commands to set pixels, clear screen, scroll, etc etc are identical, regardless of which LCD you're using ? Seems slightly implausible?
I notice my ILI9341 (320x240) scrolls crazy-slow, but my EK9716 (800x480) is really fast, and I notice the latter scrolls sideways even faster... suggesting there's some hardware support for scroll in only one of those drivers ?
(by "scroll" - I mean how the REPL shows up when I boot and upload files etc over serial)
More info about these cool "Cheap Yellow Display" aka CYD boards here: https://www.aliexpress.com/item/1005005865107357.html
I've tested wifi, serial, the 3-color LED, display, display backlight - all good.
Has ambient light detection, speaker, SD card, buttons, ports, and what looks like power/battery related circuitry - still need checking.
There's 2 models of this - capacitive touch (the one I've got) and restive. touch still needs testing, and so does the "power off" of the scree...
[I updated the initial comment so that it links to the related issue.]
CircuitPython version
Adafruit CircuitPython 9.0.4 on 2024-04-16; Adafruit CLUE nRF52840 Express with nRF52840
Code/REPL
### displayio or bitmaptools bug with missing pixels
### perhaps related to dirty region code for efficient screen updates?
### Demonstrated on Adafruit CLUE with 9.0.3 and 9.0.4
import array
import time
import board
import displayio
import bitmaptools
p1 = [(170, 120), (168, 105), (160, 91), (149, 80), (135, 72), (120...
Some drivers do not read/write registers to tie into any hardware acceleration the driver chip might have. This does vary display to display. The init sequences for displays are the basic data commands for writing to the display. The init sequences are different for each display but yes the way displayio uses them remains consistent across displays that use displayio. That's one of the advantages of displayio is consistency across displays. Some drivers are more refined than others so you might see different performance depending on the driver setup. There are tons of features a display might have that are never tapped into. Compatibility with displayio is prioritized over fine tuned performance per display. Even if hardware acceleration is available on a display driver chip doesn't necessarily mean it's being used. Someone can correct me if I'm wrong but this is my current understanding of displayio init sequences vs driver libraries that require register read/write.
@tulip sleet with the ConnectionManager updates, we lost the Error connecting socket: error 2, first error: error 1. Are we okay with that? I haven't seen a case where the two are different, but I can imagine the case where it's a MemoryError the first time and then a different one the second...
I am OK with that. And it wasn't handling SSL wrapper recovery: that would have caused two different errors if the second one failed. But the second error is the one that is interesting. The MemoryError is an internal thing that is not really an error: it's an out-of-sockets thing.
rather than put it in the exception, I think adding some logging at some point would be more helpful when debugging a problem. e.g. "This succeeded; this succeeded; this failed."
Awesome. Will update the test accordingly and push it up in the morning (it's a beautiful day and not spending anymore time inside)
The read method is documented as having a timeout argument in milliseconds. Did y'all give that a try? https://docs.circuitpython.org/en/latest/shared-bindings/usb/core/index.html#usb.core.Device.read
oh I see that the midi library is an intermediate here and probably can't provide the timeout argument. well, that complicates things.
Also from the first post:
There is a non-standard timeout argument to the usb.core.Device.read()
and usb.core.Device.write() methods. However, when specifying a timeout on .read() (by modifying adafruit_usb_host_midi.MIDI.read()), the .read() throws
an unattributed usb.core.USBError, ins...
@tulip sleet also sorry for the double ping, but wanted to make sure you saw this comment: https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/pull/212#issuecomment-2106351165
At least it looks like the timeout error should be possible to distinguish, it is of type USBTimeoutError, while all other errors are of type USBError. Both derive from OSError. It's true they don't have any relevant attributes, but an except clause should be able to catch them as different things, by having the except clause for the more specific USBTimeoutError first.
I do agree it should just maybe just return instead of raising an error.
fbofw I think this module strives for compatibility with pyusb
Unfortunately, adding a try/except for usb.core.USBTimeoutError doesn't work. I've modified adafruit_usb_host_midi to accept a timeout in its constructor that it passes to usb.core.Device.read(), and the USBTimeoutError is thrown once then a USBError is thrown.
Full gist here: https://gist.github.com/todbot/07a2ef16ec9ee83eb8980f8a128d660b
Tested on a Feather TFT ESP32-S2 with MAX3421E FeatherWing.
USBTimeoutError is thrown once then a USBError is thrown.
Ah, I see.
This may help with diagnosing #9226: it will tell us which site is unexpectedly failing after a first timed out transfer (which correctly raises USBTimeoutError)
This is probably not worth merging as is, as the NULL cases look like "this isn't supposed to happen" cases. It's just for diagnostic purposes, if someone wants to grab the artifacts.
The build in #9240 may be helpful for further diagnosis. I tried to mark each site in the source that might be throwing the USBError exception with a different string. so, what string is shown with the 2nd exception that "should have been" USBTimeoutError?
I'm curious if anyone has ideas on a name for this idea?
I started working on this utility over the weekend, I am in the very beginning stages so far.
I am envisioning it supporting these commands:
ls: list files and directories on the device optionally filter by the given directory or partial filepathrm: delete files and directories (with-r) on the deviceget: download files and directories from the device to the local computerput: upload files from the loc...
it would be nice if all workflows could be supported by a single library, which would be used by circup as well as by this new program that lets you ls/cp/rm individual files.
<@&356864093652516868> Reminder: Our community meeting is in 7 minutes or so. Please get any notes in you'd like me to read. Talk to you soon!
Will there be a live stream or recording?
Attached: 2 images
It's coming up real soon! My talk "Connecting Old to New with CircuitPython: Retrocomputer input devices on modern PCs" will be Sunday May 19th, 2024 1:45 p.m.-2:15 p.m. in Hall C.
No keyboards were harmed in the preparation of this talk. Preservation is important, and I only discuss "non-invasive", alteration-free techn...
@midnight ember pycon talks are posted later in the year, at least have been in past years
After a little bit of excitement discovering new bugs during the release, it’s done: 3.13.0 beta 1 is released, the 3.13 branch has been created, and features for 3.13 are frozen! The main branch is now 3.14.0a0. This is a beta preview of Python 3.13 Python 3.13 is still in development. This release, 3.13.0b1, is the first of four beta relea...
SOC_RMT_MEM_WORDS_PER_CHANNEL, which is used in PulseIn.c, varies per processor. However, on the ESP32, it is 64, and on ESP32-S3 and C6, it is 48. Not sure what to make of that, given your test results above.
uh oh no mic 😦
The struggle with pylint typing is real.
S2 can make multiple SSL connections now?
🙌
In EasyEDA open source hardware lab, open source square pools all kinds of electrical design engineerings together to realize resource sharing easily.
This file is part of the CircuitPython project, http://circuitpython.org/ Sees like a good line to me, I can't think of anything to change with that.
Reuse (which is run by pre-commit for us) validates those SPDX headers for us on library repos.
>>> math.acos(2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
```value error: 2 is not within the set of proper arguments for acos
```py
>>> math.abcdef
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'math' has no attribute 'abcdef'
```attribute error: there's no attribute (property) on the object with this name
Thank you for hosting @slender iron Have a wonderful week everyone!
Thanks
👋
Thanks!
Thanks for hosting Scott. Have a great week everyone 👋
Did you consider using dotclock support instead of the ra chip?
No... I thought a display of that size would require a bigger driver chip? 🤦
I don't think so. The ESP32-S3 should be able to do it directly via dotclock iirc
I would need to figure out the 40-pin connector directly to an MCU. With 100 pins wouldn't even know where to begin. Only reason I'm taking this approach is Lady Ada's RA8875 is a proven design.
I do like the idea of having the hardware accelerator for some uses too. It really is like 100x faster at drawing rectangles with the hardware accelerator.
I believe that
Ahh, thank you will look into that!
I believe the qualia boards 40-pin isn't compatible with the 7" display. I would still have to wire it from scratch or make a qualia-like board specifically for the 7" display.
They're both 40 pin but in different orders.
in the ra8875 product page There are other 40-pin displays that have different pinouts or backlight management and these may not work - they may even damage the driver or TFT if the boost converter pushes 24V into the display logic pins! For that reason, we only recommend the displays we've tested and sell here.
👍 It is good to check the pinout
yeah that particular combo doesn't seem to be compatible
yup that's where i'm going to right now to pull up a side by side schematic.
the great thing about standards 😕
can you post up next weeks notes doc so i can go ahead and give you an early hug report for your advice? 🤗
Please try it on something that wasn't working before, with the latest ConnectionManager library.
working on it 🙂
Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/19GmXK8VzVgchFclJTfG4C6ejqNsg9emYgCgpcv1PVZ4/edit?usp=sharing
yeah the dotclock qualia 40 pin is definitely different from the ra8875 40 pin. the 24V backlite pinouts are the same so it won't toast it with 24v thankfully but enough pins are different so that all communication would be broken. incompatible. will have to decide which route to take. i'll stick with the ra8875 for the hardware accelerators.
i've drawn a full 800x480 bmp on the display without hardware accelerators and it takes about 3 mins to draw. even though the s3 can dotclock it directly a display of that size would still be too slow for any appreciable use with displayio.
For a weather display that only updates every 15 minutes it's doable so it really depends on the usage. Because I only need slow redraws it's very tempting and I will likely design another PCB in the future to try it out.
I do have a project that wasn't working correctly before so I can definitely help beta test it.
The build in #9240 may be helpful for further diagnosis. I tried to mark each site in the source that might be throwing the USBError exception with a different string. so, what string is shown with the 2nd exception that "should have been" USBTimeoutError?
Thanks. I tried it the artifact from PR #9240 and the result is usb.core.USBError: tuh_edpt_xfer() failed after one usb.core.USBTimeoutError.
@tulip sleet what are your thoughts on this idea:
adding an empty class CPythonRadio: to connection manager, and then when passed in as a radio to get_radio_socketpool and get_radio_ssl_context it would return the native socket and ssl.create_default_context(), allowing connection manager to be used in CPython?
In terms of making examples run everyhwere, sounds like a fine idea, and it's small. Maybe CPythonNetwork, because it's not necessarily wifi.
100%
Ok, this makes sense. Thanks!
Generally I like the model of allocating the large chunk of memory outside of the object. That way you can reuse it in a different object if you really want to.
In the Python API, I would expose the indices though. Instead, make an iterator available to get the next value. Take a look at PulseIn for an example.
I'd also suggest adding this to a new module so we don't need to include it everywhere analogbufio is.
Any updates on this? This would be undoubtedly a significant feature to add... plus simple tensorflow lite models can run on most Adafruit boards.
Not from me. What are you looking to do with tensorflow lite specifically? I haven't seen any use that is really useful.
Wow, that's a huge change. Thank you for keeping this alive, and the (obviously huge) effort to make ESP32 boards have full BLE capability in CircuitPython! I know it's not ready yet, but it's not too early to say "THANK YOU!"
:-) Feel free to test it out. It isn't perfect but testing would be helpful. Note, it doesn't have bonding and pairing support so HID may not fully work with another device.
This board isn't made by Espressif so let's use the name on the board.
#define MICROPY_HW_BOARD_NAME "Freenove ESP32-WROVER-DEV-CAM"
Thanks for the board def. Let's not attribute this board to espressif at all. Instead let's add a separate creator id for freenove.
@Randall-Scharpf The easiest way for us to review what you've done is to make a pull request to this repo. That will show us a diff of changes that we can comment on. https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/create-your-pull-request
Thanks @elpekenin and @FoamyGuy for testing!
Ya, generally at this point you need internal debugging to let you know what the issue is.
Its been a little while since I wrote this code. I think my intent was to limit the maxlen to the amount the RMT peripheral can buffer. I didn't want to assume PSRAM was accessible when PulseIn was running. (Writing the filesystem will disable it temporarily.)
I think some RMTs can use multiple channels worth of memory if needed. That could improve things.
Note each RMT word stores two "pulses" one active and one inactive. That's why 64 words give a length of 128.
@tulip sleet do you want to take a stab at the asyncio microdot server stuff? I might be able to fix it
(if not)
I've been poking asyncio more with cpython
if you'd like, sure. I don't know if there's something missing internally that it needs (stream support or something), but the naming stuff seems pretty easy to fix
i am working on redoing headers and include guards at this very moment
I can take a stab at it tomorrow when I'm off and on
@dhalbert
Thanks for your comment.
This is a difficult area to understand for me, but I found an article that might be relevant. It seems that chips with the feature SOC_RMT_SUPPORT_RX_PINGPONG can handle more data than buffers.
I think we'll need @hathach to look into this because we try to abort the pending transfer when we reach the timeout: https://github.com/adafruit/circuitpython/blob/ca2a24e8d0f4dcc1b9e5fa28e029bf2ffad19dbc/shared-module/usb/core/Device.c#L201-L204
This should allow the subsequent call to work ok. It may be weird because our transaction is being NAKed by the device each SOF.
The USBTimeoutError is pyusb behavior it does here:
https://github.com/pyusb/pyusb/blob/4a433a5fddd6dcbc632454d53...
@short tendon this may be a place to use connectionmanager in asyncio: https://github.com/adafruit/Adafruit_CircuitPython_asyncio/issues/35
It sure looks like it
I can work on that this week
Do you know if they made it?
None of my boards say "Freenove" on them, except one that came with a robot dog I bought - the brand of which is Freenove. As far as I can tell, this is an espressif reference design, manufactured by a bunch of different places?
I've written to Freenove to ask them if they designed this or not - better to get the attribution correct than guess :-)
@slender iron remember how you made a comment during one of your recent Deep Dive streams about a patch-panel MIDI controller? I liked that idea and started planning some stuff out last week. Ordered some parts. Got some of them. Still waiting on others. Might need to order more. In the mean time, I've been planning out the software. Been taking some notes on github (patch-thing repo). If it goes well, I'll probably write up a guide on the new Playgrounds thing. Also possible I might be able to generalize some of it into a patch-panel module.
That sounds neat, I'd read that.
CircuitPython version
Adafruit CircuitPython 9.1.0-beta.1 on 2024-04-19; Adafruit Camera with ESP32S3
Code/REPL
import io
import os
import board
import espcamera
import wifi
import adafruit_requests
import adafruit_connection_manager
from adafruit_io.adafruit_io import IO_HTTP, AdafruitIO_RequestError
if input('Create espcmera object? (Y/N): ').upper() == 'Y':
cam = espcamera.Camera(
data_pins=board.CAMERA_DATA,
external_clo...
This was way to familiar, found a similar issue: https://github.com/adafruit/circuitpython/issues/8907
Best of luck with the talk 🙂 (would love to see any slides when you're able to share them.)
Enable the _eve module for espressif mcu.
CircuitPython version
# all since PR #9140
Code/REPL
while display.time_to_refresh() > 0:
time.sleep(display.time_to_refresh())
Behavior
endless loop
Description
In many of my programs I have the above conservative code snippet. Since PR #9140 this results in an endless loop, since the "fix" will always add 0.1.
When I change my code to
if display.time_to_refresh() > 0:
time.sleep(display.time_to_refresh())
I don't ha...
I would really like to see rsync (based on put and ls) as an additional command. This command should upload all files changed locally and (like the --delete option of rsync) remove files on the device that have been deleted locally. You could name it like you like, e.g. mirror, but the rshell-utility has this rsync command as well.
Regarding the name of the utility: I like wwshell as proposed by @dhalbert, since this puts the utility in the tradition of tools like rshell.
ah, abort xfer isn't implemented on max3421 just yet, though it should work with pio-usb. Let me try to reproduce and double check with the rp2040 first.
Thanks! I think that at some point a link to my slides will be added on the talk page, https://us.pycon.org/2024/schedule/presentation/15/ -- if not, I'll share them as a google doc after the conference.
To do this in general, do it in ports/espressif/mpconfigport.mk. Right now you've enabled it on some boards, but many are omitted. But it might not fit on some boards.
We have enabled this on certain boards by request, but it's not enabled by default in general.
The switch must be in the boards/[board_name]/mpconfigport.mk file because:
- Some boards are already equipped with a custom display (such as adafruit_feather_esp32s2_tft) without EVE chip, so user may not need _eve module there (Because _eve module only works with an EVE chip).
- Some boards fail to compile when the _eve module is enabled (Build CI jobs) due to an error: Too little flash (Such as [adafruit_feather_esp3...
ah, abort xfer isn't implemented on max3421 just yet, though it should work with pio-usb. Let me try to reproduce and double check with the rp2040 first.
I believe the RP2040 PIO host does implement about xfer. At least the above CircuitPython code works as expected on rp2040 and doesn’t throw the error.
I understand. How did you choose which boards to add _eve_ to?
I have selected all the boards from vendors: Adafruit, Arduino, Espressif, and AI-Thinker because these are development boards, allowing users to try them with an EVE module.
Thanks for the discussion. I've noted one board that is designed for driving other displays and shouldn't be on this list.
@tannewt how do you feel about this addition?
This board is already for driving a particular kind of display, so let's not add _eve to this.
thanks!
nice! let me look
I was thinking the 1/8th inch cables would carry uart signals that carry an id number
so it can work across "modules" and be plugged one to many as well
SproutSense soil sensor build. This has generic touchio.TouchIn enabled for testing, to see whether it will work or we need a special-purpose native module.
pins to note:
board.SENSORboard.EXCITATION: pin connected to 1M resistor that goes toboard.SENSOR
@tannewt how do you feel about this addition?
I'm happy to see eve enabled on espressif.
I agree with you that the enabling should be refactored into mpconfigport. The other thing to consider is whether it is on by default for future boards.
- Some boards are already equipped with a custom display (such as adafruit_feather_esp32s2_tft) without EVE chip, so user may not need _eve module there (Because _eve modul...
Feather nRF52840 Rev E has a new NEOPIXEL_POWER pin. Provide a pin definition and set up for control by status LED code.
Ok ... Per your PR comments, seems only ESP32-S3 is likely to work yet?
A couple of questions:
-
I searched both your source branch's Actions and the PR #9222 actions, but neither one appears to have proceeded to build. Where would be the place to pull build artifacts for ... (pulls out shelved project) ... an ESP32-S3 Reverse TFT board?
-
Should issues be filed at https://github.com/tannewt/circuitpython/issues instead of https://github.c...
#8907 was supposedly fixed by #8913, so not sure if it is related.
I have sort of a general Python question. (this in the context of PyUSB compatibilty that usb.core is doing that @slender iron & @onyx hinge were talking about in issue #9226): Are exceptions not "expensive" in Python? Are they more just an alternative return value?
My previous experience with exceptions in other languages is they're pretty expensive (blow stack frames, kill pipelining, etc) and meant to be used for substantive errors and not for expected logic flow. But in the underlying use case needed to make #9226 work, a try/except block will be in the core read() loop because most of the time usb.core.Device will be throwing timeout exceptions
raising an exception creates an exception object. The other parts are not all that expensive. The raising is done by nlr jumping usually
setting up a try block costs a bit
okay so it sounds like (Circuit)Python exceptions are not the 100x as expensive as return values like in C++ & Java
I would say not
return values are practically free, especially if the function is inlined
what costs is the if branch that checks for the error
i would say try a simple test of doing something simple that raises an exception over and over vs jsut returns. Check the timing and check the storage consumption with gc. Are you saying you are going to busy-wait on this with no delay?
The point of using the exception is to mimic pyusb, which I am not really familiar with.
The current implemention of usb.core.Device.read(), which mimics PyUSB, is to throw a timeout exception if a timeout is specified and there's nothing to read. There is usually nothing to read. Just like when waiting for UART read()s. But UART reads do not throw exceptions when there's nothing there
catching an exception involves checking its inheritance chain to see if it qualifies for the given except block, so if you have a lot of nested try-except blocks, things can get expensive
(and we usually want to use a timeout on the read so we can do otherthings with our code like read buttons, update display, etc)
so are you going to busy-wait on that?
no because we want to do other things in our code. otherwise the read() blocks
then if you are going to call read() say 10-100 times second, maybe it's not an issue
I agree that maybe pyusb's choice is not the greatest
This seems to be not an issue as much in PyUSB for whatever reason. I cannot find many examples that do reads-with-timeout to compare against
are you seeing a problem now, or is this a hypothetical?
right now the problem is the bug
it's a problem in that in #9226, the underlying max3421e driver appears to not implement read-with-timeout and the underlying TinyUSB call crashes. The PIO-USB host driver on RP2040 works as expected and throws the timeout exception. And that got me wondering if I'll be loading up another footgun and killing performance by doing read(timeout=0.001) like I do with UARTs, because I've been trained by decades of C++ & Java that exceptions are very expensive
I think the way to confirm or allay your fears is to do measurement. We don't think of exceptions as very expensive, and we don't go out of our way not to raise them. There is some philosophy about exceptions in Python: "easier to ask forgiveness than permission" https://stackoverflow.com/a/66792207/142996.
But using exceptions to substitute for normal return values is not great API design. I once designed an API like that when I first started using C++, and it was a mistake.
Thanks that's interesting. Since I came into Python mostly via CircuitPython, I'm missing some of this philosophy. I'm definitely going to make a little synthetic benchmark to see how how costly raises are vs returns too.
I made this synthetic benchmark: https://gist.github.com/todbot/6a3c8e5633a7267465775aa3afda99fd and the results on both CircuitPython and CPython are that exceptions cost about 33% more in time. In CircuitPython, where I can measure it, exceptions cost about 46% more in bytes.
Interesting results. If you do a gc.collect() when the run is done I think most of the memory difference will go away. You're seeing garbage that needs to be collected.
Originally, the only (non-debug) way to make an LFO calculate its value was to associate it with a playing synthesizer.
This posed a problem for LFOs that had "power on values" other than 0, and where the value was used other than to internally drive a note property.
Now, an initial, possibly non-zero value is calculated at object construction time:
>>> l = synthio.LFO(offset = 1)
>>> l.value
1.0
Note that this happens just once at construction; it does not happen wh...
yep
Feel free to make an "Unknown" creator id too. I just don't want to misattribute it.
I wonder if those allocations are costing cpu time too
@tulip sleet new header looks good to me too. I'd just double check that reuse is ok with it
Ok ... Per your PR comments, seems only ESP32-S3 is likely to work yet?
A couple of questions:
1. I searched both your source branch's Actions and the PR [Add ESP BLE GATT server support #9222](https://github.com/adafruit/circuitpython/pull/9222) actions, but neither one appears to have proceeded to build. Where would be the place to pull build artifacts for ... (pulls out shelved project) ... an [ESP32-S3 Reverse TFT](https://www.adafruit.com/product/5691) board?
I'l...
hmm... yeah, I've been wondering about how to deal with expansion to more patch points. The UART thing might work. Have you ever messed with 1-wire stuff? It might work to solder TO-92 or SOT-23 1-wire EEPROMs directly onto "output" jacks, and then use 1-wire scanning on "input" jacks (or vice versa). Seems like 1-wire EEPROMs are pretty cheap and relatively robust against ESD. Might save on a lot of soldering and GPIO pins. 1-wire parts have serials, the bus can handle multiple parts (e.g. piggyback cables or splitters), plus, the EEPROM would allow for custom tagging.
I'm not sure how it would work to do piggyback connections (n outputs to 1 input) with regular TTL async serial. To handle multiple patch points joined together, seems like you might need pullups with open-drain transceivers, plus some kind of protocol to handle contention and addressing? (e.g. 1-wire)
I'd only do one output to multiple inputs. I would do open drain to ensure no double output failures
I was thinking of using a cheap stm32 micro for output and input
then you'd read the input ids via i2c
and maybe set the output ids
I was thinking "per module"
i2c would be the backplane via stemma connectors
the trs would be just gnd and uart
I may be getting ahead of myself 🙂
oh, so kinda like how the attiny seesaw breakouts work? https://www.adafruit.com/product/5681
yup
I could see that. might work.
https://github.com/tannewt/StemmaG0 stm32s have i2c bootloaders in rom so I was going that way
is that the thing you were talking about in relation to some kind of dynamic compilation of IO coprocessing tasks?
Can't remember how you phrased it, but I think you mentioned the StemmaG0 thing in relation to build system stuff
ya, that's the hardware where a library would load the c binary onto it
the build system would theoretically make it easier to create those libraries
interesting. I'd been thinking of a small scale thing (<= 16 GPIO pins) where there would be maybe 8 outs, 8 ins, and you'd just raise one of the outs, scan the ins, then repeat that for each of the other outs.
It wouldn't expand well, but, you'd end up with a byte for each ouput, which would translate pretty nicely to sending as a MIDI CC value (sorta... only 7 bits to work with for MIDI CC)
For patch points, if you start getting into n:m mappings for n or m > 7, then it becomes potentially a lot more challenging to translate the graph of patch cables into something that can be represented as MIDI CC.
@tulip sleet tell me if this is too much.
I love tests. I love coverage. Many of the CP libraries can't really be tested without a lot of mocking.
For something like MiniMQTT, we could have the tests spin up a mqtt server and test most methods for real. Is this something that would be interesting?
Good call @tannewt ! They wrote back.
I'll convert this PR into a draft while I work fix all the ID codes and perform the re-naming of things.
Dear customer,
Thank you for choosing Freenove. We are fully responsible for any concerns.
The one with our logo on it is ours, which is the original design.
The ones without logo are counterfeit.
If you have any concerns, please feel free to contact us.
Have a great day!
Best regards,
Shaynee
Freenove Support Team
----...
I noticed there are two small typos in the parameters for the _bleio.Adapter.start_advertising() method. In the Parameters list, two lines had the parameter name and data type values switched. The data type should be listed after :param and before the parameter's name.
The two parameters are currently listed as:
- int (tx_power) – transmitter power while advertising in dBm
- Address (directed_to) – peer to advertise directly to
The data type should be in the parentheses, not t...
Update the description as this pull request should also close issue #9215.
@XenonFlits @dhalbert pull request #9236 approved so hopefully the new documentation is sufficient and this issue can be closed as well (?)
the board's v0.2 revision moved SDI (MISO) from GP24 to GP20 for the SPI0 bus.
there shouldn't be any backwards compatibility issues since on the rp2040 datasheet, table 2, GP24 can not be used for SPI0 (only SPI1) so SPI on any of the old revisions of the board is non-functional since all the other SPI pins ...
I think that's a fine idea. Consult with brentr about that maybe -- he might have suggestions about which server to use, etc.
@tulip sleet Tested ESP32-S2 Feather 4NR2 (no bme 280) with multiple sequential SSL connections successfully with the latest updates. Installed new 9.0.4 stable and 9.x bundle from today. Is there an open issue to confirm? I have one open for the S2 which can now be closed and I imagine a lot of S2 socket/SSL errors are now fixed. Very nice!
I closed https://github.com/adafruit/circuitpython/issues/9219. Which one did you have in mind?
I am glad this was a simple fix -- it wsn't something internal
The one I opened to track this issue is https://github.com/adafruit/circuitpython/issues/9115?
I think there are many S2 bug reports that will now be cleaned up.
This issue is now fixed as of 9.0.4 stable with 9.x bundle as of adafruit-circuitpython-bundle-9.x-mpy-20240514 The test script here finished flawlessly first attempt.
Will leave it up to you or Scott to close. You've earned it. Well done. 👏
S2 is back on the menu.
@michalpokusa Could you retry with the latest ConnectionManager library? Thanks. https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager/pull/16 has fixed several other issues that seem similar.
Could you retry with the latest ConnectionManager library? Thanks. https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager/pull/16 has fixed several other issues that seem similar.
@todbot sorry, I misread your above statement with rp2040 as ""it does not work with pio-usb as well". PR https://github.com/hathach/tinyusb/pull/2646 implements abort xfer for max3421e. It should work, please try it out to see if that work for you
@dhalbert My example code does not use ConnectionManager, adafruit_httpserver also does not use it.
The issue raises MemoryError on .accept() on SSLSocket object, I believe if anything, the CP's ssl or socket module might be related, not any Python code.
@michalpokusa Thanks. Currently when you call create_default_context() it creates an SSL context with all the root certificates loaded, etc., which uses up a lot of RAM. It may be that loading the server cert info pushes things over the top. I did some work on refactoring that, but I'm not sure it's going to help. There are also some ESP-IDF LWIP settings that could be changed.
In CPython, create_default_context() takes an optional argument that describes whether the context is going t...
Probably doesn't matter much her, but I had the smae problem on a different ESP32 board, and it was resolved by calling deinit() on the audio device before rebooting.
OK - got a new ID sorted for Freenove, and updated the name and ID in the relevant files.
@dhalbert Would it be possible to create a ssl context without loading the root certs? I understand it is necessary when we want to request website on public internet, but when creating a local server maybe it might be reasonable to use it with self-signed certs?
I may also be completely wrong about how this works, in that case please correct me.
Would it be possible to create a ssl context without loading the root certs?
Exactly, that's what might help here, if create_default_context() took the right arg. See purpose in the CPython version: https://docs.python.org/3/library/ssl.html#ssl.create_default_context. In the HTTPS server example, your certs are self-signed, and you don't need the regular root certs for the client of the server to connect. Is that right? Or, you only need one root cert.
Is it possible to customize the Bootloader section for devices on circuitpython.org page?
I've noticed some devices have different instructions for accessing bootloader (M5stack cardputer is press/release reset once, then press / release boot btn once. Double press reset does not work, and hold boot + press reset goes to ROM bootloader not UF2.). I'm pretty sure I've run across other devices like this before too, but don't recall which ones specifically.
I looked in https://raw.githubusercontent.com/adafruit/circuitpython-org/main/_board/m5stack_cardputer.md but the bootloader section content doesn't appear in here.
This looks good to me, I've done some basic testing and everything seems to work fine. I'm actually using the latest artifact in a project that allows me to snap a photo of the charge state of my solar batteries using adafruit.io. That allows me to turn on/off the inverter when I'm away from home depending on the charge state. I first tried using the Memento but ran into an issue so it was fortunate that this PR was in place :grin:
it's configurable by port right now (that's all mushed into the bootloader text file now), but I don't know that we've done it by board. There could be an include or something that came from the board directory. Sounds like an issue for the circuitpython-org repo.
This gets into how much doc to provide and where for third-party boards where the mfr is not doing support for CIrcuitPython.
I do agree it's tricky for 3rd party devices that don't use the defaults. I think it'd be great to at least have a mechanism that is a boolean "uses default bootloader behavior" flag that can be switched to false for ones that don't follow the norm so that the page at least won't contain incorrect instructions.
But having a way to for people to submit PRs that change or include updates to the text on a per board basis would be best IMO, then anyone who notices can submit a change with the correct info for that device.
@dhalbert I created my certs using:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout key.pem -out cert.pem
There is also a .load_verify_locations() method on SSLContext, but as CP's docs says, it is not implemented.
https://docs.circuitpython.org/en/latest/shared-bindings/ssl/index.html#ssl.SSLContext.load_verify_locations
NOTE - I think the above is not current. So can't use for actual pins. But still same comment about multiple PA01 entries.
Hi @hathach, thanks for the patch! It fixes the issue so now max3421e USB host mode behaves the same as usb_host.Port PIO USB host mode on RP2040.
To test, I make a local build of CircuitPython for adafruit_feather_esp32s2_tft incorporating this update to tinyusb and @jepler's labeled USBErrors. My test code now times out in the same manner as similar code using usb_host and does not error out.
I guess when CircuitPython updates TinyUSB next, this issue can be closed.
I didn't think so far as MIDI CC. I was mostly thinking synthio
One thing I can notice now though with the max3421e module: the minimum timeout passed to usb.core.Device.read() seems to be 100 milliseconds. Longer timeouts work, but shorter timeouts do not. Shorter timeouts are sort of critical for doing anything useful.
I think it is @ajmirsky. Thanks again!
Thanks for the testing @RetiredWizard and the PR @gitcnd
@devout jolt want to make a PR to update tinyusb?
What happens with shorter timeouts?
NTP lib:
sock.connect(self._socket_address)
sock.send(self._packet)
sock.recv_into(self._packet)
Adafruit CircuitPython 9.1.0-beta.1-25-g13ea06f1ae on 2024-05-15; Raspberry Pi Pico W with rp2040
code.py output:
struct_time(tm_year=2024, tm_mon=5, tm_mday=15, tm_hour=18, tm_min=41, tm_sec=14, tm_wday=2, tm_yday=136, tm_isdst=-1)
# etc...
yeah, if you wanted to do all the synthesis in CircuitPython, handling more patch points would probably be easier compared to MIDI CC. That, or perhaps using a network stack to send OSC messages. For me, the interesting thing would be to have a USB MIDI controller that lets me play with Faust or SuperCollider patches in a way that's more tactile.
thanks for the quick testing. I hadn't even gotten a board out yet.
The .send() was changed to sendto() just now in version 3.1.1 of the NTP library.
Do they have an API for setting patch connections?
Automated website update for release 9.1.0-beta.2 by Blinka.
New boards:
- adafruit_pixel_trinkey_m0
- adafruit_trrs_trinkey_m0
- ai-thinker-esp32-cam
- renode_cortex_m0plus
- spotpear_esp32c3_lcd_1_44
- waveshare_esp32_s3_lcd_1_28
- wemos_lolin32_lite
SuperCollider lets you write arbitrary code to implement event handlers for incoming CC messages. Faust is more about functional DSP data flows, so it lets you attach CC control channels to numeric UI elements (e.g. hslider), which you can then use in functional declarations to do whatever you want (subject to your ability to articulate what that is in functional style)
In my limited experience so far, playing with CC controls in Pd, Faust, and SuperCollider, implementing patchboard style functionality is not easy. The limiting factor for me is keeping straight in my head what's going on. For small numbers of controls, CC is convenient. But, particularly with Pd's graphical box and wire data flow stuff, things get really complex, really fast, as you start trying to scale up the number of controls.
I believe it!
My brain was thinking only about virtual eurorack sims where you could make physical equivalents of the front panel for hopefully less money than the original
back in a bit, going for a short walk
(back)
I think I'm gonna detour for a bit to try a breadboard prototype of a MIDI CC to synth patch thing
I have this tab open as a reminder to get back to it: https://jlcpcb.com/partdetail/ShouHan-PJ242/C431536
I've got a Feather M4 on hand. If I leave A0-A5, SCL, SDA, and 13 free, that gives me 6 pins on each side for making a tiny little breadboard and DuPont wire patch panel. I want to see if I can get something useful happening with a 6:6 routing matrix on the Feather talking MIDI CC to Pd or Faust.
@short tendon I upgraded my main project (feather weather) with 9.0.4 stable and uses minimqtt. Everything working fine so far. I do have a lot of error handling so I think that issue report is just a matter of the person not having error handlers. In an ideal world error handlers shouldn't be necessary because they're beyond the ability of beginners. That would be a nice goal to set. I would love to be able to rip out all error handling from my script and just have it work.
I can get it to manually republish by switching pages then back to the home screen. Confirmed it's publishing to AdafruitIO broker.
Quite possible. Just trying to get resolotion so we can close them out...
Yeah, just wanted to let you know there's no problems that cropped up with a known good working minimqtt script updating to 9.0.4 and latest connection manager.
What happens with shorter timeouts?
Any timeout less than 100ms results in a 100ms timeout.
What happens with shorter timeouts?
Any timeout less than 100ms results in a 100ms timeout.
Does it work correctly on RP2-PIO USB host? The timeout code is the same (but background tasks or timekeeping could be messing us up.)
PR Artifacts are here: https://github.com/adafruit/circuitpython/actions/runs/9103419532 Check the PR for the latest CI run too.
I've a similar problem.
We are using a i2S Adafruit microphone to acquire sound for a Raspi4B. We use arecord sentences according to the following link https://learn.adafruit.com/adafruit-i2s ... iring-test
We acquire audio signal every 3 seconds for instance, that is saves as a wavfile. The popping/clicking audio happens every start of the signal and sometimes also at the end.
I found some clues related with PWM of Raspi https://www.lightbluetouchpaper.org/201 ... pberry-pi/
Ther...
Ok ... dipping my toes into this uncharted space. Seems to at least boot on the ESP32-S3 Reverse TFT. No code loaded yet, and I have to re-acquaint myself with CircuitPython again. I hope to make steady (if slow) progress. Will update on the PR when I hit roadblocks or success milestones.
@slender iron I got a little breadboard patch-panel thing working. Code, wiring chart, Faust dsp patch, and preliminary documentation are up at https://github.com/samblenny/patch-thing/blob/main/notes/06_prototype/README.md
The code is a bit involved because I switch back and forth from everything pulled low (drain stray charge) to most the pins in high-z (avoid unintentional resistor networks making voltage dividers). I've got it wired up with 10k resistors on all the ins and outs as a cheap and dirty attempt of ESD and short protection. I think with the resistance that high, perhaps the capacitance of the DuPont wires and breadboard actually matter? Anyhow, the current code seems to work pretty well for mapping connections without glitching. Touching one end of the DuPont wire seems okay. Hooking up more than one input to the same output seems okay.
The Faust DSP patch doesn't do much other than just displaying the incoming CC values and using them to adjust the volume of some pink noise
...but, I think this breadboard circuit and code.py should be enough to enable some experimentation with better software synth patches that might hopefully kind-sorta resemble a modular synth setup.
For completeness, tested Pico W with SSL URL, no apparent regressions. Not sure if there was some other aspect of Pico W to test.
@anecdata pico w and w5100s (using this firmware, this latest adafruit_wiznet5k and [this latest](https://g...
@AndreasTheCat there are comments above about memory issues with Pico W + WIZnet. ESP32-S3 + WIZnet seems OK. Not sure about ESP32-S2. I don't know if Pico + WIZnet was explicitly tested... Pico should have more memory than Pico W. I'll try to set one up to replicate later.
Looks like jepler did test a WIZnet dev board (Pico + WIZnet):
https://github.com/adafruit/circuitpython/pull/8954#issuecomment-2077545160
So I suspect the issue is the extra memory on a Pico W taken up for wifi-related code. But I'll do some variations and add to this comment later. At the moment I'd say ESP32-S3 + WIZnet is the best combination... it can run native wifi + multiple WIZnet interfaces and multiple ESP32SPI (Airlift) interfaces simultaneously.
Nice! You are being more thorough than me
Addresses crashing in issue #9226 (and potentially many others, looks like tinyusb hasn't been updated in a while)?
The old version is 3 weeks old so not too bad. Thanks for the update!
oh good! I only did a quick search of previous PRs and thought the last was 0.16 (Nov 2023)
Bumps rexml from 3.2.5 to 3.2.8.
Release notes
Sourced from rexml's releases.
REXML 3.2.8 - 2024-05-16
Fixes
Suppressed a warning
REXML 3.2.7 - 2024-05-16
Improvements
Improve parse performance by using StringScanner.
GH-106
GH-107
GH-108
GH-109
GH-112
GH-113
GH-114
GH-115
GH-116
GH-117
GH-118
GH-119
GH-121
Patch by NAITOH Jun.
Improved parse performance when an attribute has many <s.
GH-124
Fixes
XPath: Fixed a b...
@devout jolt are you looking into the timeout issue?
CircuitPython version
Adafruit CircuitPython 9.1.0-beta.2 on 2024-05-15; LILYGO T-DECK with ESP32S3
Adafruit CircuitPython 9.0.4 on 2024-04-16; LILYGO T-DECK with ESP32S3
Adafruit CircuitPython 9.1.0-beta.2 on 2024-05-15; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Code/REPL
import board
from adafruit_bus_device.i2c_device import I2CDevice
# Featherwing TFT
import adafruit_ili9341
import fourwire
import displayio
spi = board.SPI()
c...
@slender iron how are you running an older vesion of uncrustify on Arch? Did you build it yourself? The ubuntu 24.04 version is too new (lots of config file changes). pybricks repo has no builds for 24.04.
I see there is an older version in an Arch archive. I may just build it myself. And will contact the pybricks maintainer.
What happens with shorter timeouts?
Any timeout less than 100ms results in a 100ms timeout.
Does it work correctly on RP2-PIO USB host? The timeout code is the same (but background tasks or timekeeping could be messing us up.)
Ignore my reported 100ms timeout error. The error was in the todbot (me), not the code.
Both the RP2 PIO USB Host (usb_host.Port) and the MAX3421E USB Host (max3421e) now heed a timeout in usb.core.Device.read(). Yay! With this and adding t...
I have the old version and don't upgrade. I'd love to update to a newer version (or switch to clang-format)
I just posted this: https://github.com/orgs/micropython/discussions/14496
for now I will just build it, I guess
oh wow, https://github.com/uncrustify/uncrustify doesn't even have tagged versions before 0.73
Does circup support installing .py versions of libraries? I cannot find anything about it.
I think it is --py
it definitely does
Oh my god, you are right, I didnt see the option under circup --help, but it is present under circupt install --help. I'm sorry, it's 1am where I am at. Maybe enough for today...
Thanks👍
And include custom instructions for M5Stack Cardputer.
Resolves: #1406
CircuitPython version
Adafruit CircuitPython 9.0.4 on 2024-04-16; LILYGO T-DECK with ESP32S3
Code/REPL
# Playgif
import sys
import supervisor
import board
import gifio
import bitmaptools
import displayio
import time
if 'DISPLAY' in dir(board):
display = board.DISPLAY
else:
try:
import framebufferio
import dotclockframebuffer
except:
import adafruit_ili9341
displayio.release_displays()
if ...
glad that works out, feel free to pin me whenever you need my help
@anecdata
simply amazing to see
`{
"args": {},
"headers": {
"Host": "httpbin.org",
"User-Agent": "Adafruit CircuitPython",
"X-Amzn-Trace-Id": "Root=1-6646e7c5-53d3c3926e38d67d4b0313a8"
},
"origin": "84.59.157.248",
"url": "https://httpbin.org/get"
}
41332 //<-gc.memfree()`
for the first time on pico w with w5100s.
Thank you so much 💯
Few fixes to enable internal camera and microphone:
- Add camera configuration in sdkconfig
- Enable at boot VDDCAM_3V3 power line (camera)
- Enable at bott VDDA_3V3 power line (microphone)
@tulip sleet do you have a rough idea on when CP 9.1.0 will release? I wanted to try to get the AttributeError/ValueError fixes in requests before it does so it would be frozen in
it's not imminent. I'd say at least a couple more weeks, and probably longer.
Implemented by #8954
The "Explorer Badge" is an RP2040 based CircuitPython board with integrated features to provide an all-in-one learning device.
The board includes:
- 1.54" ePaper display
- neopixels
- touch sensors
- accelerometer
- IR (receiver and emitter)
- I2C STEMMA-QT
- sound (both PWM and I2S support)
There is also a tutorial series associated with the Explore Badge to get users started with Python and then CircuitPython with the integrated hardware. The badge has been tested with the re...
@jepler, is this completed by #8954 ?
I think the CircuitPython core elements are in place for this, though it may need some changes in the ESP32SPI-related libraries. The native ssl module is only installed on certain boards though.
Tested config:
- UnexpectedMaker FeatherS3
Adafruit CircuitPython 9.1.0-beta.2 on 2024-05-15; FeatherS3 with ESP32S3 - Adafruit Airlift FeatherWing (NINA v1.7.1)
This code simulates an HTTPS Request over ESP3...
Tried a version where all the async functions except async_monitor_fault & async_monitor_current had their while(True) loops flipped to False so they'd exit and still saw crashes fairly quick. So I removed them and this version of the code takes 4-5 days to crash:
import time
import board
import busio
import supervisor
from digitalio import DigitalInOut, Direction, Pull
from pwmio import PWMOut
from adafruit_motor import motor as Motor
import gc
import rtc
import di...
@slender iron - I committed the change. Do I need to resubmit the PR?
nope, if you commit through the UI then it'll update
PR's track the state of a branch
- Find files that are CircuitPython-specific and change their headers to say they are part of the the CircuitPython project, not the MicroPython project. This helps distinguish upstream files that we use vs. files of our own. This change was discussed with the MicroPython folks. The new language is
This file is part of the CircuitPython project: https://circuitpython.org. - Change copyright and license lines to be SPDX-compliant. General format tested with
reuse lint. There are still man...
I think the CircuitPython core elements are now in place for this, but it needs some changes in the ESP32SPI-related libraries (and possibly NINA) to make the ESP32 sockets compatible. There's a compatibility checklist in #8954. The native ssl module is only installed on certain boards though.
Tested config:
- UnexpectedMaker FeatherS3 `Adafruit Circuit...
Is this lib/tinyusb submodule change a regression? I thought it was bumped forward in another PR.
Just some other questions. I did not test. I will put the "this and that don't work" in the release notes. When this is merged, could you add issues addressing the ports that don't work? Thanks.
Does libmesh.a have anything to do with ESP-NOW support? What is libwapi.a for ?
(I just don't know. I tried a websearch but didn't find an answer.)
What is the use case for not always having MYNEWT_VAL(BLE_EXT_ADV) turned on?
Looks like we'd need https://github.com/fsfe/reuse-tool/issues/512 fixed in order to run reuse over our files.
Looks good to me! I looked what files were changed and also at the changing script. We'll likely need to do a subsequent pass as we merge in other PRs.
@tulip sleet want me to merge your change? it looks ok to me
We'll likely need to do a subsequent pass as we merge in other PRs.
I will definitely do that.
Looks like we'd need fsfe/reuse-tool#512 fixed in order to run reuse over our files.
Yup, I first tested by copying files and LICENSES/* into a temp directory and specifying that as --root-dir. Later I did a little more testing (not of the whole tree at all) just by ignoring some of the errors.
I was just eating dinner. I just merged. I'll update your files in another PR. I have a simple way of checking for files that need updating.
Is this lib/tinyusb submodule change a regression? I thought it was bumped forward in another PR.
This bumps it further add definitions for the C2.
Just some other questions. I did not test. I will put the "this and that don't work" in the release notes. When this is merged, could you add issues addressing the ports that don't work? Thanks.
I'm not sure what you mean by this. I hope it all works but I expect folks to find issues.
The ESP32 doesn't support BLE 5 so it doesn't support extended advertisements.
I don't actually know either. I just know the H2 doesn't have them available.
I'm not sure what you mean by this. I hope it all works but I expect folks to find issues.
I meant what you said in the first post:
Connecting hangs on C6. C2 runs out of memory with wifi on. C3 is untested. ESP32 crashes with watchdog timeout.
C2 is not surprising. So C6 and ESP32 needs some fixing, and C3 needs to be tested.
Ah! I think C6 and ESP32 are fixed.RAM may still be an issue but we'll see.
I don't have time to set this up and test it but just for background GIF_playFrame will return 1 for good more frames, 0 for good no more frames, or -1 for an error.
But quickly looking I'm not 100% sure the code will work exactly or you may get 0 at times.
Based on the fact you could re-save the GIF and that version works maybe a type of GIF the library does not handle and poor error handling in OnDiskGif (oops). Exposing GIF_Reset may also have some value in case of errors.
This board seems identical to https://circuitpython.org/board/makergo_esp32c3_supermini/
@toaster-robotics Try that and see how it works. I am not sure which board is the "clone" here and which is the "original".
Tried on an UM FeatherS2, worked as expected.
This board was submitted first, but it seemed like work on it had stalled before getting the checks to pass, so I submitted the work I had done for the MakerGo version of the board, which was functional and passed checks to get merged.
Should be ready to merge now - the PR for the new IDs is https://github.com/creationid/creators/pull/69
Then I'll just close this, unless there is some difference between the boards.
Thanks, and @gamblor21, thanks for testing!
Here is a website definition for the just-merged ESP32-Cam from here: https://github.com/adafruit/circuitpython/pull/9231
I followed the guide at this URL:
As best I can tell, the "check-boards.py" code is broken - even after I made sure my board doesn't list any unknown features, the code still dies with "key errors"...
It might be worth adding and enforcing a rule about what the .md file is supposed to be called (and documenting that).
The following boards exist, but do not have .md files for them:-
- adafruit_feather_rp2040_rfm
- crcibernetica-ideaboard
- devkit_xg24_brd2601b
- explorerkit_xg24_brd2703a
- flipperzero_wifi_dev
- heiafr_picomo_v2
- renode_cortex_m0plus
- sparkfun_thingplus_matter_mgm240p_brd2704a
- wemos_lolin32_lite
The following .md files do not have any corresponding circ...
This section:-
board_id
This should be the name of the board for example "feather_m4_express".
probably needs expanding to explain what "board_id" means, and the purpose of this - as best I can tell, this is the name of the folder that the board firmware definition files live in ? and I think it's probably used as a name inside some website build process the generates the firmware binaries, so this line tells the website which firmware goes with the board, right?
Anyone able to shed light on what might be causing this build-check fail? https://github.com/adafruit/circuitpython-org/actions/runs/9137944914/job/25128516373?pr=1408 - is it me, or is the build system broken ?
I think it might be because you have an extra blank line in your YAML header: https://github.com/adafruit/circuitpython-org/pull/1408/files#diff-2e836a8a0947572aa502a38586111cfcc2f7a4e19d9aa5627b9d4c90ca9fdf39R17
Possibly not - the template we're told to copy from, "unknown.md", and many other boards also do as well?
I only checked a few but they ones I saw didn't have it
Ah, there is another one that has it https://github.com/adafruit/circuitpython-org/blob/main/_board/raspberrypi_pi4b.md?plain=1
Yup - failed despite fixing that.
Any idea how/where I can look at the code that's running that check? Someplace there must be defined a file of acceptable features, but I can't find it...
This is the code that is failing: https://github.com/adafruit/circuitpython-org/blob/main/tools/check-boards.py
Do you need to have 2 spaces before each - in the list of board URLs?
Thanks for the clues... I Found it: - I forgot to close the quote on the end of the board name: name: "Ai Thinker ESP32-CAM
Aha
It's so easy to miss stuff like that
I once spent the better part of a day chasing down a :/; typo
Oh yeah, also it looks like the other files in that directory are named with _ but yours is with -
https://github.com/mydana/CircuitPython_DMX_Receiver
It's still a bit buggy, but I'd love feedback.
I agonized over the _ or - issue myself; all the other ai-thinker boards use hyphens in their build folder names, and most places online do that as well, so that's what I picked; but yes - I did (later) notice that most of the other ports don't do that.
Thanks! This info will be helpful when I get a chance to take another look.
in general we would prefer underscores, all lower case, mfr name first
when I review PR's, if I notice, I steer people in that direction
CircuitPython version
adafruit-circuitpython-raspberry_pi_pico-en_GB-9.0.4
Code/REPL
import time
import board
import touchio
import usb_midi
import adafruit_midi
from adafruit_midi.note_on import NoteOn
from adafruit_midi.note_off import NoteOff
# Define the touch pins
touch_pins = [board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6, board.GP7, board.GP8, board.GP9, board.GP10, board.GP11, board.GP12, board.GP13, board.GP1...
The mpy format changed with version 9. Did you update to the version 9 bundle? circup update
@tulip sleet can I lower the pystack value to cause it to error?
Let’s wait and see what the person with the issue says about reproducing.
Hi again! Question for y'all: I'm working on adding this board, an ESP32-S3, and I'm unsure about the USB PID/VID thing - I've requested one from espressif in the past and understand that process, but is that needed for this specific board? The reason I ask is because the board doesn't have a typical USB port, however I believe native USB is still supported when using the usb add-on. From the factory it uses a vid/pid of 303a:1001, which is a generic ESP32 identifier. Should I still request a fresh one from espressif for circuitpython?
For custom board definitions, it’s going to require a VID/PID unique to it.
Hey, wondering if y'all have a feeling for which CP ports have the most users, vs. ones that are less active? Want to focus on where the action is
Last statistic I saw was the RPi Pico (RP2040) had the most downloads
Not sure about least though
Are those stats accessible somewhere?
I’m not certain, I think Scott pulled them from aws or the circuitpython.org backend
I believe the list at https://circuitpython.org/downloads is displayed in order of download popularity, and I thought there was a repo for the circuitpython.org website (which might have the script or data to sort that list), but I can't find it right now
Just me or does that ribbon cable look like it's going right on top of the S3? With such a tiny board, the S3 might melt that cable. Looks like they assembled the ribbon connector backwards. :/
I believe it is sorted by download count: https://github.com/adafruit/circuitpython-org/blob/main/downloads.html#L96
I did not. Mark this one down as user error. Thank you!
@urban knoll @ornate breach @devout jolt @midnight ember Yes, the boards are sorted by download count. The download counts are in here: https://github.com/adafruit/circuitpython-org/blob/main/_data/files.json. When a release is made, we generate download counts by doing a query on the AWS download logs. The release CI script generates a automated PR to circuitpython-org with zero downloads. Then we (usually I) run a small script that updates the download counts, push that commit, and merge the release PR.
Right now the query counts 8.x and 9.x releases. As the releases progress, I change the query slightly. I also clean up the logs from time to time. I think it's 2023-present right now.
Ah, handy, thanks
@danh thanks for the data. Here's what it looks like.
I do have some questions though, for instance how does it make sense that there are over 3000 downloads for https://circuitpython.org/board/trinket_m0_haxpress/?
bots
Yeah probably can't read much into any but the big numbers. There's a very long tail
yes, don't take this as anything all that indicative of popularity
Hey I don’t download the haxpress UF2 that much
Great chart! I’m pleasantly surprised to see nRF so high
I have been doing some benchmarking and the slowness of PWM setting immediately popped out. Looks like it is a known issue which still need to be fixed? And is there any background on if/how the SAMD PWM peripheral is different from e.g. the RP2040's, which requires setting it to be handled differently?
- Add
#pragma onceto any CircuitPython-specific files that didn't have existing#includeguards. - Convert all CircuitPython-specific include files to use
#pragma onceinstead of regular#include guards.
I was greatly aided in this by the https://github.com/cgmb/guardonce tool
#9257 had previously marked all CircuitPython-specific .c and .h files in their headers. I then applied this recipe:
# Add #pragma once to any .h files that didn't have it or regular
ag --hh ...
@crimson ferry when you have a moment, I would be curious your thoughts on this: https://gist.github.com/justmobilize/f236f332fa798fce520d01154b624f5e
I haven't fully tested it, but threw this together as a thought I've had in the back of my head.
one could just:
radio = get_radio()
pool = adafruit_connection_manager.get_radio_socketpool(radio)
ssl_context = adafruit_connection_manager.get_radio_ssl_context(radio)
requests = adafruit_requests.Session(pool, ssl_context)
And not need to think about anything else.
It defaults to FeatherWing pins, but one could set then real pins in settings.toml...
Regardless, I'm going to finish it up and use it (it's from a few helpers I already use)
@short tendon Looks nice, helps to encapsulate the often-messy non-native radio setup. Are you envisioning (people) using old versions of ESP32SPI (there's a bit of code associated with those conditionals)? But yeah, pins get to be the tricky part for ESP32SPI and Ethernet, with so many form factors for those peripherals.
You and I already talked about the idea of WIZnet init not requiring a network connection, so that could obviate all the connect_needed checks, and connect then happens regardless of radio type.
And if we design each connect() to be negligible processing time if already connected (like for native wifi), there's not a lot of need for some of that checking.
Some of the other init kwargs add complexity too for some projects... MAC address, static IP, DHCP, debug, etc.
So, I thought about requiring CP9.1.0, because until that's released the esp32spi frozen library doesn't have them (and I've been doing a lot of pyportal help...).
Right now, this is very much a draft/proof of concept and will get cleaned up.
Ideally I'd like to require/warn for an old Nina firmware as well
It might be worth bringing up / drafting a PR for the wiznet. Although it isn't frozen, getting it closer (if people are good with that) would be good.
right, forgot about the frozen thing
But the release should happen eventually... 😉
I can open an issue on WIZnet, not sure about getting into the weeds on DHCP and all that... that library is kinda scary to me
if you get bored, you should look over the issues I help with on #help-with-wippersnapper-and-adafruitio
I'm happy to tackle the PR if I get a thumbs up
I do lightly scan that channel, but don't use those services so don't usually have much to add
There "bug" we found makes me want to cry
do you remember where we talked about wiznet "connection"?
found it #circuitpython-dev message
Dang, was just about to share that
just glancing at the library, maybe it's just set_dhcp(), and if that's the case we have it now... call the init with is_dhcp=False, then user code calls set_dhcp() ...maybe?
I can test it out tomorrow
See #9243 if you have not looked at it already.
@short tendon I think it's already baked in...py radio = WIZNET5K(spi, cs, reset=rst, is_dhcp=False) radio.set_dhcp() this works if the cable is connected, doesn't fail until radio.set_dhcp() if the cable is unconnected (ConnectionError: The Ethernet connection is down)
but maybe a connect() alias for consistency, and .connected and .ipv4_address
Also, if there isn't a cable connected, you would get a 5 second delay here, wouldn't you?
https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/blob/main/adafruit_wiznet5k/adafruit_wiznet5k.py#L251
oh yeah, but does it really take 5 seconds to detect link, that seems like a lot