#circuitpython-dev
1 messages Β· Page 367 of 1
Yeah what Mark said, I don't think the schematic numbers matter
Probably to keep the RP2040 pins in order on the breakout board (for PIO)
if it's any consolation that might have been the mistake I just made too
I looked at the AD part I think and mixed them up
The "AD" vs "A" was what caught me up.
Yeah that.
Ok. So what I put in the guide is correct, even though it didn't feel right.
Thanks @blissful pollen and @ionic elk!
np good sanity check
no problem!
@kevinjwalters - Can you build from my branch at https://github.com/DavePutz/circuitpython/tree/issue_4602 and see if the fix I put in takes care of your issue? Please let me know; if your test is OK I'll open a PR.
@tannewt I completely understand that Adafruit has limited resources and has to make the best use of them to support business & community goals. I think Adafruit is a great example of a well-run tech company. It's the reason that I buy products from you whenever I can.
@gilded cradle I see the new funhouse guide. It has come up several times that with a new board, it is necessary to do an erase_flash with esptool before loading the CP .bin file. I donβt know if that is also necessary for loading the .uf2 boot loader .bin, but I was surprised that it was not included in the esptool part of the guide.
Oh snap, the BOOT button on the QT Py is available to CircuitPython on board.BUTTON. I was entirely unaware of this. Is it like that on all the RP2040 boards, I wonder.
@idle owl no, not on all of them
Ok so I didn't miss something obvious.
I think if you look at the schematic you'll see two connections to the switch
the place it's normally hooked up is not readable as a DigitalInOut
Hmm ok
I was going to look at the guide for the schematic, hmmm π
Haha, yeah about that.
I'm currently carefully going through the digital pins making sure that I get them right. Because RP2040 and a million functions per pin.
I do not see the thing I think is there for Qt Py RP2040 on the Feather RP2040
so "somehow" the extra diode D2 and the extra connection USBBOOT (GPIO21) enable the switch to be read from software
the feather and the pico don't have that, they just have the 1k resistor
Ok
I'd have to think about how it works to explain it but I think the best thing to look for is just that extra connection from the reset button (which will always go to QSPI_CS) to another GPIO
or just having the USBBOOT listed in pins.c
D2 stops the USBBOOT pin from interfering with QSPI_CS if it has its pull-up enabled (or if it's set to a high output, which is not useful)
Fair enough
It's a bit hand-wavy but I don't think you are really invested in understanding it?
I'll take hand-wavy when it makes sense π
So it wants a pull up?
That was unclear, worked in code with both
I think you should suggest treating it like a normal button, set pin to have pull-up, and it's pressed when .value is false
The microcontroller is changing QSPI_CS between high and low whenever it wants
thinks
You're best off giving the same instructions as for other buttons, even if other instructions might work
no need to deviate from the usual
you must be careful not to press it when resetting obviously (or you go bootloader mode) but that doesn't really impact how you use it as a generic button
@tulip sleet I have another NRF error I'm very confused by - I'm trying to exclude the simmel and PCA boards that fail from Alarm, and I'm getting the following:
```circuitpython/ports/nrf/../../supervisor/shared/safe_mode.c:64: undefined reference to `sleepmem_wakeup_event'
but this file doesn't have anything like that on line 64, in fact it doesn't reference that keyword anywhere in the file
@ionic elk locally or in CI?
locally
if locally I'd "make clean" to see if it makes a difference. otherwise, is some macro expanding to refer to sleepmem_wakeup_event?
I'm giving make clean a shot - it appeared even in a clean build, but it was alongside other errors which I've since fixed, so maybe it's getting confused about file boundaries, or something?
@tulip sleet What do we do with an nRF that isn't showing up on Windows as CIRCUITPY, but the bootloader is? Feather Sense.
There are no macros that expand to user set values in that line, and no macros are ever set to sleepmem_wakeup_event anyway
I don't see an eraser file for it, and I'm not sure if they can get to the REPL.
hmm, weird, I seem to have solved it, there was another instance of sleepmem_wakeup_event in port.c that the compiler didn't catch, and apparently thought was in this totally separate file?
@ionic elk next guess, the reference is inside a function that is inlined by the code at safe_mode.c:64
Arduino works, so they didn't destroy the board.
Thanks, I see you mean on the CircuitPython page. On the Install UF2 bootloader page (https://learn.adafruit.com/adafruit-funhouse/install-uf2-bootloader) I have erasing before programming. With UF2 it's not necessary to do that, only .bin. I can add an alert to that page though.
@onyx hinge I dunno, it would have needed to really mangle that file to get it in there
LTO is very wizardly, and its results can be weird
Well whatever it's gone now.
even wierd
just guessing, but if you check out this simple program you can see that gcc misdiagnoses the location where the missing function f is called for the error message: https://godbolt.org/z/zKK8f188Y
extern int g(void);
int f(void) {
g();
}
int main(void) {
f();
}
/tmp/ccpon7VG.ltrans0.ltrans.o: In function `main':
<source>:4: undefined reference to `g'
It may still feel mysterious, but I'm guessing it might be something like this that happened in your case, just more complicated
@idle owl there's a CLUE flash erase, it might work for the feather ?
I'm not sure π
There's a Circuit Playground Bluefruit one too. I don't know though.
Better if they can get to the REPL.
Nevermind. π€¦ They were loading the wrong build. Still, curious what we would have done if that hadn't been the issue.
we need a checklist, like phone tech support that always asks if it's plugged in first
like, if somebody mentions that they loaded a UF2, ask for the name of the file first
@gilded cradle thanks! As long as it works as explained in the guide it should be fine.
That'll be the first thing I ask moving forward. But that's how this goes. You do things a certain way until you run into something and then you assimilate that into how you do things. π
is tab detection/replacement more of a precommit thing or an uncrustify thing?
Where did we land on adding board.I2C1 to the QT Py RP2040?
I just observed a SAMD21 board with the uf2 bootloader fail to start - it was as if the bootloader + firmware had been erased. Has anyone seen anything like this?
looks like the first page of flash got nuked. π
Changes:
- Small corrections,
- Adding examples requirements in the design guide
- SI units corrections and clarifications.
- Using
:const:and Defaults to in class documentation. - Building reference change.
@kattni As discussed. First set of changes. Thank you.
@fossil gorge Thank you π
Ahhh I think I know what's happened.
The bootloader never sets BOOTPROT unless either all the fuses are bogus or if you update the bootloader with a uf2 file.
We don't change the default fuses during factory setup, so they're valid but no BOOTPROT.
and we just flash the .bin file for the bootloader so it never self-updates and never sets the fuse.
π€―
Alright, I'm gonna make my firmware set bootprot correctly.
@ivory yew we had a batch of metro m4s go out that way
were you running circuitpython?
Nah, Castor & Pollux has its own firmware.
interesting! that means it happens in other code too
I don't think we've seen any of this with Big Honking Button, which does use CircuitPython
I always assumed it was a CP bug somewhere
I'll have to double check that, though.
I'm going to write some code tonight to check and set fuses first thing in Castor & Pollux's firmware and then subject one to an obnoxious amount of power cycles and see if it dies again.
π
Do you think it makes sense for the bootloader to do that, too? As in always check & fix bootprot if needed.
I don't think it'd add much more space, the logic is there it just needs to be called in main() in addition to selfmain
it looks like the RP2040 only supports 1 address in i2c peripheral mode (unlike the SAMD21). is it preferable to change the setup input function to only take an INT instead of an array of INTs, or leave the function inputs the same and only pick off the first address to use?
it also looks like it needs a baudrate, which currently isn't an i2c_peripheral input
@misty garnet I think it's preferable to maintain the same interface, you can raise a ValueError if the list contains more than one element.
ValueError("Only one I2C address is supported on this hardware")
Hmm, it should at least support the read/write variant of the same address.
sounds good, but the lack of a frequency input variable is a bit trickier
I'd assume 400 kHz
In peripheral mode, the controller should be driving the SCL line
That's why the SAMD implementation doesn't require a frequency
Looks like on the RP2040 you shouldn't need to set a frequency in peripheral mode.
section 4.3.14 of the RP2040 datasheet says
It is not necessary to program any of the *CNT registers if the DW_apb_i2c is enabled to operate only as an I2C [peripheral], since these registers are used only to determine the SCL timing requirements for operation as an I2C [controller]
yeah, not sure how the C++ SDK interacts with the hardware registers. It looks like you need to do this:
uint i2c_init (i2c_inst_t *i2c, uint baudrate)
followed by:
void i2c_set_slave_mode (i2c_inst_t *i2c, bool slave, uint8_t addr)
so maybe the first init command can just take a dummy baudrate that it subsequently ignores
yeah, that's what I would guess.
@slender iron setting the BOOTPROT fuse seems to do it. π
I've been power cycling it like ^
Looking at my old code, I think you have to float the old pins too (set as input). I've included some relevant parts below. Please try this and let me know if you still encounter an error. I can clean up what I have (was messily written during a hackathon) and just post the whole thing as a demo. I'd also suggest blowing on the sensor as a means to test it, I found it was the lowest effort method to produce a lot of apparent noise (turbulence).
` from adafruit_pybadger impor...
@ivory yew the Adafruit factory testers set BOOTPROT when they do the initial bootloader loading. We never changed the microsoft code to always set BOOTPROT, maybe because someone might actually want to undo it for some reason. However, it appears that the Arduino SAMD21 bootloader does always set BOOTPROT: https://github.com/arduino/ArduinoCore-samd/blob/4a64bfe45d24e70eb300ce42c92e1c127c02add3/bootloaders/mzero/Bootloader_D21/src/main.c#L262
where is the change you made? I don't see a recent commit in https://github.com/wntrblm/Castor_and_Pollux/releases/tag/2021.04.20
@tulip sleet that's useful info. Here's the change I made: https://github.com/wntrblm/Castor_and_Pollux/commit/52c89d5b0348edfe2b15d6bd32819fb6b33f21e9
I'm probably going to update our factory scripts to set bootprot as well
oh, you just hadn't pushed yet!
(it's just needlessly tricky to do that with a JLink script π )
I'll ask Limor about this, but we have had very few SAMD21 boards brick themselves; with SAMD51 it happened a LOT more
I hadn't seen it at all with Big Honking Button, which uses the same samd21 as Castor & Pollux.
I mean we can discuss loosening the check for bad BOOTPROT
I only put in the current fuse fixer because people had a tendency to erase the entire chip, including the fuses, with various Segger tools, etc.
the underlying problem of the lowest section of unprotected flash being erased is still weird, and I didn't know SAMD21 was susceptible to this under harsher conditions
Yeah, idk. there's a lot more stuff going on with Castor & Pollux's board, so it's possible the voltage rise is a bit slower than other boards.
glad you figured it out, and sorry for the bootloader not being as robust as it might have been
oh nah, it's fine. The fact that it exists is great.
I'm gonna take a look at VDDCORE's rise with my oscilloscope tomorrow.
like i said, we could certainly add a bit of brownout checking for SAMD21 too. I don't know what TinyUF2 does.
good night!
thank you. π
moving here from #help-with-circuitpython because it seems like a dev topic, i have an issue with udp with the esp32spi module, details are here https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/issues/135 but TL;DR is it doesnt clear the write buffer for udp sockets between socket_write()s. I have a couple solutions proposed there but Im not really sure which I should actually turn into a patch because one option is a patch to esp32spi and the other is a patch to nina-fw which are separate projects
Hi @tannewt,
Thanks for all you do on this. I've been watching your streams lately, and really appreciate your efforts.
That said, I do have a bit of a complaint about the response above...
While I can certainly understand a "we don't support this modality of things because of resource limitations on the platform" (a paraphrased restatement of what I think you're fundamentally trying to say), I find "I'm not personally a fan of the REPL" (direct quote) to be rather dismissive, and r...
Let's wait for some feedback from our NINA-FW maintainers. An ESP32SPI fix has the advantage of working with current firmware. In the long run if the semantics of NINA-FW are inadequate, that should be fixed too. The ESP32SPI fix should work with an unfixed and a fixed NINA-FW. This might also be brought up in the upstream repo: https://github.com/arduino/nina-fw. I don't see any dicussion there about this, but there could have been discussion elsewhere (e.g. in the Arduino forums).
@lindes Thank you for your comments. We are very resource-constrained on the CPX, and have to balance stack size vs heap size. Does this still fail with 6.x? We turned on using a heap-based stack frames for Python.
@tannewt I know this is old, but I also use import test kind of things when doing some iterations. There are sometimes reasons why I don't want to use code.py (for instance, I need to start a clean Saleae trace before importing), but instead import manually from the REPL. If...
@ivory yew @errant grail Both of you have boards in circuitpython that change the USB_INTERFACE_NAME away from "CircuitPython" to your own prefix. This means that the USB interface names change, from, say "CircuitPython CDC control" to, say, "Sol CDC Control".
Recently I submitted a PR (which was merged) to the Mu editor to detect CircuitPython boards by matching the USB interface name. It assumes a "CircuitPython CDC" prefix. So your boards would not be detected as CircuitPython by Mu due to this change.
Is this significant to your user base? I'm trying to decide what to do about this. The actual check is not in Mu itself, but is here: https://github.com/adafruit/Adafruit_Board_Toolkit/blob/main/adafruit_board_toolkit/circuitpython_serial.py, in a library I wrote for Mu to use.
(The Mu PR also handles secondary CDC channels, which was the main motivation for it.)
we could change these interface strings going forward so they are more general (e.g. "<something> CircuitPython CDC"). I need them to be backward compatible as well.
I can update the board toolkit library to detect your boards for now.
Crap, yeah, it'll definitely impact folks using Sol
For us, we really just need to change the name of the MIDI endpoint descriptor so that it's easier to differentiate Sol's MIDI output from others.
The user never really sees the CDC name, so I'm personally fine with that always being "CircuitPython".
that sounds ok, or I can change the library to match against "Sol" as well. There is this "unbranding" effort going on for boards that aren't in the adafruit/circuitpython tree, so that enters into this too.
I think the easiest fix for now is to add "Sol" and "StringCarM0Ex" to Adafruit_Board_Toolkit as alternate prefixes, and then just submit a small PR to Mu to bump the required version of Adafruit_Board_Toolkit. This is all in a beta of Mu right now anyway, so this is the kind of thing to shake out. I did not realize you had changed the prefix until this morning when I was owrking on some code for dynamic USB descriptors.
yay str.startswith() can take a tuple of prefixes
@tulip sleet huh I never knew! ```python
"abc".startswith(('x', 'y', 'b'))
False
"abc".startswith(('x', 'y', 'a'))
True
i thought I would need a regex
doesn't work in circuitpython, just desktop python
that's ok, this is in the adafruit_board_toolkit library, which is desktop only
I'll take all the regex you don't use
i am good at regex but it's harder to read
yeah the problem with regex is the second person who has to work with it
(I switched to a regex for identifying the repl in my tool a few days ago, I wanted to add "IGNORECASE" and other changes without having to lookup every point of use in my code)
Currently there is a USB_INTERFACE_NAME make macro that is normally set to "CircuitPython". But a few boards change this, currently to either "Sol" or "StringCarM0Ex".
USB_INTERFACE_NAME is currently used as a prefix when constructing USB interface names, so we have, for instance, "CircuitPython CDC control". I just started using this prefix in https://github.com/adafruit/Adafruit_Board_Toolkit/blob/main/adafruit_board_toolkit/circuitpython_serial.py to identify CircuitPython boa...
@onyx hinge Woohoo! the ov7670_simpletest works great!!!
@solar whale awesome! I always hold my breath when someone else is testing my code for the first time
I was shocked that my first test of the Arduino code worked...nice work -- let me know if there are specific things you want testd
https://gist.github.com/jepler/d1b0315ae3eb68f8d9b24dda8aa02e65 is super messy but it shows how to hook it in to displayio with the 1.8" TFT shield
Thanks -- I'll try modifying it for my display -- 2.4 featherwing
@idle owl Thank yo kattni https://circuitpython.org/contributing/library-infrastructure-issues
@still zephyr Thank you for noticing we hadn't updated it π
π
@still zephyr Much of what's on there requires internal credentials, so you're aware. It initially had a lot of things that other folks could fix, but, well, folks fixed them. π So now it's mostly keeping track of stuff for us. If you find something you can fix, great! But don't feel bad if you can't deal with some of it.
Always feel free to ping me with questions though about what something means or how it could be resolved.
@onyx hinge oops -- I don't have the si5351 clock generator ... yet any hope without it?
@solar whale sure is -- that was just debugging code for me
ah - I see it is disabled ...
ov.size = OV7670_SIZE_DIV4
ov.flip_x = False
ov.flip_y = True
g = displayio.Group()
bitmap = displayio.Bitmap(160, 120, 65536)
tg = displayio.TileGrid(bitmap, pixel_shader=displayio.ColorConverter(input_colorspace=displayio.Colorspace.RGB565_SWAPPED))
g.append(tg)
display.show(g)
buf = memoryview(bitmap)
display.auto_refresh=False
while True:
ov.capture(bitmap)
bitmap.dirty()
display.refresh(minimum_frames_per_second=0)
print(end=".")
after you create your camera you just need to do something like this .. most of the rest is just junk
after you have it working, I'm VERY curious what happens if you change your OV7670 constructor to ask for mclk_frequency=24_000_000. BEWARE, it may cause your board to crash hard at start, so you'll need to be able to get to safe-mode by reset button to fix it (unplugging the camera module might prevent the crash too). 24MHz works on Arduino but gave me problems in CP.
like the comment says, frequency_16m = True # Somewhere between 16MHz and 24MHz, ghosts haunt me
OK -- will give that a try after I get something working.
@onyx hinge Ok so, this? (I'm still fuzzy on what the pull should be) ```python
import board
import digitalio
import neopixel
pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
button = digitalio.DigitalInOut(board.BUTTON)
button.switch_to_input(pull=digitalio.Pull.UP)
while True:
if not button.value:
pixel.fill((255, 0, 0))
else:
pixel.fill(0)```
(It works.)
shows red when button is pressed, dark otherwise? Is the same as you'd do for some other standard button? check and check
Yes. Though I thought whether you pull up or down is based on whether you attach the button to gnd or 3.3v on a regular button.
So I get confused with ones that I don't hook up myself.
But it does turn red when pressed and off otherwise.
Thanks π
@onyx hinge so far, the code runs, but it is not displaying -- I probably have something set up wrong for the ILI9341 -- I'll let you know when I get it going.
@solar whale okay -- it would be good to add a displayio simpletest!
@onyx hinge Progress. Iβm getting 8 copies of the image, but itβs an image!!
@solar whale that's odd!
Pieces of 8!
likely my setup -- I'm a displayio newbie...
I should write up a proper test program, but each one will be specific to its display...
I'm getting faster at modifying the cameras now, this is #4. Seems to work well to push the VCC/GND pins up but not remove them, so that they become top-side headers. Carefully solder the SCL resistor to VCC flush with the PCB, then solder the SDA resistor to the SCL resistor's VCC side. I don't have my phone or I'd take a photo of what I mean..
@tulip sleet I have one final failure on the NRF52 sleep PR - French isn't fitting, even though basically all the new additions are turned off. Only a 36 byte difference.
Should I try cutting something? Or dig around for byte savings?
or, wait, I guess it's 484 bytes locally
For EN, it's 1948 bytes free. Is it normal for fr translations to differ by over ~2.5kb like that?
short answer, yeah, translations can be a lot bigger than the original
I just made some message changes to be shorter and the FR bytes went up
I guess this isn't my ballpark π¬
can I turn off AESIO for the Simmel? It's the one thing holding this PR back
no. it was explicitly added for that board
@onyx hinge I changed OV7670_SIZE_DIV4 to DIV2 for the 320x240 display but I now get an error ```
Adafruit CircuitPython 7.0.0-alpha.1-113-g46c9b1bc3 on 2021-04-21; Adafruit Grand Central M4 Express with samd51p20
import ov7670_displayio
note: mclk frequency = 17142857
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ov7670_displayio.py", line 41, in <module>
File "adafruit_ov7670.py", line 640, in size
File "adafruit_ov7670.py", line 779, in _frame_control
File "adafruit_ov7670.py", line 723, in _write_register
OverflowError: value must fit in 1 byte(s)
do I have to change more than that one line setting the Divisor?
interesting -- I probably haven't tried DIV2 (or DIV1)
probably it's a bug, mind filing an issue?
sure -- will do.
thank you!
I understand,π , I fix some, and there are others that I understand could not be. There are some examples directories that have directories insides, so I guess the algorithm goes crazy there. just a theory...
But the pylint ones I could work on those right?
Actually, that was something I was thinking maybe you could help. I don't know how comfortable you are with the Adabot script, but since we can't really rename the directories because they're already well-used in guides, we can make the script handle the directories better.
I could help yes, I will take a look,
Great!
Perfect. I will want to discuss how I want Adabot to handle directories, so working on the Pylint ones for now is a great plan.
Adabot is indeed tricky.
Thanks Kattni
You're welcome!
@idle owl - There's a PR in Display_Shapes that needs review here. Is it possible for me to get "reviewer" authority for this library? https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes/pull/36
I requested
But you reviewed kmatch?
@ionic elk is it being compiled -Os?
No problem , I will contact you, I want to do the pylint first because I see some folks doing PR failing not because of their PR but just because other stuff( you know murphy's law). Not sure how long those would take, but next week I have free time so we could work on that
I am going to add you to the CircuitPythonLibrarians team, but there's an extra step that has to happen on our end first. I'll let you know when you're added.
Next week is perfect - I typically only work Monday-Wednesday so this is the typical end of my week. (I'm working Friday to handle the newsletter but that won't be for much longer.)
Good I am free on monday and tuesday
@tulip sleet weirdly, Os is larger again. I keep removing things and the builds get bigger, I don't understand it
Only thing that works is removing whole modules, and I don't know what's safe to exclude
Make sure you do a clean in between
Yeah, did that
It is FULL_BUILD so maybe there's some other stuff we can scrap? HID mouse and keyboard, maybe?
I don't know the use case for this board, but maybe
so the failures are in the nrf 52 sleep PR?
Excellent. Plan on Tuesday, or possibly In the Weeds on Monday, but Mondays are still newsletter days for me, so my Mondays are full up. Tuesday will work for sure.
cool Tuesday it is. π
@ionic elk simple, just set SUPEROPT_GC = 0, and see if that's enough. If not do SUPEROPT_VM = 0 also
@tulip sleet yes, even though I've turned the actual Alarm module off for the board, and it also doesn't have Jun2Sak's debug stuff enabled. I think the board itself is this: https://simmel.betrusted.io/, which is an enclosed device for contact tracing, so I think we could actually safely get rid of quite a lot of stuff, even things like PulseIO, since there's no practical way they would be implementable on it
@tulip sleet while keeping Os?
yes, then don't bother with shorter messages and all that, that's a pain
yes, the SUPEROPT things override the normal optimization flags for certain modules
Should I keep Os for the whole port? Probably not right? I can add a new flag for extra size optimization on small boards.
no, keep that flag
just keep ditching more modules: usb_hid, pulseio, pwmio, countio, etc.
Won't it reduce performance across some boards that might like it?
not having O2 turned on I mean
no, i mean this in the mpconfigboard.mk file for that board:
# Override optimization to keep binary small
OPTIMIZATION_FLAGS = -Os
keep that
i am just suggesting changes to mpconfigboard.mk
Oh, I can override it. I didn't notice the ?= my bad
turn off synt
Yeah I'll give that a shot. So far none of the option based stuff has done anything, is that weird?
bitbanio, pulseio, pwmio, synthio, usb_hid, turn all those off. Leave the rest
yes, it's weird, you need to clean each time and then do make BOARD=simmel TRANSLATION=fr
make sure make clean BOARD=simmel. A general make clean does not clean that board
That's what I've been doing: make BOARD=simmel TRANSLATION=fr clean, and V=1 on the builds to make sure the files are being rebuilt. Maybe there's just nothing that can be optimized for this particular build?
Anyway I'm sure removing the modules will fix it, it's not that much memory
what options were you changing before removing modules?
Build Os, SUPEROPT_GC, SUPEROPT_VM
it's possible the SUPEROPT's are done wrong and are being overriden. Don't worry about it. Just put back the non-module stuff and ditch a few more modules
Built Os actually increased the flash size, and the other two didn't do anything
yeah no problem, I just wanted to ask about these other options, it's good to know about
they definitely make a difference on atmel-samd, but the nrf makefile might be constructed a little differently
making a note that a) they exist but b) might not be working right
Want me to remove all the modules you mentioned to get extra space, or just enough to have it build?
some of them are pointless on the board, go ahead and remove them
they probably have their own fork anyway
yeah synthio, pulseio and countio are plenty, and probably would have been hard to use on it anyway, so that's a good enough fix for now. Thanks for the help!
Now I just gotta figure out what on earth Jun2Sak did to the main sleep loop
Thank you.
Not sure why I had review capability on that. Maybe because you requested it?
Oh and on that PR itβs ok if someone else reviews. It was their first PR so I was helping them through the process and wanted to make sure they get feedback relatively promptly. It may even be better if someone else reviews rathe than me.
I really appreciate you getting back to them quickly. It's totally ok for you to review it as well. Hopefully I'll have you added today, but I need something from Limor first, and she's in meetings. So hopefully it gets done today. Either way, you can comment-review, and someone else can merge if you feel it's ready.
Thanks for the heads-up @tulip sleet. For the StringCar M0 Express' entire known user base (I know each them personally and can count them on one hand), the interface name is unimportant. Compatibility with mu is fundamentally needed for support, so I'm completely okay with reverting to a default CircuitPython interface name.
that PR is a fix for now, so I think it should be OK. In the long run we will do something more generic, I think.
Super. Thank you.
If anyone has a moment, https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/1518
Thank you for catching that @tulip sleet. It was in the template example as well copied from when I wrote the quick code to see if the button even worked on the QT Py.
it works, for sure, I myself, was just, "wait a minute", why does 0 work?
Yah. Hilariously, I'm pretty sure I learned that trick from you.
@onyx hinge progress. Now have one image. See issue for my workaround.
You look stoic.
THis is one of those cases where the code is running an I am hanging on -- not sure if I have any idea what it is doing...
Actually - I have learned a lot by testing this. Thanks for the opportunity Jeff!
@onyx hinge I tried the 24MHz setting and it did lock up the board. Since I'm not running it as code.py, a few resets brought it back...
@solar whale OK, I'm glad it's not just me. The Arduino code uses 24MHz, so it must be something about CircuitPython -- but what....? a puzzler.
one of many...
@idle owl I can't think of a particular reason to show microcontroller temperature via REPL and not code.py
As long as the REPL is being introduced in one way or another
Very much so, earlier in any guide that would include this page.
Thanks for the feedback.
@tulip sleet thanks for the pointer on the BOD33, I've added that to Castor & Pollux's firmware and that seems to work really well.
@idle owl thanks for making the learn system better& more consistent
Thanks. That's what I'm trying to do. Heh.
Intentionally limiting the current to starve the voltage and watching it wait patiently for me to increase the current limit is :chef's kiss:
the spi flash chips also don't work so well at low voltage. I think we may have seen some problems on that as well
I have 5 units powered by my bench supply and I'm just absolutely ruining their lives.
Thankfully no SPI flash for Castor & Pollux.
@onyx hinge From my perspective, this OV7670 capability is a fantastic addition. Thanks for all the work on it. It will be a lot of fun to have.
But yeah, this is definitely due to the combination of missing bootprot and the voltage not being stable enough before the processor tries to run at 48MHz.
Keeping it at 1 MHz until VDD stabilizes is the ticket.
even with bootprot, we were seeing the next flash page after the bootloader being FFFFFFF'd when the voltage was too low. This was just destroying people's programs, fortunately not brickingthe board.
oof, but yeah, at least that's recoverable.
@mental nexus Invite sent. Welcome to the review team!
it took several PR's to nail this all down.
Having my customers ship their module back to me to fix 256 bytes makes me sad.
i know... our testers failed to set bootprot on some early SAMD51 boards, and that combined with this glitch meant we replaced a number of early boards
yike
Hehe setting my bench supply to just under the inrush current and watching the fixed boards patiently wait for their caps to charge while the unfixed ones run ahead to their death.
that situation is depressingly common in the eurorack world. People stuff a bunch of power hungry modules into a cheap power supply and that spells disaster quickly.
kudos on being a responsible mfr π
well I feel dumb for not catching this before I shipped 100 of them, but yeah lol
I'm also publishing our stress test results in the user guides:
you are building a real consumer product ; this is great
"We don't recommend it, but you're not going to blow out your board if you accidentally:"
I am more nervous about the environment that my eurorack modules will be in than the environment that Perseverance is in.
I imagine it can be more volatile than the environment that Perseverance is in π
"Hi yes, my module isn't working correctly. It's in a rack with 32 other modules, some of which are literally just some random leaves I shoved into the case #aesthetics. The power supply is a rusty 9v battery that I wired up through my cat."
Wow this RP2040 runs hot. Anyone else have a QT Py RP2040?
I'm seriously going to have to change the wording on this page to not mention ambient temperature. Because I think it's misleading at this point. The iMX ran super hot as well.
yes -- want me to try something?
Yeah - run this: ```python
import time
import microcontroller
while True:
print(microcontroller.cpu.temperature)
time.sleep(0.15)
And tell me what you get.
And if it's not as hot as mine, let it run for a bit and then tell me what you have. Because this has been running code all day.
36.9
Do you want to try it on any others RP2040s? I have a feather and pico by me
Huh ok. Mine's at ~40.
letting it run a bit
Even 36 is up there.
sitting around 36
Beyond ambient air temperature.
If you want to check a Feather, that would be nice. I have one but not next to me.
yes -- its about 22 in here
Ok, so scrub the wording. Noted.
This is why you test your code before publishing your guide pages, folks.
I've never found the cpu temperature to be close to ambient.
Hmm. The text surrounding it until now implies it's close. I am finding it not to be.
asi t runs, it is getting hotter -- >37 now
Ok. Good to know.
Just started the feather, hanging about 30. Just as reference Pico is showing 17 but its slowly creeping up
Hmm.
Must be cold in your room!
Well that's still a majority that are coming in hot. And this page is meant to go in every guide.
Any idea if it varies based on the intensity of the code or anything like that?
It should!
certainly does on something like Pi4
its around 20, that's why I wonder about the pico shows cooler
Maybe its upside down π
Holding it wrong π
just got to 38...
i'll let them sit here running for a while to see
Thanks @solar whale and @blissful pollen. I appreciate the help!
Glad to help!
No problem, they're both slowly creeping still. Feather is just shy of 32 now. No clue why the pico is colder then my room maybe something else going on
Yeah it is a bit odd.
Updated Mu, and it went through the initial install sequence and the animated snake checking its watch made me laugh out loud. I love it! @plucky flint
Odd, the latest version of Mu, I can't make the window as small as it used to let me. Wonder what the reasoning was for that.
Oh well. Wider screenshots. π€·ββοΈ
Or they won't include the entire window. Also valid option.
πhmmm... not sure about window size thing. A couple of contributors have been working on the UI. Glad you like the splash screen. Mu (and coding) is all about having fun.
Playful=good
It was so on point. You're stuck waiting for a bit, and the snake is right there with you.
I'll file an issue then if it wasn't a deliberate design decision.
I know, but I try to avoid whinging about things that were added for a reason π
Anyway, cheers! Mu keeps getting better and better.
Thank you... and it's important to note that Mu only improves because folks whinge at us... (Where whinge = constructive criticism). π
π
Valid!
Also, Steve and I (Steve does the snake logos), spent WAY too much time perfecting that splash screen. There's more of that vein coming too.
Well done you and Steve, then!
π
Sanity check. This is the proper maths for Fahrenheit, correct? microcontroller.cpu.temperature * (9 / 5) + 32
Seems right.
Yeah think that's right (as I tried well known values to verify with a calculator π )
I guess if I wanted to be stricter, I could (microcontroller.cpu.temperature * (9 / 5)) + 32 but given that multiplication/division happen first regardless, it is unnecessary.
Hehe thanks!
This is a weird one, but both @jerryneedell and I have seen it.
If an OV7670-style camera is plugged into the Grand Central M4, and a 24MHz PWM signal is generated on pin D29, then "weird stuffβ’" happens. This causes a crash or hard-fault during camera initialization (before the new ParallelImageCapture object is even instantiated), and occasionally things that look like non-fatal memory corruption. If the PWM signal is slower (nominal 16MHz, actually 17.mumble MHz) then things are OK.
...
Tested this on the Feather NRF52840 across real/fake light/deep sleep types, and it works well across all modes. The only functional issue it has is not retaining a system tick across deep sleep, which causes the USB enumeration delay to occur every time it tries to deep sleep, but that's only a minor power loss with longer sleep periods and likely solvable with a follow up issue.
There are also a couple of stylistic things that could still be changed - `common_hal_alarm_pretending_deep_s...
Note that this required a few final edits, including some formatting changes and a couple of module exclusions to make the new code fit on existing small NRF boards like the Simmel. I've also reverted the changes to main - the existing sleep loop is already capable of detecting a fake sleep wakeup, and changing it to an on-the-spot return breaks the ESP32-S2 and STM32 builds of Alarm.
@tulip sleet wrapped up final fixes and testing for the NRF52 Alarm. There's still a little bit of sweeping up to do but if it's ok I'd rather circle back to that later so we can get STM32 and the changed ESP32S2 internals in.
sure, that sounds fine; we can wait also for jun2sak's comments on your final changes
I didn't edit much of their code other than reverting the changes to main. I'm not sure if it was maybe the new changes that I merged in, or just a misunderstanding from the start, but they do a lot of wakeup reason detection in the common_hal_alarm_pretending_deep_sleep that shouldn't be necessary. I just deleted the stuff in main, and sleep works exactly the same in testing.
there was a motivation for that initially, but I don't remember exactly. There might be hints in the previous comments.
I know the general reason for common_hal_alarm_pretending_deep_sleep is that a system reset on exiting the VM returns pins to a state that's unable to detect wakeups, which is the same for STM32
ah but once that was removed, then it was unnecessary; yes, that might be it
But my hunch is that the stuff detecting non-alarm wakeups is just an oversight that main.c does the same thing. The flow is a little weird so I wouldn't blame them
yes, the flow is quite weird - the odd use of an exception ,etc
originally this pr was only deep sleep, I believe
common_hal_alarm_pretending_deep_sleep is still there, I just got rid of the stuff that returns after it, because main.c will do that automatically after the loop cycles around
this sounds fine, especially since you've tested it. Are you blocked if it's not merged? I though we'd just wait overnight on this, since jun2sak is in Japan.
I'm fine to wait overnight that's no problem, I'm doing RP2040 stuff. I'm just feeling the pileup a little bit - we have this, then STM, then the internal API, then RP2040...
For instance, I'm not comfortable fixing parts of this PR, like simplifying common_hal_alarm_pretending_deep_sleep to match STM32, until the #4606 changes are in
I'd rather just get NRF and STM in, and then we can clean everything up in one big push in #4606
that sounds fine; tomorrow let's merge even if we don't have feedback. I will take a last look also.
great, ty
@idle owl I verified two libraries that showed as failed pylint checks in the infraestructure issues, Imageload and requests, and both passed when I run pre-commit locally π€
Hmm. And you're running the same version of Pylint as the remote pre-commit?
π³ good point. I ll verify that
That's the first thing that pops into my head is that the Pylint versions are different. Because Pylint added things etc.
No guarantees I'm right.
I just do the same as alwawys. clone, and it creates ethe .env, install dependencies
So I need to verify the version
Ok
I will inform you next Monday π
Sounds good π
What the..... π€― Setting auto_write=False isn't necessary for the rainbow cycle to work. I....... seriously thought it was.
deletes a couple of things from code and saves herself having to explain calling show()
@tulip sleet Am I missing something here? Maybe it was carried over from using the rainbow cycle with other things that required auto_write=False?
Or is it one of those things that's required sometimes and not others, and if I don't include it, behavior will be different on different boards. π
auto_write=True will just update on each change to a pixel of set of pixels (each call). So if you need to do multiple calls to set up something, then auto_write is faster. I guess it's possible that intermediate auto-writes will also change the appearance of an anmiation
definitely not different on different boards
the state of the pixel buffer is written out on .show() if auto_write is false, and on every call if auto_write is true
Oooooh right, it was faster.
I think pixelbuf also made it faster
Because it is zooming over here without it set to False.
try it true and see if it's slower, which is should be
i mean false is faster, true will be slower
Honestly can't tell the difference anymore.
in adafruit_led_animation/animation/__init__.py, Animation.__init__ sets self.pixel_object.auto_write = False
Between True and False.
so .. I think it's happening behind the scenes?
Used to be REALLY obvious.
Not using LED animations
that is good that it does the right thing
ok nevermind, I zoomed through the conversation too fast π
@tulip sleet So should I continue with what we've been doing and include False and show() or roll with the improvements pixelbuf brought and leave it out now?
Because I can't tell the difference between them anymore. Used to be sooooooo sloooooow without it set to False.
i think for any significant animation, auto_write=False is better, because it will be faster. You just have to figure out where to call show
That's fair. This is for the status NeoPixel template page. So not using anything extraneous.
Right. It's in the rainbow helper here.
Ok, I'll leave it in and explain it.
@lindes That is how I use the REPL too. I'm not suggesting removing the REPL. This is a weird case where it's out of resources. In that case, I think it's ok to suggest using the code.py if it works still.
@dhalbert I'm totally open to tweaking the stack sizes. Let's see where we land after updating MicroPython. I think a bunch of stuff has changed internally.
I'm ok leaving the CircuitPython name in "APIs" so tools continue to work. I don't mean to block interoperability.
@anecdata I don't know of anyone. It'd be cool to see it added.
@hierophect I have a couple of things to be fixed. I will merge your code and commit with my code in this weekend.
UART.write() was always returning zero because it used the input len as a countdown.
This change is on 6.2.x, and we can merge or cherry-pick this to main.
First part for #2999
I've started this merge work but am taking a different approach. I'm merging each MP release from 1.10 up to 1.15. This will make the merges a bit more tractable and easier to hunt errors/bugs as we find them. (Started in #4646 )
Delete this and add a docstring for it.
I think it would be good to rename the audio_dma stuff. I'm trying to remember what makes those special so we could rename them that way. Is it that they can be triggered by events?
Please elaborate on these comments so that no other reference info is needed.
Please elaborate on these comments so that no other reference info is needed.
Are the new changes available when merging with MP in CP 7 or before?
@tulip sleet thanks for your help! I wrote this for future me and poor souls like me: https://blog.thea.codes/sam-d21-brown-out-detector/
A guide to using the SAM D21's brown-out detector to prevent strange behavior.
Question on using SPI in CP on ESP32S2
Found busio.SPI in the docs, but how can I setup pin assignments and a chosen ESP32 SPI peripheral? This chip has several variant peripherals that can do SPI, and the peripheral pins can be mapped to various HW (GPIO) pins. Lots of choices in setup. Looked at the sample code in Examples, but all of them seemed too complicated or not ESP32 specific. Where can I find a simple example that just creates an SPI object, reads a specific addressed byte from a SPI slave device (e.g., an ID register) and prints its value?
TIA, Mike
@dhalbert Gladly. :)
Given that memory error I mentioned at the end, I ended up starting to use mpy-cross for things, and that seems to have fixed things up for me fairly well. I've still had occasional problems, but not the stack error -- even after removing the supervisor.set_next_stack_limit call entirely. It even works in the REPL! Yay!
@tannewt fair enough. Given the experience I had above, I guess my suggestion for future advice is to advise folks to use mpy-cross if they'r...
24MHz is enough for 30FPS of 640x480 using 565. (51078430*2) You will probably deplete the entire RAM in this situation. This would require 600KB, which is more than the 256KB.
@daveythacher this is the PCLK rate, not related to FPS, we are not using video.
Thanks! @dhalbert... seems like the esp32s2 port also has this issue.
I'm merging each MP release from 1.10 up to 1.15. This will make the merges a bit more tractable and easier to hunt errors/bugs as we find them.
I agree, merging all of it at once is kinda overwhelming.
This is a GREAT article!
Thanks! @dhalbert... seems like the
esp32s2port also has this issue.
Thanks! I will push another commit for that.
Thanks! @dhalbert... seems like the esp32s2 port also has this issue.
Fixed and tested on esp32s2 also.
Could've have written it without your help! πββοΈ
I am going to post this in an Adafruit blog entry, if you don't mind.
That would be lovely
π thank you!
random.randrange says its signature is randrange(stop: Tuple[int, int, int]) -> int:
But it should say its signature is like this: (pasted from CPython doc)
random.randrange(stop)
random.randrange(start, stop[, step])
@jepler I think your work will supercede or obsolete this PR. I'll close this one for now and await to see if your additions also provide this capability.
what do you mean?
Could I start using deque?
not sure it is turned on
@slender iron π I started a review last night; going through files, but not in great detail
thanks! I marked as ready since the CI passed
Thanks π
`Thanks for starting this!!
MP_OBJ_FUN_MAKE_SIG and related signature checking functions look interesting; not sure how they are used yet.
As a random test, I tested busio.UART on Metro ESP32-S2 in the REPL, and also wrote the same code to a test file and copied it to CIRCUITPY and ran it.
@slender iron reviewed and approved 1.10 merge. I did not merge yet in case you want to do anything else in advance
nothing I'm aware of
just about done with merging 1.11 and then it'll be fixing the compile and then the tests
ok, merging!
π
π
@onyx hinge If I clone your pcc branch of CP, I can keep up with any changes you make to the PR 4635, correct? With all the new stuff going into CP main I was not sure if you were going to keep the pcc branch updated as well. I found it gets very mess building PRs that are not up to date with main.
Warning to all 7.x testers: the .mpy file format has changed with the merge of #4646, so use .py libraries to test (or make a fresh mpy-cross and recompile). It will change once or twice more
@solar whale I hope it'll be in mergeable state soon, but probably not today.
Good luck!
@solar whale I'll merge main into it if that seems to help with getting it ready, like if it has conflicts
i'll be working on it tomorrow
Good luck with it an let me know if there is anything I can do to help.
@tulip sleet so a new mpy-cross "should" work with 7 going forward, correct?
Scott is merging MicroPython 1.10, 1.11, 1.12, 1.13, 1.14, 1.15 in succession to keep the size of each merge down. I think he said the .mpy format changed at least twice in that succession. So as those merges go in, there will be churn on the mpy version
Sounds like fun!! Good luck!
We're pulling in upstream? Color me excited.
Wondering if we could pull the C DHT library from MP also π€
1.10 doesn't actually change the format. 1.11 and I believe 1.12 do though
Really exciting news about the merges. Is the best bet to read the micropython release notes to see what will change in regards to CP?
Some other considerations:
API:
- There's no CPython API that I know of for controlling an AP, so we'd be winging it to some extent. Initially maybe just a
wifi.radio.start_ap(ssid, password)or similar, optional params like channel, max_connections, etc. could be added later, along with some helper functions to get info about the SoftAP (MAC, etc.)
STA vs. STA+AP vs. AP:
- There are reasons to keep STA as the default, and support STA or STA+AP. For example: scanning requires a stat...
@daveythacher this is the PCLK rate, not related to FPS, we are not using video.
PCLK is correlated to data rate. CLK is correlated to internal clock. (Table 5) Some internal CLK is correlated to PCLK. (Table 5) A single frame will exceed RAM limit. The exact internal clock value needed is not clear me, however I did not read the entire thing. I failed to see internal osc, so I can only assume there is a correlation from CLK to PCLK. I saw the pull request which works off single frame ca...
Now the same thing is happening to me with a QtPy and CircuitPython 6.2.0. Very strange.
@onyx hinge @lapis hemlock do you know if there is a ulab that uses all lower case mp_obj_is_type?
@slender iron I don't know offhand, I can check around
@slender iron in fc80a256856d3eb4245aa5e83153061967c2e5c5 I changed them all to "Increase CircuitPython compatibility"
src/micropython$ git grep OBJ_IS_TYPE
py/obj.h:#define MP_OBJ_IS_TYPE mp_obj_is_type
``` shouldn't it automatically switch over to the "right one" via this macro? I assume this is something that changed since our old cp version
and the current ulab is compiling ok with 1.15
Yes, I believe their CI is always using the latest micropython when it runs. (same with cp, right now)
for a long time, or maybe in their legacy branch?, we had checked out specific branches or releases, but their main branch seems to just get the latest
@tidal kiln I don't recall anything like that, but if accurate it would be good to document it. what are you seeing?
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit ItsyBitsy M4 Express with samd51g19
>>> from collections import namedtuple
>>> foo = namedtuple("foo", "x y z")
>>>
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit QT Py M0 with samd21e18
>>> from collections import namedtuple
>>> foo = namedtuple("foo", "x y z")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object 'str' is not a tuple or list
>>> foo = namedtuple("foo", ("x","y","z"))
>>>
(edited to add what works for 2nd case)
huh, okay. I don't see where that can be separately enabled/disabled, and qt py m0 would not intentionally have things deactivated like that (it's not cramped like samd21)
it may be an unintentional change, you compared 6.1 and 6.2 above
#if MICROPY_CPYTHON_COMPAT
ok you're right, it is enabled/disabled by this
so the question is why MICROPY_CPYTHON_COMPAT is not set on rp2040, I think
I doubt it's intentional, it has plenty of code space
not QT PY RP2040
oh okay .. then that's why
my reading comprehension ... sorry
np. there's only like 5000000000000 different boards π
indeed
so yeah that would have to be changed for compatibility. adding .split() to the string-arg would be sufficient, or would be listifying it yourself
assuming it otherwise fits
yah, haven't tried with a mod'd version yet. for now, just fails due to that named tuple thing.
sorry, got a phone call from a friend. I'll take a look now. may need to update it
I'm trying to switch us to the lower case version
shared-bindings is hard
Someone is asking in livebroadcast and I cannot recall, does compiling to mpy save any RAM or just disk storage? Also asked the same regarding comments in the library
saves a bit of RAM that is used for loading the .py text and compiling, nothing after that
(so if you run out of ram due to big allocations in the code, that's not gonna help)
I looked at a subset of this and didn't see anything of concern. No testing performed.
yup yup
I looked through all the interesting files (I skip the tests). Looks good, and this is simpler than V1.11, so it should get easier and easier.
I'll do some more extensive filesystem testing when the build works, due to the update of oofatfs.
Here is some of fun of native code:
https://github.com/micropython/micropython/issues/ 583
Referenced here:
https://github.com/adafruit/circuitpython/issues/ 2999
https://github.com/adafruit/circuitpython/issues/ 2825
Super-rough and early proof-of-concept. I'll make a draft PR, still many questions on architecture, API, and implementation. It gets complex pretty fast, it would be great to collaborate with someone knowledgeable about the core and wifi.
import wifi
import ipaddress
import socketpool
from secrets import secrets
# this STA connects to an AP
print(f"Enabled? {wifi.radio.enabled}")
print("Connected?", end=" ")
wifi.radio.connect(secrets["ssid"], secrets["password"])
print(boo...
Rough early implementation based on comments in #4246...
Current Assumptions:
- Station (STA) is the baseline default mode.
- Access Point (AP) is started to create STA+AP mode.
- Single event handler due to STA and AP events sharing the
WIFI_EVENT_base. - Single radio object with STA and AP configs and netifs
- Like STA, AP
netifis always created at wifi init, and destroyed at reset - ...
Current Status:
- AP has params ssid and password only (needs channel, au...
Heads up PRs from first time contributors will require approval from a maintainer before actions will run. https://github.blog/2021-04-22-github-actions-update-helping-maintainers-combat-bad-actors/
https://xkcd.com/2407/ so it was not only a French speaker lost in translation joke... I made an xkcd joke I had not seen beforehand!
oh. the PAIN-first search!
Sphinx syntax is not obvious; it's not markdown, though sometimes it looks like that. You'll want to try to build to docs locally to make sure any changes will work, such as the new cross-reference you propose.
single backquotes in sphinx causes a cross-reference to be generated. Hopefully that will work in this case.
Single backquotes here does not make sense, because this is not a cross-reference. Double-backquotes causes the "code" font to be used, so these should stay as double backquotes.
Single backquotes here does not make sense, because this is not a cross-reference. Double-backquotes causes the "code" font to be used, so these should stay as double backquotes.
@microDev1 One more review, if you have time. I just had to bump a cache key to fix the build. Thanks.
tested on Feather nRF52840 with a jumper. Works fine! Thanks!
I agree that Sphinx is not obvious in what is the best way to highlight things as code and cross-reference to other documentation.
I had tested a local docs build and the changes made, the single quotes, get rid of the red links (generally interpreted as errors or missing links) that are currently on the website . I can rechange these back if you prefer but I think that __getitem__ and...
With your changes, these new warnings below are generated during make html:
home/halbert/repos/lesamouraipourpre/circuitpython/shared-bindings/displayio/index.rst:36: WARNING: 'any' reference target not found: ulab.numpy.frombuffer
/home/halbert/repos/lesamouraipourpre/circuitpython/shared-bindings/displayio/index.rst:66: WARNING: 'any' reference target not found: y * width + x
/home/halbert/repos/lesamouraipourpre/circuitpython/shared-bindings/displayio/index.rst:76: WARNING: 'any'...
I am experiencing this same issue using circuitpython. The further away from my AP I get, the more 205 errors I seem to receive. The other ESP32 boards I've own do not have this issue.
Weird. I've pushed those changes but I'm not sure if they've pulled over to the PR.
https://github.com/lesamouraipourpre/circuitpython/commit/0be610fd2bce8465ad5ab25ce0bf3723673374fa
If there is more than one AP broadcasting the same SSID, you can select a specific AP to connect to by its BSSID, and / or, you can select a specific channel to use to avoid channel congestion or other sources of interference:
https://circuitpython.readthedocs.io/en/latest/shared-bindings/wifi/index.html#wifi.Radio.connect
Yes, there's something weird with GitHub. Yours was your first PR against circuitpython, so I had to approve running the Actions, which I did bother to do yet, since I had proposed changes anyway. But then your second push did run the actions, but on only the first commit?? I think GitHub's new Actions permission thing may be buggy.
Try committing and pushing again; I think you can do git commit --allow-empty.
Merges
#4529
#4558
#4645
@tannewt this is ready for a fresh review assuming the CI passes. Let me know if I need to merge main or rebase onto it.
@onyx hinge Jeff, someone pointed out a serious issue with floating point constants. Here is the new release tag with the fix: https://github.com/v923z/micropython-ulab/releases/tag/2.6.1
@tulip sleet Dan, is there somewhere a decent summary of the different representations in micropython?
Never mind, I have found it: https://github.com/micropython/micropython/blob/530c76f6caee9445f468380f58b98f4e3ceda759/py/mpconfig.h#L68-L110
@lapis hemlock I have found this page very useful: https://www.h-schmidt.net/FloatConverter/IEEE754.html
makes it easy to drop the two lowest bits when testing our float represenation
@tulip sleet Thanks for the link! Someone pointed out that circuitpython uses the C representation, and then the float constants didn't work.
@lapis hemlock https://github.com/v923z/micropython-ulab/pull/370
I looked at a subset of this and didn't see anything of concern. No testing performed.
Looks good. You'll need to do a further merge.
Code looks good. Thank you! You'll need to fix the CI though.
I'd note here whether station connections are interrupted.
This looks good to me! I do like the idea of treating sta and ap modes independently. So you would be able to do AP only mode if you only start the AP.
Sorry, I couldn't find this.... what is the link to "install the example with its dependencies" ?
The Project Bundle? Or something else entirely...?
oh by the way I noticed a thing in the learn guides: when looking at the "Single Page" version, the table-of-content links on the side don't lead to anything, because the #someting anchors are not in the page
I believe I noticed that too and thought it was a me-problem.
it's not you, there are no anchors in the page for the big section titles
I was able to test on a Sony camera and firing the shutter worker correctly. Opening a PR.
Supersedes #4653. Updates xtensa build cache key also
The timing of pulseout required a fix similar to what was done for pulsein to avoid having the inherent delays in the SAMD21 timers affect the timing of pulses. So, the same functions used by pulsein were called, but renamed to avoid confusion.
Can you email me kattni(at)adafruit.com with details? I want to report it to our Learn dev folks, but don't have time today and will likely forget. π
ok
Thank you!
Code looks good. Thank you! You'll need to fix the CI though.
Just a note: I can't think of any material downsides to using STA+AP mode for achieving AP mode. There is some resource load, I don't know how significant. But STA+AP can be used just like AP-only, by just not invoking any STA functionality (scan, ping, connect, etc.)
The trick about AP-only mode is that STA currently starts by default, so if we want to allow AP-only as opposed to STA+AP, there are two ways I can think of:
- Don't start STA by default (don't start anything by default...
I'll have to test this more. I thought at first glance that starting one might disrupt the other already running. If STA is running and AP is started (or vice versa), it becomes AP+STA and may not disrupt the original. They use separate netifs. I didn't see STA stops in the log when AP started.
@slender iron What phrasing are we using for the two I2C address options? I don't remember. Jose David is updating docs in a lib, and I noticed "slave address" was still used. But I can't remember what it should be.
Peripheral, maybe?
Was it sensor, or secondary?
Finally found it in the design guide.
It's all three.
So I don't know which one is preferred for I2C. I feel like it's peripheral.
Kinda makes most sense...
Ohhh,, Did I use slave that is my bad, I could correct that.
@still zephyr Yeah π That's what I was trying to sort out to comment on the PR.
OK I'm not going to comment everywhere. I'll comment once and let you make the changes.
@still zephyr I'm not sure what you meant by this comment: https://github.com/adafruit/Adafruit_CircuitPython_ICM20X/pull/12#issuecomment-825102955 What's still an issue with Sphinx? Everything seems to be passing.
So danh requested to change the reference from busio to board...So the thing here is, I can do that everywhere but the parameter list. If I do that in the parameter list, I do not get the link for our Circuitpyhton documentation
But as you could see in the designing guide we use busio
Yeah, when sphinx try to get the documentation objects from the page, they return a non valid object
Yes, but the end user will not see this
they will see I2C, if they click on the word they will go to the busio.I2c documentation
Ok. I guess leave it as is for now. We can always dig back into it if we come up with another solution.
Yes I try even to include the reference in the sphinx_intermapping withou any luck
Maybe there is a way I could not find it yet, but Agree we can go back and change it, it will be easier
Do yo see anything else that I need to change?
Keep it in the back of your mind in case you happen upon a solution in the future, but don't stress over it.
Nope, everything else looks pretty good
ok, no problem will do thanks again kattni π
Thank you!
@still zephyr Could you point to a line where the link cannot be created?
board and busio should work equally well here. But I have an idea of something that might dbe different.
@hathach #4560 fixed it on MacOS but not iOS. I am deep into dynamic USB descriptors now, so it should be possible. I will not implement two HID devices yet, but maybe eventually.
@slender iron if you're around can you re-approve and merge https://github.com/adafruit/circuitpython/pull/4635 ? I fixed the CI, so it's green now
yup yup
thank you kindly
np!
π
hmmm before now it didn't matter that weblate was always a "first-time contributor" but now it'll be an irritation
@onyx hinge maybe you can add it as a collaborator
@slender iron might work! I opened an issue with weblate, maybe they have some good advice. https://github.com/WeblateOrg/weblate/issues/5912
Hi! I'm writing on behalf of https://github.com/adafruit/circuitpython, which we use with a paid account on Hosted Weblate. GitHub recently made a change, so that "pull requests fr...
@I put a comment in the PR, to illustrate the problem...
I tried differents options and then build documentation locally to verify...
~board.I2C() board.I2C :class:board.I2C :class:board.I2C(), I tried to use the reference in read the docs, and use the sharedbindings documentation directly putting it in the sphix_intermapping.
Just for the fun of it I tried to include board, and busio in the mockup documents㪠, and other crazy things like that, I think once, I could get the link to the correct board.I2C page, but not sure at that time I was dreaming or what... so no luck
The problem is (maybe you know this already) is that the class is busio.I2C. board.I2C() is not a class, it's just an instance, and it's not a type. So I would say this documentation is correct, it takes a busio.I2C object, which you can get by calling busio.I2C() (the constructor) or board.I2C() (the singleton).
ohhhh
the example uses board.I2C() to return a busio.I2C object
no board.I2C() did not work
yes, absolutely. It's just the examples that would use board.I2C() for convenienece
π
happy now , thanks DAHN
yes, the examples yes, I tested that in a lot of sensors yesterdays and work without a problem, i have a proposition...
you don't need to test board.I2C() where you are changing from busio.I2C()
if that's what you were testing
In an old example I found, explaining in a nothe that in case that they need to define an specific address they can added to the sensor constructor
I was testing board.I2C()
you only give the address when you create the sensor object
agree
but as you always mentions, I guess for beginners it is better to leave the example without any address, right?
yes, you can use the default address. these are just the most basic examples. If there is a sensor where there is no default address or something like that (not sure what that would mean, maybe set by DIP switches or something), then I would give the address. But for a just-out-of-the-bag sensor, it will use the default address
Will do, thanks dahn for the explanation I have a couple of free days off from work so I was planning to do this π thanks !!!
you're very welcome, and thank you for doing all this work!!
Reviewed the code, looks good to me. Did not test myself.
@tulip sleet I push the first one, I did the BME280 and add the note that you recommended for the other PR on the BMP280 regarding the pressure. With all the discussed changes.
@onyx hinge FYI just updated to tip of main with your parallel image code merged. Still works on my grand central!
I've encountered this bug after building the touch deck from John Park's tutorial: https://learn.adafruit.com/touch-deck-diy-tft-customized-control-pad. Power cycling is my workaround.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
Traceback (most recent call last):
File "code.py", line 34, in <module>
File "adafruit_featherwing/tft_featherwing_35.py", line 34, in init
File "adafruit_featherwing/tft_featherwing.py", line 67, in init
...
Thanks @tulip sleet
.
@lone axle hey00
i have a QUESTION and possible a QUEST
(the quest has a πͺ at the end too π
π hey there, whats up?
ok your gfx thing is awesom
which gave me a Bad Idea
(sometimes these are good ideas in disguise)
could we auto-generate a PNG that is auto-commited to the learn repo for each circuitpython project?
by the CI runner
cause then it 'lives' somewhere, and is updated every time the code changes
code may need to be 'ported' to a CLI-lang like python+pillow or somethin
Interesting. I'm relatively green with CI stuff but I do think it's possible to get it set up to be automated like that.
the CI stuff i can do
(its just like, a shell script we run)
but i need the script to run on a headless linux compy
so javascript is a bit tough..
I will tinker with it some and see what I can come up with
ok ill reply to the thread, we have a budget for it!
are you using melissa's json-parsin-requirements code to do it?
Currently I've been typing in the names. But the plan was to re-use whatever is generating the new zips to be more automated.
ahh
ok so you'll want it to run on the python script itself
and then use.....
hmm
hold on
i gotta find the thing that determines the imports hehe
doh its called https://pypi.org/project/findimports/
hehe
@lone axle try that
so that gives u the imports
then you can use...
Ooh neat. I'll give it a shot
the latest bundle json
(that will require github api)
parse the json to get the dep tree
then generate the image
and we'll see how it goes!
Iβve only seems a few instances of DFS/BFS algorithms used in the wild and itβs kind of cool to see it in action here
Connection to AP (open wifi) working now:
W (6142) wifi: got ip
I (6212) wifi:mode : sta (7c:df:re:da:ct:8c) + softAP (7c:df:re:da:ct:8d)
I (6212) wifi:Total power save buffer number: 8
I (6212) wifi:Init max length of beacon: 752/752
I (6212) wifi:Init max length of beacon: 752/752
W (6222) wifi: ap start
I (6222) wifi:Total power save buffer number: 8
W (6222) wifi: ap stop
W (6232) wifi: ap start
W (6232) radio: ssid=Bob
W (6232) radio: password=
W (6242) radio: max_connec...
@ornate breach π² π³ π΄
I learned a lot of algorithms in my Algorithms class and I honestly wish I used them more in my day job.
srsly i would love to use merge sort at least once before i die
i feel like most is just teaching you what to avoid
Sounds like something that's possibly just 1 bad interview away!
After balancing a binary tree
"oh look its concurrency - use one of the many theoretical algorithms that deal with it? NO just DONT DO IT"
my first interview i was asked what a red-black tree was and i said i couldnt remember
and i got credit for admitting i had no idea because nobody at the table except for one guy did either
"How would you go about implementing a binary tree in your system"
- Errr, pip install one-of-many-binary-tree-package ?"
i was also 16 so kinda surprised they'd expect it
now I have to google it !
"i dont! i use a built in object model in the language because its not 1996 anymore!!!"
"i also know how to write a compiler but why do that? nothing good comes from lex or bison"
"But lets say it WERE 1996? How would you do that?"
- Let me answer your question with a question: Has that need EVER come up on this or any related projects before?
if its 1996 i demand acid tekno, large pants, and no cell phones in the work place
@lone axle ok well reply to the thread if/when yr at a spot. i have to go iron my JNCOs
That 2nd request, that's legit.. some would say even 2 legit!
The standard we follow for my job, JSF++ prohibits using recursive algorithms
That can certainly make certain projects a bit difficult
Granted it was written for C++99
Back when memory alloc and management was much much harder
We are at C++11 now π
Yeah, but still, I've had to write Fibanocci and tower of hanoi functions in school. But also, how would you do compounding interest calculations without them?
For me, that was pre-C++99
Only 10 years behind
Wait... C++11, wouldn't that make it C12?
I did algorithms in Java
Since you're using prefix ++ operator?
(this is why we use parenthesis for order of operations, kids!)
Pedmas except for when you donβt mean pedmas
At work we basically default to horrible horrible exponential time algorithms
O(N^m) complexity
Well, except when we do any DSP stuff then we just do whatever the complexity of the algorithm is
Other than Scott (who is busy merging mp), who else knows the core well (wifi specifically, but also just general core/mp/c++ things)? The more I get into this PR, the more the scope creeps as complexity reveals itself. At some point, I'll draw a line and leave enhancements as an exercise for future contributors, but I have... Questions. Better in the PR, or just pop them into here from time to time?
danh?
Would there be any push back if I were to make a combined library for both the MCP230xx and MCP23Sxx?
Named as MCP23XXX?
Thank you for cleaning this up!
You can ask me if you want, not as knowledgeable as the others but Ive poked around the core code enough I have somewhat an idea what it's doing (as I say that I'll find something new of course!).
The PR is probably a good place to ask as well
Looked it over and compared to it to #4645 and they match. Looks good to me.
I understand that there is limited time and resource for concurrency but more and more devices/MCUs are supporting/providing more than 1 core.
It would be great to have this in general and not just for the RP2040 also for various reasons/usecases. I'd honestly prefer some planning go into getting concurrency as a whole (if it isn't/hasn't been done yet) because more devices in the future will have a multicore offering.
Offering even just async tasks to be placed onto other cores that sh...
Supporting interrupt pins from IO hooked up to other chips than the MCU or tasks that require to be action-ed every so often with timers.
@onyx hinge do you want me to merge your PR for the OV7670 or do you want to do that yourself or wait to see if there is more discussion. Still don't understand why the "4" was there in the first place...
One tweak. Otherwise it looks good. Thanks!
@ladyada
Test program for ov7670 + gcm4 + 1.8" tft shield: https://gist.github.com/645f7d052b63103111b011e507df38a1
Test program for ov7670 + rpi pico + 2.0" ST7789 breakout: https://gist.github.com/f357464e194a4ba85bbcd43378b1e189
I think the 2nd one needs the fix for the DIV2 resolution mode, https://github.com/adafruit/Adafruit_CircuitPython_OV7670/pull/4
@onyx hinge for the RP2040 Pico -- do you use GP12-19 for the data pins - for the OV7670?
Supporting interrupt pins from IO hooked up to other chips than the MCU or tasks that require to be action-ed every so often with timers.
EDIT: Being able to interrupt for a task that is latency critical is my main use case but could also provide a way to do concurrency without too much fuss.
Is part of this issue around concurrency education based?
There is already on called like that.. here .not familiar with this hardware does the S implies different things? https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/tree/master/adafruit_mcp230xx
0 is I2C and S is SPI
gotcha
I'd rather be able to provide a lib that allows both
and yes I know Adafruit doesn't sell the SPI version
yes would be wonderful, https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/blob/master/adafruit_mcp230xx/mcp230xx.py changing this one?
yeap
π
Any PR is always welcome π
Sweet, not sure how this will turn out, currently trying to get commits from https://github.com/romybompart/Adafruit_CircuitPython_MCP23Sxx so I can make the superset
But he isn't being the most helpful because I'd like to keep his account in the commits
@hollow token FYI -- there are several libraries that handle both I2C and SPI -- see https://github.com/adafruit/Adafruit_CircuitPython_BMP280/blob/master/adafruit_bmp280.py
mm interesting, is this library in the community bundle?
right, yes I jerryn mentioned we have a lot like that.
we need to see changing that name what implies... learning guides, and references... but for sure the SPI support is helpful
As long as combining the libraries doesn't stress the memory needs too much, usually you're using one or the other at a time
I'll see if I can include compat so that the old name still works
Thtat is a valid point
actually, could just make 2 lib release artefacts with the new and old name
shouldn't be too much of a concern but I'll keep that in mind.
Actually the guy who wrote the S version was using the I2C one to drive 8 of the S chips over SPI for the chip selection pin
I think from all the things behind this (meaning: documentation, examples, rst files, readme, etc,) is easier just to crate a new MCPSXXXX.py file in the library
I'll see how I go with it
Thanks
Might just leave the name change as an extra question on the PR for the spi support
right right good idea
@blissful pollen Thank you!
@solar whale yes that's right for the data pins. You are welcome to merge after you review.
@Red-M, a week ago I would have agreed with you. But one of the Adafruit developers brought up a valid point. Which is, they support 100s of boards with circuitpython. Only a few of those are multi-core. Given the vastly greater scope of requested functionality with respect to available development labor, I understand why this has not been done.
Apropos #4602, did anybody try receiving for ir remote on samd21 recently? I can't get it working, while on samd51 it works fine.
I'm getting 'Both even/odd pulses differ' and 'Only mark & space handled' errors.
@stuck elbow I just tried it with a new build (tip of main) on a PIRKEY_M0 and it seems OK. receives from remote.
but I am finding an old issue that sometimes I can't use Control-C to break out of the program after receiving data.... I know I've seen this before. Does not happen all the time. Looking at old issues...
I have that happen a lot with the Mu beta, though it might be unrelated
Not using Mu here, and now I can't reproduce it....
ah -- yes I can...
The code is running fine -- just won't respond to a Control-C...
that was a few days ago, it seemed like it was triggered by Mu and I made a note to look into it, but haven't yet, it might actually be the same and not related to Mu
It may be a "linux" issue -- "screen" is not happy.
I'll have to see if I can come up with a clean "issue" to file.
Out of time for today -- I'll look into it tomorrow.
it shouldn't matter on which pin the sensor is connected, should it?
also, while it's waiting for pulses, autoreload doesn't work
tried a different board, and now it's not throwing errors, simply just not capturing any pulses
hmm, works with serpente
@tulip sleet should Pinalarms be claiming pins? They don't, at present. Is there some reason we'd want them to be able to overlap with another module?
They should for light sleep, but for deep sleep all the pins are released, so they get "claimed" during deep sleep.
Different ports will react differently to the overlap, note. Redefining a pinalarm as a digitalIO on RP2040 will have basically no effect, doing it on STM32 will cause all interrupts to shut off.
@tulip sleet well, if you redefined it after creating the alarm but before setting it, it would have the same effect for deep sleep.
In other words, I guess what I'm trying to say is that not claiming is dangerous for STM for any form of sleep, not dangerous for RP2040, maybe dangerous for other ports.
so we should do it if there isn't a specific reason not to
For deep sleep, I would think the implementation would do nothing with the pin, until you actually call exit_and_wait_for_alarms(),
in other words, you shouldn't do anything in advance except remember which pin
does that make sense?
Well, in the STM32 case, I use a never-reset method instead of re-enabling pin detection with the EXTI. But I think you're still correct, because it enables that particular element in set_alarms
Wait, alarms aren't actually aware of what kind of sleep they're being used for until it's called. So this is a moot point anyway - if we want them claimed for light sleep, they have to be claimed for deep sleep too
adding filtering capacitors fixed it
Well, you could defer claiming them in either case until the sleep method was called, though that might be confusing, because you wouldn't get an error about the pin until then.
I guess in the light sleep case, it could fetch and memorize things like the existing pull settings, change them for light sleep, and then switch them back to the original once sleep is over?
@mental nexus Thanks for reviewing the slider π
Lets back this conversation up and start over. Lets look at the fundamentals of the coding. Python, Java, etc. are mostly interpreted programming languages which normally reside in user space. Interrupts are normally reserved for kernel space. Many interpreted programming languages crutch off kernel APIs or use native code in the background.
This is mostly how CircuitPython works. It provides a large flexible API which works around the overhead. This works for bandwidth however really stru...
@mlewus I'm not saying it isn't going to be a lot of work but some form of concurrency planning should be done soon as more MCUs are going to come out with more than 1 core.
hi folks, this issue is for collecting specific use cases for interrupts so we can implement tools to help solve specific problems. its fun to talk about operating system design, please use discord for that so we can keep this thread on topic.
Current status:
STA starts up by default in init.c common_hal_wifi_init().
STA and AP can be independently started and stopped, with no disruption to the other.
wifi mode is retained through transition from wifi.radio.enabled = False (wifi stop) to wifi.radio.enabled = True (wifi start).
There are four wifi modes:
- Station
- AP
- Station + AP
- NULL (turns off both Station and AP, but wifi remains init'ed
Make code maintainable? Make code understandable? Make code not require insane testing? Is that not like the point of application code, APIs, libraries, etc.?
Anyone write state machine for polling in super loop?
Logic need low priority long running computation while fully saturating IO bus. - Maybe supported.
Logic needs to be target from other device. - Maybe supported.
Cannot redesign protocol or timing standard. - Maybe supported.
On reliability, can I freeze my code? Convert t...
So, I remember hearing some folks were looking for the Nordic Power Profiler Kit II (PPK2), as it's been out of stock for many months.
As of 11:56pm Eastern late Saturday evening, Digikey has 21 of them remaining. Hope anyone who needs one is able to get it.
https://www.digikey.com/en/products/detail/nordic-semiconductor-asa/NRF-PPK2/13557476
Order today, ships today. NRF-PPK2 β - Current Monitor Power Management Evaluation Board from Nordic Semiconductor ASA. Pricing and Availability on millions of electronic components from Digi-Key Electronics.
@jaunty juniper FYI - the issue I was having with control-C turns out not to be an issue with irremote, but is an issue with usb_hid -- I'll file an issue on that later.
Tested this on the Feather NRF52840 across real/fake light/deep sleep types, and it works well across all modes. The only functional issue it has is not retaining a system tick across deep sleep, which causes the USB enumeration delay to occur every time it tries to deep sleep, but that's only a minor power loss with longer sleep periods and likely solvable with a follow up issue.
There are also a couple of stylistic things that could still be changed - `common_hal_alarm_pretending_deep_s...
@still zephyr Do you have a suggestion on another widget to add to my review queue fir this week?
I've done a test and I think mine is a Mu+MacOS issue
@hierophect After the above commit, I got the message saying I dismissed your review. I am sorry if I broke any rule here. But I think I have successfully merged your changes.
I would like to modify around wakeup-cause detection functions to make the code straightforward. Can I go on and commit them ?
@jun2sak No problem, please go ahead and make further changes. Reviews get dismissed automatically when code changes are pushed. It's nothing wrong. We just re-review the new changes.
basically when clicking back and forth between the Serial panel and the code file in Mu, ctrl-C ends up not working any more, which seems just a Mu UI issue until you quit Mu and connect to the board with tio and it still doesn't receive your ctrl-C until the code stops by itself, like by adding an error in the file or breaking on a button, at which point many of the missing ctrl-C are received (as indicated by multiple >>> lines)
Hi, @deshipu, where is _pew.get_ticks() being defined?
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Raspberry Pi Pico with rp2040
Code 1
from board import GP13
from pulseio import PulseIn
PulseIn(GP13).deinit()
PulseIn(GP13).deinit() # Traceback 1
Code 2
from board import GP13
from pulseio import PulseIn
with PulseIn(GP13):
pass
with PulseIn(GP13): # Traceback 2
pass
Traceback 1
Traceback (most recent call last):
File "co...
I would also like to look at the problem from a different perspective.
I agree very much with the statements of David Thatcher.
But my approach to the problem which we want to solve with introducing interrupts would go in a different direction. In general CurcuitPython is fast enough on most microcontroller to respond to Hardware events and do the processing in an adequate time. However longer running pieces of code are often in the way. Here I am helping with calling out to hardware event ...
I'm experiencing the same with pulseio.PulseIn:
from board import GP16
from pulseio import PulseIn
pulse_in = PulseIn(GP16, maxlen=1)
for j in range(5):
print(f"Run #{j}:")
pulse_in.clear()
while not pulse_in:
pass
print([pulse_in[j] for j in range(len(pulse_in))])
While signal is coming to GP16, I'm getting a similar output:
Run #0:
[141, 141]
Run #1:
[141, 141]
Run #2:
[141, 141]
Run #3:
[141]
Run #4:
Traceba...
π thanks again. maybe scales https://github.com/jposada202020/CircuitPython_scales
Verified it myself. Took a look and the deinit() function needs to call reset_pin_number(self->pin);
(Looked at displayio.ParallelBus for a reference that also uses the PIO and allocates a pin)
Latest commit allows sequences like this:
>>> wifi.radio.enabled = False
>>> wifi.radio.stop_station()
>>> wifi.radio.stop_ap()
>>> wifi.radio.enabled = True
>>>
>>> wifi.radio.enabled = False
>>> wifi.radio.start_station()
>>> wifi.radio.enabled = True
@low sentinel Can you help clarify your comment on interrupts and requests https://github.com/adafruit/circuitpython/issues/4542#issuecomment-813084517? If a request always takes more than a second, a timeout of less than a second will never allow it to be successful?
There is an open issue to create a separation of requests and responses https://github.com/adafruit/Adafruit_CircuitPython_Requests/issues/69
I am using the code below on a neopixel_trinkey_m0 to send a string when either of the trinkey cap touch pads are touched.
I have found that it works fine, but if I have the REPL open then use then trigger it to send more than once, then I am no longer able to interrupt the execution of code.py from the REPL with a Control-C. Also if I try to exit my "screen" session on Linux, I am unable to close the session. The code keeps running fine.. If I move my focus to a different window, I can s...
Enabling multithreading in general could be discussed in another issue. Feel free to open one. In this issue we are asking for specific uses for that need handling of asynchronous events. I.e., what is the project you want to accomplish that needs such a capability?
I have committed what I have been working for these days -- merging some latest changes and simplifying system_on_idle_until_alarm(). I found it work on my nRF52840 board, but I understand following items are left undone.
- deep sleep and USB enumeration delay
- adjust wake_alarm implementation on nRF to those on esp32s2
I was looking to quickly fix this but came across another issue that may be deeper. I added the reset_pin_number but now get the following:
p = pulseio.PulseIn(board.D11)
p = pulseio.PulseIn(board.D11)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: D11 in use
p.deinit()
p = pulseio.PulseIn(board.D11)
p = pulseio.PulseIn(board.D11)
>>>
It seems however the PulseIn PIO is being allocated after the first reset_all_pins the conditio...
More information:
If I shorten the string to 22 characters or fewer, the problem does not occur.
At 23 or above, it does.
at 23 characters it would sometimes stop responding to control-c after the string was sen 3 times instead of 2 as with the longer string. On a few occasions it dd respond to a control-c but after a delay of a few seconds.
Yeah that is true. Youβre right that a 2 second sla api would never work with your flashing colon and a blocking get.
If you need to have an active loop while doing a long running background operation (or 10) you probably need either polling apis and a state machine or async apis.
I think I saw itβs possible to consume a request body partially. Might be able to wrap at least the data transfer part of it in an async method (or poll it for completion). I recall that it demands the first byte of the response synchronously which Iβm not super excited about but π€·
update:
with a string of 10 characters, the response to the control-C appears to be delayed but it does responsd even after several (more than 5) string transmissions.
There is not a clear "break point" ... yet
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Raspberry Pi Pico with rp2040
code.py
Note: GP16 and GP17 are directly connected with a wire.
from board import GP16, GP17
from digitalio import DigitalInOut, Direction
from pulseio import PulseIn
from time import sleep
trigger = DigitalInOut(GP16)
trigger.direction = Direction.OUTPUT
trigger.value = False
echo = PulseIn(GP17, maxlen=10, idle_state=False)
def trigger_pulse...
@low sentinel thanks. yeah I think requests could be reworked to remove the largest source of blocking
requests is a blocking api. Probably shoehorning asynchrony into it is not a high priority? I have to admit I am curious about making an async http api though.
Related issue: #4659
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Raspberry Pi Pico with rp2040
code.py
Note: GP16 and GP17 are directly connected with a wire.
from board import GP16, GP17
from digitalio import DigitalInOut, Direction
from pulseio import PulseIn
from time import sleep
trigger = DigitalInOut(GP16)
trigger.direction = Direction.OUTPUT
trigger.value = False
echo = PulseIn(GP17, maxlen=10, idle_state=Fals...
would be rad to be able to make 4 requests at the same time while animating a progress bar or something.
Related issues: #4659 #4660
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Raspberry Pi Pico with rp2040
code.py
Note: GP16 and GP17 are directly connected with a wire.
from board import GP16, GP17
from digitalio import DigitalInOut, Direction
from pulseio import PulseIn
from time import sleep
trigger = DigitalInOut(GP16)
trigger.direction = Direction.OUTPUT
trigger.value = False
echo = PulseIn(GP17, maxlen=3, idle_state...
For issue #4657
Two problems in deinit. First was the pin being used was not reset with reset_pin_number.
Second the deinit function was not calling common_hal_rp2pio_statemachine_deinit leaving the global pin usage out of sync with the pin now being reset.
Also noticed the constructor is not calling the common_hal version to construct a state machine but did not have time to fix that now. Did a small change so it doesn't allocate a state machine object to just copy to `self->st...
hey @tulip sleet was displayio removed out of the samd21 m0 core libraries?
on what board?
it's one of my own boards but it's modeled off the qt py
it's hard to get it to fit; the CPX build with displayio is squeezed in various ways
no SPI FLASH installed
it will not fit
on non-SPI -flash SAMD21 boards we only have 192kB for firmware: not a lot of room
right, it was in there before, no?
i recall using it on a regular qt py a few months back
and by a few months like... December time frame
it is on QT Py M0 Haxpress
I don't think it's ever been on plain QT Py
it wouldn't fit to begin with
hmm... okay maybe i'm just not remembering right
if SPI flash wasn't so hard to come by these days i might have bought more
how much addition space is needed to handle displayio?
10's of kB
Couldn't figure out why I can't talk to a SPI display, D0 looks to be mapped wrong
This calls out GPI07 twice (Comment looks like it should be GPIO6)
Thanks! for the PR @gamblor21.
I believe moving to the common_hal version of construct is a better option.
Also, I found the following while going through PulseIn.c.
- There is no error raised when all state machines are in use.
- Instead of using
save_self, the struct can be passed as an arg to the interrupt handler.
The above are not necessary with respect to the current issue and can have their own PR.
oh indeed region 'FLASH_FIRMWARE' overflowed by 31108 bytes
Both D0 and D1 were assigned to pin_GPIO7, fixed D0 to pin_GPIO6, which also matches the comment.
Hi, is this something that someone with Arduino-level knowledge of C++ (but no direct register manipulation and such) could conceivably write as a PR? And if so, could you provide some guidance as to what would need to be done?
While fixing PR #4662 / issue #4657 it was found that PulseIn is not using the common_hal method of state machine construction. The common_hal version has more checks and would keep the functionality properly encapsulated. The displayio.ParallelBus could be used as a template on how to change this issue.
I came into doing core circuitpython code with a similar knowledge level. I think it is definitely possible to do. Have you set up a build environment to build the core code yet? Once I got past that step, I just started going through the code to learn what was there. I'm not 100% sure where the VM reset is but the discord channel circuitpython-dev is always able to provide guidance as well.
Yes, I've been building my own .uf2 and .mpy files for a while now (mostly because I needed to modify the sources for the latter - never touched the sources for the the former. Right now, I'm grepping around for where supervisor.reload() might be defined but not finding it (only thing related to auto-reload)....
The D0 port was incorrectly mapped to GOIO7 instead of GPIO6.
@zapwizard Thanks for catching that. I've created #4665 to address it.
Not sure that should block connecting with SPI, though. Are you using the default definition? I'll take a look an make sure that's correct.
Look in shared-binding/supervisor/__init__.c for supervisor_reload(), and then see what that calls. (I'm leaving that as an exercise so you can discover the structure :slightly_smiling_face:). In general, you can look for MP_QSTR_some_name, to see where some_name that is a Python name is used.
Ah yep, missed that! I'll kill this one.
@stonehippo
Just FYI: I believe this was blocking the SPI display connection on the SparkFun MicroMod Input and Display Carrier Board, which uses D0 for CS
@zapwizard ah, got it. I've only tried it with the ATP carrier, so this would haven't. Been an issue until I tried D0 for something.
Also see https://circuitpython.readthedocs.io/en/latest/docs/index.html#project-structure and these links in the left sidebar in ReadTheDocs:

There is also this guide, but there is much about it that is now outdated: https://learn.adafruit.com/extending-circuitpython
In common_hal_pulseio_pulsein_clear() added a reset of buf_index.
Thanks for figuring this out!
Done in my fork: https://github.com/ajs256/circuitpython/commit/4bafbca0c3571af11163b491994a3a8a7c24ea03
I will open a PR if CI goes green.
This shared-bindings thing confuses me:typedef enum { SOCKETPOOL_SOCK_STREAM, SOCKETPOOL_SOCK_DGRAM, SOCKETPOOL_SOCK_RAW } socketpool_socketpool_sock_t;The code uses the SOCKETPOOL prefix, but users only put in the latter part. Whereas here, there's no module prefix and the same constants are used by user and code:typedef enum _digitalio_pull_t { PULL_NONE, PULL_UP, PULL_DOWN } digitalio_pull_t;
@crimson ferry the user facing api depends on the qstr table
ah, ok I'll look at that, thanks
got it, I hadn't done constants before, thanks!
If I think I have found a bug in the new project bundling system, where would be the best place to report it or make an issue?
n00b joy: when anything works at all ;-)>>> dir(wifi.radio) ['__class__', 'OPEN', 'WPA2_PSK', 'WPA2_WPA3_PSK', 'WPA3_PSK', 'WPA_PSK', 'WPA_WPA2_PSK', 'ap_info', 'connect', 'enabled', 'hostname', 'ipv4_address', 'ipv4_address_ap', 'ipv4_dns', 'ipv4_gateway', 'ipv4_subnet', 'mac_address', 'mac_address_ap', 'ping', 'start_ap', 'start_scanning_networks', 'start_station', 'stop_ap', 'stop_scanning_networks', 'stop_station']
The first time I typed something into the REPL that showed/ran code I added to the core was pretty awesome
Add a board_reset_user_neopixels to the Slidey Trinkey, NeoTrinkey, and Prox Trinkey board.c files to reset the NeoPixels when entering REPL.
This is untested as I do not have hardware.
Closes #4601.
Could someone give the CI approval again? I fixed the issue that caused it to fail last time.
Hi, I just noticed a few grammatical things on the index page. Nothing big, just making it easier on the ol' brain ;)
Go ahead and just mark this one as off topic also.
Interrupts are a couple of things.
- They interrupt long running code. Making code structure simpler.
- They handle events in a non predictable manner as the source is "random" without overhead. (Ex. User input.)
- They mark critical events, which must be handled. Drop everything and do this. (Assuming processor can handle it.)
- They can be IPC or signal state alignment. Block till this or notify me which section you are in. (Ex. Sta...
In my example I did not provide any internal details. Because I will not be implementing those. So instead I just told you my requirements. You will figure it out.
This notion of soft vs hard, internal vs external, etc. is really off topic from what you really appear to be asking for. Therefore I reclassify the topic back to fundamental reasons for interrupts.
A couple of comments on authmode:
- Not all of the advertised authmodes are supported (notably WPA3 modes), perhaps related to:
- "Currently, PMF is supported only in Station mode." (Protected Management Frames)
- Supported modes are
OPEN,WPA_PSK,WPA_WPA2_PSK,WPA2_PSK WPA2_PSKshows up to some external station asWPA/WPA2 Personal, perhaps because it's (PSK/AES,TKIP/TKIP...
I upvote any solution that provides an equivalent of an integer millis() or ticks() function.
Adding either to microcontroller seems good if you don't want to pollute the time namespace.
(super jealous of _pew.get_ticks() I'd take that if it was available on Trinket / QT Py M0 boards)
Issue #4659. Increased the possible max value of a pulsein pulse to 32767 us. This is as high as it can go with affecting the interface code in shared-bindings/pulseio/PulseIn.c. Tested OK with a DHT11 temperature sensor and an infrared receiver.
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit QT Py M0 with samd21e18
and
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
Code/REPL
import time
from board import SCL, SDA
import busio
from adafruit_neotrellis.neotrellis import NeoTrellis
from adafruit_neotrellis.multitrellis import MultiTrellis
# create the i2c object for the trellis
i2c_bus = busio.I2C(SCL, SDA)
**Behav...
This sounds like there is no power being supplied to the NeoTrellis, because the the pullups should be pulling those lines up. TOr there may be something wrong on the NeoTrellis board. This is a support issue. Could you please start a thread in https://forums.adafruit.com, and include pictures of your wiring? Thanks. You can post a comment here later with a link to the forum thread.
I posted this in the forums yesterday but got no replies. The subject line is "i2c problem with Feather RP2040 and Neotrellis". I'll post pics of the wiring there right now.
INFO_UF2.txt
UF2 Bootloader v2.0
Model: Raspberry Pi RP2
Board-ID: RPI-RP2
OS
macOS Big Sur 11.2.3 (20D91)
Description
Latest build that works is adafruit-circuitpython-raspberry_pi_pico-en_GB-20210411-c333acd.uf2, I've done the bisect actually flashing the images onto the device.
With these builds the volume doesn't show up:
adafruit-circuitpython-raspberry_pi_pico-en_GB-20210412-bd5a3a3.uf2β this is the build following the latest wor...
@tyomitch tagging you for interest: bd5a3a3 is from #4583.
interested in the request. i have a macropad that works with circuitpython, which i would like to use to access to bios. here the thing https://learn.adafruit.com/itsybitsy-keybow-mechanical-keypad?view=all
I am not implementing boot keyboard in the first pass of dynamic USB descriptors, which I am working on right now. But internally the implementation is flexible enough to add later. Once I get the first version working it can be revisited.
nitpick, but if you want to be mathematically accurate the first constant should be _NS_PER_MS.
?serverinfo
what is busio.I2C.try_lock() supposed to return if called more than once without unlocking ? True then False right ?
I believe so but I can't check it at the moment
@tyomitch tagging you for interest: bd5a3a3 is from #4583.
Intriguing! I'll try to get a Pi Pico to debug on.
@eigenein do the broken builds still boot into main.py, i.e. is it only the USB interface that no longer works, or does the whole thing freeze up during boot?
ok I see it
@tyomitch Hmm, it's just got way weirder.
I've uploaded a simple blink+print script, uploaded the bd5a3a3 firmware and the volume has appeared just fine. Same with 2a78a51 and today's 7cf8f79. With the latest firmware I was able to re-attach the device multiple times to USB and always see the mounted volume.
That wasn't the case while I was doing the bisect between 6.2.0 and the latest build; actually I've re-uploaded bd5a3a3 and c333acd multiple times to ensure I've found the correct...
@tulip sleet can we add a check to the uncrustify to look for spaces vs tabs? I'm having to fix that manually for some of Jun2Sak's commits.
seems like it might be a reasonable thing to have in there?
definitely - Just open a quick issue; I don't know how to do it off the bat
Ok I can probably figure it out when I have a minute, I think it's just a regex