#circuitpython-dev

1 messages Β· Page 372 of 1

manic glacierBOT
#

Hi @jweaver85, I think you can accomplish what you're trying to do with Tasko or your own event loop & circuitpython's async/await support today. Should look something like:

import tasko

[...]


# Scheduled at a high rate so that the button is responsive
asyc def updateAlgorithm():
    [unchanged, maybe have one of these per animation instead of spreading them across time? or loop them in this function]

# Scheduled at high rate to keep brightness button responsive
async de...
manic glacierBOT
tulip sleet
#

@jaunty juniper Hi - I had staff try out your fix for M1 Macs, which I incorporated into adafruit-board-toolkit 1.1.0. It did not work for them. I'll pass you the logs -- I have not had a chance to study them in detail yet.

manic glacierBOT
lone axle
#

The first line in the meeting doc has last weeks date in it. I'm going to go ahead update it to 17th

manic glacierBOT
tidal kiln
#

does UF2 firmware loading work from an ipad?

manic glacierBOT
#

Oh, it's the dumb STM32 flash sector thing. STM32 has irregular flash sectors, and it's crucial for startup that the ISR vector table goes at the start of one. The bootloader takes up the first 64 bytes, but then the firmware ISR table has to reserve a whole 64 byte sector because there are no smaller ones left. We can manually pack libraries in there alongside it to free up space in the firmware sectors, which Micropython often does, but that's a trial and error process and wasn't done in th...

tulip sleet
#

@ionic elk 64 bytes or 64k bytes?

ionic elk
#

64kb

#

whoops I will edit

#

Anyway yeah on the meowbit the first 4 16k sectors are bootloader, than the ISR is in the 64k one, and the firmware is on the following 128k ones

tulip sleet
#

the design choices on some of the STM chips are so bizarre

ionic elk
#

the irregular flash is weird, yeah

#

but they do tend to have a lot of it for the price, so I guess it worked for them?

#

I think the newer lines like the L4 and G series have more of a standard page approach

#

But yes it's irritating that every single STM32 chip family has a totally different flash structure. F1 F4 F7 H7 L4, all of them are different and every time I add one I have to write a whole new driver in the flash files.

tulip sleet
#

trade off of engineeering time and heartburn vs price πŸ™‚

ionic elk
#

that's ST, cheap, very capable, always annoying

manic glacierBOT
copper crescent
#

Anyone have any pointers what I'm missing to build circuitpython these days following the steps on https://learn.adafruit.com/building-circuitpython/build-circuitpython (on ubuntu 20.04)?

make BOARD=circuitplayground_express V=2
GEN build-circuitplayground_express/genhdr/mpversion.h
python3 ../../py/makeversionhdr.py build-circuitplayground_express/genhdr/mpversion.h
GEN build-circuitplayground_express/genhdr/devices.h
install -d build-circuitplayground_express/genhdr
python3 ../../tools/gen_nvm_devices.py ../../supervisor/shared/external_flash/devices.h.jinja build-circuitplayground_express/genhdr/devices.h
Traceback (most recent call last):
File "../../tools/gen_nvm_devices.py", line 23, in <module>
typer.run(main)
File "/usr/local/lib/python3.8/dist-packages/typer/main.py", line 859, in run
app()
File "/usr/local/lib/python3.8/dist-packages/typer/main.py", line 214, in call
return get_command(self)(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/typer/main.py", line 239, in get_command
click_command = get_command_from_info(typer_instance.registered_commands[0])
File "/usr/local/lib/python3.8/dist-packages/typer/main.py", line 425, in get_command_from_info
command = cls( # type: ignore
TypeError: init() got an unexpected keyword argument 'no_args_is_help'
make: *** [../../supervisor/supervisor.mk:57: build-circuitplayground_express/genhdr/devices.h] Error 1

jaunty juniper
#

wait, 8.0 is out, you might need to pin it to 7.1

#

like that if 8.0 doesn't do it pip3 install -U click==7.1.2

#

the issue is that installing requirements doesn't seem to update click to the version required even though it's a requirement of one of the requirements

copper crescent
#

@jaunty juniper I've updated to 7.1.2 (I had 7.0) and running the make again

jaunty juniper
idle owl
#

<@&356864093652516868> The CircuitPython Weekly Meeting is in 1.5 hours, at 11amPT/2pmET. If you plan to participate, please include your status updates and hug reports in the notes doc. Otherwise, if you're simply listening in, no need to do anything but show up. Hope to see everyone there! https://docs.google.com/document/d/1KY5czjOS8X8uZRGZpW3zT8RYCaMnOEZyUEC5GdTpzdw/edit#

#

@tulip sleet Do you know off the top of your head of a library that has tests in it? As in a tests directory with tests included.... I know we have a few and I'm struggling to find it.

#

Really don't want to initiate the entire library bundle and grep it.

#

Nevermind! Brent came through.

tulip sleet
# idle owl <@!329766224093249548> Do you know off the top of your head of a library that ha...
halbert@tuna:~/repos/adafruit/Adafruit_CircuitPython_Bundle$ find . -name tests
./libraries/helpers/datetime/tests
./libraries/helpers/requests/tests
./libraries/helpers/midi/tests
./libraries/helpers/motor/tests
./libraries/helpers/ble-radio/tests
./libraries/helpers/simplemath/tests
./libraries/helpers/debouncer/tests
./libraries/helpers/imageload/tests
./libraries/helpers/pioasm/tests
idle owl
#

πŸ˜„ You did what I didn't want to do.

#

Thank you!

#

I linked datetime and requests to the person who was asking.

tulip sleet
#

well, I always have a clone of that repo, but using find might be new for you

idle owl
#

My clone is way out of date, and not everything is initialised. So the directories don't all have all the files.

tulip sleet
#

git pull on that repo takes a while all the time; many changes all the time

copper crescent
#

Sorry for the delay @jaunty juniper it took it a while to build but it's working again now, thanks for the quick fix :)

tidal kiln
idle owl
#

@gilded cradle For the Project Bundle, I've had someone suggest including a .gitignore in any bundle that includes a secrets.py file, so if folks are using Git/GitHub to back up their code, they don't accidentally commit/push their credentials. I'm not sure if that's possible, or something to consider, but the case they made was solid. I don't know where to file an issue for discussion.

gilded cradle
#

Not a bad idea

idle owl
#

@ember iris Hey! Keith is who suggested it.

ember iris
#

you beat me to it so I can't quite call jinx, but the spirit of jinx is there πŸ˜›

gilded cradle
#

Still not a bad idea πŸ˜‰

ember iris
#

I'd like to listen in on the circuit python chat today, is that possible? I can't go off of mute for the time being if that's ok

idle owl
#

Join the CircuitPython voice channel and remain muted.

idle owl
ember iris
#

I added a hug report, but it's text only for that reason if that's ok

idle owl
#

That's absolutely fine!

errant grail
#

Just listening today

turbid radish
#

Lurking

idle owl
modern wing
#

Sure!

ember iris
sterile bronze
#

lurking

mental nexus
#

Lurking

ruby atlas
#

i'm suppressed so I can't do a mic check.

idle owl
#

You shouldn't be.

#

I updated your role. Reload?

turbid radish
#

Hi Rose!

ruby atlas
#

Hi!

silver tapir
#

πŸ‘‹πŸ½ πŸ‡¨πŸ‡·

marble hornet
#

πŸŽ‰πŸŽŠ

idle owl
#

:=

lone axle
idle owl
lone axle
turbid radish
#

29k!

#

Yes, thank you

lone axle
turbid radish
idle owl
#

It's all Anne now! πŸ™‚

turbid radish
#

:gasp:

idle owl
#

I'll take it.

turbid radish
#

Yes, Thank you Kattni for your help as always!

ruby atlas
#

(oops! knocked over my water bottle)

slender iron
#

hope you didn't hit your keyboard

ruby atlas
#

nah, it got lodged between the desks.

modern wing
#

That's a tongue twister for sure

solar whale
#

@gilded cradle Would you mind a few questions about using Blinka on Micropython -- In the Weeds?

gilded cradle
#

Sure @solar whale

ionic elk
thorny jay
#

@tulip sleet in your cherry picking for 6.3 do you have something for the Pimoroni Pico Lipo? https://twitter.com/biglesp/status/1393549517484613632

PSA I'm messing around with @pimoroni Pico Lipo with @CircuitPython and it took me a while to notice that I was using CircuitPython 7.0 Alpha, and so my folder full of 6.0 libraries wouldn't work :) Download the 7.0 library bundle and all is good!

modern wing
#

gesundheit πŸ™‚

solar whale
#

sorry -- forgot which computer had audio....

slender iron
#

no problem @solar whale

ruby atlas
#

i chained my audio to two machines with an XLR Y splitter.

trim elm
#

Oh yeah, that was really helpful. @still zephyr Thanks for tagging me on all the prs I said I'd review but forgot about

steel granite
#

with flag DEBUG=1

hollow gazelle
ionic elk
#

@steel granite using DEBUG reduces optimization and might increase the flash size, and on some SAMD21 boards the flash margins are very tight

#

so you might need to remove some modules you aren't using and rebuild

hollow gazelle
tulip sleet
ionic elk
#

you know, I've never checked, what are the biggest "default" modules

steel granite
#

I have removed several modules, any recommendation of which modules?

steel granite
hollow gazelle
thorny jay
#

There is a key matrix library already...

idle owl
#

I shouldn't be glad to hear you managed to replicate the RP2040 issue, but I'm so glad you managed to replicate the issue @tulip sleet

thorny jay
#

For keypad.

tulip sleet
#

we were going to work on a native C module, did you mean we have one?

tidal kiln
#

@hollow gazelle yep

thorny jay
#

A python one.

#

I used that for real C64 keyboard scanning.

tulip sleet
#

this will be a native C one that will monitor button pushes in the background, like the gamepad and gamepadshift modules

#

but will definitely look at the python one, thanks

#

i am not familiar with it

manic glacierBOT
hollow gazelle
# tidal kiln <@!649453464988155906> yep

@tiny sapphire mentioned that they couldn't get to HOUSEBOOT back on 5/5, and similar question was / response was mentioned @idle owl , who said "I ran into this. I was told to press reset once, and when the NeoPixels turn purple, press reset again to get to HOUSEBOOT. I thought it didn't have the right bootloader on it or something, but it was simply a button rhythm issue." - I'll test this now

manic glacierBOT
hollow gazelle
#

thank's to @idle owl - the press reset the second time when the lights were purple, got me to green leds on the funhouse, and HOUSEBOOT showing up as a drive!

idle owl
idle owl
tidal kiln
#

@hollow gazelle thanks. same here. hmmm...guide should maybe be updated.

ruby atlas
idle owl
#

Partial results of my touchio script: code.py output: Touch on: A0 Touch on: A1 Touch (no pulldown) on: A2 Touch (no pulldown) on: A3 Touch (no pulldown) on: D0 Touch (no pulldown) on: D1 Touch (no pulldown) on: D10

tidal kiln
ruby atlas
#

I keep wanting to use Blinka in PyCharm and/or Visual Studio Code so that I can have live completion... πŸ™‚

idle owl
ruby atlas
#

I guess maybe a blinka-stubs project.

slender iron
#

@ruby atlas we have circuitpython-stubs

ruby atlas
#

TIL!

turbid radish
#

@gray mantle - let's ask Learn Dev

slender iron
#

we need it pushed to pypi automatically though

turbid radish
#

Get with me

ruby atlas
#
Creating a virtualenv for this project...
Pipfile: /Users/rhooper/Devel/sprints-2021/Pipfile
Using /usr/local/bin/python3.9 (3.9.5) to create virtualenv...
β ‡ Creating virtual environment...created virtual environment CPython3.9.5.final.0-64 in 494ms
  creator CPython3Posix(dest=/Users/rhooper/.virtualenvs/sprints-2021-u85AtMf2, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/rhooper/Library/Application Support/virtualenv)
    added seed packages: pip==21.0.1, setuptools==56.0.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator

βœ” Successfully created virtual environment!
Virtualenv location: /Users/rhooper/.virtualenvs/sprints-2021-u85AtMf2
Installing circuitpython-stubs...
Error:  An error occurred while installing circuitpython-stubs!
Error text: Collecting circuitpython-stubs
  Using cached circuitpython-stubs-2019.5.26.tar.gz (12 kB)

WARNING: Discarding https://files.pythonhosted.org/packages/6a/1b/61bbcb3680ac60d25b28ad4354603aee7507e16cc81dbe36f8c370f71412/circuitpython-stubs-2019.5.26.tar.gz#sha256=ae7b40b34c81b1ab3da8547615124d7c7d67660f35a7571b65643a9d415968d4 (from https://pypi.org/simple/circuitpython-stubs/). Requested circuitpython-stubs from https://files.pythonhosted.org/packages/6a/1b/61bbcb3680ac60d25b28ad4354603aee7507e16cc81dbe36f8c370f71412/circuitpython-stubs-2019.5.26.tar.gz#sha256=ae7b40b34c81b1ab3da8547615124d7c7d67660f35a7571b65643a9d415968d4 (from -r /var/folders/jv/6jpqf9ln0hsfkh45qtr9yxmw0000gn/T/pipenv-jwbahtln-requirements/pipenv-wyspsquu-requirement.txt (line 1)) has inconsistent version: filename has '2019.5.26', but metadata has '2021.5.17'
ERROR: Could not find a version that satisfies the requirement circuitpython-stubs
ERROR: No matching distribution found for circuitpython-stubs```
#

Looking at repo/filing an issue πŸ™‚

slender iron
#

I think it's pretty old

#

you can make stubs in the top of circuitpython to build them

lone axle
#

I don't think we've been able to get the stubs deployed to PyPi successfully. You can install them somewhat manually in PyCharm though if you want to use them in there.

slender iron
#

what was the issue @lone axle ?

manic glacierBOT
lone axle
#

When I gave it a shot I could not figure out how to get pip to actually install the files. I was able to get pip install to run but the stubs weren't present to site-packages.

ruby atlas
#

welcome to packaging in python. (insert xkcd)

thorny jay
#

All the sequence should not be in the "core" I believe.

errant grail
#

Given the ubiquity of using LEDs with CircuitPython, could LED core become a native module like ledio?

turbid radish
#

Kitty!

ruby atlas
#

Yep, in stereo. Just as I unmuted.

thorny jay
#

I had to simplify some of the code to remove colour and function that were not used.

lone axle
#

I tried looking into how other projects with stubs do it. But it's tough because most other projects I could find the main project is python code. But for circuitpython there is not python code behind it, but C instead.

slender iron
#

I think typeshed is an example

thorny jay
#

Yes, French keyboard is much wanted... and there was a PR or variant.

slender iron
ruby atlas
#

adafruit-circuitpython-animations
adafruit-circuitpython-animations-lite

idle owl
#

Having a Core and Animations separate, is a different thing.

lone axle
#

Nice! thanks for the pointer, I will take a look into that one and see if we can mimic something they are doing to get the pyi files to install with pip.

marble hornet
manic glacierBOT
#

I made the changes in existing code to support DEBUG UART on atmel-samd based boards.

CircuitPython 7.0.0-alpha.2-586-g0ac107b73-dirty on 2021-05-17; ATSAME51J20A custom board

I would like to submit my changes, but I would to clarify some doubts before doing this:

  1. There is generic part which is relevant for all atmel-samX based boards. But there is board specific part which currently resides inside of asf4_conf directory. The issue is that this configuration is really b...
lone axle
manic glacierBOT
#

What is your boot.py? That would be the easiest.

I've just copied the sample you gave in this thread in the first post https://github.com/adafruit/circuitpython/pull/4689#issue-626883902

but it outputs an error in boot_out.txt

Adafruit CircuitPython 7.0.0-alpha.2-584-g25a44cb77 on 2021-05-15; Raspberry Pi Pico with rp2040
boot.py output:
back trace (jΓΌngste Aufforderung zuletzt):
file "boot.py", line 48, in <module>
ValueError: out_report_length must be 1-255

modern wing
#

Thanks everyone!

turbid radish
#

Thanks everyone

ember iris
#

Thanks all!

still zephyr
#

Thanks everyone

marble hornet
#

Thanks All, have a great week

tulip sleet
#

that was bizarre - machine froze and discord started repeating 3 seconds of audio over and over

tulip sleet
#

linux

idle owl
#

@lone axle Multi-word library names, creating library files with spaces instead of underscores in cookiecutter, apparently.

tulip sleet
#

native app, not browser for discord

#

@jaunty juniper I will have access to an M1 Mac soon, will get you more info

idle owl
#

@lone axle

#

I mean it's irrelevant here, it will be packages. But still, probably worth looking into.

lone axle
#

and we want it to come out as adafruit_led_animation_core.py

idle owl
#
1 - Adafruit
2 - Community
Choose from 1, 2 [1]: 1
github_user [adafruit]:
author_name: Kattni Rembor
company [Adafruit Industries]:
library_name: LED Animation Core
library_description []: Core files for CircuitPython LED Animations.
library_keywords []: led animation
library_prefix [adafruit]:
adafruit_pid []:
requires_bus_device []:
requires_register []:
other_requirements []:
pypi_release [yes]:
sphinx_docs [yes]:```
#

Correct, it should be all underscores.

lone axle
#

I will check into it tonight. I think there are some spots where it does replacements with underscore. I may have broken that behavior accidentally.

idle owl
#

Ah fair enough. Thanks for all your work with it!

manic glacierBOT
#

Have you forked adafruit/circuitpython on GitHub? Do so and you can create multiple branches in your fork to handle all these changes. A GitHub pull request is the best way to submit code for review.

If this UART port only needs to exist when the CircuitPython VM is running, you should be able to implement it in a port and device-independent way. You can call the common-hal UART routines to set up the connection and then have serial.c and maybe other places direct output and take input...

idle owl
#

This will break SO MANY GUIDES. Sigh. Need to figure out a "legacy" backwards compatibility plan here.

slender iron
#

Here is the notes document for Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1QHyjj8WWI7cAWNM1gpuEVwcTM__C_wxOdurLUAZmHtM/edit?usp=sharing

tulip sleet
idle owl
#

Hmm.

#

I mean, this library is already well divided up into packages, meaning it wouldn't be hard to determine what's needed based on imports.

#

But I don't know whether that's a feature they would even entertain.

tulip sleet
#

well, we already tell people to do it by hand (delete what you're not using), so automating that is making it easier

#

myabe a library has "components", and you can say which components you want

ember iris
#

Would it be possible to make an LED Core library that is redundant, and then slowly remove the core elements from the led animations library, that way the transition can be more slowly manage and doesn't break everything at once?

tulip sleet
#

and maybe there are required and optional components

manic glacierBOT
#

I somehow broke the boot.py file which makes the file system read-only.

Adafruit CircuitPython 7.0.0-alpha.2-584-g25a44cb77 on 2021-05-15; Raspberry Pi Pico with rp2040
boot.py output:
OSError: [Errno 5] Input-/Output error

I think it should be the other way round: If something is wrong with boot.py, the filesystem should be always writeable so you are able to fix the error.

Renaming boot.py via REPL didn't work but formating the drive resets it completly.
...

still zephyr
#

And to add KeiththeEE comment, we could archive the old librry, we did that we the DHT library and people still use to this day the old one.

ember iris
#

Ah that is a good point. I was looking at it from a workload per unit time perspective

idle owl
still zephyr
#

In this case, the question will be, what would be folks complain less about as a user?

idle owl
#

That is a huge consideration, yes.

still zephyr
#

if we need to change I will help to change whatever is needed, but for me the user is the key factor here

ruby atlas
#

Hmm. The stubs seem to generate fine. Now to try using 'em.

#

aha, installing requires git.

#

and the git command fails

#

okay i think I can file a bug and fix now that I know what's up.

manic glacierBOT
blissful pollen
#

When I'm listening to this weeks meeting and find a youtube tab in my browser where I hadn't finished last weeks meeting 😐

idle owl
hollow gazelle
# tidal kiln <@!649453464988155906> that trick is mentioned here: <https://learn.adafruit.com...

thanks - I missed that!
It's not like the 'normal' double-click. ( and the important part - about pausing to hit the second reset when the LEDs are purple - is at the end, instead of noted - perhaps even there, the text should be expanded to note the importance of waiting till the LEDs are purple:

Launch UF2 by double-clicking* the Reset button (the one next to the USB C port). You may have to try a few times to get the timing right.

About a half second pause between clicks *while the DotStars are purple seems to work well.

on the other hand something is still missing on https://learn.adafruit.com/adafruit-funhouse/install-uf2-bootloader
as it only mentions the one click of RESET before HOUSEBOOT and the "half second pause between clicks" almost seems to conflict with the first sentence in Step 4.

@gilded cradle what do you think about rewording that page to say
Click RESET button to launch the bootloader. The DotStars should turn purple, then press reset quickly again. The LEDs should turn red, then green. If you get it right... " (You'll see a new disk drive on your computer with the name HOUSEBOOT.)

Adafruit Learning System

WiFi connected home automation projects made easy!

tidal kiln
#

@hollow gazelle look again. @gilded cradle just did some updates.

hollow gazelle
# tidal kiln <@!649453464988155906> look again. <@!478616919721771019> just did some updates.

but the first two sentences still say "Click RESET button to launch the bootloader. You'll see a new disk drive on your computer with the name HOUSEBOOT."
after doing just the first click, one is unlikely to see the drive if the funhouse_tinyuf2_combo.zip bin was installed, since the app launches.
The confusion and pain has locked the wait for purple into my mind, but others will likely be confused

ionic elk
#

@tulip sleet what's the nrf board I gotta get again

tulip sleet
#

Circuit Playground Bluefruit

ionic elk
#

kthx

jagged plover
#

Hi

gilded cradle
jaunty juniper
#

Hey, I recently discovered sys.stdout.buffer, which is present on a Feather NRF52 express but not on a Feather M4 (on 6.x or 7.x) I'm not sure what that's for and why it's different ?

hollow gazelle
# gilded cradle Ok, I think it's worded a bit better now.

I spent some time searching for a github repository where the learn guide for https://learn.adafruit.com/adafruit-funhouse/install-uf2-bootloader might be found ( to create and issue / pull request ), but I think I'm miossing some knowledge about how learn.adafruit.com is constructed. ( Is there some intro document that might help, or is the page in question hidden from the public? )

Adafruit Learning System

WiFi connected home automation projects made easy!

gilded cradle
manic glacierBOT
hollow gazelle
#

is there a special place to get CP7 .mpy files? ( or should I stick with .py for CP7 )
MpyError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
Just installed latest code: Adafruit CircuitPython 7.0.0-alpha.2-586-g0ac107b73 on 2021-05-17; Adafruit FunHouse with ESP32S2
and bundle 6 https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/download/20210514/adafruit-circuitpython-bundle-6.x-mpy-20210514.zip

I didn't really expect bundle 6 to work, so I wonder if I should be browsing around to
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases
to manually fetch adafruit-circuitpython-bundle-7.x-mpy-20210514.zip
from the auto release?

GitHub

A bundle of useful CircuitPython libraries ready to use from the filesystem. - adafruit/Adafruit_CircuitPython_Bundle

jaunty juniper
#

I believe the bundle is up to date with mpy's compatible with alpha 2

#

that 7.x release from the repo

#

(and circup, though circup doesn't detect invalid mpy files and will not update them if the library version is the latest)

idle owl
gilded cradle
#

@solar whale, a search for Blinka now loads the Raspberry Pi Blinka guide first.

solar whale
#

@gilded cradle excellent! Thank you!

hollow gazelle
kind river
#

I heard something about writing a keypad driver. Here's some PIO code I wrote for a 4x4 matrix if it's helpful:

.side_set 4 opt

; A 4x4 keypad driver.

nop                 side 0b0001     ; Setup to read first row
.wrap_target
start:
    mov y, x                        ; Store last isr value
    in pins, 4      side 0b0010     ; Read all columns and select next row
    in pins, 4      side 0b0100     ; Read all columns and select next row
    in pins, 4      side 0b1000     ; Read all columns and select next row
    in pins, 4      side 0b0001     ; Read all columns and select next row
    in null, 16

    mov x, isr                      ; Setup for button check
    jmp !x, start                   ; If ISR is zero (no buttons pressed), jump to start
    jmp x!=y, pressed               ; If ISR is not equal to last value, jump to to push
    jmp start

pressed:
    push                            ; Push ISR
.wrap```
manic glacierBOT
manic glacierBOT
slender iron
#

@tulip sleet can you get a capture with chip select too?

tulip sleet
#

Can do later

slender iron
#

the clock line looks really inconsistent

manic glacierBOT
#

Led does not turn on
was tested on

Adafruit CircuitPython 7.0.0-alpha.2-573-g49bad0797 on 2021-05-14; Adafruit Feather M4 CAN with same51j19a

Neopixel only turns green on bootoader mode.

I think this was broken before this change. The M4 CAN has a neopixel power pin that the core doesn't know how to turn on. On some boards with turn it off and on with board_init and board_deinit but I don't see that code for the M4 CAN.

manic glacierBOT
tulip sleet
#

@slender iron I can only get two QSPI signals at a time. What would be a good trace to do? CS & SCK, MOSI & MISO?

#

because I am just holding some needles against the pins (two needles stuck in a cork)

manic glacierBOT
manic glacierBOT
#

Good point!

I beleive it is what I mean, right?

void common_hal_busio_uart_never_reset(busio_uart_obj_t *self) {
    for (size_t i = 0; i < MP_ARRAY_SIZE(sercom_insts); i++) {
        const Sercom *sercom = sercom_insts[i];
        Sercom *hw = (Sercom *)(self->usart_desc.device.hw);

        // Reserve pins for active UART only
        if (sercom == hw) {
            never_reset_sercom(hw);
            never_reset_pin_number(self->rx_pin);
            never_reset_pin_numbe...
#

Thanks for fixing this up! Two minor comments. Good otherwise.
Thanks for quick response!

Actually, I have done this intentionally.
I know the rest of the code is written in different manner, but still I believe it is valid point.
Should it be described somewhere here?
https://github.com/micropython/micropython/blob/master/CODECONVENTIONS.md

https://en.wikipedia.org/wiki/Yoda_conditions

common-hal/busio/UART.c: In function 'common_hal_busio_uart_construct':
common-hal/bu...
lone sandalBOT
idle owl
#

@tulip sleet Is it possible to run mpy-cross on multiple files at the same time without typing them all out? As in, run mpy-cross on a package directory.

tulip sleet
#

no, it only takes one at a time, unfortunately

#

there is code in the bundle builder and in the frozen-libs builder to handle this

#
$ mpy-cross ble*.py
multiple input files
idle owl
#

Ew. Ok.

tulip sleet
#

see, it complains

idle owl
#

That's a bummer. Thanks for letting me know though so I didn't try to fight with it.

#

I'm working on refactoring the LED Animation library and want to know whether I made the Core lib tiny enough. But ugh. So many mpys still.

tulip sleet
#

it would be simple to write a shell or python script to invoke it multiple times on a directory or a list of arguments.

#

@idle owl ^^ that script should do what you want

idle owl
#

Ahhhh!

manic glacierBOT
idle owl
#

@tulip sleet I... can't figure out how to make it work. First I copied it to the lib directory and finally got it to run, but it fails with mpy-cross: command not found so I thought ok maybe it's supposed to be run from within the circuitpython repo, and I tried that, and same thing.

tulip sleet
#

you need to put mpy-cross in your PATH. Or you can change line 38 to point directly to mpy-cross.

idle owl
#

oh ok

tulip sleet
#

for instance, I have this link in my ~/bin directory (which is in my PATH): lrwxrwxrwx 1 halbert halbert 53 Jul 26 2018 mpy-cross -> /home/halbert/repos/circuitpython/mpy-cross/mpy-cross

#

so that whenever I run mpy-cross, it picks the most recently built one in my circuitpython repo (I actually have several circuitpython repo directories, but that's the main one)

idle owl
#

It worked!

tulip sleet
#

I could put /home/halbert/repos/circuitpython/mpy-cross/ , but this is easier

idle owl
#

I copied it into the lib directory and changed 38 to cmd = "./mpy-cross -v -v %s -s %s %s -o %s" % (

#

Thank you!

tulip sleet
#

if that's where you have mpy-cross, great!

meager fog
blissful pollen
manic glacierBOT
idle owl
#

Oof. I mean, it physically fits on the boards now, but you still can't use more than two animations at a time.

#

I guess that's better than nothing.

#

And I may have found a bug in using adafruit_pypixelbuf.

#

I wish we had NeoPixel frozen into all of the M0 non-Express boards. No idea if it would really help here, but maybe.

blissful pollen
#

I'm sure some animations are better then none. I'd think if you're using a small board you probably don't want a lot usually

idle owl
#

You'd be surprised πŸ˜„

#

But yes. I agree, even being able to run one at a time is good.

#

Better than at the moment, where the lib doesn't even fit.

#

I'm finding I can't use PyCharm to edit code.py though, because it's telling me it can't create a backup of the file, and refuses to update the file. I had to open it in Atom to edit it.

#

That's probably a Bad ℒ️ thing.

blissful pollen
#

What boards are they usually trying to target the animations at? Just trying to think what else could shrink stuff in that library (not sure if I'll think of any)

idle owl
#

Ok, so lately it's been M4 (SAMD51) or "better". In theory it fits on an M0 Express board, but if you want to run a lot of animations, you need RAM, so ... But folks want to be able to use a Trinket or whatever to run NeoPixels and do animations. And as of now, it requires writing up all the animation code in code.py and not using the LED Animation library.

manic glacierBOT
#

I see this uses the portalbase library. I took a quick look at the add_text and set_text functions. It has its own functions for displaying text and doesn’t use the bitmap_label or label libraries. Maybe something in the custom add_text and set_text didn’t have all the updates from the bitmap_label and/or label libraries.

I’m away from my computer now but if this is still open can take more detailed look this afternoon.

idle owl
#

I'm trying to make it work on QT Py M0 (because that's what I have sitting here). I got it going on Neo Trinkey with two animations, but Neo Trinkey has a special build, so it's not as good of an example.

#

The M0 non-Express boards require both neopixel and adafruit_pypixelbuf because we don't have _pixelbuf enabled in the CircuitPython builds for those boards.

#

So already more space and so on is taken up on those boards to use NeoPixels (or DotStars, same thing)

blissful pollen
#

Hmmm yeah so more a RAM problem (which comes up quickly). Maybe it wouldn't be helpful but there may be some more rarely used parts of the base animation class that could be trimmed. But then reduces functionality again 😐

idle owl
#

Right. That's what I'm trying to figure out.

blissful pollen
#

If I get a chance later I can glance through the base class again (less familiar with the pixelbuf stuff). See if I remember anything from writing my animations that I may have seen but realized is less used

idle owl
#

I'd appreciate that. No idea where I'll be with it later, but ping me first if you like. So we're on the same page still.

blissful pollen
#

For sure. I like blinking lights so LED libraries are fun !

idle owl
#

I'm a huge fan as well!

#

I can't even get comet to run alone on QT Py M0. It's too much.

#

Blink runs, so it's not the library that's the issue.

blissful pollen
#

It's RAM that is the issue too right now flash storage? Just checking as I did solder the extra storage to my QT Py M0

idle owl
#

You can use the basic QT Py M0 build, and it ignores the flash space.

#

I didn't Haxpress this one up, so it's basic.

#

I think it's more a RAM thing at this point.

#

Though like I said, I can't even edit code.py in PyCharm.

#

so both issue are present at the moment.

blissful pollen
#

yeah I figured storage is a problem, though reducing code size should fix that too by default - usually πŸ™‚

idle owl
#

True.

#

Ooh, comet runs without using AnimationSequence.

#

And yes, I found a bug in adafruit_pypixelbuf. Just found it again.

#

I need to test it on a board that doesn't need pypixelbuf to make sure it's not a neopixel failure.

blissful pollen
#

Not sure it would be much but is the "peers" functionality used often? I did doing more advanced animations but I don't think I saw it in any examples

idle owl
#

I have no idea! I'd need to check the Learn repo, really.

#

Though the plan is to make it all seamless.

#

So it doesn't really matter.

#

That feature can go into "Advanced" or whatever.

gleaming agate
#

Hi! Hopefully this is the right channel. I've been trying out CircuitPython for STM32F411 'BlackPill' but I can't get USB-HID working.
It's listed as having usb_hid, but I can't import it. (I am using the bin for release 7 alpha 2)

idle owl
#

JP made the point that maybe we should simply make it a cutoff that you need an M4 board or better to use the LED Animations library. That we shouldn't make it harder to use on bigger boards to cater to the smaller boards. I don't entirely agree, but I see his point from a usability standpoint.

#

grumbles

blissful pollen
#

Yeah I'm wondering if some can be pulled out or like how the Portal library works where no one uses the "Basic" animations unless you are on a constrained board... if that makes sense?

idle owl
#

Seamless in the sense that the code will work, but you'll have to import another library to make it work.

#

I think that makes sense, if I understand it correctly, that's what I'm trying to do

blissful pollen
#

Yeah that's what I thought you were. I do like that idea. So the M4+ users its easy mode. But if you want to run it on a real lightweight board here it is

idle owl
#

Even for M4+, you'll still have to import a new library over what you had to import before. πŸ˜•

#

I mean, we break things. It happens. Better now than in 6 months when the number of projects using it doubles, I guess.

blissful pollen
#

True and if it coincides with a major version change too that makes things easier to take

idle owl
#

Good point. Hadn't thought about that.

gleaming agate
idle owl
#

@gleaming agate That's entirely possible. I'm wondering if we removed it for some reason. Thing is, it shouldn't show up in the docs in that case - the docs are generated from the core, I thought.

#

I don't know why we would have removed it, unless we were running into build failures and had to remove something. That would be something Scott or Dan could answer.

slender iron
#

@tulip sleet may have removed it with the usb descriptor changes

gleaming agate
# slender iron <@!329766224093249548> may have removed it with the usb descriptor changes

ahhh yes. Seeing some relevant github discussion https://github.com/adafruit/circuitpython/issues/4752 that wasn't coming up for 'stm32f411'
I ordered a Feather RP2040 and a pico a few days ago so I will just have to be patient for digikey to ship my order

GitHub

I've bought a Feather STM32F405 Express and was expecting I could get it to act as a USB keyboard, but turns out USB_HID (and quite a lot of other features) aren't implemented for S...

idle owl
idle owl
#

Ohh right.

blissful pollen
#

That's the first reference to it

idle owl
#

Forgot about that.

manic glacierBOT
idle owl
#

I'm not even sure I remember how it's used. It might have been the predecessor to future functionality.

#

No... hmph.

blissful pollen
#

You can use it to say have a solid background or blink, and then put a rainbow on top of it

idle owl
#

Ah right

blissful pollen
#

so run multiple animations simultaneously. I can't even remember if I chose to use it in the end

manic glacierBOT
idle owl
#

One of the things that JP pointed out was the idea of having a "core" set of animations in a library, and then the rest available as separate libraries would be a bit awkward. Like he would have to check documentation every time to see what he gets built-in, versus what he needs a separate library for.

#

I don't now how to address that reasonably. But it's a valid point.

blissful pollen
#

From a maintainability aspect it isn't great, but would it make sense to have a "lightweight" package for M0s that is just standalone. Maybe even kinda like how CP is a fork of MP so you could pull some code across?

#

But really the two libraries stand on their own

idle owl
#

I don't quite follow

#

Unfortunately, we're not super keen on maintaining multiple versions of libraries.

#

It creates extra work and when it gets forgotten, causes major issues.

blissful pollen
#

Rather then trying to have them linked together in any meaningful way just have LED_animations and LED_animations_M0... maintainability is a pain though

idle owl
#

yeah..

#

I mean folks are doing that already, but not everyone is savvy enough to know how to gut a library to what they need.

#

Sigh.

blissful pollen
#

It's like that triangle, supportability, ease of use and features and we are trying to pick all 3 πŸ™‚

idle owl
#

Yeah. Agreed.

gleaming agate
idle owl
#

That is still maintaining two sets of the same code, unfortunately.

#

I don't know of any way to automatically do that. Or how to have it know what subset of things to update.

#

As the library continues to grow, we'd have to keep track of what needs to be merged into the subset.

blissful pollen
#

I'm doing a truly Canadian thing and walking to Tim Hortons for lunch now though I'll be back around later this afternoon

gleaming agate
#

I see what you mean. Even if it's as simple as "ifndef M0_version" to cut out bits of code, you still have to build and test 2 versions

idle owl
#

Though I see where you're going with it.

#

If there was a way to simply generate two bundled versions of it, I'd be into considering it.

#

But I don't know of a reasonable way to do that.

#

Without basically maintaining two libraries.

#

(bbiaf, also making lunch)

manic glacierBOT
slender iron
manic glacierBOT
slender iron
#

@tulip sleet want to chat here?

tulip sleet
#

sure, one minute, will get a drink of water

slender iron
#

@ruby atlas thanks for the "spot instance" tip. it's much cheaper than buying more ram

tulip sleet
#

@slender iron ok, thirst quenched

slender iron
#

@tulip sleet does it happen on power up or reset?

#

I have a 128 winbond I'm going to test with

tulip sleet
#

it happens on power up. several clicks of the reset button can sometimes bring it back. And when you first load the .uf2, it's OK.

slender iron
#

kk

tulip sleet
#

but you don't have a "bad" one, is that right?

slender iron
#

Β―_(ツ)_/Β―

#

I'm trying to reproduce it in my hacked up feather

tulip sleet
#

The first batch of qt py rp2040's are fine. The datecode pictures I posted are helpful. Even if the datecode is a red herring, as Limor said, I think there is some sample variation, and if you have a later chip, that would be the one to try.

#

I am going to put some SWD wires on the qtpy; I just need to find out which is which

#

eh, maybe not; they don't come out to pads :/

#

i will try the pin toggling instead

slender iron
#

this chip in the feather seems ok

#

let me find my qtpy

tulip sleet
#

my itsy rp2040 is also fine

ionic elk
#

@slender iron I have been testing

#

One thing I am noticing is that the REPL white light will stay on after restarting, and will remain on if the board enters light or deep sleep

slender iron
#

oh ya. I meant to fix that

ionic elk
#

It happens with other signals in isolated cases I am trying to quantify

slender iron
#

what do you mean other signals?

ionic elk
#

I have noticed it happen with a green LED. But I haven't recreated it yet

#

where are the LED signals documented?

slender iron
#

do we have it documented in the repo?

#

I didn't change anything

#

code.py done without error is one green flash

#

with error is two red

#

safe mode is three yellow

ionic elk
#

hmmm

#

we probably should have it documented somewhere, right?

#

so green, red, yellow, and white for repl, and that's it, nothing else? What's the blue blink?

slender iron
#

I think we have a guide page for it

ionic elk
#

I've seen a blue thingy before

slender iron
#

blue may be the bootloader

slender iron
#

and the old version had blue

#

@tulip sleet both of my qtpy work fine

ionic elk
#

I must have seen it when testing the run reason bug

slender iron
#

that shouldn't happen any more

ionic elk
#

will it blink blue at all?

slender iron
#

no

#

(I plan on using it for BLE though)

tulip sleet
#

there is a 1.5sec delay before writing boot_out.txt if it will change, to make sure the filesystem power is stable. So you usually see it blue for 1.5 secs (in the old RGB scheme) when the version number changes due to new commits, etc.

ionic elk
#

and no more colored flashes for exception type, at all

slender iron
#

correct

ionic elk
#

Ok, other weirdness. When waking from true deep sleep, it plays the safe mode triple blink

slender iron
#

my logic looks ok

ionic elk
#

no

#

well, actually, this only happens in true deep sleep so it's a little hard to check. But it's clearly waking up properly on my timealarms so it can't be safe mode proper

slender iron
#

what port?

ionic elk
#

I'm checking out the logic now. Also have question (will post on github) about removing the board_init when waking from fake sleep, don't we want that to align with deep sleep for stuff like display init? or does it actually cause problems?

ionic elk
#

feather f405

#

I can check on another, it's just what I had plugged in

slender iron
#

board_init is done after the loop still I think

#

is it doing the three yellow blinks once after deep sleep resumes?

ionic elk
#

Ah, I see, I didn't read the logic all the way through, you really moved things around

slender iron
#

that's not the steady state. it does that on start up for when you can press reset to stay in safe mode

#

(we shouldn't do it after a deep sleep wake up though)

ionic elk
#

Oh, yeah, that's it. Yes, probably turn it off for deep sleep wakes

manic glacierBOT
slender iron
#

actually it should skip it

ionic elk
#

wait, so is the triple yellow only for signifying when you can trigger safe mode? Or does one also happen when you hit it by accident?

slender iron
#

line 61 of safe_mode.c

ionic elk
#

like a hard crash

slender iron
#

it should blink yellow every 5 seconds when in safe mode

ionic elk
#

and it does two sort of shorter yellow blinks when it starts into safe mode, right?

#

I see no periodic 5s blinks though

slender iron
#

if your code is running, then it won't blink

ionic elk
#

no code, just sitting in safe mode.

#

I see a triple blink, hit reset, see two slower blinks, then it stays off.

slender iron
#

hrm

ionic elk
#

It's also a little confusing to have the "entered safe mode" sequence be the same color as the "hit now to trigger safe mode" sequence

#

the only difference is how fast the LEDs blink

slender iron
#

I like the consistency

ionic elk
#

if you think it's fine, it's fine.

manic glacierBOT
tulip sleet
#

@slender iron I am working backwards. I toggled a pin on in main(), and it never got there in the bad case (my LED lights when it does work). Now instrumenting stage2.c.jinja, but there's not much room in there. I didn't get the pin high yet, working on that (calling the gpio functions takes too much room).

ionic elk
#

@slender iron Ok, repl fix looks good, thanks! If you can fix the deep sleep safe mode blink skip, and the safe mode 5s issue, it looks good to me. I really like how it simplifies all the microcontroller pin files.

#

Also, CI is cancelling all my builds of the alarm API changes

slender iron
#

ya, I saw that too

tulip sleet
#

github is in rough shape

ionic elk
#

like, in general? or just today

#

I mean the only reason it's testing at all is I just pushed a fast forward merge with main so we can probably just merge it, the last build was fine and there aren't any changes since then.

tulip sleet
slender iron
ionic elk
#

still says it's cancelling my checks but maybe it isn't actually? I might just push a whitespace change

tulip sleet
slender iron
#

think it's ok to not have a REPL led state?

ionic elk
#

as in, not have it turn on at all when the repl is on?

slender iron
#

right

#

I just switched the code so board_init is only done when we need it

#

and leave it up to user code otherwise

ionic elk
#

Yeah, having the LED be up to user code as much as possible makes sense.

slender iron
#

this change makes the user responsible for any power enable pins too

ionic elk
#

If we were to keep it, I would at least change the color - white is what happens to the Neopixels when they glitch out a lot of the time so I try not to use it in my sketches

slender iron
#

I think I'll remove it

ionic elk
#

@slender iron I think that's reasonable, just my vote but yeah

slender iron
#

(that's true about white too)

ionic elk
#

It should get turned off though, right?

slender iron
#

hrm, I need to rethink this

#

board_init does display as well

ionic elk
#

I was going to suggest that repl be purple or something, is what I meant

slender iron
#

πŸ‘

manic glacierBOT
#

Firmware

Adafruit CircuitPython 6.2.0 on 2021-04-05; FeatherS2 PreRelease with ESP32S2

Code/REPL & Behavior

CPython allows combining comma and float string format specifiers:

Python 2.7.17
>>> x = 1234567.55
>>> print("{:9,.1f}".format(x))
1,234,567.6

CircuitPython ignores the comma with a float (ignore the precision issue)

Adafruit CircuitPython 6.2.0 on 2021-04-05; FeatherS2 PreRelease with ESP32S2
>>> x = 1234567.55
>>...
#

@foamyguy, thanks for the correction about using bitmap_label.


I modified the code to run on the PyPortal and am unable to replicate the issue.

As @kevinjwalters suggests, is it possibly an SPI writing issue? Looking at the image, it looks like text is being written in the locations where text is never requested (for example to the right of "Slider" or left of "SENSOR1").

->>>> If the SPI speed is adjustable, can someone with the FunHouse hardware try the exampl...

#

I am not sure I understand your comment correctly.
Let me try to explain my idea.

  • common_hal_busio_uart_never_reset() reserves the HW module (SERCOM) and correspending pins in order to avoid reseting of them it later on for some reason.
  • common_hal_busio_uart_never_reset() is called, for instance, from serial_early_init() during initialization phase. The allocated UART object debug_uart is passed as argument value to common_hal_busio_uart_never_reset();

supervisor/sha...

simple pulsar
tulip sleet
#

@slender iron I am trying to turn a pin on in _stage2_boot. Identical code works fine in main() and DOES turn on the pin. It is pruned down to the minimal register settings. Is there any reason you know of why using a GPIO pin would fail in _stage2_boot?

When _stage2_boot finishes, does it exit to the reset handler or jump directly to CPy?

#

i have spent like an hour on this -- frustrating.

#

worked fine in main()

#
#include "src/rp2_common/hardware_gpio/include/hardware/gpio.h"
#include "src/rp2040/hardware_structs/include/hardware/structs/iobank0.h"
#define PIN (29)
#define PIN_MASK (1ul << PIN)
#define A0_ON \
    iobank0_hw->io[PIN].ctrl = GPIO_FUNC_SIO << IO_BANK0_GPIO0_CTRL_FUNCSEL_LSB; \
    sio_hw->gpio_oe_set = PIN_MASK; \
    sio_hw->gpio_set = PIN_MASK; \
    while(true);


// This must be the first defined function so that it is placed at the start of
// memory where the bootloader jumps to!
void __attribute__((section(".entry._stage2_boot"), used)) _stage2_boot(void) {
    A0_ON;
    uint32_t lr;
    asm ("MOV %0, LR\n" : "=r" (lr) );
#

it only fits because the while(true) causes the rest of the function to be dead code (which is fine for my purposes right now)

slender iron
#

@tulip sleet reset jumps to cpy's reset handler

tulip sleet
#

so maybe the stage 1 bootloader is frotzing with something that is breaking GPIO for me

slender iron
#

if it's not twiddling from stage2 it may not be executing it at all

tulip sleet
#

does stage2 get skipped??

#

sometimes?

slender iron
#

never

#

but the bootrom will keep trying to read it for a while before giving up

tulip sleet
#

but if I put A0_ON in main(), the LED lights, that's the weird thing. hmm, i think i got it maybe: the UF2 bootloader loads the UF2, and goes directly there, the first time?

#

so that's why it's not entering stage 2?

slender iron
#

maybeeeeeee

tulip sleet
#

and why things work the first time the UF2 is loaded?

slender iron
#

the first load also means everything has longer to start up

tulip sleet
#

but stage2 never gets successfully loaded from flash

slender iron
#

it should

#

stage2 is used after every flash erase or write access

tulip sleet
#

current behavior is that CPy starts after UF2 is loaded. A subsequent power cycle doesn't work. Occasionally pressing reset multiple times makes it come up

#

so if I do a microcontroller.reset() from CPy it may not come up

#

hmm

slender iron
#

weird

tulip sleet
#

i'm just guessing that

#

il'l load a uf2 and try that

slender iron
#

the flash does need an exit command I thinkkkkk

#

you can drive a pin from the IOBANK directly

tulip sleet
#

without needing to use SIO?

slender iron
#

ya, OUTOVER and OEOVER

tulip sleet
#

I can try that too

slender iron
#

I doubt it'll help but it might

tulip sleet
#

lemme just try the reset first

slender iron
#

(section 2.19.6 in my copy of the datasheet)

tulip sleet
#

microcontroller.reset() and storage.erase_filesystem() both come back to the REPL

#

so this is just a first-power-on problem

#

i am surprised by that

slender iron
#

if you wait a while when it fails do you get to the bootloader?

tulip sleet
#

like how long?

slender iron
#

10 seconds?

tulip sleet
#

i'll see; i don't think so

slender iron
#

I think that's what it does if all the loads fail

tulip sleet
#

no, it's just sitting

slender iron
#

hrm

tulip sleet
#

I"ll try the OUTOVER and OEOVER, but I think you're right, it's not actually getting to _stage2_boot

slender iron
#

the ds says its only 5 ms to full capability

#

I think it should go to the bootloader if stage2 isn't loaded right though

#

lunchtime for me

storm minnow
#

πŸ₯ͺ

tulip sleet
#

of course I'll let you know if I find out anything else

#

@slender iron This works in main, and again is not lighting up in _stage_2_boot:

#define A0_ON \
    iobank0_hw->io[29].ctrl = \
        (IO_BANK0_GPIO29_CTRL_OEOVER_VALUE_ENABLE << IO_BANK0_GPIO29_CTRL_OEOVER_LSB) | \
        (IO_BANK0_GPIO29_CTRL_OUTOVER_VALUE_HIGH << IO_BANK0_GPIO29_CTRL_OUTOVER_LSB); \
    while(true);
idle owl
#

OEOVER makes me think French.

tulip sleet
#

"OEOVER the sea to Skye"

ionic elk
#

I can't get my pico to work after programming it with a jlink without having to physically remove the power cable and plug it back in - I have to restart Jlink and GDB every time, so it's kind of a pain when debugging. Does that happen to anyone else? Is there a way around it?

#

I assume it's because Jlink restarts it into the bootloader, but it gets stuck there for some reason

manic glacierBOT
#

Adafruit (Kattni Rembor, Tony DiCola) wrote and provided the Adafruit_CircuitPython_74HC595 driver library that can be used to add more digital outputs to a CircuitPython compatible board using the 74HC595 8-bit serial-in parallel-out (SIPO) shift register IC.

I have been working on a complementary project to add more digital inputs using the 74HC165 8-bit parallel-in serial-out (PISO) shift register IC. I copied and reversed/modified the original adafruit_74hc595.py library into a 74h...

slender iron
tulip sleet
#

i will have to do some tiny wire on the RP2040 pins; the flash pins are barely accessible. Maybe I can try 4 sewing needles.

slender iron
#

ya, I know its a pain. it'll be worth it though

#

I tend to do small wire to a pin

tulip sleet
#

I will try disabling stage2 completely (like put a while(true) at the beginning and see if I go to CPy and do a reset without ever hitting it

slender iron
#

πŸ‘

tulip sleet
#

maybe you should order a few fresh qt py's to see if you can get a flaky one

#

Limor was going to try a few as well; maybe she can pre-select one for you

slender iron
#

sure, or you can send me one

tulip sleet
#

i only have the one

slender iron
#

kk

tulip sleet
#

@slender iron you are the most knowledgeable person to work on this, so i can send it if I get stuck

slender iron
#

getting clk, cs and mosi would be a good start

#

those three will show you the commands being sent

tulip sleet
#

i sent a clock and mosi trace last night, it did not include cs, but there is nothing else on the bus

slender iron
#

@tulip sleet I have a fix for clicking reset into safe mode on the rp2040

#

cs is good for ensuring the decoder starts at the right place

tulip sleet
#

i will get that started

slender iron
#

the memory that stores the value for safe mode now gets reset by the button

#

so I moved it

idle owl
#

Huh. Fair enough.

slender iron
#

extern uint32_t __scratch_x_start__;
void port_set_saved_word(uint32_t value) {
    __scratch_x_start__ = value;
}

uint32_t port_get_saved_word(void) {
    return __scratch_x_start__;
}
#

in supervisor/port.c

#

in ports/rp2040

idle owl
#

nice

slender iron
#

so you were right πŸ™‚ it was completely broken

idle owl
#

I knew that one wasn't a me-problem. πŸ˜„

tulip sleet
#

is there ram that is not reset by the reset button?

slender iron
#

yup

#

scratch x isn't and we don't use it

tulip sleet
#

hmm how big is it?

slender iron
#

4k

#

scratch y is 4k too

idle owl
#

That's massive. Relatively speaking.

tulip sleet
#

and maybe it lasts through deep sleep, hmm

#

@slender iron no, if I disable stage2 completely, it does not start CPy after loading the UF2. But perhaps the ROM bootloader leaves things in a strange state when entering stage2

slender iron
#

ya, perhaps. I don't think stage2 resets everything

tulip sleet
#

i am trying to turn on the LED as the very first thing, and then I infinite-loop, so there's nothing else that is happening

slender iron
#

and does the led turn on?

tulip sleet
#

no

#

that's the very confusing thing, either with SIO or OEOVER

slender iron
#

is it an external led?

tulip sleet
#

yes, and I also checked the voltage on the pin

slender iron
#

can you verify the pin number is right from cp?

tulip sleet
#

the identical code works in main() to turn on the LED, GPIO29, A0. I set to to never reset and removed it from pins.c

#

I literally copy/pasted the code

slender iron
#

hrm

tulip sleet
#

exactly πŸ™‚

slender iron
#

try another pin?

tulip sleet
#

sure

slender iron
#

you know it's in stage2 because it hits your while loop right?

#

want to screenshare and walk me through it?

tulip sleet
#

sure, hold on

manic glacierBOT
#

Couple things I have discovered:

  1. Changed the SPI baud rate ranging from 30Mhz to 60Mhz - no effect

  2. I can see the vertical lines draw on the screen while the background is filling in (used 0x0F0F00 as a BG color). The glitch always seems to be a black line with bright white pixels in a few locations. As the display is rotated 270 by default this is really is a horizontal line on the physical display.

  3. Labels drawn after the background overwrite the "glitch".

Given this it s...

manic glacierBOT
idle owl
#

@slender iron Is there an open-source alternative to a j-link? I searched the chat and can't find a mention of something specific, but I feel like you're aware of something.

slender iron
#

openocd

#

that's the software

idle owl
#

What's the hardware to go with it?

#

Nm, found the documentation.

slender iron
#

black magic probe is one. any stlink would work too

#

you can use rp2040's "picoprobe"

idle owl
#

Ok

manic glacierBOT
#

I replicated the issue on an ESP32-S2 Saola with a generic ILI9341 display (320x240) running either CircuitPython v6.2 or 6.1.

I disconnected from my PC and ran with directly from a power adapter and same display glitch was observed.

Note: It takes a while for it to get severe, so you may need to wait several minutes for it to show up distinctly. While running, I observed that some of the redraws of the text are only partially refreshed, but then were overdrawn correctly when the next ...

hoary moat
manic glacierBOT
#

Firmware

Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather STM32F405 Express with STM32F405RG

Code/REPL

arr = [1, 2, 3]
print(arr)  # [1, 2, 3]
print(arr[1:])  # [2, 3]
print(f"asdf{arr}")  # asdf[1, 2, 3]
print(f"asdf{arr[1:]}")  # should be asdf[2, 3]

Behavior

Traceback (most recent call last):
  File "", line 1
SyntaxError: invalid syntax
manic glacierBOT
#

I'm using an M1 Mac for compiling, following the Markdown pages. I was successful in compiling the "/ports/atmel-samd" ports, specifically the "circuitplayground_express".

However, when I attempt to compile to any board within "/ports/nrf" I encounter an implicit declaration compiling error with ulab.

../../extmod/ulab/code/ndarray.c: In function 'ndarray_object_is_array_like':
../../extmod/ulab/code/ndarray.c:364:8: error: implicit declaration of function 'mp_obj_is_type'; did y...
manic glacierBOT
lone sandalBOT
manic glacierBOT
small blade
#

anyone can send me codes for game development

stuck elbow
small blade
#

but this is a part with a game i need codes for game development with coding

stuck elbow
#

all the source code is available there

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Update: I tried slowing the SPI bus down even further and noticed the rate of corruption lowered. At 5Mhz after running all night there are no problems on the screen.

The display seems to draw at the same speed as when the bus was set at 60Mhz but I haven't done any timings. At the moment I'm at a dead-end as to why this would fix the problem but it would be a potential short-term fix if required.

The line I changed to 5000000 is: https://github.com/adafruit/circuitpython/blob/8c0f3...

jaunty juniper
crimson ferry
#

I can't come up with a search that pulls them all, but I think it was only done for a short span of time... PyPortals, PyBadges, PyGamer

tulip sleet
#

@jaunty juniper I now have access to an M1 Mac to test on. Your code looks like it's fine -- it's something wonky with mu and maybe not importing the proper version of the library, even though I updated it in Mu's venv.

jaunty juniper
#

my work here is done then πŸ˜‰ flies away

tulip sleet
#

i hope so -- thanks very much!

manic glacierBOT
jaunty juniper
#

it's kind of weird to add STEMMA_I2C to a sparkfun board 😬

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I pushed a change, though there was git strangeness. I had to push twice.

Note also that we are using automated C code formatting now, and it indents the #ifs. You can set this up for yourself by doing:

$ sudo add-apt-repository ppa:pybricks/ppa
$ sudo apt-get update
$ sudo apt install uncrustify
$ pip3 install pre-commit
$ cd <your repo clone>
$ pre-commit install   # only need to do this once

From this point on, it will run some checks before each commit, reformattin...

manic glacierBOT
slender iron
#

any objections to me deleting the master branch on github? we've been on main for a while

tidal kiln
#

none. only reason would be to retain any work there i guess. but that's all been safely moved, right?

slender iron
#

ya, main should contain everything it has

idle owl
slender iron
#

(and much more at this point)

idle owl
#

"Why are there only 6 boards in here?! oh right, master."

slender iron
#

πŸ™‚

idle owl
#

That's my plan with the libs. Delete it.

tidal kiln
#

yah, things that might still be referencing it could break, but they should. and when they do, can update.

idle owl
#

I'd rather it error and force folks to move to main than to deal with the nonsense of folks submitting to the wrong branch.

tidal kiln
#

^^ yah

latent sapphire
#

Are the issues really that fundamental? They seem to accept in that thread that some amount of development work could provide a solution. Unfortunately, it isn't clear what that work entails.

#

@twilit kiln was selected as a GSoC student under BeagleBoard.org mentorship this year and is looking to tackle this problem under the scope of his project.

tulip sleet
#

We have talked about it with some zephyr people in addition, in live conversations. It's a big job and this was a stumbling block. We thought perhaps we could use the zephyr BLE stacks, etc., but it was faster to use, say nRF SoftDevice instead to get what we wanted at the time.

#

If @twilit kiln is interested in working on it, that's great -- I was just warning it was not a casual project at all. @slender iron would you have some comments here too, like getting in touch with the right zephyr people?

#

@slender iron has talked to the zephyr folks personally; I have not.

storm minnow
#

Out of curiosity and not knowing what's going on, what was the move from master to main about?

slender iron
#

I know the zephyr folks have been working on a pinctrl api. I'm not sure what the current state is.

slender iron
#

mhelm would be the best person to ask probably. they did the micropython port

#

circuitpython is more tightly coupled to tinyusb than micropython is

#

though the spresense port doesn't use tinyusb

storm minnow
twilit kiln
slender iron
#

there isn't a simple answer

#

a good place to start would probably be a video chat between @latent sapphire @twilit kiln and myself. I can ask mhelm for tips too

twilit kiln
#

That would be great.

tulip sleet
twilit kiln
#

Thank you @tulip sleet will surely have a look.

tulip sleet
#

Much of what you may need to deal with are build system issues, not necessarily simple porting issues.

slender iron
#

@idle owl do you know if our neopixel examples and guides talk about NEOPIXEL_POWER?

#

for the boards that require power enabled to the neopixel

idle owl
#

No maybe not.

manic glacierBOT
hoary moat
#

@tulip sleet I'm co-mentoring @twilit kiln for Beagle GSOC. I've also got friends/co-workers in Zephyr space. Hopefully we can come to some path forward.

slender iron
#

@hoary moat great! want to facilitate a video chat?

idle owl
slender iron
hoary moat
#

@slender iron I can certainly help faciliate... networking is my strongest skill πŸ™‚

idle owl
#

Because I thought Itsy RP2040 needed it, and the default code works.

#

Hmm.

slender iron
#

yup, I'm turning that off πŸ™‚

idle owl
#

Oi. Ok.

slender iron
#

I mean. I don't have to

#

but the intention of doing that design is to save power

idle owl
#

It is what it is. But it will end up being a pain for me.

slender iron
#

so turning it on and leaving it isn't very power efficient

tulip sleet
#

@twilit kiln there is a MicroPython port to Zephyr, which can serve as an example for some things. I don't know how complete it is. The ESP32-S2 and Spresense (cxd56) ports in CircuitPython would also be interesting because they're on top of an RTOS, unlike the other ports which are bare metal.

still zephyr
#

@slender iron are you around. Topic DPS310 Memory reduction improvement. just I think it would be effective if I explain here and we can go back and forth πŸ™‚ if you have some time

slender iron
#

yup!

still zephyr
#

ok

#

πŸ™‚

slender iron
#

good idea πŸ™‚

still zephyr
#

so, if you use only the code in the _init__ that could load the sensor for thee QTPy

#

is the same

slender iron
#

ok nice!

still zephyr
#

however, as we discussed we do not want separate libraries, so I need to packaged with another file that contains all the features (rate, mode, etc)

#

but when I do that, it does not work in .py version

#

so basically I have the init with the basic configuration + another file

#

but it does not load when I have it like that, do not understand why t gives memory error If I am not loading the second file in the import

slender iron
#

what is the import you are using?

manic glacierBOT
still zephyr
#

I use from adafruit_dps310 import DPS310

slender iron
#

maybe the basic version needs to be in a basic.py file

still zephyr
#

meaning I am using the class from the new init file

#

good point

#

so we do two files as always?

slender iron
#

from adafruit_dps310.basic import DPS310 maybe?

still zephyr
#

good will do

#

πŸ™‚ thanks

#

I will try

slender iron
#

and then __init__.py would be empty

#

cool cool. thanks!

still zephyr
#

I am 90% confident that way it will work

#

thank you

slender iron
#

πŸ‘

#

@idle owl we could modify the neopixel library to handle NEOPIXEL_POWER

manic glacierBOT
jaunty juniper
#

@slender iron I believe the MagTag wants NEOPIXEL_POWER brought down to enable power (while everyone else wants it up)

slender iron
#

ahhhhh

#

I thought I might need an INVERT

manic glacierBOT
idle owl
candid sun
#

so i'm trying to get circuipython running on the new arduino nano rp2040 and have a question about flash. it's using the AT25SF128A which is listed here: https://github.com/adafruit/nvm.toml/blob/main/flash/adesto-tech/AT25SF128A.toml - but when i try to insert it into mpconfigboard.mk it doesn't build. i get GEN stage2.c.jinja {'sku': ['AT25SF128A']}...shared_value = nvms[0].get(key, default) IndexError: list index out of range

GitHub

This is a human and machine readable "database" of config for non-volatile memory chips - adafruit/nvm.toml

#

i tried to see if there was like an array of flash for the rp2040 chips and maybe that one just wasn't there since it looks like it was added for an imx board, which was building for me, but couldn't find anything. this is also my first time doing this so apologies if i'm missing something obvious

manic glacierBOT
idle owl
#

@still zephyr You around?

blissful pollen
still zephyr
idle owl
#

That doesn't even get to it using libraries that CircuitPython can't use.

still zephyr
#

I see, no problem

idle owl
#

I feel like turning it into an example might be an ok idea, specifying it for Raspberry Pi.

still zephyr
#

ok I will propose that, and verify the code also

idle owl
#

Otherwise, like kmatch said, we have to translate it all to CP-compatible stuff.

still zephyr
#

I agree wwe have other libraries with examples for Raspberry pi, so I think this is the better way

idle owl
#

Alright. I haven't heard from the original author since ages ago, so I think you would need to switch it to an example to get it added to the repo.

still zephyr
#

No problem I will comment and do that

idle owl
#

Thank you!

still zephyr
#

You are welcome πŸ™‚

candid sun
blissful pollen
#

/data/nvm.toml/

#

it's a submodule imported into the project

candid sun
blissful pollen
candid sun
blissful pollen
tulip sleet
candid sun
#

that worked!

tulip sleet
#

I don't know why it's slightly out of date, but a PR to bring it up to date would be great.

#

You don't need to do more than you did. When you commit that change in circuitpython, it will pin that commit as the submodule's chosen commit.

candid sun
manic glacierBOT
slender iron
#

thanks for adding support @candid sun !

candid sun
manic glacierBOT
manic glacierBOT
slender iron
#

any suggestions for the name of NEOPIXEL_POWER when inverted? maybe NEOPIXEL_POWER_INVERTED

idle owl
#

That's about as clear as you're going to get with it. Though without context, that wouldn't mean much to me. Why is it inverted? (I mean, I know now, but I'm saying in general... if we hadn't talked about the pull downs, even I would have been confused.;)

#

But I guess we can teach folks what it means.

idle owl
blissful pollen
#

not sure if it would be more clear but NEOPIXEL_POWER_OFF ?

idle owl
#

I don't think it's about on and off, I thought it was with relation to the pull direction... Maybe I'm still confused.

slender iron
#

its a matter of what setting turns the power on

#

there is probably a pull to set it when we don't drive it

crimson ferry
#

this is for consistent naming of the pin, like LED, so people can use it programmatically across boards?

manic glacierBOT
manic glacierBOT
manic glacierBOT
tulip sleet
#

NEOPIXEL_POWER_ON_WHEN_LOW

hollow token
#

NEOPIXEL_POWER_LOW
NEOPIXEL_POWER_HIGH = NEOPIXEL_POWER

crimson ferry
#

NEOPIXEL_POWER_ACTIVE_LOW

manic glacierBOT
#

On 6.2.0 on a Feather nRF52840 Express using the singleton from board.I2C():

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
True
>>> ["{:2x}".format(x) for x in i2c.scan()]
[' 8', '23', '76']
>>> ["{:02x}".format(x) for x in i2c.scan()]
['23', '76']
>>> ["{:02x}".format(x) for x in i2c.scan()]
['23', '76']
>>>  ...
manic glacierBOT
solar whale
#

@gilded cradle I went through the guide to install Blinka on a Raspberry Pi Pico and ran into a few issues. I had some files already on the system and when I went to copy everything over, I started getting "management Errors" in Thonny. I think it was running out of space. The aadafruit_blinka src folder is over 1 Mbyte itself! I finally got it to work by deleting everything and reinstalling. The bme280 example runs fine. But if I try to copy more files to the Pico I get the "management error" again. SO just to test, I went into the adafruit_blinka/board folder and remved everything except the raspberrypi folder and the pioc_u2if.py file -- It still works!!

#

If I try to look at the file system with uos.statvfs("/") I still get odd results `(4096, 4096, 352, -53, -53, -0, 0, 0, 0, 255) but it is better that with all the the files loaded ( the -53 was -139) I'm confused as to what teh negative numbers mean for free space....

#

I just wanted to give you a heads up. I'll put this in an issue and keep poking around at it.

#

@tulip sleet do you know what it means to get negative values in response to statvs? when testing with micropython on a Pico I get uos.statvfs("/") (4096, 4096, 352, -53, -53, -0, 0, 0, 0, 255) Does that make any sense to you?

tulip sleet
solar whale
#

That was my thought -- thanks for confirming.

#

There are a lot of files copied to the system > 200

tulip sleet
#

I think micropython on the pico might be using littlefs, not FAT, because it does not expose a drive.

solar whale
#

ah -- good point -- Do you know how large the file system should be?

tulip sleet
#

you could file an issue on micropython

solar whale
#

I'll do a bit more testing then I will -- thanks

still zephyr
#

We were doing the same @solar whale πŸ™‚ I found another issue, using another sensor.

#

@gilded cradle for your info:

#
Traceback (most recent call last):
  File "<stdin>", line 10, in <module>
  File "/lib/adafruit_adt7410.py", line 94, in __init__
  File "/lib/adafruit_adt7410.py", line 130, in _read_register
  File "/lib/adafruit_bus_device/i2c_device.py", line 125, in write_then_readinto
  File "/lib/busio.py", line 147, in writeto_then_readfrom
  File "/lib/adafruit_blinka/microcontroller/rp2040/i2c.py", line 55, in writeto_then_readfrom
AttributeError: 'I2C' object has no attribute 'writeto_then_readfrom'
tulip sleet
solar whale
#

@still zephyr did you get the "management Errors" in Thonny?

still zephyr
#

yes I did, I did the same as you, erase some boards

solar whale
#

OK -- good to know.

#

@tulip sleet ok -- but likely 1-2 Mbytes so running out of space makes sense with all the Blinka files.

#

@still zephyr I found that when that error occurred, the files being copied were truncated.

still zephyr
#

ohh ok I will try again starting from scratch tonight and post my results again, thanks @solar whale

solar whale
#

I'll try and ADT7410 if I can find it πŸ˜‰

still zephyr
#

I could try another, but that is obviously the first in my box πŸ™‚

solar whale
#

found it! will test in a few minutes

still zephyr
#

Cool Thanks πŸ™‚

solar whale
#

@still zephyr Same error here

still zephyr
solar whale
still zephyr
#

Thanks @solar whale

solar whale
#

Ooh -- I was alos able to remove all byt rp2040 and pico_u2if from the microcontroller folder -- lots of files

manic glacierBOT
manic glacierBOT
idle owl
#

@slender iron What build of CircuitPython do I need to test with to verify the NeoPixel PR?

manic glacierBOT
idle owl
#

I have an Itsy RP2040 and a MagTag

slender iron
idle owl
#

Thanks

slender iron
idle owl
#

@slender iron Tested, merged and released. Do you want me to approve the CP PR as well? Or does that need more testing?

slender iron
#

I just pushed a new version so it may need one final test

idle owl
#

@slender iron Purple, then three yellow flashes on MagTag. I can't get into safe mode though if I'm supposed to be able to.

#

Is it supposed to do anything beyond that?

#

Blink-wise

slender iron
#

press boot instead of reset in the safe mode window

idle owl
#

Ah keen. Ok.

slender iron
#

LED sounds correct

idle owl
#

Now it's blinking yellow every so many whatever.

slender iron
#

the ESP32-S2 "reset" actually turns power off

idle owl
#

I'll approve the PR then.

#

Ah fair enough.

slender iron
#

kk, the serial should say its in safe mode then

#

thanks for testing!

idle owl
#
Running in safe mode! Not running saved code.

You are in safe mode because:
You requested starting safe mode by pressing boot button at start up.```
manic glacierBOT
slender iron
#

πŸ‘

jaunty juniper
idle owl
#

It shows yellow, but I can't get it into safe mode. @slender iron I tried reset and boot each. Is there some trick for the Itsy RP2040 to get into safe mode?

idle owl
#

QT Py RP, same thing. LED blinks yellow as it should, but I can't get into safe mode.

#

Is that still in another PR?

jaunty juniper
#

oh there's another PR fixing safe mode on 2040 that was just merged I believe

slender iron
#

@idle owl the build I pointed you to may not have the fix

idle owl
#

OK!

slender iron
#

the PR has a pending CI build that should

idle owl
#

Then yes, @jaunty juniper we can close that issue.

slender iron
#

(I fixed it separately)

idle owl
#

I realised that after I asked again.

slender iron
#

np πŸ™‚

manic glacierBOT
still zephyr
#

Is GitHub having problems again today?

ionic elk
#

when is github not having problems

tidal kiln
#

been loading ok for me

stiff pelican
still zephyr
manic glacierBOT
idle owl
#
Running in safe mode! Not running saved code.

You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.```
#

Did not request πŸ˜„

#

Ouch.

#

This example dumps into the hardfault handler every time.

#

Setting up the NeoPixel causes it.

#

on NeoKey Trinkey.

still zephyr
idle owl
#

No, setting up the NeoPixel after setting up other things causes it. Need to troubleshoot this further.

idle owl
#

Setting up the NeoPIxel after setting up the keyboard causes it.

manic glacierBOT
#

This should go into safe mode with a "too many USB devices" message, but instead if you look at usb_hid.devices after it runs, it prints a few and then hangs.

boot.py

import usb_hid

usb_hid.enable((
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    usb_hid.Device.KEYBOARD,
    )
)
manic glacierBOT
#

Firmware

Adafruit CircuitPython 6.2.0 on 2021-04-05; FeatherS2 with ESP32S2

Code/REPL

import time
import board
import displayio

time.sleep(5)  # give time to connect serial console after reset

spi = board.SPI()

display_cs = board.IO1  # board.D9
display_dc = board.IO3  # board.D10
display_reset = board.IO33  # board.D5
epd_busy = board.IO38  # board.D6

displayio.release_displays()

# 2C EPD does not hang on `display.re...
tulip sleet
#

@idle owl hi - i need to refer to something about how to get into safe mode. I think you wrote that up already, could you point me to that, and I'll link to it?

#

tnx

idle owl
#

In fact I'm almost certain that's where it was going to go.

#

And because it didn't work everywhere, I didn't continue to add it.

tulip sleet
#

thanks anyway - I was specifically looking for "do a slow double-click reset" kind of a writeup. I won't bother to write it myself now. It's in a caveat section about not locking yourself out

#

when/if we get around to this I'll link to it

manic glacierBOT
#

Looking at the core, the busy_state of the busy pin defaults to True, and the difference between 2C & 3C behavior is explained by that and the library inits:

  • SSD1675 does not specify a busy_state, so the core uses the default True
  • IL0373 specifies busy_state as False

Also (learned) EPDs can use either the busy pin or the refresh time parameter to determine when it's OK to refresh, i.e., the busy pin isn't required. And indeed, if the 3-color IL0373 is set up in CircuitP...

idle owl
hoary moat
#

I’ve got four CM4 modules now… all I need is a couple Piunora @crude blaze πŸ™‚

ionic elk
#

@tulip sleet should we have a de-init for PinAlarm pins?

#

Obviously it isn't useful for deep sleep, but in light sleep, there's no way to reclaim a pin that's been used for a PinAlarm - it retains the claim and pullup settings indefinitely.

tulip sleet
#

you're right, it's necessary

ionic elk
#

I just noticed it in my RP2040 testing. There's a common trickyness across all ports in terms of how they handle entering deep sleep, where exiting the VM resets pins they might be using for PinAlarm - ports have to decide whether to have those pins in never_reset, or whether to store what pins are used and re-initialize them before deep sleeping.

#

In implementing that, I noticed that the port_reset and alarm_reset functions are actually the only way a pinalarm will ever be reset to default state.

tulip sleet
#

for deep sleep, the pins don't need to be set up until sleep happens, so I wouldn't put them in never_reset

ionic elk
#

In that case the PinAlarm module needs to store information about all pins that have been initialized, along with all pull and trigger information, so they can be re-initialized right after the VM ends

manic glacierBOT
ionic elk
#

When avoiding never_reset, you literally turn them all off and then have to turn them all back on again, but without the original alarm objects available. It's an option, but it does feel awkward to me.

tulip sleet
#

I have a similar problem in dynamic USB: I have to remember HID device objects after the VM exits. So I ended up just creating a small static table of out-of-heap objects: you can have up to 8 HID objects and that's it. It's not a lot of RAM: the objects are small

manic glacierBOT
ionic elk
#

The alternative is that you add pins to never_reset, and it doesn't reset them at the end of the VM, but you keep track of what pins are in PinAlarm and have alarm_reset take care of them with reset_pin_number before the next vm

#

This prevents needing to store pullup and trigger information, but it means light_sleep can't use reset_alarms anymore because it will delete pullup information (that's where I noticed that pinalarms can't be deinited)

#

I think the flow for the second option is a little more understandable? But I'm totally open to input here.

tulip sleet
#

in both cases, I'd say defer doing anything to the pins until just before sleep

ionic elk
#

It doesn't really matter where you do stuff to the pins

tulip sleet
#

an alternative would be to have light-sleep and deep-sleep PinAlarms

ionic elk
#

it's about storing the information about the pins

tulip sleet
#

the pinalarm objects aren't that big, so a limited supply of non-heap objects is OK, I'd say.

ionic elk
#

Right now for the RP2040 I'm using a different reset function for PinAlarm for light/deep sleep and it seems ok

#

I can swap over to storing all the pin information in big static arrays, it just grates me that we're turning all the pins off just to turn them back on. Seems like what never_reset is built to prevent.