#circuitpython-dev
1 messages ยท Page 21 of 1
@tulip sleet it looks like latest version of thonny handles the escape stuff OK now? ip addr shows up in window banner, etc
which is latest version? 4.0.0 handled it at least to the extend of discarding it; I can' tremember if it showed up in the window banner
I did say that it works ok in one or more guides or the release notes.
so new screenshots is better anyway, for that reason too.
sounds good
current guide is for old version. output ended up in window text, not banner
yep. also changing guide text.
fyi - the snake emoji is a potential source of grief. getting some Tk related dumps
crashes, you mean?
X Error of failed request: BadLength (poly request too large or internal Xlib length error)
yep
don't have time to go down that rabbit hole
ugh, which tool is throwing that?
working around it for now
happens when launching thonny
with board running web workflow connected
disable web work and it launches ok
some googling error points to color emoji support issue in Tk
i didn't know thonny used tk
@tidal kiln what are the details of your linux distribution (ubuntu version etc)
@onyx hinge 20.04.5 LTS
found that same nominal solution. but also some two comments later that say "did not work for me"etc.
i'm getting thonny running enough for screen caps
so just punching thru for now
with any luck it doesn't affect win/mac users
did you try thonny on windows?
nope. would have to dig out the windows tester box.
ah, I thought your putty screenshots were windows
i think limor contributed the windows stuff
yah - it could just be me. most likely is.
and probably fixable. but just don't want blindly start sudo apt installing stuff. for now.
whenever you get around to upgrading...
on debian stable I get a black & white snake in a simple test program, don't have thonny and a board handy to test with.
yah. i'm weird. i generally don't upgrade. instead i'll do a clean install with latest. and work forward from there.
very much not efficient. but upgrades always seem to only 90% work.
I just buy a new computer and put it next to all the old computers. less downtime.
i did too. backed up my homedir, clean install, and put back homedir. I think I removed .gconf and redid all the desktop customizations
yep. or that.
in thonny I get a rectangle instead of a snake
on debian stable
but I don't really care/mind
Tested the example code with an ESP32 ( Adafruit Feather HUZZAH32) and was able to consistently handle pulses > 65K.
@tulip sleet screenshots updated. please take a look.
Looks great! I deleted the orange warning alerts as I checked each page.
thankyouverymuch
Just thinking out load here. Could it be that we are only using SPI and not QSPI that allows the block to work on our boards....
Just thinking out load here. Could it be that we are only using SPI and not QSPI that allows the block to work on our boards....
It is possible, we're not at all sure why we don't see SPI SCK on SPIM3 when VBUS is not powered. But I'm not sure the other folks in DevZone were using QSPI at the time.
Did you choose SPI instead of QSPI so you would have more pins for other uses?
I never tested with this repro code so I'm not sure. I didn't see any issues with my (different) tests.
@jepler I will close this since the underlying modules are so different now. If you'd like to retest with a new trial, that'd be great, and we can start a new issue if necessary.
Win 10 no CIRCUITPY folder:
https://forums.adafruit.com/viewtopic.php?t=197195
can see folder contents. just no CIRCUITPY. and Mu cant connect.
nothing in troubleshooting helps.
so it's just the wrong name, that can happen with a corrupted drive, if they can't access the REPL they can still put the erase code in code.py, it should execute
or.. just do it from the repl..
far quicker honestly
unplugging stuff abruptly in windows is a recipe for disaster
i doubt they'll be able to figure out accessing repl in their situation
it should still work by pressing "Serial"
nuke.uf2 ?
so just ignore the "cant find" pop up in Mu?
there should be an erase for the Feather M0 Express
I always get the message that Mu can't find the board because I never name my drives "CIRCUITPY"
but the Serial button works
(I don't use Mu for editing, only for testing Mu stuff)
by the way, I have not been on the forums since september because I discovered my company registration situation was wrong, and it took that long to figure out the problem, I should be back soon
used mu for transferring stuff to micropy
the reason I stopped using micropy
the nukes are good too. just that theyre specific and there never seems to be the exact one you need for a given situation. or a decoder for what alts work for what boards etc.
A kind user in another issue pointed me to this S3 I2C fix: https://github.com/espressif/esp-idf/issues/9777#issuecomment-1359582249. I'll test this soon.
the toml library is coming out nicely, reading (with subtables) is done
I just need to test it lots
CircuitPython version
New bug on ESP32-S3 related to deep sleep fix on 8.0.0 Beta 6. When I run the code shown below with the ESP32-S3 Feather NO PSRAM, connected to the USB for Power using MU, all works fine. Light Sleep and Deep Sleep perform as expected. When I run off of Battery Alone, then the feather goes into Light Sleep, followed by Deep Sleep (Both work fine on First Pass). On second and following passes then Light Sleep awakens after about 0.005 seconds and Deep Sleep...
We hope 8.0.0 will be out sometime in January. Using this is the most useful for boards without USB MSC support. So I see no reason to spend time on support for 7.x.
Instead of supporting only .bin on UF2-capable boards, how about also (or instead!) adding support to erase everything and install the UF2 bootloader (i.e., do a "factory reset")? Once the bootloader is installed, then regular UF2 uploads will work.
Ok, good input. By the time this is completed, 8 might be out, so the 7.x question is probably moot.
Instead of supporting only .bin on UF2-capable boards, how about also (or instead!) adding support to erase everything and install the UF2 bootloader (i.e., do a "factory reset")? Once the bootloader is installed, then regular UF2 uploads will work.
Ok, makes sense. I'm not sure if copying the uf2 file itself is very easy at this point (it probably is doable somehow), but I'll just all...
@jaunty juniper fs clean up fixed it. thanks for pointing out that mu could still access repl despite the warning dialog.
https://forums.adafruit.com/memberlist.php?mode=viewprofile&u=515426
yeah that dialog means it didn't find CIRCUITPY. There is a tentative PR to find the drives with other names by looking for boot_out.txt, though i'm afraid I killed it by noting that reading boot_out.txt can cause autoreload (if that causes the "access time" to be updated, which can happen)
(discotool can find the drives but they find it has too heavy dependencies)
CircuitPython version
Adafruit CircuitPython 7.2.0 on 2022-02-24; Raspberry Pi Pico with rp2040
Code/REPL
from ulab import numpy as np
new_poses = np.array([
[924.881, 311.124, 241.301],
[1386.19, 520.113, 338.311],
[40.5783, 94.9179, 193.41],
[8.8905, 1079.85, 251.301],
[1171.92, 619.98, 74.1977],
[629.102, 1447.75, 127.651],
[575.871, 719.038, 225.301],
[525.669, 501.781, 42.1525],
[699.721, 1331.84, 33.3177],
[1...
Testing on Grand Central M4. CircuitPython crashes quickly, after only a few seconds. It looks like it's due to a CIRCUITPY read request via USB. Backtrace, showing a memory error causing a hard fault when trying to read QSPI data.
#0 reset_into_safe_mode (reason=HARD_CRASH) at ../../supervisor/shared/safe_mode.c:122
#1 0x000077b4 in HardFault_Handler () at supervisor/port.c:723
#2 <signal handler called>
#3 memcpy (dst=0x20001968 <_mscd_buf.lto_priv.0>, src=src@entry=0x23fefe0...
I have seen many people asking how to find out whether a wifi.Radio connection is up or not. The method usually described is to try to fetch the current IP address. If that fails, the connection is not up.
I think more straightforward boolean properties would be helpful in the API, even if they are bit redundant.
Station mode
Existing API
wifi.Radio.connect(): connects to a specified network as a Station.wifi.Radio.start_station(): start running as a Station.
-...
I like wifi.Radio.connected, it's direct and reflextive of connect(). The start/stop station are under-the-hood things that most people probably don't use, but in station (and moreso in AP mode) they can be useful to change modes and change some properties before starting the mode back up.
Maybe started for AP since start is the verb?
Heads up @v923z - the "ulab" label was applied to this issue.
@v923z I can verify there's something odd going on. I built current ulab for micropython with the built.sh script then ran this simplified reproducer:
from ulab import numpy as np
new_poses = np.array([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9],
], dtype=np.float)
identity = np.vectorize(lambda n: n)
intermediate = new_poses[:,2]
output = identity(intermediate)
output2 = np.array([n for n in intermediate])
print("With vectorize:", repr(output.tolist()))
print("With ...
Thanks for raising the issue. I see that this is a fundamental problem, so I'll try to roll out a speedy fix.
I've built this PR and run my basic testing suite and everything seems fine. The additional flash storage is available so I'd say all is good.
However... there are two variants of this board, a 4MB and 16MB. I don't have the 16MB to test but I suspect replacing the EXTERNAL_FLASH_DEVICES parameter in mpconfigboard.mk with a value of "W25Q128JVxQ" would make this PR work for the 16MB version instead.
My question is how do we handle the different flash size variants?
I decided to take the approach of using the code from the WipperSnapper Firmware Uploader and adapting it to work on this site, which I think will be the quickest way to get it up and running. So far things are moving along nicely.
Any update on making this non-blocking per the OP?
Fix for issue #7352. Since pulsein values are defined as 16-bit across all boards, put in a check for Espressif boards. When a pulse exceeds 65535 to set it to 65535 (max value of 16 bits).
@anecdata thanks for the comments. If we were starting from scratch, the API might be more symmetric, but I would not be inclined to change that now.
Maybe
startedfor AP sincestart()is the verb?
It looks to me like the CYW43 can be in an intermediate state where the AP has "started to start" but there is no IP yet. I'm thinking ap_started() may not mean "ap ready right now". So I think "ap active" or "ap up" might make it clearer that it's up and ready to use.
I also like the wifi.radio.connected option, although, I'd offer a suggested change to wifi.radio.is_connected since adafruit_esp32spi.ESP_SPIcontrol already uses that key word.
Any updates on this?
I just saw circuitpython:main branch is 16762 commits ahead, 1401 commits behind micropython:master.
Is CircuitPython periodically updated/rebased with upstream MicroPython? Or has it changed too much for it to become viable and just some fixes are cherry-picked as needed?
we are on MP 1.18, CP 9 should pull latest MP
we mostly share the core language implementation, and the process of updating does involve some cherry picking
Honestly it will be pretty hard to top off 8.x in terms of features
Oh Cool.
@Anutrix everything should be fixed. The review is the only thing that needs to be done for it to be merged I believe.
You'll need to delete the files for the old name (using git rm).
Thanks! Please make a PR to https://github.com/adafruit/[circuitpython-org](https://github.com/adafruit/circuitpython-org) if you have not already done so.
ESP32Sx BLE would do it.
that could be in CP 8.x
Hi, did you get the USB_PID from Raspberry Pi? I don't see it in the list here: https://github.com/raspberrypi/usb-pid/blob/main/Readme.md
@dhalbert good catch! Let me check in with raspberry pi re: the PID. I'll give you a ping when I get it resolved. Thanks!
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Pimoroni Tiny 2040 (2MB) with rp2040
Code/REPL
async def catch_interrupt(pin):
"""Print a message when pin goes low."""
with countio.Counter(pin) as interrupt:
while True:
if interrupt.count > 0:
interrupt.count = 0
print("interrupted!")
# Let another task run.
await asyncio.sleep(0)
async ...
Hi, countio is not technically an interrupt module, it counts edges. On RP2040 it uses PWM for that, and due to hardware limitations it requires a pin on a PWM channel B. Unfortunately the pico Learn Guide doesn't list which pins are valid for that, which could be a good addition. (The information can be found in the RP2040 datasheet section 4.5.2).
As it turns out it's odd number pins.
To monitor a pin, I would rather advise using the keypad module, which regularly scans pins in the ...
Hi, I've just raised a PR on Adafruit_CircuitPython_Wiznet5k to match Wiznet sockets to CPython sockets. There's lots more to do, but it would be helpful to merge some of the outstanding open PRs before continuing. All reviews gratefully received
Thank you!
I changed Circuitpython version as below.
Adafruit CircuitPython 8.0.0-beta.6-4-g0d3b7770d on 2022-12-25; M5Stack Atom Lite with ESP32
Max pulse length 65535usec. Works for what I use.
But, Pulse counts are too few.
Pulse count is same as last time (128) .
pulses sum: 150552 pulse count: 128 Max: 65535
pulses:
[3486, 1716, 465, 408, 465, 408, 468, 1275, 468, 1278, 465, 408, 465, 1278, 468, 405, 465, 408, 465, 408, 465, 1278, 468, 408, 462, 408, 465, 1278, 465, 408, 465, 1278, 46...
I want a wifi function for analyzing the ir remote signal of the air conditioner, so I'm considering introducing a raspberry pi pico w.
@musimasami Does the fix work to fix your #7352 issue?
I will close this issue.
When I need to read a lot of pulses, I propose a new issue.
@craggy plume Re: trying to build Circuitpython in a Ubuntu VM.
Which board are you trying to build? At which point does the build fail?
@dhalbert Gordon from Raspberry Pi confirmed USB_PID = 0x1048 and that the table will be updated soon. I've updated the PR with the correct PID.
All makes sense. Iโd be fine with closing this issue then unless it would be more useful as a documentation issue. Thank you all.
I agree we could say something about the pin restrictions in the ReadTheDocs documentation. Turning this into a doc issue.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; ProS3 with ESP32S3
(Using latest U2F version with latest bootloader)
Code/REPL
`settings.toml`
CIRCUITPY_WIFI_SSID="GBD-TPLINK-Ext-2.4GHz"
CIRCUITPY_WIFI_PASSWORD="secretpassword"
CIRCUITPY_WEB_API_PASSWORD="password"
CIRCUITPY_WEB_API_PORT=3000
### Behavior
It looks as if CIRCUITPY_WEB_API_PORT is being ignored.
The webapi works but it just defaults to port 80 ever...
As a note about quickly finding GPIO capabilities on the Pico, I really like https://pico.pinout.xyz/ with the โAdvancedโ box ticked
The settings.toml parser did not handle a file that ended without a trailing newline. When such a file was encountered, retrieving the value on the last line would result in the error Invalid byte 'EOF'. For values fetched automatically e.g., by web workflow this message could not be shown.
However, such files are (A) frequently produced by text editors that folks actually use and (B) are specifically permitted by the TOML spec. (so my pedantic objection that (C) such files are not valid...
Just a reminder, there's no meeting today or this week. We'll get together with all <@&356864093652516868> next year on January 3 (Tuesday) at the usual time.
Did not test but that's what your tests are for.
Could you use %S for that case in another PR where you made an error message into a QSTR?
Is there a guide on how to use the updated adafruit_httpserver?
The api has severly changed and I need to reimplement my stuff with it.
Cause I mean,
https://docs.circuitpython.org/projects/httpserver/en/latest/api.html
really isn't helping when we cant get passed imports..
>>> dir(adafruit_httpserver.methods)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'methods'
better doc would be welcome; the examples have been reworked (I think) and may be a reasonable starting point
Alright I will refer the examples, thanks!
As to if I will manage to improve the docs, idk, but I will try.
that's because it's a submodule:
>>> import adafruit_httpserver.methods
>>> dir(adafruit_httpserver.methods)
['__class__', '__name__', '__file__', 'HTTPMethod']
@grbd if you can test with an artifact from this PR and let us know if the issue is fixed for you, that'd be helpful. Otherwise we'll probably merge it in the next day or so if we don't hear from you.
I just tried testing by adding a couple of newlines and comments at the bottom of settings.toml
but that didn't seem to fix it.
I'll have a go with the S3 daily firmware build once it hits there to see if it works
OK, I may be wrong about the cause then. I tested with a Pico W, perhaps there's a unique problem for esp32-s3 too.
CircuitPython version
Both
Adafruit CircuitPython 7.3.3 on 2022-08-29; ProS3 with ESP32S3
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; ProS3 with ESP32S3
Code/REPL
Hi,
I'm not sure if this is a circuitpython issue or something related to the esp-idf that circuitpython is using
But I recently ran into a problem similar to this one
* https://github.com/adafruit/circuitpython/issues/4373
From what I can tell if there's multiple stations avail...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6
Adafruit Matrix Portal M4
Nina FW 1.7.4
Adafruit Protomatter v1.5.2
Code/REPL
#include
#include
// It is enough to include the Protomatter library for things to
// go south.
#include
char ssid[] = "INSERT_YOUR_SSID_HERE";
char pass[] = "INSERT_YOUR_PASSWORD_HERE";
WiFiServer* server;
int clientCount = 0;
void attachToWifi() {
uint8_t status = WiFi.status();
while ...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Waveshare ESP32-S2-Pico with ESP32S2
Code/REPL
import wifi
# at this point, the ESP32-S2 is running as a station (init default), and if desired can connect to any AP
wifi.radio.enabled = False # turns wifi off, mode is retained or can be changed while not enabled
print("Stopping the (default) station...")
wifi.radio.stop_station() # now the device is in NONE mode, neither Sta...
Are you running with the wifi workflow set up (via settings.toml) or not?
I tried this on a Metro ESP32-S2 with beta.6, with using .enabled and without, and it worked for me. I saw the network advertised on my phone. I don't think you need bother to do the .enabled = False and then re-enabling.
If you mean the CIRCUITPY_WIFI_PASSWORD and CIRCUITPY_WIFI_SSID, from the environment, I made sure to clear them out before trying. I have also tried not to disable and re-enable the wifi, but confusingly, there seems to be no change in the behaviour.
I have just updated to the latest version of CircuitPython and it seems to work fine now. It could have been just an error with my code. Thank you for the quick help!
CircuitPython version
Adafruit circuitpython 7.3.3 on Feather M4 express
Code/REPL
import carrierboardv2 as cb
import time
import rtc
import board
import busio
from adafruit_esp32spi import adafruit_esp32spi
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
# Get wifi details and more from a secrets.py file
try:
from secrets import secrets
except ImportError:
print("...
Note that other files are here:
bug.zip
Hey guys. Got this string to translate: "%S". ๐
@cobalt grail yeah I'm sorry about that
I realize it's nonsense to present to a translator, but because of the C API inside CircuitPython, it had to be marked as a translated string. I would love if someone could show me a way around it in this case.
Also, shouldn't it be %s?
no
%S is an extension to printf formatting in circuitpython, which means that the associated argument is a translated/compressed string rather than a regular string
mp_printf(&mp_plat_print, "%S", translate("I have regrets about my decisions"));
Ah! Ok then. Maybe there is a way in weblate to mark it "ignore".
I could go translate it in all the languages before anyone else does
Well, swedish is already done.
Your wifi scan doesn't show it, but are there a lot of other wifi devices in the vicinity that could be causing interference? Are the routers choosing their channels, or are those manually selected? Channels 2 and 3 are adjacent, and also have frequency overlap with channels1 and 6. Channels 1, 6, and 11 are the only combination that have no overlap.
There was a comment on another issue that the ESP32-S3 has a hardware bug that reduces the signal strength on the lower channel numbers:
htt...
@cobalt grail I think I've marked it as "read only"
Not sure what that implies though.
I tested with an S3-based feather and still didn't reproduce the problem. I tried 70, 81, 3000, and 8080 as alternate port numbers. I tested with the CIRCUITPY_WEB_API_PORT line being first, middle, and last.
Let's eliminate the possibility of strange control codes in your settings.toml. Can you please run this in the repl, and then redact the wifi password in the printed string before pasting it into a comment with ```backticks```?
>>> open("/settings.toml", "rb").read()
b'...
@dhalbert let me know when you update this PR
CircuitPython version
7.3.0-beta.1-4-g7be66a573-dirtyAdafruit CircuitPython 7.3.0-beta.1-4-g7be66a573-dirty on 2022-04-15; PyCubedMini with samd51j19
Code/REPL
>>> msgpack.pack([1672099392], BytesIO())
Behavior
Traceback (most recent call last):
File "", line 1, in
ValueError: no default packer
Description
This behavior is seen when passing ints greater than 2^30, which seems very strange.
I suspect it has something to do with the c...
Ok a bit more investigation
I did another scan just now
Virgin Media RSSI: -75 Channel: 6 Bssid: b'Z\xd3C1\xd2\xe1'
BT-7CAG8T RSSI: -90 Channel: 1 Bssid: b'\xecl\x9a\x1cq\x80'
PLUSNET-6N79_Ext RSSI: -93 Channel: 11 Bssid: b"\xc0V'\xa5`\xda"
GBD-TPLINK-Ext-2.4GHz RSSI: -47 Channel: 3 Bssid: b'\xcc2\xe58\xa8d'
GBD-TPLINK3-Ext-2.4GHz RSSI: -74 ...
Just tried adafruit-circuitpython-unexpectedmaker_pros3-en_GB-20221227-785ebe1.uf2 which was released at 2022-12-27T19:18:42.000Z
Not sure if it picked up the recent pull request
Used the following settings
settings.toml
CIRCUITPY_WIFI_SSID="GBD-TPLINK3-Ext-2.4GHz"
CIRCUITPY_WIFI_PASSWORD="****"
CIRCUITPY_WEB_API_PORT=3000
CIRCUITPY_WEB_API_PASSWORD="password"
#
#
Reset the device
Looking at the IP address assigned
import wifi
print("my IP addr:", wifi.ra...
Also Tried
CIRCUITPY_WEB_API_PORT=81
CIRCUITPY_WEB_API_PASSWORD="password"
CIRCUITPY_WIFI_SSID="GBD-TPLINK3-Ext-2.4GHz"
CIRCUITPY_WIFI_PASSWORD="*****"
open("/settings.toml", "rb").read()
b'CIRCUITPY_WEB_API_PORT=81\r\nCIRCUITPY_WEB_API_PASSWORD="password"\r\nCIRCUITPY_WIFI_SSID="GBD-TPLINK3-Ext-2.4GHz"\r\nCIRCUITPY_WIFI_PASSWORD="****"\r\n'
but same result
just as a follow up
- my main wifi router is a Asus GT-AX11000
latest firmware 3.0.0.4.386_49599-g8352df7 - the wifi boosters are all the same, TPLink RE650 V1, latest firmware 20201112
Tried disabling 5Ghz on one of the boosters I couldn't connect to but made no difference
What I think I'm seeing at the moment is that if a connection is made via ESP -> Booster -> Booster -> Router, then I think it works for some reason.
Next point of call is to try altering some of the w...
I think I've managed to solve this one
Going to close it down since if this is an issue and not wifi interference (which it could be) it's probably more of a hardware / esp-idf issue
that being said it maybe useful for others to know
Fix - set "Channel bandwidth" to "40Mhz"
The short answer is that in my wifi router settings
changing the "Channel bandwidth" setting from "20/40Mhz" to "40Mhz" seems to allow the esp32-s3 to connect on the lower channel numbers without issue
Re...
As a suggestion if there's an option in the wifi router for "Channel bandwidth"
Try setting it to "40Mhz" instead of "20/40Mhz"
This seemed to fix problems I was having when connecting to the lower channel numbers of 7 and below
It's been quite a while since this was brought up so sorry to dredge it up but are there any plans to build a library for this sensor and circuit python? If not, I am going to give it a go but it is definitely going to be an uphill battle for me so didn't want to duplicate efforts if it was already planned/underway. Thanks for all the awesome hardware!
CircuitPython version
adafruit-circuitpython-teensy41-en_US-8.0.0-beta.6.hex
AND
adafruit CircuitPython 8.0.0-beta.6-6-g785ebe1f4 on 2022-12-27
#
I apologize for posting here, couldn't find a way to post in the 'beta' section.
Code/REPL
# Just a sstart....
import time
import microcontroller
import adafruit_ticks # import time
import board
import busio
# from analogio import AnalogIn
import digitalio
# import displayio
# import adafruit_ili934...
I'm not sure this is the correct fix but I changed line 116 of circuitpython/ports/mimxrt10xx/common-hal/busio/UART.c
from:
self->character_bits = (uint8_t)mp_arg_validate_int_range(self->character_bits, 7, 8, MP_QSTR_bits);
to:
self->character_bits = (uint8_t)mp_arg_validate_int_range(bits, 7, 8, MP_QSTR_bits);
and the error no longer occurs.
I believe this will resolve issue #7389
The error was resolved but I haven't tested the UART operation further than that.
CircuitPython version
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather RP2040 with rp2040
Code/REPL
# Write your code here :-)
import board
import busio
import sys
# import asyncio
import select
uart = busio.UART(board.TX, board.RX, baudrate=31250)
p = select.poll()
p.register(uart, select.POLLIN)
p.register(sys.stdin, select.POLLIN)
while True:
res = p.poll()
Behavior
Traceback (most recent call last):
File...
also match lolin_c3_mini pins definition of new version
This is OK, but might you want to define a new board for the old and the new versions of the board? For instance, trying to blink board.LED in a simple way is going to fail on the NeoPixel version of the board.
os.getenv() seems to read the file each time, so presumably the best strategy is to put more frequently-used items at the top. Is there a practical limit to settings.toml file size?
Are there any other optimizations in Python code, or a way to read all of the values at once?
That's right, each call to os.getenv reads the whole file. No, there's no way to get all values or to get a list of keys either. There may be a missing optimization to stop reading after the desired key is found and its value is read out.
I believe this will be fixed in 8, give one of the betas a try.
als to @onyx hinge : bill88t is working on tiny TOML parsing library. It will do sections and stuff
i don't think reading the whole file is all that expensive
also not sure what the semantics is of TOML and repeated values, whether the last one is the one that sticks. That was true for .env, so we had to read the whole file
Thanks, jepler and danh, jus trying to strategize a little. I'm leaning towards keeping "standard" settings in setings.toml, along with a filename of a python settings file
I'm trying to type bill88t; he's the one who was working on a TOML lib
the only strong reason to use settings.toml instead of a .py file is that the values could be read without starting up a Python VM
that was the motivation, really
I don't understand what that means in the context of CircuitPython
oh, so core code could use it
so the web workflow could get started up really early
or we could set a memory value that the VM needed to start
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit QT Py ESP32S2 with ESP32S2
Code/REPL
Placeholder issue: no minimal example at this time. Only happens on some URLs.
Behavior
# using latest release adafruit_wiznet5k v1.12.18
Traceback (most recent call last):
File "code.py", line 111, in get_http
File "adafruit_requests.py", line 823, in get
File "adafruit_requests.py", line 662, in request
File...
Is anyone else getting Github errors trying to download the CircuitPython Library Bundles? In doing a circup --verbose install [somepackage] I am getting "ERROR: 503 Server Error: Egress is over the account limit", e.g.:
12/28/2022 09:34:37 INFO: Downloading bundle: https://github.com/adafruit/CircuitPython_Community_Bundle/releases/download/20221222/circuitpython-community-bundle-7.x-mpy-20221222.zip
12/28/2022 09:34:43 WARNING: Unable to connect to https://github.com/adafruit/CircuitPython_Community_Bundle/releases/download/20221222/circuitpython-community-bundle-7.x-mpy-20221222.zip
There was a problem downloading the bundle. Please try again in a moment.
12/28/2022 09:34:43 ERROR: 503 Server Error: Egress is over the account limit. for url: https://objects.githubusercontent.com/github-production-release-asset-2e65be/98363921/76c8368a-6960-4dd2-8aac-e2d41d7b35e3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20221228%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20221228T173438Z&X-Amz-Expires=300&X-Amz-Signature=f40fabc5348c03f89661bec8fae374e4d13598bcd0e80874180c6b4a5bb0a01d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=98363921&response-content-disposition=attachment%3B%20filename%3Dcircuitpython-community-bundle-7.x-mpy-20221222.zip&response-content-type=application%2Foctet-stream
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6-7-g81e9f5013 on 2022-12-28; FeatherS2 with ESP32S2
Code/REPL
# empty code.py
Behavior
An error occurred while retrieving 'CIRCUITPY_WEB_API_PORT':
Invalid byte '\r'
Description
Seems to be a problem parsing the port number if the number is followed by '\r\n'.
CIRCUITPY_WIFI_SSID="SAVETHEPLANET"
CIRCUITPY_WIFI_PASSWORD="secret-password"
CIRCUITPY_WEB_API_PASSWORD="web-api-p...
I think I figured out the cause
I noticed the following on the serial console if I could capture it early enough after a reset
An error occurred while retrieving 'CIRCUITPY_WEB_API_PORT':
Invalid byte '\r'
and I was like aha it's windows line feeds.
Switched my editor to save unix '\n' instead of windows '\r\n' line feeds and it works
Doesn't seem to impact the other settings just that one CIRCUITPY_WEB_API_PORT
so I'm guessing the other settings are filtering out the windo...
I think this closes #7380
Currently all boards, excluding espressif/TG-Watch, have the exact same pystack size, defined by:
py/circuitpy_mpconfig.h:453: #define CIRCUITPY_PYSTACK_SIZE 1536
However, at least for me, this is a bottleneck.
My project has at this point, been optimised as much as it goes,
but I am still hitting the pystack limit with some of the latest changes.
(RuntimeError: pystack exhausted)
This pr intends to find a better value than the global 1536 that is currently applied.
As an i...
Are you testing different values on different ports / boards? I suspect this should be by port, if not by board. 512 is a lot out of a SAMD21, but likely to be inconsequential on an espressif board.
Initially I added 512 globally to test which boards will outright fail or have critically low ram.
After evaluating the actions results, I will do per-port/per-board modifications.
I plan on massively increasing the value on psram boards.
Looks good to me, including the test coverage. @rsbohn and @grbd, would you like to test? The build artifacts will be on this page in a little while: https://github.com/adafruit/circuitpython/actions/runs/3796145570
Sounds good. It is a balancing act even with PSRAM, since it trades off with espidf memory (sockets and wifi, AP connections, wifi monitor, etc). tannewt or others could speak better about leaving some headroom for future BLE features. There is the option in settings.toml to allocate some PSRAM to espidf memory, so that helps some (at the cost of speed as you noted on Discord).
For whatever it's worth.... My usage is probably a bit atypical and quickly stresses the stack storage on all the board builds. I've found it easiest to simply disable stack usage in circuitpython by setting MICROPY_ENABLE_PYSTACK to (0) and MICROPY_STACKLESS to (1). There's probably a downside to running this way but at least for my usage I haven't found any issues yet.
This is quite significant news..
This could perhaps be the way-to-go for a lot of ports if there are no sideffects.
For anyone that wants to optimize memory/stack size, I stole this bit of code from a posted Micropython (I think) issue a year or so ago:
def calcRecursionDepth(wldCLen,recursiveFail):
wldCLen += 1
if not recursiveFail and wldCLen < 90:
try:
(wldCLen,recursiveFail) = calcRecursionDepth(wldCLen,recursiveFail)
except:
recursiveFail = True
return (wldCLen,recursiveFail)
w = 0
rf = False
print(calcRecursionDepth(w,rf)...
Tomorrow along with the resizing tests, I will create stackless builds and evaluate their performance.
If anything, my project is the perfect test for this.
It uses both large amounts of ram and stack.
all the pystack talk got me thinking about swap storage
imagine if we could swap to an sdcard. that would be great
I dont wanna imagine booting off of a spi-mode sdcard though
Tested, working on Adafruit CircuitPython 8.0.0-beta.6-8-g8241edd52 on 2022-12-28; FeatherS2 with ESP32S2.
There might be a problem with the CI and Jekyll in particular, not sure why those simple change break it.
Thanks @Pixel-Clay @bergdahl @wtuemura.
@Pixel-Clay One of your single quotes was non-ASCII and caused the builds to break. I fixed that. Maybe a leftover "smart quote".
Now all the boards with MB's of ram, are set to have 5k of pystack. There is no reason not to.
nrf got a boost of 512b, and rp2 got a boost of 1kb.
The rp2 board with the least available ram is the picow and it still has more than 10kb more than nrf52840.
nrf on the other hand, has very little to begin with, so I only increased it by 512b.
I will now build a stackless build on picow and test my ljinux + webserver + ssh to see how it performs.
CircuitPython Version: Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Raspberry Pi Pico W with rp2040
code.py
`import os
import wifi
ap_ssid = "picow"
ap_password = "picow123"
print()
print("Creating a new Access Point")
create access point
wifi.radio.start_ap(ap_ssid, ap_password)
output
from code import *
Creating a new Access Point
Traceback (most recent call last):
File "", line 1, in
File "code.py", line 15, in
RuntimeError: Wifi is in sta...
The current implementation of pi cow wifi cannot do both AP and Station at the same time.
To disconnect from the station you are connected from, run wifi.radio.stop_station().
As a reminder, once pi cow AP is started, it cannot be stopped without microcontroller.reset() or a powercycle.
I am having quite a lot of trouble creating the stackless builds..
../../py/compile.c: In function 'do_import_name':
../../py/compile.c:1095:27: error: 'q_ptr' may be used uninitialized [-Werror=maybe-uninitialized]
1095 | qstr q_full = qstr_from_strn(q_ptr, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../py/obj.h:33,
from ../../py/parse.h:32,
from ../../py/scope.h:29,
from ../../py/compile.c:33:
../../py/qstr.h:84:6: note: by argument 1 of type 'const char *' to 'qstr_from_strn' declared here
84 | qstr qstr_from_strn(const char *str, size_t len);
| ^~~~~~~~~~~~~~
@wraith crow sorry to ping you, but could you please tell me how you compile your stackless builds?
probably yes, but did you do a clean first?
Remember the aliases you gave me?
I have modified them and put em on all my machines.
I always picow-cleanmake now.
i will try a build
I set MICROPY_STACKLESS to (1) and CIRCUITPY_PYSTACK_SIZE to (0)
It fails ~20s in.
I did a build for pico that compiled
Could be incorrect placement though.
where did you set those?
in ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
I have git restore'd already so I may have forgotten something.
what does arm-none-eabi-gcc --version say?
arm-none-eabi-gcc (Arch Repository) 12.2.0
Yea, I use Arch BTW.
I can try on my Pi400
we aren't using 12 yet; we're using 10.3
arch moment
it may well indicate a possible issue, since it's a compiler warning
it builds with normal settings though
builds fine with your placement on 10.3
imma jump on my pi and brb
ahh so you cannot stop it via wifi.radio.stop_ap() it should be fine with me as i am using it for a webserver
@brazen hatch instead of setting CIRCUITPY_PYSTACK_SIZE to 0, set MICROPY_ENABLE_PYSTACK to 0
oh alright, I am updating my local repo
It will take a while.
iowait is my life now
the interlocking between these settings is not necessarily perfect
i think the warning is if a malloc fails and doesn't return anything, or something like that
I can actively test the result once we build.
It should be no problem verifying it's limits.
It would take very little intentional bad code to send it to 10 bytes left.
It built just fine, onto testing now.
The issue is that I can't build esp on my pi400 cause I have made the unfortunate decision of compiling and installing by hanv python3.11 which doesn't work with esp-idf.
I will only test stackless on rp2 for now.
To make it clear, my changes are:
diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
index a31ee7327c..c2df2858df 100644
--- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
+++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
@@ -1,6 +1,16 @@
#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico W"
#define MICROPY_HW_MCU_NAME "rp2040"
+#ifdef MICROPY_ENABLE_PYSTACK
+#undef MICROPY_ENABLE_PYSTACK
+#define MICROPY_ENABLE_PYSTACK (0)
+#endif
+
+#ifdef MICROPY_STACKLESS
+#undef MICROPY_STACKLESS
+#define MICROPY_STACKLESS (1)
+#endif
+
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1)
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1)
All I have to say is, stackless is the way to go.
At least on rp2, it's a clear win.
I think we would strongly consider it for post 8.0.0. For 8.0.0 we are trying to not make major changes now, just fix bugs.
Why don't you add some comments to the stackless issue, and i'll move it to 8.x.x?
i appreciate your experimentation
I want to test this a bit more before declaring it stable, after that, I will write all my finding onto the issue.
Also, I feel like it should be tested extensively on EVERY port
It may work fine on rp2 but fail on a espressif
I can only do rp2, nrf and esp, the rest I cannot get my hands on.
yes, exactly why not to include it in 8.0.0
And I managed to crash everything (including my usb ports) with a simple
def test():
test()
Recursion limit where
import time
def test(num):
print(str(num))
time.sleep(0.01)
test(num+1)
test(0)
made it to 1.9k before hanging
Along with stackless there has to be a recursion limit implemented
Is there a resource (besides the code) that describes the CircuitPython memory architecture... heap, stack, long-lived, C stack, pystack, espidf memory, differences across ports, what happens when PSRAM is involved, etc.? Scott did a deep dive long ago, but I'm not sure it covers all of the angles from a high level (and may be a little out of date).
After further testing, I have determined stackless is the way to go.
There is no reason to further limit usable heap when stackless is an option.
not really; there are some port-specific README's, etc., but they're often out of date. There is some top-level stuff in readthedocs in various places
do include in the comments
I will include everything dw
After further testing, I have determined stackless is the way to go.
There is no reason to further limit usable heap when stackless is an option.
Could you please elaborate... what are the pros and cons of pystack vs. stackless for different application types? Defining stackless would help too, and how it's affected by other defines in the build.
After a heavy amount of testing, I have come to the conclusion that at least for rp2, stackless is stable and offers quite a lot of benefits in comparisson to the current pystack.
Building with
#ifdef CIRCUITPY_PYSTACK_SIZE
#undef CIRCUITPY_PYSTACK_SIZE
#endif
#define CIRCUITPY_PYSTACK_SIZE 0
#ifdef MICROPY_ENABLE_PYSTACK
#undef MICROPY_ENABLE_PYSTACK
#endif
#define MICROPY_ENABLE_PYSTACK (0)
#ifdef MICROPY_STACKLESS
#undef MICROPY_STACKLESS
#endif
#define MICROPY_STAC...
The just commented all my findings in #3362.
I am done for the day, see ya all tomorrow.
@onyx hinge were you still looking for a scorpio example project? Still winter related but the Icicle project I did based on PaintYourDragon's original Arduino one may work well. Needs lots of strands, it runs pretty decently. Code would need some tweaking/cleanup
@brazen hatch We seem to be on inverse schedules today ๐ sorry I missed your ping but glad you got it worked out ๐
I'll add that I've been running PyDOS "stackless" on both Circuitpython and Micropython for about a year and a half and haven't seen any issues. That being said, other than running neopixels, SPI SD cards/displays and various I2C devices I'm not really stressing the high speed timing of the microcontrollers or GPIO outputs and I'd classify both PyDOS and ljinux as not being core usage cases for Circuitpython :grin:
I have built and tested on multiple development boards using the ESP32 fami...
#ifdef CIRCUITPY_PYSTACK_SIZE #undef CIRCUITPY_PYSTACK_SIZE #endif #define CIRCUITPY_PYSTACK_SIZE 0
Just looking forward to a PR (someday post 8.0.0 :grin:) to implement this and I'm thinking if you define MICROPY_ENABLE_PYSTACK (0) then I would think CIRCUITPY_PYSTACK_SIZE shouldn't be allocated. If that's true, it probably doesn't hurt to leave the parameter set in case someone wants to override the setting and re-enable PYSTACK.
For all of my testing I wo...
This ultimately appears to be due to not telling gcc to do a software memory barrier after turning off the SAMD cache. In -O2 code, inlining some routines made this necessary. PR soon. I am seeing whether I also need to do hardware memory barrier instructions also, and what the situation on other ports is.
I found out one interesting thing: you can adjust gccoptimization levels per function inside a source file:
https://gcc.gnu.org/onlinedocs/gcc/Function-Specific-Option-Pragmas.html#F...
when there is no pystack, where does stuff go that would have gone on pystack? I tried reading the code, but it gets really deep really fast
I'm guessing not the heap, so that leaves the C stack... size of which is determined by CIRCUITPY_DEFAULT_STACK_SIZE?
I started looking a while back until my head started to hurt, but I think there's two different things going on. The pystack and stackless operation. I could be totally off base but my impression was that when pystack was turned off, the functionality was moved to a different stack or perhaps the heap? this is all a bit beyond me... However, there's also a CPYTHON stackless version/option (https://en.wikipedia.org/wiki/Stackless_Python) which perhaps is what gets triggered when the stackless option is enabled????
Stackless Python, or Stackless, is a Python programming language interpreter, so named because it avoids depending on the C call stack for its own stack. In practice, Stackless Python uses the C stack, but the stack is cleared between function calls. The most prominent feature of Stackless is microthreads, which avoid much of the overhead associ...
there could be some simplistic version of Stackless Python implemented, many of the features seem too rich and os-based for us
but if not, if stackless uses the heap we'll need to test for fragmentation, and if it's c-stack we'll need to test for stack size and C & Python not clobbering each other in odd scenarios
my understanding:
MICROPY_STACKLESScauses all allocations to take place on the heap, meaning that even functions that are originally designed to avoid heap allocation can trigger a garbage collection, or contribute to memory fragmentation.
// Avoid using C stack when making Python function calls. C stack still
// may be used if there's no free heap.
MICROPY_ENABLE_PYSTACKenables a separate "stack" from the C stack to handle python local allocations. It's called "scoped allocation" in some of the related discussions on microptyhon.
// Whether to enable a separate allocator for the Python stack.
// If enabled then the code must call mp_pystack_init before mp_init.
How they interact with each other is unclear. At first I thought that the pystack requires explicit allocation on it, but that doesn't seem to be the case (or it would be very niche).
MICROPY_STACKLESS causes all allocations to take place on the heap
seems to have large implications for fragmentation
I might have gotten all of that wrong though
When I read that comment in code, I didn't know if the 0 was what the comment was refering to, or the MICROPY_STACKLESS
ah I don't know
we really need some docs (with graphics!) of the CP architecture, particularly about memory
we can ask in the MP discord, they certainly can clarify or point to more info. Jimmo is active over there
I'll give it a go
(or over there https://github.com/orgs/micropython/discussions)
Discord so much easier ๐
@lone axle maybe you know what's going on with https://forums.adafruit.com/viewtopic.php?t=197317 and can help out?
it looks like a label that starts with a space ends up different than one without, or maybe generally different depending on where the first pixel of the first glyph is at?
Interesting. I don't know the cause off the top of my head, best guess is maybe space is "special" and handled by the code by moving some pixels in X direction. If that is the case maybe it's not using the correct value to move when it finds the space.
Is space one of the glyphs generally contained within a font file? Somehow the font file must be able to convey how wide the space should be, it could just have a glyph for it with no pixels, or perhaps it's just a number somewhere in the metadata.
.. it looks like the non-string value 3.0 was probably being interpreted as 3 aka 3.x?
Previously it looks like we built with 'ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]' so I chose to pin at "3.1"
looks like newline is the only special case https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/blob/0b209f9ada96151f4f2faf0714cb0880b12fb4ed/adafruit_display_text/bitmap_label.py#L380-L386 so font.get_glyph() must return something for " "
I'll post a reply on the forum and dig into it a bit further in the next day or two.
To document a little of the discord discussion by @anecdata and @Neradoc:
MICROPY_STACKLESS causes all allocations to take place on the heap, meaning that even functions that are originally designed to avoid heap allocation can trigger a garbage collection, or contribute to memory fragmentation.
// Avoid using C stack when making Python function calls. C stack still
// may be used if there's no free heap.MICROPY_ENABLE_PYSTACK enables a separate "stack" from the C stack...
Approving based on Dan's previous review
Thanks! One suggestion for increased clarity.
Fixes #7279.
Disabling the cache on SAMx5x caused problems when compiling with -O2, apparently due to inlining the microcontroller cache control routines.. Access to the external flash chip did not work.
Fixes:
- https://github.com/adafruit/samd-peripherals/pull/43 adds a memory fence before and after disabling the cache.
external_flash.ctries a little harder to make sure the flash chip is ready, by retrying fetching the JEDEC ID if necessary. Without this, if the chip was not ac...
Might fix for 8.0.0 by increasing PYSTACK or might defer to later. See #7396 and #3362.
I think this intersects with #6851.
nobody has taken it on that we know of - go for it!
Thanks, looks good. didn't test.
With CIRCUITPY_RESERVED_PSRAM in settings.toml as a model, is it conceivable that other low-level build features could be deferred until runtime, so that very different kinds of applications could be written without a custom build? At the moment, I'm thinking mainly of other memory configuration options (pystack, etc).
That would be nice but once stackless rolls out it will all be deprecated documentation and wasted code.
I'm going to try stackless on esp today and see how it fairs with psram.
If I manage to build it that is
my archbtw has incompatible gcc
and my pi400 has python3.11 which doesnt play well with idf
I may spin something in docker
Since the v1.0 version of the board is depricated due to flaws in the antenna design and the board is already changed to match the v2.1 version, I'll take on making a new v1 board definition but may not get to it until after the holidays. circuitpython-org entry for the now-v2.1 board will need some edits removing the caveats regarding the antenna design flaw.
I'm thinking that if the v1.0 board is deprecated, a new board def may not really be needed. Instead, it could all be documented in the circuitpython.org description.
@brazen hatch my question was a little more general, could involve other aspects of memory config, even whether Blinka shows up on displayio terminals
well usability would greatly improve if everything was set via settings.toml
no need for any custom builds ever
Also, my toml library is coming out soon, so it be very easy for code to save/load settings to it too
turns out though, accounting for all edge cases was quite a lot more code that I would like
hopefully I didnt miss any
plenty of time for people to try out all. the. things.
also fyi, building with arm-none-eabi-gcc 12.2.0, only requires a single #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
I read the code, not sure why it thinks of this
it complains about py/compile.c:1095
The compiler is probably not wrong -- it may be uninitialized. I would not suppress the warning immediately, but
try to fix the issue
i think it is beccause the called routine might not always set the value
Other than that there are no other warnings or issues.
I will give a more throughout look at the func and try to pr a fix.
It is a single warning. If it is fixed, circuitpython can be built with latest gcc.
../../py/compile.c: In function 'do_import_name':
../../py/compile.c:1095:27: error: 'q_ptr' may be used uninitialized [-Werror=maybe-uninitialized]
1095 | qstr q_full = qstr_from_strn(q_ptr, len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../py/obj.h:33,
from ../../py/parse.h:32,
from ../../py/scope.h:29,
...
hello, I think I found a discrepancy on the circuitpython download page and I'd like to know who to take it to. Could anyone direct me where to go?
here is fine
on the download page for the ESP32-C3-DevKitC-1-N4 the text on the page references the "DevKitC" but the download file and url reference the "DevKitM"
@left steeple if you're a github user you can open an issue at https://github.com/adafruit/circuitpython-org/issues
and if not, reply to this and tag me and I'll open the issue for you
I think "DevKitM" is right straight across: https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html
yeah that's a good client for an issue, those devkits are weird in their names
I think they can use the same build, I have both but no time
What did I do? In Micropython there is method called "duty()" about like in Ciruitpyton but they also have "duty_ns(pulse_len)" where pulse_len is an integer in nanoseconds. So I used Micropython. This is the only solution that avoids round off errors.
Their library code, then converts the nanoseconds into "timer counts". There is are numeric issues like we are stuck with here.
What is not understood by Circuitpython authors is PWM is many times used to transmit numeric data, whe...
Might this be solved by refactoring Wiznet5k? At the moment, wiznet5k_socket.gethostbyname calls wiznet5k.get_host_by_name which instantiates an instance of wiznet5k-dns.DNS and calls DNS.gethostbyname which instantiates a wiznet5k_socket.socket and makes calls to socket.send and socket.recv which calls WIZNET5k.socket_write.
This could be refactored into wiznet5k_socket.gethostbyname with a couple of functions to build and parse DNS messages and calls to the `WIZNET5K inst...
Might this be solved by refactoring Wiznet5k? At the moment, wiznet5k_socket.gethostbyname calls wiznet5k.get_host_by_name which instantiates an instance of wiznet5k-dns.DNS and calls DNS.gethostbyname which instantiates a wiznet5k_socket.socket and makes calls to socket.send and socket.recv which calls WIZNET5k.socket_write.
This could be refactored into wiznet5k_socket.gethostbyname with a couple of functions to build and parse DNS messages and calls to the WIZNET5K instance that is already linked to the sockets module. The Wiznet5k DNS module could be removed completely.
I was Googling to find out how to run a task on the second CPU and found this is still unimplemented in Circuitpython. I'm shocked. Having dual cores is one of the "top three" features of the RP2 and the reason for the "2" in "RP2". Excuse the pun but this is a core feature of the chip.
What is the use case?
task 1 - reading data from a bunch of sensors and we can't stop looking
task 2 - interacting with another computer via serial link and running commands that come over the ...
Update the Lolin C3 Mini page to reflect https://github.com/adafruit/circuitpython/pull/7392 changing the targeted hardware version to v2.1.
Status LED removed, replaced by WS2812B.
PCB antenna removed, replaced by ceramic antenna.
Is the language describing the RGB LED correct for a non-Adafruit (and presumably not licensed to use the term NeoPixel) WS2812B correct?
Turns out it only occurs on stackless builds.
I wonder what is the behaviour change on the V1 / V2.1 board.
I guess it is mostly the boot blinking vs colour that is affected.
So we have LED and NEOPIXEL alias, but if the goal is to focus on V2.1 then maybe LED can be removed.
That would make it perfect for V2.1 and V1 user just need to know that they can use NEOPIXEL to talk to their LED.
PS: I acquired both, but I will use the v1 for a non wifi and Arduino usage.
CircuitPython version
8.0.0-beta.6
Code/REPL
import board
import sdioio
import storage
import time
import displayio
import adafruit_displayio_sh1107
i2c = board.I2C()
displayio.release_displays()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_sh1107.SH1107(display_bus, width=128, height=64)
sdcard = sdioio.SDCard(
clock=board.SDIO_CLOCK,
command=board.SDIO_COMMAND,
data=board.SDIO_DATA,...
CircuitPython version
Adafruit CircuitPython 7.3.3 on 2022-08-29; FeatherS3 with ESP32S3
Code/REPL
# ------------------------------------------------------------------------------------
# First Module
"""
BMP280 -> Sensor Data> Temperature, pressure, and altitude
"""
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""Simpletest Example that shows how to get temperature,
pressure, and altitude readin...
CircuitPython version
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather RP2040 with rp2040
In my experience the minimum alarm period seems to be 1 second. The code below should produce 10 x 100mS sleep periods for a total of 1 second. I need to sample user buttons 10 times a second but also want to make use of light-sleep to reduce power.
Output:
mtime=8519.37
wake =8520.26
mtime=8520.27
wake =8521.26
mtime=8521.26
wake =8522.26 alarm returns after 1 sec...
I used scan-build make CC=analyze-cc with clang-11 on the unix coverage build. It uncovered several interesting things (but also a bunch of irrelevant things as well as some things that appeared to be false positives). No testing performed.
I did a litltle research to see what's happening in the core C code.
In the rp2040 microcontroller, we rely on the pico-sdk routine rtc_set_alarm to set an alarm. It has a granularity of 1 second, because it uses a datetime_t which has no sub-second resolution. If you want more info about this routine: https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__rtc.html#gad0018e9069fee8d65c3a01f7bd7ae2f4
If you need shorter sleeps, consider just using time.sleep.
As for the exception, I think it's operating as intended but the documentation could be better.
constructing a time alarm for a time already in the past gets you an exception when you create it.
constructing a time alarm for a time in the future but actually sleeping on that alarm later, after the deadline is past is supposed to return immediately if its deadline is in the past.
For instance, if you
time_alarm = TimeAlarm(monotonic_time = time.monotonic() + 1)
...
@ jepler- Thanks for the conformation about the minimum 1 second alarm delay. I figured the exception was in the creation of time_alarm. I was hoping I could trick the alarm into a short delay. I think I should call this a feature request instead of a bug. The bug is that alarm.time uses a datetime_t and is limited to 1 second sleeps. ๐ฃ
Hi, when do I know if the CircuitPython port for my OSHW board is ready to be merged into the official repo? Right now, the firmware runs beautifully but I'm still working out the userspace code that runs within CircuitPython. Should I wait until that's done, or can I open a PR?
I would say that deep sleep is not really intended for short sleeps, it's followed by a reset, so there's a lot of wasted time (and energy) in sleeping a short amount of time compared to time.sleep()
specifically one second I would say
or was it light sleep ?
ah sorry, I misunderstood the thing ๐
I should go to deep sleep, it's late ๐
I am looking for serious ways to reduce power in the RP2040. I am suprised there is not more intrest in power reduction. Light_sleep is disappointing if the whole app has to shut down for a second to use it. I also found that light_sleep shuts down the PWM logic. I see in the C source the bit mask
RP_LIGHTSLEEP_EN0_MASK which shuts down clocks. I can rebuild circuitpython after commenting out CLK_SYS_PWM_BITS but want to understand more about power reduction. I am still looking for the routine that uses RP_LIGHTSLEEP_EN0_MASK.
Itโs mostly because the RP2040 isnโt really designed for low power. There are some people who have been able to get it down to 180uA using the pick sdk, but some real finagling with shutting down RAM power.
Those things are not really as big of a priority in my own view of the RP2040 usage as it tends to be viewed as a tool for learning embedded vs optimizing for end products.
Itโs also been discussed at length that the trouble of reducing low power consumption in a few cases isnโt worth the potential headaches of managing peripheral state. That said, definitely open an issue if you are curious if your suggestions are worth trying out
Maybe try them out and test them too, if they work submit a PR
Iโd certainly be interested if you get more working. I do a lot with the RP2040, including a little watch Iโm working on.
@ornate breach- I am on a journy to learn how to make optimizations to circuitpython for my needs. I have circuitpython building on a Ubuntu VM but I have not tried refactoring or adding C calls yet. I am an embedded engineer but mostly code C for PICs. Rp2040 and circuitpython displayio gave me a big headstart on my "watch" project. Now I am running into the limitations and looking for ways to get around them.
What is the pick sdk? where is it?
Sorry, Pico SDK
Itโs C so right up your alley Iโd bet
CircuitPythonโs RP2040 builds use the Pico SDK so any optimizations you make could potentially cross over
if you board presents as USB we need a valid USB VID/PID. There are multiple ways to get them: pid.codes, Raspberry Pi folks (if RP2040), Espressif folks (if Espressif-based), or your own VID (expensive). You can make a PR now and mark it as draft if you're not quite ready. You will also be making a PR to adafruit/circuitpython-org with a board description as well after it's merged to adafruit/circuitpython (you could make a draft there too if you want).
I've already gotten a PID from pid.codes. Sounds like making a draft PR is my best bet, thanks!
@billedluh, did changing CIRCUITPY_SKIP_SAFE_MODE_WAIT work well enough for reducing your boot time? I recently tried setting #define CIRCUITPY_SKIP_SAFE_MODE_WAIT (1) in my board config header, but not seeing the speed up in boot time that I was hoping for. Still seems to be around 2 seconds for me with an esp32-s2 (Magtag).
These all make sense to me -- thanks!
This is now in esp-idf-config/sdkconfig-esp32.default, so it doesn't need to be in individual board sdkconfigs.
This is now in esp-idf-config/sdkconfig-esp32.default, so it doesn't need to be in individual board sdkconfigs.
This is now in esp-idf-config/sdkconfig-esp32.default, so it doesn't need to be in individual board sdkconfigs.
Thanks for confirming the PID!
@jepler on CYW43, is the fact you can't set the MAC address for station or AP mode inherent, or just not implemented yet? That affects my thinking about what error to raise.
I am changing the the AttributeError message in py/runtime.c to be "can't set attribute '%q'", which will match CPython.
https://raspberrypi.github.io/pico-sdk-doxygen/group__cyw43__driver.html#ga6d8ce9294b54153f84561add7fae2c18 in the docs I find a getter but no setter
@tulip sleet ^
got it, so I will add some compile-time option and remove the ro_attribute stuff from the CYW43 impl.
Hi, which is preferred for minimising memory use bytearray.extend(b"abcde") or bytearray += b"abcde"?
I don't think it will make any difference
OK, Thanks
Happy New Year <@&356864093652516868>! This is just a reminder there is no meeting today - we will meet tomorrow at 2pm EST due to the holiday. See you then!
Tested on Pico W and Metro ESP32-S2.
@dhalbert I saw that you requested the code change above and you made yourself the change in commit 01f6762aa1110bf489f39ec0ed2589a277dd78ca but github still show that the merge is blocked with this message: "Merging can be performed automatically once the requested changes are addressed."
Can you please help me to understand what shall I do?
No problem. You don't have to do anything. I was just waiting for the re-runs after my changes. I realized I could very easily make the changes without waiting for you.
The DS18B20 library may help as a general reference and onewire example:
https://github.com/adafruit/Adafruit_CircuitPython_DS18X20/blob/main/adafruit_ds18x20.py
Created an updated set of aliases for building CP based on Dan's:
alias espload='source ~/git/esp-idf-4.4.3/export.sh'
alias cpmload='source ~/.pyenvs/circuitpy/bin/activate'
alias espunload='export PATH=$(echo "$PATH" | sed -E "s#:?${IDF_PATH}/?##g" \
| sed -E "s#:?${IDF_PATH}/tools/xtensa-esp32-elf/esp-2020r2-8.2.0/xtensa-esp32-elf/bin/?##g" \
| sed -E "s#:?${IDF_PATH}/components/esptool_py/esptool/?##g" | sed -E "s#:?${IDF_PATH}/components/espcoredump/?##g" \
| sed -E "s#:?${IDF_PATH}/components/partition_table/?##g" | sed -E "s#:?${IDF_PATH}/components/app_update/?##g" \
| sed -E "s#:?${HOME}/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/?##g" \
| sed -E "s#:?${HOME}/.espressif/tools/xtensa-esp32s2-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s2-elf/bin/?##g" \
| sed -E "s#:?${HOME}/.espressif/tools/xtensa-esp32s3-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32s3-elf/bin/?##g" \
| sed -E "s#:?${HOME}/.espressif/tools/riscv32-esp-elf/esp-2021r2-patch5-8.4.0/riscv32-esp-elf/bin/?##g" \
| sed -E "s#:?${HOME}/.espressif/tools/esp32ulp-elf/2.35_20220830/esp32ulp-elf/bin/?##g" \
| sed -E "s#:?${HOME}/.espressif/tools/openocd-esp32/v0.11.0-esp32-20220706/openocd-esp32/bin/?##g" \
| sed -E "s#:?${HOME}/.espressif/python_env/idf4.4_py3.9_env/bin/?##g" | sed -E "s#:?${IDF_PATH}/tools/?##g" \
| sed -E "s#:?${IDF_PATH}/components/esp32/tools/sdk/include/?##g" \
| sed -E "s#components/esptool_py/esptoolcomponents/espcoredumpcomponents/partition_tablecomponents/app_updatetools:?##g") && \
unset IDF_PATH \
unset IDF_PYTHON_ENV_PATH \
unset IDF_TOOLS_INSTALL_CMD \
unset IDF_TOOLS_EXPORT_CMD'
alias lstty='/bin/ls /dev/ttyACM* /dev/ttyUSB*'
alias atio='tio /dev/ttyACM0'
NUM_CPUS=`getconf _NPROCESSORS_ONLN`
make-aliases () {
alias ${1}-make="(${BASH_ALIASES[$4]}; make -j$NUM_CPUS V=1 BOARD=${2})"
alias ${1}-clean="(${BASH_ALIASES[$4]}; make V=0 BOARD=${2} clean)"
alias ${1}-cleanmake="(${BASH_ALIASES[$4]}; make -j$NUM_CPUS V=1 BOARD=${2} clean; make -j$NUM_CPUS V=1 BOARD=${2})"
alias ${1}-dmake="(${BASH_ALIASES[$4]}; make -j$NUM_CPUS V=1 BOARD=${2} DEBUG=1)"
alias ${1}-dcleanmake="(${BASH_ALIASES[$4]}; make -j$NUM_CPUS V=1 BOARD=${2} clean; make -j$NUM_CPUS V=1 BOARD=${2} DEBUG=1)"
alias ${1}-load="(${BASH_ALIASES[$4]}; cp build-${2}/firmware.uf2 /media/${USER}/${3}/)"
alias ${1}-gdb="(${BASH_ALIASES[$4]}; gdb build-${2}/firmware.elf)"
}
make-aliases pico raspberry_pi_pico "RPI-RP2" cpmload
make-aliases picow raspberry_pi_pico_w "RPI-RP2" cpmload
make-aliases wannabe_lolins2mini wannabe_lolin_s2_mini S2MINIBOOT espload
make-aliases wspico waveshare_esp32s2_pico ESP32S2PICO espload
make-aliases combact Seeed_XIAO_nRF52840_Sense "XIAO-SENSE" cpmload
unset make-aliases
unset NUM_CPUS
the secondary env is specifically so that all circuitpython stuff are either using esp-idf env, or that.
Esp-idf removal from path was such a pain.
Hope these help.
Use a subshell to confine the esp-idf environment changes? ```sh
$ X=1; (X=2; echo $X); echo $X
2
1
Oh.
Oh well..
Thanks.
Imma update it and edit the message above.
Literally spent 3hrs making espunload.
It's bash, I will have forgotten by tomorrow
Updated it to use subshells.
It's cleaner this way. Leaving espunload in the aliases, in case someone wants to use it manually for flashing or something.
https://github.com/adafruit/Adafruit_CircuitPython_ST7789/pull/35 thanks @jaunty juniper
CircuitPython version
CircuitPython version doesn't seem to matter. Mostly I've tested with 8.0.0-beta.6 and 7.3.3, but I've added devices with versions all the way back to 5.3.1.
### Code/REPL
```python
No code needed.
Behavior
I've tested Pico W, QT Py ESP32-S2, Feather M4, and RP2040. In each case, the first one or two will mount, then subsequent similar devices won't mount at all or won't mount properly: They don't show up in Finder. They may not show...
I'm not sure why this order should matter! I'm also not sure why the baudrate is set separately, it's in the FourWire constructor.
it matters because the spi bus would be kept alive by the previous display and the pins would be taken
i think itโs the known displayio persistence across soft restarts
yeah I don't know about the baudrate in that example, it's weird
Whatโs weird is the learn guide for the st7789 displays released the display before setting up SPI
we could remove that
it does nothing, as the fourwire will set its own baudrate anyways
it's not in any of the simpletest examples either, which the README code often is a copy of
it's true, if the spi constructor was anything else but board.SPI() it wouldn't work. I was just wondering if there was a bug with board.SPI() being deinitialized by release_displays().
Thanks for this! I've seen something very similar on the nrf bangle.js 2. Will need to update and test it when I'm back to my proper desk.
@slender iron: @onyx hinge and I were going to over the 8.0.0 list this morning maybe 11:30am ET. But if you are available, we should include you. Could also be after the 2pm, but Limor mentioned meeting sometime after then as well.
i have a non-work mtg starting in 10 mins for an hour or less
@tulip sleet later is better for me. we have a niece here to watch ari but I'm helping her as needed. later becca will be back and I can definitely get away
i'm not going to make the meeting today, read the notes in there so far.
@slender iron I did submit an email last night and linked to a mastodon post.
should be at least 1 entry so far? ๐คทโโ๏ธ
kk, will get it sorted out. thanks!
also i know someone else used the circuitpython2023 hashtag on mastodon to submit theirs but no idea if they submitted an email along with it
i apologize for my long notes this week. there's been a lot of movement on the tr-cowbell in the past 2 weeks and very excited.
also wanted to share a video of the modular enclosure i'm designing. still new to fusion 360 and quite proud of the progress. i can't code very well... but i can design.
<@&356864093652516868> In just over 2 hours at 2pm EST is our weekly meeting. I look forward to seeing your hug reports and status updates. See you then!
I have performed A LOT more testing on esp and nrf, everything works a-ok.
The only things that need to be taken care of is the recursion limit and the exception chain.
On esp with 8mb psram I reached recursion level 128k before crashing.
Do keep in mind though, after around 1k even if you press Ctrl + C, it will hard crash.
This is because of the exception chain being massive.
Should the recursion limit be implemented, and the exception chain being trimmed, we are good.
I wil...
@midnight ember I sent a test email from my personal email and it worked. did you send it to circuitpython2023@adafruit.com?
The tested* stackless ports are now in this pr.
*For esp I only tested S2, I will also test C3, but I cannot test the rest.
@slender iron Are you available to read the core section today?
yup! I can switch off reading status updates and hug reports too if you like
great, thanks! By switch off, do you mean read for the folks who aren't able to attend?
I wonder if there was somehow some macOS "memory" of the previous use of these particular boards, and reinstalling somehow overrode that memory. On Windows it's not too hard to clear the list of previously mounted drives. I don't know if there's anything similar for macOS.
that would be great, I would appreciate the help, thank you
Overall USB names will be configurable with: #6247 (Testing would be helpful.)
Is this now included in 8.0.0 Beta 6?
If so how do I get it to work?
@ToxicTiger901 #6247 allows setting the name of the whole device, but not individual interface descriptor names. So it will not help for what you want. We haven't yet added the ability to modify the interface names. You can do a custom build and change this: https://github.com/adafruit/circuitpython/blob/4cc7466617602a4df0f8ab11958d63bbd47f5eff/shared-module/usb_midi/__init__.c#L182-L183
CircuitPython devices leave a trace in System Settings --> Network, but they can be cleared out (Neradoc has a script to do that more easily), and I did that to no avail. There may be other traces.
Testing across two Macs gives similar behavior. And it doesn't matter which of several boards are plugged in first, it's the later ones that don't mount properly. But once they have been "fixed", I can even put them on their own hub and plug the hub in and they'll all mount fine simultaneously...
One thing to test might be if you see the same issue plug in several USB sticks formatted with the same volume name. If it's not FAT12 related, then we need to figure out what is special about our USB drives.
I should go look at the code but I'm puzzled about having e.g., pop() -- aren't CircuitPython's built in palette objects fixed-length? Oh, huh, it replaces the internal palette object with a totally fresh one.. https://github.com/CedarGroveStudios/CircuitPython_PaletteSlice/blob/main/cedargrove_paletteslice/paletteslice_acme.py#L153
If I'm not mistaken Dan made almost all "can't set that property" errors better.
The length is fixed, somewhat. If you change the size of the palette, the bitmap image just uses what it needs. For example, reducing the palette size means that the image will substitute black for the missing elements. If you extend the palette size, the extra colors are ignored.
PaletteSlice repo: https://github.com/CedarGroveStudios/CircuitPython_PaletteSlice
PaletteSlice demo video. The image is expecting a 255-element palette but the slices are randomized and produce palettes of variable lengths. https://youtu.be/EwtSjBfnhWY
This is a test of the CircuitPython PaletteSlice wrapper class for displayio.Palette objects. PaletteSlice supports full slice and extended slice objects for trimming and reorganizing palettes. The test randomly creates sliced palettes of a reference orchid photograph and displays the results. The frame rate in code was slowed slightly for image...
Yes, a totally new palette object is created. Wasn't possible to inherit a displayio.Palette object, so the class composes it instead.
I should have mentioned my #circuitpython2023 post: https://octodon.social/@stylus/109615118316334203
Jeplerโs #circuitpython 2022 in review
I became a self-appointed floppy guruยน, vintage keyboard guru, and pico-w guru. I renewed my camera guru certification. I got to attend PyCon and meet some more of the community.
Challenges in 2022
Sometimes, we faced problems with no clear solution, or where the problems seem to originate in hardw...
thanks for hosting @random junco !
Thanks!
I'm back
me too.
That's where I went
If someone can merge the PR for the meeting notes, I'd appreciate it - thanks in advance: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/pull/98
@turbid radish Since the newsletter is already out, is there anything I need to do from the meeting? Just wanted to double check
Two thumbs up for the 2023 objective of finding performance enhancements for โdisplayioโ.
Could you try CircuitPython 8.0.0-beta.6 and see if the problem is still present?
This is superficially similar to #6791 which also has an S3 and a BME280 sensor.
Here is the notes document for the next CircuitPython Weekly meeting. It is on Monday January 9, 2023 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! https://docs.google.com/document/d/1CCaNlkBSC3KGohT2RsjaM-RgqQzSwrRbdAABbg3NdPg/edit?usp=sharing
Would it make sense to close this PR and open a fresh one after switching to IDF 5.0?
Moved to 8.0.0 to test the patch mentioned in the previous comment.
@RetiredWizard I think the best approach is following the Pimoroni PicoLipo method, by having a separate 4mb and 16mb model:
https://github.com/adafruit/circuitpython/tree/main/ports/raspberrypi/boards/pimoroni_picolipo_4mb
https://github.com/adafruit/circuitpython/tree/main/ports/raspberrypi/boards/pimoroni_picolipo_16mb
@tannewt I haven't been able to test this myself so far (busy schedule), but since according to @RetiredWizard everything seems to work, I think we can do a preli...
This might need to pull in https://github.com/espressif/esp-idf/pull/7688 to our esp-idf fork.
Closing this since the builds are working for now, and a potential longer term solution is to use partial clones. However, we can re-open this if we encounter the weird fetch errors again. Would rather not downgrade, as using old actions is not a long term solution (github loves to deprecate things used in actions)
@tannewt the listing should be public now (the LCD-1.28 is listed but without URL). I've updated the PR with it, should be merge-able (even with the missing drivers for QMI8658 and GC9A01).
Oh that's right Jepler it is very similar, thank you so much for reaching out to me
I've been reading his thread and I think there's a solution already for this, I'll finish reading it and update this
Hope you're having a good day!
Could you try CircuitPython 8.0.0-beta.6 and see if the problem is still present?
Of course! I'll tried it out and update this on a moment
Thanks for your help
@onyx hinge @slender iron the baudrate setting for SPI flash is less complicated than we thought. THere is a max() done, but only once, and the speed is limited to be at or below SPI_FLASH_MAX_BAUDRATE. The speed is set on each read/write, but I'm guessing that is in case the SPI bus is shared with other devices.
We selected SPI as we have tons of those chips =)
It looks to me like the flash chips listed in mpconfigboard.mk are all QSPI-capable (I looked at the datasheets). We were curious: which chip are you using that's SPI only? Thanks.
so its just the jedec read that doesn't respect it?
right, so their fix makes sense
the limiting is done in spi_flash_init_device() which is called later
It doesn't seem to be a FAT12 vs. FAT 16 issue. Using (4) Adafruit Feather RP2040, no other storage devices connected to the Mac (just the display), processed each as follows.
One at a time:
- flash-nuke
- install 8.0.0-beta.6
>>> os.statvfs("/")
(1024, 1024, 7137, 7133, 7133, 0, 0, 0, 0, 255)
(OK)
% ls -l /Volumes
drwx------ 1 a staff 16384 Dec 31 1969 CIRCUITPY
(OK)
Disk Utility & Finder:
7.3MB FAT16
(OK)
- REBOOT Mac (macOS 13.1)
Plug i...
This is plugging in multiple devices simultaneously, not sequentially?
I tried installing 7.3.3 on each, but same behavior. Even flash-nuking then installing 7.3.3 on each didn't work. Still, only the first inserted mounts properly.
This is a speculative fix for #7409 if the underlying cause is the deterministic volume ID. However, not all boards have working urandom (samd21 at least does not) so a couple of fallbacks are attempted when it fails. Note that the final fallback to the monotonic time is not great but probably has at least a few bits of randomness in it so it's better than nothing.
I verified that on a pico_w, each storage.erase_filesystem() gives a distinct 32-bit volume ID (pico_w's urandom can never f...
I notice on Linux that all CIRCUITPY drives end up with the same "volume serial number", 5021-0000, indicating the date of 2020-1-1. This means that when operating on drives "by uuid", there is confusion when two circuitpython devices are plugged in. (Tested with two pico Ws I had handy)
It looks like oofatfs tries to use the current timestamp to generate a serial number, which is obviously not working out for us:
st_dword(buf + BS_VolID, GET_FATTIME()); /* VSN */
``...
@crimson ferry I think my question was unclear. I meant to ask whether you un-plugged the earlier device before plugging in the next device. Not how long you waited.
ah, yes, ultimately trying to have more than one mounted simultaneously
I hope you can try with #7410. It's a total guess, but it can't be good that every device's "unique identifier" is actually the same ๐คฏ
right, I'll try the artifacts later
i don't know about other linux flavors, but I can have multiples mounted simultaneously on Raspberry Pi OS
e.g., 4 Pico Ws will mount on Rasp Pi OS, but not macOS 13.1
it's a new issue in MacOS 13 too (which I don't have), except we have seen in previous versions the Finder open a file on the wrong board when mutiple ones were plugged in, even with different names
(but only the Finder)
these 'bad' mounts are more fundamentally broken... they look wrong in shell
I don't have a mac to do testing for myself
what I'm familiar with from linux/unix experience is that mounting a filesystem has two steps: creating an empty directory to serve as the mount point, then "actually mounting" the filesystem.
So I am speculating that the first step succeeds and the second step fails, because the second step is working by UUID and unintentially refers to the first (already mounted) block device.
But it's all speculation, I want to stress that like 5 times.
@jaunty juniper you don't have macOS 13, or you don't have this issue?
I keep my macos version a few months/a year behind (or more if I don't like what they did like hiding the proxy icons)
I have a sacrificial laptop but it's too old for Ventura
did Apple finally relent and let people install a newer macOS virtualized in an older host yet?
gotcha, yeah I "fell victim one of the classic blunders" ...updating both Macs within a short time (once the UF2 issue was fixed)
My code will actually execute and complete, but ends in safe mode. Shorter other bpm280 code piece will run correctly. Control +C has been unresponsive except in REPL.
Code top and REPEL as jpeg

text version of code[Hard crash code from ciruit.py
while loop installed; no rate code rate call in time wait loop
Cambria 8-31-2022 8 56 PM text backup, 1-2-2023 versi...
@slender iron sent it to adafuit, resending ๐
Hi, the E-Fidget is a board I've been working on for a while. It's a haptic feedback fidget designed with CircuitPython in mind. The userspace code is a work-in-progress, but the firmware side of things seems pretty reliable. I got a PID from pid.codes, and that's the one I'm using here. I've removed unexposed pins and changed the names to be hardware-specific in pins.c (hope that's normal). Here is the design source. ...
One thing to test might be if you see the same issue if you plug in several USB sticks formatted with the same volume name.
The smallest matched set of USB sticks I could conjure up was (4) new / unused, ostensibly identical, 4GB FAT32 drives, no problem mounting them all on either Mac, even through a hub, even when other storage devices are already mounted.
Build from #7410, while probably a Good Thing, doesn't help the non-mounting issue. I loaded it up on (4) Pico W, and as usual only the first board plugged in mounted properly:
d--x--x--x 2 root wheel 64 Jan 3 20:30 CP198PICOW
drwx------ 1 a staff 16384 Jan 3 20:24 CP199PICOW
d--x--x--x 2 root wheel 64 Jan 3 20:30 CP200PICOW
d--x--x--x 2 root wheel 64 Jan 3 20:30 CP201PICOW
I wonder if it could be something like a bad pointer or buffer boundary i...
You erase_filesystem'd the devices while running with #7410?
For the above, I simply installed the PR build and tried to successively plug them in. I can try other sequences if you think it might help.
BTW, I do have two other Pico W running 8.0.0-beta.6 that can both be mounted simultaneously. I'm hesitant to mess with those since they are very useful to me that way, but I can if needed. If my previous hypothesis is correct, there would be some difference of flash contents over time that let these work but not others with different history. Of co...
[adafruit/circuitpython] New comment on pull request #7410: oofatfs: enable use of random volume IDs
Another fairly changeable number I looked at (by experiment) is microcontroller.cpu.temperature, if available, and microcontroller.cpu.voltage (if actually measured). The degree of precision on these varies: on SAMD21, temperature has only a few digits, but voltage has more. On RP2040, temperature has more, but there is no dynamic voltage measurement. However, both of these have a true UID so the point for them is moot.
Could you test with 8.0.0-beta.6 from here: https://circuitpython.org/board/unexpectedmaker_feathers3/ ? Thanks. It could easily still not be fixed, but worth trying the latest. (We know of I2C problems on S3.)
OK, I gotcha. The volume_uuid are the same previously. Performed storage.erase_filesystem on each, verified the new IDs are different from the old and unique from each other. After a few unplug-all then replug-all, they all four mounted properly. w00t!
The two I mentioned that do mount are standard 8.0.0-beta.6: one has the default volume_uuid, the other is different (not sure how that happened).
Tested with test program in #7376. Update fixes the problem reported there.
Thanks @jepler and thanks @v923z!
reading the source, it looks (previous to #4710) like the device's RTC time when you storage.erase_filesystem() will influence the resulting VolID. For instance, at apparently 16 seconds after boot, I ran erase_filesystem and got 5021-0008 instead of -0000. But when the device is blank (for instance, because it was nuked) the amount of time until it reaches the filesystem creation step will I guess be consistently under 2 seconds, and if so it'll be 5021-0000 consistently.
- fat filesystem timestamps have a granularity of 2 seconds
I am curious to see if 7410 solves the issues with the Finder opening a file on the wrong board. I rarely encounter it these days, though sometimes I am caught off guard by it. I would have to find a reproducible scenario, maybe check the volume IDs as curiosity, and test with this PR. (let's say tomorrow)
You've gotten me in the good habit of opening the file from the bottom BBEdit selection. I think you can reproduce by resetting a board under edit and having another board with same filename.
[adafruit/circuitpython] New comment on pull request #7410: oofatfs: enable use of random volume IDs
storage.erase_filesystem() with unique volume_uuid fixes #7409. ๐ Thanks @jepler!!
note that tinyuf2 uses get_fattime() for the VSN too, would it cause issues if multiple BOOT drives are mounted ?
and the answer is yes, it does !
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Raspberry Pi Pico with rp2040
Code/REPL
try:
raise Exception("Uh oh")
except Exception as ex:
raise ex
Behavior
code.py output:
Traceback (most recent call last):
File "code.py", line 4, in
File "code.py", line 2, in
Exception: Uh oh
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ...
[adafruit/circuitpython] New comment on pull request #7410: oofatfs: enable use of random volume IDs
This also fixes the long standing elusive issue with the Finder opening a file from the wrong board even before Ventura. (I tested it with nuking 2 picos and could see that the volume_uuid was the same before the PR and different after).
I wrote a few notes on that bug, but it seems that there isn't an open issue.
Thanks. I think I understand now.
My only slight confusion here is when I configure a Midi Device using standard CircuitPython firmware (see my example Python code above) it comes up as CircuitPyton Audio,not CircuitPython MIDI?
cpython actually makes sure the newly chained exception doesn't create a cycle (even indirectly); see _PyErr_SetObject's use of "Floyd's cycle detection algo". We'll go for the simpler solution of just checking one level deep until it's clear we need to do more.
Closes: #7414
Dear Dan
Perfect, now it works as expected:
A wake up and a measurement every 2 minutes.
Thanks a lot for your help!
Beat
Von: Dan Halbert @.>
Gesendet: Dienstag, 3. Januar 2023 21:12
An: adafruit/circuitpython @.>
Cc: Beat Arnet @.>; Mention @.>
Betreff: Re: [adafruit/circuitpython] busio.I2C issues on ESP32-S3: LC709203F (Issue #6311)
Moved to 8.0.0 to test the patch mentioned in the previous comment.
โ
Reply to this email directl...
@BeatArnet I haven't yet put the C patch into the 8.0.0 (main) line. Could you describe what is now working for you? Thanks. Are you using 8.0.0-beta.6 with the latest version of the LC709203F library, and that is working well? I had added some retry logic to the library.
I only installed the latest 8.0.0-beta.6 without changes to my code and without the latest LC709203F library. I shall test that later.
Von: Dan Halbert @.>
Gesendet: Mittwoch, 4. Januar 2023 15:55
An: adafruit/circuitpython @.>
Cc: Beat Arnet @.>; Mention @.>
Betreff: Re: [adafruit/circuitpython] busio.I2C issues on ESP32-S3: LC709203F (Issue #6311)
@BeatArnet https://github.com/BeatArnet I haven't yet put the C patch into the 8.0.0 (main) line. Co...
Nice find! This makes total sense to me!
For everyone in my mentions and direct messages asking about it, #Bluetooth support for @Raspberry_Pi@raspberrypi.social #PicoW just got added to the milestones for the upcoming 1.5.0 release of the Pico C SDK. I'd expect to see support publically released this month, with #MicroPython support following along soon after. https://github.com/raspb...
(that's BLE coming for picow SDK soon)
yup, I just asked on the issue if they are using nimble
@tulip sleet did you do the toml update for https://learn.adafruit.com/pico-w-http-server-with-circuitpython?view=all ?
I did a bunch, but there is a structural problem with that one where CIRCUITPY_* is used in one place and no-prefix in another.
Either this one or another one, I changed the presentation order.
"Creating Your settings.toml" file is mirrored.
Closing, fixed by storage.erase_filesystem() with unique volume_uuid. See #7410.
Closing, fixed by storage.erase_filesystem() with unique volume_uuid. See #7410.
I tested on a variety of boards (SAMD, STM, RP2040, Esprsesif) to make sure this wasn't causing any issue with current boards.
We are still interested in which chip you're using that's SPI only.
This board was just merged in to CircuitPython, so here's the circuitpython.org page!
Is a render OK for the board pictures? Let me know if changes are needed.
Hi, thanks for adding. Using a render is fine, though a photo is preferable if you have one. Is it possible to clean up the black bars on the top and bottom of the image?
I think I'll swap in real images. I just used the render because it looks cleaner.
So there will be a slight modification on the approach. The idea now is to change it so it's more of an install wizard like the WLED installer. Also, I'm looking at using esp-web-tools which WLED also uses for easier future maintenance and solves a couple of issues I hadn't addressed yet.
Thank you for your patience!
Please update the USB PID to match the publicly listed one. Do you want to rename to include the flash size as well?
@makermelissa I switched the renders for real photos, and they look good on my end. Is the quality OK? It's the best I have on hand right now.
@thetazero Small ints are stored in 30 bits themselves because they are stored in pointers with 2 bits to indicate what type of data it is. So, you are right that the small int check isn't correct. It should be more generic to handle any int. (Ints >2**30 are stored as objects rather than small ints in a pointer.)
I agree with @anecdata and would rather not use up. It is a network term that makes no sense without that background.
This is a speeculative fix for #7346. The theory is that having some active socket objects uses up the small (4000-byte) pool reserved for lwip and prevents mdns from operating properly. However, as I wasn't able to reproduce the problem with the given script, this is just a guess.
@retiredwizard testing with artifacts from this PR would be appreciated, if you're able to do so!
I was thinking we'd have an install button for each available release on the downloads page. I agree that the resulting image should include the UF2 bootloader when available.
Upon further inspection, it appears that much of the wizard functionality is part of esp-web-tools, which isn't really compatible with CircuitPython because the WiFi part of the installation is handled on the device itself by the Improv WiFi library. However, I can still draw inspiration from this and go closer to my original plan.
The Pico W still drops off the list of CircuitPython devices when response = requests.get(TEXT_URL) is executed. :frowning:
@slender iron now that web workflow is good, what if we add RNDIS to do web workflow over usb? Is it too crazy?
and replace the circuitpy drive with a samba share
@onyx hinge I donโt know what rndis is
Networking over USB
macOS 13.1 does seem to keep some stored state that can affect mounting. A couple of times as I've finished updating devices for the USB uuid, they wouldn't remount even after unplugging and delay. But if I took them to another Mac and renamed them (they weren't conflicting on the original Mac, but there were prior devices named CIRCUITPY), then they mounted on the original
the OS usually handles multiple same-name devices fine
I don't know if it helps but I traced the steps through the adafruit_requests.py library and the line that appears to shutdown the responder is:
524 sock.connect((connect_host, port))
Looking (and a bit of selective code commenting) in common-hal/socketpool/Socket.c I believe
981 err = tcp_connect(socket->pcb.tcp, &dest, port, _lwip_tcp_connected);
is the line that causes the issue. I took a look at the tcp_connect function in tcp.c and compared it to the same function in esp_tls.c hoping that the comments would suggest a clue. The only thing I noticed (understood) was that the ESP module sets the socket to "non-blocking" before connecting. That sounds ...
A couple more observations during testing:
The first power up after flashing CircuitPython Web Workflow doesn't start (device isn't listed on other board pages, title bar doesn't show IP until web.radio.connect and hosted web page isn't available). Ctrl-D soft reboots don't bring it up. The network stack seems to be working, Once it's connected to an access point via wifi.radio the device can be pinged and it can access the network but none of the Web Workflow services are available.
Th...
On Tuesday, January 3, 2023 at 07:53:58 PM PST, Dan Halbert @.***> wrote:
Could you test with 8.0.0-beta.6 from here: https://circuitpython.org/board/unexpectedmaker_feathers3/ ? Thanks. It could easily still not be fixed, but worth trying the latest. (We know of I2C problems on S3.)
โ
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
I loadedย uf2 circuit python from unexpected maker 8.0-beta.6, and ...
When I use pulseio.PulseIn , how to configure GPIO (internal pull-up or pull-down,or set to high impedance on ESP32 C3)
PR #7329 locked tj-actions/changed-files@v34.5.3, this version has a bug necessitating fetch-depth: 0 to work.
Re-opening this to test if @v34 works.
Apparently BLE support for Pico W is approaching, at least there are traces in the future 1.5 C SDK. https://www.cnx-software.com/2023/01/04/raspberry-pi-pico-w-bluetooth-le-support/
It has Bluetooth?!?!
yeah the module does bluetooth, but it was not implemented yet
more blobs
I had no idea the hardware was there!
I am not under NDA or anything... but I have strange feeling about Pico and the Raspberry Pi Foundation.
They made the RP2040 where 2=#ofCore 0=Type(M0+) 4=floor(log2(ram/16k)) 0=floor(log2(nonvolatile/16k))... so we can hope some other RP#### one day.
But when the Pico was out, they already knew the PicoW was coming (it the PicoW sacrifice some of the PIO for doing the SPI to the wifi chip).
Then they announced the W and the WH (but for the WH with header we have to wait).
Now they might announce the BLE upgrade...
But at the end of the day, it is still the same chip, that the hype again and again, but it is still the same "product".
And the SBC is not evolving either (but it is not a good time to evolve since they have already trouble to get stock of the current).
They don't really have any new product (except very specific not for mortal CM4 into CM3 package) and they are just keeping us entertained with variation of what they have.
It is very likely that this has an impact on reseller, because who need a Pi HAT if there are no available Pi SBC.
And the "W" of the "Pico W" is not available separately, so company like Pimoroni are just making board with a Pico W soldered on it (and not sure if the antenna location is optimale... and there are no external antenna option!!!).
I don't know what is going on or if we have to expect anything, but Adafruit is making PiCow addon board... I just wait Lady Ada to do an Ask an Engineer dressed with her Raspberry Pi T-Shirt... hoping it mean there will be a new product announcement at 10AM UK time.
it's a lot of work and resources to create a new chip
you can't churn them out every year
it also takes time for the ecosystem to catch up
esp32-s2 was released like 2 years ago and still has no full ble support, for example
end there is zero support for espnow
Yeah, I understand that, however... making the same with a variation is not new development, but sure a cost and why would they do that if the current is selling well. It is just that they just sell the same product again and again somehow, I am just a bit disappointed.
each time you change anything in a chip design, you have to go through the whole costly process
personally, I'm happy for "unlocking" extra features (like the usb host), especially if I already have the hardware
or remember that time when CircuitPython got a 5x speedup for free?
Iโm more disappointed in what feels like a cultural shift by RPi and what feels like a shift away from the maker community.
Like yeah, we have the RP2040 and itโs new variations.. and I understand business is still business, you have to prioritize business that keeps you afloat
well, they incorporated, that's always a change for the worse
RP4080 when
suddenly you don't just need to stay afloat, but you have to report inflated growth numbers
RP4080 Tie
Imagine if Adafruit made an RPi-type SBC ecosystem
But at the same time theyโre alienating the people who made them who they are and itโs sad..
I would buy 10 AdaPuters
I would buy hundreds
feathers kinda are that
just no ada cpu
there are feathers running linux out there
Has Lady Ada done any CPU design?
Open source silicon moves definitely could open the possibility of Ada Silicon
She has a masters in electrical engineering, so sheโs probably done some VLSI work
it's a whole different world
But itโs getting a lot closer thanks to eFabless and the whole of the burgeoning open source semiconductor community
Is VLSI a type of processor?
Ahh
you can build a 4-bit cpu on a breadboard, but it's a long way from something like rp2040, not to mention the chips in sbcs
I mean people are getting 32Bit rISC-v processors fabbed on the skywater shuttles
and I'm not even talking about silicon design here, just the design of the processor itself
Well, even if Lady Ada herself hasn't done CPU design, and if it's beyond what she's interested in doing herself, she could probably find folks to do it
I think even small CPUs are done by teams tho
Iโd do it
Open source tools though have greatly narrowed the breadth of knowledge necessary to do it
I think you greatly underrate the difference in size between raspberry pi foundation and adafruit
RPi is huge, an order of 10 larger than Adafruit
I know RPi is biiiiiiiig, but they didn't start off that big
no, you still need the knowledge to do anything practical, the tools just make it easier to play
$60m vs like.. 600m in revenue
they started with government funding
oh...
as a part of broadcom
Government, fund Adafruit
Iโm aware you still need knowledge, but the breadth of what you need to know is narrowed. You donโt need to know how to layout semi indigo layers for instance
Basic computer architecture and digital logic + HDL knowledge is all you really need these days. A little persistence to use the caravel user project template. But thatโs it
no, it's not like that. you don't need to know everything immediately to get everything working, because some decisions are already made for you in the tools, but to make anything practical, you still need to go back and make all those decisions, because those defaults are not going to be good enough
Heck, you can develop a chip in Wokwi.
Iโm saying the barriers to get started are very low anymore
Y'all should just make a chip
I am
Iโm doing my masters in electrical engineering focused on semiconductor development
making a game in Scratch is not the same as developing an AAA title, and though it is helpful in teaching, the tool doesn't help you in the end
I agree the tools are improving greatly and making it more accessible, like Scratch does for simple games
Sure, but you have to start somewhere. And these tools lower that first step.
but that still won't let you design something like the rp2040
a practical one? I have my doubts
I mean, I did. It wasnโt Turing complete because I forgot a not instruction
ah, like that, then sure
These days, many fabless companies develop their ICs in HDLs and then use HDL translation tools to layout. They still have dozens of engineers working on it of course..
But developing a circuitpython ready MCU? If someone worked at it for a year they could probably do it. Even with only a working knowledge of digital design
but that's a very bright person not working on circuitpython instead
And this is because the tools exist that remove many of the tedious steps in chip design.
But circuitpython already has a lot of supporting persons? Why take them away from it?
What makes a design "practical" that can't be done with the tools?
PulseIn doesn't support internal pulls because the pin may be connected to a peripheral that isn't gpio. We also assume any needed pulls are external. It should be high impedance unless a trigger duration is provided to resume. It'll push the values for the trigger pulse.
The most difficult part youโll find is having a good enough understanding of computer architecture and how to translate that into tools that can program the device. If youโre doing open source, youโll have to use COTS open source IP cores. You donโt get SWD, you have to use standard JTAG, you have to reduce memory complexity, etc..
I assume that's more an issue for CPUs for an SBC and less for MCU design
No, itโs very relevant for MCU design. Microcontrollers incorporate CPUs in with hardware peripherals and memory.
Does memory complexity matter much for an MCU?
It can if youโre trying to squeeze performance out of small die areas.
Ah...
My argument is that you can design something that could run circuitpython in a year, Iโm not saying it will run amazingly; but you could do it if you put in the sufficient amount of effort.
And that's the first step to eventually getting to amazing
It would probably not be very optimized or particularly powerful. But it could be done.
It's kinda like Intel with their Arc GPUs right now -- they're not really impressive compared to AMD or NVidia's offerings, but they're in the ring, and have a trajectory for improvement
It gives them a starting point
Exactly. Gotta start somewhere
For Adafruit, they wouldnโt necessarily have to even start with designing a chip. Develop IP that can run on an Adafruit fpga dev board, that IP can then be iterated on and improved, then translated into test silicon.
It would take like, 4-5 years to fully get through
I wish I had the spoons to jump in on that
Start small, try the next Tiny Tapeout coming this year. Probably march timeframe
Maybe next year? I'm trying to clear my project plate before adding more things... I already added things this year >~>
Thereโs like a 2 week window for submitting
Yeah, there's no way I'm gonna make that DX I currently know nothing about that sort of design and have way, way too much on my plate to be able to learn any time soon
Lol, anyway drifting off topic and I have a meeting ๐ฌ
Oop.... ttyl
First CircuitPython2023 overview blog post is up: https://blog.adafruit.com/2023/01/04/first-circuitpython2023-posts/
Adafruit Industries - Makers, hackers, artists, designers and engineers!
Weโve gotten a number of #CircuitPython2023 posts so far! Thank you all! Itโs not too late to post your own. Please post yours by January 18th and email circuitpython2023@adafruit.com tโฆ
This will install toolchain specific to the chip on an espressif board.
how does this interact with the idf tools cache? For instance, if the cache is created from an xtensa build, will it fail to cache the riscv toolchain, thus causing all riscv toolchain builds to have to fetch from the remote network instead of from cache?
I completely forgot about the cache, I am not sure how this change will interact with it and I won't give it much thought as the cache makes this change pointless as there is no performance improvement.
I can alter this PR and just keep the slight refactoring stuff or this can be closed.
Hi, is there the possibility of a port of CircuitPython 8 for Flipper Zero Wi-Fi Debugger Module (ESP32-S2-WROVER-N4R2)?
https://docs.flipperzero.one/development/hardware/wifi-debugger-module
https://docs.flipperzero.one/development/hardware/wifi-debugger-module/schematics
Thanks!
It would not be hard to add a port; this is also a very plain board and one of the Espressif dev module boards or similar could work as is, without needing a special board definition.
I tried the https://github.com/espressif/esp-idf/issues/9777#issuecomment-1359582249 patch and it did not make the S3 act like the S2, which does not need delays or retries. :frowning_face:
Is it intentional for the error to persist in the terminal title bar after a reload? (PyPortal)
It looks like a rogue "return" made it's way into the reset pin code for the mimxrt10xx port resulting in pin.deinit() not working.
the Scorpio page mentions ". It's also possible to flip the direction of the level shifter to make the 8 I/O pins inputs - say for making a logic analyzer - with a directional jumper selection also on the bottom of the PCB."
is any one looking at ways to collect logic analyzer data and present it to existing GUI applications?
There was some work on hooking the RP2040 to sigrok / PulseView. I had a very rough implementation that basically dumped data out that you can load in. kmatch I think got more working
This project has a lot on it too: https://github.com/pico-coder/sigrok-pico
Hereโs how far I got: https://github.com/kmatch98/tinylogicfriend
CircuitPython version
Adafruit CircuitPython 7.3.3-1-gac1e66051-dirty on 2023-01-03; Adafruit MagTag with ESP32S2
Code/REPL
import alarm
import board
import time
pin_alarm = alarm.pin.PinAlarm(pin=board.BUTTON_A, value=False)
if isinstance(alarm.wake_alarm, alarm.pin.PinAlarm):
print("Woke from button press!")
toggle_wifi_enable(display)
# Do some stuff
# Go to deep sleep
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monoton...
Scratch that, the extra 30mA I was measuring wasn't from the pull-up, my bad! So using the pull-up solves my issue.
I am intrigued by this
SparkFun MicroMod STM32 Processor (STM32F405) have usb host functionality.
I don't think after a reload. Could you file an issue? Thanks.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6-25-gbb3a1c0a2 on 2023-01-04; Adafruit PyPortal with samd51j20
Code/REPL
# Exception
Behavior
I'm able to reproduce this. With the following sequence of events, an Exception printed in the terminal title bar persists after a restart:
File "code.py", line 1159, in
IndexError: index out of range
Code done running.
Press any key to enter the ...
Hi, the problem here is that, at this line
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, cb.esp32_cs, cb.esp32_ready, cb.esp32_reset, debug=False)
you need to pass DigitalInOut objects, not Pin objects, to the ESP_SPIcontrol() constructor. The signature of this constructor is given here as:
class adafruit_esp32spi.adafruit_esp32spi.ESP_SPI...
Thanks, but I have a question.
From what I read, "install required" is equivalent to bare "install". so the effect of this is to skip installing cmake. This has the effect of changing the version of cmake used. Before this, the version from esp-idf is used. after this, a version installed by github is used. Is it important to use a matching version of cmake, or will any version do?
After installing the latest version of adafruit_lc709203f I got sporadic errors (about every 4th to 8th time). Therefore, I continue to work with the hack, which works wonderfully for days.
After installing the latest version of adafruit_lc709203f I got sporadic errors (about every 4th to 8th time). Therefore, I continue to work with the hack, which works wonderfully for days.
Hi - The library change was meant to imitate the hack you mentioned. It scans for the device multiple times to wake it up. Could you post the code you are using that is running for days, and the code you tried with the latest library that is _not_working consistently. I am interested in what is differ...
Working fine:
from adafruit_lc709203f import LC709203F, PackSize
BATTERY_MON_ADDRESS = 0x0B # Address for ESP32-s3 tft Feather
def hack_for_i2c_issue():
i2c = board.I2C()
while not i2c.try_lock():
pass
running = True
try:
while running:
print("I2C addresses found:",
[hex(device_address) for device_address in i2c.scan()]
)
# time.sleep(2)
running = False
return i2...
@BeatArnet Thanks -- these are single-reading examples, but I'd assume you're reading in a loop? Could you post the whole program(s)? Uploading in a .zip is fine if large.
btw, if you upgraded the library, make sure the only copy is in lib/. A copy at the top-level in CIRCUITPY will override what is in lib/, and a .py version in /lib will override a .mpy version.
I was reading https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython and the examples seem to feature using the PIO for output. I didn't see any overall architecture or examples for input from PIO. How would CP read from a PIO state machine?
An example like reads from rx uart: https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/blob/main/examples/pioasm_rxuart.py
Thanks for the place to start - I guess I'll need to read about autopush and push_threshold
I think auto_push is just if the PIO buffer gets pushed out or the PIO program has to explicitly call for that (been a while so I could be wrong). push_threadshold is where some of that takes place.
Other functions that I will study are readinto and in_waiting ( from https://docs.circuitpython.org/en/latest/shared-bindings/rp2pio/index.html )
A lot are just passthrus from the actual PIO SDK so you can probably find information there as well if needed
I used the library "adafruit-circuitpython-bundle-8.x-mpy-20230105.zip"
The code is in the attached file
3Sensors_MQTT with deepsleep.zip
good point - I've been looking at PIO SDK a bit - but I didn't check out the source code for the CP wrappers yet - that's another good resource - ( I had been trying to think about how to approach the problem from the documentation side at first )
Looks good. Waiting on corresponding PR.
What do folks think of the new P4 chip? From a cursory glance I think it's CP compatible
it certainly looks interesting. Price and packaging seem to be unknowns at this point
Ah ok cool
Well I feel like I could justify a good bit higher price for something like that on a feather or smaller
"high performance" "50 GPIO"
*more than
sign me up
almost a meg of sram
What kind of form factor though can have 50 pins..
a big one !
I can only think of something like the PGA 2040
I don't know package names, but when I look at the Grand Central it's big
(that's a SAMD*51 and 70 pins)
https://shop.pimoroni.com/products/pga2040
something like this but bigger
So inside the qt py samd21, is the silicon the same as the samd21 on the grand central?
Just not as exposed?
if it were to be pico form factor it would be loooong boi
since it's Espressif there's gonna be 20 different modules with confusing names is all I know ๐
That's the best part.
oh I mistyped it's a samd51, but chips do exist in different packages and variants, compare the feather M4 (ATSAMD51J19) and the grand central (ATSAMD51P20A)
https://www.digikey.com/en/products/filter/microcontrollers/685?s=N4IgTCBcDaIIIBUDKcCyARArARgFLYE4QBdAXyA
https://www.digikey.com/en/products/filter/embedded/microcontrollers/685?s=N4IgTCBcDaIIIBUDKcCyARArARgApgAY4QBdAXyA
Build artifacts are here: https://github.com/adafruit/circuitpython/actions/runs/2032460774. Click on the lilygo "Details" link above, then click on "Summary", and then scroll down.
These have expired and are no longer downloadable, is there anyway to get this? It appears LilyGo won't provide a PID, @raspberrypi said LilyGo is the only one that can request it from them but they'd look into it. In the interim, I'm trying some way to flash circuitpython, even if unsupported, to this device...
This contains the following CI enhancements:
- Refactor variable naming in
ci_changes_per_commit.py:checkrun->check_runchecksuite->check_suite
- Simplify fetching changed files: use our own recipe.
- Fix for a git bug:
fatal: error in object: unshallowwhich occurs sometimes post runninggit fetch --shallow-since.- See this stackoverflow po...
I replicated the install.sh script here which doesn't seem to install cmake but I think it is better to have the idf specific cmake so I'll revert this. Thanks for pointing it out.
Changes moved to PR 7428.
CircuitPython version
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit MagTag with ESP32S2
Board ID:adafruit_magtag_2.9_grayscale
Code/REPL
import time
import wifi
import socketpool
import ssl
import adafruit_requests
from secrets import secrets
wifi.radio.connect(ssid=secrets['ssid'],password=secrets['password'])
print("my IP addr:", wifi.radio.ipv4_address)
pool = socketpool.SocketPool(wifi.radio)
session = adafruit_requests.Session(pool, ss...
What version of Requests are you using (helps to match line numbers)?
There are a few possibilities, one may be that the website uses an unsupported cipher. curl -iLv https://api.um.warszawa.pl/api/... may give some clues.
Allow setting the cpu frequency for RP2040 boards.
My first PR here. I did very basic testing using a Pico board. Being able to lower the system frequency helps with power usage. At the standard 125MHz my board uses ~20mA and at 20MHz it uses ~6mA.
Thanks @anecdata; here is the output of curl:
- Trying 91.237.139.103...
- TCP_NODELAY set
- Connected to api.um.warszawa.pl (91.237.139.103) port 443 (#0)
- ALPN, offering h2
- ALPN, offering http/1.1
- successfully set certificate verify locations:
- CAfile: /etc/ssl/cert.pem
CApath: none - TLSv1.2 (OUT), TLS handshake, Client hello (1):
- TLSv1.2 (IN), TLS handshake, Server hello (2):
- TLSv1.2 (IN), TLS handshake, Certificate (11):
- TLSv1.2 (IN), TLS handshake, Server...
LGTM! Thanks @Lanzaa. Just a few things to address.
void common_hal_mcu_processor_set_frequency(mcu_processor_obj_t *self, uint32_t frequency) {
if (!set_sys_clock_khz(frequency / 1000, false)) {
mp_arg_error_invalid(MP_QSTR_frequency);
}
}
Not related to your changes but if you are at it, can you please change the signature of the function:
- uint32_t common_hal_mcu_processor_set_frequency
+ void common_hal_mcu_processor_set_frequency
The changes need to be made at the following 3 pla...
One thing to check is if any code is assuming 125000000 as the clock frequency. I searched for 125:
I think this could be fixed:
https://github.com/adafruit/circuitpython/blob/037bfb39e37af04b74a6f77d8a5eb0eb8cbce271/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c#L42
Another issue is code that has timing derived from assuming 125MHz. This may also be fixable, at least within a certain range:
https://github.com/adafruit/circuitpython/blob/037bfb39e37af04b74a6f77d8a5eb0eb8cbce27...
I have found, that adafruit_requests is frozen, so I have replaced it with my version.
I have added prints at certain moments of the file (as I don't know how to debug life on the MagTag), I wanted to check, what is actually going on.
I found that function _get_socket is having problems with connecting. To be exact, this is where is the problem:
sock.connect((connect_host, port))
As my Python capabilities are limited, I am asking for help. Comparing 2 different addresses (Adafruit ...
Thank you for working on this PR! A number of people would like functionality like this. However, I have some remarks about problems that seem likely to occur when this functionality is made available and would like to see the documentation improved to anticipate them.
Say that I create an object like PWMOut that has an associated frequency (1MHz), then change the CPU frequency from the default (125MHz) to 20MHz. As I understand it, the frequency of the PWMOut will also change, because it...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.6 on 2022-12-21; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32-S3
Also tested and replicated on ESP32-S2 board
Code/REPL
from adafruit_httpserver.mime_type import MIMEType
from adafruit_httpserver.request import HTTPRequest
from adafruit_httpserver.response import HTTPResponse
from adafruit_httpserver.server import HTTPServer
pool = socketpool.SocketPool(wifi.radio)
server = HTTPServe...
The 301 redirect shouldn't be a problem, but you could try putting the final location URL in as your initial URL in Requests.
Here's what I have in that section of Requests for debugging. It's likely to be an OSError, which one could give clues.
try:
sock.connect((connect_host, port))
print(f"#### DEBUG sock.connect success")
except MemoryError as e:
traceback.print_exception(e, e, e.__traceback__)
...
@anecdata thanks for help here, get to the following error now :):
OSError: Failed SSL handshake
I think that the certificate is not trusted and thou such reaction.
Is there a way to lower the threshold of checking or make it trust?
W.
Seems like a cipher or certificate issue, or something at that level, but I'm not sure at this point. There's a similar issue here.
There are ways to supply a certificate, but I don't think that's helpful here. I can't connect to api.um.warszawa.pl at all. There is a certificate for *.um.warszawa.pl, but you could try:
context = ssl.create_d...
Immediately after flashing a uf2, what's circuitpython give as the reset reason?
When I upload a uf2, the device restarts with the reason being
>>> microcontroller.cpu.reset_reason
microcontroller.ResetReason.WATCHDOG
the web workflow may skip being started depending on reset reason:
// Skip starting the workflow if we're not starting from power on or reset.
const mcu_reset_reason_t reset_reason = common_hal_mcu_processor_get_reset_reason();
if (reset_reason != RESET_REASON_POWER_ON &&
reset_reason != RESET_REASON_RESET_PIN &&
...
I also get the WATCHDOG reason after flashing.
the web workflow may skip being started depending on reset reason:
Makes sense to me :grin:
@anecdata I have taken the certificate from the page, and added as in your example - same results.
I thought that adding this cert will not turn off others, but it did and with such settings, sites that were working like adafruit quotes, stopped.
Waiting for @dhalbert or @support to come and check.
Thanks!
W.
<@&356864093652516868> Reminder of todayโs CircuitPython Weekly meeting 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 to the notes document: https://docs.google.com/document/d/1CCaNlkBSC3KGohT2RsjaM-RgqQzSwrRbdAABbg3NdPg/edit?usp=sharing
<@&356864093652516868> See above about meeting today ^ (this didn't ping, I think due to missing t in the role tag)
Thanks! I did it from my phone. edited, but it doesn't ping when you edit, so your ping was still needed
Does anyone happen to know if / how we instruct RTD on what version of the theme to use for building the docs for the pages that get hosted in their infrastructure?
Ahh, maybe it's just based on the date the project was created:
Ahhhh, yeah that does seem to be the crux of the issue. Any of our libraries created before that date use an older version of the theme that doesn't handle copying example code correctly (it includes line numbers which then have to be manually removed) :/
maybe we can change that default
If I am understanding the recomendations on this page: https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html#don-t-rely-on-implicit-dependencies If we include a pinned version (or even maybe unpinned?) inside of docs/requirements.txt, it gets referenced from there in .readthedocs.yml and I'm assuming their instance will install from there and then end up with the same version we use locally.
I'll make a note to discuss it in the weeds.
@lone axle I'm not sure if this helps any but here is the "Advanced Settings" for a typical library. Note the "ignored" stuff at the top, so it may be irrelevant.
interesting. Yeah I'm thinking our config file is taking precedent. We specify python 3 in there and I believe it uses that when it makes the builds. Not certain though.
I presume the sus stdin on C3 is known right?
If you send characters during boot, it breaks down entirely and it occasionally desyncs and requires double presses.
not sure, if you think it is something to document or is something we can fix, let us know. Add feedback to the QT Py C3 guide (see left sidebar) if you think we should adda caution
I'm talking about beetle c3 but fine
When I find time I will go write a detailed report / issue.
Its just seems so frequent ppl should be complaining about it like all the time
this is the reason I havent spoken about it
I have been fighting it since beta 0
though beetle c3 is a board I only use to specifically test c3
I hate it
I just had to test stackless
The c3 had issues with the serial repl for a long time and only recently became usable at all. There's probably not a lot of people using it yet.
Oh, so its documented then?
I don't think the issue you're seeing, there was a serial timing issue
it would drop characters randomly
Ljinux has a full 'curses' library
It can break pretty badly on c3
special character input is a 70% success rate
like arrow keys and things are 3 bytes
once one fails to go through, it progressively breaks down further
I'm thinking you should definitely submit an issue when you get a chance. The last time I was using the c3, I was so happy it worked at all that I would have expected some minor problems
alright will do, thanks for the info!
if there's not an open issue we typically don't know it exists; and even if we knew and forgot to file the issue, that doesn't help the community. So, filing bugs is almost always a fine idea (searching for closed ones first doesn't hurt though)
arm's toolchain is up to gcc 12, it'd be nice to use it unless it introduces problems.
@plucky tulip In the notes document for the meeting - please put your updates in alphabetical order, ignoring the host. ๐ It basically doesn't matter anymore because we simply read the notes, but still, it can help.
If that makes sense anyway.
@plucky tulip if you would like to speak, we can add you to the right discord role for that
Their update says text only. But good call, Dan.
We can add you to the role regardless, if you'd like weekly meeting updates. ๐
i was just seeing who was in the chat already
Ah ok!
Oh, sorry, didn't know about alphabetical thing. If you could add a role, I would apprecieate the updates ๐
Done!
You may have to leave and re-join the voice chat before you can send audio in there
not sure if that discord limitation still exists or not
Thank you! 
Is the CircuitPython forum the same as the Adafruit forum?
I think so, or at least I'm not aware of any others that are used as much as the Adafruit Forums
yey nice one 2231puppy! gotta be the haptic fidget spinner.
๐
Congrats on the board 2231puppy!
Thanks!
Welcome back Kattni
Thanks!
Where are you selling them and what program are you using to design the enclosure?
Probably Etsy and Blender or Tinkercad respectively
looking forward to seeing the new pedal restoration, the ibanaz stuff was neat to see.
Also I pushed this to Twitter but a minute too late for the notes (it could be interesting for LEGO fans): https://twitter.com/DavidGlaude/status/1612531378507096088?s=20
Fitting a breadboard ( https://t.co/wZdJHEAg36 ) and a Raspberry Pi Pico W
on top of a #IKEA BYGGLEK box (with #LEGO stud).
you may need to explain the johnny 5 reference .. I think I get it but that movie was a looong time ago ๐
classic
Itโs onlyโฆ checks notes 36 years old?!?!
"for real this week" ๐
How did we get old
Yep, that is it.
there are manual little pegs for keeping score, but I've heard they are tough to use. Plus I can't skip out on a chance to embed circuitpython device into something else!
If I get everything working I'll publish the steps to "retrofit" the stock set with the bits needed to add sensors into it.
"buglet" ๐คฃ
keyboard guru
I love it.
Open source hacking vacation sounds awesome. Fascinating project with the display emulation as well, interested to see where that leads
๐ spudgers
spudging videos are the new unboxing videos
the right to repair stuff is really taking off, ifixit is getting a lot of stuff in like that
installer wizard? what is this. interesting.
They even reference the Apple tech support product. It wasn't something Apple sold, it was what we used for in-house repairs.
for espressif family boards, as I understand it
I had a few left from being there, but no idea where they are. It was a long time ago. ๐
I think I'm gonna go text only, it's getting a little busy where I am
never underestimate the usefulness of a quality spudger
the line numbers are an issue for beginners who intend to copy code
Actually I've gotta go, bye all!
I think it relate to ESP32 install/upgrade from circuitpython.org . @gilded cradle is that it?
there are some examples in learn guides that contain repl >>> and it's kinda the same issue too. we do see beginners occasionally in help with that have unknowingly copied repl characters into their code.py
well that makes my list of libraries by creation date less useful ๐
testrepo is old enough but kattni's other points stand
maybe irremote added 2018-01-26
Thanks.
Thank you!
@lone axle happy for the chance to work on my web API skills, they are still rudimentary!
Thank you for hosting Dan
Thanks all, have a good one!
Thanks
Right, this board was added on the 8.0.0 line, and will not be backported to 7.x.x. So even if a 7.3.4 came out, it would not have this board.
We're hoping for a stable release for 8.0.0 relatively soon, but in the meantime, it's fine to try the 8.0.0 betas.
I wonder if it would be possible or worthwhile to try to include a clarification message on the page for boards that don't have a stable release yet. It's ideally a short window of time and devices, but I have seen it come up a few times. A message explaining that it is normal and expected for those device to have no stable release at this time might help re-assure people they have the right thing.
List for batch 2 of TR-Cowbells is now full. Cannot accept anymore inquiries.
@lone axle Thanks for all your hard work with the reviews of the Wiznet driver. I've updated the other pull requests to include the changes that you just merged. Hope that makes life easier for you.
I seriously wish I had a use-case for it. It looks really neat. But I genuinely don't. Haven't jumped into the black hole of synth yet.
For sure, Thank you for all of the improvements! That will definitely help me test them out, I appreciate it, thank you.
@idle owl 16 switch linear macropad. eventually i intend on using it with OBS to switch cameras while recording youtube videos. basically like any macropad.
Oh neat. Fair enough, I was thinking it was more a sequencer or whatever the terminology is. I also don't have much going on that I've considered a MacroPad for either. Point is, I wouldn't want you to put in the effort for me to not find something to do with it. But it looks really excellent!
Here is the notes document for next Tuesdayโs CircuitPython Weekly meeting. The meeting is Tuesday due to a US holiday on Monday. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please 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/1aNx4nRN0TXR7JaEv5dAu139IgZDz8aMCPL-wS6WICZI/edit?usp=sharing
yes the hardware format is designed primarily for that but with mode switching you can make it a macropad. sequencers were originally video broadcasting devices for switching cameras, then someone started using it exclusively for music buttons. history of sequencers are rooted in broadcast video.
so they are naturally great for someone like JP or streamers who have multiple cameras.
I only vaguely registered you posting this, and just now thought to go back again to read it properly. Hah! "I'm Kattni, and this is Spudging Episode 4: Removing Batteries"
is that a real episode? i'd totally watch it.
TIL!
๐คฃ Not yet, anyway.
(I'm actually lol'ing over here)
there are certainly youtube channels of taking electronics to bits, big clive comes to mind. it can get a bit repetitive, mind you.
Yeah, that's why I picked something super small for my apparently-not-so-silly example.
Because with something like that, if you combine too much into one, you'll run out.
spudgers seem silly until you need to replace the battery in your car's key fob, those suckers are precision tight and almost always with a waterproof gasket.
You misspelled needle nose pliers
So far I've hit a bit of a snag with the shinx-rtd-theme issue. I added sphinx-rtd-theme to docs/requirements.txt inside the irremote library to test. But the problem is inside of RTD it executes pip install on it's own default hardcoded version first, then afterwards it executes pip install on our requirements file.
When ours runs it gets "requirement already satisfied" for the library since it was installed in the previous step at that hardcoded default version.
If there were some flag or way inside requirements.txt to specify that you want to force it to get the newest one, that could be a fix. But as far as I can tell that doesn't seem to be a thing that exists.
We can specify a version in the file i.e. sphinx-rtd-theme==1.1.1 and that does make it get the stated version and then does indeed fix the example copying issue. But that means our version is now pinned and we won't use newer ones as they become available. We currently have sphinx>=4.0.0 in the requirements, so maybe the crux of this issue was discovered before? Or maybe we were just more keen on a pinned version for sphinx.
So far though it's looking not possible for us to force RTD to always use the latest version. We can force a specific version (or greater or lessthan with pip syntax), but not force the latest version. Hopefully I am missing some part of the puzzle and there is actually a way. I've created an issue here to ask the RTD folks: https://github.com/readthedocs/readthedocs.org/issues/9876
I'm not sure you actually want to always use the latest version. Pinning the version to a known working one seems like a reasonable thing to do. Then you can upgrade it as you have time to test everything with a newer version, or as you hit problems with the old one.
I'm pretty sure you can do the same thing as we did with sphinx to force it if we want latest.
Oh hmm.
Didn't finish reading before responding apparently.
Wait, isn't "greater than x.x.x" going to get latest? Or is it a freeforall at that point.
only if the one that rtd installs doesn't already fulfill the requirement
I'm unclear on the specific behavior. But I think it will get the lowest one that is greater than the given value, so it will get the "next newest one" after the specified version, but won't keep getting new ones as time goes on and more new ones are released.
If I am wrong and that does actually get the newest ones, that would solve it for us though I think.
I think it gets the newest one that fits the specification, as long as the one already installed doesn't fit it
@lone axle Please tag me on that RTD issue. We have an odd situation with our account because we wanted to move it to a business account, but that would have broken everything we already have, so they enabled the features on our account, but we're still "community" or whatever it's called. Anyway, point being, if there's something that they can do on their end, it's possible I can make that happen.
They didn't have a migration tool or anything yet for going from a massive community account to a business account.
Thanks!
That seems silly to me.
I can see upsides of both pinning, and always taking the latest. I don't have a strong opinion either way. In this case RTD has chosen to use latest version for that library by default on projects created after a certain date, so I'm hoping it's at least possible to make the same behavior for ones created before.
But fair enough.
I will try with the Greather than and see what version it lands on. right now for that library 1.1.1 is latest "real version" but they do have some 1.2 rc's
I typically prefer taking latest. I would rather run into needing to fix things, but keeping up with things, than to realise in 6 months we have to update the thing and do even more work then. But that's me.
I understand both sides of that camp though.
yep, different libraries are better or worse at breaking change releases as well so it all depends on so many things
Indeed.
tagged you in a comment on there. Heading outside to spray off some things while it's not quite so cold. back in a bit.
Thank you!
Ah, I do think Deshipu is right about the greater than taking newest, rather than "lowest that is newer than"
Looking at sphinx for reference it looks like it gets a much newer version when it installs that one.
So maybe this is actually easy fix of just adding the greater to whatever version is "new enough" to have the fix, or really any new-ish version.
Collecting sphinx>=4.0.0
Downloading Sphinx-6.1.2.tar.gz (6.7 MB)
Oof ok.
That seems arbitrary... if it's not latest?
yeah definitely. I hope it is the latest because it would be so weird of one to land on if not.
I think you can set a range, greater than (or equals) than this, and less than (or equals) to that
Yep I think that is true, I saw some with a range and a few other combinations. Apparently you can use commas to make arbitrary multiple logic rules for it.
