#circuitpython-dev
1 messages · Page 20 of 1
- 121295 PyPI downloads over 306 libraries
is a lot 🙂
I burned this on the AWS version using M5Burner and it seems to work fine. I don't get a mounted CircuitPython drive though, is that expected behavior?
and thanks to scott for the original feature using the "dotenv" package
@codegrue ESP32 and ESP32-C3 chips don't have native general-purpose USB, so a drive cannot be presented. I am not sure which chips are used on which M5Stack devices.
😊
I wouldn't quite have worded it like that, but I did ask ChatGPT to write circuitpython after writing some Arduino code. Here's my transcript of the chatgpt session: https://gist.github.com/jepler/f86dcbc547820ce585fd9b705cdd60d2
There are a few gradient generating code in my thermal camera code.
Nice, I'll check that out. I'm interested in any inspiration and prior examples I can find.
Another test of the CircuitPython code to add slicing to a dispayio.Palette object. In this test, parameters are randomly generated to slice a 255-element palette object then displayed as the first n elements of the bitmap palette. Thanks to John Park for creating the bitmap image.
[everyone tries to figure out if cgrover is joking about the anti-happy-birthday ordinance]
👏
i assumed it was a joke. thank goodness it's no longer copyrighted
Maybe a new SUbaru, Jeff?
We've been mostly happy with subarus over the years, but weren't looking at subarus this time around.
prius hits a sweet spot for us with regard to size, and we like the fuel economy of the hybrid engine
I looked at used prices for Prius's in your city. They are about $2k higher than when we bought a low mileage 2013 Prius Plug-In in 2017.
yeah a used prius goes for the same price as a new prius, because you're buying "not waiting 6 months"
we also got a 2013 very low mileage Corolla a year later, and those prices are also higher
Please explain what you are trying to do. I wouldn't change countio at all.
thanks for hosting @lone axle !
Yes, thanks! I'll head out, but let me know if you turn out to need the back-up recording
Thanks all!
I know of uses for countio where people are just counting pulses. The Espressif impl uses the PCNT peripheral, not interrupts (as you probably know already).
Interesting new wrinkle in the host workflow for me. Drag and Dropping the video file to the upload box on YT was not working. I was getting "file invalid" type errors. It seems to work okay by using the Browse button instead of drag and drop though.
this is the first time actually uploading from my new computer I think. I switched primary browsers to firefox at the same time though so lots of variables. I can remember to use the button.
Glad I caught a bug that was shaving off the first two digits, this real number is more impressive!
oh is that a true story? 🤣
How's it going @lone axle ?
updating newsletter right now, should be done shortly.
👏
PR for that is created.
Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1-zwAp6Jeh9Z4YiF197EHnHrXEuqxvpP4em1B3zusAak/edit?usp=sharing
CircuitPython Weekly Meeting for December 19, 2022 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to pa...
@jepler On ESP32-S2, setting up web workflow in settings.toml is causing a crash very early on. I will debug more after dinner. I can fetch values from the file just fine when the web workflow is not triggered.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; Raspberry Pi Pico W with rp2040
Code/REPL
import time
import traceback
import wifi
import socketpool
import ssl
import adafruit_requests
from secrets import secrets
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
print("Connecting...")
wifi.radio.connect(secrets["ssid"], secrets["password"])
print("My IP address is", wifi.radio.ipv4_address)
pool = socket...
I try to manage expectation about this board and avoid short circuit or broken sensor. 1) I almost burned myself by mixing LOLIN I2C JST SH accessories and Adafruit QTPy, reverse way, I could have destroyed an Adafruit sensor by connecting it to Lolin S2 Pico. 2) The screen does not work as expected for a build-in screen, DISPLAY is not defined when you import board
I did hesitate between making a special section like "Caveats" or highlighting how it deviate from one can expect from a bo...
https://github.com/jepler/circuitpython/commit/e635457a32b1cc3b4b611808fcdd16951d12f99c @tulip sleet @slender iron and anyone else interested, this is a non-booting sketch of what I'm thinking when it comes to revamping supervisor allocation.
Key is, whenever gc is up, supervisor allocations are also 'regular' allocations, so making a supervisor allocation is just gc_alloc + some slight additional bookkeeping. A freed supervisor allocation becomes gc collectable. supervisor allocation moves are done when gc is initialized.
I didn't try to debug anything, only got it to where it'd build for pico w.
@tulip sleet I'll put that aside and look at the problem you saw with getenv
Yes! I think I caught it before it ever printed them for the meeting but I noticed it was surprisingly low and fixed it before anyone else had questions. 😂
@onyx hinge please file an issue for it so it hits my inbox
@tulip sleet at 8.0.0-beta.5-27-g1b15985783 pico w wireless works, including workflow. hum. are either your ssid or password close to the size limit?
I'll get out an espressif board next
I suppose the display initialization could be added to board.c for this board?
Using a build directly from git including the pull request mentioned above I was able to solve this issue by adding the following to boot.py:
import displayio
displayio.release_displays()
SSID is 4 chars, password is <16 chars, so I don't think
i will try on Pico W
@tulip sleet you have time now/soon? I'm thinking about pin management with the ULP
and you did preserved pins
now is fine
I have a sketch at https://github.com/jepler/circuitpython/commit/e635457a32b1cc3b4b611808fcdd16951d12f99c but it doesn't boot.
The idea is to do more to leverage the gc allocator to make the supervisor allocator work.
See the commit message for more details.
Entered as an issue at @tannewt 's request
I don't plan to work on this until after 8 is out, but it was in my brain and I had to do at least this much of it.
@tulip sleet @onyx hinge any thoughts about exposing pin number to python? I'd need it to patch a ulp program
could do as .pin_number or int(pin) I think
or I could add a ULP function to do it
is it RTC_GPIO_n or GPIO_n or is it lower level than that?
lemme look at the doc
afaik it isn't expose to python yet
on ESP32-S2, GPIO2 == RTC_GPIO2, but on ESP32, GPIO32 == RTC_GPIO_9, etc
that was the craziness I mentioned in our video talk
espulp doesn't target esp32 now anyway
I think int(pin) is not great, I'd do .pin_number or .number.
I'm just going to do espulp.get_rtc_gpio_number()
that way it won't leak to other ports
@slender iron just sitting down to listen to the meeting. Have you considered a dedicated NAS, synology is a very popular brand.
I have an old qnap
I'll have to look more into it
I could also put the old cpu and mobo back in the comp...
Though if the PC would have just worked probably wouldn't even be bringing it up. Sucks to hear the PC woes.
yup, frustrating for sure
Have you tried unplugging it, waiting a couple minutes, and plugging it back in? Sounds basic but during a lightning storm if there's an electricity loss sometimes my PC's actually refuse to power back on unless I do that.
it trips the circuit protection in the PSU
I didn't unplug, just flipped the psu switch
Honestly don't know if there's a difference, I always unplug just to make sure the caps drain fully.
Make sure you got the motherboard headers for the power switch correct? If you get them backwards it might turn on and never again. The motherboard power switch pins wait for a 12V blip of a toggle switch.
Also make sure the power button isn't stuck... that actually happened to me with my current PC case. I had to dremel part of the power button so it would slide smoothly.
a way around PC power buttons it to jump the power sw headers with a screwdriver or jumper directly.
hopefully it's something simple that doesn't require parts replacement 🤞 wish you good luck.
Thanks for 3620d14. Now my Metro ESP32-S2 is coming up in web workflow. I am still have odd crashes. Now I am getting HardFault_Handler safe mode when using the file browser to download a file that is not known to be a text file:

I am not having this problem with the tip of main right now.
Backtrace is:
0x400a8850: _send_str at /home/halbert/repos/circuitpython/ports/e...
@onyx hinge I edited the report above -- I am seeing similar issue on Pico W
this seems like it might be a storage and/or gc issue
I merged main into this PR a number of times so it should have the startup fix.
@tulip sleet this is wrong before and after
} else {
- _send_str(socket, "Content-Type: application/octet-stream\r\n");
+ _send_strs(socket, "Content-Type:", "application/octet-stream\r\n");
}
because of the missing NULL, right?
right
I pushed a fix and enabled a gcc attribute so it would have been a compile-time diagnostic.
Thanks! taking a break but will check it again in a hour or less
it's specifically the pico w that is not consistently coming up now?
yes
re-plugging or resetting?
I do a UF2 load and CIRCUITPY does not appear. Plugging it in and unplugging several times and it eventually shows up, but not necessarily on the first power cycle
I think I just had it happen on trial 6 of re-plugging
aha
back later -- thanks!
i am unplugging at the USB-A end; easier on the fingers!
yes
same here
I notice common_hal_wifi_radio_connect can throw, which would go crashy-crashy during wifi workflow startup, pursuing that angle..
doesn't look like anything that should happen though
you could get some magnetic USB plugs for testing plugging/unplugging, I think Adafruit has some 😉
the cables weren't in stock last time I looked but yeah I have some of those
@tulip sleet this affected rebooting from the bootloader back to circuitpython, so it's different than the "delay 1s at startup" problem, right? because that was a cold boot only scenario as I understood it.
yes, maybe so; but perhaps the router doesn't connect sometimes, for whatever reason, so we should catch that, perhaps?
most failures return error codes, but a few failures don't
wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t *ssid, size_t ssid_len, uint8_t *password, size_t password_len, uint8_t channel, mp_float_t timeout, uint8_t *bssid, size_t bssid_len) {
if (!common_hal_wifi_radio_get_enabled(self)) {
- mp_raise_RuntimeError(translate("wifi is not enabled"));
+ return WIFI_RADIO_ERROR_UNSPECIFIED;
}
enabled is just a flag and web_workflow calls enable() so it can't happen
mp_raise_RuntimeError(translate("Wifi is in access point mode."));
}
```then there's this one, which is querying the device I think
but how could the AP be up at that point
I changed some STM PWMOut code (I think that was it) to only return error codes, so I could call it outside the VM safely (maybe in LED status code or something). Or maybe I was just trying to be consistent
From 90894014a2e146e07c2ea4f9f840242fc33bf6a0 Mon Sep 17 00:00:00 2001
From: Jeff Epler <jepler@gmail.com>
Date: Mon, 12 Dec 2022 19:43:10 -0600
Subject: [PATCH] Use the HW LED as status indicator
For me this made a rare startup failure stop, which is nonsense.
---
ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
index e5d8660b2b..a31ee7327c 100644
--- a/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
+++ b/ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h
@@ -4,5 +4,7 @@
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_PULL (1)
#define CIRCUITPY_DIGITALIO_HAVE_INVALID_DRIVE_MODE (1)
+#define MICROPY_HW_LED_STATUS (&pin_CYW0)
+
#define CIRCUITPY_BOARD_I2C (1)
#define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO5, .sda = &pin_GPIO4}}
--
2.34.1
``` this is a nonsense fix
but it's made me succeed 15/15 tries, when I was getting >1/10 failures before. but never 50/50 failures like you seemed to be describing.
I was getting 4/5 failures
I certainly wasn't getting that
it's confusing; I will try again with tip of main. I think this is timing or uninitialized memory or floating pins or something
are the CYW pins all firmly set to something before startup is attempted?
that's an unanswerable question.
you mean the HW interfacing pins between Pico & CYW or do you mean the CYW's GPIOs, which is what the status LED above is?
that is all managed in the sdk
I assume it's right
never_reset_pin_number(24);
never_reset_pin_number(25);
never_reset_pin_number(29);
``` I never-reset them and that's all I ever do
reset_all_pins is called before this
we don't accidently reset those pins ... just what I was going to ask, but on hard reset, are the never_reset's in effect? The espressif code has "reset forbidden" pins so the SPI flash pins etc are not disturbed
it's just a hypothesis
if this is really the initialization problem then why did it only appear for you today?
no idea; just a timing difference, maybe. I did not try my Pico W with web workflow before
but... I was having trouble before that, so never mind, I think that's not it. I am going to re-test the ESP32-S2 and try the BLE workflow name setting and get the PR merged. Then I will come back to testing this more systematically, maybe with a bisect
at power on GPIO pull down is enabled. However, gpio reset (circuitpython reset_pin_number) turns pull down enable off. So it could allow an interface pin to float up
OK pushed those things
you two are talking about behavior due to post-beta.5 changes, right, rather than generic beta.5 picow?
it appears so
don't know if it's relevant at all, but sockets are broken in beta.5 on picow if web workflow is enabled (you may have seen the issue)
I wonder if #define MEM_SIZE 4000 this needs to be increased (in ports/raspberrypi/lwip_inc/lwipopts.h)
the repeated retries stuff in requests conceals the "real exception", whatever it is.
and it's written in a way that exception chaining doesn't help 😭
fyi, sorry, CPB build is not working even without settings.toml
maybe we should leave this all for the morning
I pushed the cyw43 initialization changes at least
tip of main for CPB is working
mp_obj_t ble_name = common_hal_os_getenv("CIRCUITPY_BLE_NAME", mp_const_none); yeah this is suspicious, I don't think the heap is up so the object variant can't be used
it does quick blue flashes twice and then nothing
probably needs something like```diff
diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c
index 8948be1a5d..483895b5bb 100644
--- a/ports/nrf/common-hal/_bleio/Adapter.c
+++ b/ports/nrf/common-hal/_bleio/Adapter.c
@@ -346,9 +346,11 @@ STATIC void bleio_adapter_reset_name(bleio_adapter_obj_t *self) {
mp_int_t name_len = 0;
#if CIRCUITPY_OS_GETENV
- mp_obj_t ble_name = common_hal_os_getenv("CIRCUITPY_BLE_NAME", mp_const_none);
- if (ble_name != mp_const_none) {
-
common_hal_bleio_adapter_set_name(self, mp_obj_str_get_str(ble_name));
- char ble_name[32];
- getenv_err_t result = common_hal_os_getenv_str("CIRCUITPY_BLE_NAME", ble_name, sizeof(ble_name));
- if (result == GETENV_OK) {
-
}common_hal_bleio_adapter_set_name(self, ble_name); return;
#endif
while the one in bleio-hci was assuing that the heap was live even before my change: self->name = mp_obj_new_str(ble_name, (size_t)name_len); and I must have copypasted my assumptions
and the type was misspelled
got that
ok, it's coming up without the workflow enabled
(I have an animation running, ahven't tried BLE yet)
(I was using this CPB on Halloween)
i mean without settings.toml, not without the workflow
not seeing workflow yet, trying beta.5 to make sure
@onyx hinge I am too tired to figure out what is going on with the workflow, no worries, will test when I'm more coherent. I checked off the ESP32 workflow test.
thanks, goodnight
you too!
suport pulseio.pulseOut on M5Stack Atom Lite
My check result shows below.
[ Circuitpython version ]
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; M5Stack Atom Lite with ESP32
[ Result ]
Start
Traceback (most recent call last):
File "", line 23, in
File "", line 17, in send_ir_pulse
AttributeError: 'module' object has no attribute 'pulseOut'
[ source code ]
import pulseio
import pwmio
import array
import board
import time
IR Pulses
IR_head_pulse = array.arr...
This PR adds support for our new RP2040 board with integrated uSD card connector and RTC device.
Any activity using DMA with PIO and RAM in CircuitPython?
for the output side there's https://docs.circuitpython.org/en/latest/shared-bindings/rp2pio/index.html#rp2pio.StateMachine.background_write but for reading there's still nothing in the python API
Oh, does ‘readinto’ utilize DMA?
both read and write use DMA if the buffer is large enough but they block until completion. Often when people ask about DMA they are actually asking about background operation
so I answered that question instead
Thanks that makes sense. I am trying to port a microPython program to circuitPython for HID support. I had the DMA triggering from the RXFIFO
As the Olimex ESP32-POE board is currently not listed on the CircuitPython downloads page I assume this is not supported so far:
https://www.olimex.com/Products/IoT/ESP32/ESP32-POE-ISO/
That is a great board, however, and one of the very few (if not the only) option if you need a very compact and energy efficient board with PoE support.
Is there a chance CircuitPython could add support for this?
This would be highly appreciated, thanks for all ...
We generally rely on board users or manufacturers to add third-party boards. If you'd like to try it yourself, see:
https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython
https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website
USB HID support ? doing USB host via pio ?
Not host, doing device emulation
I’m using PIO for a high speed communication to FPGA
@tulip sleet I have no idea how to test BLE workflow. is there an app for android?
I was going to ask you that. 🙂 I am using PyLeap and File Glider. I got PyLeap to start to pair, but it didn't finish. I was going to try a 7.x build to see if something broke
i don't think there is an Android app. Do you have no iOS device?
none
I performed a brief search for this issue and did not see anything.
I am running CircuitPython v 8.0.0 beta 5 from 12-11-2022 I believe.
Hardware is:
Feather ESP32 S3 TFT PID# 5483
MAX17048 PID# 5580 - Adafruit MAX17048 LiPoly / LiIon Fuel Gauge and Battery Monitor - STEMMA JST PH & QT / Qwiic
I am following the Adafruit Learn guide here
My library matches the tutorial as does my code belo...
Hello Dan,
first thanks a lot for your reply quick reply which is much appreciated!
I would be happy to help with that and I do think that I could get it to work in WiFi mode as this board is based on the regular ESP32 chip - so copying the configuration from one of the already supported boards should work. Here the hardware configuration of that board from PlatformIO which supports it:
https://docs.platformio.org/en/latest/boards/espressif32/esp32-poe-iso.html
The main challenge I ...
I was going to continue testing if you can't get an iOS device.
I tried code.circuitpython.org in chromium on my linux machine and even after making all the settings it asked for the "request bluetooth device" button is still greyed out
@tulip sleet let's assume I won't have my hands on an ios device today
I will try it again in a few minutes and let you know what I am seeing. Doing a non-work thing.
of course!
Hi @deshipu , yes there must be a way to have the screen work as expected but apparently it is the first board where the screen is connected in I2C so there was no example to copy from.
https://github.com/adafruit/circuitpython/issues/7325#issuecomment-1345048637
If this PR make's it, and then later someone implement that the proper way, we can remove the warning (or say starting with CP9.0.0-alpha1 this statement is not true anymore).
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; Waveshare ESP32-S2-Pico with ESP32S2
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; Raspberry Pi Pico W with rp2040
Code/REPL
import wifi
a = wifi.radio.start_scanning_networks()
for i in a:
print(str(i.authmode))
Behavior
[None, None]
[None, None]
[None, None]
[wifi.AuthMode.WEP, None, None]
Description
wifi.Authmode.WPA2?
wifi.Authmode.OPEN?
Ad...
@tulip sleet is https://github.com/adafruit/Adafruit_Board_Toolkit/pull/10 on your radar?
@onyx hinge we have pyleap and glider for android on github
not released as apps?
both should be setup with CI that build apks
no, I missed that
not released yet. I encouraged antonio to do it but then sent him on a side quest...
ok, so on a pi pico does 'board' not return SCL and SCA?
from board import SCL, SDA
Traceback (most recent call last):
File "code.py", line 7, in <module>
ImportError: cannot import name SCL
the default I2C pins are SCL GPIO5 and SDA GPIO4
I don't see them defined seperately in pins.c
There is more than one set of "defaults"
@edgy flax the silkscreen of the pico does not designate a default I2C bus so CircuitPython does not either. However, in 8.0 beta we do designate "board.STEMMA_I2C" which is the port that is compatible with the Adafruit "cowbell" add-on.
yes I was referring to what is set in mpconfigboard.h
#define CIRCUITPY_BOARD_I2C (1) #define CIRCUITPY_BOARD_I2C_PIN {{.scl = &pin_GPIO5, .sda = &pin_GPIO4}}
https://github.com/adafruit/circuitpython/issues/5041 https://github.com/adafruit/circuitpython/issues/4121
"That's the great thing about standards; there are so many of them"
haha yes
anyways these two pins (and a combination of others) should work?
yes, any pair as shown on the pinout diagram: https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/pinouts
so pick any two that are I2C0, or any two that are I2C1
you could use GP5 and GP4, you could also use GP5 and GP0
but that's more confusing
they don't have to be physically adjacent
@tulip sleet can I ask you about something else .. I have a problem at the moment where when I use a compiled uf2 from the RP pico SDK, my program doesn't boot on a power cycle. With a uf2 from circuitpython it does always work (hooray!!); where can I look up which flags you set for the pico SDK?
I already found this one
#define PICO_XOSC_STARTUP_DELAY_MULTIPLIER 64
and are you also using this one?
#define PICO_DEFAULT_BOOT_STAGE2 boot2_generic_03h
In circuitpython I use EXTERNAL_FLASH_DEVICES = "W25Q64JVxQ", I have that one on my board.
So this isn't strictly a Circuit Python problem, more a problem that Circuit Python has already solved ❤️
The question would be, where can I look up what EXTERNAL_FLASH_DEVICES does
in ports/raspberrypi/boards/*/pico-sdk-configboard.h we set the MULTIPLIER for our boards, and many other people use it too. We are not using the DEFAULT_BOOT_STAGE2
have you set the multiplier already?
yes! building my board in circuit python works reliably with that flag
and it also reboots reliably
so you need to also set that flag in the UF2 you are building in the pico-sdk. We have that set in our board definitions that were added to pico-sdk. lemme find that
i guess we are using the GENERIC flag in those .h files, but not in CircuitPython
ah fantastic! and then I would just include that board definition in my cpp file, right? #include "boards/adafruit_feather_rp2040.h"
// Use slower generic flash access
#define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
i thought it's used automatically as part of the complex CMake logic. You set which board you are compiling for, and it picks up that include? I forget, sorry. You can check that by introducing an #error temporarily in the .h file to see if it gets read
OK I'll find that out! thank you so much for the pointers
I'll have to say it was charmingly easy to set this up in Circuit Python
thanks - we want to make it easy for us, and that transfers over 🙂
@tulip sleet yes it seems like if I change the BLE name I have to forget & re-pair but that's probably expected
but I can set a custom name in settings.toml and connect to it
just pushed the fix, which was slightly different than the non-working patch I shared last night
(name_len was never being set anymore)
i am having trouble getting Glider to connect again after changing from 7.3.3 to 8.0.0-beta.5. I forgot everything and even turned Bluetooth and and off on the iPhone. However, iOS caches BLE stuff very agressively. I may try power-cycling the phone.
i could also try with an Android tablet
ah, I had to clear bonding info yet again on the CPB
I guess I did that too at somewhere along the line
CIRCUITPY_BLE_NAME="0123456789012345678901234567891" this works (31 chars) but 32 chars gets me the name "nRF5x"
which is weird, it should get default_ble_name!
ok, works for me too with a new CIRCUITPY_BLE_NAME
it was set(PICO_BOARD "adafruit_feather_rp2040") in CMakeLists.txt
and thank you so much, because that combination of things fixed it!!
In the end I needed the PICO_XOSC_STARTUP_DELAY_MULTIPLIER but not the PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H
glad you got it working! The multiplier thing is tricky. On your board, did you use our choice of capacitors and crystal or the Pico ref design component choices?
yes and also most of the actual layout around the chip
ah hang on we used that from the pico documentation
so 18 pF caps + their crystal?
there was a Kicad file and a hardware reference PDF
but we made a four layer board
my wife does the PCB and engineering so I don't have it from the top of my head
the cap choice is described in one of the PDF's. Ah, interesting. We did a lot of experimenting because we originally we thought maybe we chose the caps wrong due to a typo, but replacing them did not fix the slow xosc startup. We know what our board yield was; we don't know what RPI's was; their samples didn't show this problem but maybe they are QA-ing those out
she says she calculated the caps from the formula in the reference PDF
Yeah, I thought it might return both an SCL0 and SCL1 since that's what the learn guide tags them as. GP5 and GP4 for the win. Thanks! That got me to the next bump in the roard
and you still had the problem, at least on some samples ... interesting
yes we only have 5 prototypes but they do behave differently
Circuit Python works reliably on all 5 so that configuration seems to work for us
@tulip sleet OK I pushed another fix related to maximum buffer length
lengthening the xosc startup seems very reliable
they might consider changing the default, I guess
from my testing this is set to be approved; you fixed the latest edge case;
Thank you for this, and for patience through all the churn and testing!!
I don't think supporting any LAN chips is a priority for Adafruit-funded folks in the near-term. We'd be happy to review and merge support though.
Please post to the support forum: https://forums.adafruit.com/viewforum.php?f=60 This isn't clearly a code problem.
Web workflow uses 1 socket for mdns, 1 socket to accept connections with a buffer of 1, 1 "active" socket for web requests and 1 socket for the websocket connection. So, 4 or 5 depending on how the pending connection is handled.
So this always has the heap inited on allocation but then it tries to move movable allocations on init? Is there a period where it is deinited?
You don't need this file if you use SRC_SHARED_MODULE_INTERNAL: https://github.com/adafruit/circuitpython/blob/main/py/circuitpy_defns.mk#L720
I'd put the common_hal_ functions into __init__.c in shared-module and the parsing stuff can stay in the "internal file" getenv.c.
I realize I'm being nitpicky but I think this reorg is easy to do and makes it more consistent with other modules.
I will do the 'fix' for needing the nearly-empty file.
Most of the code has to stay in getenv.c so that it can be linked into the unix coverage build for testing.
@slender iron getenv_str and getenv_int could be moved to __init__.c (making os_getenv_buf_terminated part of the non-static API) but common_hal_os_getenv has to be in getenv.c so it can be linked with the unix coverage build without replacing the rest of 'their' OS module, which is a big undertaking we do not need right now. I like getting rid of the extra file, but I'd rather not do any of those other things right now.
(and honestly getenv_str and getenv_int would be nice to directly test in the testsuite; those are the code paths that are all about static buffers)
that's fine. just document it somewhere
I'll add a comment
// These functions are separate from __init__.c so that os.getenv() can be
// tested in the unix "coverage" build, without bringing in "our" os module
done & pushed
Thank you for this, and for patience through all the churn and testing!!
thanks for the pointer about _INTERNAL @slender iron
@tulip sleet one more build & review ! but no substantive change
that's interesting, when I "1200 baud trick" the CPB it gets into a broken bootloader mode and then when I reset-button it, I get into safe mode in CP
@tulip sleet is this the bootloader that is challenging to update? UF2 Bootloader 0.2.11-8-g2c13fd5-dirty lib/nrfx (v1.1.0-1-g096e770) lib/tinyusb (legacy-755-g55874813) s140 6.1.1 ?
Yes, I think 0.5.9 or 0.6.0 or later can be self-updated, but not before, something like that
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Nordic system firmware failure assertion.
Please file an issue with the contents of your CIRCUITPY drive at
https://github.com/adafruit/circuitpython/issues
Press any key to enter the REPL. Use CTRL-D to reload.
it is relatively easy to solder a 3 pin header or jumpers on the CPB pins and connect up a JLink and then do the update: https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/README.md#flash
thanks
not sure I'll do that right now. Using the 1200 baud trick to reach bootloader is something I like to do but it's not really something commonly used by folks. I assume if this was still a problem for arduino we'd have heard about it.
(since it's the method arduino uses too)
Do the ESP based Adafruit "feather" boards support native USB? If not, how would you get circuitpython on those?
What's the status of the CircuitPython JTAG and MachXO libraries?
Asking because they haven't been updated other than upkeep in a while and they tend to be a large share of the Library Infrastructure page on circuitpython.org
i don't see them on circuitpython.org: where are you seeing them?
https://circuitpython.org/contributing/library-infrastructure-issues listed a bunch of times here
e.g.,
For PyPI compatibility, missing optional_requirements.txt
https://github.com/adafruit/Adafruit_CircuitPython_JTAG https://github.com/adafruit/Adafruit_CircuitPython_MachXO
@proven garnet I don't see them in the bundle. Should we maybe leave Adafruit_CircuitPython_* libraries out if they are not in the bundle?
Hmmm... That would work. It would also help with libraries that are under development from always showing up.
ESP32-S2 and ESP32-S3 have native USB
ESP32 does not have native USB (so no CIRCUITPY) but:
https://learn.adafruit.com/circuitpython-with-esp32-quick-start
we do want to include Blinka, I think? Not sure if there are other special case libraries
I think we could take the full list, we determine what isn't in the bundle (only non-Blinka libraries and exceptions), then use that new list for all the other checks
ESP32-S2 and ESP32-S3 boards have native USB support. It is a function of the chip. "ESP32*" is a family of chips, and more confusingly, plain "ESP32" is also the name of the first chip in the family.
This is turning into a support question. Could we continue discussion in our discord, https://adafru.it/discord or the forums, https://forums.adafruit.com/viewforum.php?f=60 ? I will close for now.
The new list would include Blinka and the like
I can file an issue and self assign for adabot
you have the whole list, so you could see what the exceptions are
Good idea!
Since "M5Stack devices" encompasses a growing family, if there are specific requests, let's make issues for those. Otherwise I wouldn't be sure when we could close the issue.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; S2Mini with ESP32S2-S2FN4R2
Code/REPL
import board
import displayio
import adafruit_ili9341
import busio
import digitalio
import esp32_camera
displayio.release_displays()
display_bus = displayio.FourWire(
busio.SPI(clock=board.IO7, MOSI=board.IO5),
command=board.IO9,
chip_select=board.IO3,
reset=board.IO10,
baudrate=40_000_000,
)
display = adafruit...
@tulip sleet I don't reproduce the make check-stubs failure locally, do you?
oh wait I do
i just did, I had to install the venv thing
something updated out from under us??
also fails on tip of main, not in your PR (as one would suspect
Using legacy 'setup.py install' for Adafruit-PlatformDetect, since package 'wheel' is not installed.
sudo apt install python3.10-venv caused new versions of mypy, isort, black, Blinka, pyserial to be downlaoded and instead.
so isort is the most suspicious update, considering that's the failure point
isort 5.10.1 was new in November 2021 :/
so hunh
5.10.1 was installed by pip, but we are using 5.11.2?
5.11.2 3 hours ago, 5.11.0 was yesterday
stopped supporting 3.6?
@onyx hinge are you debugging this, or should i try?
ok, i will spend a little time on it
can you just pin isport?
I have a machine here with 5.9.3 of isort and it seems to be fine
but everything else is old too
(pip freeze output)
i will spend a few minutes on diagnosis, at least.
but will pin if it's not triviial
On some URLs, with web workflow off, things appear to work. But the adding some print-debugging to Requests to expose the pass'd and retried exceptions, it looks like there is either OSError: [Errno 9] EBADF (in my case, for an mDNS address) or OSError: 32 [EPIPE?] (in my case, for a numeric local IPv4) on every other try, but the retry gets it, so nothing is reported with the standard library.
This happens in beta.4 and beta.5. So something has been lurking there that may be relat...
@tulip sleet I'm back, did you figure anything else out about that stubs failure?
@tulip sleet from types import we seem to have this line in the generated _bleio.pyi
from types import all alone by itself? hmm
I think I have a fix if that's truly the problem
yes older isort removed the line!
This prevents a bogus line such as from types import from being generated.
surprisingly this was not detected as a problem until a change in isort! Formerly it would remove the bad line, but now it (correctly!) errors
File "<string>", line 1
from types import ()
^
SyntaxError: invalid syntax
```importing the empty tuple is not permitted either, interesting.
I will undo the pin
force-push and merge the toml PR, sound OK?
well, I will merge your 7341 first, and then merge the TOML pr
I'm not sure what you need to force-push but if you need to then do
i pushed a pin of isort in your PR
Thank you for figuring this out. I was speculating it was some new 3.11-ish thing from isort.
@proven garnet I can move those repos to myself too
@onyx hinge I am cancelling some unnecessary PR runs to get things merged (in case you see "failed" email messages)
I'll still go ahead and make that proposed adabot update but that also works
I just purchased a PyPortal Titano to do a PoC for a project that will use a large screen. This looks like a great product but for $60 will be too costly for a production run. What would be the process to add CircuitPython support for cheaper Chinese equivalents such as this:
https://a.aliexpress.com/_mKq21pC
Submit a pull request to add it. You'll need to request a unique USB pid:vid but espressif had a GitHub repo where you can do that.
Are there detailed instructions for the whole process? I am happy to contribute but am not the maker of this board.
Search in learn.Adafruit.Com there's a guide about the generalities at least.
Thank you
Does this assume the designer of the board is doing this, or can a random user (me) do that for a purchased board?
You can do it, for sure
Displayio is its own thing and not the most high performance.. micropython with lvgl might be something to consider as well. Not trying to dissuade you just offer alternatives
There is no port of LVGL to CircuitPython then I take it.
Interesting that last link mentions LVGL fits the vision of CircuitPython.
a lot of what you want may be in various displayio-based libraries
Cancelled PR build since it looked like it was going fine. I won't cancel the merge build.
@ctmorrison I have been trying to reproduce this. I have been running your test program for about 8 hours, without a crash, on CircuitPython 8.0.0-beta.5. I reduced the sleep time from 15 seconds to 2 seconds to speed up the possibility of crashing.
Is this battery-powered? Might your battery be getting low when it starts crashing? I'm testing with a 5V AC adapter, so I am doing true deep sleep, but the power is steady.
Forgot to mention that with web workflow on raspberrypi beta.5, when using the above code, I've tried several URLs. With the Adafruit URL, I don't know what the server sees, but none are successful. When I hit a WAN Apache server I can access (using domain name), the server shows HTTP 200 status codes and occasionally some are successful, but usually error as described above. But a LAN Apache server (using IP address) shows HTTP 408 status codes (server timed out). So it looks like some level...
I changed spell pulseOut to PulseOut.
I can observe IR pulses. Thank's
The device is battery powered and the battery is sufficiently charged. I've moved to Arduino code to run the application, so this exercise is rather academic at this point in time. However, I appreciate your attempt to find the issue. Happy Holidays!
would there be an interest for a full project in Circuitpython that acts as a client for Blinka ? Think U2IF but written in Circuitpython
We have had some projects vaguely like that in the past: Firmata, extended for CPB, and the Adafruit BLE services used here: https://learn.adafruit.com/bluefruit-playground-app
we can ask Management ( 🙂 )about it
I was wondering about firmata too, if there would be a point in blinka being able to talk to it
there isn't much call for firmata; code.org might use it, but we rarely get inquiries. I asked about the U2IF-ish thing internally: U2IF solves most problems, but not all, not clear there's a strong need for something new. We don't really want to fork U2IF permanently, I think.
yeah makes sense
It's been 6 days and I have not had another core crash on any of the 5 QT PY's. I think the problem was due to running multiple QT PY boards with identical default hostnames on the same network. The problem may be specific to my Asus Wi-Fi router. Many of the simultaneous core crashes did seem to coincide with deauths in the router log.
I don't know that these kinds of errors should cause literal crashes, but that may be beyond our control.
Did some testing on espressif: none of the exceptions occur with beta.4 or beta.5 on QT Py ESP#@-S2 or QT Py ESP32-S3, including none of the "hidden" exceptions pass'd through Requests' retries.
However, with some URLs, the first try in the _send_request Requests loop gets an empty response (status code 200 on the servers in all observable cases) but the retry is successful.
I'm testing with
Adafruit CircuitPython 8.0.0-beta.5-11-gfc13fba6e5-dirty on 2022-12-14; Raspberry Pi Pico W with rp2040
this contains some fixes to make a wider range of socket name lookup failures throw the "gaierror" exception as intended, but should be functionally identical to main.
wifi workflow is enabled. However, I have not connected to the web workflow interface or messed with resolving the device's mdns name from other computers.
To exclude as many factors as poss...
While investigating #7333 I noticed that the work in #7269 was incomplete: multiple paths would still result in an OSError, and for one API it was unclear whether it was intended to throw or return a sentinel value in the case of failed lookup.
This tidies things up, and I think catches all the error paths.
Just chiming in to say I think I'm having the same issue. I've designed a custom circuitpy board based around a raytac module but it uses the a split 1.8/3.3v rail where the nrf52480 and nvm run off 1.8v (VDD and VDDH are tied so it's in 'normal' mode). My status led's post circuit python uf2 upload seem to be working and suggest it's running, but I get no usb activity so I can't load programs onto it. The adafruit UF2 bootloader works without issue as well while things are in bootloader mode...
I tried running the original test script on the Pico W running the 12/8 beta.5 bits from s3 and after about 5 minutes I got the "OutOfRetires: Repeated socket failures" message.
I then flashed the latest bits from github and replaced my .env file with a settings.toml file and ran the test script which results in the success message being displayed repeatedly. I've run it now for several minutes without any failures.
This is probably expected behavior but I haven't noticed it before. Prior to running this script the Pico W shows up in the web workflow list of "CircuitPython devices on your network" from another idle device, but while the script is running the device doesn't show up in the list.....
great success
in the end the source of all the problems were two swapped data pins in the information on the camera module
jpeg works too now
yay!
This is often my greatest downfall
the sad thing is, I realized I can't use this camera shield with my robot, because I already use all 8 pwm channels to control servos
aww...
and unlike the imagecapture lib, this one doesn't support the option of using an external crystal for that
I'm still super happy I got it to work, and I'm sure it will be useful in other projects
Fixes #7312.
Redo pin resetting logic to never ever reset vital pins. Thanks to @RetredWizard for diagnosis.
The only board I had to test is the Teensy 4.1, which does come up in the REPL. I did make it blink board.LED.
@RetiredWizard let us know if this build works for you
Looks fine. -- thanks! I am approving assuming the answer to my question is that you are using QSTR's because something is preventing the message from being translated.
Just to be clear, the gaierror messages are not translatable?
I briefly looked but wasn't sure how to use a translatable string here. (It was this way in the first commit too)
I can try to make it translatable if you like.
Well, the code to do that is in py/objexcept.c and maybe a little in py/mpprint.c, but it's not factored nicely. We could make a utility routine to decompress a compressed string into a Python string. I can make an issue for that for later.
I also only have the teensy41 to test on but this PR did result in a build that boots on my teensy41. I ran my standard tests and everything seems to work fine.
Thanks Dan! I clearly don't have a grasp on how the port modules work because I didn't see this fix being anything like it turned out :smile:
Hi, when adding typing to libraries, is there a more elegant form of Union[bytes, bytearray]? Thx!
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.5-11-gfc13fba6e-dirty on 2022-12-14; Raspberry Pi Pico W with rp2040
Code/REPL
import wifi
import socketpool
import ssl
import adafruit_requests
from os import getenv
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
print("Connecting...")
wifi.radio.connect(getenv('CIRCUITPY_WIFI_SSID'),getenv('CIRCUITPY_WIFI_PASSWORD'))
print("My IP address is", wifi.radio.ipv4_address)
poo...
Reviewers might note that the forbidden pin checking is O(num_special_pins*num_all_pins) when resetting all pins. That's not ideal, but I think it's not really a problem.
I was aware of this: I haven't yet figured out a clean way to make a compile-time boolean bit-mask table with pin numbers > 64, as I did for Espressif.
There is ReadableBuffer and WriteableBuffer, if that's what it really takes (would it take an array.array that's not bytes?)
testing dynobot repeated charswords
@lavish saffron depending on the specifics you might be looking for circuitpython_typing.ReadableBuffer but that includes additional types beyond what you named, like memoryview, array.array, ulab.numpy.array
hah only 2 hours late with that answer, and repeating dan. considers going back to bed
I do that all the time. It would be nice if discord flagged a post as having a reply.
ya, I wish it had links to skip forward to replies
Code for decompressing compressed messages is mostly in py/objexcept.py. In PR #7344, an exception wanted to use two arguments, an integer and a string, and it doesn't seem to be possible to use a translated string right now.
If a utility routine that converted a compressed string to a Python string were available, this would be easier to do, and that routine could also be used in py/objexcept.py, I think.
I wonder if the additional requests are turning off the MDNS responder.
Please get an appropriate USB VID and PID for this.
Having a plain LED name will make it work with regular blink examples.
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_PB12) },
{ MP_ROM_QSTR(MP_QSTR_LED_GREEN), MP_ROM_PTR(&pin_PB12) },
This is the Adafruit vendor ID and shouldn't be used for non-Adafruit boards without permission.
Please ask the manufacturer to provide a PID under their VID or request one from http://pid.codes.
How about factoring this code out instead of copy and pasting it? Should be easy if you pass the pin array in.
Thanks for fixing this! One refactoring request.
Could you make the pin check work at the port level? Maybe using a weak pin array?
I think it may be worth using the cpy-MAC hostname in dhcp in addition to mdns. That'd make them much more likely to be unique.
good idea to moving this into Pin.c or something and using a weak empty pin array.
I generated a unique name using the least significant 19 bits of the microcontroller.cpu.uid
hostname = 'QTPY' + str(int.from_bytes(microcontroller.cpu.uid, 'little') >> 29)
Example: QTPY362041
That way it's easy to identify when using network tools.
Can you summarize the situations where it crashes?
- If you start from a hard reset and never edit any files, does it keep running indefinitely?
- If you start from a hard reset, and edit a file, so that it restarts, does it crash reliably? Immediately or much later?
It has been a long time since the testing in this issue was done. Have any of you re-tested with a newer version of CircuitPython, e.g. 8.0.0-beta.5?
- Fixes #7339.
My change to make authmodes bitmasks was a tiny bit over-enthusiastic.
Tested on Metro ESP32-S2 and Pico W. Both now print authmodes properly.
That along with people actually doing a reply... 😁
@lone axle if you get a chance, could you create the notes doc? otherwise let me know and I'll do it tomorrow sometime.
woops, yep I'll get it created
thank you!
I created after the meeting, and pinged it here but never pinned the message 😅
pinned now, doc is here: https://docs.google.com/document/d/1-zwAp6Jeh9Z4YiF197EHnHrXEuqxvpP4em1B3zusAak/edit?usp=sharing
CircuitPython Weekly Meeting for December 19, 2022 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to pa...
oh oops! I didn't search
To be fair, the S2 Pico circuitpython-org entry (I wrote it) does have a mention that the connector is not Stemma-QT pinout.
BTW, not slacking with the circuitpython-org entry for the luatos board. I soldered headers to my only physical one before I had a chance to take photos and I don't want people to see my horribly bad soldering skills. I have some more boards arriving next week from China.
fixes a typo in the path of the postCreateCommand
When I look at the failed checks, these are all architecture-builds which are not relevant for this pull-request.
Is there a way to configure the .devcontainer-subdirectory to prevent all these builds? This would save time and ressources.
CircuitPython version
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather RP2040 with rp2040
Code/REPL
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
Behavior
File "code.py", line 5, in
File "adafruit_wiznet5k.py", line 51, in
ImportError: no module named 'adafruit_wiznet5k.adafruit_wiznet5k_dhcp'
Description
The initial context:
The import worked when there was only the wiznet library to contend with.
The cod...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; M5Stack Atom Lite with ESP32
Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; PCA10059 nRF52840 Dongle with nRF52840
Code/REPL
import adafruit_irremote
import pulseio
decoder = adafruit_irremote.GenericDecode()
pulsein = pulseio.PulseIn(board.D32, maxlen=600, idle_state=True)
pulses = decoder.read_pulses(pulsein,max_pulse=91000,pulse_window=0.104,blocking_delay=0.102)
##...
sys.path is ['', '/', '/lib']. So the files you copied into the top-level directory, CIRCUITPY, would be found first. But if you didn't copy the whole tree, then once the package started importing things inside itself, it wouldn't find things. Is the top-level package tree as complete as what is in lib/?
hi,
Good to know. I'll be careful of this in the future.
Once I changed the source file names there were no import name collisions.
The problem with the "featherwing" is there is no such thing as "ls -R", the whole OS seems
to be a python interpreter.
Too bad import doesn't accept a debug flag that prints its search path - but
I'm guessing for that to work, import would have to become a function, like print.
bob s.
Sorry, I just meant you could do ls -R /media/yourname/CIRCUITPY on the host computer (assuming it was Linux).
I think you would find the same issue with regular Python. It also uses sys.path to find things. Its sys.path does not include /lib, of course, but it does include various library locations. If you replaced only some of the files in a particular library, I think it would have the same import troubles.
the script ci_set_matrix.py in tools controls which boards are built based on the changed files. It has to be hand modified for exceptional files. It doesn't look like it has a facility right now to ignore whole directories, just individual files. So you could list your individual files, or you could add a facility to filter whole directories.
btw is there any possibility / utility to testing .devcontainer during our build? If a typo goes unnoticed, that's not great. If we could have...
sorry, I wasn't thinking. I'm still a newby with rp.
I'm also not used to an embedded device having its own "finder" window.
ls -R didn't behave recursively in my mac, but I think this is a mac problem
% ls -R ./wiznet
./wiznet5k.py ./wiznet5k_dns.py ./wiznet5k_socket.py
./wiznet5k_dhcp.py ./wiznet5k_ntp.py ./wiznet5k_wsgiserver.py
% ls -R ./lib/wiznet
init.py adafruit_wiznet5k_dns.mpy adafruit_wiznet5k_wsgiserver.mpy
adafruit_wiznet5k.mpy adafruit_wiznet5k...
interesting automated formatting in the issues tool, right angle brackets seem to be converted into shadow indent pipes
Use the < > to convert text you paste into monospaced literal text. It will surround the text with triple or single backquotes. I have edited your post above to do that. Click on Edit in the ... menu to see what I did.
Try ls -R /lib to get a tree view of all of lib.
eventually I'll get there, need caffeine to enervate the grey matter
% ls -R ./lib/ | grep wiznet
./lib//adafruit_wiznet5k:
adafruit_wiznet5k.mpy
adafruit_wiznet5k_dhcp.mpy
adafruit_wiznet5k_dns.mpy
adafruit_wiznet5k_ntp.mpy
adafruit_wiznet5k_socket.mpy
adafruit_wiznet5k_wsgiserver.mpy
There is the possibility to pre-build containers. But I'm not sure that this catches problems with the postCreateCommand. And I think pre-build containers are not suitable for CircuitPython-builds, because I think it is important to do the whole fetch-submodule logic every time after a fresh-clone.
I will try to find something useful in the Github-docs.
BTW: this error prevented the postCreateCommand to run at all, but there could be errors in the script as well. Or the script is outdat...
The wiznet/ directory makes the collection of files be a package. Did you create a CIRCUITPY/wiznet/ directory and then put the .py files inside it, or did you copy the .py files directly to the CIRCUITPY? If the latter, that would explain the issue you had.
The latter.
Thank you for providing insight.
I'm done, going to self-close.
Looks like there is an IDF ringbuffer that we may not be pulling from fast enough: https://github.com/adafruit/circuitpython/blob/2e93c9577a0da46930934fdb632d7faff0e6f57a/ports/espressif/common-hal/pulseio/PulseIn.c#L119
I am going to close this for now, absent some newer reports on 8.0.0 builds. There is some problem here, but I'm not sure what it is, and it may have been fixed since the initial reports.
@schaefer01 Shameless plug incoming :grin: if you grab PyDOS.py from https://github.com/RetiredWizard/PyDOS/blob/main/PyDOS.py (you only need the one file) and type import PyDOS you can then run some DOS type commands including dir/s or dir/w/s for a recursive directory listing....
I can confirm that protomatter 1.5.3 does NOT work as-is on Adafruit Feather ESP32-S3 TFT. But we don't want to use an unreleased protomatter either. 1.5.2 doesn't build, and the commit in this PR is a non-accepted PR, not a release.
With modifications I can get the matrix to come up once but not a second time (including over soft reset). The code runs, but no display is visible.
Possibly because the featherwing uses TX and RX pins, running in DEBUG= mode makes it crash.
I will ...
This didn't seem to be necessary after some recent merges, so it may depend on how many commits back various things are. I will mark this as 8.x.x for now.
This reverts commit 5d974c35ee620e36efa2148a6f64e1e7df1b55f5. https://github.com/adafruit/circuitpython/pull/7182 updated protomatter, but it broke esp32-s3 support (tested with Adafruit Featherwing ESP32-S3 TFT). We will update protomatter again, possibly with https://github.com/adafruit/circuitpython/pull/7232, but only after testing on a range of hardware.
This is probably expected behavior but I hadn't noticed it before. Prior to running this script the Pico W shows up in the web workflow list of "CircuitPython devices on your network" from another idle device, but while the script is running the device doesn't show up in the list.....
No, I think it would be expected to still show up. @tannewt can you say for sure?
@tulip sleet ya, 7300 is coproc related
we could fix it before I get my pr in if we want
I was hoping to get it in before I'm out but its working less well now and I haven't figured out why
can 7300 be fixed without coproc? Or we could revert the current coproc, and that would fix it?
is 7300 a regression right now?
I'd expect it to show up. However, mdns does use udp so it may be missed occasionally due to that.
ya, I can make a pr to fix it before my coproc stuff
its not really a regression since s3 sleep was only recently "fixed" and exposed this bug
the current coproc code tells the idf to wake based on the ulp even when no ulp alarm is set
s3 everything is less than ideal.
I was hoping to wrap up my changes and fix this issue along with it
however you want, if you get stalled on coproc, then a quick PR early next week makes sense. coproc as a feature could be pushed beyond 8.0.0
👍 that's a good plan
I have a couple hours now where I hope to figure it out
this code I have has the pin reset protection now so it should be close to ready
I did check it out on a Feather ESP32-S3 and didn't see the same behavior so I opened an issue up on it #7346
Does the dual-core S3 have an advantage with blocking Python or core code, vs. underlying priorities of core tasks?
I checked pre-build containers, but they don't execute the postCreateCommand at all.
I think the S2 is a single core and I just tested the latest CircuitPython on the QT Py ESP32-S2 and the web workflow didn't drop the device from the list when this code was run.
Does the dual-core S3 have an advantage with blocking Python or core code, vs. underlying priorities of core tasks?
I would say not really, the RTOS can take care of allowing the IDF network code to run, on a single core or the other core, if available. If we have something blocking in the Python code that is blocking network code, that is a bug.
is the .env file parsing currently broken on main?
The most recent bits are now using settings.toml instead. All strings need to be contained within double quotes.
i.e. CIRCUITPY_WIFI_SSID = "my ssid"
awesome, thanks
@tulip sleet found the bug! the idf was turning off the rtc io clock when any of the pins was disabled
any instead of all ?
that sounds like a bug -- great catch!
yup, any instead of all
I can merge this as-is, or I can wait for you to make the change to the script so updates to this file don't cause excess builds; ping me and let me know.
I've been spending a while on this. It doesn't seem to have anything to do with displayio at all, or subclassing native classes, etc., all of which I was suspicous of. Some code is crashing when doing an assignment after throwing an AttributeError. Trying to get to the simplest case. More later.
The master_clock_pin was already optional, but not specifying it would result in a crash. This fixes it, so it really can be omitted, when the camera module has its own clock source built in.
To test this with a module that doesn't have a crystal, you can create the PWMOut yourself before creating the camera:
import board
import displayio
import adafruit_ili9341
import busio
import digitalio
import esp32_camera
import pwmio
displayio.release_displays()
display_bus = displayio.FourWire(
busio.SPI(clock=board.IO7, MOSI=board.IO5),
command=board.IO9,
chip_select=board.IO3,
baudrate=80_000_000,
)
display = adafruit_ili9341.ILI9341(
...
Did this start after chained exceptions were added?
Did this start after chained exceptions were added?
I thought it might be related, so I checked beta.4, and it's broken in beta.4 also. I'll double check that, but chained exceptions were added after beta.4, according to the release notes.
This is the minimal crash-inducing program:
def crash():
try:
None.wrong()
except AttributeError:
pass
i = None
crash()
Necessary elements:
- The
tryblock must be in a function. It does not crash when at the top level. - I tried raising ZeroDivisionError instead, and it does not cause the problem.
- The local var assignment must be present. It doesn't really matter what it is. In
Label, it was an assignment of0.
...
The manufacturer is not responding, can I use USB_VID = 0x0483 USB_PID = 0x5740 STMicroelectronics Virtual COM Port?
I'll make a pull request for the script, but that won't be before Wednesday.
The maximum ir signal I'm using is 222 pulses. Panasonic air conditioner.
M5Stack Atom is ESP32-PICO chip.
How about ESP32-C3 & ESP32-S3 & ESP32-S2 chip.
I did some bisect-like builds by hand to track this down. I believe this is the critical commit:
58485bc0b1e47e6ef13691a7629356c2a24ca16d. It switched the default SAMx5x builds from -O2 to -Os, and also removed -fno-inline-functions. When DEBUG=1 is set, additional -O flags are piled on, but the -fno-inline-functions remains removed.
There are more files than I would expect to have changed in the changes for the esp32-camera submodule. Your PR to that changed only one file, I think.
That's interesting. I had recently noticed that "-O2" is broken in sam 5x builds: https://github.com/adafruit/circuitpython/issues/7279 -- however, that stopped circuitpython from coming up at all
That is because the circuitpython branch contains all those changes, with my commit only being added on top of that. The current submodule points at a specific commit in the circuitpython branch, and I don't see any way of adding only my commit to it. Do you know if something like that is possible?
On the other hand, I don't see those changes breaking anything, so maybe I could make a separate PR bringing the submodule to the commit just before my commit, and you could merge that first?
@slender iron I think I've got it done! Except, there is one issue. I attempted to playback a sine wave, and it skips. This is because Python can't generate the sine wave fast enough (I'm using a QT Py RP2040), so the buffer is emptying (and then playing back silence) while the next portion is generating. I thought this might happen, and I may be able to work around it, but even if I can get a sine wave playing, more complex waveforms that take even longer to generate could still have issues.
I'm not giving up though! I'm going to see if a square wave (or triangle or sawtooth...) will work, as they don't require an expensive trig function. If those work, a lookup table for sine waves could be a valid solution. Alternatively, I could do it all in C and add yet another module for synth generation (which I was already planning to do eventually anyway). Regardless, there is definitely going to be some limit to how much complexity any given processor can handle before it takes too long to generate the audio samples.
Anyhow, if anyone is interested, the code is on my CircuitPython fork: https://github.com/Rybec/circuitpython The new module is audiostream. I'm going to do a bit more testing before putting in a pull request.
Ah, I see, #2 brought in a bunch of upstream changes, but the circuitpython repo didn't pick those up. Sorry, it's fine, then.
We could try putting back -fno-inline-functions for #7279, but it would be nice to understand what is really causing the problem. I'll look at this some more and do some more experiments, and see if there was ever a time that DEBUG=1 worked with -Os.
@slender iron I have some potential information on the issue with speaker noise happening when the board automatically resets on filesystem writes. During audio playback using my new class, the print function causes audio noise when the board is connected to a serial console. I'm not 100% sure these are connected, but I suspect they are. My class does not interact with the serial system at all, so it's unlikely that it's a bug there. I haven't tested this with the existing RawSample or WaveFile class, but I suspect the same noise would happen when communicating with the serial console while they are playing.
Alright, I've verified that the same thing happens during playback with RawSample. Each time something is printed to the serial console, garbage is output on the audio. This only happens when the device is connected to the serial console though. When there is no connection, it does not happen. (The noise during automatic reset, however, does happen even when not connected to the serial console.)
crosstalk between the traces?
Possibly. This project is using the QT Py RP2040, and I haven't tested it on any other board. That said, the auto reset thing produced the noise on A0, A1, and A2 equally. Since I tested that, I soldered the speaker to A0, so I can't really test other pins anymore. (If my oscilloscope was out of storage... I don't have room for it right now though.)
It's not a huge deal for this project, as I don't need to use serial for the end product, and it doesn't produce noise on manual resets or power on/off. It's mostly just an annoyance. If someone did need to use serial and audio at the same time though...
Just a guess but I have a feeling it has to do with the timing. I do not think serial or audio uses DMA or at least still uses a lot of processing while working and it isn't coded to really work in parallel. Would explain why the noise does not occur on a hard reset.
I've noticed the same behavior in the past myself, but never looked into it further
@blissful pollen Audio uses DMA, according to the source code in the part I was working on. It's possible that the serial and automatic reset are preventing the DMA from being updated on time when it gets to the end of buffer, either reading past the end a bit or causing just enough delay between updates to produce brief garbage output. It would only take a byte or two delay to turn smooth audio into something very rough.
The module ipaddress is not present on Seeed XIAO nRF52840 Sense. Where am I meant to fetch it from?
Cause like, my wifi stuff are built to need it and not quite sure how to work without it
Also I am talking about 8.0
I didn't think the nRF52840 Sense has wifi on the chip at all? Only BLE
As far as I'm aware only the ESP32 family and Pico-w have wifi support in CP.
It seems to not have wifi at all, not just in CP.
Oh well, ble time.
Correction of information
I measured Panasonic air conditioner pulses. I show it below.
Adafruit CircuitPython 8.0.0-beta.0 on 2022-08-18; Raspberry Pi Pico with rp2040pulses sum: 249428 pulse count: 439 Max: 10480
pulses:
[3521, 1731, 453, 419, 455, 1310, 453, 420, 453, 420, 454, 420, 453, 420, 454, 420, 452, 422, 453, 421, 453, 420, 453, 421, 453, 420, 452, 422, 452, 1312, 451, 422, 451, 423, 450, 423, 450, 423, 440, 433, 433, 441, 448, 425, 431, 1333, 428, 1337, 427, 1336, ...
no wifi. Nordic has started selling wifi chips, but they are not these
in theory, one should be able to use a websocket to connect to serial to a web-workflow CP device, detect if it has hardfaulted (checking if in REPL... somehow, then by trying reload, perhaps), and reset it?
still haven't managed to get a curses-compliant shell via the websocket
I will prolly write my own at some point
prolly will be a fork of some other, idk
but still no web-workflow-ssh
Adding frozen modules to the build, modifying the flash size.
Have you tried this mod? I think I got it working but it behaves very odd. Mu keeps thinking I have an esp32 connected. The python code runs but it doesn’t seem to actually work
not beyond verifying that I could load a firmware (I forget which one) and import uctypes. I don't use mu, but it seems very unlikely that adding uctypes would make it mis-identify a board. But unlikely things happen everyday.
I don't plan to add ssh because websocket works in and out of the browser
Hello, for private functions that will be compiled by mpy-cross, is it better to use doc strings? e.g.
def _next_retry_time(self, *, interval: int = 4) -> int:
"""Calculate a retry stop time.
The interval is calculated as an exponential fallback with a random variation to
prevent DHCP packet collisions. This timeout is intended to be compared with
time.monotonic(). Uses self._retries as the exponent, and increments this value
each time it is called.
:param int interval: The base retry interval in seconds. Defaults to 4 as per the
DHCP standard for Ethernet connections.
:returns int: The timeout in time.monotonic() seconds.
:raises ValueError: If the calculated interval is < 1 second.
"""
...
Or should I use comments? e.g.
def _next_retry_time(self, *, interval: int = 4) -> int:
"""Calculate a retry stop time."""
# The interval is calculated as an exponential fallback with a random variation to
# prevent DHCP packet collisions. This timeout is intended to be compared with
# time.monotonic(). Uses self._retries as the exponent, and increments this value
# each time it is called.
# :param int interval: The base retry interval in seconds. Defaults to 4 as per the
# DHCP standard for Ethernet connections.
# :returns int: The timeout in time.monotonic() seconds.
# :raises ValueError: If the calculated interval is < 1 second.
I'm wondering whether mpy-cross throws away comments, saving space?
Thx!
Thx
Thanks! One suggestion for increased clarity.
How about ESP32-C3 & ESP32-S3 & ESP32-S2 chip.
They all use the code I cited.
I'd rather not. I'd prefer a pid.codes ID.
Hi I too have a project with an LED Matrix that is ruined with the console appearing at startup. displayio.release_displays() in boot.py did not work for me.
According to this forum post the error is "Attribute Error:
'Processor' object has no attribute 'frequency'" It should instead say it isn't settable. I suspect we need to remove the setter when setting isn't possible. The code now returns a NotImplementedException that is being caught internally and producing the error seen. So conditionalize this:
https://github.com/adafruit/circuitpython/blob/10138f43d62a90fa9d090c7eb4bdaaa08...
https://forums.adafruit.com/viewtopic.php?p=952638: user found AttributeError message confusing when trying to set MAC address on Pico W. The attribute exists, despite the message, but is not settable (currently?) for CYW43.
- Used
NotImplementedErrorinstead, with a clarifying message. - Share that message with another place.
- Merge "read-only` messages to reduce number of messages.
I can add this to a similar PR I just made, #7358, which also had a confusing AttributeError.
@tulip sleet does the notimplementederror actually make it to the user?
I was assuming it did. for RP2040, CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY does not seem to be set at all, which should have been a compiler error. I was just going to ask you how the NotImpl was being eaten and turned into an AttributeErrror. I'll track this down. I thought you were speaking from authority 🙂
Maybe I will take away that SETTABLE flag, and add a weak common_hal set_frequency
or we'll make CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY have a useful default value. It's set to 0 or 1 per board, which I think is too many places. Should be mostly per prot.
Will revise to fix #7357.
it looks like in py/runtime.c, mp_store_attr() gets a return value from the attempted call, even if it threw an exception, and turns that into a "has no attribute" error. This looks like it would be true for any property that threw an exception. I will see if it's true for reading attributes as well as writing, but I'm confused, because this would break all kinds of property error checking, and I don't see that right now. (e.g. setting a bad value in, say busio.UART
>>> class X:
... @property
... def p(self): return 1
...
>>> x = X()
>>> x.p
1
>>> x.p = 7
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: can't set attribute
Python uses AttributeError for a non-settable property but it has a clearer error ("can't set" vs "has no attribute").
Maybe we should fix this by making the failure to set the attribute have a distinct message:
diff --git a/py/runtime.c b/py/runtime.c
inde...
(or save even more code space by making the property either a GET or a GETSET depending on #defines, which would let this site's error checking be reused)
@onyx hinge that is a better message
I'm still looking into why the NotImpl is eaten by that, but other exceptions raised in set-property impls are getting through
NotImplemented in particular? weird!
it's even more weird. I had a random build on a Metro M4, and got this:
>>> import microcontroller
>>> microcontroller.cpu.frequency = -1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Processor' object has no attribute 'frequency'
something to do with built in types? ```class X:
@property
def p(self): return 1
@p.setter
def p(self, _): raise NotImplementedError()
x = X()
x.p = 1
I then rebuilt with ValueError instead of NotImplementedError, and got ValueError: frequency is read-only for this board, as I would expect. Then I rebuilt back to NotImplementedError, and got NotImplementedError: frequency is read-only for this board.
that is, it was inconsistent. So maybe it's reading trash on the stack or something.
sometimes zero, maybe sometimes not?? I haven't yet been able to reproduce the "random build" behavior. It was a leftover build from debugging the other AttributeError DEBUG=1 issue
I rebuilt with DEBUG=1 but could not reproduce
that feels like it could be a clue about the crashing error
yes, maybe they are all related; it's rather odd syncrony
there is no special handling of NotImplementedError in circuitpython/py/*
agree, based on a quick check. same for RuntimeError which NotImplementedError inherits
<@&356864093652516868> we're looking forward to chatting with you in about an hour -- it'll be the last meeting of the year, if you can believe that. Please add your notes to https://docs.google.com/document/d/1-zwAp6Jeh9Z4YiF197EHnHrXEuqxvpP4em1B3zusAak/edit?usp=sharing like I'm about to do. Hope to see you in the voice chat & here in the text chat. As usual, mark the document if you need the host (me) to read your notes.
CircuitPython Weekly Meeting for December 19, 2022 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to pa...
It is now a generic memorymap API and an ESP specific espulp module.
Fixes #7218. Fixes #3234. Fixes #7300.
it was interesting to see how much easier it was to do vs ble
looks like someone copy pasted into my status update... unsure who it belongs to
I think it's a copy of dan's section
looks like it was some anonymous animal
I enjoyed reading your updates on how you used the clock to get back needed GPIO.
the cosmetic version of the step switch for pcb designs, how it started
my first 3d model design 🙂
@midnight ember it just dropped through the mail slot!
maybe 2 inches 🙂
Keep your chin up Melissa, hope you feel better soon. 🤗
the district mapping stuff you did was interesting
The circuitpythonukiahs look really neat. Saw it on mastodon. neat design.
Two weeks is what I'd think is good, I don't think longer will really get anything more that 2 wouldn't
2 months sounds excessive, realistically after the holidays 2 weeks sounds good.
2 weeks seems good to me as well.
closing 1 day after a final meeting is a good idea too
Oh, I like that idea to schedule it day after a meeting for a "last call" to be mentioned during the meeting.
Next stop, 2023 all aboard!
Thank you for this year of CircuitPython.
thanks
thank you!
happy holidays folks!
happy holidays
Thank you for 2022 Circuit Pythonistas! What a wonderful year.
Thanks everyone
(meow ho ho)
Thanks everyone! 👋
hey is there a known issue with timings on RP2040 ? I get random timings of the status LED blinks seemingly only on RP2040 boards
pico as opposed to pico w?
i don't know of such an issue
all
you mean the brief green flash every few seconds?
I was adding the status LED to the pico, but I see it on the picow, feather (I'm making a test build to log the timings)
yes
that could be a idle time timing issue. If nothing is going on, it will
instead of every 5 seconds I get things like that:
[20:43:07.513] Pattern start
[20:43:42.173] Pattern start
[20:44:15.190] Pattern start
[20:44:36.533] Pattern start
[20:44:49.742] Pattern start
[20:45:03.570] Pattern start
[20:45:13.578] Pattern start
[20:45:23.595] Pattern start
wait for an interrupt, and maybe it is not waiting for any ticks. Do you NOT see this on say a SAMD51?
(which are prints I added)
ESP32xx is not a good comparison because of the RTOS
I have put latest on a ESP and a trinket and don't see it
try a 51 also; samd21 background timing is pretty different in how it works at a low level
Here is the notes document for the next CircuitPython Weekly meeting. It is on Tuesday January 3, 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! <@&356864093652516868> https://docs.google.com/document/d/13tKfczFaOh-Z6xRyjLMAkx6QTI5OBA1dWh9e8ld2Y04/edit?usp=sharing
CircuitPython Weekly Meeting for January 3, 2023 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to part...
The ULP code to test is here: https://github.com/adafruit/Adafruit_CircuitPython_ULP_Blink
Here is a pre-compiled version along with the code.py's for them. (The blink examples compile .c to a .py wrapper library.)
Archive.zip
The libraries should work on S2 with sx_version=2 but I haven't tested it. They shouldn't be board specific because the pins are dynamically patched into the binary.
I plan on polishing th...
ah tio's delta timestamp mode ❤️
so that's frustrating, my build with a single print in it now doesn't blink at all, which is what I originally thought the issue was, but my previous build with more prints did blink randomly. The difference is that the new build doesn't print with the first blink
while the other build would print every time the LED was turned on
I like your little friends... I want some
Allow a means to add custom default code. For example, after running storage.erase_filesystem() or after the file system becomes corrupt, rather than printing hello world it would import some custom file content.
it's all open source
Link please!
I'm working on a pi pico version still, that will be a separate project
I shall attempt to make a giant version!
robots don't scale
make it 2x bigger, and suddenly it's 8x heavier, and needs 8x stronger servos
this is why small robots are much easier
While adding MICROPY_HW_LED_STATUS on the Raspberry Pico I noticed that it didn't blink every 5 seconds. I did some tests on other boards and different types of satus LEDs, and it seems that it's a RP2040 bug.
It looks like the pico W is doing it correctly (and it already had the status LED defined).
Since staring at a LED for minutes to see when it blinks is not a lot of fun, I added a serial_write here, and it rarely blinks and seems to only react to the USB host doing something, ...
Maybe I can find a way to increase overall scale without increasing mass drastically...
I think it's up to 100x
in any case, the smaller it is, the stronger it is relatively
also the more resistant to falls and so on
Yeah, which is why bugs can fall off a skyscraper and don't care, cats can jump from 5-10 stories and be fine, but we get hurt falling out of a 2nd story window
and you'd kill an elephant if you dropped it from 40cm
This is why we never drop elephants
or flip cows
you could probably make the legs twice as long, there is some margin of strength in there
especially if you switch to metal gear servos, mg-90 instead of the sg-90
Git bisect leads to #7201
"the camera" is copy pasta, I think.
I thought I did a review this afternoon, but my comments are still pending. Haven't tested yet, but here are some thoughts.
If you try to do a multi-byte read or write that is not aligned, could this cause an addressing exception in the common-hal implementation, because the compiler will be doing an unaligned read or write?
Maybe an example here would be good, and/or explaining that memcpy does not guarantee multi-byte reads or writes (at least I don't think it does) Maybe don't refer to memcpy specifically, since the user may not know its semantics. Or say multi-byte chunking is neither guaranteed nor for...
Originally I added a comment that pin numbers could be >32, but I see below the ULP is restricted to a smaller range. Could you add a comment here about that too?
// stop the ulp timer so that it doesn't restart the cpu
Thank you in advance. Board was added with https://github.com/adafruit/circuitpython/pull/7306
Fixed a couple overlooked things and this should be ready for review now.
This is a followup issue regarding https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/issues/67.
It is specifically about 8.x.
TLDR; If you mpy-cross the Adafruit_circuitpython_wiznet5k module with any optimisation (so, -O1 or greater), the entire module breaks apart.
.chipdetection is broken.link_statusdetection is broken- dhcp is broken
- and basically every socket & request is also broken
I do not have the technical know-how regarding how mpy-cross wor...
Anybody got any hints on working with the mpy-cross logic?
@brazen hatch are the built .mpy's in the bundle or the library release on github defective, or only when you compile with mpy-cross by hand?
i don't see any optimization settings in circuitpython-build-tools, but I may be looking in the wrong place.
the builds are only defective when done with -O1 or greater
-O0 is fine
i understand, but are you doing that compiling or is the bundle version being built with -O1 or greater?
i.e. is the bundle version of this library fine?
I am the one doing it, the bundles are fine
the are most certainly not using optimisation settings
ok good, I wanted to know if this was urgent. thanks for discovering this. We never use these settings, and will look at whether micropython has any reported issues on this
well I have been using -O3 with my whole project and never seen issues
so its prolly something very specific causing this
what does it even do ?
do you see significant space savings?
is there any documentation of the optimizations ?
complete borkage, basically no variables are being updated it so seems
70kb -> 40kb
and my stuff has no issue with it
as if the object is read only but actually not
something is really wrong with it
but only that library; others are ok, you say
there are tools to examine the .mpy code. I am not seeing any error reports in the micropython repo.
we will take a look, not immediately, but may pass the buck to micropython if we discover a problem.
This affected the CI of udecimal (https://github.com/jepler/Jepler_CircuitPython_udecimal/actions/runs/3736842809/jobs/6341532963) and maybe also ulab.
I will give it a try too, and pass you whatever findings
@brazen hatch you're talking about when you run mpy-cross -O#, not about the compiler flags when building the mpy-cross program itself, right?
-O3 does deliberately disable line numbers, to save space.
-O1 or greater controls whether __debug__ is a true constant or a false constant.
based on source searching, I don't see any other intentional changes due to setting optimization levels in the mpy-cross commandline.
adafruit_wiznet5k/adafruit_wiznet5k.py: assert self._w5100_init() == 1, "Failed to initialize WIZnet module."
adafruit_wiznet5k uses assert a bunch
OK, asserts are disabled too. And wiznet5k uses assert in a way that is .. not entirely appropriate
so for instance it'll just skip calling _w5100_init() when optimization is on
See discussion in the wiznet issue. It appears mpy-cross optimization levels are working as designed.
thanks for taking the next step to look at this
@brazen hatch I looked briefly at the wiznet code and I see that its use of constants could be changed, I think, to reduce the result compiled code size: https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/issues/84
Closing this as the changes are unpolished.
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.4 on 2022-10-30; Raspberry Pi Pico W with rp2040
Code/REPL
import alarm
import time
import board
print("Waking up")
# Create an alarm for 60 seconds from now, and also a pin alarm.
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 20)
pin_alarm = alarm.pin.PinAlarm(pin=board.GP12, value=False)
# Deep sleep until one of the alarm goes off. Then restart the program.
alarm....
this code even though it seems high quality its very weird
I did the asserts pr and will test it a bit
Hi I too have a project with an LED Matrix that is ruined with the console appearing at startup. displayio.release_displays() in boot.py did not work for me.
Did you build circuit python from the git repo?
This change is more recent than the latest release.
LGTM! Thanks for working on this, the API looks more polished now. Just a couple suggestions.
Might want to infer the ULP state from registers.
I refactored mpconfigport.mk recently and set the following convention:
# Module on by default and conditionally turned off
CIRCUITPY_ESPULP ?= 1
ifeq ($(IDF_TARGET),esp32)
CIRCUITPY_ESPULP = 0
CIRCUITPY_MEMORYMAP = 0
else ifeq ($(IDF_TARGET),esp32c3)
CIRCUITPY_ESPULP = 0
CIRCUITPY_MEMORYMAP = 0
I'd prefer to do the opposite so that future chips have it off by default.
This was deliberate because the ULP might already be running when the object is created.
@tulip sleet just pushed an update to the pr. Didn't test it yet though. Will later when becca is back and can watch ari.
Hi, I have setup a temperature sensor MCP9808 connected to a Feather M0 Express that will monitor a room for 2 weeks (with a host gathering the data and putting that in an SQLlight database) all that following this great guide: https://learn.adafruit.com/diy-trinkey-no-solder-air-quality-monitor/circuitpython
However, I feel I need a guide or advice on how to make reliable piece of hardware/software to work unattended for 2 weeks. Some ideas/questions (none that I have implemented):
- Use watchdog (poor choice, there is no CP support for the M0).
- Use try to catch exception and force a reset.
- Monitor the heap/memory space and write defensively using prealocated buffer.
- For a restart every ??? day.
- Do not trust the precision of monotonic over long period and use ad-hoc function for time comparison (I think @onyx hinge made some work on that?
Right now, for me it is too late as I will lose access to this place for 2 weeks, and I did not bring the right MCU for the job (watchdog), nor want to make last minutes change to the code... but I feel there is maybe a place for a learn guide or gathering experience on the best practice for "high availability CP". A bit like we did for memory issue and how to optimize your code.
I know CP is not targeted at that, nor at security, but having things that run for weeks without help would be great too.
These TPL timers: https://www.adafruit.com/?q=tpl&sort=BestMatch are useful to force hard resets. We have not yet implemented safemode.py (https://github.com/adafruit/circuitpython/issues/5956), which would also be helpful
@brazen hatch it's a bit late but I wrote a program that can automatically convert all asserts to 'if not EXPRESSION: raise RuntimeError("...")': https://gist.github.com/jepler/c12e35cbfa9ad5a06cee9de647ba8225
philosophical question re:libraries... Board helper libraries like the ones using PortalBase tend to be all-encompassing.
But should we try to keep lower-level driver-type libraries smaller and more minimal? Example: do we really need NTP in WIZnet5k library, or should WIZnet be simply a physical/link-layer/IP-layer library, and other code or libraries can build on that? Other examples in WIZnet, EPS32SPI, and the WSGI servers that are scattered around too.
r/oddlyspecific
there are apparently hundreds of other uses of assert across the libraries!
for example rfm9x/adafruit_rfm9x.py:713:9: assert 0 < len(data) <= 252
at least 100 in files not named *test*
honestly before today I didn't even know of assert
some of them, like maybe that rfm9x example, are the kind of asserts you'd want to leave out of a -O'd mpy file so they really need human review
should this one be an assertion or an exception? (adafruit_atecc) no idea. ```py
self._get_response(status)
assert status[0] == 0x00, "Error during sha_start."
@slender iron I have CircuitPython 2023 graphics for you. To add to your blog post.
a motivated person would run the script, then using a tool like git-gui make a judgement call and either commit or revert each one. erring on the side of transforming, because it would be bad to lose an important error check.
assert is really an archaic C-ish thing imo, not surprised if anyone's not familiar with it.
if it deals with external data, then exception
@tulip sleet What ended up happening with the .toml guide updates?
not merged yet, so we didn't do anything. Scott's coproc PR may or may not get in by tomw. In either case, I will make a beta.6 tomw that includes settings.toml.
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather RP2040 with rp2040
hi,
my first attempt to use minimqtt to talk to a server on a wired lan returned the error:
AssertionError: Error: SSL/TLS is not currently supported by CircuitPython.
- is this a circuitpython problem or a minimqtt problem
- in either case, will SSL/TLS be supported in the future?
bob s.
Ok. I'll see where Liz is at, and decide how to proceed.
WIZNET itself does not support SSL:
https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/issues/59
Supporting SSL generally would require some work:
https://github.com/adafruit/circuitpython/issues/6535
https://github.com/adafruit/circuitpython/issues/2202
I can make systematic changes when I do the release, given a recipe and a list of guides
I will close (without prejudice :) ) as this is subsumed by the other open issues.
Hmm fair enough. I think there's a draft somewhere to start from, that Liz put together. I'll take a look at that and see if it works, and that would be part of your recipe.
@tulip sleet Ok, I talked to Liz. We figured out a plan, which I can explain when you're around. We'll be putting together the canonical page for you to mirror, and then there's a blurb on every applicable code page that will need to be updated, and we will compile a list of links for you. Liz and I will both be around tomorrow to answer questions, and Liz offered to help update guides if you wanted assistance.
sounds good; i had to reboot due to a crash
Ah fair enough. I saw you green again as I had already typed that part. 😄
Linux USB support is flaky; it gets upset sometime when CircuitPython just stops abruptly
v annoying
thanks @idle owl! I saw it hit basecamp and snagged it
OK that works too.
@tulip sleet just tested it and it looks good still
i'm satisfied then, are you awaiting another review cycle from microdev?
I'd rather not since they are sleeping and I'm just about out of time
ok, I'll merge soon and microdev can open new issue(s).
I can start working on the release notes
thank you!
small and simple is better. I'm not a huge fan of the "do everything" libraries because they are hard to modify and reuse
NTP shouldn't be redone unless you can't do it with sockets from the device.
NTP is already in the WIZnet library (as is a WSGI server), but there's a PR to fix a bug. UDP sockets work fine on WIZnet. Similar issues with ESP32SPI.
We almost need a channel here for libraries for development and longer-term stuff... like the socket vs. socket+interface conundrum between native and WIZ/ESP
@tulip sleet Do you want to vid for a bit to go through the guide update plan? We have a document, so it's not bonkers to try to remember it all. Also Liz can help, and I'll be around as well tomorrow to help out as well. I don't know what your timeline is, but I likely won't be around until noon or later, so if you want to get started before that, it's better to chat about it today.
What's the best way on espressif to extinguish an LED that would ordinarily start up floating at half-brightness in board.c while retaining it for later use at the circuitpython code level? Just something in reset_board()?
I think it's espressif_board_reset_pin_number
https://github.com/adafruit/circuitpython/blob/e9f032f468b06553b3151ffa76e6bfaab608da4b/ports/espressif/boards/adafruit_feather_esp32_v2/board.c#L34-L43
@spiral elk
I'll play around with something like that later, just tired of staring at this second LED on this board every time I plug it in.
Annoyance, the instigator of change...
I thought I did a review this afternoon, but my comments are still pending. Haven't tested yet, but here are some thoughts.
@MicroDev1 After discussion, we are going to merge as is for beta.6 and vacation scheduling reasons, but happy to address further things, probably after the new year.
@tannewt Is this fixed (or is now moot) by #7218?
I just tested this with latest S3
Adafruit CircuitPython 8.0.0-beta.5-22-ge9f032f46 on 2022-12-20; Raspberry Pi Pico W with rp2040
and .env converted to settings.toml.
This works now with web workflow enabled. (Requests is still often getting an OSError: 32 on the first, hidden, try, but the internal retry is successful.)
Does anyone know what was broken in beta.5 (it used to work in beta.4), and what fixed it?
Do we have a preference for single vs. double quotes in setings.toml ? All the readthedocs use double (but no explicit mention that I could find), but the web workflow Welcome page uses single.
ah that needs to be updated then, prefer double quotes
I think it has to be double quotes
I am going to fix all the Learn Guides when beta.6 comes out. Kattni and Liz wrote up a plan which I will follow
Any thoughts of supporting a more complex type so we could essentially have lists or dicts? I want a list of potential servers in settings.toml that code could iterate over, but for now I'll just number them and know how many.
I wasn't sure, I remember seeing it mentioned, but it's not in the PR (about double quotes only)
for use in user code ? You could use a coma separated list and .split(",")
oh, good point, I can just parse a string
are there open issues relative to the web REPL ? I am seeing issues when pasting a line in it, namely it stops responding (without any javascript error)
>>> os.getenv("EMOJI")
'😹'
```😹
I don't know of open issues, but sometimes it eats the first character I type when first opened
by web REPL, do you mean web workflow serial console?
that could be it, but nothing is displayed in the upper pane of the web workflow window until after it eats the character ...doesn't always happen
I've seen the hanging too
is it just Macs that get the authentication dialog twice?
I've seen that in other contexts, so I assumed it was not a CP issue
- Fixes #7261.
This program crashed on SAMD51 when compiled with DEBUG=1:
def crash():
try:
None.wrong()
except AttributeError:
pass
i = None
The stack variable fastn in mp_execute_bytecode() in py/vm.c was getting smashed. It was a Heisenbug because adding print statements caused it to work.
After narrowing down the point of smashing, I looked at the assembly code and saw that call to nlr_push() in `mp_execute_bytecode assumed ...
Opening a separate issue for this:
On
raspberrypi, mDNS is not shutdown on reload, som = mdns.Server(wifi.radio)getsRuntimeError: mDNS already initialized. Even on reset, with web workflow enabled,m = mdns.Server(wifi.radio)getsRuntimeError: mDNS already initialized. This is probably the larger issue, but I'm not entirely sure how this should work across ports.
espressifshuts down mDNS on reload, so after a reload,m = mdns.Server(wifi.radio)works. It works...
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.5 on 2022-12-08; Raspberry Pi Pico W with rp2040
Code/REPL
See #7326
Behavior
On raspberrypi, mDNS is not shutdown on reload, so m = mdns.Server(wifi.radio) gets RuntimeError: mDNS already initialized. Even on reset, with web workflow enabled, m = mdns.Server(wifi.radio) gets RuntimeError: mDNS already initialized. I'm not entirely sure how this should work across ports.
`espres...
It makes sense to move NPT client and WSGI server code to separate libraries so that the code only has to be maintained in one place.
This is a PR as suggested by @jepler in https://github.com/adafruit/circuitpython/pull/7350
Thank you! I have a suggestion.
It's nitpicky but do you mind updating the comment and/or moving it to where IGNORE_DIRS is defined?
It might say
# Files in these directories never influence board builds
IGNORE_DIRS = [ ... ]
and then no comment down at the if any ...: continue line would be needed imho.
Valid point, I will update that.
On our challenger_840 boards using the 32MHz driver default SPI clock to probe the JEDEC ID fails, so I added an initialization to SPI_FLASH_MAX_BAUDRATE before the framework tries to probe for the JEDEC ID.
Also increased max speed for our board to 20MHz.
If this is on a per-board basis, can't it be added to the board's description?
Two questions:
- Do your boards not use QSPI for the external flash?
- There is a serious problem with SPIM in battery-only operation: #5233. We encountered this, and disrecommend using SPIM3 under those circumstances. So I'm wondering whether your board might have the same issue. It's also possible to disable SPIM3 completely at compile time.
@tulip sleet I'm so happy you found an explicable reason for that crash!
that was kind of ridiculous. Even more interesting that the old fix got lost and yet it didn't cause a huge problem for a while.
onward to the -O2 mystery, which we hoped might be the same
returns_twice is a bit of a head-spinner, but it has the right compilation side-effect. https://stackoverflow.com/questions/17917720/function-attribute-returns-twice
- No, our board uses standard SPI.
- I don't think this is the same issue. I noticed when probing sclk that the frequency was 32MHZ which caused problem when reading the JEDEC ID. Reducing the clock to Max clock makes it work again. The problem is that the SPI interface is initialized to the max frequency when creating the bus and only reduced after having detected what memory device is attached. Could that be the problem you are also seeing ? This would occur after power on and reset.
2. I don't think this is the same issue. I noticed when probing sclk that the frequency was 32MHZ which caused problem when reading the JEDEC ID. Reducing the clock to Max clock makes it work again. The problem is that the SPI interface is initialized to the max frequency when creating the bus and only reduced after having detected what memory device is attached. Could that be the problem you are also seeing ? This would occur after power on and reset.
We are not seeing a flash problem ...
Automated website update for release 8.0.0-beta.6 by Blinka.
New boards:
- challenger_rp2040_sdrtc
Is it possible on your board to have VBUS not powered? If so, does SPIM3 work for you in that circumstance?
It does work yes, I just retested to be sure. Both directly after power on and after reset running only on battery and VBUS totally disconnected. I have attached a schematic for your reference (The body diode on the mosfet is drawn backwards).
And this is with the fix I implemented to reduce the SPI speed during initial JEDEC probing. Otherwise it just hangs, waiting for a non FF by...
I tested on an ESP32-S2 and was able to get a max pulsein reading of 65262. It was an accurate reading, based on measurements by a logic analyzer. I will see if I can get a M5Stack Atom to test with.
That is interesting -- thanks! Just to confirm: R5, the zero ohm jumper between VDD and VDDH is populated on your board? Your schematic is very similar to the Feather nRF52840.
I don't know why you don't see this SPIM3 problem. We saw it when trying to use SPIM3 much later, after CircuitPython starts, and as you can see from the Nordic DevZone complaints, other users are also having trouble when SPIM3 is used by user code.
I or @tannewt will review this more. I just want to make sure se...
https://realpython.com/generate-images-with-dalle-openai-api/ I don't think we can do this in circuitpython yet but wouldn't it be cool
maybe we can use some service for converting to a format that pyportal can handle?
That could be fun for anything with a display -- I just imagined a little handheld device using something like a Pico W, and some option buttons to pick from sets of categories and descriptors, and at the press of a button it makes the request and displays the results for you on your TFT or whatever
@tulip sleet Where are you with the release?
it will finish building in about 20-30 minutes. I'm getting ready to publish the release notes after I update circuitpython.org (after the builds finish). Then I will do the settings.toml changes
doing some smoke tests right now
OK, please remember to ping Liz and I if you have questions or would like assistance. 🙂
sure, thanks!
I have no idea about settings.toml since i missed pretty much all related commits
So I will be seeing them for the first time
I plan on utillising it to its maximum for my project too
cuz I already had a config in root for defining core options like sd card pins, in case the user wanted to boot from an sdcard
in any case, the notes will receive lots of attention real soon
https://blog.adafruit.com/2022/12/21/circuitpython-8-0-0-beta-6-released/
This release changes .env to settings.toml. See the release notes for details. The Learn Guides will also be updated.
🎉
ok, starting with the checklist!
Keen! Let us know if you have questions or would like some help!
Is Blinka a WiFi logo for this one? :0
that poster is for 8.0.0 in general, not just this beta. the design is kind of a mash-up of the Espressif logo and blinka
it's an Espressif logo
Ahh
I figured the poster was 8 in general, I just wasn’t familiar with the Espressif logo
It defining makes sense now! And I added it to my cart :3
@idle owl the side2 image is kinda wierdly offset:
I added "double" to "double quotes" to emphasize what kind of quotes
Put some whitespace above the text in the side2
that moves the text down but there's still a lot of whitespace around the pic
I think that's fine.
recrop it? side2 requires 4:3
Is a lot of espressif support added in 8?
@candid sun ^^ (re: side2)
moving on...
i can redo the screenshot
That would work.
@candid sun I would suggest making the screenshot bigger, and use an arrow or something to point to the relevant part.
or add whitespace on the bottom to make it 4:3 in gimp or something
do you want me to delete or just unpublish the .env page?
Delete.
changing name of "Enivronmental Variables Docs" to "Environment Variables Docs" (more usual term)
it is still relevant, it was updated to describe settings.toml: https://docs.circuitpython.org/en/latest/docs/environment.html
Ahhhh ok. Thanks! Nest it under the settings.toml page like it was for the .env page then
@idle owl why is "Create Your settings.toml File" expandable here: https://learn.adafruit.com/pico-w-wifi-with-circuitpython but not here: https://learn.adafruit.com/intro-to-mastodon-api-circuitpython/
Because mirroring a page does not mirror the link nested under it.
That must be added separately.
Oh wait
I did add each external link page separately
I see what you mean
I have no idea
Probably a bug
I'll get screenshots and send them to Learn
@tulip sleet Sent.
@jaunty juniper Maybe you've seen this. circup failing here. Do you happen to know why? Not sure who else to ask.
look at the first line: you are running an older version
Oh!
This is for someone else. I completely missed that line when looking at it. Thank you!
@idle owl guides all updated except for some screenshots I need to redo in Carter's guide. I'll give it a few hours and then search for '.env' in google and the learn search engine to find any stragglers.
Nicely done!!! Thank you so much!
i mirrored the settings.toml setup page into some more of the guides, instead of providing an off-guide reference
Yeah that sounds perfect.
@tidal kiln I updated all the guides to refer to settings.toml instead of .env, now that beta.6 is out. Your guide https://learn.adafruit.com/circuitpython-with-esp32-quick-start has a bunch of screenshots that use .env instead of settings.toml. I could try to re-create these, or do you want to? (Probably neither of us wants to.)
@tulip sleet i can take care of it. i should catch up a bit on the .toml thing in general. so that'll force me to do that.
is the TLDR that .env is now settings.toml?
yes, a rename, and really main thing is use double quotes instead of single quotes.
OK, what should I do for a board definition about a GPIO pin that is broken out to a pin and marked on silkscreen, but will never work?
This page is mirrored in many guides: https://learn.adafruit.com/pico-w-wifi-with-circuitpython/create-your-settings-toml-file and here's the doc: https://docs.circuitpython.org/en/latest/docs/environment.html
@spiral elk don't include it in the board module
Thank you.
@tulip sleet it's just the ones on this page?
https://learn.adafruit.com/circuitpython-with-esp32-quick-start/setting-up-web-workflow
also all the following pages; I put orange (?) warning boxes before the first screen shot that needs to change on each page
yeah it's orange
ahh...ok..seeing those. it just happens to show up 😦
ok. thanks. can use your orange boxes as a locator.
i'll go thru all that and update it tomorrow
i'll grab a beta.6 firmware and run thru it all
GPIO11 is used internally on this particular version of the board despite being broken out to a pin and marked on silkscreen.
Also change flash mode to dio
Hi the product page and related tutorials are being updated, please help me to merge it, thanks.
Add the upcoming nullbits Bit-C PRO RP2040 board. Tested and working on our engineering samples.
Relies on this pico-sdk PR: raspberrypi/pico-sdk#1149
I'm updating adafruit_wiznet5k_socket to match CPython. Part of this process is changing all socket.recv() calls to include a buffer length. What is a reasonable maximum length for a HTTP request (for the WSGI server)?
I think it might be more interesting to make it compatible with adafruit_httpserver and drop the wsgi server from the library, but maybe that's a longer term goal
I agree, first I'd like to fix sockets so I'll just put a bandaid on the WSGI server for now. Is 512 bytes a good balance between not truncating a request and not taking up too much memory?
honestly I don't know
Then it's 512 bytes until a reviewer tells me it's not! 🤪
I think Apache has a limit of 2MB by default
Wow. That's a lot. Maybe too much for a microcontroller.
adafruit_httpserver.server.py uses 1024 so I'll go with that
yay I found that the calendar viewer we were using for the meeting schedule has been re-hosted at (pardon the long url!) https://open-web-calendar.hosted.quelltext.eu/calendar.html?url=https%3A%2F%2Fraw.githubusercontent.com%2Fadafruit%2Fadafruit-circuitpython-weekly-meeting%2Fmain%2Fmeeting.ical&title=CircuitPython Meeting Schedule&tab=agenda&tabs=month&tabs=agenda
I replaced it in the meeting repo and in the notes doc template
question regarding settings.toml
are subtables going to be supported?
and is there going to be a ‘native way’ for updating settings.toml?
if we support subtables, it would probably be through a Python-based toml library. RIght now os.getenv() stops scanning as soon as it finds a subtable [ indicator. We have no plans for a native way of updating the file, other than that you can write a program to rewrite it yourself (modulo the usual "remount" stuff)
this was designed to be a minimal settings thing that uses only a very small amount of C code.
all the toml libraries I've seen parse the whole file and present you with a dictionary of dictionaries or similar.
Oh well, guess I am writing a circuitpy-specific toml module
I will make sure to keep it as tiny as possibly
there are a number of toml libraries available that might be starting points
Honestly adapting them to circuitpy memory standards is going to take longer than to rewrite
I want not a single byte of leaked ram
especially something I plan on calling constantly
it will fetch and save keys without loading the whole file
saving keys of a different length without rewriting the whole file will be a bit tricky
Thanks @wtuemura and @bergdahl!