#circuitpython-dev
1 messages · Page 27 of 1
a comment in the PR yeah
Yea wspico seems to be in spec for psram 120MHz speed and works perfectly fine with ljinux on 2 samples here.
Pr incoming.
This is a much needed speedup.
Chip schematic here.
This is the chip on the board.
The datasheet says "133MHz for 32 Bytes Wrapped Burst operation at VDD=3.0V+/-10%".
The board 3v3 line is precisely on that (since it has a pretty good regulator), so within +/- 10% of 3.0V. So it would be within spec to run it at 133Mhz.
However there is no such option, so running it at 120Mhz. (Which may be for the best)
This pr also explic...
Actually shouldn't the qspi pins be defined?
Even in the board definition of adafruit_feather_esp32s3_4mbflash_2mbpsram which seems to also be qspi, it only has one data pin defined..
I've been poking and prodding this for the last 2 weeks and I've come to the conclusion that there is something going on with the VCMAILBOX_TAG_GET_CLOCK_RATE_MEASURED function with the CORE clock specified on the VideoCore that is hanging the mailbox registers. Once you send the CLOCK_RATE_MEASURED request to the VC I've been seeing something like an 80% chance the registers will hang and from then on, no mailbox requests of any type can be processed. Perhaps the CORE clock can be in a state...
anyone have ideas to shrink M0 builds? my 7-color eink code doesn't have room anymore
Rip everything out and start back from the bottom?
😬
At some point, it just ain't gonna fit.
@kllsamui , the value of 100 I used was based on the two MQTT brokers I had available to test (1 local, 1remote). Some sites could require even more time. The fix in PR #7623 should take care of the problem regardless of the keep_alive timeout.
I already did something that recovered a couple of hundred bytes. I think making the 7-color conditional is necessary (or is it already?)
Hey, sorry for the late reply, the CI stuff took precedence.
I like this over adding separate properties in ESPNow, it keeps the communication part isolated the same way in which the peers management part is isolated and maintains hierarchy in the module.
Also, the stats are an important part for making the communication work effectively with minimal packet drops so a no to tuples which as you mentioned earlier aren't self documenting.
Lastly, I don't find it weird to have proper...
@DavePutz
try 5000

so i have to test the ?next? CP802++daily from
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/raspberry_pi_pico_w/en_US/
( the newest NOW is 2023-02-21T22:26:38 )
or look for a new /lib/adafruit__minimqtt/ bundle?
_pixelmap and/or adafruit_pixelbuf could be dropped from kicksat-sprite. Test a build locally with the largest language that doesn't fit. (make BOARD=kicksat-sprite TRANSLATION=...)
@tulip sleet it isn’t now and isn’t clearly separated out. One idea I have is to reorg the local and global tables to compact the qstr keys together
Each entry wastes two bytes
When sending requests to the video core to return the "measured" CORE clock rate the mailbox registers frequently hang preventing any further access to the video core. This PR replaces the "measured" CORE clock rate checks with an unmeasured request. Fixes #5887 & fixes #5913.
A separate pull request to adafruit/broadcom-peripherals is being submitted to add the additional mailbox call routine.
This will also resolve the deinit issue noted in #5887
Hello @tannewt awaiting further comments from you. Can we document the restriction of using one pin at a time for ESP32 port of analogbufio for now and move ahead?
use 'logging' again

why it say INSECURE
INFO - Establishing an INSECURE connection to <xxx>.hivemq.cloud:8883
1615.053: DEBUG - waiting for messages for 0 seconds
1615.560: DEBUG - waiting for messages for 0 seconds
1616.066: DEBUG - waiting for messages for 0 seconds
1616.572: DEBUG - waiting for messages for 0 seconds
is meant to say 0.5 sec ?
INSECURE means plaintext MQTT. If you want TLS, you need to set is_ssl to True.
On Wed, Feb 22, 2023, at 09:15, KLL wrote:
use 'logging' again
why it say INSECURE
INFO - Establishing an INSECURE connection to <xxx>.hivemq.cloud:8883—
Reply to this email directly, view it on GitHub <https://github.com/adafruit/circuitpython/issues/7606#issuecomment-14...
I think that's because default loop() timeout is 0. See issue 142 in the Adafruit MQTT project.
On Wed, Feb 22, 2023, at 09:38, KLL wrote:
1615.053: DEBUG - waiting for messages for 0 seconds 1615.560: DEBUG - waiting for messages for 0 seconds 1616.066: DEBUG - waiting for messages for 0 seconds 1616.572: DEBUG - waiting for messages for 0 seconds
is meant to say 0.5 sec ?—
Reply to this email directly, view it on GitHub <https://github.com/adafruit/circuitpyth...
244240 bytes used, 1520 bytes free in flash firmware space out of 245760 bytes (240.0kB).
31044 bytes used, 165564 bytes free in ram for stack and heap out of 196608 bytes (192.0kB).
@milindmovasha If I understand correctly, you are allowing one-byte arrays or two-byte arrays to be passed in, but you always write two bytes. Is that correct?
Normally if a result is 16-bit words, we would design an API to require an array.array('H', ...) (or maybe larger), instead of spreading the result over two bytes. That is why I was asking for further checking of the allowed type of the passed-buffer.
If the previous analogbufio implementation is doing something similar, we s...
@tulip sleet I'm not sure the 7623 fix is right, or if that API has to be non throwing for the needs of web workflow.
@slender iron (he/him) @onyx hinge (he/they) Ideally I would like to make an 8.0.3 release very soon (like today) with https://github.com/adafruit/circuitpython/pull/7616 and https://github.com/adafruit/circuitpython/pull/7624 in it. We were awaiting stonehippo's test pf RTS/CTS for 7616, but right now there is a really significant regression on normal UART use on many boards, and I would like to get 7616 in imminently because of that. I think the RTS/CTS will be OK, based on my changes, an the user base for that is small.
7624 is a backport of a socketpool fix that will help mqtt. @slender iron (he/him) Are you willing to go ahead and approve 7616, and could someone approve 7624? Thanks!
I was wondering about that too, but there are other throws in the code there.
In the same function? Ok then
let me check
no, not in the same function. this is a lower-level function called by the common-hal function.
I'll look who calls it
Thank you. I'm sorry I didn't get to looking at it in depth earlier, I saw it go by yesterday but was in the midst of other stuff
I'll be at my computer in an hour or so and can look then if it's still inconvenient
Inconclusive that is
called by _read_byte() in the web workflow, so not a good idea, so I'm not sure how it fixes the original problem... looking more
Are these secure or regular sockets? There's so much discussion on that issue!
it's when TLS is in use, so maybe something else is not checking the return value for negative, and that is passing back the negative value.
Yes that is what I'd check into anyway
I don't see any places where the negative value is not handled correctly, but I don't know the code that well. However, I think I will submit a revert PR for the original and ping DavePutz about it.
is there anyway that a library will stay in disk after an storage.erase_filesystem() command, I am having this problem.. not sure why?
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!
Code done running.
Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit PyPortal Titano with samd51j20
>>> import storage
>>> storage.erase_filesystem()
[08:37:25.698] Disconnected
[08:37:26.699] Warning: Could not open tty device (No such file or directory)
[08:37:26.699] Waiting for tty device..
[08:37:31.706] Connected
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit PyPortal Titano with samd51j20
>>> import adafruit_display_text
>>>
@tulip sleet is there some failure in the chain of calls involving _mbedtls_ssl_recv? (is this failure one that should match mp_is_nonblocking_error()?)
Thanks 🙂
i have no idea -- it would be great if you could pursue this further -- you are much more familiar with the code.
thanks, I think. 🙂
i know it's not your mainline assignment 🙂
Reverts adafruit/circuitpython#7623.
@DavePutz: @jepler brought up that the mp_raise is being done in the internal routine socketpool_socket_recv_into(). There is already a throw in coimmon_halsocket_pool_socket_recv_into() In general these routines below common_hal...() do not throw, because they are called from other places that don't expect them to throw, like the web workflow implementation.
So I think we need to revert this, and figure out what routine is leaking the -116 r...
Do the frozen modules need to be updated? We can do that in the next release(s) of both 8.0.x and 8.1.x.
I think this needs further examination, as the routine where the exception is now raised is used in the web workflow and exceptions are not allowed to be raised in that code. I'll work on an alternate fix today.
working on the verbose option for the printing of the glyphs warning, so probably we could wait. there is no rush
when defining a board, is it okay to define pins with extra names, purely for convenience and/or conforming to old examples, like IO12 and D12 and BUTTON_1?
There is one more use case for IR receiver. That’s possible to detect IR codes on RPI Pico using CircuitPython but that’s impossible to do something more, see for example https://learn.adafruit.com/ir-sensor/circuitpython for IR receiver only (CircuitPython code) and https://learn.adafruit.com/remote-controlled-led-candelabra/code for IR receiver plus LEDs (C code). Even block code language for MicroBit allows to use IR receiver and neopixels together via interrupts but CircuitPython doesn’...
for ESP32, we often use IOxx names: the D names correspond to Arduino usage. The most important thing is to have names that correspond to the board silkscreen.
if you have a pin that's connected to a button, sure name it for the button. Put the "primary" name first in the list in pins.c
Ah okay, was expecting to define all pins, then function specific names
take a look at some existing pin.c files: the Feathers or Metros are good examples. Note how pin aliases are grouped together, with blank lines around them, for clarity
if you don't care about Dmm vs IOnn don't both with D12 -- it's for back-compatibility with Arduino in certain cases.
I was kind of using the adafruit boards, because of display attempt, so this is roughly where I'm at, please forgive extra separators for now, but I found the D prefix for digitalIO and A for analog very useful and everywhere in example code, so to make it beginner friendly I'd rather include those too (ADC on esp32s3 will be interesting and probably have ADC2P1 plus A1 names).
put all the GPIO14's together, in order, with the primary one first, etc.
gotcha
thanks danh, looking at the newer boards (reverse tft s3) the layout is clearly as you describe
@tulip sleet I'm not sure there aren't two problems. The first problem is a return of 116 when trying to read 1 byte and; the next problem is the return of 4294967285 when no data is available. I have a correct (I think) fix for the 2nd thing but the first thing is still baffling me.
of course I'm using a standalone program and not mqtt, let alone the specific mqtt broker the OP reported a problem with
It looks like the initial fix may have been incorrect. re-opening.
<details>
<summary>OP's testing code</summary>
# ______________________________________________________ TEST CODE for LOCAL REMOTE broker TLS problem
import time
import microcontroller
#import micropython
#import gc # micropython garbage collection # use gc.mem_free() # use gc.collect
import os # ____________________________________________ expect file: settings.toml with:
THIS_REVISION = os.getenv('THIS_REVISION')
THIS_OS = os.getenv('THIS_OS')
WIFI_SSID = os.get...
I routinely get OSError: [Errno 116] ETIMEDOUT in Requests in recv_into, possibly same issue
(but it usually succeeds on retry)
my interpretation of #7606 so far is that it's returning the integer 116, not raising an oserror with an errno of 116. (and I'm also confused because the source code says that MP_ETIMEDOUT is 110 not 116)
yeah, the number threw me
this is when running adafruit_requests on a pico w?
espressif, hmm, I can't run that code on Pico W (too big)
oh mostly that list of errno numbers isn't used, py/mpconfig.h:909:#define MICROPY_USE_INTERNAL_ERRNO (0)
so some system dependent list of errno values is used instead
oh I wish all users were magically able to distill their programs down to the simplest reproducing form. because I sure don't enjoy doing it 😛
sounds like a feature request for copilot
🤔
@milindmovasha If I understand correctly, you are allowing one-byte arrays or two-byte arrays to be passed in, but you always write two bytes. Is that correct?
Normally if a result is 16-bit words, we would design an API to require an
array.array('H', ...)(or maybe larger), instead of spreading the result over two bytes. That is why I was asking for further checking of the allowed type of the passed-buffer.If the previous
analogbufioimplementation is doing something sim...
ulaw is a very simple audio codec that originates in telephony. Here is one open implementation. Typically would use 64kbps at 8 bits per sample, 8khz sampling. https://github.com/dpwe/dpwelib/blob/master/ulaw.c
It would be a nice way to halve audio bitrates without using the memory or compute of mp3, and could include both the encoder and decoder.
This PR contains the following changes:
- Split
atmel-samdinstead ofraspberrypi: This more evenly distributes the number boards across matrix jobs. - Refactor and simplify fetching port deps: Now port specific stuff can be placed in
.github/actions/deps/ports/.... - Fix for empty exclude commit: Use
github.event.pull_request.head.shainstead ofgithub.event.afterwhich can be empty.
@tulip sleet Any interest in switching to the CP8 header image I mentioned earlier?
https://github.com/microdev1/circuitpython/tree/patch#readme
The Espressif-ish image we are using now was specifically approved of by Espressif. There is an on-staff artist who makes our images, so if we wanted a respin like that, we could ask them to make the current poster more horizontal.
i am not saying no, but saying we have an internal workflow for this kind of thing
hah, just bitten by the bug gneverov fixed (mdns lwip locking), time to rebase this branch
Rather than returning the negative error value.
This is intended to close #7606, though I did not test with mqtt. Instead, I created a simple standalone test program:
import wifi, socketpool, ssl, time
#wifi.radio.connect()
import socketpool
socket = socketpool.SocketPool(wifi.radio)
ctx = ssl.create_default_context()
b = bytearray(8)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sss = ctx.wrap_socket(s, server_hostname='example.com')
sss.connect(('example.c...
I also tested with mqtt on hivemq.cloud with the following program adapted from the original test program on #7606.
# ______________________________________________________ TEST CODE for LOCAL REMOTE broker TLS problem
import os
import time
import microcontroller
import adafruit_minimqtt.adafruit_minimqtt as MQTT
import ssl
import adafruit_logging as logging
# NOTE: relies on web workflow being configured in settings.toml!
MQTT_broker = os.getenv('MQTT_BROKER')
MQ...
common_hal_socketpool_socket_recv_into() returns an int, and similar for other return values in that file.
But common_hal_ssl_sslsocket_recv_into() returns an mp_uint_t, and similarly for ...send(). I think it is inconsistent that the SSL versions return unsigned ints. Either all the common_hal routines like this should never return ints (which might be negative error values), and always throw, or they should all return ints. This is how we got into trouble.
On Wed, Feb 22, 2023 at 6:13 AM Adrie @.***> wrote:
In my humble opinion the community would really benefit from
microcontroller features that are (becoming) standard.
Then move on to Micropython. It is quite a lot ahead of Circuitpython.
There is no down side to switching.
Let me repeat: I do appreciate all the hard work
The work would be much more appreciated if it were not wasted on this
Circuitpython fork, but rather put into advancing Micropython. We'd all be
furth...
Would you like me to change that here (in 8.0.x) or in a separate PR (for main)?
Would you like me to change that here (in 8.0.x) or in a separate PR (for main)?
We can do a separate PR for main because it's churn. Do you agree they should be regularized, or is there some reason they are not?
No, I don't know if there's a reason the return value types are what they are
I think that code is inherited from the espressif port, so scott might know if there's a reason
Thank you for the revamped fix!
Thanks to @DavePutz and others on 7606 for the sleuthing!
@onyx hinge thanks for taking the time on that -- your understanding is much fresher than mine. Now I can still consider an 8.0.3 very soon
Of course!
yes, you did, tnx, I will go ahead
some background observations around the socket OSError issue:
- It would be nice to have greater clarity around the split between "bindings" and "common-hal". Clearly "bindings" is the C glue code to expose a Python module. But is "common-hal" just the port specific part of this glue, or is "common-hal" meant to stand on its own as a C API. I think it maybe started off as the former but then slid into the latter because of the supervisor. The distinction is important because C callers don't want to deal with Python exceptions, maybe don't want to use Python types, and in some cases don't expect allocations.
- So having rules about how "common-hal" works and establishing best practices would be useful, especially around error handling. In any case, returning an errno as a negative integer is not a good practice. The global errno variable exists so that we can return errnos independently of the function return value.
- Error messages take up a lot of space. It might be a good idea to consolidate error reporting into a standard set of error codes (errno codes or something else). This way every exception raising site doesn't invent its own message string (taking up space). There is a single standard message for an error code. The API documentation can contain more information about what each error code means for a specific function call. Here you have a lot of space to explain in detail what the error means, instead of trying to cram it into an exception message string.
I agree that common-hal definition is fuzzy
It only needs to stand on its own as a C API when it is used by code outside of the VM
which is why we don't have a strict line
I wouldn't spend my time getting it strictly separated though
another use case of common-hal as a C API is when other common-hal modules use it as an implementation detail. E.g., audiopwm using pwm for implementation, or audioi2s using rp2pio for implementation.
It is a little nerve racking in these cases when every common-hal call can potentially throw.
in most cases that's fine because the VM is running
I do usually omit the common_hal_ prefix on versions that are used outside the VM
@wraith crow looks like svdconv was moved by arm and the broadcom-peripherals library is broken
a common bug pattern is:
allocate some hardware resource
call someone else's common-hal function which throws
now my hardware resource has leaked
Obviously the fix is to use nlr_push(), but that's quite cumbersome and no one wants to do that all the time.
I'm not sure I'd call it common because I don't hear folks hit it that often. It is definitely a gotcha
I assumed it was your folder (adafruit/broadcom-peripherals)
since there was no link indication in github
Does Audacity support it? How would one create a file for it?
Ahh, I'm catching up with you slowly 😁 let me poke around and see if I can figure things out.
Would you mind just splitting out every port? I split nrf out in #7497 because I needed to install nrfutil for it. See that PR for some renaming too.
np, thanks for looking into it @wraith crow. I think you are the only person using the broadcom port 😕
Ah well, the 4's may be a bit overkill but once the next generation of zero's come out I think the zero, zero2 and zero2w may make very attractive CP boards
Looks good to me! Thank you @bill88t!
@wraith crow totally. I still want to get back to usb host at some point too
In audacity you "export as wav" with "encoding: u-law". The https://en.wikipedia.org/wiki/Au_file_format is maybe a more "classic" way to store this data, available as "Other uncompressed files" with AU header, encoding: u-law. (a-law is very similar but I think u-law is slightly more common / better). Consider also setting the sample rate to 8khz in Audacity's Tracks -> Resample
Okay so I found the workflow link to the old location, which I can easily update to the new location you suggested but I don't know what the "commit one" is and if that would be a better choice.
Usage is via settings.toml, e.g.: CIRCUITPY_PYSTACK_SIZE=2048?
And supervisor.runtime.next_stack_limit is intact and adjusts the C stack?
"commit one" would be the raw link to the same file but under a specific commit before it was deleted
Actually shouldn't the qspi pins be defined? Even in the board definition of
adafruit_feather_esp32s3_4mbflash_2mbpsramwhich seems to also be qspi, it only has one data pin defined..
Defined where?
I definitely think this is an optimization we should be able to make on many ESP boards. We haven't ensured that we're running near the limit of the flash and RAM.
In ports/espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/sdkconfig we can see:
CONFIG_SPIRAM_MODE_QUAD=y and CONFIG_SPIRAM_TYPE_AUTO=y
CONFIG_SPIRAM_MODE_QUAD is for qspi, so shouldn't we define the rest of the data pins?
Currently only:
CONFIG_DEFAULT_PSRAM_CLK_IO=30
CONFIG_DEFAULT_PSRAM_CS_IO=26
are defined. So the board would run in normal spi?
Shouldn't there be something like:
CONFIG_DEFAULT_PSRAM_CS_IO1=26
CONFIG_DEFAULT_PSRAM_CS_IO2=26
CONFI...
I may be reading it wrong, but the license seems to apply to any Raspberry Pi device. Emphasis mine:
This cyw43-driver is also available for use with Raspberry Pi Ltd semiconductor devices under different terms (see LICENSE.RP in this directory).
Raspberry Pi Ltd (Licensor) hereby grants to you a non-exclusive lice...
Sorry for the slow response. It was a three day weekend here in the US and I didn't have the brain power yesterday to context switch to this.
Unfortunately, I don't think the existing API is good enough for audio input. I'd suggest following my original suggestion to do init/deinit for reading here. Then, follow up with a new AudioIn API. It'll need to take a buffer in the constructor, return samples read without blocking and detect overflows. It'll be pretty different than this API.
Broadcom SoC, this would work for zero 2w though.
Thanks for your response! I hope you enjoyed your long weekend. Coming back to thread, even if I follow your original suggestion of init/deinit we wont' be able to support second bufferedIn on second pin because mask for ADC units will get overwritten and previous bufferedIn samples would be stopped if second bufferedIn is configured. Even if we remember the mask (read/modify/write) and configure second BufferedIn appropriately, the samples collected via adc_digi_read_bytes would be interleav...
Nevermind, I added X support but it'll raise an error on 100% duty cycle. Note, it also has a fixed falling edge when most PWM are fixed leading edge. The CircuitPython API doesn't explicitly say which it is.
It now handles deinit, never_reset and sharing tracking. PWM now runs in the WAIT state as well during a time.sleep().
_reset_ok() was removed because it was called in one spot right before deinit().
Some PWMOut were also switched to a bitmap for use instead of reference count. That way init and deinit are idempotent.
Fixes #6589. Fixes #4841. Fixes #4541.
Yup! It was good. The read should occur during readinto and that ensures only one pin is being read at a time. This API isn't designed for background reading.
So I think I could save 1548 bytes by changing the QSTR -> obj tables
I think they take 6192 bytes now. each entry is 8 bytes and could be 6 bytes a piece
Would you mind just splitting out every port?
I took a look at the nrfutil changes and this pr simplifies it.
The port specific configuration steps/dependencies for nrf can go in:
# .github/actions/deps/ports/nrf/action.yml
name: Fetch nrf port deps
runs:
using: composite
steps:
- name: Get nrfutil 7+
run: |
wget https://developer.nordicsemi.com/.pc-tools/nrfutil/x64-linux/nrfutil
chmod +x nrfutil
./nrfutil install nrf5sdk-...
It would be unfortunate to switch to this tool as we have user/developers who build on arm64 linux platforms (e.g., rpi)...
@slender iron Looks like the broadcom-peripherals finally passed the checks 😁
Working with a device that uses a SPI bus with 6-bit command words. When trying to configure the bus for this via:
...
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
spi.configure(bits=6)
...
I get:
ValueError: Invalid number of bits
(This is the device I'm trying to control, if that's helpful)
This should be good to go now. It's not perfect, but it is in a good place to be added to the site.
It would be unfortunate to switch to this tool as we have user/developers who build on arm64 linux platforms (e.g., rpi)...
Are you talking about nrfutil? If so, #7497 is a better place to discuss this.
Is there a way to kick off the workflow checks of a PR without sending a new commit?
Do you want to re-run all jobs? on you pr?https://github.com/adafruit/circuitpython/pull/7628/checks for this one?
Yep, that's the one
CircuitPython version
Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit Metro ESP32S2 with ESP32S2
Board ID:adafruit_metro_esp32s2
UID:C7FD1AA13E86
Code/REPL
# SPDX-FileCopyrightText: 2020 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import ipaddress
import ssl
import wifi
import socketpool
import adafruit_requests
# URLs to fetch from
TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"
JSON_QUOTES_URL =...
done, normally it would appear re-run all-jobs on the screen right hand side
lol, okay I'll look at the screen closer next time. Thanks!
🙂 yw
Looks like I missed a step, does the CircuitPython link to adafruilt/broadcom-peripherals need to be updated?
CircuitPython version
CircuitPython 8.0.2 on Adafruit Feather ESP32 V2
Code/REPL
N/A
Behavior
N/A
Description
In CircuitPython 8.0.2 with ESP32 V2, whenever a file is uploaded (PUT) or deleted (DELETE) the web workflow gets broken because the board no longer listens for TCP connections on port 80.
Downgrading to 8.0.0 beta 4 fixes the problem. https://github.com/adafruit/circuitpython/commit/f8ac1d9261c087d1f65886036289c2121c32cc0f#diff-...
ya, you'll want to make sure the submodule uses the latest commit
@tulip sleet @onyx hinge got time to chat about my table size optimization idea?
yup, I am just back from being out
I can get on video in a few minutes
kk, I'm in the Amelia room
Does anyone know of / if a Blinka animated GIF exists?
Will merge for now since this is an 8.0.0 regression on a number of boards, breaking UART. @stonehippo we are still interested in your test results, of course!
I sometimes forget how good @slender iron is with creating tooling .. but it's hard to even know to look for whether someone's already created a relevant tool, you have to stumble across it or say something at the right time to jog someone's memory
what tool of mine are you thinking of?
it crossed my mind to use SWO for the memory captures
@vale spire any thoughts around reorganizing qstr-only tables to save flash space?
heyya, sorry don't have any context here .. what was the idea?
ohh wait, yes
🙂
i looked into this with @onyx hinge ... the idea being that many locals dicts have qstr-only keys which means only 16-bits per entry
so for 4-byte alignment this means you need to split keys and values into separate tables (instead of a single table of elements)
but then you have two huge problems:
- writing the tables is annoying (and working around this is beyond what is probably considered healthy use of preprocessing... and you know how low my standards are here)
- any code that iterates a map now needs to know which structure it is (and most code that iterates maps does so by directly using the table of elems)
yup yup, that's the thinking
If we're willing to number the entries we could use initilizers to mix the two
or we could pack two entries together k1, k2, v1, v2
i wrote a script to rewrite all the affected const maps and conpute the savings and it was... not amazing
yep sounds about right
1500 is great, but i couldn't see a way to avoid likely a lot of extra code in handling it
i also wondered that many of these maps are qstr to rom pointer
and so perhaps we could do silly things to make the rom pointer 16-bit (i.e. an offset)
that could help us mix the definition of two arrays
yup, I thought about that too
we could use a python script and then sort the keys to speed up search
have you seen tools/cc1 in the main repo 🙂
i think the map caching we added last year mostly gets the same win
haha, nice
ya, I'd believe it
and most of the tables are pretty short
is tools/cc1 actually used?
no, was just an experiment (untouched for many years now)
So it turns out adafruit/broadcom-peripherals has two branches main and main-build. CP uses the main-build as a submodule but I pushed my PR against the main branch.
Should I change the link in .gitmodules to the main branch or resubmit my pull against the main-build branch?
there are so many things in this category of "what if we wrote a real C preprocessor for MPy"
exactly
oh yea 😊
so packing two entries at a time could be one way to do it
but splitting it into two arrays would likely lead to simpler searching code
because you'd just change the element size
https://learn.adafruit.com/assets/82651 it doesn't have lots of movement, and it's 4 blinkas isntead of one but here is onem.
ooh, here's another: https://cdn-daily-blog.adafruitdaily.com/uploads/2021/02/20210223blinka.gif
Oh thanks I hadn't seen the second one
@tulip sleet @slender iron maybe we should re-triage the imx bugs in view of the upcoming metro
I did a bit already
moved some of the long term things to 9.0
I also wanted to update to the newer sdk that they have on github
good idea, maybe tomw?
but was going to wait until after 8.1
that's fine too
I'm also happy to chat it over tomorrow
SCP-7951; “mailbox of infinite snakes”. A simple green mailbox that appears to hold an infinite number of Blinka snakes. No upper limit has been found on how many can enter the box, but every few seconds, another appears and jumps in.
So the updated broadcom-peripherals changed a lot of the parameter names. I'm working my way through the modules swapping in the new names but it's going to take a while.
@tannewt Would you mind taking a look at this? Thanks.
There was one file in the broadcom-peripherals repository that needed to be updated with the new parameter names. I'll wait for that to be merged (https://github.com/adafruit/broadcom-peripherals/pull/2) before pushing the hopefully final updates for this PR
Okay. I get it. The current analogbufio APIs are designed for "one shot" or "single conversion" mode of ADC DMA. It does not support "continuous conversion" mode. I will make changes as per your suggestion to move init/deinit in readinto.
Hi, Can I check if there is a good reference code(for both send and receiving side) that is able to send a csv file from mac to circuitpython board (ESP#@ S3 TFT). Thanks
no news, just for info:
- nuke
- adafruit-circuitpython-raspberry_pi_pico_w-en_US-20230222-c2c7b93.uf2
- adafruit-circuitpython-bundle-8.x-mpy-20230223.zip
works with is_ssl=True,
HANGS without
___ Connecting to router kll-wlan_2.4G OR CHECK THE 'settings.toml' FILE
___ Connected to kll-wlan_2.4G
___ Listening on http://192.168.1.214:80
___+++ setup MQTT
___+++ setup MQTTclient
___++++ use TLS
___ Attempting to <xxx>.hivemq.cloud
after several minutes wait see
...
@tannewt I have addressed your review comment of initializing and de-initializing dma in readinto function via commits https://github.com/adafruit/circuitpython/pull/7602/commits/09f84e351318f9f3bf5bff6bb9664703ca743c78 and https://github.com/adafruit/circuitpython/pull/7602/commits/9e73e8351aace95c6600345ca80134a7e13915de
I have restricted the buffer type to array.array('H', ...) as part of commit https://github.com/adafruit/circuitpython/pull/7602/commits/09f84e351318f9f3bf5bff6bb9664703ca743c78
https://github.com/adafruit/circup code has a TODO to check free space on a device before installing a module. To support this for web workflow (https://github.com/adafruit/circup/issues/156) as well, the value available needs to be available via the REST API.
This q is better asked in #help-with-circuitpython
While looking into #7606 @dhalbert noted that there were irregularities in our socket-like APIs that may have contributed to the bug existing in the first place.
We should consider rationalizing the code so that:
- the common-hal APIs consistently return either positive counts or negative errno values, in signed types (mp_int_t)
- the shared-bindings have the responsibility of transforming negative errno values into OSError exceptions
- noting, at least in comments, common-hal APIs t...
@dhalbert I suggest merging this PR after you release 8.0.3, so all those bugfixes also arrive in main.
We believe this is fixed by #7632.
The only possible block to 8.0.3 I see now is potentially #7636.
from what I can see, hivemq only offers mqtt over tls (what we call is_ssl=True). It's no surprise if they can't successfully communicate when one side is expecting TLS and the other is expecting plaintext.

Port 1883 is allocated for non-secure MQTT. However, hivemq machines do not respond on port 1883. I think that non-TLS (use_ssl=False) is not supported by hivemq.
We don't support any microcontrollers that have sub-8-bit SPI peripherals. In general, 8-bit is standard, a few support 9-bit or 16-bit.
Despite the fact that the datasheet says the device "is compatible with the SPI protocol", it is so only in a loose sense.
If you use 8-bit SPI and have your setting bits in the lower 6 bits, does that work? Maybe it will accept 8 clocks and just discard the top two bits.
You could also simulate 6-bit SPI by bitbanging the data and clock lines yours...
Found and fixed a bug while implementing a simple idea to make testing much easier.
I could not reproduce this on a Feather ESP32 V2 or a Metro ESP32-S2. I uploaded files and deleted files, and did not see a problem. Is your code.py doing some networky thing? Mine is not.
I thought I'd see if 7636 showed up on the Huzzah32 but the 8.0.2 and the latest build seem to cause a boot loop. I'll see if I can find where it started
The rp2pio SM has great timing capability. Well beyond that of CPy. If one could get triggers or read state from peripherals like the ADC or DMA, it would easy to measure the timing for various IO apps to a microsecond (instead of a millisecond). Is this a viable feature request? Do I open an issue in GitHub?
My app uses an rp2pio sm to generate 8 sq wave pulses at 40KHZ after a calculated NOP delay. This is sent to a transducer. The receiving transducer reads from the ADC0 using analogbufio. However, the CPy overhead from the call to my pulse routine and analogbufio makes it hard to get microsecond timing.
I loaded 8.0.2 on a Feather Huzzah32 and it is not boot looping. try doing a full erase first (I didn't have to do that, but this Feather has had CPy on it before)
There is too much delay between the pio write and the analogbufin?
okay :), I was coming to the conclusion it was on my end since I know I've run beta6 on the board and it's not running now. I had Micropython on it last and didn't erase it first :/
@slender iron since I can't reproduce 7636 I am going to proceed with 8.0.3, as it does not seem to be a pervasive issue
Yes. I performed a study. The best I can do is 800 microseconds plus or minus 100 microseconds
works for me. I didn't want to context switch to it
Could you use the non-blocking PIO write to capture early?
(I know nothing about transducers)
Thats with the non-blocking PIO!
sounds like you may need something native
I'd appreciate a consult and take it off line if its not in everyone's interest sandbox.
Hi lee, I'm looking at async io perf in general. I'd be happy to hear more about what you're trying to do.
What board are you using? PIO on the RP2040 could be used too.
I'd suggest writing up an issue with what you are trying to do.
Where should I submit the issue? Looks like there is at least one other interested party.
Will do. Thanks!
Feel free to reach out to me. latkinso42@gmail.com
an issue is best so others (like me) can follow along
Agreed. I am writing it up now. I find the PIO so incredibly powerful. It allows for speciality needs on the downside of an interpretive language without having to commit one's entire app to C++.
I (inconsistently) drop the common_hal_ prefix on functions meant to be used outside of the VM.
This would use f_getfree() internally. We may want to add it to the BLE workflow API too.
Without the common_hal_ prefix the functions can sometimes collide with functions in 'shared-bindings' which already typically don't have a prefix.
Yup! I usually add a _ prefix which I use for statics ala Python's private designation.
Maybe we could use a base_ prefix or similar for the functions that can be called from C outside the VM. Maybe you can think of a better prefix. I too usually drop the common_hal_ for routines not meant to be called via a Python API.
@vladak What versions did you try? 8.0.0? 8.0.1?
A put and delete shouldn't change the reset reason. So I don't think it is the cause of the issue you are seeing.
I could not reproduce this on a Metro ESP32-S2 with 8.0.2 and the latest version of adafruit_requests (installed with circup). You might want to try erasing the flash completely and then reinstalling the UF2 bootloader: https://learn.adafruit.com/adafruit-metro-esp32-s2/install-uf2-bootloader
@slender iron is the case-insensitive space saving change imminent? The 8.0.x->main merge is failing on a few boards due to space.
I haven't made the changes yet. I'm still trying to determine exactly what is pulling in those tables
i may merge that anyway, or do some temp shrinking in that case, since we want those changes in main
there are pico w fixes and other regression fixes from 8.0.x we should have in main
temp shrinking would be like turning off rainbowio or something
give me today to get something together. I'd rather not have anything temporary in main
sure, np
so shouldn't we define the rest of the data pins?
I think the pins are fixed, not flexible. So you don't need to define them.
I've been doing a little testing on the Huzzah32 (thanks for the kickstart @dhalbert :blush:). I didn't reproduce exactly what it sounds like @vladak is describing but I did find something that maybe they are running into.
On the Huzzah32 with the default code.py file when the board boots it sits at the Press any key to enter the REPL prompt. Web workflow works fine and you can access the serial terminal. However if you are at that initial "Press any key" prompt and you use the web workflo...
Would you mind just splitting out every port?
I took a look at the
nrfutilchanges and this pr simplifies it.
I agree it simplifies that part but I'd still like to split the matrix by port rather than architecture. That would be clearer than having a mix as you have now.
Looks good re my comments! I'm making a simple grammar change myself.
msgid "%q must be an array of type 'H'"
mp_raise_ValueError_varg(translate("%q must be an array of type 'H'"), MP_QSTR_buffer);
@slender iron did you mean to approve https://github.com/adafruit/circuitpython/pull/7602 (analogbufio)? You requested a review from yourself.
it looks fine to me but also wanted you to look
you can remove me
and approve when you are ready
👍
Thank you for this! One structural comment.
Changed my mind; "an array" to just "array", for space reasons, and to make translation easier.
msgid "%q must be array of type 'H'"
mp_raise_ValueError_varg(translate("%q must be array of type 'H'"), MP_QSTR_buffer);
Basically, the boot.py stuff is not currently being utilized because it ended up being a much more complicated feature than I had originally thought and the project was stalled as a result. I was planning on following up in another PR.
This feature would enable many amateurs and professionals to leverage the power of processor peripherals for precise microsecond level timing applications, such as measurement, where Circuitpython's inherent time resolution of near 1 millisecond is insufficient.
Use of IRQs would not be needed (to the best of my knowledge). The trigger would merely be a state change of a register or more specifically, particular bits of a register.
Example Need:
A current project, a precise ultrasonic ...
The serial terminal behavior started with rc.0, it doesn't happen on beta.6.
Should the latest S3 build show Adafruit CircuitPython 8.1.0-alpha.2-15-gd5e936ce7 on 2023-02-23; Adafruit Feather HUZZAH32 with ESP32 as the version?
I guess that's right, just not used to seeing the alpha 🙂
we didn't release an alpha; it's just a placeholder so it won't say 8.0.0-rc.something. there will be a beta.0 soon
@slender iron Can you merge #7631 as is, it contains some fixes for changes per commit.
I agree with you on making matrix by port rather than architecture but I might not be able to get to it until next week.
ya, sure
Automated website update for release 8.0.3 by Blinka.
A few builds are failing due to size. Will wait for case-sensitivity change (to reduce firmware size) before merging this.
Thanks @latkinso42 for writing up your use case.
FWIW, I've been exploring a new approach for doing I/O. In this approach everything is a "stream" which serves as a common abstraction for connecting independent IO modules, like analogbufio and rp2pio. In this imaginary world, analogbufio would expose a stream of the ADC samples, which you'd connect to a PIO State Machine. When streams are "connected" they automatically transfer data without any interaction from the main program. When your ...
@slender iron @vale spire I have terribleness for you. using "order_pp" and "chaos_pp", a pair of very painful macros that can declare the weird mixed tables you'd need for packing qstr-keys dicts closer ...
given
TABLE((1,a) (2,b) (3,c) (4,d));
TABLE((1,a) (2,b) (3,c) (4,d) (5,e) );
the macro can produce
{ {1,a},{2,b},{3,c},{4,d} };
{ {1,a},{2,b},{3,c},{4,d},{5,e} };
``` (traditional interleaved table) or using the TABLE2 macro ```c
{ {.a=1,.b=2},{.a=3,.b=4}, {.obj=a},{.obj=b},{.obj=c},{.obj=d} };
{ {.a=1,.b=2},{.a=3,.b=4},{.a=5}, {.obj=a},{.obj=b},{.obj=c},{.obj=d},{.obj=e} }
```(hypothetical packed table in which the elements are a union of `qstr a, b` or an `mp_obj_t obj`)
Based on awful awful horrible "boost preprocessor wasn't ~~bad~~ ~~*good*~~ **bad** enough" https://github.com/rofl0r/chaos-pp and https://github.com/rofl0r/order-pp which I chose after a survey of general terribleness at https://jadlevesque.github.io/PPMP-Iceberg/
https://gist.github.com/55d51d1b9186194917f6387ef448a052
Excellent idea and very exciting. I have to admit, I'm not the EE or HW guy I need to be to make any of this happen. I barely suffice to understand the genius that has come before me. However, it can be manifested SW-wise, precise timeing for peripherals would make for powerful control with ease of programming. I suppose it would not need to add data 'streams' but merely use the PIO as a trigger. In the case of analogbufio, the DMA starts running, but effectively does nothing until the first ...
I don't think we SHOULD do it but I just wanted to see if it could be done within the C preprocessor.
ok now I'm very interested 🙂
but yeah I don't think we should do it because i just can't see the cost of using it being worth it... we can't have every site that iterates a dict have two different versions (i think??)
I could not reproduce this on a Feather ESP32 V2 or a Metro ESP32-S2. I uploaded files and deleted files, and did not see a problem. Is your code.py doing some networky thing? Mine is not.
code.py contains just this:
print("Hello World!")
How many places actually read this table?
order-pp seems very powerful and very nearly undocumented so it was a bit of a slog to create this blob of macro
@onyx hinge are you tempted to do it?
@onyx hinge did you see a way to do it as split tables? i.e. array of keys and array of values?
one advantage of that is that can also be the layout for all maps
The macro could declare two variables, one an array of qstr and the other an array of mp_obj_t, I thnk
does that help?
i wondered if this might improve performance for lookup because you look at less memory (i.e. less cache filling)
yes
looks like ~55 distinct sites refer to the table field of mp_map_t
@vladak What versions did you try? 8.0.0? 8.0.1?
A put and delete shouldn't change the reset reason. So I don't think it is the cause of the issue you are seeing.
Reflashed the board with 8.0.0, the problem is present there as well.
btw y'all going to come visit us in August?
https://2023.pycon.org.au/
if only! but I think Adafruit's probably going to send me to only one python conference this year.
Could you erase the flash completely and load 8.0.2 fresh? I know this will be a bit of a nuisance. What browser are you using (I don't think it should matter, but...)
I don't really want to take this on right now, my interest was in seeing if macros could help adapt a "natural key,value" layout to the new split layout, but I don't want to do all the other stuff...
puts it in his back pocket
Here's what I have tried so far:
| Version | Problem present |
|---|---|
| 8.0.2 | Yes |
| 8.0.0 | Yes |
| 8.0.0-rc0 | Yes |
| 8.0.0-beta6 | No |
| 8.0.0-beta5 | No |
| 8.0.0-beta4 | No |
so it seems to be introduced in 8.0.0-rc0.
What files were you uploading and deleting? I was uploading and deleting datafiles, not code.py or some other used .py file.
python find_reverse_deps.py cvt Cvt 367ms Thu 23 Feb 2023 01:06:49 PM PST
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ff.o:ExCvt
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ff.o:follow_path
f_stat
f_utime
f_chdir
f_opendir
f_unlink
f_rename
f_mkdir
f_open
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ffunicode.o:cvt1.1
ff_wtoupper
f_mkfs
f_setlabel
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ff.o:xname_sum
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ff.o:dir_find
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ffunicode.o:cvt2.0
ff_wtoupper
f_mkfs
f_setlabel
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ff.o:xname_sum
/home/tannewt/repos/circuitpython/ports/mimxrt10xx/build-metro_m7_1011/lib/oofatfs/ff.o:dir_find
Could you erase the flash completely and load 8.0.2 fresh? I know this will be a bit of a nuisance. What browser are you using (I don't think it should matter, but...)
I use REST APIs via circup (or rather my PR that introduces web workflow support), however it fails with browser as well (Firefox in my case).
After doing
esptool.py --port /dev/ttyACM0 erase_flash
esptool.py --port /dev/ttyACM0 write_flash -z 0x0 \
~/Downloads/adafruit-circuitpython-adafruit_feather_esp32_v2-en_US-8.0.2.bin
I created the settings.toml file using the guide on https://learn.adafruit.com/circuitpython-with-esp32-quick-start/setting-up-web-workflow , verified it is reachable via ping and TCP on port 80 and retried. It fails in the same way as before.
What files were you uploading and deleting? I was uploading and deleting datafiles, not code.py or some other used .py file.
I am uploading Python libraries.
sorry for the continuing q's, still trying to reporduce. Are you addressing the board with a DNS name, or a numeric IP? I have trouble with cached entries in my browser, so I always use a numeric IP.
Using numeric IP address.
Happens also when code.py is changed with:
import requests
from requests.auth import HTTPBasicAuth
auth = HTTPBasicAuth("", "XXX")
r = requests.put("http://172.40.0.10/fs/code.py",
'print("Hello ESP32 V2!")',
auth=auth)
oooh that's weird, I have the Feather ESP32 V2 stop responding to its IP after uploading a file from the web UI, but still working via my app as long as I don't close the window (changing the code, seing the LED change color), while curl says "Failed to connect"
and if I look in the dev console I see "fetch failed loading etc." but the color changes...
For the serial terminal issue I was seeing, I tracked it down to https://github.com/adafruit/circuitpython/commit/40534da92a8e385b9a04b8d0ff14f8365b2e1f5a and in particular this change:
uint64_t start_ticks = supervisor_ticks_ms64();
// Allow timeouts and interrupts
- while (newsoc == -1 && !timed_out) {
+ while (newsoc == -1 &&
+ !timed_out &&
+ !mp_hal_is_interrupted()) {
if (self->timeout_ms != (uint)-1 && self->timeout_ms != 0) {
...
On a somewhat unrelated note, when I was looking at the commit in question it looked to me like the this change:
- write(socket_change_fd, &fd, sizeof(fd));
+ // Write must be 8 bytes for an eventfd.
+ uint64_t signal = 1;
+ write(socket_change_fd, &signal, sizeof(signal));
should have set signal to fd, but I don't have any clue as to what the code is actually doing here....
fatfs size reduction commit https://github.com/adafruit/circuitpython/pull/7497/commits/1a3358d036ece62ff22614e4844ea79b90825b87
@tulip sleet ☝️
are the files still going to print as lowercase (assuming they were saved as lowercase)? Just a little confused about FF_FS_ASCII_UPPER_ONLY
I think they will print as the saved case because it only converts incoming path strings afaict
the name made sense to me an hour ago. not so much now 🙂
it will change the uppercase table of formatted exfat too
and FF_CODE_PAGE is usually 437, it looks like?
yup, think so
looked that way to me too
did you test with some extended char filenames? I think you could write a port/unix test for this??
no I didn't. let me look
well, maybe not, not sure whether you can use VfsFAT in unix
should have set signal to fd
The value of signal doesn't seem to be used anywhere, and the size of the write was wrong earlier (it was 4 bytes instead of 8, which is required). Maybe fixing that broke something this other thing.
The first fix, adding !mp_hal_is_interrupted(), allows ctrl-C, I don't think that would affect this. Is that the change you made in the attached firmware.zip?
Yep, I removed the !mp_hal_is_intrrupted() and my issue went away.
looks like it does run them
Yep, I removed the !mp_hal_is_intrrupted() and my issue went away.
That is weird, it would normally be always true (ctrl-c not typed).
Autoreload could cause interrupt too I think. I think there needs to be a check after that loop to ensure that newsoc is valid. If not, return EAGAIN like the check inside the loop does.
i'll be afk for a while
Or, looking more closely, lwip_fcntl should happen later after we know newsoc is valid.
I'm done once Ari wakes
Should the 8.0.0 warnings be repeated in each point release notes? I imagine lots of people will go from older firmware to some point release.
ya, maybe until 8.1
I get the issue on a FunHouse too, when I try to upload a file, it fails as it should because the drive is mounted, but still auto-reloads, and after that the web workflow stops responding.
The issue also happens when creating a directory but ONLY if the directory is really created, not if it already exists, or if the drive is mounted. Which is also the only case where it triggers an auto-reload.
The warnings were for churn inside the 8.0.0 betas, for new ports, so I didn't think it necessary to repeat for people upgrading from 7.3.3. But I could put them back.
I saw what you wrote in #help-with-circuitpython . Which board is it? I thought there were no churns in filesystem between 7.3.3 and 8.0.0 because it was all new boards, but I guess not.
sorry, I think it was my confusion. Pico W certainly didn't exist. I think what happened to me was ESP32-S2 that had filesystem expanded, then put 7.3.3 back on it, then 8 again
I saw files I thought I had lost
I'll have to see if I can replicate that ,,,nope, that wasn't the sequence with the odd file behavior
I'm trying to get going on the adafruit macropad. I took the code from the example of the numpad script and put it into the code to file. I've restarted the board and the top left bottom blinks green every 5 seconds and the screen says code done running. But none of the keys work.
could you link to the script you mean?
Sure, it's the numpad.py script in the .zip file that the website provides.
Oh gosh that's so big
Yes all the ones that came with the zip file
Yes
you want to see what errors are being printed, if any, so you want to connect to the board's serial connection. You can use Mu or a terminal program.
I have used mu but it says the same as the little screen, "code done running"
The code.py file is in the circuitpy root directory
Yes I took the code out of the numpad file pasted it into the code.py file in root directory. I can run print statements in the same script and those will be put on the screen so I think I'm using the correct file.
your code.py is too small, it should be 8.5kB
use the original code.py that came in the bundle. That is the program in charge, which reads all the definitions in macros/.
in your file explorer, turn on showing file extensions (under View), it will make things much easier
you're welcome, np
Now to start customizing it for SQL server!
@tannewt I'm using a Teensy 4.1.
@dhalbert thanks for this! I had considered that I might have to do some bit banging, but to be honest I rarely do much work with micros. When I looked at the source for busio, I saw it was doing what looked like a simple check for the bits argument and wondered if it might be as easy as adjusting that check.
I'll get a chance to look at the device tomorrow and was going to try an 8-bit word like you mentioned and hope it discarded the unnecessary bits. If ...
interesting... taking a post-8.0.0-beta.1 PicoW back to beta.1 then back to post-8.0.0-beta.1 exposes the files that were on it originally
also I was (pleasantly) surprised that reverting an expanded ESP32-S2 to 7.3.3 didn't un- expand the filesystem
the UF2 only writes the blocks that are actually used
it probably fails when trying to write to parts that are in the extended section, by just failing, or overwriting the wrong part of the flash
yeah, there wasn't a lot on that one
I managed to brick / kill a Pico W somehow though 😦
I don't have an exponent of 2 Picows anymore 😦
I'm assuming something bad happened to it electrically
and I discovered that my websockets code that works on ESP32 doesn't work on a picow
so that's a fun thing to debug
I thought websockets was just some high-level protocol on top of HTTP
oh, it is different
you tell the http server to switch to websockets for that connection, which makes it persistent
and then there's a protocol with bytes and stuff
those pesky bytes
right now after sending the headers, reading times out
at the point where the server should send "HTTP/1.1 101 etc"
(except on SSL where it just freezes at sock.connect)
I haven't done a lot with sockets but I did find that depending on the server I was connecting to, if I didn't send the header variables it wanted the connections would timeout or freeze.
But, as you're working with code that worked on the ESP32 that's probably not relevant.
I'll try to get more debug done tomorrow, look at what is really going through the network
for now it looks like the pico only actually sends the headers after I ctrl-C rather than when send() is called if the server debug logs are to be believed
While working on the SPI issues I noticed that when the PI4B would corrupt my SD card, I would often get directory entries that looked similar to this one:
Adafruit CircuitPython 7.2.0-alpha.0-120-gaee80d67b on 2021-12-14; Raspberry Pi 4B with bcm2711 >>> import os >>> os.listdir() ['AdafruitCi', 'ha.0-120.-ga', '4;Raspb.err', '\nBoardI.d:r', '~1.MET', '.Trashes', 'code.py', 'lib', 'boot_out.txt', 'System Volume Information']
:
print(no)
try:
test(no+1)
except RuntimeError:
print("Done")
test(0)
I'm very interested in this. We have some esp32s2 boards we use in schools to teach students.
The problem we have is EAP-TTLS with PAP enterprise wifi. We managed to hack something together in Radio.h and Radio.c to use other enterprise authentication methods and it is our understanding that for EAP-TTLS and PAP we need esp-idf 5.0 due to espressif/esp-idf/issues/7011.
Can we help somehow? How much work is this?
PLC and ESP32 IOT
It is useful to be able to generate accurate PWM frequencies that are in the 1hz to 100Hz range, (or even slower).
While it has been suggested that these can be generated in a timing loop, that is not a viable solution when reliable timing or a specific duty cycle is required. Real world examples would be generating a square waveform for ringing a telephone bell (20hz or 30hz), pulse dialing a phone in an alarm system, sending tones of precise duration, or for phase-control lighting applic...
I'm not sure that it's possible to do substantially better than we currently do with the PWM hardware. If you have a specific idea about how to call functions in the pico_sdk that would achieve your goals, please give more information.
Instead, I'd recommend using the pio peripheral to get cycle-accurate delays and transitions. For instance, this example blinks an LED with a frequency of 5, 8, and 30Hz (and 50% duty cycle): https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython/...
jepler, I hope you don't mind, I edited your comment so the link wasn't 404
Rest up and get better, this functionality is awesome and is absolutely functional even with this issue. I'm not around much this weekend but I'll try and nail down the exact setting that crashes when I have a chance. Thanks SO much for this work :grin:.
I’ll look into the PIO. My impression has been that Raspberry Pi Foundation created PIO as a way to prove that there can be something more difficult and obscure than assembly language.I don’t know how to make constructive suggestions as I don’t have low-level skills.On Feb 24, 2023, at 20:57, Jeff Epler @.***> wrote:
I'm not sure that it's possible to do substantially better than we currently do with the PWM hardware. If you have a specific idea about how to call functions in the pico_...
how can i privately report a potential security issue in a circuitpython library?
@midnight sage start with security@adafruit.com and they'll get it to the right folks
ok
The link you gave is a 404 error:On Feb 24, 2023, at 20:57, Jeff Epler @.***> wrote:get cycle-accurate delays and transitions. For instance, this example blinks an LED with a frequency of 5, 8, and 30Hz (and 50% duty cycle): https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython/using-pio-to-blink-a-led-quickly-or-slowly—the on/off times can be any specific number of CPU cycles.
Looks like my colleague edited the original post on github so that the auto-link behavior was correct -- try https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython/using-pio-to-blink-a-led-quickly-or-slowly
Thanks. By the way, taking your suggestion a little tongue in cheek the logical extension of your argument is that there is no need or use for CircuitPython since anything can be better accomplished in assembly language.My point is that working at a high level with tools that have a minimum of misbehaviors lets end results get accomplished without falling into the infinite learning recursion syndrome.If the PWM just worked at lower frequencies then there would be one less case of “death by a ...
somehow this was fixed with a flash nuke 🤷
The RP2040 PWM hardware can support frequencies as low as 7.5 Hz. @SeattleDavid let us know if it is not working at say 10 Hz, as there may be a bug there.
If the frequency is too low for a specific port's PWM hardware, it would be a more seamless developer experience if PWMOut could automatically fall back to a timer interrupt based implementation.
For right now, we could raise an error when the requested frequency is out of range.
@tulip sleet I was poking around the espressif Socket.c and I'm still getting stuck on setting signal to 1. The original version wrote fd (which was the wrong type, only 4 bytes) but fd was passed in as what looks like the socket number. Can the socket number only be 1?
It did do that, but the value passed was not used anywhere (that's what I concluded). So ti didn't matter what was passed. Do you see otherwise?
the value passed is added to a counter in the ESP-IDF eventfd code. (I traced it down to that.)
I have no idea how to trace where write(socket_change_fd, &signal, sizeof(signal)) is sending the data or how that data is processed so I assumed you wouldn't want the PR to change the data being written. It sounds like you did track it down and incrementing the counter by 1 or by the socket number doesn't matter. Just curious was there an advantage to passing the 1 rather than just setting the new signal variable to fd?
it appeared to be just a count, so passing fd is a red herring.
Now I understand why there's a hook stuck in my lip 😆 I always chase those dang herring....
I had to chase it too, in this case 🙂 . I'll see if I can find more info for you -- it's always good to have more eyes on this.
@wraith crow
https://github.com/espressif/esp-idf/blob/4c2afac35502161ce473660c99e17feb013a378d/components/vfs/vfs_eventfd.c#L250 event_write(): makes sure the data size is 8 bytes, may call signal_event_fd_from_isr() with the data value. May add the data value to s_events[fd].value.
https://github.com/espressif/esp-idf/blob/4c2afac35502161ce473660c99e17feb013a378d/components/vfs/vfs_eventfd.c#L225
May add the data value to .value, as above.
eventfd is more general than just for sockets, so there's some use case that's interesting for maintaining .value, but I don't know what it is.
I actually did all this code tracing in emacs with tags, not in GitHub, but any IDE would help.
Thanks! I'll have a look over the weekend and see I can pry this hook out
@tulip sleet @onyx hinge I'm around now if you want to talk imx
i can do it in 1 minute
I'll join in a bit.
I'm back and looking at the mimxrt10xx label list
I'm in the Amelia room
I like that!At, say, <6.5 it would (behind the scenes) switch how it does things. This could make it possible to support under 1hz.On Feb 24, 2023, at 23:28, gneverov @.***> wrote:
The RP2040 PWM hardware can support frequencies as low as 7.5 Hz. @SeattleDavid let us know if it is not working at say 10 Hz, as there may be a bug there.
If the frequency is too low for a specific port's PWM hardware, it would be a more seamless developer experience if PWMOut could automatically fall back ...
Not as good as doing it the correct way by switching methods under 7.5, but certainly better than now when it is just wrong.On Feb 24, 2023, at 23:29, Dan Halbert @.***> wrote:
For right now, we could raise an error when the requested frequency is out of range.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
slightly better name for FF_FS_ASCII_UPPER_ONLY
#if FF_FS_CASE_INSENSITIVE_COMPARISON_UPPERCASE_ONLY
or FF_FS_CASE_INSENSITIVE_UPPERCASE_ONLY ,which is shorter
@tulip sleet I think you meant ASCII instead of UPPERCASE above
you're right, trying to do too many things at once
so you had to fix the tester 🙂
I did
exfat is off on samd21 it looks like already
removing mkfs didn't do anything
ok, pushed
Can we help somehow? How much work is this?
Our plan is to switch to 5.0 once we've branched 8.1 (and mark main as 9.0.0 alpha.) That should happen pretty soon.
@MicroDev1 would know what help we need to get this ready to merge.
Ok, sounds good! I'm excited for people to start trying this. We can sort out the drive later.
any thoughts on how perf tests should measure the time they take?
micropython uses utime.ticks_us()
I'm not sure we have a microsecond clock running usually
trying now with monotonic_ns
Python Enhancement Proposals (PEPs)
Thanks @jposada202020 and @luisan00 !
Merging, with hope that the case-insensitive file changes will make things fit now.
OK, I give up. I can't translate this one due to line feeds. WHY is there even linefeeds here?
Regardless how many linefeeds I put in it won't accept it.
serial_write_compressed(translate("\nInvalid CIRCUITPY_PYSTACK_SIZE\n\n\r"));
oh that's a weird line
We have Invalid %q, not sure if "Invalid %q", MP_QSTR_CIRCUITPY_PYSTACK_SIZE will save space
the \r has to be a typo 🤷
if we take the \n out of all the translated strings, does that have a horrible cost ?
not a typo, it ws to reduce calls to the string writing routine
how does it do that ?
can you do a multiline message? Just entering newlines? Maybe with ctrl-enter ??
we can't enter a \r in weblate
never mind the \r's.
the rest is fine
it has to do with terminal programs that don't do auto CR's
on a few terminal programs, just \n will produce something like:
this is one line
this is another
putty does this
oh so instead of "\r\n" it sends just \n then a single \r to reduce bytes ?
(aren't \n converted anyway ? or is it higher level ?)
if it is \n\n\r I did not do that deliberately, it's probably a typo. I can fix it later; it will just be in the beta now
yeah that's what is weird, I didn't see that anywhere else
oh and also I'd like to rethink "%q is %q" 🤔 https://github.com/adafruit/circuitpython/blob/f9831b3bbccdb29c438b30ec8908dbbaaeaaf791/shared-bindings/dualbank/__init__.c#L73
is it just CIRCUITPY_STACK_SIZE; ok, I think we should have caught that in the review; that was not me. I changed some safe mode printing but I took out the \r's there
The markdown links were not rendering
Hi, @interfector18 thanks for taking interest, this is a draft because the boards with PSRAM crash on boot.
I did some basic printf debugging and vaguely recall that the crash happens somewhere in the PSRAM initialization.
I had put this aside since this is scheduled for 9.0.0.
Is it safe to assume that this didn't yet make it into 8.0.3? I'm experiencing similar issues trying to control a Crickit HAT (which communicates via I2C): motors are moving out of sync, updating the onboard NeoPixel has an obvious delay; but I only noticed now that this wasn't merged until yesterday.
I've been struggling with supporting animated Gifs through the Gifio library and realized that there are some errors there in the documentation, in the example part. The actual code is:
import board
import gifio
import displayio
import time
splash = displayio.Group()
board.DISPLAY.show(splash)
odg = gifio.OnDiskGif('/sample.gif')
odg.next_frame() # Load the first frame
# THE ABOVE LINE IS WRONG
# face = displayio.TileGrid(odg, pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565))
face = displayio.TileGrid(odg.bitmap, pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565))
splash.append(face)
board.DISPLAY.refresh()
# Wait forever
while True:
# THE ABOVE LINE IS WRONG
#gif.next_frame()
odg.next_frame()
time.sleep(0.1)
Oops! Thanks for finding that and pointing it out. The example was tweaked a bit before we finalized things and I guess I forgot to run it and had stared at it too long. Sorry for the confusion
I was hoping to write up a quick how-to guide for GIFs but real life has just got in the way the last few days
shouldn't it also be time.sleep(odg.next_frame()) or something similar?
Yes you are right. I'll leave it like that for the example for simplicity. Really should check the time before/after the load frame, screen refresh and then delay the remaining time.
A couple errors made it through when the documentation was updated. They have been corrected. Example ran for me on a KB2040.
Looking at the github 8.0.3 tag this update isn't included so I'm guessing it hasn't been merged into the released builds yet. If you used the "absolute newest" link from the circuitpython.org downloads page you should get a firmware file with this update merged in.
@dhalbert ended up trying your suggestion of just ignoring the top two bits of an 8 bit word, and it worked a treat!
Thanks again.
#7644 pointed out the need for better documentation.
To the best of my ability I noted the current behavior. I think that there may be some ports that do not actually read back the 'set' frequency value, but they are ports marked as beta status (mimxrt10xx) or not maintained by us (cxd56).
This isn't to say that we shouldn't improve the implementation, for instance, to make sure that out-of-range values are handled uniformly across ports. I think there's some subtlety to this; for insta...
There's also a trade-off to be made between frequency precision and duty-cycle precision. Right now we favor duty-cycle precision, but I think it would be acceptable to drop one bit of duty-cycle to attain better frequency precision at low frequencies. Or even make the duty-cycle precision an optional parameter to the API.
somebody should make a thing that scans the i2c bus and installs all those packages, circup-style
you don't want to see my heavily-nested i2c address-detection, import, and init attempt code o_O
0x77 is particularly nasty
based on address ? different attempts at getting identification bytes ?
me? just trying to init and seeing what happens, no low-level i2c code currently
the thought was that the code could auto-configure and I could plug in anything I own ...mostly it works but there are a few sticky bits
no, how would you scan I2C and find what's on it without the library and prior knowledge [of a restricted list of hardware], unless Jeff meant the Raspberry Pi hats with EEPROM
yeah, address-only could mean installing half dozen libs or more, and then it still might not be right. yikes, all the configurable address boards with ranges of possible addresses...
I've lamented the fact the I2C devices don't easily ID themselves, but SPI is worse, especially dispays w/o miso
there was a set of displays with miso that I could ID by the time it took for the init to run O_o ... oops, faulty recollection from 2017 arduino days, it was... checks notes... 0x70-0x77 i2c featherwings (toyed with gpio as spi ID, but clearly unsustainable)
I2C database with addresses and scan them? maybe https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests/blob/main/examples/fakerequests_advancedtest.py.
Wippersnapper does scan and list candidates based on the address
That is nice
I love it when my bad ideas prompt discussion. 🙂
you can do better, you could develop a magic-like database that not only has the addresses, but also a register to check and the expected value, for the cases where there are multiple devices for the same address
spi displays are 🤷 though, I briefly played with using gpio pins as an identifier for which was wired up (clearly not sustainable) before going with a downloadable config file
spi is generally not suitable for this
not enough of a protocol
Raspberry Pi had this idea of adding an i2c memory on every official shield, with identifying data and config on it
you can use a cheap EPROM chip for this
yeah not all devices would have some identifiable bytes, but some drivers definitely look for those, I am worried that trying to read it could have an unintended side effect on a device that is not intended for it
Even 0x50 would be a nightmare.
Being able to distinguish between chips with different address modes (1-byte vs 2-byte) would be fun.
most devices don't do anything destructive on a read
if we can assume it's an Adafruit stemma QT breakout, there's probably many cases where we can find exactly what it is
Great! I wish the datasheet had been clearer. So often they say only just the bare minimum, without helpful use cases.
also I'd suggest
display = board.DISPLAY
splash = displayio.Group()
display.root_group = splash
instead of using .show(), which is now deprecated. Do you want to make a doc update PR?
This was merged into main, which is on the 8.1.0-beta track, and will probably not be backported to the 8.0.x branch. We'll be making 8.1.0-beta.0 soon.
Made a PR and added your suggestion as well. Thanks. Forgot that had changed.
Inserting a mp_hal_delay_us(1); between asserting the row to its resting value, and turning on the pull resistor, also solves the problem for me.
I'm not really sure where to go from here. Pretty much anything solves the issue on my keyboard. It's a matter of finding a solution that's good enough to upstream for all keyboards, and hopefully puts the issue to bed once and for all. Any ideas?
Verified that the problem exists on ESP32-S2 and ESP32-S3 with the latest build as well; but not on a PICO-W. The issue seems to be tied to overflows on the receiving ring buffer that are not being checked for in websocket_background().
CircuitPython version
Adafruit CircuitPython 8.1.0-alpha.2-14-gc2c7b9345 on 2023-02-22; Seeeduino XIAO RP2040 with rp2040
Board ID:seeeduino_xiao_rp2040
Code/REPL
# I am posting the code for Gifio test, but the same problem happens with any use of TFT Display and I2C call at same time...
import board
import busio
import gifio
import displayio
import time
import adafruit_ili9341
dc=board.D5
rst=board.D4
cs=board.D2 #My display does not have it....
you forgot to call displayio.release_displays()
You can't use the same board.D5 pin as both D/C and SCL at the same time.
Sorry man! When I post it, I've discovered my stupidity. Hahahaha
I will solve it and post if it works.
Inserting a
mp_hal_delay_us(1);between asserting the row to its resting value, and turning on the pull resistor, also solves the problem for me.
I'm certainly willing to add that. One other thing to try: in place of the mp_hal_delay_us(1), add asm volatile(""); That will prevent certain compiler optimizations, which might be affecting that.
I hadn't even considered compiler optimizations. I gave your compiler fence a try to no avail -- it ghosts just like a stock CircuitPython build.
I don't know much about ARM but I for good measure I also tried a hardware fence __atomic_thread_fence(__ATOMIC_SEQ_CST); which compiles to a dmb instruction. This also behaves exactly the same.
Man, sleeps/delays feel dirty to me. I was really hoping to come up with a better solution.
does the Hallowing M0 need paralleldisplay ? Can it even really use it ? The builtin display is SPI.
It has adafruit_lis3dh frozen into but no BusDevice which is kind of weird to have a frozen library require an external library. I was thinking of adding it. There's space for it, though I don't know for all languages...
I have this problem too, w5500-evb-pico use http_server , not response after 1 minute not have income request.
CircuitPython Bundle 8.0.3
I have this problem too, w5500-evb-pico use http_server , not response after 1 minute not have income request. CircuitPython Bundle 8.0.3
Can you provide some code example? How are you accessing your HTTP server? curl? Chrome? Firefox? This error was preety much only visible when using Chrome.
I want to check whether we are talking about precisely the same error.
Let's see if #1121 is fixed upstream yet.
Got rp2040js working with reading RAM usage by imports! I'll bring it up tomorrow, but the question now is HOW to use it (and of course if we want to).
The first question is how to check (e.g., should a package be checked for each importable module, or the sum of all it's modules?) and what to do (a PR comment? only if certain thresholds are met?).
I think there are other questions but those are easier to answer (e.g., how not to run it for thinks the rp2040 can't run like adafruit_esp32spi).
@lone axle you might be interested in this since it builds on your outstanding PR to the cookiecutter regarding mpy filesizes.
Apologies in advance if anyone looks - I haven't updated the README yet, but the test workflow shows example usage.
The logic of the main loop was changed between version 7 and 8 (Commit). Something is wrong with the existing version 8 logic so the serial write of "soft reboot" is never executed when the user does a soft reboot.
A consequence of this is that tools like tools/pyboard.py, ampy and mpremote are not able to activate the raw REPL since they execute a soft reboot and wait for this to be printed to...
On the S3 it seems that a setting of 3504 or higher will lead to a safe mode hard crash if the stack depth test is run. 3503 or lower seems stable.
Oh really? I meant it as an example of incompatibility based on the MCU but I actually didn't realize that would work.
with an Airlift wing or similar (really, any ESP32 as a co-processor)
M0 is about the only thing that can't run ESP32SPI, due to small RAM
Ah, thanks for the clarification!
And that's right, I've definitely done the same with an airlift.
simulate_reset is now not used at all. I think perhaps an alternative fix is not to add first_run back, but to initialize bool simulate_reset = false instead of true.
Tested locally. Thank for you for this fix! Couldyou change the base to 8.0.x soit will get in the next stable 8.0.x release? We will have an 8.0.4 soon -- there is at least one other thing we want to fix on the stable line.
You are right that doing it with simulate_reset is better. However, just initializing it to false is not correct I think, since it would also print soft reboot at first power up.
I looked a little deeper into the code and I think I have the right understanding of the behavior now. The basic problem was that simulate_reset was initialized to true (correctly), but it never was set to false anywhere. Inside run_code_py, it only ever gets set to true as well (to make a sleep...
However, just initializing it to
falseis not correct I think, since it would also printsoft rebootat first power up.
Yes, thanks for pointing that out.
The sleep / fake-sleep logic was made a lot simpler, and we missed this case when we redid it.
Shoot. I may have screwed that up by checking the "Copy the main branch only" checkbox when I created my CircuitPython fork. So I don't have the 8.0.x branch. I've been looking but I can't find how to add this branch to my form after the fact. Do you know?
I have found this more difficult recently, not sure why. git fetch adafruit 8.0.x:8.0.x I think works, where adafruit is my name for upstream. But don't worry about this. I'll merge this to main and backport it with a cherry pick, no problem.
hey my first accidental push to an Adafruit repo \o/
CircuitPython version
Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit Feather M4 Express with samd51j19
Code/REPL
# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""CircuitPython Essentials: PWM with Fixed Frequency example."""
import time
import board
import pwmio
# LED setup for most CircuitPython boards:
led = pwmio.PWMOut(board.LED, frequency=5000, duty_cycle=0)
while True:
t...
@xorbit noticed that "soft reboot" was not being printed at all, due to a logic error when we reworked main.c. Fixed in #7652 on main. This is a backport to 8.0.x.
Just to add some confusion to the day... I wanted to try something on a feather_esp32s3_nopsram so I updated my clone of the repo and build it then flashde it via make BOARD=feather_esps2s3_nopsram flash PORT=/dev/tty.usbmodem<etc>'it flashed OK, but did not boot. I then used the WEB tool to flash the 8.0.3 release downloaded from circuitpython.org and it worked fine... after some head-scratching, I loaded a UF2 bootloader to it (via Arduino) and then loaded my local built .uf2 of the latest repo and it also worked fine. I noted that the Web tool loads circuitpython-firmware.bin while the make loads firmware.bin...is this a problem? Should I be using some other parameters with the make command?
I am wrong about the Web tool using circuitpython-firmware.bin ignore that
circuitpython-firmware.bin is the circuitpython only, without the second-stage bootloader and paritition table. firmware.bin is the whole thing. You can see this at line 439 in the Makefile
yeah -- that makes sense, I was confused by downlaoded file name -- but I'm still puzzled why my local build/load of firmware.bin failed.... I'll retry it.
do an erase first
you are resetting, right? It stays in the bootloader until you reset
yes -- connecting to the board I see ```ESP-ROM:esp32s3-20210327
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x400454d5
SPIWP:0xee
mode:QIO, clock div:1
load:0x3fce3808,len:0x68
ets_loader.c 78
jerryneedell@Mac-mini ~ %
I was digging through the core but didn't explicitly see it - but I assume function argument names are stored as qstr right? Also, are variable names within functions stored like that, or just globals?
Thinking of tools to track stored strings like these to maybe help optimize
I reloaded the UF2 bootloader and the firmware.uf2 works fine....
Thanks -- me too!
Is the usb_cdc.data possible with the SAMD21?
what about the bug and how can somebody make two MSC Endpoints for IN an OUT?
"The exception is SAMD21, which has some bug that requires separate MSC endpoints for IN and OUT, instead of a pair"
you mean the C code? Yes, arg names are qstr's. qstr's are unique -- they are interned strings, so there are not going to be duplicate qstr's
Gotcha, I basically want to build a Python tool that will analyze the AST and estimate the size. It came up when talking about const() usage. Hoping to pair it with that RAM analysis check I'm working on.
So are local variables stored as interned strings as well?
@louisfrederic That turned out not to be true. usb_cdc is available on SAMD21 builds. I edited the post to make this clear.
Local variables are not avialable by name: https://docs.micropython.org/en/latest/genrst/core_language.html#local-variables-aren-t-included-in-locals-result . This is one of the reasons why we have ctrl-C restart the VM instead of leaving you in the previous VM. You can't examine variables like you can in CPython, because their names are not available.
Ah, thank you! That's also a good page, I forgot it's there but will come in handy for this project.
So I've been playing around with the MP3 decoder on my trusty rp2040. Maybe I'm crazy but it seems like the time to decode an mp3 frame varies from build to build. (I.e., it's constant for a single build, but if I change some code and rebuild it can be different.) It varies from 20 to 40 ms. This is significant because the audio length of a frame is 26 ms, so if it takes longer than that to decode, playback effectively doesn't work. Has anyone else experienced this?
this sounds like maybe it's due to code moving around affecting the caching?
especially since the RP2040 uses external flash for everything. I assume you are decoding the same mp3 over and over
since I don't think the decode time per frame is constant, it depends on the data
you can change the compile flags for just one file. It would be interesting to move it away from -Os for the mp3 decoding file
Yes, code layout is what I'd suspect too, but that's really hard to fix 😭 , so I hoping there was another explanation, and/or to confirm other people at least experience non-real-time mp3 decoding.
It seems like the decode time is approximately constant time since most of the time is spend doing the inverse DCT, which is same time independent of content. At least that's my working hypothesis.
The optimization flags don't seem to have an effect other than altering code layout. Sometimes a -O1 is faster than a -O3 build.
Sadly the 64-bit multiply/add instruction isn't available on Cortex-M0+, which seems to be the critical instruction for mp3 decoding.
Hi everyone.
I'm currently working on a port for the Lilygo T-Embed.
So far, I'm able to compile and I started to add specific pins names for example for the screen.
I have many questions of course but the current in my mind is the following: can we add constants to help the user? I'd like to add some constants like the width and height of the screen.
Which file is the proper one?
Looks good to me.
I tested this successfully locally and compared to current live page.
This is screenshot from this PR version:

Currently live page shows literal text instead of links:

Thank you @alustig3!
fwiw the screen size is generally accessible from the initialized display object. On boards with a built-in display you should be able to access it with board.DISPLAY.width and board.DISPLAY.height
I would think that inside of board would be the best place to put extra constants that are helpful for the user based on things that are built-in to a specific piece of hardware as well. Though I don't know of any examples of just generic constants, generally it's holding pin names and initialized buses like SPI, I2C, as well as the display on device with one builtin.
I don't know, it's not something we do right now, the usual method is more a board helper library in python, which could even be frozen in, as some boards do
rpi may have put a version of this in ROM
@proven garnet I'd probably avoid AST analysis. I had some scripts that would analyze the contents of RAM that could be useful instead
wasn't there the idea of having like the number of on-board neopixels in the module ? I don't think is was done anywhere though
Interesting idea, I don't recall hearing of it before but I do think that seems like a nice bit of helper information.
The Adafruit MP3 guide is using low sample rate MP3s. I'd believe that would fix my real-time decoding problem. I must have been incredibly lucky that the first time I did this it worked with "standard" MP3 (44.1 kHz, 16-bit, stereo). But now I am cursed knowing that it can work. 😬
yes, we definitely tested and advised limiting the rates
@solar whale @slender iron I have to squeeze the Feather M0 RFM69 board on 8.0.x to get a tiny fix in. ja is overflowing by 20 bytes. Current modules:
any suggestions? I might be able to shrink the frozen library, but that is more work
there are pins BATTERY and VOLTAGE_MONITOR which are the same, could drop one
also various other pin aliases
That sounds like a great way
At some point, should they go the way of the "pirkey" and just stop being updated?
pirkey was never a real product
I guess it will be problematic to maintain the .mpy's
I can probably shrink the library, I'll take a brief look. I think I did that for rfm9x already
I just meant that PIRKEY is on the circuitpython.prg site, but only old versions are avaialbe fpr it.
I'm sure there are some things that can be done for the library.
I don't know if the more recent stuff that added types also made it bigger?
not so much, but there are recent additions to various things in the runup to 8.0.0, and it must have been on the hairy edge of fitting
rfm9x is building ok?
we have a shrink for main, but I'm reluctant to backport that to 8.0.x
yes rfm9x is ok, surprisingly
it even has room for rainbowio
hmm -- hopefully there are some things that never got done for rmf69. I'm surprized it is bigger than rfm9x.
Would you like me to look at it?
Will just dropping one of the pin names -get you by?
library has stuff in it that checks whether supervisor.ticks_ms() exists. That is a given now, could remove that code
i'll look and see when that happened
That could be simplified a lot if the check is not needed.
it was added in 7.0.0, so no problem removing it. I'll submit a PR for that.
Danh -- I'll be happy to approve it just based on reading it -- I can test it in the next hour or so if you want to wait.
just have to dig out the boards and make some room on my bench!
probably best to test it, thank you very much, I am not trying to get this fixed today
OK - I'll run some tests in a bit.
aha, it doesn't work because there is no supervisor in blinka, so this is a cascade of changes. I think will withdraw this for now, and try something else
ugh!
I didn't see any obvious other things to shrink the code significantly, other than to remove functionality
how much does dropping the extra pin name save you?
I will llok
getting rid of one of the battery names is a good start
can you get a few bytes by shorteining the message here if version != 0x24: raise RuntimeError( "Failed to find RFM69 with expected version, check wiring!" )
it saved nothing for one, and 8 bytes for the other, not good enough. I could remove collections, looking at that
nah - it is just namedtuple left in collections anyway
I have not tried using neopixels much with the m0 -- Is there enough ram to even import the library? -- could neopixel_write be removed?
Im sure that would make some folks unhappy..
that's kind of major, i could imagine projects that use the RFM to control neopixels
yeah -- samw with pwmio and analogio I guess
i can shorten several messages, i'll try that, after the meetings
we are saving several hundred bytes in 8.1.0, that should be ok for later
Nice!
the adafruit_led_animation library even works on trinkeys, if you're very careful (yes I am surprised too)
i see a little bit of common subexpression elimination as well
"""Enter idle standby mode (switching off high power amplifiers if necessary)."""
# Like RadioHead library, turn off high power boost if enabled.
if self._tx_power >= 18:
self._write_u8(_REG_TEST_PA1, _TEST_PA1_NORMAL)
self._write_u8(_REG_TEST_PA2, _TEST_PA2_NORMAL)
self.operation_mode = STANDBY_MODE
def sleep(self) -> None:
"""Enter sleep mode."""
self.operation_mode = SLEEP_MODE
def listen(self) -> None:
"""Listen for packets to be received by the chip. Use :py:func:`receive` to listen, wait
and retrieve packets as they're available.
"""
# Like RadioHead library, turn off high power boost if enabled.
if self._tx_power >= 18:
self._write_u8(_REG_TEST_PA1, _TEST_PA1_NORMAL)
self._write_u8(_REG_TEST_PA2, _TEST_PA2_NORMAL)
# Enable payload ready interrupt for D0 line.
self.dio_0_mapping = 0b01
# Enter RX mode (will clear FIFO!).
self.operation_mode = RX_MODE
def transmit(self) -> None:
"""Transmit a packet which is queued in the FIFO. This is a low level function for
entering transmit mode and more. For generating and transmitting a packet of data use
:py:func:`send` instead.
"""
# Like RadioHead library, turn on high power boost if enabled.
if self._tx_power >= 18:
self._write_u8(_REG_TEST_PA1, _TEST_PA1_BOOST)
self._write_u8(_REG_TEST_PA2, _TEST_PA2_BOOST)
# Enable packet sent interrupt for D0 line.
self.dio_0_mapping = 0b00
# Enter TX mode (will clear FIFO!).
self.operation_mode = TX_MODE
``` we may be to use a function for the `if self._tx_power >= 18` tests. 2 are identical and one is jsut a different address....
in tx_power(), self.output_power can be fetched once at the top into a variable. That will make all return statements smaller.
may help to do a = b = 0 etc some places instead of a = 0; b = 0
that kind of thing. we have a 1pm meeting, tty after 2
ok -- I'll keep looking after lunch
<@&356864093652516868> we'll be having the meeting about 1 hour from now. please add your notes ahead of time here: https://docs.google.com/document/d/18-Buy1i0z-7l-fJlpYge63EPgbZoqKBTd8YRQOKy9cU/edit#
CircuitPython Weekly Meeting for February 27, 2023 Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll b...
(not worth immortalizing in the notes, but I'll be afk first half of March... no cell/wifi/internet/MSC/CDC)
@tulip sleet I started working on a few changes that may help - see jerryn_size branch in https://github.com/jerryneedell/Adafruit_CircuitPython_RFM69.git
This looks good and I think will be enough!
I made a clock that always* shows the wrong time when it detects someone looking at it.
*It's right twice a day
17451
913
I'm setting up to test it now.
I’ll think about the best way to present it. Then I’ll PR to have complete advice and maybe adapt after precise discussion. Thanks a lot
@candid sun if your voice wants a break I can take the libraries section
that would be excellent @onyx hinge thank you
I am now finally fixing pystack for S3. I am defining hard-limits for every port at it's effective maximum (the point where no more depth can be gained).
Are there #ifdef's for all esp cpus?
I can only see:
CONFIG_IDF_TARGET_ESP32C3
CONFIG_IDF_TARGET_ESP32
unknown. but increasing the size past some point (differs per port), doesn't make recursion tests to reach bigger numbers
maybe there is a separate check
Ah, no the stack is allocated alright
did a megabyte on s2
Currently known:
3.5k S3
3.7k S2
7.0k rp2
I haven't tested the rest.
I think the S3 limit may be a different barrier than the other boards since the S3 causes a crash
I mean, if it doesn't wield any benefit, why permit more?
ya, fixing the crash would be good
@brazen hatch your test case is pretty specific
its possible that larger function frames could benefit from it still
figuring out what limit you are hitting now would be good for understanding the new constraint
Ljinux doesn't benefit from larger-than-effective either. And nested commands take 3kb each.
I don't think you should cap it unless its too big to fit or will cause a crash
Alright
Still, I need this
Or else I will have to do it board-per-board
you want to set a max for s3 to prevent a crash?
@midnight ember could be a cracked solder connection
@tulip sleet I think we could make any circuitpython board work as a slow debug probe
I was playing around with it here: https://github.com/tannewt/jtag
not sure about the UM Feather S3 but often one of those LEDs next to the USB connector is the charge indicator; without a battery the activity of the charge state indicator can be irregular... (because it's based on the voltage measured from a battery that's not there)...
i've rebooted 3 times, restarted the device 50 times, yes, all manner of button sequences attempted.
"jtag" might be the ROM bootloader, if uf2 is not installed on it or not successfully starting...
yes i've seen jtag as a device before if the uf2 is missing
yup i think that's what it is, just looked at the bottom of the USB connector and the joints aren't flowed from the bottom all the way like on an adafruit board.
potato camera sorry
Potatoes are delicious
no more chip shortage song though 😦
Used the installer first time today. It seemed to work ok but I had other issues afterward. The actual update was really cool. All the different options might confuse a beginner though.
cool, knitting symbols https://github.com/marnen/knitting_symbols/blob/master/symbols/index.md
Even knitting has code? didn't know that.
🙂
Yea, S3 needs a hardcap on 3500
do you understand why it crashes?
Looking forward to the M7's zoom zoom.
it'd be nice to understand why on non-crashing systems there's still some kind of soft limit too
Thanks for hosting the meeting.
Thank you for hosting Liz!
Thanks
otherwise 👻 🪦 it's just spooky 🎃
Thanks
it could be interaction with the c stack limit
thanks liz!
thanks folks!
Thanks for running the meeting, Liz!
pystack doesn't mean that a function call uses no C stack memory, just that it doesn't use it for the python objects such as arguments?
Absolutely not a single clue. On S2 I could only make it fail the same way by spamming zero's.
I have no S3 board, so can't gdb it to see.
I was wondering if the dynamic pystack allocation was doing something like using the RTC memory and running into the physical limit
I have no jtag dongle even, so can't even debug S2.
I have been swd'ing picos for debugging this whole time.
It turns out there is something wrong on that board. Repeated erasing/installing the UF2 bootloader gave the same results. Thank you for looking at the problem. I am glad you were able to get the example to work on your end. That lead me to replace the board. The test program is now working.
I generally use ESP_LOG debugging on ESP because it goes out the uart
(and crashes usually generate backtraces there)
@tulip sleet it's been a long time since I submitted a PR -- Do I need to initiate a new release for the rfm69 library or does someone do that routinely? Should we even bother since there is no functional change. it really only impacts the size.
As soon as I have some time, I'll try and get a debugging build for the S3 setup and see if I can get a backtrace from the crash
I will in the meantime try to find the #ifdef's for the hard-limit.
Here is the notes document for next Monday’s CircuitPython Weekly meeting (March 6, 2023). 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/1qZcdRI7ho9WyFsDM8X6hhcUYfifnyVcCTaYT_LUTmqk/edit?usp=sharing
CircuitPython Weekly Meeting for March 6th, 2023 Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be ...
@solar whale Thank you! I made a release and I will incorporate it into the 8.0.x PR that was too big.
Great, thanks! Glad I could help.
The Hallowing M0 has the adafruit_lis3dh library frozen in, which requires adafruit_bus_device.
So might as well enable it rather than depend on an external library.
In the futture if there are size issues, I noticed that paralleldisplay is enabled on it, which doesn't seem useful on a board with a builtin SPI display.
I have added propre display init in board.c, the display starts with proper brightness. But then I was expected to have a board.DISPLAY once under circuitpython and it's not the case. What did I forgot?
@lethal abyss add to pins.c { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)},
ohhhh, thanks. I really try to understand every piece I modify so thanks a lot.
once more thanks to you and the wonderfull Adafruit community, I think I'm really to close to a PR, the pre-commit tool says it's ok 🐼🎉
Added a missing step into one of the installer flows and removed a false statement that said that CP and Arduino support was missing from the S3 dev boards.
it's doing a slow boot loop, roughly about 10 seconds. tio is connecting and disconnecting
let me try it
And… it just broke all my USB devices. Have to reboot
it works fine for me
ok, i am back -- had to boot up another machine to log in over the network to reboot cleanly
@DavePutz are you working on a fix?
@tulip sleet have you only tried with this one board?
@slender iron I have to update the RFM69 library to shrink the Feather M0 RFM69 build on that PR ^^ to get that board to build. Will get a re-review from you
@tulip sleet you could try cp on an evk
I have a 1011 evk, and i have a Teensy 4.1
have to figure out how to get it on the evk
have you loaded the .bin or gotten the .uf2 bootloader onto the evk? There are lots of jumpers and switches here
I never used this
I probably went straight to swd
I've been metroing so far
it is tricky with the dip switches
have you done teensy before?
One interest would be to print out the memory address that are allocated to see what they are near.
yes, but it's been a while
I can find my evk if you want to try that
i have to look at the doc. Let me finish what I was doing for Erin. this is going to take a while, and I may need to try more than one.
kk. I'm on ari time so it might need to be tomorrow
I was maybe going to stop soon anywy
kk, let's regroup tomorrow
i can report to you tomorrow what is working or not, and you don't have to wait around for me
I still think you should consider the beagle
Maybe yes, but I don't think it
its pricey but we're going to do more stuff that utilizes hs
's going to help this problem
there is an alternative to the beagle, that Thach has, but it might be more pricey
I love its diagrams, though
teledyne?
yah I think so
may be closer in cost
beagle 480 is $1295, Teledyne USB-TMS2-M02-X is $1305
beagle is what I have
yeah
so I'd go that way to have the same thing
I'd love to use open source analysis software anyway
in my fantasy world
could I order one of the dell's you have?
a specific model that matches yours
@lone axle are you finishing these 7-color epd drivers for me?
they don't have the exact model, but I have demonstrated the issue on a 3020 with an i5, and a 7060 with an i7
I think it'd be money better spent for you getting a beagle 480
if I get a dell then I have to store it
and maintain it
35% coupon. If you could use a solid Windows machine for testing, these are great
these a NUC-sized
I put in PRs to fix the name of superclass inti argument and remove the note about not being on pypi. I have in mind a few ideas for other examples that I plan to submit as well.
I'm not sure what else if anything they need, but I'm open to working on it if there is anything.
let me just try some more tomorrow with the other boards. For this particular problem, i don't think the Beagle helps
you need at least 8th generation to run Windows 11
I'd assume that linux is resetting due to a tinyusb error
and you may be able to see what that error is with the beagle
Ah, I think they will go automatically to pypi when a release is made.
I turned on logging and Thach looked at the log -- did you see that?
he said a READ10 was late in replying
I saw the discussion but didn't look at the log
he figured it out from the log, he didn't say he needed a trace, and he didn't need the wireshark
no, the drive doesn't show. /var/log/syslog shows that linux attempts to mount the drive, and read stuff from it, but then it decides to reset
This must be related to SYNCBUSY:
I think we do want the value to be copied on reload but that shouldn't prevent us from writing the buffered value multiple times in the interim. We just changed this on rp2: #7299
@slender iron 1011 EVK is showing CIRCUITPY, so there is something odd about my other board
It has a .bin MSC bootloader. I was just able to copy the .bin to RT1010-EVK MSC device that appears on the debug USB port
not sure if changing the switches was necessary or not. The MSC devices always appears
the documentation is kind of terrible
@tannewt Yes. I have seen that by increasing the size of _buf in supervisor/shared/web_workflow/websocket.c the issue can be avoided; at least until the size of _buf is exceeded again. This does not look like a great fix to me, so I am trying to see why the buffer is overflowing in the first place.
didn't specifically check the submodule stuff
CircuitPython version
Adafruit CircuitPython 8.0.3 on 2023-02-23; Raspberry Pi Pico W with rp2040
Code/REPL
import ssl
ssl_context = ssl.create_default_context()
ssl_context.load_verify_locations()
Behavior
This code throws: TypeError: can't convert 'NoneType' object to str implicitly
Description
The docs describe cadata as optional and that None is a valid value: https://docs.circuitpython.org/en/latest/shared-bindings/ssl/index....
I am interested in using CircuitPython running on a Pico W to serve a small website over HTTPS. The main reason for HTTPS is to enable browser APIs like service workers (good for offline support) and push notifications (useful for IoT).
The good news is it's possible to serve content over HTTPS using a self-signed certificate, shown in this minimal reproducible example. It's about 15 lines of code that does real work. The not-so-good new...
IDs are as follows
The table has not been updated, but the numbers are valid.
Vendor ID = 0x2E8A
Product ID = 0x104C

This is the code to add the Lilygo T-Embed s3 board.
I followed the Adafruit guides, ran the pre-commit and I hope I was correct on all rules.
This PR was based on espressif_esp32s3_devkitc_1_n8r8 which was already working on that board.
I adujsted the proper amount of RAM and PSRAM
I added pins definitions for all features of the board
I then added display init to ease the usage of the screen attached to this board.
This was tested on two boards and I also tested with [the examples...
@tulip sleet @onyx hinge why are you changing color conversion stuff in displayio?
we are not; we were looking at gifio
most SPI displays have a bit in MADCTL for swapping RGB/BGR
so my intent was to have a single ordering throughout displayio
gifio converts a frame to RGB565 BE, we were seeing whether LE might be better
yes, pyportal has the "reverse bytes" flag true, so we were saying that. it expects LE, gifio outputs be, so the frames need a ColorConverter that is RGB565_SWAPPED (as opposed to RGB565)
jeff tried raw writes to the display as well, not going through displayio
much faster but expects native byte order that you set up in board.c
so we are not changing gifio's output now, we'll just document it needs RGB565_SWAPPED for now, and maybe add an optional arg to specify order later
@slender iron yes madctl can swap R and G, but this is about the order of the 2 bytes that hold the full 16 bit color value
ah, ok
as far as I could see this is NOT settable it's always big-endian on st7789 and ili9mumble displays used in spi mode. it might be settable for displays in 8-bit mode, not sure, I saw some small indication of it when browsing the st7789 manual
@slender iron how do you load the bangle2 build into the bangle2?
@solar whale using nrf connect to load the dfu
you can also use swd if it comes to it
nrf connect on ios hasn't worked reliably for me. it has been good on android
ok so just use nrf connect and load the .bin file or does it produce some special files?
there should be a zip
ah great. i’ll give it a try later today .
i’ve had mixed success with IOS as well. i have an android phone just for this purpose!
they did just redo the ios app. I meant to test it more
@slender iron EPaperDisplay says the terminal is shown if the root_group is None, but do you show the terminal on epaper? I thought it would be refreshing the display too fast.
I think maybe that is just copy pasta
(I was writing deprecation notes for show()
got it thanks, wasn't sure where to look
i’ll try the bangle 2 when i get home this afternoon . i’ll probably have more questions then…
main does the refresh manually after code is done
thanks @solar whale. I should be around until 3:30 pst at least
(then I'm gone when the baby wakes from his nap)
