#circuitpython-dev

1 messages ยท Page 26 of 1

brazen hatch
#

I took care of the rest.

#

Stackless works the same way it did before.

#

I am pretty much done.

#

Tough now it fails on m0 for flash size.

#

40 bytes is 40 bytes

#

An idea for saving space would be to seperate all strings into words and store and deduplicate translations.

#

So, I have reduced it's footprint to a minimum, if flash size fails again what do I do?

#

Yea no, my changes ain't saving anything

#

still need 40 bytes

brazen hatch
#

I did deduplicate the messages a bit, hope this helps.

manic glacierBOT
manic glacierBOT
tulip sleet
# brazen hatch I did deduplicate the messages a bit, hope this helps.

Maybe you did this already: look for mesages in locales/circuitpython.pot that match what you want to say. A number of these are parameterized with %q, which will substitute a QSTR. This saves space if the QSTR is already defined for other reasons, such as that it's an arg name:

mp_raise_BlahError_varg(translate("Invalid %q"), MP_QSTR_buffer);

for example, will print "Invalid buffer". "Invalid %q" is already used lots of places. MP_QSTR_buffer is really common so it's "free" (no new storage cost) to use it.

analog bridge
#

What is runtime.py in cp root? It seems to remove #include "supervisor/shared/translate/translate.h" from all the files.

tulip sleet
tulip sleet
crimson ferry
#

the merges aren't going onto S3, only the releases?

manic glacierBOT
#

Most of this file is copied from micropython's implementation (in their source tree at extmod/modlwip.c)

I notice that this one is not present in upstream micropython. We should raise an issue with them. It could clarify whether this is not needed, or whether they have a bug that would be fixed by this.

I did a quick analysis and I think this addition is probably not necessary, but it could also be that I'm fuzzy on the rules and requirements for using these ENTER/EXIT macros.

This f...

#

another set of calls to check with micropython about.

I compared this to https://github.com/raspberrypi/pico-examples/blob/master/pico_w/wifi/tcp_client/picow_tcp_client.c#L190 and I don't know WHY (i.e., failed at finding specific documentation) but it seems like neither pico-sdk nor micropython guard tcp_new .. the pico example does a bunch of calls and then guards only tcp_connect, which is very ... specific.

(I won't call out additional sites where you added the enter/exit cal...

brazen hatch
tulip sleet
analog bridge
#

I have a fix for it ready in #7594

crimson ferry
#

since 8.0.2 ...I can get them from the actions, but my first go-to is usually S3

analog bridge
#

The S3 upload is broken in main

crimson ferry
#

ok, thanks

tulip sleet
#

@analog bridge ok, I will finish reviewing and approve. ONly q I had was why the stubs changed from .zip to .tar.gz?

#

maybe people need .zip stubs?

crimson ferry
#

oh, challenge level has increased, looks like actions only have the affected board builds now (makes sense)

tulip sleet
#

do all the editors handle .tar.gz stub files?

analog bridge
tulip sleet
#

oy vey

analog bridge
#

Even earlier the .zip was just enclosing .tar.gz requiring two programs to de-compress it

tulip sleet
manic glacierBOT
tulip sleet
#

ok, will merge 7594

manic glacierBOT
analog bridge
#

You may want to move the previous builds in OS specific directories.

tulip sleet
#

@analog bridge please do write up all the changes that a PR does to summarize, so it's documented what is being added and changed

#

btw I had no idea you could do a GUI for a workflow run -- that is remarkable!

timid bolt
#

You need to call socket.close() to release the resources of the socket.

manic glacierBOT
#

I did this work hoping it would fix the mdns issue, but it ultimately did not.
My general process for making this change was to define:

#define LWIP_ASSERT_CORE_LOCKED     cyw43_thread_lock_check

This turns on LWIP's built in checking to find places where the lock is not held. Every time the assert fired, I added a lock. This happened a lot. After a while I worked out which LWIP functions are calling LWIP_ASSERT_CORE_LOCKED and just added the lock to all call sites of those fun...

slender iron
tulip sleet
analog bridge
#

running that script still removes that line in like ~218 files

slender iron
#

@lavish saffron __del__ isn't called immediately it will be called when gc.collect runs. You shouldn't rely on when it would be called. This is why CircuitPython objects usually have deinit() and socket has close()

manic glacierBOT
lavish saffron
#

Thanks for clearing that up. I'll try adding a gc.collect() before checking the socket status list. If that doesn't work, I'll gently tap my head on the desk for a while and see if any other solutions present themselves.

tulip sleet
#

@analog bridge hurrah!

#

I will now work on renaming the mpy-cross's

manic glacierBOT
crimson ferry
#

Got my first supervisor.SafeModeReason.HARD_FAULT in the wild, and the board reset into safemode.py , then boot.py, then code.py. Took a licking and kept on ticking. ๐Ÿ™‚

#

hm, last post was blocked but I can't spot anything questionable

tulip sleet
#

so are you doing a microcontroller.reset() in safemode.py?

crimson ferry
#

yes

tulip sleet
#

excellent, glad it worked for you!

tulip sleet
manic glacierBOT
crimson ferry
#

Not sure how to interpret this. Auto-reload was off, I wouldn't have expected the code to restart until after the serial disconnect due to hardfault, and the reset in safemode.py:

RuntimeError: Input / 0utput error

Code done running.

Auto-reload is off.
code.py output:

[tio 12:33:49] Disconnected
[tio 12:34:07] Connected
manic glacierBOT
#

CIRCUITPY_PYSTACK_SIZE has never been used as a string before. It's just a nameshake with the #if.
The plan was to get rid of all the compile-time settings for stacks in favor of this implementation.
However they both remained in the end.
I do not see a better name that isn't also used by #if's.
And there is no real risk of users confusing compilation settings with settings.toml variables.
Pretty much nobody will be using stackless after this pr is merged.
There will be no benefit...

brazen hatch
#

Yea no, if I use invalid %q I cannot put a \n's

tulip sleet
manic glacierBOT
brazen hatch
#

we can add about 1 big line.

#

Nothing more.

#

104 bytes.

tulip sleet
#

we will need to turn this off on some builds

brazen hatch
#

But.. It works on all builds as of now?

tulip sleet
#

yes, but I just pushed safemode.py, which will grow builds. Builds always grow, and then we need to trim them.

#

we can turn this off on Trinket M0, etc.

#

is it condtionalized so we can turn it off?

brazen hatch
#

So.. Do I make more #if's?

brazen hatch
tulip sleet
#

yup CIRCUITPY_SETTABLE_PYSTACK or whatever you want to call it

brazen hatch
#

Well I will #else the old barebones logic.

tulip sleet
#

the basic pystack logic can stay the same, but the reading of a value, etc., could be conditionalized

manic glacierBOT
#

Correct, this is just an optimization for the build to fail at compile time instead of link time, because I'm impatient waiting for builds.
A typical scenario is I'm working on some module, and I sneak in a dependency on another module by including its header file. This compiles fine, but if the other module is not in the build config I happen to be using, I will get a link error. I think it would be hard to check this in .mk files since .mk files don't know what header files C files are inc...

tulip sleet
#

is PYSTACK on on the smallest builds?

still zephyr
#

It seems to be some extra 'blank' characters in the strings to translate, is this wanted?

slender iron
#

it seems weird to me that you are passing a struct (vm_memory_t) around by value

manic glacierBOT
brazen hatch
tulip sleet
brazen hatch
#

I only supervisor allocs

still zephyr
#

gotcha (y)

tulip sleet
#

lemme look

still zephyr
#

๐Ÿ™‚ no problem

slender iron
#

@brazen hatch I'll reply in the PR

brazen hatch
#

kk

tulip sleet
# still zephyr gotcha (y)

OK, there are some strings with newlines hence the characters you are seeing. So include a newline in the string you translate, at the place indicated. They were there before, but maybe you personally just haven't encountered this yet.

#

i would hope weblate lets you include newlines

tulip sleet
manic glacierBOT
slender iron
lavish saffron
#

The Wiznet5k socket.close() implementation does not prevent future calls to e.g. socket.bind(). Is there a way to have the socket instance kill itself, or will I need to set a _closed flag and then check this before each method call?

tulip sleet
#

@timid bolt I have an i7-8700 (6 cores, 12 threads) I got from https://dellrefurbished.com (always find coupons: 35-50% off). Next significant step up for me would be a i7-12700 with lots more cores and threads, but not feeling the need yet. Other folks have much faster machines.

manic glacierBOT
tulip sleet
#

dell outlet has the 12700's; no off-lease ones in dellrefurbished

brazen hatch
#

it is amazing for openocd

timid bolt
slender iron
#

this is the first place that'd use that pattern

#

my suggestion of the pr was to move the heap allocation back to where it was

#

and only factor out the pystack allocation

lone axle
slender iron
#

I have two new libraries

#

looks

#

the latter for the 4 and 5 in

timid bolt
lone axle
#

Thank you!

timid bolt
# slender iron and only factor out the pystack allocation

Right, that makes sense. bill88t had something like that originally, but I suggested the creation of the vm_memory_t struct to reduce and contain the amount of #if needed in the code. You could still pass vm_memory_t to start_mp by reference.

slender iron
#

The heap allocation happens regardless though so I'd separate it out

brazen hatch
#

Did it now, one question, how do I send \n seperately now?

#

I can't find any related ref

slender iron
#

serial_write()?

brazen hatch
#

oh, ok, thanks

#

So something like this?

serial_write("\n");
serial_write_compressed(translate("Invalid %q", "CIRCUITPY_PYSTACK_SIZE"));
serial_write("\n\n");
slender iron
#

Almost, you'll want MP_QSTR_CIRCUITPY___PYSTACK___SIZE I think

#

to make it a qstr

#

(instead of the string)

brazen hatch
#

Oh I do not know qstr's. Imma copypasta and worry later.

slender iron
#

they are weird

onyx hinge
#

serial_write_compressed won't be aware of %-formatting.

slender iron
#

ah true too

#

mp_printf would work

brazen hatch
#

alrighty let's see if it works.

jaunty juniper
#

QSTRs also need a make clean

brazen hatch
#

I always cleanmake

#

I have had enough nightmares with dirty builds.

slender iron
#

(qstr is usually the only time I need a make clean)

brazen hatch
#

I rather wait.

tulip sleet
#

i am moving the mpy-cross executables around; i forget what platform we build linux-aarch64 for.

#

is it 64-bit raspbian or something else?

slender iron
#

ya, probably raspberry pi

tulip sleet
#

there are plain raspbian builds; i assume they are 32 bit

slender iron
#

thats what the broadcom port is for

brazen hatch
#

here here

tulip sleet
#

OH

slender iron
#

broadcom port is 64 bit iirc

brazen hatch
#

Linux Pi400 5.15.84-v8+ #1613 SMP PREEMPT Thu Jan 5 12:03:08 GMT 2023 aarch64 GNU/Linux

tulip sleet
#

got it

#

well, glad we build it for you

brazen hatch
#

Though android should also report the same under termux and stuff

#

And mayhaps m1-2 macbooks under asahi

brazen hatch
#

I can confirm this as I have used em.

tulip sleet
#

i am moving things around with the S3 web gui. aws-cli is so terrible for this the gui is actually easier, and it's pretty clunky

brazen hatch
#

Ahh I can feel my module breaking

#

I had like a month ago made a module specifically for automatically downloading mpy-cross'es

#

based on board version

#

it constructed the url

#

Do not mind I will fix it.

tulip sleet
#

I am duplicating the 7.3.0 and 8.0.0 ones there because we depend on them for library building. Then I will fix that and then get rid of the top level ones

tulip sleet
jaunty juniper
#

I wonder if it would be possible to archive the en_US PR builds on a small selection of boards, like the pico for RP2040 boards, before cleaning up S3, for bisecting purposes ?

brazen hatch
#

You can always remake them locally, it takes 20s.

tulip sleet
#

and I leave all the releases there (beta.n, etc.)

jaunty juniper
#

yeah that has not been enough in a few cases in the past

tulip sleet
#

once you narrow it down, we can do regular git bisects

brazen hatch
#

gcc didn't like qstr

tulip sleet
#

i deleted them because the list is very long and it obsucres the older builds

brazen hatch
#

Or I shouldn't tr it?

tulip sleet
#

in addition to being hundreds of thousands of files

onyx hinge
tulip sleet
#

oh bleah, ok

onyx hinge
#

@brazen hatch the usage is not right. Here's an example that's closer to what you need: py/builtinhelp.c: mp_cprintf(MP_PYTHON_PRINTER, translate(" is of type %q\n"), type->name); but instead of type->name you'd have your MP_QSTR_... identifier.

#

mp_cprintf takes a compressed string (result type of translate()) . but printers take a first argument specifying the KIND of printer, MP_PYTHON_PRINTER or &mp_plat_print typically. And translate takes 1 arg, not 2

brazen hatch
#

These functions are so complicated omg. Thanks so much for explaining!

still zephyr
tulip sleet
onyx hinge
#

yes, I think it's part of how files are installed via the embedded version of pip

tulip sleet
#

oy, maybe I need to copy them back to the top level

#

ok...

brazen hatch
#

huh WHAT

#
  1. Why did it make it 3 long? Wasn't that an escape?
  2. Why did it spam \t????
#

The current code is

serial_write("\n");
mp_cprintf(MP_PYTHON_PRINTER, translate("Invalid %q"), MP_QSTR_CIRCUITPY___PYSTACK___SIZE);
serial_write("\n\n");
#

I will change it to a single _ and try again

#

however about the \t idk

onyx hinge
#

main.c: serial_write("\r\n");

#

in there, \n is the move down character, (newline or line-feed) \r is the move to beginning of line character (carriage return)

#

mp_printf turns '\n' into '\r\n' (because stdout is in text mode) but not serial_write

brazen hatch
#

Isn't that.. windows only?

#

How come I have never run into this whilst making jcurses..

onyx hinge
#

because you are probably writing via sys.stdout

brazen hatch
#

yea, pretty much

#

Well, learned something new today.

#

Wait, does that work on it's own?

#

Can I use it to go to line character 0?

#

That would be a big optimisation as I use move for all ops right now.

onyx hinge
#

print(end='\r') works similar to on host computers

slender iron
#

@brazen hatch I was guessing at how to escape the underscore. Must not be needed

brazen hatch
#

lol, if it doesn't work imma do \_

#

Meanwhile toasty pi400

#

temp1: +48.7ยฐC
Ambient is like 10.

#

HAHAHAH IT DOESNT EVEN BOOT NOW

manic glacierBOT
brazen hatch
#

This isn't working

#

it seems to somehow nameshake with something

#

I will have to openocd it.

#

Found it.

#

Hardfault since heap and stack are not alloc'ed

#

so no mp_cprintf

slender iron
#

ah bummer

brazen hatch
#

I think that just doing one print for "Invalid CIRCUITPY_PYSTACK_SIZE" is the best way to go about it.

slender iron
#

@tulip sleet I think we should rebase our changes onto the idf whenever we update it

#

@brazen hatch works for me

#

isn't really true

#

(and I can't find my changes easily)

tulip sleet
#

for v5

slender iron
#

yup, just thinking ahead to how we update it

#

I found my pr via the folder history

tulip sleet
#

that is part of the reason why I made a new branch -- it was really hard to do diffs, etc.

#

so I made a new branch, which was more draconian than rebasing

brazen hatch
#

The pystack code is currently running on a 3-times desoldered pico.

#

Done and pushed. Now for which boards do I set CIRCUITPY_SETTABLE_PYSTACK to 0?

tulip sleet
tulip sleet
#

you don't necessarily need to do it per board

manic glacierBOT
brazen hatch
#

Unless I am forgetting something this pr removes no functionality whatsoever.

brazen hatch
#

Oh, it was broken already. It did nothing.

jaunty juniper
#

yep, I think that's all it removes

solar whale
#

On my Mac, when I do a new clone of the circuitpython repo then run make fetch-submodules, then "git diff" I see ```jerryneedell@Mac-mini circuitpython % git diff
diff --git a/ports/broadcom/firmware b/ports/broadcom/firmware
--- a/ports/broadcom/firmware
+++ b/ports/broadcom/firmware
@@ -1 +1 @@
-Subproject commit bf96d0eda5952595d717fedb797aeb168483e9fa
+Subproject commit bf96d0eda5952595d717fedb797aeb168483e9fa-dirty

#

Its not big deal since I am not using broadcom, but it results in "dirty" builds. Any idea why?

jaunty juniper
#

I believe that's the part that requires a case-sensitive filesystem ?

#

go in it and git status

solar whale
#

ah -- good catch -- I used to use one -- I'll go back to it.

#

thanks

jaunty juniper
#

on APFS there is no cost to adding a case sensitive partition, so I do my CP stuff in one (as in it doesn't reserve space for it so both partitions can grow and shrink however much they want)

solar whale
#
jerryneedell@Mac-mini firmware % git status
HEAD detached at bf96d0ed
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   modules/5.10.82+/kernel/net/netfilter/xt_DSCP.ko
    modified:   modules/5.10.82+/kernel/net/netfilter/xt_HL.ko
    modified:   modules/5.10.82+/kernel/net/netfilter/xt_RATEEST.ko
    modified:   modules/5.10.82+/kernel/net/netfilter/xt_TCPMSS.ko
    modified:   modules/5.10.82-v7+/kernel/net/netfilter/xt_DSCP.ko
    modified:   modules/5.10.82-v7+/kernel/net/netfilter/xt_HL.ko
    modified:   modules/5.10.82-v7+/kernel/net/netfilter/xt_RATEEST.ko
    modified:   modules/5.10.82-v7+/kernel/net/netfilter/xt_TCPMSS.ko
    modified:   modules/5.10.82-v7l+/kernel/net/netfilter/xt_DSCP.ko
    modified:   modules/5.10.82-v7l+/kernel/net/netfilter/xt_HL.ko
    modified:   modules/5.10.82-v7l+/kernel/net/netfilter/xt_RATEEST.ko
    modified:   modules/5.10.82-v7l+/kernel/net/netfilter/xt_TCPMSS.ko
    modified:   modules/5.10.82-v8+/kernel/net/netfilter/xt_DSCP.ko
    modified:   modules/5.10.82-v8+/kernel/net/netfilter/xt_HL.ko
    modified:   modules/5.10.82-v8+/kernel/net/netfilter/xt_RATEEST.ko
    modified:   modules/5.10.82-v8+/kernel/net/netfilter/xt_TCPMSS.ko

#

looks suspicious -- thanks

jaunty juniper
#

yeah:

xt_dscp.ko
xt_DSCP.ko
...
xt_hl.ko
xt_HL.ko
#

it's ugly is the answer ๐Ÿ˜›

solar whale
#

@jaunty juniper Yay! -- problem solved by using a case sensitive file system. No more dirty builds!

manic glacierBOT
brazen hatch
#

gcc just keeps removing the pystack argument cuz it is static WHYYY

#

tried NULL and (supervisor_allocation *)1

slender iron
#

what do you mean?

brazen hatch
#

look at ci

slender iron
#

๐Ÿ‘€

brazen hatch
#

It builds and works locally in either configuration (py)stack(less)

slender iron
#

you needed to remove the volatile but leave it null

brazen hatch
#

nop, that was the original

slender iron
#

what was the error with that?

brazen hatch
#

the same

#

exact

slender iron
#

please be specific

#

I can't easily follow the multiple CI runs

brazen hatch
#

gcc optimises start_mp(heap, pystack) to start_mp(heap)

#

the avalanche that ensues is pretty simple, not enough arguments

#

70 checks failed

#

Meanwhile locally it works.

#

So I have no idea as if I fixed it.

#

I gotta commitspam

slender iron
#

I don't think its that smart

brazen hatch
#

Well, that whole , pystack didn't delete itself.
Something did it.

#

it works on mine but not on CI.

#

I blame gcc.

slender iron
#

it could be a caching issue on the CI

brazen hatch
#

What. The actual.

#

Goodnight. Imma deal with this tomorrow.

#

I had had enough.

slender iron
#

๐Ÿ‘ thanks for working on this

brazen hatch
#

Thanks for the all the help. I couldn't have made it here on my own.

jaunty juniper
#

it says it's in run_safemode_py which is from the safe mode PR, which I don't think you rebased on ?

brazen hatch
#

No??

#

WHAT?

#

I just updated from main a few hrs ago.

#

Didn't rebase, just update.

#

was that merged?

jaunty juniper
#

like 3h ago

slender iron
#

pr runs happen with the latest merge

#

not with what you push

jaunty juniper
#

so github auto merged that ?

slender iron
#

I would expect it to complain about a conflict

jaunty juniper
#

yeah that's surprising

brazen hatch
#

did it pretend a merge on main<-settings-toml-pystack and fail on that??

#

That would make sense

#

Well that then means I just have to update my branch. Again.

brazen hatch
slender iron
#

ya, I don't think this is a cache issue. Its a hidden automerge

#

github should make that clearer

jaunty juniper
#

if I rebase locally git is very unhappy, really weird that github took it

brazen hatch
#

updated and put the good'ol snippet in safemode func.

manic glacierBOT
brazen hatch
#

Let's hope when I wake up it's a โœ…

jaunty juniper
#

๐Ÿคž

manic glacierBOT
manic glacierBOT
#

I erased the storage as requested. That was successful as I saw the label of the drive change.

When I add en empty line to code.py:

Code stopped by auto-reload. Reloading soon.

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:

.......write lba=0x45, block_count=1

Code stopped by auto-reload. Reloading soon.
write lba=0x21, block_count=1
write lba=0x2, block_count=1
write lba=0x51, block_count=1
write lba=0x21, block_coun...
manic glacierBOT
#

I am doing the same as you, on Ubunut 22.04, and I don't see any writes.

I think lba=0x21 may be directory metadata.

Are you running tracker? tracker daemon -p would say what tracker processes are running.

How long does it take before you see the lba=0x21 write?

When you say diff the file, do you mean you were doing something like diff /media/username/CIRCUITPY /dev/null?

What does mount -l |grep CIRCUITPY say?

On mine:

$ mount |grep CIRCUITPY
/dev/s...
manic glacierBOT
#
  1. I don't know what tracker is but here's what I get:
> tracker3 daemon -p
Found 1 PIDโ€ฆ
Found process ID 2441 for โ€œtracker-miner-fs-3โ€
  1. About 30-40s. Doing an actual write to the file does trigger the auto-reload immediately.
  2. diff --brief path/to/source/code.py /path/to/CIRCUITPY/code.py.
> mount -l|grep CIRCUITPY
/dev/sdc1 on /run/media/rarnaud/CIRCUITPY type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii...
#

Web workflow requires auto-connect, using CIRCUITPY_WIFI_SSID and CIRCUITPY_WIFI_PASSWORD. These also automatically cause the webworkflow to start, web server on port 80, mdns and all. If CIRCUITPY_WEB_API_PASSWORD is not set, the home page shows up and cp/version.json, but the file browser and REPL return an empty page.

Auto-connect is useful, for development in particular, by not having to wait for reconnect on auto-reload (even though the user code should probably manage disconnec...

timid bolt
#

What is auto-connect?

jaunty juniper
#

to make the web workflow accessible the board must connect to an access point using credentials in settings.toml, instead of waiting for the user code to connect

analog bridge
#

@tulip sleet The main commits aren't tagged with 8.1.0-alpha.0.

tulip sleet
#

I thought I tagged main at the point of the 8.0.x branch. hmm

#

maybe I didn't push that tag, but I thought I did it from github

analog bridge
#

Did you make that tag earlier?

analog bridge
#

I think it uses date-time for a tie-break or is it semantic versioning?

#

If a single commit has two tags.

tulip sleet
#

the commit has three tags, hold on

#

well not three, but two:

commit 5f43a63a701447595e5647621769e1ca9289ac85 (tag: 8.1.0-alpha.0, tag: 8.0.0)
Merge: 3a82730eb fab1bb5f2
Author: Mark <56205165+gamblor21@users.noreply.github.com>
Date:   Fri Feb 3 18:09:51 2023 -0600

    Merge pull request #7546 from FoamyGuy/is31fl3741_fix
    
    fix for native is31fl3741
analog bridge
#

maybe just create alpha.1 now with the latest commit

tulip sleet
#

sure; you just want a distinguishable latest tag, right?

analog bridge
#

yes, or else the main commits are listed below 8.0.x

tulip sleet
#

I could label the commit right after alpha.0 as alpha.1, would that be better? And I'll delete the alpha.0

analog bridge
#

I am not sure, the commits above it already have 8.0.0 something, if you tag 8.1.0 aplha now, that version would change

tulip sleet
#

those commits are not on the 8.0.x branch, so not sure what you mean by 8.0.0 something

#

i am not going to move any tags

jaunty juniper
#

yeah that makes git freak out

tulip sleet
#

i can make latest main be 8.1.0-alpha.2. If I want to create an alpha.1 further back, I will do that later. We are not going to release any alphas for 8.1.0 anyway, we were planning to start with betas

#

so these are just placeholder tags

#

howzat sound? we have plenty of integers ๐Ÿ™‚

analog bridge
#

seems fine to me ๐Ÿ‘

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 8\.1\.0\-alpha\.2
tulip sleet
#

i deleted 8.1.0-alpha.0 in github, but the deletion didn't seem to propagate down when i did a git pull --tags locally. So I just deleted it locally

#

8.1.0-alpha.2 is on the current tip of main

analog bridge
manic glacierBOT
#

When you run fatrace, do you see it report activity at the same time as the autoreload?

This is key and I should have paid more attention earlier.

sudo fatrace -c
md5sum(141934): RO /run/media/user/KEYBOARD-L/code.py
md5sum(141934): C /run/media/user/KEYBOARD-L/code.py

Something is running md5sum on code.py. It might not be tracker, but it is something. Also, whenever something does a read on a file on CIRCUITPY, a write is done to note the access. And why...

tulip sleet
manic glacierBOT
manic glacierBOT
#

I've recently been playing with audiomp3.MP3Decoder and audiopwmio.PWMAudioOut on the rp2040 and find these clicks at the start and end of each track really distracting!

For reference I have a number of instrumental mp3 files encoded at 8kbps / 8Khz / mono. I've attached one here.
Breathing In And Out.zip

import os
import board
import audiomp3
import audiopwmio
import random
audio = audiopw...
tulip sleet
#

@analog bridge the merge-queue-test repo was private, which caused to it use up all of the limited free quota for the circuitpython GitHub org and stall further actions. I made it public, which makes it unlimited.

brazen hatch
#

'FLASH_FIRMWARE' overflowed by 16 bytes

#

I guess a board is getting axed

tulip sleet
# brazen hatch I guess a board is getting axed

it's kicksat-sprite, which has a lot of stuff squeezed into it, and a lot of stuff removed. One thing to turn off first on that board is CIRCUITPY_RAINBOWIO, which is not needed in its use case (cubesats ๐Ÿ™‚ )

manic glacierBOT
brazen hatch
#

Also yes, the board is genuine.

brazen hatch
#

Added safemode checks for pystack alloc, it will use build default on safemode

manic glacierBOT
#

This may be a CP-specific problem. I rebuilt micropython with ulab and help("modules") enabled, and get no duplicates. but, ulab submodules aren't listed either; mp treats submodules a bit differently than cp):

jepler@rat:~/src/micropython-ulab$ ./micropython/ports/unix/build-2/micropython-2 -c 'help("modules")'
__main__          mip/__main__      ucryptolib        ure
_thread           termios           uctypes           urequests
_uasyncio         uarray            uerrno        ...
tulip sleet
manic glacierBOT
onyx hinge
#

@tulip sleet am I right that (1u << 32) - 1 is well-defined in C, as 0xffffffff if unsigned is 32-bits?

tulip sleet
onyx hinge
#

well, it's from converting the bits-per-value into a maximum value for the range checking ... this is what I suggested to foamyguy, but it's clever:

mp_uint_t value = (mp_uint_t)mp_arg_validate_int_range(mp_obj_get_int(value_obj), 0,(1u << common_hal_displayio_bitmap_get_bits_per_value(self)) - 1,MP_QSTR_value);
tulip sleet
#

or MAX_UINT32 or whatever it's called

manic glacierBOT
onyx hinge
#

I'm pretty sure it's right for everything but 32 bit depth and think it's right for bits_per_value == 32.

tulip sleet
#

I think that 1 << 32 is going to become zero

onyx hinge
#

yes I think it becomes 0u, and when you subtract 1 you get the maximum value due to unsigned wraparound

onyx hinge
#

unsigned though

#

in that code a was signed

tulip sleet
#

i think we have to look at the standard

manic glacierBOT
#

Hello team, this is a PR for implementation of analogbuio module for espressif port. I have tested the code on ESP32S2 board adafruit_feather_esp32s2. The code supports other version of ESP32 chip however it is not tested. Please note this code is compatible with ESP IDF version 4.4.x. There have been changes in ESP IDF 5.0 implementation of ADC DMA and the module will have to be updated when CircuitPython moves to ESP IDF 5.0

Test code:

import time
import board
import analogbufio...
onyx hinge
#

yeah it's undefined in C, drat it.

tulip sleet
#

do you have a link

#

iddin't find it yet

onyx hinge
#

no, just a program that printed an error using -fsanitize=undefined

tulip sleet
#

I think the standard is something you have to pay for -- I forget

onyx hinge
#
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) {
    int n = atoi(argv[1]);
    printf("1u << n = 0x%08x\n", 1u << n);
}
$ gcc intshift.c -fsanitize=undefined
$ ./a.out 31
1u << n = 0x80000000
$ ./a.out 32
intshift.c:6:37: runtime error: shift exponent 32 is too large for 32-bit type 'unsigned int'
1u << n = 0x00000001
timid bolt
#

it most languages "x << y" == "x << (y % 32)", which is why 1 << 32 == 1.

onyx hinge
#

there are legitimately distributed "draft C / C++ standard" documents that differ in unknown but probably extremely minor ways from the actual paid specs

#

it seems like a hack around ISO charging for standards that the C / C++ committees are well on board with

tulip sleet
manic glacierBOT
#

Thanks. Sadly, we're going to have to do one more iteration of this.

I was wrong when I stated that this was a correct way to get the maximum value, including for 32-bit bitmaps:

(1u << common_hal_displayio_bitmap_get_bits_per_value(self)) - 1

we'll need to define a function to return the maximum bitmap value and then call it in these cases. It'll apparently need a special case for 32-bit bitmaps.

:-/

timid bolt
manic glacierBOT
tulip sleet
#

ok, all the board PR's awaiting PID's are now draft, with task(s) to be completed. This will save me looking at them over and over.

tulip sleet
analog bridge
#

where can I find the svg of CP8 logos?

analog bridge
#

I was thinking of replacing the README artwork with latest release ones.

brazen hatch
analog bridge
brazen hatch
#

Oh alright

#

Yea github is dying, a lot are returning Connection refused.

idle owl
#

I read that as Connection confused. And it still made sense.

brazen hatch
manic glacierBOT
#

Thanks your for your suggestion! The intention of this PR is to support recording audio via ADC DMA https://github.com/adafruit/circuitpython/issues/7454

The python application would typically look as follows:
Initialize the analogbufio
Read and process samples in a loop
Dinitialize analogbufio

Loop in second step above would be required on ESP32 boards without PSRAM support where amount of RAM is limited. The ADC DMA samples would be read into same buffer again and again and would b...

#

It looks like from the example that the allowed sample size varies per processor. It would be good to validate this by checking the element size of the array that is passed in, and raising errors if they don't fit. There is already a check for this in shared-bindings/analogbufio/BufferedIn.c in ...readinto() there. Additional checks should be added here. It's a choice whether to make sure the sizes match perfectly, or allow 16 bit samples to be written to a 32-bit buffer.

slender iron
brazen hatch
#

Plot twist I can't. Prolly no perm.

slender iron
#

k, lemme look

manic glacierBOT
jaunty juniper
#

it's queued I think

slender iron
#

looks like another run is already going

brazen hatch
#

Hmm, but I didn't do anythin?

#

Someone must have pressed the rerun.

jaunty juniper
#

arm / build (meowbit_v121)
Started 21m ago
...
Waiting for a runner to pick up this job...

brazen hatch
#

Thanks! Let's hope it finally passes.

idle owl
#

I ran make fetch-submodules and it returned this before it started: ```# This update will fail because the commits we need aren't the latest on the

branch. We can ignore that though because we fix it with the second command.

(Only works for git servers that allow sha fetches.)```

#

I've never seen that. What does that mean?

jaunty juniper
#

it says that every time

idle owl
#

Huh.

#

I guess it usually starts faster than I can read it.

#

So it's fine

brazen hatch
#

tbh though, I have never built directly from adafruit/circuitpython/main

jaunty juniper
#

the message is hard coded in the makefile

#

the actual presence of the errors that it warns you about, might depend on whether you are in main, a tag or detached head

brazen hatch
#

Least boilerplate message.

jaunty juniper
#

I believe it prints because it's indented

manic glacierBOT
brazen hatch
#

So it can be moved outside of the target if we want to hide it.

#

Shall I pr it?

slender iron
#

ya, I think moving it would prevent it from being printed

manic glacierBOT
jaunty juniper
#

I tried unindenting them, it made them not print (while the commands after it did run, this is no python and I'm lost), does unindented mean not in a target too ?

brazen hatch
#

pr'ing it

jaunty juniper
#

aaah

manic glacierBOT
#

In ports/espressif/esp-idf/components/hal/include/hal/adc_types.h the structure adc_digi_output_data_t is used to return data read from DMA. The actual ADC sample data is maximum up to 13 bits however it contains additional bits to identify channel and unit. Since for analogbufio we only return the sample values only 16-bit buffer would suffice. I will update the code accordingly and add checks to verify if application has provided 16-bit buffer.

proven garnet
#

If I were to create a template repository for using rp2040js within GitHub Actions, would people prefer TypeScript or JavaScript? Maybe I'm the only one who might use it, but if there are others, I'd love to tailor it to that.

#

I'm leaning towards TypeScript, for what it's worth, but could easily be convinced either which way.

#

@slender iron and @jaunty juniper - tagging you because you expressed interest

#

Also @analog bridge since I think you were looking into this a few months ago

slender iron
#

I don't have a preference

#

one idea I had was to have it output trace data

jaunty juniper
#

no preference either ๐Ÿคท

proven garnet
manic glacierBOT
manic glacierBOT
#

I'm the one running either md5sum, diff, or cat. So that call is not unexpected. fatrace logs the access right away, but as we can see in the logs I've provided, no write is done. The auto-reloads happens some time later (35-40s). Maybe when the system performs a sync on the device?

I'm running this because I'm working off a git repository and auto-uploading any changes on the file as I saved it.

Here's the disk info:

> sudo fsck.fat -v -n /dev/sdd1
fsck.fat 4.2 (2021-0...
brazen hatch
#

Github really isn't happy today.

#

do github worker vms even have a watchdog?

#

or will this run perpetually?

#

And wait a moment, aren't you guys paying for CI? Someone should prolly cancel it cuz it hang.

proven garnet
#

Also, I think there's a time limit

brazen hatch
#

If I wake up tomorrow and it's still going I will kek like no man has kek'ed before.

proven garnet
#

Usage limits are 6 hours for a job and 35 hours for an entire workflow

brazen hatch
#

I am more concerned as to why you know it.

proven garnet
#

I could tell you I googled it, but maybe I'm lying?

#

I definitely remember seeing that there were usage limits recently, that's why I remembered

manic glacierBOT
#
  1. Install wireshark with dnf or whatever (it's been a long time since I used Fedora).
  2. Check that usbmon is in your kernel. Read https://fedoraproject.org/wiki/Usbmon and follow its instructions. It looks like it's already part of the kernel. On Ubuntu, I have to load it.
  3. Add yourself to the wireshark and usbmon groups (per the link above). You will need to log out or even reboot to make this take effect, depending on how your desktop login works.
  4. Start wireshark and look ...
manic glacierBOT
brazen hatch
#

autoreload should perhaps not trigger on file property changes.

slender iron
#

it doesn't know anything except block number

#

so it doesn't know anything about what the filesystem is changing

brazen hatch
#

bummer

jaunty juniper
#

it would have to double-buffer the drive or something

brazen hatch
#

Nah, the better way would be to try to understand the write

#

but that would be slow on an mcu

#

I'm pretty sure there is no good fix for this

#

Perhaps suggest noatime for experts.
But not even those who know how to are gonna bother.

#

I at least make boot.py's JUST for disabling autoreload

#

Also, another concern of mine. Isn't the boot_out.txt spamming writes on every boot?
That could wear out flash really quick under some deployments..

jaunty juniper
#

only if it changed, I don't know if that applies to boot.py

brazen hatch
#

I really should check that.

#

Cuz ljinux's"bootloader" spams the same message every time.

#

Though I guess if it's an stdout capture and save, the comparison should only happen once.

#

Though I still should check.

#

Yea the comparison is in the end.

#

Whoever coded it like this, you have my thumbs up.

#

Excellent code.

jaunty juniper
#

it is, but I don't understand where it gets the output into the right place for the comparison

#

(that would be jepler)

brazen hatch
#

It seems to do just memory comparison from the read file. And it tries to skip it by comparing the len.

#

So if diff len, just don't compare

#

I am more perplexed as to how f_close isn't needed.

jaunty juniper
#

oh ok setting boot_output to non NULL is responsible for mp_hal_stdout_tx_strn writing into it
but I don't get that line:

        (void)found_boot;
#

some C magic I don't know about

blissful pollen
#

I think (could be wrong) it is to get rid of unused variable warnings the compiler tosses.

jaunty juniper
#

ah makes sense

manic glacierBOT
trim cave
#

Hi all, I have a "is this possible, if how" question. Running a matrix portal M4 and having fun displaying data from MQTT with miniMQTT library. If I had a .png image URL as a value in MQTT, is there any way I could display that on my board? I get I could copy the image to the portal and display it that way but was curious if the URL option (or something like it) would work.

idle owl
trim cave
#

@idle owl -- thanks new here and wasn't sure the distinction between channels

idle owl
#

No worries! We're here to help.

manic glacierBOT
#

CircuitPython version

CP800b6 daily 
Adafruit CircuitPython 8.0.0-beta.6-43-g1c1cf1cf5 on 2023-01-18; Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w

Code/REPL

negative number of bytes to read: -115

Behavior

use: CP800b6 latest ( from 14. and 18. ) ( with bundle /lib/ from 15. and 17. )
on a PICO_W ( nuked )
to connect to a local broker ( RPI mosquitto) OK
BUT
to a remote broker TLS ( HIVEMQ ) ERROR
always get error at subscri...

brazen hatch
manic glacierBOT
orchid basinBOT
#

Ok, this is pretty much functioning well at this point. I'm putting this in a draft because I want to polish it up a bit more and add some things like showing a link to the Code Editor if credentials have been added. I still haven't figured out a good way to get the IP address without logging into the REPL (for when install is done using the CIRCUITPY drive). I'll probably just show the circuitpython.local in that case.

There are some binaries included. Those are temporary because my compu...

analog bridge
# proven garnet If I were to create a template repository for using `rp2040js` within GitHub Act...

Hi, @proven garnet. Thanks for looking into it. Yes, I was looking into implementing it in CI and have also done some work locally to get a CLI version going for rp2040js and even esp32js with success. The people at Wokwi have done an amazing job.

An issue I quickly ran into while trying it out was that the website has a peripheral simulator engine for things like gpio, wifi etc. which is closed source. The ...js libraries only contain the processor's instruction set so you can imagine a hardware with peripherals stripped from it, meaning there is no peripheral interaction which leads to things like this:

import board
import digitalio

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT

led.value = True
print(led.value) # This is False in rp2040js but works correctly in the website

This basically limits the usability to checking things which are already being checked by the UNIX port + checking whether or not the firmware itself boots.

jaunty juniper
#

oh the peripherals are closed source ? ๐Ÿ˜“

last bough
#

Can I use tailscale on a circuit python board
It's a wireguard VPN with a coordination server

coarse merlin
#

is there a command to cleanup all the GPIO pins in circuitpython?

#

or is there just deinit() and you gotta call them got all the pins individually?

#

got should be on

stuck elbow
#

you can reset the board

manic glacierBOT
manic glacierBOT
#

I have committed the changes as per all the review comments received so far. Except for the translation related pre-commit failure everything seems to be fine. Please let me know how to resolve translation related error and also additional review comments if any.

Following is the updated test code and output:

Test code:

import time
import board
import analogbufio
import array
import supervisor
import gc

SAMPLE_RATE = const(40000)
CAPTURE_TIME_SECONDS = const(2)
ADC_PIN ...
manic glacierBOT
manic glacierBOT
proven garnet
manic glacierBOT
manic glacierBOT
#

If supporting DMA on multiple pins simultaneously is the original use case then we need to brainstorm on how to handle this in case of ESP32. The ESP32 DMA engine provides use of two masks for ADC1 and ADC2 units which selects pins to be used for DMA operation. Based on pins selected by this mask the DMA starts collecting samples from these pins. The DMA read result provided by adc_digi_read_bytes consists of bits for DMA Unit, channel number (pin) and sample value. So the application has t...

manic glacierBOT
#

bytes_per_sample is set in the Python API interface, based on the whether the array passed in is bytes or halfwords: https://github.com/adafruit/circuitpython/blob/508f2015b68042c25256a8f57dd37e5aec2c48c5/shared-bindings/analogbufio/BufferedIn.c#L144-L149
I'm actually confused why your example in the top post works at all, because it looks like the validation in the lines above should reject the 'L' array.array. Your check_valid_data does not throw an error if the size is a mismatch,...

manic glacierBOT
#

The sample python code and the C code have been updated by later commits. The previous sample was only tested for ESP32S2 chip and not for other versions as noted in my original post. (Even the modified sample is used with ESP32S2 only). Hence 'L' array.array was never used. It would have thrown error if tested for other chips. Please refer to updated sample it no longer use'L' array.array

As per updated code the returned sample value is always 16-bit for ES32-nn. The applicatio...

stuck elbow
jaunty juniper
#

how does a build know the size of the flash on RP2040 ?

#

is it static based on the flash chips in EXTERNAL_FLASH_DEVICES, or is it dynamic as it detects the flash chip ? What if we set something like:

EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ,W25Q128JVxQ"
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit Feather ESP32-S2 TFT with ESP32S2
Board ID:adafruit_feather_esp32s2_tft

Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit Feather RP2040 with rp2040
Board ID:adafruit_feather_rp2040

Code/REPL

import time
from displayio import ColorConverter, Colorspace

cc_888 = ColorConverter(input_colorspace=Colorspace.RGB888, dither=False)

results_histo = {}
for i in range(1100):
 ...
analog bridge
manic glacierBOT
#

I am second guessing this maximum on the value_count Prior to this change it was possible to pass a number up to 65536. The docs make mention of 8, 16, and 32 bits per pixel in the bitmap and capping this at 32767 makes it so it wouldn't be possible (or at least easy to create) a Bitmap that has 32bits per pixel unless I'm misunderstanding how something works.

I'm still trying to wrap my head around how Bitmap + ColorConverter function together as compared to Bitmap + Palette which ma...

crimson ferry
#

are there multiple branches getting merged as S3 builds... in other words, does Absolute Latest have everything to date, or do I need to know which to download to have a certain feature?

#

safemode.py is in 8.0.x, lwip mdns fix is in main, but not vice versa, if I'm reading the tea leaves right

#

can something be merged to multiple branches?

blissful pollen
#

Short answer is yes something could be merged into a branch but not in all of them (like main is ongoing but 8.0.x is branched off for now) and generally you would pull the individual PRs or the whole branch into main

crimson ferry
#

I've heard talk of an 8.1, is there also plans for an 8.0.3?

#

we have a stable 8.0.2, so I'm not really clear on why there are two active branches that are different right now

jaunty juniper
#

I don't think that merges to 8.0.x are uploaded to S3

#

only tags

crimson ferry
#

so nothing on S3 has safemode.py?

jaunty juniper
#

lwip fixes is not on S3

crimson ferry
#

oh, right, I had it backwards

jaunty juniper
#

8.0.x was merged back to main last before that

#

oh wait wrong lwip PR

#

I think

#

if 3 > 2

crimson ferry
#

it's all a bit confusing

#

I'll go with S3 for now, I want safemode.py on all the things

#

circup over web workflow occurred to me this morning, and found there was already an issue ๐Ÿ™‚

#

but I need to switch all my codes over to stay connected rather than connect only when necessary

#

I don't currently use circup, that that may be enough motivation to switch

jaunty juniper
#

oh I wouldn't function without circup, manually copying files ? no thanks !

crimson ferry
#

yeah, there's a lot of steps to figure out if something is where you might want it

crimson ferry
jaunty juniper
#

I call mine discotool, it's on pypi ๐Ÿ˜‰

crimson ferry
#

there are certain libs I always want, then it also depends on how much flash there is and what the board capabilities are, if I want .py versions... many variables, not just related to the current project on that board

jaunty juniper
#

circup via web workflow poses questions of detection and selection of the board, I was thinking maybe it could detect and list boards and prompt the user (with an option to bypass the prompt)

crimson ferry
#

I have an item on my long-term to-do list to re-implement my script with the file API

#

wouldn't you point it to a known device, not broadcast to all

#

like, I know all my IP addresses

#

(I don't know all my MAC addresses) ...well, other than in dhcp file)

jaunty juniper
#

you can use a requirements.txt file with circup for libs that you want to always install

crimson ferry
#

so I'd probably have half a dozen or so requiorements files

tulip sleet
jaunty juniper
#

that does give me ideas of things to add to my web workflow app, I want it to be a tool that manages boards, like automatically do backups, browse them and restore per board... Having presets of libraries to install, or like "templates" could be interesting
https://github.com/Neradoc/discotool-circuitpython-manager

manic glacierBOT
#

PR will be submitted soon but the problem was in shared-bindings/displayio/ColorConverter.c in displayio_colorconverter_obj_convert(...)

    _displayio_colorspace_t colorspace;
    colorspace.depth = 16;

The colorspace object is never initialized and later in the code colorspace.reverse_bytes_in_word is referenced. If it is incorrectly set to non-zero the function fails.

jaunty juniper
#

(right now you can upload a directory by selecting it in the upload dialog adding automatically finding and installing the requirements.txt would complete that)

willow totem
#

Is there a good reason esp32 S3 has CIRCUITPY_PARALLELDISPLAY disabled?

#

ports\espressif\mpconfigport.mk Line75

tulip sleet
#

I will be doing an 8.0.3 pretty soon.

#

in a matter of days

jaunty juniper
#

8.0.x doesn't pull from main right ? It's just for quick fixes. But 8.1.x will start from main ?

tulip sleet
#

right

#

but we merge frequently from the latest stable branch (in this case 8.0.x) to main

tulip sleet
willow totem
#

missing i2s_dma stuff, I'd forgotten there were issues there, but should be resolvable in theory.... undefined reference toi2s_lcd_driver_init'`

manic glacierBOT
#

Fix for #7609

The output colorspace struct was created every call to convert but the structure was not initialized leading to random values. Specifically reverse_bytes_in_word was referenced in the conversion function with never being set. This lead to unpredictable behavior.

Moved the colorspace object to the class structure so it can be reused and is properly initialized. This also allows the output colorspace to be made to be configurable in the future.

Tested on a KB2040.

...

#

Fix for #7609

The output colorspace struct was created every call to convert but the structure was not initialized leading to random values. Specifically reverse_bytes_in_word was referenced in the conversion function with never being set. This lead to unpredictable behavior.

Moved the colorspace object to the class structure so it can be reused and is properly initialized. This also allows the output colorspace to be made to be configurable in the future.

Tested on a KB2040.

``...

manic glacierBOT
#

CircuitPython version

Tested with CP 8.0.2 and CP 20230218-12d3640.

Code works properly with CP 7.3.3.

Code/REPL

import time
import board
import busio

e5_uart = busio.UART(
    board.TX, board.RX,
    baudrate=9600,
    timeout=0.01
)

while True:
    out_bytes = bytes('From QT Py\n\r', 'utf-8')
    e5_uart.write(out_bytes)
    in_bytes = e5_uart.read(10)
    if in_bytes:
        print(in_bytes)

    time.sleep(1)

Behavior

I ...

manic glacierBOT
#

I have a project on the Unexpected Maker Feather S2 that enters safe mode with "Crash into the HardFault_Handler." or "Internal watchdog timer expired." This project doesn't have issues under 7.3.3.

Unlike anecdata's project, mine uses adafruit_mqtt not the adafruit_httpserver or adafruit_request libraries. Mine also seems to run for a couple days before crashing. I can open a different ticket, if people think my issue is unrelated.

#

CircuitPython version

Adafruit CircuitPython 8.0.2 on 2023-02-14; Seeed XIAO nRF52840 Sense with nRF52840

Code/REPL

import atexit
import time
import supervisor
import adafruit_ble
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.color_packet import ColorPacket
from adafruit_ble.services.nordic import UARTService

ble = adafruit_ble.BLERadi...
willow totem
#

Okay, how totally insane am I to try and consider using the esp_lcd_panel_i80 driver for displayIO on the S3? (Ive seen it done for esp-idf/arduino) I'm desperate to see the 8bit parallel display on the LilyGo/TTGO T-DisplayS3 working in displayIO, but stumbled on the lack of ParallelDisplay support on the s3. I'm no novice, but equally don't have an oscilloscope, just a pico (https://github.com/fhdm-dev/scoppy). I was hoping to cobble something together, but realise it's a bit above my comform zone / skill level

manic glacierBOT
rugged spindle
manic glacierBOT
manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.0.2 on 2023-02-14; Adafruit Matrix Portal M4 with samd51j19

Code/REPL

import time
import board
import terminalio
from adafruit_matrixportal.matrixportal import MatrixPortal

# --- Display setup ---
matrixportal = MatrixPortal(status_neopixel=board.NEOPIXEL, debug=True)

# Create a new label with the color and text selected
matrixportal.add_text(
    text_font=terminalio.FONT,
    text_position=(0, (m...
#

Installed 7.3.3 as well and it has the same error:
Adafruit CircuitPython 7.3.3 on 2022-08-29; Adafruit Matrix Portal M4 with samd51j19

Traceback (most recent call last):
  File "code.py", line 4, in <module>
  File "/lib/adafruit_matrixportal/matrixportal.py", line 33, in <module>
  File "/lib/adafruit_matrixportal/network.py", line 31, in <module>
  File "adafruit_portalbase/network.py", line 28, in <module>
  File "/lib/adafruit_io/__init__.py", line 21, in <module>
  File ...
manic glacierBOT
#

In the "ports/stm/supervisor/internal_flash.c" file
In the "supervisor_flash_read_blocks" function

`uint32_t count = (sector_size - (src - sector_start_addr)) / FILESYSTEM_BLOCK_SIZE;
count = MIN(num_blocks, count);

if (count < num_blocks && _cache_flash_addr == sector_start_addr) {
    // Read is contained in the cache, so just read cache
    memcpy(dest, (_flash_cache + (src - sector_start_addr)), FILESYSTEM_BLOCK_SIZE * num_blocks);
} else {
    // The r...
willow totem
proven garnet
#

Alright, demo code and instructions for using CircuitPython (with optional filesystem) added upstream to rp2040js!

proven garnet
#

Hoping for a release to npm soon for that.

brazen hatch
#

This is just amazing.

manic glacierBOT
#
  • Fixes #7612.

  • SERCOM USART TXPO computation was not correct on SAMD21 for TX pins using pad 2, due to changes introduced in #6434. SAMD21 and SAMx5x are different: SAMx5x does not allow pad 2 for TX. In addition, checking for allowed pins based on their pads was not as rigorous as it should have been. Code is somewhat restructured.

  • Signature for busio.UART() was missing several arguments and did not account for None values.

  • Did more pin validation in shared-bindings `busio.U...

manic glacierBOT
manic glacierBOT
#

Addresses https://github.com/adafruit/circuitpython/issues/5136 for rp2040 for me with the code & mp3 listed in https://github.com/adafruit/circuitpython/issues/5136#issuecomment-1434157983

During the testing of this change, in the construct and stop functions I sprinked a bit of:

    printf("quiescent_value: %d\n", self->quiescent_value);
   ...
    printf("\nslice top / cc: %d / %d\n", self->left_pwm.top, (uint16_t)(pwm_hw->slice[self->left_pwm.slice].cc));

To see what ...

stuck elbow
#

it's perfectly fine, you are just more likely to get a better answer there

tulip sleet
manic glacierBOT
#

Test program I used to find working combinations, a variation on https://learn.adafruit.com/circuitpython-essentials/circuitpython-uart-serial#wheres-my-uart-2985036. Generates thousands of combinations, and takes a while to run. Includes cases where pins are None.

import board
import busio
from microcontroller import Pin

def is_hardware_uart(tx, rx, rts, cts):
    try:
        p = busio.UART(tx, rx, rts=rts, cts=cts)
        p.deinit()
        return True
    except Val...
manic glacierBOT
arctic stirrup
timid bolt
#

Why do we keep the CYW43 driver under lib instead of sdk/lib? Don't we want to keep the CYW43 driver in sync with the RP2 SDK?

blissful pollen
#

Anyone know offhand why the maximum frequency I can set the SPI bus on an RP2040 in CP is 31.25Mhz when in Arduino (and the specs) seems it will go to around 50Mhz?

tulip sleet
digital shoreBOT
#
adafruit
Owner

adafruit#3230

Category Channels

8

Text Channels

62

Voice Channels

7

Members

36787

Roles

36

jaunty juniper
#

So, I believe that the flash size is detected on run on RP2040 and it uses the flash settings to switch to fast mode. I know we had issues with boards using a new chip, but can we use something like this to make a single build for multiple sizes, maybe support some pico clones with bigger flash without adding builds ?

EXTERNAL_FLASH_DEVICES = "W25Q16JVxQ, W25Q128JVxQ"

Like the WeAct Studio Pico where we have builds for 2MB and 16MB but not for the 4 and 8 variants. I tried putting the 4MB pico lipo on a 16MB pico lipo, or putting the 16MB WeAct on a RPi pico and looked liked it worked.
What is the catch ? Is it using the defined chip settings (for the wrong chip) or is it using default settings and not run it in quad speed or whatever it is ?

timid bolt
tulip sleet
#

The reason is historical, and may still be relevant

#

we did the port immediately after the library became public

#

when we move to pico-sdk 1.5.0-something, we can re-examine this

#

i think the cyw43 driver was getting fixes faster than the pico-sdk was being updated

timid bolt
#

Right. So there are two open issues: update pico sdk and update cyw43 driver. But it possible that the former would take care of the latter, if we didn't have our own fork of cyw43-driver.

tulip sleet
#

right, for sure, worth adding a comment to those issues to note they are linked

#

and see what's fixed in our fork

timid bolt
#

Also the cyw43 submodule of pico sdk, just points to the origin (georgerobotics). So if we just wanted the latest cyw43, we could pull the latest inside sdk/lib/cyw43-driver and not need our own fork.

tulip sleet
#

soounds good - I think it's really that we had fixes that were not upstream at the time

manic glacierBOT
tulip sleet
# jaunty juniper So, I believe that the flash size is detected on run on RP2040 and it uses the f...

How to treat the flash chips is handled in the stage 2 bootloader, which is generated from a template: circuitpython/ports/raspberrypi/gen_stage2.py and stage2.c.jinja. It looks like gen_stage2.py makes sure that the critical settings of all the listed chips match (e.g. all have qspi, etc.). Then it uses those common settings to generate the right thing in stage2.c. (I did not know this off the bat -- had to read the code.)

#

so we can't list disparate flash chips that vary in certain parameters, because the stage2.c builder will complain.

onyx hinge
#

Yeah I think we went with the non-nested submodules so that we did not have to update pico-sdk and cyw43 in lock-step or maintain our own pico-sdk fork. there are other decisions that would have worked equally well / have different caveats.

In the current case, we did carry one difference compared to upstream pico-sdk of the time, so that it could cooperate with our mdns-related needs.

tawny anchor
#

Hi all ... trying to get my MetroESP32-S2 to connect with my home mosquitto mqtt server using Circuitpython. I tried my own program then fell back to trying the example on adafruit's website. I replaced the adafruit information in the secrets.py file with my own information but when I try the mqtt_client.connect() it get a repeated connect fail error.
I have successfully pinged the host that mqtt is running on from the metro (which says the Metro is connected and the host is reachable) and I can successfully send/receive messages in node-red. Any suggestions?
secrets = {
'ssid' : 'OurHouse_GWF',
'password' : '#########',
'broker' : '192.168.86.71',
'broker_username' : 'rick',
'broker_key' : 'password',
'port' : 1883,
}

subtle ledge
#

Hello all! I posted a PR to add a Packsize of 2200 to match the battery I am using. I apologize if I missed reading any docs on submitting PRs. I'm not in any rush, I was just wondering if you had any feedback or whether this was something that could get added? https://github.com/adafruit/Adafruit_CircuitPython_LC709203F/pull/23

GitHub

I'm using the 2200 mAh battery in my project with an ESP32-S2. While it is working perfectly using a value of PackSize.MAH2000, I wanted to be able to specify the perfect PackSize. I tested t...

tulip sleet
tulip sleet
subtle ledge
tawny anchor
tulip sleet
subtle ledge
tawny anchor
#

But I have seen lots of people that successfully connect and publish/subscribe to adafruitIO.

still zephyr
tawny anchor
tawny anchor
subtle ledge
tawny anchor
manic glacierBOT
manic glacierBOT
#

Adafruit HUZZAH32 Breakout uses a 4MB flash WROOM-32E module.

  • There is an LED on GPIO13, which is used for CircuitPython status.
  • There is a button on GPIO0, which is used to enter boot mode. It can also be used to enter safe mode, when the LED flashes multiple times during boot. Tested this.
  • Pins are plain IOnn. There are no default I2C, SPI, or UART devices, per discussion with @ladyada
  • Touched up formatting of adafruit_feather_huzzah32/mpconfigboard.mk file.

Tested with...

crimson ferry
#

that will be useful for a lot of #vintage ESP32 boards

orchid basinBOT
manic glacierBOT
orchid basinBOT
#

Hi There:

I have completed the .md file for brainboardz_neuron in the _board directory and I have added the (original, large and small images) for the brainboardz_neuron to the assets/images/boards/ folders. I have also updated the Features section of the .md file to be compliant with the instructions on this item.

If this can get merged and become active I would greatly appreciate it. Thanks for all the help!

manic glacierBOT
#

Ah yes, I hadn't seen the (samd specific) ramp functions in https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/common-hal/audioio/AudioOut.c#L58 - they've got a bit more going on than the basic / naieve ramp I threw in here. I did very little tuning on my ramp, other than initial versions with ~10 steps over shorter timeframe being able to be audibly heard.
RUN_BACKGROUND_TASKS; certainly seems like a good idea, though shouldn't this be included in any delay functions?
T...

#

CircuitPython version

Adafruit CircuitPython 8.0.2 on 2023-02-14; Raspberry Pi Pico W with rp2040
Board ID:raspberry_pi_pico_w

Code/REPL

import os
import wifi

ssid = os.getenv('CIRCUITPY_WIFI_SSID')
password = os.getenv('CIRCUITPY_WIFI_PASSWORD')

print("Activating Access Point SSID...", ssid)
wifi.radio.start_ap(ssid, password)

Behavior

code.py output:
Activating Access Point SSID... ReS_AP01
Traceback (most recent call last):
File...

orchid basinBOT
manic glacierBOT
#

Testing (with a lot of tracing) has shown that the 116 is, in fact, an MP_ETIMEDOUT error code being returned from lwip_tcp_receive in common-hal/socketpool/Socket.c. I am unsure why the value is 116, as MP_ETIMEDOUT is defined as 110 in py/mperrno.h. Adding a "keep_alive=100" to the MQTT initialization in the supplied script avoids the timeout in my testing. There may well be some issue here that is keeping the error from being properly reported, perhaps because at some point the return va...

orchid basinBOT
#

Hi foamguy:

I made the change as requested and committed it to my branch. I'm a bit
unsure whether I need to submit another pull request. Github is new
territory for me.
If I commit to the main branch is that ok? I could do another pull request
but I think that is not how changes are supposed to work. Sorry for
the confusion.

On Mon, Feb 20, 2023 at 9:53 PM foamyguy @.***> wrote:

@.**** requested changes on this pull request.

Thank you.

I tested this out locally and ...

#

@BrainBoardz once you have created the PR you can add new commits to the same branch (BrainBoardz:main in your case) and the PR will automatically update to reflect the new commits. The PR tracks the branch if/when it changes, so there is no need to make a new PR, making new commit(s) is good enough.

The latest version looks good to me. Thank you!

#

Hi There:

That's awesome news. Not only did it get posted (yay!) but I now understand
how the process is supposed to work. Thanks for all the help!

bye for now,

On Mon, Feb 20, 2023 at 10:16 PM foamyguy @.***> wrote:

@.**** approved this pull request.

@BrainBoardz https://github.com/BrainBoardz once you have created the
PR you can add new commits to the same branch (BrainBoardz:main in your
case) and the PR will automatically update to reflect the new commits. The...

manic glacierBOT
manic glacierBOT
#

There are currently limitations in the Pico W implementation due primarily to external submodules. This will hopefully improve in the future. But for now, here's a summary of the limitations:
https://github.com/adafruit/circuitpython/pull/7101#pullrequestreview-1188988867

Basically, a device can either be a Station or an Access point, and since the example above starts web workflow and therefore becomes a Station, it precludes the device from becoming an AP.

#

The explanation for that code is here: https://github.com/adafruit/circuitpython/pull/5031. I don't remember the details now, but I thought it would fix the problem because of the active driving. Apparently this is not always the case.

I'm a little confused by your suggested change, because it waits for all the keys to be unpressed, according to the comments. But that would stall the scanning, (wouldn't it?), for the time you held down a key.

manic glacierBOT
#

Wow, that was a quick response! And #5031 sounds like my exact problem.

I thought it would fix the problem because of the active driving.

The active driving does look like a good approach. It's possible my keyboard is just particularly bad when it comes to parasitic capacitance and inductance and it takes a bit longer to drain them via active driving.

I'm a little confused by your suggested change, because it waits for all the keys to be unpressed, according to the comments. But...

manic glacierBOT
manic glacierBOT
#

I have an idea, how about a wifi.radio.bg_connect that is enabled automatically when web workflow is configured and can be toggled at any time? Should this property be enabled, while backround tasks run, the wifi connection can be attempted automatically.

Though the more I think about it I think it should be a class..

wifi.radio.bg.connect
wifi.radio.bg.enabled
wifi.radio.bg.attempt_interval
manic glacierBOT
#

Thank you so much @anecdata . It Works for me your explanation and the code shared. I deleted the lines of wifi configuration in the settings.toml and changed my code to this lines:

if wifi.radio.ipv4_address_ap is None:
print("Activating Access Point SSID...")
wifi.radio.start_ap("Cookie", "franemma")
else:
print("Access Point SSID already active...")

This scheme is neccesary to avoid an error when AP is already started. And when a i need a change in AP parameters i code ...

tulip sleet
# crimson ferry that will be useful for a lot of #vintage ESP32 boards

It does have an LED on IO13. If that is not typical, maybe I should make an even simpler one. But if you use IO13 for something else, it will stop using IO13. The only issue is if there is something hardwired to it that would be upset at uncontrolled transitions. (And you could turn it off early in the boot process.)

manic glacierBOT
manic glacierBOT
brazen hatch
#

One thing I have noticed regarding resizable pystack is at some point (differs port-to-port) increasing the size doesn't increase max recursion size.
For esp32s2 that is 3.7k for pico 7k.

#

Though stackless is still available for those who need it.

#

I will prolly end up using it too for simplicity.

#

I will make one attempt at having that one board pass with rainbowio

#

Didn't ci used to only redo the checks for the boards affected? What a bummer

blissful pollen
#

@tulip sleet responding here as Iโ€™m at work and my phone isnโ€™t signed in to GH. The GIF pr just needs the last commits to be reviewed - as far as I know thatโ€™s all thatโ€™s left.

manic glacierBOT
slender iron
timid bolt
#

FWIW, I've also been looking into pwm audio performance. A more fundamental cause of the "pops" is that the output is being driven as single-ended, so there is a DC bias in the signal, which causes the pop when the output is started/stopped. Amplifiers and especially speakers expect double-ended output, which also has no DC bias so implicitly removes the pops. (I.e., you want alternating current flowing through the speaker coil so that the cone moves in both directions.)

slender iron
#

how do you produce double ended output?

#

two pins?

timid bolt
#

Most MCUs have PWM modules that support an inverted output. Yes, so you have two pins and one is the inverse of the other.

slender iron
#

๐Ÿ‘

timid bolt
#

The rp2040 has this, which is what I'm using. But even back in the day the atmega328p has this as well. It basically provides a H bridge, which is useful in other applications too.

slender iron
#

ya, sounds familiar with the pwm work on imx rt I've been doing

#

that will produce more volume too right?

timid bolt
#

Yes, for directly connected speaker it is 2x (or 4x?) more volume. But for amplifier it doesn't matter. I guess it doubles the dynamic range for the amp and speaker too.

manic glacierBOT
#

One mystery solved; the #define of ETIMEDOUT in /arm-none-eabi/include/sys/errno.h is 116. Now the question is whether that error should be returned to the user, or perhaps a retry in the minimqtt library, or maybe increase the default value for TLS connections from 60 in the library. @kllsamui , are you able to test with your original setup and verify that a keep_alive of 100 is sufficient?

tulip sleet
manic glacierBOT
thorny jay
manic glacierBOT
brazen hatch
#

Satellites don't need rgb?

#

Everything needs rgb

onyx hinge
#

@tulip sleet if melissa doesn't make it I can read the blinka section

tulip sleet
#

tnx!

gilded cradle
#

I'm here

brazen hatch
#

May I join (listening-only) when it starts?

onyx hinge
#

@brazen hatch yep, now's a good time to join

#

[and if you're a Mastodon person you can use @Anneb@octodon.social and #circuitpython on your post/toot]

slender iron
#

I think it uses openocd

onyx hinge
manic glacierBOT
blissful pollen
#

Sorry no voice today

slender iron
#

I think folks will be excited by that

midnight ember
#

wifi audio with scorpio and asyncio? ๐Ÿ˜ฏ ๐Ÿ‘€

#

Jepler does this involve a floppytron in any way?

timid bolt
#

I'm actually doing it on pico-w. But I guess it should work on any rp2040 with wifi.

onyx hinge
#

@midnight ember no, though with the floppy featherwing you can access the step & direction pins of the floppy drive so you could maybe make it make some noise

midnight ember
#

No more chip shortage song? ๐Ÿ˜ฆ

brazen hatch
#

I have unused floppies. I guess I am making an alarm.

midnight ember
#

Hope you get better soon Tekktrik. ๐ŸŽˆ

onyx hinge
#

Thanks Dan for running the meeting!

midnight ember
#

Thank you danh for hosting the meeting.

gilded cradle
#

Thanks

brazen hatch
#

Thanks danh!

slender iron
#

thank you!

blissful pollen
#

Iโ€™m pleasantly surprised to find that my workโ€™s wifi let discord audio through. It didnโ€™t last time I tried

crimson ferry
#

Has anyone thought about DNS caching, either in Requests or in the core? DNS seems to get called for every connect, and takes a relatively long, indeterminate amount of time.

manic glacierBOT
timid bolt
crimson ferry
#

I just ran a quick test:```py
for _ in range(0, 10):
start = time.monotonic_ns()
ipv4 = ipaddress.ip_address(pool.getaddrinfo(HOST, PORT)[0][4][0])
print(f"DNS took {(time.monotonic_ns() - start) / 1_000_000} ms")

#

hm, I don't see anything obvious about caching in the espressif docs or nongnu.org/lwip

#

anything we can do to async these long-running things is a big win too (wifi connect, dns, tcp connect, etc)

tulip sleet
#

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

timid bolt
timid bolt
manic glacierBOT
brazen hatch
#

Do I cut more corners or just revert?

brazen hatch
#

In the future I plan on creating tmpfs on CP.
It will be very useful for ljinux (/dev, /tmp)
It will be an independent library ofc.

#

I will try to make it run code on virtual files like gpio for example.

#

echo 1 > /dev/gpio/1/enabled

timid bolt
brazen hatch
#

Allow me to introduce you to psram my boi. 8 whole megabytes!

#

I am pretty sure that you would still not be able to download many files, but I guess it's better than breaking the board flash

#

If only could mount more psram as dram sticks or download more psram

#

Heap swap would be nice, but flash would die

#

Perhaps on a sdio-connected sd it would makd sense swapping

#

Ahh I can smell it, iowait in the air,
Every pi user's nightmare

timid bolt
#

Does rp2040 have psram? I think no.

brazen hatch
#

Yea it sadly doesn't.

#

Pretty sure it doesn't have support for it either.

#

If it had i'm sure board makers wouldn't hesitate to plop some in.

#

Though 140k usable ram isn't little. Considering my bloat project fits in 40kb, you can do quite a lot in it.

timid bolt
#

Well, I'm jealous of your 8 MB of ram. It would certainly make buffering audio easier.

brazen hatch
#

Ljinux booting on external psram may take up to 40 seconds.

#

rp2 is 7s

slim basalt
#

can anyone tell me whether i'm in the right ballpark with this board definition? just double checking before i make a fool out of myself blindly submitting a PR...

brazen hatch
#

From a first glance it looks good to me.
I have no knowledge of the board though.
I would try enabling ESPPSRAM64 though.

slim basalt
#

this module only has 32 mbits... i think the newer WROVER-E modules have 64 but i am not sure if they're using them on this board

brazen hatch
#

Well you can always just try a local build to see what work and what doesn't.

slim basalt
#

i have it up and running locally now, which is pretty cool. i like being able to run code in the REPL

#

blinked an LED too

brazen hatch
#

Oh wait that's legacy esp32

slim basalt
#

yeah, no USB on this one

brazen hatch
#

well, web-workflow is your friend

slim basalt
#

yep. kinda neat to be able to edit code directly on the device through my web browser. i'm living in the future, man

#

can't fathom all the hard work that went in to get it to this point

brazen hatch
#

I wonder if ljinux would run on that..
If it did you could use nano on the board itself

slim basalt
#

i've seen a couple of proof of concept level demos of linux booting on the esp32, via a RISC-V CPU emulator

brazen hatch
#

I have no legacy esp32's so I can't port or test.

slim basalt
#

terribly terribly slow though

brazen hatch
slim basalt
#

oh

#

my bad

#

hadn't heard of it

brazen hatch
#

oh well

#

If you need any help on the board port feel free to ping.
I'm not very experienced on the topic (I have only ported one), but i'm glad to help.

slim basalt
#

thanks!

crimson ferry
timid bolt
brazen hatch
#

https://gr.mouser.com/datasheet/2/1127/APM_PSRAM_QSPI_APS6404L_3SQR_v2_3_PKG-1954826.pdf
Waveshare esp32s2 pico has this psram chip.
It says, 84MHz for Linear Burst operation, 109MHz for 32 Bytes Wrapped Burst operation at VDD=3.3V+/-10% and 133MHz for 32 Bytes Wrapped Burst operation at VDD=3.0V+/-10%.
But 3.0V +/-10% is within the 3v3 range.
So couldn't I set CONFIG_SPIRAM_SPEED_120M=y? It certainly boots with it, but is that an overclock?

#

And does circuitpython even use "Wrapped Burst operation"?

#

The board feels much faster with it enabled.

#

Hmm, chatgpt is very well versed in based software.

#

But let me actually verify cuz I don't trust it.

jaunty juniper
#

you should ask bing, and see if it yells at you

slender iron
#

@slim basalt feel free to submit a PR we're friendly ๐Ÿ™‚

brazen hatch
#

The board will become an led.

slim basalt
#

roger that

slender iron
#

thank you!

slim basalt
#

i have a feeling i messed up the pin list but will need someone else's eyeballs to tell me what

slender iron
#

generally we just merge it and others can fix as they find issues

slim basalt
#

sweet

slender iron
#

since we don't always have boards

slim basalt
#

yeah this is a pretty unique board, i doubt there's anyone but me even interested in running circuitpython on it...it was more designed as a demo for espressif's audio framework

manic glacierBOT
jaunty juniper
slim basalt