#circuitpython-dev
1 messages · Page 420 of 1
I had a new idea for saving memory on get-only or getset-only properties. I'll briefly mention it here. We tried before to find some way to encode the "this property has no setter / deleter" within the object itself, but there's really no space to do so. so here's how you do it: You encode it by where they're placed in flash, using sections. So you place all the "get only" properties in section A, all the "get + set" properties in section B, and the "full properties" anywhere outside those sections. Then, you just have to have a way to compare the address of the property for whether it falls in the given section. There are some details to work out, but I think this approach may actually work.
(that new address-checking code just gets added in 2 paths, or at any rate I think it should be)
I would need to make specific measurements but the new delay feels frustratingly long compared to before
Not sure if best to ask/mention here or discord or forum...
I have been playing around with adding ability to talk to Dynamixel Servos, as mentioned in the couple of PR's and earlier issue.
For the heck of it I ported over the DynamixelSDK python code to talk to servos using the rs485_dir
When I tried it on the RP2040 with my mods to support the direction pin, the python code error happened in the dynamixel library code that None class is not itterable...
In the function: https://gi...
(@solid fjord the docs are here https://docs.circuitpython.org/)
https://docs.circuitpython.org/en/latest/shared-bindings/busio/index.html#busio.UART.read
Nice find! I had a quick look at this and commented on the upstream PR:
https://github.com/micropython/micropython/pull/8599#issuecomment-1114256576
Thanks, for the link! I wish google of (CircuitPython uart class) would have returned that link instead!
yeah, when searching for those, google is... 🤷 I believe we actually have better results since removing some older versions from readthedocs, where it used to point you to 4.x or something
though machine in 1.0.0 is not much better
Thanks,
Note: with the issue, I fixed once case of it so far in my copy of the DynamixelSDK code, by:
rdata = port.readPort(wait_length - rx_length)
if (rdata != None):
rxpacket.extend(rdata)
But I am almost sure I still need to it in other places in their code as well, Like the Protocol2 file...
taking a look at my QT Py ESP32-C3 boards, trying to build/flash... No luck so far getting them to boot with CircuitPython. Don't think it's my dev env, since S2/S3 boards build/flash fine. Is there a special trick to it?
Actually, I guess it could be running fine, but it sounds like USB mass storage isn't a thing on the C3 so file management has to be done with Thonny or something?
Ahh, yes! Answered my own question. Without USB mass storage it works fine but just needs to be interacted with via serial. 😄
>>> ```
just if rdata: should both cover None and b"" and makes sense in both contexts, but I agree that it doesn't seem to follow the pyserial API and it might be a thing to fix for CP8 (since it might be a breaking change) though it would be interesting to see how much code is already compatible (by testing if data: and not testing None)
Note as mentioned on discord:
I changed the code from:
rxpacket.extend(port.readPort(wait_length - rx_length))
to:
rdata = port.readPort(wait_length - rx_length)
if rdata:
rxpacket.extend(rdata)
Which is working
When maintaining/building CircuitPython drivers is it worth it to do testing on the cxd56 port? I haven't gotten my hands on a Spresense board yet but it seems like a cool board, just haven't seen many projects using it yet.
I had the same problem with a brand new ESP32-S2 TFT. 7.3.0-Beta cleared up the issue.
Happy to help with this effort!
We sell the board but the port is maintained by Sony. You could test if you want, but for I2C it is likely to just work.
The HX711 driver I submitted to community bundle this weekend is a bit-bang thing, so I’d expect some timing deviation from platform to platform. So far I haven’t seen any issues in testing so far (samd, esp, stm, rp2040 look good) except form some wacky results with nrf, but haven’t dug deep into that yet.
It’s good to know that Sony themselves maintain the port though. Wasn’t sure how that worked
would it make sense to have a board definition for the pico with Maker Pi Pico [base] ? It's technically an expansion board, but it would have the advantage of using the neopixel as status LED (and there's a model with the pico pre-soldered on it).
https://www.adafruit.com/product/5160
Hi all, any success getting i2cperipheral to work with an RP2040?
I have a project where I would like to use an RP2040 as an I2C slave (ahem.. peripheral/target)
If not, I can try to look into it (if time permits), don't want to duplicate effort if others are working on it.
Cheers.
Could this be related?
https://github.com/adafruit/Adafruit_CircuitPython_LC709203F/issues/3
Perhaps try bitbangio with a very low frequency to see if the result is the same as in above bug
Hi Wattsie,
I'm afraid I haven't been working on it. Truthfully, the availability of
Adafruit's QT Py ESP32-S2 has lowered the priority of this for me -- I
would still love to be able to chain 2040's together through their S-QT
ports, but the esp32-s2 aren't that much more expensive and can use WiFi
for communication, so I've been going in that direction.
But if you manage to get the I2C peripheral mode working, I'd certainly
love to have that as an option -- and can happily promise to sin...
Here's a document for folks at the sprints to collaborate in: https://docs.google.com/document/d/10WugUTj_L7SQ0jEyQWUaYSpKZwz1DXWgrcDjFbtbZYc/edit?usp=sharing
<@&356864093652516868> Reminder: CircuitPython weekly meeting today 11am Pacific / 2pm Eastern / 1800 UTC here on Discord. Here is the notes document for todays meeting: https://docs.google.com/document/d/1QEMJLYwOVee_Bi0MKcS4SW5jKSc5SA0rr14YBfRhjRQ/edit?usp=sharing
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! We may have some remote participants from PyCon.
We're working on getting mypy working, and figuring out which CPython version and libraries need to be installed. More in thread.
I'm tracing up to the root dependencies that will be imported by other libraries. So far, I'm getting to _blueio (Adafruit_Blinka_bleio). Let me know if I'm on a fools errand 😛
I think your headed in the right direction. Getting all of the dependencies installed helps because it may allow you to find usages of functions or other hints that may be relevant to the types needed.
Trying to build the pulse oximeter library under Windows 10 and running into problems installing the pythonnet sub dependency. Recording what I know here in case someone else is having the same problems
Does it make sense to add type annotations to bleak? It looks like the adafruit fork has issues disabled, so I'm guessing you're still pushing to upstream (and certainly I could make a PR upstream). There isn't anything in the upstream repo regarding improvement of types BUT mypy certainly has quite a few issues it's raising
You could open an issue in the bleak repo and ask if they would be interested; right, it does not make sense to add them only to our fork.
I think we are primarily concerned with our own repos. But yeah like Dan mentioned you could raise the issue upstream to see if they are interested in having them added.
I'll open an issue just to get that convo started, but will focus on _bleio then
Native _bleio annotations are here: https://github.com/adafruit/circuitpython/tree/main/shared-bindings/_bleio
to crib from
@gilded cradle what's your recommendation for semver release for that typing package requirement fix? Increase patch version? Or minor?
When I run pre-commit I am getting errors from pylint:
************* Module adafruit_ble_ibbq
adafruit_ble_ibbq.py:141:16: E1101: Module 'struct' has no 'unpack_from' member (no-member)
adafruit_ble_ibbq.py:162:51: E1101: Module 'struct' has no 'unpack_from' member (no-member)
I didn't make any edits to that
I usually bump the minor (farthest right) number when I make releases from PRs that add typing info.
I think we are primarily concerned with
that's pylint being weird, last time I got that happen I believe I erased the pre-commit cache, and updated the pylint version from v2.11.1 to v2.12.2 in .pre-commit-config.yaml and maybe the version installed in my environment
@proven garnet probably the lowest number since it's more of a bug fix than a new feature.
Thanks @lone axle and @gilded cradle!
Thanks that fixed it
Haven't used bitbangio yet but is there a provision for bit-banging variable-size shift registers? Or is it just for broad protocols?
edit: Should've just RTFM'd, looks like its just I2C/SPI at the moment. Might make a feature request (or try my hand at a PR) for a 'general purpose shift-register' class to add in there
bitbangio is generally a subset of busio, implemented as "manual" bit-flipping. A shift-register class is kind of outside its purview. Such a class could be written as a Python library unless you are looking for very high speed.
i.e. bitbangio is the "soft" implementation of busio
Ahh, thanks for the detail. 🙂 Was poking at the code seeing if the idea would fit in there but yeah, definitely not the place for it.
My main desire is to get more deterministic behavior when doing two-wire "clock-then-read-a-bit" stuff.
For the HX711 driver I've found that RP2 PIO is amazing for this kind of simple stuff. But flipping bits at a high level ends up with different timings on different platforms... Which is only an issue when the chip I'm reading from has a threshold shorter than the shortest pulse possible with high-level bit banging.
Captured some data illustrating this here:
yeah, in this use case it's a "clock rising edge, clock falling edge, read in a bit, repeat" scenario.
I guess most general purpose shift registers won't have strict timing requirements so it'd just be for edge cases like the HX711 that have a max time limit between pulse edges before it resets
if you just use SPI, in what way does that not work?
I haven't tried using SPI actually, the chip doesn't explicitly use/support SPI since it's just a two-wire thing.
Hmm, yeah... Thank you for that hint. Might be able to just wrap it in SPI. I just need granular clock count control (to clock only 25, 26, or 27 times)
Or with rp2040 try PIO peripheral
PIO works great. 🙂
Very deterministic results! Took the time to make a PIO class for the driver since it was so solid.
https://github.com/fivesixzero/CircuitPython_HX711/blob/main/hx711/hx711_pio.py
took some time to learn PIO and massage the behavior into place while tracking with a logic analyzer.. But the results were worth the effort.
Some screenshots of logic analysis are in the issue I posted above, with PIO performing incredibly well.
That is rather inconvenient to implement!
Really simple in assemlbler, really frustrating in high level languages 😂
Had to brush up on bit shifting/masking to make sure things aligned right with Pythonic 32-bit ints
Thanks, I haven't read the whole conversation, just dropping by while waiting at the airport
np, thanks for dropping in, hope the travels go smoothly!
For now I think I've fixed the GPIO driver as much as possible by simplifying the loop. nrf seems like it has the most non-deterministic high-level bit-banging timing results in my testing so far. Just about to test and see if that fixes it.
https://github.com/fivesixzero/CircuitPython_HX711/commit/41831e67c72a7dd39daff567115040e29a5451ae
The nRF implementation is multi-tasking, and will be interrupted for BLE things. You may see similar issues on ESP32-nn, with its background wifi tasks. So we provide things like PulseIn and PulseOut to guarantee timing. But you need both at once, so SPI and PIO sounded like candidates.
Thanks for the info 🙂 Also saw a lot of jitter on esp but nrf was the only port to fully fail on reads with the simpletest code alone.
Will see if SPI works, that's a great idea that I hadn't considered yet. Sounds like a great way to get the benefits of the low-level platform-specific clock/bit-read code.
Maybe someday everyone will have PIO blocks in their chips? 🙂
👋
Run Python code in your HTML.
Celeb sighting! @Dan_Halbert from the @CircuitPython team is here to check out our student projects. Thanks so much for stopping by! And thanks for your hard work!
PLEASE SUBSCRIBE https://www.adafruitdaily.com
Ooh neat, looking forward to that guide. I'd be happy to help out with testing new ports like that but don't know how yet.
for that keynote about the EHT. It was super fascinating!
plus 1000 for this haha
Could I have git on the CIRCUITPY drive? Would that work?
I would love a PyCharm plugin for something like that. 🙂
What about rsync between CIRCUITPY and another folder (I am on Windows, so maybe not for me...).
Mu keep a copy of the file as long as it is open, in case of problem I can save it elsewhere, maybe Notepad++ have that too.
Thanks all for attending!
mu's logs have also saved me many a time
Do we have any, even rough, histogram-type data on editors / IDEs people use for CircuitPython?
thanks for hosting @tulip sleet
Yes, thanks Dan!
I use that to back up all connected boards, but it's manual
alias cpbackups='discotool backup --format "{timestamp}-{device}_{drive}_{serial}" ~/Backups/CPBackups'
Work in progress... but super slow.
I haven't seen any, but it may be out there somewhere. I would expect Mu to be much more commoon than anything else amongst standard users. But it would be great to offer it as plugins for each IDE that we know of.
fwiw, I use Atom, but that's not one I see people mention a lot
I wonder if it would be possible for a CP core module (optional of course) to be set up to do backups back to the host device, then it is editor agnostic. May be too much trouble
I think Mu, PyCharm, VSCode, and to a lesser extent Atom, and much lesser, vim, emacs, Notepad++
I'm not sure a core module can tell the host what to do
Circuitpython knows nothing of the host device
Maybe sublime too. I think Scott uses that one, though I'm not sure about on circuitpython code vs. core development.
Yeah I guess the CP device would need USB host to now be the device too
The trouble I have with most editors is that they don't seem to handle multiple simulataneous Circuitpython devices very well (if at all) ...they get very confused (Atom does handle this well)
What about not writing to the device at all, but only copying the whole stuff to CIRCUITPY when you click a button? I am still in the rsync kind of mode, a solution external to the editor would work for all... like an USB key backup program that detect the mass storage and take a copy.
the VSCode plugin handles this well for me, with each device being opened in its own new window
@idle owl @gilded cradle : Came up in today's meeting, and I brought it up In the Weeds; might be something for someone to work on in the sprints for Mu, VSCode, PyCharm, emacs, vim, atom: implement auto-backup when writing to CIRCUITPY from an editor or IDE.. This would be an IDE/editor-specific plugin or whatever that writes a copy of what you write to CIRCUITPY somewhere else as well.
also some discussion above ^^
pycharm handles it okay if you set up your project in a very specific way. Basically having the "real" project directory somewhere on the PC and then adding /media/[your_user]/ as a sources_root in the project then it will list out CIRCUITPY, CIRCUITPY1 etc.. for all of them (although it will also show thumbdrives and other removable stroage if they exist)
somebody shared that a long time ago, which uploads to a board when saving a file in the designated directory basically
#!/bin/bash
if [[ -z "$2" ]]; then
TARGET="/Volumes/CIRCUITPY/"
else
TARGET="$2"/
fi
echo "$1" to "$TARGET"
fswatch -o $1| while read num; do cp -vX "$1" "$TARGET";echo "sync";done
When maintaining a Community Bundle library should I submit a PR to the bundle for new version releases, to make sure that the submodule points to the latest tag/commit? Or does the bundle release script handle pulling the latest version?
Fair enough. No idea if folks here have that skillset.
Super neat!
Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern / 1800 UTC here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868>
https://docs.google.com/document/d/19SfrFM1BeAqltmW6iBdWZYqqQ4lmiQaiqLzV8_ea7eo/edit?usp=sharing
CircuitPython Weekly for Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting -...
@idle owl have you talked with any of the sprinters about updating version of pylint used by pre-commit? I noticed that was changed in this PR: https://github.com/adafruit/Adafruit_CircuitPython_BLE_iBBQ/pull/9/files and wanted to check with you before leaving feedback for it. My assumption is if / when we want to update that we'll do it as a patch or script across all libraries at once rather than one-offs in PRs like this.
ah, that was that, but I believe the issue might not need to change the pylint version for the CI, it's weird, it was mentioned here a few times and I'm not sure what's going on with that struct problem
#circuitpython-dev message
@steady garden This is the blinka-level issue tracker: https://github.com/adafruit/Adafruit_Blinka_bleio/issues
I think now that you only need to update the local version of pylint (pre-commit doesn't use its own cached one all the time) and delete the pre-commit cache (which is in ~/.cache/pre-commit for me)
Thank you, I found some issues in the pylint github talking about it as well. It may be also tied to specific versions of python which maybe accounts for why we don't seem to see it when it runs in actions.
oh yeah it might something like that too
Uff, I did not discuss it, and yes if we update, we want to do it across the board. So go ahead and leave feedback.
This PR adjusts the values for NEOPIXEL and NEOPIXEL_POWER in board.c to match those in defined in adafruit_qtpy_esp32s3_nopsram/mpconfigboard.h and tinyuf2's adafruit_qtpy_esp32s3/board.h
Currently this code does not work:
import board, digi...
Sorry for the confusion! Wasn't able to make the meeting and forgot to note it in the doc!
No worries! that original message was from a different meeting a while ago. possibly discord notifications are getting confused for some reason and showed it to you now.
Something like this would be very useful for a project I'm working on currently. I have 2 boards. One in a stationary box on my boat and another in a hand controller. I'd like to try to keep communication between the 2 boards as simple as possible
I received my Lilygo T-oi plus Esp32-C3. I'll have to make the pinout file.
@lone axle we only want to type functions and methods, not attributes, right?
Or the more the merrier?
correct. Only function arguments and returns. We tried on attributes (or "normal" variables) at one point and mpy-cross didn't seem to be able to compile those ones. We'll need that fixed in mpy-cross before we could start adding annotations for them in library code.
Sounds good, thanks!
Good to know, I put up a PR (https://github.com/adafruit/Adafruit_CircuitPython_RFM9x/pull/73) with a wider reach of annotations in it (beyond just function and method returns), I'll scale it back and keep this guidance in mind for the future!
@muttstang I've not heard anyone talk about it.
Not sure where to ask this, but it seems CirPy ESP32S3 internals-related. I'm experiencing disturbingly high-current draw (150mA) on QT Py ESP32-S3 when sitting idle in the REPL. Right out of reset it'll draw ~50mA but then jump to 100mA. If I do import adafruit_ble; r = adafruit_ble.BLERadio(), current draw immediately goes to 140mA and keeps rising, with temperature at the Vreg going up to 150ºF and feeling dangerously hot. And the temp keeps increasing, seeming to be in a slow thermal runaway. These photos were taken about 10 minutes apart. There's a thermocouple kapton'd on top of the Vreg. This is running Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Adafruit QT Py ESP32-S3 no psram with ESP32S3 and on a fresh local build
Please file this as an issue - thanks. If you have measurements from, say, an ESP32-S2, that would be interesting.
okay, thanks. wasn't sure if it warranted a CirPy issue (in case it's a board design issue or ESP32 problem)
we should test it against other ESP32-S3 boards doing the same thing. But getting it in the issues system will add it to the to-do list.
Is there a way to force USB [re-]enumeration? I regularly get events on CircuitPython devices that eject the drive and it doesn't remount, though serial does re-connect. macOS.
This request is to support my opensource RP2040 based mechanical keyboard.
HW Repo here for reference: https://github.com/BigTuna94/RP2.65-F
hiya did raspi grant you the USB PID?
Hi @ladyada! No, the USB PID/VID codes were not from Raspberry Pi.
I've just updated the ones in this repo to match those in my request to the pidcodes repo. Relevant request here: https://github.com/pidcodes/pidcodes.github.com/pull/734
Do you still have programmatic control of the board? You could force a reset with microcontroller.reset() Otherwise, this is why I have a lot of USB hubs with per-port power switches 😀
CircuitPython version
Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Adafruit QT Py ESP32-S3 no psram with ESP32S3
Code/REPL
import _bleio
Behavior
I'm experiencing worryingly high-temps (150ºF) and high-current draw (140mA) on QT Py ESP32-S3 when sitting idle in the REPL. Right out of reset it'll draw ~50mA but then jump to 100mA. Upon import _bleio current draw immediately ...
Filed on my request after Discord discussion. Thanks!
CircuitPython version
Adafruit CircuitPython 7.2.5 on 2022-04-06; Adafruit QT Py ESP32-S3 no psram with ESP32S3
Board ID:adafruit_qtpy_esp32s3_nopsram
Code/REPL
import time
import board
import neopixel
print("Hello, world!")
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixels.brightness = 0.3
while True:
pixels.fill((255, 0, 0))
time.sleep(0.5)
pixels.fill((0, 0, 0))
time.sleep(0.5)
print("Hello, world!!!")
###...
This is also happening with
adafruit-circuitpython-adafruit_qtpy_esp32s3_nopsram-en_US-7.3.0-beta.2.uf2
@brentru check yours? mine gets warm but not 150
I was worried is a one-off issue two and checked the other QTPy ESP32-S3 that I have and both behave similarly.
No, still doesn't work :-(
I just tried the esp32 2.0.3-RC1 Arduino core. And:
- 20mA - ROM bootloader mode
- 40mA - TinyUSB bootloader mode (not used but interesting)
- 100mA - Running
void loop() {Serial.println("Hello world!"); delay(500);} - 156mA - Running "BLE_uart" example but not connecting
So not a CircuitPython issue exactly but wth?
I wonder if it's a Mac issue (perhaps related to too many USB devices), or a hub issue. The software already escalates to reloads then resets when some exceptions accumulate. I'll try to track whether it persists after resets and not only after reloads.
there's no way for the device itself to know if the host recognizes its USB volume though, right?
I try to reset only as a last resort due to the file system corruption risks and the data loss (no sleep alarm memory and I'd rather not use nvm unless I have to)
Sorry, my bad - I just installed the .uf2 file, not the .bin file! Here's the .bin version that is working:
Adafruit CircuitPython 7.3.0-beta.2-6-gbf0e1fafa on 2022-05-02; Adafruit QT Py ESP32-S3 no psram with ESP32S3
Board ID:adafruit_qtpy_esp32s3_nopsram
@todbot this is resolved right?
Good call.
- 110mA - Running "WiFiScan" example Arduino sketch
Thermocouple on vreg reading about 112ºF.
note your temps should be in C - 150*C is silicon limit, do you mind converting/editing comments above?
ok just to verify you're getting the same power draw on the Feather and the QT Py S3, its just the S3 is warmer right?
there's not a lot of ground plane on the QT to dissipate the generated current, and it is a dual core 240 mhz processor. so being toasty isnt that out of bounds
@UnexpectedMaker are you seeing similar power draws? i dont have one of your boards with me right now to check :)
@ladyada I see approx 145mA draw when importing _bleio - but temp wise on my TinyS3, it's not getting above 45deg C after about 5 mins.

I am also seeing similar power consumption, but not excessively high temperatures. The regulator on top is at most 50C, and the ESP32-S3 is about 45C. I have essentially the same measuring equipment as @UnexpectedMaker. I also tested with a Thermoworks Thermapen Mk4 cooking thermometer, which has more sinking ability.
My QT Py has header pins installed, which are getting warm and probably acting as a good heat sink. @todbot, it appears you do not have header pins installed.
@todbot assuming the current is OK (seems like its high for just an import but like, not a hardware issue) - can you check the temp rise of the other 2x S3 QTPys u have? it may be our RF isnt tuned well enough and/or im wondering if its a one-off
I'm thinking this is just a vreg heatsinking issue with the QTPy just being so small that there's not much copper on the board and the ESP32 being known for having 130mA BLE "by default" that people complain about it.
The Feather ESP32-S3 I have has similar current consumption, but its vregs don't get that hot (40ºC at most)
I tested all 3 of my QT Py ESP32-S3s:
- All three behaved the same: 140mA when running "BLE_uart" Arduino sketch
- Headers do seem to act as heatsinks, it was ...
@todbot I think it's less about the LDO and more about the lack of ways for heat to exit the board. My TinyX boards run hotter than my Feather format boards, with the same specs. The Feather boards have 3x more PCB surface exposure to air, allowing more heat to get into the copper pours, and then dissipate out off the board.
The QT Py is smaller than my TinyX boards and double sided as well, so even less air contact area for heat to dissipate. That might be reflected in components that get...
I was assuming it was the LDO producing most of the heat, but yeah totally. From reading, looks like the ESP32 heats up too.
Aaargh, I am translating Arduino code into CP code. Now that I have almost everything working, I discover this learn guide: https://learn.adafruit.com/arduino-to-circuitpython/overview
If a "uf2" and a "bin" behave differently, that is a bug that needs to be addressed.
@deshipu what hardware does this affect, is it anything adafruit sells?
No, I stumbled upon this by working on a new display, and I simply forgot to set it to monochrome. Normally you would never use SH1107_addressing with color or grayscale displays, because it doesn't really make sense for them. So this really isn't a problem as such, other than maybe it should be an exception being raised rather than a crash. On the other hand, adding a check and an error message is going to waste additional space in the flash, so I'm not sure it even makes sense to fix it. ...
Hi @onyx hinger, welcome back! If you have a brainstorm for flash savings, go to it. These are the open 7.3.0 issues:
Of these, I am working on 6263, but it's in progress with Espressif, and may not get resolved soon. I will probably work on 6311 as well. 6307 is external. 6286 and 6258 deserve some checking by either of us.
thanks! is 6311 another i2c thing?
yes, I think so
6113 could just use a validation chek
as you discussed
it can use one of the argcheck.c checks
hmm I was hoping to save hundreds of bytes but I only saved 96 bytes 😕
oh :/
more checking on it to do?
per Limor, i am working on a hw test suite, first for digitalio, then analogio, to vet the S3 port
will also be applicable to any other port
I think I made an incorrect estimate, because I forgot a property always has a pointer to the property type object
more savings on larger ports, probalb
yeah
A property with only a getter shrinks from 16 bytes to 8 bytes; a get & set property shrinks to 12 bytes. However, new tests are added in some fast paths, apparently costing ~120 bytes on samd21. Net, 96 bytes are saved on the trinket_m0 build.
well, there's the patch. didn't save as much as I'd hoped, but I know this idea of saving the wasted space for the deleters and setters had been rattling around in your head @tulip sleet and mine for awhile without being successfully implemented..
I think I suggested encoding it in the .base.type value somehow, maybe that also didn't save much
I think you re-read this before coding this? https://github.com/adafruit/circuitpython/issues/4899#issuecomment-864406406
I've tried again in #6337 and did get some savings. The approach it takes is to organize "get-only" properties into one region of flash and "get-set" properties into another; in each flash region, they're assumed to have just 1 or 2 proxy slots rather than the traditional 3. It avoids adding additional Python types or performing weird "low bit tricks", and saves 8 bytes for get-only and 4 bytes for get-set (each). However, ~100 bytes of code end up added. There is still a net savings on Trink...
Tested: Qt Py ESP32-S3 running WipperSnapper Sketch (1x AHT20 sending measurements to AIO every 5m), arduino-esp32 2.0.3-RC1 core.
Avg. QT Py ESP32-S3 Temp (NO headers): 24degC
Avg. Environmental Temp/Humid: 18degC/48%
Testing performed:
- pygamer still works
- when running the crash reproducer from #6113, it doesn't crash
I did not immediately turn up an sh1107 display for testing, it would be good to test with one before merging this PR. Website says I do have a https://www.adafruit.com/product/4650 it just didn't immediately come to hand.
@todbot yah your boards probably have less-than-ideal tuning which causes some RF self-heating, but also - its a small board, with a powerful chip. the regulator is doing a lot and there isn't a ton of space for it. your board isnt damaged and wont be damaged from use, its just a toasty lil boy :)
@deshipu wanna test/review?
hmmm wait the issue says that SH1107 could be grayscale displays in which case this patch is wrong (it forces SH1107 quirk OFF except for 1-bpp displays). https://cdn-shop.adafruit.com/product-files/5297/SH1107V2.1.pdf doesn't mention the possibility of a 2-bpp mode.
I might have been to hasty when I said SH1107 addressing only makes sense with 1bpp, it certainly breaks with 16bpp, though. I don't really have any 2bpp or 4bpp displays that use SH1107 addressing to test.
I'm afraid the subrectangles = rows_per_buffer/8; line might still crash with 2bpp right now?
@todbot We'll close this for now, and note the temperature characteristics in the guide. We appreciate your original writeup: it was definitely worth investigating, especially since it might have been a CircuitPython issue. Thanks.
@lone axle lightly following along on my lunch break, I'm happy to break out some of those Protocols into the circuitpython_typing library. Good point on Pixel, I had added the led based things to it not too long ago
It's led.py in that package
Also, good point that if a ton of classes use value similarly, it makes sense to define the duck for wherever it quacks 🦆
@todbot you could attach a smol heatsink if you like
https://www.adafruit.com/product/1493
I hoped it would catch your attention! :)
LGTM
ping @ZodiusInfuser; I think this should be fine for you.
The main CircuitPython page for UARTS
https://docs.circuitpython.org/en/1.0.0/docs/library/machine.UART.html
did not exist, but I did find...
https://circuitpython-jake.readthedocs.io/en/latest/shared-bindings/busio/UART.html#busio.UART.read
This is the doc page you want; not sure where you got the 1.0.0 page URL, that is ancient.
https://docs.circuitpython.org/en/latest/shared-bindings/busio/index.html#busio.UART
RTD is linked several places, e.g., see along the top of th...
.. but the core says (at least according to source code comments inherited from micropython development):
if (mp_is_nonblocking_error(error)) {
// https://docs.python.org/3.4/library/io.html#io.RawIOBase.read
// "If the object is in non-blocking mode and no bytes are available,
// None is returned."
// This is actually very weird, as naive truth check will treat
// this as EOF.
The Python docs make the distin...
I'm going to go ahead and close it up. It appears to me that the behavior is deliberate, and matches the documented behavior of io.RawIOBase.read.
So then this does point out that:
Adafruit CircuitPython 7.3.0-beta.1-31-g73f6b4867-dirty on 2022-04-28; Teensy 4.1 with IMXRT1062DVJ6A
>>> import board, busio
>>> print(board.UART().read(5))
b''
should really be None.
Working toward #6326, by adding links to tutorials for busio. Could theoretically cover for providing additional documentation for the following builtin modules:
busiobitbangio
You're right, I missed the part where it was inconsistent within our various ports, after I thought I'd seen that we had one consistent block of code to handle the condition. Reopening, as apparently mimxrt needs a block similar to
if (total_read == 0) {
*errcode = EAGAIN;
return MP_STREAM_ERROR;
}
return total_read;
}
from RP2040
Working towards #6326, adds links to CPython documentation for time module
Thanks! good to merge if green.
Thank you @jepler! This was on my list to get to, honest! 😅
Can we do more of these at once? This generates ~3-4 hours of builds.
I can add a few basic ones so save time if you'd like! I'll do a bunch that are subsets of CPython here
That's great too, feel free to re-request review when you're done.
@kattni Is it possible to be connected to the REPL when doing this? if so, what does the REPL show in each version?
Thanks! good to merge if green.
Keep adding as many as you can do - they are easy to review and the fewer builds and merges the better, in this case.
Also each commit restarts the builds, so if you can group changes into one commit or submit commits all at once, it will also save time.
@tulip sleet do you think https://github.com/adafruit/circuitpython/issues/6213 and https://github.com/adafruit/circuitpython/issues/6286 are related? Or is it just concidentally the same message?
CircuitPython version 7.2.1 and later Code/REPL import board uart = board.UART() Behavior on reload: >>> soft reboot Auto-reload is off. Running in safe mode! Not running saved...
6213 it was due to a gc-able object inside the board default object; I didn't look yet to see if 6286 is the same thing. 6286 needs a re-test
I was confused by the reporter's follow-up about clock stretching, that seemed like a non-sequiteur to me
me too
this is busio.I2C(board.SDA, board.SCL) so it would not be the default BOARD object
good point 🙂 , really need to test here with a similar setup
it's an interesting clue if it could be related to clock stretching. the sample code is incomplete and for a non-adafruit board
i am looking to see what the actual I2C device is
it looks like some home-grown microcontroller software, because the firmware is upgradable
but I don't see still why that would cause the error that it caused
I'm trying to duplicate this, but my set-up isn't like the original reporter, and the original report is not a complete program.
My test board is a pygamer, because it was handy, the same microcontroller family, and has a built-in i2c device
My test:
import busio
from board import *
import adafruit_lis3dh
i2c = busio.I2C(SCL, SDA)
assert i2c.try_lock()
print(i2c.scan())
i2c.unlock()
lis3dh = adafruit_lis3dh.LIS3DH_I2C(i2c, address=25) # address jumper is pulled hig...
Agree on closing this issue. Everything seems to be working as intended. I was all excited to try BLE on ESP32 and was startled it was so hot when idly grabbing it. But after reading up, I see ESP32 BLE is much less developed than NRF. Not surprising, I guess.
@ladyada ahaha that heatsink is adorable! I'm sure I'd fat-finger it to oblivion. And right now I'd rather use an NRF52840-based approach.
I don't see anything in busio.I2C that would make a reset-during-clock-stretch different than at any other time
Okay @jepler and @dhalbert that's what I can immediately find!
You used several different styles of linking, do you want to comment on why?
I actually was working on the web interface of github when I noticed the shortcut, so my copypasta wasn't too efficient; let me refactor to use that one.
The directive actually came from the .rst files, so I'm glad it works in the source docstrings as well!
If there's a standard order we want the note in, let me know (as in, it should be immediately after the module name and before any other information).
Going to just close, fix, and add more things so I don't eat up time with the CI.
If there is a standard order, I'm also happy to just fix it in another PR that adds more documentation so it doesn't have to be rerun here
Fixes #6179.
I keep encountering cases where I would like to microcontroller.Pin objects to be in a set() or be dictionary keys.
I just tried both the .bin and the .uf2 and both work as intended. I think this issue can be closed.
Pedantically, here's what I did:
Test .BIN
- Put QTPy ESP32-S3 into JTAG/Serial bootloader mode (hold BOOT + click RESET)
- Go to https://nabucasa.github.io/esp-web-flasher/
- Connect to QTPY serial port
- Click "Erase", wait for it to complete
- Load "adafruit-circuitpython-adafruit_qtpy_esp32s3_nopsram-en_US-20220502-bf0e1fa.bin"
from "https://adafruit-circuit-pyth...
@proven garnet How do you feel about me using the photo with you, me, melissa and kattni in an adafruit blog post about pycon? I would say something like "we were also joined by Alec [or Tekktrik, your option] who has been helping us with CircuitPython for a few months".
if you want to see the photo before I post it I can DM
Fixes #6268, and also adds board.LED to PyRuler.
Thanks! looks sensible, didn't test or consult schematics.
Can you use this existing function?
mp_obj_t mp_generic_unary_op(mp_unary_op_t op, mp_obj_t o_in) {
switch (op) {
case MP_UNARY_OP_HASH:
return MP_OBJ_NEW_SMALL_INT((mp_uint_t)o_in);
default:
return MP_OBJ_NULL; // op not supported
}
}
It's used, for instance, for function objects unary op slot so that they can be set members...
I would be thrilled!! Feel free to use either or both my real and username!
@tulip sleet or @onyx hinge - that doc PR I made to the core passed doc build if you want to cancel it and move on
I will wait for a couple of regular builds and then cancel, thanks!
eventually we might check to see if a PR is ONLY comment changes, which would mean doc only, and not build boards
Fixes #6317, I hope! Will get tested at the next release.
@tekktrik Will this work? (I noticed information had a typo anyway.)
//| |see_cpython_module| :mod:`cpython:random`
Yup! Tested locally, it's the same trick used in the *.rst files! I'll fix the typo.
Yup! It just adds the hyperlink. Seemed better than using the note, because the two modules have different names. I can use the shortcut note if you think that's better though.
Note as I discovered the differences in these return values as part of the code to try to handle Dynnamixel messges
I added the changes for this into that PR:
https://github.com/adafruit/circuitpython/pull/6328
Can you use this existing function?
Oh, sure, I didn't realize it existed. I have some other places I can use it too.
- [ ] Will need to shrink CPX displayio build with
CIRCUITPY_ONEWIREIO = 0to accomodate https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/116.
Since this board is showing up as an unknown board, I'm going to hide the board for now which requires a file in place. Feel free to replace it if there's a merge conflict.
Changes look good to me.
Tested with a locally running server. The micromod device now shows images and more information and the Motor 2040 has been removed from the downloads list for now which was the intention as far as I understand it.
I created a concurrent flasher... Would love it to get some love from others!
have you thought of using discotool to find the board ?
it finds boards, board info, and the associated drive, in a multi-platform way, including fixes to serial.tools.list_ports on mac and windows
Thank you! Looks good, didn't test. Too bad none of the other savings are in things enabled in our tiniest ports.
Not sure how you'd test this, but no obvious problems with the yml syntax. I did verify that a secret with the name shown exists in the repo under the settings tab, visible only to project admins.
Dan's suggestion of changing it from "socket" to "random" seems dubious :stuck_out_tongue_winking_eye:
so, I'm exploring a trick where we add a subdirectory to the adafruit_circuitplayground that is used to host the frozen version by using symbolic links, like this, and change the frozen dir accordingly:
frozen_version/
adafruit_circuitplayground/
__init__.py
circuit_playground_base.py
express.py
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground/frozen_version
Thank you! Looks good, didn't test. Too bad none of the other savings are in things enabled in our tiniest ports.
and that compiles and runs
>>> import adafruit_circuitplayground
>>> dir(adafruit_circuitplayground)
['__class__', '__name__', '__file__', '__path__', 'sys', 'cp', 'express', 'circuit_playground_base']
>>> from adafruit_circuitplayground import cp
>>> cp.temperature
26.1708
size change:
circuitplayground_express 248476 bytes (latest)
circuitplayground_express 247352 bytes (cpx_frozen_lite)
I checked off the "done" items in #6326. (No need to edit, you can just click on the checkboxes.)
@jaunty juniper that's interesting! I don't think symlinks (which mean no complicated processing of files or filenames) were discussed the last time this idea came around. I like it.
or anyway it wasn't a part of the conversation I was aware of.
I remembered how the stage frozen library does it
I tested running circuitpython-build-bundles in the library's directory and that worked without taking additional files, maybe because of the prefix. I haven't tested with the full bundle build, if there's an issue we could always add a special subdirectory to ignore (like "test" or "docs" is)
I didn't spot any problems, but no testing performed.
Note: This is to fix the issues in https://github.com/adafruit/circuitpython/issues/6310
Please use the special syntax (by editing the initial comment on the PR) to 'link' issues that will be fixed by a pull request. It's super helpful. You can do this anytime before the PR is merged.
seems to work fine with the bundle too
Ah okay, I did not realise. Thank you.
@onyx hinge that would be the changes that seem to work for me:
https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/compare/main...Neradoc:frozen-module-subdirectory?expand=1
https://github.com/adafruit/circuitpython/compare/main...Neradoc:cpx-frozen-lite?expand=1
@jaunty juniper this seems quite nice; will it work on a Windows build?
not working on Windows is not necessarily a show-stopper
that is the question. I'm not setup to build CP on windows, I wonder what git does with symlinks there
if it checks out the original file instead of the symlink, that might compile ok, if not 🤷
note that the builds that use the stage frozen library also rely on symlinks
You could submit a PR to try, and it will be tested via the Windows build CI
we build some representative builds on Windows
so if stage works, it probably will
https://github.com/adafruit/circuitpython/blob/main/.github/workflows/ports_windows.yml, which I think you know about
first, the PR to adafruit_circuitplayground must be made and released, so that the files even exist
I'll open both, with a comment on how one depends on the other
This PR requires an update and release of the adafruit_circuitplayground library (followed by updating frozen modules in this PR) before it can be merged.
It changes the frozen directory of the circuitplayground library to a subdirectory with a copy of the library made using symbolic links excluding the CPB specific file. Reduces the size of the CPX build by 1148 bytes.
Note: it's important now to NOT freez...
I don't see what changed since the previous iteration, still looks OK as long as it's green.
I'd like to see this happen, it gives us some breathing room. I suspect the PR will be red in its current state, for the reasons given in the PR, though, so no surprises there but it means we can't merge yet.
On samd21, common_hal_os_urandom() just does return false; -- I guess there's no RNG there. That's why the random number generator is seeded so much more poorly on cpx. However, at pycon we were testing with cpb, where we do have a RNG. It's odd, then, that the initial random numbers appear to be so poorly distributed on cpb as well. Perhaps the behavior of os.urandom on cpb bears a bit more investigating.
We believe this is fixed. In fact, we believe so strongly that it is fixed, that we fixed it a second time.
There was a stray < character at the end of one file, I think from typing in the wrong window. Thanks!
This is clever! I have an experiment or two I would like to try before approving.
CircuitPython version
Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Raspberry Pi Pico with rp2040
Code/REPL
import time
import board
import pulseio
pulsein = pulseio.PulseIn(board.GP21, maxlen=5)
time.sleep(2.2)
pulsein.pause()
if len(pulsein) == 5:
x = [pulsein.popleft() for _ in range(5)]
print(x)
else:
print(len(pulsein))
Behavior
Output doesn't match input. Final pulse width is at the beginning of the list
De...
I've fixed a wrong sizeof() as indicated by some builds, and also this alignment issue pointed out by the old 8086_commander CI build:
../../supervisor/shared/usb/usb.c: In function 'usb_return_boot_py_data':
../../supervisor/shared/usb/usb.c:161:27: error: cast increases required alignment of target type [-Werror=cast-align]
161 | usb_build_descriptors((usb_identification_t *)temp_st...
It actually turns out that the maximum length of USB descriptor strings is 126 characters. Since the USB descriptor size field is only one byte, the maximum length of the whole descriptor is actually 255 and not 256 bytes as I had wrongly assumed so far.
I battled with RST a little bit and now the frozen modules link to their respective github repository or documentation if possible, parsed from the README.rst of the frozen directory (the badge on Adafruit libraries), which is a little hacky but works. (Except stamp_carrier_board, which has neither).
I marked the frozen modules with a (*) that matches the one in the text at the top, and copied the style of the links to builtin modules. I also tinted them slightly blue because... Frozen.....
It's just a guess at this point but you may have to teach the CI that it now needs to have the frozen git submodules populated, as the error was during:
Run python tools/ci_fetch_deps.py docs af7c94b2e150da26d72e52242cc6ae831337cadd
If you'd like help sorting that out please feel free to ping me.
I just learned that it's possible to search git for all pull requests across github that are tagged for your review, excluding requests for team review (e.g., circuitpython librarians): https://github.com/pulls?q=is%3Aopen+is%3Apr+user-review-requested%3A%40me+archived%3Afalse
"No results matched your search.", phew!
that means you can go on vacation next week, yay!
if I went on vacation, I would actually have time/energy to work on CircuitPython
Part of the reason this had any size savings at all is that there is no longer code to seed the RNG.
This is not a good fix as it stands, as it doesn't address the 'automatically seed' path. That's the path that is trouble for microcontrollers that don't implement os.urandom.
It's also puzzling that several of us believed the problem affects CPB: The problem of bias of the first RNG output for small seed values would only affect manual seeding OR the fallback to seed from monotonic time when os.urandom is not available. This would be the case for samd21 (CPX) but should not be for nrf52 ...
I have two boards that have the same behavior described in this thread and can confirm 7.3.0-beta.2 fixes the issue:
7.3.0-beta.2: works
7.2.5: fails
7.2.4: fails
7.2.3: fails
7.2.1: fails
7.2.0: fails
7.1.1: works
thanks for the fix.
Note that this updated documentation is presently a lie, as it depends on the underlying platform to set an errno-like value before returning that 0 bytes were read. At least mimxrt was behaving in this way, I think. See #6332.
We should decide which we want it to do.
OK I feel like I've gone around in circles on this RNG thing and ended up nowhere. 😕
platforms with os.urandom support "should" be doing as good as possible, but that leaves out boards like cpx (no os.urandom is possible), but those have the least possibility to get better behavior by throwing more code at at, since there's no room for more code.
def random():
return 4 # determined with a fair dice roll
and trying to make the RNG smaller hasn't worked out, it may be kinda junk but it is tiny
@tulip sleet I don't know where you are vs making a 7.3.0 release (beta? rc?), should I merge in these PRs I have previously approved? https://github.com/adafruit/circuitpython/pulls?q=is%3Apr+is%3Aopen+review%3Aapproved+draft%3Afalse
Could you see whether it actually makes sense to support the RS485 direction pin on all ports? Does the SERCOM or equivalent need to support RS485 in hw? I did not have time to check that yet; I am not familiar enough with RS485.
To my understanding, it doesn't seem to need support in the SERCOM or equivalent. It's just a pin you set before doing a TX and clear when TX is complete.
but I have never actually used RS485 to my recollection
i was not planning a release this week, unless you think there's an important bug we fixed. But I could do one just to keep up, and it would test the circuitpython.org PR generation.
but because we're poor at splitting implementation between ports & shared-modules it'd be additional work to actually make it work cross-port this way
does the user flip the direction pin or shared-___ should?
the existing API has
rs485_dir (Pin) – the output pin for rs485 direction setting, or None if rs485 not in use.
rs485_invert (bool) – rs485_dir pin active high when set. Active low otherwise.
which unless we want to do incompatible changes is what we're stuck with.
without support in the sercom-or-equivalent, you aren't guaranteed alignment between TE and TXD at the start of a transmission, or a particular GTIME-like delay at the end.
so without hw support, ideally we would raise an error if you specified RS485-relevant parameters as not None
I have assumed that what Kurt wrote is working in practice
so he's simulating RS485, but without the timing guarantees, is what you're saying?
I guess it would not hurt; I was just wondering about support issues.
so, the RP2040 impl is rather more casual, without timing guarantees (there could be an interrupt that delays things).
Some people have talked about using PIO for RS485; that sounds more like the direction to go. My inclination is not to approve, because it's not really RS485, and could fail in mysterious and intermittent ways. Would you agree with that?
canbus is broadly similar, a multidrop bus, but it requires HW support for managing access & defining who wins if multiple devices try to access simultaneously. RS485, it's much murkier.
"hey does this actully work in practice?" seems like a valid question to ask at this point. because Kurt may know even if we have no idea
he tried with some servos, and it seemed to work, but that is not "it works reliably"
and the mimxrt one is "maybe using HW support [rts], maybe not"
The timing of this control is critical, especially when switching from the send to the receive
mode, as the application has to make sure that the device is in reception mode before data
are sent by the other entity.
The master has to free the Tx/Rx line in no more than a bit time, otherwise there is a
collision with the slave response. So the DE signal has to switch from high to low level within
the bit time that follows the last bit of the last byte sent by the master.
So basically there's no guarantee that this requirement is being met [from the st pdf]
OK
hmm rerequesting review from myself doesn't actually clear the "approved" status
will you "request changes"?
You can dismiss your review, I think.
on another note, I am doing an experiment on Trinket M0, just removing the deleter slot in properties it uses entirely, to see what savings there is. That is a lower bound on the properties stuff. But maybe you have that data already.
Hi - my understanding is that you are simulating RS485 serial hardware, which guarantees certain timing on the direction pin, as described, for instance, in https://www.st.com/resource/en/application_note/cd00249778-managing-the-driver-enable-signal-for-rs485-and-iolink-communications-with-the-stm32s-usart-stmicroelectronics.pdf (linke courtesy @jepler).
if, say, an interrupt occurred before the pin was toggled, the signal might get delayed, or it might get lengthened if the interrupt occu...
I am concerned that this software impl of RS485 might fail occasionally due to timing issues, as I mentioned here for i.MX: https://github.com/adafruit/circuitpython/pull/6328#pullrequestreview-961932879.
The discussion I have found about RS485 on RP2040 discusses using PIO instead of the regular UART, because that way the direction pin timing can be guaranteed.
I did an experiment on the Trinket M0 build: I just removed the deleter slot from mp_obj_property_t.proxy, and adjusted all the intiializers referenced by the Trinket M0 build. I made no other code changes, so it's not functional, but gives us a lower bound on what would be saved.
Removing the one slot saves 144 bytes. If all the Trinket M0 properties were read-only, which is not true, then the total savings would be 288 bytes. A quick manual count shows ~24 read-only properties. And thi...
I think because you'd created the issue to update libs before 7.3.0 final, that you were closer than you actually are.
I just wanted to not forget that!
I think the ESP32-Sn I2C issues may just have to be deferred past 7.3.0
drat
I wish I had been able to reproduce the safemode i2c problem issue, but I wasn't able to with just the particular accelerometer I had for quick testing. It sure could be specific to that peripheral
i will see what the Espressif person comes up with. My fix works for some I2C, but it's an accident
that is really mysterious, since there's no obvious cause, it's almost like a memory smash or something
yuck. too bad nobody's written valgrind for microcontrollers.
busio was having a default timeout for clock stretching of 255 microseconds but cannot change it, so instead we discovered that bigbangio accepts the timeout parameter. Since TIC max clock stretching is 1.5ms we set the timeout to 1500us.
@phantomsixthplayer Do you think the clock stretching is related to this safe mode problem? We were not sure why you mentioned it.
Parts of samd were being compiled even for boards that did not turn on CIRCUITPY_SAMD. Despite LTO, this was adding about 76 bytes to such builds.
Also conditionalized a few other SRC_C files. Tried to conditionalize lib/tinyusb/src/portable/microchip/samd/dcd_samd.c, but it didn't work for some reason: got linker errors; not worth figuring out right now.
I was wondering about making it look like this, rather than marking each one. There would be a line break or paragraph break before the frozen modules. Not sure which is "better":
**adafruit_bus_device, adafruit_pixelbuf, analogio, audiobusio, audiocore, audioio, bitbangio, board, busio, countio, digitalio, errno, math, microcontroller, neopixel_write, nvm, onewireio, os, pulseio, pwmio, rainbowio, random, rotaryio, rtc, storage, struct, supervisor, time, touchio, traceback, usb, usb_cdc...
I'm concerned that this RS485 might work "most" of the time, but would randomly fail occasionally due to timing issues. For casual servo work that might be fine, but not in other cases.
Understood!
However today on all of the Teensy 4.x board you two choices. Either it works most of the time, or works none of the time. None of the Uarts have any CTS pins exposed, as such you do not have a way to synchronize a pin with when transmission completes.
Your Uart Write code here is...
Your Uart Write code here is neither synchronous nor asynchronous as it returns as soon as it places the last byte in the output queue of the IMXRT processor.
Both the atmel-samd and the nrf ports wait until the UART peripheral is no longer busy to return. I think, but am not sure, that mean that the last byte has been transmitted out of the FIFO. If the i.MX port is not doing that, then it should, and we would welcome that fix.
Re RS485. We could place a warning in the documentation ...
Hello,
Is there a near-term plan for official CircuitPython support for the VL53L4CX?
https://www.adafruit.com/product/5425
Thanks!
I didn't spot any problems, but no testing performed.
Note: This is to fix the issues in https://github.com/adafruit/circuitpython/issues/6310
Please use the special syntax (by editing the initial comment on the PR) to 'link' issues that will be fixed by a pull request. It's super helpful. You can do this anytime before the PR is merged. (edited to add the link to the docs)
Re RS485. We could place a warning in the documentation that the RS485 support is "best effort, use with caution", and that seems fine to me.
Added a doc note. I'll approve this and the RP2040 one after that.
Before this change, it took 1085ms to generate 100000 random numbers (10.85us/number). After the change, it took 1104 (11.08us/number). The performance impact on m0 will likely be a bit higher, as it requires a longer instruction sequence to multiply 64-bit numbers together.
On a Trinket M0, your benchmark with the old RNG ran in 5067. With this new one, it takes 5216. That seems quite tolerable.
Thanks for your work on this!
If you need to toss around ideas about it or brainstorm anything about random let me know. Not sure if I can add a lot more but never know
Working towards #6326. Adds links to guides for some of the more essential functionalities, particularly those in the CircuitPython Essentials Learn guide. These all seemed to be at the bare minimum of things that should get links to tutorials first, though more definitely still remain. If there are any others that fit, I can add them to this PR in a single commit.
Includes:
boardbusiobitbangioalready referencesbusio, so I would say this would get resolved too- ...
@tulip sleet hey - any reason why some board pages on circuitpython.org don't have a bootloader section? for example:
https://circuitpython.org/board/matrixportal_m4/
no, that is a bug; they are probably missing from the board list for that architecture
or there is an issue with the bootloader board name vs the CPy board name
they are often not the same
thanks. need me to do anything other than point it out?
just filing an issue is fine
main cp repo?
on circuitpython-org
@tulip sleet do you think this guide page needs to be revised with your research on neopixels? https://learn.adafruit.com/intro-to-rp2040-pio-with-circuitpython/using-pio-to-drive-a-neopixel
Rather than tinkering with it a lot can I just state that it works for specific neopixel chips and leave it at that?
the new code uses a faster clock and multiple clock delays per instruction, to achieve different timings. It's pretty similar otherwise
Maybe better to copy the new code, so people don't use the old timings
the old code didn't work on certain strips
yeah
You can use any NeoPixel (including a NeoPixel strip) but this code example only drives a single NeoPixel at a time.
I'd almost just rather change this bit, but it's probably just the laziness speaking. But also this example IS direct from the pio examples repo from raspberry pi, just adapted to CircuitPython
"you can use any WS2812-compatible NeoPixel"
You could put a pointer to the current code as an aside; point into the cpy repo
that's not a bad idea
But also this example IS direct from the pio examples repo from raspberry pi, just adapted to CircuitPython
I think Limor would say they copied that from us! The 1/3-2/3 thing is not what the datasheets request
it's got history, I know.
I looked at the page and I didn't realize how detailed it was. It's a detailed tutorial for a timing sequence that doesn't work, maybe it should be reworked, sorry
and the neopixels it didn't work on are WS6812B's (see slack)
OK, seems like doing what we can to stamp out the incorrect "everybody knows that..." would be for the good. I'll get it on a list to revisit.
I amended the text somewhat to say 'this is what the code does .. it's not the most compatible .. see circuitpython C code for the best example' and I can do more to improve it later.
is UART parity acted on by the core in some way... report exception or no bytes read if it's wrong?
I think the setting is only used to generate the requested partiy. There is no handling/checking of read parity that I see.
thanks, I couldn’t find any checking either, so I wondered if there’s any point in using parity. I have a CRC.
I don't think there's any point, really. it's expensive in terms of bits, it misses many multi-bit errors, most data is 8 bits, not 7, etc. it was conceived of decades ago when computation was expensive, and communications could easily be less reliable.
example is that server RAM is ECC, not simple parity
Looks good to me. Didn't test.
DigitalInOut.pull on Espressif boards was always returning None. The bit extraction to find out which pull was in use mistakenly assume the bit was shifted down to the low-order bit. It just does a masking, but not a shift.
@tulip sleet Thanks , that improved throughput ~38%, a lot more than I would have guessed. The setup is (3) esp32-s3 boards feeding 921600 UART packets (several hundred bytes each) almost as fast as they can to a single esp32-s3 receiver. Still slower than I expected, have to time the CRC separately to see how much that's contributing.
So far as I know Adam has managed to get his i2cperipheral library to at least a working state, but I myself haven't had the time to check into it at all, focused on an entirely different project right now, sorry.
Hello I am new to Circuitpython
I just wanted to ask since strings are not allowed how can I send a Ascii string over Uart and the \n\r (basically ENTER over Uart):
My current code looks like this def get_psuState(): # Einlesen der psuState Daten
uart.write("psuState")
bytes_psuState = uart.read(173) # Read psuState over UART
string_psuState = ''.join([chr(b) for b in bytes_psuState])
string_psuState_split = st...
Hi @Cyb3r-N1nja ! Github issues are not a good place to get help with CircuitPython or support for Adafruit products.
For community help with CircuitPython, please visit our discord: https://adafru.it/discord and for help with Adafruit products please use the forums at https://forums.adafruit.com/
I wonder what "duty ratio 50%" means in this bit of the ws2818 datasheet. since the data is emphatically NEVER at a 50% duty cycle.
on average?
are they talking about LED illumination duty cycle?
@tulip sleet did you discover anything interesting about the "reset time"? this datasheet has 280us.
I am not sure we do a "reset", in general
that seems to be the term for the time between sequences/refreshes
there is no explicit hundreds of microseconds delay anywhere, I think
The the _bleio.Attribute values are plain ints, but https://github.com/adafruit/Adafruit_Blinka_bleio/ uses CPython Enum. This causes problems when trying to add type annotations: https://github.com/adafruit/Adafruit_Blinka_bleio/pull/44.
The Attribute code was written a while ago. I think we could switch it to use py/enum.h, and fix this incompatibility.
Sorry if these are semi random questions, but a few of us have been wondering a few things about the MSC drive you write out to the boards
So far I believe that all of the ones I tried are: FAT12 with 1 FAT copy and are marked in the MBR as with partition type 1. Do you ever instead use lets says Fat16? If so do you change the partition type?
if (block_num == 0) {
// fake the MBR so we can decide on our own partition table
for (int i = 0; i < 446; i++) {
dest[i] = 0;
}
build_partition(dest + 446, 0, 0x01 /* FAT12 */, PART1_START_BLOCK, supervisor_flash_get_block_count());
``` looks like the partition table always says FAT12. However, I think some CIRCUITPY are big enough that they're actually FAT16.
Second part: wondering on Teensy when we flash a new copy with the Teensy tool, we end up wiping out the storage. There is an open issue on this #6309 on this. But I sort of wondering as you output stuff to file for location, if you also flash out a beginning FS?
that happens in bool filesystem_init(bool create_allowed, bool force_create), if I understaned the question
if (nclst <= MAX_FAT32) fmt = FS_FAT32;
if (nclst <= MAX_FAT16) fmt = FS_FAT16;
if (nclst <= MAX_FAT12) fmt = FS_FAT12;
``` f_mkfs chooses the fat type based on the number of clusters
Question is, if for example the .hex file you created, includes the file system which is then flashed... Then wont be able to maintain current contents...
I have seen that type code in a few places like in code, but was unsure.
then, no.
the build artifacts (hex or uf2 files) shouldn't overwrite the byte ranges that are the CIRCUITPY drive, when they're in the same flash part as the main code
Thanks
usually the rule for creating the hex file will only include sections that should be written. ```$(BUILD)/firmware.hex: $(BUILD)/firmware.elf
$(Q)$(OBJCOPY) -O ihex -j .flash_config -j .ivt -j .text -j .ARM.exidx -j .data -j .itcm -j .dtcm_data $< $@
Yes - I noticed in the map files that there looks like there may be some defines for where the FS goes... So will be interesting to see if anything is defined in those areas
Background
Hi, I'm working on a package called unigui that wraps displayio functionality into a widget set for use on CircuitPython boards as well as general-purpose computers and single-board computers via Blinka.
Problem
In addition to terminalio.FONT, I would like to have other built-in fonts distributed with my package. I'm accomplishing this for CPython by including BDF font files in my package and using the...
FAT12 vs FAT16 is determined by the cluster size and number of clusters, so you can't just choose one over the other arbitrarily. FAT16 (and FAT32)support does work if flash is big enough
FAT12 was not written out promptly by Windows; they claim to have fixed that. (Had to do with old support real floppies, I think).
At one time I considered faking a FAT16 filesystem with a lot of bad blocks, but that has not really been necessary.
I guess the follow on question might be why then use partition type 1? Which by https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs
The partition type (or partition ID) in a partition's entry in the partition table inside a master boot record (MBR) is a byte value intended to specify the file system the partition contains or to flag special access methods used to access these partitions (e.g. special CHS mappings, LBA access, logical mapped geometries, special driver access,...
1 is FAT12? Although most code tries to adapt using similar numbers for where the breaking point is for # of clusters
My test code is in https://gist.github.com/727e476033edd1ec3dfc3ee995f89f97 and runs on the macropad.
I ended up having to add superstitious extra calls to background-write an empty buffer, and I had to make the non-dithered neopixel also write in a loop= even though a single loop should suffice.
sm.background_write(
gamma_program[:0]
) # For some reason, needs this (empty write) or the data gets scrambled
sm.background_write(loop=nongamma_pr...
@mwisslead , by design (which I am not particularly fond of), pulsein on all CP boards wraps around if the incoming pulse is longer than the maxlen. I would prefer throwing a "Buffer Exceeded" or some such. In any case, it looks like your example is picking up an initial pulse (low?) then the five pulses (making six) and so wrapping the fifth around to the first position. You could work around this behavior by setting maxlen to 6 and dropping the first value.
@solid fjord probably the OG devices were all fat12 and nobody identified a problem (like, windows/mac/linux all mount fat16 labeled as fat12 in the partition table) so it never got changed.
Thanks, we had to add in Fat12 support to our USBHost stuff... By default the SDFat librray has Fat12 turned off. I also had to update the code to allow for single FAT as SDFat assumes 2 fats...
I believe it should wrap around in the internal buffer but the order of popleft should always be first in first out
Switching the pulses to alternating 300us high 70000us low with the same code always gives an output of [65535, 300, 0, 0, 0]
@solid fjord the first block (the partition table? I forget) is faked and is not really stored in flash, because it doesn't change
Yep the MBR which includes the partition table (first 4 entries) is record 0
It looks like we're only displaying bootloaders for the atmel samd boards and the nrf52840 chipsets. However, since this is an atmel-samd board, it should be displaying.
Since pulsein is a very primitive protocol, lacking an end of transmission indicator, the only way to 'detect' the end of a series of pulses is by timing out. The somewhat arbitrary timeout value on the RP2040 was set to 65535 ( a little more than 1 second), which is why you see that in your output. If you have a use case that needs a longer pulse length than that, please let's discuss it.
I will look at seeing if the order of pulses can be retained in the case of buffer overflow; but someth...
by design (which I am not particularly fond of), pulsein on all CP boards wraps around if the incoming pulse is longer than the maxlen. I would prefer throwing a "Buffer Exceeded" or some such.
We would certainly be interested in adding this capability; it sounds like you have uses cases. It could be a new boolean option that defaults to the old way. It could be a constructor arg or a settable attribute or some other arg.
It looks like it's missing the "bootloader_id:" line. I'll go through these and make sure they have these.
I'm flipping this to ready for review. It might not be perfect, but I think its working well. The one open item is the Creations ID and Repo, but I think when Scott is back that will be cleaned up and be implemented as I suggested and have it in the files.
@proven garnet Let me know when you're around. I have a potential quest for you.
it's dangerous to go alone, take this
Indeed. And, reward is five xp, one coin, one magic stone, and one fresh mango.
one coin
don't spend it all in one place
Oooh, a mango sounds nice. Promise it's fresh?\
Oh yes, that is a promise.
I had ranch style beans for lunch so I have to do something to offset the unhealthy
With coin shaving, anything is possible.
the coin is not bearded
not anymore!
@gilded cradle For your PR, are you certain they're accurate? I'm happy to merge but I don't know where that ID comes from.
For example, why do most have manufacturer bits in the bootloader ID, but this one doesn't? https://github.com/adafruit/circuitpython-org/blob/7b98d78d65e134dcb9d3104f05afee1ead5d9625/_board/xinabox_cc03.md
I got the IDs from https://github.com/adafruit/uf2-samdx1/releases and https://github.com/adafruit/Adafruit_nRF52_Bootloader/releases.
I don't believe you did. I'll scan for that and then merge it.
Cool, thanks.
Looks good! Caught one thing below.
Note, it's also missing on some ESP32S2 and ESP32S3 boards. For some of them it might be because there is no UF2 bootloader available, so that has to be checked, must some are definitely missing.
I ran a script:
adafruit_qtpy_esp32s2.md
ai_thinker_esp_12k_nodemcu.md
crumpspace_crumps2.md
electroniccats_bastwifi.md
espressif_esp32s2_devkitc_1_n4.md
espressif_esp32s2_devkitc_1_n4r2.md
espressif_esp32s3_box.md
espressif_esp32s3_devkitc_1_n8.md
espressif_esp32s3_devkitc_1_n8r2.md...
@DavePutz are you saying that [65535, 300, 0, 0, 0] is what I should expect from alternating 300us high pulses and 70000us low pulses? I was expecting [65535, 300, 65535, 300, 65535] or [300, 65535, 300, 65535, 300]. Should I get [65535, 300, 0, 0, 0] using the 5 other ports that have pulseio? Can we agree that something is wrong if I run the same test with a esp32s2 and get a different result?
Fixes #943. Pulled IDs from here: https://github.com/adafruit/tinyuf2/releases. Some were missing. A couple C3 bootloader IDs removed due to not using native USB.
Thanks !
One point in bootloaders.json, and I think the QT PY ESP32C3 needs its bootloader_id removed too.
https://github.com/adafruit/circuitpython-org/edit/main/_board/adafruit_qtpy_esp32c3.md
Has anyone found any clues for resolving this/ work arounds for now? or news of firmware update in development that may fix it?
Didn't test but looks good to me.
As noted above, when not using the Matrix Portal library, I don't see these crashes. We're not sure why the library is causing a problem, but you could try rewriting your program to use adafruit_requests directly and see whether you see the problem.
I'm not using Matrix Portal library; direct adafruit_requests post methods with similar network setup via Internet connect guide, leading to the same symptoms mentioned here (hang, USB disconnect). My flash just wiped itself clean as I press reset button. So unless there's a manual wipe button sequence I just pressed, it seems like other things are wrong with my board. Not sure what to do at this point. I'll reset firmware and try to repeat symptoms I guess.
I might as well ask.: Should a ...
@dsohrabian We would be quite interested in the simplest example program you have that seems to cause trouble, including your descriptions of what is returned from the requests. 5kB reponses might eventually lead to memory fragmentation, depending on how you hang on to the results. But there also might be bugs in the ESP32 firmware.
Question re the 2.13" Tri-Color SSD180 Featherwing.
I have it connected to a Feather STM32 and am running the ssd1680_simpletest.py example. It displays the ruler image as expected but... After the 2 min timeout it prints 'code done running' and the 'Press any key...' message on the serial console. Now the funny part, 1 minute later the screen refreshes to black and and it displays on the e-Ink screen 'refreshed c/r Code done running c/r Press any key ...' Where is this coming from? I expected it to leave the last image visible on the screen.
when the code finishes, it will show the repl, if you want it to keep showing the last image, add while True:pass loop at the end of your program
Even though we don't save that much on the smallest builds, I think this is a good improvement, and only helps. The macros make it easy to implement. Thanks for this brainstorm!
@tulip sleet do these details look right?
for the rp2040 neopixel
values are all rounded of course
Anyone can help me to implement pins from this board ? https://github.com/Xinyuan-LilyGO/LilyGo-T-OI-PLUS
.. this would help with the neopixel background write, which otherwise requires software byte swapping.
The 70000us pulse will be interpreted as and end-of-pulse, since it exceeds 65535. So, yes, I would expect that to terminate a pulsein. What I am unsure of is that leading 65535. The default idle_state on a pulsein is false, meaning that no signal should be getting counted until it goes high. I am investigating that. As for the esp32s2, that is using a ring buffer provided by the FreeRTOS layer; and I am not sure what that uses to detect an end-of -pulse.
Whoops, missed the ping yesterday, but I'm here!
Warning: video contains rapid flashing
I wonder what's going on here, and I'm not sure it shows clearly in the video. but, it is like it goes rapidly sometimes and slower other times, in a regular alternating fashion. The loop is simple and without delays, though: ```python
while True:
pixels.fill(rainbowio.colorwheel(j := (j+1) % 255))
it's using my background-writing code so it may be something to do with that. just strange.
putting in a 10ms delay makes it "just about even" so it's probably fine
Yes, this aligns with the Saleae measurements I took after adjusting the PIO program. https://docs.google.com/spreadsheets/d/14p5i4Hpy5OkdMedLXQrMjaIdPGqrMOiDdNNoKLmQ2vo/edit#gid=1228862380
thanks
I'm at a loss to explain the irregularity in the video, could it be gc??
that's the only variable/unpredictable thing that comes to mind, but would gc even be running on most iterations of the loop? doesn't seem like it should, even though it DOES allocate memory every time through
cache interaction depending on the relationship of the address of the buffers to the memory that's being DMA'd?
could put a gc.collect() in the loop, though that's kind of like adding a delay, it might swamp what you are trying to observe
two CP boards in very weird states:
https://forums.adafruit.com/viewtopic.php?f=60&t=190755
https://forums.adafruit.com/viewtopic.php?f=60&t=190904
@tulip sleet in case you need more known cases for this weird feather esp32 tft issue, looks like another one here:
https://forums.adafruit.com/viewtopic.php?f=57&t=190872
looks like they did not try 7.3.0-beta.2 yet?
no. only recently realized they were probably hitting that issue.
recently = this morning 🙂
https://forums.adafruit.com/viewtopic.php?f=60&t=190755 might be bad flash chip, somehow, though it would be good to know if they can get to the REPL even without CIRCUITPY (and then try storage.erase_filesystem().
I have seen total of one bad flash chip, on a CPB
a local user sent me a few bad CPB's, out of about 70 he bought
Baseline test of noise signal measured on the PyPortal Titano pin A0 (input to on-board audio amplifier). A 500kHz signal appeared in the spectrum, so the assumption for now is that the PWM brightness signal does bleed through slightly. It peaked at approximately 60mV, -60dB in the spectrum. The PWM noise signal didn't appear to change when the brightness was set to 0.0, 0.5, or 1.0.
<img width="1022" alt="titano_a0_noise_baseline" src="https://user-images.githubusercontent.com/29906257/1...
Testing the esp32s2 with the same python code just different pin name, I get no pulses at all for alternating 300us high 70000. I upped the off pulse to 100000 and I get [16128, 306, 303, 303, 303] which except for the first value is ok if long idles are intended to be ignored. For the sequence of [373, 215, 285, 327, 479], I get [33444, 228, 297, 339, 483] sometimes and [0, 228, 297, 339, 483] other times. If I drop the sleep time to 1.1 I get [384, 228, 297, 339, 483].
Hey again! Let me know next time you're around. Hopefully we can stop playing asynchronous tag, and actually cross paths sometime soon. 😄
Hopefully easy question: I am playing with a Teensy Sketch that allows you to plug in an CircuitPython board and make sure I can talk to all or at least most of the USB pieces. So for example I see your MSC type drive and I show it up as an MTP drive out of the sketch. Also I can send and receive stuff to the main USB Serial object:
I have a Python script on the CircuitPython (T4.1) that has code like:
cbavail = supervisor.runtime.serial_bytes_available
if cbavail:
print("cbavail: ", cbavail)
led.value = True
text = input()
print("*** Serial input ***", text)
...
led.value = False
And when I talk to it with the teensy, the LED is on most of the time
Wondering if it might be end of line stuff? That is what happens if lines are sent with <CR><LF> vs just <CR> or just <LF>?
Note: after changing this code to look at cbavail... Found it was a bool...
@onyx hinge Do you know of a simple way to figure out how many PRs were filed by PyCon folks? They were across multiple libs obviously, so I'm unsure how to have tracked them.
We also didn't label them.
@idle owl no, not really.
Ok thanks.
I noticed that it became possible at some point to 'pin' a fork to an organization page so just now I pinned circuitpython to https://github.com/adafruit?view_as=public
Thanks, yes that works but the real problem is that I read the documentation that says e-Ink displays should not be used as the console. However when you initialize the display the Circuit Python backend sends all print statements to both the USB Serial Port and to the new display you just attached. This causes future print statements from both the program and the REPL to be sent to the e-Ink display as well as the USB serial console.
The 'fix' appears to be to release the display before printing any debug messages with 'print' and before exiting.
displayio.release_displays()
where did you read that?
@idle owl I don't think it could have been that many? adabot just has in its last report, "* 10 closed issues by 5 people, 8 opened by 8 people"
and that would cover the sprint days
Hmm. Fair enough. Felt like more than that. Some are still open I think.
@lone axle See above. Do you know of any magic to figure out how many PRs came out of the Sprints at PyCon?
They were obviously across multiple libs.
I started digging around in your and Tekktrik's activity on GitHub because I figured you two reviewed most of them.
But I'm not certain of that.
Sort of answering own question, I believe you only want <CR> will have my sketch check and only send as such...
our recent activity is probably a pretty good start to get them. I don't know of any other specific ways. Maybe API queries with a date range filter if they allow that, but I've never gotten that specific with the API not certain if it does.
I was going to go through this weekend and get a list of them though. Specifically to have the list of contributor names to mention during the next meeting. But that would also give us a count.
Hmm. Alright, thanks
Please let me know what you end up with. I'll add it to the newsletter.
Will do.
Thank you!
Ohh nice! that search syntax seems super helpful for it
where did you read that
@idle owl I'm about to go for a run, but I'm here for the next 10 minutes and I see you're online!
Also tag you're it 
Green dot kind of means nothing for me, I'm always a green dot 😄
OK, so the changes here: https://github.com/adafruit/Adafruit_CircuitPython_TestRepo/pull/43/files need to be applied to all the libraries. I tried to do it with Adabot, and either I'm missing something obvious, or she can't do it.
The PR this came from also changed the spacing and location of the - on everything in the .yaml file.
Also, thanks for the cool PIO stuff @onyx hinge, it might come in handy at work so it's been good learning it!
I did that initially, but thought maybe that was why it wasn't working. So I backed down until I only had what I linked.
@proven garnet glad you're having fun following along.
So... the spacing could be updated too to match cookiecutter.
Spacing update looks more like this: https://github.com/adafruit/Adafruit_CircuitPython_TestRepo/pull/43/commits/31b0bbe3b68480b770bf8eccb12e2c8500163a77
Anyway... I assume a script could do it?
So that's the quest, if you choose to accept - update the libraries to match cookiecutter.
Here is the cookiecutter PR: https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/182/files
The second file in the cookiecutter PR is the one to match.
The spacing should be doable, I think PyYAML can do it pretty easily on the first pass through, and I think there was only one thing I would need to do on a second pass through (though I think it only mattered for the workflow YAMLs, I played with it a few weeks ago)
Alright 🙂
PyYAML should make doing the change easy too
Excellent.
No super rush on this, and, maybe do a couple of libs first to make sure CI still passes. Because the TestRepo has very little content.
But not NeoPixel 😄
Sure thing! I'll let you know if I hit any problems, but I should be able to get something running pretty quickly.
Thank you so much!
OK wow now I can make a colorwheel cycle so fast it looks like it's just white. video is 8x slow motion. flashing warning again.
Wow. Impressive.
my loop is ``` while True:
pixels.fill(rainbowio.colorwheel(i := (i + 1) % 256))
- Fix a problem when once=None and loop=None in background_write
- Fix a problem where a zero-length buffer is passed in
- Add support for byteswapping via the DMA peripheral
- add ability to get, clear the txstall flag
This makes it possible to
- actually wait for the transfer to FULLY complete (not just trickery like in the morse code example)
- stop a background transfer after a full loop exactly
- background write neopixels that 'act like' a pypixelbuf without manually swa...
@tulip sleet now that I don't rely on ulab to copy and byteswap my memory, it's much faster and if there's still 'unevenness' I can't see it.
seems most of the time was in fact being spent in the byte swapping which is interesting to know. vs doing in the pio's dma peripheral.
the speed is a bit of a lie, 12 neopixels can really refresh at about 600Hz I think. but with auto_show=True nothing stops it updating the pixels multiple times (e.g., with .fill()) before the buffer gets looped once
1080us data + 320us gap = 1400us ~= 715Hz
Updates the starting index when maxlen is reached. Fixes #6348
I figured out the issue is the start index not being updated so when you popleft or getitem you are getting values that aren't necessarily the first ones that came in.
Does ESP32-C3 have WiFi and BLE Support (With Adequate Documentation) with CircuitPython?
BLE support on ESP is very limited and alpha in CP
I fixed a doc formatting issue (extra """). I added (reverse) in the documentation for the swap arguments, to clarify that the byte order is reversed, since swap is not so obvious for the 4-byte case. If you disagree with that, we can change it back. I will not merge pending your thoughts on that.
Thanks for adding these cross-references!
Is there any risk that having DMAs for sizes less then the threshold that require swaps will cause either a speed issue for the small DMAs or potential exhaustion of DMAs? It may not be any concern just wanted to bring it up.
Rest looks great.
Is there any interest in Prs for bitshifting the serial numbers for various libs into their decimal value? ie, sdc4x returns serials as <serial> <checksum> <serial> <checksum> <serial> <checksum> in a tuple
the decimal value for such being the first, second, and third values bitshifted over by 32, 16 and 0 then summed
(or at least a method to provide such to avoid breaking changes)
greetings i got my hands on a waveshare RP2040 with 160x80 pixel RGB display and the ST7735R driver is giving me a 26 pixel offset image on it ... i found some arduino topics about some offset registers that have to be changed but i have no clue where to find them in curcuitpython ... am i in the right channel to begin with?
fixed it myself after looking up all the parameters for displayio.Display 🙂
now for a more generic question, i want to init this display whenever i start my board, how can i make it available in the repl ?
@rain island You can put the initialization code you want to share in some other .py file, and "import" it from both code.py and from the repl.
@rough folio I don't know about the sdcx4 in particular and I may be misunderstanding your suggestion but it's worth noting that not all boards can handle 48-bit numbers as integers -- a lot of the older boards don't support "long ints" because there's just not enough space in their flash for the code that enables it.
was having multiple issues at the time and wasn't able to get i2c working with the tic driver using busio, then switched to bitbangio as I could set the clock stretch to the same as the tic which is 1500us and haven't had issues since.
I'm having a feeling the heap allocation error might be a coincident when it crashed with using about 20 labels in conjunction with rgbmatrix, mp3decoder and neopixels. I did experience this a lot with the program before however I changed the design and only...
I don't really know. :) There are 12 DMAs; audio might claim 2 in the background, and this code now claims up to 2. so it looks like there should be plenty left over.
At first I wanted to say this was no change for existing code, but it IS a change. Before, if you had a LARGE buffer but couldn't allocate DMA, the code would fall back to copying in a CPU loop. Now, it will return an error.
@dhalbert thanks, the doc changes look fine to this human but I see the doc build is (still) failing.
wow those docstrings were all messed up, I should have tested locally after doing copypaste
I fixed a doc formatting issue (extra """). I added (reverse) in the documentation for the swap arguments, to clarify that the byte order is reversed, since swap is not so obvious for the 4-byte case. If you disagree with that, we can change it back. I will not merge pending your thoughts on that.
thanks dan!
@lone axle I notice you're scheduled to do the discord meeting on monday, and I'm scheduled on the 16th. The 16th is after I start my vacation. Do you want to swap so I am the host on may 9?
june 13 also needs someone else to take it, but I figure once scott's back you'll want to re-do the schedule anyway
Yep swapping 9th for 16th works for me.
Your welcome
Now if only I knew how to write the core code to allow 'await state_machine.async_write(buf)`
-byte_count % 4 as a way to find the additional padding needed to make a buffer of byte_count bytes a multiple of 4. is there a less clever way to write it that is still succinct?
(-byte_count) % 4 at least makes the order of operations clearer, but I feel like the reason it works is mysterious
I wonder if it's worth adding typecode= to the sm read/write methods. It lets you avoid the memoryview(buf).cast('L') business, which performs allocations.
self._sm.background_write(loop=buf, typecode='L', swap=True)
Now if only I knew how to write the core code to allow 'await state_machine.async_write(buf)`
For this, I think the easiest thing to do is to pass an asyncio.Event in to your code, and trigger it when the write is done. Then the Python code can await the Event change.
This only looked smaller because I forgot automatic seeding. Let's close it up for now, the original problem only affects samd21 or other platforms without os.urandom anyway.
Any thoughts on adding the rgbmatrix module to the broadcom port (or making a standalone library for Blinka)?
@low sentinel (or anyone else versed in core stuff)
Do you know how I could call this set_dirty() function:
https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-module/vectorio/VectorShape.c#L184
From inside of Group.c here when the group gets sett hidden or visible:
https://github.com/adafruit/circuitpython/blob/5f4f66774ccb5f7f01d9a1e130676882a73ffed0/shared-module/displayio/Group.c#L47
I tried adding a similar looking layer initializer thing and then calling it this way:
layer = mp_obj_cast_to_native_base(
self->members->items[i], &vectorio_vector_shape_type);
if (layer != MP_OBJ_NULL) {
mp_printf(&mp_plat_print, "calling set dirty vectorio shape\n");
common_hal_vectorio_vector_shape_set_dirty(layer)
continue;
}
But it never gets inside of the if statement. I think it's because it's actually a Circle, Rectangle, or Polygon and not specifically a VectorShape.
I can't figure out the proper way to tell the shape object that it's dirty so that it will force a redraw. I'm pretty sure if I can get this to happen along with some other changes I made inside group we'll be able to hide and show vectorio objects by setting hidden on the group they belong to.
Ah, I might have figured out a way (unsure if it is good or best way, but it seems to work):
layer = mp_obj_cast_to_native_base(
self->members->items[i], &vectorio_circle_type);
if (layer != MP_OBJ_NULL) {
common_hal_vectorio_vector_shape_set_dirty(common_hal_vectorio_circle_get_draw_protocol(layer));
continue;
}
Yeah was going to call out draw protocol. I added it so common functionality like this can be abstracted. I could have sworn I wrote an example of calling a draw protocol method without knowing the type of the draw protocol implementation or the type of the shape which owns the draw protocol…
I am moving houses at the moment (my first house!) and my office is boxed or
—-or I’d go dig around for you!
Thank you. I'll poke around a bit and see if I can find that example in there. Appreciate your guidance and horray! congrats on the house! 🏠
Hi, thanks for your query! This sounds like an interesting use case, and the code would almost certainly be welcome in the community bundle if you chose to contribute it.
Can you identify a small subset of pkgutil that will satisfy your use cases and be implementable on CircuitPython? Perhaps you can prototype it in unigui, similar to:
try:
from pkgutil import get_data
except ImportError: # Running on CircuitPython
def get_data(package, name): ...
The CPython doc...
resolves #6204
Here's a short recording showing the behavior with these changes running the reproducer code from the issue
https://user-images.githubusercontent.com/2406189/167264730-752cd9c4-bb1e-4330-ac21-84870ffcd297.mp4
It may be possible that there is some more type agnostic way to do this instead of having to check for and handle all 3 vectorio types individually like this.
I'll look into it a bit further but this is the way I figured out how to do it first and it does seem to work this way.
We would probably add it; the broadcom port is extremely alpha, and we're just trying to get basic things working reliaably, like filesystem access
@lone axle thanks!
I remembered where this happened. I did this when cleaning up the vectorshape+named shape vs just the named shapes api object. It’s the most recent change in group.c https://github.com/adafruit/circuitpython/commit/8607cdd7830220f5ad30fc62e367b0fc01596855
holy moley I’m on mobile and that embed is huge sorry
No worries. Thank you for the pointer!
Latest commit corrects an issue where vectorio shapes that were nested at least 2 layers deep inside of groups would not be properly hidden / shown if the outermost parent (or probably any parent except the one the shape was directly inside of) was the one set to hidden.
Oh, duh, yeah, boards have limits. Forgot about that, whoops.
To that point though, scd4x in particular has checksums in it's serial number code and across the handful of libs I used endianness flipped a couple times as well- might be a nice thing to normalize, but I guess it's more work than it's worth?
With a point in the right direction by WarriorOfWire I think the code from here is how this can be done in the more generic way without having to check for each possible type:
I'll come back to this and attempt something similar for the changes in this PR to minimize the amount of new code needed.
I don't know specifically what the use case is for checking sensor serial numbers so I don't know what the impact would be of changing how they're presented to users of the libraries. Consistency is important, but what consistency? To a previous release of the same library? to the datasheet? to the arduino library, if applicable? to other CP libraries? I don't have an answer.
@tulip sleet looking at asyncio.event.Event I'm not sure it could be used for this. The docs sternly warn:
# Note: This must not be called from anything except the thread running # the asyncio loop (i.e. neither hard or soft IRQ, or a different thread).
I'm not sure whether "the background task" fits these criteria, or how a problem would manifest if it didn't.
We have only the one thread, but "the background task" can interrupt code in odd ways that MP authors wouldn't have been considering.
a background task 'set' could interrupt the middle of 'wait', putting the Event into an invalid state, I think
async def wait(self):
if not self.state:
# Event not set, put the calling task on the event's waiting queue
self.waiting.push_head(core.cur_task)
```if background tasks run between `if not self.State` and `self.waiting.push_head`
they don't have the background task, it's true, but I was considering just as a convenient boolean that can be polled when the scheduler runs
With a point in the right direction by WarriorOfWire I think the code from here is how this can be done in the more generic way without having to check for each possible type:
I'll come back to this and attempt something similar for the changes in this PR to minimize the amount of new
code needed.
Some additional context for $future_reader:
...
I'll try Event and see what happens
@tulip sleet ooh it kinda works .. something's weird though.```python
Let's alternate SOS and TEST, forever, using asyncio:
class AsyncStateMachine:
def init(self, sm):
self._sm = sm
self._event = asyncio.Event()
self._sm.background_callback = self._event.set
async def awrite(self, buf):
self._sm.background_write(buf)
await self._event.wait()
async def main():
#sm.frequency = sm.frequency * 100
asm = AsyncStateMachine(sm)
FILLER = array.array('H', [1]) * 8
while True:
for plain, morse in (
("SOS", SOS + FILLER),
("TEST", TEST + FILLER),
):
print(f"Sending out {plain}")
await asm.awrite(morse)
```It quickly completes 3 loops without the LEDs blinking the codes, which is weird. Then after that the "Sending out {plain}" message is shown just as it transitions from message to message. The FIFO doesn't have room for 3 copies of SOS+FILLER (the FILLER is enough to fill the whole FIFO) so I don't know what's happening yet. Anyway, that aside .. is this sensible from a user's point of view: await asm.awrite(morse)
that looks ok to me, but are you just doing asyncio.run(main())? I did not test Event at all yet.
it's flaky around soft reset and somehow also broke screen refreshing .. it's worse the faster I make the morse code blink. I think this is probably not really OK. And yeah I left it out but asyncio.run(main()).
could also try avoiding using _asyncio and just use the Python versions: change the import in core.py in asyncio
oh I didn't realize I was getting built in versions. Of Task but not Event, I guess?
it is supposed to work, so this is something I/we will need to debug before springing Events on people
right, there is no native Event yet, but there's an unmerged PR
I think it's more likely to be a problem with me running Event.set from the background callback
in CP or MP?
in mp
ah
yes, maybe messing with the asyncio task queue from the background task is not a good idea
they are trying to add event support ot pin transitions and other stuff, if I remmember right
I don't think I'll go too much further down this road right now
it'd be neat but it's a distraction too
it would be easier just to set a shared boxed boolean or something, and await that. Event has this rescheduling side effect
is that a thing that exists, or that has to be made?
like the way I did the shared control objects in the asyncio guide
one task changes the control values, and the other monitors it. They take turns
via await asycnio.sleep()
did you add the background callback or is that already merged in via the PR?
no it's just in a local branch
I think the native Event may work out better for this if/when we get it. Calling from native code into Python has always been tricky
maybe so
is there a .done value for the background PIO or not? That would be simple to poll
yes
oops that doc is wrong
https://docs.circuitpython.org/en/latest/shared-bindings/rp2pio/index.html#rp2pio.StateMachine.pending This becomes False as soon as a background_write would not block
https://docs.circuitpython.org/en/latest/shared-bindings/rp2pio/index.html#rp2pio.StateMachine.txstall the docs are wrong, should say "stalled due to an empty tx fifo", which as long as your system has enough memory bandwidth that the FIFO can't empty during DMA, is when the DMA has completed AND everything's been popped out of the fifo.
so there are at least two kinds of completion really
To the particular usecase my envisioned use here is tracking age and also calibration data- really, I guess the endianness and checksummery don't matter too much as long as it was consistent
I guess it's better suited as a documentation change
but for example-
scd4x.serial_number -> (int, chk, int, chk, int, chk)
sgp30.serial -> (int, int, int)
SHT31D.serial_number -> int
the scd and sgp in particular stand out here because they both use the same int,chk,int,chk,int,chk from the device, but the sdc4x lib doesn't cut the checksums and they both have different property names
it's a pretty minor issue I guess but I was still surprised
I can also look through my history and pull the numbers for myself
grimnoirelabs has a neat toolkit for getting insights on dev activity on github
it's a little docker container that runs ES and a frontend- dumps all info about commits, PRs, issues, contributor info into an ES database and then does searches across it
Oh that's pretty neat, I'll check it out, thanks!
it also tracks what organizations are contributing etc
was a project by.... some group of decent authority(?) to figure out diversity metrics for their projects
oh, linux foundation and community health
@idle owl @proven garnet Here's the lists I came up with:
users:
awordforthat
jcerise
matt-land
davclark
rmblau
sabadam32
ktkinsey37
ryanskeith
PRs:
https://github.com/adafruit/Adafruit_Blinka_bleio/pull/44
https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad/pull/60
https://github.com/adafruit/Adafruit_CircuitPython_ST7789/pull/32
https://github.com/adafruit/Adafruit_CircuitPython_AHTx0/pull/13
https://github.com/adafruit/Adafruit_CircuitPython_BLE_iBBQ/pull/9
https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio/pull/23
https://github.com/adafruit/Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter/pull/10
https://github.com/adafruit/Adafruit_CircuitPython_RFM9x/pull/73
https://github.com/adafruit/Adafruit_CircuitPython_BLE_Magic_Light/pull/10
https://github.com/adafruit/Adafruit_CircuitPython_JWT/pull/11
https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/pull/39
https://github.com/adafruit/Adafruit_CircuitPython_OAuth2/pull/7
https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/116
https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver/pull/22
These were just ones that I found with contributors I didn't recognize. 14 PRs by 8 contributors. Many are types but a few were other things. There were also a few from tekktrik, neradoc during this time range that went along with some of these but I kept it to just new contributors that I believe were at pycon.
I think the deviations in the format are usually because a lot of the circuit python code is adapted from the provided c/c++ driver code that sensirion provides, which also sometimes deviates from datasheet (I think at some point they broke out some of their i2c drivers and bundled that specifically, and newer sensors now refer to the bundle for comms). The different formats can add complexity like you're facing when you just want to add a, "get the serial number" block, that's a good point to highlight
@idle owl whenever you get a chance, here's a gist with the result of the .pre-commit-config.yaml that my script outputs. It's slightly different than the one you gave me, it's actually more consistent with the spacing in the - --disable= parts. I also didn't change the black rev, but I can if you'd like!
Thanks for the reply. I thought that the SAMD51 had a much longer clock stretching timeout than 255us. That was a problem on the RP2040, which we fixed a while ago. Please open another issue if that is the case. I will close this issue for now as it seems to not necessarily be reproducible.
CircuitPython version
Adafruit CircuitPython 7.3.0-beta.2 on 2022-04-27; Raspberry Pi Pico with rp2040
Code/REPL
help('modules')
Behavior
It will return all the modules without usb module
__future__ board onewireio touchio
__main__ builtins os traceback
_asyncio busio paralleldisplay ulab
_bleio collections pulseio ulab
_eve ...
This module is not (yet) supported in any CircuitPython build, and it's a mistake that it appears in the documentation.
I've met same issue on latest release (7.2.5). Is there any other idea what to do except use RP2040 instead of Zero 2W?
I understand, Thank you.
It's in documents & the download page
https://docs.circuitpython.org/en/latest/shared-bindings/usb/index.html#module-usb
https://circuitpython.org/board/raspberry_pi_pico/
The broadcom builds, including Zero 2W, are at a very, very early development stage; there's a lot more debugging to do.
should this really be closed, or should it wait for us to switch to this submodule & ref in main?
I did not mean to link the issue.
I'm not sure if we want this one, but it allows writing with the desired object size without any allocations. Before, memoryview().cast() would cause two allocations:
self._sm.background_write(memoryview(buf).cast("L"), swap=True)
after, you can write
self._sm.background_write(buf, typecode='L', swap=True)
which is allocation-free (as far as I know). background_write doesn't have the slicing arguments, so some use cases might still require allocations (`memoryview(bu...
Fixes #6263 by switching to https://github.com/adafruit/esp-idf, which has https://github.com/adafruit/esp-idf/pull/2 applied. The patch in https://github.com/adafruit/esp-idf/pull/2 is from https://github.com/espressif/esp-idf/issues/8770.
When the https://github.com/espressif/esp-idf/issues/8770 patch gets into https://github.com/espressif/esp-idf, we can switch back to using the upstream repo.
I re-tested that the delay is gone with this submodule change with an MSA301 on a Metro ESP...
Q: Can you figure out the desired typecode by looking at the type of buffer?
The specific use-case shown above is to implement a NeoPixel-like class in CircuitPython using the background-write functionality.
The core allocates the buffer that is passed to _transmit, and its type is always 'B'. But I need the StateMachine to treat it as an 'L'.
This is an unusual situation. Usually, you'd create your array as the right type, like with array.array('L', ...) or np.zeros(..., dtype=np.uint16).
@onyx hinge does the typecode arg only really need to specify the number of bytes? i.e.g 'L' and 'l' are treated alike? I am just thinking that specifying a typecode is obscure. But specifying the length of the data to transmit at once (1,2,4 bytes) is more in line with what the user is thinking about
so pass in a 1 or 2 or 4?
that's an alternative. I was thinking about it in relation to cast which takes B/H/L
maybe that is what a typecode is, and I am re-inventing the wheel
a typecode can specify floats and all kinds of other stuff. WE are really just talking about a raw byte/word/long
i was trying to see if the cast could be done once, earlier, but given the internal workings of pixelbuf, maybe not
Writing down a discord discussion.
This could be explicated further. It could say that the typecode is one of B/H/L, which is used to set the element size as 1, 2, or 4 bytes. Or 1/2/4 could be passed in, since it's the length, not the actual type, that needs to be specified.
I am just thinking that why this needs to be specified requires a few sentences, and maybe better to put it here than repeat it in discord multiple times. It would be in a guide too, perhaps eventually.
"Unlike using memoryview.cast, this requires...
CircuitPython version
for itsybitsy m0 and gemma m0
Your adafruit_hcsr04.mpy does not work with CircuitPython 7.x -- To get the sensor to work, I had to install:
adafruit-circuitpython-gemma_m0-en_US-6.3.0.uf2
and then use:
adafruit-circuitpython-bundle-6.x-mpy-20211213.zip
After downgrading the Gemma to these version - the sensor now works perfect.
I tried multiple versions of 7.X - none worked, it was only when I downgraded back to 6.3.0 - that the sensor ...
AnalogOut just takes a 0-65535 arg. The actual voltage is not specified, and is board-dependent.
Maybe AnalogOut should also provide a reference_voltage attirubute, like AnalogIn, so board-independent code could be written to produce a specific voltage. I'm not sure if the name should be reference_voltage or maximum_voltage or something like that.
@WarriorOfWire First, thanks for the additional explanation this is all quite helpful. And the ability to define new shapes from python sounds awesome!
Looking into changing this I'm thinking I will need to expose the set_dirty() function in the protocol impl here:
Does that seem right to you?
I made a first attempt at it and wasn't successful but am...
Meaning the special byte with value 0 that terminates a C-string. I can write it however you prefer.
If I do the following, will the range statement eat up a lot of memory, or is CircuitPython smart enough to know to check the bounds:
if thing not in range(1, 14001):
...
Or is it better to explicitly check given the range:
if not 1 <= thing <= 14001:
...
Related to a PR where it seems like fitting on smaller boards was a concern so trying to take that into account
A range object allocate storage for about 3 numbers (start, stop, and step), not 14000 numbers.
however, the explicit comparison version won't allocate any objects at runtime
oh and your tests aren't exactly equivalent, since the range doesn't include the number 14001
the range() version has 18 bytecodes, while the comparison version has 22 bytecodes. [checking in micropython because it's easier]
raw bytecode: 22 19:06:02:04:20:81:b0:57:5b:da:46:07:22:80:ed:31:da:42:42:5a:59:63
prelude: (4, 0, 0, 1, 0, 0)
args: ['thing']
line info: 20
81 LOAD_CONST_SMALL_INT 1
b0 LOAD_FAST 0
57 DUP_TOP
5b ROT_THREE
da BINARY_OP 3 __le__
46:07 JUMP_IF_FALSE_OR_POP 7
22:80:ed:31 LOAD_CONST_SMALL_INT 14001
da BINARY_OP 3 __le__
42:42 JUMP 2
5a ROT_TWO
59 POP_TOP
63 RETURN_VALUE
children: []
simple_name: g
raw bytecode: 18 21:08:03:04:60:20:b0:12:05:81:22:80:ed:32:34:02:dd:63
prelude: (5, 0, 0, 1, 0, 0)
args: ['thing']
line info: 60:20
b0 LOAD_FAST 0
12:05 LOAD_GLOBAL range
81 LOAD_CONST_SMALL_INT 1
22:80:ed:32 LOAD_CONST_SMALL_INT 14002
34:02 CALL_FUNCTION 2
dd BINARY_OP 6 <in>
63 RETURN_VALUE
children: []
I would use the comparison one precisely because of that off-by-one gotcha
it's true, you don't need to remember how range() treats its endpoints if you write the explicit comparisons
(and if you don't need the step argument)
Ah, thank you, that was actually one of my feedbacks on the PR that the numbers were off 😅
Thanks @stuck elbow and @onyx hinge for the thorough explanation. My thought was to use the explicit as well, thanks!
the law of the least surprise
I'm pretty sure I'd prefer to write the comparisons version than the range version, and it doesn't consciously have anything to do with 'unsureness' about what is in a range().
I agree, particularly because it's use is in conjunction with raising a ValueError so clarity in the code in that area is key I'd argue 😄
(I feel like learning to write for x in range(...) and know what the range means will be valuable to most python learners)
either NUL or null is fine. I thought nul was a typo.
I tested this fix on the original script, a DHT11, and an infrared remote. All worked correctly, so looks good to me.
Thanks for testing, @DavePutz!
@FoamyGuy yeah, that sounds right! Probably the right thing to do is to replace on_dirty with your new draw protocol method too. https://github.com/adafruit/circuitpython/blob/main/shared-module/vectorio/Polygon.c#L198
I cannot reproduce this with busio.I2C() on a Feather ESP32-S2, either with 7.3.0-beta.1 or the pending https://github.com/adafruit/circuitpython/pull/6366 I2C fix. busio works fine. It's true that bitbangio gives the error above. I have been running for several minutes during each trial. I tested with only USB, with USB and an attached battery, and with a battery only, sending output to the default UART.
@kattni
import time
import bitbangio
import board
import busio
from...
This does seem to work. I noticed it's the only one of these of these set to a function with common hal in the name.
Should it be set up differently? Or is it okay like this?
I got this working, but unsure if I've gone about it in the correct way.
I didn't end up making a new function I don't think, I'm not sure how to set the on_dirty event
Not sure if this is the right place for this, but is the nRF5x support on the Adafruit DAP library complete enough to work?
I see there is files for nRF5x but I don't really have an nRF board on hand that I could actually try it out.
Seems like this will break shapes cleaning up after they’re set hidden, no?
This looks reasonable!
Tested further. These all work with #6366. Did not try with 7.3.0-beta.1
- old ESP32-S2 Feather (rev A?)
- Rev C ESP32-S2 Feather
- ESP32-S2 Feather TFT
ESP32-S3 Feather works sometimes for a while at 10kHz I2C clock. At 100kHz, seems to fail immediately. Saleae trace with working reads, and then last is failure:
Feather-ESP32-S3-LC709203F-10kHz.sal.zip
I'm not sure. I still don't quite have a full picture in my mind of how everything works together. But I'm picking up new pieces each time I dive in and attempt changes like this one so I'm getting closer.
I haven't noticed any unwanted effects of being done this way, however the only test scripts I've used are the relatively basic one in the issue #6204 and more complex one that is a modified version of the TabLayout example from https://github.com/adafruit/Adafruit_CircuitPython_DisplayI...
Yeah, if you move the shape/anything then set hidden=true within 1 draw’s interval I think you will regress all displayio objects’ cleanups with this change if I understand and remember correctly (which is not a guarantee)
@tulip sleet my phone popped up with a notification that had your face on it, and immediately disappeared. it could have been e-mail, I don't know. Did you need something?
I sent some email at 8:51am ET about the Jekyll site CI message. Haven't addressed anything specifically to you since then. I just opened discord.
OK, it may have been that; I'd read it on my computer a little earlier. Just wanted to check!
@lone axle I assume you're probably looking at PRs from PyCon today to try and close out as many as you can, but if you want, I was going to ask for a second look at a PR I'm reviewing. Couple instances of scope creep on it so it's grown a decent amount to the point where I would appreciate a second set of eyes. A second look from anyone would be fantastic though.
It's also still WIP based on recent feedback, though
Yep, going to try to get any that I can merged today. I have a few to circle back to that need tweaks and testing. Am about halfway through the first pass on them so far today.
And yep I'll take a look at that one later on as well. iirc I picked up one of those devices and a fan to test out a prior PR.
Anyone have experience with https://github.com/adafruit/Adafruit_CircuitPython_JWT ? I'm having trouble figuring out how to get the simpletest example running. It's expecting a secrets['private_key'] value in order to work but I don't see anywhere showing the correct formatting for that. I've tried generating a keypair and putting the private one in the secrets dictionary but am getting errors from generate() with everything I've tried so far.
Ah I think I found the way to generate the right format here: https://learn.adafruit.com/pyportal-iot-plant-monitor-with-google-cloud-iot-core-and-circuitpython/code-setup#creating-a-rsa-key-pair-3038069-14
I had found that guide but hadn't found the right page yet!
Is there any CircuitPython hardware object with a value attribute that is purely read-only?
(or purely write-only)
TouchIn.value?
in touchio
Excellent, thank you! And is there a write only counterpart? Trying to determine how specific I need to be.
I assume AnalogOut
But not specifically any kind of value attribute in something?
Hi guals and guys ! I just got (last week or so) the Lilygo T-oi Plus that got esp32-c3 on it. There is no port of it yet. The lilygo t-01C3 is not giving me acces to the pins I have on the T-oi Plus
but I think it can be read too
Got it, thanks!
Is there a way I could mod the port for T-01C3 to use T-oi Plus ?
thanks
ask if you have any trouble with it
sure will
Fixed by #6272. I am closing, as the original issue is fixed. There are some internal code issues that we want to explore further, but the #6272 fix is correct.
#6272 fixes #6264, but the code seems redundant: we thought espressif_board_reset_pin_number() code was supposed to be doing this reset to high already. Diagnose why espressif_board_reset_pin_number() is not producing the desired effect.
is there a file with all the pin define tag ?
<@&356864093652516868> The weekly meeting is in about 80 minutes from now in the "circuitpython" audio channel. Please add your notes to the document if you haven't already: https://docs.google.com/document/d/19SfrFM1BeAqltmW6iBdWZYqqQ4lmiQaiqLzV8_ea7eo/edit?usp=sharing (and note if you'd like me to read your notes aloud). I look forward to catching up with y'all!
CircuitPython Weekly for May 9, 2022 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to participate, add...
@stuck elbow I am using the schematic to be sure what pin is what
not sure what you mean
#define MICROPY_HW_BOARD_NAME "LILYGO TTGO T-OI PLUS"
#define MICROPY_HW_MCU_NAME "ESP32-C3"
#define MICROPY_HW_LED_STATUS (&pin_GPIO3)
#define DEFAULT_UART_BUS_RX (&pin_GPIO20)
#define DEFAULT_UART_BUS_TX (&pin_GPIO21)
#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX
#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX
the tags after define
I think the names of the pins are defined in the IDF
you need to look at where those nets are connected to the microcontroller
ok
Thank you so much! I'm going to discuss this in the Weekly meeting, I really appreciate you putting this together!
Black should have already been updated, so please update it here as well. Thank you!
@stuck elbow in this github the manufacturer added examples in one of them it says it got 7 neopixel, but I see none on my board
maybe they connect additional neopixels?
maybe. It's hard to tell
https://www.hackster.io/lilygottgo/lilygo-ttgo-t-oi-plus-740139 there seems to be a neopixel "expansion board" like shown/linked here. it's up to the manufacturer to make sure the data they publish is clear, circuitpython can't do much about it.
Something I won't use
Is the weekly meeting going to happen today
Yes.
We're finishing up our internal meeting, then i'll need 5 minutes to get set up
thanks for your patience
@errant grail What is your website URL?
No public website, just a github presence https://github.com/CedarGroveStudios
@inland tusk Can you mute please?
When an invalid usage was given, the error message incorrectly referenced "usage_page".
I haven't tested this - can't currently compile, but fairly sure this is the correct fix.
Jeff you have to release me before I can mute
To celebrate MicroPython's ninth birthday (29 April 2022), let's use Gource (https://gource.io/) to take a look at the development history.
Today watch out for #RevengeOfTheFifth after #MayTheFourthBeWithYou! Here's the rebel DeathStar animation in #CircuitPython on a GC9A01 round LCD driven by @adafruit QTPY RP2040
120
For #StarWarsDay I made a silly targeting computer gizmo in #CircuitPython. This uses an @adafruit ESP32-S2 TFT Feather but any CircuitPython-capable board + display will work. Stay on target!
186
love the targeting computer!
Transfer texture from an @adafruit PyGamer to #GameBuilderGarage on #NintendoSwitch by mouse emulation.
A translation in #CircuitPython of Arduino code, credit to the original author and community.
Bonus: copy the texture via USB, display on screen.
Code: https://t.co/zKaBJnnW6L
Yes, thanks for catching that!
this is a really interesting coding experience on mobile: https://tomorrowcorporation.com/7billionhumans
Tomorrow Corporation is an independent game developer behind indie games Little Inferno and Human Resource Machine
I could play it with one hand while holding a baby
thanks folks!
thanks all
Thanks!
Thanks all!
@onyx hinge - use case for PIO is that we're trying to test an error we get when a pin is short for crazy short amount of time, like 40 nanoseconds. Couldn't even do it with Arduino using inline assembly. But PIO allows us to do even better because we can take advantage of the 8 nanosecond clock tick. Now we can test not just for upper limit but maybe even lower limit!
@proven garnet cool! if you make a special overclocked build you should be able to go even lower than 8ns
Good point!
@idle owl was the formatting for the .pre-commit-config.yaml okay? My - --disable... lines are all at the same indentation as opposed to the example you linked, I assume that's fine if not preferable?
Um.... same as the gist you linked earlier?
I'm not sure why the spacing was changed so significantly in the example. I genuinely don't know what's preferable. The Gist you sent looks appropriate. If you made changes, please let me know so I can take a look.
(brb)
this is apparently how far I got in 7 billion humans, and how long ago. no wonder I'm fuzzy on the details
No it's the same gist, just checking.
Gist looks correct.
I'll probably patch this weekend then, will probably 100% post-check this one since I'm not entirely confident something won't potentially trip it up based on the moderate complexity.
Perfect. Thank you.
@slender iron great to see you back!
scheduling is always the hardest problem in CS ;-)
🙂
#include "shared-bindings/board/__init__.h"
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
CIRCUITPYTHON_BOARD_DICT_STANDARD_ITEMS
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_IO20), MP_ROM_PTR(&pin_GPIO20) },
{ MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_IO21), MP_ROM_PTR(&pin_GPIO21) },
{ MP_ROM_QSTR(MP_QSTR_LED), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO3), MP_ROM_PTR(&pin_GPIO3) },
{ MP_ROM_QSTR(MP_QSTR_IO19), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO19) },
{ MP_ROM_QSTR(MP_QSTR_IO18), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO18) },
{ MP_ROM_QSTR(MP_QSTR_IO9), MP_ROM_PTR(&pin_GPIO9) },
{ MP_ROM_QSTR(MP_QSTR_IO8), MP_ROM_PTR(&pin_GPIO8) },
{ MP_ROM_QSTR(MP_QSTR_IO2), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_BAT), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_IO4), MP_ROM_PTR(&pin_GPIO4) },
{ MP_ROM_QSTR(MP_QSTR_IO5), MP_ROM_PTR(&pin_GPIO5) },
{ MP_ROM_QSTR(MP_QSTR_IO6), MP_ROM_PTR(&pin_GPIO6) },
{ MP_ROM_QSTR(MP_QSTR_IO7), MP_ROM_PTR(&pin_GPIO7) },
{ MP_ROM_QSTR(MP_QSTR_IO10), MP_ROM_PTR(&pin_GPIO10) },
{ MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
for this
today the import of the notes doc into github was a pain, the "*" were spaced in more than usual and so it wasn't good markdown
Ooof that was probably my bad.
so I had to "delete 3/4/5/???" spaces in a lot of places. I hope I got it mostly right.
@idle owl why/how would it be any different than usual?
Where I added the bullets to the list of PyCon PRs?
no, like, all through status updates, almost everyone
Am I on the good track or I'm off to be beaten with a stick ?
that looks good to me, you could add a board.I2C since, even though it's not marked on the board, it is the grove connector, which is an obvious default, even alias it to board.STEMMA_I2C since that's how adafruit calls the grove connector
don't forget that the pins have to be defined in mpconfigboard.h for the default busses
this is an other task
I am trying my best
@jaunty juniper I don't even know how to make the stemma_i2c definition in cpp
and thank you for working on it 👍
np I need it for my project
what do I do with those ???
The SPI got like 5 different pins
and 3 of them are also ADC channels
@dhalbert and others - I have been sort of curious why the Filesystem is wiped clean. So I have been doing some experiments.
Most of these are talked about on the Teensy form thread, that @roberthh (MicroPython) created for same issue.
I hacked up a quick and dirty hex file range dump program from the Teensy_loader_cli app, that simply dumped the ranges of ...
they seem to be arbitrary names for the pins, in fact that picture on their site with the names on the silkscreen seems... self-contradictory
// UART
#define DEFAULT_UART_BUS_RX (&pin_GPIO20)
#define DEFAULT_UART_BUS_TX (&pin_GPIO21)
#define CIRCUITPY_BOARD_UART (1)
#define CIRCUITPY_BOARD_UART_PIN {{.tx = &pin_GPIO21, .rx = &pin_GPIO20}}
#define CIRCUITPY_DEBUG_UART_RX DEFAULT_UART_BUS_RX
#define CIRCUITPY_DEBUG_UART_TX DEFAULT_UART_BUS_TX
Do I keep both def ?
silk screens are devious sith lords
@jaunty juniper https://github.com/Xinyuan-LilyGO/LilyGo-T-OI-PLUS this is the board
seemingly not the same revision of the board ? I am very confused
http://www.lilygo.cn/prod_view.aspx?TypeId=50044&Id=1361&FId=t3:50044:3
yeah the old version had a long ceramic antena
the one I got is the one with the ui18 small red ceramic antena
I'd say we generally don't give pin names if they are not on the silkscreen and just an arbitrary convention of default pins, and I think the C3 can assign MISO/MOSI/SCK to any pin like the other EPS32 chips, but 🤷
ok so I won't name them
if you're using CIRCUITPY_BOARD_UART_PIN, you can remove DEFAULT_UART_BUS_RX/TX
but the debug at the end are using the RX/TX def
ah well you can replace with the actual values
but to have access to those you need to solder pins
The usb-c is functionnal
I'll remove the debug ?
I guess, I don't know what they're for in this case
I copied the T-01C3 files
since it was the closest to T-oi Plus
Do I need to set the reset button and the on off switch from the battery ?
no that's not something you can access in software
and for the battery power level ?
should I use A0 like the schematic is telling (A0 is also ADC1_CH2 and GPIO2)
A Xiao/QTPy checkbox under the filter->features section of the https://circuitpython.org/downloads?sort-by=downloads would be useful.
Does anyone know if it is expected for an SDCard being plugged in or not to cause a difference in behavior on the SPI bus?
I'm noticing that a RFM9X FeatherWing has very weird / unexpected behaviors if I have the SDCard plugged in to my PyGamer. But if I remove the SDCard all behavior is normal.
None of my code initializes or does anything with the SDCard, my assumption was that would mean there should be no traffic on the bus related to SDCard stuff. But maybe some occurs inside the core that I am unaware of?
I vaguely recall something about init order being important. e.g. must init SD card first maybe?
oh yeah the SDCard has to be inited so it operates in SPI mode
otherwise it can interfere with the bus
(it's in sdio mode by default or something)
oh so maybe not initing the SD card can cause problems on SPI?
it looks like A0 is internally connected to the battery, it would be called:
{ MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_GPIO2) },
{ MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_GPIO2) },
interesting, so possibly if I do initialize it and configure it a certain way it could stop it from interferring?
give it a try? 🤷♂️ 🙂
I think if you init it with adafruit_sdcard it should do it
great ! so now, I'll revise it so it is accurate to the board, and then send a pull request. I can't compile on this computer... and I don't know why
also, the text for "Wi-Fi (Two Version Onboard Antenna Or UFL Connector)" seems to have been split across two checkboxes

I need someone to review and compile this build so I can test it.
ok
meaning it compiles all proposed code to ensure it still compiles
why can't you compile locally? I may be able to help you get it going
I use VSCode and I always have cmake errors
what OS are you on?
ah, I haven't gotten CP compiling on windows myself