#circuitpython-dev

1 messages ยท Page 362 of 1

slender iron
#

the teensy4.x are cheaper but don't break out SWD

#

@onyx hinge nope, it's not that smart. I suspect it'll just find the first

gilded cradle
#

Correct @raven canopy

raven canopy
#

๐Ÿ‘ just wanted to make sure you knew. its one of those sneaky details. ๐Ÿ˜„

gilded cradle
#

I generated a json file locally that I'm just using for my test code

onyx hinge
#

@raven canopy it's nice to see you dipping your toes back in!

orchid basinBOT
raven canopy
#

hai hai. its nice to be dipping again. ๐Ÿ˜†

ionic elk
#

@tulip sleet

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I have nothing connected to the QT Py except for the USB C cable and I am reading the pin value for A3 and it gives me a reading that fluctuates between around 25000 and 32000 and that does not make sense to me. Is this normal?

Here is my code:

import board
import time
from analogio import AnalogIn

therm = AnalogIn(board.A3)

while True:
    v = therm.value
    print(v)
    time.sleep(0.1)
lone sandalBOT
orchid basinBOT
#

Demo is working! https://tranquil-massive-cilantro.glitch.me/ (random name generated by glitch) I have it downloading adafruit_ssd1305 and adafruit_ht16k33 by default, but you can specify a libs parameter. It will download any dependencies as well. It just needs a bit more polish, but this looks like it is totally doable using JavaScript. Currently the JSON and zip files reside on glitch so I didn't have to deal with CORS policies and I need to have it detect the latest bundle version still.

orchid basinBOT
orchid basinBOT
#

Demo is working!

Nice! Its quite speedy, to boot.

I have it downloading adafruit_ssd1305 and adafruit_ht16k33 by default

The ht16k33 folder was empty when I tried it a couple times, but probably a minor issue.

Currently the JSON and zip files reside on glitch so I didn't have to deal with CORS policies and I need to have it detect the latest bundle version still.

The libraries page JS might give you a head start on grabbing the latest version of the JSON file: https://g...

mental nexus
#

Looks like the imx EVK 1010 evaluation board doesnโ€™t have many pins broken out (for example to develop ParallelBus). And actually ParallelBus may not get much use on the early boards for the RT1011. Iโ€™ll keep my eyes open to see how the imx development proceeds and see if thereโ€™s a topic that makes sense to get involved with.

#

Looks like I spoke too soon, I looked one more time and found an app note on an 8bit parallel demo on the EVK1010 board (6800 bus, not 8080 like on our typical LCDs): https://www.nxp.com/docs/en/application-note/AN12813.pdf using the FlexIO. So it looks like thereโ€™s room to explore on the board you mentioned.

#

Just for completeness (and for future me when I forget where I found this), hereโ€™s an 8080 parallel LCD demo (ParallelBus) on an older NXP chip and demo board. Seems like the โ€œFlexIOโ€ configuration is similar to that on the RT1011: https://www.nxp.com/docs/en/application-note/AN5313.pdf

manic glacierBOT
onyx hinge
#

@mental nexus the I/O layout of the 1010-evk is a bit weird and limited. Be especially careful if you're using the schematic because some things that look like they are connected are NOT because a 0 ohm resistor is marked "DNP" or "do not populate"! On the doubled Arduino-style headers there are some connections on the inner half but far from all connections are used.

mental nexus
#

Thanks for the warning. In looking at the docs, many of the pins arenโ€™t broken out to headers. For 80 pin package I guess they use them for other purposes on the board. Will stew on this a couple more days and decide whether to order one of these.

jaunty juniper
#

say, I was looking at the _data/files.json file on the circuitpython-org repository and noticed it's technically not correct json (there's a , at the end of some lists), but I don't know where the code generating it is to maybe issue a fix ?

onyx hinge
#

@jaunty juniper I think they are usually generated by code but were hand-modified the last time around due to a bug

tulip sleet
#

yes, that might be it, I just grep -v'd some stuff out of the json

manic glacierBOT
idle owl
#

@slender iron Ping me when you're around to chat about the pre-commit page. No rush.

onyx hinge
#

@jaunty juniper if you want to take this on ^^ it would be helpful. If the issue is too terse I am happy to expand on it

tulip sleet
#

looks like my hand edit did add trailing commas:

onyx hinge
#

I updated issue #4470 with more information so someone else may have a chance of understanding what is needed ๐Ÿ™‚

#

(it says "issue opened" above, but it was transferred from circutpython-org where I'd mistakenly opened it initially)

jaunty juniper
#

ah I see

#

I was investigating ways for circup to get info on the latest beta without doing parsing on its own

tulip sleet
#

#4470 needs to be fixed before the next release of any kind

mental nexus
#

I feel like I'm being dense, but I can't find an example in shared-bindings that takes a string as an input parameter. I'm looking to add a filepath input string to a function, and can't seem to find how to track down an existing example.

onyx hinge
#

@mental nexus a lot of things take opened files rather than filename strings ..

mental nexus
onyx hinge
#

@mental nexus try ipaddress_ipv4address_make_new in shared-bindings/ipaddress/IPv4Address.c

mental nexus
#

Cool, will look there.

onyx hinge
#

It's parsed as a generic object { MP_QSTR_address, MP_ARG_OBJ | MP_ARG_REQUIRED }, then checked for being a string by shouting at it MP_OBJ_IS_STR(address) and then the bytes and (byte-?)length of the string can be extracted by additional shouting GET_STR_DATA_LEN(address, str_data, str_len);

mental nexus
#

Exactly what I was looking for. Thanks jepler!

manic glacierBOT
tulip sleet
#

@slender iron (when you're up) and @onyx hinge too if you're interested. I would like to have a little release planning meeting about what should go into 6.2.0 and when we should branch it. @ionic elk has STM sleep code that will be ready to go soon, but it has some internal refactoring and renaming and will require revision of the nRF sleep PR. The nRF sleep PR is blocked by a USB issue I need to look at. We can also talk about whether the new flash stuff and any I2C fixes should go into RP2040 before 6.2.0.

ionic elk
#

@tulip sleet I'm around all day

manic glacierBOT
#

Firmware

Adafruit CircuitPython 6.2.0-beta.1-dirty on 2021-03-22;

Code/REPL

import time
import board
import busio
import wifi # without this import, i2c won't work
import adafruit_mpu6050

i2c = busio.I2C(board.SCL, board.SDA)
time.sleep(1) # without this delay, i2c won't work
mpu = adafruit_mpu6050.MPU6050(i2c, address=0x69)

while True:
    print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (mpu.acceleration))
    print...
idle owl
#

Seems like spamming the result is irrelevant here, because the LED is on or off.

tulip sleet
#

no, because who cares whether the light goes on and off due to bounces. It may not even be visible

idle owl
#

Ok that's what I thought.

#

Thanks.

tulip sleet
#

it might be interesting to come up with an example where debouncing is crucial: a simple one would be counting button presses

#

like printing out a character on each press

idle owl
#

There's quite a few already. I usually do simple state machines to handle it though, so you can track press and release without a separate module.

#

Not sure we've done anything with the debounce being the focus though. Maybe Dave Astels did at some point since he wrote the debounce lib?

#

No idea.

onyx hinge
#

@tulip sleet happy to chat or get on a video call about it but I don't feel like I have a high level overview of the state of things.

orchid basinBOT
#

The ht16k33 folder was empty when I tried it a couple times, but probably a minor issue.

Oh yeah, I just noticed mine is too. I'll look into this next.

The libraries page JS might give you a head start on grabbing the latest version of the JSON file: https://github.com/adafruit/circuitpython-org/blob/master/assets/javascript/libraries.js

Thanks

And while I love cilantro...tranquil, massive cilantro does sound ominous. ๐Ÿ‘ป

Yeah, I should probably change the name...

cobalt grail
#

Hej weblate GANG - Got my matching tattoo today! @fossil gorge @still zephyr blinka

manic glacierBOT
#

We believe this the error "common_hal_busio_spi_write: status 400" has been fixed #4048. Please feel free to re-open (or open a fresh issue if "re-open" is not available) if this problem still exists.

We are aware of the problem getting the 1020-EVK to work at all (#3510) and hope to address it soon.

Note that in the datasheet, "SDI" indicates Serial Data In from the point of view of the microcontroller, which is MISO (microcontroller in, secondary out) in SPI parlance.

jaunty juniper
#

@tulip sleet trying to run build_board_info.py locally I run into Expecting value: line 71 column 5 (char 979) because it loads the current files.json from circuitpython-org, should I PR a fix for the file ?

tulip sleet
#

certainly if it's easy clean up the current file ; thank you

manic glacierBOT
orchid basinBOT
onyx hinge
#

just to share some frustration .. I was trying to check out how I2C works on the 1010-EVK with some 6dof sensor I wasn't familiar with. didn't work. Started checking the schematic and .. after much hair-pulling .. noticed that THE WHOLE SENSOR is a "DNP" part. Oh, that's why it didn't show up on bus scan...

fossil gorge
#

What's "DNP"? I assume not "Do Not Pull-hair"?

tulip sleet
#

do not place

analog bridge
#

do not populate

tulip sleet
manic glacierBOT
#

Two Learn Guide feedback entries:

On Win 7 after trying out datalogging example T\the Pico became ReadOnly. Used flash nuke to unbrick it then CRASH !!!! (blue screen of death) repeatedly But on Win 10 it works fine. On Win7 it causes crash as soon as module is plugged into USB (with CIRCUITPY in it)
Using the beta 4 version. Will try new version as soon as it becomes available. Problem is only related to Win7. On Win 10 it's working fine.

I wonder if anyone has come across a c...

slender iron
#

@tulip sleet I'm around if you want to talk 6.2

tulip sleet
#

now is good

onyx hinge
#

I'm around but it'd be slightly inconvenient to hop in a voice channel right now

manic glacierBOT
gloomy shuttle
#

I am playing around with the new Touch Deck guide but I am trying to use a FeatherS2. Unfortunately it doesn't use the same pins as the tft_featherwing expects. Now the problem is that tft_featherwing_24 and tft_featherwing_35 don't expose the ts_cs and sd_cs pins. I was able to get it to work, but should these be exposed so users can use other feather boards with those libraries easily?

mental nexus
onyx hinge
#

what, when I told you to watch out for DNPs? yeah. ๐Ÿ˜“

gloomy shuttle
lone axle
#

They default to the standard adafruit pinout if you don't pass them.

#

Ah I see

manic glacierBOT
#
    { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_09) },
    { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_10) },
    { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_TX), MP_ROM_PTR(&pin_GPIO_09) },
    { MP_OBJ_NEW_QSTR(MP_QSTR_ESP_RX), MP_ROM_PTR(&pin_GPIO_10) },
    { MP_OBJ_NEW_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO_10) },
    { MP_OBJ_NEW_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO_09) },

Before my change there are a magnificent THREE different pairs of UART RX/TX pins available!
...

gloomy shuttle
#

I created a pull request if the keyword arguments should be exposed in the subclass.

lone axle
#

To answer your original question though, yep it definitely should allow for that. Excellent thanks for making that PR. I will review that tonight or tomorrow.

#

Using the actual argument names like you did instead of kwargs like I said is actually better I think. Good call on that. It will make the documentation more clear.

thorny jay
gloomy shuttle
manic glacierBOT
#

without this, the baud rate could be wrong; in my testing, it was low by a factor of 2 when requesating baudrate=1_000_000 (1MHz).

When passing the baudrate in to LPSPI_MasterInit, the setting is made automatically, but LPSPI_MAster_SetBaudRate just returns it via the out-parameter tcrPrescaleValue.

This is related to #3062 but is not a solution for it, as there remain long inter-byte gaps.

Now with correct 1MHz SCK rate, but still with multi-microsecond gaps between bytes:
![image]...

stuck elbow
#

How can I test the 8-bit parallel display with a Feather RP2040? I don't see a set of 8 consecutive gpios on it, is there some trick?

manic glacierBOT
ionic elk
#

@tulip sleet quick question for you about power, got a sec?

manic glacierBOT
onyx hinge
#

@stuck elbow I think they have to be consecutive but need not be aligned, so try D4 as the base

manic glacierBOT
#

@dhalbert 786k is the new 400k.

Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Raspberry Pi Pico with rp2040
>>> import board, busio
>>> i2c = busio.I2C(scl=board.GP1, sda=board.GP0, frequency=786_000)
>>> big_buf = bytearray([0x81, 0x46, 0x81, 0x55])
>>> i2c.try_lock()
True
>>> i2c.writeto(60, big_buf)

From three runs measuring a chunk of clock pulses

Average Frequency = 399.436 kHz
Average Frequency = 401.070 kHz
Average Frequency = 399.787 kHz

Do...

#

This was raised by user "cake" on the discord chat on 24 March 2021 at 1:43 pm central.

Firmware

Adafruit CircuitPython 6.2.0-beta.4-84-gc81007afb-dirty on 2021-03-24; Adafruit PyPortal with samd51j20

Code/REPL

import board
import displayio
import vectorio

import time

display = board.DISPLAY


rect_palette = displayio.Palette(color_count = 2)
rect_palette[0] = 0xffffff
rect_palette[1] = 0x00ff00
rect_palette.make_trans...
tulip sleet
slender iron
ionic elk
#

I think I basically have it figured out but just wanted to check - when the USB delay is called, we want to delay the interval for a deep sleep alarm until the deep sleep actually starts, right? In ESP32-S2 I think it does this automatically because esp_sleep_enable_timer_wakeup doesn't actually set an interrupt itself, the actual deep sleep command sets that up. But it's relevant for STM32 because the alarms that alarm_time_timealarm_set_alarms creates can go off in the middle of the USB delay.

tulip sleet
#

when we start the USB delay we have no idea whether we should be real or fake deep sleeping

ionic elk
#

Right now I've made it so that when common_hal_alarm_enter_deep_sleep is called, it calls alarm_time_timealarm_prepare_for_deep_sleep which sets the alarm again, which will either replace it if it was too short (went off during USB delay) or too long (in which case it overwrites it)

tulip sleet
#

are you saying like if we want to deep sleep for 10 seconds but have to wait for 5 seconds for USB that we actually sleep for only 5 seconds after the first 5 seconds (i.e., make it more accurate?)

ionic elk
#

I'm saying that if I sent a command to sleep for 2 seconds on STM32, unless I have a system to catch that, the alarm will go off during the USB delay and it will never be able to wake up

tulip sleet
#

yes, got it, so on the ESP32-S2 this was not a problem because the alarm time was only considered when we actually started sleeping. Maybe the name of the function should be more accurate

stuck elbow
#

@onyx hinge oh, I missed gpio6 because it wa son the other side, thanks

tulip sleet
#

I remember noticing that

ionic elk
#

There are two ways to solve that - either we catch the problem before deep sleeping and just restart, or I can make it actually only start the timer once it's decided to fake/real deep sleep. I picked the second because it's closer to the ESP32

tulip sleet
#

I agree with the latter

ionic elk
#

In the majority of cases, alarm_time_timealarm_set_alarms does actually start the alarm. We just need an extra check to make sure it doesn't expire before deep sleep, so the code can always wake up.

#

Now that I think of it, this could actually happen with user code... if someone (foolishly) puts another form of delay or long calculation between alarm_time_timealarm_set_alarms and common_hal_alarm_enter_deep_sleep, this could still happen

#

It might actually be a clearer API to always start all time alarms only when actually sleeping? Or does that interfere with the ambitions to have alarms function as a proxy ISR?

manic glacierBOT
#

The speeds you ask for may not be precisely available based on the way the peripheral clock is generated. It's usually generated by dividing a higher-speed clock. I don't think it's necessarily a bug; you'd need to study the clock setting in the I2C driver.

This is common: for instance, when we have high SPI speeds on other chips, they are very approximate because the divisors are quite small.

#

Currently one option is to use the vectorio library and draw a polygon (rectangle). I think it will created โ€œfilledโ€ polygons only.

If you need an example of a vectorio polygon look at the needle on the recent Dial widget here: https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_Layout/blob/main/examples/displayio_layout_dial_simpletest.py

If youโ€™d like other basic examples let me know and I can try to find one m

tulip sleet
#

@ionic elk The alarm times are set as a time in the future, as an absolute time.monotonic(). That is, I want to wake up at time x, not x seconds from now. So whatever makes sense to preserve those semantics is best. If the alarm time has already expired, then we wouldn't sleep at all (or deep sleep would wake up immediately after exiting the VM).

ionic elk
#

@tulip sleet the current system is not sufficient, then. If that is the intent, we need to change both the ESP32-S2 and upcoming ports to double-check before deep sleeping that their wakeup time interval has not already elapsed, and restart (possibly with a warning saying they were late)

#

Ah I seem I'm kind of repeating you there

tulip sleet
#

we should probably do that; it was not a big deal because we were envisioning sleep times of minutes or hours, not a few seconds

#

this was all directed toward the magtag, waking up very occasionally to update things and then go back to sleep

ionic elk
#

Yeah I mean the super trivial way would be to just throw a value error if you try to sleep under 5s

#

deep sleeping for 2s in any case is kind of silly (even though it will work just fine on every sleep restart after the first plug-in)

tulip sleet
#

that might make sense. We were just being sloppy/urgent.

ionic elk
#

Yeah it's no biggie, just digging these things up as I go ๐Ÿ™‚

tulip sleet
#

it's worth the clean-up thinking, thanks.

#

if you don't want to bother with it now, it can be a long-term issue

ionic elk
#

I may go with my current system as of right now just because it's working and I want to get my stuff in

#

(ie both the ESP32-S2 and STM32 will push out the wakeup date by 5s after first plug-in)

manic glacierBOT
ionic elk
#

other trivial question, do we want to have a shortcut for setting the timealarms to relative time?

#

Seems like relative time is used a lot in the examples anyway and makes sense for many applications

tulip sleet
#

we decided not, to make the semantics clear

#

since it was "relative to what start time"?, and that wasn't obvious

#

but you could propose it

#

again, the magtag examples were more like: wake up at 9am and get the weather, as opposed to wake up 24 hours from now

#

so for longer periods it was an "alarm", not a "timer" (comparing your phone functionality, for instance)

manic glacierBOT
ionic elk
#

Probably would want to include it in the call itself, maybe, alarm_time_timealarm_set_delay_after_sleep

#

specifying that it's after sleep actually starts

#

or something

tulip sleet
#

or it could be a different keyword arg, I think that's the idea of the monotonic_time keyword arg name. There may be some discussion of this in the original issue or PR.

ionic elk
#

Seems like something to just propose in an issue. I'll do some research to see if there's existing basis.

tulip sleet
#

btw, we decided to defer these new sleep impls to past 6.2.0 to get the current beta to stable quickly

ionic elk
#

a-ok by me

#

makes sense

onyx hinge
#

@ionic elk how much imx-brain do you have active at the moment?

ionic elk
#

@tulip sleet one more thing for you. Do we care about second-level resolution re: alarm times? For short alarms they're often off by 1s, but as per the above I don't know that we care

#

@onyx hinge I can re-brain some i.MX, just finished an STM32 task I'm out of the weeds mentally

#

what's up

onyx hinge
#

I am trying to figure out how to phrase the question ๐Ÿ™‚

ionic elk
#

well, it's i.MX so take your time

#

lmao

onyx hinge
ionic elk
#

more like i.MESS amirite

onyx hinge
#

SPI transfers have absurdly long pauses between bytes

#

but all I do is, call their SDK function

#

and I don't know a better question to ask than, is that just how it is?

#

maybe, is there some other SDK function I overlooked for doing this with DMA, which is what someone in the issue mentioned? The lpspi API just has blocking and non-blocking versions, but neither uses DMA to the extent I can follow what they do

ionic elk
#

Have you poked around inside the SDK function to see if it's doing weird stuff? Maybe it wants you to do some kinda DMA thing?

onyx hinge
ionic elk
#

ah ninjad

onyx hinge
#

drivers/fsl_lpspi_edma.h oh maybe the dma related stuff is in a different file entirely

ionic elk
#

my question might be are the blocking calls slotting something weird in there, like a flash access or something that's taking lots of time

onyx hinge
#

shouldn't be?

ionic elk
#

SDK manual shows both Peripheral and eDMA sections

#

so they're considered separately there too

onyx hinge
#

OK, well, now I know why I couldn't find DMA

ionic elk
#

do you need the SDK API ref?

#

I have the PDF

onyx hinge
#

I don't know if I found that one yet

ionic elk
#

I don't think NXP docs are very good but still probably nice as a reference

onyx hinge
#

.. is there no html version ? ๐Ÿ˜ข

ionic elk
idle owl
#

@tulip sleet Mu works with Pico now? Or will..? Guide feedback mentioning the 2 COM ports.

onyx hinge
#

@idle owl 2 COM ports has been disabled for now

ionic elk
#

@onyx hinge ๐Ÿคทโ€โ™‚๏ธ

onyx hinge
#

largely because of mu

idle owl
#

Oh I thought that was still a Pico issue. Fair enough.

#

Thanks.

#

I knew it had been disabled. Was conflating things.

onyx hinge
#

@ionic elk so far the main thing I'd tried was identifying the routines used during SPI'ing (in the sdk) and put them in itcm but that didn't make any difference

ionic elk
#

@onyx hinge apparently there are also examples at <SDK_ROOT>/boards/<BOARD>/driver_examples/lpspi you could try those and see how the speed comapres

#

sorry am I flaking on what itcm is

#

oh right address ram

onyx hinge
#

I don't exactly know, but my understanding is it's a region of memory that is faster for fetching instructions from -- instruction tightly-coupled memory

ionic elk
#

yep just forgot momentarily, google was giving me silly company names

#

Well, sorry I'm not more helpful here, I didn't write i.MX busio so I'm not super strong on it.

#

But I think DMA is probably your best shot, especially if you can find SDK examples for it

onyx hinge
#

thanks for talking through it, it is nice in itself

manic glacierBOT
jaunty juniper
onyx hinge
#

@jaunty juniper good question!

#

Comparing to existing files is tough, especially due to the unsorted nature of the files. There are json diff programs but I've found that the files of that size tend to give them trouble, particularly the browser-based ones

#

I'd just make a plausible looking change and manually check the language list.

manic glacierBOT
orchid basinBOT
#

I have been tackling the CORS issue. I set up a GitHub IO website with these pages hoping that would fix the issue, but is still was running into the same error since the domains are different.

I worked around it currently by having it using a public CORS proxy for now, so it's getting the zip and json data from GitHub successfully, so this is very close to being done. In terms of security, this is fine because everything is public already. However, I don't want to be reliant on somebody ...

manic glacierBOT
orchid basinBOT
onyx hinge
#

@jaunty juniper honestly i'm not sure if/how to run build_board_info locally... hm

jaunty juniper
#

I can test it by adding a print at the end

#

and then there's moving language_allow_list and the related daunting prospect of testing build_release_files.py, I guess CI will have to do that

onyx hinge
#

CI does that everytime so I wouldn't worry there

orchid basinBOT
idle owl
#

Is the process to add a new board to Mu documented anywhere? I received guide feedback asking for it to be added to the "adding a board to CircuitPython guide" and I don't know the process well enough to add it.

onyx hinge
#

@idle owl @tulip sleet is probably the expert about that at the moment. As I understand it, the process will be greatly simplified (or totally eliminated) once they take some enhancements he's been working on, but the schedule for that on mu's end was unknown last I heard.

idle owl
#

Thanks. I'll talk to Dan about it when he's around next.

onyx hinge
#

the status quo is that somewhere inside mu is a list of USB IDs and if your product is not an Adafruit product then you need to add it there. Soon, though, it'll just look for some other things in the USB information that say CircuitPython, is approximately the thing

manic glacierBOT
#

Firmware

Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Raspberry Pi Pico with rp2040

Code/REPL

import time
import board
import digitalio
import analogio
import usb_hid
from adafruit_hid.mouse import Mouse
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
mouse = Mouse(usb_hid.devices)
kbd = Keyboard(usb_hid.devices)
x_axis = analogio.AnalogIn(board.A0)
y_axis = analogio.AnalogIn(board.A1)
btn_left =...
idle owl
#

The guide feedback linked the file that needs to be changed, and what needed to be added. But I wasn't going to simply take that as valid.

tulip sleet
#

@idle owl the Mu file containing the VID/PIDs for boards now wildcards all Adafruit boards. I have a PR pending to Mu that eliminates the need for this entirely: it looks at the interface description string for the REPL connection and decides it's a CircuitPython board that way

#

is the board an Adafruit or non-Adafruit board?

idle owl
#

This would be a non-Adafruit board. The guide is how to add your board to CircuitPython.

#

So ostensibly it's other folx adding boards.

tulip sleet
#

They haven't yet accepted my PR, but they haven't even started reviewing it. They were actually stuck on some CI problems.

idle owl
#

@tulip sleet So for non-Adafruit boards, this still stands? they can submit a PR to Mu Editor, editing this file: https://github.com/mu-editor/mu/blob/master/mu/modes/circuitpython.py And adding their board to valid_boards. The format is like this: (VID , PID, "Manufacturer Name", "Device name")

tulip sleet
#

yes, though my PR will supersede any new PR for a single new board

idle owl
#

I don't follow.

#

Once your PR goes in, no new board will need to be manually added?

manic glacierBOT
orchid basinBOT
tulip sleet
idle owl
#

@tidal kiln You around?

tidal kiln
#

no. i'm a square!

#

๐Ÿ™‚

#

yah. what's up.

idle owl
tidal kiln
#

i do

idle owl
idle owl
#

Because the text on the back says 0x52, and the product copy and guide say 0x53

#

So something isn't right there.

tidal kiln
#

interesting. yah. let me check. the adapter itself really doesn't have an address. it's just an adapter. but let me see what a nunchuk reports as...

idle owl
#

Hmm ok

#

Thanks!

gloomy shuttle
#

I am 99% confident they are 0x52.

tidal kiln
#
>>> import board
>>> i2c = board.I2C()
>>> i2c.scan()
[]
>>> i2c.scan()
[82]
>>> hex(82)
'0x52'
>>>
idle owl
#

Ok silk is correct

#

Thanks much.

tidal kiln
#

first scan with just adapter

#

second with nunchuk plugged in

#

nunchuk = original nintendo model

#

not the one in shop, if that matters?

idle owl
#

Nah, I think it's probably correct.

#

Good enough for me ๐Ÿ™‚

manic glacierBOT
tidal kiln
#

np. mario out!

fossil gorge
# tidal kiln second with nunchuk plugged in

I'm going to have to make note of that. I remember not seeing it when I did a scan, but working when I tried the code. I bet I didn't have a nunchuk plugged in when I scanned...

tidal kiln
#

worth checking, but still not 100%. there can be some odd things that don't scan well, but work fine otherwise.

lone sandalBOT
manic glacierBOT
#
$ make BOARD=adafruit_feather_rp2040 -j 32
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
Traceback (most recent call last):
  File "gen_stage2.py", line 82, in <module>
    typer.run(main)
  File "C:/msys64/mingw64/lib/python3.8/site-packages/typer/main.py", line 859, in run
    app()
  File "C:/msys64/mingw64/lib/python3.8/site-packages/typer/main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  ...
orchid basinBOT
#

The language menus are in an arbitrary order, making it potentially confusing when looking for one. The order used is the one from the files.json file, which in turn depends on the way languages are listed with os.scandir in the circuitpython repository (build_board_info.py).

The displayed language names are in the board.html template. To sort by name the code uses Liquid's {%capture%} and split to make a new list with the name and the language code, so it can be sorted. This requir...

manic glacierBOT
jaunty juniper
#

is this the correct list of excluded languages ? {'el', 'cs', 'ko', 'en_GB', 'hi'}

#

wait I could just look in the locale directory

#

(I looked, and it is)

lime trellis
#

Hi all! Linked below is a WebSerial demo with some tweaks for circuitpython.

This <200 line html file lets you access the serial terminal of your circuitpython boards using your browser!! Confirmed working in Chrome and MS Edge (v89+). Firefox and Safari will likely not work.

copy the text into a .html file and give it a go ๐Ÿ™‚
https://github.com/maholli/serialTerminal.com/blob/main/index.html

I'm always looking for easier ways to have my students connect to their circuitpython boards and this will be a game changer! File is small enough that I'll likely distribute boards to students with a similar html file onboard.

tulip sleet
#

@lime trellis this is fantastic! I had tried the Google demo and some others, and they didn't quite work.

lime trellis
tulip sleet
#

can the index.html be served or must it be local

lime trellis
signal pasture
#

doesn't google chrome force pages to be accessed over https to use the serial port?

lime trellis
signal pasture
#

yeah, that would be really cool

lime trellis
tulip sleet
#

On Ubuntu 20.04 with Chrome 89.0.4389.90, I am getting "Serial Connection Failed"

#

after choosing and hitting Connect

lime trellis
tulip sleet
#

The Google demo has the typing in-line, instead of a separate line. That can't be too hard. Let me find it...

#

THis does a weird disconnect when I try to type, though, that was the problem

lime trellis
tulip sleet
#

I think a merging of the two might work out

lime trellis
tulip sleet
#

are you on windows or linux

lime trellis
#

windows

tulip sleet
#

that may be the difference. Try resetting the board and reconnecting with the Connect button and see if you get spurious DISCONNECTED

#

If I was previously connected, it works for me, but it does not work when started from scratch with a board that wasn't connected to web serial previously

lime trellis
tulip sleet
#

would be interested to hear, thanks

gloomy shuttle
thorny jay
thorny jay
#

All is up to date.

manic glacierBOT
#

Running Liz "I voted" badge on the Feather RP2040 and a FeatherWing 128x32 (I2C) I get garbage on the screen.
A video: https://photos.app.goo.gl/RrA6ntgNwnJnfuS16

All libraries are up to date and run the latest firmware.
The same screen on any of my other Feather does work with the same code.
I believe I have had the same issue with a pico and manual wiring to the FeatherWing.

Other piece of code driving that screen on the Feather RP2040 did not display that kind of problem (but may...

thorny jay
#

I don't know why I did believe it was from Liz. Maybe because of the "voting intro" in her video???

manic glacierBOT
#

I need C.R.U.D. I get from btree or I could have used a text fileWm E Fitzpatrick(703) @.***
-------- Original message --------From: ajs256 @.> Date: 3/24/21 4:51 PM (GMT-05:00) To: adafruit/circuitpython @.> Cc: bill22152 @.>, Author @.> Subject: Re: [adafruit/circuitpython] btree for Circuitpython (#4477)
You can write files to the CIRCUITPY drive from user code. This guide gives you the basics.

โ€”You are receiving this because you authored the t...

#

Moves the language allow list to generate_download_info() and use it there too.
This syncs the list of languages on circuitpython.org with the builds.

I did some tests by adding a print of the generated json and using a test script digging into the data structure to compare it with the file generated from main (adding the same print to main), using beta and stable tags, checking that only the languages vary by what is expected.

manic glacierBOT
manic glacierBOT
#

It does trigger the error: "TimeoutError: Clock stretch too long"

# Set up display & add group
#i2c = board.I2C()
i2c= bitbangio.I2C(board.SCL, board.SDA) 
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
# ^^^ TimeoutError: Clock stretch too long
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
group = displayio.Group(max_size=1)
display.show(group)

PS: Just in case I also checked inverting SDA/SCL but it give the same effect.

manic glacierBOT
#

I recently filed a similar issue with a Feather RP2040 displaying garbage on a 128x64 OLED FeatherWing

Please see the issue for details, and I found a workaround by using a bus speed of 400kHz instead of the default 100kHz using i2c = busio.I2C(board.SCL, board.SDA, frequency=400000)

It seems specific to the RP2040 as I tried it with a number of other boards and displays and only had the issue with the RP2...

bitter bronze
#

Using CircuitPython extension in VSCode. View>Command Palette>CircuitPython:.. fail with an error message that the command resulted in an error. That is true for all CircuitPython commands like Show Available Libraries...

cedar moth
manic glacierBOT
manic glacierBOT
solar whale
#

Just a "heads up" to others who have not been keeping up with the CP development tools... I updated to the tip of main today as I do most days and tried a build the adafruit_feather_rp2040. It failed because it now apparently needs cascadetoml to have been installed. No big deal, but a surprise. I went back to the building CP guide and noted what I think is a new step pip3 install -r requirements-dev.txt https://learn.adafruit.com/building-circuitpython/build-circuitpython I ran this and found I was missing several packages ... Everything is working now but it was a confusing start to the day.

manic glacierBOT
manic glacierBOT
mental nexus
#

I've got a pre-commit question. I've staged only a few files for a commit. When I run pre-commit I get this:

margaret@iMac circuitpython % pre-commit   
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/margaret/.cache/pre-commit/patch1616685107.
Check Yaml...........................................(no files to check)Skipped
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Translations.............................................................Passed
Formatting...............................................................Failed
- hook id: formatting
- files were modified by this hook
[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
#

It's not saving the formatting fixes on my files, maybe because I have un-staged files? How can I get the formatting to update the files that I have staged and make a commit?

analog bridge
#

@mental nexus you can run formatting on a specific set of files by pre-commit run --files file1 file2...

mental nexus
#

Ok, I'll try that. In the meantime I messed up my branches and misplaced my files. Bleh. Will get help in the git channel.

slender iron
tulip sleet
#

I did revise the Building guide very recently after someone reported the issue. I will try to make an announcement in-channel if I do revise the instructions.

fossil gorge
slender iron
#

@onyx hinge we really shouldn't need dma for spi

#

the peripheral has a 16 word transmit FIFO

#

(though dma insulates the transfer from interrupts)

onyx hinge
#

@slender iron my gut agrees with you, yet using the FIFO-based API in the sdk gives the results seen on the PR: big gaps between bytes

#

If you have something I could look at first before doing DMA I'm open to it

#

I considered seeing whether by bypassing the SDK and just touching the registers I could do better

manic glacierBOT
onyx hinge
#

welll looks like my fix for flash files wasn't right & complete. I hope it's still a step in the right direction @slender iron

manic glacierBOT
slender iron
#

No worries @onyx hinge. Iโ€™ll look at the flash stuff after breakfast. Is the sdk waiting on a fifo empty flag instead of fifo full?

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

mem_free = 137
Traceback (most recent call last):
File "code.py", line 74, in
File "adafruit_display_shapes/rect.py", line 47, in init
MemoryError: memory allocation failed, allocating 19200 bytes


     try:    

        Disp = displayio.Group(max_size=(20+3*(12+1)))
        # Blue Background
        Disp.append(Rect(0, 0, WIDTH, HEIGHT, fill=BLUE))  #line 47
...
#

Even if RAM is free, it may not have a large enough contiguous "chunk" available for the size of the item you're trying to create.

If it will work for you, the best option is probably to use a vectorio.Rectangle since that won't need to allocate so much RAM for the display_shapes.Rect (that uses a bitmap). If you are using a lot of shapes (polygons, rectangles, circles), consider using vectorio for all of them. Here are the [docs for vectorio](https://circuitpython.readthedocs.io...

#

I could have 59 if the program would continue to run.... but its ending
before I get there..

Does the vectorio module have bitmap fonts?

On Thu, Mar 25, 2021 at 12:40 PM kmatch @.***> wrote:

Even if RAM is free, it may not have a large enough contiguous "chunk"
available for the size of the item you're trying to create.

If it will work for you, the best option is probably to use a
vectorio.Rectangle since that won't need to allocate so much RAM for the
display_shapes.Re...

slender iron
#

@onyx hinge got a link to the spi code in the nxp sdk?

manic glacierBOT
onyx hinge
#
        while (LPSPI_GetTxFifoCount(base) == fifoSize)``` the most basic thing you suggested to check seems to be as expected
slender iron
#

ya, that looks correct

manic glacierBOT
onyx hinge
#

yet from the traces it never successfully gets a 2nd byte into the FIFO before the first byte is shifted out.

slender iron
#

there is a retry loop in common-hal

onyx hinge
#
        if (((NULL == rxData) || (rxRemainingByteCount - txRemainingByteCount) < rxFifoMaxBytes))```
#

This was a bit confusing to wrap my head around, but I think it's right

#

the retry loop in common-hal is only for the "is busy" case, if it's not busy the single call does the whole transfer. /* Check that LPSPI is not busy.*/ if (LPSPI_GetStatusFlags(base) & kLPSPI_ModuleBusyFlag) { return kStatus_LPSPI_Busy;

slender iron
#

didn't nxp post the code on github now?

onyx hinge
#

I dunno, the one we use was just imported by arturo into a repo with empty history

slender iron
#

right, I feel like greg pointed me to it on github

onyx hinge
slender iron
#

yup, that's what greg pointed to

onyx hinge
#

It's not obviously, hugely different than what we have

slender iron
#

yup yup

#

it'd be good to switch over

#

did you check errata?

onyx hinge
slender iron
#

๐Ÿ‘

#

looks like there is an edma version of the driver

onyx hinge
#

yes

slender iron
#

ยฏ_(ใƒ„)_/ยฏ

onyx hinge
#

switching to that is basically what I was intending to do

slender iron
#

it all looks right to me

onyx hinge
#

but .. how is it spending 8000 CPU cycles between putting a byte in the FIFO !?

slender iron
#

well its likely on a slower memory bus

#

so checking all the registers could be slow

#

have you logic analyzered the spi flash?

#

I'm trying to remember where I saw the memory structure map

onyx hinge
#
a/devices/MIMXRT1011/drivers/fsl_lpspi.c
+++ b/devices/MIMXRT1011/drivers/fsl_lpspi.c
@@ -777,2 +777,3 @@ bool LPSPI_CheckTransferArgument(lpspi_transfer_t *transfer, uint32_t bitsPerFra
  */
+__attribute__((section(".itcm.LPSPI_MasterTransferBlocking")))
 status_t LPSPI_MasterTransferBlocking(LPSPI_Type *base, lpspi_transfer_t *transfer)
@@ -1813,2 +1814,3 @@ void LPSPI_SlaveTransferHandleIRQ(LPSPI_Type *base, lpspi_slave_handle_t *handle
 
+__attribute__((section(".itcm.LPSPI_CombineWriteData")))
 static uint32_t LPSPI_CombineWriteData(uint8_t *txData, uint32_t bytesEachWrite, bool isByteSwap)
@@ -1897,2 +1899,3 @@ static uint32_t LPSPI_CombineWriteData(uint8_t *txData, uint32_t bytesEachWrite,
 
+__attribute__((section(".itcm.LPSPI_SeparateReadData")))
 static void LPSPI_SeparateReadData(uint8_t *rxData, uint32_t readData, uint32_t bytesEachRead, bool isByteSwap)
``` I tried putting MasterTransferBlocking and everything it calls that is not inlined into itcm and it did not help
slender iron
#

hrm

onyx hinge
#

it's possible I got it wrong since I had to write it out rather than use our macros

#
                0x00000000000019e8       0x4c build-imxrt1010_evk/supervisor/flexspi_nor_flash_ops.o
                0x00000000000019e8                flexspi_nor_flash_page_program
 .itcm.LPSPI_CombineWriteData
                0x0000000000001a34       0x50 build-imxrt1010_evk/sdk/devices/MIMXRT1011/drivers/fsl_lpspi.o
 .itcm.LPSPI_SeparateReadData
                0x0000000000001a84       0x68 build-imxrt1010_evk/sdk/devices/MIMXRT1011/drivers/fsl_lpspi.o
 .itcm.LPSPI_MasterTransferBlocking
                0x0000000000001aec      0x22c build-imxrt1010_evk/sdk/devices/MIMXRT1011/drivers/fsl_lpspi.o
                0x0000000000001aec                LPSPI_MasterTransferBlocking
 .itcm.common_hal_neopixel_write
                0x0000000000001d18       0xd8 build-imxrt1010_evk/common-hal/neopixel_write/__init__.o
                0x0000000000001d18                common_hal_neopixel_write
```but the map file looks right
slender iron
#

ya, seems right

#

what is you change the wait to read the current amount once and set the difference?

#

instead of checking to see if it's full each write

#

I'm sure the low speed bus is still much faster than the spi transmit

onyx hinge
#

does the data need to be coming from the right RAM area?

slender iron
#

for dma yes

#

dma can't access TCM

#

afaik

#

an interrupt could be slowing down the cpu core

#

maybe usb

#

do you get the gaps when not connected to usb?

manic glacierBOT
#

Bumping this, as i ran across it for my use case.
Building a remote anemometer/wind vane station, with solar/battery and LoRa.

The anemometer is a simple pulse device, with 1 pulse per rotation. I expect it to be pulsing in the low seconds to milliseconds range.

This rules out using the frequencyio and pulseio modules, and leaves me with countio, which will have the problem @dmopalmer mentions of not using period timing.
This means i will have to do longer samples, wasting more power...

#

import gc
import time
import sys
import board
import busio
import adafruit_bme280
import displayio
from adafruit_display_shapes.rect import Rect
from adafruit_display_shapes.line import Line
from adafruit_display_text.label import Label
from adafruit_bitmap_font import bitmap_font

def printf(format, *args):
sys.stdout.write(format % args)

def eprintf(format, *args):
sys.stderr.write(format % args)

i2c = busio.I2C(board.SCL, board.SDA)
bme280 = adafruit_bme280.Ada...

#

`import gc
import time
import sys
import board
import busio
import adafruit_bme280
import displayio
from adafruit_display_shapes.rect import Rect
from adafruit_display_shapes.line import Line
from adafruit_display_text.label import Label
from adafruit_bitmap_font import bitmap_font

def printf(format, *args):
sys.stdout.write(format % args)

def eprintf(format, *args):
sys.stderr.write(format % args)

i2c = busio.I2C(board.SCL, board.SDA)
bme280 = adafruit_bme280.Ad...

#

`
import gc
import time
import sys
import board
import busio
import adafruit_bme280
import displayio
from adafruit_display_shapes.rect import Rect
from adafruit_display_shapes.line import Line
from adafruit_display_text.label import Label
from adafruit_bitmap_font import bitmap_font

def printf(format, *args):
sys.stdout.write(format % args)

def eprintf(format, *args):
sys.stderr.write(format % args)

i2c = busio.I2C(board.SCL, board.SDA)
bme280 = adafruit_bme280....

onyx hinge
#

@slender iron figured it out ๐ŸŽ‰

slender iron
#

nice!!! what was it?

onyx hinge
#

30MHz transfer yay

#

there are several delays which are configured by default ``` masterConfig->pcsToSckDelayInNanoSec = 1000000000 / masterConfig->baudRate * 2;
masterConfig->lastSckToPcsDelayInNanoSec = 1000000000 / masterConfig->baudRate * 2;
masterConfig->betweenTransferDelayInNanoSec = 1000000000 / masterConfig->baudRate * 2;

slender iron
#

is it toggling CS every byte?

onyx hinge
#

If I set them all to 0, the gaps go away. I think it's the betweenTransferDelay

#

this flag also may have helped: xfer.configFlags = kLPSPI_MasterPcsContinuous

#

anyway, I'll tidy it up but this looks very good at the moment

slender iron
#

I thought all of those delays only impacted to CS

#

are you capturing CS too?

onyx hinge
#

No, we never enable the "internal" CS output

#

we always use our software CS in CircuitPython

#

.. right?

slender iron
#

ah, right

#

my guess is continuous was the key

onyx hinge
#

no, Continuous on its own tightened things up a bit but it was not the resolution.

slender iron
#

hrm, weird

onyx hinge
#
    // SPI bus noise before they are put into SPI mode.
    config.baudRate = 250000;
#

hmmm, these initial settings were also made with a baudRate of just 250kHz, so they ended up being very big numbers when you switched to 30MHz instead of 250kHz. the settings were relative to some default baudrate, which we then set to another rate

#

those default delays were hidden inside SDK, not in CP

slender iron
#

๐Ÿ‘

orchid basinBOT
manic glacierBOT
onyx hinge
#

last thing to check is whether the sdk code needs to be in itcm to work at 30MHz

#

nope, fine without it

slender iron
#

๐Ÿ‘

manic glacierBOT
#

It's possible to configure very large gaps between transfers (bytes), and indeed this is what we ended up with by using LPSPI_MasterGetDefaultConfig.

Set all the delays to zero, enable a bit for "continuous transfers", and cap the speed at 30MHz per the datasheet's restrictions.

After this change, here is a view of a transfer at 30MHz:
image

I tested on the MIMXRT1010-EVK both wi...

#

Ok, here's my first cut at it. Main changes:

  • Separate the stagnant graphics (stored into the background_Disp group)and dynamic graphics (foreground_Disp group) into separate groups.
  • I further broke foreground_Disp into three subgroups, each subgroup holds one set of measurement lines: T_group, P_group and H_group
  • After each measurement, pop all the items out of the T_group and re-append all the lines. Repeate with P_group and H_group.
  • I replaced the stagnant rec...
manic glacierBOT
ionic elk
#

@tulip sleet I have a tricky problem.

bitter bronze
# cedar moth Have you opened the D:\ folder in VSCode? The CP extension uses the boot_out.tx...

Thanks @cedar moth. In VSCode,I have opened the drive on the Pico (F: in my case ) and then opened the code.py file (which is a simple flash the LED program), and tried running it. If I try View>Command Palette>CircuitPython:... it still fails with the "resulted in an error message". Other commands also fail. I have similar failures with the Pico-go commands. I'll keep poking around. Any ideas about a good help sight for VSCode.

ionic elk
#

@tulip sleet On STM32, the WKUP pin function just fine when in true deep sleep, but it cannot actually wake from WFI, and it in fact disabled all other functions of that pin when not in sleep mode. So it's impossible to have a program that can handle both true and false deep sleep without making a judgement on whether the program is connected to usb when the alarm is created

#

In the ESP32 case, the program only makes that judgement when it actually starts deep sleeping, since a pin can function as both a false and true deep sleep wakeup.

#

Or maybe I should dynamically reconfigure the pin only when true sleep actually starts, based on whether it was requested earlier... that's probably the way to go, nevermind.

tulip sleet
#

yup, the last thing is what i was going to say; you just have to remember the pin and do the work when you know

manic glacierBOT
ionic elk
#

@tulip sleet yeah STM32 only has one viable wakeup pin so it's actually pretty easy

manic glacierBOT
#

@dglaude I am not seeing this problem with the following simpler test program. Could you try this one? I am testing with the absolute latest build (built locally): 6.2.0-beta.4-93-g0105b30a0

import board
import displayio
from adafruit_display_text import label
import adafruit_displayio_ssd1306
import terminalio
import time

displayio.release_displays()

i2c = board.I2C()
display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)
display = adafruit_displayio_ssd1306.SSD1...
stuck elbow
#

displayio.ParallelBus on the Feather RP2040 works!

slender iron
#

๐ŸŽ‰

stuck elbow
#

however, I expected it to be a bit faster, is there a frequency setting somewhere?

stuck elbow
#

I see there is, just undocumented

mental nexus
blissful pollen
#

but I thought it may be faster too but cannot see anything that is slowing it down compared to other ports. Let me know if you notice anything

manic glacierBOT
stuck elbow
#

@blissful pollen it defaults to 30_000_000, I got it to work with 62_500_000

#

I'm really not familiar with pio yet

blissful pollen
#

which display are you using?

stuck elbow
#

Z320IT002 โ€” that is a 3.2" tft with ILI9341 COG

blissful pollen
#

Hmmm yeah I will have to play around again to see. I ran into issues going any faster on the display I have. But that's why frequency is there ๐Ÿ™‚

stuck elbow
#

I appreciate its presence

#

though I think it might go even faster, if the pio allowed

#

I mean the display could probably handle it

blissful pollen
#

It takes 2 PIO cycles to control so I know that maxes at 60Mhz (120 divided by 2 instructions). The frequency setting takes that into account... or should unless I made a mistake hmm

manic glacierBOT
#

Maybe doing show() cleared out some of the old memory references that you obliterated when redoing the Group, so maybe they can get freed up by the garbage collector. Your guess is as good as mine. Whatever works!

As for printf, that was new to me. Rather than fight it, I traveled a known path. Didn't want to get distracted from the core problem at hand. But I will add something new to things I need to learn about.

stuck elbow
#

well, I did a binary search looking when I get the fequency out of range error, and I found exactly 62_500_000

#

hehe, the datasheet says write cycle is 33ns, so 30Mhz sounds about right

manic glacierBOT
stuck elbow
#

I was really expecting the parallel interface to be faster than SPI, but it isn't

blissful pollen
manic glacierBOT
#

I've split this changeset from #4378 so the two tangentially related things aren't muddied together, and so that #4378 is no longer blocked by this somewhat more controversial (and far reaching) change.

I know the i2c pullups on the RP2040 are a little on the weak side for i2c, but I've got tested prototypes that appear to be reliable with them. There's some related discussion on #4378.

This change may or may not be worthwhile or useful to someone, but with the issues bitbangio presen...

stuck elbow
#

@blissful pollen possible, I will look closer with a logic analyzer over the weekend

manic glacierBOT
#

Written to get audiomixer working on the RP2040, but this may work on other non-M4 devices.

Tested on an ItsyBitsy M4 (for compatibility) and Feather RP2040.

The RP2040 seems to have a separate audio issue after repeat playings adding in a crackle. I could reproduce this without audiomixer so think that is a separate issue. First play through is clean sound.

#

Here is how I tested it on both devices.

import board
import audiocore
import audiomixer
import digitalio
import time
from audiopwmio import PWMAudioOut as AudioOut

time.sleep(1)

a = AudioOut(board.A0)
one = audiocore.WaveFile(open("one.wav", "rb"))
two = audiocore.WaveFile(open("two.wav", "rb"))
mixer = audiomixer.Mixer(voice_count=2, sample_rate=16000, channel_count=1,
                         bits_per_sample=16, samples_signed=True)

print("playing")
a.play(mixer)...
still zephyr
#

mmmm maybe now we would need an equalizer widget ๐Ÿค”

manic glacierBOT
manic glacierBOT
#

Firmware

adafruit-circuitpython-adafruit_feather_rp2040-en_US-6.2.0-beta.4.uf2
adafruit-circuitpython-bundle-6.x-mpy-20210324
Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; FeatherS2 with ESP32S2

Code/REPL

import board
import busio
import adafruit_rfm9x

spi = busio.SPI(clock=board.IO36, MOSI=pin.IO37, MISO=board.IO35) # Init SPI Bus
print("SPI bus INIT OK")

rfm9x = adafruit_rfm9x.RFM9x(spi=spi, cs=board.IO5, reset=boar...
manic glacierBOT
#

This is very unusual. I successfully loaded recent builds on a Metro M4 Express AirLift. Can you get to the REPL? Try to ctrl-C and try import storage; storage.erase_filesystem(), which will reformat CIRCUITPY.

What kind of host computer are you using, and what version of the operating system?

If the reformat doesn't help, I'd suggest two more things::

  1. If it's Windows, clear out the USB devices using the USB Device Cleanup tool from here: https://www.uwe-sieber.de/misc_tools_e.htm...
manic glacierBOT
serene briar
simple pulsar
manic glacierBOT
mental nexus
stuck elbow
#

@mental nexus yeah, that would be the maximum guaranteed to work, but in practice you can usually go faster

#

@mental nexus also, I think the slowness is not due to the slow speed of the clock, but pauses between transmissions

#

I plan to work on this over the weekend a bit, and the first thing I want to do is to compare with samd51 to see if there is any noticeable difference in speed

mental nexus
#

Compared to the pyportal I have seen slightly faster pure redraw rates from the ESP32-S2 so Iโ€™m interested in how the RP2040 compares. I just ordered a Teensy 4.1 so Iโ€™m interested to see how fast the iMX. I seem to remember seeing a limit somewhere in the imx datasheet of 75MHz but Iโ€™ll need to dig deeper.

tulip sleet
serene briar
manic glacierBOT
tulip sleet
onyx hinge
#

@tulip sleet I don't think we need to say SDIO is experimental on stm32f405 feather anymore

tulip sleet
onyx hinge
#

appreciate it @tulip sleet

orchid basinBOT
manic glacierBOT
#

Please disregard.

The FeatherS2 has labels SDI and SDO on the board, but when connecting the RFM module, they must connect to the opposite:
SDI -> MISO and SDO -> MOSI

Where as on the Pico and some other boards it's MOSI -> MOSI and MISO -> MISO.

Which sort of makes sense, In -> Out, Out -> In

In my case, I have simply flipped the pins in code:

import board
import busio
import digitalio
import adafruit_rfm9x
import feathers2

# Make sure the 2nd LDO ...
crimson ferry
#

@prime flower I looked at the Wiznet5k+Requests issue, but don't know how to fix the incompatibility

manic glacierBOT
timber mango
#

hi, I'm looking a way to get nice animations for Dotstar rbw 2328 stripes

#

like you can find with processing NEopixels through fadecandy

onyx hinge
timber mango
#

ah sry, 1st time here

onyx hinge
#

welcome!

timber mango
#

thanks

manic glacierBOT
manic glacierBOT
manic glacierBOT
meager fog
lone axle
# meager fog <@!382939733107408897> hihi can you look at https://forums.adafruit.com/viewtopi...

I can take a look later tonight or over the weekend. But I don't have a Titano to test with. I do think the theory posed about the larger screen size is likely on the right track though. At first glance it looks like the code makes a Bitmap object based on the size of the display. One thing I would recommend is using bitmap_label instead of label in all cases that I have come across it leads to less memory usage, and with longer strings the savings can be fairly significant. It should be easy to try it by switching the import at the top of the file. I'll post a comment on that thread once I have a chance to dig in further.

manic glacierBOT
lone axle
#

Possibly the Bitmap could be reduced to half the screen size and then scaled by 2 using a Group. That would save some memory I believe at the cost of slightly "chunkier" resolution.

#

There may also be some savings to be had by not using the PyPortal helper library. It looks like that is being used only for the display and playing sounds at first glance. Those could possibly be done with core APIs only and it would save a few imports.

meager fog
#

@lone axle i think there's something else, 256KB is a massive amount of RAM.... is the bitmap being made thats 16-bit color?

lone axle
#

looks like only 4 colors to me:

plot = displayio.Bitmap(GWIDTH, GHEIGHT, 4)
manic glacierBOT
#

I found that with the following code, the with-statement is never entered (circuitpython waits forever). However, if I change the type of spi bus to board.SPI() aka busio.SPI, it completes.

# spi = board.SPI()
spi = bitbangio.SPI(board.SCK, MISO=board.MISO, MOSI=board.MOSI)
cs = digitalio.DigitalInOut(board.D10)
dev = adafruit_bus_device.spi_device.SPIDevice(spi, cs)
print("before with-statement")
with dev as card:
    print("with-statement")
print("after with-statement"...
lone axle
#

@onyx hinge or @mental nexus do you know if using a PCF font would be expected to consume less RAM than the same font, but BDF format? I know there was a loading speed boost, but unsure about other RAMifications ๐Ÿ˜…

idle wharf
#

@prime flower are you around ?

tulip sleet
prime flower
idle wharf
manic glacierBOT
#

Firmware
Tried both the 6.1.1 stable and the below with same results on the feather nrf52840
Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit Feather nRF52840 Express with nRF52840

tried 2 versions on the feather nrf52840
adafruit-circuitpython-bundle-6.x-mpy-20210303
adafruit-circuitpython-bundle-6.x-mpy-20210326

The code.py is the example ble_broadcastnet_battery_level.py
I'm getting the below error in the library adafruit_ble_broadcastnet
line 171   se...
prime flower
#

@idle wharf ping!

onyx hinge
#

@lone axle I would expect the final memory usage to be about the same

idle wharf
#

The send is failing... (let me get you a screen grab)

#
1967.96: DEBUG - Sent!
1968.83: INFO - - iot_mqtt :: connect :: iotc-738e1892-03dd-4ad0-be4a-c69e3c9a5182.azure-devices.net
1968.83: DEBUG - Attempting to establish MQTT connection...
1968.83: INFO - Establishing a SECURE SSL connection to iotc-738e1892-03dd-4ad0-be4a-c69e3c9a5182.azure-devices.net:8883
Traceback (most recent call last):
  File "code.py", line 106, in <module>
  File "/lib/adafruit_azureiot/iotcentral_device.py", line 160, in connect
  File "/lib/adafruit_azureiot/iot_mqtt.py", line 387, in connect
  File "/lib/adafruit_azureiot/iot_mqtt.py", line 133, in _create_mqtt_client
  File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 437, in connect
  File "/lib/adafruit_minimqtt/adafruit_minimqtt.py", line 271, in _get_connect_socket
RuntimeError: Repeated socket failures```

I'm using the iotcentral simple example as my test. 
I can't see what is wrong with iot_mqtt connect or _create_mqtt_client 

I was just about to use the minimqtt spi sample to verify it works first. But if you see something obvious that would be helpful.
prime flower
#

hm

#

@idle wharf It looks like the connect is failing, not the send?

idle wharf
#

Correct, bad choice of words before I got the screen ouput. The registration steps do suceed

onyx hinge
#

@tulip sleet That USB vs CAN memory doesn't ring a bell for me.

tulip sleet
#

yeah, I don't know what to make of it

prime flower
#

Is the root cert for AzureIoT in nina-fw still correct?

manic glacierBOT
idle wharf
prime flower
idle wharf
#

IoT Central, on a known working instance. Verified the scope, id and key are good

prime flower
#

lol i am confused...hol don

#

Or are you running a file which interfaces with adafruit_azureiot/iotcentral_device.py

idle wharf
prime flower
prime flower
idle wharf
#

Thanks @prime flower its helpful to have someone validate you're headed on the right path.
I'm also going to run the minimqtt spi sample once to verify nothing in my firmware(s) or dependencies is involved. Not likely I think, but worth checking.

prime flower
#

Agreed

#

I'd try to test with only MiniMQTT as much as possible to narrow down the issue if you can

tidal kiln
#

achievement unlocked! ๐Ÿ™‚

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit QT Py M0 Haxpress with samd21e18
>>> print("i am not cat")
i am not cat
>>> 
idle wharf
#

Thank for that @tidal kiln

still zephyr
idle owl
#

@tulip sleet I'm trying to get https://www.serialterminal.com/ to work. It connects only when using that URL, none of the other URLs from maholli, or trying from a local version of the index.html. But I'm not sure it's doing anything once I'm connected. I'm using Chrome.

#

I can type something in, and it shows up below n next to >. But it doesn't appear to be a REPL or anything.

tulip sleet
#

maholli only tested it on windows

idle owl
#

Ah hmm. Fair enough.

#

Might explain why Anne got it to work last week and I didn't.

tulip sleet
#

did you click the "Connect" button in the upper left?

idle owl
#

Yes.

tulip sleet
#

i have similar issues on Linux

idle owl
#

And it popped up a window for me to click on a device. Chose the CPX, and then kinda nothing.

#

Hmm ok.

tulip sleet
#

yeah, I get this:

idle owl
#

I don't get that if I use Chrome.

#

It seems to connect.

tulip sleet
#

i am using Chrome, but I get it on Linux after I try to type somethign

#

but it keeps disconnecting on Linux

idle owl
#

I have a Windows VM, but that's a whole other bucket of fish.

#

That works for me on MacOS!

tulip sleet
#

close the browser and reopen it; sometimes it works after it fails for me, but it doesn't work the first time; it's weird

idle owl
#

Hmm ok

tulip sleet
#

yeah, sometimes I get it to work without knowing why

#

like, what it I do that's it now working?

#

someone needs to spend some time on this. it may well be a Chrome bug in the implementation of Web Serial.

#

but the potential is great

idle owl
#

hmm yeah

tulip sleet
#

i'd expect the low-level implementations to be different for each OS. I saw something similar (works on some platforms, not others), when trying their gamepad support

idle owl
#

Restarted browser, still "connects" but then nothing happens.

tulip sleet
#

if you type ctrl-C or return, then nothign?

idle owl
#

No response.

#

The googlechromelabs one works. on MacOS.

tulip sleet
#

try the googlechromelabs one with a fresh browser

idle owl
#

I did, it still works

tulip sleet
#

maybe it's a paragraph that says: this is flaky, but try it out; if you're a JavaScript/browser expert, maybe you can help

idle owl
#

hmm maybe yeah

tulip sleet
idle owl
#

Tried serialterminal.com in my windows VM, but I'm unconvinced it's not working other than because USB is flaky in a VM.

tulip sleet
#

i'll try it on a real windows machine

idle owl
#

It's ok. We don't need to spend more time on it right now. I'll ping Limor with the results and see what she thinks

tulip sleet
#

@idle owl i just had to power up my desktop Windows machine. the googlechromelabs one works. serialterminal.com is flakier

idle owl
#

Hmm alrighty

#

Thanks!

manic glacierBOT
#

This required both adding support for the "default write value" in bitbangio.SPI, and also supporting duck-typing in adafruit_bus_device's SPIDevice which, surprisingly, was overlooked when we fixed I2C.

Now, the following code works, tested on RT1010-EVK:

import os
import board
import bitbangio
import adafruit_sdcard
import storage
import digitalio

spi = bitbangio.SPI(board.SCK, MISO=board.MISO, MOSI=board.MOSI)
cs = board.D10
sdcard = adafruit_sdcard.SDCard(spi, d...
idle wharf
#

@prime flower You'll be happy to know that the minimqtt sample worked flawlessly so it is definitely something in the config or he way the library is calling Minimqtt.
I'm going to setup an IoT Hub and work that side as well so I can verify against the IoT Central path. Thanks again !

onyx hinge
#

@tulip sleet "RM0091" is about STM32F0x1/STM32F0x2/STM32F0x8, so it doesn't relate to STM32F405/407. The latter are the only ST MCUs that have canio enabled

#

I think CircuitPython is only on F4/F7/H7 so it's not relevant for us

manic glacierBOT
marble hornet
#

@tulip sleet I don't think it's pertinent to the help channel discussion but, regarding reload() vs reset() , reload has some memory it doesn't free (under the hood )right?

tulip sleet
#

it restarts the VM; it's the same as typing ctrl-d. But the heap starts from fresh

manic glacierBOT
thorny jay
#

@tulip sleet Super happy to could have help... There is something amazing about that OLED. It was going in "autonomous scrolling, partial or full screen". And if not "powering off" the scrolling from the I VOTED (with old firmware) was able to scroll your Hello World. That screen/driver have some "hidden" feature and seems to do things on it's own. At one point with the garbage random pixel on the screen it was like a starfield effect (ร  la StarTrek or StarWar).

jaunty juniper
#

uuuuuuh USB keyboards are so complicated

stuck elbow
#

why?

manic glacierBOT
ornate breach
#

Does the RP2040 have a preconfigured USB PID/VID?

#

The chip itself not any of the current dev boards

jaunty juniper
# stuck elbow why?

Different layouts introduce multiple types of changes, and I want a code that can for example select all (ctrl-a) and say switch to the 5th tab of firefox (ctrl-5).
5 on a french keyboard is shift-( but the position is the same, and the shortcut is actually ctrl-( not ctrl-shift-( so the keycode is unchanged. That is often the case, where number shortcuts will be based on position rather than character, otherwise it would add modifiers.
a on the other hand is switched with q, so the keycode changes, but the actual shortcut is the same. That is also usually the case, where the letter shortcuts are based on the letter.
So if I want to make a macro keypad that works on multiple setups by only configuring the layout it's a little complicated.

onyx hinge
#

@ornate breach in bootloader mode it does have a particular PID/VID for sure. after that it gets whatever the loaded software chooses.

ornate breach
#

Okay, just making sure so I know how many PID to request from PID.codes

#

๐Ÿ™‚

onyx hinge
ornate breach
#

Oh so I could technically do that too

#

Very cool thanks ! ๐Ÿ™‚

onyx hinge
#

It may not be the fastest way, I see there's only one allocation to date.

ornate breach
#

I has a company now so many Iโ€™ll eventually be purchasing a VID once Iโ€™m making the big bucks ๐Ÿ™‚

#

Might be a few years but thatโ€™s okay ๐Ÿ™‚

manic glacierBOT
#

a patch for folks who don't want to wait, latest builds fix bitbangio and you can read/write the SD card with SPI!

import os
import busio
import digitalio
import board
import storage
import adafruit_sdcard
import bitbangio

# Connect to the card and mount the filesystem.
spi = bitbangio.SPI(board.CLK, board.CMD, board.DAT0)
cs = digitalio.DigitalInOut(board.DAT3)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")

# Use the f...
manic glacierBOT
manic glacierBOT
manic glacierBOT
jaunty juniper
#

btw, I tried serialterminal.com (online and locally) on Mac (Chrome) and it was able to connect, but only if I set a baud value. That's a bug in the page, it's undefined if never set (even though the menu says 9600)

stuck elbow
#

@jaunty juniper just configure keycodes instead of characters, and it becomes simple

manic glacierBOT
#

Did you consider or measure the effective impact of switching from 4 conditioned writes to multiple conditions followed by 4 branching unconditional writes?
Probably in this case it is okay because it is per-frame, but seemingly innocuous change can have dramatic pixel fill rate or frame latency impact in this area so Iโ€™m somewhat skeptical of doing more work than is necessary.

manic glacierBOT
#

@garethhcoleman It should be the case that translations that are same can be omitted. that may save you at lot of work (or maybe too late!).

It is too late! But in case anyone wants to translate to Australian English it might help!

I flagged 4 translations of "MicroPython" into "CircuitPython" - just to note this isn't an attempt to remove attribution, just aiming for consistency across all error messages. If you agree then perhaps the source could be updated?

manic glacierBOT
#

I encountered a crash in re.match (in the unix port). It may require that you build with DEBUG=1.

This is not entirely frivolous, the task that led me to this crash was trying to write a proper lexer for adafruit_pioasm. (I'll probably just set the idea aside for now)

$ ./ports/unix/micropython -c "import ure as re; re.match('wwwwwww|xxxxxx|yyyyy|zzzz|bbbb|cccc|dddd|eeee|ffff|gggg|hhhh', 'a')"
micropython: ../../extmod/re1.5/recursiveloop.c:79: recursiveloop: Assertion `!"recur...
manic glacierBOT
#

Typical test:

import displayio
import rgbmatrix
import board
displayio.release_displays()
matrix = rgbmatrix.RGBMatrix(
    width=128, bit_depth=4,
    rgb_pins=[board.GP0, board.GP1, board.GP2, board.GP3, board.GP4, board.GP5],
    addr_pins=[board.GP6, board.GP7, board.GP8, board.GP9],
    clock_pin=board.GP10, latch_pin=board.GP11, output_enable_pin=board.GP12)
mem = memoryview(matrix)
mem[0] = 65535 #  OK
mem[0] = 65536 #  errors (out of range)

Prior to this...

manic glacierBOT
mental nexus
#

Just learned this week about make -j to use all my processor cores for compiling CircuitPython. Just think how productive Iโ€™ll be after learning that. ๐Ÿคทโ€โ™‚๏ธ

blissful pollen
manic glacierBOT
#

@tannewt I'm having a similar problem and can't seem to initialize uart library with a buffer size greater than 64:

>>> uart = busio.UART(board.TX,board.RX,baudrate=9600,bits=8, parity=None, stop=1, timeout=10, receiver_buffer_size=96)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Could not initialize UART

I'm talking to a Simcom 7080G LTE Modem and basic AT commands work fine but when I try to enable GPS and output current location the ...

manic glacierBOT
manic glacierBOT
#

This PR adds the common_hal prefix to a number of sleep-related functions to identify that they are implemented on the port level, and adds the new weakly linked common_hal_alarm_pretending_deep_sleep function, which is required for both the NRF and STM32 sleep implementations. It also fixes a small problem with the deep sleep implementation in main.c, where the 5 second USB delay would set up to use port_idle_until_interrupt but never actually call it.

Result of a discussion with ...

iron aspen
manic glacierBOT
#

CP currently has hashlib based upon frozen code, providing sha1 and sha256 for instance.
aesio, c lib based, but not included by default in the Pico port.

SHA hash functions are widely used primitives you need for all sorts of things.
I needed them for TOTP code generation (hmac with sha1) for instance.
The pure python code works and is compliant, but takes time (0.2 sec per hmac on the pico)

sha1 and sha256 can be implemented with a small c code and should not take much flash space....

thorny jay
#

Low priority message for @idle owl: I just noticed that I don't have a board.LED thing for the CLUE. So I use led = DigitalInOut(board.WHITE_LEDS). Maybe that could be an issue for your learn guide thing about blink. Regards.

manic glacierBOT
crimson ferry
#

@thorny jay It does seem like if there is only one LED pin (regardless of color), it should be board.LED.

#

The trouble comes when there are multiple colors of LEDs on a board... in addition to board.RED_LED and board.BLUE_LED, should perhaps the red LED also get an alias of board.LED so thre's always a board.LED?

jaunty juniper
#

I would say so

thorny jay
tulip sleet
lone axle
#

Wow. I never knew about that either. That cut a build of mine down from 1m32s to only 39s

idle wharf
#

Can -j be the default?

onyx hinge
#

there's not a super great way to make -j the default that I know of

#

I mean, you sure can do it with a line like this in a Makefile: MAKEFLAGS += -j4 except 4 isn't the right number for everyone

fossil gorge
#

Does it have to be -jx or can it be just -j?

lone axle
#

I did just -j no number

manic glacierBOT
onyx hinge
#

@fossil gorge Generally it's recommended to use -j# where # is the number of cores or threads in your system.

#

Using no number or a very large number uses more memory (potentially including swap space) and provides no performance benefit. It can even run your computer out of memory entirely.

#

For instance, the raspberry pi build has over 500 object files in it. "make -j" will try to invoke the compiler in parallel up to that many times!

fossil gorge
#

Ah, I see. I thought that -j defaulted to the number of processors/cores, not "all the things"

onyx hinge
#

Maybe make has been changed in the last 15 years, weirder things have happened ๐Ÿ™‚

onyx hinge
#

(literally not joking, that's just about the last time I updated my idea about how make works)

fossil gorge
#

Fair enough

crimson ferry
#

i tried -j before just reading about -jx, and it reduced make clean from 3m to 1m. nice!

onyx hinge
#

If the '-j' option is followed by an integer, this is the number of
recipes to execute at once; this is called the number of "job slots".
If there is nothing looking like an integer after the '-j' option, there
is no limit on the number of job slots. The default number of job slots
is one, which means serial execution (one thing at a time).

fossil gorge
#
       -j [jobs], --jobs[=jobs]
            Specifies the number of jobs (commands) to run simultaneously.  If there is more than one -j option, the last one is effective.  If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.
#

From my local man make. on macOS 11.2.3 with M1 proc

kind river
#

I've also seen make -j$(nproc) used in examples to automatically use the number of cores.

crimson ferry
#

-j 16 was 5 seconds slower than -j for me

onyx hinge
#

nproc as a shell command is available on most linux but not on mac

#

and since we all use Python here, another alternative is: ```NPROC=python3 -c 'import multiprocessing; print(multiprocessing.cpu_count())'

fossil gorge
#

When building core CP that is

onyx hinge
#

I hope so -- I grabbed that line from micropython-ulab's build which runs on github's build system (linux & mac)

fossil gorge
#

Worse case, you follow it up with a || # for a default number

onyx hinge
#

for circuitpython we've just hard-coded -j2 in a number of places, and there's even this ... curious ... ```PARALLEL = "-j 5"
if "GITHUB_ACTION" in os.environ:
PARALLEL = "-j 2"

fossil gorge
#

Hmm

manic glacierBOT
tulip sleet
fossil gorge
#

For macOS, you can use sysctl -n hw.ncpu

mental nexus
#

On my machine: 3.2 GHz Quad-Core Intel Core i5 I didn't see any real difference in compile time no matter if I used -j or whether it was set to -j, -j1, -j4 or '-j8`. But I perceived it to bog down my machine with larger values. It took between 140-146 seconds for all of these builds (for pyportal). This machine is from 2015, so maybe it's time for an upgrade.

manic glacierBOT
#

I've been working on getting audio (wav) working on my Feather RP2040 and I'm also having these similar issues but wildly inconsistent behavior. Mine is coupled with the Adafruit I2S mono amp (https://www.adafruit.com/product/3006). Using the same StreetChicken.wav test file. I'm not sure how far long I2S audio is on this new board but I figured I'd throw in what I'm experiencing if I can help at all.

Is there a preference to what pins we should be using for I2S audio? My setup is as follo...

#

That's a great point. My main motivation was to fix an issue where when area1 was combined with an empty area (defined as empty by x1==x2==0) that it would return an area with x1=0 and x2=area1.x2. This caused unnecessary dirty rectangle redrawing.

But your point is about performance of the union command vs. the code in expand. I didn't look at any performance differences. I've never done any performance testing down at the C-level. If you give a good example of how best to do thi...

manic glacierBOT
#

I think a test for this would be a chore. Native time functions have a 32khz resolution iirc and either call should surely take less than 31 microseconds? You could time a frame with several 1px overlapping rectangles but thereโ€™s quite a bit of noise in that aggregate signal. Iโ€™ve wrapped code up higher in the displayio draw stack to A/B test things in this way but I do not have a clear example for you to follow.
Last time I was actively adding to vectorio I wanted to make a more convenient ...

manic glacierBOT
meager fog
meager fog
#

can ya update that guide to talk about fonts too

#

like bitmap_font

#

does have to be a lot but folks dont see how to use custom fonts

#

wait

#

now im confused, there is a page

#

@tidal kiln when yr around can ya explain the thing you were asking about

#

now im confused >.<

tidal kiln
#

i think there's enough to dealing with fonts - creating and using, that more info in that guide would help

lone axle
#

One thing that does seem to be missing is a page or section with a basic example that actually shows the code for loading and using a custom font.

tidal kiln
#

think in terms of 3 parts:

  • displayio
  • text
  • fonts
#

i think we have the first two covered well, but need a little more for the third one

lone axle
#

a section showing example code would be a good addition I think. Maybe some "outside the box" font uses like the FontAwesome stuff that Jeff E got into at one point?

tidal kiln
#

yep. that sort of stuff. like you mention above, not sure theres a good basic example that focuses on just the font aspect

meager fog
#

ok thanks for clarifyng - i wanted to make sure i got it right ๐Ÿ˜“

#

foamy, dya wanna come up with a few things we could do to update that guide and call it a 'project'?

lone axle
#

Yep, I can do that for sure

tidal kiln
#

i'm assuming that guide is the best place? the URL is a bit misleading (pyportal) but the actual guide name seems more fitting

lone axle
#

Yeah, a more general name might be good. Don't know if changing it causes too much trouble though.

meager fog
#

we can change guide names/urls

#

they auto-follow

manic glacierBOT
manic glacierBOT
stiff pelican
#

Is this a website issue? Or is the Pynt missing modules it should have?

jaunty juniper
#

hmmmm there's "py" in the name, I wonder...

#

nah it's not the only one

#

ah it's aliases

manic glacierBOT
#

Test Case:
Want to measure duty cycle and convert to RGB values

Test Setup:
PWM input from RGB LED conroller connected to pin 18 on Pico (used a level converter to bring 5V down to 3.3V)
Using this version on the Pico "Adafruit CircuitPython 6.2.0-beta.4-116-g010232574 on 2021-03-27; Raspberry Pi Pico with rp2040"
Square wave is a 7.83 KHz

Test program:
import board, import pulseio
pulses = pulseio.PulseIn(board.GP18, maxlen=2, idle_state=True)
print(len(pulses))

Error:
...

manic glacierBOT
solar whale
#

@stiff pelican If I recall correctly, the Pynt actually uses the same build as the PyPortal. It is just renamed.

jaunty juniper
#

yep

jaunty juniper
#

there's a PR two messages above to fix it ๐Ÿ˜‰

solar whale
#

Ah -- sorry - I missed that !!

jaunty juniper
#

(I was working in that file earlier last week, it's an easy fix)

#

but it will only apply to future releases

#

oh alias boards are also not in the support matrix on readthedocs

#

and I remember noticing that it (the matrix) also doesn't identify the internal adafruit_bus_device due to the CIRCUITPY_* define that enables it not following the format of the others

solar whale
#

I have noted some guides still refer to adding the bus_device library to boards .... I guess it does no harm other than taking up space. I think the core module is used even if the library is on the file system

jaunty juniper
#

seems so

stiff pelican
#

Cheers @jaunty juniper and @solar whale . That's a very quick turnaround.

jaunty juniper
#

to be fair I was a little quick to push it, a minor detail of coding style but I should have sit on it a little bit

plucky flint
#

We expect there to be some CircuitPython related updates in betas 4 and/or 5. We hope to maintain a fortnightly beta release schedule as things "come together" for a final release soon-ish. (It's ready when it's ready). Thanks for the help and support.

stiff pelican
#

Hi. Could someone add me to the circuitpythonistas role please? Many thanks.

solar whale
#

@stiff pelican Done

manic glacierBOT
#

I'd add to the list of modules that are not captured: adafruit_bus_device, recently added to the core, also missing from the matrix, since it's based on CIRCUITPY_BUSDEVICE.

Also, the aliased boards are missing from the Support Matrix. These are boards where the build is identical to another, and therefore is not generated on its own, but only listed separately on circuitpython.org and copied to S3. As seen in build_board_info.py:
https://github.com/adafruit/circuitpython/blob/main/...

manic glacierBOT
jaunty juniper
#

@onyx hinge ok so, I have never responded to a review like that before, github tells me I can click on "insert a suggestion", make your change and that will automatically make a commit once approved ?

onyx hinge
#

@jaunty juniper I have seen other people use "suggestions", I just create a new commit, push it to the pr, and mark the conversation resolved. Mentioning the person who made the original review is good etiquette too.

onyx hinge
idle owl
jaunty juniper
#

I am deep into shared_bindings_matrix (which provides the support_matrix dict) to add aliased boards to the readthedocs Support Matrix page (as well as adafruit_bus_device), and that might actually replace PR#4507 since support_matrix[alias] will then work as expected

idle owl
onyx hinge
#

I find that hard to believe

#

good morning!

idle owl
#

Good morning ๐Ÿ˜„

onyx hinge
#

Is there an effective commandline flag to entirely disable duplicate code checking?

idle owl
ornate breach
#

Going to attempt to lurk and work this morning

idle owl
#

Lurk and work. It's like Lunch and Learn only lurkier and workier.

thorny jay
idle owl
ornate breach
#

For the meeting, need to get back into doing more for Circuitpython which is my goal for my new Thursday stream ๐Ÿ™‚

thorny jay
#

The white one are "aggressive"... maybe usefull for color detection, but not super friendly.

onyx hinge
#

@idle owl is there an effective commandline flag to entirely disable duplicate code checking?

idle owl
#

@thorny jay Exactly what they're for.

idle owl
#

That is the whole thing.

#

You can't disable it.

#

You can only increase the threshold to make it stop running on the whole repo. Or force Pylint to run on files separately.

#

@onyx hinge Do you understand now why there are shenanigans?

onyx hinge
#

To me it looks like pylint --disable=duplicate-code,... effectively disables the check

#

locally I have pylint 2.6.0, is that the current?

idle owl
#

Unless that was added in the last few weeks, it is a red herring.

#

2.7.1 is what we're using

onyx hinge
#

upgraded to 2.7.2, and the commandline --disable= also works for me

idle owl
#

2.6.0 had not fixed the duplicate check yet.

onyx hinge
#
pylint 2.7.2
$ pylint --disable=pointless-statement,missing-module-docstring *
************* Module b
b.py:1:0: R0801: Similar lines in 2 files (long spew omitted)... (duplicate-code)
Your code has been rated at 9.95/10 (previous run: 9.95/10, +0.00)
$ pylint --disable=duplicate-code,pointless-statement,missing-module-docstring *
Your code has been rated at 10.00/10 (previous run: 9.95/10, +0.05)
idle owl
#

Checking change logs.

onyx hinge
#

I recall you checked putting the disable in as a comment in a .py file

idle owl
#

We also tried adding it to .pylintrc but I swear we tried it on command line as well.

#

I guess we didn't. So that was all pointless.

thorny jay
#

@idle owl I wanted to use led_animation on the QT-Py, just an I2C sensor, a bit of code and blinking RGB using it. But I ran out of flash space. Works fine on the haxpress. I just needed colorcycle that only needed color for the Rainbow. So I started by removing everything except the two__init__, colorcycle.mpy and I replaced color.mpy by a stripped down version as color.py with only the needed color for the Rainbow (the MPY version was running out of memory). So now I can do rainbow, blinking, blinking between two color and still color. I could strip down a littly bit the init too as it contain a lot of thing I don't use. Would you consider a small version of led_animation?

idle owl
#

@onyx hinge Whatever. If you made it work, then PR to cookiecutter, and create an Adabot patch. We have to fix all the libs if that's the case.

onyx hinge
#

@idle owl yeah the second part I'm not thrilled about

#

I'll update my comments on that cookiecutter issue and if after reading it you feel like we've ended up on the same page then we can initiate actually doing all the stuff...

idle owl
thorny jay
# idle owl We don't want to support two versions of libraries. It's a support nightmare. Yo...

I kind of needed "blink.animate()" way of working as animation is not the sole goal but the indication of the sensor value. Here a CO2 sensor. I try to find a "language" where the color, or blinking speed or alternating of color is an "universal" or "understandable" indicator. Like GREEN/YELLOW/RED for traffic light. "Rainbow" could mean the air quality is perfect. "RED/BLUE" like police light mean emergency to open the window.

idle owl
#

Fair enough.

thorny jay
#

I'll to incorporate what I need in the body. That library inflated to many usecase, but too much for QT-Py. I believe the QT-Py RP2040 will solve all the space and memory issue. ๐Ÿ™‚

#

But as this is for COVID refresh air indicator in school... availability is more important than a lot of other criteria.

onyx hinge
#

if coding in arduino would let you attain your other goals, it's worth considering too

thorny jay
#

Yeah, that's an option. Now I have a PoC and it is working... it's for a friend that does not seems to be afraid to solder and program. So if he want to do better, he can.

onyx hinge
#

Just realized yet another wrinkle with pre-commit & pylint ... ugh, it's complicated!

idle owl
#

Yes.

onyx hinge
#

I think there is a possibility that duplicate code checking within the main package is not correct under pre-commit because of reasons

idle owl
#

I believe it.

onyx hinge
#

@idle owl OK I wrote a long new comment on https://github.com/adafruit/cookiecutter-adafruit-circuitpython/issues/121 but ultimately I'm concluding that the status quo isn't super broken, so maybe not touch it right now. But I do want the thoughts written down while I've got a good grasp of them.

idle owl
#

Makes sense.

#

The getting the thoughts down. I haven't read it yet, no idea if your thoughts make sense to me yet.

onyx hinge
#

fair enough. you have other priorities today anyhow

onyx hinge
#

<@&356864093652516868> hey all! the weekly meeting will be taking place in about an hour. Scott will be your host today. Please get your notes in the doc! No need to do anything if you'll just be listening in. https://docs.google.com/document/d/1CXqf-nL0NEFt2aXH2ouDlDym6o2VWNz8JRLPNmWUnQQ/edit?usp=sharing

thorny jay
#

Anybody speaking?

idle owl
#

Nope.

thorny jay
#

I hear sound... that's good.

#

Any advance technology will look like magic.

lone axle
#

A CircuitPython program running on the Cytron Maker Pi Pico using one row of its LEDs for a larson scanner. All sixteen GPIO pins are driven with PWM to allow the apparent brightness of the blue LEDs to be varied. An Adafruit Feather nRF52840 Express in the background plays the swoosh sound samples via commands sent over a serial connection betw...

โ–ถ Play video
fossil gorge
#

Listening only for now

lone axle
idle owl
#

@fossil gorge Still listening only?

fossil gorge
#

For now, yes

still zephyr
#

Listening only

thorny jay
#

Is that going to be iOS only? The BLE workflow?

fossil gorge
#

Will BLE include desktop support as well?

slender iron
manic glacierBOT
#

I was not able to reproduce the hang using PWM out at 7.83 KHz from one Circuitpython board into a Pico.
A few comments:

  1. The stack output doesn't show us anything - it is a thonny stack and not from circuitpython
  2. The print of len(pulses) probably doesn't show what you think it does, pulsein needs calls to popleft() to get values. So, you
    may want to do something like:
...
pulses_in=[]
while pulses:
    pulses_in.append(pulses.popleft())
print(len(pulses_in), "pulses_i...
idle owl
#

@fossil gorge Still listening only?

fossil gorge
#

No, I'm "fully here" now

idle owl
#

(Also you're blinking intermittently like you have audio coming through.)

manic glacierBOT
#

Instead of empirically determining the I2C SDA hold time, calculate the number of clock ticks to get the 300ns required value. See https://www.nxp.com/docs/en/user-guide/UM10204.pdf#page-48, table note [3] for the origin of the 300ns value.

The hardware default is 1, but that is arbitrary, since the length depends on ic_clk. 2 was enough to fix several I2C devices. 5 was need for PA1010D. However, the calculated value is 38 for 300ns. So the other values were quite marginal; this should ...

fossil gorge
mental nexus
#

FlipInput widget coming soon for Adafruit_DisplayIO_Layout

idle owl
#

Happy early birthday, @blissful pollen!

fossil gorge
blissful pollen
fossil gorge
thorny jay
#

There was the "use bytearray" advice.

#

And use binary font (unsure).

#

Reduce color depth.

#

Avoid recursivity?

#

Use generator rather than build big list.

mental nexus
#

Thanks all!

still zephyr
#

Thanks!

blissful pollen
#

Have a great week everyone!

thorny jay
#

Thanks.

gilded cradle
#

Thanks

lone axle
#

๐Ÿ‘‹

idle owl
#

Cheers!

manic glacierBOT
manic glacierBOT
slender iron
#

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

manic glacierBOT
#

I believe there is a CircuitPython backend to Thonny that will work better than the MicroPython one. The MicroPython one "runs" the code through the REPL which we don't really support. Instead, we expect the code to execute to be written to the code.py file on the disk. Mu is an alternative that does this: https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython

alpine nimbus
#

i can see items in this channel in the livestream but I don't see them here in discord. hmm

slender iron
#

what livestream?

alpine nimbus
#

the weekly meeting. wasn't i watching it live?

slender iron
#

It was three hours ago or so

alpine nimbus
#

oh, doh!

slender iron
#

๐Ÿ™‚

#

we don't stream to youtube live

#

but you can jump in here and join the circuitpython voice channel to listen live

alpine nimbus
#

that's ok. i didn't realize it wasn't live and was very confused

slender iron
#

np ๐Ÿ™‚

alpine nimbus
#

I just wanted to make a comment about memory usage. Last week I ran into a memory issue last week that kmatch and jose david were kind enough to help with and I finally got things to work.

#

I wrote some text to the screen on a Clue and replaced it a few times and then drew an emoji bitmap (not a huge one)

#

It seems like it should have placed only modest demands on the board. but that was enough to cause fragmentation and I couldn't load the bitmap

slender iron
#

were you using the clue library?

#

the "all-in-one" libraries can be very large

alpine nimbus
#

My main point is that the first thing everyone's first thought was to stop using the clue library. Libraries like that are supposed to make things easy for people like me. I did something small and the first thing I'm supposed to do is stop using the library? LOL

#

I could understand If I was doing something big

slender iron
#

ya, it's the challenge of having a library to do everything, even the things that you don't want to do

alpine nimbus
#

Also, using memfree, it looks like the clue library was barely using any memory

#

๐Ÿคทโ€โ™€๏ธ

slender iron
#

my preference would be to move away from those monolithic libraries in favor of smaller composable components

#

if the failing allocation was large, it would be a fragmentation issue

#

Live stream of @tannewt debugging memory issues in CircuitPython.

Visit the Adafruit shop online - http://www.adafruit.com


LIVE CHAT IS HERE! http://adafru.it/discord

Adafruit on Instagram: https://www.instagram.com/adafruit

Subscribe to Adafruit on YouTube: http://adafru.it/subscribe

Join our weekl...

โ–ถ Play video
alpine nimbus
#

I moved the bitmap allocation to the beginning and things seem to be fine now. and made a few other tweaks

slender iron
#

๐Ÿ‘ makes sense

manic glacierBOT
left mirage
#

are there any known issues with enabling the uctypes module (#define MICROPY_PY_UCTYPES (1)) when building for the trinket m0? i was able to compile (by changing the warning flags for one step) and haven't run into any issues yet

alpine nimbus
#

@slender iron Thanks, that link sounds helpful!

manic glacierBOT
slender iron