#circuitpython-dev

1 messages · Page 227 of 1

idle owl
#

On each line labeled with the SPIDevice no-member error, please put two spaces at the end of the line, and add # pylint: disable=no-member

gilded cradle
#

Ok

idle owl
#

Ok in your docs/api.rst file you need to change adafruit_ra8875 to adafruit_ra8875.ra8875 and include a second .. automodule block with adafruit_ra8875.registers. I think that should fix the Sphinx issue.

gilded cradle
#

Thanks, I'll try again now

gilded cradle
#

@idle owl looks like it finally passed. Is there anything else I need to do?

idle owl
#

Congrats!!

#

Nope, now you wait for a better review than I can give it 😃

gilded cradle
#

Thanks for all your help

idle owl
#

Thanks for writing that! And great job working through Travis!

gilded cradle
#

You're welcome and I had a lot of fun doing it.

idle owl
#

Do you mind if I DM you?

gilded cradle
#

No, go ahead.

grim sparrow
#

@stuck elbow Ah - right; so treating FrameBuf.buf as the "data" for the _block write?

ruby atlas
#

@idle owl do you remember how the frozen-mpy.c missing argument problem was fixed?

idle owl
#

Only other reference to it was that there was no mpy-cross... so you had to make -C mpy-cross...I'm not sure that's your issue

ruby atlas
#

-rwxr-xr-x 1 rhooper staff 224104 19 Jan 17:11 mpy-cross

#

nope that's there.

idle owl
#

I'm not sure then, no.

ruby atlas
#

yay makefile debugging time.

#

looks like the makefile uses a subshell using find to look for the *.mpy files. But those don't get generated again if you didn't already build mpy-cross before first building.

#

purging the build-* directory fixes that.

idle owl
#

Good to know.

ruby atlas
#

even just removing the frozen_mpy dir of the failed target works.

cunning crypt
#

Quick question here because I'm being lazy and haven't looked yet: Where would I find something for loading an image onto a display (Specifically, ST7735R if relevant)?

exotic pumice
cunning crypt
#

@exotic pumice I don't see a way to load, say, a .bmp image via that library

#

(It's the one I'm currently using)

manic glacierBOT
exotic pumice
#

ok

cunning crypt
#

That said, I wouldn't be surprised if I was blind and just missed it entirely

raven canopy
#

@ruby atlas do you normally run make clean BOARD=<board>; make BOARD=<board>? clean deletes the previous build directory. adds a little time, but cuts down on those mpy and qstr errors.

exotic pumice
#

I don't see it either

#

but you could always parse the bmp yourself and use the pixel function

ruby atlas
#

@raven canopy no, because I generally don't need to 😃 it was just because of the mpy-cross missing that I had a bad env.

exotic pumice
#

might have to wait for displayio otherwise

cunning crypt
#

@exotic pumice That is correct, but I don't particularly feel like reinventing the wheel if it's already been done.

#

Displayio? What's this?

ruby atlas
#

we should really have ports/atmel-samd build ../../mpy-cross/mpy-cross

cunning crypt
#

Is that the equivalent of the arduino Adafruit GFX Library?

exotic pumice
#

it's the next-gen lcd module for circuitpython

raven canopy
cunning crypt
#

@exotic pumice @raven canopy oooooh.

#

So.... when will displayio be around? Is it intended for CP4.0?

exotic pumice
#

I think so

cunning crypt
#

OK, cool. I'm working with 4.0 on this project since it's a future thing anyway.

#

Can I get an "experimental" version?

#

Looks like the metro M4 doesn't include it by base (Surprise surprise, since it doesn't have a tft by default)

raven canopy
#

Scott is heads down on it right now. I think the releases only have it for HalloWing. buuut...scroll up. he posted up some uf2's last night iirc.

#

i remember at least one for Feather M4

cunning crypt
#

No worries, by "future thing" it's.... months away at the earliest.

#

I can set it aside and work on other things for the time being. Of which I have numerous

raven canopy
#

do you have a Feather M4? if so, put the below into the search bar...

from: tannewt#4653 in: circuitpython feather
ruby atlas
cunning crypt
#

@raven canopy Only M4 board I have is the Metro. I was just curious.

slender iron
#

@ruby atlas I'll look on monday. don't worry about it now

ruby atlas
#

I checked my failed items and it seems they line up with the master build. Phew.

#

Easter egg in the examples 😃

raven canopy
#

@ruby atlas do you have the link to the "create and share a library" guide?

ruby atlas
#

I think this is a bit more complicated than that - it's eventually a neopixel.py and adafruit_dotstar.py replacement.

raven canopy
#

well, dotstar is an external library... 😆

ruby atlas
#

since they'll start using _pixelbuf instead.

raven canopy
#

at least, i think it is. isn't it?

ruby atlas
#

But yes, I know about the guide. There's a gating problem; we need _pixelbuf in circuitpython before the library becomes useful.

#

otherwise it's just bloat.

raven canopy
#

understood. backs away. there is a master plan. 🙇

ruby atlas
#

well, there's a trajectory at least.

#

Not sure it's got a solid plan.

exotic pumice
#

does it replace neopixel_write as well?

ruby atlas
#

no, it uses it.

exotic pumice
#

ok, just curious

ruby atlas
#

_pixelbuf is a layer to accelerate rgb(w) pixel (strips)

idle owl
#

@raven canopy Hokay so let's test some cookiecutter!

raven canopy
#

🍪 ✂ 🎆

idle owl
#

I got me a big chocolate chip cookie here! I am ready.

raven canopy
#

shutting down core stuff...

idle owl
#

Alright, so I have your zip. Run cookiecutter from within that folder to test the new version?

raven canopy
#

yep

idle owl
#

(I really do have a delicious cookie here.)

#

I don't think that worked.

#

What command should I have used?

#

I used the one in my bash history, maybe that's the issue.

raven canopy
#

cookiecutter /path/to/template.zip

idle owl
#

😆 I have your branches

raven canopy
#

hehe. or that...

idle owl
#

I'm in the directory so...

#

I am confuse.

raven canopy
#

you have to supply a target i think. github or local

idle owl
#

Yeah my bash history has a github one

raven canopy
#

maybe cookiecutter gh:sommersoft/cookiecutter-adafruit-circuitpython/tree/pypi_time?

idle owl
#

Could not be found.

raven canopy
#

spinning up the laptop, so i can test things before suggestion

#

pointing to the zip may be the easiest. ~/test: cookiecutter /kattnis/awesome/mbp/test-cookie.zip

idle owl
#

Can't be the zip, has to be the unzipped folder!

raven canopy
#

then cookie needs to update their docs... "Works with Zip files"

idle owl
#

Woooo traceback!

#

And some issues 😄

raven canopy
#

yeah, i'm getting invalid repository. maybe the zip itself.

idle owl
#

No, I got a directory with files in it

#

it worked

#

but I got an error?

#

Too big for here I think, hold on, gisting.

#

Ok... So I did what I thought made sense and I see some problems with the output. Including no .travis.yml I just noticed. Which may have been part of that error

#

I'm liking this though!

raven canopy
#

no travis, since it bailed out. let me run mine again, and see if i can adjust the zip.

idle owl
#

Ok!

raven canopy
#

those are some interesting fails though...

idle owl
#

Hooray!

#

😄

raven canopy
#

did you run it from the zip?

idle owl
#

No it wouldn't let me, I unzipped it and made the folder the target

raven canopy
#

k

idle owl
#

zip gave me this: cookiecutter cookiecutter-test.zip A valid repository for "cookiecutter-test.zip" could not be found in the following locations: /var/folders/gn/8nj05bcd65v347j_shy4m57r0000gn/T/tmp07trdlck/{{ cookiecutter.library_name }}

raven canopy
#

yeah, that's what i was getting.

idle owl
#

cookiecutter cookiecutter-test/ worked after a fashion

raven canopy
#

ohhh! got a new trick, that i scrolled past. cookiecutter https://github.com/sommersoft/cookiecutter-adafruit-circuitpython --checkout pypi_time

idle owl
#

Here's a thing: I unzipped it, then rezipped it and it's letting me use the new zip...

raven canopy
#

🤣

idle owl
#

Let me run though it and see if it works

#

then try what you just sent

raven canopy
#

ran it from the branch. got the same error! i missed something in my transcription...

idle owl
#

Yah same error from zip.

#

Ok

#

@raven canopy Hurry! I'm running out of cookie over here. 🤣

pastel panther
#

I should get a cookie

raven canopy
#

🏃 found another syntax snafu...

idle owl
#

No worries 😄

raven canopy
#

k. try the one from my branch

idle owl
#

No fail bail!

raven canopy
#

woohoo. i've got some formatting to test with those two fixes.

idle owl
#

Ok do you want the issues I found?

raven canopy
#

shonuff!

idle owl
#

Alright, the requirements are put into setup.py as a single string: install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice', 'adafruit-circuitpython-pca9685adafruit-circuitpython-lis3dh' ],

#

requirements.txt shows them together on the same line: adafruit-circuitpython-pca9685adafruit-circuitpython-lis3dh

manic glacierBOT
idle owl
#

Do the quotes here matter? - provider: releases api_key: "$GITHUB_TOKEN" file_glob: true file: "$TRAVIS_BUILD_DIR/bundles/*" That's in a .travis.yml that was reconfigured using travis encrypt.

#

You don't have the quotes in the one we did for cookiecutter

raven canopy
#

i can add them. not sure why encrypt does, but standard.

idle owl
#

Encrypt doesn't but it's in what we paste in there...

#

So that may entirely be on Scott including them in the first one he did and we've done it ever since unnecessarily?

#

Also, the .travis.yml has different whitespace than the way it looks after encrypt is done with it. Does that matter?

raven canopy
#

the file one may be necessary. since its an env var + stuff.

idle owl
#

ok, then we should probably include it on both

raven canopy
#

yep. re-whitespace: i found that travis (YAML?) prefers 2-space indents...

idle owl
#

Also, in setup.py: url='https://github.com/adafruit/Adafruit_CircuitPython_Testrepo', <-- Did not maintain TestRepo with the camelcase.

#

Hmm, I wonder why travis encrypt removes those indents?

raven canopy
#

well, with the - sections, the indents only matter for sub-thingies. like on.

#

as far as i know.

idle owl
#

Ok

raven canopy
#

yeah, i have the URL doing capitalize incase the "user" doesn't cap. might need to think about/research that one.

idle owl
#

Oh right, I remember that.

#

That's an issue with camelcase or multicase repo names

raven canopy
#

i might be able to catch a if not capitalized type state.

#

especially now that i know how to access Python in Jinja.

idle owl
#

Nice!

raven canopy
#

that little {% do extension is handy!

idle owl
#

Languages that include do crack me up.

raven canopy
#

hmm. requirements list is joined with \n. does your editor recognize that as a line break?

idle owl
#

When travis is running through the PyPI part it gets to fuzzy do ruby or whatever that line is and it entertains me.

#

I'm looking at three different editors here and all of them have squashed things

#

Two rather

raven canopy
#

🤔

idle owl
#

PyCharm and TextEdit

#

Atom and TextEdit see requirements.txt the same

raven canopy
#

and i know that Windows is the only odd-person-out when it comes to line endings.

idle owl
#

PyCharm is looking at setup.py, not requirements.txt. sorry.

#

I was going to say we should include the adafruit-circuitpython- prefix on the requirements, but there's requirements that are neither, like pyserial so while the majority of them fall into the first category, we'll make people type them out. They'd have to for requirements.txt anyway.

raven canopy
#

did you separate them with commas when you ran cookiecutter?

idle owl
#

no, you never gave me instructions, so I typed them separated by spaces

#

😃

raven canopy
#

oh hey, btw, i updated the README with instructions for the new fields.

#

😉

idle owl
#

Oh sure, have instructions ready ALREADY...

#

keywords worked without commas btw.

#

keywords='test repo testing testrepo',

#

LOL I almost used the ones you used in the example 😆

#

I used PCA9685 tho

raven canopy
#

yeah, i only wordwrap that one. the keywords i referenced didn't have commas, so i didn't even think about having them entered with commas. its also not handling commas in there if they're supplied...so.

idle owl
#

We need to give more explicit instructions for "description" with an example. Because otherwise that one will not be great.

#

Ok so let me try it the way you suggested

raven canopy
#

lol. in the instructions for keyword, i copy and pasted the strucs for requirements. it says use comma separated. 🤦

idle owl
#

ohhhhhh

#

so I was right about keyword

#

because I just did it with commas 🤣

raven canopy
#

both wrong?

idle owl
#

one! more! time!

raven canopy
#

i promise people, we're professionals. (i'm not really)

idle owl
#

(I am :sad_trombone:)

raven canopy
#

gonna celebrate! (the punk is now firmly in my head, while other music plays)

idle owl
#

Alright!

#

The URL issue is still there obviously but the string issues are fixed.

raven canopy
#

yay! so, keywords entry: you want comma separated or spaces?

idle owl
#

Spaces is fine. Unless you think it's confusing. That's how it's done in setup.py so that's how I did it by default, but no one else is going to have that default but me since... i do the setup.pys.

raven canopy
#

spaces it is. updating readme.

idle owl
#

Right on

#

So let's get the URL fixed, was that the only other thing I pointed out? Scrolls up

#

quotes in .travis.yml

raven canopy
#

yep. just did that. what sort of example do you want for description?

idle owl
#

Looking

#

crap that one is long.

#

How about this. "Write a sentence describing the purpose of this library. i.e. 'A CircuitPython driver for the ADXL34x family of accelerometers.'" or something like that, basically include an example description

#

I was going to use MotorKit, but it's kind of long

#

actually

#

Let's use that one, it doesn't matter in the README.

#

'CircuitPython helper library for DC & Stepper Motor FeatherWing, Shield, and Pi Hat kits.'

#

It's thorough, that's why I like it as an example. Doesn't have to be that long tho, in fact that had to be broken into two lines.

#

So maybe it's a bad example.

#

thoughts?

raven canopy
#

just pasted it in. let me push, and we'll see how it be lookin!

#

pushed

idle owl
#

Looks good there in the README. Rereunning now

#

url still the same

#

oh we didn't update the other issues 😄

raven canopy
#

other? there's more!?

idle owl
#

the url in setup.py and the quotes in .travis.yml

#

not more, same ones

raven canopy
#

hehe. jus messin. i did do travis though.

idle owl
#

hm... doesn't show up in that run

raven canopy
#

there are things afoot. cause it does for me. 🤷

#

Jinja has a lower test. so, i can only make URL capitalized if it's all lower case. thoughts?

#

basically:

{% if lower(cookiecutter.library_description) %}
   {{ cookiecutter.library_description | lower }}
{% endif %}
idle owl
#

there are some that are all lowercase......

#

Just remembered that.

#

like miniesptool

raven canopy
#

its never simple... 😄

#

just drop the capitalization?

idle owl
#

Maybe explicit instructions to type it exactly correctly

raven canopy
#

well, and URL isn't the only place its force cap'd, i think. let me look.

#

yep. in the README too, for the Travis badge URL.

idle owl
#

hmm

#

the problem was it wasn't doing it properly I thought

#

It was on Limor's checklist

#

maybe she wasn't capitalising it when she ran cookiecutter then?

#

We could specify that it needs to be exactly what the URL will be?

#

wait no it was capitalising the lib name at the top of the lib file

#

that we fixed I think. It's supposed to be lowercase like the .py file there.

#

If we specify that you have to enter it correctly, will it show up correctly in the URLs?

raven canopy
#

sorry, had to refill water + things. if we specify, and it is entered that way, then yes we could drop the force cap. but...then it may still need changing. all depends on how the final repo is named.

idle owl
#

I guess we weren't generating setup.py until the repo was complete typically. but the README we did. so...

#

I guess it is what it is, if it changes, then we alter the files.

raven canopy
#

cookie needs some AI... 🤖

#

"Dave, i think you should CamelCase that title."

idle owl
#

😄

#

Alright, I think it's solid. Let's wait until tomorrow to do the PR so it doesn't get merged without me being aware of it, and that way I can update the guide to match the README. I think I'm done for tonight.

#

wait

#

I'm getting WAY ahead of myself.

#

I have to test whether travis works with that .yml

#

and the test repo.

#

But I'm not catching the updates you pushed apparently...

#

Not sure what's up there.

raven canopy
#

you're answering y to the "do you want to download a new version"?

idle owl
#

Yep

#

well

#

"yes"

idle owl
#

😄 Nice commit message. OK, meh. Alright. We'll figure it out tomorrow.

#

And then I'll get it to a point where travis passes and we'll see if it works, and then we see if it'll deploy to PyPI with this setup.

raven canopy
#

i'm trying to get on @tidal kiln's level. i have far to go...

idle owl
#

He's on point. We all have to step up our game to get there.

#

Well, this was good! I'm looking forward to this working. I imagine tomorrow it will not 🤣

#

Travis is so fickle. We'll see

raven canopy
#

such an optimist... but, yeah. Travis. 🔥

idle owl
#

Also I ate a big cookie while testing cookiecutter. I call that a win.

#

That's two wins today.... we got a foot of snow dumped on us, and the neighbor took a snowblower to my sidewalk without me asking. Total win.

raven canopy
#

even if it didn't work, still win.

#

oh nice! neighbor snow removal is the bestest!

idle owl
#

Since legally we're supposed to keep it clear apparently.... I'm not used to this type of thing, I did not grow up in a neighborhood.

#

I grew up where you plow if you want access to things, not so the mail person can get to the slot in your door.

raven canopy
#

yeah, when i dealt with snow, the HOA said we were supposed to clear sidewalks. negative. though, we would tag-team our driveways.

idle owl
#

I think it's still snowing so I'm hoping this awesomeness will happen one more time if needed. Otherwise, leverage the kid across the street 😆

#

Anyway, I am heading out for the night. Goodnight!

raven canopy
#

viel spass!

manic glacierBOT
idle owl
#

@gilded cradle I'm going to add you to the CircuitPython Helpers role as well - you won't show up purple because the punners role is higher, but you'll get tagged when we send out the reminders about the meetings, or if there's some important CircuitPython related news.

gilded cradle
#

Ok, thanks

raven canopy
#

welcome to the gang @gilded cradle!! and thanks for the lib! i'll toss in a review if it sits for a while. display stuff is not my forte...

gilded cradle
#

Thanks @raven canopy

tawny creek
#

@raven canopy couldn't figure out how to set up that windows app to investigate the USB since it doesn't show up in the devices panel anymore (idk why)

Pressing and holding the Reset key + Pluggin the device in sets the LED1 and LED2 indicators blinking and I am able to discover and connect via Adafruit Bluefruit app.

Is it possible to install CircuitPython firmware this way?

raven canopy
#

@tawny creek hmm. i don't know if the nRF work has gotten to OTA yet. or if its even planned. the analyzer should at least pick up the IRQ requests, but...windows. 😄

main meteor
#

Trying to use the serial console via Mu on a Grand Central, but Mu says it's not connected. I see the port as /dev/tty.usbmodem1421 and can get the REPL if I connect to it with screen. Not sure why Mu can't find it.

#

Updating Mu seems to have fixed that.

manic glacierBOT
solar whale
tough pier
#

Hello, javascripter here, new to circuit python. How in the world do you force the HID keyboard to only send 1 character when a toggle is thrown. I'm having to use this but these sleep times reek havoc on the switch logic...
while True:
if apu.value:
while apu.value:
pass
kbd.send(Keycode.A)
time.sleep(2.0)
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)

stuck elbow
#

what is "apu"?

#

generally, more details would be helpful

tough pier
#

apu is auxilary power unit, it starts the F/A-18 , basically I'm building a cockpit with real world switches and letting the CPX handle the translation to the simulator

raven canopy
#

is the code formatted like you posted, or like this:

while True:
    if apu.value:
        while apu.value:
            pass
        kbd.send(Keycode.A)
        time.sleep(2.0)
        cpx.pixels.brightness = 0.05 
        cpx.pixels[5] = (0, 200, 0)
#

if everything below the pass is indented to be inside the while loop, it will continually send the keycode.

#

well, continually while the apu's value is true...

tough pier
#

ah ha... that makes sense... let me try it out...

raven canopy
#

@tough pier i assume it's a momentary switch? so, if you're wanting to simulate holding the button down until the APU is started, i would send the keycode first, then block with the while: pass afterwards.

tough pier
#

No, it is not a momentary and that's the problem. I need it to work like the real one, i.e. it is a toggle to ground that when on sends to ground and sends 1 keycode A and the when the switch is turned off (ground released) it sends a CTRL ALT A

raven canopy
#

ahh. then, is it toggle ON -> APU start -> toggle OFF? or does it remain on for longer lengths of time?

tough pier
#

It (and many other switches in this cockpit) stay on for extended periods of time and that is the other issue I'm running into ...

#

in javascript we have case statements to track many items, is there anything like that in CP?

#

because I'm having to track 10 switched

raven canopy
#

yeah, then you'll need state machines. i think we discussed that earlier this week? if apu.value is not last_apu.

sadly, no switch/case in Python. its if or else. 😆

tough pier
#

can you point me to some docs or a bit of sample code how you might tackle it?

raven canopy
#

let me see if i can dig something up...

pastel panther
#

hey @tough pier did you get the wiring sorted?

tough pier
#

@pastel panther indeed!

pastel panther
#

sweet

raven canopy
tough pier
#

excellent I'll look into it

raven canopy
#

the basic premise is that you keep track of the last state that was acted upon, and proceed based on that.

#

with 10 switches to track, wrapping their state into a class may help readability a lot.

main meteor
#

Yeah, I'd so something like have a boolean value for "have I sent APU start", and check it before sending, something like ```python
sent_apu_start = False

while True:
if apu.value:
if not sent_apu_start:
sent_apu_start = True
kbd.send(Keycode.A)
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)```

raven canopy
main meteor
#

Then clear sent_apu_start when the switch is flipped back

tough pier
#

@raven canopy the second example looks a little easier to follow... lol

#

@main meteor that is a basic state machine then?

main meteor
#

Yeah, it's sort of a minimal state machine with two states ("have I sent this yet?" and "I have sent this").

tough pier
#

so with 10 switches that all can be in any one of two states (one switch has 3 states) I will need a state variable for each switch yes?

main meteor
#

If you want all of them to act that way, and if none of them interact with each other, yes.

#

In that sort of case, it might make sense to write a "switch" class to handle each one that accepts an input pin and character to send, and just have instances of the class for each switch. That would avoid duplicating a lot of code.

#

One of my favorite illustrations of a simple state machine, for a heater. It has three states ("off", "low", and "high"), and two buttons ("LO" and "HI"). Pushing the "LO" button when it's off sets it to low. Pushing the "LO" button when it's already on "low" turns it off, etc.

tough pier
#

@main meteor so I took your code (and modified it a bit to make sense to me) and so far so good. So I would then need to create and apuOff and set that up under an else statement???
apuOn = False

while True:
if apu.value:
if not apuOn:
apuOn = True
kbd.send(Keycode.A)
kbd.release_all()
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)

raven canopy
#

no, you'll only need one state variable per switch. then, just set it accordingly:

apuOn = False

while True:
    if apu.value:
        if not apuOn:
            apuOn = True
            kbd.send(Keycode.A)
            kbd.release_all()
            cpx.pixels.brightness = 0.05 
            cpx.pixels[5] = (0, 200, 0)
    else:
        if apuOn:
            apuOn = False
            kbd.send(Keycode.CTRL_A)
            kbd.release_all()
            # pixel stuff
#

you could also use a dictionary:

states = {"apu": True, "ailerons": False}

while True:
    if apu.value:
        if not states["apu"]:
            states["apu"] = True
#

then there's set() or using a class. Python...so many ways! 😄

pastel panther
#

once you get more than a few state variables/objects organizing them in something like a dict or class becomes much easier than keeping track of a bunch of individual variables

raven canopy
#

in. deed.

pastel panther
#

in['deed']

tough pier
#

@raven canopy Using your code example I have the apu working as designed! thanks! now I'm going to try the dictionary method and then try it on the 3 state engine crank switch (3 states are off Right and Left)

raven canopy
#

woohoo! love it when stuff works!

main meteor
#

I misread that at first and thought you meant the magneto switch, but that should have 4 positions (off, left, right, both). 😃

tough pier
#

me too

main meteor
#

Then again I'm not sure an F/A-18 has magnetos.

tough pier
#

@main meteor no sir, it definitely does not...

#

code working with dictionary! trying engine crank now!

#

with the 3 states I'm going to make crankOff a true statement and then watch for crankRight and CrankLeft would I do that with if else else?

raven canopy
#
if:
elif: # else if
else: # anything not above
tough pier
#

@raven canopy thanks

raven canopy
#

You could also use one crank variable, and set it to a string:

states = {"crank": "off"}
if states["crank"] == "off":

elif states["crank"] == "right":
tough pier
#

the off state of engine crank has no keystroke becasue it doesn't do anything, so do I just leave the kbd stuff off that part?

raven canopy
#

If it requires no execution, I would only check the "not off" states. So, if right and elif left.

#

Alright. I'm for for few hours. Glad the sim is on the right track for ya!

tough pier
#

@raven canopy Thanks so much!

bleak tiger
#

Hi, I'm trying to retrieve data from an RSS feed for a weather display I'm building. I tried using espatcontrol_webclient.py and just replacing the url but get the following error:

#

ESP AT GET URL https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866
Resetting ESP module
Checking connection...
Retrieving URL...Failed to get data, retrying
No OK response to AT+CIPDOMAIN="weather-broker-cdn.api.bbci.co.uk"
Checking connection...
Retrieving URL...Traceback (most recent call last):
File "code.py", line 46, in <module>
File "code.py", line 36, in <module>
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 168, in get
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 154, in request
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 127, in request
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_socket.py", line 53, in readline
ValueError: need more than 1 values to unpack

#

I've tried to figure this out myself but its a little above my limited skills! Can anyone help?

meager fog
#

you can try turning on debug

#

and you must have RTS pin connected for most data transfer

bleak tiger
#

I'll look into that ,thanks!

bleak tiger
#

@meager fog was it the rst pin you mentioned? its connected to pin 5 on my M4express

#

debug immediately before the error is:

#

---> AT+CIPSTART="SSL","2.20.163.107",443,10
<--- b'CONNECT\r\n\r\nOK\r\n'
---> AT+CIPSTATUS
<--- b'STATUS:3\r\n+CIPSTATUS:0,"SSL","2.20.163.107",443,15489,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 44 bytes\r\n\r\nSEND OK\r\n'
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 41 bytes\r\n\r\nSEND OK\r\n'
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 36 bytes\r\n\r\nSEND OK\r\n'
---> AT+CIPSEND=2

<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 2 bytes\r\n\r\nSEND OK\r\n'

solar whale
#

@bleak tiger you should have RESET and RTS -- I just tried your example on my metro_m4 and ESP32 and it works, on min e RESET is D5, RTS is D6

bleak tiger
#

oh, cool I'll try that thanks!

solar whale
#

sorry RTS is D9, but teh webclient does not use it since it runs at 9600 baud

bleak tiger
#

ok, just to clarrify I'm using an esp8266 huzzah breakout. can't find mention of the rts pin

solar whale
#

its is GPIO13 on the breakout -- and if you look at some of the other examples you will see it using D9 on the metro_m4 as rtspin.

bleak tiger
#

thanks again @solar whale I'll take a look at those

solar whale
#

is you code using 9600 for the run_baudrate

bleak tiger
#

yes

solar whale
#

it should work evne without RTS -- does for me - it's good to add, but may not be the problem.

#

can you post your code -- just to make sure something else is not changed -- i only changed the URL line.

bleak tiger
#

sure

#

import time
import board
import busio
from digitalio import DigitalInOut
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_espatcontrol import adafruit_espatcontrol_requests as requests

Get wifi details and more from a settings.py file

try:
from settings import settings
except ImportError:
print("WiFi settings are kept in settings.py, please add them there!")
raise

uart = busio.UART(board.TX, board.RX, timeout=0.1)
resetpin = DigitalInOut(board.D5)

URL = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866"
print("ESP AT GET URL", URL)

esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, run_baudrate=9600,
reset_pin=resetpin, debug=True)
print("Resetting ESP module")
esp.hard_reset()

requests.set_interface(esp)

while True:
try:
print("Checking connection...")
while not esp.is_connected:
print("Connecting...")
esp.connect(settings)
# great, lets get the data
print("Retrieving URL...", end='')
r = requests.get(URL)
print("Status:", r.status_code)
print("Content type:", r.headers['content-type'])
print("Content size:", r.headers['content-length'])
print("Encoding:", r.encoding)
print("Text:", r.text)

    time.sleep(60)
except (RuntimeError, adafruit_espatcontrol.OKError) as e:
    print("Failed to get data, retrying\n", e)
    continue
solar whale
#

put trhee backtick before and after it to format it

bleak tiger
#

sorry, didn't realise

#

`import time
import board
import busio
from digitalio import DigitalInOut
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_espatcontrol import adafruit_espatcontrol_requests as requests

Get wifi details and more from a settings.py file

try:
from settings import settings
except ImportError:
print("WiFi settings are kept in settings.py, please add them there!")
raise

uart = busio.UART(board.TX, board.RX, timeout=0.1)
resetpin = DigitalInOut(board.D5)

URL = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866"
print("ESP AT GET URL", URL)

esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, run_baudrate=9600,
reset_pin=resetpin, debug=True)
print("Resetting ESP module")
esp.hard_reset()

requests.set_interface(esp)

while True:
try:
print("Checking connection...")
while not esp.is_connected:
print("Connecting...")
esp.connect(settings)
# great, lets get the data
print("Retrieving URL...", end='')
r = requests.get(URL)
print("Status:", r.status_code)
print("Content type:", r.headers['content-type'])
print("Content size:", r.headers['content-length'])
print("Encoding:", r.encoding)
print("Text:", r.text)

    time.sleep(60)
except (RuntimeError, adafruit_espatcontrol.OKError) as e:
    print("Failed to get data, retrying\n", e)
    continue

`

#

ah sorry three backticks, I'll get the hang of this eventually!

#
import board
import busio
from digitalio import DigitalInOut
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_espatcontrol import adafruit_espatcontrol_requests as requests

# Get wifi details and more from a settings.py file
try:
    from settings import settings
except ImportError:
    print("WiFi settings are kept in settings.py, please add them there!")
    raise

uart = busio.UART(board.TX, board.RX, timeout=0.1)
resetpin = DigitalInOut(board.D5)

URL = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866"
print("ESP AT GET URL", URL)

esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, run_baudrate=9600,
                                          reset_pin=resetpin, debug=True)
print("Resetting ESP module")
esp.hard_reset()

requests.set_interface(esp)

while True:
    try:
        print("Checking connection...")
        while not esp.is_connected:
            print("Connecting...")
            esp.connect(settings)
        # great, lets get the data
        print("Retrieving URL...", end='')
        r = requests.get(URL)
        print("Status:", r.status_code)
        print("Content type:", r.headers['content-type'])
        print("Content size:", r.headers['content-length'])
        print("Encoding:", r.encoding)
        print("Text:", r.text)

        time.sleep(60)
    except (RuntimeError, adafruit_espatcontrol.OKError) as e:
        print("Failed to get data, retrying\n", e)
        continue
#

yay!

solar whale
#

the code is OK -- same as I am running -- I'll try it on an esp8266 -- will take a few minutes to swap - you can try adding the RTS add rtspin = DigitalInOut(board.D9)
and change ```
esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, reset_pin=resetpin,
run_baudrate = 9600 rts_pin=rtspin, debug=True)

bleak tiger
#

I'll try that.

solar whale
#

OK -- I reproduced it on my ESP8266 -- Adding RTS now

bleak tiger
#

just tried it, still getting error:

#
<--- b'STATUS:3\r\n+CIPSTATUS:0,"SSL","2.20.163.107",443,5494,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b' '
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b' '
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b' '

---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b' '
Traceback (most recent call last):
  File "code.py", line 46, in <module>
  File "code.py", line 36, in <module>
  File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 168, in get
  File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 154, in request
  File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 127, in request
  File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_socket.py", line 53, in readline
ValueError: need more than 1 values to unpack```
solar whale
#

yes, me too -- looking into it.

bleak tiger
#

thanks

solar whale
#

@meager fog could this be an issue with the ESP8266 SSL support?

#

yes -- @bleak tiger change the https to http in the URL

bleak tiger
#

it worked! thanks @solar whale !

solar whale
#

Great -- there may be some issue with SSL on the ESP8266 -- I'm not to familiar with it -- will try to learn more - the ESP32 handles it better.

#

@bleak tiger with the RTS pin connected you can raise the baudrate -- I ran it a 480600

meager fog
#

@solar whale yeah esp8266 doesnt have ssl

solar whale
#

OK -- bur some https URLS work and others don't ...

#

I've used it to post to aio using https URL

stuck elbow
#

depends on what ciphers the given https server accepts

#

esp8266 only supports some, relatively weak, ciphers

solar whale
#

@stuck elbow OK -- good to know -- hard to prediict!

#

I guess I need to look more cloely at the responses when it fails ...

stuck elbow
#

would be nice to be able to see the actual error

solar whale
#

working on it ...

solar whale
#

ther failure is casued by an empy line being seen from the ESP8266 that does not occur with the ESP32. still inivestigating.

solar whale
#

@stuck elbow @meager fog so the difference I see is that the ESP32 CIPSTATUS report TCP even when https is used but the ESP8266 reports SSL -- when the request is sent to the ESP8266 it does not send a response and there is en empty response after a timeout. The ESP32 responds with valid data as in the HTTP request.... ESP32 note TCP ins STATSU even though HTTPS requestes - note port 443 ```---> AT+CIPSTATUS
<--- b'STATUS:3\r\n+CIPSTATUS:0,"TCP","104.121.87.114",443,62119,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b''
Receiving: 2920

ESP8266 note SSL in  CIPSTATUS and empty line at end note port 443

---> AT+CIPSTATUS
<--- b'STATUS:3\r\n+CIPSTATUS:0,"SSL","104.121.87.114",443,44683,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b''
b''

solar whale
#

but according to the documentation -- only TCP or UDP are expected to be in that field? SSL is not a valid type

kind herald
#

heey guys

#

I have been really wanting to try python or microcontrollers but I don't know where to start and I have lots of question

#

is anyone willing to help ?

solar whale
#

@kind herald Go ahead and post questions -- also are you using CircuitPython or micropython and on what board(s)

kind herald
#

I saw both of those. but is there a difference ? I didn't start yet I know to code python and love to play with microcontrollers so I thought doing both would be awesome. What board do you recommend for starting out ? @solar whale

main meteor
#

I have a real fondness for the Circuit Playground Express for getting started with CircuitPython. It has a bunch of nice built-in peripherals you can use without having to wire anything else up.

stuck elbow
#

it really depends on 1) how experienced with microcontrollers you are, 2) what you want to achieve

meager fog
#

@solar whale may be - ive really be focusing on ESP32 because 8266 has such bad SSL - very flakey :/

#

and the AT commands are not well documented -

#

might actually be easier to 'backport' the SPI code to ESP8266 from ESP32

kind herald
#

I prefer the ESP32 way more

#

the ESP8266 gives me a bunch of headaches

solar whale
#

@meager fog agreed! about flakey SSL! I was jsut trying to understand whay it was failing.

kind herald
#

what's the difference between circuitpython and micropython ?

#

and I think the ESP32 supports both of them correct me if i'm wrong

solar whale
#

@kind herald circuitpython does not run on an esp32 😉

#

big difference!

#

no - only micropython for the ESP32

kind herald
#

ohhh I see

#

so circuitpython is only for adafruit products ?

solar whale
#

not necessarily - it works on some sparfun SAMD51 boards and many nrf52840 baords (particle, adafruit, nordic)

magic wing
solar whale
#

It was supported on the esp8266 but has been dropped going forward

magic wing
#

@solar whale as of 4.0 alpha 3, correct?

solar whale
#

correct

kind herald
#

thaaanks for the link @magic wing !

meager fog
#

yes it it very hard to support the ESP's well, we found better success with hving them as a subprocessor

#

and if you look at other companies, others are doing the same...

#

ESP for wireless only - SSL and socket management - not for peripherlas

magic wing
#

ah, dang it

#

@meager fog I'm sorry to hear that, is that in general or just from a CP perspective?

meager fog
#

in general

#

the ESP series are wonderfully inexpensive, and painful to use - if you aren't doing exactly what they are good for - its hard to know what went wrong

magic wing
#

<laughs> of course, the automated satellite tracker I'm building just switched from a 2560 Mega to a Huzzah precisely because the ESP8266 wifi support is so much better

meager fog
#

and the documentation is not as solid as other chips - there's little app support. the low cost is part of the deal

#

the wifi part of the ESP works great...its everything else 😃

kind herald
#

that's what I love about them they are cheap xD

meager fog
#

thats why its a good co-processor

kind herald
#

so we can't expect anymore

magic wing
#

well, this project is using the Arduino IDE not CP so as long as someone else writes the server code, i can use it (and thankfully the guy who designed the project wrote the code)

meager fog
#

someone has to support them, tho - who will do that?

spark mesa
#

Hey guys! First time here. Looking for help with reinitializing a digital pin for a neopixel strip connected to a pi. Here's what I've tried:

>>> import board
>>> import neopixel
>>> neo = neopixel.NeoPixel(board.D18, 2)
>>> neo[0] = (255, 0, 0)  # turns the first pixel red
>>> neo.deinit()
>>> neo = neopixel.NeoPixel(board.D18, 2)
>>> neo[0] = (255, 0, 0)  # turns the first pixel red  # Nothing happens :(
meager fog
#

light, that isnt supported probably. keep the object around!

spark mesa
#

Ah ok. Thought I may be doing something wrong. Thanks!

kind herald
#

so after a quick reading (I will have more time tomorrow to look into this) CP is just MP but with added features so generally better and the way to go ?

magic wing
#

@meager fog this is what I picked a bit over two years ago as my first electronics project. Was also my first intro to Adafruit. It's been a long learning curve, but I'm basically left with just buttoning it up in a permanent enclosure (which I'm going to try to finish tonight) and showing it off on Show and Tell
http://clearskyinstitute.com/ham/AST/

#

The switchover to the ESP8266 was a last minute curve ball, but it's actually simplified a lot for me

meager fog
#

yay come by S&T next week!

kind herald
#

um okayy thanks for the help guys

solar whale
#

@kind herald good luck and come back any time

idle owl
#

@kind herald CircuitPython is a much better option for getting started, yes. 😃

kind herald
#

@solar whale I surely will ! just saw a video about the community reaching 10000 people on discord. Now I know why

#

@idle owl Alright ! I have a better idea now thanks 😄

#

@meager fog wait are you the one from the videos ! 😮

pastel panther
#

that's just a hologram

meager fog
#

man yep

#

many

kind herald
#

@meager fog never seen an admin, a youtuber, a maker and still this close to his community ! I'm sorry still new to this world of adafruit. Thaanks anyway

pastel panther
#

hey @meager fog for the OnDiskBitmap height&width properties, you meant for them to be exposed like odb.height etc.? I was slightly confused when I saw that OnDiskBitmap's get_pixel was only used via Bitmap

meager fog
#

yeah height/width

pastel panther
#

right, ok.

meager fog
#

so you could center it in the screen

pastel panther
#

right; will do

manic glacierBOT
#
  • Add 'x' format character to struct format strings. This designates a padding byte that is 0 when packing and is skipped when unpacking.
  • Follow CPython's lead on checking buffer length. struct.unpack() requires the buffer size to match exactly the size required by the format string. struct.unpack_from() requires the buffer size to be at least the size required by the format string (the buffer could be longer).
  • struct.unpack_from(fmt, data, offset=0) now allows offset as a k...
tough pier
#

@pastel panther you around

pastel panther
#

@tough pier I am

tough pier
#

@pastel panther so Everything is going superbly. I have 4 of 8ish switches working. No interference, no time lags, etc. The only one I'm not sure how to handle is the engine crank switch, which is a two pole, 3 position toggle. Center is off and does nothing. Right takes A4 to ground and Left takes A3 to ground. Here's the complete code. Could you just look it over to make sure you see nothing weird and then tell me how I should do the 3 postion logic.

import time
import board
import digitalio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_circuitplayground.express import cpx

kbd = Keyboard()

apu = digitalio.DigitalInOut(board.A1)
apu.direction = digitalio.Direction.INPUT
apu.pull = digitalio.Pull.DOWN
seat = digitalio.DigitalInOut(board.A5)
seat.direction = digitalio.Direction.INPUT
seat.pull = digitalio.Pull.UP
eject = digitalio.DigitalInOut(board.A2)
eject.direction = digitalio.Direction.INPUT
eject.pull = digitalio.Pull.UP
repair = digitalio.DigitalInOut(board.A6)
repair.direction = digitalio.Direction.INPUT
repair.pull = digitalio.Pull.UP
crankRight = digitalio.DigitalInOut(board.A4)
crankRight.direction = digitalio.Direction.INPUT
crankRight.pull = digitalio.Pull.UP
crankLeft = digitalio.DigitalInOut(board.A3)
crankLeft.direction = digitalio.Direction.INPUT
crankLeft.pull = digitalio.Pull.UP

apuOn = False
seatArmed = False
ejectionTriggered = False
crankRight = False
crankLeft = False

cpx.pixels.brightness = 0.05

#

while True:
if apu.value:
if not apuOn:
apuOn = True
kbd.send(Keycode.A)
kbd.release_all()
cpx.pixels[5] = (0, 200, 0)
else:
if apuOn:
apuOn = False
kbd.send(Keycode.CONTROL, Keycode.SHIFT, Keycode.A)
kbd.release_all()
cpx.pixels[5] = (0, 0, 0)
if seat.value:
if not seatArmed:
seatArmed = True
kbd.send(Keycode.CONTROL, Keycode.SHIFT, Keycode.T)
kbd.release_all()
cpx.pixels[9] = (0, 0, 0)
else:
if seatArmed:
seatArmed = False
kbd.send(Keycode.T)
kbd.release_all()
cpx.pixels[9] = (200, 0, 0)
if eject.value:
if not ejectionTriggered:
ejectionTriggered = True
kbd.release_all()
cpx.pixels[8] = (0, 0, 0)
else:
if ejectionTriggered:
ejectionTriggered = False
kbd.send(Keycode.E)
kbd.release_all()
cpx.pixels[8] = (200, 0, 0)
if repair.value:
cpx.pixels[0] = (0, 0, 0)
else:
kbd.send(Keycode.R)
kbd.release_all()
cpx.pixels[0] = (200, 0, 0)
time.sleep(0.5)
cpx.pixels[0] = (0, 200, 0)
time.sleep(0.5)

pastel panther
#

@tough pier give me a few minutes to try and wrap something up and I'll take a look

pastel panther
#

@tough pier I think you would treat the two sides of the crank switch like two different switches

#

They're mutually exclusive so you don't have to worry about all the different states they could be in since mechanically if one is on the other must be off

#

now that I think of it you probably want to know which switch just turned off, so when one of the two is off, you'll want to check if the other is off. If the other is off as well you'll check the "previous" state of both to figure out which one is changing from on to off

main meteor
#

I was guessing you could use one variable, but it wouldn't be a boolean.

pastel panther
#

ya, that makes sense

manic glacierBOT
tough pier
#

@main meteor although that is probably the correct way, I think because it is like what I have already done, I will probably implement it like @pastel panther said

main meteor
#

They're both valid approaches. The individual variable approach lets you use pretty similar logic for the new situation, which makes sense.

tough pier
#

@main meteor I didn't mean correct, I think I meant that your way would be more terse and have less overlapping code

main meteor
#

Understood. Like most programming, there are a few ways to do it. For my projects, personal preference is often more important than engineering optimization.

tough pier
#

yea, I get a little too caught up in trying to make perfect code, and waste a lot of time when I should just go with what I know better, even if it takes a few more lines

main meteor
#

I've done that sometimes too.

manic glacierBOT
umbral dagger
#

I'm scrathing my head over this:

#
>>> import busio
>>> import board
>>> air_uart = busio.UART(board.D6, board.D5, baudrate=9600)
>>> esp_uart = busio.UART(board.D13, board.D10, timeout=0.5)
>>> gps_uart = busio.UART(board.TX, board.RX, baudrate=9600, timeout=3.000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid pins
#

If I just do the final UART call with TX & RX it's fine

pastel panther
#

well that's strange; does it behave differently without timeout vs. without baudrate?

solar whale
#

What if you swap the order?

main meteor
#

It looks like baudrate and timeout are optional arguments (keyword arguments).

pastel panther
#

do you think that would somehow affect the pins being passed to the constructor?

main meteor
#

So board.RX and board.TX work fine, but only if the optional arguments are not specified?

umbral dagger
#

This works fine: ```>>> import busio

import board
import gps
gps_uart = busio.UART(board.TX, board.RX, baudrate=9600, timeout=3.000)

#

On the Feather M4 Express TX/RX correspond to : ```>>> board.TX
microcontroller.pin.D1

board.RX
microcontroller.pin.D0

#

So there shouldn't be a conflict.

tulip sleet
#

My guess is that is has to do with which sercoms are being allocated. THe first two uarts might use up the available sercoms for TX and RX. There are at most two sercoms available for each pair of pins.

umbral dagger
#

Yeah... that might be it.

#

I'll play around with pins more tomorrow

#

Thanks folks

manic glacierBOT
manic glacierBOT
slender iron
#

<@&356864093652516868> Reminder the meeting is on Tuesday this week (24 hours later than normal)!

manic glacierBOT
hallow rapids
#

hi! i'm still trying to decide whether to use circuitpython or arduino for my circuit playground express project. i'd like to use python but i didn't find a usable fft implementation yet. the most interesting one i found uses asm_thumb, which doesn't work on the cpe.

#

i would also like to know if there is support for dma with neopixel matrices in circuitpython?

exotic pumice
#

not that I know of but I could be wrong

#

looks like I'm not the only one burning the midnight oil tonight

#

pixelbuf may be?

#

but roy said that's just using neopixel_write so maybe not

hallow rapids
#

okay, thanks. i'll try to ask again during daytime (in us)

manic glacierBOT
exotic pumice
#

I think I got the clock blues again

tulip sleet
#

@hallow rapids neopixels require precise timing; right now they are bit-banged. A DMA implementation ends up using a lot of RAM, more than one bit per output bit. This is true both in Arduino and CircuitPython.

DotStars are more flexible because they use an external clock and can use a conventional SPI interface.

There's a hw assist to neopixels and other RGB LED's that's in development right now named pixelbuf.

If you have an API idea for an FFT module that would be implemented in C, let us know (say, open an issue). It could operate on an array.array of some data type.

If you want to do this NOW, Arduino might be the better choice.

hallow rapids
#

@tulip sleet thank you, that helps for my current decision

timber mango
#

Hi

#

I managed to extend my trellis M4 board with 2 neotrellis (seesaw)

tulip sleet
#

@timber mango very nice!

timber mango
manic glacierBOT
timber mango
#

the main issue is that the 3V regulator on the trellisM4 is to small for so many neopixel

tulip sleet
#

I pointed other staff to your project

timber mango
#

thank you 😃

meager fog
#

nice work!

timber mango
#

the VDD on the edge of the trellis M4 is 5V (Vin) ? or 3V like the I2C (JST port) ?

#

it seems I won't get power failure when I will solder the 2 neotrellis to the trellisM4 (instead of I2C port with 3V)

manic glacierBOT
river quest
meager fog
#

@umbral dagger hellooo - are you still hackin' on hackspace?

umbral dagger
#

@meager fog nope.. Working on the evnironment sensor

meager fog
#

@umbral dagger which ones that?

#

i forgot

umbral dagger
#

@meager fog gps + bme280 + particulate sensor + eps8266 + feather M4 Express

manic glacierBOT
meager fog
#

@umbral dagger sounds cute, whats it for?

umbral dagger
meager fog
#

ok im not sure it will work - but you can try! no SSL supported

#

did you get it connecting?

umbral dagger
#

Mostly

#

I've had it post a few readings to AdafruitIO

meager fog
#

ar eyou using the requests interface

#

we did a recent update

umbral dagger
#

Seems glitchy.. but I have one of the older 8266 boards. Going to try with a new one.

solar whale
#

@meager fog esp8266 and adafruitIO seem ok with SSL

meager fog
#

he's using an ESP8266

umbral dagger
#

Using the restful API

manic glacierBOT
meager fog
#

restful over requests?

solar whale
#

sorry typo

umbral dagger
#

yes

solar whale
#

yes -- it post OK -- just some SSL sites don't work

umbral dagger
#

Got 3 uarts running (esp, gps, articulate sensor). That was fun

#

I2C for the bme280

tulip sleet
#

was it just an ordering issue or did you use other pins?

raven canopy
#

@slender iron are you still running adabot on a local cron? i think we're in a "dueling banjo" situation. the bundle releases for the last few days are ping-ponging the FeatherWing release between 0.9.4 and 1.0.0. looking at the Travis cron history, it's committing an update to 1.0.0, but can't create the release since the tag name is already created. i'm not even sure how we "fix" it. 😄 🏓

tulip sleet
#

@raven canopy I think you could just make a 1.0.1 (after the twin adabots fixed)

#

as scott says, there

#

s a large supply of numbers available

raven canopy
#

i thought about that. just not sure it would course correct, with the associated twin adabots as you mentioned. 😄

umbral dagger
#

I.e. start with TX/RX and find other valid pin combination without deiniting each time.

meager fog
#

@umbral dagger ok after this we could use that bitbangio library - its not as exciting but will let us do more on raspi 😃

manic glacierBOT
slender iron
#

@raven canopy should be stopped now

#

(just did it)

manic glacierBOT
manic glacierBOT
pastel panther
#

@slender iron re: Dean's mixer voice gain PR, what still needs to be done? I haven't tested it yet but it looks like most of the pieces are there

slender iron
#

I don't remember....

manic glacierBOT
ruby atlas
#

No meeting today? (I don't see the google doc link).

#

Oh, google calendar saying it's a US holiday. I guess that's why. That's too bad, I managed to clear my 2pm today and moved it all to tomorrow.

idle owl
#

@ruby atlas We made the decision in the meeting last week, and included it in the notes. However, it appears we did not ping CircuitPython Helpers until last night. Usually we post it the day we make the decision and pin the message. We evidently failed to do that this week. Apologies.

ruby atlas
#

That's okay, I didn't even know today's a holiday there because most of my US customers are still working.

#

Slack has actually been busier than usual for several.

manic glacierBOT
inland tusk
#

Was there a meeting today or is it tomorrow at the regular time?

gilded cradle
#

Tomorrow at the regular time

inland tusk
#

Thanks

gilded cradle
#

You're welcome

bleak tiger
#

Hi, I'm getting the following error when trying to run my adafruit charlieplexed matrix with the simpletest example code:

#
Traceback (most recent call last):
  File "code.py", line 20, in <module>
  File "code.py", line 10, in <module>
  File "adafruit_is31fl3731.py", line 95, in __init__
  File "adafruit_is31fl3731.py", line 144, in _init
  File "adafruit_is31fl3731.py", line 141, in _mode
  File "adafruit_is31fl3731.py", line 133, in _register
  File "adafruit_is31fl3731.py", line 128, in _bank
  File "adafruit_is31fl3731.py", line 122, in _i2c_write_reg
  File "adafruit_is31fl3731.py", line 120, in _i2c_write_reg
OSError: [Errno 5] Input/output error```
#

can anyone help?

#

running on as M4express feather, circuitpython 4.x

manic glacierBOT
manic glacierBOT
meager fog
#

@tidal kiln hihi

#

i have a printer guts

#

can u take a quik snap of the pluggin

#

so i dont get it wrong

tidal kiln
#

i don't have...but there's one in forum i can link...let me find...

meager fog
#

thankx, thought so

tidal kiln
#

@bleak tiger is it actually the matrix? not the wing?

bleak tiger
#

yes its the 16x9 matrix

#

I think I adjusted the code to suit:

#
import busio
import adafruit_is31fl3731


with busio.I2C(board.SCL, board.SDA) as i2c:
    # initialize display using Feather CharlieWing LED 15 x 7
    #display = adafruit_is31fl3731.CharlieWing(i2c)
    # uncomment next line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
    display = adafruit_is31fl3731.Matrix(i2c)

    # draw a box on the display
    # first draw the top and bottom edges
    for x in range(display.width):
        display.pixel(x, 0, 50)
        display.pixel(x, display.height - 1, 50)
    # now draw the left and right edges
    for y in range(display.height):
        display.pixel(0, y, 50)
        display.pixel(display.width - 1, y, 50)```
#

oops sorry, paste mistake!

tidal kiln
#

you can edit it

bleak tiger
#

got it

tidal kiln
#

give me a sec. i'm gonna hook this up and test real quick...

bleak tiger
#

thanks!

tidal kiln
#

worked for me.

#

you didn't get the pull up error, so it seems like your I2C wires are at least connected

#

how are you wired up?

bleak tiger
#

SCL to SCL, SDA to SDA

#

running circuitpython 4 alpha if that helps

tidal kiln
#

what about GND and power?

bleak tiger
#

aah think I spotted the problem, wired up to vbat but no battery connected during test

#

I'll just check

#

yup working now

#

thanks @tidal kiln , rookie error on my part!

tidal kiln
#

no worries. glad its working.

magic wing
#

@bleak tiger those are my favorite kind of errors

#

easily found, easily fixed

meager fog
#

@tidal kiln one silly Q, i cant get the test page to print

#

i am shorting J1 while powering?

tidal kiln
#

hmmm. yah. and that'd be like holding button while powering.

#

and then print begins when you release?

meager fog
#

hmm nopw

#

did you ground DTR for that test?

tidal kiln
#

i don't have the guts. so going by forum results. it worked there.

#

a little unclear - in one case DTR was grounded, for the other - doesn't look like they did

meager fog
#

yeah doesnt seem to

tidal kiln
#

not seeing anything different or special

old smelt
#

Hey all - not sure if this is the right place to ask this question, but did I see somewhere that one of the new Particle boards will run CircuitPython?

exotic pumice
#

they can run circuitpython, but it replaces the stock firmware

#

so you lose the particle mesh functionality

manic glacierBOT
#

I get the following error when I try to build for metro_m4_express. I'm using OSX and have been following these instructions: https://learn.adafruit.com/building-circuitpython/build-circuitpython

`~/circuitpython/ports/atmel-samd$ make BOARD=metro_m4_express V=1
GEN build-metro_m4_express/genhdr/mpversion.h
GEN build-metro_m4_express/genhdr/qstr.i.last
xargs: arm-none-eabi-gcc: No such file or directory
make: *** [build-metro_m4_express/genhdr/qstr.i.last] Error 127
make: *** Deletin...

old smelt
#

@exotic pumice - ok, thanks! I'll stick with the Feather m4 for now, then...

manic glacierBOT
meager fog
#

plz try going there - i gave u perms

raven canopy
#

dons 'intrigued' mask. resists urge to click 😆

meager fog
#

sommer, its for arduino library maintainers - if you plan on doing any arduino library codin' we can add ya 😃

raven canopy
#

quietly backs away lol

#

not sure i have the cycles rn to get back into the arduino world...

tidal kiln
#

@meager fog there. i think. but not seeing any activity?

meager fog
#

yah its fresh

#

but i dont see ya there?

tawny abyss
#

@meager fog Could you tell me a little about the state of Ampy? I get that the native USB lets Circuit python iterate a whole lot faster, but Ampy seems to get a lot of love even from the microphython side of things.

meager fog
#

hiya

#

yep! we are no longer supporting ESP8266 on circuitpython, and so will not be maintaining ampy - its still there, and it works for many uses, but we aren't maintaining it anymore because we are not using it

#

if you'd like to develop it, please fork from github

#

if you'd like to take over maintenance, we can transfer the repo to you! 😃

manic glacierBOT
#
  • Put back string UUID parsing and printingfor bleio.UUID. No longer assume that there are adafruit_ble Python wrapper classes for most classes in bleio.
  • Make CharacteristicBuffer be a standard stream class, so that it mimics busio.UART, etc. However, it only provides read functionality
  • Protect the ring buffer in CharacteristicBuffer with a mutex.
  • Refactor ringbuf.h to include some operations that were added for nRF UART.
  • Fix a minor doc error in busio.UART.

...

slender iron
#

<@&356864093652516868> Here is my draft for the circuitpython 2019 aggregate post. I've got a couple more sections later to do later tonight but want to make sure you have time to look it over before our meeting tomorrow. Thanks! https://docs.google.com/document/d/1_HpiYQOVxrBMd8HSn_vvjpl629M23tu8lsxh9bMHY98/edit?usp=sharing

solar basin
#

@slender iron not sure if it matters but @TJ Peden == @TangoJuliett

manic glacierBOT
manic glacierBOT
slender iron
#

<@&356864093652516868> Ok, I've filled out the last couple sections. Please take a look before tomorrow's meeting.

exotic pumice
#

my clocks are running quite strangely

#

my DFLL is 6MHz and my DPLL0 is 8MHz

#

instead of 48 and 120

#

we need a generic #developers channel or something so I don't feel guilty about posting in here about non-circuitpython stuff

#

oh some of the dpll0 pulses are 12mhz, that's closer

exotic pumice
#

makes no difference if I use osculp32k or xosc32k

#

you guys said DFLL is supposed to be 48MHz at reset right? No configuration required

#

xosc32k is actually 32K-ish

exotic pumice
#

but if I try to divide it I get nonsense

#

I think atmel's using new math

exotic pumice
#

confirmed new math

#

ok, so the explanation of divsel was just plain wrong

#

it's 2*(n+1) not 2^(n+1)

hallow rapids
#

the video is fun to watch, though!

exotic pumice
#

yeah the video is great, atmel datasheets, not so much

manic glacierBOT
manic glacierBOT
wise crest
#

Hey there!

I'm a fellow pythonista, ususally found hacking over at - https://github.com/pycampers

I saw ampy doesnt have a maintainer now, so i though it would be great if I could help in make this great project better for everyone. And of course, solving that issues that it currently has.

I wouldnt say that i have a perfect knowledge of ampy's internals. Although, I have contributed to ampy in the past, and would love to continue doing it.

(Assuming you guys haven't already transferred the ownership to someone else)

Also, I don't currently have the variety of devices ampy supports, but i'm ready to buy them as long as my pocket allows it.

sinful sand
#

On the NeoTrellis M4 there is a 4 pin JST hacking port with pins labelled: GND, 3V, SDA, SDL In CP I use

import board
import busio
 
i2c = busio.I2C(board.SCL, board.SDA)

but if I want to use UART, which pins become TX and RX or can they be user assigned?

Then I use?

uart = busio.UART(board.TX, board.RX, baudrate=9600)

Next, how do I send any button presses out over the UART?

tulip sleet
#

@sinful sand experimenting:

Adafruit CircuitPython 4.0.0-alpha.5-126-gc5e1f0b6a-dirty on 2019-01-11; Adafruit Trellis M4 Express with samd51g19
>>> import board,busio
>>> u = busio.UART(board.SCL, board.SDA)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid pins
>>> u = busio.UART(board.SDA, board.SCL)
>>> 
#

So you can re-use the JST SDA and SCL pins (in that order) for UART. As for sending button data, it's up to you how you want to encode the button data as bytes and then write it out with UART.write. You could send it as 4 bytes (32 buttons), or use some other encoding scheme.

sinful sand
#

@danh thank you. Sorry if I'm slow on the uptake but to be clear: SDA is TX and SCL is RX?

manic glacierBOT
meager fog
tulip sleet
#

@sinful sand yes, the order of arguments is that, and you can also give the names explicitly:

u = busio.UART(tx=board.SDA, rx=board.SCL)
sinful sand
#

@meager fog @tulip sleet thanks both I will keep trying to get my head around it

wooden lichen
#

I downloaded the adafruit-circuitpython-bundle-py-20190121.zip to take a look at some libraries

#

I found out that in for example the adafruit_bme280.py library has the line "from micropython import const" in it

#

Is this a circuitpython library as well ?

solar whale
#

@wooden lichen yes - It is a CircuitPython Library - it won't work for micropython. -- many of them import that same module.

wooden lichen
#

ok thanks!

#

I see, the example contains 'import board' and import busio

solar whale
#

actually, I'm not sure if the lib can be used on micropython -- clearly, the examples cannot.

wooden lichen
#

This one looks like it can be used with both, it even tries to import ustruct if importing struct fails

manic glacierBOT
wooden lichen
#

I see that some other libraries use 'from adafruit_bus_device.i2c_device import I2CDevice'
What is circuitpython only I believe

fluid helm
solar whale
#

@wooden lichen Others may know more, but I am not aware of any effort to maintain micropython compatibility in the circuitpython libraries.

manic glacierBOT
slender iron
#

@wooden lichen adafruit_bus_device is written for CircuitPython's APIs. You could probably write a compatible class for MicroPython though

solar whale
#

@slender iron sorry - I have a "day job" conflict today so I'll be "lurking with one ear" for the meeting today. Group hug, Nothing special to report.

idle owl
#

@solar whale Thanks for letting us know!

slender iron
#

thanks @solar whale!

wooden lichen
#

Ok great, i'll look into it! @slender iron

idle owl
#

@wise crest Sounds great! We'd be happy to transfer the repo to you.

umbral dagger
#

I'll try to lurk today... I've been spending the last week with hardware or C mostly.

wise crest
#

@idle owl thanks! Here is the organization name - pycampers

idle owl
#

@wise crest Alright thanks! It is possible we can also add you as a maintainer on the PyPI project. Or you can handle deploying to PyPI on your own. We need to do a couple of things before we can transfer the repo, so we'll do that this week and get it ready to go!

wise crest
idle owl
#

Got it. Great!

#

<@&356864093652516868> This week's CircuitPython Weekly starts in about 30 minutes!

meager fog
#

i haz a meetin'

#

no real news this week

#

hugz to kattni who has been pickin' up a lot of guide and github stuff!

modern wing
#

Howdy ya'll, lurking here today. 😃

slender iron
#

thanks @meager fog will read it off

meager fog
#

hugz to dan for getting bleio uart working

#

hugz to scott for displayio - its amazing

slender iron
#

<@&356864093652516868> starting in a minute

marble hornet
#

I take it we haven't started

#

😉

umbral dagger
#

lurking...

tidal kiln
#

lurking...

raven canopy
#

Technically, Travis did the work. 😄. Hmm. It uses \n.. need a \r?

#

I may have to bounce out for a few. #day_job

fathom lava
#

I'm out today, but I'll be working on porting CircuitPython to the SparkFun SAMD21 Dev Board (Arduino footprint) this week. Hugs to all!

slender iron
#

awesome! know about a lumidrive board setup too?

turbid radish
#

lurking myself

gusty kiln
#

you betcha. :)

slender iron
#

@gilded cradle are you lurking?

gusty kiln
#

thanks @idle owl.

gilded cradle
#

No

slender iron
#

kk, you next 😃

#

(after ladyada)

gilded cradle
#

Ok

tidal kiln
#

@gusty kiln happy trails 👋

gilded cradle
#

voice is having trouble, just a sec

raven canopy
#

Negative

#
  • @Maker Melissa for the RA8875 library
  • Huggus Groupus!
gusty kiln
#

very proper latin, i'm sure.

gilded cradle
#

I think I'm good

raven canopy
#

Latin..sure. 😆

stuck elbow
#

in the weeds: non-SPI display support

raven canopy
#

Gotta drop off. Be back in a few I hope..

tidal kiln
#

yeah propmaker guide! i've been reverse engineering forum support from the schematic. will be nice to be able to point to a guide now.

slender iron
#

@tulip sleet I've read your notes off

tulip sleet
#

Will be just listening. About to start driving

slender iron
#

kk

gusty kiln
#

i think it's a solid post, @slender iron

solar whale
#

👍

marble hornet
#

weedsy topic?: python code to read from perferals and add objects to a "message que"

stuck elbow
#

I'm particularly thinking about the error handling for displays like the i2c oled, neopixel displays, and other displays with weird interfaces

marble hornet
#

Is this all monospace?

stuck elbow
#

yes

marble hornet
#

Oh 👌

stuck elbow
#

oh, nice

#

good luck making a 5x3 Japanese font ;-)

#

gameboy managed 8x8

manic glacierBOT
#

The current circuitpython master (9e8d182fe14c05b3e7c6a74e35987ec293310c7a) does not build for esp8266. The build fails with:

../../py/objfun.c: In function 'fun_asm_call':
../../py/objfun.c:549:5: error: passing argument 2 of 'mp_arg_check_num' makes pointer from integer without a cast [-Werror]
     mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
     ^
In file included from ../../py/objfun.c:33:0:
../../py/runtime.h:80:6: note: expected 'struct mp_map_t *' ...
gilded cradle
#

I have a hardware accelerated rounded rectangle function for the RA8875. I was thinking a GUI library that you could pass these drawing functions to.

stuck elbow
#

they all use the same commands, because that's a MIPI standard

marble hornet
#

@gilded cradle that's how I set up my gui, just pass methods.

gilded cradle
#

Oh perfect

raven canopy
#

Thanks everyone!

modern wing
#

Thanks ya'll!

gilded cradle
#

Thanks everyone

marble hornet
#

The documentation doesn't exist yet but I can get you up and running with my code if you wanna chat after

gilded cradle
#

Sure

manic glacierBOT
gusty kiln
#

that'd definitely save a couple pings a week at least.

modern wing
#

I'll second that too.

#

hahahaha....clean slate

marble hornet
#

Ahahaha

manic glacierBOT
raven canopy
#

@idle owl I was 1 click away from adding a "I Love Lamp" image to that PR...

modern wing
#

likewise here, changes are live without need for an application restart (which sometimes does happen)

manic glacierBOT
gilded cradle
#

Maybe have a Development Group then and move CP to that?

manic glacierBOT
marble hornet
#

@gilded cradle I'm have computer troubles rn, restarting. Sorry

manic glacierBOT
gilded cradle
#

Ok @marble hornet

marble hornet
#

@slender iron yolo

#

@gilded cradle here is the repo: https://github.com/TG-Techie/TG-US changes need to be made to the io_screen, pin_port, and the sys_config depending on your hardware setup

#

like buttons and such

#

io_screen is for the display

gilded cradle
#

Ok, I'll look it over

marble hornet
#

@vernal fern if problems arise, i;d suggest turning buttons off and using the keyboard

marble hornet
#

@slender iron alpha 5 doesn't have displayio yet, i'll need to build?

slender iron
#

yup, you'll want the latest from s3

#

I was thinking I'd do beta.0 today after reviewing PRs

slender iron
#

make translateimgrofybeepboopbop from a @tulip sleet commit. lol

idle owl
#

Right?

manic glacierBOT
marble hornet
#

joke or serious ?

#

and a beta seems aptly timed

#

@slender iron what/where is s3?

slender iron
#

travis auto-builds the latest code and stores it there

marble hornet
#

?

#

oh, awesome! thanks

slender iron
#

😃

marble hornet
#

4.0.0-alpha.5-497-g738e8f0 i;m still not getting displayio on the m4

#

hrmmm

#

yay ! it imported!

slender iron
#

nice!

#

what display do you have?

tidal kiln
idle owl
#

Don't think it was on the list, but it should probably be updated

exotic pumice
#

y'all still ok if I use this channel for SAMD51 initialization questions?

tidal kiln
#

cool. don't think it's super urgent, since there's the example, but when/if you can...thanks!

idle owl
#

@exotic pumice The idea is more basic questions will be handled in the #help-with-circuitpython channel, and dev discussion can happen here.

exotic pumice
#

ok, cool

#

@slender iron @tulip sleet any guesses why my DFLL is 6MHz?

slender iron
#

@solar whale ya, its an off by one error I haven't hunted down

solar whale
#

ok good -- just wanted to make sure you knew.

slender iron
#

@exotic pumice nope, when I'm debugging clocks I usually have a TC setup to pwm at 500 hz so I can verify the clock speed

#

@solar whale yup, I'm aware. @solar basin was going to hunt for it I think

solar whale
#

great -- I hope to have some time to do more testing of displayio and bleio tomorrow

exotic pumice
#

I'm actually putting the gclk out on GCLK/IO because my timers don't initialize properly

#

nor do my sercoms

slender iron
#

@solar whale awesome! I'm thinking I'll release beta.0 today so you can test that and we can do beta.1 with fixes

solar whale
#

woohoo!

slender iron
#

I just merged translations with git checkout --theirs locale/ make translate I think that's the easiest way

manic glacierBOT
meager fog
#

@wise crest heya i think we need to do the transfer together

#

since there's multiple admin permissions

exotic pumice
#

I think I'm gonna try futzing with dfllval.coarse and dfllval.fine

#

or should I switch to closed loop mode?

meager fog
#

@wise crest so lemme know where you want to xfer it to - i can also make you an admin on that repo, maybe then you can xfer it

#

ok i think i fiugred out how to do it, i xfered to myself and then to you

#

so when you accept it then its yours

#

you'll need to redo the pypi deployment stuff cause it was tied to our account

#

i can add you as a maintainer on pypi

manic glacierBOT
tulip sleet
#

@exotic pumice Closed loop mode is broken - check the errata (there's a lot of surprising or even horrifying stuff in the SAMD51 errata).

#

One thing you could do is check the clock register settings in CircuitPython and compare them to your settings.

exotic pumice
#

yeah I have that tab open and I remember you mentioning it before

tulip sleet
#

We use the svd package to make it easy to look at register values.

exotic pumice
#

our entire register access model is based on the svd

#

autogenerated code from the svd

#

some of the svd is a little wrong too

tulip sleet
#

i mean in gdb; there's a python thing that reads the svd and lets you dump register values

exotic pumice
#

oh yeah, scott showed me that

#

I already have the svd open so it's easy enough for me to just read it manually and then x/xw the address

#

you guys said the dfll requires no configuration right?

wise crest
#

@meager fog , thank you so much!

idle owl
#

@wise crest Thank you!

exotic pumice
#

@tulip sleet, it should just be 48MHz on boot?

manic glacierBOT
tulip sleet
#

@exotic pumice I think you still have to turn it on

#

you're reading our clock code, right?

exotic pumice
#

yeah I've read it

tulip sleet
#

also we do set it to lock to USB, not sure if it really is or not

#

since closed loop mode is broken

exotic pumice
#

I think I had that chunk of code and I commented out and there was no difference

#
        unsafe {
            oscctrl.dfllctrla.write(|w| w.bits(0));
            oscctrl.dfllmul.write(|w| {
                w.cstep().bits(1);
                w.fstep().bits(1);
                w.mul().bits(0)
            });
        }
        while oscctrl.dfllsync.read().dfllmul().bit_is_set() {}
        while oscctrl.dfllsync.read().dfllctrlb().bit_is_set() {}
        
        oscctrl.dfllctrla.modify(|_, w| w.enable().set_bit());
        while oscctrl.dfllsync.read().enable().bit_is_set() {}

        oscctrl.dfllctrlb.write(|w| {
            w.ccdis().set_bit();
            w.usbcrm().set_bit();
            w.waitlock().set_bit()
        });

        while oscctrl.status.read().dfllrdy().bit_is_clear() {}
meager fog
#

@wise crest congrats and best of luck 😃

tulip sleet
#

thank you @wise crest !

exotic pumice
manic glacierBOT
exotic pumice
#

It looks like I'm missing clearing dfllctrlb, I wonder if that'll make a difference

tulip sleet
#

i'm going to dump the CPy settings, getting set up for that

exotic pumice
#

thanks

#

still getting 6MHz after clearing ctrlb

manic glacierBOT
tulip sleet
#

@exotic pumice are you sure the GCLK you're sending the DFLL to is not dividing it?
btw, from hpl_gclk_config.h in CPy, a description of our clockc setup?

// Circuit Python SAMD51 clock tree:
// DFLL48M (with USBCRM on to sync with external USB ref) -> GCLK1, GCLK5
//   GCLK1 (48MHz) -> 48 MHz peripherals
//   GCLK5 (48 MHz divided down to 2 MHz) -> DPLL0, DAC peripherals
//     DPLL0 (multiplied up to 120 MHz) -> GCLK0, GCLK4 (output for monitoring)
exotic pumice
#

yup I have all that

#

I'm setting the divider to 1

tulip sleet
#

divider in gclk, not just dfll?

exotic pumice
#

yeah

#
    let _gclk2 = clocks
        .configure_gclk_divider_and_source(GCLK2, 1, DFLL, false)
        .unwrap();
#

configure_gclk_divider_and_source is a wrapper around

fn set_gclk_divider_and_source(
        &mut self,
        gclk: ClockGenId,
        divider: u16,
        src: ClockSource,
        improve_duty_cycle: bool,
    ) {
        self.gclk.genctrl[gclk.bits() as usize].write(|w| unsafe {
            w.src().bits(src.bits());
            w.div().bits(divider);
            // divide directly by divider, rather than 2*(n+1)
            w.divsel().clear_bit();
            //w.divsel().set_bit();
            w.idc().bit(improve_duty_cycle);
            w.genen().set_bit();
            w.oe().set_bit()
        });
        self.wait_for_sync();
    }
tulip sleet
#
(gdb) svd/x OSCCTRL
Registers in OSCCTRL:
    EVCTRL:               0x00  Event Control
    INTENCLR:       0x00000000  Interrupt Enable Clear
    INTENSET:       0x00000000  Interrupt Enable Set
    INTFLAG:        0x00010100  Interrupt Flag Status and Clear
    STATUS:         0x00010100  Status
    XOSCCTRL0:      0x00000080  External Multipurpose Crystal Oscillator Control
    XOSCCTRL1:      0x00000080  External Multipurpose Crystal Oscillator Control
    DFLLCTRLA:           0x-7E  DFLL48M Control A
    DFLLCTRLB:            0x00  DFLL48M Control B
    DFLLVAL:        0x0000747B  DFLL48M Value
    DFLLMUL:        0x00000000  DFLL48M Multiplier
    DFLLSYNC:             0x00  DFLL48M Synchronization
    DPLLCTRLA0:           0x02  DPLL Control A
    DPLLCTRLA1:          0x-80  DPLL Control A
    DPLLRATIO0:     0x0000003B  DPLL Ratio Control
    DPLLRATIO1:     0x00000000  DPLL Ratio Control
    DPLLCTRLB0:     0x00000000  DPLL Control B
    DPLLCTRLB1:     0x00000020  DPLL Control B
    DPLLSYNCBUSY0:  0x00000000  DPLL Synchronization Busy
    DPLLSYNCBUSY1:  0x00000000  DPLL Synchronization Busy
    DPLLSTATUS0:    0x00000003  DPLL Status
    DPLLSTATUS1:    0x00000000  DPLL Status
exotic pumice
#

what do the ones with dashes mean?

tulip sleet
#
(gdb) svd/x GCLK 
Registers in GCLK:
    CTRLA:            0x00  Control
    SYNCBUSY:   0x00000000  Synchronization Busy
    GENCTRL0:   0x00010907  Generic Clock Generator Control
    GENCTRL1:   0x00010906  Generic Clock Generator Control
    GENCTRL2:   0x00000000  Generic Clock Generator Control
    GENCTRL3:   0x00000000  Generic Clock Generator Control
    GENCTRL4:   0x00010907  Generic Clock Generator Control
    GENCTRL5:   0x00180906  Generic Clock Generator Control
    GENCTRL6:   0x00000000  Generic Clock Generator Control
    GENCTRL7:   0x00000000  Generic Clock Generator Control
    GENCTRL8:   0x00000000  Generic Clock Generator Control
    GENCTRL9:   0x00000000  Generic Clock Generator Control
    GENCTRL10:  0x00000000  Generic Clock Generator Control
    GENCTRL11:  0x00000000  Generic Clock Generator Control
    PCHCTRL0:   0x00000000  Peripheral Clock Control
    PCHCTRL1:   0x00000045  Peripheral Clock Control
    PCHCTRL2:   0x00000000  Peripheral Clock Control
    PCHCTRL3:   0x00000000  Peripheral Clock Control
    PCHCTRL4:   0x00000000  Peripheral Clock Control
    PCHCTRL5:   0x00000000  Peripheral Clock Control
    PCHCTRL6:   0x00000000  Peripheral Clock Control
    PCHCTRL7:   0x00000000  Peripheral Clock Control
    PCHCTRL8:   0x00000000  Peripheral Clock Control
    PCHCTRL9:   0x00000000  Peripheral Clock Control
    PCHCTRL10:  0x00000041  Peripheral Clock Control
    PCHCTRL11:  0x00000000  Peripheral Clock Control

rest are zeros

#

i think the dashes are don't-care bits

#

??

#

anyway, I'd do a dump of yours and compare

exotic pumice
#
(gdb) x/64xw 0x40001000
0x40001000:    0x00000000    0x00000000    0x00000000    0x00010100
0x40001010:    0x00010100    0x00000080    0x00000080    0x00000002
0x40001020:    0x00000098    0x00008c80    0x04010000    0x00000000
0x40001030:    0x00000002    0x0000003b    0x00000800    0x00000000
0x40001040:    0x00000003    0x00000080    0x00000000    0x00000020
0x40001050:    0x00000000    0x00000000    0x00000000    0x00000000
0x40001060:    0x00000000    0x00000000    0x00000000    0x00000000
0x40001070:    0x00000000    0x00000000    0x00000000    0x00000000
0x40001080:    0x00000000    0x00000000    0x00000000    0x00000000
0x40001090:    0x00000000    0x00000000    0x00000000    0x00000000
0x400010a0:    0x00000000    0x00000000    0x00000000    0x00000000
0x400010b0:    0x00000000    0x00000000    0x00000000    0x00000000
0x400010c0:    0x00000000    0x00000000    0x00000000    0x00000000
0x400010d0:    0x00000000    0x00000000    0x00000000    0x00000000
0x400010e0:    0x00000000    0x00000000    0x00000000    0x00000000
0x400010f0:    0x00000000    0x00000000    0x00000000    0x00000000
tulip sleet
#

if you have a bin starting at 16k or a .uf2 I can load it if you're not set up for the above

exotic pumice
#

I have a bin yes

tulip sleet
#

does it start at 0x4000?

exotic pumice
#

yes

#

it puts the clock onto d13

#

mostly because I saw d13 was an option and thought it was funny, and also because when I was having trouble with uart I was using gclk2, and that's where it's gclk/io happened to be

#

oh, actually, the bin doesn't start at 0x4000, you flash it there with -o in bossac

#

the elf starts at 0x4000

#

is that what you meant?

tulip sleet
#

actually an elf would be easier, hard to load a .bin in gdb with j-link (or at least I don't know how

exotic pumice
#

kk

#

my setup is kinda weird, my elf loader doesn't work properly in gdb/openocd, so I flash with bossac and debug with gdb

tulip sleet
#

clock_out loaded:

gdb) svd/x OSCCTRL 
Registers in OSCCTRL:
    EVCTRL:               0x00  Event Control
    INTENCLR:       0x00000000  Interrupt Enable Clear
    INTENSET:       0x00000000  Interrupt Enable Set
    INTFLAG:        0x00010100  Interrupt Flag Status and Clear
    STATUS:         0x00010100  Status
    XOSCCTRL0:      0x00000080  External Multipurpose Crystal Oscillator Control
    XOSCCTRL1:      0x00000080  External Multipurpose Crystal Oscillator Control
    DFLLCTRLA:            0x02  DFLL48M Control A
    DFLLCTRLB:           0x-68  DFLL48M Control B
    DFLLVAL:        0x0000747B  DFLL48M Value
    DFLLMUL:        0x04010000  DFLL48M Multiplier
    DFLLSYNC:             0x00  DFLL48M Synchronization
    DPLLCTRLA0:           0x02  DPLL Control A
    DPLLCTRLA1:          0x-80  DPLL Control A
    DPLLRATIO0:     0x0000003B  DPLL Ratio Control
    DPLLRATIO1:     0x00000000  DPLL Ratio Control
    DPLLCTRLB0:     0x00000800  DPLL Control B
    DPLLCTRLB1:     0x00000020  DPLL Control B
    DPLLSYNCBUSY0:  0x00000000  DPLL Synchronization Busy
    DPLLSYNCBUSY1:  0x00000000  DPLL Synchronization Busy
    DPLLSTATUS0:    0x00000003  DPLL Status
    DPLLSTATUS1:    0x00000000  DPLL Status
#
(gdb) svd/x GCLK 
Registers in GCLK:
    CTRLA:            0x00  Control
    SYNCBUSY:   0x00000000  Synchronization Busy
    GENCTRL0:   0x00000307  Generic Clock Generator Control
    GENCTRL1:   0x00010905  Generic Clock Generator Control
    GENCTRL2:   0x00010906  Generic Clock Generator Control
    GENCTRL3:   0x00000000  Generic Clock Generator Control
    GENCTRL4:   0x00000000  Generic Clock Generator Control
    GENCTRL5:   0x00180106  Generic Clock Generator Control
    GENCTRL6:   0x00000000  Generic Clock Generator Control
    GENCTRL7:   0x00000000  Generic Clock Generator Control
    GENCTRL8:   0x00000000  Generic Clock Generator Control
    GENCTRL9:   0x00000000  Generic Clock Generator Control
    GENCTRL10:  0x00000000  Generic Clock Generator Control
    GENCTRL11:  0x00000000  Generic Clock Generator Control
    PCHCTRL0:   0x00000000  Peripheral Clock Control
    PCHCTRL1:   0x00000045  Peripheral Clock Control
    PCHCTRL2:   0x00000000  Peripheral Clock Control
    PCHCTRL3:   0x00000000  Peripheral Clock Control
exotic pumice
#

thanks

tulip sleet
#

I'll put the salae on D13 just to check

slender iron
#

@marble hornet do you have a link for your board? adding it to the release notes

exotic pumice
#

oh, why is my dfllmul set?

#

my code says

oscctrl.dfllmul.write(|w| {
                w.cstep().bits(1);
                w.fstep().bits(1);
                w.mul().bits(0)
            });
tulip sleet
#

I am getting like 1.25MHz and 1.562 MHz alternately

exotic pumice
#

that's interesting

#

I get 6 and 8

tulip sleet
#

🤷 the secret is in the bits, I hope the compare helps

exotic pumice
#

yes thank you

#

this dfllmul value is very interesting

tulip sleet
#

maybe you need to clear the reg completely first?

exotic pumice
#

here's our diff

[paul@P50-Arch tmp]$ diff diff1.txt diff2.txt
1c1
< (gdb) svd/x OSCCTRL
---
> gdb) svd/x OSCCTRL
10,11c10,11
<     DFLLCTRLA:           0x-7E  DFLL48M Control A
<     DFLLCTRLB:            0x00  DFLL48M Control B
---
>     DFLLCTRLA:            0x02  DFLL48M Control A
>     DFLLCTRLB:           0x-68  DFLL48M Control B
13c13
<     DFLLMUL:        0x00000000  DFLL48M Multiplier
---
>     DFLLMUL:        0x04010000  DFLL48M Multiplier
19c19
<     DPLLCTRLB0:     0x00000000  DPLL Control B
---
>     DPLLCTRLB0:     0x00000800  DPLL Control B
manic glacierBOT
exotic pumice
#

clear all of oscctrl you think?

tulip sleet
#

hold on, I will get an expanded dump

#

yours

(gdb) svd/x OSCCTRL DFLLCTRLA
Fields in OSCCTRL DFLLCTRLA:
    ENABLE:    0x1  DFLL Enable
    RUNSTDBY:  0x0  Run in Standby
    ONDEMAND:  0x0  On Demand Control
(gdb) svd/x OSCCTRL DFLLCTRLB
Fields in OSCCTRL DFLLCTRLB:
    MODE:      0x0  Operating Mode Selection
    STABLE:    0x0  Stable DFLL Frequency
    LLAW:      0x0  Lose Lock After Wake
    USBCRM:    0x1  USB Clock Recovery Mode
    CCDIS:     0x1  Chill Cycle Disable
    QLDIS:     0x0  Quick Lock Disable
    BPLCKC:    0x0  Bypass Coarse Lock
    WAITLOCK:  0x1  Wait Lock
(gdb) svd/x OSCCTRL DFLLMUL 
Fields in OSCCTRL DFLLMUL:
    MUL:    0x0000  DFLL Multiply Factor
    FSTEP:    0x01  Fine Maximum Step
    CSTEP:    0x01  Coarse Maximum Step
(gdb) svd/x OSCCTRL DPLLCTRLB0
Fields in OSCCTRL DPLLCTRLB0:
    FILTER:         0x0  Proportional Integral Filter Selection
    WUF:            0x0  Wake Up Fast
    REFCLK:        GCLK  Dedicated GCLK clock reference - Reference Clock Selection
    LTIME:      DEFAULT  No time-out. Automatic lock - Lock Time
    LBYPASS:        0x1  Lock Bypass
    DCOFILTER:      0x0  Sigma-Delta DCO Filter Selection
    DCOEN:          0x0  DCO Filter Enable
    DIV:          0x000  Clock Divider
exotic pumice
#

oh, so dfllmul.mul is 0, but the other parts of the register are set

tulip sleet
#

CircuitPython:

(gdb) svd/x OSCCTRL DFLLCTRLA
Fields in OSCCTRL DFLLCTRLA:
    ENABLE:    0x1  DFLL Enable
    RUNSTDBY:  0x0  Run in Standby
    ONDEMAND:  0x1  On Demand Control
(gdb) svd/x OSCCTRL DFLLCTRLB
Fields in OSCCTRL DFLLCTRLB:
    MODE:      0x0  Operating Mode Selection
    STABLE:    0x0  Stable DFLL Frequency
    LLAW:      0x0  Lose Lock After Wake
    USBCRM:    0x0  USB Clock Recovery Mode
    CCDIS:     0x0  Chill Cycle Disable
    QLDIS:     0x0  Quick Lock Disable
    BPLCKC:    0x0  Bypass Coarse Lock
    WAITLOCK:  0x0  Wait Lock
(gdb) svd/x OSCCTRL DFLLMUL 
Fields in OSCCTRL DFLLMUL:
    MUL:    0x0000  DFLL Multiply Factor
    FSTEP:    0x00  Fine Maximum Step
    CSTEP:    0x00  Coarse Maximum Step
(gdb) svd/x OSCCTRL DPLLCTRLB0
Fields in OSCCTRL DPLLCTRLB0:
    FILTER:         0x0  Proportional Integral Filter Selection
    WUF:            0x0  Wake Up Fast
    REFCLK:        GCLK  Dedicated GCLK clock reference - Reference Clock Selection
    LTIME:      DEFAULT  No time-out. Automatic lock - Lock Time
    LBYPASS:        0x0  Lock Bypass
    DCOFILTER:      0x0  Sigma-Delta DCO Filter Selection
    DCOEN:          0x0  DCO Filter Enable
    DIV:          0x000  Clock Divider
exotic pumice
#

so you're not doing usbcrm after all

tulip sleet
#

our FSTEP and CSTEP are zero

exotic pumice
#

yeah

tulip sleet
#

maybe we gave up on that due to no closed loop mode

manic glacierBOT
tulip sleet
#

i have to go eat - maybe look at the datasheet a bit more too

exotic pumice
#

thanks, have a good one

tulip sleet
#

@exotic pumice Our clock setup is here: it's not what's in the asf4_config files (any more)

exotic pumice
#

I think it's running too fast for my 24MHz logic analyzer now

#

that or it's not running at all

#

ok it seems to not be running

exotic pumice
#

setting the ondemand bit breaks dfllrdy, but I've divided my dfll by 12 and am getting 3.429-4MHz 😄

#

thank you @tulip sleet

#

huge hug report

tulip sleet
#

yw! clocks are the hardest thing

raven canopy
#

yeah...quite confusing. multiply this, then prescale this, but only after that...

exotic pumice
#

my dpll0 divided by 12 is 8-12MHz o.0

#

it's a really nasty looking signal

#

and it wasn't enough to fix uart but one step closer

manic glacierBOT
#

When doing make -j4 BOARD=metro_m4_express DEBUG=1, I get this fatal warning:

../../drivers/wiznet5k/internet/dhcp/dhcp.c: In function 'parseDHCPMSG':
../../drivers/wiznet5k/internet/dhcp/dhcp.c:670:9: error: 'type' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  return type;
         ^~~~
cc1: all warnings being treated as errors
../../py/mkrules.mk:55: recipe for target 'build-metro_m4_express/drivers/wiznet5k/internet/dhcp/dhcp.o' failed

Doesn'...

exotic pumice
#

hmm, my 200ms delay is still 91ms

#

I thought the clocks would've resolved that one at least

manic glacierBOT
pastel panther
#

that said they do look fairly different as they seem to use UART for communication

manic glacierBOT
slender iron
#

@pastel panther interesting! I think the idea is similar

tulip sleet
#

@slender iron is UARTServer instead of UARTService OK by you? (See github emails for my replies.) If so I'll push a commit to the PR

slender iron
#

@tulip sleet fine with me

#

can you test with the latest commit in master. I'll release as beta.0 tomorrow morning

#

did release notes already

tulip sleet
#

Great! Sure thing. I'd like to do a show&tell demo too.