#circuitpython-dev

1 messages · Page 361 of 1

idle owl
#

Maybe.

lone axle
#

whats up?

idle owl
ornate breach
#

The sky slaps knee

idle owl
#

Try it with jobs=2 first though to make sure I'm not misremembering.

idle owl
#

@slender iron I remembered a point worth considering - you can't have the jobs increased in Pylint, and have it acknowledge the duplicate code threshold change. We ran into this with the two libs that we opted to increase the threshold on. It ignores changes to that threshold if jobs>1. It's a bug. So if we increase that threshold, we will not have Pylint running as quickly.

#

Though it seems like this is out of my hands, so I suppose it's more of an FYI than it is something to discuss.

idle owl
slender iron
idle owl
#

Yes.

#

I don't know of another way to do it.

#

It's not a normal check.

#

That you can disable.

slender iron
#

right

#

I think it's ok to just have one pylint job. most libraries are small

idle owl
#

Ok.

#

I will have Tim come up with an increased threshold that works on that specific library, and we'll call that the new threshold. And have Dylan run an Adabot patch. CI doesn't trip the needs-release check anymore, so we won't have to do a sweep afterwards.

slender iron
#

👍

idle owl
#

Threshold-wise.

lone axle
lone axle
#

You are correct about the jobs=2 issue. It seems to ignore the min threshold when jobs is 2.

idle owl
#

Yeah that's what I thought.

#

It's fine, make it 1, and proceed.

lone axle
#

@idle owl the magic number for bno08x is min-similarity-lines=12 with that set to 12 it starts passing pre-commit when I run it locally.

idle owl
#

Cheers.

slender iron
#

@onyx hinge are you looking at cascadetoml for the imx?

idle owl
onyx hinge
#

@slender iron it's because of imx that I was poking at it

#

I'm not sure if it's going to be relevant though

slender iron
#

I was thinking about using it

#
  • for imx
slender iron
#

@onyx hinge we can work to get it going on 3.7

onyx hinge
#

@slender iron I suspect the immediate term problem (supporting the GD chip) can be solved just by hand-writing the required config by hand, or by substituting in a "generic enough" one

#

"generic enough" is what we did on rp2040 feather right?

slender iron
#

yup yup

#

ya, for now

#

I see two options to fix the config for gd: 1) uncomment the single fast read version or 2) switch sequence 4 to using 0x51 (iirc)

#

which is writing the second status byte

onyx hinge
#

Way back when did you get very far in to understanding the imx flash config stuff?

slender iron
#

ya, I grokked it

onyx hinge
slender iron
#

k, breakfast time for me and 🐱

simple pulsar
#

Hi. Is a non-beta release planned soon for Pi Pico?

tulip sleet
#

the next non-beta release will be for everything. The number of 6.2.0 issues is decreasing but is not zero yet

onyx hinge
#

there's also the "port status" .. will raspberrypi port remain designated "beta" when 6.2.0 goes out?

#

(I don't know that we've decided to mark it as "stable")

manic glacierBOT
#

After some amount of testing I've got a part-complete solution, but I'm running into roadblocks with bitbangio.

It, and internal I2C pull-ups seem to be mutually exclusive. If it's initialised as part of the i2c setup then I will inevitably get an error along these lines:

>>> import busio, board
>>> i2c = busio.I2C(board.SCL, board.SDA)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TimeoutError: Clock stretch too long

Afaict this is because `c...

#

That aside, I've added CIRCUITPY_BUSIO_I2C_INTERNAL_PULLUPS_AVAILABLE but a cursory search over the codebase doesn't suggest a place to:

  1. Define a default value for CIRCUITPY_BUSIO_I2C_INTERNAL_PULLUPS_AVAILABLE
  2. Check the value along with CIRCUITPY_REQUIRE_I2C_PULLUPS

In py/circuitpy_mpconfig.mk add some code like this, alphabetically is possible:

CIRCUITPY_BUSIO_I2C_INTERNAL_PULLUPS_AVAILABLE ?= 0
CFLAGS += -DCIRCUITPY_BUSIO_I2C_INTERNAL_PULLUPS_AVAILABLE=$...
#

Afaict this is because common_hal_digitalio_digitalinout_construct sets the pin pull state to PULL_NONE so no matter where or when I enable internal pull-ups, bitbangio will inevitably trample them.

Do you feel that that common_hal_digitalio_digitalinout_construct() should perhaps take an extra argument specifying the pullup and/or the initial value? I'm not sure if that would help or not based on your program flow.

simple pulsar
tulip sleet
#

all those work, except busio.I2C is flaky on some sensors (not a CPy problem), and bitbangio.I2C would work

#

but really, it's in quite good shape, especially now the accidental overclocking of the flash chip has been fixed

simple pulsar
#

This is the 0 byte write thing? I get some occasional quirks on a nobrand SSD1306 screen but that also completely fails on me at times and then recovers so I've assumed so far it's the screen. (It has onboard 10k pullups, running it at 400kHz over 8 in. wires).

tulip sleet
#

that was fixed by beta.3. There are still some sensors (notably TCS34725, a color sensor), that don't seem to like something about the hardware I2C timing. The waveforms look fine on the Saleae

#

it's also possible to wedge some sensors into a bad state by doing probing, but nearly all seem to be fine. Also the PA1010D I2C GPS module likes bitbangio.I2C a lot better

onyx hinge
#

beta.3 had a serious problem for feather rp2040 but I don't think that one affected the pico

tulip sleet
#

i forgot the clocking issue was only on feather?

onyx hinge
#

(didn't we have the flash settings wrong? It's been long enough I don't quite remember)

tulip sleet
#

beta.4 will be out relatively soon, but we have no target day yet

simple pulsar
tulip sleet
#

i haven't heard any further conjecture on that issue

lone axle
#

@idle owl here's what I found on the other two libraries to get them passing the dupe check from pylint locally:

LSM6DS:
min-similarity-lines=6

PyBadger:
min-similarity-lines=12
manic glacierBOT
idle owl
#

We'll go with 12 apparently.

slender iron
#

@onyx hinge I released cascadetoml 0.3.0 on pip. hopefully it'll work on 3.7

idle owl
#

@onyx hinge Can you get me the still image of your heart circuit sculpture? Doesn't need to be high res, it's going into the newsletter. I can't really pull guide images from Learn, only images in pages, and I don't see that still anywhere else.

onyx hinge
#

@idle owl hold on...

idle owl
idle owl
#

Ah yes! Thank you. That works.

onyx hinge
#

@slender iron yay it's working here with py37. ```../cascadetoml/cascadetoml.py cascade filter sku="GD25Q64C"
{'sku': ['GD25Q64C']}

[[nvm]]

Data for path: flash/gigadevice/GD25Q64C.toml...```

slender iron
#

nice!

#

I also refactored it so you can use it in python via import cascadetoml

onyx hinge
#

one thing I don't understand is, why do devices ship without quad enable .. enabled? what potentially breaks?

slender iron
#

the top two data pins are HOLD and write protect by default

onyx hinge
#

oh so you lose a function of those pins

slender iron
#

yup

onyx hinge
#

hadn't occurred to me

#

OK looks like some of the PWM setup is being done, but maybe the pinmux is not being set right...? (imx)

idle owl
#

@tulip sleet There was some library you and Limor were talking about and I'm supposed to add it to the contributor bundle. I never knew what library it was though.

tulip sleet
idle owl
#

Ah thanks

tulip sleet
#

sure, its components map closely to their chosen blocks

manic glacierBOT
#

@jepler Jeff, would you interface it to ulab like so (pseudocode)?

b = displayio.Bitmap(8, 8, 256)
a = array.array('H', range(64))
bitmaptools.arrayblit(b, a)

arr = ulab.frombuffer(a)

What would be really great is, if this worked in the other direction, too. I.e., if you could pipe the data into a bitmap object, like so

arr = ulab.linspace(0, 100, num=64, dtype=ulab.uint8)

b = displayio.Bitmap(8, 8, 256, buffer=arr.tobytes())

i.e., without hav...

idle owl
#

Added the lib to the bundle.

manic glacierBOT
#

@v923z the goal was to have it work with a ulab array too, though I didn't test it before.

Here's what you can write now that this PR has been merged, freshly tested:

>>> arr = ulab.linspace(0, 100, num=64, dtype=ulab.uint8)
>>> b = displayio.Bitmap(8, 8, 256)
>>> bitmaptools.arrayblit(b, arr)
>>> print([b[i] for i in range(64)])
[0, 1, 3, 4, 6, 7, 9, 11, 12, 14, 15, 17, 19, 20, 22, 23, 25, 26, 28, 30, 31, 33, 34, 36, 38, 39, 41, 42, 44, 46, 47, 49, 50, 52, 53, 55, 57, 58, ...
#

@v923z the goal was to have it work with a ulab array too, though I didn't test it before.

Here's what you can write now that this PR has been merged, freshly tested:

Thanks!

Because of "dirty rectangles" (the bitmap needs to track which portions of the itself have changed, to make display refreshes more efficient) we can't enable using the same storage for a writable ulab array and a bitmap, so a copy will be necessary. Unless someone sees a clever way around this little det...

manic glacierBOT
manic glacierBOT
#

This makes a displayio.Bitmap usable as a read-only buffer.
It enables this to work:

>>> b[0] = 32
>>> b[1] = 64
>>> b[8] = 64
>>> ulab.frombuffer(b, dtype=ulab.uint16).reshape((8,8))
array([[32, 64, 0, 0, 0, 0, 0, 0],
       [64, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0, 0],
       [0, 0, 0, 0, 0, 0, 0,...
manic glacierBOT
slender iron
#

stage2.c.jinja gets templated and then compiled

onyx hinge
#

@slender iron I didn't dig into the compilation flags, but wondered whether making the functions in stage2.c static, or using -fwhole-program, or using -flto would get space back.

slender iron
#

ah, good point

onyx hinge
#

I assume you determined -fPIC was necessary, but .. why? don't you know the RAM address where you'll be loaded?

slender iron
#

static helped!

#

222 -> 194

onyx hinge
#

yay!

slender iron
#

it gets loaded twice

onyx hinge
#

at different addresses? Ok.. I'll allow it

slender iron
#

ya, I think so

#

still not quite enough

onyx hinge
#

🙎

slender iron
#

so close!

onyx hinge
#

yeah I'm getting about 270 here

slender iron
#

lto didn't help any more than static

#

so it does fit if I don't change the pad settings

onyx hinge
#
    ssi_hw->dr0 = status_command;
    ssi_hw->dr0 = status_command;
``` this is really supposed to be repeated?
slender iron
#

ya, the second could be zero

#

you need to send a second byte to trigger a read

#

may be able to use an eeprom mode to skip the extra writes and reads

onyx hinge
#
+    if ({{ clock_divider }} <= 2) {
         ssi_hw->rx_sample_dly = 1;
+    }
``` based on the comment, can this assignment be made conditional?
#
        wait_and_read(1);

        ssi_hw->dr0 = (uint8_t) CMD_WRITE_STATUS2;
        ssi_hw->dr0 = {{ quad_enable_bit_mask }};
        wait_and_read(2);
``` I don't suppose these can be merged, 3 `dr0` assigns + `wait_and_read(3)`?
slender iron
#

the wait causes chip select to de-assert

#

so you can't skip it

#

I think we might be able to always set the delay

tidal kiln
#

nope. but on the way. ordered today.

slender iron
#

kk, cool

tidal kiln
#

with intent to take a look at those PRs

slender iron
#

thanks!

tidal kiln
#

np

tulip sleet
#

@slender iron I was trying to get a build going from your repo but failing. If you can send me an elf that includes stage2, I can look at the assembler. There doesn't look like a lot to shrink. Maybe the wait_and_read() routine could be squeezed in some way, since it only gets called with 1 or 2

#
rm -rf build-raspberry_pi_pico 
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
{'sku': ['stage2.c.jinja']}
Traceback (most recent call last):
  File "gen_stage2.py", line 11, in <module>
    quad_enable_status_byte = flashes["nvm"][0]["quad_enable_status_byte"]
IndexError: list index out of range
onyx hinge
#

@slender iron it's good to know why, thanks -- I don't see any obvious space savings, I tried tinkering with some stuff but it didn't make a difference

tulip sleet
#

is this in the regular elf?

slender iron
#

@tulip sleet did you init submodules?

onyx hinge
#

@tulip sleet there is a "4" watchdog_hw->scratch[1] = wait_and_read(4);

tulip sleet
#

yes, I did

slender iron
#

oh! do the feather, not the pico

tulip sleet
#

one of your submodules is ssh, not https, that was a diversion

#

AH

slender iron
#

ya, I do ssh locally

#

one change is to make the two helper functions static

tulip sleet
#

that shouldn't affect the assembly code

slender iron
#

the compiler can optimize it better then

manic glacierBOT
tulip sleet
#

you could maybe just put the wait() part in a routine, and then exapnd 1, 2, or 4 reads into straightline code. that may or may not be an improvement

slender iron
#

it's probably more worth my time to just figure out how to use it from CP code

#

could even just link in a second copy

#

it all fits without the capacity read

manic glacierBOT
slender iron
#

the benefit from doing in CP would be that we could do more complicated init if a board has very different flash chips

tulip sleet
#

but you were sad about losing some pico-sdk functionality?

#

you would have to rewrite?

slender iron
#

no, it'd be ok because the stage2 does full init

#

I just have to redo their internal functionality to stop things and then restart them

tulip sleet
#

it sounded like you could propose a PR to their current API to read more stuff

#

read more of the status register or whatever

slender iron
#

I'd really like a general command in their sdk

manic glacierBOT
#

May need to do display.refresh()

On Mar 17, 2021, at 8:23 PM, David Glaude @.***> wrote:

I used the copy in my thermal camera experiment, but noticed the image was not refreshing when updating the bitmap.
Right now I am doing the following, but I don't know if this is the optimal way:

image_group.remove(image_tile)
image_group.append(image_tile)

Thanks for the feature, I am not sure I fully understand everything that is happening under the hood, but ...

slender iron
#

not sure why they didn't just add that

tulip sleet
#

i think you could propose it and put it in our fork and it would eventually show up?

#

and then we could stop using our fork

slender iron
#

ya, I could do that

#

aren't we off our fork anyway?

#

I thought we were on 1.1

tulip sleet
#

i don't remember; they are updating so fast that we should keep merging from upstream

#

if we are using our fork

slender iron
#

ya, they are releasing pretty slowly though

#

and develop hasn't moved that much either

#

anyway, I'll sort something out tomorrow

tulip sleet
#

i looked at the assembler (i fudged the size to 512 bytes in the .ld). this is all striaght line code, I don't see much to squeeze. I thought there were more conditionals and calls

slender iron
#

yup yup

#

I don't know how to squeeze it either

tulip sleet
#

maybe wait_and_read could be shrunk by a few instructions, but not much, not enough to make a difference. it was 280 when I built it

manic glacierBOT
#

@v923z ah, the mental model of displayio is different than what you're thinking of .. There are what I think folks call "immediate mode" graphics engines where to redraw you run through sections of code which say "draw THIS, over THERE" and when it's done the new content of the screen is ready. If the content of a bitmap changes, you have to also run the code which says to draw the bitmap.

By contrast, I'd say that a big element of displayio is that you declare that some graphical e...

slender iron
#

did you add the statics?

tulip sleet
#

no

slender iron
#

it dropped it by 10 I think when I did

tulip sleet
#

yaah 280 to 270

slender iron
#

only 18 off 😛

tulip sleet
#

i like your overall plan better, though

slender iron
#

ya, I'll just change the sdk

#

so I can use it to get capacity

#

time to get off the comp now though

#

good night!

tulip sleet
#

👋

manic glacierBOT
#

Sorry I missed this. I guess this is now the risk we face with the write_pixel function broken out separately.

One note of caution, if a dirty region’s x1 == x2, this signifies that there is no dirty area. Right now there is no checking inside set_dirty_area to enforce x1 != x2. Is there a possibility that x1 could equal x2 here? If so, it will cause unexpected refresh/dirty rectangle behavior for single column changes.

earnest grove
#

I'm looking at building a macro keyboard (like so many others) and I was thinking of qwiik connectors. Adafruit has buttons with qwiik connectors, but they are not i2c. sparkfun has i2c qwiik buttons, but only mentions a Arduino library.
Anyone know if there is a Circuitpython library to use these in a project?

jaunty juniper
earnest grove
#

Thanks, I'll go look.

manic glacierBOT
#

Running this on 6.2.0-beta.3-11-g7970c882a on 2021-03-04 on a Pi Pico

import time
import math
import random
import struct

import board
import pwmio
import digitalio
from audiopwmio import PWMAudioOut as AudioOut
from audiocore import WaveFile
import rp2pio
import adafruit_pioasm

AUDIO_PIN_L = board.GP18
AUDIO_PIN_R = board.GP19
audio_out = AudioOut(AUDIO_PIN_L, right_channel=AUDIO_PIN_R)
stereo_file1 = open("scanner-left-16k.wav", "rb")
stereo_file2 = open("scanne...
manic glacierBOT
#

@kmatch98 if you don't mind, I'd like to leave this possible "inefficiency" for now. From what I can tell, the scenario you outline

  • would only affect programs where an arrayblit() call doesn't actually touch any pixels
  • would not create an incorrect display
  • would only cause some pixels to be needlessly redrawn (an inefficiency)

If that's correct, a user who is concerned about the loss of efficiency can simply ensure they don't call arrayblit() to do nothing.

I would like ...

#

In #4430, @kmatch98 raised an issue where calling displayio_bitmap_set_dirty_area with an "empty area" could in fact dirty some pixels.

This made me start looking in the code for ways to make the C APIs more resistant to misuse. To that end, I

  • Added more area helpers (canon, copy_coords and area_empty)
    • canon swaps the coordinates of an area if necessary to make it "canonical"
    • copy_coords copies the x1/y1/x2/y2 coordinates of one area (but not its 'next' poi...
unkempt crow
#

While chasing another problem I discovered a strange Magtag behavior.

Using an i2c device (in this case the tlv493d) and mqtt I was having to power off and on each time I was making a change, or I would get
ValueError: No I2C device at address: 5e

When I changed
i2c = busio.I2C(board.SCL, board.SDA)
to
i2c = busio.I2C(board.SCL, board.SDA, frequency = 400000)

#

the problem goes away.

manic glacierBOT
#

@jepler Maybe I am unclear or am misunderstanding, here goes a scenario where I think it would cause an incorrect dirty rectangle:

  1. Bitmap is created 100 x 100 pixels

  2. The bitmap is manipulated a lot and the dirty_area rectangle covers a big chunk of the area, say (0,0) to (100,100)

  3. Somebody calls arrayblit with x1==x2.

  • No pixels are updated in the bitmap (in this case, the for loops do nothing).
  • The bitmap's dirty_area.x1 and dirty_area.x2 is set to the same v...
tulip sleet
#

@unkempt crow that is interesting. The datasheet talks about 400 kHz as typical but doesn't say it's minimum. I will bring this to the attention of the right folks. If you have a non-ESP32S2 board to test the sensor on, that would be great. I will order one of these to test more thoroughly.

#

I am not sure this is ESP32-S2-specific.

manic glacierBOT
tulip sleet
#

@unkempt crow could you try taking readings without using wifi to see if the lockup occurs then?

manic glacierBOT
#

Didn't test, but seems to make sense. I'm not familiar with the usage of buffers or the notation used in the type definition .buffer_p, so I can't comment on the implementation.

Based on the test code demonstrated, it looks like it performs the function requested, to get ulab access into a bitmap.

As for the color depth, main thing is to keep the color index >= 256 colors if you want to use this in ulab. If folks are clamoring to save memory on bitmaps when using this, perhaps the...

unkempt crow
gloomy shuttle
#

Has there been given anymore thought to fixing the dir() issue that appears in the CPX library. It seems like there is a fundamental problem with the core and dir() calling properties, but could a temporary fix be implemented in the CPX library. https://github.com/adafruit/circuitpython/issues/4171

tulip sleet
#

@unkempt crow could you open an issue on the library with the info? Thanks a lot, and we will investigate further

tulip sleet
#

open it on the driver library for now

#

are you lubarb on GitHub?

unkempt crow
manic glacierBOT
gloomy shuttle
tulip sleet
#

if you just do cp.<tab>, does that break also?

gloomy shuttle
manic glacierBOT
tidal kiln
manic glacierBOT
#

I've been prodding this library as an alternative to some other code I have, and it's super-impressive. One question: what's the most appropriate way to change the auto-generated device name?

In my MIDI Monitor tool, I get this:

image

and I've had good success with other boards on changing the detected devicename - which I appreciate might be a USB setting rather than a MIDI-specific...

slender iron
#

@still zephyr I invited you to CircuitPython librarians so you can do PR reviews on libraries

still zephyr
#

Thanks @slender iron

slender iron
#

np, it just lets you help me 🙂

still zephyr
#

🙂 ok no problem always like to help

slender iron
#

thanks! it's appreciated

manic glacierBOT
slender iron
#

@tulip sleet are you hoping to do an rc next instead of a beta?

tulip sleet
#

@slender iron - maaaybee an RC next, but we would want to do a feature freeze and do a 6.2.x branch at that point, since we have so many new things coming in. Looking at the 6.2.0 issues https://github.com/adafruit/circuitpython/milestones/6.2.0 I think 4431 is worth trying to fix. As for 4042, other boards, we don't have PR's for a few not-yet-on-sale ones, so we could skip those. 4041 is up to you, and I am looking at 4010 right now to decide if it's worth trying to fix

manic glacierBOT
#

@tannewt I assume you're not interested in bending this rule of bitmaps even if a hypothetical speed improvement can be had due to avoiding memory copies.

I'm not sure exactly what you are proposing.

Remember that displayio was designed to 1) reduce the in-memory footprint by not having one big bitmap and 2) reduce the SPI traffic by tracking dirty rectangles. It (barely) works on the SAMD21 for the original Hallowing. I think the TileGrid model does a good job for 2d widget style l...

tulip sleet
#

we could start with 7.0.0. betas right away, as soon as we do the incompatible changes: new ulab API, remove the transitional compatibility stuff

slender iron
#

I think I'd do one more beta since beta.3 is a bit rough

tulip sleet
#

i feel that's good too

slender iron
#

I will want to do further 6.2 stable releases for rp2040 boards too

tulip sleet
#

i thought maybe you were pushing for an rc 🙂

slender iron
#

no, seems like you are 🙂

tulip sleet
#

no 🙂 I just want to get usb_cdc turned off, etc., and the Feather RP2040 fixes in

#

I could make a beta any time: the release notes are up to date. I could do it this afternoon

slender iron
#

ya, that'd be my vote

tulip sleet
#

i think it's a good time -- there are plenty of fixes piled up

#

ok, I will start on that, I just need to do the download counts and contributors

slender iron
#

jeff and your minds didn't explode with my flash setup for rp2040 so I can probably get that in next week

tulip sleet
#

righto -- i think contributing to pico-sdk is the right tack

slender iron
#

👍 that's my task today

#

it'll be nice to read capacity from the flash

#

I just ordered ~30 different flash chips from digikey....

tulip sleet
#

ok, I will start on the beta right now. Mostly need to wait for zillions of download logs files (I have all of Feb but no March)

slender iron
#

I'm pretty happy with the nvm.toml stuff

#

thanks! we should publish daily jsons of counts on public s3

#

that way we know where to pick up with the next release

tulip sleet
#

i know how to do it with some AWS features or other, I just haven't gotten started on that, but it sounds like something I might have time for. I was hoping I could have the server logs be confined to HTTP GET's but that doesn't seem to be a setting choice

slender iron
#

👍

tulip sleet
#

so I can troll through them with a server-side script; I think I wwas going to use Lambda or something like that

#

ok, regular beta, and then maybe some infrastructure work for the next release

slender iron
#

👍 thanks!

manic glacierBOT
#

@kmatch98 I believe that was in my code already but did not have the expected effect.

May need to do display.refresh()

And @jepler explanation is likely right, no need to compare previous content and new content, if something was copied over into the bitmap, it likely has changed.

This is sort of the bug that @dglaude experienced above, because I forgot the call to displayio_bitmap_set_dirty_area in arrayblit.
[we'll correct the bug in the core of course]

I did try to trigg...

#

Then, when I type a key in REPL serial, it goes into REPL prompt almost immediately, with REPL and CUIRCUITPY connection maintained. In your test case, at which step does it lose connection ?

The button check is to get out of the sleep loop in case things go wrong and I can't get to CIRCUITPY.

If I use the test below on a Feather nRF52480 or a CLUE (using board.BUTTON_A instead of board.SWITCH), then I lose the serial connection to /dev/ttyACM0 while it pretends to deep sleep. T...

tulip sleet
#

@onyx hinge I am about to make a release. Is #4429 good to merge?

manic glacierBOT
onyx hinge
#

@tulip sleet if it's not too late, I think it is but I didn't fully look into the dirty area issue that kmatch raised. there may be something about what he's saying that I don't understand

tulip sleet
#

yeah, that's why I didn't merge it, so i could wait until beta.5

#

i know you did try it, but i didn't follow the discussion

crimson ferry
#

CI pylint is busting me for things it didn't bust me for a few days ago in library examples, like importing non-existent secrets, and import order of said non-existent file

#

and missing docstring

tulip sleet
#

@onyx hinge I think I will wait on the merge of #4429 since there is some mild question

crimson ferry
#

ok, weird, the pylint errors are referring to last week's file, not the present one, but last week's file succeeded last week

onyx hinge
#

@tulip sleet that is fine, either way the effect is mild

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 6\.2\.0\-beta\.4
manic glacierBOT
#

Right now it just restarts CircuitPython:

>>> microcontroller.on_next_reset(microcontroller.RunMode.BOOTLOADER)
>>> microcontroller.reset()

[tio 15:51:33] Disconnected
[tio 15:51:35] Connected
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

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

Adafruit CircuitPython 6.2.0-beta.3-258-gc0d4b3732-dirty on 2021-03-17; IMXRT1010-EVK with IMXRT1011DAE5A
tidal kiln
#

i guess the other option is to make sure the user code exits nicely?

gilded cradle
#

@tidal kiln possibly, but I'm not sure how simple getting it to work in Blinka would be since maybe libgpiod_pulsein is holding onto it.

tidal kiln
#

yep. that's exactly what's happening. just not sure who/where/how has the responsibility of killing the thread.

gilded cradle
#

It may be an issue in the libgpiod_pulsein script, which is written in c. Some deeper exploration would be needed as I'm mostly guessing at this point. 🙂

tidal kiln
#

but if you <CTRL><C> your program, nothing stops it

gilded cradle
#

Ah, ok. So it may be totally doable with a try/except KeyError block.

tidal kiln
#

yah. something like that try/except....just some mechanism that would make sure that blinka's deinit stuff gets called....

gilded cradle
#

right

tidal kiln
#

there may be some pythony solution to this i'm not aware of

#

like registering a callback with SIGINT?

gilded cradle
#

🤷‍♀️ not sure. I've only minimally played around with subprocess.

tidal kiln
#

yah. same here. just some basic launching etc.

#

you OK if i open an issue just so we have something for reference?

gilded cradle
#

Sure

orchid basinBOT
tulip sleet
#

I cannot merge it myself because I am the PR author

onyx hinge
#

@tulip sleet hmmmm I think there's a problem...:

#

the languages list seems to be everything, but we withdrew several translation since the last release

#

build_release_files has language_allow_list = [ "ID", ...

tulip sleet
#

it looked like it was a different order

onyx hinge
#

but maybe it didn't get used in all the right places .. en_GB is on the list in your new files.json but it shouldn't be

tulip sleet
#

i will clean out the bad languages by hand; i think we didn't have a release since that change?

onyx hinge
#

the allow list needs to be moved so that generate_download_info() uses it too. I'll enter an issue.

tulip sleet
#

@onyx hinge where is the allow list?

#

never mind I was looking in the wrong repo

#

Removing "hi",
"en_GB",
"cs",
"ko",
"el"

onyx hinge
#

I think that's right?

tulip sleet
#

i checked it systematically, so yes

onyx hinge
#

Note: Not building languages {'en_GB', 'ko', 'hi', 'cs', 'el'}

#

I wonder if we can/could json.dumps(..., sort_keys=True)

tulip sleet
#

that would be nice too

#

i pushed an update, hurray for egrep -v

onyx hinge
#

thank you!

tulip sleet
#

well it was a happy accident I had to do the PR by hand and you had a keen eye

#

thank you

manic glacierBOT
signal pasture
tulip sleet
#

you just need to re-enable CIRCUITPY_USB_CDC and you'll have the separate CDC channel again

signal pasture
#

do i have to do that in c/c++? or in python?

tulip sleet
#

you have to do a custom build of CircuitPython

signal pasture
#

i would probably screw it somehow

tulip sleet
#

it's a very useful thing to know how to build. Have you done Linux command line before? Do you have a Linux box? I would recommend that over Mac or Windows.

signal pasture
#

would it be possible to, somehow, have something to be able to control enabling that 2nd usb_cdc? or it's part of the bootloader?

#

i can spin a vm, and have some devices with linux

tulip sleet
#

it will be controllable in boot.py. I have to do the work. It's my next major thing to do.

#

because we want to make it easy to use again

#

you could stick with beta.3 for now if you don't need to move forward

signal pasture
#

oh, if it will be able to be enabled in boot.py, then yeah, i will wait for it

#

i dont see anything i need in there on my rp2040, so, i will hold on to beta3

#

thank you!

tulip sleet
signal pasture
#

nah, im not desperate at all

tulip sleet
#

like, for instance, you may want to turn off CIRCUITPY, etc., in the future once you get a device you want to leave plugged in permanently

signal pasture
#

i actually want to make a device to be permanently plugged in, but i kinda want to have flash access too, so c# can open/read/save a file into there

raven canopy
gilded cradle
#

Oh yeah, I think you're right. I think we used that for neopixels.

tidal kiln
#

@raven canopy neat. thanks! will check it out.

manic glacierBOT
#

was a windows thing perhaps
this fixes it:

`

SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries

SPDX-License-Identifier: MIT

simple_test

import time
import random
import usb_midi
import adafruit_midi
from adafruit_midi.control_change import ControlChange
from adafruit_midi.note_off import NoteOff
from adafruit_midi.note_on import NoteOn
from adafruit_midi.pitch_bend import PitchBend

print(usb_midi.ports)
midi = adafruit_midi.MIDI(midi_in=usb_midi.ports[0],...

tulip sleet
orchid basinBOT
#

Ok, so here's the thing. It doesn't appear we currently store the raw .py or .mpy files on amazon or elsewhere, only zipped vesions. I'm trying to figure out the best solution here, but would like input from others. Here's the options I see:

We can use the .zip files from the release assets from GitHub to build a bundle, but a zip file with more zip files will probably be annoying to the user because it's more work than just grabbing the bundle itself.

We can start storing .mpy and .py...

#

We can start storing .mpy and .py files on Amazon s3 somewhere like we do with all the circuitpython releases, but I'm not sure what are limits are and this may take up a bunch of room unless we just keep the latest versions of everything.

The CircuitPython releases are more than 3000 files for each merged pull requests or release. The bundles are tiny in comparison. I periodically clean out these files and I could do the same on the bundles. But maybe you just need to keep the latest un...

crimson ferry
orchid basinBOT
slender iron
#

@tulip sleet thanks for doing the release!

tulip sleet
#

yw - it was a lot less work this time except for the language thing

#

the ongoing release notes is maybe more time altogether, but a lot less painful

orchid basinBOT
#

Why not just create the bundles the same way that the Bundle repo's .github/workflows/release.yml does, utilizing circuitpython-build-tools? Could probably work it into the current workflow file, and have them built on each release. Would only need to establish how to store/use the data for the specific bundles.

I would love to have a just-in-time service, but that would require some serious caching mechanisms to overcome the bandwidth issues with always requesting assets from GH.

manic glacierBOT
orchid basinBOT
#

I would love to have a just-in-time service, but that would require some serious caching mechanisms to overcome the bandwidth issues with always requesting assets from GH.

We would store the assets on S3, so I don't think it's too much of an issue. There could be caching behind that, but I think we could see if it's necessary. It could all be client-side JavaScript, just fetch multiple files from S3.

manic glacierBOT
#

This release, 6.2.0-beta.5, is the sixth beta release of CircuitPython 6.2.0. Notable changes since 6.2.0-beta.4 include [[HIGHLIGHTS]]. See Port status below for details on port stability for each port, and Known issues for known problems. If you find any issues with this release, please file an issue.

Download from circuitpython.org

Firmware downloads are available from the [downloads page](https://circui...

manic glacierBOT
orchid basinBOT
#

Why not just create the bundles the same way that the Bundle repo's .github/workflows/release.yml does, utilizing circuitpython-build-tools? Could probably work it into the current workflow file, and have them built on each release. Would only need to establish how to store/use the data for the specific bundles.

I think the main issue with doing pre-built bundles is there are just too many permutations to make it practical.

I would love to have a just-in-time service, but that w...

manic glacierBOT
manic glacierBOT
#

This is an addition to add color palette getters/setters for the OnDiskBitmap. This will allow for palete animations/color cycling for bitmaps without having to load them into RAM.

Also, this adds a flag that provides an option to force refresh of an OnDiskBitmap whenever the palette is modified.


This work was spurred out of an exploration of animated icons. @FoamyGuy demonstrated that using OnDiskBitmap allowed loading of significantly more images for the "TouchDeck" p...

manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
manic glacierBOT
ionic elk
#

@crimson ferry UDP servers? I actually don't know what's involved with that. I just wrote sendto and recvfrom_into. Shouldn't any server structure regarding datagrams happen on top of those?

#

There's no connectivity state with datagrams so the concept of a UDP server isn't built into the API in any obvious way I know of

crimson ferry
#

I got the server part working (I think), it needed to bind to the explicit IP address rather than "127.0.0.1" or "localhost", though I have yet to be able to read the replies from the server (can read replies from CPython servers)

ionic elk
#

It's the "bind" part I don't get

crimson ferry
#

I guess bind was pre-exisiting for TCP

ionic elk
#

Yes, I guess you have to bind but I'm not sure I proofed that for UDP

#

I can try poking at some test sketches for that

#

With "bind" you need to actually grab the real IP address from the ESP32-S2 via the debug console or wifi module, have you done that?

signal pasture
#

can i ask something weird about what you're talking about?

crimson ferry
#

ESP32-S2 UDP Client works fine, as you know. Server, when bound to explicit IP, will receive and show data sent back. I haven't yet gotten CPython, ESP32-S2, or ESP32SPI UDP clients to be able to read that returned data. May have to get serious and watch the packets on the network.

signal pasture
#

(i know it's kinda rude to stick myself in the middle of a chat, but, i may be able to help)

crimson ferry
#

(I wasn't expecting the explicit IP required, since CPython is pretty casual about it)

#

@signal pasture totally fine, go ahead

signal pasture
#

are you talking about socketserver.TCPServer?

#

or similar?

ionic elk
#

@crimson ferry so an ESP32-S2 socket will receive UDP data fine with recvfrom_into, when bound to an address? But when it sends a reply back with sendto, it fails?

crimson ferry
#

@ionic elk from the server perspective, it shows data sent back to the client. But none of my clients can rad that (yet?)

ionic elk
#

I mean, presumably both ends require an address bound to them, if you're using ESP32-S2s on both ends

#

@crimson ferry can you be more specific about what you mean by "shows data sent back to the client"

#

What actual calls are you using

#

@signal pasture we're talking about the ESP32-S2 implementation of socketpool.Socket. We don't have TCPServer on Circuitpython

#

or at least not on the module level

#

maybe up in the libs or something I dunno, I'm the C monkey

crimson ferry
#

UDP server: bind, recvfrom_into, and sendto. Client: sendto, recvfrom_into. (sendto includes the IP/Port tuple)

#

"shows data sent back to the client": size = s.sendto(buf[:size], addr) print("Sent", buf[:size], size, "bytes to", addr)

ionic elk
#

So on your UDP server, you have valid data that seems to be going out with sendto, and it isn't working

#

so either the server sendto, or the client recvfrom, is failing on the reply. Gotcha.

signal pasture
#

but is anything listening on the other side?

ionic elk
#

I can check it out, thanks for clarifying

crimson ferry
#

yes, the client is waiting with a recvfrom_into

ionic elk
#

@signal pasture presumably the client listens with recvfrom_into (a blocking call) after it sends the original request.

signal pasture
#

yes, but is the server listening?

crimson ferry
manic glacierBOT
crimson ferry
#

@signal pasture In my scenario, both client and server are repeatedly sending and listening

ionic elk
#

@signal pasture we are talking about datagrams, so listen() is not used, if that's what you're thinking of

#

None of this uses TCP calls

crimson ferry
#

right, no listen in udp

#

by "listen" in that comment, I meant recvfrom_into

ionic elk
#

@crimson ferry can you post an issue for possible problems with either sendo/recvfrom in a reply context from a UDP server, with whatever code you can post?

#

I'll track it from there.

signal pasture
#

by "listen" i meant "some device on the other side that is ready to receive anything"

crimson ferry
#

yeah, I want to play around more to make sure I'm not missing something dumb

ionic elk
#

@signal pasture yes, that would be the client, using the call recvfrom_into, which will block until it receives something.

crimson ferry
#

my goal is to get TCP and UDP sockets fully interoperable across CPython, ESP32-S2, and ESP2SPI (though there are no servers in the latter)

ionic elk
#

@crimson ferry sure. And so just to recap, I've never tried UDP from the server context you're describing, so it's possible I missed something about the interaction between bind and sendto, or something

signal pasture
#

makes sense then

ionic elk
#

@crimson ferry it actually also might be a timeout problem, when I think about it. I might need to go in and make sure that sendto has appropriate timeout handling

crimson ferry
#

sendto is fine from the client side

ionic elk
#

UDP didn't get the huge timeout/blocking pass I did on TCP

crimson ferry
#

sendto appears to succeed from the server side

ionic elk
#

well, give it a bit more work and then tag me in an issue whenever you'd like me to look

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Be careful, following these instructions can leave you with a board in a difficult to recover state!

  1. Put this in code.py:
print("hello world")
while True:
  pass
  1. reset the board
  2. connect via usb-cdc to repl
  3. hit "A" then "ctrl-c"

Normally, you'd expect the ctrl-c to interrupt. However, it doesn't. If "ctrl-c" is the FIRST thing typed through usb-cdc, then it probably works. But typing anything else first leaves it non-working. My Linux terminal p...

thorny jay
#

Is there a better way to do "profiling" and find where time is spend?

#

start2 = time.monotonic() <put the code here>
stop2 = time.monotonic()
print("Time copy: %0.3f s" % (stop2-start2))

simple pulsar
#

Hi. I was just looking at some of the PIO code in CircuitPython and this line looks wrong. The tests for tx and rx on this line look superfluous and would do something wierd if transfer was called with two NULL data pointers (probably not possible with current code). https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/common-hal/rp2pio/StateMachine.c#L620

GitHub

CircuitPython - a Python implementation for teaching coding with microcontrollers - adafruit/circuitpython

orchid basinBOT
#

Ok I'm trying to figure out best infrastructure for S3. Right now CircuitPython uses GitHub actions, which works pretty well. It has the Amazon token as part of repo-specific secrets. Long term it would probably be best to have each repo upload its zip files to Amazon S3, but that would likely require another Actions sweep first and that would only upload the latest files.

Adabot has access as well and already has the secrets set up, so that looks pretty promising, but I didn't want to bog...

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

58

Voice Channels

6

Members

28154

Roles

34

manic glacierBOT
#

Retroactive LGTM. The only thing we lose here is telling users that they might want to reshuffle certain initializations on STM32 so the dynamic timer allocation doesn't reserve timers on pins that require PWMOut. That was an STM32 specific issue, so I didn't want to abstract it to the shared bindings level. That only comes up if you're using PWMOut and PulseIO/Protomatter simultaniously though, so it's probably fine to leave debugging to the user.

Remind me the incentive for standardizing...

#

Remind me the incentive for standardizing these exceptions again, does it have a benefit for displays? It's been a while since I touched it.

The reason to remove the exceptions and pass back status codes was that the on-board display initialization in boards/<someboard>/board.c is done before exceptions will work or can be reported. common_hal_displayio_display_construct() was calling common_hal_pwmio_pwmout_construct(), and when the latter failed, an exception was getting raised. ...

manic glacierBOT
orchid basinBOT
#

I think the bundle builder could just upload the files in the unpacked bundle. Otherwise every library repo has to know the S3 secret. Or it could be a webhook, like readthedocs, which does not require secrets. Nominally, that would require a server to answer the webhook, but you could use AWS Lambda to do this really easily, e.g. https://medium.com/mindorks/building-webhook-is-easy-using-aws-lambda-and-api-gateway-56f5e5c3a596 (many other examples can be found).

One advantage of doing it ...

manic glacierBOT
orchid basinBOT
ionic elk
#

@onyx hinge hey Jeff, is AudioPWMIO normally supposed to be interruptible by the REPL or no?

onyx hinge
#

If you're interactive, .play() will return to the REPL while the sound continues playing

#

if you exit the repl sound will stop

ionic elk
#

so a ctrl-c should exit

onyx hinge
#

.play() returns immediately in other words

#

so normally it's followed by a while True: or while speaker.playing: loop which will be interruptible with ctrl-c

#

is that answering your question?

cedar moth
#

Just a heads-up that I posted an issue under the Adafruit_CircuitPython_DisplayIO_SH1107 library on GitHub regarding the SH1107 128x64 OLED FeatherWing Display and the Feather RP2040 over I2C. Since the problem seems to occur only with the RP2040 and this display (also tested with M0 and STM32 boards and a different display with no issue), I wasn't sure where best to post but wanted to bring this to the attention of those of you working on the RP2040 in case it is relevant.
https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SH1107/issues/4

manic glacierBOT
#

I added it three years ago... Have you reproduced an issue with this or just suspect a problem?

My particular use case was attempting a file access in an interrupt handler, and observing that it locks up the board if the interrupt happens during screen update.

I think the assumption is that it'd be incorrect for this code to occur when the spi bus is locked. Having this be a loop allows you to detect the error with a debugger when developing.

There is nothing to prevent this code...

blissful pollen
#

@slender iron (or really anyone else) looking for something else to work on in the core if you have something that's not high priority but needs to be done. I have a couple weeks vacation and well can't go anywhere so may as well do something!

slender iron
#

@blissful pollen there is a quick PIO ASM bug you could knock out

#

will think about stuff for the core

blissful pollen
#

cool is there an issue for it? I can go look for it

slender iron
#

yup, only issue on the PIO_ASM repo I think

manic glacierBOT
#

Thanks for this PR! I'm unable to get this working on my Meowbit with the WAV sample code in the Circuitpython documentation. The speaker makes a little strangled sound, and then the program hangs irrecoverably, requiring a manual erase of the entire flash. If you have a test sketch of your own, I'm happy to try that.

The style and timer allocation stuff looks generally ok, I can't point out where the h...

orchid basinBOT
manic glacierBOT
#

@hierophect thank you for the review!

I'm unable to get this working on my Meowbit with the WAV sample code in the Circuitpython documentation. The speaker makes a little strangled sound, and then the program hangs irrecoverably, requiring a manual erase of the entire flash. If you have a test sketch of your own, I'm happy to try that.

My guess is that it's #4397 :-)
You should be able to get `Wav...

manic glacierBOT
#

@tannewt It seems the most likely place for this to be encountered in practice is with the Meowbit, which shares the SPI bus between the flash and the screen (I assume this is where you first encountered the problem, @tyomitch). Specifically, when a module tries to access the flash while the screen is updating, it causes an irrecoverable hang. Then you need to figure out how to manually wipe the NOR flash somehow, like introducing an intentional exception into your build. I just ran into it w...

#

Firmware

Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; FeatherS2 with ESP32S2  # also tested on beta.2

Code/REPL

CircuitPython native UDP Server code & CPython UDP Client code are in the comments below.

Behavior

I've been testing cross-compatibility of CPython, CircuitPython ESP32SPI, and CircuitPython ESP32-S2 sockets, both TCP and UDP. All supported combinations work except CircuitPython ESP32-S2 UDP Server... none of the thr...

#

CircuitPython ESP32-S2 UDP Socket Server example code:

import wifi
import socketpool
import ipaddress
import time
from secrets import secrets


TIMEOUT = None
HOST = ""  # see below; 127.0.0.1 and localhost don't work
PORT = 5000
MAXBUF = 256


# connect to wifi
print("Connecting to Wifi")
wifi.radio.connect(secrets["ssid"], secrets["password"])
pool = socketpool.SocketPool(wifi.radio)

print("Self IP", wifi.radio.ipv4_address)
HOST = str(wifi.radio.ipv4_address)
ser...
#

CPython UDP Socket Client example code:

#!/usr/bin/env python3
import time
import socket


TIMEOUT = 5
HOST = "192.168.6.198"  # edit as needed
PORT = 5000
MAXBUF = 256


buf = bytearray(MAXBUF)
while True:
    print("Create UDP Client Socket")
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    s.settimeout(TIMEOUT)

    size = s.sendto(b"Hello, world", (HOST, PORT))
    print("Sent", size, "bytes")

    size, addr = s.recvfrom_into(buf)
    print("Receive...
simple pulsar
#

Hi. Has anyone managed to get an implementation of PWM on PIO on RP2040 to work like the ones floating around for MicroPython?

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Firmware

Adafruit CircuitPython 6.2.0-beta.2 on 2021-03-01; Raspberry Pi Pico with rp2040

Code/REPL

import busio, bitbangio
i2c = bitbangio.I2C(board.GP1, board.GP0)

Behavior

Traceback (most recent call last):
  File "", line 1, in 
TimeoutError: Clock stretch too long

Description

  • Error while using i2c...
  • Only happens when...
  • might be related to #4291...

Additional Info
...

jaunty juniper
#

you gotta love accidentally sending a form before filling it in 🙄

manic glacierBOT
manic glacierBOT
#

@hathach I did a bisect and narrowed this down to:

commit 5351a93c70fcacc50a154edac0a6d6d1028296e0
Author: hathach thach@tinyusb.org
Date: Mon Nov 23 13:39:14 2020 +0700

update tinyusb to fix cdc connection race

issue is fixed in https://github.com/hathach/tinyusb/pull/557

Before this commit, connecting to the REPL on a Feather nRF52840 responds immediately. Afterwards, it takes about five seconds after connecting to print the initial prompt. I looked in `/var/lo...

manic glacierBOT
#

Found an off-by-one error in bitmaptools.rotozoom. Here's the minor updates: https://github.com/kmatch98/circuitpython/tree/bitmap-dirty-improvements

I checked bitmap.fill, bitmap.blit and bitmaptools.fill_region and bitmaptools.rotozoom. Tommorrow I will look a spend a little more time looking at bitmap loading (imageload and OnDiskBitmap) and doing changes to palettes.

Here's my test code so far:

# Trials for bitmap dirty rectangle tracking

# Move text aroun...
manic glacierBOT
manic glacierBOT
#

@jepler

If you can modify the bitmap via its buffer, memoryview(bitmap)[X+Y*bitmap.width] = 0 there is not a facility in micropython to notify the bitmap that its content has been modified.

If I understand correctly, your only concern here is that this refresh/update function has to be called manually, otherwise, while the data will be "updated", this fact will not be reflected on the display itself.

But is this really a problem? If someone is using this very low-level buffer u...

manic glacierBOT
#

@tannewt I assume you're not interested in bending this rule of bitmaps even if a hypothetical speed improvement can be had due to avoiding memory copies.

I'm not sure exactly what you are proposing.

Remember that displayio was designed to 1) reduce the in-memory footprint by not having one big bitmap and 2) reduce the SPI traffic by tracking dirty rectangles. It (barely) works on the SAMD21 for the original Hallowing. I think the TileGrid model does a good job for 2d widg...

vague latch
#

Hey all how does circuitpython work under the hood. What i am trying to do is add functionality to my code to provide the deque module from the collections library in python. The library is in c and so i was thinking it should'nt be hard to add it to the circuitpython base. Am i missing something here. Is there a guide or instructions on how to do this sort of thing

manic glacierBOT
solar whale
vague latch
#

so is there anything stopping me adding a standard python library

solar whale
#

It is written in C, not python -- if you want to ad a python library, you can do that without rebuilding CP.

vague latch
#

yeah, so actual cpython library

#

would it be worthwhile adding in the whole collections library then.

#

is it a balancing act between functionality and size for the main build

solar whale
#

Right -- If you think it is something that needs to be added, you can open an issue for discussion or add it and then create a PR to see if it is something that should be added for all.

vague latch
#

ok. thanks for that. ill do some testing.

mental nexus
#

I usually start by writing a Python library to try things out. That’s usually much quicker to get something working and try out all the logic. (Unless it needs access to something that not available to Python then that’s a different story.) Then if it needs to be faster that’s really the reason to put it into the core C code. But if you want to learn more about how CircuitPython is built then by all means go for it! And ask around here, the guides are a starting point but there are many ways to get stuck. Ive learned a lot by asking here when I’m stuck.

vague latch
#

so i really want to get up and running an async type code base.

#

i watched david beazleys discussion on asyncronous and concurrent programming and his code utilises heapq and deque

#

i was looking to add these functionalities to my code and noticed neither of them are implemented.

#

or if they are i couldnt see them

mental nexus
#

Have you tried the tasko options? I’ve not used them. It I know some support of async is available.

vague latch
#

it wasnt running at the speed i was expecting so i thought i will try and write one myself.

mental nexus
vague latch
#

maybe. I will look into that. I cnat seem to build circuit python forthe feathers2 at the moment anyway

#

does the circuitpython build require a certain version of python

jaunty juniper
#

what issues are you getting ?

vague latch
#

I dont remember what the issue was i t basically never looped through

#

or the issue with the build

lone axle
#

Feather S2 is an ESP32-S2 which does require some extra set up to build.

#

if you have not done the install and export steps for the esp-idf you'll need to do those.

vague latch
#

i did those.

#

i am running python 3.8 and thought that may be the issue

jaunty juniper
#

esp tools want python3 but call python

lone axle
#

That version should be okay. I am able to build and I use python 3.8 as well

jaunty juniper
#

on an ubuntu VM I installed python-is-python3 for that

vague latch
#

ok

lone axle
#

mine is set up that way (python3 is actually called python in my environment)

vague latch
#

ok my error is in ```circuitpython/ports/esp32s2/esp-idf/tools/ldgen/generation.py", line 84, in do_section_expansion
expansions = fnmatch.filter(sections_in_obj, section)
File "/home/tim/miniconda3/lib/python3.8/fnmatch.py", line 55, in filter
for name in names:
TypeError: 'NoneType' object is not iterable
ninja: build stopped: subcommand failed.
Makefile:310: recipe for target 'esp-idf-stamp' failed
make: *** [esp-idf-stamp] Error 1

lone axle
#

did you run these commands in the repo also?

git submodule sync --quiet --recursive
git submodule update --init
vague latch
#

yep

lone axle
#

Those and the install / export of the esp-idf are the main gotchas that I am aware of. If you've taken care of those I'm not sure what else could be giving you trouble.

#

I don't recognize that error specifically. But as other folks come online someone may know what it's about.

vague latch
#

hmm thanks for your help anyway

#

ill have a fiddle with it and look at the update of tasko

lone axle
#

I honestly don't know much about anaconda, but I noticed your path has miniconda in it. I have seen other folks have issues with anaconda environment before. I'm not certain if it's your issue. But if you have a way to try a "vanilla" python environment it might be worth a shot.

vague latch
#

yeah my default on this machine is miniconda path

#

i should look into changing that.

manic glacierBOT
#

@tannewt Hypothetically, if a ulab array can be a writable view onto a bitmap, you would have to call a new dirty() method on the bitmap after modifying it outside the knowledge of the Bitmap itself:

b = displayio.Bitmap(8, 8, 256)
a = ulab.frombuffer(b) # create a ulab.array that views onto b, but see below
a[y,x] = p
b.dirty(x, y, x+1, y+1) # This call doesn't exist yet, because we've worked to prevent the need for it

If you omitted the call to the new dirty() function, or ...

manic glacierBOT
#

Ok, I did some more tests and didn't find anything more. All I found else was that one issue in rotozoom (listed above). Once you merge that, I think it's good to me. I'll add a review.

Here's my latest test code that I used, now including tests with adafruit_imageload and displayio.OnDiskBitmap.

# Trials for bitmap dirty rectangle tracking

# Move text around, label and bitmap_label
# Make bitmap boxes
# - Move them
# - Change palette
# - Change individual pixel...
onyx hinge
#

hmmm I think there's a (probably preexisting) problem with dirty areas for TileGrids that transpose_xy when updating grid elements

#

I sorta suspect the coordinates "dirtied" are not accounting for transposition alone

manic glacierBOT
#

I haven't distilled this down into a test program, but I had a tilegrid with 8x5-pixel tiles, sized 4x23, and transposed. (so it ends up being a wide and short tilegrid)

I found that after the initial draw, only a narrow strip at the left of the tilegrid would be updated when I changed the tiles.

Here are the relevant snippets. Running with recent main branch on a feather rp2040.

font = displayio.Bitmap(8, 5*256, 2) 
with open("/font5x8.bin", "rb") as f:
    f.read(2)
    bitm...
mental nexus
crimson ferry
onyx hinge
#

I'm not able to follow what that code is doing right now, maybe some other time

#

@crimson ferry hmm it looks like you're supposed to use a particular URL within that host according to the examples. Do you think it's "new" that the front page doesn't say something? ```$ curl http://wifitest.adafruit.com/testwifi/index.html
This is a test of Adafruit WiFi!
If you can read this, its working :)

crimson ferry
#

No, just me remembering wrong

onyx hinge
tulip sleet
onyx hinge
#

interesting

#

@crimson ferry ah I see you'd already updated yourself when I said that. glad you figured it out

crimson ferry
#

interesting, wasn't aware of the alternate

onyx hinge
#

Seems like it's not unreasonable for the "/" page to say something besides 403, so I sent an internal message to our web folks. Dunno whether they'll do anything, but the issue has been raised.

#

they often have bigger fish to fry

crimson ferry
#

I can understand not having anything at the root, keeps out the riff-raff. I do that with some of my domains.

manic glacierBOT
#
b = displayio.Bitmap(8, 8, 256)
a = ulab.frombuffer(b) # create a ulab.array that views onto b, but see below
a[y,x] = p
b.dirty(x, y, x+1, y+1) # This call doesn't exist yet, because we've worked to prevent the need for it

If you omitted the call to the new dirty() function, or specified the wrong rectangle, the display might not be correct. If you're OK with adding a "displayio.Bitmap.dirty" method that users would have to call if they used this advanced feat...

#

It looks like numpy tracks whether the original storage was mutable or not, so e.g., if the origin is a bytes object it is immutable but if it's a bytearray then it's mutable:

>>> import numpy as np
>>> a = np.frombuffer(b'abcd', dtype=np.uint16)
>>> a
array([25185, 25699], dtype=uint16)
>>> a[0] = 1
ValueError: assignment destination is read-only

versus

>>> a = np.frombuffer(bytearray(b'abcd'), dtype=np.uint16)
>>> a[0] = 1
>>> a
array([    1, 25699], dt...
#

I can help show you what is needed to accomplish the initial check for whether the storage is mutable,

I think you brought this up in the thread that I linked to above, and I don't know what the right solution is. On the one hand, numpy-compatibility is great, and I would advocate that. On the other hand, a microcontroller is simply not a computer, and we have to be careful about how we squander bytes both in flash, and RAM. If you judge compatibility to be important, then I am OK wit...

manic glacierBOT
crimson ferry
#

Is anyone else still seeing Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit Feather RP2040 with rp2040 disappearing after reset?

#

...and is there a better procedure to get it back than the Raspberry Pi org PICO flash nuke UF2?

manic glacierBOT
crimson ferry
#

...I have a very strange Requests bug that only manifests on the Feather RP2040 (some primitive behaves different? timing? other?) But I want to make sure the flash is stable to rule that out as an issue.

ornate breach
#

hey @tulip sleet can the bin generated for circuitpython be loaded into memory through DAP and be fine or is it better to just drop the uf2 via usb?

#

i'm developing my workflow for burning bootloaders and loading circuit python onto a lot of boards in a pretty fast go, and want to know if I can just DAP it into memory or if I need to individually drop circuitpython on them via USB

tulip sleet
ornate breach
#

oh gotcha, i'm wondering if it's worth while to do or just let the end user do it.

#

I don't really have plans to add arduino support for my boards because it's just cumbersome

#

one day maybe

tulip sleet
#

the tester loads a test program; the human checks the test output, and then that is it

ornate breach
#

i'm going to eventually need to make a more robust test jig

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
still zephyr
#

@lone axle let me know if you are around, want to discuss about the readinto issue

lone axle
still zephyr
#

So I am trying to test your solution, what imageload version did you use?

lone axle
#

I think we have two different issues there 1) the unexpected argument with the current released version of CircuitPython. and 2) Certain images get loaded improperly and then look different than their raw image file.

still zephyr
#

1.4?

#

Yes at the beginning I was not sue, and I was not having the same error as you, so I guess is the imageload version, as I am using an old one

lone axle
#

Yeah, version 0.14.0 is where the issue was introduced I think. That was the one I was using when I noticed the unexpected argument error.

still zephyr
#

ah ok, gotya, I am testing this right now, I will put my review in the comments. I was not sure about the version of the imageload, I guess with old version works ok

lone axle
#

Yeah, that is true. The old versions did not try to use the new readinto() function so they do not have these issues.

still zephyr
#

@lone axle review is done, do I need to do anything else?

lone axle
#

That is perfect. Thank you! I'll give it a little longer today to see if anyone else has any thoughts or ideas. But if we don't get anything else I'll go ahead and merge this tonight so that we hopefully avoid too many folks ending up with the combination of versions that leads to the crash.

still zephyr
#

Perfect.

#

🙂

onyx hinge
#

drat, there's no UART pin left on the rp2040 feather once you use an rgbmatrix featherwing

#

(rx only)

#

I guess I can try implementing the PIO UART

ornate breach
#

😬

manic glacierBOT
#

I've been running thestandard "color_wheel" demo on an STM32F11CE Blackpill with a 16 RGB neopixel ring.
I noticed that when it is running, the pattern occasionally "stalls" for varying amounts of time - sometimes over a full second.
I added a print out the time between cycles of the the color wheel and you can see in the sample below how it sometime takes a lot longer between cycles. I have no idea why...
I tried just running a counter that does not use neopixels and I did not see this be...

manic glacierBOT
onyx hinge
manic glacierBOT
#

@Shubhankargo I'm not sure I understand what you mean. You should not use the Feather binary since it will have totally different pin definitions and oscillator settings. CanIO is a native module and does not have a .mpy file in the libraries folder of the filesystem, so I'm not sure what you mean there either.

If you want to use CAN on the F407 Discovery now that support has been merged, you should visit the s3 lin...

manic glacierBOT
#

I was just playing some audio on a Feather nRF52840 and changed the code from stereo to mono and I could still see the audio was active on the right_channel. I could see on the serial console that it was doing Auto-reload but I verified code.py had actually changed. I did a microcontroller.reset() and then it was actually using the pins I defined. I'm just watching audio on LEDs so not sure if samples will then play on both channels but there was certainly activity on right_channel when...

#

BTW the PWM does not continue after a sample is playing resulting in clicks. I think this differs to the RP2040 implementation which carries on PWMing at quiescent_value. Is that a bug? I noticed it today on 6.1.0 and wayback when writing and playing Adafruit Learn: Quick Draw Duo. You can hear the clicks in the video as thuds at the end of the exaggerated richochet.

still zephyr
#

@mental nexus Are you planning to make a Cartesian plane widget, if not I would like to work on it

mental nexus
manic glacierBOT
still zephyr
manic glacierBOT
manic glacierBOT
#

.. implemented only on raspberrypi, where it's easiest. If this is considered useful enough, we can potentially implement it on at least SOME other ports. However, each port is a bit different so for now I just made them ignore the frequency= constructor parameter and return 1_000_000 for the frequency property.

This is useful to me because using a frequency of 1000 lets me track the length of WWWB symbols, which are from 200ms to 800ms long.

fossil gorge
#

Crud. TIL that the PyGame library doesn't support Apple's M1 processor yet.

ornate breach
#

😮

nocturne monolith
#

YES! Just made the Feather M4 feather light up when I push a button. I'm proud of myself ^_^ This it my first CircuitPython experience!

ornate breach
#

nice job! 🙂

#

blinky type projects are greatly undervalued for the impact they have 🙂

nocturne monolith
#

Time to hook up a speaker for a tone!

fossil gorge
nocturne monolith
#

MUAHAHAHAHA

fossil gorge
#

Now I'm concerned just what tone you're planning on emitting! lol

nocturne monolith
#

Exactly B#.

#

in 3/4

pulsar bloom
#

+1 on changing PulseIn frequency.

nocturne monolith
#

Actually, I hooked up the button to a keyboard. Small steps!

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Thank you! I don't have the hardware to verify, but I also noticed these changes bring things in line with the above MX25R6435F part.

The two devices still have a different start_up_time_us, not sure if important. If CircuitPython is loaded from a uf2 bootloader, as is customary on Adafruit boards, it does not matter.

@tannewt looks like you may need to pick up this change for nvm.toml.

#

I spent much of the weekend developing a project on the Feather RP2040 that uses RGBMatrix.

Occasionally (1 in 20?) times when I would write out code.py, the board would freeze (USB stopped, matrix scanning stopped). A hard reset cured it, and I never lost my CIRCUITPY contents.

@ladyada also saw this at least once while she was testing the code, but we decided at the time to brush it off. Unfortunately, it's real and it's still there.

idle owl
#

@lone axle You up for pulling down a PR and seeing what the min-similarity-lines threshold would need to be to get it passing?

idle owl
#

@lone axle Then if you could PR the change to that PR, I'd really appreciate it.

#

If it will let you anyway.

#

Or push directly to the PR, whatever works.

#

If neither works, you can make a separate PR. Rerunning the Actions job on PRs seems to pick up changes to .pylintrc.

manic glacierBOT
onyx hinge
#

squeee .. I PR'd into pico-sdk and they accepted it

manic glacierBOT
manic glacierBOT
#

Closes #4417

I only compile-tested this for feather rp2040 with

diff --git a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk
index f4106b94a..f891c3668 100644
--- a/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk
+++ b/ports/raspberrypi/boards/adafruit_feather_rp2040/mpconfigboard.mk
@@ -7,3 +7,5 @@ CHIP_VARIANT = RP2040
 CHIP_FAMILY = rp2
 
 INTERNAL_FLASH_FILESYSTEM =...
manic glacierBOT
#

How does this handle interaction with the mandatory 5s delay (CIRCUITPY_USB_CONNECTED_SLEEP_DELAY) after first startup? That relies on the use of port_interrupt_after_ticks() to exit when it is ready to enter true deep sleep. It caused problems on my STM32 implementation if the sleep duration was less than five seconds - you implementation may catch it automatically but I figured I'd check in about it.

ionic elk
#

Does anyone have experience using SWO as a logging output in Jlink?

manic glacierBOT
modern wing
#

Good afternoon all you wonderful folks!

idle owl
#

<@&356864093652516868> CircuitPython Weekly meeting in a few minutes here. If you're participating with Hug Reports and Status Updates, please add yourself to the notes doc. https://docs.google.com/document/d/11uksHbpF2KT8sBC9Bov9XLtSgM62HXAHUKVxKhjr5cE/edit

#

We're finishing up an internal meeting - we'll be there soon!

#

@slender iron Reminder that you're on notes for the meeting today. I am still unsure of my power status. Seem stable? But 🤷‍♀️

slender iron
#

yup, on it

idle owl
#

Thanks!

manic glacierBOT
idle owl
#

BRB

silver tapir
#

lurking

modern wing
#

chonk++;

slender iron
#

👍

lone axle
manic glacierBOT
lone axle
slender iron
#

🥚

manic glacierBOT
#

This example hangs the board after a few seconds if AUDIO_DAUGHTERBOARD = True is changed to AUDIO_DAUGHTERBOARD = False to do local wave audio:

https://github.com/kevinjwalters/circuitpython-examples/blob/master/pico/larson-scanner.py

https://github.com/kevinjwalters/circuitpython-examples/tree/master/audio

Serial console dies, CIRCUITPY no longer works, PWM pins are left PWMing.

slender iron
#

committee? maybe

lone axle
#

Committee I think. A few of the weblate contributors were talking with each other in the chat during my stream over the past weekend.

cobalt grail
#

A big hug to the weblate GANG.

thorny jay
#

😊

still zephyr
#

Sorry for my "unreadable" comments ....

slender iron
#

(on desk of ladyada last night)

#

it's a flat flex cable pinout for easily connecting displays

idle owl
slender iron
#

@still zephyr have you tried reading the I2C registers directly?

#

I wouldn't wait for the pico-sdk

solar whale
#

1 cord = 3.6 cubic meters

thorny jay
#

And the Blue LED will be what?

still zephyr
slender iron
#

🙂 it's usually my preference

#

since you can use the datasheet as documentation for it

blissful pollen
#

text only for now! sorry forgot to add it to the status area too

slender iron
#

got ya

gilded cradle
slender iron
#

@blissful pollen audomixer for rp2040 would be good

#

it uses assembly that the cortex m0 doesn't have so it'd need a generic C implementation as an option

blissful pollen
#

Sure i'll take a look at that

slender iron
manic glacierBOT
solar whale
#

Sorry -- I have to leave early -- have a great week 👋

slender iron
#

@blissful pollen picking up and finishing pending PRs would be awesome too

still zephyr
#

Thanks @lone axle 🙂

blissful pollen
slender iron
#

yup, the old core ones

#

I think the one to switch to different python files to run is pretty close

idle owl
slender iron
#

@thorny jay are you text only still?

thorny jay
#

I'll try my mic.

slender iron
#

kk

still zephyr
#

@idle owl Yes it helps, thank you very much.

#

@timber mango Thank you for contributing and be in your first CP meeting 🙂

idle owl
lone axle
#

One of the ways we've attempted to alleviate this issue with pin names in some of the libraries to allow keyword arguments for uses to add to the initialize if they want to customize the pins that are used (which is needed in the case if pin names are different). A more general "board-level" solution would be really cool though.

idle owl
#

You're entirely welcome!

timber mango
#

@still zephyr it was a pleasure to join the meeting.
@idle owl thanks for the clarification.

If you guys want to discuss further the PR just ping me.

idle owl
crimson ferry
#

FeatherS2, e.g., microcontroller.pin.GPIO9 board.D11 board.IO9 board.SCL

#

(not the same physical pin location as D11 on other Feathers)

slender iron
thorny jay
#

Thank you.

#

And EU will do the summer time and it will be the "usual" time again.

blissful pollen
#

@slender iron quick question, since the M4 is pretty port specific worth splitting audio mixer into common-hal?

mental nexus
#

Thanks all!

modern wing
#

Thanks y'all!

#

Another meeting in the bag 🙂

slender iron
#

@blissful pollen I don't think so because it'll work on any cortex with those instructions

#

@onyx hinge has some #if statements in the mp3 lib that you can use

blissful pollen
#

okay that answers my next question if you knew where they'd be 🙂

slender iron
#

np

manic glacierBOT
thorny jay
#

So I believe those 5 Dx are wrong, they should match M4 things.

slender iron
#

yup

thorny jay
#

D5 = org_board.IO33
D6 = org_board.IO38
D9 = org_board.IO1
D10 = org_board.IO3
D11 = org_board.IO7

#

So this should be changed (or at least checked in the code) and @atomic summit should fix that graphic too.

manic glacierBOT
atomic summit
#

Fixing the graphic is not an option as I ship printed cards with my boards and have shipped thousands.

manic glacierBOT
#

Hypothesis #2: recvfrom_into() needs the port byte order switched. The TCP case works with recv_into() but not with recvfrom_into(). Swapping the port byte order in CircuitPython UDP server code between recv and send does work:

    size, addr = s.recvfrom_into(buf)
    print("Received", buf[:size], size, "bytes from", addr)

    addr = (addr[0], htons(addr[1]))  #test

    size = s.sendto(buf[:size], addr)
    print("Sent", buf[:size], size, "bytes to", addr)
simple pulsar
manic glacierBOT
#

This resolves an error in redrawing when using transform_xy with displayio.TileGrid.

The logic for displayio_tilegrid_get_refresh_areas did not consider the TileGrid's transform_xy value and the transform of dirty rectangles was not being performed.

Here is the result with version Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit PyPortal with samd51j20:
![IMG_7566](https://user-images.githubusercontent.com/33587466/112062451-f7ac8580-8b2d-11eb-8966-b88dacc971cb.jp...

onyx hinge
#

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

manic glacierBOT
manic glacierBOT
slender iron
manic glacierBOT
slender iron
#

this might be a record for me:

manic glacierBOT
#

@bablokb You almost always want pin in use checking because it catches misuses. This is a very special case where you want to share display busses. The easiest solution by far is to use a separate pins for the second DC and reset. Otherwise, we could check if another display bus objects are using the same reset and DC and ignore the duplication. It's not a priority for us though.

orchid basinBOT
#

Hi, thanks for adding this. Could you please remove TinyPICO-Compatible from the features? Here's a guide that has the values you can use: https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-downloads.

We need to limit these because when we didn't the available options in the filters on circuitpython.org got out of control and wasn't very useful anymore. Thanks.

manic glacierBOT
#

But is this really a problem? If someone is using this very low-level buffer utility, then it is expected that they would explicitly call refresh. I reckon, this is probably not for the faint of heart, and then the only question is, whether all functions in circuitpython should be high-level, or is it OK to allow the more experienced users to directly tamper with the hardware. Perhaps, this would set some precedence, so I understand your reluctance to open a potential Pandora's box.

I'...

orchid basinBOT
#

Hi, thanks for adding this. Could you please remove TinyPICO-Compatible from the features? Here's a guide that has the values you can use: https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-downloads.

We need to limit these because when we didn't the available options in the filters on circuitpython.org got out of control and wasn't very useful anymore. Thanks.

Oh yeah, sure! I actually didn't mean to leave that in the features list after ...

manic glacierBOT
hoary moat
#

Has anybody else seen Feather RP2040 stop running CP after ~36 hours on time? Neopixel is off and heartbeat LED is off. Running Friday’s S3 uf2

onyx hinge
#

@mental nexus thanks for that PR!

manic glacierBOT
#

However, true deep sleep seems to not work with a lot of the alarm systems I use in fake deep sleep, is hard to log, and frequently disconnects my Jlink. The RTC also seems to retain problems across resets, so the chip also needs to be power cycled to get back up and running again, which further complicates things. I'd appreciate any other pairs of eyes on the problem.

I'm confused; is this problem now gone?

#

I'malso curious whether we should consider renaming the functionality of common_hal_alarm_light_sleep_until_alarms to simply common_hal_alarm_wait_until_alarms, since it doesn't really sleep any more than the circuitpython default, and try to fold more power saving into common_hal_alarm_light_sleep_until_alarms. STM32's STOP mode might be a good fit for this, as would the ESP32S2 light sleep feature.

The nRF52 sleep PR does have a true light sleep, so I think we could keep it. But ...

mental nexus
# onyx hinge <@366059101203202052> thanks for that PR!

I was glad to finally catch this bug. The end behavior was totally weird since it depended on how fast it was drawn, since the refresh timing seemed to matter on the final display result. It lets me know I eventually need to learn how refreshes get triggered, but that’s yet another rabbit hole.

manic glacierBOT
manic glacierBOT
#

Addresses UDP server issue https://github.com/adafruit/circuitpython/issues/4445 by changing the recvfrom_into() port number into network byte-order, so that sendto() sends to the correct client port.

Successful sequence:

CircuitPython socketpool UDP Server:

code.py output:
Connecting to Wifi
Self IP 192.168.6.198
Server ping 192.168.6.198 0.0 ms
Create UDP Server socket ('192.168.6.198', 5000)

CPython UDP Client:

Create UDP Client Socket
Sent 12 bytes

...

fossil gorge
#

Sorry I missed the meeting this week. <feelsbad.gif>
It's been... a day. Add to it the first day of kids physically back in school in 1+ year. Will catch up on the YT replay

manic glacierBOT
#

My application needs to monitor these time pulses relatively precisely (ms-level) while doing other things (redrawing a displayio screen). I need something running more predictably than a "forever loop" of python bytecode that also redraws a display.

Using exactly the approach you suggest (count time periods with polling plus monotonic_ns) I actually spent quite a bit of time believing I was dealing with interference from the power switching of the RGBMatrix display interfering with a wea...

ornate breach
#

I’m hoping to be settled enough with my work routine to really start at least lurking during the meetings.

manic glacierBOT
#

Why do this in C at all? Can't Python do it? The RTTTL library is very similar but in Python: https://github.com/adafruit/Adafruit_CircuitPython_RTTTL/

The main difference is that adafruit_rtttl cannot play things in background while other Python code runs.

Perhaps there is a lower level API we need to add. I highly doubt we need to do any parsing in C though.

It would be nice to be able to implement AudioSample classes in Python, but I thought there was a conscious decision ...

manic glacierBOT
#

I want to attach 12 (!) displays to a pico, using two SPI-busses. Although the pico is a pin-monster, this does not work out if I have a dedicated dc-pin for every display. (I'm building an advent Calendar with two picos and 24 displays in total).

"Catching misuse" is fine as long as the check is for real misuse and not for non-standard but valid usage. Since this is no priority on your side, I will see if I fork the library or switch to C.

manic glacierBOT
#

I too have this issue since using circuit python on an RPI pico, and also a nucleo development board using the newer STLINK-V3 which also provides composite USB devices and an MSD for easy flashing.

I have been using Ubuntu 18.04, but I just upgraded to 20.04 hoping they may have fixed it. It has only been a day and no crashes (yet) but I have turned off auto mount, and I try to safely eject the drive before turning it off. (This seems to help).

Last night I discoved this in my dmesg, t...

manic glacierBOT
#

We have a consultant helping us with Smoothie, and he has suggested this...

"the correct way to handle it is to report as a removable device, and generate an eject event rather than a disconnect
and we want to do that anyway because there's some really annoying W10 bugs related to disappearing MSC devices"

This won't help when the CP device is just turned off or tugged out of the port though, but maybe a control key in the REPL could tell it to do this which we can do before t...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@kevinjwalters yes currently any write <= 2 bytes will go through a bitbangio instance:

https://github.com/adafruit/circuitpython/blob/98425c9a9d594d05249bcf4e8edf47075d613111/ports/raspberrypi/common-hal/busio/I2C.c#L159-L161

I've got an outstanding PR to change this to == 0 since rp2040 can handle 1 and 2 byte writes fine but will not do a 0-byte address-only write (used to check for the address ACK when probing the bus). I think this was the result of some misunderstanding or very ...

manic glacierBOT
jolly roost
#

Hi, we would like to add a new board (this one: https://github.com/watterott/senseBox-MCU) to circuitpython (our status: https://github.com/felixerdy/circuitpython/tree/main/ports/atmel-samd/boards/sensebox_mcu). The board is samd21 based and we are already able to run easy programms. The Board has 2 XBee Slots which can equipped with wifi, sd or lora-bees. One problem we are facing at the moment is, that all pins are not powered by default. The Board has the option to power each port individually (see: https://github.com/watterott/senseBox-MCU/blob/master/arduino/samd/variants/sensebox_mcu/variant.cpp#L199 and https://github.com/watterott/senseBox-MCU/blob/master/arduino/samd/libraries/senseBoxIO/src/senseBoxIO.h how it's done with arduino) When we try to power the xbee 2 ports with ```
xb2_pwr = DigitalInOut(board.XB2_PWR)
xb2_pwr.direction = Direction.OUTPUT
xb2_pwr.value = True

manic glacierBOT
stuck elbow
#

@jolly roost wait, you are trying to power a radio module from a gpio pin?

#

@jolly roost you are aware that those pins can supply like 4mA of current only?

jolly roost
# stuck elbow <@!570235973988777985> you are aware that those pins can supply like 4mA of curr...

the modules are powered with 3.3V directly from the regulator not from the gpio pins. But its possible to deactivate the whole power circuit for each interface (UART, I2C, XBee with SPI etc.) individually. In arduino it works easy and its also possible to power up the i2c power circuit on the board an read for example data from an bme680. But when I try the same with the XBee 2 PWR the board crashes

stuck elbow
#

what does it give as the reason for entering the safe mode?

jolly roost
#

You are in safe mode: something unanticipated happened. The microcontroller's power dipped. Make sure your power supply provides enough power for the whole circuit and press reset (after ejecting CIRCUITPY).

manic glacierBOT
slender iron
#

you may have in-rush current when enabling a portion of the board that dips the main supply

manic glacierBOT
stuck elbow
#

bigger caps \o/

onyx hinge
#

the microcontroller may have different brownout settings, but those aren't exposed in CircuitPython. A custom build apepars able to change them. ```#ifndef SAMD21_BOD33_LEVEL
// Set brownout detection to ~2.7V. Default from factory is 1.7V,
// which is too low for proper operation of external SPI flash chips
// (they are 2.7-3.6V).
#define SAMD21_BOD33_LEVEL (39)

#

and incidentally there you have our motivation for the value we use

#

@jolly roost

jolly roost
#

thank you for your help. I'll try to change the brown out detection level and try again

manic glacierBOT
#

Why do this in C at all? Can't Python do it? The RTTTL library is very similar but in Python: https://github.com/adafruit/Adafruit_CircuitPython_RTTTL/

The main difference is that adafruit_rtttl cannot play things in background while other Python code runs.

Yup! True.

Perhaps there is a lower level API we need to add. I highly doubt we need to do any parsing in C though.

It would be nice to be able to implement AudioSample classes in Python, but I thought there...

#

Right now we can only playback RawSamples, WAV and MP3. It'd be nice to add a synthio module that can generate audio based on settings set from Python. For buffering changes, it could also take in MIDI commands and apply them over time.

The Teensy Audio library is a really neat Arduino library we can reference: https://github.com/PaulStoffregen/Audio

It has these synth modules:

  • wavetable
  • drum
  • string
  • sine
  • sine_hires
  • sine_fm
  • waveform
  • waveformMod
  • pwm
  • toneswe...
#

@dhalbert sorry Dan, I hadn't updated the original PR message since I fixed my issues. My original thinking was that the term "light sleep" might be better suited to more power saving tasks, since the ESP32S2 light sleep saves no power compared to time.sleep, and I thought the same would be true for STM32. But since Scott argued that we can still put in manual clock gating into other ports, I think our current situation is fine.

I wouldn't be opposed to nailing down some official guideli...

#

Ok, well I'm ok with this. Your need makes sense. I think that it'd be good to:

  1. Error in other ports if they get any other different value since they don't try to change.
  2. Switch trigger_duration to cycles instead of microseconds as well.
  3. Document the class as a whole in dealing with cycles, not microseconds.

Reading the docs here may help you understand what I mean: https://circuitpython.readthedocs.io/en/6.1.x/shared-bindings/pulseio/index.html#pulseio.PulseIn Updating from ...

#

I want to attach 12 (!) displays to a pico, using two SPI-busses. Although the pico is a pin-monster, this does not work out if I have a dedicated dc-pin for every display. (I'm building an advent Calendar with two picos and 24 displays in total).

We don't support 12 displays out of the box anyway. So, you'll need to compile it yourself regardless. Since you are doing that, you can comment out the pin check too: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/displayi...

manic glacierBOT
#

Also, I don't see the difference between a screen, and a DAC: both are peripheral devices, they just, well, display data in different ways. So, if you can pipe data into a DAC, or serial port, then why should you not be able to do the same with a display? I understand that the display requires extra functions, but that is not really a conceptual difference.

You can with busio.SPI. displayio is meant to be higher level and also allow display sharing with the CircuitPython core f...

onyx hinge
#

@slender iron as far as I could tell you also got all issues @tulip sleet raised resolved, but I was too cowardly to merge it with my approval.

slender iron
#

🙂 I'm working on imx now

onyx hinge
#

squee, much appreciate

slender iron
#

kinda daunted about testing all of the boards though....

tulip sleet
#

i was waylaid by a veterinary event; all done now

slender iron
#

everything ok?

onyx hinge
#

I have 1010/1020/1050/1060 evks, I can go through and test 'em all. @slender iron are you doing it in tinyuf2 or cp or both?

tulip sleet
#

Gryphon had a abcess on her lip that opened up; we didn't know there was an abcess, and she was bleeding noticeably. She may or may not need dental work later. We though it was more serious.

#

she has been in rough shape for a couple of weeks

slender iron
#

that's good news overall I think

tulip sleet
#

yah

slender iron
#

I remember you mentioning that

tulip sleet
#

she is quite old

slender iron
#

I'd love to hand it off to you 🙂

#

I kinda feel like I should do the other external flash settings too. That way we'd be on nvm.toml completely

onyx hinge
#

okay -- well, I am pretty sure that when you boot tinyuf2->cp, that it's tinyuf2's flash_config that is used even after it hands off

#

but I could be wrong, etc

slender iron
#

@onyx hinge ya, that sounds right actually

onyx hinge
#

but to keep in mind when testing!

slender iron
#

because it's the bootrom that sets everything up

#

should we remove the flash settings from CP completely?

slender iron
#

I guess that'd mess up teensy

#

I wonder if we want a separate repo for imx flash

#

then we pull it into cp and tinyuf2

onyx hinge
#

could be?

#

it doesn't belong "in" nvm.toml, does it?

#

"nvm.jinja"

#

heck maybe somebody wants your rp2040 generator for their pico-sdk project

slender iron
#

ya, that's a good question

#

nvm.toml could have the python script or a couple for different techniques

#

least common denomiter settings vs detect and change settings

#

before I switch away from rp2040

#

I need to think on the imx some more

lavish steppe
#

i just rebuilt circuitpython and had to manually install cascadetoml with pip btw dont know if i should make it an issue or what but never had to do that before

tulip sleet
lavish steppe
#

oh btw the digitzer works great on windows but acts super weird on mac, dont have linux to test but im guessing will be weird there too. it works but sometimes

tulip sleet
#

it's been very difficult or impossible to make an HID definition for certain devices that works across the three major platforms. Same has been true for Gamepad

lavish steppe
#

that must be super annoying 😦

tulip sleet
#

yah, frustrating ... OK, I have updated the Learn Guide to tell you to do pip3 install -r requirements-dev.txt.

lavish steppe
#

you added it to before the builder has git cloned the repo isn't requirements-dev.txt in the repo?

tulip sleet
#

oops, yes :/

lavish steppe
#

haha no problem glad i could help and not just ask questions 🙂

orchid basinBOT
#

Ok, I have the first piece of this finished. I decided to put the JSON file building code into the circuitpython-build-tools when the bundle is built and it will be attached as an asset with the bundle.

One of the complication I was realizing that we would run into by having the files on Amazon S3 and the web files on GitHub would be CORS or Cross Origin Resource Sharing policies. This is a mechanism by the browser to help reduce Cross Site Scripting vulnerabilities and if we had the files...

mental nexus
#

It seems like the imx boards are going to be the next exciting area for CP. Is there a suggested demo board to use to get started on the RT1011 while we wait for the Metro M7 that’s coming soon? Or if coming soon is really soon, soon, then is it best to wait a bit for that?

ionic elk
#

@tulip sleet can I chat with you real quick about a sleep thing?

tulip sleet
#

sure, in a minute

ionic elk
#

np, whenever you have a bit

tulip sleet
#

@ionic elk ok, in Amelia

orchid basinBOT
slender iron
onyx hinge
#

huh, that's weird. I guess the system doesn't really have any way of noticing duplicate entries. ``` { MP_OBJ_NEW_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO_09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_09) },
...

// UART
{ MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_09) },
raven canopy
#

@gilded cradle re Justin's question ^^: circuitpython-build-tools will need a new release for your changes to be pushed to PyPI, and subsequently used when the bundle release happens tonight.