#circuitpython-dev

1 messages · Page 46 of 1

manic glacierBOT
#

@HelenFoster People shouldn't be using drive strength to limit LED current. It doesn't work that way, e.g. setting 4mA drive strength doesn't actually limit the current to 4mA, you just get a voltage drop which may or may not limit current by much, depending what you're driving.

Yes, that's exactly right. I ran a small experiment on an RP2 where I tied 6 GPIO pins to ground each through its own 220R. At 3.3V this should draw 15mA each. Varying the drive strength, I saw the following mea...

manic glacierBOT
#

I don't know if this would end up working with an I2C multiplexer, if you mean something like the chip in this product: https://www.adafruit.com/product/5626 -- is that important for your design? The PCA9554 for example has 8 selectable addresses giving up to 64 I/Os on expanders, without needing an I2C mux.

What I'm envisioning is that the IO expander could work with

  • bitbangio.SPI (not busio.SPI)
  • cs pin of an adafruit_bus_device SPI device
  • digitalio.DigitalInOut
  • keypad.Keys
manic glacierBOT
atomic summit
#

Hiya - I'm trying to commit my FeatherS3 Stemma I2C changes into the 8.2.x branch in github, and I'm having some pre-commit issues... everything has been installed correctly as per the learn guide for building CP. All requirements (dev + doc) have been installed. Everything looks fine... but I keep getting a fail with translations because of /bin/sh: xgettext: command not found

Full commit output is here...
https://gist.github.com/UnexpectedMaker/ce7d79bc0a2193d2f12bbeb850943ac3

This on an M2 Mac running 13.5.1, python version is in the gist
Any thoughts?

wraith crow
#

On linux I needed to run "sudo apt install gettext" at one point

atomic summit
#

I have the xcode command line tools installed - which should apparantly provide xgettext

#

Ok, I just brew installed gettext and got past that error, but now it's failing to translate a bunch of stuff I've not even touched 😦

#

Ok, I got it - wow, was a submodule conflict nightmare after checking out the 8.2.x branch

wraith crow
#

👍

manic glacierBOT
atomic summit
#

Well, that was fun! hahaha... dislike_git++ 😉

tulip sleet
atomic summit
tulip sleet
#

Sometimes even more than that, if I have multiple PR's going 🙂

midnight ember
#

For the matrix panel height being implied might not work in all situations. a panel that is 64x32 rotated 90 degrees would have a height of 64 and width of 32. if it's implied prior to the rotation that would work but then there's also the 64x64 panels out there too. while height might be optional i still think it's best practice to specify all dimensions, just like you would do with a TFT.

manic glacierBOT
manic glacierBOT
#

I don't know if this would end up working with an I2C multiplexer, if you mean something like the chip in this product: https://www.adafruit.com/product/5626 -- is that important for your design? The PCA9554 for example has 8 selectable addresses giving up to 64 I/Os on expanders, without needing an I2C mux.

Ah sorry. When I mentioned multiplexer, I meant an analog multiplexer. On Yukon we have their address controlled by the IO Expander, and thus it's beneficial to set all the relevant ...

manic glacierBOT
midnight ember
#

I'm not sure where to put this. An issue, a feature request, etc..? The Metro M7 iMX 1011 does not include the RGBMatrix library. Apparently that library only exists in shared-bindings and common hal etc.. within circuit python.

#

Attempted to use the iMX with the Uno/Metro form factor RGB Matrix shield. Would likely work in Arduino but doesn't seem to be support in Circuit Python.

#

was just an experiment anyway. ```py
Traceback (most recent call last):
File "code.py", line 10, in <module>
ImportError: no module named 'rgbmatrix'

#

I know that kind of combination is likely out of leftfield. Was too tempting to try the iMX's speed with the panels.

onyx hinge
# midnight ember I'm not sure where to put this. An issue, a feature request, etc..? The Metro M...

@midnight ember yeah it's not supported at the moment on that chip. first move would be to file a feature request on the protomatter github repo, but I don't know if adafruit is inclined to devote developer time to it.

As to your other question/remark, unless I'm mistaken rgbmatrix doesn't support rotation. rotation comes into play when you add the displayio layer with a FramebufferDisplay. So rgbmatrix "height" and "width" are always about rows and columns in the panel addressing scheme. when you create a FramebufferDisplay you can get/set its rotation property and you can get its width and height properties which for 90 and 270 rotations are swapped compared to the rgbmatrix.

#

though .. there is a "teensy4" "core" for rgbmatrix, so maybe it's not as much work as you'd think (i.e.,does "teensy4" support all mimx10xx or just mimx106x or what..)

#

the code does imply it's 1062 only, unfortunately.

midnight ember
#

Could I use the matrixportal library? I was trying to use rgbmatrix itself as that's what I'm doing on the matrixportal s3. I'm not using the matrixportal library with the matrixportal s3... only rgb matrix.

#

It will do rotation np.

#

seems the matrixportal s3 has the rgbmatrix lib frozen in.

tulip sleet
#

RGBMatrix is native C; it is not frozen

midnight ember
#

ah

onyx hinge
#

this section tries to explain how rotation works. You use the RGBMatrix constructor the same (so rows and columns are "un rotated" numbers), and then set the rotation on the FramebufferDisplay.

tulip sleet
midnight ember
#

guess i should say i was using rotation with the framebuffer yes

#

was being lazy and didn't want to rewrite the whole thing around the matrixportal library. thank you for the directions, will do.

tulip sleet
#

@onyx hinge @slender iron I can make an 8.2.5 today if you have time to review #8374 and #8376

manic glacierBOT
onyx hinge
#

A pin on an I2C expander has a characteristic we never imagined before: maybe it can't be read or written RIGHT NOW because it's on the other side of a locked bus. 😕

wind kettle
#

Hello

#

Any news about BLE software support on Raspberry Pico W?

#

👀

#

Any updates or commits or pull requests?

random junco
manic glacierBOT
#

I've been doing some reading on the fascinating (and as it turns out related) topics of drive strength and slew rate. Full disclosure: I am not an EE but do have enough experience with digital electronics to be dangerous, so take my analysis with a grain of salt.

Have a look at this https://electronics.stackexchange.com/questions/360750/how-the-slew-rate-and-drive-strength-affect-the-output-signal-of-the-fpga/360752#360752. It shows graphically how drive strength and slew rate affect a sig...

stuck elbow
brazen hatch
#

Picow will probably not work very well with ble too..
It already is crippled by ram..
Reserving more for the ble stack isn't gonna be fun.

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 8.2.5
onyx hinge
#

@tulip sleet can you do final (hopefully) review on the dot clock display PR? Since scott's last review I fixed the typo and the copyright notice; and added the hack tablet board def. It'd be nice to merge it today since I'm out tomorrow; asking you because scott's out today.

orchid basinBOT
onyx hinge
#

thank you

stuck elbow
manic glacierBOT
brazen hatch
#

It should be only using 70k but big allocations (10k+) fail a lot more often, rendering it pretty useless.

#

That’s fragmentation, even though I spam gc.collect every free slice of time

#

Until I learn how to execute code from storage in segments this is really hindering what picow can do

#

Cause currently to exec() something I need to load the whole thing.

#

And some .py’s are already 15k

wraith crow
#

Using the picow with Pimoroni's DVI base (or I imagine the PiCowbell) might demonstrate the case, it's possible to build the firmware with both WiFi and PicoDVI active but you're limited by RAM with what you do with it.

tulip sleet
#

@onyx hinge I approved the PR, but I think Scott would still like you to update the copyright notices in shared-bindings/dotclockframebuffer to be you. There was a spelling fix that it looks like you already resolved. I can re-approve after a push.

manic glacierBOT
#

Both Adafruit TFT Experiment board and for an unreleased pimoroni board use on-board I2C bus expanders.

Besides this, the Pico W has a special I/O pin that is on the CYW wifi coprocessor.

Usable for what tasks?

It is desirable for these "pins" to be able to be treated consistently by anything that doesn't require fast or accurate timing. This could include:

  • digitalio.DigitalInOut
  • bitbangio.SPI
  • The CS and DC pins of an SPI device, SD card, or a 4-wire display
  • keypad.K...
stuck elbow
#

there was a some way to get the build artifacts for a particular pull request, anybody remembers how?

stuck elbow
crimson ferry
#

Checks --> Build CI for open PRs

tulip sleet
#

in any case, if you click on one of the builds, you can then click "Summary" at the top of the left sidebar. Then scroll down to show the artifact .zip files

#

note that pre-merge PR builds don't build all the languages

brazen hatch
#

I will be continuing and probably finishing the ftp implementation today.
Can I stream it in one of the channels if anyone wants to see me working?
I have my v4l2loopback in obs setup so I can stream from wayland!

tulip sleet
#

but you might need privs you don't have to do video

brazen hatch
#

It works.

wraith crow
#

Just curious how the streaming worked 😁 You're upside down though....

brazen hatch
#

What?

#

My preview was flipped, so I flipped it in obs

wraith crow
#

The video screen is upside down

brazen hatch
#

?!

wraith crow
#

that's better, fixed 😄

brazen hatch
#

So discord's preview is just wrong.. K, good to know, thanks!

manic glacierBOT
manic glacierBOT
#

@jepler I did not consider the locked I2C problem. I was testing with the ST7789 library, I found that having auto_refresh=True was a bad idea, and it was better to explicitly call display.refresh() when a refresh was wanted. As such I never thought about any async or other way of handling the display that may cause the lockup you describe.

One thing I did have to do in my build was release the displays on reset_board() to avoid the REPL rendering to the screen and thus tanking perfo...

manic glacierBOT
#

I think this is mostly a DigitalInOut abstraction rather than a Pin one. The Pin would only be needed if you wanted to have references to them in board. If that's the case, then they could be attributes on a long living object for the expander that is also available like board.SPI(). This is a similar model to the existing PCF8574 driver.

I don't think a protocol is necessarily the right approac...

manic glacierBOT
#

I think this is mostly a DigitalInOut abstraction rather than a Pin one. The Pin would only be needed if you wanted to have references to them in board.

I just want to throw in that in my case I do have the pins referenced in board: https://github.com/ZodiusInfuser/circuitpython/blob/yukon/ports/raspberrypi/boards/pimoroni_yukon/pins.c
My rational there is that the IO Expanders are an implementation limitation of the board, due to the RP2040 not having enough native IO pins to perfo...

#

If we had the space, I'd suggest also including DigitalInOut.drive_strengths, which would return a tuple of port-specific available drive strengths, in mA. Then the code can choose. Setting DigitalInOut.drive_strength would then have to either set a valid drive strength exactly, or (alternatively, a more forgiving API) would set the nearest one (or floor or ceil).

So you could get the max by .drive_strengths[-1] and the min by .drive_strengths[0]. This is portable.

I d...

slender iron
#

@tulip sleet I wonder if we need to make the Pin object smarter and encompass drive strength. maybe rename it Pad

tulip sleet
#

also pulls are usually independent of usage

manic glacierBOT
#

the only artifact is mpy-cross?

This must be a bug in the build matrix script.

@tannewt This PR exists to just make raspberrypi act the same way as espressif.

I understand that. My intention was to ask how that behavior was implemented on ESP. My goal is to remove the special case from the supervisor code. ESP doesn't need it and therefore RP2 shouldn't either. The wifi reset must happen in some other call on ESP and RP2 should copy that.

slender iron
brazen hatch
#

Is there a way to make sure a socket.send() has been ack'ed?
If I spam file parts at max speed, they arrive with missing parts, with no errors on the board side..

#

I had to add some nominal time.sleep()'s to make em arrive well.

#

time.sleep() however isn't the right way to ensure that.
Something like .send_with_ack() that checks the ack was good, like on the rfm stuff, doesn't exist for the socket stuff?

#

When sending small stuff it's all good, but as I begin sending files >20k, packets are lost..

#

512 byte chunks with sleep(0.02) is the best I could do reliable and with margin for hops

buoyant lagoon
#

what does socket.send() return?

brazen hatch
buoyant lagoon
#

and are you checking that the number of bytes sent, is the number you requested?

brazen hatch
#

it always returns the intended number, even if it fails?
lemme recheck to make sure

buoyant lagoon
#

if the buffer only has room for 500 bytes, and you try to send 1000 bytes
it will send the first 500 bytes, and then return 500

brazen hatch
#

Oh it does indeed report lower numbers on failures..

buoyant lagoon
#

so you need to retry the send, with the tail end of the buffer

brazen hatch
#

It is always the last bytes?

#

Well, I guess it's easy enough to just retry and check if the sums match

buoyant lagoon
#

when it returns 832, that means it sent the first 832 bytes of the buffer you gave it

#

so you need to cut the first 832 bytes off, and send the remainder

brazen hatch
#

lemme try that

buoyant lagoon
#

you likely also dont need to stick to 1024 byte blocks

#

just try to send your entire jpeg in one shot

#

and then discard however many bytes send sent

#

and keep trying with whatever is left

brazen hatch
#

HOHOHO

#

it not only worked flawlessly

#

but got a speed of 200kb/s!

brazen hatch
#

it did around 2 pages of retries, all of which are 832 for some weird reason.

buoyant lagoon
#

there are ~3 layers of buffering that are going on

#

first, there is however big the buffer is on the sending device, it usually has a max size, to prevent using all ram

brazen hatch
#
dat = f.read(self.tx_size)
if not dat:
    break
res = 0
while res != len(dat):
    try:
        if res:
            print("Retry:", res)
        res += self._data_socket.send(dat[res:])
    except OSError:
        pass
buoyant lagoon
#

then there is the packets that are in-flight on the network

#

but an in-flight packet may be dropped, so it has to keep a copy in the tx buffer, until it gets an ACK

#

the more data in-flight, the higher the latency when you drop a packet and have to re-send all of the in-flight data

#

a normal TCP stack will adjust the "tcp window" to minimize the packet loss

#

and then there is the rx buffer on the receiving side

brazen hatch
#

I have never made it that deep into the esp source.
Tysm for sharing all of this info with me!

stuck elbow
#

only as much as you want to send

brazen hatch
stuck elbow
#

ah ok

buoyant lagoon
#

i assume thats inside another loop?

#

and is reading 1024 byte chunks

stuck elbow
#

but you can further improve it by using a memoryview for that slice

brazen hatch
brazen hatch
buoyant lagoon
#

the linux end is likely reading fast enough that the buffer never fills

brazen hatch
stuck elbow
brazen hatch
stuck elbow
#

unless it's on a memoryview

brazen hatch
#

ah k

#

I will eventually try to learn memoryview

#

maybe once I finish the module and try converting it to C to add it to the core

buoyant lagoon
#

write() on linux behaves the identical way when in C

#

and most MCU stuff like circuitpython tends to try to copy that behavior

desert yarrow
#

Does anyone know if USB Host support is included in CircuitPython?

buoyant lagoon
#

depends on the board i think?

desert yarrow
#

rp2040 / Adafruit has a USB Host board

#

Pico W

brazen hatch
#

I don't see it in the list

#

maybe it's frozen, maybe it's not

#

usb_host it is iirc

#

so if it's not in here, it prolly isn't on any other

desert yarrow
#

"Currently, support for the USB Host peripheral is only in Arduino. So check out the TinyUSB ‘dual role’ examples for some things you can do"

#

(from that link)

brazen hatch
#

Eh that's out of date..

desert yarrow
#

(promising, then!)

#

?

brazen hatch
#

yea, lemme check the source

desert yarrow
#

thx

brazen hatch
#

answer: it does

#

I can see it init the usb port from boot

#

so it certainly does have it

#

It could be though, that 8.2 doesn't have it but the current main does

desert yarrow
#

Oh wow!!!

#

Thank you guys for helping to look this up!

brazen hatch
#

No problemo, Idk much on the topic, but glad I could help!

desert yarrow
#

CircuitPython 8.2.5 Latest was just released 3 hours ago, so it's probably in there

buoyant lagoon
#

i recently build circuitpython from source, for the regular rp2040 pico, and wired a usb cable to the right gpio pins, and was able to do usb host, i think i just had to run 2 lines of python

wraith crow
#

Certainly worth checking, but CP is currently developing both the 8.x line and the 9.x line so if it doesn't seem to be in 8.2.5 grab the firmware from the "Absolute Latest" link

desert yarrow
brazen hatch
#

Well, it could be that just the boot stuff wasn't backported idk

#

I was busy studying for exams while the usb stuff was going on

#

so missed all the commits

desert yarrow
#

heh -- ok

brazen hatch
desert yarrow
#

Excellent!!!

#

Do you know when 9.x is "likely to be released"?

#

It is a few days or a few months-ish?

brazen hatch
#

months-ish more like

#

I have only been here since 7.0 so I have only witnessed the 8.x development cycle

#

9.0 will be a little bit messier, and we are right at the start

desert yarrow
#

Ok, good to know

brazen hatch
#

so, yeaaaa

desert yarrow
#

hah... ok, cool

#

Holy smokes the github diff between 8.2.5 and the main branch is massive

brazen hatch
#

Ya, it's like using debian vs arch in terms of updates.

#

I track main for that reason. (I use arch too btw)

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.4 on 2023-08-22; S2Mini with ESP32S2-S2FN4R2
(also on an S3Mini with 8.2.4, too)

Code/REPL

import board
import pulseio
from time import sleep

pulse_in = pulseio.PulseIn(board.IO9, maxlen=120, idle_state=True)
pulse_in.pause()

pulse_in.clear()
pulse_in.resume(1000)
sleep(0.25)
pulse_in.pause()
while pulse_in:
    print(pulse_in.popleft())

pulse_in.deinit()

Behavior

Running the abov...

manic glacierBOT
#

There's not a helper for unsigned int types that I could find. I'd added one in an earlier commit as mp_obj_get_uint, but that involves a change to py which is undesirable. So, I've moved its code inside memorymap_addressrange_make_new. If you've got second thoughts about this approach, it's no trouble to move it back out to py/obj.c.

It turns out that the "start must be an int" message can be done away with entirely by attempting object conversion to an int by means of `mp_unary_o...

tulip sleet
manic glacierBOT
stuck elbow
#

I made a new clone of circuitpython, and I'm trying to run fetch-all-submodules, and both in main and in 8.2.x it errors with missing commits in a number of submodules. What am I doing wrong?

manic glacierBOT
brazen hatch
#

May I suggest remove-all-submodules?

#

Then start over.

#

I could have just been gith being weird

mortal kernel
stuck elbow
mortal kernel
stuck elbow
#

it suddenly works again

#

seems like this was github's problem

manic glacierBOT
mortal kernel
stuck elbow
#

shift+enter

mortal kernel
manic glacierBOT
manic glacierBOT
orchid basinBOT
orchid basinBOT
manic glacierBOT
#

CircuitPython version

8.2.4 + 9.0.0-dirty from end of august (before final certs submodule change as part of resolving #8299 )

Code/REPL

import ssl
context = ssl.create_default_context()
data = MY_CA_DATA # some pem string or bytes from a file of single cert or bundle (was testing bundle)
context.load_verify_locations(data)

Behavior

Reports extra arguments given: 1

Description

No response

Additional information

Supplying the ar...

#

CircuitPython version

All

Code/REPL

import ssl
context = ssl.create_default_context()
data = MY_CA_DATA # some pem string or bytes from a file of single cert or bundle (was testing bundle)
context.load_verify_locations(data)

Behavior

If a path is passed, via ca_path named argument, or a certificate (or bundle of certificates) is passed in PEM format using the named argument cadata/ca_data then it should be accepted, and the bundle should be us...

#

I can replicate on test hardware here: Matrix Portal M4. Don’t even need to run code…issue is visible in the REPL display.

This is a photo of 8.2.5 but it’s basically the same as what’s seen w/8.2.2:
matrix-circuitpython

Meanwhile, an Arduino example w/current Protomatter lib (1.6.1), rock steady:
![matrix-arduino](https://github.com/adafruit/circuitpython/assets/887611/74ded7e4-c612-4bb5-...

orchid basinBOT
tidal kiln
tidal kiln
#

i did add a print(len(i)) at some point. i think it was like ~73 on first pass, and then 512 after that. chuck_size is 512.

strange spoke
#

@crimson ferry re the seeed esp32s3 board definition for Circuit Python, Matthew from Seeed is the person in charge of that wiki program I mentioned in the thread on their discord to potentially reach out re: as a contact for the vid and pid you need there. He is very responsive via email and includes his email in his github portfolio. He may be a good person to reach out to for the remaining board aspects.

I was hesitant to say more on their discord, as silly as it sounds, as I had seen an earlier ask they had from that program to implement CircuitPython for this board and it was marked as done / someone did it in a generic way vs the board definition and I didn't want to call out the deficiency in a public way shaming the dev (weird anxiety thing of mine) https://github.com/Seeed-Studio/wiki-documents/issues/327 given their callout specifically to support this board on this platform I think he'd be happy to have you reach out to discuss it further though to get the last bits in place.

tulip sleet
manic glacierBOT
tidal kiln
manic glacierBOT
#

Do all boards which have a drive strength option specify it in mA?

I think in some way they do, though it's tricky, since the total current that's sinkable could be less than the sum of the pins due to power bus issues.

What should drive_strengths be for boards which don't have the option?

It would be a 1-tuple that is the rating for the pin.

tulip sleet
midnight ember
#

disable_concurrent_write_protection sounds dangerous. was that being used? if you pull the power during a file write yes it will absolutely corrupt files on the sdcard. it should not corrupt circuit python.

tidal kiln
manic glacierBOT
#

And where should it go (like I was saying, DigitalInOut seems a little odd).

Drive strength, pull settings, etc. are not just GPIO, but right now a Pin is just an immutable identifying object. @tannewt had an idea of refactoring this somehow so that a, sya, Pad object would carry the current settings. But that is a big change to the current API.

midnight ember
#

part of the problem might be related to running 8.2.4? try with 8.2.5?

tulip sleet
midnight ember
#

since it's an online script if it failed halfway and didn't complete the chunks, it might be possible to corrupt an unfinished file?

tulip sleet
#

does it reset with an open file?

midnight ember
#

seems as if it's pulling from an api url though APIURL = "https://openaccess-api.clevelandart.org/api/artworks?cc0=1&has_image=1&indent=2&limit=1&skip="

#

with 8.2.4 the adafruitio part of the script would likely work but the clevelandart.org url might decide not to.

brazen hatch
#

I just got the ftp STOR command working (put)..
But writing is so slow!

---> STOR IMG_2023-03-29-14-56-39-732.jpg
150 Opening data connection for IMG_2023-03-29-14-56-39-732.jpg
226 Transfer complete
1067934 bytes sent in 60 seconds (17.4 kbytes/s)
ftp> 
---> QUIT

That is on a dio flash board, and I cached the writes.
I made 2 bytearrays, one for rx and one for storing chunks of the file as to not write too often.
I think I will remove all the caching code, since the gain is pretty minimal from gathering many writes.

#

But I at least got to learn memoryview

tidal kiln
#

same issue happens with 8.2.5

#

as well as 7.3.3

#

6.3.0 works

tulip sleet
tidal kiln
tulip sleet
#

or something like that

#

i'm trying to reduce the amount of code that leads up to that... Since you said a simpler example is not failing.

#

is the network code somehow interfering with the SD writes (which use SPI)

tidal kiln
#

looking...can comment the fetch...but then it needs something to iter on in the write loop....

#

not sure. don't think so? at this point it's done the fetch, and now it's just writing to sd.

tulip sleet
#

so you tried extracting the SD mounting, and the write loop, and it didn't fail?

tidal kiln
#

yah. a very simple sd card write example. that mounts, opens file, loops and writes bytes.

#

worked

tulip sleet
#

are the chunks determined by the fetch? Is the data coming back in chunks from the website, or is it all concatenated?

#

if the latter, you could replace the request.get() with a string assignment

tidal kiln
#

lots of layers. and a mix of frozen modules, etc.

#

i'm overriding the frozen portalbase for testing

#

by placing lib in root folder

#

(wasn't frozen in 6.3.0)

tulip sleet
#

is it using sdcardio or adafruit_sdcard?

tidal kiln
#

sdcardio

tulip sleet
#

could try substituting adafruit_sdcard and see if it's the same. Are you using one of the 512MB cards or some random 2GB,etc. card?

tidal kiln
#

using 16G card formatted FAT32

#

CP 6.3.0 had no issues writing to this SD card

#

could even remove and view BMP on PC

tulip sleet
#

is it writing to the display? Could disable the display

#

maybe some interaction between SD card SPI and display SPI

tidal kiln
#

lemme try that...

#

disable display how?

tulip sleet
tidal kiln
#

not simple, since that's happening in side pyportal/portalbase libs

tulip sleet
#

how about no background image, don't add "circle" to splash; comment out the circle update code

#

response = pyportal.fetch(APIURL + str(itemid)) replace that with something static that's not a fetch

midnight ember
tidal kiln
tulip sleet
#

response = "some long bytestring the same length as what was sent"

#

simulate the fetch

midnight ember
#

replicate what the response should be so you can feed it data locally

tulip sleet
#

could just be [1] * reponse_length, kind of like what you did before

tidal kiln
#

that'll just not call the offending code?

tulip sleet
#

not call pyportal.fetch(). I want to see if the network fetch is causing a problem.

#

And if it still fails, that helps reduce the example.

#

and also take away messing with the display (the cicle thing). But try one thing at a time.

#

just divide and conquer

tidal kiln
#

been doing that since yesterday 🙂

#

i think i'm just going to label that guide as works with 6.3.0 only

tulip sleet
#

fer sure for now!

tidal kiln
#

there's tons of intermingled automagic happening in the pyportal/portalbase libs. it's a convoluted divide/conquer

tulip sleet
#

can open an issue with a summary of all this, just point to the forum thread, say the code in use, and the versions that work/don't work. It would be a circuitpython issue, should raise an error there

#

what error does it actually raise?

#

it doesn't sound like a hard crash

tidal kiln
#

oserror 5?

tulip sleet
#

sure include that

midnight ember
#

here's an example response url as far as i can tell https://openaccess-cdn.clevelandart.org/1962.154/1962.154_web.jpg

#

it parses the json for the path https://openaccess-api.clevelandart.org/api/artworks?cc0=1&has_image=1&indent=2&limit=1&skip=69

manic glacierBOT
#

Minor updatelet: looks like Arduino and CircuitPython are both compiling with -Os, but with Arduino using GCC 9.2.1 and CircuitPython using 10.2.1…so there might be differences in the generated code.

As a quick last-ditch thing, I’ve declared certain vars as volatile in the innermost loop. This should prevent the optimizer from removing those lines. Confirmed on scope that Arduino timing is unchanged. As an alternative, in CircuitPython, exposing the duty cycle setter (_PM_setDuty()) mig...

midnight ember
#

will return json ["data", 0, "images", "web", "width"]

manic glacierBOT
#

CircuitPython version

Works with 6.3.0.

Tested the following versions and they show the issue:
* 7.3.3
* 8.2.4
* 8.2.5


Example banner from 8.2.5:

Adafruit CircuitPython 8.2.5 on 2023-09-07; Adafruit PyPortal with samd51j20


### Code/REPL

```python
Code is from Learn guide here:
https://learn.adafruit.com/cleveland-museum-of-art-pyportal-frame/code

Behavior

There is other output, including URLs that include API keys, so not adding that here. ...

midnight ember
#

seems like it's first checking the width of the image so it doesn't grab one that's 5101 px wide for example

#

i don't have a pyportal. this one seems right up my alley though. :/

#

foamyguy would be a good one for this

tulip sleet
#

@tidal kiln ok, thanks for the issue!

manic glacierBOT
tidal kiln
#

@tulip sleet thanks for taking a look and suggestions!

brazen hatch
#

The FTP server is almost done. Should I open an issue for us to discuss if and how it's getting in the core?
We could very well decide to just freeze it due to how big it turned out. But that would mean no ftp-web-workflow.

slender iron
brazen hatch
#

That's a valid option alright. I was just asking, cause it would be interesting if we could get it to be a web-workflow alternative mode.

jaunty juniper
#

for web workflow, I think it would be easier and much smaller to expand the current implementation with a few commands to make it webdav compatible

manic glacierBOT
brazen hatch
manic glacierBOT
jaunty juniper
#

(modern UI FTP clients generally support webdav too)

brazen hatch
jaunty juniper
tidal kiln
brazen hatch
#

Well I guess, it sounds pretty counterproductive, shoving 20k of code into core if webdav is a few command implementations away..

slender iron
#

the brass standoffs worry me a little

brazen hatch
#

I can take a look at webdav after this.

#

And perhaps fix the remote shell which never worked and made me implement telnet

#

Jokes aside, soon enough I will have almost all the common coreutils and programs a old linux distro would have running in circuitpython..

manic glacierBOT
wraith crow
#

Do you have the FTP client side built yet, with the direction boards are going to support local displays and keyboard input I'd actually be more interested in reaching out from the microcontroller for files rather than the other way around

brazen hatch
#

It's just that even having read RFC959 (twice), I still haven't understood all the commands.

#

The client is basically the same code in reverse.
Since the data sockets and stuff also need to made, all the same code would be there.

#

The messages would just be different

#

tbh, I made the ftp server just to be able to have "usb" on non-native usb boards.

#

I love my M5Stack timer camera.

#

But developing code without native usb is such a pain.

#

with filezilla I can just have a local copy and sync

#

Bruh.. bytes(memoryview(self._rx_buf)[:size]).decode(_enc).split(" ")[0].replace("\r\n", "").lower()

slender iron
#

anyone disagree with setting the default RTD version to 8.2.x for now?

brazen hatch
manic glacierBOT
manic glacierBOT
#

Do all boards which have a drive strength option specify it in mA?

No, not necessarily. Some parts give you the option of "normal" and "strong" or similar language. As @HelenFoster pointed out, drive strength is not a limit on the amount of current the pin will drive. From my research, I've determined that it is the current limit at which VOH is guaranteed to be met. My experiment on the RP2040 that I detailed above shows that for at least that part the drive strengths are very conservat...

manic glacierBOT
tulip sleet
manic glacierBOT
#

CircuitPython version

I use latest version (8.2)

Code/REPL

# microcontroller - sender
import sys
import time
from ulab import numpy as np
import board
import busio


uart = busio.UART(board.GP4, board.GP5, baudrate=2000, timeout=0)

def sending(data):
    
    uart.reset_input_buffer()
    time.sleep(0.001)
    uart.write(data)
    time.sleep(0.001)
    return print(data)

k = 1
while k < 50:
    
    data = np.zeros((3, 3), dtype=np.ui...
manic glacierBOT
manic glacierBOT
#

The baud rate is very low and is also non-standard. Did you try, say 1200, and 9600?

If you set the timeout to 0, then .readinto() will only read as many characters as are available. It will not wait for the whole array to fill. It returns how many bytes it actually read. Add print statemtns to see what .in_waiting and .writeinto() return.

Are the two boards connected to have a common ground?

manic glacierBOT
manic glacierBOT
#

I am not associated with M5Stack.

AtomS3U is very similar to already supported board AtomS3 Lite, so large portion of this PR is taken from https://github.com/adafruit/circuitpython/commit/89bd5fae616ec6d403d820bb470a5375789ccf5d

Datasheet https://docs.m5stack.com/en/core/AtomS3U
USB IDs taken from https://github.com/espressif/usb-pids/blob/60f612f5e2e177104382a009e7b787fc463c18d1/allocated-pids.txt#L399

I used AtomS3 Lite bootloader (as LED and button pins match and controller is t...

manic glacierBOT
manic glacierBOT
#

Does CircuitPython do anything with the pin drive strength? Arduino on SAMD always sets PORT_PINCFG_DRVSTR (stronger drive strength) on all GPIO. If this is not the default behavior of CircuitPython, perhaps it could be added to the _PM_pinOutput macro so it’s applied to all Protomatter pins.

CircuitPython does not do anything with the pins except pass them on to _PM_init(). It does use high drive strength for DigitalInOut, but not for RGBMatrix.

#

MicroPython's machine.Pin object is more like a Pad, though it has some other things that are closer to the hardware than we might want to expose.

I want to emphasize that this would be a really big potentially incompatible change. It should still be really easy to use pins, and some backward compatibility would be needed. Also any complication of how pins/pads are treated would still need to fit in the smallest ports like SAMD21. This is not something to do lightly just to handle a sm...

#

OK @phantomsixthplayer, here’s a quick-n-dirty thing to try. Add this before declaring the matrix:

for pin in [ board.D8, board.D9, board.D10, board.D11, board.D12, board.D13, board.D4, board.D6, board.D3, board.D5, board.D1, board.D2, board.D0 ]:
    foo = digitalio.DigitalInOut(pin)
    foo.direction = digitalio.Direction.OUTPUT
    foo.deinit()

From what I can tell, looks like deinit() doesn’t reset a pin’s drive strength. So in theory this will set each pin to high streng...

#

@PaintYourDragon

adafruit-circuitpython-grandcentral_m4_express-en_GB-8.2.5.uf2

displayio.release_displays()

for pin in [ board.D8, board.D9, board.D10, board.D11, board.D12, board.D13, board.D4, board.D6, board.D3, board.D5, board.D1, board.D2, board.D0 ]:
    foo = digitalio.DigitalInOut(pin)
    foo.direction = digitalio.Direction.OUTPUT
    foo.deinit()
    
matrix = rgbmatrix.RGBMatrix(
    width=64,
    height=32,
    bit_depth=4,
    rgb_pins=[board.D8, board.D9...
manic glacierBOT
#

This is the order I uploaded the firmware:
adafruit-circuitpython-grandcentral_m4_express-en_GB-8.2.2.uf2
adafruit-circuitpython-grandcentral_m4_express-en_GB-8.2.3.uf2
adafruit-circuitpython-grandcentral_m4_express-en_GB-8.2.4.uf2
adafruit-circuitpython-grandcentral_m4_express-en_GB-8.2.5.uf2
gc4-rgbmatrix-fix.uf2

import displayio
import rgbmatrix
import board
import framebufferio
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
im...
#

OK. I can’t be certain whether CircuitPython is fully resetting the pin on deinit(), it was just a quick hack to try in that it might have left high-drive enabled. CircuitPython is big and I’m not deeply involved in it.

Regardless…without level shifting in the circuit, this is a design problem, not a software bug. That it showed some success in a prior release is “stars aligning” and not an engineered solution. I’ll spend a little more time and see if I can work drive strength into the l...

crimson ferry
#

@blissful dragon what board?

#

Pico W?

#

what's the content of the boot_out.txt file on CIRCUITPY?

#

you need the Pico W UF2, that's the regular Pico... no wifi

manic glacierBOT
crimson ferry
#

I don't know that stuff very well... but it works on the regular Pico UF2? that would be strange

#

the only differences are the wifi module, and a couple of subtle pin differences

#

2.1.0?

#

not too many people around right now, I'd suggest post the question in #help-with-circuitpython now or in the (U.S.) morning, and see if someone can help

#

it is, timing varies depending on the change and how extensive, who has expertise to review etc

#

yes, definitely odd... it's never a guarantee that a close firmware will work on a board with more features, but usually it's OK (some things might not be accessible or have the right names)

#

CP is in an awkward interval right now... working on 9.0.x (main), and having to backport critical changes to 8.2.x

#

you can always grab latest from the downloads page

manic glacierBOT
#

Right, maybe this is too big and too deep for a proper fix. For ports with memorymap support, it's possible to manipulate pad settings without the need for any additional changes. In the documentation embedded in the RP2 memorymap support, there is example Python code for reading and setting pad drive strength that can be easily adapted for nRF. Ditto for other pad attributes. Maybe just call that the answer and close this issue?

midnight ember
#

Anecdata, it's 2am so not tagging. How did you get the markdown to do a collapsible arrow? That's a really nice feature I think should be added to the default issue report template. That helps make an issue report filled with code examples much easier to digest. https://github.com/adafruit/circuitpython/issues/8381

midnight ember
#

I will be doing this from now on. Would like to see it added to the base issue reporting template.

manic glacierBOT
manic glacierBOT
#

Here is a simplified version of the Cleveland Museum code that can be used to demonstrate the issue:

import board
from adafruit_pyportal import PyPortal

WIDTH = board.DISPLAY.width
HEIGHT = board.DISPLAY.height

APIURL = "https://openaccess-api.clevelandart.org/api/artworks?cc0=1&has_image=1&indent=2&limit=1&skip=1234"

pyportal = PyPortal(
                    image_json_path=["data", 0, "images", "web", "url"],
                    image_dim_json_path=(["data", 0, "imag...
manic glacierBOT
#

You are aware of the flash access time limits? You are aware of the RAM arbitration limits?

There is no real way to count cycles in cooperative 32-bit processor beyond 25-50MHz in most that I have seen. Closest you can do is with RAM function using bus arbitration promoting CPU. (Variable CPI, like Von Neumann and like Harvard.)

Protomatter belongs on dedicated processor. I would presume CircuitPython will ditch Protomatter eventually or recommend against it. This would allow better ce...

#

You are aware of the flash access time limits? You are aware of the RAM arbitration limits?

There is no real way to count cycles in cooperative 32-bit processor beyond 25-50MHz in most that I have seen. Closest you can do is with RAM function using bus arbitration promoting CPU. (Variable CPI, like Von Neumann and like Harvard.)

Protomatter belongs on dedicated processor. I would presume CircuitPython will ditch Protomatter eventually or recommend against it. This would allow better cen...

manic glacierBOT
manic glacierBOT
#

@dhalbert I’ve added some code in arch/samd51.h that in theory enables high drive mode on all Protomatter pins (static function _hi_drive()).

HOWEVER…it makes an assumption about pin numbers that might not be correct. I’ve dug a few layers down into CircuitPython source but you could probably answer this in like 12 seconds…

I don’t know how pin indices (as stored in the core structure) map to hardware in CircuitPython…whether it’s fairly direct or if these go through a table (as in Ar...

manic glacierBOT
mortal kernel
#

IEEE Spectrum ranks Python the number 1 programming language for 2023. A quote from the article for the hard working CircuitPython develpers to savor, "And although Moore’s Law is winding down for high-end computing, low-end microcontrollers are still benefiting from performance gains, which means there’s now enough computing power available on a US $0.70 CPU to make Python a contender in embedded development, despite the overhead of an interpreter. Python also looks to be solidifying its position for the long term: Many children and teens now program their first game or blink their first LED using Python. They can then move seamlessly into more advanced domains, and even get a job, with the same language."

onyx hinge
#

can someone double check me? This is not correct usage, right? you might write Union[A, B] or A | B but writing Union[A | B] is .. redundant?

#

in this docstring in the core: //| hostname: Union[str | ReadableBuffer]

lone axle
stuck elbow
#

I think both are correct, just mean different things

#

technically correct, anyways

#

Union[A | B] would be equivalent to Union[Union[A, B]] which basically means the same thing as A | B

onyx hinge
#

Yes, that is my understanding as well, and much better put/explained

manic glacierBOT
#

Add an (expired) root cert, DST Root CA X3, to the roots cert list to handle the special way Let's Encrypt does its root cert. See details here: https://github.com/adafruit/certificates/pull/1.

This cert was present in the older NINA-FW list. It was removed when the roots cert bundle was completely reworked in #8374. But mbedTLS does not seem to work properly with the Let's Encrypt scheme without this cert.

Discovered by @BlitzCityDIY while using site.api.espn.com.

slender iron
thorny jay
#

Initially posted on the live channel by mistake:

Sorry, skipping the meeting without notes... my poor non CP excuses:

  1. There is/was a heatwave over Belgium
  2. School and sport restated with timing incompatible with the weekly meeting
  3. Part of the week-end I have been trying to be friend with the AI and the robot by carefully placing a perimeter cable around the garden, but the landmower robot has been sabotage it by cutting the wire (a luddite would not have done a better job)... and now it refuse to obey because it felt a bit of rain!
mortal kernel
#

Wondering if there are any outstanding CP issues that I could lend a hand with? I'm well tooled up for RP2040 and enjoy low-level detail oriented issues. Would really love to help.

slender iron
manic glacierBOT
slender iron
#

multicore, run C blob on second core could be interesting

#

bigger and less clear

mortal kernel
#

Thanks! I'll take a closer look at 4106 and 7990. 4106 looks especially interesting.

slender iron
idle owl
#

@slender iron Turns out the issue started on GitHub, and they suggested contacting them through their support page (https://readthedocs.org/support/). I ended up talking to Eric, and then another person took care of the needed changes. I would suggest using the support page as it definitely got me to the right folks.

#

👍🏻

mortal kernel
#

Link to meeting notes, please?

slender iron
lone axle
turbid radish
#

If you have news, projects, updates, & more - please send them to cpnews@adafruit.com for the next newsletter

onyx hinge
lone axle
turbid radish
#

Congratulations Kattni! We will miss you but it's exciting to see your next steps!

modern wing
#

🎉 Congrats, and the absolute best of luck in everything that comes next!

solar whale
#

Congratulations Kattni!! Best wishes! Thank you!

gilded cradle
#

Congratulations @idle owl

idle owl
#

Thank you so much, everyone! 😊

ember iris
#

Congratulations, and thank you for having been such a pillar in this community! A lot of how welcoming this community is is thanks to the effort you've put into it!

modern wing
#

Your guides have been an amazing welcome to so many newcomers to CircuitPython.

#

And helping run the newsletter, and the meetings, and all the other product guides, and building this Discord, and bringing in so many absolutely wonderful people to this community....you're an awesome community architect 💜

solar whale
#

AC in Seattle -- who'd a thought ....

#

We need it now in NH as well!

thorny jay
#

Whoa, that is breaking news...
I have so much to say.
I guess most of us have seen you create and improve this community... but we have also seen you make your first board, your first contribution to the core and so many other steps where you improved the range of your skills.
This place would not be what it is now without everything you did.
Good continuation @idle owl

idle owl
#

@thorny jay Thank you. I really appreciate your words. ❤️

onyx hinge
#

ooh gamma correction.

thorny jay
#

About @devout jolt in the weed... Is that for flashing from a computer or flashing from a smaller board like LadyAda testing board? Having a Feather RP2040 USB Host do that job would be great!

slender iron
#

computer I assume

thorny jay
onyx hinge
#

also yay it's important we have someone who has run an adabot patch actively involved

candid sun
#

thanks for hosting @slender iron

modern wing
#

Thanks for another excellent meeting!

gilded cradle
#

Thanks everyone

lone axle
#

Thanks for hosting Scott, have a great week everyone.

ember iris
#

Thanks all, have a great week!

slender iron
#

you all are welcome! thanks for meeting up!

onyx hinge
#

for some reason a very old pi -- is it a pi 1? -- has surfaced on my desk. (c) 2011.12

main furnace
#

It belongs in a museum.

slender iron
onyx hinge
#

@slender iron do I repeat the "Adafruit" name in both the USB manufacturer & product? ```USB_PRODUCT = "Adafruit-Qualia-S3-RGB666"
USB_MANUFACTURER = "Adafruit"

thorny jay
onyx hinge
#

@slender iron is there any big problem changing the USB_PRODUCT string after the fact? There are apparently a handful of Adafruit boards that do this.

#
espressif/boards/adafruit_feather_esp32s3_4mbflash_2mbpsram/mpconfigboard.mk
espressif/boards/adafruit_feather_esp32s3_nopsram/mpconfigboard.mk
espressif/boards/adafruit_qtpy_esp32s2/mpconfigboard.mk
```plus the one I'm alreayd renaming
slender iron
#

I don't think so...

#

we'll find out 🙂

onyx hinge
#

I wonder if the first 3 were specifically due to there also being the Unknown Maker Feather S2/S3

devout jolt
onyx hinge
#

I don't think I'll change the others right now

manic glacierBOT
mortal kernel
#

I'm seeing something weird when cloning the CP repo. Lots of "multiple configuration" messages like this:

warning: 01cabb0324186808c14ec1b02fb8a3be28837160:.gitmodules, multiple configurations found for 'submodule.lib/axtls.path'. Skipping second one!
warning: 01cabb0324186808c14ec1b02fb8a3be28837160:.gitmodules, multiple configurations found for 'submodule.lib/axtls.url'. Skipping second one!
#

gh repo clone eightycc/circuitpython circuitpython-82x

slender iron
#

I haven't seen that before

mortal kernel
#

It's just happening when I clone my fork. Think I'll try to delete it and fork again.

slender iron
#

I usually use raw git

#

Here is the notes document for next Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - 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/1J0mv2qVnfBwjg4DZj47JYn-WPQI68thUqp8ZYfr14fs/edit?usp=sharing

mortal kernel
#

Deleting my fork and re-forking fixed the problem.

manic glacierBOT
#

@phantomsixthplayer I duplicated your setup, more or less:

  • Grand Central M4
  • Exactly the same pins as you are using; no outboard level shifting (3.3v pins)
  • power (only) supplied via MatrixPortal S3 panel power screw terminals and cable, so panel power is from a second USB port
  • Same font display test program that you supply above. Also tried a scrolling text program....
manic glacierBOT
manic glacierBOT
#

I've set up a small test jig that can reproduce the problem. I borrowed a simple keyboard HID emulator from here https://learn.adafruit.com/circuitpython-essentials/circuitpython-hid-keyboard-and-mouse and modified it slightly to work with a Pico W. I put these lines from @dhalbert into boot.py:

import usb_cdc
import storage

storage.disable_usb_drive()
usb_cdc.enable(console=False)

Plugging this into a cold RP 4 fails, but plugging it in when the RP 4 is booted works. I...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

CircuitPython version

I'm using the latest version 8.2.4 on both Pi Pico

Code/REPL

# same code into both microcontrollers
import busio
import board
from adafruit_bus_device.i2c_device import I2CDevice

i2c = busio.I2C(board.GP3, board.GP2)
while not i2c.try_lock():
    pass
ad = i2c.scan()
print(ad)

Behavior

Hello. I'm trying to connect two Raspberry Pi Pico microcontrollers using i2c.

I'm scanning the i2c bus using scan(). I loaded t...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

One board needs to run a board that uses the "i2ctarget" module. there is a simple example shown in the documentation. https://docs.circuitpython.org/en/8.2.x/shared-bindings/i2ctarget/index.html

import board
from i2ctarget import I2CTarget

regs = [0] * 16
index = 0

with I2CTarget(board.SCL, board.SDA, (0x40, 0x41)) as device:
    while True:
        r = device.request()
        if not r:
            # Maybe do some housekeeping
            continue
        with r:...
onyx hinge
#

I didn't see an I2CTarget guide on Learn...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.4 on 2023-08-22; TinyS3 with ESP32S3

Code/REPL

import time
import board
from adafruit_bus_device.i2c_device import I2CDevice


def read_i2c(send="123"):
    ret = "nothing"
    try:
        with board.I2C() as i2c:
            device = I2CDevice(i2c, 0x08)
            br = bytearray('yyyyyy', 'ascii')
            with device:
                print(f"sending {send}")
                device.write_t...
manic glacierBOT
onyx hinge
#

@tulip sleet I notice this in the git history: ec1e7a03b38c625664a4615e60d26956205d7a67 Reset UART on deinit, reduces power consumption

tulip sleet
onyx hinge
#

seems a likely candidate to introduce a subtle problem

manic glacierBOT
#

@furbrain Sorry to report that this issue is being caused by #8089, your UART power-saving PR. If I revert that the problem goes away. It appears that power-cycling the UART peripheral leaves something in a bad state.

For the next 8.2.x release, I am going to just revert #8089 for now, even though that will cause increased sleep current. It would be great to figure out the best way to do this.

#
[adafruit/circuitpython] New branch created: revert-8089-main
#

Thanks for the report.

I looked over your example programs for any problems and I did notice some things that are strange but I don't think they are probably the cause of the behavior you're seeing.

The first thing I noticed is apparent incorrect buffer use in your attiny firmware:

  char buf[6] = "xxxxxx";
  sprintf(buf, "%c      ", rcvd);

Handling strings & buffers in C is .. hard. I think code is incorrect, because C strings always include a trailing "NUL" byte. This me...

#

I saw the note about this work in the circuitpython newsletter. Just wanted to offer any help on performance of this, we've spent a LOT of time / code getting the same thing going in Micropython for TulipCC.

We're using ESP5.1-rc2 and running the SPIRAM at 120MHz. We're getting pretty stable 30FPS on full screen refreshes on a 1024x600 RGB dot clock display. We use the bounce buffers reading from a SPIRAM framebuffer that's bigger than the screen siz...

#

It's quite some years since I really coded in C, so yes I've been lazy.

The first buffer size mismatch is a fair cop - 7 bytes (rcvd, 5 * space, null terminator). But that said, it's sending 6 bytes over the wire, so whether there's a seventh \0 byte or not isn't the issue.

The second double assignment of the send buffer was down to me simplifying things to try and narrow the problem down and not bothering to remove the previous line.

'yyyyyy' in the buffer was putting somethi...

mortal kernel
#

I need REPL redirect to a UART. I've found mention of DEBUG_UART in 4761, but other than a mention in ports/stm/supervisor/serial.c there's nothing else in CP. Before I hack up my own, wondering if anyone has redirect code gathering dust somewhere?

manic glacierBOT
tulip sleet
mortal kernel
manic glacierBOT
tidal kiln
#

@tulip sleet just curious - any idea why the singleton uart worked? (for that nrf issue)

tulip sleet
#

so the new code in the PR never gets run

manic glacierBOT
#

Here is a simplified version of the Cleveland Museum code that can be used to demonstrate the issue:

I tried this code on a PyPortal with 8.2.5, and it's working for mepc . SD card is a SanDisk 4GB.

Adafruit CircuitPython 8.2.5 on 2023-09-07; Adafruit PyPortal with samd51j20
>>> 
>>> import test
Connecting to AP PBE2
Retrieving data...Reply is OK!
image dim: 969 893
original URL: https://openaccess-cdn.clevelandart.org/1973.160/1973.160_web.jpg
convert URL: https://io.adafru...
manic glacierBOT
#

Activated UART REPL by adding these lines to ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.h:

#define CIRCUITPY_CONSOLE_UART_TX (&pin_GPIO0)
#define CIRCUITPY_CONSOLE_UART_RX (&pin_GPIO1)

and then connected the UART through picoprobe. Here's what I get on a cold RP 4:

Serial console setup                                                                                     
Adafruit CircuitPython 8.2.5-1-g707120244c-dirty on 2023-09-12; Raspberry Pi Pico ...
tulip sleet
#

@cater the forum post user says they were using 1.7.5 ... hmm. I did circup update all my libraries too

tidal kiln
#

i had old fw. trying update now.

tulip sleet
#

the user said they had 1.7.5 but if they don't really that would cause the issue

#

we certainly should change the library code to prevent the red herring SD card message, which wasted a lot of time

manic glacierBOT
tidal kiln
#

@tulip sleet what if you use libs taken from bundle zip? still work?

tulip sleet
#

so that is what I updated to, without having to do it by hand

tidal kiln
#

right. but wondering if it could be a lib issue. and we aren't sync'd on that? someone following guide would just use bundle zip.

tulip sleet
#

I did not test the Learn example, just your simplified example

manic glacierBOT
#

Nina FW updated:

Adafruit CircuitPython 8.2.5 on 2023-09-07; Adafruit PyPortal with samd51j20
>>> import board
>>> from digitalio import DigitalInOut
>>> from adafruit_esp32spi import adafruit_esp32spi
>>> esp32_cs = DigitalInOut(board.ESP_CS)
>>> esp32_ready = DigitalInOut(board.ESP_BUSY)
>>> esp32_reset = DigitalInOut(board.ESP_RESET)
>>> spi = board.SPI()
>>> esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
>>> esp.firmware_version
bytea...
#
[adafruit/circuitpython] New tag created: 8.2.6
orchid basinBOT
manic glacierBOT
#

During HID initialization, adafruit_hid/keyboard.py tries to release all keys by means of self.release_all() and then tries once more if after 1 second. So, this clearly isn't going to cut it if there's a long delay between power-on and host enumeration. Thanks @dhalbert I was just going to search for such an animal as supervisor.runtime.usb_connected. Giving it a try now.

tidal kiln
#

@tulip sleet one thing to keep in mind is that the portalbase lib is frozen in. so it isn't latest. and isn't using what is in /lib.

manic glacierBOT
tulip sleet
#

@tidal kiln well, I only have .mpy libraries, and only in .lib

#

i just re-updated NINA-FW, and it's still working

#

testing 8.2.5 with your test program

#

does it work without an aio key?

tidal kiln
#

i'd think it'd fail trying to access it?

tulip sleet
#

yeah

tidal kiln
#

but on that point - my setup still has secrets.py instead of toml

tulip sleet
#

is there any possibility we are using different AIO servers which are set up differently

#

I have both secrets.py and settings.toml, updated with a new key. updating settings.toml did not help; I needed secrets.py

tidal kiln
#

64.190.63.111 for me

tulip sleet
#

hmm, hmm

#

could copy the library into the top level of CIRCUITPY and change io.adafruit.com to a numeric IP

tidal kiln
#

it pulls OK just copying URL into browser

tulip sleet
#

do you have a paid IO subscription? I don't

tidal kiln
#

no. just free one.

tulip sleet
#

@tidal kiln so nslookup io.adafruit.com returns 64.190.63.111 for you?

manic glacierBOT
tidal kiln
#

@tulip sleet hmmm...not anymore. now i'm getting 52.54.163.195

tulip sleet
#

I have no idea how they manage servers; maybe it is dynamic

#

I tried using curl and it's working fine with the given URL.

#

here is a simple test program for ESP32SPI; could modify it to test the time URL I just gave

tidal kiln
#

tried numeric ip. looks like maybe nina fw doesn't support that? dumps with an esp32 not responding on the fetch.

tulip sleet
#

the numeric IP doesn't match the cert, so it complains (I saw that when I tried the numeric IP in curl). So that won't work 😦

tidal kiln
#
Fetching text from https://io.adafruit.com/api/v2/time/ISO-8601
----------------------------------------
2023-09-12T15:22:51-04:00
----------------------------------------
#

worked

#

had to comment out the wifi scan

#

but otherwise, just change TEXT_URL to the aio time URL

tulip sleet
#

the wifi scan works for me

tidal kiln
#

nothing but hidden here. so got a nonetype on return. and didn't like it.

tulip sleet
#

I erased CIRCUITPY completely, added back your test program, and the needed libraries. Still works.

#

how fast is your internet? Mine is 300Mb up/down. It's slower through the wifi, but I have good wifi access points

#

i'm grasping at straws a bit

#

could you maybe try your phone as a hotspot?

tidal kiln
#

oh...i'm sad slow...like 5mbps down/0.5mbps up. best option i have out here.

manic glacierBOT
tidal kiln
#

@tulip sleet if you're suspecting something network, wouldn't it hit it also replacing the file write with a print?

manic glacierBOT
tulip sleet
tidal kiln
#

lemme try it again. pretty sure i did that days? ago. whenever i was originally troubleshooting.

#

only portalbase is frozen in. pyportal is coming from /lib.

tulip sleet
#

we should be using the same libs now

tidal kiln
#

you're using ones from bundle zip?

tulip sleet
#

circup is; it downloads the latest bundle

#

NOT from the Learn bundle

tidal kiln
#

ohh....sry....that's what i meant by bundle

#

the bundleflyblob thing

#

from learn

#

and i'm not actually sure what i have loaded right now, since have tried many things. i'm going to storage.erase and start over.

tulip sleet
#

try what I am using: your short test program, and circup-installed libs. I'll compare the libs

tidal kiln
#

(i'll need to install circup)

tulip sleet
#

the libraries differ only in adafruit_esp32spi/PWMOut.mpy (!)

tidal kiln
#

ERROR: Failed building wheel for circup

#

worth chasing this down? or can just use bundle zip?

tulip sleet
#

circup is really a time-saver; worth tracking down the issue at some point

#

maybe your desktop python is old

tidal kiln
#

it was something about setuptools versions. probably easy fix. but not now.

#

all of those taken from adafruit-circuitpython-bundle-8.x-mpy-20230912.zip

#

and then running simple test from GH issue thread

#

exact same issue

#

it consistently fails on the second pass through the iterator. note the single . that gets printed on first pass

#

going to try print instead of file write now

tulip sleet
#

are you using your short test program or the original program?

#

Never mind. I misunderstood. It's:

aving data to  /sd/cache.bmp
.............................................................................................................................................................................................................................................................................................Created file of 144138 bytes in 9.0 seconds
tidal kiln
#

using short test program from GH issue

#

@tulip sleet do you have both secrets.py and settings.toml on the PP?

tulip sleet
#

yes

#

I can take one away

tidal kiln
#

try removing toml

tulip sleet
#

it was empty

#

now it's gone

tidal kiln
#

ok. try running again.

tulip sleet
#

still works

manic glacierBOT
#

@dhalbert This was a crash I found as I was seperating wifi-autoconnect from web-workflow. In the rush of things, as I was testing edge cases, I assumed it's a side effect of my changes and fixed it. It went in main with that pr.
After seeing this issue however, I realized it was broken all along.
I offered to backport just the fix, but since it was deemed unimportant, I took no further action.

manic glacierBOT
tulip sleet
slender iron
#

@tulip sleet do you have an ssl test script?

tulip sleet
slender iron
#

it'd be handy for idf 5 testing. yup

tulip sleet
#

You may need to comment out some of the fetches. I get memory errors sometimes if they are all executing. This is the usual test script, + adafruitIO + a Let's Encrypt site

manic glacierBOT
#

@tannewt Two places to look: (1) for DDR 120MHz PSRAM you need "octal flash", which are the modules that say OT in this chart
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/esp32s3/user-guide-devkitc-1.html#ordering-information

(2) You want to see this list of "groups" of settings: https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-guides/flash_psram_config.html#f8r8-hardware

Note that the N8R8 in (1) is OT PSRAM but "only" quad flash -- wh...

tulip sleet
#

@slender iron I started to do that 8.2.x PR too, but it has merge conflicts

slender iron
#

want me to fix them or do you?

#

I want to rebase my idf5 changes on it since it has the pin in use fix

tulip sleet
#

i was going to do a local PR from my fork, yeah, I can do it if you just want to close it

manic glacierBOT
#

Something to consider about module _thread in CPython and MicroPython is that they do not offer concurrent execution of Python code on multiple cores. The interpreter implementation is such that it can run only on one thread at time under the control of the GIL (Global Interpreter Lock). Quote from the CPython documentation:

CPython implementation detail: In CPython, due to the Global Interpreter Lock, only one th...

manic glacierBOT
#
[adafruit/circuitpython] New branch created: 8.2.x-to-main-2023-09-12
#
[adafruit/circuitpython] New branch created: 8.2.x-to-main-20230912
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

This is possibly SD card related. :(

Since the one used above worked when reverting to an older version of CP, it was considered OK. However, just did the simple check of swapping to another SD card - and it now works! Running simple test from above:

Reply is OK!
Saving data to  /sd/cache.bmp
.........................................................................................................................................................................................
manic glacierBOT
crimson ferry
#

where do the CIRCUITPY_CREATION_ID come from for non-USB boards?

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.1-39-g3032d4e7d5 on 2023-09-13; M5Stack Timer Camera X with ESP32

Code/REPL

import espcamera, board

a = espcamera.Camera(data_pins=board.D, pixel_clock_pin=board.PCLK, vsync_pin=board.VSYNC, href_pin=board.HREF, i2c=board.SSCB_I2C(), external_clock_pin=board.XCLK, external_clock_frequency=20_000_000, powerdown_pin=None, reset_pin=board.RESET, pixel_format=espcamera.PixelFormat.JPEG, frame_size=espc...
manic glacierBOT
#

Tested with:

a = espcamera.Camera(data_pins=board.D, pixel_clock_pin=board.PCLK, vsync_pin=board.VSYNC, href_pin=board.HREF, i2c=board.SSCB_I2C(), external_clock_pin=board.XCLK, external_clock_frequency=20_000_000, powerdown_pin=None, reset_pin=board.RESET, pixel_format=espcamera.PixelFormat.JPEG, frame_size=espcamera.FrameSize.QXGA, jpeg_quality=55, framebuffer_count=2, grab_mode=espcamera.GrabMode.LATEST)

Which is the absolute maximum and the wifi connected.

manic glacierBOT
#

first thing first there is a wrong color for UART and TOUCH pins in legend, thanks for pointing out.

Second, ESP32 chips allow for 'multiplexing' of almost all signals so it isn't like some pins can do SPI and others can't. You can connect any of the available PWM channels, I2S channels, UART, I2C or SPI ports to any pin. I have added the pins as default. you can Ignore the pins that are in diagram.

As you said you could not able to use the rgb led, the rgb led is connected to GPIO 21...

manic glacierBOT
onyx hinge
#

@tulip sleet like so? ```//| :param Sequence[digitalio.DigitalInOut] rgb_pins: The matrix's RGB pins in the order (R1,G1,B1,R2,G2,B2...)
//| :param Sequence[digitalio.DigitalInOut] addr_pins: The matrix's address pins in the order (A,B,C,D...)

tulip sleet
manic glacierBOT
#

Sorry, could you elaborate on this one? The line in question that uses this string is

    if (state < 0 || state > UINT16_MAX) {
        mp_raise_TypeError(translate("state only supports 16 bits"));
    }

I also do other checks such as

    if (chip < 0 || chip >= TCA9555R_CHIP_COUNT) {
        mp_raise_TypeError_varg(translate("chip can only be 0 to %q"), TCA9555R_CHIP_COUNT - 1);
    }

and

    if (!mp_obj_is_type(pin_obj, &tca_pin_type)) {
        m...
manic glacierBOT
#

Also, did you want to add pin list defs for MatrixPortal S3?

These [should] match what was already defined for MatrixPortal S3; it's about bringing the M4 up to the standard I created with S3. If the "standard" I dreamed up in that PR is not good, then I can just drop/revert this part of the change for now.

The reason there's a dict and a tuple that is not in the dict:

  • the dict is for use as a **kwarg, rather than 4 separate arguments
  • the tuple of address pins is not inside it...
#

Where possible, you should use the routines defined in py/argcheck.c. (declaration in py/runtime.h) This helps reduce code size and makes error messages more consistent.

For instance, here's the implementation of one of them:

mp_int_t mp_arg_validate_int_range(mp_int_t i, mp_int_t min, mp_int_t max, qstr arg_name) {
    if (i < min || i > max) {
        mp_raise_ValueError_varg(translate("%q must be %d-%d"), arg_name, min, max); 
    }
    return i;
}   

you'd call `mp...

manic glacierBOT
manic glacierBOT
slender iron
#

@analog bridge are you ok with me trying to force push to your update-idf branch? I'm just about ready to PR it. (I think) Pushing to your branch will update the existing PR.

manic glacierBOT
#

with the i2c bus operating at 400kHz this achieves a 4.8kHz SPI clock rate which could be worse.

It accepts the same style of init sequence as displayio.

tested by scoping the pins on the espressif lcd dev kit with a dummy init sequence:

Initialization exercise code

import busio, microcontroller, dotclockframebuffer
expander_addr = 32
init_sequence=b"\x55\3\xaa\xff\x00" * 100

bus = busio.I2C(microcontroller.pin.GPIO18, microcontroller.pin.GPIO8, frequency=400_000)
...
slender iron
#

@brazen hatch your web workflow change also changed when we construct mdns

#

were you seeing issues with mdns as your ip changed? the mdns server should stay up

brazen hatch
#

hardfaults

#

at least if memory serves well
my brain is kinda cooked rn

#

Yea, if the network changed, it was producing a hardfault for some reason.
Not quite sure why, but I did decode the backtrace and it was mdns

#

So I kinda went, "sure, have a || reload".

#

Is this causing an issue?

#

I kinda assumed it's harmless and spared no more of my time on it.

slender iron
#

ya, its a bit weird because a second construct call will mark the object as deinit

#

so the web workflow then sees its deinit and doesn't think that mdns is active

brazen hatch
#

How do I check that?
I have very little experience with actually using it.

slender iron
#

I saw the issue on esp32

#

when I loaded the webpage, board name (really instance name) and hostname were empty

#

walk time. back in a bit

brazen hatch
#

I need time anyways to test some stuff, I have an idea on how to alleviate the issue.
But it could take many tries.
Enjoy your walk!

slender iron
#

removing the reload fixes the immediate issue

brazen hatch
#

But booting without web workflow, enabling and reloading will prolly be a hardfault

manic glacierBOT
#

Hey @jepler. Could you clarify the difference between shared-bindings and shared-module. I've checked both folders, and I see each has folders such as digitalio. It looks to me like shared-bindings is for the micropython binding part of a module (i.e. anything dealing with mp_obj)? Then shared-module is for common_hal functions, which I don't explicitly have.

It could just be i'm not thinking clearly as it's late evening over here 😅

slender iron
#

I'll give it a shot as I test C3

brazen hatch
brazen hatch
slender iron
brazen hatch
#

ya

#

there is no other way as of now

#

I want to eventually make it a user function

slender iron
#

ok, my settings.toml should only turn wifi on now

#

(and seems to hang)

slender iron
#

after adding the web workflow password, it doesn't start up

#

doesn't crash though either

manic glacierBOT
manic glacierBOT
#

You are doing the separation some. You just aren't designating it common-hal. For example, tca_port_read_polarity_state is used to parse and validate params and then call tca_get_polarity_port. The latter would be common_hal_ and moved into shared-modules. tca_port_read_polarity_state would be in shared-bindings and documented with a Python stub comment.

cyw43 is a bad example because it doesn't split out the limited implementation. Both rp2pio and picodvi are split along...

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.6 on 2023-09-12; ST STM32F746G Discovery with STM32F746
Board ID:stm32f746g_discovery

Code/REPL

print("Hello World")

Behavior

I programmed the "adafruit-circuitpython-stm32f746g_discovery-en_US-8.2.6.bin" file from the official repository and tried to connect to the REPL. I tried just to see what was available but running "import board" printed a few extra new lines and then hung.

Either press...

manic glacierBOT
manic glacierBOT
orchid basinBOT
manic glacierBOT
manic glacierBOT
#

@jepler Is there a process for sorting out the makefiles for having your code in shared-bindings and shared-module? I'm getting so many linker errors 😭

- Verbosity options: any combination of "steps commands rules", as `make V=...` or env var BUILD_VERBOSE
QSTR not updated
Module registrations not updated
/usr/lib/gcc/arm-none-eabi/10.3.1/../../../arm-none-eabi/bin/ld: build-pimoroni_yukon/py/objmodule.o:(.rodata.mp_builtin_module_table+0x214): undefined reference to `tca_module...
manic glacierBOT
#

not exactly but looking at a commit which adds a new module that is split across shared-modules and shared-bindings may be instructive: f5c637dc10e2374ca1282cbc430c94fc0973b2f6 (there's this guide but it's well out of date: https://learn.adafruit.com/extending-circuitpython/inside-the-virtual-machine)

  • Add a SRC_PATTERNS stanza and some SRC_SHARED_MODULE_ALL lines to py/circpy_defns.mk
  • Add a default enable/disable Makefile value and a controlling value to CFLAGSS in py/circpy_mpflags...
manic glacierBOT
#

This is less of a feature request and more of a request to get down to decide an api for it.
I would like to try implementing it, but I want your input on how it will work.

I was thinking of making a fallback of sorts.
If the STA network /settings.toml specifies is not found, or could not be connected, check if AP credentials exist and make an AP.

CIRCUITPY_AP_SSID
CIRCUITPY_AP_PASSWORD

Also it would perhaps be worth considering installing some random defaults onto the files...

#

not exactly but looking at a commit which adds a new module that is split across shared-modules and shared-bindings may be instructive: f5c637d (there's this guide but it's well out of date: https://learn.adafruit.com/extending-circuitpython/inside-the-virtual-machine)

  • Add a SRC_PATTERNS stanza and some SRC_SHARED_MODULE_ALL lines to py/circpy_defns.mk
  • Add a default enable/disable Make...
manic glacierBOT
#

I agree with this. Having a user create a secrets.py or settings.toml instead of providing one in the file system isn't intuitive especially for a first timer. For those of us who constantly play with new boards, having to create the file, and fill it with relevant credentials with copy/paste gets tedious. Even if the settings are blank it would be nice to have a default settings.toml included with all possible fields that can be used in a settings.toml file.

digital shoreBOT
onyx hinge
#

huh, weird/cool. I noticed today that this error isn't caught in circuitpython, but it is in micropython 1.20. Turns out it's newly detected by micropython, and misbehaved before: ```py

def f(**kw): return kw
...
f(x=1, **{'x':2})
{'x': 2}

#

i.e., micropython fixed the bug in 1.20

slender iron
#

it'll raise an exception now?

onyx hinge
#

let me double check but yeah

#
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> def f(**kw): return kw
... 
>>> f(x=1, **{'x': 2})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: function got multiple values for argument 'x'
>>> 
manic glacierBOT
#

check if AP credentials exist and make an AP.

What do you gain by making an AP? I don't think web workflow works on one yet.

Even if the settings are blank it would be nice to have a default settings.toml included with all possible fields that can be used in a settings.toml file.

This will take up more flash space because we'd need to store a copy of the default file in the image. I think it'd make it harder to write to since you'd need to edit a line instead of appending.

T...

slender iron
#

nice! better errors are better 🙂

manic glacierBOT
#

I don't think we automatically want an AP started by default on every CircuitPython install (or storage.erase_filesystem()) with no user intervention. An AP uses board resources and creates security and privacy vulnerabilities that don't require physical access to the device.

But an easy way to optionally enable web workflow via AP would be very welcome.

orchid valve
#

Hello, sorry to bother, but I'm new looking to help debug issue i posted for supporting the STM32F7 disco board. Is there any documentation on how to setup to debug the core? I have experience with embedded firmware, so I don't need hand holding, but any standard practices would be helpful. I have also built circuit python for another project to add a custom board for a client using the RP2040, so vaguely familar with basic getting of code and building, but looking for any direction on how to build for debug. TIA

manic glacierBOT
#

This will take up more flash space because we'd need to store a copy of the default file in the image. I think it'd make it harder to write to since you'd need to edit a line instead of appending.

It could just be generated at fs creation time.
There is no reason not to just touch and append to it whatever we generate.
This way, we could use the #if's to very quickly append placeholders for whatever the board has.

What do you gain by making an AP? I don't think web workflow work...

tulip sleet
#

Out shopping. I can make a new token and we’ll try that

idle owl
slender iron
#

and then a debugger should be able to know what is happening

#

for debugging safe mode, you can break on reset_into_safe_mode

#

@onyx hinge do you have a repo with test code for these dot clock displays?

onyx hinge
slender iron
#

👍

#

updating it for 5.0

onyx hinge
#

oh the lcd driver?

slender iron
#

DotClockFramebuffer

onyx hinge
#

does it look like a tough change? I'll test of course.

slender iron
#

not too bad initially

#

now has esp_lcd_rgb_panel_get_frame_buffer

onyx hinge
#

that's good for us! we can lose the hack to retrieve it

#

I think I also saw double/triple buffering

slender iron
#

yup, just deleted it

stuck elbow
#

@slender iron by the way, would it be possible to add the same tags to your article as are on that atmel studio one? it's much harder to find

slender iron
#

ya, let me look

#

added arm development to it

#

and I crashed it...

stuck elbow
#

\o/

slender iron
#

🙂

blissful pollen
#

Unsure if I should raise an issue for this, but if anyone recalls there was an issue with the FunHouse having a display glitch (https://github.com/adafruit/circuitpython/issues/4775) that was fixed by lowering the display rate but it only occurred in CP an not in Arduino so there was more too it.

I am now seeing similar behavior on the ESP32-S2 TFT after I hooked my lightning detector board to it.

I know how to lower the display frequency/build a custom build to fix my porblem, and so far it has only occurred for me with a second SPI device hooked up. But this is showing that the underlying, unknown issue still seems to exist.

onyx hinge
#

humm is there a reason that these are not static const arrays as a rule? uint8_t display_init_sequence[] = {

#

seems like not making them const means they use up RAM in addition to flash

slender iron
manic glacierBOT
onyx hinge
#

I wonder why uncrustify INSISTS on the extra indentation here. ```c

  • dotclockframebuffer_ioexpander_spi_bus spibus = {
  •    .bus = i2c,
    
  •    .i2c_device_address = i2c_device_address,
    
  •    .i2c_write_size = 2,
    
  •    .addr_reg_shadow = { .u32 = 1 }, // GPIO data at register 1
    
  •    .cs_mask = 0x100 << 1, // data payload is at byte 2
    
  •        .mosi_mask = 0x100 << 3,
    
  •        .clk_mask = 0x100 << 2,
    
  • };
#
        .bus = bus_obj,
        .i2c_device_address = i2c_address,
        .i2c_write_size = 1 + gpio_data_len,
        // ASSERT(LITTLE_ENDIAN, "don't have to differentiate 8- vs 16-bits here")
        .addr_reg_shadow = { .u32 = gpio_address | (gpio_data << 8) },
        .cs_mask = 0x100 << cs_bit,
            .mosi_mask = 0x100 << mosi_bit,
            .clk_mask = 0x100 << clk_bit,
    };
```it did here too
slender iron
#

@onyx hinge do you know what clock source it should be set to?

slender iron
onyx hinge
slender iron
#

that's uncrustify + python post-processing iirc

#

so it might be the post stuff going awry

onyx hinge
#

you mean the function lcd_rgb_panel_select_clock_src?

#
examples/86box_smart_panel/main/bsp_board.c:    .clk_src = RMT_CLK_SRC_DEFAULT, // different clock source can lead to different power consumption
examples/smart_panel/components/esp32_s3_lcd_ev_board/sub_board/sub_board_480x480.c:        .clk_src = LCD_CLK_SRC_PLL160M,
examples/smart_panel/components/esp32_s3_lcd_ev_board/sub_board/sub_board_800x480.c:        .clk_src = LCD_CLK_SRC_PLL160M,
examples/smart_panel/main/bsp_board.c:    .clk_src = RMT_CLK_SRC_DEFAULT, // different clock source can lead to different power consumption
```some different demos in esp-dev-kits make different choices and I don't konw why.
slender iron
#

rmt clock source is different I think

#

I don't see idf 4.4 setting a default

onyx hinge
#

yeah the RMT_CLK_SRC must be for something else. Use PLL160M or LCD_CLK_SRC_DEFAULT then?

#

components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c: .clk_src = LCD_CLK_SRC_DEFAULT,

slender iron
#

welp, it compiles but doesn't work or error

manic glacierBOT
#

Yes, this is needed to support boards with built-in displays like the esp32s3 lcd dev kit. but if you like I can gather numbers showing it's also a good deal faster than a pure Python bitbang spi-over-i2c. (even so, it's not fast; each SPI bit is 2 I2C transactions with 24 bits each, so the absolute maximum with a 100kHz I2C bus is about 2kHz and in practice it's slower; the 400kHz I2C bus only got to 4.8kHz SPI bit rate)

tidal kiln
manic glacierBOT
tidal kiln
tulip sleet
#

np!

manic glacierBOT
manic glacierBOT
#

In addition to the MIDI note value to frequency converter helper already in synthio, it would be very handy to include a converter for a note's Scientific Pitch Notation (SPN) string to a frequency.

Here's an example of a helper in CedarGroveStudios/CircuitPython_MIDI_Tools (also in the community bundle) that converts SPN to a MIDI note value.

def name_to_note(name):
    """Translates a note name to a MIDI sequential note value. Note names are
    character strings expresse...
manic glacierBOT
#

From the OP, this is the key:

check if AP credentials exist and make an AP

An auto-generated random password doesn't solve the problem of not having serial access to the device. And if you do have serial access, AP might be a convenience, but you could do anything over serial without needing an AP.

I would not want every new device to start an AP by default, increasing complexity, using resources, broadcasting an SSID, and revealing its permanent hardware MAC address (and by infer...

plucky tulip
#

I am currently working on the templating engine for CP, a common feature that they offer are functions for escaping unsafe characters like < to &lt; or " to &quot; in HTML.

Although I can think of multiple formats that might benefit from this feature, only HTML seems to be useful in context of CP.
Markdown, SQL or XML cannot be used directly in CP, so implementing functions for them seems pointless as it increases lib size.

Can anyone think of any other format that would require this functionality while also making sense in CP?

shrewd nymph
#

I am trying to build a macro pad thing with the follow set up, is it possible to read the (big)switch if I wire it to the stemma port at the end of this chain? I currently have everything up to the big switch working as expected.

tulip sleet
#

Consider using something like a QT Py RP2040 instead, which will let you connect the switch to one of its pins.

proper solstice
#

You could repurpose the rotary switch push button, if your not using it and bound to that hardware

manic glacierBOT
#

I uploaded the last uf2 file to my PicoW and the previous error related to the pio machines seems to be solved by using the GP26 and GP27.

My code is:

import microcontroller
microcontroller.cpu.frequency = 120000000

print(microcontroller.cpu.frequency)

import board
import usb_host
import usb
import sys
import supervisor
import time


usb_host.Port(board.GP26, board.GP27)
if supervisor.runtime.usb_connected:
  print("USB<host>!")
else:
  print("!USB<host>")
  
w...
manic glacierBOT
#

But it seems that it is not able to read and print any press of buttons on the keyboard. I am new to circuitpython and maybe there is a different way of reading the usb.

I would suspect that the USB keyboard isn't assigned/added to the stdin-"channel" automatically - all search results I got refer to the board emulating a USB keyboard (and not using a keyboard for stdin as a USB host). But some code parts in supervisor/shared/usb/host_keyboard.c seem to implement just that....maybe I fin...

hidden rain
#

I create a single like this:

#

class SingletonClass(object):
def new(cls):
if not hasattr(cls, 'instance'):
cls.instance = super(SingletonClass, cls).new(cls)
return cls.instance

#

This is declared in fileA, and fileA is imported by many other files. It seems to initialize for each import!

#

WHy?

#

Its like i have multiple instances of my singleton...!

short tendon
stuck elbow
#

__new__ is not supported in MicroPython or CircuitPython, iirc

short tendon
#

Ahh, there I go using my normal Python knowledge... this has bitten me too many times.

stuck elbow
#

just make a factory function

hidden rain
stuck elbow
#

singleton_class_instance = None

def make_singleton_class():
    global singleton_class_instance
    if singleton_class_instance is None:
        singleton_class_instance = SingletonClass()
    return singleton_class_instance
hidden rain
stuck elbow
#

a class variable is a hidden global

hidden rain
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I'm seeing the same issue but only after connecting the 5v lead from the Pico to the Adafruit 16x2 RGB Char LCD Shield (Adafruit Part#714).
If the Shield is not powered on then microcontroller.cpu.temperature returns a correct cpu temp around 34° Celsius. As soon as I boot the Pico with the Shield attached via i2c and powered from the Pico's 5v vbus the cpu temp is reported as a negative number usually around the -70° Celsius range.

Pico W
Cir...

manic glacierBOT
#

CircuitPython version

On the transmitter microcontroller I use version 8.2.4. On the receiver microcontroller I use version 8.2.6.

Code/REPL

################# transmitter microcontroller #################
import sys
import time
from ulab import numpy as np
import board
import busio

uart = busio.UART(board.GP4, board.GP5, baudrate=9600, timeout=5)

def sending(data):
    
    uart.reset_input_buffer()
    time.sleep(0.01)
    uart.write(data)
...
manic glacierBOT
manic glacierBOT
brazen hatch
#

I made a ramdisk module for circuitpy finally

#

Question

#

Why is:

def writeblocks(self, block_num, buf):
    for i in range(len(buf)):
        self.data[block_num * self.block_size + i] = buf[i]

Like 10 times slower than:

def writeblocks(self, block_num, buf):
  area = block_num*self.block_size
  self.data[area:area+self.block_size] = buf
#

it makes no sense..

stuck elbow
#

because the first one gets executed in python, while the second one is executed in C

brazen hatch
#

yea but the 2nd one is the slower one..

#

that's the issue

#

I tried to do it the smort way

stuck elbow
#

you mean the slice is slower?

brazen hatch
#

ya

#

lemme time it

stuck elbow
#

what is self.data and buf exactly?

brazen hatch
brazen hatch
stuck elbow
#

there is something weird going on there, the slicing should be much faster

brazen hatch
#

Here is the whole code:

from storage import VfsFat

class RAMBlockDev:
    def __init__(self, blocks: int, block_size: int = 2048) -> None:
        if block_size < 512:
            raise ValueError(
                "Block size must be at least 512."
            )
        if blocks < 64:
            raise ValueError(
                "Cannot be less than 64 blocks."
            )
        self.block_size = block_size
        self.data = bytearray(block_size * blocks)
        VfsFat.mkfs(self)

    def readblocks(self, block_num, buf):
        mvd = memoryview(self.data)
        for i in range(len(buf)):
            buf[i] = mvd[block_num * self.block_size + i]

    def writeblocks(self, block_num, buf):
        #for i in range(len(buf)):
        #    self.data[block_num * self.block_size + i] = buf[i]
        area = block_num*self.block_size
        self.data[area:area+self.block_size] = buf

    def ioctl(self, op, arg):
        if op == 4: # get block num
            return len(self.data) // self.block_size
        if op == 5: # get block size
            return self.block_size
#

The code.py is:

import os
import storage
from ramdisk import RAMBlockDev
import time
a = time.monotonic()
print(time.monotonic()-a)
vfs = storage.VfsFat(RAMBlockDev(512))
storage.mount(vfs, "/ram")
storage.umount("/ram")
print(time.monotonic()-a)
stuck elbow
#

btw, to make that code equivalent, it should be self.data[area:area+len(buf)] = buf

brazen hatch
#

the writes will always be of block size so its faster to use the stored val

stuck elbow
#

if buf is different size than self.block_size, your coode would make a copy of the whole self.data

#

using a memoryview might help

brazen hatch
#

wait

#

I confused it

brazen hatch
#

so it's copying indeed

#

so wait

#

it's not writing blocks of the correct size???

stuck elbow
#

it will replace the self.block_size bytes with the whole buf

#

for that it will need to reallocate and copy the whole self.data

brazen hatch
#

k I fixed it, but it's still slow..
self.data[area:area+len(buf)] = buf
Now it should never copy??

#

I am actually gonna speedrun filesystem corruption

stuck elbow
#

try wrapping self.data in memoryview

brazen hatch
#

wait aren't mv's readonly?

stuck elbow
#

not sure...

#

gtg

brazen hatch
#

bb

#

apparently not.. you can write just fine..

#

still no speed improvement.. very weird

brazen hatch
#

I am pretty sure at this point it's a core bug..

#

imma stick to the for

tulip sleet
#

@onyx hinge For the V1.20.0 merge, I am down to about eight files with remaining merge conflicts. Some of these are just tedious, but some I could use your expertise on (generators, type stuff). I think I would like to do some "pair merging" if you're up to it.

#

btw I like your new avatar on Discord. It's very crisp even tiny. Have you considered it for GitHub? The tiny pictures in Blame listings are hard to see.

onyx hinge
#

@tulip sleet good morning. I'd like to do that!

#

I'm out at 4PM ET to get my COVID vaccination, so we could do it before meetings today OR we could do it tomorrow OR we could do it for a short time after meetings.

tulip sleet
#

I am also trying to get vaccines around that time, though the store said the COVID one is not in stock. That's another story. in about 30-45 minutes would be good for me. I am running the meetings today so I'm pretty occupied 12pm ET on.

onyx hinge
#

OK, let me eat breakfast and then I'll ping you.

onyx hinge
#

@tulip sleet I'm available now.

tulip sleet
onyx hinge
#

OK, take your time

manic glacierBOT
#

CircuitPython version

Adafruit CircuitPython 8.2.6 on 2023-09-12; TinyS3 with ESP32S3

Code/REPL

import board
import time
import sys
from adafruit_bus_device.i2c_device import I2CDevice

delay = 0.1
bytes_to_read = 12

print("")
print(f"Reading {bytes_to_read} bytes from I2C every {delay} seconds")

reads = 0
errors = 0
while True:
    try:
        with board.I2C() as i2c:
            device = I2CDevice(i2c, 0x08)
            data = bytearra...
manic glacierBOT
onyx hinge
#

@tulip sleet was that 2 files we got through? makes me appreciate your work all the more to do some of it with you.

tulip sleet
mortal kernel
#

@danh Big shout out of thanks for keeping the core of CP in synch with MP. Bravo!

manic glacierBOT
onyx hinge
#

I'm trying to understand why an I2C bus needs a lock.

In the days of using "continued start", I can see why -- other interspersed activity on the bus would have been trouble. but now everything is writeto_then_readfrom.

Unlike SPI there's no settable frequency and no cs pin to manipulate.

Could the lock be dispensed with?

(broadcom and stm call RUN_BACKGROUND_TASKS during i2c transactions so that would have to change: that WOULD allow an i2c function to be re-entered recursively from background context and right now the locks prevent that. but most ports don't seem to)

blissful pollen
onyx hinge
#

@blissful pollen does access to a different device in between the operations have to be prevented?

#

or can you write(slow); write(fast); read(slow)

tulip sleet
#

we can discuss in In the Weeds

blissful pollen
onyx hinge
#

I ask because the I2C lock is the main thing that made me decide to put aside the core I/O expander support work.

tulip sleet
#

i also found it intrusive in the past. I wonder the same about SPI

blissful pollen
#

I can only think maybe for large writes (displays?) if it is broken up for any reason and something else in background tasks jumps on the i2c bus and somehow that causes an issue. Maybe more for SPI. I'll keep mulling it over and let you know if I think of any cases.