Looks like None is the correct default value. We must not handle it quite right internally.
#circuitpython-dev
1 messages ยท Page 28 of 1
@DavePutz seems like we may not want to take bytes from the socket if the ringbuf is full.
- Update the
gifio.OnDiskGifexample and documentation. - Update
DisplayandEPaperDisplayto note thatshow()is deprecated.
@slender iron I'm having some issues with nrfutil -- the version I have is old (looking for python 2) did you install it via homebrew (on a mac) or via pip?
nrfutil on pip requires python 3.10 or lower
nrfutil 7 is actually a direct download from nrf
so that's what the CI does
hmm -- I'll take a look
OK -- now have a .zip --- took a few gyrations but now to attempt to load it.
first I have to find my bangle2 ...
This split-string translate() message is not printed when I exercise this error. Instead I just get AttributeError:.
https://github.com/adafruit/circuitpython/blob/8e4626ffba19a8cc18b6e80693f8b6429fbbd91f/shared-bindings/pwmio/PWMOut.c#L273-L275
There may be others like this.
I think we cannot split these due to some limitation in the translation processing?
I did some simple testing on an i.MX 1010 EVK (good grief, why can't they label the pins?). Seems to work fine. I found an unrelated problem by accident (#7661). It was also confusing that the "X" PWM pins can't go to 100% duty cycle. We should document this thoroughly and/or have an explanatory error message.
Look forward to this in 8.1.0-beta.0!
nice! I use file glider on ios
and bluefruit connect for the repl
the testflight versions will be better
not sure what is in the app store now @solar whale
I'll give those a try
my watch keep buzzing every few seconds..is that expected?
Glider or Bluefruit connect don't seem to be able to connect. keep disconnecting..
ok - Bluefruit connect sees it, but wont connect
are you using the testflight of glider?
did you try code.circuitpython.org ?
I think that should work
I think the iOS apps are easiest if you are like me and want it connected to your phone for notifications
I tried.. but no luck -- yet
you should be able to connect through nrf connect too
the latest glider can see existing connections
I will try reloading CP to it
what does the status bar at the top say for BLE status?
Reconnecting
ah, ok. that means it thinks its connected once already
did it connect to your android already?
at one point
you should be able to hold the button to reset CP and then press it during the fast pulse (think fast blue flash) to have it publicly advertise again
the hold is 10ish seconds
it went to safe mode ??
that'll happen if you press too early after the restart
wishes it had a status rgb led
hrm, did you get the testflight version? that's what I'm using
yes
hrm, what does the setting > bluetooth page say? what does CP say?
where? glider (and nrf connect) say "peer removed pairing information)"
yay! glider is in !!!
๐
very cool !
we have improvements to bluefruit connect for the repl
are you planning on using it day-to-day or just trying it?
I don't think I posted my code anywhere
I'm looking. I'm not sure if its setup
ok -- no worries -- I did not mean to tie you up. I can play with glider.
got it
build 55 should have just been pushed
there is a terminal mode in the uart settings
did you select terminal mode?
yes finally -- thanks for the demo code -- I think I can work with it now. Thanks for being patient.
after selecting terminal mode I also changed the EOL character to "\n\r"
this is very cool!
ya, its a weird wireless world
Thanks, trusting git to merge changes up properly and signal us if there are conflicts...
anyone with library experience know what this issue is? https://github.com/adafruit/Adafruit_CircuitPython_ACeP7In/actions/runs/4297284805
thanks @onyx hinge!
doc changes don't need a release
(or is it pulled into stubs?)
๐
@slender iron Are these fonts availble somewhere self.font64 = bitmap_font.load_font("share_tech_64.bdf") self.font64.load_glyphs("0123456789:") self.font32 = bitmap_font.load_font("share_tech_32.bdf")
Thanks -- Is there a way to upload a whole directory via glider -- or does it have to be one file at a time?
open the files app
glider makes the FS available there (and any other app that can read from the files app)
very nice!
so much to learn!!
๐
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.4-32-g6bec65833b-dirty on 2023-02-28; Adafruit Feather RP2040 with rp2040
Code/REPL
# example from adafruit_circuitpython_floppy repo
Behavior
Traceback (most recent call last):
File "", line 1, in
File "floppy_vfs.py", line 41, in
OSError: [Errno 19] No such device
(because data read back as all zeros instead of correctly decoding mfm)
Description
No response
##...
Progress
in the pic it doesn't look right
don't think so
any library person want to review this new guide page on pypi secrets? https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/setting-up-pypi-secrets-2?preview_token=gO04kJJYe1ceVmGSwwRZWA
Getting notifications nowโฆ still something odd with the time. Still pretty impressive
I wonder if those are old font files
I just grabbed them off my comp
not my watch
they do just seem to be too large
Off watch
larger than in your picture.
one step at a time!
thanks so much for the code -- it will make it so much easier to try things.
When I used notification on the bangle2 espruino code, it kept crashing -- I'm looking forward to seein ghow this runs.
nice!
I've seen some hangs on disconnect
and I poke it by "writing" boot_out.txt from glider
I've been meaning to debug that
it doesn't happen so often that its unusable
if the battery dies completely it may start in safemode because it doesn't see the flash
you can get to the repl to restart then though
I spend months using SWD to get out of safemode ๐
Does it jsut should the last notification?
OK
but you can change it ๐
I need to read the code ...
yup!
This has been a great start! I have to go offline, but thanks so much for the help. I'll let you know what I can break ๐
@onyx hinge what do you think of: ```
512 bytes used, 0 bytes free in FLASH_CONFIG out of 512 bytes (0.5kB).
48 bytes used, 4048 bytes free in FLASH_IVT out of 4096 bytes (4.0kB).
483516 bytes used, 515908 bytes free in FLASH_FIRMWARE out of 999424 bytes (976.0kB).
0 bytes used, 7340032 bytes free in FLASH_FATFS out of 7340032 bytes (7168.0kB).
0 bytes used, 0 bytes free in RESERVED_FLASH out of 0 bytes (0.0kB).
22396 bytes used, 43140 bytes free in OCRAM out of 65536 bytes (64.0kB).
23776 bytes used, 8992 bytes free in DTCM out of 32768 bytes (32.0kB).
7376 bytes used, 25392 bytes free in ITCM out of 32768 bytes (32.0kB).
that's a lot to digest!
it makes me wonder about putting it in json instead so we can look at it with tools
ya, I should figure out how to output a table
can totally do json too
considered progress bar style too
could do mm/nn used (xx%) would be more compact
json output could be written to a standard filename
I also know the sections like .text, .dtcm_bss etc
512/512 100.0% FLASH_CONFIG
0x60000400 512 .flash_config
48/4096 1.2% FLASH_IVT
0x60001000 48 .ivt
483516/999424 48.4% FLASH_FIRMWARE
0x600820ac 8 .ARM.exidx
0x6000c000 483500 .text
0x600820ac 8 .ARM.exidx
0/7340032 0.0% FLASH_FATFS
22396/65536 34.2% OCRAM
0x20200000 2364 .data
0x20201000 20032 .bss
23776/32768 72.6% DTCM
0x20000400 2272 .dtcm_bss
0x20000ce0 20480 .stack
0x20000000 1024 .dtcm_data
7376/32768 22.5% ITCM
0x0 7376 .itcm
and I'm double counting exidex
if you wrote json, we could have a CI step that says, "hey this build is getting dangerously low", I think that's what you might have had in mind? Write json and then have another pretty-printing script that produces output like the above from the json
my main goal was to show all the regions, not just flash and ram generically
logging it somewhere would be neat
would it be horribly complicated to have all of that inserted in a database, with git hash, board ID and language, so we can do comparisons ?
running the db is probably the hardest part
this is what the linker prints: Memory region Used Size Region Size %age Used FLASH_CONFIG: 512 B 512 B 100.00% FLASH_IVT: 48 B 4 KB 1.17% FLASH_FIRMWARE: 494272 B 976 KB 49.46% FLASH_FATFS: 0 GB 7 MB 0.00% RESERVED_FLASH: 0 GB 0 GB OCRAM: 24128 B 64 KB 36.82% DTCM: 23776 B 32 KB 72.56% ITCM: 7376 B 32 KB 22.51%
looks more correct than mine ๐
@onyx hinge Just curious when you were writing a GIF directly to the display did you just handle it direct via SPI with the commands and all?
@blissful pollen did you see the gist link? It's making calls on the display bus object
I missed it earlier but see it now, thanks! Just curious and wanted to try it out
https://gist.github.com/jepler/074aa1d7d8991be612db12fed06617c4
display_bus.send(42, struct.pack(">hh", ow, d.width + ow - 1))
display_bus.send(43, struct.pack(">hh", oh, d.height + ow - 1))
display_bus.send(44, d.bitmap)
d.next_frame()```
so for many common displays those codes (42/43/44) are consistent and set the bounding box of the area to write and then accept the data in RGB565_SWAPPED order
Thanks. Didn't think to just send via the display bus.
* Add --error-handling-script=<NAME> command line option to allow a helper script to be invoked when an undefined symbol or a missing library is encountered. This option can be suppressed via the configure time switch: --enable-error-handling-script=no.
Increases drive strength of 32kHz external crystal (LSE), in line with calculations specified in ST AN2867 sections 3.3, 3.4, and STM32L4 datasheet DS12023 Table 58. LSE oscillator characteristics.
The drive strength RCC_LSEDRIVE_LOW is marginal for the 32kHz crystal oscillator stability, and RCC_LSEDRIVE_MEDIUMLOW meets the calculated drive strength with a small margin for parasitic capacitance.
I don't see any default value for BOARD_LSE_DRIVE_LEVEL defined anywhere. There should be a default or all the other STM32L4 boards will fail to compile.
@tulip sleet @onyx hinge ok. not sure where I should go with this region stuff
ld 2.40 looks to fail correctly now
but it doesn't print free bytes itself
is what you are printing now good enough? json would be nice but it's a lot of work
json is easy to print but doing something with it is hard
I've gotta make my script work for all ports because its parsing the linker script
to get the memory regions, their offset and length
it's parsing the linker script or the linker output you pasted above?
@proven garnet do you know if there is setup that needs to be done for the 'upload-release-assets to github' actions task in new libraries to be able to run successfully? This one https://github.com/adafruit/Adafruit_CircuitPython_ACeP7In/actions/runs/4297284805/jobs/7490060429 reports an error Error: Input required and not supplied: upload_url
It seems like it should come from here: https://github.com/adafruit/workflows-circuitpython-libs/blob/3d93baee6d79e829cf6dd463decd1d5fd6031f6c/release-gh/action.yml#L59 but I'm not certain where this inputs object comes from when it runs in the actions container.
Can you just have a specialized script for that port? I'm not sure why it has to work across all ports, beyond what we have already
you could have a script per port
or an optional script per port, so you only have to write one for now
I'd rather have something consistent
getting the .ld's to be consistent is a big job, is it worth it?
the different ports have different memory architectures, may be hard to generalize across them
I don't think it'll be super bad
its all done at the memory region, section and segment level
i am just thinking about whether it is worthe the effort. You could say that we should have one Makefile for all ports also, instead of port/*/Makefile, but we don't. Sure it would be nice, but it's not getting in our way
i had a scrum manager who always cautioned us against doing unnecessary work
that's why I'm considering removing the memory info step all together
but I don't want less information, it's useful
ya, missing free bytes would be annoying
print what you need to now for i.MX, it's already working, you don't have to refactor it now
I modified the existing file ๐
put it back and copy and rename it ๐
I don't think its much more work to get it going for other ports
it's your time ๐
but don't give me less info than I have now. I mean i don't care about both free and used, etc. I can do arithmetic
but I want to know how full stuff is
Memory region Used Size Region Size %age Used
FLASH_BOOTLOADER: 0 GB 8 KB 0.00%
FLASH_FIRMWARE: 250488 B 253696 B 98.74%
FLASH_FILESYSTEM: 0 GB 0 GB
FLASH_CONFIG: 0 GB 0 GB
FLASH_NVM: 0 GB 256 B 0.00%
RAM: 12352 B 32 KB 37.70%
is what the linker would give us
just have to add a flag
that's metro m0
that's not terrible, though it is nice to have the free bytes there immediately.
What does it print on overflows?
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: build-metro_m7_1011/firmware.elf section `.data' will not fit in region `OCRAM'
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: build-metro_m7_1011/firmware.elf section `.data' will not fit in region `FLASH_FIRMWARE'
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: region `FLASH_FIRMWARE' overflowed by 19152 bytes
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: region `OCRAM' overflowed by 482880 bytes
/usr/lib/gcc/arm-none-eabi/12.2.0/../../../../arm-none-eabi/bin/ld: warning: build-metro_m7_1011/firmware.elf has a LOAD segment with RWX permissions
Memory region Used Size Region Size %age Used
FLASH_CONFIG: 512 B 512 B 100.00%
FLASH_IVT: 48 B 4 KB 1.17%
FLASH_FIRMWARE: 1018576 B 976 KB 101.92%
FLASH_FATFS: 0 GB 7 MB 0.00%
RESERVED_FLASH: 0 GB 0 GB
OCRAM: 548416 B 64 KB 836.82%
DTCM: 23776 B 32 KB 72.56%
ITCM: 7376 B 32 KB 22.51%
I do find it a little weird that sometimes we just see negative bytes and sometimes we see an error. I don't know why it can do either
we added the script because the linker used to be wrong
but I have 2.40 and it looks right
(it didn't use to count .data into flash)
ah, I thought the script was modified from micropython
I'm modifying build_memory_info.py
I wonder if we're failing builds we don't need to...
the 10.x toolchain still has 2.35. We are not all on arch
I'm not sure when it was fixed
can you test with the 10.x toolchain?
I'm looking at the ci output now
Also suspect that the delay leads to DC motor "rattling" when establishing a new motor speed at low PWM frequencies since the two PWM control pins aren't changed simultaneously.
@proven garnet I think I figured missing upload_url thing out. It was needed one additional line in the workflow file to set that variable. I think I understand now how the inputs come in from the with of the parent action thing
@slender iron I submitted PRs to both 7color einks that I think will let that release action succeed after merge + new release.
$ arm-none-eabi-ld -v
GNU ld (GNU Arm Embedded Toolchain 10-2020-q4-major) 2.35.1.20201028
``` this can still get negative bytes free according to our measurement script
@tulip sleet @slender iron the negative free space thing is still a thing
sorry, which one are you talking about using? I thought you were wanting a test with the 10.x toolchain
I'm trying with 12.2
.github/actions/deps/external/action.yml: release: '10-2020-q4'
OK I was answering about the one currently used in CI, I thought it was the test dan asked for
yup, it is
I'm gonna push a test with 12
it may not have fit because of this fix
humm our ci is still on 20.04? we should bump it while we're going up in versions of things
It is defined in ports/stm/boards/swan_r5/mpconfigboard.h since it is a board-specific property. Adding a default is potentially dangerous since it depends on the characteristics of the baord.
At present, only the Swan R5 board is based on the L4. As new boards are added, they will need to define the correct drive level that is calculated from the board characteristics. If a new board doesn't define this symbol, the [error message produced](https://github.com/adafruit/circuitpython/pul...
Would a high drive level be safe? How did you determine the level you needed?
Or is high drive potentially damaging to some crystals?
What I am thinking about is that if a board is based on a reference design with the reference crystal, the drive level is known. I see that F7 and H4 boards also have a default of "low". It sounds like your board is different. But a vanilla board could work with "low", if that's what's fine for the reference design. Otherwise someone starting to port a new board will have to figure this out. That's why I'd rather have a safe default. If it doesn't work, then they can change it.
ok, so I don't think this is a fixed bug
its a difference in behavior depending on the link script
If you do .data: AT(previous_location) it doesn't work. but if you do } > RAM AT> FLASH at the end of the section, it does
hmm, are they supposed to do the same thing, that's weird
Ah sorry, I was in class. Yup! Sounds like you got it.
Automated website update for release 8.1.0-beta.0 by Blinka.
New boards:
- lilygo_tembed_esp32s3
- espressif_esp32_lyrat
- adafruit_huzzah32_breakout
- espruino_banglejs2
- hack_club_sprig
- cosmo_pico
Unfortunately, finding out that it doesn't work can happen quite far down the road, as was our case. (And is mentioned specifically in the opening of the application note. I didn't personally do the calculations needed so can't answer how MEDIUMLOW was arrived at, but it was found to give better stability and is something specific to the Swan R5 boa...
Notable changes to 8.1.0 since 8.0.0
- Add animated GIF support: gifio.OnDiskGif.
- Add safemode.py, for programmatic handling of safe mode.
- Add 7-color e-ink display support.
- Allow setting pystack size in settings.toml.
- Add dither support to Palette.
- Support array.extend(iterable).
Built on an ESP32-S3-DevKitC-1-N8R2. The crash limit was actually a little higher but I haven't spent any time looking at that yet. I set the pystack size to 3600 and got the following trackeback:
***ERROR*** A stack overflow in task main has been detected.
Backtrace: 0x40378646:0x3fcf2da0 0x4038262d:0x3fcf2dc0 0x40385daa:0x3fcf2de0 0x403843b0:0x3fcf2e60 0x403826dc:0x3fcf2e90 0x403826d2:0x2d797063 |<-CORRUPTED
ELF file SHA256: 199f30faa96abdc6
CPU halted.
I tried ...
One interest would be to print out the memory address that are allocated to see what they are near.
I'm not real fluent in c++ pointer addresses but I used the following to print what I'm hoping is the pystack memory address:
mp_printf(&mp_plat_print, "Pystack address %d",(mp_int_t) pystack); and got the following: Pystack address 1070215376
Yea, I thought that might be important ๐
Once you have a stack overflow I suppose it's not surprising that the backtrace get's corrupted....
oh make translate does actually warn about the \r
main.c:146: warning: internationalized messages should not contain the '\r' escape sequence
Do you think there would be any traction for adding a 'castellated pads' feature to the .org board data and filters?
There seem to be at least 40 boards with them.
@slender iron having fun with the watch. I changed it to a 24hr time and have been fiddling with the msg priorities. Also raised the backlight to 2**15. I could not see it at 2**8. Lots more to explore!
Hello, I did not test this with the original workflow. Instead I used the one provided in the https://github.com/adafruit/circuitpython_jupyter_kernel/blob/master/examples/using_magics_and_nbdev.ipynb example. Instructions for installation are provided. I used the following script fromthis learning guide: https://learn.adafruit.com/mqtt-in-circuitpython/connecting-to-the-adafruit-io-mqtt-broker
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Iden...
CircuitPython version
Adafruit CircuitPython 8.0.0-rc.1 on 2023-01-30; Adafruit QT Py ESP32S2 with ESP32S2
Code/REPL
Adafruit CircuitPython 8.0.0-rc.1 on 2023-01-30; Adafruit QT Py ESP32S2 with ESP32S2
import time
import board
import digitalio
import busio
from adafruit_hid.mouse import Mouse
from usb_hid import devices
import time
# time.sleep(3) # ??? needed delay at start to not crashy-crashy
SCALE = 1
mouse = Mouse(devices)
spi = board....
Adding the capability to use WAV files in bytes format with audiocore.WaveFile would be extremely useful. Currently, this feature is not available, as audiocore.WaveFile only accepts either a file object or an object path.
@solar whale great! The backlight was that dim because I was using it in a completely dark room with a baby. ๐
only one build overflowed with the newer toolchain: https://github.com/tannewt/circuitpython/actions/runs/4298636837/jobs/7493054457#step:10:31
the msgpack module does this, seemingly to check the byte order and swap if not big endian, couldn't that be done with a #if ? Or is it already done elsewhere ? (I'll look in the struct module)
STATIC uint32_t read4(msgpack_stream_t *s) {
uint32_t res = 0;
read(s, &res, 4);
int n = 1;
if (*(char *)&n == 1) {
res = __builtin_bswap32(res);
}
return res;
}
couldn't that part with n just be #if MP_ENDIANNESS_LITTLE ?
This also updates the M7 Metro.
This will save space on boards that have an existing display and are unlikely to have an external epaper display (like pew pew m4).
I did this update in a branch and only one build is too big: https://github.com/tannewt/circuitpython/actions/runs/4298636837/jobs/7493054457#step:10:31
I looked at sizes between current toolchain and what you are using. Most builds are 500-700 bytes larger with the new toolchain. Weirdly RP2040 is about 4k bytes smaller. Maybe something is not being counted
was rp2040 double counting .data?
no idea
and the second stage bootloader is very small?
or is it about 4k (I have another memory it's 256 bytes -- maybe both are wrong)
second stage is 256 bytes (252 + 4 checksum)
I should test the size command
I didn't actually verify its behavior varies
only that --print-memory-usage varies
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
Memory region Used Size Region Size %age Used
FLASH_BOOTLOADER: 0 GB 8 KB 0.00%
FLASH_FIRMWARE: 251596 B 253696 B 99.17%
FLASH_FILESYSTEM: 0 GB 0 GB
FLASH_CONFIG: 0 GB 0 GB
FLASH_NVM: 0 GB 256 B 0.00%
RAM: 10856 B 32 KB 33.13%
text data bss dec hex filename
250532 1064 9784 261380 3fd04 build-metro_m0_express/firmware.elf
Converted to uf2, output size: 503296, start address: 0x2000
size excludes the .data section from text
I trust the linker more than size
maybe the optimizer tunings we have need re-tuning
e.g. trinket is 500 bytes bigger. I should look at function sizes.
I won't do this immediately
going for a walk in about half an hour
I think we can do it with 9.0
yeah, a bit too much pot stirring now maybe
i think we will get spattered a bit in the process ๐
the code sizes will change a bunch then anyway
I just filed an issue to split out epaperdisplay for displayio too
good point
that'll help in cp 10
@tulip sleet think I should PR my changes without the toolchain update?
the size-printing changes?
move to AT> everywhere and remove build memory info
and .ld ?
yup
if you could smoke-test one board from each port, that would be good
I think its samd only that used the old form
I don't think its worth it to do now
I want to do perf stuff now
we can do it with the gcc update
yes, your .ld changes will not go stale
new ports should use AT>
that can go in your porting guide
yes!
though I'm not really covering getting it building...
its a bit like I'm starting with part 2
it can just be a random note for now
I think the crash makes it pretty clear that we're not checking that we're within the C stack. There is stack checking code but its probably not checking the C stack and the pystack.
Ya, I don't think the tool that extracts the string can work on multiple lines.
Any sphinx experts handy? I'm trying to guess/understand why the documentation of the __init__ method is not showing the parameters: https://docs.circuitpython.org/projects/mcp2515/en/latest/api.html#adafruit_mcp2515.MCP2515 .. they're all documented in the source https://github.com/adafruit/Adafruit_CircuitPython_MCP2515/blob/main/adafruit_mcp2515/__init__.py#L285
I assume it's something about the sphinx setup but I don't know what.
could it be that the class docstring overrides the init doc string ?
the dosctring is usually on the class I believe
(but I'm no sphinx expert)
basically there is no documentation for the __init__ method, since it's just the documentation for creating an instance of the class, and appears under the class header
similarly to how the docstring for setters is ignored, using only the getter docstring
https://docs.circuitpython.org/en/latest/shared-bindings/canio/index.html#canio.CAN https://github.com/adafruit/circuitpython/blob/859a48723f86cd56c671ddc0ee5e66ded6910f75/shared-bindings/canio/CAN.c#L40 seems like we do it in the core this way
with documentation for the constructor in the doc of __init__, and both are shown in the docs
https://sphinx-autoapi.readthedocs.io/en/latest/reference/config.html#confval-autoapi_python_class_content I tried making this =both too
sphinx in libraries doesn't use autoapi ๐ค
I saw that:
def skip(app, what, name, obj, would_skip, options):
if name == "__init__":
return False
return would_skip
def setup(app):
app.connect("autodoc-skip-member", skip)
but that adds a __init__ entry
or that which is not better:
.. autoclass:: my.Class
:special-members: __init__
:members:
me, I would put the dosctring at the class level an leave it at that (although I notice that other libraries use a __init__ dosctring)
Jeff put the parameters at the start of the class, like this, I could make a PR later if needed..
class MCP2515: # pylint:disable=too-many-instance-attributes
"""
A common shared-bus protocol.
:param ~busio.SPI spi: The SPI bus used to communicate with the MCP2515
:param ~digitalio.DigitalInOut cs_pin: SPI bus enable pin
:param int baudrate: The bit rate of the bus in Hz, using a 16Mhz crystal. All devices on\
the bus must agree on this value. Defaults to 250000.
:param Literal crystal_freq: MCP2515 crystal frequency. Valid values are:\
16000000, 10000000 and 8000000. Defaults to 16000000 (16MHz).\
:param bool loopback: Receive only packets sent from this device, and send only to this\
device. Requires that `silent` is also set to `True`, but only prevents transmission to\
other devices. Otherwise the send/receive behavior is normal.
:param bool silent: When `True` the controller does not transmit and all messages are\
received, ignoring errors and filters. This mode can be used to โsniffโ a CAN bus without\
interfering. Defaults to `False`.
:param bool auto_restart: **Not supported by hardware. An `AttributeError` will be raised\
if `auto_restart` is set to `True`** If `True`, will restart communications after entering\
bus-off state. Defaults to `False`.
:param bool debug: If `True`, will enable printing debug information. Defaults to `False`.
"""
def __init__(
ah ok so the difference is in use of autoapi. OK, I can do it in whatever way non-autoapi needs ๐ I wish it was consistent with the core
thanks for the info all!
I'm willing to go along with this, since there are no other boards affected.
We have had our own issues with crystal oscillator parameters on the RP2040 -- on a small number of samples, the xtal osc can take much longer to start up than might be expected. There is a settable delay for this. I don't think there is a drive setting on that chip.
This also sets it to use Amazon S3 for the download link for now to get around some CORS problems that cloudfront is causing and the "CircuitPython Installer" title is moved out of the base installer and into the CP specific one.
Thanks - one q about commented-out code
Just tested the C3 now that the installer is working again and realized it should have been included in the list of boards without native usb.
@tulip sleet @onyx hinge I did try and ping you here: https://github.com/adafruit/circuitpython/pull/7470#discussion_r1114743146
i will take a look; will read the orig doc ; don't know how it works
thank you!
@adriangalilea Please post a video of what you are seeing. There's a chance that the neopixel is misbehaving.
Sorry for the delay, I've been meaning to do it, will do tomorrow.
There appears to be pyocd support for samd51 ```jepler@eric:~$ pyocd pack find SAMD5
Part Vendor Pack Version Installed
ATSAMD51G18A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51G19A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51J18A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51J19A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51J20A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51N19A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51N20A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51P19A Microchip Microchip.SAMD51_DFP 3.6.120 False
ATSAMD51P20A Microchip Microchip.SAMD51_DFP 3.6.120 False
that would be great. openocd claims to, but it doesn't work well
Is there a reason for this? display_bus is reference below
You call next_frame() on line 93 too.
thanks for both comments -- fixed now, I think?
Looks good to me. I've been using this to do some testing on my own so glad you shared it.
Is there a limit on how much one send you can make for SPI on an ATMEL port? Trying the gif code there and it is sending about 40K of the bitmap. Interestingly enough the second half of the data it seems
The PSRAM issue is now resolved.
there shouldn't intentionally be, but you never know what bugs lurk
[interestingly enough the second half of your message seems]
Iโll poke at it some more and file an issue. Probably rare to ever write so much SPI data at once.
And my writing was trying to say I only saw the second half of the buffer transmitted. Which seems weird
ah now I understand what you meant.
it appears the length of a single DMA transfer may be 64k "beats" in samd51, see https://datasheet.octopart.com/ATSAMD51N20A-AU-Microchip-datasheet-86798286.pdf around page 416
and because of reasons the address used is the end of the buffer, so if the transfer length is altered by truncation to 16 bits, it would be the end of the data that is actually transferred
mind opening a bug @blissful pollen ? it'll probably need to be fixed down in the peripherals submodule but go ahead and start it in circuitpython...
Will do, I probably cannot until I get home later if thatโs okay. Or may be able go at lunch.
Thanks for finding it in the spec I ran out of steam last night.
of course, take your time
Yeah, that sounds like a good feature to add. Would you like to go through the boards and submit a PR? Don't forget to update https://github.com/adafruit/circuitpython-org/blob/main/template.md so it will pass the checks. Afterwards, I can update the guide.
mainly just curious what changed here? revisiting some very old code. this worked ~2018
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Feather M0 Express with samd21g18
>>> import board, pwmio
>>> pwm = pwmio.PWMOut(board.A1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: All timers for this pin are in use
>>>
guessing some timer allocations got rearranged
(does same in 8.0.3 fwiw)
we've made a lot of PWMOut fixes since 2018, so I'm not surprised, having to do with allocation, etc.
It looks like phy_rate is validated in the common-hal, but I think buffer_size is not.
I do not understand the reason for this special method and the private __send() and __read() methods, instead of just send() and read().
I agree that a more straightforward stats interface would be easier to understand. Maybe it goes with my comment about why to use job, instead of just send and read (receive ?). I looked briefly at some ESPnow tutorials and didn't see the same kind of thing, but maybe I am missing something.
That's PB08 and its TC4 output 0. IIRC we never supported output 0 because it also used for the timer's top value
thanks. somehow it worked way back when. no worries. so long ago doesn't really matter. easy updates.
nothing special about that pin. can change to another.
nope. not sure. and s3 bucket doesn't go that far back.
iirc the code would let you set use those pins and/or timers, but then it wouldn't work correctly
like, you would have several pwm outs sharing the same timer
use case at the time was a single servo
github goes that far back I think: https://github.com/adafruit/circuitpython/releases?page=14
we moved to s3 later
ah. yah...ok lemme try that. for the grins and/or the giggles.
Adafruit CircuitPython 3.0.0 on 2018-07-09; Adafruit Feather M0 Express with samd21g18
>>> import pwmio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'pwmio'
>>>
must've been later than this...trying next...
ah. ok. that's probably part of it.
i think this code was script updated at some point
so original code was pulseio
OnDiskGif.next_frame() returns a delay, which was incorrectly chopped to 8 bits.
Thanks @TheKitty for finding the issue and testing the fix.
Adafruit CircuitPython 3.0.0 on 2018-07-09; Adafruit Feather M0 Express with samd21g18
>>> import board, pulseio
>>> pwm = pulseio.PWMOut(board.A1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: All timers for this pin are in use
>>>
Adafruit CircuitPython 2.2.4 on 2018-03-07; Adafruit Feather M0 Express with samd21g18
>>> import board, pulseio
>>> pwm = pulseio.PWMOut(board.A1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid pin
>>>
bad pin, no biscuit
@tidal kiln there are old releases in the OLD/ directories on S3 for boards that have had builds for that long
oops. copy pasta error. one sec.
Adafruit CircuitPython 1.0.0 on 2017-09-12; Adafruit Feather M0 Express with samd21g18
>>> import board, pulseio
>>> pwm = pulseio.PWMOut(board.A1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid pin
>>>
weird. so not sure how this worked way back when.
but doesn't really matter
this is all getting updated
the batch code updating from pulseio to pwm was the main point of confusion
@slender iron @tulip sleet thanks for looking. sry for the noise. no real issue here. more of curiosity.
was it on a different board?
example of an old fix: https://github.com/adafruit/circuitpython/pull/1184
Didn't test it but looks good. Verified GIF_playframe returns the delay in an int.
Good catch!
so far back, not sure. the associate fritz is feather m0. but maybe i used a m4? but going to use a rp2040 for the update.
CircuitPython version
Adafruit CircuitPython 8.1.0-alpha
Adafruit ItsyBitsy M4 Express with samd51g19
Code/REPL
display_bus.send(42, struct.pack(">hh", 0, 239))
display_bus.send(43, struct.pack(">hh", 80, 319))
display_bus.send(44, gif.bitmap)
Behavior
When sending a large SPI transfer the transfer is truncated. @jepler found reference in the samd51 spec that the block transfer count size in DMA is limited to a 16 bit value which implies the m...
There's a proof of concept implementation of SDIO in the pico-extras repository at least.
Maybe it would be interesting to implement the sdioio module with it.
https://github.com/raspberrypi/pico-extras/tree/master/src/rp2_common/pico_sd_card
m0 basic or m0 express?
i was using express above
what was done way back in ~2018 remains a mystery
but not an issue
i'm redoing it all and updating to use a rp2040
i was originally updating existing, so was trying feather m0 express again, which led to the confusion
but limor wants to also switch to basing on feather rp2040 - so it's turned into a redo
code updates aren't huge, but will at least be known working with current hardware/CP release ๐
bonus - i can use keypad now for button reads. helps simplify things
๐
๐ yep. thanks again for taking a look.
CircuitPython version
Adafruit CircuitPython 8.0.3 on a Raspberry Pi Pico W with an Adafruit 4682 "Micro SD SPI or SDIO Card Breakout Board" and Adafruit 4830 "MPR121 12-Key Capacitive Touch Sensor Gator Breakout" (although the MPR121 likely has nothing to do with this, it was just part of my build).
Audio is clipped to the 3.5mm audio plug of a simple hamburger speaker.
Issue may be with sdcardio and audiomixer, but am unsure.
Audio files used are at:
https://bit.ly/circui...
Fix for #7670
Writes over 64Kb were failing as that is the maximum a DMA write can handle.
Possible other fix would involve chaining DMA transaction buffers but the break between buffers was about 3 microseconds so probably not an issue.
This could be moved into dma.c but then would have to be careful about QSPI (which has this problem but at 4x the size). This was the easier place to put it in, but open if we want to modify it too. It seems only SPI/QSPI uses the routine in question.
This helps my development scripts work better, and probably also fixes a problem switching from the circuitpython environment back to arduino. (specifically, the "1200 baud" serial trick was not rebooting into the bootloader but was just resetting)
(microcontroller.on_next_reset worked, but because of reasons the code is not shared between the two)
@lone axle ping. not urgent.
Whats up?
hey, can you take a look a this:
https://forums.adafruit.com/viewtopic.php?p=962841#p962841
wondering if i'm missing something in their code that would explain the weird offset behavior they are seeing?
note - they're also struggling with a basic string formatting issue, which is causing the text overlap stuff, but can ignore that
Yep will take a look
i couldn't recreate this on a magtag
and my 2.13" EPD breakout is old enough to be different than currently shipping version
so can't test directly ๐ฆ
thanks!
The only bit that I am slightly suspicious of are the things like:
humidity_icon.pixel_shader.dither = True
humidity_icon.pixel_shader.convert(0)
I don't quite understand how dither will effect the drawing yet. I wouldn't think it could cause the black box thing, but might be worth trying without.
the call to convert(0) as far as I can tell wouldn't do anything, though I would assume it also wouldn't do anything bad. My understanding is that is like a 1 time conversion that takes an int in and gives another int back out. Since the return isn't being stored or printed or anything it essentially just does it's operation and then throws away the answer.
The text migrating to the right is something I've never seen before. Total shot in the dark but it makes me wonder if maybe there is a specific hardware rev where the display and/or driver is slightly different and needs something tweaked in the start sequence. If something is off by a small amount maybe there is some cumulative effect building up over time?
As of May 9, 2021 we're selling a version with SSD1680 chipset, instead of the SSD1675 chipset. Firmware code will need to be updated as they are not code compatible.
i was wondering same. but their code is at least using SSD1680.
I think the only things I've got with similar screens are magtag, and a very old pimorni phat 2.13" I'm not sure of it's exact model, the driver code references SSD1683 which is similar at least.
Is there any down side to trying the other 1675 driver? Can it damage the display? If not that is worth a try. Their pictures look like the old one to me more likely
with blue PCB makes me think older
good question. i am assuming it's the newer rev, simply based on date of post.
and i'm not sure of behavior when using 1675 with 1680
doubt it'd damage it. but would it even produce output?
or 1680 with 1675
Coincidentally I was testing some eink drivers recently. In my case one of the wrong drivers produced garbled output on the display, and a different one of the wrong drivers had no visible effect. So I assume it depends on how similar the protocols are, some are probably close enough to work to some extent.
yep
ok. thanks for taking a look.
felt like something that'd be obvious, but was just overlooking
in code
One chunk down from here: https://learn.adafruit.com/adafruit-2-13-eink-display-breakouts-and-featherwings/circuitpython-usage#tri-color-display-usage-3085461 (no anchor on it directly)
It also talks about an older version that used IL0373
Maybe they can post a photo of the back side as well. If there are any identifying marks that could help figure out which one they need.
Code looks good to me apart from the two things I mentioned, but I think its unlikely those contribute to the behavior they are seeing.
Could I get some eyes on https://github.com/adafruit/Adafruit_CircuitPython_framebuf/pull/50 ? First PR to circuitpython, open to any feedback
GitHub
This lets people use framebuf for 2 color displays like the 8x8x2 matrix. It is a mostly mechanical port of the circuitpython GS2_HMSB code.
You can see how I use this code in https://github.com/je...
its weird making a PR that has code I don't fully understand but works xD
There aren't many of us who are familiar withe framebuf code, so sorry if you aren't getting some feedback on it.
Yeah and I can imagine a discontinued product is not something people will be able to easily test
That said, I link to code than emulates the displays in a terminal. I wonder if I can add that to the PR to make it easier for folks to visualize and test...
@slender iron adapted your bangle2 demo to the CPB with gizmo!
It really is nice. This only took a few minutes to do.
Good to know, thank you both. I should have some time this evening to check out the beta.
I will take a look this evening. I don't have the Bi-color matrix to test the actual new functionality with though. I'll try out your emulation script and test some of the hardware that relies on the same library to ensure the new functionality doesn't bother anything else.
for me it show the screen with diagonal lines when I used the incorrect driver
cool. thanks for testing. that's with mixing SSD1680/SSD1675?
Yes, indeed, however, nothing similar to the post. LEt me know if you need more help I do have the display
is yours a newer SSD1680?
let me check I think is the old one... give me 5 minutes
Not sure how to identify them
unfortunately, i don't think there's a way from just the board
but the invoice description at time of purchase would have had it in the text
ah. the older one. SSD1675.
they're using SSD1680 in post, per their code - and at least not getting diagonal lines
yeah. let me know if you want me to test the code to see if I ahve the same behaviour
thanks. i think the mix/match behavior is all at this point.
I see you could use it in an SSD1306. if that is the case, I could take a look, but as danh mention, not very familiar with framebu so give me a little bit of time :). Let me know!
Code test for that little screen will be greatly appreciated in case you have it
Lemme see if I have one around or can adapt what i have for it
Thanks, Ill comment on the PR then.
@tidal kiln I've had good luck reading the printing on the eink display ribbon to know what version of the display it is
neat. good idea.
I wish I could read markings on the driver ic ๐
Are there any updates on this issue, because I think I am experiencing the same issues.
my hw:
KB2040
Adafruit SPI/SDIO microsdcard breakout
Sandisk SDHC 16GB
I have recompiled cpy to include the debug flag in sdcardio: producing the follwoing output:
code.py output:
cmd 0 [00] arg= 0 [00000000] len=0 data
cmd 0 [00] arg= 0 [00000000] len=0 data
cmd 0 [00] arg= ...
@vladak, here is a fix similar to @RetiredWizard's, and in addition it moves lwip_fcntl() to a place where newsoc is know to be good. Would you mind testing this? Thanks very much. If it works I will PR this to 8.0.x.
FYI Metro M7s are in the shop for those who want this fancy new chipset! https://www.adafruit.com/product/4950
Where is the out-of-tree extension module documentation for circuitpython?
that's the neat thing, there are no out-of-tree extensions
oh, it looks like it still works the same as micropython with USER_C_MODULES directories and -DMODULE_name_ENABLED=1
by accident
Know anything about tracking down sources that create undefined reference to _close ; oh, figured out I can define it with a global int as a hack, as long as it doesn't get called.
This is a rough start on an Opus audio codec extension for circuitpython, which is an excellent audio codec. It expects https://github.com/dholth/arduino-libopus to be checked out next to the circuitpython checkout. Not sure it has a place in circuitpython in this state, but it might be interesting to someone. This began as a micropython extension, but crashed on-device when instantiating oggz.oggz(f), and I haven't investigated that with a JTAG probe.
Usage
import oggz
nyan = o...
This contains the following:
- split boards dynamically
- refactor workflow names
- conditionally build all languages
@vladak, here is a fix similar to @RetiredWizard's, and in addition it moves
lwip_fcntl()to a place wherenewsocis know to be good. Would you mind testing this? Thanks very much. If it works I will PR this to 8.0.x.
That seems to work, the same tests I ran before do not trigger the issue with this build.
I also tested the code from the circup web workflow PR.
I have finished reading the cp source for all stack code (pystack, cstack, heap).
The C stack is allocated before pystack. Starting from main.c:416, function stack_resize calls supervisor/shared/stack.c:75 which in turn calls :46 function allocate_stack.
This function is similar to the other stack allocations, using allocate_memory for a generic supervisor_allocation.
As a reminder allocate_memory is 'safe'. Populated in supervisor/shared/memory.c:233, it uses `allocate_mem...
The following build is latest master, built manually cuz I just reinstalled my desktop and was testing it.
[bill88t@KeyFalse | espressif]> time beetle-cleanmake
[ ... ]
real 0m41,789s
user 4m51,394s
sys 1m18,136s
Quite a bit faster than my pi400.
Reproduced on C3, with a pystack of just 2000!!
Adafruit CircuitPython 8.1.0-beta.0-4-g8a1006999 on 2023-03-04; DFRobot Beetle ESP32-C3 with ESP32-C3FN4
>>> def test(no):
... print(no)
... try:
... ...
It boots and works till you access that memory. Stock pystack size works just fine, so as an emergency workaround I suggest CIRCUITPY_SETTABLE_PYSTACK is disabled for C3 and S3 till this issue is solved.
Just 2k pystack is enough to break C3.. smh..
Well, doesn't C3 have jtag built in? I can prolly debug that
Now onto setting openocd on a new machine..
ugh openocd
What about it?
Don't I use jtag with openocd?
I only know swd, so it's new to me.
Well, what would you suggest then?
I'm open to testing more stuff.
I have time at my hands.
pyocd is nicer, black magic probe is probably an option too
.startswith("py"), i'm all for it.
ah nice, it's a pip module
Huh, there doesn't seem to be plenty of docs for it.
No built-in target for any espressif
no problem, I will setup openocd now, and try more later
black magic probe looks cool, but pi400 can literally do all that
esp32c3 has built-in jtag, You plug it in, you get serial + jtag immediately
it seems to have an openocd target already
This should probably read: { MP_ROM_QSTR(MP_QSTR_GP2), MP_ROM_PTR(&pin_GPIO2) },
typo in _GP1 instead of _GP2
Looks pretty safe, though I notice that for (say) a transfer of 65536+16 bytes it will do a DMA transfer of the final 16 bytes. This is probably just fine, I think avoiding DMA for small transfers is just for efficiency, not correctness. Didn't test, would love to hear from @gamblor21 before merging if this fixes the original problem
oh wait, you filed the PR. I'm apparently not far enough into this mug of coffee yet :)
CircuitPython version
Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Feather ESP32S2 with ESP32S2
Code/REPL
>>> import wifi
>>> wifi.radio.connect(ssid="myssid",password="0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
Traceback (most recent call last):
File "", line 1, in
ValueError: password length must be 8-63
>>> wifi.radio.connect(ssid="myssid",password=b'\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89\xab\xcd\xef\...
Need a blank line to make sphinx happy, I think.
//| .. code-block:: Python
//|
//| # Initial set-up the same as above
Looks good to me. I've been using this to do some testing on my own so glad you shared it.
Seems not to work with my board as soon as I use REPL with the regular build and ST7789 library. Compiling these 5 file changes into a circuitpython build beta 8.1.0 shows only during boot for a short period the display content (backlight is on all the time) but is otherwise dark.
Is there anything beyond RUN_BACKGROUND_TASKS; that is needed, or could be used inside of the main while loop in that function to allow it to bail early if/when the user does ctrl-c?
I added RUN_BACKGROUND_TASKS; here:
That does allow the device not to disconnect while the function is running.
However I noticed if I press ctrl-c while it's runn...
You can call mp_hal_is_interrupted(), which will be true if ctrl-C was pushed (or there was an auto-reload request. There are lots of examples of this in the code.
attempt to resolve #7485
Added code to run background tasks and bail if interrupted.
Tested successfully on PyPortal Titano with the reproducer code in the issue.
This resolves the problem of getting "stuck" during the fill, but the underlying crux is that boundary_fill is fairly slow for filling large spaces. The current implementation is based on this https://en.wikipedia.org/wiki/Flood_fill#Moving_the_recursion_into_a_data_structure There some other more efficient algorithms dis...
@vladak, here is a fix similar to @RetiredWizard's, and in addition it moves
lwip_fcntl()to a place wherenewsocis know to be good. Would you mind testing this? Thanks very much. If it works I will PR this to 8.0.x.
The firmware reports itself as CircuitPython 8.0.2-2-gc7f485d7d-dirty on 2023-03-03 and seems to be working fine w.r.t. multiple PUT/DELETE requests.
- Fixes #7636.
I misread the code flow when I first added making the socket non-blocking. Removed mp_hal_is_interrupted() from the wrong place, and now make the socket non-blocking only if we know it is legit.
Tested by @Neradoc and @vladak -- thanks!
The artifact from this PR eliminates the issue I was seeing on the Feather Huzzah32.
Can someone explain to me what the new layout for the mpy-cross'es on aws S3 is?
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross/
They seem to be mixed to here + in the folders..
they are in the folders going forward, but there are some old ones at the top level, which I added temporarily to support Thonny, because there was a list of locations Thonny was sort of depending on: https://github.com/aivarannamaa/pipkin/issues/7
Hmm, but 8.0.3 isn't in the folders?
8.0.0 is there, 8.0.2 is there, 8.1.0 dailies are in, but no 8.0.3
This is what confused me and I asked..
Anyways, thanks!
It's amazing how complicated constructing those urls is. Honestly more complicated than before
if sys == "Linux":
url += "linux-"
appen = ".static"
if mac == "aarch64":
url += f"{mac}/mpy-cross-linux-aarch64-"
appen += f"-{mac}"
elif mac == "x86_64":
url += "amd64/mpy-cross-linux-amd64-"
elif mac == "armv7l":
url += "raspbian/mpy-cross-linux-raspbian-"
appen += f"-raspbian"
else:
raise UnsupportedMachineError(f"{sys}_{mac}")
url += f"-{version[0]}.{version[1]}.{version[2]}"
if special is not None:
url += f"-{special}"
url += appen
del appen
Ah yuesh
CircuitPython version
Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit Feather ESP32S2 with ESP32S2
Code/REPL
import wifi
# 1 - give it an AuthMode
wifi.radio.start_ap(ssid='Wireless', password='wireless', authmode=wifi.AuthMode.WPA2)
# 2 - give it an AuthMode inside an iterable list to make it iterable as requested
wifi.radio.start_ap(ssid='Wireless', password='wireless', authmode=[wifi.AuthMode.WPA2])
Behavior
1 - It refuses and reque...
hmm, why not add it to a list and do a "".join() at the end?
uhh, I'm kinda hesitant doing fancy stuff on desktop python cuz my brain breathes circuitpython and I have forgotten the differences.
that's probably a bug, but it doesn't matter, there hasn't been a change in mpy-cross in ages
Do I open an issue?
yeah, sure!
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross/
All the mpy-cross'es for 8.0.3 are placed outside of their respective directories.
(They are not inside, just outside)
It should be checked as to if CI bugged or there was human intervention.
Huh, macos mpy-crosses are the only without .static, how weird and incosistent. My brain hurts as to why.
I think the changes of location were on main, not 8.0.x, I didn't realize there weren't missing completely. So the 8.0.x branch is putting them in the old locations. The 8.1.0-beta.0 ones are in the directories?
dailies are in dirs
how about beta.0?
here url
Turns out this is because the relocation was done on main after 8.0.x was branched. Sorry for the false alarm.
I found a solution, with WPA2 you also need to supply PSK:
import
wifi.radio.start_ap(ssid='Wireless', password='wireless', authmode=[wifi.AuthMode.WPA2, wifi.AuthMode.PSK])
Perhaps it would be a good idea to move the files in the folders manually for 8.0.x.
Or else the new code will be the one failing.
maybe, I have to see what THonny wants
My code has a hardcoded url if all other fail.
So it shouldn't matter much for mine.
We should also maybe say that PSK is necessary.
First stage of scanning the pinout of circuitpython8 running on the arduino mkr vidor 4000,
there's a bunch of peripheral documentation that's missing or hidden that can't be found on any other board(s)
it thinks its a feather m0 basic proto so some of the required pins are missing. long story short, it might be worth uploading circuitplayground express support onto it instead
because it has the pins already defined in the board module with no changes required
I would suggest to use USB_VID = "0x2E8A" (that's the Raspberry Pi foundation) and USB_PID = "0x000B" (that's Circuitpython firmware - according to https://github.com/raspberrypi/usb-pid ). On this page it states in the second sentence after "Use of the IDs" that "In general, the only reason to require one is because Windows uses the product ID to select a vendor-specific driver for a USB device." And from USB's perspective it is just connected to a rp2040, and gets some subfunction...
@erongd @dhalbert @tannewt I would suggest to use USB_VID = "0x2E8A" (that's the Raspberry Pi foundation) and USB_PID = "0x000B" (that's Circuitpython firmware - according to https://github.com/raspberrypi/usb-pid ). On this page it states in the second sentence after "Use of the IDs" that "In general, the only reason to require one is because Windows uses the product ID to select a vendor-specific driver for a USB device." And from USB's perspective it is just connected to a rp2040, and gets...
CircuitPython version
Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Grand Central M4 Express with samd51p20
adafruit-circuitpython-grandcentral_m4_express-en_GB-8.0.3.uf2
update-bootloader-grandcentral_m4-v3.15.0.uf2
Code/REPL
import displayio
import rgbmatrix
import board
import framebufferio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
import digitalio
import busio
import sdcardio
import st...
The code looks good to me, my only thought is have you looked at performance? If you are checking every loop that may have an effect on speed more then intended.
//| self, *, monotonic_time: Optional[float] = None, epoch_time: Optional[int] = None
Can combine this with some other PR to save builds.
Hi,
This PR solves: aeios.AES.rekey() is not documented #7435
a) Documented the aeios.AES.rekey() function
b) Refactored the arguments validation. Please let me know if that was the idea of "canonicalize arg checking".
Tested with adafruit_feather_rp2040 with the following code:
import aesio
import os
from binascii import hexlify, unhexlify
plaintext = unhexlify("6bc1bee22e409f96e93d7e117393172a")
key = unhexlify("2b7e151628aed2a6abf7158809cf4f3c")
iv = unhex...
CircuitPython version
Adafruit CircuitPython 8.1.0beta0 on Adafruit Pyportal
Code/REPL
// Designed to decode images up to 480x320
Behavior
When gif is larger than screen, error occurs. Is this an exert? Should it throw an error or display the upper left portion of the gif?
Consider documenting on readthedocs compatibility with palletized colors vs. embedded colors. I tried reducing with a palette early on and it didn't take it. That's fine but...
While doing some other work with my Saleae, I noticed large SPI transfers had a gap every 4Kb for about 300 microseconds. Over larger transfers this delay adds up and becomes more apparent the faster the SPI frequency as the delay is constant vs frequency.
This PR adds multiple transaction queuing. The current implementation sends 1 transaction at a time. In the linked [IDF example](https://github.com/espressif/esp-idf/tree/af805df3cb6117cc74f0875831fbab6446824453/examples/peripherals/spi_...
Thought might be something to do with baudrate, but can't set it
in init
TypeError: extra keyword arguments given
class HiscoreController:
def init(self):
spi = busio.SPI(board.SCK, board.MOSI, board.MISO, baudrate=12000000)
sdcard = sdcardio.SDCard(spi, board.CS, baudrate=12000000)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/")
Just thought I'd let you know that the LSM6DSO has both I2C and SPI support and I am using it with SPI. I still get the hang. I suspect it happens if my code is at some stage of communicating with the chip while being OTA upgraded causing a reset of the MCU or being reprogrammed with a debugger at the "wrong time". I have not been successful in recovering without interrupting the LSM6DSO power as it does not have a reset pin.
I'm not sure why the unix port build is failing. It reports this error:
../../shared-module/bitmaptools/__init__.c: In function โcommon_hal_bitmaptools_boundary_fillโ:
../../shared-module/bitmaptools/__init__.c:380:9: error: โRUN_BACKGROUND_TASKSโ undeclared (first use in this function)
380 | RUN_BACKGROUND_TASKS;
| ^~~~~~~~~~~~~~~~~~~~
Which seems like perhaps there is a missing #include that is needed. But I'm not sure which one if that is the case...
Looking at other shared-module/ examples with RUN_BACKGROUND_TASKS, try
#include "py/runtime.h"
It's got py/runtime.h include already here: https://github.com/adafruit/circuitpython/blob/0ca6cc7741103ced6e2c35fb3d7da708fb030d7f/shared-module/bitmaptools/__init__.c#L34
Could it need a different order or something more specific to the function where it's used?
Order shouldn't matter, but I'm wondering if the unix port is not compiling the other files with RUN_BACKGROUND_TASKS. The most likely one to be compiled is shared-module/os/__init__.c. You can try putting an #error in that file and see whether it gets hit when you do the unix port compile. if it does get compiled, then check what that includes and how, and try to replicate.
I think maybe this should have a RUN_BACKGROUND_TASKS in the loop, to not lock background tasks, in case the transfer is large and slow. At most SPI frequencies this might not matter, but it could make a difference.
I don't think it's so likely this is an electrical problem, but rather it's a timing problem. Running an RGB Matrix requires real-time updates of the matrix, and missing an update can create flicker. It takes about 1/3 of the CPU to do it. It's done at interrupt level, so it should be capable of overriding most other things going on. but writing to an SD card may add uninterruptable things, or may cause contention that introduces latency and therefor flickering. We'll need to do some instrume...
Ahh, it looks like you are correct on that.
I added #error inside of shared-module/os/__init__.c and it does not stop the unix build from completing (if I remove the RUN_BACKGROUND_TASKS stuff that the PR is adding). So it seems unix port doesn't build that file.
Whoa, is it a new feature for Github to show actions failure error messages intermixed inline with the code on the 'files changed' page? I've just found one that is showing the error messages at the offending lines.
@kyrreaa This should not be the same with SPI. A SPI devices bus state is reset every time the CS transitions. So as long as you are toggling CS, it should be OK. I2C devices get stuck in a state because they only have the two wires. The only way to fix it is to clock them back into idle, with an unknown number of clock cycles.
For problematic devices that can hang, it's good to be able to power-cycle them. We have controllable I2C power on a numbe of boards, for power-saving reasons. Or, if the device is fairly low power consumption, you could power them from a GPIO pin.
@lone axle the newsletter is ready to crib from for the Discord meeting notes
Thank you
@brazen hatch C3 is risc-v cored and pyocd is arm-only atm
hey, can you share the screenshot
On Espressif, I think we just need to allow 64 characters, and probably should vet that the characters are all hex digits.
On RP2040 CYW43, it's not documented as far as I can tell whether this would work or not.
We would have the password be ASCII hex digits as opposed to raw binary.
Does this block until the transaction is done? We may want to move RUN_BACKGROUND_TASKS here so that it can run after each transaction completes.
One question. Looks good otherwise. Thank you!
What capitalization is correct here? It looks like CP will parse IV.
//| IV: Optional[ReadableBuffer] = None,
Here is a page that has them: https://github.com/adafruit/Adafruit_CircuitPython_Touchscreen/pull/24/files. I pushed changes to the original one I found that resolved the errors. Created this one as a quick test to be able to see them.
@erongd @dhalbert @tannewt I would suggest to use USB_VID = "0x2E8A" (that's the Raspberry Pi foundation) and USB_PID = "0x000B" (that's Circuitpython firmware - according to https://github.com/raspberrypi/usb-pid ).
This PID is for CircuitPython on the Pico explicitly. This is a different board. Please make a request on pid.codes if you haven't already.
You are right. Will fix that. Thank you!
<@&356864093652516868> Apologies for not getting a ping out sooner, but the weekly meeting is set to begin here on discord in just a few moments.
and some of us arriving from our internal meeting which just finished .. I'll be back in a few moments
https://blog.adafruit.com/2023/02/28/circuitpython-8-1-0-beta-0-released/
Add animated GIF support: gifio.OnDiskGif.
Add safemode.py, for programmatic handling of safe mode.
Add 7-color e-ink display support.
Allow setting pystack size in settings.toml.
Add dither support to Palette.
Support array.extend(iterable).
[not 100% sure if this is who you were talking about but note Kyoshii's pronouns on discord are [she/they]]
oops
๐
heh and I even wrote the wrong thing first just now. 
the important thing is to do one's best and correct when wrong ๐
thanks for fixing that for me ๐
Oh no
๐ฆ
@lone axle that is a "flood fill" algorithm?
yep, there is some room for improvement on the specific algo as well I think.
Great!
that's exciting @timid bolt ! which microcontroller ?
rp2040
that sounds awesome gneverov!
zork style game built with and meant to be played with chatgpt? that's deep.
wait, feather m7 or mispoke?
@midnight ember not sure what I said, I meant metro m7
๐
@midnight ember that said .. https://blog.adafruit.com/2020/02/29/circuitstonks-snakes-its-way-to-the-nxp-imx-rt1011-m7-feather/
I found out about veneer functions this week too when adding mp3 decoding functions to ram
Will do Scott. Spinning the tires on the iMX, can't wait!
@timid bolt I've got some elf based tools that can tell you what a function references so you can decide to move deps too
it's tricky because adding a function to ram, although it makes itself faster, it makes all the functions that call it slower because of the veneer ๐คฆโโ๏ธ
Maybe leave it in there as an alias, don't know if that's possible, as a slow phase out instead of a hard deprecation?
is that elf-section-graph?
it's still backwards compatible in 8 so old code does still work.
yup. I think I have some local changes though. iirc I added address info to each node last week
7.2+ support the root_group property
There are still some examples in read the docs still using examples as far back as like 7x i think. Breaking old examples especially stuff from read the docs would be concerning from a support perspective at the very least.
er my mistake, it's not settable in 7.2 / 7.3.
Is there daylight savings in the US between then and now?
normal time next week
Thank you!
Thanks Tim!
Thank you all!
Thank you for hosting @lone axle
I think so. There is a time change during the upcoming weekend I believe.
@timid bolt pushed my changes to elf-section-graph
Yes, next week the parts of the US that observe DST / "summer time" switch, making the meeting "2PM in UTC-4", whatever that means to you.
Truth
Clever.
@errant grail Was more an act of desperation after hours of fighting against 20W ear shattering squelches. It just worked. Will still end up playing with the mp3 decoder board for sure though.
Will it still work without shorting the minus output to ground, leaving the cap between plus output and ground? Iโd be concerned about overloading the negative side of the ampโs h-bridge.
Not sure I follow. You wouldn't want to use only the positive side of the cap and leave the ground floating.
Keep the cap between plus and ground but donโt connect the amp neg output to anything.
The 20W amp uses a 5mm 12V barrel jack. By unplugging that the sound won't be amplified then and you're sending 3W into the unpowered amp which I'm sure it can handle np.
Shorting the neg output to ground would unnecessarily heat up the amp chip. The output is basically like a floating h-bridge motor controller.
which amp chip the 3w or 20w?
Only use the 3w ampโs positive output.
i played bartlebeats for 24 hours straight np. :/
didn't feel the chips though
the 3w chip is upside down on the protoboard, i can't get to it with a finger.
i didn't amplify it to full volume though, maybe 50%
Itโs overheat protected, so it should survive. Might shutdown on a hot day.
will keep an eye on it this summer in the 105F and 100% humidity workshop.
Yeah, global warming and all.
heat torture testing is just a product of my natural environment lol. i've killed sooo many routers they just can't handle the ambient heat in a garage.
I finally put in a split heat pump out there. Can work in comfort but canโt stress test stuff as easily.
i will keep an eye on it thank you for the advice. i honestly have no idea what i'm doing. it worked so i'm happy.
Here is the notes document for next Mondayโs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Note that these timezones will be observing a time change for daylight savings prior to the next meeting. 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/1NZeAkPhnhUytsVP1rKAScEsxPWYmZC2s7yNt4Eqj_cU/edit?usp=sharing
Google Docs
CircuitPython Weekly Meeting for March 13, 2023 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canโt make the meeting and would still like to partic...
Hey, if it worksโ very inventive.
I'm not sure if it's acting like a coupling capacitor or decoupling capacitor. I should probably go do some research.
@midnight ember I'm a little bit skeptical of your 1000 uF capacitor solution. 1. electrolytic caps are polarized, so it's a little sketchy putting them across the differential output, 2. 1000 uF is basically a short circuit at audio frequencies, 3. the 20 W amp is a high impendence load, so it is not at all like a string on Neopixels.
I'm not familiar with the product or what the gain pin does. But you would probably want a 100k resistor in series with the 20 W amp, as the board is probably outputting 3-5 V which is too high for the amp.
Probably more like a low-pass filter and attenuator.
Ohh I could have wired up each leg to the positive only is that what you're saying?
Haven't tried that, or for the negative side though it shouldn't do anything on the negative side hopefully.
This calls for more experimentation ๐
We should move the discussion to the hardware channel and free this one for software dev.
what's the hardware channel called?
I'm ok disabling it for boards that crash instead of setting an arbitrary limit.
Normally I'd agree with you @Panometric, but real world experience has thought me differently. This also why I do have transistor-controlled supply to some SPI or I2C devices that lack reset pin (@dhalbert). On I2C it is even harder as they can be back-powered by the I2C pullups making it very annoying.
Feeding extra clock cycles seem to work for some devices on I2C but not all in my experience.
In my case the CS is indeed being controlled and I have verified this with a oscilloscope. Yet, ...
Thank you for these refinements. I really like the two levels of builds now. One suggestion I had will improve the job naming.
I'm a little worried they aren't detailed enough for complex platforms. Ideally, I'd like to get rid of this python script in favor of correcting linker scripts to use AT>. How does this work with imx?
Are there non-reusable versions of this? I'm not sure why you want the distinction here.
Rename this job to board. That should make the task name change from Build CI / boards (atmel-samd) / build (8086_commander) (pull_request) to Build CI / ports (atmel-samd) / board (8086_commander) (pull_request)
CircuitPython version
Adafruit CircuitPython 8.1.0-beta.0 on 2023-03-01; RP2040-LCD-1.28
Code/REPL
#code from docs
start = time.monotonic()
odg.next_frame() # Load the first frame
end = time.monotonic()
overhead = end - start
face = displayio.TileGrid(
odg.bitmap,
pixel_shader=displayio.ColorConverter(
input_colorspace=displayio.Colorspace.RGB565_SWAPPED
),
)
splash.append(face)
main.append(splash)
Behavior
Tra...
CircuitPython version
Adafruit CircuitPython 8.0.3 on 2023-02-23; Adafruit Grand Central M4 Express with samd51p20
adafruit-circuitpython-grandcentral_m4_express-en_GB-8.0.3.uf2
update-bootloader-grandcentral_m4-v3.15.0.uf2
Code/REPL
class HiscoreController:
def __init__(self):
pass
def hiscore(self):
spi = busio.SPI(board.SD_SCK, board.SD_MOSI, board.SD_MISO, baudrate=500000)
sdcard = sdcardio.SDCard(spi, board.SD...
I want to fix it so that all boards can use it to their limits.
However for now, I will create a pr that disables settable pystack for all C3 and S3 boards to act as a temporary patch.
When I manage to fix this I will slide in the revertions in the fix pr.
It looks like in your code you are supplying the baudrate= argument to busio.SPI rather trhan sdcardio.SDCard.
Note that usually it would be recommended to set up the SD card once, and to use a mount point like '/sd', but while this would be good to keep in mind it doesn't seem to be related to the specific exception that your code caused.
The forums or our discord are better places to ask for help with your circuitpython programs.
No, this is just a normal workflow. The workflow_call event is what makes this reusable.
The reusable prefix in name is added just to separate it from the rest in GitHub UI.
This just logs if any boards are being built.
A couple of comments here:
-
Depending on the GIF if it uses the "Restore to previous" disposal method that cannot be fully supported in CircuitPython. In that method the drawing routine is supposed to remember what was behind the GIF before drawn so would require two frames to be stored in memory. For most microcontrollers that isn't practical as it doubles memory requirements.
-
What can be done is to ensure the transparent background is a set color. @FoamyGuy (can you share your code...
Yes, the size reported by this script and that by the linker differ, on espressif I noticed script - linker ~ 1500 bytes.
This doesn't work for imx, all languages are built.
Nothing in circuitpython supports transparency directly. User code must use make_transparent() function of Palette or ColorConverter in order to achieve something akin to "green screen" transparency. You can set the color you want to represent as transparent and displayio will omit drawing pixes of that color, allowing whatever is beneath them to be seen.
I was just looking back at the VOD to figure out how that ended up working, as it does require some quirks in the user code.
I used t...
For more details please refer to #7643.
I'm pretty sure I didn't forget any boards.
This will be reverted once the proper fix is found.
It looks like in your code you are supplying the
baudrate=argument tobusio.SPIrather trhansdcardio.SDCard.Note that usually it would be recommended to set up the SD card once, and to use a mount point like '
/sd', but while this would be good to keep in mind it doesn't seem to be related to the specific exception that your code caused.The forums or our discord are better places to ask for help with your circuitpython programs.
ah mind was in daze readin...
I was absent last week, was there ever a definitive resolution on what's causing the esp settable pystack crash?
If this is a chip level change, it can go in mpconfigport.h
// Temporarily disable settable pystack
#if defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3)
#undef CIRCUITPY_SETTABLE_PYSTACK
#define CIRCUITPY_SETTABLE_PYSTACK 0
#endif
I've figured out a way to do all the necessary conversions in the user code so that you can more easily indicate a RGB888 color value that you want to be transparent:
cc_gif.make_transparent(int.from_bytes(cc_888.convert(0x00ff00).to_bytes(2, 'little'), 'big'))
.. and write a general 'pin change interrupt' facility to power it
This uses the same quadrature state machine as atmel-samd, nrf, and rp2040. The 1011 doesn't have a dedicated encoder peripheral, so we go the pin-change + software route.
Do I need to treat this new table of interrupt information as a GC root? in some weird case (like if you don't save your IncrementalEncoder object anywhere, i.e., a bug) it might be the only thing that would keep the object alive.
Moved it there, and it did not cause any noticeable slowdowns.
I tested everything at 100Khz and never had a USB timeout and Ctrl-C is almost instant (even 4KB is 1/3 second at that speed).
@FoamyGuy - I was able to successfully use white to make my GIF transparent, 0xFFFF.
However, I've tried a file at 240x240, 54k in size, with 51 frames and I've hit an out of memory error.

I updated this with 2 small changes:
- changed the int docstring type to ReadableBuffer
- added a basic example of usage of the function
It seems good to me at this point (pending actions result). Allowing lists or tuples for the points would be a "nice to have" imo, but doesn't need to hold this back.
I retested the latest version on a Feather ESP32-S2 TFT with the example code that was added to the docs.
@ryatkins what device are you running it on? It may be the case that there isn't enough RAM in order for it to render it as-is
That is much larger than any GIFs that I tested.
The only idea I can really offer is try to lower the size of the gif. ezgif.com has some compression functionality including possibly scaling the image down some. If you make the source gif smaller but still want to display it larger on the display you could try using scale=2 or some other value on the Group th...
For what it's worth, I downloaded that gif that you posted and I am able to render it as-is on a Feather ESP32-S2 TFT, although it's bigger than the size of the built-in display, so not everything is actually visible.
If you have access to ESP32-S2 based device it may be worth trying on there.
Iโm on a Waveshare RP2040-LCD-1.28
Thanks for giving it a try.
How was the performance of the animation?
On Mon, Mar 6, 2023 at 6:18 PM foamyguy @.***> wrote:
For what it's worth, I downloaded that gif that you posted and I am able
to render it as-is on a Feather ESP32-S2 TFT, although it's bigger than the
size of the built-in display, so not everything is actually visible.If you have access to ESP32-S2 based device it may be worth trying on
there.โ
Reply to this...
@ryatkins I didn't do any timing or real measurements, but anecdotally it seems pretty good to me:
Screencast from 03-06-2023 05:42:42 PM.webm
Better than I thought it would be before I tried honestly. I'm not sure if or how the pixels "outside" of the visible display factor in. Perhaps it's saving some time by not rendering them
I published my audio PR here (https://github.com/gneverov/circuitpython/pull/1). I appreciate any feedback you have, positive or negative. Also please feel free to schedule a review with me to discuss directly. Thanks.
That looks very nice and usable. It seems the ESP32-S2 has more RAM.
It tried to do the same type of animation with drawing vectors and ran into
RAM issues as well.
What would be really interesting is if CircuitPython supported svgs and svg
animations!!
On Mon, Mar 6, 2023 at 6:46 PM foamyguy @.***> wrote:
@ryatkins https://github.com/ryatkins I didn't do any timing or real
measurements, but anecdotally it seems pretty good to me:Screencast from 03-06-2023 05:42:42 PM.web...
For what it is worth I was able to load the GIF onto an KB 2040. The 2040s do not have a lot of RAM so depending what else is being loaded it could be easy to run out.
oh I didn't know that it was possible to mount an SD card as / (it hides the contents of CIRCUITPY until reload as I guess one would expect if it doesn't error)
vfs = storage.VfsFat(sd)
storage.mount(vfs, "/")
docker for circuitpython when
I meant inside circuitpython
oh lol
we could look at what it takes to run mpremote mount it's quite a fun feature
I don't think so. I suspect our stack checking function doesn't check both the cstack and the pystack
Why not put it on the main repo as a draft? That'll make it easier to find
What does the stack checking function check for?
It is because the audio PR is in a branch on top of my previous (unmerged) async PR. There's getting to be a lot of code and I don't know the best way to manage it. I can put it all in one branch if that is easier for you.
do you want to propose both or split them apart?
I think we need to have a discussion about PR strategy. I proposing a large breaking change: how would you evolve the product while maintaining backward compatibility.
generally we have one major release that supports both apis
If there's a new api, does it have to be implemented on all ports? Is there a minimum viable set of ports that a feature should be implemented on?
No, it doesn't need to be on all ports. Starting with one is ok.
I added the pin change pointers to gc root. Let me know where the pin change infra should go, if not in Pins.c. I envision that it would be shared with other possible uses of pin change interrupts (like pulsein?)
Are you sure you are waiting for the transaction to finish before exiting the function? It looks like bits_remaining is decreased when you setup a transaction, not when a transaction completes.
I think I'd just leave the name as-is. It only really matters when we have a mix. The job structure makes it obvious what version it is.
Every week if I produce a new PR of code, you probably don't want to keep reviewing the sum of that against main. So can work-in-progress start being merged into adafruit/main?
Thanks for the update! I like the job names now.
I'd prefer to leave the file names and workflow names as-is and not add the reusable/re prefix.
That depends. If its isolated to its own module then yes. If not, we'll need to think more carefully.
we do have to be aware that folks will start using new apis so we'll want to be clear about stability
//| :param ~circuitpython_typing.ReadableBuffer IV: Initialization vector to use
Right. That's why I think we need to discuss that to work out a strategy.
For example, look at the PRs I have and triage how to merge different part of the functionality.
I'm happy to do that
Great! Would you prefer to do it collaboratively, or asynchronously through PR comments?
Cool. Let me know when you want to do that. I'm going to be out on Monday (3/13) though.
I can in 15 min or so
Sure. Amelia Earhart at 9:30.
@tulip sleet and @onyx hinge can join if they want too
I won't be able to but thanks for the invitation!
I'm happy to resched so you can all comment
Do I need to treat this new table of interrupt information as a GC root? in some weird case (like if you don't save your IncrementalEncoder object anywhere, i.e., a bug) it might be the only thing that would keep the object alive.
I think you can use MP_STATE_PORT or use a finalizer to stop the interrupts when the object is GCed.
I added the pin change pointers to gc root. Let me know where the pin change infra should go, if not in Pins.c. I envision that it would be shared with o...
@slender iron Isn't it better in terms of navigation to separate the reusable from the rest? Ideally, I'd want github to not show them at all.
I don't think reusable means anything outside of this pr
will a _ prefix work?
I would be reluctant to introduce a finalizer since it would add code on all ports.
If the code is moved to the nominally CP-independent 'peripherals' then I couldn't put the pointer table in MP_STATE_PORT.
just so it sorts it together?
ya
sorry @timid bolt and @tulip sleet for bailing. I forgot I had a mobile app meeting
no worries
fwiw, I started a pattern for interrupt tables in peripherals for rp2040 here. I even independently created the same "port gc collect" function from this PR!
I didn't need to store anything in MP_STATE because the gc collect function is used to mark the peripheral's global variables as gc roots.
So, it looks like this issue is caused by the placement of RUN_BACKGROUND_TASKS in socketpool_socket_recv_into() for espressif boards. When web workflow is active; the code:
while (ringbuf_num_empty(&_incoming_ringbuf) > 0 &&
_read_next_payload_byte(&c)) {
in websocket_background() means that after the test for ringbuf_num_empty is done, calling _read_next_payload_byte() can eventually result in background calls, thus ending up calling websocket_background() ag...
Also suspect that the delay leads to DC motor "rattling" when establishing a new motor speed at low PWM frequencies since the two PWM control pins aren't changed simultaneously.
Confirmed. At low PWM frequencies in slow decay mode, the delay causes a DC motor to noticeably chatter when switching between velocity zero and coasting (velocity = None) and back. Don't have a setup to test stepping motors, but would expect a similar issue.
@tulip sleet it looks bleio_hci takes 500+ bytes of bss
is that good or bad ๐
bad? ideally it'd allocate the space when it needed it
(I'm looking at bss to make more space for heap on imx)
bleio_connection_internal_t bleio_connections[BLEIO_TOTAL_CONNECTION_COUNT];
5 connections by default
this is probably it:
// FIX size
#define RX_BUFFER_SIZE (3 + 255)
#define ACL_DATA_BUFFER_SIZE (255)
STATIC uint8_t rx_buffer[RX_BUFFER_SIZE];
STATIC size_t rx_idx;
STATIC uint8_t acl_data_buffer[ACL_DATA_BUFFER_SIZE];
STATIC size_t acl_data_len;
in hci.c
hey @tulip sleet, the adafruit asyncio library is not a subset of the cpython asyncio, so replacing it with the latter would be a breaking change. So would you still want me to PR my cpython port into that library?
spi_device_get_trans_result is blocking until the transaction finishes (when the delay is set to portMAX_DELAY). So we ensure all (up to) 10 transactions return before we move on.
The old code used spi_device_transmit which combines spi_device_queue_trans and spi_device_get_trans_result into one function call, resulting in the same functionality (but with 1 transaction instead of 10).
In the new way up to 10 (as needed) transactions are queued up and then the code waits until ...
what are the interesting differences? The asyncio examples in our guide are very simple, so it may not be a big change.
For simplicity, I would say that the MP asyncio api is not based on the CPython one at all. I agree porting the examples will be straightforward though, since they don't use much of the api anyway.
I only used create_task() and gather(), and asyncio.sleep(). Those are the same. For basic task stuff, do you see it as all that different? I would say it's a subset except for a few things.
For basic stuff it is the same. Advanced methods on Task may vary. CPython has Future. MP has Event, Lock, and Stream which sound the same but are different to CPython's classes of the same names.
I use Task.cancel(), asyncio.CancelledError, asyncio.run(), Task.done()
I used a lock when running multiple seesaw devices trying an async version of the seesaw library
(replacing the mandatory 8ms sleep with an async sleep, access must be protected against multiple reads on the same device)
very few people are using it now, based on how few people are asking for support. The MicroPython stuff is documented in https://github.com/peterhinch/micropython-async.
but yeah none of that is in the guides
I would say we could skip providing a lot of the more historical stuff in CPython asyncio and still have somethign very usable. We could adapt to more CPython-like Event, Lock, and Stream
People can always use an older version of the library for their existing code if they do not want to rewrite it
that has been our philosphy about library updates. We are willing to make breaking changes, and we will rewrite all the Learn Guide code as needed.
Sorry, Lock and Event and CPython compatible, expect for the ThreadSafeFlag part of MP Event.
The CPython api is well layered, so I think it is easy to carve out a subset of it. Not sure which parts are consider "historical" still in 3.11.
only my concept of "historical" ๐ , raw use of event loop primitives, non-task stuff, things like that. I want to promote tasks and TaskGroups
stuff that was in asyncio guides pre 2015-ish (not sure of the exact dates).
not a sharp breakpoint -- it's just that people got more structured about how to use async
Makes sense. I think they've cleaned up a lot of that now in the current release.
@timid bolt do you see a big size difference?
@jepler I have assigned myself #7595 and #7596. I will look at whether your changes to the cwy43 library are now incorporated. There are some interesting changes listed in the 1.5.0 release notes about cyw43:
Do you think these will make a difference?
Blocking cyw43_arch_wifi_connect_ functions now continue trying to connect rather than failing immediately if the network is not found.
[restructuring of pico_cyw43_driv...
Yes. My CPython port is 29 kB (and doesn't currently include locks or task groups) The adafruit/MP one is 9.3 kB. This is absolutely not a space saving change. The benefits of the change are we get a high functionality, high compatibility library with minimum development cost.
are there significant things we could remove?
or, saying it a different way, what kind of code can't we write with the current library?
There is fat that could be trimmed from everywhere, but I wouldn't say there are chunks of things that can be removed. My motivation for porting from CPython was to get functionality quickly. I needed Future and some other things. Plus it is code that is difficult to get correct, so I didn't want to write it myself.
so having Future and/or ?Awaitable
you need plain Future instead of Task?
ok, there is no Awaitable
Yes, need Future. (Awaitable is not actually a class.) I think I had issues with the way MP Tasks worked also.
There is also better error checking and reporting in CPython's impl which costs a lot of code size.
in the current doc:
Futures
A Future is a special low-level awaitable object that represents an eventual result of an asynchronous operation.
When a Future object is awaited it means that the coroutine will wait until the Future is resolved in some other place.
Future objects in asyncio are needed to allow callback-based code to be used with async/await.
Normally there is no need to create Future objects at the application level code.
emphasis mine
Iโm curious if you could have asyncio and asyncio-classic to maintain functionality in the future?
but you need it to write the api libraries you want to write?
Then it could be toggled per build or brought in as a library
This is correct. But system code needs them.
it's not build-time, it's just a library right now. It is all python
there are some optional C helpers, but they are invisible
I figured. I was just curious if it might be better to maintain two until thereโs a reason to replace the current?
for the average user, if we made this change, it would be upward compatible
the functionality we describe in the Learn Guide is the same
i was very careful to describe only the minimum in the Guide
mostly to make it easier to understand
Ah okay
I suppose it would allow for more portability of additional asyncio features in the future
Futures are needed for "driver writers" to create an awaitable method specific to their hardware. fwiw, the only thing you can pretty much 'await' in MP is sleep. There is no functionality for waiting on hardware, which is how they haven't needed Future.
they have plans, with Event or ThreadSafeFLag, I think
I could certainly write a leaner version of CircuitPython asyncio that contains Future and the things I need. But I was quite comfortable borrowing from CPython and I didn't think 29 kB was a lot, considering the larger boards that this targets have MBs of flash, and the library unlocks a lot of potential for those boards to be able to multitask.
so 29kb mpy, you mean?
Yes.
Also my guess is a lot of the bulk of CPython comes from error reporting, which is something everyone is willing to pay for when debugging async programs. ๐
i guess you already had to make some changes to get it to work
How do you mean?
MB of flash yes, but not RAM, except some ESP32
there is a lot of code in https://github.com/python/cpython/tree/3.11/Lib/asyncio that might depend on things we don't have at all
concurrent.future, contextvars, various decorators, etc.
i have to go back and look at your code.
i was just looking in futures.py
Oh yes, I deleted a lot of stuff. I tried to only delete, but not change anything. concurrent.future is definitely out since we don't have threads. contextvars could be nice to have, but I didn't inlcude it. Obvious Windows and Linux specific parts are cut too.
Right. But I don't have a comparision on RAM usage.
does the audio stream stuff we were talking about earlier depend on this?
Not the current PR because I haven't added async support for audio yet.
But any of my new async stuff I'm working on depends on this (e.g., PIO, audio, network, ultimately anything that does IO).
Please go ahead and submit a PR to the library. That will get the code in one place. People can review it and try it, and we can see if its size is a problem in existing code. Maybe we can find some more to trim, or be able to avoid importing except in certain circumstances. We could even release it and put it in the bundle with a different name temporarily, maybe (we haven't done that kind of thing before). We may want to wait until 9.0.0 development to release it as the main library, since the things that would be used by the new libraries will not be in the core.
... Or we could make a temporary new library, asyncio2 or nasyncio or something like that ... We'll talk more about this internally to figure out how we might stage it all.
Sounds good. Thank you.
I'll be on holiday for 2 weeks, but I'll get to this once I'm back.
the response is a single list (shade position, mac address, status success/fail), maybe some other stuff. Under 100 characters for sure
Posted it in help-with-circuitpython and was told to come here, I don't mind being ping ponged back and forth but just not sure where this script behavior falls
ah, sorry
this channel is mostly for topics related to development of the circuitpython firmware itself
it was an ambivalent suggestion for here, just that if you were hitting some internal limit, might be better asked here (number of sockets)
#help-with-circuitpython is better in general if it's not a core issue.
OK- I'll delete the question from here to keep it clean
hi, with the risk of asking a profane question - are there any up to date guides on extending circuitpython with your own C based shared module out there? The only one I found is related to 4.x.x and is not really complete. I'm trying to port an existing one wire bus protocol to circuitpython / esp32. Thanks!
I think there currently is no up-to-date guide.
there were some changes recently
@stuck elbow any project that i can use as a blueprint?
Is there a location I can find those changes or do I have to scroll through the changelog?
I think the most recently added new module was the analogbufio, perhaps you could look at that pull request
Thanks, will do that.
I have one general question - does every c and h file require the micropython wrappers or can I write just one exposed file that accesses other source files in the background?
I think it's your judgment, whichever seems clearer, but the reviewers may disagree...
if it's 3000 lines of a single file, you will be asked to split it, for example
I see, makes sense - thanks for the heads up
is it anything like the existing onewire code?
@tulip sleet I did look into the onewire code, but no it is not really similar, unfortunately
are you proposing to PR this to circuitpython or just use it locally?
if it's specialized we might accept it but not turn it on by default if it's not widely used
it was meant to be used privately only, but it's based on LIN so I might be able to PR that part of it, but I was not planning to for now
if it's just bitbanging, you can copy shared-bindings/onewireio and shared-module/onewireio and just replace the bitbanging guts. Or just copy OneWire in both of those and make a new class. We always start by copying an existing module or class. That gives you a starting point for all the boilerplate. The actual implementation might be rather small.
you will need to add your module or class to various makefile lists in py/circuitpy*. Look there for where the existing onewire file references are and duplicate it.
thanks for that advice - it is requiring some IRQ handling because of tight timings, not sure if bitbanging would be sufficient for that - I will have a look
Oh one question that just came to my mind - if I make the project it usually complains that I need to be on a specific version for build. Is there a way to disable this check while developing?
i'm not sure what you mean. What complains about which version of what?
Does this suggest the issue is not specific to ESP and it could happen on any port?
@tulip sleet I might be dreaming, but on my first test build make complained asking me to checkout a specific tag instead of building directly within the main branch - However, running it now again it does not seem to complain so nvm my question ๐
๐ np
it's not cosmic rays -- there's always a reason, but we can ignore that for now until/if it shows up again.
Yes I'll let you know if I ever see it again!
note that if you cloned from github without unchecking the "only clone main" option, you will be missing the tags, which are used to generate the version number, maybe something was complaining about that ?
yeah that sounds like it could be the cause - I did checkout the tags only later I don't recall if I did that before or after my first build
the esp-idf also complains about tags every time you install or source it, with no consequence though, you have to look for it to notice it
fatal: No tags can describe '630c2724fc8c69eeaaa1bb025de52b99c5cb11aa'.
Try --always, or create some tags.
WARNING: Git describe was unsuccessful: b''
@onyx hinge I am trying to revert to using the cyw43 driver inside pico-sdk. I'm confused because there are multiple mbedtls directories floating around: circuitpython/lib/mbedtls, ports/raspberrypi/sdk/lib/mbedtls, ports/raspberrypi/mbedtls, an also circuitpython/lib/mbedtls_errors, which is not elsewhere. Could you explain which to use? I'd assume I'd want the one inside the sdk for now, but it looks like you use mbedtls_errors for something.
also we use the certs from the top-level lib directory
@tulip sleet oof it's a bit of a mess isn't it.
@tulip sleet lib/mbedtls is what the picow build actually uses. it matches micropython. sdk/lib/mbedtls is not intended to be used at the current time.
lib/mbedtls_errors is also from micropython and has to do with converting mbedtls errors into exceptions with terse text. It's used.
ports/raspberrypi/mbedtls is the worst named thing. It has (A) our mbedtls settings for picow and (B) a copy of the esp certficate handling code that allows it to use the same nina-fw certificate store
so it really might be mbedtls_config
micropython seems to tend away from using nested submodules where possible, and of course it's also using just one copy of mbedtls and lwip across multiple boards ports
sdk/lib/mbedtls is not intended to be used at the current time.
sure, it could be renamed mbedtls_config, and the certificate handling part would be in some other location (probably not in the port)
what is wrong with the sdk/lib/mbedtls that pico-sdk has? Why would they bother if it's not used? Or is it for some pico-sdk wifi code?
i'm just worried the cyw43 drivers care, but if mbedtls is above them, then it doesn't matter, I guess
oh also sdk 1.4.0 didn't have sdk/lib/mbedtls anyway
in that case, I will just use the updated driver dir. Also I have to see if they fixed what you are using our fork for