#circuitpython-dev

1 messages ยท Page 355 of 1

ionic elk
#

Oh, sorry. UART resets using driver_delete, SPI just calls "free" which I2C doesn't even have an equivalent for

tulip sleet
#

so the IDF API is not very consistent

#

is that true?

#

but UART does not have this problem, is that correct?

#

I would look at the IDF impl to see what's different about driver_delete for UART vs I2C, if one works but the other doesn't

ionic elk
#

Not sure what you mean by "works", works as in it doesn't shut down wifi?

#

They work fine for actually resetting the bus

serene harness
#

That information from before is for a magtag project

tulip sleet
#

Doesn't produce the same bugs we are seeing with I2C and wifi interactions

ionic elk
#

Right, ok, sorry wanted to make sure we were synced

#

TBH UART could cause the same issues and that simply was never tested

tulip sleet
#

it would be interesting to test that, then

ionic elk
#

I'll give it a shot and see

tulip sleet
#

@serene harness You have some kind of issue with line 63, also could you ask in #help-with-circuitpython. There are a few more helpers over there. This is more for circuitpython dev issues. Thanks.

serene harness
#

Oh, I apologize. Thought that I was in that forum.

tulip sleet
#

np! don't upload as a .odt. It's hard to figure out the line numbers. Just upload the code.py

simple pulsar
idle owl
#

@simple pulsar Oooh that's a good question. I'm not sure.

onyx hinge
#

@slender iron apologies for repeating myself, but better to mention it in public. You were looking for a lost thread on double-tap-for-bootloader in rp2040. is this it? I wonder if this is the discussion of double-tap bootloader for rp2040 that scott was looking for: https://github.com/raspberrypi/pico-sdk/issues/87#issuecomment-773929609 -> https://github.com/raspberrypi/pico-examples/tree/master/system/double_tap_usb_boot

tulip sleet
simple pulsar
#

@tulip sleet thanks, useful to know

idle owl
#

@tulip sleet So on the Pico, only the three pins can do analogue? 26-28?

tulip sleet
#

looking ...

#

@idle owl, yes, the pins are fixed. GPIO29 is actually a real chip pin, but on the Pico, it is connected to a voltage divider to measure the 3.3V supply, and is not broken out to the edge.

idle owl
#

@tulip sleet Ok wanted to make sure I was understanding it right.

#

Thank you

tulip sleet
idle owl
#

Right, fourth channel is temp.

slender iron
#

@onyx hinge I was trying to remember where I thought I saw a schematic for doing the double tap in circuitry

idle owl
#

Thanks Dan!

slender iron
#

fifth channel is temp

#

(starts at 0)

idle owl
#

um...

tulip sleet
#

channel #4 is temp ๐Ÿ™‚

idle owl
#

The book seems to indicate there are only 4 channels

#

3 channels to GPIO, and a fourth connected to temp

slender iron
#

it's wrong then

idle owl
#

Hah ok

tulip sleet
#

they are not counting the GPIO29 voltage monitor?

#

book is talkign about the board, not the chip

idle owl
#

Oh right

#

So am I though

#

ok

#

It's super not clear though if that's the case. They talk about the chip in the same paragraph. Bleh. Whatever.

slender iron
#

they were probably confused themselves

ionic elk
#

@tulip sleet on a debug optimized build, I still don't see anything weird going on during the Wifi/I2C conflict hang. It's just looping in run_code_py, and should be running background tasks, but it isn't maintaining the USB or keyboard detection. Makes me think that there's something going haywire in the I2C interrupt system, messing with USB interrupt priority

tulip sleet
#

hmm! maybe time for some debug uart printouts

scenic echo
#

I just received a FeatherS2. Iโ€™m trying to play with toggling the LED via a webpage. Has anyone gotten it to serve a page in AP mode? (I donโ€™t want to connect to an existing network, but create its own point)

slender iron
#

@scenic echo I recommend asking on the unexpectedmaker discord first

scenic echo
#

@slender iron they sent me here ๐Ÿ™‚

slender iron
#

haha, ok. I don't know of any examples for that

ionic elk
#

@tulip sleet I remembered another weird thing I wanted to ask about. When testing the original issue, where the whole chip resets when you tried to use I2C after a soft reboot, it would only happen if I used board.I2C(), not a busio.I2C instance. Poking around, I figured the only difference between these two is that a board.I2C might have the object preserved for longer in a soft reboot? Or something?

#

Honestly I'm running out of ideas of things to try.

#

oh, and UART doesn't cause a wifi conflict. The underlying reset code is totally inconsistent between them though, so it'll be hard to narrow down what actual change might be causing this.

tulip sleet
#

check where the board.I2c instance is stored, whether it's in the heap or separate. If it's separate, maybe it is being garbage-collected by accident. If it's not in root pointers or not handled in a _gc routine, then it's not being walked during gc and any objects it points to will be gc'd and possibly smashed

#

The underlying reset code is totally inconsistent between them though

#

that is telling, maybe

ionic elk
#

I think the board.I2C instance is just STATIC mp_obj_t i2c_singleton = NULL; in shared-module

tulip sleet
#

when it's set, is it set to be a heap object? See how it's implemented on some other port, like atmel-samd

idle owl
ionic elk
#

@tulip sleet no, it's statically allocated

#
// Statically allocate the I2C object so it can live past the end of the heap and into the next VM.
// That way it can be used by built-in I2CDisplay displays and be accessible through board.I2C().
STATIC busio_i2c_obj_t i2c_obj;
tulip sleet
#

but if its struct has internal pointers that might be heap allocated, then that's an issue

ionic elk
#

Oh, hmm, I see your point

tulip sleet
#

so the second time around it will use the existing one. but maybe it got messed with during vm restart

#

i would again check if the port-specific code differs from, say atmel-samd

#

@idle owl where is guide page for this?

ionic elk
#

None of the above is port specific, it's all shared-module

idle owl
#

@tulip sleet Not published yet. I can link you in Slack if you want.

tulip sleet
#

yah

idle owl
#

It's in the Pico guide

tulip sleet
#

tnx

idle owl
#

Linked

ionic elk
#

But I'm wondering here, if the IDF tries to allocate something in the heap, does that get cleared? Or does it have its own heap?

idle owl
#

@tulip sleet If you have suggestions, we can chat here, I try to avoid putting the internal links in public channels.

tulip sleet
#

aprvd

idle owl
#

Ah thanks!

ionic elk
#

I'm going to try what Bruce suggested and update the IDF to something more recent, see if that helps

manic glacierBOT
#

Some notes from testing today:

  • The current I2C problems (crashing or failure after soft reboot) do appear to have been caused by #3803, as reverting it (by re-adding the i2c_driver_delete to reset/deinit and having I2C initialize new drivers on reboot) solves those issues. However, as predicted by @skieast, it causes the Wifi/I2C conflict hang in #3743 to appear again.
  • It is not clear what causes this conflict hang. Circuitpython is still looping properly in run_code_py (so it isn...
modern wing
#

Good afternoon all you wonderful folks -- happily lurking/text only. Updated the notes doc with those details. Will be updating myself with a hot cup of tea. ๐Ÿต

idle owl
#

<@&356864093652516868> CircuitPython Weekly is in ~15 minutes. Please add your notes to the notes doc. If you're listening in or lurking, please add your name to the lists under Hug Reports and Status Updates alphabetically with (lurking) after it so we know to skip over you. Thanks much!

tulip sleet
#

wow, forgot all about that

manic glacierBOT
fossil gorge
#

Mostly lurking, but should be able to hop in for my "in the weeds" topic if need be. However, I'm fairly certain I'm not a CircuitPythonista. Probably more CircuitPythonistish ๐Ÿ™‚

idle owl
#

@fossil gorge Welcome to the role!

slender iron
#

I just added you ๐Ÿ™‚

idle owl
#

We both did ๐Ÿ˜„

slender iron
#

great minds think alike ๐Ÿ™‚

fossil gorge
#

lol, thanks. It's all downhill from here folks!

#

Mostly coz it's snowy and iced over in Dallas

modern wing
#

Thankfully it wasn't bad in NJ....early projections were 1/3rd inch of ice. We barely got any.

solar whale
#

What happend to the pinned messages?

idle owl
#

@solar whale They're showing up for me.

supple gale
idle owl
#

I think it's a Discord glitch.

solar whale
#

they're back ๐Ÿ˜‰

idle owl
#

Magical!

ionic elk
#

@supple gale thanks for the update - I've spent more time digging at the I2C bug but I don't think I've turned up anything useful, unfortunately.

solar whale
#

When we lose power -- it's squirrels....

ionic elk
#

I think I'm going to put it down until we get the 4.3 update changes together, and start afresh from there. No point in solving a super-involved bug if the next version update breaks it again.

tidal kiln
#

lurking

blissful pollen
#

Had squirrels take out my internet before

fossil gorge
manic glacierBOT
modern wing
#

I've had squirrels in my home....put cashews....in the shoes under my bed. That was a great thanksgiving vacation, coming back to that.

solar whale
#

What -- no squirrel emoji!

modern wing
#

๐Ÿฟ๏ธ

solar whale
#

That's not a squirrel!

fossil gorge
errant grail
#

๐Ÿ”ฅ

manic glacierBOT
#

@tannewt Thanks for the review.

flash_range_program() accepts 256 aligned write... flash_range_erase() can only erase in 4k alignment which I think is the cause of a bug I am facing... writing at the same address twice is not working. The stored value turns to 0 when a second write attempt is made.

Buffering in the whole sector... then erasing it and writing might fix the bug but this is highly in-efficient and buffering in the whole sector is also causing a crash.

onyx hinge
#

We're soon changing how lurkers work a little bit, stay tuned. (not today)

solar whale
#

anyone else having trouble accessing the Google Doc?

onyx hinge
#

@solar whale it's fine for me, was just editing it

idle owl
#

@solar whale No... it's all issues for you today!

solar whale
#

just came back to life -- must have been a squirrel ๐Ÿ˜‰

modern wing
#

[they think I'm a real human!]

stuck elbow
#

I'm not a cat!

still zephyr
#

Lurking

errant grail
onyx hinge
lone axle
onyx hinge
manic glacierBOT
onyx hinge
idle owl
#

Haha I didn't read it off because the name was so long ๐Ÿ˜„

old smelt
#

Lurking

tulip sleet
#

it took me days to memorize lywsd03mmc well enough to type it without copy/paste

tidal kiln
#

looks like a cheat code

supple gale
#

Tuned in just in time for a listen.

fossil gorge
#

TIL that even with PTT, you need to unmute Discord. The more you know...

analog bridge
#

just stopping by to say hi ๐Ÿ‘‹ to all <@&356864093652516868>

ionic elk
#

One day

#

not today though I'm done lol

bleak spear
#

I had no problem getting the gamepad examples setup but those examples have the same problem I was talking about. No way to implement analog trigger buttons. Only the analog sticks and 16 buttons. It appears to just not be implemented in circuitpython at all and I can't parse the micropython well enough to see how to add it. @steep finch mentioned they have a fork exposing those buttons, but I couldn't find it. @steep finch do you have a link? I should asked earlier.

cobalt grail
#

Sorry. Lurking

onyx hinge
#

yeah you did, I didn't get it in the doc

slender iron
#

@low sentinel are you lurking?

low sentinel
#

Yeah! Just realized this was happening with the role ping.

slender iron
#

๐Ÿ˜„

onyx hinge
fossil gorge
#

Issues and PRs - a good place to contribute and enhance, and scratch some of that "code it from scratch" itch

tulip sleet
onyx hinge
#

belated hug report to dan for doing that sdcard work

low sentinel
#

2nd usb channel is amazing

tulip sleet
#

^^ uncrustify is what MicroPython finally settled on

onyx hinge
low sentinel
#

I use that with a car dashboard with particle photon. I can log and drive the display with a serial test harness over usb. Just luxury ๐Ÿ™‚

steep finch
#

@bleak spear I'm going to rebase it after the pico gets UART support

onyx hinge
fossil gorge
#

I seem to recall that the sphinx generator also creates man pages, PDF, and some other file formats. Are those not published or available anywhere?

#

Alternatively (but bandwidth and time consuming), clone the repos, and build the docs?

onyx hinge
#

so now I know that there are 248 pages in the circuitpython (6.1) manual. wow.

fossil gorge
onyx hinge
#

My suspicion is that there's some rtos thing like a mutex or a task that is getting confused. just a theory, I couldn't prove it.

steep finch
thorny jay
solar whale
#

Never let the boss test...

marble hornet
#

Great to hear about everyone's work and projects!
Have a great week all ๐Ÿ‘‹ , have to duck out.

tidal kiln
#

๐Ÿˆ

onyx hinge
#

that sounds like a lot of work

#

@idle owl will there potentially be a new twitter handle to tag?

thorny jay
onyx hinge
#

Widgets: Button, Progress bar, Sliding switch, Needle dial gauge, Scrolling value selector, Widget label, Widget indicator (label plus arrow)

gloomy shuttle
#

I second it being in pre-commit

lone axle
#

+1 from me for moving it into pre-commit as well. I still sometimes forget to run one or the other.

still zephyr
#

As new user I will love a pre-commit

low sentinel
#

Have a great week yโ€™all!

onyx hinge
#

the rp2040 datasheet states that I2C peripheral mode is supported

still zephyr
#

Thanks I will see the M4 implementation

thorny jay
#

Airlift.

#

Would the ESP32-S3 be useful as a Nina future hardware?

onyx hinge
#

Is the concern about the time to sort, or the dirty rectangle that results from it?

thorny jay
#

It's GPLv3 so you may not want to add it...

#

Compatible with MIT but will be "contaminated".

#

So "macro" kind of feature?

onyx hinge
#

was just going to mention .wrap_target

thorny jay
#

Ok, great. I'll see how I can use it for testing.

#

More about regression checking.

#

Thanks.

#

I will start with accumulating example and expected result.

#

@narrow dirge was testing with the comma with or without a space on the left and the right...

onyx hinge
#

too big to fail test

idle owl
thorny jay
#

Anna was picking up project like that.

#

At a time I was doing "one project a week", but I failed a bit, or not interesting enough to be spread in newsletter.

errant grail
#

Thank you!

mental nexus
#

Thanks everybody!

still zephyr
#

Thanks!

modern wing
#

Thanks y'all!

gilded cradle
#

Thanks

thorny jay
#

Bye

modern wing
#

Another successful meeting in the bag ๐Ÿ™‚

#

You know it's cold when C and F are the same...

thorny jay
#

I was considering checking all the meeting notes and pick what I did over a year... and what I had plan and did not.

fossil gorge
#

Cookiecutter issue opened. Feel free to assign the issue to me

modern wing
#

+45F right now in NJ

idle owl
#

@fossil gorge Will do!

#

@fossil gorge To be clear, you're planning to take it on?

fossil gorge
#

That is correct, yes

idle owl
#

Excellent, wanted to make sure before assigning you ๐Ÿ™‚

#

Done!

fossil gorge
#

Thanks! ๐Ÿ™‚

thorny jay
#

@idle owl in the "how to contribute" do you have separate instruction (and cookiecutter things) for Adafruit library and Community library?

idle owl
#

@thorny jay I haven't actually checked. Foamyguy updated the guide, I'm not sure exactly how he did it.

lone axle
#

It's the same basic instructions. The first prompt asks you which you want to do.

thorny jay
#

Yeah, there was that list of change to do to use it for non Adafruit library.

#

It's automated, great.

lone axle
#

The defaults are all good now I believe. If you choose community bundle it should have sane defaults for many of the fields. If you end up running it and notice there are specific prompts that could use better or additional wording in the guide feel free to ping me.

idle owl
#

Dropping off. Later!

idle owl
#

@tulip sleet Disconnected you from the chat so nobody jumped in and started talking.

tulip sleet
#

tnx - i was loading the dishwasher

tulip sleet
#

@idle owl sleep(0.00001) is 10 microseconds. time.sleep() is not good for that. It might not sleep at all or be highly inaccurate. Try microcontroller.delay_us(10) instead, but that might not be great either.

#

something like pulsein would be a lot better

idle owl
#

Hmm alright

#

Thanks

manic glacierBOT
onyx hinge
#

hmmm here's another puzzler -- PioPixl8 needs consecutive pins. There's not actually a way to check that is there?

#

from python

tulip sleet
#

you could get the microcontroller.pin equivalents and deconstruct the pin names ...

#

but no easy way

manic glacierBOT
slender iron
#

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

manic glacierBOT
#

I am running circuitpython 6.2.0-beta.2 on a Feather S2 (ESP32S2). For the libraries adafruit-circuitpython-bundle-6.x-mpy-20210214

I have tried using the guide from adafruit under https://learn.adafruit.com/mqtt-in-circuitpython/circuitpython-wifi-usage as well as the examples included with the lib.

The code is returning an error:

Connecting to Adafruit IO...
Traceback (most recent call last):
  File "code.py", line 77, in 
  File "adafruit_minimqtt/adafruit_minimqtt.py", li...
idle owl
#

@onyx hinge @slender iron FYI I updated the CP Weekly template with the new suggestions for submitting newsletter ideas. It now reads You may also tag a tweet with #circuitpython on Twitter, or email cpnews@adafruit.com. Letting you know so you're aware for when you next run the meeting, in case you have that part memorised and don't read it from the doc.

onyx hinge
#

wheee! "piopxel8" now works with the LED animations library. I'm running a different animation on each of the 8 independent strands right now.. (only 2 are wired up but I imagine the rest in their glory)

slender iron
#

nice!

onyx hinge
#

it seems reasonably fast with 240 pixels but I don't necessarily have a point of comparison. @slender iron do you think that (A) I should implement piopixl8 as a core module or (B) expose this extremely specific bit_transpose routine to Python? I don't want to go down the wrong route with a pull request.

slender iron
#

I'd do A if you suspect it'd work on other ports.

#

Do B if you don't

slender iron
#

(can't you do 16 that way too?)

onyx hinge
#

@slender iron the transposition routine is specific to working in 8-bit (8-strip) units. as for working on other ports, I guess there was a long ago failed attempt to do something similar to this on samd with spi dma but it didn't pan out (maybe not even in CP; limor mentioned paintyourdragon worked on it)

#

(so not 2, 3, 4, ..., 7 strips either -- only 8)

idle owl
#

@onyx hinge Unrelated, check the #books-and-tutorials channel - potential feedback on the canio guide. I asked them to submit feedback through Learn, but I know it's difficult to get through all of it.

slender iron
#

only 8 if you are outputting via shift register

#

you could do an odd number with a single PIO state machine doing similar

onyx hinge
#

the "bit transposition" code is very specific to working with a unit of 8 strips, in order to be efficient.

#

it has to take the first bit for each strip and pack it into 1 byte, etc

slender iron
#

right, I get what you are doing

#

I'd probably lean towards B, a bit manipulation library

#

time for me to eat lunch

onyx hinge
#

To do 16, aside from needing a different transposition code, you'd need to double the speed of the pio peripheral to ....83.2MHz?

idle owl
#

Do all Adafruit CircuitPython compatible microcontrollers have super specific PWM "slices" like the Pico does? As in are there usually conflicting pins where if you used a certain two pins it could be conflicting PWM? I'm not sure how to ask this question.

onyx hinge
#

@idle owl short answer is often they do.

idle owl
#

Hmm.

#

How do you know other than trying to use them and having them conflict?

onyx hinge
#

and, like unhappy families, they are each different in their arbitrary-seeming requirements

idle owl
#

We have that script that tells you which pins have PWM, but not if they're conflicting.

onyx hinge
#

you can go read a datasheet? which we like to do for fun, yes we do

idle owl
#

Oh.

#

Fair enough.

#

And is it true that if you have two things on conflicting PWM pins, and you send an instruction to one of them, it affects the other one too?

onyx hinge
#

But to be less flip, no, I don't think we've tried to docuement in a "regular people"-compatible way, the specifics of this; because it can be complicated.

onyx hinge
#

Generally speaking, the core should raise an exception if you ask for something the hardware can't do. There could always be bugs, of course.

idle owl
#

This book seems to indicate that it won't error, it'll simply send the same instruction to both pins.

onyx hinge
#

is that describing mp or cp?

idle owl
#

Presumably meaning an LED each on two conflicting pins, and you PWM one pin, it will affect both.

#

MP.

#

presumably

#

I thought it might be a hardware thing though

#

I wasn't attributing that concept to MP.

onyx hinge
#

If they have an example of that circumstance, you should adapt it to CP and try it. I think we would want it to throw an exception.

idle owl
#

I don't think they have an example. It was an explanation in the copy.

onyx hinge
#

for instance, if pins 99 and 53 both use PWM unit "sqrt(2)", then they have to agree on the frequency when they are created

idle owl
#

Says basically you'll know if you use conflicting PWM because it will affect both pins, and if that happens, check the pinout and try again.

#

I could try it, the pinout is in the book. I know two conflicting pins.

onyx hinge
#

0/1/16/17 are all tangled together for instance

idle owl
#

Right.

#

Quick hardware question, the ground rail on a breadboard is simply connected pins right? So I could use it to route an LED via a resistor? Or is there something special about the power and ground rails on breadboards other than connectivity?

onyx hinge
#
>>> q = pwmio.PWMOut(board.GP1, frequency=800)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: All timers for this pin are in use
>>> q = pwmio.PWMOut(board.GP1, frequency=400)
>>>```
idle owl
#

Kind of dumb question I guess. But still, question stands.

onyx hinge
#

so in CP if you ask for different frequencies, but the pins have to SHARE a frequency, it says "no"

idle owl
#

Good news! Alright

jaunty juniper
#

yes that's what it's there for, all pins connected on a rail

idle owl
#

That is way easier to explain than to say "read the datasheet!"

onyx hinge
#

Because GP0 and GP1 are on the same "PWM slice" 0 but different "PWM channels" 0A and 0B. If you use GP0 as PWM, you can't use GP16 as PWM even if they share frequency=, because they are the same "PWM channel" 0A. But yes, short story, CP tells you about this kind of limitation with an exception

idle owl
onyx hinge
#

@idle owl thanks for the other mention .. I fixed the typo

idle owl
onyx hinge
#

oh sure

idle owl
#

Thanks!

#

@onyx hinge But I'm reading this right that every pin can do PWM? but not at the same time obvs.

#

Wait. Put simply for the Pico, you can do PWM on one side of the board or the other, but not both at the same time if you want to be guaranteed to avoid conflicts. Not sure that's worth including in the guide though.

onyx hinge
#

@idle owl yes "All 30 GPIO pins on RP2040 can be used for PWM" though with CP you won't be able to do more than 16 simultaneously

idle owl
#

Right on. Thank you.

onyx hinge
#

(with MP or C++, you could sort of go past 16 but it's not clear whether that's useful)

#

(because some pairs of them would be exactly identical)

idle owl
#

(hmm yah)

onyx hinge
#

(actually ... no, wait, I don't want to go further into the weeds than we have)

idle owl
#

๐Ÿ˜„ Appreciated.

onyx hinge
#

(using a feature of the RP2040 chip that CP doesn't make available, I think you can cause the PWM output on pins 0 and 16 to be exact opposites which is useful to someone, somewhere. don't write that in the guide)

manic glacierBOT
onyx hinge
simple pulsar
manic glacierBOT
#

Why is there an underscore in the name?

I thought it might be appropriate to distinguish them from the Micropython battery of tests that are run automatically by run-tests. The rest of the tests in that folder are very uniform in style and purpose, and these are different enough that I thought it'd be worth prefixing them.

If anything we could do circuitpy-manual to mimic what we do in py.

Note, I added manual with my audiopwm changes that were merged in already.

#

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 future IDF releases.

Why not? I like the full path because that makes them easier to find. I dislike having super long include directory lists and include filenames that look like they come from the same place but don't.

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

tidal kiln
#

@idle owl hey. i'm about to start something that'll essentially be a data logger. been seeing your recent traffic on that, but haven't really followed it. just curious if anything has changed?

manic glacierBOT
idle owl
tidal kiln
#

yes please. i'll take a look.

idle owl
# tidal kiln yes please. i'll take a look.
tidal kiln
#

sounds like remounting in boot.py is still the only way to make it writeable?

idle owl
#

@tidal kiln As far as I know?

stuck elbow
#

@slender iron why do you keep both native_layer and original_layer in the group children?

tidal kiln
#

okie doke. cool. thanks for the links. yah....looks pretty much like i remember.

idle owl
#

@tidal kiln But you can do it like I linked where it requires a pin to be grounded or a button to be pressed (depending on what board you're using) at startup for it to data log. Or not. Up to you.

#

Yeah, it's pretty much the same.

manic glacierBOT
tidal kiln
#

right. so something physical must be setup for boot.py to read and act on.

manic glacierBOT
idle owl
#

Yeah. Otherwise, you can get out of a writeable state using the REPL and os.rename or os.remove on boot.py.

#

But a button makes it a little easier if it's a reasonable addition to your project.

manic glacierBOT
jaunty juniper
idle owl
#

Oh interesting. I guess I should have known you could reboot into safe mode using software, but I've never seen it done.

manic glacierBOT
tidal kiln
#

wondering if i could use nvm to maybe do this from user space....set a flag there, reset, read that in boot.py.....hmmmm

manic glacierBOT
#

This only works on even pins, the rest are left low judging by LEDs on a Cytron Maker Pi Pico I've been using:

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_c...
tidal kiln
#

you can!

#

here's boot.py:

import storage
from microcontroller import nvm

storage.remount("/", nvm[0])
#

and then in user code, can do something like:

>>> nvm[0] = False # or True
>>> microcontroller.reset()
idle owl
#

Fancy!

jaunty juniper
#

note that currently on the S2 nvm[0] will raise an exception if it was not set before

tidal kiln
#

like if you just did print nvm[0] without do anything else first?

jaunty juniper
tidal kiln
#

oof. thanks. good to know. luckily i'm using nrf52 for this particular project.

jaunty juniper
#

it's implemented with a key-value storage in the background but there is no way to probe the key it seems, so the only way is to try/except, which is less than ideal

tidal kiln
#

@idle owl anyway to check current fs state? other than trying to open and catching exception?

idle owl
manic glacierBOT
tidal kiln
#

@tulip sleet @solar whale just fwiw/fyi - still getting USB hard locks after upgrading to ubuntu 20.04 laser eyeball tiger cat

solar whale
#

I get them occasionally. Totally unpredictable.

tidal kiln
#

it seems to always be related to a soft reset

#

but as to when and why...???? yah totally random

idle owl
manic glacierBOT
#

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?

random will use the time you first call it to seed the pseudo-random number generation if urandom isn't provided. It should NOT be used for cryptography. This true in CPython as well: https://docs.python.org/3/library/random.html Anything that doesn't do cryptogr...

slender iron
manic glacierBOT
#

I totally agree we could do this better. I think our best option is to take in the filename instead of a file object. That would imply that OnDiskBitmap manages when the file is open.

There aren't great places to throw an error when a used file is closed because display updates happen in the background. In this example, we could have TileGrid raise an exception but you could always put it in the with statement as well and then expect it to continue to work.

So, I think taking in the f...

#

I think the simple route is your only route. The complex route risks not actually updating a portion of the screen because dirty areas only come from TileGrids IIRC. TileGrids need to know when they are hidden so they can provide the area where they were rendered last (but not where they are now.) hidden_by_parent is separate from hidden because the public hidden attribute is for the TileGrid only.

simple pulsar
#

@tidal kiln I've found holding down the button on the CLUE works well for enabled write access in boot.py

#

It's more useful than I thought because it means the data logging code doesn't start writing when I plug it into desktop to retrieve data. I append so it would be safe (in term of not losing data) but it's still more convenient for my case to have the writing be very explicitly enabled.

tidal kiln
#

thanks. yah, i might end up going that route also.

blissful pollen
#

@slender iron You were still planning to change PIO pin initialization correct? I (think) I figured out how to get the 8 pins for ParallelBus going, though to run an init program more then 1 instructions have to move the pio_sm_set_enabled to after the init instructions get ran. But if it's all going to change i'll just sit on this until then.

tidal kiln
#

this is something i'm wanting to be sort of plug-n-go and auto-magic. at least for my initial thinking.

slender iron
#

@blissful pollen ya, I'm planning on it

#

gonna just add a ton of initial_*_values as kwargs

#

with sensible defaults

blissful pollen
#

okay i'll sit on ParallelBus until after that, if that makes sense?

slender iron
#

sure, sorry about that!

#

I didn't quite forsee getting to PIO as part of I2S

blissful pollen
#

no problem, just wanted to make sure (and had meetings all CP meeting earlier today)

slender iron
#

np, always feel free to ping me to coordinate

#

I'm hoping to go heads down on it tomorrow

#

finishing up email now and then I'm making dinner tonight

manic glacierBOT
#

Buffering in the whole sector... then erasing it and writing might fix the bug but this is highly in-efficient and buffering in the whole sector is also causing a crash.

Yes, it is inefficient. It's also the only way to do it. Programming flash only sets 0s. It cannot change a 0 to a 1. Erases reset everything back to 1. So, you always need to erase and then program in the smallest erase block size.

Also, be aware that the SDK checks may only be active during a debug build. So if it's...

idle wharf
#

This sounds very cool Jeff... can't wait to see the demo !

onyx hinge
#

It doesn't "look" like much yet. ```code.py output:
?0100010-001000010-000100000-
-00100011-001000001-000000100-010100010-001000010-000100000-
(21, 45, 21, 13, 0, -200, 0)
-00100100-001000001-000000100-010100010-001000010-000100000-
(21, 45, 21, 14, 0, -200, 0)

The symbols 0, 1, - and ? appear, about 1 per second.  When 60 of them in a row "make sense" it prints the time: 2-digit year, day-of-year, hour and minute GMT, and some other information (about leap seconds and daylight saving time).  The time is the minute that _just ended_.
#

the receiver is very noise-sensitive so I have to test & debug it from a battery-powered laptop. I think 60Hz noise from the mains may be particularly able to interfere with the 60kHz radio signal.

blissful pollen
#

What are you using to receive it?

onyx hinge
#

Looking for an interesting display concept, but I also need to figure out the power issues

blissful pollen
#

Oh neat. I've received it on an RTLSDR. I wonder if ferrite beads on the cable would help but the antenna wire is pretty short

manic glacierBOT
#

Thanks for making this issue!

I believe board is the right way to approach this problem. It's meant to hold board-specific initialization in a cross-board way. Generally, there should be a standard name for an object that has an expected API. Currently most attributes are pins but we also have I2C, SPI, UART and DISPLAY already.

Let's take these one-by-one:

Buttons

This looks like we need a way define standard Gamepad objects with a standard pressed mask OR we need an async way...

stuck elbow
#

@slender iron but calculating the native type doesn't seem to be that expensive?

onyx hinge
#

My friend who has built several WWVB clocks just says to add filtering on the power input to the reciver until it works

blissful pollen
#

Makes sense. Radio always hurts my head when all the interference can come into play.

onyx hinge
manic glacierBOT
#

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

Nope! You can just put it in shared-module then.

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

Take a look in py/circuitpy-* files. There is a regular pattern to new modules there.

onyx hinge
#

@slender iron any name suggestions for this new function & its module for re-ordering the bits for piopixl8? I called the function bit_transpose and put it in _pixelbuf for testing but I don't think we want it in pixelbuf permanently.

slender iron
onyx hinge
#

.. it's tempting to see if we can get to 16. can the PIO divisor go all the way to "1"?

slender iron
#

@onyx hinge no immediate ideas. felt similar-ish to ulab to me

#

yes

onyx hinge
#

(16 strands)

slender iron
#

ya, I did a / 1 square wave of two instructions

#

dinner time for me

onyx hinge
#

see ya

stuck elbow
#

@slender iron ok, thanks, I will try with storing only the original type then and see how that works

slender iron
#

@onyx hinge you should support less than 8 inputs and just pad the byte with 0s

#

some folks will want to use it with fewer than 8

onyx hinge
#

@slender iron I can benchmark it but I think it will make the speed worse

slender iron
#

people will still want to do it

onyx hinge
#

I agree, but it'll hurt performance, or burn flash space

slender iron
#

we've got a ton of flash space on the rp2040

onyx hinge
#

adding 6 conditional branches to each byte handled

#

or adding 6 copies of the critical function

#

~200 bytes apiece, so +1 to 1.25kB?

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.

adafruit_bus_device was similarly python code moved to the core so that may help you see what for something similar. Feel free to ping me on discord too as someone who just recently did this from a newbie point of view.

slender iron
#

or making 6 extra buffers to get bytes from

#

I allocated 1MB for the CP flash space

#

for a reason ๐Ÿ™‚

onyx hinge
#

I'll consider your feature request ๐Ÿ™‚

slender iron
#

gotta give folks a path from 1 to 8

ornate breach
#

If youโ€™ve got the space split it in two ๐Ÿ˜‰

onyx hinge
#

I could do one optimized for 8, and one branchy for 2..7.

slender iron
#

sure

onyx hinge
#

it'll satisfy my peculiarities for optimization, but give flexibility, and only cost ~200 bytes

slender iron
#

๐Ÿ™‚

#

k, off for real. I've gotten the cat off my lap

onyx hinge
#

awwww but they were comfortable there

manic glacierBOT
#

This fix seems to change refresh behavior:

import time
import board
import supervisor
import microcontroller
from adafruit_magtag.magtag import MagTag


def show():
    for _ in range(0, 5):
        print(" ", _, "\r", end="")
        magtag.set_text(_)
        time.sleep(magtag.graphics.display.time_to_refresh + 1)
        magtag.graphics.display.refresh()


time.sleep(5)  # time to get serial console connected

magtag = MagTag()

magtag.add_text(
    text_position=...
manic glacierBOT
manic glacierBOT
simple pulsar
#

@onyx hinge Did you do the PWMAudioOut for RP2040? I've noticed it's a bit quiet on the Cytron Make Pi Pico's speaker - similar volume to CLUE which has a much smaller speaker and is driven in similar way.

onyx hinge
#

nope, it was scott

manic glacierBOT
simple pulsar
#

I'll try compressing it (the sound sample) a lot to see if that improves things. There's a huge difference between PWMOut square wave and square wave played over PWMAudioOut.

manic glacierBOT
manic glacierBOT
#

I slowed it down so I can see what's going on, GP0 flashes as expected, GP1 doesn't flash and appear low for this:

Adafruit CircuitPython 6.2.0-beta.2-18-g2a467f137 on 2021-02-15; Raspberry Pi Pico with rp2040
>>> import pwmio
>>> import board
>>> p0 = pwmio.PWMOut(board.GP0, frequency=2, duty_cycle=32768)
>>> p1 = pwmio.PWMOut(board.GP1, frequency=2, duty_cycle=32768)
>>> p0.duty_cycle
32768
>>> p1.duty_cycle
32768
tidal kiln
#

@simple pulsar i'm trying the hold button approach on CLUE for enabling write access. but it seems to go into bootloader mode when a button is held during reset. have you seen that behavior?

jaunty juniper
#

I believe that holding both buttons puts it in dfu mode, but that's different

tidal kiln
#

i'm doing just one. and either one does it.

idle owl
#

Does CircuitPython do something special with duty_cycle using pwmio on Pico? I wrote some simple code that uses a potentiometer to fade an LED, but it is not behaving like this MicroPython book seems to indicate it should be. Turning the pot fades the LED from off to bright, over the full rotation of the potentiometer. The book seems to make it sound like it should reach max brightness at 1024/65353 in the potentiometer rotation range unless I do something else to the code.

#

@slender iron Is this the expected result of using a pot with PWM to fade an LED? Or is there something weird going on...

#

Here is my code ```python
import board
import analogio
import pwmio

potentiometer = analogio.AnalogIn(board.GP26)
led = pwmio.PWMOut(board.GP14, frequency=5000)

while True:
led.duty_cycle = potentiometer.value```

slender iron
#

it should be over the full rotation

idle owl
#

Ok, so CP is doing the duty_u16 MicroPython thing in the background?

slender iron
#

I don't know what you are referring to

idle owl
#

Ok.

#

It's fine. I'll explain what I have.

slender iron
#

both duty_cycle and value are defined as 16 bit values in circuitpython

idle owl
#

Ok then yes is the answer to my question. Thank you.

idle owl
#

How do I determine a good frequency for PWM? There's an example using 5000 for fading an LED, but 1000 seems to work as well.

#

There must be a reason to it.

tidal kiln
#

in general, any freq above human perception is good

#

so you don't see the flicker

idle owl
#

Ah ok

tidal kiln
#

there can be secondary things as well, like electrical interference

#

or even auditory

#

i forget what the technical terms is for "the freq response of human eye", you'll see it come up in POV discussions. as i remember, it's pretty low

idle owl
#

Fair enough

tidal kiln
#

tv/movies for example are O(24-30)Hz

#

and if other sensors, like digital cameras, need to be considered, then that can up the threshold

jaunty juniper
#

you might want to avoid being too close or a multiple of a camera's frequency like 60fps, lest the picture flickers when filming

idle owl
#

Thanks @tidal kiln

tidal kiln
#

"why not just set it crazy high and forget about it?" <-- also a good question ๐Ÿ™‚

idle owl
#

Well? ๐Ÿ˜„

slender iron
#

too high and you'll lose resolution

idle owl
#

I mean, I went with 1k to match the book example. But still worth knowing. ๐Ÿ™‚

slender iron
#

ya, that'll be fine I think

idle owl
#

The code and hardware works anyway.

slender iron
#

its 125000000 / (2 ** 16) for the fast full resolution

idle owl
#

hmm. Fair enough.

tidal kiln
#
>>> 125000000 / (2 ** 16)
1907.3486328125
#

it's the 6 in the decimal that really matters ๐Ÿ™‚

#

but, yah, 1k better than 5k to get you the full res.

ionic elk
#

@tulip sleet I'm working with the Monsoon today and I just wanted to double check - I need to actually have two USB B cables in order to measure USB power draw? IE the monsoon itself can't provide power over USB. Is that right?

#

It seems like what the manual is implying but I'm not totally sure

manic glacierBOT
tulip sleet
#

so I used the binding posts

ionic elk
#

Oh, that's a good point. I didn't do that and was surprised it wasn't lower. I'll have to go back and re-measure my control.

tulip sleet
#

there is a dialog box to set what voltage is coming out of the binding posts

ionic elk
#

You just powered off the 3.3V pin, then?

#

on a feather/Saola?

tulip sleet
#

no, I sent it into the battery connector on the MagTag, using 3.7V

#

since the idea is to measure consumption with a battery

ionic elk
#

Sure, makes sense.

#

I'll see if I can dig up a JST I can use instead of trying to cram duponts or something in there

tulip sleet
#

be careful not to leave it connected if you power via USB temporarily, since you'll be backpowering the Monsoon from the Feather battery charging circuitry

#

Hopefully there's a protection diode, but I didn't check that.

#

The MagTag has no charging circuit, so it's not an issue

#

But Saola has no charger, is that right?

ionic elk
#

What does that mean, no charging circuit? On the magtag?

#

Saola doesn't, at least that I'm aware of. Nothing marked Vbat or that looks like an MCP

tulip sleet
#

The Feathers all have a LiPo battery charger on board that charges an attached battery if they are powered via USB. When there's no USB power then the charger is off.

#

The MagTag does not have that circuitry

#

That is a basic feature of Feathers

ionic elk
#

It doesn't? So it won't charge a Lipo when plugged in?

tulip sleet
#

I don't think so, but I'll check

ionic elk
#

I'm just surprised because I'm pretty sure I've charged my project devices on a Magtag

tulip sleet
#

oh, you're right!

ionic elk
#

Yeah it has an MCP738

#

I thought that'd be weird if it didn't

tulip sleet
#

I have a switched JST cable I was using between the Monsoon (or the PPK) and the battery connector

#

but I would hope both the PPK and Monsoon have protection

ionic elk
#

handy, did you make that yourself or do you happen to have a purchase link?

tulip sleet
#

The switch is weird, it is on when the button is up

#

that was confusing

#

I put some Dupont style connectors on the ends of some

manic glacierBOT
tidal kiln
#

for anyone wanting a one liner to convert image files to CP bitmaps:

convert foo.png +dither -colors N foo.bmp

seems to work nicely.

#

set N as low as possible to cover desired number of colors

lone axle
#

neat! I've never seen this convert command. I made a python script that uses PIL that does something similar, but there are so many other nice options built into this

jaunty juniper
#

it's imagemagick I believe

tidal kiln
#

yep. although i think i'm still getting slightly better results going through gimp.

vague latch
#

Hi all, just started with the raspberry pi pico, i am trying to do a series of asyncronous data collects and was trying to use asyncio in its micropython version. However i have since found libraries for the sensors im using in the circuit python github. Is there asyncio in circuitpython.

idle owl
#

@vague latch There is not. There may, however, be ways to do what you're trying to do without specifically using asyncio.

vague latch
#

thank you for your response. Do you have any examples on how this may be done instead.

#

Or is it in the pipelines to port asyncio to circuitpython

idle owl
#

I would need to first know what you're trying to do.

#

It's on our radar, but it's not a priority for the core devs at this time.

vague latch
#

I have a gps, bme280 (pressure, humidity..) and a bno055(IMU) i want to collect the data from each of these at a different sampling rate and parse them to the SD card

#

i was thinking asyncio would allow me to do a OS like event handler

idle owl
#

Ah ok. I might not be the best person to help you as my knowledge gets a little fuzzy in this area. I feel like you should be able to set each one up, and have a loop within a loop that uses something like time.monotonic() to poll at different rates... But I'm not certain.

#

It might do that, yeah.

vague latch
#

ok, ill have a look into that

idle owl
#

I am fairly certain it's possible to do what you're suggesting in CircuitPython. But I don't think I can make any helpful suggestions.

vague latch
#

ok, can you mix micropython and circuitpython at all in these systems

idle owl
#

No. They're not really compatible.

#

The code will always look really similar, but it won't work together.

vague latch
#

thanks for your help. ill look into time.monotonic or ill port the adafruit libraries to micropython

idle owl
#

You're welcome. Sorry I couldn't help more!

lone axle
vague latch
#

that looks interesting. thankyou @lone axle

vague latch
#

Another quick question. I searched for the better part of yesterday and couldn't find the answer and would suggest someone write a blog post on it if they are so inclined. I need to add libraries onto the circuitpython based raspberry pi. My mu editor isnt working properly so i began copying across the code using the file storage but would like a way where i can use pip to install the libraries straight onto the board. Further i would like to get someones github library and add it to the device like i would with python. ie pip3 install git+https://github.com/....

#

clarification raspberry pi pico

lone axle
#

@vague latch check out circup if you haven't seen it yet: https://github.com/adafruit/circup It's a CLI tool for installing circuitpython libraries on your devices. If you have experience with pip then the workflow of this will likely be familiar.

vague latch
#

That looks good. however i cant see an indication as to whether anything other then adafruit based libraries can be added, this will help with the other libraries that i was manually copying across. Im just thinking in regards to the tasko library is there a simple way to get this onto the board directly from git. I don't see any real way of doing. It is not a huge hassle to git clone then copy to lib folder.

idle wharf
vague latch
#

hmm i just had a thought, i can cd into the circuitpython location and git clone directly into the lib folder

slender iron
#

that will likely fill up your filesystem

idle wharf
#

You can pip install to a folder... let me lookup how that is done

vague latch
#

yeah, i could then remove the .git files and other stuff but it is slower

#

@slender iron what is the current best solution to put these libraries that are sourced from github onto the pico

slender iron
#

generally we expect you to download the bundle zip and copy libraries over

#

as you need them

#

circup is replacing that over time though

vague latch
#

yeah ok that sounds good

idle wharf
#

assuming the package is published (not all are)
pip install <PACKAGE_NAME> --target /Volumes/CIRCUITPY/lib

#

or your OS specific version of /Volumes/CIRCUITPY/lib

#

I'm on a Mac.

vague latch
#

interesting. These would need to have a setup.py file im assuming

idle wharf
#

But honestly 99.9% of the libraries are a single .py file... you can download onesie twosies

#

Ultimately, circup will do the magic

vague latch
#

yeah, i am looking at using this for multiple identical picos so was looking at automating some of the installation

#

but i definitely see that the majority of cases a single copy works

#

Do the .py files need to be at the top level of the lib folder or can they be in their own folders.

idle wharf
#

in /lib

lone axle
#

I would set up one master "image" one and then copy from that to a PC and then from there to all of the others. instead of direct install each lib on each device.

idle wharf
#

folder under /lib are for modules (libraries with many files)

vague latch
#

Thanks for your help all

manic glacierBOT
#

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 future IDF releases.

Why not? I like the full path because that makes them easier to find. I dislike having super long include directory lists and include filenames that look like they come from the same place but don't.

I found this very confusing as well. I would suggest the time might be right for having a philosophy (I'm shyin...

#

Since the datasheet cast some doubt on the strength of the "rosc_hw->randombit", I use the SHA256 hash function to create a high quality random seed from random values of uncertain entropy, as well as to generate a sequence of random values from that seed using SHA256 as a cryptographically-secure random number generator.

image

In practice, it produces over 100kB/s of random data whi...

vague latch
idle wharf
#

I just added that, glad you like it. ๐Ÿ™‚

tidal kiln
#

anyway to recover when both CP and PC see filesystem as readonly?

jaunty juniper
#

that sounds like it's corrupted

tidal kiln
#

could be. i've been going back and forth a lot. just hoping for something before i storage.erase

jaunty juniper
#

I would say try safe mode but you probably should erase anyway for safety

idle owl
prime flower
tidal kiln
#

there currently is no boot file

orchid basinBOT
vague latch
#

I can confirm that if you create a simple setup.py file which i checked through forking tasko. You can then do pip install git+https://github.com/qwertimer1/tasko.git --target /media/<user>/CIRCUITPY/lib and the library is saved into the lib folder with setuptools install working without an issue

vague latch
tidal kiln
#

stroage.erase fixed it

idle wharf
#

@tidal kiln I was surprised you ended up there, do you think it was from disconnecting from USB without ejecting or some other action?

tidal kiln
#

unknown. could be. i'm working on a data logging app. so there's lots of back and forth.

#

need to set write access to allow PC to push code update

#

then change to allow code to write

#

rinse, repeat

jaunty juniper
#

you could ampy put it should still work

gloomy shuttle
manic glacierBOT
#

I posted a question in the forum and they directed me here:
I just updated my UF2 file to 6.2.0 Beta 2 and tried the Internet Test from the Learn Guide
https://learn.adafruit.com/adafruit-metro-esp32-s2/circuitpython-internet-test
I get the out of sockets error running the Internet test:
`Fetching and parsing json from https://api.github.com/repos/adafruit/circuitpython
Traceback (most recent call last):
File "code.py", line 55, in <module>
File "adafruit_requests.py", line 598, in...

vague latch
#

anyone know how to completely wipe the storage for the pico. I tried the bootsel and re add circuitpython but all my files are still there. I have an 'OSError: [Errno 5] Input/output error' occuring, I am hoping i havent brcked the pico

manic glacierBOT
vague latch
slender iron
#

what I/O error are you getting?

vague latch
#

OSError: [Errno 5] Input/output error

#

it wont let me write to the circuitpython folder

slender iron
#

ah, ya sounds busted.

#

there is an example you can use. let me find it

vague latch
#

The repl still works

slender iron
#

hrm. I don't see a uf2 of nuke

#

(it's very weird to me that erase_filesystem doesn't work)

#

but it didn't work for me today either

vague latch
#

can we add erase filesystem and not reload circuit python

jaunty juniper
#

ah I was gonna ask: would a "erase flash UF2" be hard to make ?

vague latch
#

i was trying to find the library in the git repo but am still looking for it

slender iron
slender iron
#

right

vague latch
#

i was thinking you could just erase but not recreate the filesystem

slender iron
#

that's what it actually does. it just rewrites the FS data structures

vague latch
#

ok

slender iron
#

it's the same code that's run the first time when a filesystem isn't found

#

so it's weird that it doesn't work

manic glacierBOT
#

`import machine
import utime

C4 = 262
D4 = 294
E4 = 330

tone = [C4,D4,E4]

audio_left = machine.PWM(machine.Pin(18))
audio_right = machine.PWM(machine.Pin(19))

for i in tone:
audio_left.freq(i)
audio_right.freq(i)
audio_left.duty_u16(19660)
audio_right.duty_u16(19600) #30%
utime.sleep(0.15)
audio_left.duty_u16(0)
audio_right.duty_u16(0)
`

I can use change both GP18 and GP19 frequency in MicroPython. I can't do in in CircuitPython ?

#
import machine
import utime


C4  = 262
D4  = 294
E4  = 330

tone = [C4,D4,E4]

audio_left = machine.PWM(machine.Pin(18))
audio_right = machine.PWM(machine.Pin(19))

for i in tone:
    audio_left.freq(i)
    audio_right.freq(i)
    audio_left.duty_u16(19660)
    audio_right.duty_u16(19600) #30%
    utime.sleep(0.15)
    audio_left.duty_u16(0)
    audio_right.duty_u16(0)

I can change both frequecy for GP18 and GP19 in MicroPython. I can't do it in CircuitPython ?

manic glacierBOT
#

Hello guys i am working on a macro keyboard project on my pico and I cant figur eout how to get the Decouncer module.
i did download adafruit-circuitpython-debouncer-6.x-mpy-1.3.9.zip and palced the mpy file in the lib/adafruit_deboucner folder but i cant load the module.
Here is my script:
`# Imports
import time
import board
import usb_hid
import digitalio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_debouncer import Debouncer

...

manic glacierBOT
jaunty juniper
#

I'm gonna bookmark that nuke uf2

vague latch
#

yeah, very useful

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Implements a second CDC channel on boards where it is possible.

  • New module usb_cdc. usb_cdc.serials[0] is the REPL channel; usb_cdc.serials[1] is the new secondary channel. Both are pre-created instances of usb_cdc.Serial.
  • usb_cdc.Serial is more strictly like pyserial than the current stream implementation. New pyserial-compatibility flags added to enable this, for use with usb_cdc:
    • read() defaults to reading one character.
    • readinto() does not take a second...
manic glacierBOT
manic glacierBOT
glossy pecan
#

? Using Segger J-Link Edu Mini adapter to debug ESP32-S2 Saola 1R dev kit?
Kind folks, I have followed the instructions for setting up to build the CircuitPython binary for the ESP32-S2 Rover module on the Saola 1R dev kit, using my MacBook Pro "Big Sur". Great. Got a live REPL, etc., Thanks. Now I'd like to use my Segger J-Link Edu Mini to debug changes I want to make to the code. Has anyone succeeded in doing this? How? Using OpenOCD or J-Link Commander to control the adapter?
Note: This article describes how to do it for the J-Link "Edu" adapter, but says it doesn't work for the "mini" -- https://dzone.com/articles/eclipse-jtag-debugging-the-esp32-with-a-segger-j-l

dzone.com

In this article, we learn more about how to use a SEGGER J-Link with Eclipse and OpenOCD for JTAG debugging the ESP32, looking at an example project.

manic glacierBOT
#

@microDev1 and @skieast if you want to try ... I added you as contributors to my fork.
Scott suggested you could add my fork as a remote git remote add askpatrickw https://github.com/askpatrickw/circuitpython.git and then merge into my branch which is connected to this PR. At least I think so... ;-)

Whatever is easiest though.. I'm not concerned about it coming from my repo or this PR.

glossy pecan
#

? esp-idf version in CircuitPython repo?
While I'm asking questions, I note that the Espressif esp-idf code repo is included in the CircuitPython source repo. I presume this is to ensure some version control on which release of esp-idf is used. Anything else I'm missing here? Why not just check out a fixed tag from the general esp-idf repo, e..g., "Release 4.2"?

analog bridge
manic glacierBOT
#

I added a check to determine if a write procedure is a rewrite... if it is than an erase and sector write is done else page write.

Also, be aware that the SDK checks may only be active during a debug build. So if it's "working" with OPT, it may still break with DEBUG=1. Dave found an issue with my code this way.

ya... my usual workflow is doing debug builds while in development and a test with non-debug when performing commit.

#

@microDev1 and @skieast if you want to try ... I added you as contributors to my fork.
Scott suggested you could add my fork as a remote git remote add askpatrickw https://github.com/askpatrickw/circuitpython.git and then merge into my branch which is connected to this PR. At least I think so... ;-)

Whatever is easiest though.. I'm not concerned about it coming from my repo or this PR.

Always like to learn new things. I will look at merging my i2c changes. Will have t...

calm oar
#

I am trying to find a good use of my MagTag and thought of making a news headline viewer. Are there any rss feed parsing libraries that will work with circuitpython? This is the only one that I found -> https://github.com/kurtmckee/feedparser

manic glacierBOT
#

I'm trying to connect the raspberry pi PICO to the Raspberry Pi 4 and send data via Serial from the PICO to the Pi4.

Every example I see for Circuitpython uses either I2C or UART (i.e. using the pins on the board for Serial communication).

Is serial communication solely via USB possible? I want to only connect the Pico to the Pi4 with the USB cable and no other wires.

manic glacierBOT
manic glacierBOT
solar whale
#

Does anyone have a Fingerprint sensor ( not the R503)? It would be nice if someone could test this PR https://github.com/adafruit/Adafruit_CircuitPython_Fingerprint/pull/28 with a different sensor - I have tested it with the R503. The new example can run on a Raspberry Pi, not on an MCU.

manic glacierBOT
#

Yup! it is possible... take a look at #4215.

Awesome, good to hear. Unfortunately looks like it's pretty new? I'm a pretty basic user so much easier for me to follow a guide and adapt it to what I want to do...

Maybe there will eventually be some guides I can utilize! Thanks for the info.

Yes, it is pretty new (last night :slightly_smiling_face: ). I will be writing a guide soon.

#

from my experience, the ttyACM/COM numbering (0, 1) will swap around and could cause a bit of confusion

This has not happened to me (yet!): I tested on Linux, WIndows, and MacOS, and they were always assigned in sequential order.

I did have a problem in which I left pyserial running on ttyACM1, and then restarted the board. Then ttyACM0 and ttyACM2 were assigned. Then Linux got completely messed up and stopped assigning any new tty's, and I had to reboot. I attribute this to L...

#

I have a silly question. If I disable the REPL CDC, on my build , will the index of the other CDC change in usb_cdc.serials? It would be nice to be able to test my code with repl enabled first, and then disable it without having to change the code.

Do you mean you would set CIRCUITPY_REPL_USB = 0? (That's the new way of disabling CDC.) I'm not sure what would happen -- I don't think I considered that case. The indices are fixed, and len(cdc_usb.serials) is always 2 right now. It mi...

tulip sleet
#

this is more the dev channel (fine to ask here, but there are more user eyes in the other channel)

manic glacierBOT
#

from my experience, the ttyACM/COM numbering (0, 1) will swap around and could cause a bit of confusion

This has not happened to me (yet!): I tested on Linux, WIndows, and MacOS, and they were always assigned in sequential order.

I did have a problem in which I left pyserial running on ttyACM1, and then restarted the board. Then ttyACM0 and ttyACM2 were assigned. Then Linux got completely messed up and stopped assigning any new tty's, and I had to reboot. I attribu...

#

yeah, It will be good on testing, and then decide to confuse us when we want to do something more stable. Just kidding, in case of issue e.g with ACM0 it will come back as ACM2 then we have ACM1 & ACM2. It can stay like that, and thing can be confusing on our support for which ACM for REPL. But it is really minor to those who want dual CDCs. Just make sure we have some note to user :)

It would be nice to be able to identify the CDC channels by the string ID's:

$ lsusb -D /dev/bus/u...
onyx hinge
#

@tulip sleet could it be a dict with meaningful keys, 'repl' and '???' to avoid the problem with numbers vs com port numbers?

manic glacierBOT
tulip sleet
#

could be .serials with integers now, and add .serials_by_name now or later

onyx hinge
#

so nice to see a number of these bars nearly full!

#

we just got possibly the first weblate contributions in Italian, nice!

calm oar
manic glacierBOT
manic glacierBOT
#

Do you mean you would set CIRCUITPY_REPL_USB = 0? (That's the new way of disabling CDC.) I'm not sure what would happen -- I don't think I considered that case. The indices are fixed, and len(cdc_usb.serials) is always 2 right now. It might not even compile. So you want a serial connection but no REPL, is that right? I could probably make that work, maybe after this PR.

Yes, that's what I meant.

Is that because this will not otherwise work on SAMD21? You could disable MIDI and regai...

onyx hinge
#

.. but maybe monotonic_ns is? or maybe my test was wrong?

#
....................................................................................................
Neopixel show() 2.93066s, 34.122FPS, 32757.084370pixels/second
....................................................................................................
PioPixl8 show() 0.429688s, 232.727FPS, 223418.116570pixels/second
``` it seems to be working now, huh.
#

also speedup ahoy

manic glacierBOT
slender iron
#

@onyx hinge it should work because it's based on the single 64 bit timer I think

manic glacierBOT
tulip sleet
#

@slender iron I am working on the short I2C write issue on RP2040 by using bitbangio. Just about to test.

slender iron
#

thanks!

idle wharf
onyx hinge
#

@idle wharf good point -- I dunno if we've tweeted about weblate lately. There are share links right on the weblate page... dunno if it shows that image in particular though

idle wharf
manic glacierBOT
#

We want to speed up writing neopixels by nearly 8x on RP2040 by placing multiple strands in parallel and driving them with PIO. This needs a very specific bit rearrangement calculation which is too slow to do in Python but can be done very efficiently in C.

Testing performed: with work-in-progress adafruit_piopixl8 library, drove 2 to 8 strands of 30 real LEDs each; also stress tested the library by driving 25600 imaginary LEDs at a rate of about 240,000 pixels/second (theoretical ma...

#

Can we change the setup of sphinx so that it doesn't see "problems" like these when building in a clone which has been used to build an esp32s2 FW:

/home/jepler/src/circuitpython/ports/esp32s2/.idf_tools/tools/cmake/3.16.4/share/cmake-3.16/Help/command/file.rst:159: WARNING: Could not lex literal_block as "cmake". Highlighting skipped.

(and many others)

Possibly we could do this by having a whitelist of locations to use, instead of looking everywhere.

jaunty juniper
#

@tulip sleet I know pyserial can get this information on mac, is pyserial platform-independent enough ?

import serial.tools.list_ports
for port in serial.tools.list_ports.comports():
    print(port.device,port.interface)
/dev/cu.Bluetooth-Incoming-Port None
/dev/cu.usbmodem7CDFA100E6201 CircuitPython CDC data
tulip sleet
#

port.interface would do it! Thanks!

#

could you add a comment to the PR?

manic glacierBOT
jaunty juniper
#

I've been using a tool so I never have to look up serial ports for my boards, though it's mac/linux only because I had to use platform specific tools to identify which drive matches which board/serial port. https://github.com/Neradoc/discotool

#

(I need to add differentiating between serial ports now)

#

I whish to make it multiplatform and hopefully the methods used could be used to identify boards in Mu or other similar environments more reliably

tulip sleet
#

@slender iron ok, rathole commencing: bitbangio I2C not working well on RP2040, so that needs to be fixed first. Are there known time-keeping issues?

slender iron
#

ya, it's something I stubbed out but didn't exhaustively do

#

generally sleeps appear to be right to me

#

I wanted to get WFI working but had to punt on it

tulip sleet
#

so common_hal_mcu_delay_us() is probably not doing great: that's the basic timekeeping in bitbangio I2C.

#

i will do some testing and open issue(s) as appropriate

slender iron
#

I think it's based on the sdk

#

what does the saleae look like?

tulip sleet
#

haven't gotten there yet ; that's next. Just was trying a couple of simple sensors to make sure it worked, after TCS34725 still did not work,

slender iron
tulip sleet
#

looks like it's worth fixing but I have a higher prio BLE bug to fix as well. I thought I could knock off this I2C thing but it's not a one-hour fix. I will save what I have and come back to it.

slender iron
#

kk

#

I was hoping alex would fix but they must have gotten distracted

simple pulsar
manic glacierBOT
#

While trying to use bitbangio.I2C to fix #4204 and potentially #4082, I tried using bitbangio.I2C for short I2C writes. However, it wasn't working, and further trials showed bitbangio.I2C was just not working well.

Examples:

>>> import adafruit_tcs34725, board, busio, bitbangio, adafruit_lis3dh, sht31d
>>> i2c = bitbangio.I2C(board.GP1, board.GP0)
>>> l = adafruit_lis3dh.LIS3DH_I2C(i2c)
Traceback (most recent call last):
  File "", line 1, in 
  File "adafruit_lis3dh...
simple pulsar
#

Hello. What are the units for the frequency arg for rp2pio.StateMachine ?

manic glacierBOT
#

I think these are an artifact of the CPU or interrupts being blocked so the audio isn't filled in time.

Try providing a bytearray > 1k in size to WaveFile. It'll use the bytearray to buffer then. The larger it is, the more resilient to scheduling the playback will be. https://circuitpython.readthedocs.io/en/latest/shared-bindings/audiocore/index.html#audiocore.WaveFile

#

I've been experimenting with code derived from the demo code on https://github.com/adafruit/Adafruit_CircuitPython_PIOASM - what duty_cycle and frequency square wave is that supposed to create?

I've found that a frequency of 16 is faster than 1 but 64 is slower than 1. If I print sm.frequency it does show correct number. Is 1 supposed to execute at 1Hz? The units aren't documented at the moment in https://github.com/adafruit/circuitpython/blob/ae262cde55669c354fa2422097581b4ac4af...

simple pulsar
#

@tidal kiln Have you got ESP32S2 CLUE? https://www.youtube.com/watch?v=h_kmnOEpAYk&t=25m48s

We had a lot of time for making, hacking, and tronix this weekend. Fueled up with some tasty Chinese food, we tore apart a Mi Home-compatible BLE sensor and E-Ink clock, added 7-color ACeP E-Ink support to our Arduino library, tried out some SD-card-on-a-chip samples, and even started working on an ESP32-S2 WiFi CLUE board (our last CLUE was des...

โ–ถ Play video
tidal kiln
#

@simple pulsar not yet. i'm using the current nRF52840 one.

manic glacierBOT
#

I can change both frequecy for GP18 and GP19 in MicroPython. I can't do it in CircuitPython ?

No. frequency is dictated by the TOP value and clock divider which are shared for the two channels output from a PWM slice. CircuitPython prevents you from changing these values from a single output because it could lead to unexpectedly changing the frequency of the other channel. MicroPython doesn't check this for you. Therefore, in CircuitPython you need to use pins with separate slices for ea...

#

I've only had a quick look but I think the PIO PC wrapping functionality introduces no delay so the example code

squarewave = """
.program squarewave
    set pins 1 [1]  ; Drive pin high and then delay for one cycle
    set pins 0      ; Drive pin low
"""

would produce a 66.7% duty cycle rather than 50% which is probably what was intended. This was probably based on code that had an explicit jmp, cf https://github.com/raspberrypi/pico-examples/blob/master/pio/squarewave/...

ionic elk
#

How would people feel about a new "port_" prefix for functions that are implemented in the common-hal layer and used elsewhere in Circuitpython (like main, shared-bindings, and supervisor) but are not represented in the python API?

#

I've been feeling like it'd be nice to group them - Alarm has a lot of them, Microcontroller/Pin has a few, RTC probably has candidates too.

slender iron
#

I wouldn't do port_ because that implies to me that it's unique to a port

#

but maybe that's wrong. port_init and port_reset don't do that

ionic elk
#

I'm thinking stuff like alarm_enter_deep_sleep, reset_all_pins, and claim_pin, which have unique port level implementations, but don't have python equivalents

#

Maybe hal_? Since it's not the part that's "common" with python?

#

But I think the unique to a port part is what I'm going for? Maybe I'm misunderstanding you.

tulip sleet
#

@ionic elk something like internal_hal, maybe? I think the point of common_hal is that the same functions are provided by all ports: they're common across ports. I think common_hal routines would not HAVE to be called in service of implementing a python api. There is the old mp_hal name too

slender iron
manic glacierBOT
manic glacierBOT
ionic elk
#

@tulip sleet if we define common_hal as items that should be accessible across all ports, then that would apply to many of the contents of alarm, like alarm_enter_deep_sleep and alarm_woken_from_sleep. Would you be open to changing those to a common_hal prefix?

#

@slender iron yes, that issue should be resolved by my I2C PR.

#

back on the prefix thing, I originally brought it up because I was noticing a lot of alarm functions in main that weren't common-hal prefixed, and it reminded me of a similar issue I worked on last year with the pin claiming functions spread across displayio that didn't have a common prefix or API

ionic elk
#

@slender iron just merged it, I'd forgotten to check on the CI passing.

slender iron
#

ok, great!

manic glacierBOT
analog bridge
#

@slender iron can can you create a new branch for idf update so folks can easily collaborate

slender iron
#

is it not working to use patrick or bruce's?

analog bridge
tidal kiln
#

if one is using the pyportal in BLE mode, the pp lib can't really be used, correct? that seems sort of wifi specific.

manic glacierBOT
#

There are three cases:

  • timeout < 0 corresponds to timeout = None on the Python side. A timeout of None in pyserial waits indefinitely for the requested number of bytes. (But I should fix this so that we don't wait for more bytes than the buffer will ever hold - that's a bug.)
  • timeout == 0 returns whatever bytes are available, and returns immediately.
  • timeout > 0 waits for up to timeout seconds to try to get all the bytes requested. If the timeout expires, then return wh...
tidal kiln
#

@gilded cradle hey. you'd probably know. pyportal question ^^ got lost in scroll.

manic glacierBOT
gilded cradle
#

@tidal kiln, I believe that's correct. I haven't used bluetooth mode, but likely functionality just needs to be added and a firmware version check would need to be added.

tidal kiln
#

thanks!

gilded cradle
#

๐Ÿ‘

ionic elk
#

I have a git fu question: I've made changes to a bunch of files but haven't committed anything yet. I think I need to break out some of those file changes into a separate branch so it can go in before the others. What's the best way to do this? I'm thinking maybe git stash push -p all the stuff I don't want, then make new branch with the unstaged material, commit it, return to the original, merge the branch I just, then pop the stash so I can keep working. Is there a better way?

jaunty juniper
#

alternatively there's git add -i, leaving the unstaged changes in the files

simple pulsar
#

Does anyone have an example of PIO code for RP2040 doing PULL operations? I'm struggling to get this to work and write to the rp2pio.StateMachine seems to lock up the code - cntrl-c can't interrupt it.

idle wharf
#

I have a question about https://github.com/adafruit/actions-ci-circuitpython-libs
I see this being pulled in when the build action runs for libraries and circup. But when I. look through it, it looks like (and I might be wrong) that all this is now covered by the cookiecutter and github actions in general.
If that's true, can we remove it from the cookiecutter (and thus libraries)? It would speed up the builds a bit.

onyx hinge
#

@slender iron if you have an idea what to call the module for driving the neopixels with shift register & pio, let me know -- I know you didn't dig the piopxl8 name for reasons...

#

.. I'll read back later, just remembered we didn't get to it on the stream (like that was gonna happen)

ornate breach
#

@onyx hinge shiftymate <โ€” name for your module LOL

#

Or pixelmate

#

Or shiftypixel

manic glacierBOT
slender iron
onyx hinge
#

I also saw un-ctrl-c'able during PIO operations when I had bad code -- didn't debug it. It had to do with trying to shift in or out in the program when there wasn't an in/out buffer provided @simple pulsar @slender iron

#

the code's supposed to permit ctrl-c

#

I'd concentrate on debugging (by print statement if necessary) the two different places in the core that StateMachine write (and soon readinto and write_readinto) try to wait for keyboard interrupts

#
            RUN_BACKGROUND_TASKS;
            if (mp_hal_is_interrupted()) {...```
tulip sleet
#

@onyx hinge I'm trying to track down a ulab issue. Are you still up?

tulip sleet
manic glacierBOT
glossy pecan
#

@tulip sleet Pinging you because of an earlier msg of yours. Have you (or anyone you know) gotten Segger J-Link EDU Mini adapter working with ESP32 or ESP32-S2?

wise wigeon
#

Hello and thank you for maintaining this awesome library! I am currently working on a project where extreme power-efficiency is important. I bought the nRF52840 to see if it was fit for my project, and as I've always been a fan of Micropython, I was excited to see that you support this chip. My question is: how far along is the nRF52840 port of the alarm library, is it even being worked on? I see that it currently only supports ESP32-S2, but I could not find anyone working on the port to nRF52840.
The nRF52840 currently goes in to soft sleep on timeouts, but so far there is no interpretation of sd_power_system_off() - is that correctly understood?

onyx hinge
tulip sleet
#

thanks - I pinged you before I looked more closely. It's really a question for Zoltan. I just got on and haven't seen if he's replied yet.

tulip sleet
tulip sleet
manic glacierBOT
onyx hinge
#

@glossy pecan When I have needed to use a debugger with ESP32-S2 I've used the Kaluga development board which has a built-in debugger that works with openocd and is well documented by Espressif how to start & use the debugger. In principle the j-link hardware works but you still have to use (esp-idf's version of) openocd. I just updated this guide page https://learn.adafruit.com/adafruit-metro-esp32-s2/debugging-with-openocd because it gave the wrong "gdb" program name to use (it didn't call for the "esp32s2" version). When you run the wrong gdb, it can sort-of work sometimes, and I suspect that was related to my problems...

#

I had been meaning to go back and check whether I'd made that error so thanks for causing me to actually do thta

manic glacierBOT
onyx hinge
#

@tulip sleet I suggested a (partial) fix for the buffer bug, it should allow any 1D arrays to be converted to buffers but not 2D arrays.

tulip sleet
#

@onyx hinge thanks. Since there is no ndarray_get_buffer() in the 2.x code, does it work completely differently?

manic glacierBOT
ornate breach
#

Hey @tulip sleet what do you use for your Linux dev environment? Iโ€™m going to be setting up a nice little Linux dev server after I move ๐Ÿ™‚

tulip sleet
#

Hi - are you asking about hw or sw? I use Ubuntu 20.04. I use the cinnamon desktop.

ornate breach
#

Sw

#

Ah okay

tulip sleet
#

desktop is a personal choice. I like the thin taskbar on cinnamon. I'm not that fond of unity. Never really tried kde for any length of time

#

taskbar. i have two monitors

ornate breach
#

Makes sense. I was basically going to set up a server and use a cheaper mini desktop to virtualize on in my office

tulip sleet
#

what kind of server?

ornate breach
#

Maybe centOS or debian

#

Then serve an Ubuntu VM on it

tulip sleet
#

I am just using an old Intel i5 4-core processor and 16gb, with ssd's. But i have a 6-core i7-9500t arriving in a day or two. Both of these are used Dell Optiplex desktops.

#

scott has a hefty zillion-core AMD, but i am not going to spend that much

#

there is always a coupon, or just wait a week or two

ornate breach
#

Haha, yeah I might go AMD but Iโ€™m also considering a r240 from Dell

#

They have one for $500 right now

tulip sleet
#

do you have other uses for a server? do you need a home media server or something like that?

ornate breach
#

It will manage NAS storage and whatnot

#

Iโ€™ll be upgrading my Netgear readyNAS 2 bay NAS to a rack mounted NAS

tulip sleet
#

i have been going for single used machines instead: tv computer, development desktop, another desktop for Windows testing, another leftover tiny one for Windows Insider Preview testing, etc. I was tired of managing VM's

onyx hinge
#

For building CircuitPythonโ€”that is, repeatedly building one particular firmware.elfโ€”having a zillion cores doesn't help that much.

#

(I use Debian & xfce but I don't necessarily recommend it)

manic glacierBOT
tulip sleet
#

this "new" machine I am getting is 6 cores 12 threads, tshould maybe be twice as fast.

#

it is micro-form-factor, but the speed penalty is only about 10%

manic glacierBOT
tulip sleet
#

i used debian for a long time but I like the up-to-date-ness of ubuntu

ornate breach
#

Iโ€™m also going to probably host a website or two. Iโ€™m not sure yet. Itโ€™s more to play around with, get better setting up and developing in Linux and creating an isolated development environment away from my regular computer

#

Iโ€™m probably going to load a docker container on it to to manage my 3D printers

#

Plus circuitpython development will happen there

onyx hinge
#

Throwing 16 threads at the build process only speeds it up by less than 4x...

tulip sleet
#

make sure the remote desktop setup you proposes works well for remote USB. I am sticking to native so I can see USB problems for what they are, instead of being confused by VM USB issues

#

does the remote desktop sw you are using do remote usb?

ornate breach
#

Iโ€™ve not chosen Remote Desktop software yet, Iโ€™ve used VMware Horizon Client

#

But Iโ€™m not sure if it supports native USB

tulip sleet
#

so plugging/unplugging boards, using J-Link etc. might be problematic

ornate breach
#

Potentially

#

Maybe Iโ€™ll set up CI on the server that I can fetch on my desktop

#

Like a local git server or something

manic glacierBOT
#

There may be an issue -- the gps.update is faiong in _read_sentence here:

    def _read_sentence(self):
        # Parse any NMEA sentence that is available.
        # pylint: disable=len-as-condition
        # This needs to be refactored when it can be tested.

        # Only continue if we have at least 32 bytes in the input buffer
        print(self.in_waiting)        
        if self.in_waiting < 32:
            return None

self.in_waiting seems to be 1 all the time

#

There may be an issue -- the gps.update is faiong in _read_sentence here:

    def _read_sentence(self):
        # Parse any NMEA sentence that is available.
        # pylint: disable=len-as-condition
        # This needs to be refactored when it can be tested.

        # Only continue if we have at least 32 bytes in the input buffer
        print(self.in_waiting)        
        if self.in_waiting < 32:
            return None

self.in_waiting seems to be 1 all the time

tulip sleet
#

i haven't really had the need for that kind of thing. Usually I just push to github at least every day for backup reasons, and when I'm ready for a PR, I rely on GitHub to do the big CI. But if you are doing other dev tasks too, that could be handy.

onyx hinge
#

It's a good idea to have some kind of backup plan for any data you're working with. Anything that backs up your user files will work to back up your working files & local (non-pushed) git changes. but pushing regularly to a remote system like github is also not a bad idea, because it means you have different independent kinds of back-ups.

ornate breach
#

Yeah, thatโ€™s the thought

#

Iโ€™m just mostly looking to brush up understanding and learn more stuff related to developing software and devops things.

ebon ingot
#

Hi! I was directed here by @slender iron, as I'm in the process of adding definitions for Pimoroni RP2040 boards. I've got them written and compiling, and am looking to create a draft PR for review. The only issue is, as we already have a fork of Micropython, Github won't let us create fork of Circuitpython too. I could fork to my personal account, but that will become problematic when several of the team wish to contribute.

Scott mentioned something to me about "adding pimoroni/micropython as a remote to push to" but I'm a bit of a beginner when it comes to Git so have no clue what that actually means ๐Ÿ˜† . Any help with this would be greatly appreciated

tulip sleet
analog bridge
#

@ebon ingot you can create a new branch from CircuitPython & MicroPython break-point (i.e. before Jan 1 2017) and then pull in the changes from adafruit/circuitpython...

fossil gorge
ebon ingot
#

Thanks for the suggestions @tulip sleet & @analog bridge . No idea how to do either of them, so any guides you could point me too that would step me through the process would be welcome

tulip sleet
#

@ebon ingot I think this is going to be painful for anyone else trying to do PR's to circuitpython in your organization. You might consider creating a new organization to hold a new fork. I know that's not great. You could segregate all circuitpython dev there (e.g. also CPy libraries), and then it begins to make more sense

#

I wish github handled this better

#

i will do a little research

analog bridge
#
git checkout -b branchname 0ae344841
git pull https://github.com/adafruit/circuitpython.git
#

@ebon ingot ๐Ÿ‘† and you are good to go

ebon ingot
#

And that's to be applied to a clone of our micropython repo, yes?

analog bridge
#

I'd suggest doing another clone as the change is too big and switching branches would be cumbersome

git clone https://github.com/micropython/micropython.git circuitpython
ebon ingot
#

Okay, thanks. I'll give that a try

tulip sleet
#

@analog bridge so @ebon ingot and colleagues will need to repeat git checkout branchname; git pull https://github.com/adafruit/circuitpython.git in each new clone, right?

#

where branchname is circuitpython-dev or similar

#

whatever it was called the first time

#

(and that branch should be pushed at some point)

#

@ebon ingot Also be careful when you submit a PR that it's against adafruit/circuitpython and not micropython/micropython, which can be embarassing (I've done that by accident a couple of times).

analog bridge
onyx hinge
#

to do circuitpython work, why don't you suggest making the initial clone be of adafruit/circuitpython, @analog bridge ?

analog bridge
onyx hinge
#

I see.

analog bridge
onyx hinge
#

Git accommodates a lot of different workflows; I typically start by cloning where I eventually will pull-request to, so that origin/main or origin/master refers to the place I want to start branches. I add my own fork with git remote add jepler .... Starting new work is git fetch origin; git checkout -b project-name origin/main (or origin/master). Pushing it (first time) is git push --set-upstream jepler HEAD and subsequently is git push. Creating a PR is visiting the intended repository and going through the steps manually to create a PR from my repo to the intended repo. Take that all for what it's worth.

tulip sleet
#

the base problem is that they already forked micropython in their org, so they can't fork circuitpython also, maybe your workflow accomodates that. I always clone my own dhalbert/circuitpython, because it contains my un-PR'd branches, etc.

analog bridge
ebon ingot
analog bridge
#

yep... pimoroni/micropython it is

ebon ingot
#

Hmm okay. Well it shouts at me when trying the checkout line


fatal: '0ae344841' is not a commit and a branch 'circuitpython-dev' cannot be created from it
analog bridge
#

hmm... let me give you an older commit.... how about a081b49d

ebon ingot
#

That worked

ornate breach
manic glacierBOT
#

Thanks! @ladyada and @jerryneedell for the extensive testing... ๐Ÿ‘

is there potentially an issue with this not returning the correct value for bytes in the uart?

Seems like uart_is_writable can only return if data is available or not and not the actual number of bytes.

/*! \brief Determine whether data is waiting in the RX FIFO
 *  \ingroup hardware_uart
 *
 * \param uart UART instance. \ref uart0 or \ref uart1
 * \return 0 if no data available, otherwise the number of by...
ebon ingot
ionic elk
#

@tulip sleet would it become more difficult for us to merge from Micropython if Circuitpython became a non-fork repo?

analog bridge
tulip sleet
manic glacierBOT
ebon ingot
#

fatal: unable to access 'https://github.com/pimoroni/micropython.git/': The requested URL returned error: 403

analog bridge
#

this is for the new clone?

ebon ingot
#

Yes

analog bridge
#

you can make branch upstream and then modify it locally and force push

ebon ingot
#

How would I do that first part?

#

Did I mention I'm new to Git ๐Ÿ˜†

analog bridge
ebon ingot
#

Ah yes, good idea

manic glacierBOT
manic glacierBOT
#

I'm not sure if it's device specific or not, just tried on my Metro ESP32-S2 and wasnt able to replicate either..

Could you attach a logger to MiniMQTT so I can see what's going on? The logging library is here: https://github.com/adafruit/Adafruit_CircuitPython_Logging

to do this - add these lines after the mqtt_client initialization in your code:

import adafruit_logging as logging
mqtt_client.enable_logger(logging,logging.DEBUG)

Then, please re-run your code and copy/p...

#

Connecting to Adafruit IO...
905.876: DEBUG - Attempting to establish MQTT connection...
Traceback (most recent call last):
File "code.py", line 81, in <module>
File "adafruit_minimqtt/adafruit_minimqtt.py", line 467, in connect
File "adafruit_minimqtt/adafruit_minimqtt.py", line 263, in _get_socket
TypeError: can't convert str to int

Code done running.

Error is consistent with both the adafruit example (as run in this instance) and my own code.

wise wigeon
tulip sleet
#

@wise wigeon You'll need to reimplement ports/esp32/common-hal/alarm for nrf. I am not sure if TouchAlarm makes sense for nrf, so that might be omitted. Note the discussion of light sleep and deep sleep in the documentation and the Sleep Learn Guide. We initially thought that light sleep on the esp32-s2 would preserve enough state that we could use the ESP light sleep, but it turns out even its light sleep shuts down a lot of things.

#

The nrf52 chips have excellent power-down capabilities, and you may be able to keep more things on at a low power draw. It may not be necessary to switch to system OFF to achieve very low draw.

orchid basinBOT
wise wigeon
tulip sleet
#

yes, I was surprised by that, but they've done an excellent job in power reduction.

wise wigeon
tulip sleet
#

and thank you for working on this!

simple pulsar
ionic elk
#

@tulip sleet quick couple of questions for you:

  1. is common-hal/alarm/pin/__init__.c an obsolete leftover?
  2. it references alarmio, is there a particular reason why we didn't go with that name? I kind of prefer it to alarm, since there's a lot of included IO with the pin interrupts and adjustments to other parts of the processor.
#

@wise wigeon I am currently implementing alarm for STM32 so I'd be able to help/provide reference for NRF once that's done.

tulip sleet
#
  1. yes, that is junk; the routines there are not used elsewhere.
#
  1. I thought for a while about alarm vs alarmio, and liked alarm better, because some of its functionality is not io, like sleep alarms
orchid basinBOT
ionic elk
#

Also, was esp_sleep_pd_config not useful in narrowing the domains that ESP32S2 shuts down in light sleep? The docs make reference to it as a way to change the behavior of the RTC

tulip sleet
#

i don't think we are going to change it now, since it's in stable releases. Originally it was sleepio, but I thought we might have alarms not realted to sleep later

#

esp_sleep_pd_config I think might be called one or two places. the ESP-IDF already calls it properly in several places to do the right thing depending on what's enabled

#

there is discussion with igrr about that in some of the PR's or issues

ionic elk
tulip sleet
#

primarily, light sleep turns off wifi, and that's not just pd_config.

ionic elk
#

Turning off wifi is a big issue?

tulip sleet
#

it changes wifi state, it doesn't just suspend things

ionic elk
#

hmm. Is that irrecoverable?

tulip sleet
#

yeah, it loses state

#

you'd have to re-establish connections, etc

ionic elk
#

That's not such a big deal, though, is it? As long as it's clear upfront. If you have a program that sleeps for 1 hour, your connections are probably borked anyway.

tulip sleet
#

yeah, but light sleep otherwise doesn't save that much power, so you may as well just time.sleep()

ionic elk
#

Ah, yeah if it doesn't save anything that makes sense. I'm surprised it doesn't though, if it shuts all this stuff down.

simple pulsar
#

@ionic elk It would be polite/efficient to close the connections if you know you're going to sleep for that long unless they are to a private resource.

ionic elk
#

I'm trying to figure out parallels to the STM32, since ST chips have three states, not two: Sleep, Stop and Standby. Standby is the closest to deep sleep, Sleep is the ideal version of Light Sleep (some savings with no state loss) and Stop is kinda in between

#

@simple pulsar I'm simply wondering if light sleep should actually handle a clean Wifi shutdown automatically, and warn users of that in the docs.

#

I'm just speculating though, it doesn't sound like it's priority since the light sleep doesn't save much anyway

tulip sleet
#

we wanted the semantics of alarm.sleep_until_alarms() not to turn things off. It also resets the pins

#

my light-sleep measurements at the time (no longer in the guide), showed it drew about 1.5mA

#

so ... maybe losing the pin state was also a big lose

#

if you are going to lose all that, you may as well just deep sleep and restart

ionic elk
#

But right now light sleep doesn't actually do anything at all, right?

tulip sleet
#

it just does WFI, it's like time.sleep()

#

on the nrf you can do a lot better

#

with a light sleep; you can preserve all the pin state and the RAM and still just draw microamps

#

the ESP32-S2 is just not a good model for light sleep that preserves state

simple pulsar
orchid basinBOT
#

Hi Melissa,

Sorry about that, I was wondering what was allowed for features but I hadn't seen that page. Thanks for the link.
I was also wondering about how strict "Feather-Compatible" is. It has an unusual board outline and doesn't support battery charging, but it's definitely intended to be used with the Feather ecosystem.

I also changed the copy to have a "Learn More" section since the board is not for sale yet.

marble hornet
#

@tulip sleet can I bounce a quick question off you regarding the nrf52840 board config? it looks like there are two conflicting BOARD_HAS_ definitions.

tulip sleet
#

sure

orchid basinBOT
marble hornet
#

what's the difference between BOARD_HAS_32KHZ_XTAL and BOARD_HAS_CRYSTAL.
EX: I dead bugged an nrf module and found that adding a 32.768 khz crystal makes the _bleio module importable.

tulip sleet
#

nrf likes to have both a 32kHz crystal and a something-MHz crystal (32, I think, but I'd have to look)

tulip sleet
#

without one of those, you don't have accurate enough timing for BLE.

#

The CPB is unusual and has only one crystal, I think. Let me look.

#

yeah, it only has the 32MHz crystal. Most have both, for more accurate timekeeping, I think, when the CPU clock is off

#

Long ago I wanted to rename BOARD_HAS_CRYSTAL to something more specific for nrf, but didn't get around to it yet.

#

in CPB's mpconfigboard.h:

// Board does not have a 32kHz crystal. It does have a 32MHz crystal.
#define BOARD_HAS_32KHZ_XTAL (0)
turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

58

Voice Channels

6

Members

27582

Roles

34

marble hornet
#

thank you @tulip sleet ! Ah, I thought (assumed) crystal referred to the 32khz. the watch now has BT! it's the last known bug! switch BOARD_HAS_CRYSTAL on and BOARD_HAS_32KHZ_XTAL off.

tulip sleet
#

great! yes, it's confusing, I spent a while with schematics. The nrf modules often don't mention they have an internal crystal, so I was pretty confused for a while

marble hornet
#

would it be acceptable to propose a change from BOARD_HAS_CRYSTAL to BOARD_HAS_MAIN_CRYSTAL or BOARD_HAS_32MHZ_CRYSTAL in a pr?

tulip sleet
marble hornet
#

gladly! i'm leaning towards MHZ over MAIN solely because it draws attention to the units, thoughts or input?