#circuitpython-dev

1 messages · Page 354 of 1

manic glacierBOT
manic glacierBOT
jaunty juniper
#

is there a procedure to go into safe mode on the pico ?

manic glacierBOT
slender iron
#

@jaunty juniper I don't think so. the reset button trick might just work

mental nexus
#

I'm trying to import <math.h> in my build of circuitpython so that I can calculate sin(angle). Did you ever figure out how to access math.h?

#

I'm building for the PyPortal.

#

Here's the error I'm getting:

CC ../../lib/protomatter/src/core.c
LINK build-pyportal/firmware.elf
/usr/local/Caskroom/gcc-arm-embedded/10-2020-q4-major/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: firmware.elf.lto.o: in function `displayio_bitmap_obj_blitfancy':
<artificial>:(.text.displayio_bitmap_obj_blitfancy+0x1d4): undefined reference to `sin'
/usr/local/Caskroom/gcc-arm-embedded/10-2020-q4-major/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: <artificial>:(.text.displayio_bitmap_obj_blitfancy+0x1ec): undefined reference to `cos'
collect2: error: ld returned 1 exit status
make: *** [build-pyportal/firmware.elf] Error 1
manic glacierBOT
#

From a problem signaled by Redat on discord, the following code hangs after a reload.

import board
import gamepad
from digitalio import DigitalInOut

button1 = DigitalInOut(board.GP7)
button2 = DigitalInOut(board.GP14)
button3 = DigitalInOut(board.GP13)
button4 = DigitalInOut(board.GP12)
button5 = DigitalInOut(board.GP11)
button6 = DigitalInOut(board.GP10)
button7 = DigitalInOut(board.GP9)
button8 = DigitalInOut(board.GP8)

pad = gamepad.GamePad(
	button1,
	button2,
 	...
tulip sleet
manic glacierBOT
#

Tested the 2-color EPD FeatherWing again with 6.2.0-beta.1 on a FeatherS2 with adafruit-circuitpython-bundle-6.x-mpy-20210209. Issue still occurs, changes to label text aren't shown with a simple display.refresh(). This sequence gets it to work:

display.show(None)
display.show(splash)
display.refresh()

Neither the 3-color EPD FeatherWing nor the MagTag exhibit this issue.

idle wharf
#

My proposal on the copyright: Do nothing right now finish off the PR. Then open a separate issue and discuss. Maybe for example, the entire docs folder should be optional for Community devices ...

idle owl
#

@idle wharf I'm game.

#

My only concern is the guide we need to update along with the PR.

idle wharf
#

someday I think the bundle model will break down, but for now I could that working great...
If you do the build stuff... I'll do the circup stuff...

idle owl
#

Took me a second to realise that wasn't a reply to me. It was confusing as a response. 😄

idle wharf
#

I'm a discord conversation and YT community meeting time traveler...

idle owl
#

@idle wharf I don't have the cycles at the moment to update that guide. There's not a whole lot to the update, but the page that explains cookiecutter needs to match, well, cookiecutter. I don't suppose you're interested in updating it?

idle wharf
manic glacierBOT
idle owl
#

@idle wharf Yeah it's a proprietary system that has a tiny learning curve, but that's entirely fair. I figured it was worth asking.

idle wharf
idle owl
#

@lone axle I'm thinking perhaps punt the PRs I suggested, and instead update the Sharing a Library guide to match the incoming PR so we can merge it sooner rather than later. Would you be up for that?

idle owl
lone axle
#

the cookie cutter one?

idle owl
#

Yeah.

lone axle
#

yep. I can do that. @idle wharf do you know how to test locally the new version? I want to make sure I get all of the prompts accounted for but have only ever run the production one.

idle owl
#

@idle wharf We're on. Please finalise the PR and we'll get it merged.

idle wharf
#

Well we gotta sort out the copyright and the docs stuff... I think those are bigger choices for you to make

#

(writing the issue now)

idle owl
#

Ok

#

@lone axle I think I tagged you on the PR already, but I'll tag you once we're ready.

#

Then you can get to it when timing works out. I might leave merging up to you at that point so you can deploy the doc updates at the same time on your own time.

idle wharf
lone axle
#

how to run cookie cutter with it once I have it cloned locally.

idle owl
#

Oh, I can help with that one. You run the same command as in the guide, but you run it from within the cloned repo, and you use . instead of the github address.

idle wharf
#

ah... I backup one folder and then cookiecutter cookiecutter-adafruit-circuitpython

idle owl
#

I think.

#

oh

#

Also valid!

idle wharf
#

that works too

#

Two ways !

lone axle
#

excellent! thank you both 🙂

idle owl
#

😄 exactly

idle wharf
#

If I did it that way Kattni, I'd probably checkin my test runs by accident...

idle owl
#

haha that's totally fair.

manic glacierBOT
#

@jerryneedell I tried this with the I2C/SPI backpack, which uses an MCP23008. I had to use 3.3v->5v level shifters to get it to work with a Metro M4, and then I moved it to an RPi Pico and it worked fine. I did not try it without the level shifters on the Pico in the interest of not potentially frying the Pico.

If I use the Metro M4 connected straight to the backpack with the 5V pullups, it hangs up. I think it does not like the overvoltage. I have seen this before with the SAMD51

The ...

idle wharf
jaunty juniper
#

@idle wharf any plan to add a pre-commit-config.yaml to circup ? with make check in it

idle owl
#

@idle wharf Please tag me on that issue so I can have it in my email and look at it tomorrow.

idle wharf
#

@jaunty juniper great idea... circup feels sort of one-off to me, maybe the cookiecutter should be applied to it

manic glacierBOT
solar whale
#

@tulip sleet Thanks for the help with the LCD. The "plate" was the only LCD I had and I was only hooking it up to respond to the original Discord question. I had some pretty long wires and that may have played into it. Now that it is working, I'm happy to put it back in my parts box.

manic glacierBOT
tulip sleet
#

I have a box full of pre-Adafruit LCDs and adapters of various sizes. THe level converters seemed very necessary on the ones i have.

solar whale
#

I check the schematic for this one before using it. The I2C signals are level shited on the board for the Pi, but it expect 5V in -- 3V is not connected....

#

hmm -- I take that back -- I need to read up on the mcp230017 -- and stop using this for now

#

I am confused. looking at the schematic now, the mcp230017 is connected to 5V -- not sure how that is OK on a Raspberry Pi?

manic glacierBOT
hoary moat
#

I’ve been playing around with classes for LatchingRelay and soon Relay. Is this something that would find a home somewhere?

fossil gorge
still zephyr
#

Hello, sorry if this is not the correct channel but I do not know where to put or ask question regarding the libraries.
If was looking in some issues for the library
Adafruit_Circuitpython_DHT.
I review the issues (open/closed). I compile a table that is in my REPO. link included

So, I decide to compare the old with the new library, and here I am talking for the BITBANG as a lot of people raising the issues are using RPs

I found that the new library uses the following code to start the communication

dhtpin.direction = Direction.OUTPUT dhtpin.value = True time.sleep(0.1) dhtpin.value = False time.sleep(0.001)

However reviewing the odl library in C code I found that the initialization time were

` // Set pin high for ~500 milliseconds.
pi_2_mmio_set_high(pin);
sleep_milliseconds(500);

  // The next calls are timing critical and care should be taken
  // to ensure no unnecssary work is done below.

  // Set pin low for ~20 milliseconds.
  pi_2_mmio_set_low(pin);
  busy_wait_milliseconds(20);`

This times coincides with some standard found in ocfreaks.com and in sgbotic.com
Images attached.
I did some tests, altough not perfect, at least my DHT11 worked with the bitbang of the
Adafruit_Circuitpython_DHT library 70% of the time in my RP3

Last thing, I did find a sparkfun datasheet that mentions 1 ms as low signal to start listening,
https://github.com/jposada202020/DHT_Investigation/blob/main/DHT_investigation.md
Do anybody knows why we use 0.001 for the low signal? I really appreciate some insight. THANKS 🙂

slender iron
#

@still zephyr the dht11 protocol is a weird one. the lack of real-time support on the rpi makes it hard to support

lone sandalBOT
crimson ferry
#

I have to rig up measuring current running on battery. Using an INA219 FeatherWing. FeatherS2 on USB 5V power (data lines not connected to fool Deep Sleep) down to avg 1.5mA using TimeAlarm, but there's the red power LED shining brightly.

#

Not using any sleep modes, just disconnecting from wifi when it's not needed cuts current by around 30mA.

manic glacierBOT
manic glacierBOT
lone axle
#

@fossil gorge that is awesome. No worries about the time, you can ping me here anytime I turn off notifications when I'm unavailable so pinging me will never be interrupting anything.

#

I will talk with Kattni and figure out where the best place would be to get this info into the learn system.

fossil gorge
#

I know some of that is a bit circumstance specific, but figured I'd document it to it's at least "known"

#

And those parts are the ones which I've run into. The parts you covered, I put in there more or less verbatim

ionic elk
#

@mental nexus scrolls back a year

#

@mental nexus I don't think so. I ended up doing a much simpler workaround of the problem that didn't require <math.h>

onyx hinge
#

You should also use the type mp_float_t for floating-point values

mental nexus
#

And thanks for the warning for the right code and data type to use for float or double.

idle owl
#

@candid sun Hey! This channel will do well enough.

#

Do you have the AW9523 board yet? It is my understanding that you'll be working with it soon with Noe and Pedro.

candid sun
#

yes we are! i have a couple on order

idle owl
#

Oh ok, you don't have it yet. Well maybe you can still help. I'm working on the guide for it and trying to do the wiring diagrams. I'm a little unclear on how to hook up an LED.

#

I thought LEDs usually go from pin to ground with a resistor in the mix.

#

But all the extra pins on this board are VCC.

#

or VIN rather.

candid sun
#

i was a little cloudy on it too but i'm thinking that the LED's pos leg will be connected to one of the GPIO outs

idle owl
#

Right ok I figured that part

candid sun
#

but yeah not completely sure what the VIN rails are for

#

where there's one for each pin

idle owl
#

hmm, from Limor in Slack: "ok the cool thing about the expander is you do not need LED resistors"

#

Right that's where I got confused was the VIN rails.

#

I guess I'll ping Limor. She'll know for sure.

#

I thought you might have it already 🙂

candid sun
#

no unfortunately, hopefully soon though! darn snow

idle owl
#

@candid sun Oi yeah. Ok, well I'll let you know what I find out 🙂 In case you get it before the guide goes live.

#

Thanks for thinking through it with me!

candid sun
#

@idle owl thank you!

tidal kiln
#

@idle owl yah, the AW has fancy pants outputs that limit the current, so will basically do what the resistor would do normally

idle owl
#

Ok, that makes sense, but I still don't understand the VIN rails. @tidal kiln Don't LEDs go from GPIO to ground?

#

Or is the current limiting to connect the LED to VIN and GPIO?

tidal kiln
#

let me look at the docs real quick. mines on the way also unfortunately.

idle owl
#

@tidal kiln Thanks! Limor got busy.

#

As she does. 😄

tidal kiln
crimson ferry
#

product description says "simply connect the LED anode to one of the many VIN pads, then connect the cathode to the GPIO pin"

tidal kiln
#

think of the VIN rail as that red stripe

#

^^yep

#

so like LED+ to VIN, LED- to GPIO

#

the VIN rail is for convenience, otherwise you'd be bringing all the LED anodes (+) back to a single point

idle owl
#

Hmm ok

#

Fair enough.

#

Thanks!

#

@slender iron This is still needed in 6.x for a generic CircuitPython audio out example, correct? python try: from audioio import AudioOut except ImportError: try: from audiopwmio import PWMAudioOut as AudioOut except ImportError: pass

slender iron
#

yes because that handles both the express and bluefruit

#

bluefruit uses PWM

idle owl
#

@slender iron Ok, updating the Essentials guide to remove deprecated code, and wanted to verify that wasn't also deprecated now. Didn't think it was, but naturally I chose a Bluefruit to test, so it would have worked if I removed the extra stuff there... figures. Thanks.

tidal kiln
#

@idle owl i think so. that's my understanding at least. do you have one to actually test?

idle owl
#

@tidal kiln Nope.

#

That's why I'm struggling.

#

if I could have simply hooked one up, I would probably have sorted it.

#

heh

mental nexus
blissful pollen
idle owl
#

@gilded cradle If I were going to add the Getting Started with Pico and CircuitPython guide link to the Pico downloads page on circuitpython.org, do I add it to _board/raspberry_pi_pico.md ?

#

@slender iron Would you suggest replacing the RPi Documentation link with our guide? Or adding it in addition to?

slender iron
#

addition to

idle owl
#

Thanks

slender iron
#

np, thank you!

#

breakfast time for me

tulip sleet
#

@tidal kiln I was going to look at the Pico TCS34725 issue. Unfortunately I don't have this breakout. It has level shifters. Are you powering it with 3.3V on Vin or 5V? I am just wondering about the strength of the pullups and whether the SCL/SDA pins are showing 5v or 3.3v out.

mental nexus
gilded cradle
#

@idle owl, that's correct. Sorry for the delay.

idle owl
#

@gilded cradle No worries, thanks.

tidal kiln
#

@tulip sleet sry. on a quick pre-snow event errand run. let me take a look....

tulip sleet
#

np

tidal kiln
#

@tulip sleet power via 3V3 OUT from pico. i just set this back up. i'll add a photo to issue thread.

tulip sleet
#

thanks, I was wondering whether the Pico was seeing 5v pullups. Maybe next step is to parallel some 10k or 5k resistors on the pullups to see if stronger pullups help. I will try some other breakouts.

#

@tidal kiln so you are just sending an EON command, and that's getting a NAK, right? this is weird

tidal kiln
#

can't remember what the command was, but something i grabbed from the driver, and the just tried to send that manually

#

yep, and it NAKs

simple pulsar
#

Is there a list of what works and doesn't work (but will one day) in CircuitPython on Raspberry Pi Pico. I might take a look at PWMAudioOut next week...

tulip sleet
#

we label all the issues

simple pulsar
manic glacierBOT
uncut nexus
#

@slender iron - I noticed that we are building RP2040 builds with BLE on by default. Not that we're short on memory, but it does add about 31K to the build. Was that done on purpose?

tulip sleet
#

BLEIO_HCI makes sense, BLEIO does not

uncut nexus
#

@tulip sleet - If I just set CIRCUITPY_BLEIO to 0 I get an error in main where bleio_reset is getting called.

tulip sleet
#

is BLEIO_HCI set? You need BLEIO for BLEIO_HCI

uncut nexus
#

BLEIO_HCI is on by default when CIRCUITPY_FULL_BUILD is on

tulip sleet
#

that makes sense, because you may want to use it with an AirLift

#

ANy board that has the flash space has BLEIO_HCI on

uncut nexus
#

OK - I'll ignore it then, thanks!

manic glacierBOT
tidal kiln
#

@tulip sleet no change with 10k or 4.7k added in

tulip sleet
#

@tidal kiln 😦 thanks for trying. I will try a few other breakouts to see if they fail similarly, and will order that one.

tidal kiln
#

np. yep. from what i can tell, it's a pretty weird issue.

manic glacierBOT
#

I saw #4143 but haven't yet worked out exactly what's going on there, is that related to this?

This bug is fixed in main. (I'll close shortly.)

Is there anything simple that documents "the slices" or is in the monster datasheet?

It's in the pin function section. It's simple though. The slice is pin number / 2 % 8 and the channel is pin number %2. In words, starting at zero the next two pins share a slice, then the next two do and so forth until pin 16 which starts the pattern aga...

slender iron
#

@uncut nexus we should have plenty of space for it on the rp2040. thanks for asking though!

idle owl
#

@tulip sleet Around for a question?

tulip sleet
#

@idle owl sure

idle owl
#

I mean I assume the except OSError as e bit is for when the filesystem isn't writeable.

#

But what's the specific argument?

#

Trying to add this to a guide, and want to make sure it's all necessary and how to explain it if so.

tulip sleet
#

an exception can have associated values, often an error code or (usually) a string, e.g.:

>>> e = Exception(32)
>>> e.args[0]
32
>>> e = Exception("something wrong")
>>> e.args
('something wrong',)
>>> e.args[0]
'something wrong'

So this was the equivalent of raise OSError(28)

#

the 28 is an errno value, hold on

idle owl
#

ok

tulip sleet
#

error 28 is ENOSPC, no space left on device (e.g. filesystem full)

idle owl
#

OH.....

#

Ok. Yeah that makes sense

#

Blink fast because it can't write anymore.

tulip sleet
#

I think a comment is in order

idle owl
#

Indeed.

#

@tulip sleet Added the comment, I'll put it in with the current code I'm working on.

tulip sleet
#

and all other errors it blinks more slowly

#

like being unable to open the file for write, etc.

manic glacierBOT
#

The existing implementation of I2C does not currently recognize requests for a repeated start condition, which caused reads to fail on some chips. Since only the "IT" interrupt-driven versions of the ST HAL support this feature, fixing this issue also required implementing the usual infrastructure for ST interrupts, matching other modules like UART and PulseIn.

@tannewt I didn't really touch the base implementation here, but if you think we'd benefit from moving regular I2C operations to t...

idle owl
#

@tulip sleet Right. Ok. Thanks!

manic glacierBOT
idle owl
#

Please note the change of day! Here is the notes document for TUESDAY’S CircuitPython Weekly meeting. It is on TUESDAY next week, at 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/1CgGh2MkN5dY0VeqONvdY1h9bs13mZhzp1a4nYExQ4vg/edit

idle owl
#

@tulip sleet More questions about the nature of storage.remount(). Or maybe only one question, I don't know. If you run it, and make the filesystem writable to CP, your computer can no longer write to it. So, in the Essentials guide for example, we show how to wire a pin to ground to make the filesystem read-only, and if you start the board without that pin wired, it's writable. What do you do if you don't have that extra step in there? So let's say you have the following boot.py file: python import storage storage.remount("/")And you log something for a bit, but then you want to update your code, how do you get back to a writable state?

#

Because you can't simply delete boot.py, because it's a read-only filesystem at that point.

#

This is specific to the Pico, which I don't know if you can get into safe mode, as I assume that's going to be your answer.

tulip sleet
#

@idle owl you can do this in the REPL:

>>> import os
>>> os.remove("boot.py")  # delete boot.py
OR
>>> os.rename("boot.py", "boot1.py") #rename boot.py
idle owl
#

Ooooh. Ok.

manic glacierBOT
#

I copied some larger audio files to CIRCUITPY, using up about 30% of the space. storage.erase_filesystem() reset the board but did not reformat the filesystem. The filesystem appears the same before and after. So perhaps the original issue was a corrupted filesystem that wasn't cleaned up by erase_filesystem(). I've changed the title to reflect the more general issue.

#

A few questions for feedback:

  • A better name of the function Bitmap.blitfancy
  • Should the source and destination translation points ox,oy and px,py be sent as (x,y) tuples?
  • Should I add a decode_an_tuple_of_int function since this code is duplicated? (maybe it will save space)
  • Should I add a constrain_clip_boundary function to constrain and arrange the clip coordinates, since this code is duplicated? (maybe it will save space)

This version added about 2kB to a bu...

tidal kiln
#

is this expected behavior?

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit_circuitplayground.express import cpx
>>> dir(cpx)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is not supported on Circuit Playground Express.
>>> 
idle owl
#

hmm

#

Probably not?

tidal kiln
#

older rev, fwiw:

Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit CircuitPlayground Express with displayio with samd21g18
>>> from adafruit_circuitplayground.express import cpx
>>> dir(cpx)
['__class__', '__dict__', '__init__', '__module__', '__qualname__', 'gamepad', 'temperature', 'acceleration', 'shake', 'tapped', '_int1', '_i2c', 'light', '_audio_out', 'detect_taps', '_touch', 'touch_A1', 'touch_A2', 'touch_A3', 'touch_A4', 'touch_A5', 'touch_A6', 'touch_TX', 'adjust_touch_threshold', 'pixels', 'button_a', 'button_b', 'were_pressed', 'switch', 'red_led', '_sine_sample', '_generate_sample', 'play_tone', 'start_tone', 'stop_tone', 'play_file', '_a', '_b', '_switch', '_led', '_pixels', '_temp', '_light', '_touches', '_touch_threshold_adjustment', '_lis3dh', '_speaker_enable', '_sample', '_sine_wave', '_sine_wave_sample', '_detect_taps', 'touch_A7']
>>> 
idle owl
#

wait

#

why are you importing from .express?

#

It was refactored to use a base class

#

I don't know why it would fail that way

#

but do from adafruit_circuitplayground import cp and then dir(cp) and it works.

tidal kiln
#

ah. i'm copying someone else. could be it. let me self rtm....

idle owl
#

Hah. Ok

#

Yeah we refactored it, you shouldn't be importing from .express specifically anymore.

#

There's really nothing in it.

#

Nearly everything is in the base class.

tidal kiln
#
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit_circuitplayground import cp
>>> type(cp)
<class 'Express'>
>>> dir(cp)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is not supported on Circuit Playground Express.
>>> 
idle owl
#

Ah ok

#

welp

#

It works on Bluefruit

#

so I'm not sure what's going on there

#

I think I'm running the beta though, and maybe not the latest CP lib.

#

let me update the lib

tidal kiln
#

the actual lib is frozen in, right? must be, it's not in my lib folder.

idle owl
#

yes for CPX

#

not bluefruit

#

Hmm it works on Bluefruit.

#

I am confuse.

#

Let me grab a CPX.

tidal kiln
#

okie doke. cool. thanks.

idle owl
#

Yep fail.

#

I wonder if it's the way we did the unsupported things, when you do dir(cp) it tries to list unsupported features and fails? I'm stretching here.

tidal kiln
#

the line number is odd too, if that can be trusted

idle owl
#

Agreed, it's not right.

#

I don't know what's going on.

#

hold on

#

let me update, this is running a dirty build.

tidal kiln
#

it otherwise generally works

>>> cp.pixels.fill(0xADAF00)
>>> cp.play_tone(440, 1)
>>> 
#

tab completion works too

idle owl
#

fail on the beta as well.

#

I wonder what changed. Pretty sure that dirty build had a latest version of the lib too, and it failed with that. So it's not like updating the frozen module will fix it.

#

I'm at a loss. Bluefruit works fine.

tidal kiln
#

you said not frozen on bluefruit? so it's using what's in lib folder?

idle owl
#

yes

#

Bluefruit has room for it.

#

Express, not so much.

#

Doesn't appear to be a frozen library limitation ```>>> import adafruit_lis3dh

dir(adafruit_lis3dh)
['class', 'file', 'name', 'const', 'digitalio', 'math', 'namedtuple', 'struct', 'time', 'version', 'repo', 'LIS3DH_I2C', 'RANGE_8_G', 'RANGE_16_G', 'RANGE_4_G', 'RANGE_2_G', 'DATARATE_1344_HZ', 'DATARATE_400_HZ', 'DATARATE_200_HZ', 'DATARATE_100_HZ', 'DATARATE_50_HZ', 'DATARATE_25_HZ', 'DATARATE_10_HZ', 'DATARATE_1_HZ', 'DATARATE_POWERDOWN', 'DATARATE_LOWPOWER_1K6HZ', 'DATARATE_LOWPOWER_5KHZ', 'STANDARD_GRAVITY', 'AccelerationTuple', 'LIS3DH', 'LIS3DH_SPI']

#

But it could be something about it being frozen and the way we handle unsupported modules.

tidal kiln
#

seems like it. if it were a basic frozen issue, the above would have it also.

idle owl
#

Or would fail somehow anyway.

tulip sleet
#

@slender iron @onyx hinge I am composing beta.2 release notes.

tidal kiln
#

@idle owl worth issue?

idle owl
#

@tidal kiln Probably, though I have no idea who will look at it or when. But yes, please. File an issue.

manic glacierBOT
#

Re this thread:
https://forums.adafruit.com/viewtopic.php?f=58&t=175096

Some weirdness trying to use dir() with the CPX. Can recreate it:

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit_circuitplayground import cp
>>> type(cp)

>>> dir(cp)
Traceback (most recent call last):
  File "", line 1, in 
  File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is...
idle owl
#

@tidal kiln Ah I would have filed it on the lib. But that also works. Might get it looked at more quickly. Or it might get moved to the lib. 🤷‍♀️

tidal kiln
#

🙂

manic glacierBOT
manic glacierBOT
#

This doesn't actually work for me (adapting the duplex spi example), though I think the problem lies either with my pio code or the construction of the StateMachine.

Here's my test program, with a workaround for https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/issues/7 applied:

import adafruit_pioasm
import rp2pio
import board


"""
; Pin assignments:
; - SCK is side-set pin 0
; - MOSI is OUT pin 0
; - MISO is IN pin 0
;
; Autopush and autopull must be enabled, an...
idle wharf
#

@idle owl, you have time for milk and cookiecutter?

#

I saw your reply on the issue, I had one more idea. Would Adafruit want to add the product number so the link to the adafruit hardware page could be in every library?

#

If the URLS could pre-known (well formatted) we could even add the picture.

manic glacierBOT
idle owl
#

I say "kind of", I mean we do.

manic glacierBOT
idle owl
#

Sorry for delayed response, I was quickly eating before our meeting.

slender iron
#

@uncut nexus are you looking at the pio as well?

idle owl
#

@idle wharf The cookiecutter for the PCB repos has that feature is my point.

#

Including the image from the product page.

#

If you want to see an example of how to do it.

manic glacierBOT
idle wharf
manic glacierBOT
#

I was able to reproduce this error. Commenting out the raise exception in _unsupported in adafruit_circuitplayground.express allowed for it to operate as expected.

    @property
    def _unsupported(self):
        """This feature is not supported on Circuit Playground Express."""
        raise NotImplementedError(
            "This feature is not supported on Circuit Playground Express."
        )
    @property
    def _unsupported(self):
        ""...
idle owl
slender iron
#

@onyx hinge want to chat PIO before our meeting?

onyx hinge
#

@slender iron sure, let me get back to my desk

slender iron
#

can just do it in the same place

manic glacierBOT
idle owl
#

Cheers.

thorny jay
#

Here?

tulip sleet
#

or help

idle owl
#

@tulip sleet boot.py is run only when the board boots up, correct? So is that on soft reset as well? When you press the reset button? Or since the Pico has no reset button, when you plug it into USB?

tulip sleet
#

on pico, yes when plugged in. I will double-check about reload

jaunty juniper
#

by plugging or via the run pin

idle owl
#

Run pin?

tulip sleet
#

no not on soft reload, of course, since USB is connected

idle owl
#

Ok

#

Thanks

jaunty juniper
#

the pico has a pin called run, that... resets

idle owl
#

Oh right.

#

Not sure I want to get into that for this guide.

jaunty juniper
#

as the name does not imply

idle owl
#

It's meant to be beginner.

idle owl
#

@tulip sleet Trying to explain this file: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Getting_Started_With_Raspberry_Pi_Pico/data_logger_boot.py So far I have it's setting up the pin. With the storage.remount("/", pin.value), it's running storage.remount every time the board starts up, but only remounts if the pin is connected to ground? Is that a good explanation?

tulip sleet
#

it might be clearer if you test the pin and run remount only if it's in the state that needs it.

idle owl
#

I don't follow.

#

Like if pin.value: storage.remount()?

tulip sleet
#
if pin.value:
    storage.remount(...)
idle owl
#

ok

tulip sleet
#

or maybe it's not pin.value

idle owl
#

I'll update and test it.

jaunty juniper
#

it would be a breaking change but having readonly a required named parameter would make the API clearer in the examples (as long as everyone understands it's readonly from python of course)

#

actually is that possible ?

idle owl
#

@tulip sleet It's not. 😄

#

Would it be if pin.value if I did a Pull.DOWN?

#

Why is a pull-up used over a pull-down anyway.

onyx hinge
#

and put the other end of the button to VSYS

idle owl
#

?

onyx hinge
#

instead of gnd

idle owl
#

There's no button. It's a jumper wire.

onyx hinge
#

oh, you connect the jumper wire to what?

idle owl
#

GP0 to gnd.

#

That's how we did it in the Essentials guide

#

grounded a pin

tulip sleet
#

gnd is usually more readily available than the +v when you design a board. Maybe a little less noisy too

onyx hinge
#

if you pull DOWN then you'd connect GP0 to vcc to simulate the "press"

idle owl
#

Oh.

#

ok

#

This is fine.

tulip sleet
#

this is fine 🔥

onyx hinge
#

some old microcontrollers had pull "UP"s but not "DOWN"s, now most have both.. so like original arduino atmega had only pull UP as far as I remember

idle owl
jaunty juniper
#

I was thinking storage.remount("/", readonly = False) might be more readable than a mysterious boolean, even if the name is not necessary ?

tulip sleet
#

i like using the argname

idle owl
#

@tulip sleet python if not write_pin.value: storage.remount("/") yes?

#

I mean it worked

#

but checking with you anyway

tulip sleet
#

i thought you had to specify a non-default value of the readonly arg?

idle owl
#

¯_(ツ)_/¯

jaunty juniper
#

it defaults to False

tulip sleet
#

or even if the default value is ok, specifying it is clearer.

idle owl
#

how so, I'm not following

tulip sleet
#

remount could remount read/write or readonly, so which is it? we'd have to look at the doc

idle owl
#

Oh hmm

manic glacierBOT
jaunty juniper
#

then again we only ever remount with False, since it's to change the default behaviour of the drive

tulip sleet
#

well, you could flip back and forth, for some reason

idle owl
#

@tulip sleet So what should I be doing then?

jaunty juniper
#

true, like write into a file and remount readonly

idle owl
#

@jaunty juniper I'm getting that much, but I'm unclear on exactly what the code is supposed to be.

manic glacierBOT
tulip sleet
#

@idle owl

if not switch.value:
    # If switch pressed, mount CIRCUITPY so Python can write it.
    storage.remount("/", readonly=False)
idle owl
#

@tulip sleet Thank you

manic glacierBOT
#

Oh, good call. I've gotten so used to @property I don't even notice it much now. Hmmmm....why is it a property? For the items that get remapped:

    sound_level = _unsupported
    loud_sound = _unsupported
    play_mp3 = _unsupported

the last two are functions.

Simply commenting out the @property line gets around it also:

Adafruit CircuitPython 6.2.0-beta.1-194-gf6603aa56-dirty on 2021-02-10; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit...
tulip sleet
#

@slender iron I will do beta.2 unless you have anything else you want to add now

slender iron
#

let me glance over pending stuff

#

@tulip sleet looks good to me

#

I suspect we'll want to do one next week too

tulip sleet
#

downloading the download logs now ...

slender iron
#

I'm curious about the pico stats too. we really need a cron for it

tulip sleet
#

it would be great to suppress the upload logging. I haven't had time to look at that. I did look at doing AWS lambda to do some preprocessing, but just saw it was possible

slender iron
#

added stride support, restart, run and stop

#

also wait_for_txstall which I need for I2S

onyx hinge
#

looks good at first glance

#

thanks @slender iron !

slender iron
#

I'll test it tomorrow when I do the PIO for I2S

#

we should determine a better way to pin init

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

Interesting note in the python docs about dir().

Note: Because dir() is supplied primarily as a convenience for use at an interactive prompt, it tries to supply an interesting set of names more than it tries to supply a rigorously or consistently defined set of names, and its detailed behavior may change across releases. For example, metaclass attributes are not in the result list when the argument is a class.

Maybe __dir__ sh...

lone sandalBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

With the patch in, this script is working for me:
import pwmio
import board
pinred = pwmio.PWMOut(board.GP17, frequency=5000, duty_cycle=0)
pingreen = pwmio.PWMOut(board.GP18, frequency=5000, duty_cycle=0)
pinblue = pwmio.PWMOut(board.GP19, frequency=5000, duty_cycle=0)
print(pinred,pingreen,pinblue)

Note that if you choose GPIO pins that use the same channel (such as 5 and
21, or any pair
that differ by 16) you will still get the ValueError.

On Wed, Feb 10, 2021 at 10:32 PM bhavithiran97 <...

manic glacierBOT
manic glacierBOT
orchid basinBOT
prisma salmon
#

Rando question - has anybody dealt with pinning Micropython and NimBLE to core 0? I'm running into inconsistent initialization times on a BLE board, largely because of this issue:
https://github.com/micropython/micropython/issues/5489

manic glacierBOT
#

on a metro-esp32s2
After a hard reset I can access I2C normaly, but after soft reboot or deep sleep the access fails to find the I2C device
This example uses board.I2C, but is fails the same with busio.I2C

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

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

Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Adafruit Metro ESP32S2 with ESP32S2
>>>
>>> import shtc3_simpletest
Temperature: 2...
manic glacierBOT
solar whale
#

@tulip sleet Is there something I have to do to "revert" to not use the UF2 bootloader on a metro esp32s2 -- I just did a make flash ... and it loaded OK but does not boot? It works fine with the UF2 Bootloader.

tulip sleet
#

did you load the bin or the uf2?

solar whale
#

doh!

#

no-- make flash does the bin

tulip sleet
#

i don't remember the uf2 mechanism, but I never use the uf2 bootloader. you can do esptool.py ... erase_flash or something like that to get rid of everything, and then load the bin.

solar whale
#

will try that

#

OK -- now it boots -- thanks

manic glacierBOT
solar whale
#

ah -- uf2 bootloader is causing some mischief....

manic glacierBOT
#

We saw something similar a long time ago with SAMD boards. They would reboot at too low a voltage level: the voltage was enough to run the CPU but the first attempt at trying to read the flash chip failed. So the code assumed the flash filesystem was defective and reformatted it. We ended up changing the bootloader to wait longer for the voltage to stabilize.

The latest 6.1.0-beta.2 has a fix so that waking from deep sleep will not mistakenly think there was a brownout. I'm not sure that w...

manic glacierBOT
#

I think they mean “with the proposed changes incorporated”

On Wed, Feb 10, 2021 at 9:48 PM bhavithiran97 notifications@github.com
wrote:

What do you mean by patch in ?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/issues/4143#issuecomment-777217031,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADWE465QJJPA2IXXPMGZOYTS6NVTBANCNFSM4XF4LMKA...

onyx hinge
#

@slender iron seems like your work in progress code that you shared with me yesterday supersedes the draft PR I had to enable read and read/write on pio .. agree?

manic glacierBOT
#
[adafruit/circuitpython] New branch created: revert\-4114\-spidevice\_spi
manic glacierBOT
#

The basic problem is that dir() is calling the properties:

test.py:

class Test:
    def func(self):
        pass

    @property
    def prt(self):
        print("prt was called")

    @property
    def prop(self):
        raise NotImplementedError("no prop")
Adafruit CircuitPython 6.2.0-beta.2-dirty on 2021-02-11; Adafruit PyPortal with samd51j20
>>> from test import Test
>>> t = Test()
>>> dir(t)
prt was called
Traceback (most recent call la...
manic glacierBOT
#

Hi guys, I tried to get help on the discord channel but no dice so I'm opening and issue.

I'm playing with the feather M4 express and a stemma speaker. There is something weird happening where after playing the mp3 file, there is a weird noise playing. like a high note going to a low note. kind of line a laser blaster sound FX

Here's a clip of that sound. https://streamable.com/8axwjf

And Here is the code I'm using.

import time
import board
import digitalio
import audiomp...
#

Thanks for the quick response.

Here is my original code and I just tested it again and it still doing the same thing. How do I prevent the deinit in this case? I fooled around a lot last night trying to figure what I'm doing wrong.

import time
import board
import digitalio
import audiomp3
import audioio

whistlefx = audiomp3.MP3Decoder(open("whistle.mp3", "rb"))
a = audioio.AudioOut(board.A1)

while True:
    try:
        print("playing")
        a.play(whistlefx)
    ...
slender iron
#

@onyx hinge ya I think so. Sorry about that! Still good for you to wrap your head around pio. You can help me come up with a better way to init pins.

blissful pollen
onyx hinge
#

@slender iron do you know what macro protomatter should check to decide if the microcontroller is rp2?

idle wharf
#

I am fixing my MacOS setup to be able to build on my Mac Mini M1 and I hit an issue, I wanted to see if this was already on your radar.
When I install the esp-idf from github and run source ~/esp/esp-idf/export.sh it works but in a new terminal when I try to run the export form ports/esp32s2/ I get ERROR: Platform Darwin-arm64 appears to be unsupported
Is it time to update the IDF version in CP ?

gloomy shuttle
idle wharf
#

I can build successfully from the ~/esp/esp-idf environment.

slender iron
#

@onyx hinge no, you may need to add one

onyx hinge
#

@idle wharf it may need an esp-idf update in circuitpython before that build environment will work.

idle wharf
#

Well for now... the next person who hits this can at least find that.

onyx hinge
#

looks like we're using an adafruit fork of esp-idf so it would totally work to pull that change into there, and then use it in CP

#

I understand if you don't want to switch tasks and do that right now though

idle wharf
#

If you explain to me how to do it, (or point me to the how-to) I'm happy to do it. My git foo is not advanced.

manic glacierBOT
onyx hinge
#

@idle wharf maybe just file an issue on circuitpython then

manic glacierBOT
#

When installing the esp-idf from github and runing source ~/esp/esp-idf/export.sh it works but in a new terminal when running the export from ports/esp32s2/ I get ERROR: Platform Darwin-arm64 appears to be unsupported.

I can build successfully using the latest IDF (commit 73db14240).

The fix in the IDF appears to be this one
https://github.com/espressif/esp-idf/commit/5739127412b6756801a38c700d068dd1d937ed41#diff-873391a19109de0fec9486d3ef26704a32fe81560a38f2e1f6c4f3db99d19350

...

manic glacierBOT
#

A few questions for feedback:

* A better name of the function `Bitmap.blitfancy`, maybe `blit_rotate_scale`?

I'm ok calling it fancy blit.

* Should the source and destination translation points `ox`,`oy` and `px`,`py` be sent as `(x,y)` tuples?

Whatever is consistent with existing APIs (I can't remember.) One reason to avoid tuples is it forces an object creation.

* Should I add a function to decode two ints from a tuple, since this code is duplicated? Or ...
#
void audiosample_convert_u8m_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes);
void audiosample_convert_u8s_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes);
void audiosample_convert_s8m_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes);
void audiosample_convert_s8s_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes);
void audiosample_convert_u16m_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes)...
slender iron
tulip sleet
#

single-click

#

at least on cpx

#

i can test this on pybadge

onyx hinge
#

This bar graph is a good indication that Long term isn't just a place for issues that we ignore forever. It would be nice if it were "more full", but we certainly do get to these items (and there are probably even more items that were once marked long term but got moved to a release-milestone before being completed).

manic glacierBOT
#

Some items that have come up repeatedly but have been addressed separately each time:

  • Conversion of samples between signed & unsigned
  • Conversion of mono samples to stereo
  • Conversion between 8 and 16 bits (some ports even need other sizes, e.g., 10 bits (pico) or even non-power-of-two ranges (nrf))
  • "re-blocking" audio to fit an underlying buffer size required by the API
  • "ramping" to/from a quiescent value

We should more closely identify what we would like to do, find API...

onyx hinge
#

@slender iron OK I filed an issue but it's a bit rambly so anything you can do to concentrate our minds will help

tulip sleet
#

@slender iron yup single click. I can post in the forum if you want

slender iron
#

@tulip sleet go ahead

onyx hinge
#

On Linux, if your CircuitPython board supports reboot-to-bootloader and is at the location $SERIAL, you can commandline reboot it to bootloader with: stty hup 1200 < "$SERIAL"

slender iron
#

@onyx hinge rambly is ok for now. mainly we should gather ideas

#

@onyx hinge I didn't know if make:code binaries supported that

onyx hinge
#

it wasn't really related to what you & dan were discussing

ionic elk
#

@tulip sleet what's an expendable module that could free up about 2k in space?

tulip sleet
#

you mean for testing or in general?

ionic elk
#

Gotta fix this espruino thing

#

the JP issue. Kinda silly but it's a low prio board anyway

#

so I can probably just chop something and worry about it if anyone brings it up later

tulip sleet
#

there's something weird going on because it should not have grown by 2kB just in your PR

#

if you build it locally with TRANSLATION=ja does it overflow?

ionic elk
#

let me try that, I don't normally build for translations so I was looking for the syntax

tulip sleet
#

make BOARD=... TRANSLATION=ja clean
then not with clean

ionic elk
#

running

tulip sleet
#

what's the chip on the board?

#

never mind I'm looking

ionic elk
#

hmm yep it runs fails with overflow, running again on main

#

*meant to say runs out

tulip sleet
#

CIRCUITPY_FRAMEBUFFERIO could go

ionic elk
#

hmmm, it does work on main, how weird.

#

Reading the build output, the difference is a flag, -DCIRCUITPY_USB_VENDOR=0

tulip sleet
#

that should be off by default for all builds

#

maybe you should merge from upstream

ionic elk
#

I'll try that and see if anything magic happens

#

nope, no dice, how weird

#

(stepped out for a sec)

manic glacierBOT
ionic elk
#

@tulip sleet Framebuffer did the trick though, thanks for the suggestion.

manic glacierBOT
#

Testing performed: scoped it, didn't drive a real display yet

  • created a 128x64 display, 3 bits resolution
  • checked across soft resets
  • checked recreating display

Also found a race condition between timer_disable and redraw, which would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable or put a delay or print inside it. That's what pausing inside reconstruct
fixes.

So that the "right timer" can be chosen, timer_allocate now gets the self pointer. It...

cobalt grail
#

Is the webserver stuff working on the ESP32S2 yet? I have a cool home automation related project in mind, but it requires acting as a webserver.

tulip sleet
#

@cobalt grail tcp server is in the latest beta (and the one before that, I think)

tidal kiln
#

so....a PR that's like a few lines of text to update docs....anyway to dial down the CI?

tulip sleet
#

no, sorry

#

we need to make 3000 builds

tidal kiln
#

that's ok...i'm the one who's sorry. poor little hamsters.

manic glacierBOT
#

Thanks for the feedback, I added a few functions to reduce the repetition, saved a little space, but still about 2k larger than the previous.

Makes sense to put it into a different module, since I can envision other bitmap manipulation functions (I'm already thinking about a blit version with color re-mapping options). How about a name like like bitmap_tools?

Next question, is how do I break it into a separate chunk?
Keep it inside displayio, or up at the same level as displ...

manic glacierBOT
sour river
#

@slender iron I'm a few days late, but I just tried the new code and 16-bit worked perfectly! Look at this beautiful sine!

#

(oh, and I had changed the tone to 256 Hz--that's not a mistake)

fathom trellis
#

Hey folks -- I'm one of the organizers of PyCascades. We're running a mentored sprint on Sunday, Feb 21st in PT. I was wondering if any contributors to CircuitPython would be interested in joining us for a few hours to lead a sprint and help some folks who are new to open source get started.

#

You can learn more about PyCascades here: https://2021.pycascades.com/

manic glacierBOT
manic glacierBOT
#

@matemaciek I have heard that the CircuitPython crew has UART on the roadmap for the Pico but there is none on the map for USB host support (on any board).

But once UART is available you can use a separate board as USB host to connect to the PICO via UART or other protocol. It’s not so elegant but you can “spoof” a REPL to go to UART. I know It’s not officially supported by the crew here but you can hack something that can work. Ping me on discord if you want an example.

manic glacierBOT
fading mantle
#

I'm trying to port circuitpython to this module:
https://www.we-online.de/katalog/en/PROTEUS-III

i have the a devkit and started my efforts by basing it on the official Nordic devkit (PCA10056) board definition.
now my question is:
i don't need USB support. can i disable it or at least have the REPL run on UART rather than CDC?

manic glacierBOT
tulip sleet
#

@fading mantle

i don't need USB support. can i disable it or at least have the REPL run on UART rather than CDC?

#

No, we don't have a way of supplying the REPL over UART right now. It is part of the CircuitPython "experience" to have the REPL accessible via USB. The same is true for the CIRCUITPY drive being available via USB in order to get code and libraries onto the board.

mental nexus
#

@fading mantle I’ve made a hack that intercepts the REPL and takes input via UART (see file ri.py. Perhaps this could be expanded to send output back on the UART. https://hackaday.io/project/171269/files

onyx hinge
#

I can only speak for myself, but I think there will eventually be a compromise on the "usb workflow" we will make. "ble workflow" is something tannewt wants to work on and will likely involve a non-usb UART and non-mass-storage file transfer. It would just be mean to write that in a way that it only works with a BLE uart and not a hardware UART. USB host mode isn't on our roadmap, but I'm not sure why we'd have to turn it down. But we'd probably want CircuitPython to be able to detect whether it's connected as a host or as a device and still be capable of presenting the standard CDC & Mass Storage interfaces when connected as a device. And of course you can always fork & rebrand--While we love to bring in all the boards that meet the circuitpython guidelines. A friendly fork is absolutely a thing that can exist.

manic glacierBOT
#

maybe this info would be also useful.

what Im working on requires a loop that waits for a request through I2C and depending on what it recieves it will play a specific sound FX. But the issue was that the AudioOut was initialized but it would not stay up or active while waiting for something. So what I just do is I created a function that initialise AudioOut, play the sound FX and deinit() once the clip is done playing.

here's the function I made instead of trying to keep the audio st...

prisma salmon
#

Random question - I love circuit python. Like, straight-up LOVE it. My concern is that I see very little compatibility with boards outside of the Adafruit ecosystem. Are there any plans for a broader adoption of Circuitpython?

#

(E.g. I want to use CircuitPython at work, not just in my personal hobby projects - will that ever happen?)

split ocean
#

I've run into an issue w PWMOut on RP2040 Pico board while using adafruit_motor. Seems that setting the PWM pins to full duty cycle of 0xFFFF fails to turn the motor, but 0xFFFE turns it just fine. This means the throttle = 1.0 or throttle = -1.0 values don't work. @slender iron any ideas if this is something funny about PWM on the Pico? @errant grail had a look at this as well and didn't see anything obvious.

lone axle
#

@prisma salmon there are over 100 devices listed with support for circuitpython, not made by Adafruit <Gigantic link removed>

split ocean
#

@lone axle well now I need a Thunderpack board!

lone axle
#

As far as using it for work. I guess it depends heavily on your work. I've used Circuitpython and Adafruit devices successfully in 100-200 sized deployments of custom hardware "widgets" for work.

idle wharf
lone axle
#

With regards to filtering being tedius I guess maybe I should use my old friend... Subtraction to find that number 😅 it's been a long day already.

idle wharf
prisma salmon
slender iron
slender iron
prisma salmon
jaunty juniper
#

is the S2 cheaper ? what with having one core and only wifi, would it take over the cheap ESP32 market ?

prisma salmon
idle wharf
#

What will make S2 cheaper is for an OSS board to be massed produced to drive down the cost

jaunty juniper
#

right

idle wharf
prisma salmon
idle wharf
#

OK... we're prolly off topic now... 😉

manic glacierBOT
#

I've run into an issue w PWMOut on RP2040 Pico board while using adafruit_motor. Seems that setting the PWM pins to full duty cycle of 0xFFFF fails to turn the motor, but 0xFFFE turns it just fine. This means the adafruit_motor throttle = 1.0 or throttle = -1.0 values don't work. I found that throttle = 0.9999998 works, but 0.9999999 does not.

I'm using GP28 and GP27 on the Pico.

Running adafruit-circuitpython-raspberry_pi_pico-en_US-20210212-08f30fe.uf2
Library from this...

split ocean
slender iron
#

thank you!

#

@split ocean is it urgent for your work?

manic glacierBOT
fathom trellis
#

Hey folks -- reposting just in case my message got lost in the shuffle last night.

Would any CircuitPython maintainers be interested in leading a mentored sprint for PyCascades for a few hours on Sunday, Feb 21st in PT? We'd love to have you.

split ocean
#

I'm doing a guide of mini-examples for how to use different motors with the Pico.

manic glacierBOT
slender iron
#

@tulip sleet @onyx hinge or @ionic elk do you have cycles to debug John's PWM issue on RP2040?

#

I'm debugging I2S atm

ionic elk
#

I'm on other stuff RN but I could check it out tomorrow

tulip sleet
#

i have a guess, even without looking at the code

#

i'll see if it's real easy

#

i am working on cdc

slender iron
#

@tulip sleet there is a bit of weirdness around the top value I may have gotten wrong

tulip sleet
#

yeah, it's not like the atmel code

#

self->top is 2^16 instead of 2^16 -1

#

this could use some printf debugging

manic glacierBOT
crimson ferry
#

@ionic elk I'm trying the manual NTP test script. Would you expect it to work repeatedly wrapped inwhile True: with pool.socket(pool.AF_INET,pool.SOCK_DGRAM) as sock: I get "Out of sockets" after 4 loops. Also tried w/o with and explicitly using close.

ionic elk
#

hmm. Have you tried waiting for a little bit after closing?

#

If that doesn't work I'll double check that close is working

crimson ferry
#

I have a 5-second delay between iterations. When I explicitly close, I get Out of sockets after 1 iteration (suspect some under-the-covers retries) ...update: ignore the 1 iteration behavior, I forgot "Out of sockets" requires a microcontroller reset

manic glacierBOT
#

I created a test program that loops turning a MIDI note on and off. After running for a while (minutes not hours) I lose USB communications (both USB-MIDI and serial debug). I have the LED flashing to debug and it appears the loop is continuing it's just USB comms that stops inexplicably.

This is only reproducible on one of my Wins10 PCs (Dell XPS desktop) and the USB driver is still active when data isn't flowing. Further if I switch to a Teensy 4.0 running the same test (written in C++) ...

onyx hinge
manic glacierBOT
#

@tannewt I know you have similar code. If you want to take yours in favor of mine (if so feel free to close this up!), make sure you have the equivalent of this change for getting the right shifted-in bits:

     if (rx) {
-        rx_source = (const volatile uint8_t*) &self->pio->rxf[self->state_machine];
-        if (!self->in_shift_right) {
+        rx_source = (volatile uint8_t*) &self->pio->rxf[self->state_machine];
+        if (self->in_shift_right) {
             rx_sourc...
tidal kiln
#

@slender iron hey - did one (or more) of your deep dives cover your efforts converting atmel start stuff into what's in CP? i.e. what you did here:
https://github.com/adafruit/asf4

slender iron
#

@tidal kiln no, that's pre-deep dive

tidal kiln
#

thought it might be. thanks. no worries. totally just for self education thing.

slender iron
#

np

manic glacierBOT
thorny jay
#

@slender iron Would this kind of Pico board qualify for it's own CP board entry: https://shop.pimoroni.com/products/pimoroni-pico-vga-demo-base it is based on Raspberry Pi documentation and very similar to the hardware used for the BBC emulator demo. I am mostly interested in the VGA output, but even without that it has I2S and PWM output, reset button, 3 button, SD card... but it totally lack I2C connector or Wii connector. And no RGB either. You do not solder the Pico on top, it has female header.

slender iron
#

I think that's better handled with a library

thorny jay
#

Like those "Portal" thing. Just simplifying the access to "accessories"?

#

Or more the CPX library and CLUE library.

slender iron
#

ya, simpler than portal

#

(and it'd be good if pimoroni did the libs)

manic glacierBOT
#

Fixes #4189.

  • The pwmio_pwmout_obj_t top was 32 bits, but it's passed to pico-sdk as 16 bits. Make it 16 bits so the compiler can catch values that are too large. Then needed to force some arithmetic to be 32 bit.
  • Maintain top as a 0 to n-1 value. It was getting set to 65536 in one case. Remove self-> top -1 computations.
  • Comparison check for low vs high frequency had a boundary problem at .frequency = 1907. Fix by using <= comparison instead of <.
  • Add some bounds che...
tulip sleet
#

@onyx hinge I fixed something in RP2040 PWMOut that was decrementing the pwm counter top by 1. The pwmaudio code was setting the top to 1023, so the pwmout code was setting the top to 1022. I wonder if this has anything to do with the audio glitches you were seeing ??

onyx hinge
#

@slender iron maybe? my last audio was esp32-s2 ..

tulip sleet
#

oh, i am completely off base, i forgot you were doing esp32-s2

#

but maybe I should look at that ...

#

sri

manic glacierBOT
#

I observed a strange behavior when using the .hidden flag of the displayio.Group where the group is actually visible, even when group.hidden is set to True.

If the group.hidden is set to True before content is appended into it, the .hidden flag is ignored.
The group.hidden flag's proper behavior can only be recovered if it set to False and then back to True again.

Here's the example code to replicate the issue. This was tested on the PyPortal.

CircuitPython vers...

#

I am testing a small script where two .wav files are played depending on the readings from an HC-SR04. I am running this script on a feather M4 Express with a Prop-Maker for audio.

In Example 1, I initialize the HC-SR04 before initializing the speaker, and audio will play correctly. In Example 2, I initialize the speaker before the HC-SR04, and the audio comes out as static noise. I should also mention that Example 1 is still broken in a way because the distance readings are off. The readi...

manic glacierBOT
manic glacierBOT
crimson ferry
#

@ionic elk another curiosity... for several iterations, supervisor reload will allow recovery and 4 more UDP transactions before "Out of sockets", but then for no apparent reason it will go into this mode where even reload doesn't allow recovery and microcontroller reset is required:```Code stopped by auto-reload.
soft reboot

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

code.py output:

1 WiFi NOT connected
Connecting to WiFi... WiFi connected
Creating socket...
Sending packet...
Traceback (most recent call last):
File "code.py", line 37, in <module>
RuntimeError: Out of sockets
Closing socket (explicit)... None

Code stopped by auto-reload.
soft reboot

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

code.py output:

1 WiFi NOT connected
Connecting to WiFi... WiFi connected
Creating socket...
Sending packet...
Traceback (most recent call last):
File "code.py", line 37, in <module>
RuntimeError: Out of sockets
Closing socket (explicit)... None

Code stopped by auto-reload.
soft reboot```I noticed in the debug log that "Out of sockets" is oddly accompanied by AP disconnect, which makes me think something unexpected is happening deep in lwip. WiFi connections otherwise are very stable and the disconnects are very predictable with the "out of sockets" sequences.

manic glacierBOT
lone axle
idle wharf
lone axle
#

Thank you as well! This makes it much nicer working on community bundle projects.

#

Going to use the new version tomorrow morning on my stream to finally publish properly a library I made a little bit back.

idle wharf
#

I'll be skiing, but I'll watch it time delayed

#

Thanks again for your testing and code review !

alpine nimbus
#

instead of calling it the QT Py 2040 , you should call it the QT Py Pi

manic glacierBOT
thorny dove
manic glacierBOT
lone axle
#

Is there any step that needs to be done for Library releases to "inform" PyPi what the "latest version" is?

#

Ah 🤦 the lead number is too small

manic glacierBOT
manic glacierBOT
late atlas
#

Hi. First time novice user. Can you tell me why, when I save my circuit python code in Mu with my QT Py attached, the serial display fails to show any print code I might display? It just says code running but doesn't output anything.

manic glacierBOT
mental nexus
#

@late atlas in order to automatically run your Python program on reboot of your QTpy, you have to save your file with a file name of code.py. With your current file name it’s not actually running your code at all.

manic glacierBOT
idle wharf
lone axle
#

It could see the tag, but it didn't think it was the latest since the number was smaller.

#

I ended up making a small typo fix change and then making a new release and that got it back to working good.

manic glacierBOT
manic glacierBOT
#

The root cause of this is related to the use of two separate properties to control hidden behaviour of Group and TileGrid.

The Group contains two properties that help hide graphical content:

  • hidden
  • hidden_by_parent

I'm not clear on the logic behind hidden_by_parent so I'm interested to better understand the importance of that.

Here is cause of the issue. Whenever content is appended (and maybe inserted) into a Group, the hidden property is not transferred into th...

manic glacierBOT
#

@tannewt I read the datasheet and did a lot of boundary testing with the Saleae, checking both the low and high frequency cases at the boundary , and much higher and lower frequencies. I made sure duty_cycle = 65535 result in high all the time, no glitches output. Just rounding properly did not always result in no glitches. I also improved the calculations of actual_frequency by rounding to the nearest integer.

#

The flash chips we use typical have a minimum operating voltage of 2.6v. The exact chip used in the ESP32-S2 module is not specific, but it might be similar. The datasheet for the module says a recommended minimum operating voltage is 3.0v. So it would be interesting to know if your voltage is dipping below either of those.

We could add code to CircuitPython that refuses to run below a certain voltage. It could also wait longer on startup for the voltage to stabilize.

manic glacierBOT
#

Starting the work for #4182

  • Updated the branch ESP-IDF to point to releases/v4.3
  • Fixed the include paths in Makefile
  • Fixed #includes which had incorrect full paths to use shorter paths

Open Questions:

  • There are other full path includes.. they work, but should they be changed?
  • Local build now fails on actual code changes which would be needed.

This is the first one, but there are more errors behind this. It would be great if someone who knows C could pickup from here....

manic glacierBOT
#

Attempts to use os.urandom(n) on the Pico currently report:

>>> os.urandom(1)
Traceback (most recent call last):
  File "", line 1, in 
NotImplementedError: No hardware random available

The datasheet for the Pico indicate that the ring oscillator can be used for this (RP2040 datasheet, page 240). They do note that there are potential cryptographic attacks possible on this, but could this still be a considered "random hardware"? There are CircuitPython libraries that requi...

mental nexus
#

FYI was rebuilding CircuitPython with some custom code additions and after loading it on the pyportal a bunch of code broke, saying that it could not create module. Turns out a lot of my libraries got truncated when loading the larger UF2 file. Bleh. 🤦‍♂️

manic glacierBOT
#

This might be obvious to experienced Python programmers, but not to me.
The code runs with no errors, but the display does not show the bitmap because the with statement has closed the file.
To help beginners like me, it would be good if OnDiskBitmap would throw an exception if it cannot read the file instead of failing quietly as it does now.

with open("hari/BlobAnim.bmp", "rb") as bitmap_file:
    bitmap = displayio.OnDiskBitmap(bitmap_file) # setup the file as bitmap data source...
crimson ferry
#

@ionic elk n/m my earlier UDP questions, jfurcean demonstrated that the code was fine, and I replicated it OK on a different device.

manic glacierBOT
manic glacierBOT
manic glacierBOT
echo jacinth
#

@ionic elk Thank you so much for all the Socket library fixes in the latest beta, it's really appreciated! (I'm StarWitch from GitHub, I reported that UDP socket args issue.)

manic glacierBOT
#

I also started this chase down the rabbit hole. I however did not make nice edits so my result is not really pretty.
The semaphore stuff is easy to fix. Once that is done the SPI requires some relatively major changes as Espressif have refactored some calls. I made some changes so it compiles but doesnt work. I will now start again :)

I'm not really liking all the full path includes. I changed them to most;ly match how the IDF does its includes. I think this might make it easier for ...

noble mango
#

I always been a programmer that looks at time spent to learn a language. Adafruit created Adafruit Feather STM32F405 Express. Same chip as MicroPython pyboard v1.1 creator of Micropython. Adafruit created WICED and said this "Arduino standard-supported Atmega series and many libraries that are written specifically for AVR will not compile or work with the STM32". I want to take advantage of all libs and use python from adafruit. But adafruit circuitpython is not as ready for STM32 as Micropython and I may not be able to use all available libs that adafruit has to offer which are many.... That and guides are what sets you apart from others.. How can you work on finishing circuit python for Atmel and STM32 ? Are they both getting equal programming effort? You even say "CircuitPython support is in a good spot" for the STM32F405 Express. What does that mean? How committed are you towards the the fast different chip STM32? Again being my goal is using all adafruit libs , products, and python. Its sounds like your plans is making the STM32 only for circuit pthyon (after ATMEL support is finished) and let Arduino worry about the ATMEL to STM32 other LIBS. Is it best to pass on STM32F405 Express for now unless I want to use only python and MICROPYTHON to boot??

stuck elbow
#

not sure what you mean by "atmel" here, it's all Microchip now

#

also, not sure what you are trying to do

#

the release notes say "As of this release, atmel-samd, nrf, and stm for the F4 family are stable." — so, assuming that by "atmel" you mean the samd chips, they are all supported.

jaunty juniper
idle wharf
#

I wish for a feature matrix view of that information. (✅ - done ⭕️ - not done ❌ - not possible) It could be used to indicate if it is possible or not so a community member could contribute. Also when one board ends up creating a new library it would show more help is needed.

#

It would take a RST superdev though I think

stuck elbow
#

"not possible" is not always clear

idle wharf
#

I might be wrong about the specific labels but I assume the general idea is possible

stuck elbow
#

well, the matrix linked already has most of that information, except for the impossible bit

#

you can always write a two-liner in python to display it differently

idle wharf
#

True, I'm just visualizing it differently in my mind's eye

stuck elbow
#

and apart from some very few exceptions, CircuitPython support tends to have module granularity — if a module is there, it all works

manic glacierBOT
#

Thanks @skieast, I appreciate you picking this up and running with it !

tbh I have no idea how to 'run with it'. Does that somehow involve me modifying your PR? Or do I just start a new PR with what I have. As you can probably see my github knowledge is limited. Very much so.
I may just start a new local branch and make my changes in a more consistent way now that I know it works.

fading steppe
#

I am looking at moving a part built project from C to circuitpython, I have most libraries covered but I am looking for an I/O expander library. I was using the 40-bit PCA9698 I/O expander but dont have the skills to write a circuit python library. Any tips on writing libraries?

onyx hinge
fading steppe
#

I was looking at the PCA9698 a 40 channel I/O expander

onyx hinge
#

oh I had the wrong number, sorry!

fading steppe
#

All good 😄

onyx hinge
#

well I actually fault search engines for showing me things I didn't search for that don't contain the words I searched for 🙂

fading steppe
#

Maybe I will look at using mulitple 74HC595 shift registers

onyx hinge
#

choosing a chip that is already supported is maybe a wise choice. Otherwise if you had the interest I'd advise you to study code for a different I2C I/O expander -- some parts will be broadly applicable, other parts will be specific to the chip.

fading steppe
#

Becuase I have so many LED's to control I need more that 8 I/O in an expander

#

The 74HC595 is only 8 channel

#

At upwards of 100 LED's to control I need more I/O

#

Which is why I was looking at the PCA9698

#

The big benefit to the PCA9698 is its current capability

#

At 5 V supply voltage, the outputs are capable of sourcing 10 mA and sinking 25 mA with a total package load of 1 A to allow direct driving of 40 LEDs.

onyx hinge
#

yeah it made me think of IS31FL3731. but I think its current capacity is MUCH lower. no way that passes 1A

#

anyway my gut feel is that PCA9685 is totally a "doable" driver, you would have to get comfortable with bit arithmetic but it has fairly simple I2C interactions to bulk set outputs high or low..

#

for instance understanding why a value like 16 would turn on the 5th LED in a set of 8..

fading steppe
#

I'll take a look at it again, I remember looking into it a while ago

onyx hinge
manic glacierBOT
#

I can and can fork those (it’s RSA lib I want). But thought it would be helpful to get this on someone’s non-urgent list for implementation for the pico.

Thanks!

On Feb 13, 2021, at 2:19 PM, ladyada notifications@github.com wrote:

@joelburton you cant use random.randint() ?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

fading steppe
#

constant current LED driver, no resistors needed

onyx hinge
#

neat!

fading steppe
#

perfect!

manic glacierBOT
manic glacierBOT
#

I teach Computer Science; I'm making graduation gifts for my students of a
pico with various CS challenges built in, and one of them is decrypting a
message using RSA. :-)

On Sat, Feb 13, 2021 at 6:41 PM ladyada notifications@github.com wrote:

well tbf i dont know the crypto implications - i am not sure how we seed
the pico's RNG. i will leave open but yah maybe can you submit a PR to
change RSA lib to use random. instead of os.urandom if it throws an
exception?

what are you d...

manic glacierBOT
#

@tannewt I see the basic idea of what you are talking about for adding a new directory for bitmap_tools in shared-bindings and then for each port in ports\common-hal, but I don't understand the specifics to pull it all together.

Right now I don't forsee any port-specific code, so does it need anything in common-hal for each port?

How do I tell the build system to include the new files when I build a given port?

Thanks for you guidance!

manic glacierBOT
manic glacierBOT
#

Hi all,

I am using CircuitPython with Arduino Nano 33 BLE board. Currently, I am trying to read the built-in IMU readings and get the following error:

Traceback (most recent call last):
File "code.py", line 18, in
RuntimeError: SDA or SCL needs a pull up

I then set the board.R_PULLUP as digital output with a value of True. I added a delay after setting the True value and was able to measure that the R_PULLUP pin level was set to HIGH. And then when the code ran to line 18 (the lin...

noble mango
noble mango
stuck elbow
#

@noble mango that has nothing to do with circuitpython, as it doesn't work on atmegas

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

There is a number of gaming devices available that run CircuitPython, and so when a new game is made, it is desirable to make it run on all of them, or at least as many as possible. However, each device has different way of accessing the buttons and the audio, and some builds might even need to have the display initialized.

Asking the players to edit the code of the game to adjust it to the device they have is not a very nice way of doing this. Providing a separate version of the game for ...

#

One way I attempted to solve this problem with the Stage library is by using a device-specific module — I named it ugame because the first device I supported was the µGame, but later I realized that it has to have the same name on all devices. That module contains all the code necessary to initialize and use the buttons, audio and display, and it's frozen on the device. This way each device can come with its own version of the code, specially adjusted to it.

#

Another way of handling this was proposed by @tannewt — instead of having different versions of the library for different devices, there would be only one version, that would contain the code for all the supported devices, and it would guess what device it is running on by checking what names are defined in the board module, and initialize it all accordingly.

I tried to implement this here: https://github.com/deshipu/circuitpython-vacuum-invaders-displayio/blob/master/invaders/controls.p...

#

Yet another way of doing this would be to generate the library for the individual devices from some kind of a template, letting the player select how the buttons, audio and display are connected in their particular device. This has the advantage of not wasting additional memory for classes that are not being used, and of supporting a wide variety of homebrew devices that we don't need to know up front. It has the disadvantage of requiring the player to select the device they have.

ornate breach
#

so i'm getting a build error for a new board i'm working on

#

Here's the output:

#
../../py/gc.c: In function 'gc_sweep':
../../py/gc.c:298:68: error: 'MP_QSTR___del__' undeclared (first use in this function)
  298 |                         mp_load_method_maybe(MP_OBJ_FROM_PTR(obj), MP_QSTR___del__, dest);
      |                                                                    ^~~~~~~~~~~~~~~
../../py/gc.c:298:68: note: each undeclared identifier is reported only once for each function it appears in
make: *** [../../py/mkrules.mk:55: build-cp_sapling_m0_revb/py/gc.o] Error 1```
orchid basinBOT
manic glacierBOT
manic glacierBOT
#

On the Discord it was suggested you could fork my fork, but I know you can't do that really without removing other forks. I could make you collaborators on my fork instead.

But, why don't we abandon this PR and you can do your own sounds like @microDev1 had already gotten farther than I had anyway. That's probably the easiest. I'll leave this open and you all can decide. Thanks for doing the work for this!

manic glacierBOT
manic glacierBOT
stuck elbow
onyx hinge
#

I've been working on a WWVB (north american time signal) decoder and .. it actually receives and decodes the time!

#

still some work to do with conversion to/from local time but the new adafruit_datetime module should help there

#

then I get to add some kind'o display

onyx hinge
#

@prime flower yay, it's slightly different than what I have to do on desktop python (missing datetime.astimezone method?), but I seem to be able to convert from UTC to US Central time using adafruit_datetime

manic glacierBOT
#

I'm working on a game that uses an isometric view, and one thing I need for this is to sort the sprites representing mobs according to their depth on the screen. In displayio the drawing order is determined by the order of elements in the displayio.Group, and I'm wondering what would be the best way of keeping it sorted:

  1. Create a list out of the group, sort it, and then create a new group, with all the items from the sorted list appended to it. Do this every time the positions o...
supple gale
# manic glacier

Yes, i'm working on getting the i2c working on microdev branch. we shall see. "shouldn't be hard" said someone one youtube once
YAY, scan() works. Only some minor semaphore stuff to edit.
Unfortunately v4.3-beta1 of the IDF did not fix the soft reboot and i2c issue. So a long rabbit hole with no actual results

manic glacierBOT
#

I believe in my build I disable the check for pull-ups in the i2c as the cucumber doesn't have any on the internal bus. At least I was getting errors when creating an instance. Will have to check again when I have a chance

The pull-up check is meant to check for external pullups. Adafruit microcontroller boards don't generally have pullups unless there are on-board I2C sensors. All our breakouts do have sensors. So we don't disable pull-up detection, and I would not expect you to either,...

manic glacierBOT
#

Hi I've just tried the example code for the keyboard emulation on the Pico. I've loaded CircuitPython 6.2.0-beta.2 onto the Pico and tried a keyboard example "examples/hid_keyboard_shortcuts.py" from Circuitpython.org and I get an error

Traceback (most recent call last):
  File "", line 9, in 
ImportError: no module named 'adafruit_hid'

Is there a problem in the latest beta as I've seen a Youtube video using this module with 6.2.0=beta.1.

manic glacierBOT
prime flower
manic glacierBOT
manic glacierBOT
alpine nimbus
#

@lone axle @honest nova Do you have documentation yet for base_alignment? I thought it was in issue 75 but I don't see it now. I was going to comment on its behavior but I haven't tried it yet or even read docs so maybe I'm wrong about how it works.

lone axle
alpine nimbus
#

thanks!

#

@lone axle So by default the top of the bounding box is placed at label.y and with base_alignment=True the baseline is at label.y instead?

still zephyr
#

@alpine nimbus You could use the position x,y in the label to position the two labels at the same y position. There will be an example with the PR showing this. I have some code trying to show the behavior with anchor point that you can get from the PR, but for simplicity it was not included in the current PR. let me know if you have any other questions. We are currently working in the documentation, and it will be good to include it. Please see issue 75 where we put some New documentation proposition, any feedback will be really appreciated 🙂

alpine nimbus
#

unfortunately, i can't try it out until after you check it in. Or, I should say, I'm too lazy to set up a CP build environment.

still zephyr
#

no problem, for the example I used the code in your original issue, it will look familiar

alpine nimbus
#

That's weird that you give both labels the same x,y. They turn out next to each other and not one on top of the other?

still zephyr
#

oh my bad, you are right you give them the same y position.

#

the x will vary

alpine nimbus
#

When I first saw the example code I had some strange ideas how it worked but its actually straightforward

manic glacierBOT
still zephyr
#

Hopefully, when you try it let us know, maybe you have some insight that we did not see... Also this was intended to include align the text using the baseline to address Paint your dragon enhancement suggestion.

alpine nimbus
#

I think it would be nice for the docs to show how to place two labels next to each other. Lets say they're a number and a unit (e.g. 33 F). A) place both labels at some value of y and set base_alignment=True B) Place the number label at some value of x and compute the x value of the unit label based on the with of the number's bounding box plus a bit extra. I guess the extra would be the width of a space character.

#

from a comment in paintyourdragon's issue, it looks like the width of a space would be int((self._font.get_glyph(ord(" ")).width)

#

probably the space character in the larger font?

still zephyr
#

Good points, regarding the spaces, yes according to my tests, space could vary from 4-8 (maybe more) pixels width according to font and size

alpine nimbus
#

By the way, I'm really excited about this code. Good job!

still zephyr
#

Normally you can access the separation with the _shiftx (I think) to do some the x movement after each glyph

#

Thank you blinka

#

It is a team effort for sure,!

alpine nimbus
#

🥳

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Similar to this issue:
https://github.com/adafruit/circuitpython/issues/3894

Running: Adafruit CircuitPython 6.2.0-beta.2-14-g766e79ad3 on 2021-02-12
Sensor: mlx90614

I have this code running:

i2c = io.I2C(scl=board.GP5, sda=board.GP4, frequency=100000)
time.sleep(1.0)

# Lock the I2C device before we try to scan
while not i2c.try_lock():
    pass
# Print the addresses found once
print("I2C addresses found:", [hex(device_address) for device_address in i2c.scan()])
 
...
fading mantle
#

Quick question:
Can I embed a code.py script directly into the image?

manic glacierBOT
#

@Bhavithiran97 you can't, check out the table here: https://github.com/adafruit/circuitpython/issues/4143#issuecomment-776388367
Some pins are paired. While you can adjust the duty cycle you can not adjust the frequency. If you need a different frequency on each pin you need to choose a different set of pins that don't share their PWM bank.
What this patch fixes is that you can still use them both but not if you construct them both with variable_frequency=True as you can not change their...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
ionic elk
#

@noble mango support for the STM32F405 should be very broad across Adafruit libraries. The remaining modules that aren't implemented like rotaryio or frequencyio are less used and just haven't been requested in a way that pushes them over priority features on other chips. Is there a specific module you are missing? The Feather F405 is very fast, which makes it good for audio, signal or screen projects, but a lot of people are more used to the SAMD series so that tends to see more project attention.

#

@noble mango also, just a quick historical note. The company called Atmel used to make a series of 8 bit chips called the Atmega, using their own processor core design called AVR, which are used in the old Arduinos. None of those will support Circuitpython, they're over a decade old and much weaker than modern chips. Atmel also created the SAMD family, which uses the ARM core and is much more powerful, and is the family of chips Circuitpython uses. Atmel as a company was bought by Microchip in 2016, so all their chip lines are now under the Microchip brand, but people still call the chips "atmel SAMD" sometimes out of habit.

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

58

Voice Channels

6

Members

27469

Roles

34

solar whale
#

I was just runnin ga test with the "feather_m0_adalogger" build and noticed that it does not include the native busdevice... Does anyone know if this was intentional or should I open an issue to add it?

manic glacierBOT
manic glacierBOT
onyx hinge
#

<@&356864093652516868> just a reminder that the meeting is tomorrow due to a US holiday. Same time of day as usual, just 24 hours later.

solar whale
#

@onyx hinge thanks -- I may do some experimenting -- it looks tight with ~2500 bytes avaialable in us_EN

stuck elbow
#

is it a hangover day after the valentines?

solar whale
#

"Presidents Day" -- Combined "Washingtons and Lincolns Birthdays"

manic glacierBOT
ionic elk
#

So, the ESP32S2 has an I2C issue where it resets, but it doesn't seem to be an actual crash, so it doesn't land in safe mode. It also doesn't hit a reset_handler, but that might just be because it isn't ARM? in any case it's making it hard to trace what actually causes the reset

#

anybody have ideas how I could break on reset, so I get a backtrace?

manic glacierBOT
manic glacierBOT
#

Just wanted to follow up. I found a temporary solution. Essentially, the HC-SR04 and speaker are constantly initialized and deinitialized within the loop. The two are never initialized at the same time.

`
import time
import math
import board
import digitalio
import audioio
from audiocore import WaveFile
import adafruit_hcsr04

=== speaker ===

propMakerPower = digitalio.DigitalInOut(board.D10)
propMakerPower.direction = digitalio.Direction.OUTPUT
propMakerPower.value = True
...

solar whale
#

@ionic elk Is there a known address it goes to on RESET so you can set a breakpoint at that address?

manic glacierBOT
manic glacierBOT
#

I've been testing this today, it appears to be the same problem as #4079, and probably #4147. Your test sketch catches the problem the most cleanly, I think. I can verify that at least for me, busio.I2C(board.X, board.X) does not cause this issue, only board.I2C.

This makes me think it has something to do with how the internal IDF object is dealt with internally during reset. The current version of I2C on the ESP32S2 doesn't do much on reset, so from what I can tell, board.I2C() tries ...

ionic elk
#

@solar whale I'm really not sure, unfortunately, I've been looking for one but there doesn't seem to be a clean stand-in for Reset_Handler.

ionic elk
#

@tulip sleet if you have some time tomorrow I was wondering if I could ask you some questions about the intended behavior of board.I2C on soft reboot

#

I'm confused about how the reset should affect that object.

supple gale
# ionic elk <@!329766224093249548> if you have some time tomorrow I was wondering if I could...

I have also been looking at this, trying various things. I believe if i pull out my PR #3803 I think this starts to work, But then the original problem with the wifi and i2c cannot coexist re-appears. I wiil do some more work later today. I have also tried the IDF v4.3-beta1, using something @analog bridge has on his repo. I managed to get i2c.scan() working but have to look further into it. Lots to look at.
I do think its something with the IDF but rather hard to pinpoint what.

ionic elk
#

@supple gale wait, you have a problem where wifi and I2C can't coexist? I haven't been looking at that

#

I'm currently trying to just figure out why I2C is always invalid after soft reboots if it uses board.I2C()

supple gale
ionic elk
#

I can partially solve the issue by adding a i2c_driver_delete to the reset process, so it doesn't do the weird non-crash reset, but then it just makes all I2C operations for board.I2C fail with ESP_ERR_INVALID_STATE

supple gale
#

I had a build from December 12 where it worked. From main. When was the version of the IDF being used changed?

ionic elk
#

Oh I see I misread your issue, your fix resolved one issue but seems related to this one?

#

Ah, so you actually removed the driver reset?

supple gale
#

yes, and looking at some espressif forums this seems to be fine. at one point at least.

#

i have a conference call in a few minutes but after that will look at where i am at with the various idf versions and do some testing

#

Do you know when CPY moved from the IDF that scott had to v4.2 that is currently being used?

manic glacierBOT
ionic elk
#

I'd have to double check. I updated the IDF several times to address AnalogIO issues but I think that predates any of these issues.

#

what is "DF"

supple gale
#

lol, cant type IDF

ionic elk
#

oh I thought you meant another acronym haha

crimson ferry
ionic elk
#

The two problems are related, based on Bruce's issue and PR. It seems that by enabling a thorough reset, the wifi and I2C conflict, but removing it breaks board.I2C()

#

This matches my experience in testing.

supple gale
#

Here are the dates of the two versions,

Works with
Adafruit CircuitPython 6.1.0-beta.2-7-g22ad76bb4-dirty on 2020-12-07; FeatherS2 with ESP32S2

Doesnt Work (built from main)
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; FeatherS2 with ESP32S2

The code pings google dns and does an i2c.scan(), nothing very complicated. When the running code it interrupted and restarted so does circuitpython. Restart that is.
ionic elk
#

Well, at least the re-enabling the reset mostly fixes the board.I2C() thing, I haven't tested the wifi part

gilded cradle
#

My issue was that when I was using I2C and WiFi in ESPHome on the ESP32-S2, I would get a WiFi disconnect. I've heard that changing the init order can help, but I ended up putting the project on hold.

ionic elk
#

There are at least 4 different issues that seem to be attached to this one central problem, just at differing levels of library obfuscation

supple gale
#

ok thanks. is there any way to merge issues? lol. i'm replying mostly to another one.

ionic elk
#

Not that I know of, we just close them if they're obviously redundant, but if it's possible they could actually be different problems they tend to stay up until they've been definitively fixed.

#

I think #4046 is the best issue to track in since it includes an example sketch that makes the problem very easy to replicate

manic glacierBOT
simple pulsar
ionic elk
#

@simple pulsar pwmio was created to split PWM away from the IR libraries PulseOut and PulseIn, since they didn't really have anything to do with one another and often used completely different chip peripherals under the hood.

#

Now that that's happened, PulseOut and PulseIn are going to be treated as lower priority than pwmio since they're typically used for IR controllers, which are pretty specific compared to PWM which is used for all kinds of things.

simple pulsar
#

My question was more about the migration and the docs look incorrect for 6.2.0-beta.2

stuck elbow
#

most commonly, blinking leds

onyx hinge
#

I am guessing that because the pico did not exist before 6.2, it is not an incompatibility if it does not have the pulseio library.

#

it is a bit of hair splitting, perhaps

stuck elbow
#

also, it is a beta

#

compatibility promises only apply to released versions

jaunty juniper
#

the doc says PWMOut is removed from pulseio in 7, but pulseio is not implemented on the pico yet, so that's still valid for me, it can have PWMOut if pulseio is implemented before 7

#

in 6 it is in both, but deprecated in pulseio

tulip sleet
manic glacierBOT
#

I just ran this

Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040
>>> import pwmio
>>> import board
>>> pins = (board.GP0, board.GP1, board.GP2, board.GP3,
... board.GP4, board.GP5, board.GP6, board.GP7,
... board.GP8, board.GP9, board.GP10, board.GP11,
... board.GP12, board.GP13, board.GP14, board.GP15)
>>> pwms = [pwmio.PWMOut(p, frequency=2000, duty_cycle=3456) for p in pins]

On Cytron Maker Pi Pico which has LEDs on the pins. Even numb...

#

👍 for this feature.

Since the pico has two UART ports, I was hoping to use one of them to talk to another pico - daisy chaining them together would be great, with child picos using UART0 to talk to the parent, and UART1 to talk to the next child in the chain.

As it is now, the pico does not support running as an I2C peripheral under circuitpython, and can not use the UART1 function, so the options are limited for pico-to-pico communication.

simple pulsar
#

On Pico I'm not finding audio libs on 6.2.0-beta.2, are they supposed to be there? ```Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040

import audiocore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'audiocore'
import audiopwmio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'audiopwmio'

manic glacierBOT
#

I can't find libraries which hold PWMAudioOut and WaveFile on 6.2.0-beta.2:

Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040
>>> import audiocore
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'audiocore'
>>> import audiopwmio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'audiopwmio'
bleak spear
#

I'm looking at the gamepad library, and see it doesn't have support for analog triggers. is there a reason that wasn't added or is it just not in the documentation?

slender iron
slender iron
bleak spear
#

yes, but that's basically the only reference I've been able to find to gamepad usage in circuit python. looking at the core usb_hid there's no gamepad documentation at all

gloomy shuttle
#

I am guessing that was just something that wasn't implemented.

steep finch
#

@bleak spear I've got a fork of the library that makes the gamepad expose more buttons. Still trying to get multiple picos talking to each other though

simple pulsar
manic glacierBOT
#

@ladyada I confirmed that there's an issue. TCS34725 does not respond, and also takes down the I2C bus so that other devices on the bus are prevented from responding: I added an LIS3DH, which could not be found until I removed the TCS34725.

Notes: @ladyada says this may very well be due to the unusual way we probe for the device on the RP2040. If We do a zero-length read; normally we would do a zero-length write, but the pico SDK does not provide for that. (I believe that is right, based o...

manic glacierBOT
manic glacierBOT
#

This sort of thing will demonstrate the problems. Playback is sometimes fine, sometimes accompanies by nasty noise, and occasionally silent with some minor noise.

Adafruit CircuitPython 6.2.0-beta.2-18-g2a467f137 on 2021-02-15; Raspberry Pi Pico with rp2040
>>> import board
>>> from audiopwmio import PWMAudioOut as AudioOut
>>> from audiocore import WaveFile
>>> audio_out = AudioOut(board.GP18, right_channel=board.GP19)
>>> testwav = WaveFile(open("120998-32k.wav", "rb"))  ### 32...
simple pulsar
idle owl
#

@tulip sleet Ok so trying to pick up where I left off. Is this where we landed? ```python
import board
import digitalio
import storage

write_pin = digitalio.DigitalInOut(board.GP0)
write_pin.direction = digitalio.Direction.INPUT
write_pin.pull = digitalio.Pull.UP

If the write pin is connected to ground, CircuitPython can write to the CIRCUITPY filesystem.

if not write_pin.value:
storage.remount("/", readonly=False)

#

comment could be clearer, but is the code proper?

stuck elbow
#

the direction is input by default

#

but it doesn't hurt

idle owl
#

I'm not sure we want to take that out because .. yeah. That. And it means when setting things to output, folks won't be confused as to why previous code worked without setting direction.

#

But good to know, thank you.

stuck elbow
#

otherwise looks good

idle owl
#

Ok, thanks!

stuck elbow
#

that code needs to be in the boot.py, of course

idle owl
#

Right.

#

That's where it is.

#

code.py is the file writing whatnot.

simple pulsar
idle owl
#

No, it's going in the Getting Started with Pico and CP guide

#

We could update the one on storage as well if it makes sense.

simple pulsar
#

I've been using this on the CLUE: ```import board
import digitalio
import storage

button_a = digitalio.DigitalInOut(board.BUTTON_A)
button_a.switch_to_input(pull=digitalio.Pull.UP)

if not button_a.value:
### Left button is pressed down, remount CIRCUITPY r/w
print("Remounting / read-write")
storage.remount("/", readonly=False)
else:
print("Leaving / as read-only")

idle owl
#

Convenient.

simple pulsar
#

That's left button held down. Are both buttons pressed at power-on used for bootloader mode on ESP32-S2 CLUE?

idle owl
#

I have no idea. I haven't looked into that one yet.

stuck elbow
#

another way is to always remount it, and use the safe mode to access the disk

idle owl
#

@stuck elbow I'm including that in this page, but not as the "default". It's basically a "you can also do".

stuck elbow
#

sounds good

#

since I usually replace the reset button with a jumper on my boards, it's rather hard to trigger safe mode on them

idle owl
#

@stuck elbow You can get to the REPL though even when the board is read-only to your computer... and run os.remove or os.rename on boot.py... right? Without safe mode?

#

I thought that's what Dan told me to do last week. And I think I tried it and it worked. I can test it again though.

#

Not sure how to get the Pico into safe mode. No reset button. And Dan said access the REPL.

lone axle
#

@idle owl that is correct in my experience. You can get to REPL and rename or remove boot.py from there in order to switch back to USB drive having write access.

#

without out safemode

idle owl
#

Yah ok. That's what I thought. I got nervous again when safe mode came up. Heh.

stuck elbow
#

yeah, you can, but it's not very convenient

idle owl
#

To be clear, this would remount every time the board starts up, yes? ```python
import storage

storage.remount("/", readonly=False)```

#

@stuck elbow Is this right? ^^

ionic elk
#

@tulip sleet do you have a bit of time today to discuss this ESP32S2 I2C issue? It's turned out to be way hairier than I thought. I think the best way to approach it will be to try and keep I2C objects persistent across resets but I'm not totally up to speed on how that system works so I was hoping to pick your brain.

#

@tulip sleet if you're not the person I should be asking let me know. I'm not sure whose ballpark this falls into

stuck elbow
#

@idle owl yeah

idle owl
#

Thank you!

tulip sleet
#

@ionic elk I have not looked into this in any detail. I would not try to keep the I2C objects persistent across soft-reloads, since many aspects (like which pins to use) may change. It sounds like a workaround, solving the surface problem instead of the deeper problem. Instead, I think it would be more important to make sure that the ESP-IDF's state of the world re I2C is reset properly on soft reload, so that re-creating the objects works properly. There is some bug in the ESP-IDF, or we are using it improperly.

#

Limor said she was able to get it working properly with wifi in Arduino, remember? So I would look at the sequence of calls in Arduino to see if it's different than what CPy uses.

manic glacierBOT
ionic elk
#

@tulip sleet you might already know this but the historical issue I'm running into is that calling i2c_driver_delete apparently causes a hang when combined with wifi. There was a "fix" that removed it, which fixed the wifi problems but introduced all of these new I2C issues

tulip sleet
#

i do remember, so I think something about i2c_driver_delete is doing something or we are doing something else wrong

ionic elk
#

I've been running the wifi hang under a debugger and I'm having trouble pinning down why exactly it's a hang at all

#

Do you know why GDB would make a big jump in the code like this?

(gdb) n
esp32s2: Target halted, PC=0x400A0369, debug_reason=00000001
330            RUN_BACKGROUND_TASKS;
(gdb) n
esp32s2: Target halted, PC=0x400A025F, debug_reason=00000001
331            if (reload_requested) {
(gdb) s
main () at ../../main.c:600
600                skip_repl = run_code_py(safe_mode);

Is this just some kind of GDB skipping stuff thing or is it possible memory corruption?

#

Or maybe it's just how Xtensa deals with GDB, I'm not sure. I've been frustrated by the debugging experience on ESP32-S2 so far.

tulip sleet
#

it might be inline code substitution or optimization reordering. Can you compile it with less optimization?

ionic elk
#

Which was the issue that Limor talked about Arduino in? I wasn't part of these original bug conversations

tulip sleet
#

it was in a mtg

ionic elk
#

@tulip sleet good idea, I'll try that

tulip sleet
#

i thought you were in that mtg (last week's CPy mtg)

ionic elk
#

Was it last weeks? I don't have it in my notes?

#

It wasn't the one before? I wrote down stuff for GP15, bus device, SD card, no I2C though

tulip sleet
#

well, anyway, she said she did not see the problem in an Arduino test program, so you might try enabling wifi in Arduino and then doing the I2C stuff. But maybe it is not a good test because you'd have to the driver_delete and re-create in the same program. So upon reflection, maybe it's not a proof of anything, since Arduino doesn't have soft-reload

ionic elk
#

My question was going to be about the soft reload. It clears out the heap, right? Would it clear stuff that the IDF uses?

#

What protects objects in the never_reset arrays from having their internal state destroyed?

#

Even if we do re-introduce the driver deletion, this would still be at risk of occurring for never_reset I2C instances.

tulip sleet
#

The IDF has its own storage. ... Are there python objects in the never_reset arrays? If so, they may be allocated outside of the regular CPy heap, either statically or in some non-heap dynamic storage (supervisor_allocation or something like that).

#

I am not familiar with never_reset of stuff other than pin state

ionic elk
#

Typically, no. In something like STM's never_reset array, it's just an array of booleans, telling me the physical I2C peripherals I shouldn't reset and shut down the clocks for

#

I've never had to worry about the higher level objects much before, other than for interrupts, where I used a root pointer

tulip sleet
#

that is used only for a display I2C, right?

#

can you reassign the pins without doing a driver_delete?

ionic elk
#

I guess, on the low level I don't have to worry about what it's used for. Never_reset isn't represented in the python APIs

#

@tulip sleet yes, you can. That's what the Wifi fix was doing. It just kept the peripheral up and running forever after it was initialized the first time, and would simply re-arrange the pin mux rather than actually reset it

#

After on a soft reboot, when using board.I2C and certain other library-related scenarios, you see a weird full-board power reset

tulip sleet
#

do we do driver_delete on other peripherals without issue?

#

e.g. SPI or analog or whatever?

serene harness
#

Code that is producing the error: "Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

code.py output:
Connecting to Mere Muggles
Traceback (most recent call last):
File "code.py", line 63, in <module>
ConnectionError: Unknown failure 205

Code done running.

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

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

code.py output:
Connecting to Mere Muggles
Traceback (most recent call last):
File "code.py", line 63, in <module>
ConnectionError: Unknown failure 205

Code done running.

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

ionic elk
#

@tulip sleet yes for UART, no for SPI

tulip sleet
#

UART we do or don't recycle the existing driver instances? (just not sure what "yes" and "no" mean here)

ionic elk
#

the busio API stuff for ESP32 seems like it's all over the place