#circuitpython-dev
1 messages · Page 55 of 1
I know. So make should work but it doesn't
instead of "doesnt work" you should show what the error is, dont you think?
not paraphrase to cause confusion, but a straight copy-paste
I am getting the same exact error as this message
hmmm, i thought the export.sh script checks that everything is installed, maybe it doesnt
there was something like idf.py install... maybe? did you run that?
no.
I did try to install xtensa-esp32s3-elf-gcc but downloading the archive and copying all the bin files so that may be a issue
(im assuming you have already folllowed this before asking, maybe you havent: https://learn.adafruit.com/building-circuitpython/espressif-build)
make BOARD=<...> clean just in case
if you ran install.sh and gotten esp-idf to run export.sh without complaining mid-way, i have no idea what could be missing, tbh
it works after removing xtensa-esp32s3-elf-* that I manually downloaded
kewl
what type do I use for a arg wanting a python int
type annotation? foo: int
In C I have a function that needs a python int
in CircuitPython C code? do you need to extract the int from an unknown Python obj?
is this in a constructor?
yes. I am trying to add the proto arg to the socket but I don't know what type to use
you would specify the type as MP_ARG_INT. See for example busio_spi_configure() in shared-bindings/busio/SPI.c
Ok thank you
that will automatically do type checking that it is an int, and you can give a default value too. .u_int = 0, etc.
Can I just do a cast to int with that or does it work just like a int
aka how can I use that as a int in C
args[ARG_proto].u_int will return an mp_int_t
look at at that configure code. It shows how to set up the arg list, give names to the args using the enum, and do range checking: mp_arg_validate_int_range()
all kinds of examples in there.
Generally, steal the idiom from an existing call that is like what you want.
if it's a required keyword arg in CPython, ues MP_ARG_KW_ONLY, otherwise omit that
those values use a union so that you can pass the same type (compiler's POV) and have polymorphism(ish) inside it
there are a bunch of bits on that args[ARG_proto] can that be interpreted in different ways, in this case, by using .u_int you say "hey, these bits are an int" (for other args you would "interpret" them as a float or whatever)
in this case, u_ means union (not unsigned)
the ble workflow will use some bleio apis when the vm isn't active
do the args have to be a list or can I just add a arg like
mp_arg_int proto = 0
STATIC mp_obj_t socketpool_socketpool_socket(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_family, ARG_type };
static const mp_arg_t allowed_args[] = {
{ MP_QSTR_family, MP_ARG_INT, {.u_int = SOCKETPOOL_AF_INET} },
{ MP_QSTR_type, MP_ARG_INT, {.u_int = SOCKETPOOL_SOCK_STREAM} },
};
socketpool_socketpool_obj_t *self = MP_OBJ_TO_PTR(pos_args[0]);
you are going to add something to the enum, and to the allowed_args list., and then validate the args[ARG_proto].u_obj value that you fetch.
also update the inline documentation that's above that
where is this code
shared-bindings/socketpool/SocketPool.c
moving here from #help-with-circuitpython message, i wont be looking at this for the following days either, so not a moving thing right now (maybe not in a few days either), just dropping a little idea
it feels like a bunch of the time is spent resolving the circuipython.local name to an actual IP (as the browser shows nothing at all), but i have no way of confirming this, any ideas how to measure such thing?
- if that's the case, i dont think we can do much on that end
- if resolution is fast, but the actual loading of front page is slow, we could maybe send a very simple HTML so that the user sees some movement rather than a dead loading screen... as of now, from a user perspective myself, it just looks like the device is dead or just barely alive 😛
I see that now. Is it your intention for each port's _bleio to have a ble_drv.[c,h]?
(Or similar. The BT workflow implementation makes me think so.)
espressif port is tested but I couldn't test the raspberry pi because I don't have a device to test it
looks like raspberrypi_pico and some other builds failed so I will try to fix that
whenever I try to build circuitpython for the pico w I get a permission denied error
make: cmake: Permission Denied
@pulsar sleet I can test Pico W once artifacts build, do you have starter code you can share?
The call to ble_drv_remove_heap_handlers makes complete sense to me now. Thank you.
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit Feather M4 Express with samd51j19
Board ID:feather_m4_express
with bootloader v3.15.0.uf2
Airlift Featherwing
Code/REPL
Full code for the project I was working on is [here](https://github.com/DJDevon3/My_Circuit_Python_Projects/tree/main/Boards/atmel-samd/Adafruit%20Feather%20M4%20Express/Adafruit%20Airlift%20Featherwing/64x32%20Matrix%20Panel)
Behavior
I did ctrl+s i...
This happens when CircuitPython is unable to mount CIRCUITPY. It assumes it's corrupt or empty and reformats it. This generally happens unwantedly when the power supply sags enough for long enough that the external flash does not respond properly. Or it happens when something has corrupted CIRCUITPY so badly that it cannot be mounted, even read-only.
What host computer and OS are you using?
Are you powering the matrix through USB or separately?
Thanks for both of your assistance here.
Indeed, I have a serial interface into the boards that do not appear as volumes. And can successfully run storage.erase_filesystem(). However, upon trying to "save" via the CP editor, I am met with a Disk Error.
Error saving file to disk. Ensure you have permission to write the file and sufficient disk space.
Also, no luck restarting my Mac machine.
Upon trying on a Windows machine same story. Not showing up as a removal dri...
Windows 10. Powering the 5mm pitch 64x32 matrix panel separately with a Meanwell 5V 18A PSU. Same one that I use to power 6 panels in my 12 panel matrix project. I removed 1 panel and 1 PSU to make this 1 panel project. This project started out with helping someone in the Adafruit Circuit Python Forum... and I ended up running into multiple issues with 2 different Feather M4's. I don't use boot.py or have variables for web workflow. Fairly...
You mentioned a few posts back that CIRCUITPY is not appearing on multiple disparate boards, not just the nRF52840. Is the CIRCUITPY drive could not be found or created only on one board or multiples? There may be multiple issues here.
If you do storage.erase_filesystem() on the Windows machine for each different board, and then wait for the board to reset and come back, does CIRCUITPY reappear on Windows? Have only one board at a time plugged in. After that result, let's talk about ma...
Power sag could be possible. While I was making the wiring schematic I noticed I hadn't plugged in pin D4. So I plugged it in while the matrix panel was still powered instead of turning off the power to the matrix panel first via a rocker safety switch.
This is actually the same process that I believe killed the first Feather M4. I plugged in D4 while the matrix panel was on with the first feather m4 too. Because it killed that feather I unplugged D4 as I thought that pin might be a deb...
It just happened again this morning. I was working as normally in Mu. Did ctrl+s to save the file. It gave a memory allocation error because I added a couple more labels and ran over the RAM limit. Nothing unusual there as a ctrl+s usually works again, frees up some memory, and code.py works again.
Except when this condition happens it presents two back to back dialogs. There is no serial log as it closes REPL completely as the device is detached.

while True:
print(iadc.value)
time.sleep(0.1)
Behavior
Connect any potentiometer. First pin to 3v3, middle pin to the adc pin of the board, and the third pin to GND.
As we spin it around it should change it value.
The maximum should be 65535 and the minimum 0.
Wi...
Thanks for the updates.
This seems more like a hardware error. Maybe we could add some sort of calibration function
I'm not quite sure of the sequence of events after the ctrl-S. So did it save and restart? When it restarts, do the matrix panels start illuminating completely? Did you see any flash of illumination before it failed?
Could you recheck the wiring to the panels? Are you using a Matrix FeatherWing? Which one, 3036 or 4702? There are two versions. Are you connected through the barrel jack to the Meanwell power supply?
Is the pullup mentioned here, https://learn.adafruit.com/rgb-matrix-feath...
The ADC on the ESP32-S2 is not great. There is an offset at zero, and it is not rail-to-rail. They started adding some factory-set calibration data at some point.
@lone axle#2825 does this ring a bell? https://forums.adafruit.com/viewtopic.php?t=206964 I thought this was working. Not sure if it's just this bundle or not. debouncer requires ticks. Guide in question is https://learn.adafruit.com/mini-pinball-table-with-gemma-m0/code-the-gemma-m0-with-circuitpython
not urgent
That is odd. I don't recall running across it before.
I'm not sure how the learn project bundler works, but it appears like it has trouble with adafruit_ticks.
i was wondering if it was an issue with the debouncer library
i don't know whether the bundler looks at requirements.txt
The only two things I can think of as possible causes would be: 1) debouncer not having ticks in it's requirements.txt, but it does and it seems to be correct https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/blob/main/requirements.txt or 2) ticks not being in the bundle (if the learn project bundler relies on the built library bundles which I assume it does, but could be wrong.) But that isn't the case either, I double checked the bundle and ticks is definitely in there.
yes, I would look for some similarly transitive dependency and see if the bundle for that works. have you seen adafruit_ticks missing before?
I don't recall seeing it missing before
tbh I don't recall ever seeing a bundle that was downloaded from learn be incomplete or missing anything.
maybe it is just this bundle. I will look for other examles in the learn guide and see how their bundles are
This one also relies on debouncer and therefore ticks, but is missing ticks in it's download: https://learn.adafruit.com/ambient-machine/code-the-ambient-machine And in this case the project uses the automated screenshot generator which I noticed also failed to include adafruit_ticks
I worked on the screenshot generator so I am more familiar with it's operation. I can try looking into it later on in the screenshot generator context and if I discover the root cause it may be the same as for the project bundler.
pip thinks the dependency is OK:
$ pip3 install adafruit-circuitpython-debouncer
Defaulting to user installation because normal site-packages is not writeable
Collecting adafruit-circuitpython-debouncer
Using cached adafruit_circuitpython_debouncer-2.0.8-py3-none-any.whl (5.7 kB)
Collecting adafruit-circuitpython-ticks
Using cached adafruit_circuitpython_ticks-1.0.13-py3-none-any.whl (5.4 kB)
[...]
it doesn't look inside adafruit_debouncer.py, does it?
The import there is a from..import: from adafruit_ticks import ticks_ms, ticks_diff
debouncer has an optional_requirements.txt, which I have not seen before.
Maybe https://github.com/mgedmin/findimports can only traverse 1 level?
(re my previous post) never mind, they all have optional requirements.
or at least does in our case only do one level. It wouldn't have access to the library .py file easily that I know of so it couldn't really recurse to check for imports that came from libraries.
The screenshot generator does. And I think maybe I heard that the project bundler does back when I was working on the screenshot one, but I am not certain.
says it is olde than setuptools, so maybe it doesn't even look at requirements.txt.
I would have thought the bundler and the screenshot tool would both rely on pyproject or setuptools and would be using requirements.txt at least indirectly
but I guess I am wrong
I'm trying to think of other instances of 2 levels like Project depends on Library1 and Library1 depdends on Library2 like this. I'm sure there are other cases but I am drawing a blank at the moment.
Learn guide project code doesn't always have a pyproject.toml or requirements.txt though I don't think.
sure that makes sense. well, I will try to run findimports by hand and see what happens. Its README suggests using pydeps
i guess I would think findimports on the learn guide code and then requirements.txt subsequently
ok, well...
halbert@cod:~/repos/adafruit/Adafruit_Learning_System_Guides/GemmaM0_Pinball$ findimports
./code.py: could not find adafruit_hid.keyboard.Keyboard
./code.py: could not find adafruit_hid.keycode.Keycode
code:
adafruit_debouncer
adafruit_hid.keyboard.Keyboard
adafruit_hid.keycode.Keycode
board
digitalio
usb_hid
no mention of debouncer adafruit_ticks
the first one?
sorry, no mention of adafruit_ticks
I did come up with a 2 level dependency chain Adafruit_IO depends on Adafruit_MiniMQTT. But the constructor for adafruit_io actually needs to have an instantiated mqtt object to pass in to it, so the project code ends up importing adafruit_mqtt in adition to adafruit_io therefore it doesn't end up suffering from the same problem.
Here is the section of code responsible for building the list in the screenshot generator: https://github.com/circuitpython/CircuitPython_Library_Screenshot_Maker/blob/main/get_imports.py#L152-L167 it doesn't seem to account for multiple levels. It's only finding imports from the project code files, but not recursing into the library code as far as I can tell.
hmm so do pyportal bundles omit portalbase??
It's not an ideal solution, but based on the way that adafruit_io and adafruit_mqtt interact and end up working with the screenshotter and bundler it would seem a temporary workaround could be to add import adafruit_ticks to the project code.
for example
Ah good thought those should make a dependency chain with multiple levels I'll check one of those
This is a pyportal project and the bundle and screenshots do not end up including adafruit_portalbase https://learn.adafruit.com/pyportal-air-quality-display/code-pyportal-with-circuitpython
In that case it works when users try it in most cases because they device they'd be running on has portalbase frozen in I think so they don't end up missing an import even though it wasn't included.
so the way the whole thing works now is ... poorly
Unless I'm misunderstanding it, it definitely does seem prone to missing any dependencies past the first level. And we've kind of just have been mostly lucky that in the cases it misses the libraries it missed were included due to being frozen in.
circup does a fine job:
$ circup install adafruit_debouncer
Found device at /media/halbert/CIRCUITPY, running CircuitPython 8.2.9.
Searching for dependencies for: ['adafruit_debouncer']
Ready to install: ['adafruit_debouncer', 'adafruit_ticks']
Installed 'adafruit_debouncer'.
Installed 'adafruit_ticks'.
it's doing the right thing
circup does reference either requirements.txt or pyproject.toml I belive.
I think it'll need to have a second "stage" added to the operation to work through the libraries it finds on the first pass and find thier dependencies based on one of those files as well.
Perhaps the code from circup can be re-used in the screenshot generator for that. I don't know how the backend of the bundler works or if it is python though.
it looks in requirements.txt
the bundle itself has a requirements directory with adafruit_debouncer/requirements.txt, etc.
One thing to consider is if we do want to take into consideration the list of frozen libraries as well. i.e. should the screenshot and bundle actually end up including portalbase since most of the time they'll be frozen in?
although consistency between circup and the other tools would be ideal. So whichever we land on, all should behave the same.
the bundler is not specific to a board, so what's frozen can vary. circup does not check for frozen, it always installs all the requirements
Not able to fully see what your issue is, but feels related to something I wrote. I have a script that reads through my lib folder, and then fetches all the related requirements.txt to see if there's anything missing. For example if I have adafruit_adafruitio it fetches https://raw.githubusercontent.com/adafruit/Adafruit_CircuitPython_AdafruitIO/main/requirements.txt (I do have a lookup for some)
All modern espressif mcus are already callibrated at factory and their settings are stored in efuse.
I did check the code, CP does load the calibs properly.
The ADC on the ESP32-S2 is not great.
But then s3?
In ESP-IDF, for the ESP-S2, ADC_CALI_SCHEME_LINE_FITTING_SUPPORTED is defined. For ESP32-S3, ADC_CALI_SCHEME_CURVE_FITTING_SUPPORTED is defined. So the S3 has a more sophisticated calibration scheme.
@dhalbert very grateful for your willingness to help!
You mentioned a few posts back that CIRCUITPY is not appearing on multiple disparate boards, not just the nRF52840
I actually have multiple custom PCBs that all use the same nRF52480 mcu. This project was prototyped with the ItsyBitsy so figured might as well run with the nRF52840 :)
If you do storage.erase_filesystem() on the Windows machine for each different board, and then wait for the board to reset and come back, does ...
Could you provide some code or test the pull request for me. I tried but networking is not for me
In the original post:
I've tested Pico W, QT Py ESP32-S2, Feather M4, and RP2040. In each case, the first one or two will mount, then subsequent similar devices won't mount at all or won't mount properly: They don't show up in Finder. They may not show up in ls -l /Volumes, and if they do, they may not show up properly.
Is that still the case with the non-nRF boards after you updated and did storage.erase_filesystem()? (Windows and/or macOS).
The older API docs show a curve (ESP32-S2) that is reasonably linear (when calibrated), except that it doesn't go to zero, and it doesn't go to 3.3V (iirc 2.6V when using 11dB attenuation):
https://docs.espressif.com/projects/esp-idf/en/release-v4.4/esp32s2/api-reference/peripherals/adc.html
The APIs have changed, and the chart no loner appears that I can find, but I suspect the underlying hardware limitation hasn't changed.
Hmm, alright then.
Now before I close the issue, maybe we should document that somewhere and maybe update the reference voltage in analogio to be the suitable one for each chip, instead of 3v3.
Is that alright? Can I go and do it?
Is that alright? Can I go and do it?
That would be great. There is one comment already in the doc:
Note the ADC value may not scale to the actual voltage linearly at ends of the analog range.
I am not sure about the reference voltage, because the attenuation I think may have chosen to allow 3.3V as the reference voltage.
The physical setup of my Feather M4 Matrix Panel project is also described at the bottom of the page with illustrations and pictures.
There is no Matrix Featherwing because it conflicted with physical pinouts of the airlift... so I took it out of the equation. Perhaps that is an issue if one of those breadboard wi...
Do you have a .uf2 file for the test build? If so, I could test it out for you.Sent from my iPhoneOn Dec 24, 2023, at 4:09 PM, Carson @.***> wrote:
Could you provide some code or test the pull request for me. I tried but networking is not for me
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
A Raspberry Pi Pico (RP2040). Sent from my iPhoneOn Dec 24, 2023, at 7:03 PM, Carson @.***> wrote:
What device do you have
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
This commit adds some files that should probably not have been added (os, os.path, etc) with many thousands of lines of content. Please rebase this branch so that these files are not added to our history. If that's beyond your git skills, I can help you figure out how.
The rest looks plausible, based on my small understanding of networking.
This change should probably also add some "proto" named constants to the socketpool object, such as IPPROTO_IP and IPPROTO_ICMP. It might also make sense to state that this value is only used for SOCK_RAW.
Ok. I can work on this tomorrow.
By design, the ADC reference voltage for ESP32-S3 is 1100 mV
but it can vary, and most chips have the actual value in eFuse. Input voltages from the ranges at the link in my prior comment are attenuated so they can be measured against the reference.
I took a good read through the s2 technical manual and the attenuation stuff.
(Actually managed to 100% understand the analogio code!)
Also, C6 is perfectly 0-3.3V. I did it both outside (esp-idf) and inside CP, and it works on both.
return voltage * ((1 << 16) - 1) / 3300;
}
float common_hal_analogio_analogin_get_reference_voltage(analogio_analogin_obj_t *self) {
return 3.3f;
}
I still do not quite understand why I shouldn't go and just and #define the ...
At the user level, isn't vref 3.3v for all variants, despite different top-end limits (like 2.6v)? CircuitPython code would use the vref for what, other than reconstituting a 16-bit value into a voltage?
I think the point of the vref is to say what the 65535 value corresponds to, yes.
Then vref for all esp (except C6) is wrong (as it cannot reach 65535) and should be fixed.
Imma go gather all the values and hardcode em.
Then vref for all esp (except C6) is wrong (as it cannot reach 65535) and should be fixed. Imma go gather all the values and hardcode em.
I think the documentation is not so great, but I think that IF you could measure 3.3V it would be 65535. In other words, the reference voltage is the scale factor: volts = (reading / 65535) * reference_voltage.
Well, IF we could, it would show 65535, like how it does on C6.
But for the rest it's impossible.
We can either do "max is always 65535" or do "65535 is 3v3".
Docs say the first, implementation does the second.
It might be tough to state an exact maximum achievable voltage for a particular variant, since it depends on the per-chip internal vref (110mV±100mV). And the docs seem to have stripped out the linear voltage range details at some point.
(Also we may want to allow attenuation as a param at some point to give more precision (same bit width over a smaller voltage range), though there may be not much accuracy benefit to this.)
Does circuitpython support warning. I am working on adding the proto argument to sockets and I want to show a warning if proto is set put the socket is not a SOCK_RAW sock
there is a subset of it, warnings.warn should work (not all the same options that you get on computer)
or, if you need to call it from C, it would look something like:
warnings_warn(&mp_type_FutureWarning, translate("%q moved from %q to %q"), MP_QSTR_Display, MP_QSTR_displayio, MP_QSTR_busdisplay);
(extracted from https://github.com/adafruit/circuitpython/pull/8524)
translated to human that is:
warnings_warn(type_of_warning, message)
messageis a format string with variadic args.... which in this case is equivalent of"%s moved from %s to %s" % ("Display", "displayio", "busdisplay")
what is a future warning
you'd likely want (if implemented) something a UserWarning i guess
How can I build with CIRCUITPY_WARNINGS enabled or is it enabled by default with just a make BOARD=
Check the PR i linked
Since it added the thing, it also has to have added the flag that controls enabling it (at the Makefiles)
(which likely defaults to true)
what is the behavior in CPython? We would want to emulate that
warnings is on by default on all boards, I think, except maybe the absolute smallest
To activate BT workflow on the nrf52 boards the reset button is pressed while the neopixel rapidly blinks blue. The RP Pico W has only a green LED. Any thoughts on an activation sequence for these boards?
The RP Pico W also lacks a reset button.
a getenv() special variable? if it works for enabling web workflow then could be used to enable bt workflow?
but how are you going to edit settings.toml without usb connection?
how do they do it currently with web workflow? I have no idea, never used one in that way.
They still have serial, dont they?
not on an ipad
the whole idea with the bluetooth workflow is that you can use it on a phone or a tablet
From a CP development perspective it may be useful to have both a button press at reset and a settings.toml variable that can activate BT workflow.
If you want a button press with a Pico W you'd have to use a Pico W Bell, then maybe.
maybe there could just be a separate firmware with the bluetooth workflow enabled
I just realized that you need usb anyways, to flash the firmware
That's probably the case. I'm looking into the bootsel button to see if there's maybe a way to use it.
iirc that one shorts the flash CS pin to gnd
It does, using it at runtime is possible but quite hacky (and probably flaky), wouldnt do it
At boot, if it is shorted to GND, RP2040 goes to bootloader, otherwise gets configured as the CS for flash
Yes, that's what the schematic shows. Not useful for this purpose.
I have it connected to an additional pin with some resistors, so I can sense it without messing with the cs pin on my board, but not sure how pico has it
Pico has it through a 1K to ground.
The reason given in the docs for the nrf52 behavior (BT workflow off by default) is security. I wonder if security really is an issue?
you don't want random people under your window to connect to your device
I'm not able to get a connection further than about 6" away.
How about this: BT is off by default (current behavior), but can be activated by a setting in settings.toml?
I can see all of my neighbour's bt devices perfectly fine
When advertising, BT workflow turns the radio power down.
imagine a classroom
OK, I'm starting to understand why it is like it is. Back to my question: BT workflow off by default but activated in settings.toml?
The BLE workflow was conceived of before either MSC or serial worked at all with tablets, either Android or iOS. We can reconsider how it works now. It was designed to be simple to use, and originally boards like CPB were the target. Whether this still makes sense or not I don't know. I don't think we have much if any data about how it's being used now.
I would say just pick something for now, and we can change it later if we want.
It might be tough to state an exact maximum achievable voltage for a particular variant
Well, CP uses the calibs. We do not have to bother with the chip variance (theoretically).
The technical reference manuals for esp32, esp32s2 and s3 state that:
But vref is not defined anywhere in this document.
Assuming it's 3v3, it would mean it's 3300÷4095×3300=~2660.
But that clear...
I read through some documentation, both hardware and software. The clearest explanations are in the ESP-IDF V4.x manuals, such as https://docs.espressif.com/projects/esp-idf/en/v4.3/esp32s2/api-reference/peripherals/adc.html. There, the actual maximum voltage and the attenuations are explained. The ESP-IDF v5 documentation is less clear: https://docs.espressif.com/projects/esp-idf/en/v5.1.2/esp32s2/api-reference/peripherals/adc_oneshot.html?highlight=adc#introduction.
When we originally de...
I do think there is a bit more value than convenience to this api, as it could be used to fetch many more readings, as the conversion logic would be in C. It would also be more beginner friendly.
Considering this should add almost no strings, it shouldn't take too much space.
However I do not think .reference_voltage should remain useless.
If we were to put the effort to revamp the api, shouldn't we at least make it settable and leave the default to be 3v3 as is?
But considering t...
One reason for the current API is that not all boards have floats enabled.
One reason for the current API is that not all boards have floats enabled.
All CircuitPython boards have floats (e.g. for time.sleep()), but not all have longints. I think there may be some MicroPython boards without floats.
If we were to put the effort to revamp the api, shouldn't we at least make it settable and leave the default to be 3v3 as is?
That is an idea. I thought you wanted to set them differently at compile time, which would change the current ranges.
Hmm, I remember the floats problem coming up during the discussion of the ADC and the PWM API, so maybe it wasn't the case back then? Or maybe my memory is just failing me.
Also just making a setter for the ref voltage could be a tiny tiny change that would not affect any existing apps.
It would take (almost) no flash space.
Should I add it in my docs pr?
Also just making a setter for the ref voltage could be a tiny tiny change that would not affect any existing apps.
But you want it to affect the returned .value, right? It's not just informational.
Hmm, I remember the floats problem coming up during the discussion of the ADC and the PWM API, so maybe it wasn't the case back then? Or maybe my memory is just failing me.
The original analogio discussion was maybe before my time, but I think pretty early float was turned on for "everything" (SAMD21). But #85 is maybe what you're thinking about?
Also just making a setter for the ref voltage could be a tiny tiny change that would not affect any existing apps.
But you want it to affect the returned
.value, right? It's not just informational.
Default would always be 3v3, as it currently is.
If changed, the math at the value return statement would change yea.
If unchaged, the math will be identical to how it is now.
The circtuitpython-stubs package is great, and along with the improved typing in the bundles you can get pretty good hinting in tools like VSCode.
The one missing piece is the pins for specific boards. The circuitpython-stubs package for board only has hints for the I2C, SPI, and UART functions and the board_id. So you don't get autocomplete and possibly warnings for the board specific features.
@joedevivo who maintains a VSCode extension for Circuit Python does some good s...
I don't think so. I probably just got lazy. Ideally it'd be functions defined in shared-bindings that all ports can implement.
That would be ok. We didn't have settings.toml when I added it. Pico W could use the reset button if it had one. The green led can blink quickly like a neopixel would.
Hi
Can confirm that behaviour
And DTR enabling helps
I don't think it's really important which board to use, but I'm using rp2040 now
Thank you! I'll stick with what I have now (it follows the nrf port's ble_drv pattern) and revisit it later to move the rp2 and nrf ports to shared-bindings for bonding flash and BLE events.
I am going to close this since we believe that enabling DTR is the key. If the original poster is still having trouble, please reopen.
@lone axle do you want me to merge and release those PRs related to unpinning sphinx and adding sphinx-rtd-theme for RTD? I resurfaced now that the semester is over and am catching up on things.
hi @proven garnet ! good to see you
my MEMENTO pycamera arrived
the installed firmware displays images from the camera on the tft display
double clicking reset brings up a
PyCamera
0.16.0-27-g3d79e6c
firmware.uf2 -> CAMERABOOT
circuitpython.org
screen, but the computer (windows 11) doesn't show a CAMERABOOT drive - so that seems out to be able to download new circuitpython firmware
I also tried to follow the instructions on
https://learn.adafruit.com/adafruit-memento-camera-board/install-circuitpython
and made further progress after switching from an external hub to not using the hub and directly connect to a port on the computer
( thanks for the note about avoiding the hub from the boot loader, I'll do some more research and get back here )
Hello! It's good to be back! Luckily I didn't see my shadow, so I'm out of my groundhog hole earlier than expected 
That would be great if you get a moment. I think there are only a few remaining open ones iirc. Nice to see you!
You too! I think I got the last remaining handful!
well, I now have
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Adafruit Camera with ESP32S3
Board ID:adafruit_esp32s3_camera
installed, and am going through the https://learn.adafruit.com/adafruit-memento-camera-board
there seem to be a lot of references to board.LED, (probably generic instructions )
There is a warning that says
The KB2040, QT Py and the Trinkeys do not have a built-in little red LED! There is an addressable RGB NeoPixel LED. The above example will NOT work on the KB2040, QT Py or the Trinkeys!
should this also mention the MEMENTO ?
at least there is a link to the NeoPixel blink example!
If you're using a KB2040, QT Py or a Trinkey, please download the NeoPixel blink example. https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Welcome_to_CircuitPython/code.py
Pretty good chance this is user error if I missed a required resistor. Updated the wiring graphic to make it easier to replicate a test. I wanted the wiring in the project to be very clearly defined what I did in case it's another self-inflicted wound. Using breadboard headers on stacking header pins also doesn't provide the best connection.
I find the widely used
while not i2c.try_lock(): pass
construct problematic (or even catastrophic in boot.py) because it will just get the code into an endless loop if try_lock() is unsuccessful.
It would be nice to have an optional timeout argument so that an exception will be raised if the lock cannot be acquired within a certain timeframe. Currently, I would even opt for the timeout to have a default value of maybe 1 or 2 seconds.
Yes, you can easily do that. What is the issue?
import time
timeout = time.monotonic() + 3.0
while not i2c.try_lock():
if time.monotonic() > timeout:
raise RuntimeException("i2c lock timeout")
in the current code for raspberrypi boards in common_hal/digitalio/DigitalInOut.c the code appears to set output pins to 12mA using PADS_BANK0_GPIO0_DRIVE_VALUE_12MA.
In the Issues, there appeared to be some debate.
Is this intended to persist or might it change?
In my board_init() I need to set one pip as OUTPUT HIGH and it needs to be capable of the 12mA max (although I don't anticipate it will ever be required to deliver that much)..
I think we set max driving strength on all boards by default
there are some bugs where we don't, that should be fixed
thanks
Thanks @tulip sleet. Those were the “issue” discussions I was referring to in my original question.
It appears the core will continue to set the output to the max allowed on the raspberrypi boards.
we are talking about how to make setting drive strength more flexible. It may involve some fundamental rethinking of DigitalInOut and Pin.
in general we would like max drive strength to be the default, because it is the most useful for the novice user
Well, I’m taking advantage of the pin being max drive strength now 😉
Asking if anyone is willing to put eyes on the ConnectionManager pull request here: https://github.com/justmobilize/Adafruit_CircuitPython_ConnectionManager/pull/1. Trying to see if this is a direction folks want to go.
@carson-coder Any chance to link me the .uf2 that you’d like tested?
I'm sure people will look at it. It's a quiet week and you might bring it up again next week, say in the Tuesday (not Monday due to New Year's Day) meeting.
Sounds good. I did add a comment to the meeting notes and plan to attend
What extra steps do I need to do when setting a GPIO pin in my board_init() such that the pin is still available to the end user to change in the code.py?
I copied the code from the Adafruit RP2040 USB Host board.c:
digitalio_digitalinout_obj_t _host_power;
void board_init(void) {
common_hal_digitalio_digitalinout_construct(&_host_power, &pin_GPIO18);
common_hal_digitalio_digitalinout_never_reset(&_host_power);
common_hal_digitalio_digitalinout_switch_to_output(&_host_power, true, DRIVE_MODE_PUSH_PULL);
...
}
Is my problem the never_reset() call or something else?
so you want board.HOST_POWER or something like that?
I want to have a pin which I set as output HIGH to start. the user may need to change it to LOW (and or HIGH) from their circuitpython code.
in my usecase its an "enable" pin
set the pin to high without using common_hal_digitalio routines. Just use the pico-sdk GPIO routines
CircuitPython version
MicroPython 9.0.0-alpha.6-8-g9ac250aa3b on 2023-12-27; linux [GCC 11.4.0] version
(this is my custom build of the UNIX port of CircuitPython, the executable is also named `micropython`, it looks like you haven't renamed this port)
Code/REPL
>>> class D(dict):
... def __setitem__(self, k, v):
... super().__setitem__(k, v)
...
...
>>> d = D()
>>> d['foo'] = 'bar'
Behavior
Traceback (most recent ...
thanks @danh. I will see if I can find an example as to what I need to include and what calls I will make.
Take a look at some other boards that setup various pins in advance -- there are a numbe of such cases
OK. all of the examples I found were using the common_hal_digitalio_*() calls. I will dig deaper.
did they make the pin available?
or was it hidden?
calling the common_hal routines claims the pin
no. all of the examples I have found within the CP code is very simialr to the adafruit RP2040 USB board.
I'll dig
If you're using 9.0.0 alpha 6 you can manipulate pin drive strength by accessing RP2040 registers directly. Here is an example that does just that: https://docs.circuitpython.org/en/latest/shared-bindings/memorymap/index.html
Could you test this for a few previous versions of MicroPython? We have only merged from MicroPython v1.21.0, and perhaps this does not work in older versions of MicroPython.
Could you help me with git rebase @jepler
thanks @mortal kernel - I want to set the pin from the firmware before the user sees it so it has a smart default state
Do you have `adafruit/circuitpython as a remote, e.g.:
$ git remote -v
adafruit https://github.com/adafruit/circuitpython.git (fetch)
adafruit https://github.com/adafruit/circuitpython.git (push)
origin https://github.com/dhalbert/circuitpython.git (fetch)
origin https://github.com/dhalbert/circuitpython.git (push)
It might be called upstream instead. If not add it as a remote.
So, to rebase:
$ git fetch adafruit
$ git rebase adafruit/main
ports/raspberrypi/boards/lilygo_t_display_rp2040/board.c is an example of initializing a backlight pin in advance using the pico-sdk GPIO HAL
About to do some broadcom testing on Pi zero W and Pi zero 2W. Have heard reports that the CIRCUITPY drive isn't mounting for > 8.0.5. I'll be trying latest 9x builds first.
@carson-coder Thank you. Will attempt to test in 1 to 2 hours and let you know. Sent from my iPhoneOn Dec 27, 2023, at 11:41 AM, Carson @.***> wrote:
https://github.com/adafruit/circuitpython/actions/runs/7315146763/artifacts/1133347374 Here @300bps
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>
$ git fetch adafruit $ git rebase adafruit/main
Could I do adafruit/8.2.x because I am adding this on the 8.2.x branch
thanks @tulip sleet. I was close. needed the code from DigitalInOut.c to set the output strength and needed to not do the never_reset()
const uint8_t pin = gp_pin->number; // the VCC enable pin
gpio_init(pin);
gpio_set_dir(pin, GPIO_OUT);
hw_write_masked(&padsbank0_hw->io[pin],
PADS_BANK0_GPIO0_DRIVE_VALUE_12MA << PADS_BANK0_GPIO0_DRIVE_LSB,
PADS_BANK0_GPIO0_DRIVE_BITS);
// Turn on "strong" pin driving (more current available).
gpio_put(pin, 1);
// common_hal_never_reset_pin(gp_pin);
ould I do adafruit/8.2.x because I am adding this on the 8.2.x branch
fer sure, and I guess you did
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; Raspberry Pi Zero W with bcm2835
Code/REPL
None
Behavior
Prints the version, Board ID, and UID on the HDMI screen, then stops.
The status line is visible:
:snake: Done | 8.2.9
Description
On the Raspberry Pi Zero W it doesn't seem to boot fully. The CIRCUITPY drive is not mounted. Windows complains of an unknown USB device.
Additional information
Last known goo...
Does #8044 seem like your problem? We thought we fixed it in 8.1.0.
For background, the reason I'm doing this is that I'm trying to get my Microdot web framework to run under CircuitPython. My test suite runs on the UNIX port, and while I have been testing MicroPython releases for a long time this problem is currently preventing me from running my tests on CircuitPython.
Just in case and to be 100% sure, I tested this on a few older releases of MicroPython.
MicroPython v1.19.1 on 2023-12-27; linux...
Looks like pre-commit wants a few more changes. Other than that, this looks good to me (but i didn't test)
What kind of network testing do you want to do with this? Can you write a ping?
Does it work on a non-Unix (microcontroller) version of CircuitPython? How about on a microcontroller version of MicroPython?
Tried on 8.2.9 on a ESP32-S3 TFT:
<img width="497" alt="image" src="https://github.com/adafruit/circuitpython/assets/1547881/0d0c62a0-1bf1-43e6-8474-181b79868591">
Also playing with it,
class x:
def y(self):
print(1)
class xx(x):
def y(self):
super().y()
>>> xx().y()
1
Works as expected.
Doing this:
class D(dict):
pass
d = D()
d['foo'] = 'bar'
>>> d
{}
Shows it's specific to dict (or maybe other things)
To answer the remaining question, this works just fine on regular MicroPython builds for devices. I have personally tested it on various ESP8266, Pico and Pico W builds over the last 3 years or so.
having it integrated would be a lot more effective/elegant both for the coder and the reader, i.e. more pythonic. And the proposed default timeout would work retrogradely.
@tulip sleet - thanks again for the pointers and replies on my GPIO questions. The results are working exactly as I had hoped.
This resolved the prior discussion of “REPL output to an integrated ePaper display”.
The new code means the default behavior will be “just like every other board” and the user has the option to enable/disable the ePaper display as often as they like with the default behavior being the display is active.
Not sure what exactly you mean by efficient? Elegance is in the eye of the beholder.
What are you going to do when it times out anyways? The rest of the program assumes that you have acquired the lock.
How is the UID that gets put into boot_out.txt generated? I've never paid close attention, does it stay the same across formatting the storage? Is there anything a typical user might run into that would cause it to change on their device?
@carson-coder: Kudos! My first tests of the changes that you implemented appear to work! Note that this is the "happy path" -- I haven't proceeded to more exhaustive testing including potential edge cases, but I was pleasantly surprised that the first test works (that almost never happens ;)! I'll do some more testing and update you with more results.
Can you link me to your fork that includes the source for these changes? I can examine that as well.
it havent looked at it either, but would expect it to be some kind some serial numbering on the actual hardware (at least on the ports that do have something like that), so a read-only value
Should this also be added to the ESPI32SPI Library to keep them similar?
@justmobilize I took a quick look at the ESPI32SPI file you mentioned and it looks like that one already accepts and attempts to use the 'proto' parameter to the 'socket' call -- at least at that level. I didn't dig deeper to see what happens further down the stack of turtles, though ;)
im lazy enough to not create the equivalent link to github ```c
// Write version info
mp_printf(&mp_plat_print, "%s\nBoard ID:%s\n", MICROPY_FULL_VERSION_INFO, CIRCUITPY_BOARD_ID);
#if CIRCUITPY_MICROCONTROLLER && COMMON_HAL_MCU_PROCESSOR_UID_LENGTH > 0
uint8_t raw_id[COMMON_HAL_MCU_PROCESSOR_UID_LENGTH];
common_hal_mcu_processor_get_uid(raw_id);
mp_cprintf(&mp_plat_print, MP_ERROR_TEXT("UID:"));
for (size_t i = 0; i < COMMON_HAL_MCU_PROCESSOR_UID_LENGTH; i++) {
mp_cprintf(&mp_plat_print, MP_ERROR_TEXT("%02X"), raw_id[i]);
}
mp_printf(&mp_plat_print, "\n");
port_boot_info();
#endif
@300bps it's passed into the init, but not used. Probably added to make signatures match CPython.
eg, for RP2040 it pretty much just calls (imma guess Pico-SDK function that does the internal stuff to read it) function: ```c
void common_hal_mcu_processor_get_uid(uint8_t raw_id[]) {
pico_unique_board_id_t retrieved_id;
pico_get_unique_board_id(&retrieved_id);
memcpy(raw_id, retrieved_id.id, COMMON_HAL_MCU_PROCESSOR_UID_LENGTH);
}
so it looks like this populates it common_hal_mcu_processor_get_uid(raw_id);
okay, cool. Thank you. I did just test storage.erase_filesystem() and it does not result in the UID changing. I'm going to validate a few other scenarios but it looks like it can serve the purpose I have in mind.
from a quick look, it has to be defined (ie there's no defined(COMMON_HAL_MCU_PROCESSOR_UID_LENGTH)) and no port defines it to 0 (or negative) so every port does (currently) implement it
welp, STM port apparently only covers F4, so probably you get a no-op for other families
The rest of the program won't run if an unhandled exception is raised. But it gives the developer a clear indication of what the problem was (or the program a way to handle it). One instance where this is particularly helpful is in boot.py. If try_lock goes into an endless loop, the cp module will simply not boot and remain completely inaccessible (i.e. with no USB drive mounted and no REPL connected). The only way to get out of that is to manually boot into safe mode by pressing the reset ...
You don't need my_busio, just use busdevice, it handles the locking correctly for you.
I agree that the while loop used in the examples may not be the best way to use the try_lock function and for new users may lead to issues.
Much of the core is still over my head so it's dangerous for me to make conclusions after looking at the C code, but when I look at the common_hal_busio_i2c_try_lock function (rp2040), it doesn't look to me like there is any advantage to calling the try_lock function a second time if the first call returns a False. Is it possible the while loop was us...
Much of the core is still over my head so it's dangerous for me to make conclusions after looking at the C code, but when I look at the common_hal_busio_i2c_try_lock function (rp2040), it doesn't look to me like there is any advantage to calling the try_lock function a second time if the first call returns a False. Is it possible the while loop was used in the examples because in the limited context of the example there was no difference between infinite looping and simply exiting the code?...
You don't need
my_busio, just usebusdevice, it handles the locking correctly for you.
I dare to disagree. try_lock is a method of the bus object, which you have to specify to instantiate a bus device. The bus device will use the try_lock method of the bus object - and end up in an indefinite loop if it fails to acquire the lock
Maybe you should explain to us a little bit more about how you ended up with a permanently locked bus?
Deleted code.py and it boots, the CIRCUITPY drive is available. If I connect on the serial terminal I can get the '>>>' prompt, but if type anything more it crashes when I press ENTER.
CircuitPython version
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; M5Stack M5Paper with ESP32
Code/REPL
import board
board.DISPLAY.refresh()
Behavior
Serial console setup
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
Please file an issue with your program at github.com/adafruit/circ...
There are situations that require manual locking. The scan() method of an I2C object, for instance. I accidentally deleted the unlock() line and then used then tried to access the I2C encoder breakout.
While I do like the idea of a timeout on try_lock() and I already do this in most of my code, the cause-and-effect is one of legacy examples.
As @bludin notes, there are so many examples that show the while not i2c.try_lock(): pass code snippet that users see it as a best practice. If the try_lock() throws an exception and the examples showed a try: except code block, then much of the angst and head scratching would go away.
I recognize this is a case of _"water under the brid...
try_lock() is exactly that: it returns a boolean, and throws no exception if there is a failure. Adding a timeout that might throw an exception changes its semantics. A separate lock() operation that has a default timeout and does throw an exception if the locking fails might be better.
yes. I think the missing piece is for all of us to make better examples since they are used as "best practice".
Following on @RetiredWizard's examples, the simplest might be:
if not i2c.try_lock():
raise RuntimeError()
With 9.0.0 Alpha 6 on the Zero W, plugged into the inside USB connector many "read sector" errors are reported, presumably while attempting to mount the CIRCUITPY drive.
...
read sectors result 8 when reading block 7772138 for 1
read sectors result 8 when reading block 7772140 for 1
read sectors result 8 when reading block 7772142 for 1
read sectors result 8 when reading block 524288 for 1
read sectors result 8 when reading block 524289 for 1
read sectors result 8 when reading bl...
I was using the bottom of the RGB Matrix Featherwing pinout in the learn guide as a reference, except then it becomes backwards and upside down.
Seems as though I got the rows flip-flopped. That shouldn't work at all but does actually work. After looking at the physical pinout on the matrix panel can see that there's something obviously incorrect with my wiring...
@bludin how many users do you think are going to put an i2c scan in their boot.py and make the exact same mistake as you, and do you think preventing this is worth removing some built-in library from the smallest boards to make room for the extra code this will require? Do you already have an opinion about which built-in module would be best to remove?
@dhalbert that code will fail randomly when you have a display on that i2c bus.
Opened a pull request for a header bug in Adafruit_CircuitPython_Requests: https://github.com/adafruit/Adafruit_CircuitPython_Requests/pull/149
It wiped itself again. I dismantled the entire project and put my Matrix Portal S3 on there instead which of course works splendidly because it was built exactly for that purpose.
I think attempting to manually wire up a Feather M4 Express & Airlift to a matrix panel is just a bad idea. It was an experiment. It doesn't work very well even when it does work. A lot of artifacts and glitching because it's using breadboard wires. It's a better idea and more fruitful use of time to use a Mat...
@DJDevon3 have you tried using a Adafruit RGB Matrix Featherwing? I use these without any issues...
OK, I think we will close this because the actual cause is very unclear, could be power glitches.
@justmobilize To my knowledge, you can't use an RGB Matrix Featherwing with both a Feather M4 Express and an Airlift featherwing. That's why I had to manually wire it in the first place. The RGB Matrix Featherwing requires some of the same pins used by the Airlift. I could cut traces but I really don't feel like doing that if I'll need it again in the future. Hence wiring around it manually which turned out to be a bad idea.
@bludin how many users do you think are going to put an i2c scan in their boot.py and make the exact same mistake as you, and do you think preventing this is worth removing some built-in library from the smallest boards to make room for the extra code this will require? Do you already have an opinion about which built-in module would be best to remove?
@deshipu if that's indeed the only conceivable scenario where the real benefit (as opposed to the esthetic one) is significant, we might ...
@bludin I'm afraid that the day when we drop the support for the smallest boards is closer.
web interface for custom builds
#7594
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; Seeed Studio XIAO ESP32C3 with ESP32-C3FN4
Board ID:seeed_xiao_esp32c3
UID:43588170B08D
Code/REPL
http://circuitpython.local does not respond MDNS
Behavior
I have 4 Seeed Studios Xiao ESP32C3 processors on the network, running 8.2.8 and 8.2.9. When I attempt to get to get to http://circuitpython.local or /code/ I get a timeout. Wireshark shows no response to MDNS request packets...
I manually passed the value of proto = 1 for ICMP and it works to allow me to create a manual ICMP packet with a raw socket (I've tested it). Unfortunately, it doesn't look like IPPROTO_ICMP = 1 is defined anywhere, in the existing code base.
I've been testing the Raspberry Pi Pico version of this build (some comments were in the associated issue). The results are:
- These code changes in this build SUCCESSFULLY allow me to create a raw ICMP (ping) socket by passing proto=1. Previously, this was not supported.
import socketpool
import wifi
IP_HEADER_PROTOCOL_ICMP = 1
sp = socketpool.SocketPool(wifi.radio)
sp.socket(family=socketpool.AF_INET, type=socketpool.SOCK_RAW, proto=IP_HEADER_PROTOCOL_ICMP...
What kind of network testing do you want to do with this? Can you write a ping?
@dhalbert I did successfully do this with changes in this PR for the RPi Pico and it works well. See my previous comment above for more detailed results. Thanks!
@carson-coder
Posted my test results in the associated PR at: https://github.com/adafruit/circuitpython/pull/8752
CircuitPython version
adafruit-circuitpython-luatos_core_esp32c3-en_US-8.2.9
and also 9.0.0-alpha.6
Code/REPL
none
Behavior
The led always blink 3 times on every reset (both on push rst button or re-plug usb cable), maybe in a safemode but repl doesn't say why.
Description
It's a fresh install by the web installer. WIFI was configured by web installer too. I tried to use a external USB to TTL adapter to connect the esp32-c3 for more logs, ...
I think socketpool.SocketPool.IPPROTO_ICMP could be added:
>>> help(socketpool.SocketPool)
object <class 'SocketPool'> is of type type
socket -- <function>
getaddrinfo -- <function>
gaierror -- <class 'gaierror'>
AF_INET -- 2
AF_INET6 -- 10
SOCK_STREAM -- 1
SOCK_DGRAM -- 2
SOCK_RAW -- 3
TCP_NODELAY -- 1
IPPROTO_TCP -- 6
IPPROTO_IP -- 0
IP_MULTICAST_TTL -- 5
EAI_NONAME -- -2
https://github.com/adafruit/circuitpython/blob/6627bd7826fc7bbcddb...
For constantant for the proto parm I just use the Two that already exist
Some Lilygo TTGO T-Display ESP32 are sold with a 4 MByte (32MBit) flash chip. The current firmware for the 16 MByte version is not compatible.
To enable the build there is literally only one line to change: in the mpconfigboard.mk change one line to 4MB:
CIRCUITPY_ESP_FLASH_SIZE = 4MB
After that the build runs without any issues and the produced firmware works on the 4M version of the T-Display out of t...
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; LILYGO T-DISPLAY with rp2040
The behaviors was tested with all versions from the first support at 8.1.0 to the latest 9.0.0-alpha6 and is consistent across all versions. It even applies to the similar T-PicoC3. Details below
Code/REPL
# 23 Jun 2022 - @todbot / Tod Kurt
import time, random, board, displayio, vectorio, rainbowio
display = board.DISPLAY
maingroup = displayio.Group()
dis...
That's how it should look like and it is intended to be used for (thats why a higher refresh rate is needed).
I can at least tell you why the rotation is different (and I suspect the rotation is at least in part responsible for the slowdown). In the initialization sequence for the display, in the MADCTL register there are some bits that decide how the display is going to be rotated respective to its internal memory – on the side of the display chip. The board.c code has this:
0x36, 1, 0x08,
and if you glance at the ST7789 driver code, it seeming has the same:
b"\x...
binascii.crc32 is missing from 9.0.0-alpha.6 (of the RP2040 port), is that intentional?
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Adafruit Feather RP2040 with rp2040
>>> import binascii
>>> dir(binascii)
['__class__', '__name__', '__dict__', 'a2b_base64', 'b2a_base64', 'hexlify', 'unhexlify']
forced hdmi hotplug to get a repl
now i cant access the data due to
`SD card init failed 2
SD card init failed 2
...
I am adding the proto arg to socketpool.socket and I want to know what oonstants should I add for IPPROTO_.
- Fixes #8766
In one of the recent MicroPython merges, I missed that MicroPython now controls the presence of binascii.crc32() separately. Always turn it on if binascii is enabled.
Should I add every IPPROTO_* constant. And what would I do for the socketpool.socket() docstring because listing every constant isn't viable because there are a lot
I don't know how to test it, however CI doesn't seem to build images for WIZnet boards.
You could add only the ones that are actually implemented by Espressif or RP2040 wifi. And yes, add each one, with a docstring underneath. as class constants.
I just added each one and in the docstring for socket I said that proto can be IPPROTO_TCP, IPPROTO_IP or any other IPPROTO_ constant. and I added each constant in the class doc string. you can look at the next commit.
Adding them here does not make them available in Python You need to add them around line 221 in this file. But there are too many to add, and most will not be used. Just add a few of the common ones, including ICMP.
For instance, MicroPython defines these common ones:
https://github.com/micropython/micropython/blob/9feb0689eeaca5ce88aedcc680f997a3b4d0221c/extmod/modsocket.c#L640
Almost there! Flawless on 2 boards already 😁 And I started to read the 300+ page of the ST7789V documentation ...
First a picture that shows the strange bottom line with pixel noise:
So I followed your suggestion and changed the MADCTL register to 0b00010000 (as 0x10) and changed the rotation in the board.c to zero. It didn't had the intended effect:
, certainly no objections. This originally arose due to someone noticing that websockets in HTTPServer didn't have access to native hashlib (someone there should eventually re-test). But I think @Akkiesoft is right that there are no raspberry builds, WIZnet or otherwise.
Nice work!
@dhalbert GitHub newbie question here, but it looks like this was merged into a branch (8.2.x). How does it get into main so that it will be available in the CP9.0 codebase?
CircuitPython version
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-29; ESP32-S3-DevKitM-1-N8
Code/REPL
>>> import espulp
>>> ulp = espulp.ULP()
Traceback (most recent call last):
File "", line 1, in
NotImplementedError:
Behavior
In CircuitPython 9 it is no longer possible to instantiate a ULP object. In CircuitPython 8 this still worked.
Description
The reason for this seems to be the new preprocessor directives that were introduc...
Since the RP2040 preserves RAM when in the dormant (deep sleep) state, is it not possible to resume the program after a PinAlarm, without resetting the board? This would make it significantly easier to preserve state while dropping into lower power modes.
@ghubcoder's blog post describes how to recover from the dormant state by resetting clocks. This was implemented for MicroPython in [modpicosleep.c](https://github.com/ghubcoder/micro...
That was done here: #8769 by @jepler.
Due to the way the CI optimizes building fewer boards when possible, the rp2040 builds are on a previous Actions run. I think you can get the artifact you'd want for testing from here: https://github.com/adafruit/circuitpython/actions/runs/7305598483?pr=8749
The init sequence in board.c had one additional auto_brightness setting in the common_hal_busdisplay_busdisplay_construct() of the display_init() function that caused a one pixel noise line at the bottom of the display and a slow refresh rate from below 1 Hertz. Described in https://github.com/adafruit/circuitpython/issues/8765
Removing this line solved the issue.
Furthermore the init sequence from the Adafruit Feather esp32s3 tft was copied to rotate the refresh of the display t...
Pull request is created. The different settings for _MADCTL cause the pixel update when drawing to be now from top to bottom (it was left to right or right to left prior to this change). I think this is more pleasing to the eye. The transfer rate of new pixels to the frame buffer of the ST7789V over SPI is still not very high, but probably within the limits of the fourwirebus.
I'm surprised the display worked at all with the argument positions shifted like this!
Configurations which have a "0 degree" rotation of the displayio display are almost always preferable.
These settings can be replicated directly in Circuitpython. Instead of using the compiled adafruit_st7789.mpy I used the regular adafruit_st7789.py and changed one line with _MADCTL. The additional _MADCTL line can indeed be removed, no change here. And the file has only some 20 lines of code, anyway, so here is the adjusted init sequence from this file:
_INIT_SEQUENCE = (
b"\x01\x80\...
Sorry, not dismissed. But I found one error that was not obvious with B/W text but with the use of color. The D3 bit of MADCTL changes the color information. It was initially zero and therefore RGB but with the change to 0x68 we set it to one and therefore BGR. The change to 0x60 switches the order back to RGB and is consistent with the use in T-Display ESP32. So the change from the original 0xC0 only changes the orientation and refresh direction to allow for rotation=0
Performs a similar calculation as in HTTPServer web sockets:
<details>
<summary>EXPAND...</summary>
import time
GUID = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
ITERATIONS = 10_000
def hashme():
key = "dGhlIHNhbXBsZSBub25jZQ=="
start = time.monotonic_ns()
for _ in range(0, ITERATIONS):
response_key = hashlib.new("sha1", key.encode())
response_key.update(GUID)
return time.monotonic_ns() - start
import hashlib
duration = hashme()
print...
I don't have the hardware to test #8772 but the S2 version of the board was rotating the screen 90 degrees and I do have that board so I stole @kreier's changes and tested them on the Lilygo ttgo T8 S2 ST7789.
I did run a color test and the 0x68 on board.c line 44 results in the proper colors being displayed.
I changed the row start to 53 to remove the bottom noise line that showed up when rotation was set to zero.
I have since found out that the location where CONFIG_ULP_COPROC_TYPE_FSM should be defined is in ports/espressif/esp-idf-config/sdkconfig-*.defaults.
The issue seems to be that idf.py menuconfig only allows either CONFIG_ULP_COPROC_TYPE_FSM or CONFIG_ULP_COPROC_TYPE_RISCV to be defined but not both at the same time. This is despite the ESP32S2 and S3 having both the FSM and RISCV ULPs...
It looks like this issue has to be fixed upstream in the espressif toolchain. In the mean...
According to the Reference Manual of the ESP32S3 (Page 29), the ULPs cannot be used simultaneously. This means that Espressif will likely not update idf.py menuconfig to allow CONFIG_ULP_COPROC_TYPE_FSM and CONFIG_ULP_COPROC_TYPE_RISCV to be enabled simultaneously.
But compiling Circuitpython with both ULPs worked for Circuitpython 8, so I suggest to revert the r...
usb_hid packages support keyboard, mouse, consumer_contol features based on tinyusb. The examples of tinyusb can support wakeup in host sleep mode but Circuitpython usb_hid packages has no code to support it. I added some code from tinyusb example to Circuitpython usb implementation code. I tested this modification on esp32s2 board and works fine as I expected.
Here are the diff file.
diff --git a/shared-module/usb_hid/Device.c b/shared-module/usb_hid/Device.c
index b28de9c1b1..7d0e6e...
CircuitPython version
Adafruit CircuitPython 8.2.9-18-gee8b6f4e9b on 2023-12-30; Adafruit MatrixPortal S3 with ESP32S3
Code/REPL
import board
import displayio
import framebufferio
import rgbmatrix
DISPLAY_WIDTH = 64
DISPLAY_HEIGHT = 32
matrix = rgbmatrix.RGBMatrix(
width=DISPLAY_WIDTH, height=DISPLAY_HEIGHT, bit_depth=3,
rgb_pins=[
board.MTX_R1,
board.MTX_G1,
board.MTX_B1,
board.MTX_R2,
board....
This may be a duplicate of #8449
My code never runs it just always gives a os error
Are you doing this on macOS Sonoma? I thought you were on Linux.
Try this with 8.2.9 or the 9.0.0-alpha.6 build. Before you do anything, save what you need on CIRCUITPY, and then do
import storage
storage.erase_filesystem()
to make sure CIRCUITPY is not corrupted in some way. Then copy the files back and try again.
I erased the filesystem and now I am getting a too many display busses error
`
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 27, in <module>
RuntimeError: Too many display busses
Code done running.`
I swiched my build to 8.2.x but still compiled on my computer. Im going to try downloading a compiled 8.2.x version
With a build downloaded from https://circuitpython.org/board/adafruit_matrixportal_s3/ The code runs once then if I try ctrl-c ctrl-d then I get the too many display busses error
You forgot to call displayio.release_displays() before creating a new display.
Thanks! There is discussion of this in https://github.com/adafruit/circuitpython/issues/5380#issuecomment-925044500 and the whole issue. I think you did all that was noted there?
Would you be interested in submitting this as a PR?
I have this new code that does the same thing ```import board
import displayio
import framebufferio
import rgbmatrix
displayio.release_displays()
matrix = rgbmatrix.RGBMatrix(
width=64, bit_depth=4,
rgb_pins=[
board.MTX_R1,
board.MTX_G1,
board.MTX_B1,
board.MTX_R2,
board.MTX_G2,
board.MTX_B2
],
addr_pins=[
board.MTX_ADDRA,
board.MTX_ADDRB,
board.MTX_ADDRC,
board.MTX_ADDRD
...
Now I am just getting os errors but my code won;t run
Doing another erase gets me the error MTX_R1 in use. Im going to close this error for now and move to the discord
Advanced happy new year to everyone here (I live in the future). Thanks all for the amazing work on CP and excellent support to the community in 2023.
And the story with MADCTL continues. I collected a list of boards with the ST7789 display driver and their combination of MADCTL settings and rotations. The board names link to the respective board.c files. Looks like values are all over the place.
| board | MADCTL | _MADCTL | rotation | column start | row start | width | height |
|------------------...
This changes D5 MV Page/Column Order to one (reverse mode) and D6 MX Column Address Order to one (now Right to Left instead of Left to Right) in the ST7789 configuration. Effectively rotating the display to the landscape mode we are using it with refresh from top to bottom when writing/updating.
I tried these changes with a new firmware on my T8 ST7789 and it works as intended!
DOIT ESP32 Development Board implements ESP-WROOM-32.
However, the BLEIO module is not enabled.
REPL
adafruit-circuitpython-doit_esp32_devkit_v1-en_US-8.2.9.bin
Adafruit CircuitPython 8.2.9 on 2023-12-06; ESP32 Devkit V1 with ESP32
>>> import _bleio
Traceback (most recent call last):
File "", line 1, in
ImportError: no module named '_bleio'
>>>
Web
list of preferred pin names?
Is there a list of preferred or recommended names to use for pin on boards with I2C, SPI, I2S, UART, analog pins, digital pins, and buses?
BLE has not been available on plain ESP32 ever in CircuitPython, for various reasons. See for instance https://github.com/adafruit/circuitpython/pull/7220.
It depends on the form factor, and the tradition with the particular chip family. Is this Espressif or RP2040, and is it an existing shape factor? (I think not for the latter.)
@tulip sleet - unique form factor. RP2040.
then I would suggest using GPnn, and taking other cues from the Pi Pico board def
I thought the PICO use GPnn ?
Ideally, I’d like the pin labels to align with most of the Adafruit tutorials.
yes sorry
Imo something like "SPI" (ie default config for the bus) doesnt make sense unless you have some special connector, because pretty much any set of pins can output SPI (same thing with I2C)
For the generic pin labels, I am using the GPnn format.
it's up to you how you are doing the silkscreen on the board. We recommend providing pin names that match the silk. You can also add pin aliases that make sense
The RP2040 does have pins for I2C, UART, etc. I assume, when exposing them I could use both labels (if space allows)
OK. I’ll look thru a bunch of boards to get a consensus on label names.
well, it's quite flexible, you can use I2C0 on multiple pairs, I2C on other multiple pairs, etc. Too many to come up with pin names.
e.g. for SPI, using MISO, MOSI, SCK, etc and for I2C using SCL and SDA. For power enable, I currently use *_EN corresponding to whatever it is powering.
For a Feather, a Qt Py, a Metro shape, etc. yes, there are standard locations for those pins, so we label SCL and SDA, etc. For your board, there is no standard, unless you want to make one. If you have a STEMMA or Grove connector, certainly yes
I just wasn’t sure if there was a recommendation list somewhere. Sounds like the answer is “no”.
use similar boards as a guide, since we have reviewed those choices
It does have a STEMMA QT connector.
so you could label those pins as SCL and SDA, unless you ALSO want other pins to be designated for non-STEMMA I2C
It also has the analog pins so I will alias those as well.
All I2C are on the same pins so I will use SCL and SDA
tell us, how is it? any improvements?
2024 is a little warmer than 2023 was 😉
oh no
Images automagically compressed by Calibre's image-actions ✨
Compression reduced images by 53.1%, saving 19.90 MB.
| Filename | Before | After | Improvement |
|---|---|---|---|
| assets/images/boards/large/adafruit_esp32s3_camera.jpg | 179.00 KB | 89.64 KB | -49.9% |
| assets/images/boards/large/adafruit_kb2040.jpg | 213.11 KB | 97.99 KB | -54.0% |
| assets/images/boards/large/adafrui... |
I hate to do the "me, too" thing because I have a problem that's either identical or totally different. :-) I'm on a Adafruit MatrixPortal S3. Once the boot sector gets clobbered and you have to restore it, it goes flashy-flash and then:
➜ git:(mps3) ✗ cp ~/Downloads/MatrixPortal_S3_FactoryReset.uf2 /Volumes/MATRXS3BOOT/
cp: /Volumes/MATRXS3BOOT/MatrixPortal_S3_FactoryReset.uf2: fcopyfile failed: Input/output error
cp: /Volumes/MATRXS3BOOT/MatrixPortal_S3_FactoryReset.uf2: fchmod failed: ...
Sorry, my mistake. The correct value for MADCTL is 0x68. I checked three values in different builds and the impact on the screen:
- 0x08 is the old value used prior to this pull request. colors are fine, refresh from left to right
- 0x60 flips the
D3bit of MADCTL. Colors created by adafruit_display_text are not affected, RGB values submitted with the color attribute in Label render the RGB color as intended and before. But colors used ascolor_palette[0]in `displayio.Palet...
@robertlipe It's the same problem. It's not actually specific to CircuitPython or even USB, it happens with any small FAT12 (and I think FAT16 but I've honestly lost track at this point) filesystems with Sonoma.
It appears to be a bug in the new user-space FAT filesystem implementation that Sonoma has.
You can work around it by remounting the MATRXS3BOOT drive the way remounting CIRCUITPY works. This oddly forces the old kernel filesystem code to run instead, which still works properly....
Thanx for confirming. Ejection in this case happens upon mostly successful
write of the utf file when upgrading firmware. The device "eats" the file
and then resets itself, which forces an abrupt removal and thus
destruction/re-enumeration of the device.
In my second day of ownership, I'm finding the MATRXS3 is already really
flaky on a boot; S3's using MTP seem to already hang on boot
https://github.com/espressif/arduino-esp32/issues/6762, with no fix in
sight. (My fleet of ones ...
Of course, this is the month after my Applecare expired, so I can't report it. :-/
There's no problem reporting it - it's an OS bug. You can use the Apple Feedback tool and refer to other Feedback numbers that are listed above.
If only macOS did implement MTP -- it would be a more reliable solution, and we could use a better filesystem underneath. But the iPod-only attitude meant they never did it.
I te-tested this today on a QTPy 9.0.0.alpha.6 with the above linked simpletest script from requests. I still get the same results as with alpha.5, consistently have the MemoryError when it runs. I also tested 8.2.9 and confirmed that it consistently succeeds.
Howdy folks & happy new year. Remember that there's no meeting today -- instead, it'll be tomorrow (about 25 hours from now). I'm looking forward to hearing what everybody's been up to! <@&356864093652516868>
It looks like DISPLAY doesn't exist (https://github.com/adafruit/circuitpython/blob/main/ports/espressif/boards/m5stack_m5paper/board.c) so maybe there is a definition for DISPLAY but there isn't a display instants causing circuitpython to segfault causing safemode
So we could remove the DISPLAY definition (https://github.com/adafruit/circuitpython/blob/main/ports/espressif/boards/m5stack_m5paper/pins.c#L76) or setup the display.
I guess this falls under feature request:
I've been looking into implementing a more responsive debouncing algorithm for
the keypad module. The motivation should be obvious: the current implementation
is a scan rate limiter which effectively implies a random input delay between 0
and interval seconds, which can be undesirable in various applications.
What I have implemented and tested as a minimum impact improvement is an
additional parameter debounce_cycles to the scanner initi...
Happy new year everyone! Here is the kickoff post for #CircuitPython2024. I set the deadline at the end of the month because I'll be out the next two weeks to visit family. I'll try to blog up folks' posts though while I'm there. https://blog.adafruit.com/2024/01/01/circuitpython-in-2024-circuitpython2024-python-circuitpython/
There's some background info in #8293. Removing the DISPLAY definition even if it's only while the setup is being worked out sound right to me...
Random question on .mpy files and typing. I've noticed (although not dug in too deep) that when typing information is defined in .py files, that it takes up space in the .mpy file. Is it possible to make that not happen?
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit MatrixPortal S3 with ESP32S3
Board ID:adafruit_matrixportal_s3
UID:84722ED31008
Code/REPL
import board
from digitalio import DigitalInOut, Direction
# from adafruit_debouncer import Debouncer
class InvertedDigitalInOut(DigitalInOut):
"""A class that provides an inverted version of DigitalInOut pins."""
def __init__(self, pin):
super().__init__(pin)
...
Thank you @jepler !
I tested with W5500-EVB-Pico.
I no longer get the hashlib error when I run the code used in the following Issue URL.
https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer/issues/73
LGTM.
If you haven't looked before there is the mpy-cross tool that builds the mpy files. I quickly glanced and did not see a flag to not include typing information. But you could remove the typing information from the .py files and recompile the mpys.
The import and try/except will unfortunately take up space no matter what. The annotations themselves do not take up space. I have experimented with re-writing Python code automatically before mpy-compiling to recognize common idioms , but never came up with anything good enough to ship. https://gist.github.com/jepler/9ae2dbe8fda6ee5ff9e9360efe3bc157 #circuitpython-dev message
We've also discussed various ways to minimize the extra mpy space but I don't know that we've written up a best practices guide. Folks just kind of do whatever they've seen somewhere else.
I think the ideal solution IS some kind of ast-manipulation one PLUS a best-practices document so people can get a clear statement of how to ensure their type annotations have as little overhead in CircuitPython as possible.
@lone axle @gilded cradle let me know if you can read your usual sections in the meeing today.
I cannot. Unfortunately I've had a different meeting for work that conflicts come up. Likely won't be able to make today's meeting.
@lone axle that's exactly why I checked. No worries.
If any other meeting regulars would like to take a turn reading the library update let me know! otherwise I've got it covered.
Yep, I should be able to
thanks Melissa
Hi, no CP activity since the last meeting, so I will not write anything in the notes.
This would have been my busy "Non CP" section:
- Turning a Pi4 into a Home Assistant server
- Connecting the smart doorbell (ESP HOME)
- Reading power consumption from the electricity smart meter (P1 interface) connected to an ESP HOME
- Reading temperature/humidity from 4 LYWSD03MMC (flashed) using Bluetooth relay from ESP HOME
- Setting up a Pi5 + Pineberry PCIe bottom + SSD + Plex Server
- Growing my UniFi network with manageable switches and a VPN to France with dedicated Vlan/Wifi
- Got a PowKiddy RGB30 for Xmas and I installed my Pico8 licence to have a physical "virtual" console
(don't hesitate to ping me, maybe DM, if you have questions about any of those)
Have a good 2024.
<@&356864093652516868> meeting in about 8 minutes, sorry for the late notice.
Lurking today, no notes
This appears to mostly be a duplicate, but a dev version. I think this will make it so actions stops failing.
This is inaturalist
https://www.inaturalist.org
This is the library
https://github.com/fede2cr/cpyinaturalist
I'll certainly write about cpy24, but wifi with bt on esp32 families that have it, which is already being worked on.
OTA updates with uf2 might be very very cool as well. (or at least an update via the cpy site installer that works via wifi)
Thank you for hosting jepler.
Thanks, have a good week too
Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1Z2eoPQUUiMq5NK6sINJRZ-byxr5CSbZQm2u0cEehjkU/edit?usp=sharing
there's an incompatibility between jekyll and logger 1.4.3: https://github.com/jekyll/jekyll/pull/9392
What about converting the types into stub files that can be included in the PyPI distribution? We could use mypy still (if that is still the future intent) and use stubtest in the CI to make sure they don't deviate over time.
So this block in Adafruit_CircuitPython_Requests: https://github.com/adafruit/Adafruit_CircuitPython_Requests/blob/4754bf3e5fdb559be9ea085bfb65bd435039e887/adafruit_requests.py#L44 takes up about 1kb in the mpy file. Not a ton, but it's still some...
I think this may fix the error during actions:
/opt/hostedtoolcache/Ruby/3.3.0/x64/lib/ruby/3.3.0/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)
@level_override[Fiber.current] || @level
^^^^^^^^^^^^^^^
from /home/runner/work/circuitpython-org/circuitpython-org/vendor/bundle/ruby/3.3.0/gems/jekyll-4.3.2/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'
I'm having a problem where 4 different circuitpython boards (ESP32C3 by Seeed) used to perform flawlessly, but have recently stopped responding to the web workflow, and even to pings to their ip addresses. I would think they were dead, but they continue to post sensor data to an MQTT server. I'm now trying to understand the network services that live under the REPL and handle stuff like MDNS replies, web workflow, etc. Can I get a pointer to the circuitpython repo area that does that bit of service code?
MDNS I am not sure about, but for web workflow and the REPL websocket I believe the code lives here: https://github.com/adafruit/circuitpython/tree/main/supervisor/shared/web_workflow
what version of CP are you running? there is a bug fixed in 9.x where a reload at the wrong time would break web workflow until a reset
@lone axle Thanks, I'll check. @slender iron 8.2.8 and 8.2.9. But this issue survives a power-cycle and other resets.
oh! surviving a power cycle is weird!
Tell me about it. 🙂
I thought maybe my code was interfering, so I cleared flash and installed 8.2.9 from scratch. Only patched up settings.toml to get on wifi, and it still fails.
Does the bootloader get involved? I've checked my network. I can see the MDNS request go out from my browser, and other MDNS replies from the printer and Tivo come back, so the multicast appears to be working.
If it helps anyone, this is the script I've been using lately. Taken from comments above. Works with bootloader disks by giving it the diskname as argument (remount-circuitpy.sh FEATHERBOOT)
#!/bin/bash
# remount-circuitpy.sh -- remount a FAT disk, usually CIRCUITPY, so it works
#
# Works around bug where macOS 14.x causes file corruption on small FAT
# filesystems. The remount apparently causes older kernel FAT driver
# to be loaded. see https://github.com/adafruit/circuitpyth...
the bootloader shouldn't matter. can you access it if you put the IP into the browser?
is it just MDNS that is broken?
That worked for a while, at least as far as asking for log-in info.
But no longer. No ping response either given a numeric IP.
I don't understand the web workflow well, but circuitpython.local seems to make the MDNS request, which is unfulfilled
hmm, can you get serial output over usb?
correct .local is mdns
ip should work too if mdns doesn't
that takes me to cpy-<mac addr>.local which was intermittant (when I could get there.) If I go direct, that also fails the MDNS request.
I can get to serial over usb cable. I'm unfortunately becoming adept at writing file read and write utilities over the REPL
that's good. you could build your own CP and add print statements in then
do you see the ip in the serial terminal title bar?
yes
but it doesn't respond when you visit?
nope. ping <numeric ip> doesn't respond either. (should it? I thought it did in the past....)
I'm not sure ping will work
http should
you can add debug prints into the code and they'll go out the serial link
I misspoke: ping does work if you give it long enough. 9 fails, then reliable
hrm
and now http://ip brought me to the welcome page. full code editor link takes me to http://ip/code/ and wi-fi dialog again takes me to cuitpython.local/code/ which doesn't respond
is "http://circuitpython.local/code/#state={"path"%3Anull%2C"contents"%3A""%2C"pos"%3A0}" meaningful to you?
I'm wiresharking the network, and I do see MDNS traffic from other units on the network, but no response for circuitpython.local.
which implies to me that it's not a firewall issue on my computer
hmm, all cp devices should respond to circuitpython.local
agreed.
yeah that would be base to respond for sure
in web_workflow.c, I see CIRCUITPY_WEB_INSTANCE_NAME is used in MDNS
I've gotta run. I think you are looking in the right portion of code
later tannewt
ports/espressif/common-hal/mdns will have mdns calls into the ESP-IDF too
a debug build make BOARD=foo DEBUG=1 will turn on IDF logging which could help too
may go out a different uart from the one on the internal converter
If I set that to anything other than it's cpy-<mac> (which I have) could that be it?
ya perhaps. I haven't tested it much with overriding from user code
@slender iron Thanks for the pointers so far. I'm trying to avoid learning to build cpy from scratch, but if a cleaned up settings.toml doesn't do it, I can see a "fun" evening ahead.
building is pretty well documented here: https://learn.adafruit.com/building-circuitpython
it could interesting how this thing will evolve with this new wit-bindgen standardization will change things and evolve as document for that https://github.com/bytecodealliance/wit-bindgen
I can make a pull request removing (or commenting out) the display definition until someone writes code to initialize the display
I got into safe mode by doing
from digitalio import DigitalInOut, Direction, Pull
# from adafruit_debouncer import Debouncer
class InvertedDigitalInOut(DigitalInOut):
"""A class that provides an inverted version of DigitalInOut pins."""
pass
btn = InvertedDigitalInOut(board.A1)
btn.direction = Direction.INPUT
btn.pull = Pull.UP
print("okay")```
where does the matrixportal s3 put debug data when building with DEBUG=1
It looks like a issue with deriving a class from DigitalInOut
in the binary?
The printed out data. Does it show on the uart to usb converter or do I need to connected up a uart reader on different pins
In general it does not work to subclass a native class, unless special arrangements are made in the C code. Duplicate of #7305.
It would be nice if we could forbid or warn when a native class that can't handle subclassing is subclassed. Classes that do handle this properly could be marked as such. This is probably a change to make upstream.
Hi,
I wrote a program that fit in an rp2040 featherwiing, then added features, then got this error:
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPython core code crashed hard. Whoops!
Hard fault: memory access or instruction error.
I then stopped calling the added code, but it still crashed, I then started commenting out the code
that wasn't called, and eventually I could again run the program (with limited features).
I'm thinking that so...
I could add a error whenever someone tries to subclass a native class.
Continue discussion in #7305. There are native classes that can be subclassed if they take certain steps internally.
what printed out data? DEBUG=1 enables debugging symbols in the binary, so that when you connect with gdb you can see the variable and function names
I think it comes over this pin. I've not used it on a matrix portal, but on Feathers you can use debug pin with DEBUG=1 builds to get encoded tracebacks when the core crashes. There is a script in the core repo that can decode them. I've seen it spit out some other information during boot up and things but not sure what all it was.
I read it with a USB serial adapter
I got a KB2040 I got for free because I spent a certant about on money and I use that as a uart to usb converter (just printing uart input)
where is the script to debug the DEBUG pin. I tried to find it online but no luck.
I think <board> argument should be the same name used when making a build for that device. It's been a while since I used it though I could be misremembering. Then you paste the hex or whatever was output on the debug pin into the prompt from this script.
Such an error message would be appreciated.
I copied the output of the debug pin (from putty) and it just gave me
0x00000000: ?? ??:0 do I need hex
I think I am doing something wrong becuse in putty I am getting
0�ßÕ· !1H�¤&9�¥�§�¶)!)§�í¬��!�!)���!�í�§��!�§))))�í�)!äÿ�1¤)9)=1!)©���
maybe wrong baud rate
yeah, it should be legible characters I'm pretty sure.
looking online the bause rate should be 115200bps
running a debug build with code that hard crashes (looks like it) doesn't go into safe mode. The circuitpy drive isn't mounting and there isn't a port to connect to. Connecting to the uart with a external device shows just the crash. It looks like it just doesn't reset after crashing
actually it did connect but I can't get into safe mode by pressing the reset butting while the neopixel is yellow.
Just a forgotten pin.
Pressing the boot button worked
@pulsar sleet sometimes the trace you get on the debug console is corrupted, but if it isn't you can decode it using ports/espressif/tools/decode_backtrace.py
if safemode is entered then code.py doesn't run and it tells you when its in safe mode so its not in safemode
This is a fascinating question that involves some of great questions of computer science! Which unfortunately isn't likely to be solved on an RP2040 :)
In formal computer science, this is called "the halting problem" - I'll paraphrase, but it's believed that there's no more efficient way to determine the behavior of a program than to actually run the program. While there are some trivial cases that are simple to recognize, we're not able to ...
@lone axle sorry for the direct ping, but trying to learn the flow. You reviewed and tested my requests header fix PR, is there a next step?
No worries. Often I will merge it when I approve a PR. In this case I didn't because I didn't look over the requested changes specifically. I intend to circle back to it this week if no one beats me to it.
Cool. Thank you
macOS Sonoma 12.3 beta2 out today, no improvement.
Filed updated feedback including the new information about the filesystem implementation and a suggestion that Apple simply disable the new implementation. Include links to this whole issue and to the detailed trace. Requested they simply disable the user space filesystem until they have the bandwidth to fix the real problem.
My latest feedback ID is FB13513401, referencing FB13469123 FB13468526 FB13269327 FB13428357 FB13416096 FB132266...
Hello folks. Newbie question. I am trying to install CircuitPython on a particular ESP32-S3 module. Is there an easy way to see if a build is premade for a specific variant?
This might not be the right place, but I was hoping someone on the adafruit team could take a look at https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/pull/184 and https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/issues/148 ?
Hi folks -- I've run into this issue on the Feather RP2040: #148
Not too sure if this is the proper fix for everyone, but this unblocked our team so I thought I'd share a PR. Happy to fix a...
HI,
My understanding is that the halting problem is the indeterminacy of whether a program will or will not halt,
not whether it will run out of resources.
There's a bit difference between knowing the future over the long term and predicting what will happen on the next step.
Why aren't there runtime calls that can be used to check for heap and stack space before allocation, like C's malloc?
It's interesting that a warm boot doesn't find the problem but a cold boot (power cycle...
As noted in the linked mp issue this may still not be quite right
@vital dune https://circuitpython.org/downloads
If your particular variant is not there, you can make a PR for it (in some cases, there may be a board that's close enough: ram size, flash chip type and size, etc)
If someone were going to fix this, the information needed is:
- how much ram is on the feather?
- where does circuitpy fit in the ram?
- where does the app get loaded?
- what is the loading process?
- can the loading process do ram size pre-checks?
reviewed but did not test, however nothing looks amiss to me :)
What version of CircuitPython?
Does it make any difference which code is removed, or is it definitely related to the amount of code removed?
This could be an issue separate from pure RAM usage. If I have a code.py file importing every native module, then a few thousand lines of simple print statement, I get MemoryError: memory allocation failed (as expected) but not safe mode.
I tried with 8.2.4 and also 8.2.9
I'm not sure its responsible to recommend running code labeled "alpha.-dirty"
I tried 3 different levels of code excision because at first I thought it was code execution (me at fault) and not code loading (maintainers missing something), but only the last level, removal of unexecuted code prevented hard crashes
level 1. removing libraries, conditional imports (disable features)
level 2. conditional execution (more disable features)
level 3. co...
@lone axle the work you did on RTD, did that include updating the web hook? I just got an email saying that those need to be updated on some of the projects I created on RTD.
Apologies if I'm waaaaay behind.
I don't think so, but I'm not certain I know which part you mean. Is that something you do inside the settings page for the repo? Either in Github or on the RTD side? If so I don't think I did anything on that front (don't believe I have access)
just saw #7305 and thought it would be interesting to dive into it
in order to achieve it, im looking for the piece of code that creates the new class at C level after parsing Py's source (still havent found), during my little trip across the code i've seen mp_obj_is_native_type but im not sure if that would be the best function to use (maybe some checking needs to be crafted into a new function instead)
also, my idea so far is to emit a Warning when code tries to inherit from a native class. ie: not actually crash the program but let the user know it may be a bad idea.
- reason not to actually
raisebeing that some native classes (or at least some particular inherits) might be safe (?) .... and i dont know (maybe just lack of knowledge about the codebase) it there's a good way in which classes could note "hey, im fine being inherited from" (in which case we could default toExceptionfor all types, but emit a Warning for the "safe" classes, probably) - downside being that crashes would not be prevented without a
raise🙃
here's my theory, circuitypy sets a sentinal (checksum result?) but only checks it on soft reset after a bad program load,
and regenerates the sentinel on a power cycle
scenario 1. reboot, loads good small code.py, everything is ok
scenario 2. bad large program is copied to code.py after previous ok program (scenario 1),
soft reboot, loads too big program but too-big program / sentinel is not checked,
program runs until power cycle and hard boo...
@schaefer01 is that on MacOS Sonoma?
catalina. I just upgraded to sonoma this morning, I'll try again right now ...
wild, the remagen program generates an error on copy-and-paste:
The Finder can’t complete the operation because some data in “” can’t be read or written.
(Error code -36)
I'll re-expand the working shorter program to see what happens ...
I get the same error when I expand the small program into the too-big program.
deshipu, do you know what is going on?
How does the copy-and-paste operation know that a program is too big to run?
I think it's technically an RTD thing that they want to be done in GitHub, if that makes sense. I think it's basically regenerating the webhook stored in GitHub repos, but I don't have permissions for that on the GitHub side. There is a "Resync webhooks" button on the RTD site you can use but again I don't have permissions to alter webhooks in repos.
.. update the tests as well. Don't dump the bitmap when the bitmaps already compared equal for the crop and position tests.
Basically, the y= coordinate was not used (x= was used) and my tests all happened to use x=y values. Oops!
hi, I just talked to some knowledgeable people here (my boss) and there are 4 banks of 64K RAM, my program is just over that size in text and definitely smaller if I comment out code.
The question is, can anyone tell me about the paging mechanism, Can a program run across multiple banks of RAM?
I don't believe that I do either. Make a note to discuss it during a meeting if you can?
The source of the .uf2 file is this github code.
Also maybe something doesn't get cleared right when soft rebooting causing the next program to crash?
Also try "compiling" the code that fails (convert to .mpy with mpy-cross) and see if it works then. I had to do this to use less memory on my device.
Switching to sonoma solves one part of the problem by preventing a too big program to be copied to the featherwing.
I'll wait to see if anyone wants to explain whether the featherwing can or cannot run a program bigger than 64K in code-size, and why this is, or is not, possible.
I asked about Sonoma, because there is a pretty bad bug in it right now, which corrupts the filesystem. My hypothesis was that maybe with the bigger file it doesn't get all written to the filesystem before the reset, so the file gets corrupted and that then causes a crash when CP tries to execute it. But if it was on Catalina, then I have no idea.
How Python in general executes files is two-stage: first, it parses the file and compiles it into bytecode, and then the bytecode is getting exe...
Wow. I'm definitely on the bleeding edge.
Maybe when the sonoma bug is fixed, larger programs will be able to be copied and run.
Anyway, per your hint, I'll try refactoring my program into a smaller program that imports parts as needed.
Thank you very much. I'll leave this issue open if that's ok with the maintainers.
what is the board? Recommend asking in #help-with-circuitpython first, and sometimes the manufacturer of the board has compiled a circuit python bin specifically for the board, which isn't listed at https://circuitpython.org/downloads?mcufamilies=esp32s3
Will do!
@schaefer01 That's a great point about the "halting" part of the halting problem, but it's not just about the indeterminacy of whether a program will halt. In the abstract, the halting problem is about the general indeterminacy of the program's behavior. From a formal computer science perspective, again vastly simplifying, you can map any program to a halting program. The focus on halting is just to make the problem manageable. So again, it's believed in formal computer science that you can't...
If I wanted to add a board, that had a library specific for that board, would I put the library in the main circuitpython project? Or would I fork and compile it and create a frozen module?
It’s a C driver for an RP2040 that is specific to the board I made. It also has a python part that is higher level stuff, but relies on the C driver
Just not sure if it makes sense to put a board specific driver in the circuit python repository
Some more context: I made a RP2040 based board with a MCP2515 CAN controller on it. I know that Adafruit has (basically) the same combo, but my board has headers/features specific for my application.
I am not really satisfied with the Adafruit MCP2515 CAN driver because it uses blocking calls for CAN, and waits until a message is received or timeout to return the message. This is inconvenient because it prevents other timing-critical tasks like driving NeoPixels, displays, etc. What my driver does is dedicates the RP2040's second core to managing CAN, and stores every message in an array, and updates the array with the most recent message. It also has a queue for transmitting messages, creates a system for messages to repeat (helpful in automotive applications), and other small features helpful for me. The circuit python side (still in development) basically just communicates with the lower level CAN driver in a way that doesn't use blocking calls. I plan on using it for robotics and for automotive uses, so I will have features in the CircuitPython relevant to that as well.
Unfortunately, my CAN driver is specific to the RP2040 and MCP2515, and really my board's wiring, so it wouldn't necessarily work on the RP2040 Feather CAN (I haven't checked though), and it wouldn't be applicable for any other boards.
With that being said, I am wondering where the best place to put the library is. I am not sure if it's wise to put it in the circuitpython repo because it's so specific, but I also want to be able to sell this board in the future, and the requirement for my board to be able to use CircuitPython (https://github.com/adafruit/circuitpython#branding), it has to be supported by the primary CircuitPython branch. Plus, I want to be able to contribute to it if/when I do more development
I would like to use the following Waveshare EPaper display with CircuitPython.
https://www.waveshare.com/product/displays/e-paper/epaper-1/7.3inch-e-paper-g.htm
It is a 4-color display (Red/Yellow/Black/White).
4 pixels per byte are transmitted (= 2 bit color depth).
Black: 00b
White: 01b
Yellow: 10b
Red: 11b
I have seen in the current C source code that the 7-color display from Waveshare is already supported. Unfortunately, I am not able to contribute C code for the 4-color v...
romkey, good point.
I've thought more and believe that there's two kinds of halting problems, the first is when the program is known to be correct, i.e. is the end condition ever reached?
The second is, is the program correct?, i.e. is there a bug? I've got the second kind of halting problem. There definitely is a bug, but where is it, in circuitpy itself, or in the host os, or in the interaction in interface between the host os and the featherwing during program load?
Computer sc...
On behalf of all of us with this issue, our thanks for staying on top of this.
On Jan 3, 2024 at 8:03 PM -0500, John Romkey @.***>, wrote:
macOS Sonoma 12.3 beta2 out today, no improvement.
Filed updated feedback including the new information about the filesystem implementation and a suggestion that Apple simply disable the new implementation. Include links to this whole issue and to the detailed trace. Requested they simply disable the user space filesystem until they have the b...
@knotty trail we don't currently have a solution for shipping native code routines that are not "in the core".
so you would hypothetically add your routines in shared-bindings and shared-modules (or ports/raspberry-pi/common-hal if it relies on rpi specific hardware features) + a new frozen library
that said, we are unlikely to want to offer multiple incompatible APIs for canbus within the core. is there any way to evolve the current API so that it is more suited to your use cases? mcp2515 is pure python code outside the core, while we have canio for some mcus with built-in can peripherals.
@onyx hinge I was looking at evolving the existing canio interface but my implementation isn’t as nice as the existing canio interface. Also, it is somewhat specific for the rp2040. Maybe I could create an rp2040 specific canio interface but I’m not sure if that will work for all projects since it uses the second core to constantly monitor the MCP2515 and that could affect other libraries.
I will look further into evolving the canio module later. I think for now, the best option may be to just fork circuit python and list my board as CircuitPython-compatible. That kind of sucks because I’d like for it to be listed on the circuit python site, but it is what it is
can you say a little bit more about how it's specific to rp2040, when the mcp2515 is just a SPI connected device?
oh the second core, hmm
Yes. Basically all the second core does is poll the MCP2515 as fast as possible. I tried using interrupts but after trying to read/store over 1000 messages/sec, it locks up.
With continuous polling, I’m able to process over 8000 messages per second, which is basically a 1MB/s CAN bus near 100% utilization. I haven’t tried more than that but I’m sure it can handle it.
I also have a message transmit queue so you can queue up to 32 messages to be transmitted instead of only 3 (tx buffers). I also save the count and timestamp of each message. I also have a mechanism to send messages every x milliseconds, even if the data wasn’t updated. This is useful for vehicles or devices that require a constant stream of messages and would set a fault/dtc if it didn’t receive a message on time.
What’s also nice is that since it uses the other core, the first core doesn’t have to do any busy waiting. This use useful if you have any neopixel animations or other sensors you are polling
It’s really useful for gateway-ing messages, Robotics, and I even have plans to use it on a solar hybrid inverter
The limitations on the python MCP2515 implementation is that it doesn’t save every message, it will wait until a message is received before returning, which can mess up neopixel animations and other sensor reading routines, and it has no method to continuously send CAN frames every x milliseconds
bitmapfilter.morph is taken from openmv's imlib.
It is substantially faster than blur/sharpen implemented in ulab, by up to 10x. It also avoids making many allocations.
Creating as a draft PR in part because if we go this direction I'll want to add more processing algorithms (sharpen, grayscale, sepia, edge detect for example). It also needs docstrings etc.
I chose to make this separate from "bitmaptools" in case of source code growth, other name ideas are welcome.
I'll disable it on all boards where it doesn't fit when I next update the branch (approximately 18 boards)
@schaefer01 This isn't really a great place to chat without bugging everyone else who may have posted on this issue or be monitoring CircuitPython issues. If you want to chat more about it, Adafruit has a very friendly Discord server. That's also a great place to seek support next time you need it.
Since your problem was identified, I'd suggest closing this issue, but I'm not one of the maintainers.
Pre-planning. Does anyone know if the right people will be in this coming up Monday meeting to talk about ConnectionManager?
Also, if this gets accepted, if a board has frozen requests, this would also need to be frozen in, yes?
yes about the freezing. I am not sure when Dan and Scott are back.
Thanks. If it's given the go ahead, I'll open ALL the pull requests...
I’m back the 16th
i just got back
I’d suggest opening an issue so we can have a longer term discussion. One apiece I’ve thought about is a coprocessor api so you can run whatever code you want on the second core. Sharing peripherals and pins will be a bit tricky though. You can also have port specific bindings (instead of shared bindings) that may be more relevant too.
Should I then wait until the 22nd (the first Monday both are back)?
Is it possible to use 16-bit commands with DisplayIO's API? I'm trying to write a board.c file, but it seems like common_hal_displayio_epaperdisplay_construct is hardcoded to use one byte commands, then immediately send the data.
I'm thinking maybe I can setup everything in the display_start_sequence and then just set all the commands to NO_COMMAND ?
Actually, sequences work fairly well, it would be great if all the command parameters just used a sequence rather than a byte.
(I might trying making a pull request for that...)
I could try to add this but I don't have a epaper display
Technically it only needs a change of one line in mpconfigboard.mk with the adjusted CIRCUITPY_ESP_FLASH_SIZE = 4MB and now CircuitPython runs on versions with a smaller flash chip. I have several boards here and they are still available to order.
While at it I changed the init sequence for the display with an adjusted MADCTL to 0x60 (instead of 0xC0 to get the rotation=0 and a refresh of the display from to to bottom. 0x68 causes inverted colors when using `displayio.Pal...
I just created the mentioned pull request https://github.com/adafruit/circuitpython/pull/8787
The CI found a duplicate creation ID, you'll probably want to change CIRCUITPY_CREATION_ID to be something like 0x00320004 (https://github.com/creationid/creators/blob/main/creations/lilygo.md). You'll also want to make a PR against https://github.com/creationid/creators to add the new creation ID.
From the How to add a new Board learn guide:
Creator/Creation IDs
For boards th...
I confirmed this issue exists on TFT screens as well with a Feather ESP32-S2 TFT.
Here is some reproducer code that can run on any device with a built-in display:
import board
import displayio
import vectorio
main_group = displayio.Group()
palette = displayio.Palette(2)
palette[0] = 0x00ff00
palette[1] = 0x000000
display = board.DISPLAY
display.rotation = 180
print(f"width: {display.width} height: {display.height}")
border_rectangle = vectorio.Rectangle(pixel...
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; Cytron Maker Pi RP2040 with rp2040
(issue also occurs with CircuitPython 9.0.0-alpha.6)
Code/REPL
n/a
Behavior
When using Windows with Samsung Magican (SSD utility) installed (actually it's the SamsungMagicanSVC running) the board boots using the out-of-box demo code that comes with the Maker PI RP2040 but hard faults after a few seconds. The CIRCUITPY drive gets listed in Windo...
I would like to suggest adding a method to the module "wifi.Radio" for getting information about connected devices when the board configured as an access point (i haven't found a way to get this info). Should I write it on Github?
@gaunt bolt yes, you can create an issue on the circuitpython repo
CircuitPython version
Adafruit CircuitPython 8.2.9 on 2023-12-06; Adafruit Macropad RP2040 with rp2040
Board ID:adafruit_macropad_rp2040
UID:DF61B0C28717182F
Code/REPL
# N/A; this is a bug in the HID Report Descriptor as seen by a host, but here is the code.py, which is one of the MacroPad demos
# SPDX-FileCopyrightText: Copyright (c) 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
Rainbow LED grid layout demo ...
wow that formatting came out weirdly
The core module wifi.Radio does not provide any method to know if there is any device connected to the board when it is configured as access point. I would like to suggest the development of the following method:
- .connected_clients -> list of of connected devices
- connected_clients[].IP -> IP address of a particular connected device
For applications when we have to transmit sensor data to connected devices (e.g. musical controllers), this is radically important. We usually do not re...
@slender iron - I recall an open issue regarding the use of the second core on dual-core MCUs. The options quickly became untenable.
I like the idea of having a CircuitPython core level capability since the second core is a hardware capability, having the board’s CircuitPython firmware has appeal.
For my board, I struggle to see what makes sense to go on the second core because everything has “end-user” applications - e.g. neopixels, touch sensors, and SPI display, audio (often used with synthio).
To take advantage of any of these, a portion of the existing core code would need to be shunted over to the second core; then the user calls would need to be routed according.
Like before, things get complex quickly.
What protocol is being used to communicate from the AP to the connected stations?
I think it would involve capturing the IP_EVENT_AP_STAIPASSIGNED event and handling this structure:
https://docs.espressif.com/projects/esp-idf/en/release-v5.1/esp32s2/api-reference/network/esp_netif.html#_CPPv427ip_event_ap_staipassigned_t
A typical use would be using OpenSoundControl (application level protocol), which is usually implemented with UDP. When I coded this in C or Arduino there were methods to obtain the clients' information. Ideally, it would be great to obtain it directly from wifi.Radio
In the mean time, I don't know if you have control over which order the stations connect to the AP, but the AP will be 192.168.4.1, and stations get assigned sequentially starting with 192.168.4.2. You can set a maximum number of stations allowed to connect in the start_ap() call (up to 10).
Thanks for the tip. In fact, this is what I have engineered at this moment. It really works well but it will definitely would be great to deal with this automatically :) I hope this could be developed!
#general-chat Itt megy a beszéd itt fejlesztés/ hibabejelentés megy
(sorry)
Yeah, I'm trying to get four bits per pixels working for a greyscale eInk display, so it would be great to just have a parameters for the colour depth. Current implementation seems a little limited. I'll have a look.
The CI found a duplicate creation ID, you'll probably want to change CIRCUITPY_CREATION_ID to be something like 0x00320004 (https://github.com/creationid/creators/blob/main/creations/lilygo.md). You'll also want to make a PR against https://github.com/creationid/creators to add the new creation ID.
From the How to add a new Board learn guide:
Creator/Creation IDs For ...
Can you describe the user case more? Are all connected stations equivalent, with the same packets going out to each, or is there some other way to know what each one can do?
I think the event handler process is more complex since stations connecting (and then obtaining an IP address) and later disconnecting means state for each station will have to be tracked in real time and persist until the next change.
The latter alternative above is a call to get a list of the IPs (and potentially ...
Some esp32s3 boards like lilygo t-display-s3 come with a display connected via 8080 interface, so having parallelbus back on ESP would be nice....
I started working on a port for the LILYGO T-Display S3 and ended up here. Its feasible to get the display working inside the build. However, my cursory look leads me to believe the new ESP drivers are quite different from the old ones. I don't have the smarts to try and tackle it myself, but I'd be more than happy to test any feature branches...
I dug deeper and the Pico DVI board/library is a similar situation. Super custom code running on core1
In my opinion it doesn't matter if different packets go to different clients if an enough informative event handler is created. In the past, I coded these applications in Arduino using similar code to this: https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/WiFiClientEvents/WiFiClientEvents.ino
The device transmiting would implement the following event handlers:
``
USB host as well
I wouldn't change the title with the assumption of an implementation detail.
There is a similar event handler already in the core for espressif port, but in general we don't print from the core. There would still need to be an API to query the core from CircuitPython user code to get the (current) IP(s), since there is no way to interrupt python code f...
b84e8bcf6727666f68c510730465e07d06dd6599
Hi all 😁👋 it's been a hot sec
I've been encountered a build problem (maybe🤷♂️🧐) on main* and, if someone has a few minutes, I wonder if it's worth a sanity check?
(typing...)
Oop! never-mind it looks like it's because there was a space in a directory that was part of the path to circuitpython 😅 .... 🤦♂️
I'll see if it's easy to add a check or fix to makeversionhdr.py (where the error occurred) hopefully before the meeting.
- boards without board.DISPLAY cannot do this. For example, matrixportal s3 does not have board.DISPLAY.
After displayio.release_displays(), there is still a blinka flash when networking seems to be initialized.
Which arm-none-eabi?
This may be an obscure configuration but here it is: Using VMWare Fusion for Ubuntu guest (ARM64) on MacOS host (Apple Silicon). I am not sure which toolchain to download.
https://learn.adafruit.com/building-circuitpython/linux#install-build-tools-on-ubuntu-2986713 points to https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads for the 13.2.Rel1 release. From there find the "macOS (Apple silicon) hosted cross toolchains" "AArch32 bare-metal target (arm-none-eabi)"
The host is macOS; the target is AArch32 bare metal (arm-none-eabi)
this may also be in homebrew, but I don't know
(That's for running the toolchain on your Ubuntu guest)
whoops sorry, yes, bob is right, I was looking at the macOS host, not Ubuntu guest on VMWare
I tried arm64-arm-none-eabi.tar.xz and I cen an exec format error cannot execute binary
So perhaps the aarch64-arm then?
The ARM site is a touch confusing. You need to scroll down to the AArch64 Linux hosted cross toolchains section.
Thanks. We are all landing on the same conclusion concurrently 👍🏼
Irony is the bold category labels are a slightly smaller font from the sub-category labels 🫣
we have a winner!
@danh I'd like to take up reviving the CP fork of the CYW43-driver.
The aarch64-arm is what I needed
(appreciation to @tulip sleet and @mortal kernel)
that is fine
How do we go about it? It needs to be re-synched, branched, and have a couple of local pulls merged. I'd be happy to do it with if you can give me repo privileges.
i have sent you a collaboration invitation
<@&356864093652516868> We'll have our weekly meeting in about 60 minutes from now in this text channel and in the circuitpython voice channel. Please take the time to add your notes in advance to the document: https://docs.google.com/document/d/1Z2eoPQUUiMq5NK6sINJRZ-byxr5CSbZQm2u0cEehjkU/edit -- I look forward to everyone's updates!
Added support for Columbia DSL Sensor board
No notes, just lurking today
compared to last week this meeting is hopping 🦗
A comprehensive and FREE Online Python Development course FOR KIDS utilizing an official BBC micro:bit Development Board and later an Expressif ESP32 Development Board going step-by-step into the world of Python for microcontrollers.
FREE COURSE @ minipython.org
Music from Kevin M. Thomas:
Bios Data Area - Cyber Armageddon
☺️
@stuck elbow i think you need to mute
sorry
all good!
WaveViz in action
[I keep hearing "wave biz". Hey, I make money in the wave biz.]
That is really cool @errant grail haven't had a chance but wanted to try more with WaveTables and being able to see it is great
One of the symptoms of the bad and misbehaving SD card.
😦 😦 so many folks with covid right now.
wastewater COVID results tell the tale. North Boston region:
I'm open to using something besides threads if it works as well.
https://biobot.io/data/ for more Covid wastewater data
I think the threads work nicely, but if I come up with any other ideas I'll make an issue to propose them. PyGameDisplay had actually used Threads prior to the Blinka Displayio update and I think having both making threads was causing trouble. But the latest working revision I have actually removes the threading from PyGameDisplay and relies on just the threading in Blinka_DisplayIO which makes PyGameDisplay much less complex. Just gotta find and hammer out the last few quirks.
I'm sure you'll get it!
@proven garnet Adafruit also got a message about a bunch of repos. I tried this with some of the adafruit repos and it did not seem to work; my assumption is that either something's not right at the organization level or my access level is not sufficient.
appreciate that Dan!
fwiw I do have the ability to log into readthedocs as adabot but it didn't work
yes we could do the manual process for them all but it'd be nice not to:)
i'm also happy to help if repetitive actions are needed
That sounds great, somebody just needs to implement it and make it fit on as many devices as possible.
The specifics of handling that section of storage is over my head. But the functionality of having that traceback or perhaps other diagnostic info in an easy-to-access file sounds awesome to me.
The big issue with a logging file/filesystem is host OS filesystem caching. Once a filesystem is mounted, the host OS will not see updates reliably or at all.
Would be great to add logging in there too, so we have some breadcrumbs of what happened
USB events are a possible solution, but I'm unclear whether USB events can be limited to just one filesystem. I believe the event in question forces a remount.
that would require using flash storage, and you run into flash wear issues with it
@tulip sleet fwiw I found that adabot can't do the necessary operation on readthedocs, but if I add myself as a mantainer first [logged into readthedocs as adabot] and then re-sync the webhook [logged into readthedocs as myself] it works. It doesn't matter if I sign in to readthedocs with github or not. maybe we can elevate adabot's permissions on github so that it can administer webhooks?
thank you Liz!
Thanks everyone
Thanks all!
It couldn't use the same virtual?
Next week's meeting is on the 16th (tuesday)
ram doesn't survive powering off
Hope everyone has a nice week. Thanks for hosting Liz!
Thanks to Liz for being an excellent host and for reading the text-only sections.
Thanks 😄
thanks folks!
Thanks!
How could you store it in boot_out.txt ?
the boot_out.txt is only updated when it changes, to avoid flash wear
Thanks - I will see if I can (perhaps temporarily) make adabot be a Maintainer in the adafruit org, click the buttons in readthedocs while logged in, and then switch it back. How can I tell whether it worked or not? Is there a status message in each readthedocs project/subproject?
and most of the time it doesn't change
Ahhh, could the logs be stored in ram, and then only written if there is an exception?
@tulip sleet it tells you "Webhook activation failed. Make sure you have the necessary permissions." on RTD if it didn't work.
you could do that with python right now
Here is the notes document for next Tuesday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/1BnXAE4EqNirRCWa8SfC291593gxhsrIrJBOcdCfqEeM/edit?usp=sharing
Hey all - is there a document that lists Adafruit's pin name recommendations for common built-in buses, sensors, etc? I think I've tracked down a lot of them, but haven't found a list of recommendations anywhere.
I don't know that there is a document. This may be a bit outdated, and is specific to Feather: https://learn.adafruit.com/adafruit-feather/feather-specification. This covers sensor units rather than pins: https://docs.circuitpython.org/en/latest/docs/design_guide.html#sensor-properties-and-units. I'd look to the most recent Adafruit boards added, that should get pretty good coverage of pin naming.
Addresses issue #8681, enabling the Raspberry Pi Pico/Pico W to swap audio channels A and B in the audiopwmio library.
Notes:
- Adjust the stereo condition, checking both channels are defined.
- Remove error handling if the left channel is assigned to pin channel B since the channels can be swapped.
- Introduce a new variable,
swap_channel. - Update the code inside I2SOut.c to align with
audio_dma_setup_playbackand set theswap_channelto false."
Can you help review this?
...
CircuitPython version
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Raspberry Pi Pico with rp2040
Code/REPL
import board
import busio
import digitalio
import displayio
import os
from adafruit_ssd1680 import SSD1680
from terminalio import FONT
from adafruit_bitmap_font.bitmap_font import load_font
from adafruit_display_text.label import Label
# EQUIPMENT
# Raspberry Pi Pico https://www.adafruit.com/product/4864
# 2.13" Diagonal E-Ink DIspl...
Thank you!
This seems fine. However, I didn't test anything.
I note that the new swap_channel flag assumes the output data is stored in a 16-bit data type. While this appears to always be true, it's worth mentioning that there does seem to be some (unused) code for 8-bit resolution samples. If we actually do use 8 bit samples in the future, the channel swap code will need to be revisited.
I looked into getting rid of inline type annotations, but the only way to provide them per PEP 561 is if the distribution is a package - there is no option for modules. So for any of the modules we would just be stuck with the status quo. There is a draft PEP for this issue that was started a year ago, but no development on it since, it seems.
You can trick Pylance in VS Code into finding it with a hack to data-files in pyproject.toml, but not mypy as easily.
This looks OK to me too, but I would like to know if you tested it on hardware for both I2SOut and PWMAudioOut. Thanks.
The mpconfigboard.mk and sdkconfig files are in CircuitPython 8.x.x style. Take a look at some ESP32-S3 board definitions in the latest main. We have added some settings to mpconfigboard.mk and made the sdkconfig files simpler.
While at it I changed the init sequence for the display with an adjusted MADCTL to
0x60(instead of0xC0to get therotation=0and a refresh of the display from to to bottom.0x68causes inverted colors when usingdisplayio.Palette()so I kept bitD3of MADCTL at zero.And I added the missing pins
GPIO36andGPIO39even though they can only be used as input. And renamed the buttons toBUTTON_LandBUTTON_Rto be consistent with the rp2040 version of this b...
Thanks @andibing @Saentis @hexthat !
While at it I changed the init sequence for the display with an adjusted MADCTL to
0x60(instead of0xC0to get therotation=0and a refresh of the display from to to bottom.0x68causes inverted colors when usingdisplayio.Palette()so I kept bitD3of MADCTL at zero.
And I added the missing pinsGPIO36andGPIO39even though they can only be used as input. And renamed the buttons toBUTTON_LandBUTTON_Rto be consistent with the rp2040 version of this b...
Hello,
Is there any update on this issue ?
Does someone have a workaroud to avoid this ?
Thanks for your work !
The button name change could break existing code although this PR is against MAIN so it may not show up until 9.x, that being said, the only board that uses BUTTON0 and BUTTON1 is the LIlygo_t_display_esp32_16m. BUTTON1/2/3... is used by a few NRF boards. BUTTON_L/BUTTON_R is only used by the Lilygo_t_display_rp2040 but I'm not sure the L/R (presumably Left/Right) have much meaning for that particular board layout. Several other boards do use BUTTON_LEFT/BUTTON_RIGHT.
I don't think the bu...
Biweekly check-in, sad trombone: macOS Sonoma 12.3 beta3 is out today and still broken.
Maybe we could get the attention of one of the Mac new sites? That might get Apple's attention. Though they're probably all hands on fixing bugs for Vision Pro at this point.
Feedback filed, new set of ids is FB13528351 FB13513401 FB13469123 FB13468526 FB13269327 FB13428357 FB13416096 FB13226668 FB13306896
Button renamed to original version for 16M edition. Indeed, it's not a big deal and best not to break code. Users will probably use some if board.board_id contains '2040': to differentiate between the boards and have the same code running on different editions.
Thanks for your feedback!
I appreciate your observation regarding the 8-bit resolution samples. I'll carefully review the code to ensure compatibility with 8-bit samples if needed in the future.
Regarding testing, I have successfully tested PWMAudioOut on hardware, and it's working as expected. However, I haven't tested I2SOut on hardware yet. I'll make sure to perform the test and update you on the results.
There was some question somewhere (not here, it seems) about whether the MSC device is reported as "removable". The answer is that TinyUSB in its MSC device code always sets the RMB ("removable") bit to 1 when it answers a SCSI INQUIRY command.
I'm currently looking at the issue of excessive current draw after de-initing the UART. I originally tried to fix this in https://github.com/adafruit/circuitpython/pull/8089, but that broke some fairly major USB functionality, so it was reverted
Looking at this further the nrfx_uarte_uninit function that is in the nrfx library linked to circuitpython was buggy (https://github.com/adafruit/nrfx/tree/3f55e49eb11e6db0da1da09e189bb094222702c9). More recent versions of nrfx have fixed this, and indeed these have been ported through to the most recent adafruit version of nrfx
However, circuitpython still links to commit 3f55e49 of nrfx
I've tested just updating nrfx_uarte.c - and that works fine. However trying to compile circuitpython against the most recent nrfx fails with multiple errors - and I'm concerned that it could break other peripherals.
I suppose the question is whether I should create a branch of nrfx with just the uarte updates - just a handful of lines are changed, and link CP to that, or some other solution?
Looking further at the circuitpython history, the commits after 3f55e49 have never been used in circuitpython
I have now successfully compiled circuitpython against a slightly altered nrfx from the latest commit on that branch - and it seems to work. Not sure what a good testing strategy would be however.
Our fork of nrfx already has some changes we needed in it - most notably (and maybe only) the "uninit()" operations are idempotent. So our fork could be brought up to date with upstream and then further changes could be made. Another change we haven't made but need to is to provide a timeout in I2C transactions to prevent hanging when the bus is stuck.
Is there a process for testing these changes?
I'm thinking something like unit testing but with hardware. Or is it a question of asking people to beta test and report failures
we have no automated testing. We have worked on that in the past but never got an automated test. For this, I would test BLE, busio.*, etc.
I might struggle to test the SPI stuff, but I think my device uses pretty much all the other peripherals
So if my thingy works, likely most of everything else will. I'm just wary having broken USB MSD with a UART fix!
I'll have a play and submit a couple of PRs - one to nrfx and one to CP.
I've been seeing a lot of safe mode resets when writing to CIRCUITPY today on my pycamera / memento with latest-ish 9.0-pre code.
I have a pile of local changes but none that would affect msc or flash intentionally
if it's semi-reproducible a bisect might be in order. Also there have been a bunch of fixes since 5.1.2 - I was looking through them while debugging something else
i'm currently working on a new library (https://github.com/adafruit/Adafruit_CircuitPython_MCP3421) and stuck on a CI issue. i keep hitting this error:
Run circuitpython-build-bundles --filename_prefix adafruit-circuitpython-mcp3421 --library_location .
Traceback (most recent call last):
...
File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/scripts/build_bundles.py", line 267, in build_bundles
build_bundle(libs, bundle_version, zip_filename, package_folder_prefix,
File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/scripts/build_bundles.py", line 171, in build_bundle
build.library(library_path, build_lib_dir, package_folder_prefix,
File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/build.py", line 301, in library
_munge_to_temp(full_path, temp_file, library_version)
File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/site-packages/circuitpython_build_tools/build.py", line 174, in _munge_to_temp
with open(original_path, "r", encoding="utf-8") as original_file:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/Adafruit_CircuitPython_MCP3421/Adafruit_CircuitPython_MCP3421/adafruit_mcp3421.py'
which makes sense because that file does not exist. the library structure is adafruit_mcp3421/mcp3421.py and adafruit_mcp3421/analog_in.py is there a setting that i'm missing somewhere? i'm looking at the CI script to see if there's something in there. the initial commit passed because it had the cookiecutter structure with that default setup. i deleted that workflow run in case maybe something had been cached but that didn't fix it
I think you need an empty __init__.py in there?
to make that directory a package
When there's more than one py file usually there is a (possibly empty) file that indicates it's a package: adafruit_mcp3421/__init__.py
okay, thank you! i'll add that
and some path may be wrong on part of the setup too?
no idea how this stuff works, but Adafruit_CircuitPython_MCP3421 appears twice, maybe it is pointing to the folder while it should point at its parent (and the library's name gets added)
yeah that's what i was wondering
same error with the included init.py
@candid sun researching, I'll have an answer for you in a moment
thanks!
@candid sun please try changing pyproject.toml: ```diff
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -41,7 +41,7 @@ dynamic = ["dependencies", "optional-dependencies"]
[tool.setuptools]
TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
CHANGE py_modules = ['...'] TO packages = ['...']
-py-modules = ["adafruit_mcp3421"]
+packages = ["adafruit_mcp3421"]
[tool.setuptools.dynamic]
dependencies = {file = ["requirements.txt"]}
ah! i knew it was something like that 😅 thank you!
that did it, thank you @onyx hinge
you're welcome
I played with ruff last night for formatting and linting my circuit python related stuff and it blew my mind how fast it was.
It would require changing the pylint disables to the equivalent style for ruff, but it's speed plus that it combined black, pylint, and for me pydocstyle made it a really good switch. Plus it has a pre-commit hook.
Not sure the libraries would gain much though given pylint and black don't take that much time for something that size, plus it only changes downloading two hooks into one. Plus the changing of linting disables is a pain.
I have also been using ruff in some personal (non circuitpython) software & like it
ruff also auto-fixes more things
Oh that's awesome that it can automatically handle more stuff
https://github.com/jepler/wwvbpy is a modest sized project but when I added ruff it knocked pre-commit time way down https://github.com/jepler/wwvbpy/pull/72 from 11s to <1s
~2400 lines or so
Unable to upgrade ST-Link, need help
@trim lion to get official help with hardware purchased from adafruit, use the forum: https://forums.adafruit.com/viewforum.php?f=19 -- since the product is from ST, you can also use their support methods, which I am not familiar with.
This particular channel in discord is for discussing development (coding) of circuitpython.
Hello @crude blaze I hear you may be back from holiday and that you figured out a good fix for the rotation/offset with the ST7789 display on the pi.
@trim lion you might also look over these matching threads to see if anything there helps: https://duckduckgo.com/?q=site%3Aforums.adafruit.com+st-link&t=ffab&ia=web
DuckDuckGo. Privacy, Simplified.
thank you @onyx hinge
hi yea I'm back to work. Rotation of the display worked fine with the existing drivers, what was still an issue was that the TSC2007 touch driver did not support rotation. I submitted a PR but it looks like Pi might want us to go through upstream first, I need to follow up on their comment.
Ok, thanks. I'll see if I can get the BrainCraft working using the existing driver.
@gilded cradle cool let me upload the overlay somewhere, should mostly need pin changes
Ok
@gilded cradle ah nvm forgot I had already put it into a PR:
https://github.com/adafruit/Raspberry-Pi-Installer-Scripts/pull/280/files
it works fine but the value for the touchscreen probably need some tweaking but for just a screen all is working, its only draft because of the TSC stuff
BrainCraft uses ST7789 rather than ILI9341. Will I need a different overlay for that?
ah didn't realize, yea that needs a different driver.
There is a DRM driver for it but it uses the same compatible string as the fbtft driver so not sure which one would get loaded as both seem to be enabled in the Kernel.
https://github.com/raspberrypi/linux/blob/rpi-6.1.y/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
Otherwise they had recently merged that generic panel-mipi-dbi driver recently where someone had success using that under wayfire with the ST7789V I believe (and also their custom driver but not sure if that got merged into the kernel)
Ok yeah. I've had success with the panel driver, but only if I used X11 instead of Wayland.
then it loaded the fbtft driver in that case
Ah
panel-mipi-dbi seems to be the way to support SPI based drivers in the future, I think you had added a version of that to the pi scripts repo too but now its included "officially" so that makes it easy to use.
There are a couple good threads on the forum by 6by9 and aBUGSworstnightmare on using that with different panel ICs
Ok. Well I'll take a look and try experimenting to see what works. Currently chasing down a separate issue with audio.
Hello, i'm new on programming the lolin s2, which pins are TX/RX? Should i specify any pins as TX/RX like this?
SerialPort.begin(9600, SERIAL_8N1, RXD, TXD);
I finally retested it with 9.0.0-alpha.6, same board: still got the glitches. (I have not proper metric but it feel like there is less of them...)
I notice that we could use the flag ESP_INTR_FLAG_IRAM to allocate the bounce buffer of the RMT peripheral in internal RAM rather than PSRAM. (the IRQ handler is already in IRAM)
Random question... Looking at adafruit_portalbase/network.py there is this method get_local_time that does all this crazy breaking up of "%Y-%m-%d %H:%M:%S.%L %j %u %z %Z" to make a time.struct_time. Any reason it's not something simpler like:
TIME_SERVICE_FORMAT = "%Y,%m,%d,%H,%M,%S,%j,%u,0"
which would return
'2024,01,11,16,50,58,011,4,0'
which we could do:
now = time.struct_time([int(value) for value in response.text.split(",")])
and removing 9 lines of code?
I think that would be fine. The code was probably adapted without rethinking the requirements.
I'll test around with it a bit more and open a PR if it makes sense. Found it when I was looking to do something similar without reinventing the wheel
Hi, I'm working on adding board support for a custom ESP32 board. I managed to successfully configure the files, build the firmware and flash it to the board, but I can't get Web Workflow working. The board is connected to the same wifi as my laptop and I can ping the board, but trying to access it via mdns or directly accessing the ip from a browser doesn't work (tried on Firefox and Chromium on PopOs and Firefox on Android phone). I also attached my settings.toml with replaced ssid and passwords, but it should be the same as the instructions... Any suggestions would be welcome, thanks!
Hi, I'm working on adding board support
CircuitPython version
Adafruit CircuitPython 8.2.8 on 2023-11-16; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3
Code/REPL
import time
import rtc
now = time.struct_time((2024, 1, 12, 21, 51, 40, 4, 12, 0))
print(now)
rtc.RTC().datetime = now
now = time.localtime()
print(now)
Behavior
struct_time(tm_year=2024, tm_mon=1, tm_mday=12, tm_hour=21, tm_min=51, tm_sec=40, tm_wday=4, tm_yday=12, tm_isdst=0)
`struct_time(tm_year=2024,...
New descriptors shall be added to characteristics succesfully now, tested on hid.py from adafruit_ble.
@silabs-ChatNguyen @silabs-BelaV Could you review this? Thanks.
This code resolves the issue related to adding a descriptor to a characteristic.
It looks good and should contribute to the source.
The font Arial-12 is from here: MagTag Google Calendar/fonts
Another weird board. The USB port is detachable.
Looks almost identical to RP2040-Zero, but has less pins exposed.
USB pid:vid pending.
CircuitPython version
Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM with ESP32S3
Board ID:adafruit_qtpy_esp32s3_4mbflash_2mbpsram
UID:4F21AFA53806
Code/REPL
class ClassB:
def __init__(self, bb=None, cc = None, packet_callback = None):
None
class ClassA(ClassB):
def __init__(self, *args, **kwargs) -> None:
super().__init__(packet_callback=self.processReceivedPacket, *args, **k...
Added support for VIDI X board (https://vidi-x.org/). It's an ESP32-WROVER-B based board with screen and buttons similar to Hardkernel ODROID GO.
TODO:
- make new Creator ID and Creation ID
- check why Web Workflow doesn't work
Erreur lors de l'envoi des données: (-8576, 'MBEDTLS_ERR_X509_INVALID_FORMAT')
This is the type of error i get with my program in circuitpython (8.2.9) using PI Pico W and SSL.
SSL is used to secure communication between Pico W and a Flask server running on a Raspberry pi 4.
The certificate looks valid (no weird caracter), was put at the root of the pico W and was generated using this command : openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes.
I don...
I'm affected by this bug as well.
I added a check of the LBA against the drive's capacity in tud_msc_read10_cb and return -1 in case it is out of bounds. With that change, the drive works even with Samsung Magician running.
Could you submit this as a PR? Thanks very much!
it seems this let me pass to next step :
Charger le certificat auto-signé
with open("cert.pem", "r") as cert_file:
cert_data = cert_file.read()
ssl_context.load_verify_locations(cadata=cert_data)
but now i got this message :
Données JSON à envoyer : {'eCO2': 400}
Type d'erreur: RuntimeError
Message d'erreur: Sending request failed
with this
print("Données JSON à envoyer :", data)
# Envoi des données à l'API REST via une requête POST
try:
response = ht...
Hi, can you please help to add this new board?
https://www.cytron.io/p-edu-project-and-innovation-kits-for-pico-w
and also adding new libraries to frozen.
Thanks.
(edited code formatting, hope you don't mind)
Do you get Sending request failed consistently? If not, some retrying could help, or skip until the next loop.
You may want to use the traceback module to get the full exception trace, with the lines in the library where errors occur, something like:
import traceback
# ...
try:
# some stuff ...
except Exception as ex:
traceback.print_exception(ex, ex, ex.__traceback__)
It seems that the error occur due to the new submodule libraries is still not available.
Do I need to PR the new submodule libraries first before adding the board?
someone please reassure me that raising an exception to pass an interrupt from C code to Python code is way too kludgy to even think about
It’d make a lot of code uncertain. If you wanted interrupts in cp, then do it like mp.
What are you trying to do?
it was just a crazy thought
🙂
It seems that the error occur due to the new submodule libraries is still not available.
Do I need to PR the new submodule libraries first before adding the board?
It looks to me like you added the submodules to .gitmodules, but did not actually do a git submodule add for all the new submodules, because the submodules are not showing up https://github.com/CytronTechnologies/circuitpython/tree/add-edu-pico/frozen yet. You shouldn't need to do that in a separate PR, but this PR ...
Looking over the product information it looks to me like this board would work with either the Pico or the Pico W. It seems like the plan is to market it for use with the Pico W but you might want to allow for a future version of the CircuitPython firmware built for the Pico by renaming this port to "Cytron EDU PICO W" and updating MICROPY_HW_BOARD_NAME and possibly
USB_PRODUCT (assuming you can get a unique USB_PID, which I believe Adafruit would prefer)
The Pico version would be very ...
Thank you, it's working. It seems I missed the step to do a git submodule add.
The Grove port table in the datasheet indicates SPI pins for ports 1-6, but I'm thinking those devices don't actually communicate over SPI which would mean the only predefined SPI would be for the SD card which you might want to define as board.SPI
#define CIRCUITPY_BOARD_SPI (1)
#define CIRCUITPY_BOARD_SPI_PIN {{.clock = &pin_GPIO18, .mosi = &pin_GPIO19, .miso = &pin_GPIO16}}
I'm thinking predefined pins for the detachable Grove modules may not make sense as they may not be present or moved between Grove ports, but the motor controls, logging switch and USB Relay output are permanent so you could also add the following pin defintions:
{ MP_ROM_QSTR(MP_QSTR_MOTOR_1_A), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR_1_B), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR_2_A), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_MOTOR...
If you decide to add the board.SD object from the mpconfigboard.h above then you might want to also add the corresponding CS pin definition and to be complete, I would add all the SD card SPI pins:
// SPI Pins for SD Card
{ MP_ROM_QSTR(MP_QSTR_SD_MISO), MP_ROM_PTR(&pin_GPIO16) },
{ MP_ROM_QSTR(MP_QSTR_SD_CS), MP_ROM_PTR(&pin_GPIO17) },
{ MP_ROM_QSTR(MP_QSTR_SD_SCK), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_SD_MOSI), MP_ROM_PTR(&pin_GPIO19) },
These will define the actual board.SD_SPI and if perhaps adding the board.I2C device would be useful since some of the Grove devices would use it.
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) },
{ MP_ROM_QSTR(MP_QSTR_SD_SPI), MP_ROM_PTR(&board_spi_obj) },
Thanks for the wonderful suggestion to improve the pin definition. I will update it.
Looking over the product information it looks to me like this board would work with either the Pico or the Pico W. It seems like the plan is to market it for use with the Pico W but you might want to allow for a future version of the CircuitPython firmware built for the Pico by renaming this port to "Cytron EDU PICO W" and updating MICROPY_HW_BOARD_NAME and possibly USB_PRODUCT (assuming you can get a unique USB_PID, which I believe Adafruit would prefer)
The Pico version wou...
Thanks you Anecdata !
Yes consistently. I thought of a timeout issue or something...
Pico work i can connect to network and send ping to google for exemple.
It seems i have issue with this : response = http_session.post(url, json=data) in ssl context (https)
I simplified the data check the format of the data.
I will try your proposal. I fi can't see clearer i will go to http to see if it works.
Thanks again
here is the result of the traceback :
Connected to WiFi
Type de temperature: <class 'float'>
Température: 28.8 C
Type de co2eq: <class 'int'>
CO2eq: 400 ppm, TVOC: 0 ppb
H2: 13815, Ethanol: 19668
Données JSON à envoyer : {'eCO2': 400}
Type d'erreur: RuntimeError
Message d'erreur: Sending request failed
Traceback (appels les plus récents en dernier) :
Fichier "adafruit_requests.py", ligne 515, dans _get_socket
OSError: (-9984, 'MBEDTLS_ERR_X509_CERT_VERIFY_FAILED')
L'except...
Not sure what is going on, but Weblate seems broken to me.
- It stopped mailing me notifications.
- The suggestions tab is totally broken.
Loads of the suggestions is just "%" or similar nonsense.
Is this a known issue? We are looking into using weblate in another open source project.
We didn't know about this but will look into it -- thanks!
Did you get it to work? I see https://github.com/adafruit/circuitpython/pull/8801
yikes I had not realized how close to full esp32s3 4MB parts are.
bitmapfilter is only ~7kB but it's enough to overflow qtpys & feathers -- camera fits but only because of stuff like audio being turned off.
<@&356864093652516868> just a reminder -- there is no meeting today due to the obervation of Martin Luther King Jr. Day. We will meet 24 hours later than usual this week.
I think this may be due to big growth in ulab from gcc 13. I think this is still unresearched. https://github.com/v923z/micropython-ulab/issues/648
Not sure but I think my question is too technical for #help-with-circuitpython : does AESIO takes advantage of the hardware on ESP32s and is it compatible with python3 aes decryption?? From: https://github.com/adafruit/circuitpython/blob/a501a21887e87cead1a37a9a3ced609a67b7801c/shared-bindings/aesio/aes.c it would seems not but maybe Im missing something
Im not seeing #defines for esp32 that is why I dont think it takes advantage of flash memory encryption aes and/or aes hardware acceleration features on the esp32s
@tulip condor our implementation of aesio is in https://github.com/adafruit/circuitpython/blob/main/shared-module/aesio/aes.c and is just a software C implementation. It does not use microcontroller-specific facilities to work.
I don't think the module's API is compatible with CPython. However, it should comply with the AES standard. We test it against several test patterns from the AES specification in tests/circuitpython/aes.py.
aesio vs pycrpyotodome: ```py
CircuitPython:
import aesio
key = b"Sixteen byte key"
inp = b"CircuitPython!!!" # Note: 16-bytes long
outp = bytearray(len(inp))
cipher = aesio.AES(key, aesio.MODE_ECB)
cipher.encrypt_into(inp, outp)
outp
bytearray(b'\xab\xb1\xa1\xf9\x8fW@\x9eEZ\xc0nqS_\xfe')
Python3 with PyCryptoDome:
from Crypto.Cipher import AES
key = b'Sixteen byte key'
inp = b"CircuitPython!!!" # Note: 16-bytes long
outp = bytearray(len(inp))
cipher = AES.new(key, AES.MODE_ECB)
cipher.encrypt(inp)
b'\xab\xb1\xa1\xf9\x8fW@\x9eEZ\xc0nqS_\xfe'
thanks a lot !
if you want to dive into low level microcontroller code and add support for AES instructions, that'd be awesome. it's just not anything we've prioritized yet.
For espressif it looks like "just" shifting to using the mbedtls implementation of AES would get you hardware AES support. Which might be a good idea to do in general, similar to how it was done recently with hashlib
hum Id have to figure out first if it is supposed to be used directly. It is in the mbedtls implementation of esp-idf but it's not used directly. Even the arduino esp32-arduino library dont use it
Also using flash encryption has a lot of side effects and is irreversible
CircuitPython version
Main branch
Code/REPL
import sys
print(sys.version)
Behavior
It reports back 3.4.0; MicroPython 9.0.0-alpha.6-17-g2c453390ec on 2024-01-09.
Should this really be left to be reported as MicroPython?
Shouldn't it be something like:
3.4.0; CircuitPython 9.0.0-alpha.6-17-g2c453390ec on 2024-01-09; M5Stack Timer Camera X with ESP32?
to match the repl prompt somewhat?
If this is intentional feel free to immediately c...
No, those were fully manual translations.
@cobalt grail If the weblate website isn't working properly for you, it's appropriate to open issues on weblate's github: https://github.com/WeblateOrg/ -- you can mention that you are using CircuitPython which is a paid account, not sure if it makes a difference to how they triage issues. It seems they did change something about e-mail notifications recently: https://github.com/WeblateOrg/weblate/pull/10659 it was supposed to work the same as before but you might just go look at your profile and check the notification settings anyway..
fwiw I also see problems with automatic suggestions from libretranslate, suggesting just "%" as a translation. oof.
As for translations, I guess ...
There used to be a site-wide configuration at Hosted Weblate, but it is now gone for several reasons. So the project has to configure own if it is desired to use machine translation. https://github.com/WeblateOrg/weblate/issues/9689
I have deactivated LibreTranslate as we do not have an API key for it.
So what translation services are supposed to be working?
none.
Oh, there were a bunch of them when I first started to use Weblate.
It seems like they've found them too costly to provide, or something. Personally, I have no idea if it's helpful or unhelpful. Sounds like you found it helpful, though. When you used it, was there one translation service that was better than the others? I can check into price and find out if Adafruit wants to pay for a translation API key on an ongoing basis.
that is, "[hosted weblate] found them too costly"
Not sure which ones was available, but there was two that was helpful. Mostly needed it when the error message used an unfamiliar term. If I recall correctly it was the Google and Microsoft services.
Yeah, used to get errors from time to time, I guess that was rate limiting in action.
seems that adafruit could self-host libratranslate
there is a flag to enable api keys or not that probably means that libretranslate is charging the bandwidth to do this which isnt a problem if self-hosted
Really minor typo in the README. The line
./esp-idf/export.sh
is missing the source or . command, so the environment variables it sets would only be set in a sub shell and wouldn't affect the current shell as is necessary for this to work. I used source here as it's clearer and looks less like a typo.
besides pins availability / hardware capability what detrermines what modules are available for a board ? Is it the way the shared modules are included or not for each board as well? Does this mean one could recompile the circuitpython image for a board with some libraries the official download doesnt provide and without some libraries the official download provide ? I assume that if a board has X amount of space in KB that some choices have to be made for its circuitpython image ?
Flash, RAM, port / board capabilities, (and whether a specific feature has been ported), determine what modules are included. Yes, decisions are made when flash (or RAM requirements) are constrained (which is often). Custom builds are possible to delete some modules and add others, provided the other constraints are met.
so if I dont see some defines for a board in the init.c/init.h or even an include of board.h or the board supervisor or the pins macros used are available according to my board config file (mpconfig and pins.h) I could assume the module doesnt have any board-specific limitations and it's just a question of including it on the image ?
Someone else will have to answer that one. But my general sense is that when possible, if flash permits, all applicable ported modules are included. When flash doesn't permit, some priorities had to be decided to include some modules at the expense of other(s).
Separate question... I'm a little confused (or recall wrong) about some info on https://github.com/adafruit/circuitpython/tree/main/ports/espressif for ESP32-S2 and ESP32-S3:
It says pin 20 (D+) and pin 19 (D-) are used:
to access the CircuitPython drive
and that
A USB to UART converter can be used for connecting to ESP32-S2 to get access to the serial console and REPL and for flashing CircuitPython.
using pins 43 (RX) and 44 (TX).
But doesn't the drive and normal serial console / REPL both use the native USB, and the USB-to-UART is for the debug console (and flashing) and not the REPL (at least in standard builds)?
I see . By porting I guess someone would have to write it in esp-idf so that it works on esp32. So if it's not in the image it may simply mean that nobody has ported it yet for that platform not necessarily that the esp32 cant run it
or in whatever api/sdk the samd21 uses in its firmware
if it's ported, there will be something in common-hal (or in shared-modules if it doesn't require port-specific code)
shared-bindings (the common API as documented in readthedocs) will typically make calls to common_hal_{something}, and those functions are (usually) either in common-hal (or shared-modules)
I tested on the EFR32xG24 Explorer Kit and was able to complete the ble hid function normally.
Thank you for your work! @picospuch
Looks good to me, I don't have the hardware to test but I did load the artifact up on a Pico W and it seems to work fine (except for Web Workflow but I think that may be related to a separate issue reported in a current discord thread, WiFi works fully except for the Web Workflow page, tomorrow I'll see how reproducible the problem is and if I can track it to a particular merge).
in case anyone is here from vim/neovim land trying to find board specific stubs.
you can also find your board in this project under ports. i.e. /ports/raspberrypi/boards/adafruit_kb2040
and find the pins definition to just add a few more type stubs to the typings/board-stubs/__init__.pyi where needed.
import microcontroller
D6: microcontroller.Pin
D9: microcontroller.Pin
def STEMMA_I2C(): -> busio.I2C:
...
kind of hacky but i've just been spending 3 minu...
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CIRCUITPY drive could not be found or created.
Press reset to exit safe mode.
Adafruit CircuitPython 9.0.0-alpha.6-42-g029c6c2f0c-dirty on 2024-01-16; posix with amd64
>>> print(3+3)
6
>>> ^C
```It's not _actually_ working yet but it's close!
It's becoming more and more of a hack to incorporate some circuitpython modules into the "unix" port for testing purposes, so this is an ongoing attempt to build something that runs on a POSIX system but is built "just like circuitpython".
<@&356864093652516868> The weekly meeting is set to occur here on discord in about 30 minutes. We're on Tuesday this week due to the US holiday yesterday. We look forward to seeing folks for the meeting!
Notes doc is in the pinned message feel free to fill in status updates / hug reports before the meeting if you can.
Extremely useful design documentation. Nice overall UI design, too.
when you have many labels, are they in a subgroup?
some are main groups only, some are subgroups but overall yes. remove and append makes a performance difference.
hrm, so hidden stuff is costly still
Oh no! Have you fully recovered?
as of yesterday yup feeling much better.
What is a Pico B2? Haven't heard of that one.
could be a version
thanks @lone axle !
Thank you for hosting @lone axle
Welcome back @slender iron hope everything is going well
thanks! excited to dig into CP things again
Here is the notes document for next Monday’s CircuitPython Weekly Meeting. It is at the normal time of 11am Pacific / 2pm US Eastern here on Discord. Add your hug reports and status updates to the document before the meeting. If you are unable to attend but would still like to contribute, feel free to add your notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1hvExFQWMsV78bORs1uBxon_bncchrHPV96r4cAWEhcA/edit?usp=sharing
Would next week be a good time to talk about the connection manager?
@slender iron RP2040B2 is a hardware revision to the RP2040. It fixes two issues with USB ("USB device fails to exit RESET state on busy USB bus." and "USB device endpoint abort is not cleared.") This is described in the "Errata" section of the RP2040 datasheet (See section "4.1.2.6.5. Errata") And these issue I believe have work-arounds in the Pico-SDK
Had no idea. Thanks!
As an extra: B1 (second version) has a software fix on the SDK for an issue too, not sure if one of those or a third one
I should be around
Yay, I just marked bitmapfilter out of draft mode.
Looks good overall! Just a couple questions. No major concerns about the division between bindings and implementation.
Are these names consistent with something like imagemagick? Maybe example image magick commands should be put in the docs. Inline images would be awesome too.
//| according to the ``weights``. Then a scaling factor ``mul`` and an
//| offset factor ``add`` are applied.
I don't plan on adding two highlight color support anytime soon because Adafruit doesn't currently carry the display.
I suspect you'll need to copy over the IDF functions we use so they are both available at compile time until espressif fixes it. I'd suggest filing an issue with them about making the API work dynamically like we use it.
I am very impressed with how the USB host keyboard works. For my CNC project, I needed to add the ability to work with the function keys f1-f12, ctrl-left, ctrl-right, ctrl-up, ctrl-down, page down, page up, insert, delete, etc. in the format of command VT 100. Offer my modified code "supervisor/shared/usb/host_keyboard.c"
host_keyboard.c.txt
it seems that the page here: https://circuitpython.org/contributing/library-infrastructure-issues hasn't updated for a few days or a week-ish. Many of the librariers listed as having new commits since the latest release do actually have releases that are more recent than their newest commits. The release date shown on the page is isn't accurate for the actual latest release on them.
Adabot has a newer version
I've reworked how locking is managed. IIRC I tested the web workflow side with the rework but not BLE. Marking ready for review because the code should be close.
Looks like dynamic service support has been added to ESP nimble and is in IDF 5.1.2: espressif/esp-idf@94ad8f1
@tannewt I saw you managed to get IDF 5.1.2 into CircuitPython 9.0.0-alpha.6 🙇 so I went to give it a try and spotted that for the Seeed Xiao ESP32C3, it's now missing the _bleio module that was previously in 8.2.9 and is needed for BLE .
I did but I haven't improved bleio on ESP...
Could you submit this as a pull request? There are directions here:
https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
This is not intentional, and is probably due to a merge mistake when we merged from upstream.
Great. I'll add it to the weeds...
When you set the RTC, the number of seconds since some start date (the "epoch") is recorded. All the other info is discarded. One of tm_isdst's main uses is to disambiguate times that fall near the boundaries of the date-time when DST starts or stops. See https://stackoverflow.com/a/47333019/142996.
Since the timezone and location info are note saved in the RTC, the DST state is not really interesting. You could save the timezone and location info if needed. Note that the timezone does n...
I also see this issue on a Magtag under certain circumstances. I tested a few different things with somewhat perplexing results.
This basic label test adapted from the code pasted above does seem to reliably reproduce the issue. When this runs the display does not refresh at all. It will continue showing whatever was on it previously. It does print "after refesh()" but nothing happens on display
import time
import busio
import board
import displayio
import fourwire
import adaf...
Thanks Tim!
What is your use case where the current scheme does not work so well?
After a little more tinkering and testing I think that this line is somehow relevant to the behavior.
FONT = load_font("/fonts/Arial-12.pcf")
I found that if I comment this line out and use the built-in font the label will show properly.
I also tested commenting this out and showing a blank Group, and CIRCUITPYTHON_TERMINAL which both also showed successfully while this line was commented out.
I took a guess that maybe somehow clobbering the name FONT could be proble...
Hey, I have not been able to get the drivers working. I tried the 2.2" PiTFT with the pitft22 overlay first and that initializes the display and makes it black, but nothing is displayed. Next I tried compiling the overlay you may for the pitft 2.4 with a tsc2007 wired up using the gpios specified in the overlay, but it remains white. Any tips?
if it remains white that usually means unitialized. Which Kernel version are you working with? Might need to run an rpi-update. Some of the latest display changes were only merged recently after the latest release
I'm using 6.1.0
I'll try updating
ah okay, I've only tested on 6.1.65 so far. Maybe thats it
It just updated to 6.1.72
newer than 65 should be fine
Still nothing on the 2.4". I'll try the 2.2".
you might need to do a cold boot with power removed. I had some issues during development with warm reboots where there was no power cycle of the display
Ah, I'll try that next. I just hooked up me 2.2"
Same deal on 2.2". I'll try 2.4" with cold boot.
@crude blaze ok, 2.4" initialized from a cold boot, but no desktop on display. Basically same as 2.2".
do you have an HDMI display connected at the same time?
then make sure you have
dtoverlay=vc4-kms-v3d
max_framebuffers=2
but its default in newer distro releases
Yeah, that's the settings I have in my config
I'm double checking my wiring. Weird that the 2.2" inited the 2.4" but the overlay with correct gpios is still white.
if it stays white then I would double check wiring and maybe double check that the overlay is unmodified. Otherwise unsure what the difference could be
🙂