#circuitpython-dev
1 messages · Page 370 of 1
Changed both raises here to reset into safe mode, with two new safe mode reasons. Also restructured the safe-mode printing slightly to save 32 bytes.
@onyx hinge for tomorrow when you have time: https://github.com/tannewt/circuitpython/tree/merge_1.13 I'll check in tomorrow before I pick up anything. Note running the tests is a different command because of unix build changes. make VARIANT=coverage test_full
from ports/unix
Adding the Usage template used across libraries to illustrate in readthedocs how to use the different libraries
@kattni as discussed this afternoon. Thanks
sys.print_exception() has disappeared from 7.0.0-* ?
that is the result of 1.12 merge
yep, disappeared in 1.12 merge, probably not intentionnally
we might want to move it from sys though since it's not C Python
(and 7.0s are for breaking changes)
yup, I disabled it because it doesn't match CPython. we could add a traceback module instead with it
I think that's where it is in CPython
I believe it's not really in C Python, I guess the closest would be traceback.print_exc(), but nothing here just takes an exception, it's more convoluted
format_exc might be better, to get a string
@jaunty juniper it is, https://docs.python.org/3/library/traceback.html#traceback.print_exception
no it's not, this takes a bunch of things and does not provide the simple API of sys.print_exception
In function its closer to print_exc()
but as the Python doc explains, print_exc() is only really a macro to print_exception(*sys.exc_info(), limit, file, chain)
sys.print_exception() was probably there because mpy or circpy didn't have traceback
I've seen sys.print_exception used to get the stack trace without halting the code, and to log the exceptions to a file basically, both useful on a microcontroller
having traceback is actually pretty useful overall
you can still do that with traceback
I don't want to see it disappear in favor of a module that will take more space and in particular not fit on small boards
errrr, are you sure about that? https://github.com/python/cpython/blob/3.9/Lib/traceback.py
even in its uncompressed form in CPython, its only 23KB
even if you made utraceback as a version, you're still not going to take extra space than before
(aka, strip functions you don't care about (there is a LOT of format funcs in that lib) it isn't going to make builds bigger in memory than before)
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Raspberry Pi Pico with rp2040
Code/REPL
import board
import busio
from time import sleep
uart = busio.UART(tx=board.GP0, rx=board.GP1, baudrate=115200)
while True:
print(uart.write('Hello, world\n'.encode())) # 0, every time
sleep(1)
Behavior
Unfortunately, nothing. The UART interface reports 0 bytes written, the computer attempting to receive the messag...
@markrawls This issue was fixed recently. Try the latest build from S3.
Running with boot message Adafruit CircuitPython 7.0.0-alpha.1-1004-ga2ae50350 on 2021-05-04; Raspberry Pi Pico with rp2040, the return value from uart.write() is correct, but nothing is actually getting transmitted down the wire.
I am unable to replicate this issue. Can you try the following code.
Connect GP0 & GP1 together. The expected output is hello in REPL terminal.
import time
import board
import busio
import digitalio
led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
s = bytearray("hello\n\r".encode())
uart = busio.UART(board.GP0, board.GP1, baudrate=115200)
while True:
uart.write(s)
data = uart.read(10) # read up to a byte
# ...
I connected GP0 and GP1 together and used that code (modified to use board.GP28 instead of board.LED as that's where I have a status LED hooked up) and saw no output. I change the wire to the one that was successfully receiving data before, but still not output whatsoever. Uncommenting that print statement showed None as the result of every read.
Try GP4 and GP5 with the 7.0.0 version; maybe you have a bad pin?
Yeah, I mentioned earlier that naming is an issue. There's a natural confusion between AP-things related to the AP an ESP32-S2 Station is connected to, vs. The ESP32-S2 as an AP. Changing it would break existing code, but now's the time if we're going to do that. Maybe connected_ap_info or remote_ap_info?
@arctic hamlet In CircuitPython 7, we're adding some things that are overflowing your CS11. I am getting things to fit by turning off longints. Also note there is now a native sdcardio implementation that can substitute for the Python-based SD card library.
It appears you have discontinued the CS11 anyway?
do you have strong requirements for longints?
@paper sedge I sent you a message yesterday via contact form about removing some things from the CircuitBrains Basic build. I may be able to remove less than I thought. Removing async/await and re may do it.
@arctic hamlet similar q for CC03
Hi @tulip sleet. Thanks for the update. Sorry I hadn’t replied yet. Do you happen to know what Adafruit is going to do with their SAMD21 board definitions?
we are going to make them fit :). CPX is a special case, but Feather M0, Metro M0, etc. will all be similar.
Current settings I am testing:
CIRCUITPY_AUDIOMIXER ?= 0
CIRCUITPY_BINASCII ?= 0
CIRCUITPY_AUDIOMP3 ?= 0
CIRCUITPY_BLEIO_HCI = 0
CIRCUITPY_BUILTINS_POW3 ?= 0
CIRCUITPY_COMPUTED_GOTO_SAVE_SPACE ?= 1
CIRCUITPY_COUNTIO ?= 0
# Not enough RAM for framebuffers
CIRCUITPY_FRAMEBUFFERIO ?= 0
CIRCUITPY_FREQUENCYIO ?= 0
CIRCUITPY_I2CPERIPHERAL ?= 0
CIRCUITPY_JSON ?= 0
CIRCUITPY_MSGPACK ?= 0
CIRCUITPY_RE ?= 0
CIRCUITPY_SDCARDIO ?= 0
CIRCUITPY_SYNTHIO ?= 0
CIRCUITPY_TOUCHIO_USE_NATIVE ?= 1
CIRCUITPY_ULAB = 0
MICROPY_PY_ASYNC_AWAIT = 0
for boards with external flash. displayio will be ON, but probably not vectorio (addition to displayio)
countio could go either way
the main addition for CircuitPython 7 in terms of space taken is dynamic USB descriptors so you can turn devices on and off and supply your own HID report descriptors (custom gamepads, etc.)
Thanks. I am pretty sure I am on my last run of these boards. They aren’t selling well anymore, likely due to market shifts like the RPI2040. I am good with whatever is decided for the Adafruit M0 line.
got it; we can always tweak the definitions for you later; the RP2040 is a big (and ultimately good) disruption. We always felt the SAMD21 boards were a stepping stone due to limited RAM and flash, but are not planning to drop them or anything like that.
Totally agree of the 2040 being a good direction. My board is a bit of a different case because it’s more of an intermediate board that you typically would design a mounting PCB around. It’s a tough sell at the price point required for small volume production. The only thing constant in life is change. 😀
if you can get RP2040's and build a tiny castellated board, it sounds like it would go over well
good luck with your product line!
Thank you!
[adafruit/circuitpython] New comment on issue #4697: mpy\-cross build issue on 64bit Raspberry Pi OS
Following merge of 1.12, this seems to be fixed now.
@tulip sleet Are you around for a question about the HID thread?
yup
Limor said "make a note on the Pico HID guides and the HID template", but I'm unclear on what I'm supposed to be making a note of? That multi-media keys are sent using ConsumerControl? Or.. am I missing something.
I think, to make the point that certain keys on a regular keyboard are not necessarily sending regular keycode values, but might be sending consumer control values on a separate consumer control device.
In CircuitPython, this means sending Keycodes values via a Keyboard, and sending ConsumerControlCode values via a ConsumerControl.
So if you have a stock HID keyboard example, maybe it should also include ConsumerControl, instead of just Keybaord, to make people aware they may need to do both. E.g. include sending an "A", and also "mute", or something like that.
Hmm ok.
maybe an augmented example is not necessary, but just add some text that some keys on a keyboard that a person might want to emulate are not actually regular keyboard keys, but consumer control keys. The person in that issue was not aware of that. Or maybe just have a section about "Consumer Control", and how it's used for "multimedia keys", and they don't require focus. It's hard to explain, I agree. People think that the keys on their keyboard are just keys that send codes like any other key, but in fact something quite different is going on.
I'm adding a paragraph or two to the only Pico HID guide I can find now.
it's not Pico only at all, it's any use of HID.
it's just that everyone and their sibling is using Pico to build keyboards 🙂
Right, which is why I was a little confused at the specificity of the request. But yeah.
I'll include the note in my HID template when I do it.
sounds good
@slender iron making good progress on test failures, will push something soon.
past the first set of tests, but there are more failures with "--emit native"
async and native don't mix
@tulip sleet ```USB Keyboards versus CircuitPython HID Keyboards
Certain keys you might want to emulate from your standard existing keyboard, such as multi-media (volume, play/pause, etc.) keys, are not actually regular keyboard keys. They are consumer control keys. All keys on a standard USB keyboard are not necessarily sending regular keycode values, but instead may be sending consumer control values on a separate consumer control device. In CircuitPython this is the difference between sending Keycode values via a Keyboard, and sending ConsumerControlCode values via a ConsumerControl. Therefore, if, in CircuitPython, you intend to send, for example, a "mute" command in your HID example, you should use ConsumerControl instead of an equivalent keyboard key based on your standard existing keyboard.
Consumer control keys, such as multi-media keys, do not require "focus" to function. For example, sending a VOLUME_DECREMENT consumer control command will decrease the volume regardless of what application is currently focused.```
Eh?
Some of that is code formatted in Learn.
oops last part has grammar issues.
Quite clear, I think/hope. Last sentence maybe "regardless of which window currently has keyboard focus"
all this talk about "focus": I am not sure many people know the technical terms, but they just know "I have to click here before I type", but I'm not sure we can educate them on that right now
The writeup makes sense to me and until 60 seconds ago I did not know anything about consumer control keys and how they work in USB
Heh, thanks Mark.
Hopefully that's enough for now.
i was completely surprised by it too, when I was looking at the HID descriptors for a regular keyboard: "hey, what's all this extra stuff??"
There's "sys control" too, which is for power keys, etc., but no one seems interested in those
i think we could use a whole USB guide when dynamic descriptors go in, with more or several pages on HID devices
It should have never appeared. Our policy is to not have any non-CPython functions on CPython modules
yes, but the traceback module is a more complicated way to do it, so I prefer it to be moved to a non C Python module rather than removed
that's fine with me
I just fear another situation where "you can't do it on M0"
but if it's not much more difficult I'd rather match CPython
and maybe it's not, I might not just understand the traceback module
I did a build implementing traceback.print_exception and its 80 bytes for S2
@slender iron want to see a PR?
sure! thank you
So, even though the button on a QT Py RP2040 is controllable in code with CircuitPython, I can't use it in boot.py to trigger storage.remount() because if I'm holding down the boot button on reset, it will go into the bootloader. Right? Sanity check on that please?
I can use the button on a CPX though, I think.
right, you make a delay, and then check the button, but you'd have to explain that
So tying a pin to ground would be a better option.
Thanks. That's what I'm going for.
will the QT PY 2040 be updated to light up the neopixel yellow for safe mode ?
all of the LED flashing will be changing soon hopefully
it should apply to the RP2040 though
I don't think you intend to change wait_for_safe_mode_reset() as part of that ?
nope. I think the startup LED colors will be the same
@slender iron I think I have a good lead on the native+async problems
nice!
We can do this in a follow up PR too.
This looks good to me! Thank you!
This may be expected, but
REPL_RELOADonly arises with Control-D immediately after:
Press any key to enter the REPL. Use CTRL-D to reload.Control-D from the
>>>prompt gives:>>> # Control-D >>> soft reboot Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. code.py output: supervisor.RunReason.SUPERVISOR_RELOAD(same on PyPortal & MagTag)
Thanks for the testing @anecdata! @hierophect wa...
Thanks for adding this! I've included some suggestions below.
It is similar to the simpletest example, however this will display the information in the Read The Docs
Class documentation example template
When documenting classes, you should use the following template to illustrate basic usage.
Code looks good to me! Thank you. I've invited you to collaborate on the repo so it'll (hopefully) run CI immediately for you.
@crimson ferry want to do anything else on your AP PR?
@slender iron There's always more scope, but I think it's at a good place with core features.
How can I determine how much space is left for files on CIRCUITPY using command line? Using Finder is returning the same number no matter what, I don't think it's right.
I don't think there's a way. did you empty the trash?
Two different boards gave the same number.
Disk Utility is giving me a more accurate picture.
So now my original question: is 40KB very much space for a temperature logging file in CircuitPython, or would that fill up really fast?
how much are you writing for each log entry?
and how often?
do you need to write a timestamp?
This code doesn't timestamp it. Only records the temp, on one line, every second.
I'm looking at NeoTrinkey as the smallest example here. Basically I'm trying to decide whether it is possible to use the NeoPixel for the blink codes on boards without a little red LED, or if that would take up too much space.
so 5-10 bytes per second. 300-600 bytes per minute 18k-36k bytes per hour
I wouldn't log every second
Ok, so drop logging time.
So basically every second I add to logging time, adds an hour to how long it would last?
ish
wait no
I'm mathing wrong.
if you sampled every 10 seconds, then 1.8-3.6kb per hour
Ok so no I did the maths right.
Alrighty. So 10 seconds gets over 10 hours. I suppose that'll work.
Better than wiring up an external LED to make a data logger.
Which is what I'm trying to avoid here.
depends on how many digits of accuracy you want. If just 3 digits, then more like 5 bytes per entry
writing every second may wear out the flash also, so 10-30 seconds is a better example
Duly noted.
So glad I wrote this code ever so long ago: while True: cpx.pixels[0] = (abs(cpx.pixels[0][0] - 255), 0, 0) time.sleep(0.5) It's the NeoPixel equivalent of led.value = not led.value.
If I remember correctly anyway.
@slender iron okay, that PR's updated so that all the tests pass. the workflow doesn't run on github because I'm a first-time contributor to your repo...
Yes, thank you @anecdata. I am also unable to replicate the issues with STARTUP on my STM32F405, funny that that issue is for SAMD only. I'll check out both problems.
thanks!
Realising blinking an LED every 10 seconds in that fashion isn't really all that useful. On for 10 seconds, off for 10 seconds... hmph.
blink for one second every ten seconds?
Yeah that would be idea.
I am currently trying to wrap my brain around the logic necessary to do that.
I'm sure it's simple, but I'm missing something.
Need to write the file every 10 seconds, and blink the LED for 1 second, every 10. Need monotonic() maybe?
That's the only way I know how to do it is to use monotonic().
you can blink 1 second and sleep(9) but you'll drift due to overhead, not that monotonic won't anyway
Be back in a few, prepping lunch.
I didn't even know we built latex/pdf documentation -- that's where the actions in my repo failed.
/home/runner/work/circuitpython/circuitpython/CONTRIBUTING.md:8: WARNING: None:any reference target not found: CODE_OF_CONDUCT
Drift is fine, this isn't meant to be precise. But I'm not following how that would work. Trying something like what you're suggesting and it's not doing what I need it to.
ah sorry, I might have misunderstood what you wanted to do
No worries, I sort of thought it might work as well.
I'm trying to do two things in a loop. One thing every 10 seconds, and the other thing for 1 second, every 10 seconds.
not synchronous with each other ?
So, let's say, print to the serial console once every 10 seconds, and blink the LED for 1 second every time I print.
Synchronous.
Not perfectly because print doesn't take 1 second, but you get the idea.
Huh, this is an interesting idea. I wonder if we can add something to the data files that CircuitPython generates since every board is already split up in Ports folders.
@idle owl, turn LED on, sleep 1 sec, turn LED off, sleep for 9 seconds, read and log temp, loop around
Oh. I need to separate out the LED code. Ok. That makes more sense.
I knew it was something simple I was missing. 🤦♀️ Thank you.
np 🙂
Easier to explain than my fancy neopixel = not neopixel code anyway.
Although SAMD21 and SAMD51 are grouped together in CP, so maybe not the best approach. If we add to the data files, I think we'll have to have some checks in place so the values are restricted to a list because Jekyll likes to group things like "SAMD21", "samd21", and "samd 21" differently.
maybe blink 1 sec, read/log temp, sleep 9 seconds, so the logging is close to the blinking
I wrote a simple print/blink thing and it seems to be pretty close. But yeah I'll reorder it.
pixel.fill((255, 0, 0))
time.sleep(1)
pixel.fill((0, 0, 0))
time.sleep(9)
print("Test")```Puts them kind of together because end and beginning of loop...
This is better. while True: pixel.fill((255, 0, 0)) print("Test") time.sleep(1) pixel.fill((0, 0, 0)) time.sleep(9)
except might be a problem if the write takes longer then 1 second.
Can put write first.
Thanks @kattni all changes included in https://github.com/adafruit/circuitpython/pull/4709/commits/0f60a3b997b26b5d0a67d547247867d0b63bb2f0
I am sorry kattni, returning to see this and I see that I have never posted this comment... sorry about that
@jposada202020 No worries! I get a notification email when you commit. So I knew to check it out.
Did this ever work? It gives the pin a Pull.UP but we say to connect it to ground.... Is that right? Because giving A0 on QT Py RP2040 a pull up, and connecting A0 to GND returns False and connecting it to 3.3V returns True.
Wait.
I think I just confused myself with the readonly thing 😆
OK, I confused myself because it wasn't really tied to ground, the wire apparently wasn't quite connecting. So I thought everything was backwards.
False alarm.
Oooh I almost wasted a ton of time troubleshooting that buggy pin definition on the Itsy RP2040 that I fixed. Apparently had only updated one of my two Itsy's. Oi.
Also destroyed my USB on that board reset. Had to unplug my hub from the wall and plug it back in to bring my keyboard back up.
sometimes with a rp2040 board on my Mac, after going to bootloader I have to switch USB port or the CIRCUITPY drive doesn't come up. It's very elusive and I have like 2 powered USB hubs in cascade, so who knows what's up with that...
I have a dumb question... in the context of the dynamic USB descriptors, is CDC Data in CircuitPython the serial output, and that's distinct somehow from the REPL in USB?
there will be cdc data and cdc console; the latter is the REPL and the normal destination for print(), etc. aka sys.stdin and sys.stdout. However, if you access it through usb_hid.console, it is a binary stream ,as opposed to through print() or input(), where it's a text stream
i have also seen that sometimes i have to power cycle or just reset to get the drive back. Which OS is this on?
it's Catalina
that's all cdc console, right? is cdc data something in use in CircuitPython currently?
cdc data was availaable in 6.2.0-beta.2 or 3 but then turned off afterwards because it confused Mu
it's coming back in 7.0.0 but will be turned off by default. Also now Mu knows how to identify a particular CDC as console/repl
I had the impression (perhaps mistaken) that was a secondary console that was turned on then off, is data characteristically different than console?
I'm having issues with more than one board on Catalina. Absolutely cannot get two to show up at the same time. I have to get to the files via command line.
In Finder, I mean.
If I want to use Finder to copy files, I have to unplug one board, and then reset the other board to get it to show up.
They both mount fine, and are accessible via command line.
not sure what you mean by "characteristically". It's a completey separate channel, so on Windows, COM5 might be the console/repl, COM6 might be data. Nothing is sent to data except by you, so there's no interfering data like console messages or repl prompts, etc.
sorry I'm being obtuse about this... so console is really a subset of data that we use in special ways?
@idle owl do you use column view? sometimes I won't see a volume in the left naviugation pane, but it will show up if I navigate the columns to find it
they are both USB serial (CDC) devices. until 6.2.0-beta.3 or whatever there was only one, which was used for the REPL
I do not. I'll try that next time.
now we have an optional second one, which is in addition to the REPL
i'm not sure what you mean by subset
until usb_cdc existed, there was just text stream access to the REPL connection via input(), print() or sys.stdin and sys.stdout
oh, I make the removable drives show up on the desktop, I forgot that's an option
now you can also access the same stream (as a binary stream, not text) using usb_hid.console.
Ugh, I don't. I get annoyed by that.
if you enable usb_hid.data, then you have a separate bidirectional stream that you can use however you want, that shows up as a separate COMxx or /dev/tty...
Is there any case where we actually use exit_code != 0 to exit the for loop in main and hit mp_deinit? Or is that just legacy handling?
I think you can do sys.exit(1), etc
is there a point to doing so, though?
thanks for the deep dive, Dan!
i'll probably write a guide 🙂
mp_deinit doesn't appear to do a lot, just MP_THREAD_GIL_EXIT, which is just some kinda mutex thing?
maybe not, but in the future, there might be, to indicate some error condition
@tulip sleet you can read console as binary, but receiving 0x03 will still ctrl-C the program right ?
i mean, in regular python sys.exit() returns an integer to the shell. We don't have a shell to take that, but you could imagine somehow passing that error code back
it'll hit the end of main, right? Is that even defined the same for ARM vs XTENSA etc?
right, because the repl stream is still reading it. It's just another connection to the same stream
i don't think we would necessarily cause main() to exit, it could be handled by supervisor, which kind of takes the place of the shell
but right now, no, it's not interesting, but I wouldn't take it out; it's latent support for doing something.
Ok, good to know. Thanks!
was just curious whether something sneaky was happening there.
I do kind of wonder what happens with the return 0; from main though, I'd have to look at the C runtime
It could be defined differently between ports.
yeah, just looking, main() gets called from the reset handler in mimxrt, but I don't see other ports calling main(). However, there is something that calls main in the guts of the arm-none-eabi runtime
or the xtensa one, in the ESP case, which might be different.
I could put in a comment saying the behavior is undefined, maybe?
@slender iron can you help me with github privs? I don't have access to the settings tab of https://github.com/circuitpython/CircuitPython_Library_Screenshot_Maker
@onyx hinge added you as a maintainer
thanks!
@lone axle Have you started on the CircuitPython Essentials storage page update yet?
made you an org owner too
@lone axle I'm asking because I started working on the Template, and you may want to check it out because I'm trying to include the bits that I wanted included in the current one. And if you started on it, I wanted to look at what you have. If you haven't, you can check out what I have as I work on it.
Not yet, it's on my docket for tonight though.
@lone axle Alright, remind me to send you a link to the template before you start working on it tonight then. We'll see how far I get. Templates are a little weird to look at, but you'll get the idea.
Will do.
@slender iron thanks, I was able to make sure actions was enabled in that repo (I think it was all along but if a PR has workflows but the main branch doesn't, github doesn't bother running them in the PR)
GP4 and GP5 did work with the 7.0 version, looks like my GP1 pin is dead. That's unfortunate, but I'm glad it was just a simple flaw along those lines.
Check whether your USB-serial converter (if that's what you're using) is set for 5V rather than 3.3V levels.
It's connected directly to a Raspberry Pi 4B on GPIO pins 14 & 15, which are 3.3V.
Are microcontroller.cpu.temperature values affected by ambient temp? As in, could you track changes in ambient temperature by running a basic board-only temperature logger for a period of time, or do the temperatures of the MCUs stay pretty consistent regardless of ambient temperatures? I've never run one long enough to have any idea.
Trying to figure out whether it's worth telling folks "You can plug this in anywhere you have USB power and track the temperature" or whether there's no point because tracking CPU temp in random places isn't useful.
Playing with Thermal display, you can be stuck into a function call to the library for a "long time" and you cannot catch event (button or else) while receiving your frame.
This usecase is discussed at the end of this blog post: https://www.recantha.co.uk/blog/?page_id=20924
The CPU temp can change based on ambient temperature but it will still register higher (usually) then ambient and CPU workload can also affect it. If the CPU workload is pretty even and has reached a consistent temp, then the ambient temperature may be detected by changes, but it would be a relative measure. Hope this makes some sense
That makes exact sense. That's exactly what I was thinking, but wanted a sanity check.
Basically it's running the data logger code, and that's it. So if you set it and forget it until it fills up, it should be stable.
Thanks, Mark!
Welcome!
@blissful pollen The temperature is not the ambient temperature; it is the temperature inside the microcontroller, which will typically be higher than ambient temperature. However, running only this code, once the microcontroller temperature stabilises, it should at least be consistent, and therefore usable for tracking changes in ambient temperature. Changes is in italics.
Clear enough?
reads clear to me
Great, thank you.
@onyx hinge I'm gonna merge in your fixes and keep going with it
I'm not going to amend that starting commit anymore
@slender iron thanks, let me know if/when you have more for me to look at.
👍
[adafruit/circuitpython] New comment on issue #4697: mpy\-cross build issue on 64bit Raspberry Pi OS
In #4712 we added building mpy-cross for aarch64 so this regression should be noticed in the future. Thanks again1
What is it called in Python when you get an error? Is CircuitPython "returning" the error? "Receiving" the error sounds wrong, but returning seems dubious as well.
"throwing" seems familiar?
But also seems more casual.
I think the Python term is “raise”
Yes!
That is it. Thank you.
throwing is used in other programming languages, python raises an exception
Swift throws an error
I've fixed the REPL to correctly set the reload reason when it encounters a CTRL-D during the repl process, as opposed to the triggering character, as Scott suggested. Works for me in testing.
However, @anecdata I can't replicate your problem with the SAMD not returning STARTUP after hitting the reset or using microcontroller.reset(). My M0 and M4 express boards both return this value after restarting. I don't have a PyPortal, but there are exactly 2 places where AUTO_RELOAD can actua...
Woah. I just erased my CIRCUITPY filesystem, and now it's NO_NAME. By hitting reset, and then hitting reset again in an attempt to get into safe mode.
I can still get to the serial console.
Hey I was able to reproduce it
I think it's if I hit reset when the status LED is blue. Because it took a few tries this time.
I do not have a boot.py on this.
It's currently called storage_boot.py. and doesn't have valid pin names in it.
that is before boot.py runs, but maybe you caught the USB just trying to set up the MSC device
Hmm.
Related question: how do I get into safe mode or is that not a thing you can manually trigger anymore?
do you see it yellow for 700ms? It's during that time you can do it
No, I don't see it yellow, that's when I thought I was suppose to do it.
me too...
there could be something different about the startup on RP2040
but I don't know off the bat. That may be a Scott q
Being able to destroy your filesystem by hitting reset in the wrong rhythm seems worth dealing with.
storage.erase_filesystem() gets me CIRCUITPY back.
i keep trying to think of a better way to indicate getting into safe mode, but we need yet another button, or maybe support for triple-click in the bootloader
re: STARTUP, I'm not sure, could be a problem with the test method. I commented out the reload to remove that variable, and added in a time indicator:
import time
import supervisor
time.sleep(10)
print(time.monotonic(), end=" ")
print(supervisor.runtime.run_reason)
#supervisor.reload()
After a hard reset, I wait about 5 seconds until the volume appears, then start screen. Result:
14.928 supervisor.RunReason.AUTO_RELOAD
Code done running.
Auto-reload is on. Sim...
Can't seem to do it again with no code running. Let me add a code.py with something more substantial than hello world in it.
Still not doing it. Was it somehow trying to run the code in storage_boot.py? Trying with that.
It's not a valid file, there's no pin names in it or whatever, it's a template file.
but it turns blue, I hit reset, and it blasts the board.
Weird. The SAMD boards have a longer time to connect to the serial connection, in my experience, so it isn't trivial to tell without introducing new variables whether it is restarting for some reason under the hood. What kind of computer are you testing on? Is it possible that Screen is triggering the MSC autoreload somehow?
ah I though I understood a thing but I misread >_>
oh the itsybitsy 2040 also has a NEOPIXEL_POWER pin
@jaunty juniper Oh thanks.
does it have a 700ms delay on boot ?
I have no way to measure that 😄
true
the difference might be visible if you light the neopixel in code.py, compared to the pico (which doesn't have the delay due to no status LED)
it shouldn't do that, but if you reset before boot.py was completely written, that might happen (though it's very rare on the Mac)
In Linux, you can run the sync command, which forces stuiff out. It might exist on MacOS too
any other file disappear ?
I mean, it persists through a normal reset. But If I click reset again when the LED is blue, deletes boot.py.
macOS, anything is possible in the interval before I get output... I'll try another method... I'm open to suggestions, but:
import time
import supervisor
import microcontroller
reas = str(supervisor.runtime.run_reason).encode()
microcontroller.nvm[0:len(reas)] = reas
time.sleep(10)
while True:
print(microcontroller.nvm[0:len(reas)])
print(time.monotonic(), end=" ")
print(supervisor.runtime.run_reason)
time.sleep(5)
after waiting about 20 sceonds to star...
It also resets code.py to it's initial state.
I added a test print into code.py, and it's gone.
So basically, add some code and a boot.py file, click reset, NeoPixel turns blue, click reset again, CIRCUITPY is back to it's initial state.
Won't that sketch overwrite the nvm message if reloaded? Or am I just being an idiot and missing something? You could add a counter to the first byte of NVM to see how much it increments by the time you look at it.
I'll try that. Odd though that SAMD51 behaves differently than ESP32-S2.
I'll try that. Odd though that SAMD51 behaves differently than ESP32-S2.
I think it's specifically the PyPortal you have, my SAMD21 and 51 work fine. Do you have another SAMD51 board you can try it on?
Anybody have a PyPortal who could give the run_reason PR a shot? We're having trouble pinning down a weird overwrite of the "STARTUP" with "AUTORELOAD" reason on that board.
are the artifacts unavailable while it's re-building?
You're right, weirder than I thought... Feather M4 with 6.2.0, with no special preparation, just plug in, start screen, and control-C:
>>> supervisor.runtime.run_reason
supervisor.RunReason.STARTUP
@idle owl I will be getting going on the storage clarifications shortly if you want to send me that page to take a look at.
I'll DM you the link.
I think the only other point not covered on that page is explicitly explaining the CPX switch. Because that page is written for using a pin, and there will be a separate one for using the switch.
Latest artifacts:
Adafruit CircuitPython 7.0.0-alpha.1-1042-gb9843f15b on 2021-05-05; Adafruit Feather M4 Express with samd51j19
>>> import supervisor
>>> supervisor.runtime.run_reason
supervisor.RunReason.STARTUP
Adafruit CircuitPython 7.0.0-alpha.1-1042-gb9843f15b on 2021-05-05; Adafruit PyPortal with samd51j20
>>> import supervisor
>>> supervisor.runtime.run_reason
supervisor.RunReason.AUTO_RELOAD
I didn't notice this earlier, but watching the PyPortal built-in display, the PyPortal does reload after a hard reset, with no other action on my part. That would explain it.
okie doke, TIL...
Tested changes for REPL_RELOAD from the >>> prompt, and it now works as expected.
@lone axle Explains why I couldn't get to it on this board. Basically you'd be stuck listing all the boards it works for, etc. So, forget it. Means you could be able to get pretty much everything you need from the template.
Makes it easier!
The ItsyBitsy RP2040 also does not show yellow on start up.
@tulip sleet I am reproducing this weird deleting boot.py issue. Should I file an issue at this point? Is this a bug or is it me?
sure, document the recipe to get it; it may ultimately be something else but it's good to write it down; i don't think it's necessarily you
.. and also distinguish CircuitPython better in mpy-cross --version
In #4693, we allocated some flag bits differently than MicroPython (in order to fully distinguish async functions from generators). This makes our .mpy files incompatible with ones generated from any version of MP.
Change our first mpy signature byte to 'C' to distinguish us from MicroPython which uses 'M'.
Hopefully this will be the last bytecode incompatibility before 7.0. :stuck_out_tongue_winking_eye:
I will get it worked into the hidden page and note which direction the switch is for each setting.
Perfect. Thank you.
@slender iron do you want to review the run reason thing or should I go ahead and merge? Green light from Anecdata
no need to wait for me
k
Does Circuitpython supports 32MB of flash? I know there is a 16MB csv file with the partition, but I'm wondering if I can modify that to support 32MB?
Also, is the "squash and merge" feature on Github new? That seems handy
We don't have it turned on though
on what board? usually the port has a limit
Is for my new board the ATMegaZero. We are shipping it with 32MB flash with the ESP32-S2, but I know that their firmware is limiting it to 16MB
We don't squash because that rewrites history and makes it hard if folks reuse their local branch
Hmm, gotcha
the only q is whether CIRCUITPY rolls over smoothly to FAT16 from FAT12 when you get to 16MB (actually it depends on sector size and # of sectors, but it's usually 16MB). The underlying code is supposed to handle FAT16, but I'm not sure it's been exercised.
(welll, maybe that's not the only q, but it's the q i have)
if it doesn't work we will want to fix it
Is there a way I can test that out to see if it would handle it?
you could just specify the new flash chip and then try a build. I think the CIRCUITPY size is just what's left over after everything else, though I'm not sure. I didn't do that part.
worst case is at first the size will need to be limited until any issue about it gets fixed
@slender iron can you think of any other gotchas?
Right now I'm running the board fine with 16MB out of the 32MB
but, i'm not taking full advantage of the extra space
so are you pretending the chip is the 16MB part number, or did you just set a limit somewhere?
@slender iron those test failures are weird. Python 3.8 prints these SyntaxWarnings, CP/MP never have. Python 3.7 and below didn't. So I get a pass locally since I have 3.7. But we aren't NEWLY using 3.8 for CI. If you look at a build of main in the CI, you can see that the SyntaxWarnings are shown as part of the output, not "what is being compared"... weird.
The board has this memory chip in it. https://www.mouser.com/ProductDetail/Winbond/W25Q256JVEIQ-TR?qs=qSfuJ%252Bfl%2Fd4d16629NnShw%3D%3D. When I created the board definition I used the 16MB partition because I couldn't find any 32MB example.
ya definitely. it does matter how big the memory mapped space can be
ok, I think I'm on 3.9 locally but I know what to ignore
This is the board I'm referring to BTW: https://cdn.shopify.com/s/files/1/0489/4720/0154/files/F4A1C54A-64C3-4A28-9D8E-7C9D2EA92C1B.jpg?v=1619533357
I would love to take advantage of the 32MB since I'm planning to ship it with CircuitPython
(I can reply better after show and tell)
looks like it depends on the idf
only 10.5MB are supported through the memory mapped cache
but the datasheet says up to 1GB is supported
right
which is why we went with 32MB since that was the biggest chip we could fit in this board
this is where CP calls into the IDF: https://github.com/adafruit/circuitpython/blob/main/ports/esp32s2/supervisor/internal_flash.c
I also just noticed that CircuitPython doesn't have the partition I was referring to. I got confused with the arduino approach.
How can I verify if it's reading the memory size correctly? Sorry I'm not super savvy with this yet. 🙂
the drive should be 28MB when working I think. 3MB are used for CP
you'll want to change CIRCUITPY_ESP_FLASH_SIZE=16MB and add a 32MB partitions.csv file into esp-idf-config
Which values can I change here for the 32MB? this is copy from the 16MB partition csv file.
the userfs size
Thanks, let me try that
I did change the stderr capture I think
@slender iron it could be that, maybe I just didn't see it in the diff
we could also add to the python3 commandline the flag to turn off all warnings if we knew what it was
-Wignore
I was running the make script and got this error after updating to 32MB. esptool elf2image: error: argument --flash_size/-fs: 32MB is not a known flash size. Known sizes: 512KB, 256KB, 1MB, 2MB, 4MB, 2MB-c1, 4MB-c1, 8MB, 16MB
that looks like an idf issue, not a CP one
it appears it may have been added in esptool, but it requires a newer one than is in the esp-idf version we use -- https://github.com/espressif/esptool/commit/bb9a93b9d7170aa1ad015df881f2c881a81dada1 (march 25)
huh either feb 16 or mar 25 🙂
https://github.com/adafruit/circuitpython/pull/4195 seems to be the latest place we've discussed updating esp-idf. It might be worth revisiting for main branch / 7.0 because the trade-offs are different than when we were trying to stabilize 6.2.0 for release.
I'm trying to use that branch from that PR for testing the new idf but I keep getting some errors when running the make script. fatal error: soc/gpio_periph.h: No such file or directory
#include "soc/gpio_periph.h"
^~~~~~~~~~~~~~~~~~~
wait, I forgot to run git submodule update.
Testing again, hopefully it works
@slender iron Ok, I'm almost there. Just got this new partition error. esp32s2/esp-idf-config/partitions-32MB.csv' occupy 4.3MB of flash (4549568 bytes) which does not fit in configured flash size 2MB. Change the flash size in menuconfig under the 'Serial Flasher Config' menu.
I gave the value of user_fs, data, fat, 0x450000, 27584, for 32MB
I semi guess that number of google conversion of MB to KB
take a look at the other files in the board directory
theres is probably something else there
I haven't seen any 32MB version yet
Thanks - this is certainly necessary.
@tannewt This is ready for re-review. I broke out the responses to your review in fc8e1c4. The other commits are reworking the builds to make them fit and make the choice of modules more regular.
I've tried to flash adafruit-circuitpython-espruino_pico-en_US-6.2.0.bin on the Espruino Pico following the advanced reflashing instructions on https://www.espruino.com/Pico#advanced-reflashing , but after what seemed a succesful flash the board didn't react in any way (nothing was logged in dmesg).
I have also tried 7.0.0-alpha.1 with the same result
On the same board I have successfully flashed micropython, following the same instructions.
I've also found this post on the forum htt...
@idle owl for whenever you dive in today: I have the unpublished page here https://learn.adafruit.com/admin/guides/1954/editor/22213 with the new wording from your template plus a note explaining which way the switch on the CPX / CPB belongs for each setting.
oh the mpy-cross page has the same multiple pages issue as the adabot stats, with the windows versions being pushed to the bottom https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross/
I'm cross-asking this here (already asked in the UnexpectedMaker Discord): I'm running the same code on a Feather S2 and Feather M4 Express but the M4 is a lot faster (RGB matrix, running at 7 FPS with the S2 vs 12 FPS with the M3). On paper, this shouldn't be the case and the S2 should outperform the M4 by being almost twice as fast.
Same results on Circuitpython 6.2 release and 7.0.0-alpha1.
On the S2 the RAM and flash are off board so are slower to access. Maybe that counteracts the processor speed.
Hmm that does makes sense. My application is very memory heavy and I'm doing a lot of matrix calculations. Unfortunately I have nothing as optimized as numpy 😄
is this MP or CircuitPython?
Circuitpython 6.2 release and 7.0.0-alpha1.
There is no pre-built MP binary available yet as far as i know
The speed in MHz is not everything when comparing the speed of chips
Sorry I was talking about the bumpy party you could use Ulab
The cpu architecture can impact cpu performance as well
Absolutely. But with double MHz speed I would have expected... well at least comparable code speed.
how did i not know about that! That might help!
Thanks!
No problem 🙂
It will for sure
My guess is both the memory access and differences in cpu architecture will be impacting. That being said I don’t have that much knowledge on the lx7 core the esp32s2 uses.
Already gained ~20% speed replacing pow() with **...
Definitely give ulab a try, it’s not as good as fully cpython numpy but offers much better performance than plain circuitpython.
@tulip sleet can you help out with this?
On the M4 i was RAM constrained so i had to split up image sprites into single bitmaps. Might try to revert to sprites and use the additional RAM, vs. having to read a BMP file for every frame.
sure, thanks, I will just clean most of the versions. @jaunty juniper
@tulip sleet now that micropython 1.12 and #4713 are merged in, I believe the mpy format is stable for the time being ? Could then an alpha 2 release be made to upgrade the 7.x bundle to the latest mpy format going forward ?
Let's double-check with @slender iron about the mpy format, but yes, I can make a release. The dynamic USB PR is close to done, so when that's in, I can make a release in the next few days.
@onyx hinge just tried the new mpy-cross on a pirkey_m0 (converted adafruit_dotstar and adafruit_pypixelbuf) worked fine!
Could you try some earlier versions: 6.1.0, 6.0.0, 5.3.1? That will help us narrow it down. You can download them here:
https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/espruino_pico/
Sounds great 👍
Thanks a lot
في الخميس، 6 ماي 2021 13:56 Nicola @.***> كتب:
Hi, check my repo here
https://github.com/n-elia/MAX30102-MicroPython-driver. Feel free to
propose improvements.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/issues/2359#issuecomment-833499548,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARIAJJHRD5SP2YIHMV3RHP3TMKGWNANCNFSM4...
Cheers, looking now.
@slender iron I tossed in a PR to fix what I think were the last two failing builds.
for some reason it's still requiring approval to run in your repo... huh.
@lone axle Ok I made a couple of tiny changes, but overall it's good to go. Feel free to integrate it whenever you get a chance. Love the page name 😄
😄 I'll work on moving it over tonight. Thank you.
This is on an ItsyBitsy RP2040.
Currently running:
Adafruit CircuitPython 7.0.0-alpha.1-1025-g30c7aa8fc on 2021-05-05; Adafruit ItsyBitsy RP2040 with rp2040
** code.py and boot.py
It doesn't matter what you add to code.py - I added another line simply to verify the behavior.
code.py contains the following:
print("Hello World!")
print("Another line of code.")
boot.py is empty.
** Behavior
To reproduce:
Click the reset button. When th...
@tulip sleet The ability to turn off the REPL and CIRCUITPY is already in main?
Want to know if I should include a warning in this section about using the REPL to recover a read-only fileysystem about how if you turned off the REPL, it won't work.
@idle owl not yet
I did some basic benchmarking a while ago when I saw some odd-looking performance numbers in HackSpace. Your code sounds more like a real world application. In https://forums.adafruit.com/viewtopic.php?f=60&t=170425if you're interested
Thanks.
@slender iron it is possible to create a group of reviewers for the circuitpython.org? similar to the librarians in the libraries? thanks
Hmm. Is there a way to differentiate between ValueErrors if they don't have an Errno? I'm trying to write a script that tells me what pins have touch capabilities, and ValueError is returned on invalid pins, and also on valid pins without a pulldown.
The PWM/SPI/UART/I2C scripts simply use ValueError to determine invalid pins. But that isn't working here.
Or is there some other way to know what pins work with touchio.
I want to take a peek at 1.14 first. I think it might be pretty quick to do
Ya, I think we could have a librarians team there too. (or just use the graphics team)
@tulip sleet for the mijia sensor did you find someone who determined how to change the display from C to F?
without the app
haha, got it
I'm such a "hacker"
sent 1 to the the Temperature uint characteristic
🎉
Touch (no pulldown) on: D7
Touch (no pulldown) on: D9
No touch on: LED
Touch (no pulldown) on: MISO
Touch (no pulldown) on: MOSI
Touch (no pulldown) on: NEOPIXEL
No touch on: NEOPIXEL_POWER
No touch on: RX
Touch (no pulldown) on: SCK
Touch (no pulldown) on: SCL
Touch (no pulldown) on: SDA
No touch on: TX```
Script works. It's aware of the pulldown or not situation. code.py output: Touch on: A0 Touch on: A1 Touch (no pulldown) on: A2 Touch (no pulldown) on: A3 Touch (no pulldown) on: D0 Touch (no pulldown) on: D1 Touch (no pulldown) on: D10 Touch (no pulldown) on: D11 Touch (no pulldown) on: D12 Touch (no pulldown) on: D13 Touch (no pulldown) on: D24 Touch (no pulldown) on: D25 Touch (no pulldown) on: D4 Touch (no pulldown) on: D5 Touch (no pulldown) on: D6 Touch (no pulldown) on: D9 No touch on: LED
Some comments and messages used the non-standard spelling
I've used, as root, the command dfu-util -a 0 -s 0x08000000 -D adafruit-circuitpython-espruino_pico-en_US-6.1.0.bin (etc. with the other versions)
6.1.0 -> no storage device, no serial device, nothing in dmesgs
6.0.0 -> no storage device, no serial device, nothing in dmesgs
5.3.1 -> works fine
wanna pr? 🙂
@hierophect This is an STM32F401xE. Do you have any guess of why this would have stopped working?
I don't have one to try.
Scott just has to do a final review on the PR.
I'll add the warning, then. Might be a little confusing for a bit, but better to have it.
on reflection, do you think if we just make one "SOS" build per board, it should be an eraser, or simply drop you into safe mode, where you can erase/reformat via the REPL or rename boot.py via CIRCUITPY
I thought safe mode didn't work on everything.
Or is it the rest to safe mode that doesn't.
i think it's reset to safe mode. I will just make sure I can make an "immediate safe mode" RP2040 build
i know what you mean; I had to clean my desk over the weekend. It had about three layers of projects and other cruft
I'm glad to hear having a pile of random circuit boards on my desk isn't unusual
I just had to move my office, which unfortunately meant dismantling about three layers of long-term "experiments" 😦
My desk is actually uncharacteristically clean at the moment. I mean, it's cluttered, but I can still see desk. Here anyway. My other desk is a mess.
Could be something got messed up with the oscillators in the course of the v6 updates. I'll check it out.
in https://circuitpython.readthedocs.io/en/6.2.x/shared-bindings/gamepadshift/index.html :
"They button presses are accumulated" should be "The button presses are accumulated"
I will include this in in some unrelated upcoming PR - thanks.
I feel like the Espruino Pico has the most misleading possible name for a devboard now. It's not an ESP32, it isn't from Arduino, and it's not a Pico.
or confusing, rather. It's not like it's their fault.
By the way Mark, how come only the people and Show and Tell could have one of your boards? 🤔 😋
Ha just was my thought cause they're showing and telling something! But if contributors to CP wanted one that could be arranged - if I can find a replacement IMU
Remind me if I forget, I plan to check for a replacement chip soon but I'd send you one for sure
Thank you very much 🙂
This might be related to having the FS writeable and being writing boot output to boot_out.txt.
In the long term I'd like to see a TOML database for boards similar to https://github.com/adafruit/nvm.toml. That info is more broadly useful than just having it in CP.
@onyx hinge gonna get back to this? https://github.com/adafruit/circuitpython/pull/4607
The LSE on the Espruino Pico is actually DNP, which isn't documented on the schematic. This was causing a clock failure after the 6.0 STM32 timekeeping reworks.
Resolves #4714
@idle owl (if you have time) do you have an M1 Mac? I couldn't remember if you mentioned that. I have one thing for you or someone to try
What would need to be done to use u2if with adafruit RP2040 boards? Would a similar pull request as this one need to be done but with a new board and pin definition? https://github.com/adafruit/Adafruit_Blinka/pull/449/files
I think @tidal kiln would know @gloomy shuttle
yes. that PR, plus one like this:
https://github.com/adafruit/Adafruit_Python_PlatformDetect/pull/152
but the bigger task would be to update the u2if firmware with builds for those boards
this is all planned to be done eventually
for feather/itsy/qtpy 2040's
Thank you and that is good to know! That u2if on the pico really saved me a lot of hassle on a test project I am working on. It will be really nice with the adafruit rp2040 boards, stemma qt connector, and the new see saw rotary encoders.
cool. yep. that's the hope. it'll be a bit of work, so no known timelines.
glad you found the blinka/pico-u2if combo useful
that u2if firmware is the real magic
I don't have one.
ok, np, tnx
GitHub actions cache is broken again. Also fixes #4717.
[adafruit/circuitpython] New comment on issue #4592: Add circuit python countio support for the Clue
I think this is closed by #4609
Oh shoot, thanks for catching this! ❤️
Random thought: I know there has been questions about running items on the second RP2040 core, I wonder if the native MPY change being merged in would be a good way to target something like running code on the second core.
(cavet I haven't had a chance to look or examine the code related to the native MPYs yet)
That's a nicer number
Does anyone have tips on how to load onto a RP2040 and restart it without the Jlink needing to be disconnected and reconnected? After I load, I always get ISR hardfaults, or a deadbeef report, or any number of things and always have to restart GDB or even hard power cycle
For each board, this builds one special build that erases CIRCUITPY when loaded. The status LED starts at red and goes to blue when done. The build does nothing after erasing: no USB mounting, etc. So it's language-independent.
The GitHub Actions build will create a new CIRCUITPY_ERASE directory in S3 for each board, alongside the language directories.
Basically, this is a simple way of making per-board flash erasers without involving Arduino, etc.
Thanks for making this. One alternative that I've used for scenarios that needed this is to instruct Circuitpython to enter the repl first, before executing any user code. Simply erasing without having the user do anything is conveniently fire-and-forget, but it's another option to consider - it would let you access the filesystem and extract things you want from it before erasing.
[adafruit/circuitpython] New review comment on pull request #4722: build a CIRCUITPY\_ERASER variant
Did you want to keep this, or can the whole if block be removed?
It appears the CI is failing for unrelated reasons on the ESP32-S2, nothing to do with this I don't think.
[adafruit/circuitpython] New review comment on pull request #4722: build a CIRCUITPY\_ERASER variant
oops, that was a testing thing. It's only 75 bytes to add a non-empty code.py, but that can be a separate PR.
Thanks for making this. One alternative that I've used for scenarios that needed this is to instruct Circuitpython to enter the repl first, before executing any user code. Simply erasing without having the user do anything is conveniently fire-and-forget, but it's another option to consider - sitting in the REPL would let you access the filesystem and extract things you want from it before erasing via
storage. This would be done by changingbool skip_repl = true;tofalsein `main()...
It appears the CI is failing for unrelated reasons on the ESP32-S2, nothing to do with this I don't think.
Yeah, I fixed the build problem with #4721. This seems to happen every time there is some updated software on the build system VPS's.
@hierophect Could you drop an Espruino Pico build in #4714 for the OP there to test? I thought I could point to an artifact, but I don't see any artifacts. Thanks.
@dhalbert makes sense, sounds good to me
That's weird, don't they normally show up even when the build fails overall? Anyway yeah I can drop one over there.
@valholl Hi, want to give this binary from my fix in #4719 a test? This fixes the problem on my Pico. Normally I'd point to the build artifacts but CI is being weird and didn't generate any.
firmware.bin.zip
That's weird, don't they normally show up even when the build fails overall? Anyway yeah I can drop one over there.
Yes, I am confused why they aren't there.
I've got an M1, and happy to help out if you need something tested
@fossil gorge Is it still limited to 1 external display?
Not sure. I'll give it a go and find out
I haven't looked recently. That was a dealbreaker for me.
Oh. That also works 😄
@fossil gorge The thing Dan wanted tested. He wants to know what prints out when you do the following: ```# unplug all CircuitPython boards
$ pip3 install adafruit-board-toolkit
$ python3
import adafruit_board_toolkit.circuitpython_serial
print(adafruit_board_toolkit.circuitpython_serial.comports())
now plug in a CircuitPython board and wait for CIRCUITPY to appear
print(adafruit_board_toolkit.circuitpython_serial.comports())
print(adafruit_board_toolkit.circuitpython_serial.repl_comports())```
@slender iron I don't think I can "finish" it to the point where we're at zero diagnostcs right now (so much stuff to do!), so we can't enable -Werror=missing-prototypes. It might be better to vet the changes that are in that PR and if possible merge it as is, vs letting it languish.
that's fine with me
So, as far as my Macbook Air goes, so far, only 1 display - more if you count mirroring the external display (I don't)
Neither do I. Thanks for checking.
Will give that a try and report back
There appear to be workarounds that require extra hardware to run more than one display. Apple supposedly said they'd include native support in a future Big Sur update. I apparently will still be waiting.
Probably with something from DisplayLink. Works well in a pinch, but it's a lot of CPU work for the external display
Because I has teh smartz, I'm guessing that would be with a CP7 image, right?
Sorry, meant to tag @tulip sleet about that question
Oh I have no idea. Heh yeah, I was going to say. Ask Dan 😄
hi, no it has nothing to do with CP7. Just try it with any old board 5.x or later, probably. I'm testing some CPython code that figures out the USB devices connected to the Mac.
❯ python3
Python 3.8.9 (default, Apr 4 2021, 15:10:29)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import adafruit_board_toolkit.circuitpython_serial
>>> print(adafruit_board_toolkit.circuitpython_serial.comports())
()
>>> print(adafruit_board_toolkit.circuitpython_serial.comports())
()
>>> print(adafruit_board_toolkit.circuitpython_serial.repl_comports())
()
>>> ^D
This is the first try, with a USB-A to USB-C adapter on the computer side
Just realized I have a USB-C to USB-C, so will try that "natively"
Same result
Tried 2 different boards as well, just in case
thanks, that's bad, it doesn't appear to work on M1
I'm currently crowdfunding this version on GroupGets.com. The link was taking people to the older version which doesn't support circuitpython.
@fossil gorge could you also try this:
$ pip3 install --upgrade pyserial
$ python3
>>> import serial.tools.list_ports
>>> print(serial.tools.list_ports.comports())
without and with a CPy board plugged in
thanks!
this tries the original code from pyserial to see if it can list the ports
@tulip sleet Editing a message to add a username only makes it highlighted, it doesn't tag the person.
@dhalbert makes sense, sounds good to me
I think last time you ended up keeping this as the non-u-prefix name?
which cross-ref style is right?
❯ python3
Python 3.8.9 (default, Apr 4 2021, 15:10:29)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial.tools.list_ports
>>> print(serial.tools.list_ports.comports())
[<serial.tools.list_ports_common.ListPortInfo object at 0x102ede0a0>, <serial.tools.list_ports_common.ListPortInfo object at 0x1029f9610>, <serial.tools.list_ports_common.ListPortInfo object at 0x102faf340>, <serial.tools.list_ports_common.ListPortInfo object at 0x102efeee0>]
>>>
is that with or without the board(s)?
the list should add one more port when a board is plugged in
Without boards
so now if you plug in a board, let's see if there are five ports
just repeat the same print()
@jaunty juniper I was going to ping you later about this
I don't have a M1 😕
>>> print(serial.tools.list_ports.comports())
[<serial.tools.list_ports_common.ListPortInfo object at 0x102faf190>, <serial.tools.list_ports_common.ListPortInfo object at 0x102ec4fd0>, <serial.tools.list_ports_common.ListPortInfo object at 0x10298ee50>, <serial.tools.list_ports_common.ListPortInfo object at 0x10298e9a0>, <serial.tools.list_ports_common.ListPortInfo object at 0x10298ebb0>]
>>>
So 5 indeed
ok, that's what I expect. I just tried it on Big Sur 11.3 on a non-M1 mac, and it's working. will upgrade to 11.3.1 in a bit
thankyouverymcuh
Sure thing!
Just realized I was/am on 11.2.3, but 11.3.1 is anxiously awaiting my "ok" to upgrade
if you could repeat the adafruit_board_toolkit testing after the upgrade, that would be great, thanks
Sure thing
@slender iron I am going through the 1.13 files
ok, looks like Jeff is too
If someone knows offhand what's the extmod directory for? (glancing at the 1.13 changes and see lots there)
extmod is where micropython puts a lot of its native modules, what we have in shared-bindings and shared-module and common-hal
ah okay that makes sense, thanks. So what is there can be brought in with an import just like something in shared-bindings
they don't separate the Python API impl from the functional impl
Ignore the MP_ERROR_TEXT comment; I can't find it in the sea of files.
Definitely getting simpler. Thanks for continuing to do this!
Change this back to errno from uerrno.
There are a bunch of these reversions. Did you #define MP_ERROR_TEXT(x) translate(x) somewhere?
Never mind. Found it way down below.
@slender iron https://gist.github.com/5a88cfdb0f24132fe7950027e56d1591
[fixes the one test failure I saw locally with the native emitter]
Output after upgrading to macOS 11.3.1
❯ python3
Python 3.8.9 (default, Apr 4 2021, 15:10:29)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import adafruit_board_toolkit.circuitpython_serial
>>> print(adafruit_board_toolkit.circuitpython_serial.comports())
()
>>> print(adafruit_board_toolkit.circuitpython_serial.comports())
()
>>> print(adafruit_board_toolkit.circuitpython_serial.repl_comports())
()
>>> import serial.tools.list_ports
>>> print(serial.tools.list_ports.comports())
[<serial.tools.list_ports_common.ListPortInfo object at 0x104efee50>, <serial.tools.list_ports_common.ListPortInfo object at 0x104efe9a0>, <serial.tools.list_ports_common.ListPortInfo object at 0x10517cd00>, <serial.tools.list_ports_common.ListPortInfo object at 0x10517c670>, <serial.tools.list_ports_common.ListPortInfo object at 0x10517c610>]
>>>
# after unplugging board
>>> print(serial.tools.list_ports.comports())
[<serial.tools.list_ports_common.ListPortInfo object at 0x104efe9a0>, <serial.tools.list_ports_common.ListPortInfo object at 0x10517c5e0>, <serial.tools.list_ports_common.ListPortInfo object at 0x10517cd00>, <serial.tools.list_ports_common.ListPortInfo object at 0x10517c610>]
>>>
Hi, is this aspect of f strings supposed to work ```>>> val = 1.2345
digits = 2
f"{val:.{digits}f}"
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: digits
it works in CPython 3.6, but the impl in CPy/MPy must be incomplete
@fossil gorge thanks; @jaunty juniper this is mysterious. The stock list_ports() is working.
and just on M1 ?
yes
there was this old fix, but it's already done: https://github.com/pyserial/pyserial/issues/545
i just retested on 11.3.1 on non-M1 and it's fine
the weird difference is that your patch is an adaptation of what is in pyserial 3.5, which is what seems to be working above but not in adafruit_board_toolkit; i copied your PR into there
perhaps I made a mistake of some kind, though it works on non-M1
it just changes the interface property
right, so I don't understand why it's not finding the ports at all
hey @hugo could you test this ?
pip3 install discotool-for-microcontrollers
discotool
it must be because the interface names are not coming back, because I do filter on them:
return tuple(
port
for port in ports
if port.interface
and port.interface.startswith(
tuple((prefix + " CDC" for prefix in INTERFACE_PREFIXES))
)
)
ah right
actually that is post 1.0.1, and hasn't been released yet. IT's even simpler:
return tuple(
port
for port in ports
if port.interface and port.interface.startswith("CircuitPython CDC")
)
so my guess is that port.interface is not working
we should see whether list_tools is returning anything for interface, even if it's wrong
[(port.interface,port.device) for port in serial.tools.list_ports.comports()]
something like that
I'm curious what system_profiler -json SPUSBDataType gives too
if @fossil gorge is willing to test further with @jaunty juniper , thanks! You know a lot more about this.
or if you have a nearby friend with an M1 Mac...
I certainly am!
With or without board plugged in? Or does it matter?
with
Just in case...
# Without device...
❯ discotool
No device found.
## Plugged in device
Projects/CircuitPython/Tests via 🐍 v3.8.9 (.venv)
❯ discotool
- Feather RP2040 ---------------------------------------------------------------------------------------------------------------
Adafruit [SN:545473038350B304]
/dev/cu.usbmodem1101 ()
thanks
making it draft while testing builds, not sure it's right (but build is being made)
I think I'll need the output of ioreg -l on an M1 with a connected board to understand what I should be looking for
I'm asking a staff member
Danh and Neradoc Thanks for the help earlier, I was able to test the sensor and verify my PR.
good night, this will be a process, thanks
@jaunty juniper you don't need to be tempted 🙂
Hopefully that helps 🙂
(in the morning, ofc)
is that with a board connected ?
@fossil gorge can you run this script (with pyserial installed) ?
https://gist.github.com/Neradoc/e718ee1db78549e510dfd03da2eed7d9
One of each
I think that broke Gist
Those are the directly piped output, with each
❯ python3 pyserial_list_ports_osx.py
----------------------------------------------------------------------
/dev/cu.Bluetooth-Incoming-Port: n/a [n/a]
/dev/cu.HugoDahlsAirPods-Wirele: n/a [n/a]
/dev/cu.debug-console: n/a [n/a]
/dev/cu.usbmodem1101: Feather RP2040 [USB VID:PID=239A:80F2 SER=545473038350B304 LOCATION=1-1]
/dev/cu.wlan-debug: n/a [n/a]
I need to get to bed, but happy to help out more in the morning
yeah me too, good night
G'night 🌜
@hierophect it works also on my pico, thanks!
The f string impementation from https://github.com/adafruit/circuitpython/pull/2690 does not appear to implement setting parameters with {} syntax. An example from 6.2.0 on a Feather nRF52840 Express:
>>> val = 1.2345
>>> digits = 2
>>> f"{val:.{digits}f}"
Traceback (most recent call last):
File "", line 1, in
KeyError: digits
I noticed this whilst trying to help out with [Adafruit Forums: How to display decimals on Bitcoin price?](https://forums.adafruit.com/viewt...
@still zephyr if you are up for doing another one of the changes from busio to board, I found this one that needs a PR for its example code: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Data_Logging_with_Feather_and_CircuitPython/DataLogger.py
@slender iron curious if you have any insight into why we need to clear out more stack entries than micropython .. I think we've seen it twice now. ```python
- [0, 1, 2, 3] # use up Python stack so f is really gone
- [0, 1, 2, 3, 4, 5] # use up Python stack so f is really gone``` https://gist.github.com/5a88cfdb0f24132fe7950027e56d1591
you figured it out the first time, I just copied
FWIW I ran out of juice reviewing the changes in that merge PR
I think I figured out... something... can somebody run me this on an M1 mac WITH a Circuitpython board connected ? The goal is to have the interface of the board being Circuitpython CDC Data (or at least not empty)
https://gist.githubusercontent.com/Neradoc/e718ee1db78549e510dfd03da2eed7d9/raw/6b93e0643bc04b05e795e6adeb16c2fba5a11a31/pyserial_list_ports_osx.py
@dhalbert I hate to keep bringing the pirkey_m0 up , but this removes pulseio from it again. Was that intentional? Should I give up on it...
Ah -- it's more than just that -- I put pulseio back in -- now get an IOError: USB Busy -- I'll look into that but it may be time to move on...
@fossil gorge if you are available ☝️
Sure thing. Will give it a go in just a sec
thank you very much
I think you're right, @jaunty juniper!
❯ python3 pyserial_list_ports_osx.py
cu.Bluetooth-Incoming-Port
name: None
interface: None
device: /dev/cu.Bluetooth-Incoming-Port
cu.HugoDahlsAirPods-Wirele
name: None
interface: None
device: /dev/cu.HugoDahlsAirPods-Wirele
cu.debug-console
name: None
interface: None
device: /dev/cu.debug-console
Feather RP2040 - CircuitPython CDC data
name: Feather RP2040
interface: CircuitPython CDC data
device: /dev/cu.usbmodem1101
cu.wlan-debug
name: None
interface: None
device: /dev/cu.wlan-debug
So not only not empty, but also has the "CircuitPython CDC data" present. though "Data" is actually lowercase "data".
You're most welcome!
HAs there been a basic change to using usb_hid? I'm getting USB Busy errors with code that worked before the recent updates.
@tough flax Hey, Bill! I have a quick question. Is it alright with you if I use the STEMMA connector from your Feather RP2040 pinout for our own pinout diagrams? I need to modify it to match our pin labels, but I'd like to use the connector bit if it's ok with you.
I forget what function it was but we basically added some more C functionality that caused the C stack to be larger. If a pointer value remains in the stack area (even if unused) it won't be collected and finalized by the gc.collect()
it's just a fragile test
Yes, , I am up to it. would take a look and change the references and go through that library with the other new changes. thanks
I think this is better because it matches MP. Here is the CP change: https://github.com/tannewt/circuitpython/commit/d7dc3801ab9fdeef1b1edde050f9aad35c92d73b and the MP one: https://github.com/micropython/micropython/commit/7d851a27f146188752e89bb026021fb8d3985395
I just built CP forom the tip of main for the neopixel_trinkey_m0
but not usb_hid is not working.
I had the same issue on the neopixel_trinkey_m0 and the pirkey_m0
Adafruit CircuitPython 7.0.0-alpha.1-1088-g2fe1df466 on 2021-05-07; Adafruit NeoPixel Trinkey M0 with samd21e18
>>> import usb_hid
>>> from adafruit_hid.keyboard import Keyboard
>>> keyboard = Keyboard(usb_hid.devices)
Traceback (most recent call last):
File "", line 1, in
File "adafruit_hid/keyboard.py", l...
Ignore the MP_ERROR_TEXT comment; I can't find it in the sea of files.
Definitely getting simpler. Thanks for continuing to do this!
For the record MP_ERROR_TEXT is here for CP: https://github.com/tannewt/circuitpython/blob/merge_1.13/supervisor/shared/translate.h#L84 (I deleted the MP version.)
Where we can use this? I can't think of any immediately. Can we do that in a follow up?
Added board compatibility and instructions on how to flash the image. I personally verified the procedure on several boards.
Of course. I made that for adafruit. Do what you’d like with it
Cheers! Appreciate it.
Internally f-strings are implemented by translating to a .format call. That makes this tough to do I believe.
I really don't like this. It has nothing to do with CircuitPython. I'd much rather factor out the useful bits from CircuitPython so that they can be used for other cross-board software. I understand this is the more expedient option but I think the extra work put into splitting useful things out will be more useful than we think.
It also erases all of the filesystem when we just want to disable boot.py and code.py to recover from USB mis-settings. This is what safe-mode is for and if it'...
@still zephyr I noticed this list says 41. But if you check the .gitmodules file, submodule appears 43 times, implying 43 libraries. Any idea why there's a discrepancy? https://github.com/adafruit/CircuitPython_Community_Bundle/blob/master/circuitpython_community_library_list.md
There are two libraries included after the list was made, schedule and morse_code,
The list was created as a test that the code works but is not live
Ah ok
Cheers
I'll stick with my method of searching for submodule in the .gitmodules file. It's worked for a long time. 😄
@slender iron any more merge test failures for me to look at?
:), we could revisit once all the bundles and community repos are defined
That's the plan.
nope. I did 1.14 and 1.15 yesterday too. could use reviews for them though
1.13 is still failing on esp32-s2 builds?
It also erases all of the filesystem when we just want to disable boot.py and code.py to recover from USB mis-settings. This is what safe-mode is for and if it's broken on some boards, then we should fix it.
Is there a way to force entry to safe mode from the hardware? I've had to build versions of Circuitpython like this (or revert to old builds of Circuitpython that don't support what I'm working on) for peripheral-related bugs triggered by code.py that hang without crashing into safe ...
just pushed a fix. the AP PR had added more const_none_obj things
Not sure if it has to be in or out of CircuitPython, but I believe Adafruit should be providing a safe UF2 file to restore the board to a working state, or one to test the board outside of user error...
If done here, it will benefit all of the non Adafruit board too, and every new board will automatically benefit from it.
It automates ignoring parts of MP we don't use.
Related to #2999
@idle owl do you think there is any way, that we could make a note for first time contributors, when they submit a PR in Github?, There is a section in the readme.md in how to contribute. But this link points to the Creating and sharing a CircuitPython library learning Guide in , and is not until further in that reading that the Pylint and Black is mentioned. Also I think, that we should include the design guidelines somewhere as normally people include code to the library and not build a library. This is related to this PR. https://github.com/adafruit/Adafruit_CircuitPython_MCP4728/pull/10
What kind of note specifically?
See the Pylint and black Learning Guide, and the design guidelines in the circuitpython repo?
And I don't think we can do a thing that is specific to first time contributors. I'd have to look into that. I think it's everyone or no one.
This works:
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>>
>>> val = 1.2345
>>> digits = 2
>>> "{val:.{digits}f}".format(val=val, digits=digits)
'1.23'
Thanks, for looking into that
I'm not finding anything. If we're going to include a note, it would be a PR template that would appear to everyone.
As far as I can tell.
I saw that we have that kind of template in the learning guides, I think would be good, but others opinion are welcome 🙂
We have them on CircuitPython now as well. I kind of don't like them because you get folks who see text in the PR, and don't delete it or fill anything in because there's already something there. But I guess it' a matter of education.
I need to see whether enabling templates is something we can automate because 270 repos is a lot to manually do that on.
or maybe if we could have a template for reviewers that could help also and avoid the spam in the notes
that everyone uses and we just copy as a first note
Looks like we can automate it.
oh nice 🙂
It's simply a file in the .github directory. That's Adabot's jam.
@slender iron should we consider transitioning from translate() to MP_ERROR_TEXT generally? or just in files that are shared with mp?
oh no , ... suddenly I feel fear with the Adabot mention 😬
I just did the shared ones. we use it for more than error text so I didn't want to overuse it
Adabot is your friend 🙂
I didn't think f-strings worked at all in CP
😆 well... not sure about that
I thought we added support at some point.
a=2; print(f'{a}') gives me an invalid syntax error
I could be conflating it with a discussion about adding support.
versus actually adding it.
ah
Scott, Dan or Jeff might know.
It shouldn't be port specific.
maybe...
It is, unfortunately. It's turned on by .... checks
Oh. Interesting.
oh no....
I'm on CP7 on QtPy M0, so maybe I don't have the right flag set
It's turned on/off by MICROPY_CPYTHON_COMPAT which is turned off for small boards like most (all?) samd21
that would explain it
So we need to avoid them in the examples as they do not work all across the board jeff?
Yeah you need to do other things like "...".format() for code that will work on all CP boards
I would say that is correct. Unless you are explicitly clear that the example is meant for a specific board. Even then, it's not a good idea.
The "m" in "mpy" stands for "coMpiled"
somehow "f-strings" sounds like something you would get banned for using....
heh
the "ſ" stands for subſtitution
It's that "early-american" form - congreff
personally I'm conflicted on f-strings, people seem to think they are great, but how do you translate an f-string ? you can translate "Speed: {}" into "Vitesse: {}" and .format it but where and how do you translate f"Speed: {speed_value}" ?
I agree, f-strings and localization don't seem to mix
perhaps some future version of Python will provide for a kind of extended literals that can permit both localization and formatting, so that e.g., f_"Speed: {speed_value}" does a gettext() call and then a format() call. C++ has added such user-defined string literals that can expand into magical things.
the f-string PEP doesn't seem to have discussed how it interacts with localization. https://www.python.org/dev/peps/pep-0498/
likewise I believe Swift has an approach that allows for localisation but I don't remember the details
@lapis hemlock once 1.13 is merged in, I think ulab may be able to drop the workaround for cicuitpython not having rich comparisons!
It also erases all of the filesystem when we just want to disable boot.py and code.py to recover from USB mis-settings. This is what safe-mode is for and if it's broken on some boards, then we should fix it.
Boards without a status LED are an issue. Plus the Raspberry pico doesn't even have a reset button, so you couldn't do anything without adding wires. The only "safe" state the user can achieve with a naked pico is bootloader.
There is the nuke UF2 of course, but...
Is it possible...
@idle owl or @onyx hinge I would include this note in the design guideline, please let me know if I need to rephrase it. thanks
When using print statements you should use the " ".format() format, as there are particular boards that are not capable to use f-strings.
@still zephyr sounds good (missing an e of "are particular")
Thanks, I will correct that
To add recommended CircuitPython print statements formatting.
hey @fossil gorge are you ready to live on the edge ? Would you risk installing the latest on a board and enable the second serial, and run the serial test script on M1 ? https://gist.github.com/Neradoc/e718ee1db78549e510dfd03da2eed7d9 there's a bug if you don't disable hid (at least on QT PY), so you would put that in boot.py
import usb_hid
usb_hid.disable()
import usb_cdc
usb_cdc.enable(console=True, data=True)
Live on the edge and back away from this freefall? :D
I'll give it a try as soon as I get back home. Should be about 30 minutes
thank you 👍
Running with the following boot.py on a QT PY Haxpress.
import usb_cdc
usb_cdc.enable(console=True, data=True)
Running the fixed version of serial/tools/list_ports_osx.py gives:
/dev/cu.usbmodem144443301: QT Py M0 Haxpress - CircuitPython CDC data [USB VID:PID=239A:00CC SER=6EC079803935545020312E321E200FFF LOCATION=20-4.4.4.3.3]
/dev/cu.usbmodem144443303: QT Py M0 Haxpress - Cir⅄ 䦸 [USB VID:PID=239A:00CC SER=6EC079803935545020312E321E200FFF LOCATION=20-4.4.4.3.3]
It ...
This is without the "boot.py" file (using a Feather RP2040)
❯ python3 pyserial_list_ports_osx.2.py
/dev/cu.Bluetooth-Incoming-Port: n/a [n/a]
/dev/cu.HugoDahlsAirPods-Wirele: n/a [n/a]
/dev/cu.debug-console: n/a [n/a]
/dev/cu.usbmodem1101: Feather RP2040 - CircuitPython usb_midi.ports[0] [USB VID:PID=239A:80F2 SER=4545373038053B40 LOCATION=1-1]
/dev/cu.wlan-debug: n/a [n/a]
Should I try with the boot.py file as well?
yes, but I think I'll want the output of ioreg -l like last time too
Ok. I'll run those and let you know what comes up
cause there it's saying "usb_midi.ports[0]" and that is super weird
Here's the pyserial_list_ports.py
❯ python3 pyserial_list_ports_osx.2.py
/dev/cu.Bluetooth-Incoming-Port: n/a [n/a]
/dev/cu.HugoDahlsAirPods-Wirele: n/a [n/a]
/dev/cu.debug-console: n/a [n/a]
/dev/cu.usbmodem1101: Feather RP2040 - CircuitPython CDC data [USB VID:PID=239A:80F2 SER=4545373038053B40 LOCATION=1-1]
/dev/cu.usbmodem1103: Feather RP2040 - CircuitPython CDC2 data [USB VID:PID=239A:80F2 SER=4545373038053B40 LOCATION=1-1]
/dev/cu.wlan-debug: n/a [n/a]
For @jaunty juniper - ioreg output
ah that's not a M1 issue
good to know
thanks, I believe that means my code works and I can PR for now, but there are more issues with 7.x
Awesome! Good job getting it sorted out! 🙂
Ah but without a boot.py it's not correct either (that's for the REPL serial port)
| | "bcdDevice" = 256
| | "USB Interface Name" = "CircuitPython usb_midi.ports[0]"
| | "USB Product Name" = "QT Py M0 Haxpress"
It also erases all of the filesystem when we just want to disable boot.py and code.py to recover from USB mis-settings. This is what safe-mode is for and if it's broken on some boards, then we should fix it.
Is there a way to force entry to safe mode from the hardware? I've had to build versions of Circuitpython like this (or revert to old builds of Circuitpython that don't support what I'm working on) for peripheral-related bugs triggered by code.py that hang without crashing into...
Ah -- it's more than just that -- I put pulseio back in -- now get an IOError: USB Busy -- I'll look into that but it may be time to move on...
The removal of pulseio was unintentional; I will put it back. If you are getting USB errors, that is something else, and may reflect a larger problem. Try a Trinket M0 or similar; I did test, but not after I did a lot of the build rework.
Oh, I don't mean we have to use this now. But I recently was working on som.e code that required positive arguments, and to have this checked automatically would be nice
Everything I had has been addressed. Thanks for taking on this! Onward!
I did start to implement this as a separate small executable based on the circuitpython code base (filesystem_Init() and the status LED), but it was becoming painful, and I realized the infrastructure I needed was right there in the existing code and build system. It creates a version for each board with little trouble. Yes, it is expedient; we need something soon. It's not elegant, but it works.
This could easily be changed to just rename boot.py and code.py, and do nothing else (an...
Booting into safe mode the board does not appear on USB anymore until reset into normal mode.
Tested on macOS Catalina, but I think it's either a crash of the board or USB being disabled in safe mode.
Tested with a QT PY M0, Feather M4 pressing reset-to-boot, and a pico using the following code:
>>> import microcontroller
>>> microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE)
>>> microcontroller.reset()
Tested a few builds, it seems to happen starting with #468...
Same with me using the RP Pico using mouse in the latest build (adafruit-circuitpython-raspberry_pi_pico-en_US-20210507-f761292.uf2)
Seems to fail in the same place but in mouse.py when initializing at the section below.
try:
self._send_no_move()
except OSError:
time.sleep(1)
self._send_no_move()
With the error:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
File "/lib/adafruit_hid/mouse.p...
I know what the problem is and will fix it.
So far -- post merge of MP1.13 my rp2040 pico and esp32s2 funhouse are still working !! Well done!
No really CP related (I think) but do you know if your funhouse temperature reading seems a lot higher then what it actually is? Mine is saying 33C and I'm not where near that
Yes - the onboard temps are way high due to heating of the board 😦 - I use an external I2C (STEMMA) temperature sensor
okay thanks just wanted to make sure that was normal
Fixes #4728.#4729
Tested on a Trinket M0. @Neradoc Could you test if you have time?
Still need to fix other issues.
Thanks! This won't get in the way of anything, and it may be useful in the future.
I don't think I'll get around to this.
I have an idea about how to handle MP_ERROR_TEXT in native code .mpy files, but the simplest version depends on all the encoded string lengths fitting in 8 bits (so than an 8-bit sentinel length value of b'\x00' can be used to indicate that it's a "not-actually-compressed string")
If this passes CI, I can use it as a basis for work on that idea.
any idea with mocking hardware in **all **circuitpython libraryies that supports development of software/program and debugging outside the hardware..? (for ex: in ubuntu)
Example : adafruit_mcp4725 and adafruit_tca9548a in https://github.com/codenio/virtual-pi
This swaps pins D0 and D1 to correlate with GPIO0 and GPIO1, respectively; they were previously swapped so when I asked for D0 in the software I had to interface with D1 on the board (second pin down on the left instead of first).
This now matches the board schematic (via, see snipped image of the schematic below), and I also confirmed that all the other pins correctly match the board too...
do not know, hey those DAC look familiar 😬
Fixes #4724. @jerryneedell
Fixes #4727. @Neradoc
- Sense of HID enabled was reversed.
- Interface index was being passed instead of interface name index in several places.
- Calculation of individual HID report descriptor size mixed up word and byte sizes.
Yout might want to have a look at those links:
MicroPython and Ikea HomeSmart
Ikea HomeSmart product insights and how to hack into them. They are using the EFM32 chips
Gecko Zigbee Python interface
This is a pure Python implementation of a IEEE802.15.4 and ZigBee network stack that works with MicroPython for the EFM32 chips
fixes #4724 - tested on neopixel_trinkey_m0, qtpu_rp2040 and pirkey_m0 -- all work now.
There is an issue with the pirkey_m0. The current build is without pulseio. usb_hid works ok. However, if is restore pulseio then the pirkey_m0 will not boot - the neopixel just blinks and no USB device is mounted. Should I open anew issue for this once this is merged? Is pulseio working normally on other boards?
(note that the built-in tests do NOT test that these examples build, you have to do it locally)
One bit of information regarding the pirkey_m0 issue -- If I resotore pulseio and build from main without this PR, then the pricey_m0 boots ok -- but ISB_HID does not work, With this PR -- USB_HID is ok but it won't boot if I reset pulseio...
I tried adding pulseio into another "small build (rfm9x) and it works OK with this PR
I also versified that pulseio (using irremote) works as expected on a CPX -- with this PR
I don't know if you want to invest any time the pirkey_m0. I just wante...
I had the following requirement :
I had to develeope an GUI that controls several DACs using Circuit Python libraries. As developement inside RPi becomes difficult (or if you dont have one yet) and ubuntu had no GPIO support, I started with Mocking GPIO and then Mocked all essential breakout boards (MCP4725 and TCA9548A). Post Developement in ubuntu it was a seamless switch. It uses virtual libraries when executed outside RPi and actual Hardware inside RPi.
Adding such mock/virtual hardware in respective circuit python libraries could accelerate software/program developement even in absence on actual hardware. It helps to decouple the hardware dependencies during developement and enhances debugging.
It resembles : Local developement and deployment in production
Thoughts and Comments..?
Hello.I would like to ask how to open the AP module of IOTS2 module?Has this module been released yet?
T&C: I guess you could have use some Blinka layer, or create a fake Blinka layer that only print and does not do anything. That way you have a compatible interface that work on Pi and MCU and many other SBC.
It's part of the wifi module on ESP32-S2 builds since this merge (7.0.0 alpha builds). You can find "Absolute Newest" builds for your board here: https://circuitpython.org/downloads. Documentation is here: https://circuitpython.readthedocs.io/en/latest/shared-bindings/wifi/index.html#wifi.radio. If you have further questions, I'd suggest asking on Adafruit's #h...
@jerryneedell I added a commit to restore pulseio to pirkey, which we need regardless. Could you retest with the pirkey artifact after it rebuilds?
I would not give up on the pirkey right now because the problems you are seeing might indicate a more general bug.
@dhalbert Can you remind me where I find the artifacts for a PR?
I built it locally and it still fails but I'd like to try your build.
@dhalbert OK - I found the artifacts and I get the same results with your build (that is reassuring!)
here is what I see in dmesg when I copy over the .uf2
[Sun May 9 16:33:18 2021] usb 1-1.4.7: USB disconnect, device number 57
[Sun May 9 16:33:18 2021] FAT-fs (sda): unable to read boot sector to mark fs as dirty
[Sun May 9 16:33:19 2021] usb 1-1.4.7: new full-speed USB device number 58 using xhci_hcd
[Sun May 9 16:33:19 2021] usb 1-1.4.7: New USB device found, idVendor=239a, id...
I would suggest merging this PR to get the usb_hid fixed and deal with the pirkey_m0 separately.
Provided the other issues addressed by this PR are fixed. I have not test them.
Same questions as David, do Blinka is included, also it would worth a look to https://github.com/adafruit/Adafruit_Blinka_Displayio. I am interested in the graphical aspect, do this does something similar to Raspberry Pi GPIO Emulator? but very interesting.
BHB's definition assigns PA00 and PA01 to MICROPYTHON_PORT_A:
If you try to use one of those ports from user code, for example via the neopixel library, you'll get an error saying the pin is in use. However, in the current production design those pins are not connected and so should be available for hax. This change free...
Looks good, just waiting on CI
a concrete "fake" implementation for use on non microcontrollers would be interesting. I was randomly googling ideas this morning, and started thinking about circuitpython in Jupyter Notebooks, and borrowing some of the components that have been developed for the wokwi arduino simulator 🙂
Is it possible to modify a uf2 (existing or by regenerating) so that a newly flashed CP device will have pre-packaged files on the CIRCUITPYTHON drive? e.g. I'd like to add a custom code.py, a back-up copy of this, and possibly one or two of the standard libraries. (I don't want to freeze them - want to include them as a concrete example of where the files should be copied to.)
@still zephyr thanks- but I think that's for connecting a notebook to a CP device and using Jupyter as a sort of REPL frontend. I was thinking more of a virtual CP that could eg be used with google colab, no CP hardware at all.
I loaded the pirkey build onto a trinket m0 and it worked. I also added pulseio to the Trinket build and it also worked. So it may be something peculiar about your pirkey, or perhaps it's running a boot.py or code.py that's crashing. You could erase the filesystem and see if it works, if you have not done that already. But given those tests, I feel comfortable in moving on.
I think, as goal from this discussion, would be being able to unit test CircuitPython code, without having to have a device farm
eg, create a device simulator or pseudo-device library, that simulated states to test code
Interesting 🤔 . yes being able to test CP is a good thing.
I do this on my own projects as well. https://coveralls.io/github/Red-M/RedSSH?branch=master
Understanding coverage and how much of your code is actually able to be used is also good.
Fixes #4727 in all the tests I could think of.
FunHouse, sweet FunHouse.
@dhalbert This is very odd. You are correct that the issue is related to my code.py. If I remove my code.py, then the pirkey_m0 boots OK -- but with the code.py, it fails -- this happens on 2 different prirkey_m0s!
However, sorting is odd. if I name the file some thing other than code.py, I can execute it from the REPL - it only fails to boot if I try to run it as code.py....
I agree with moving on with this PR and I will explore the code.py issue on the pirkey_m0 further. I did try load...
@dhalbert Hold on!!
I think there is a real issue here -- I modified my code from the pirkey_m0 to run on a CPX ...
I can reproduce the same issue -- If I run the code from the REPL it is OK but if I load it as code.py the CPX fails to boot just as the pirkey_m0 did. I did not see this behavior prior to this PR
OK -- one more example.
On the CPX, I created a new code.py that just just uses the neopixels. It runs fine with this PR.
I also ran some more test on the pirkey_m0 and it appears that the issue only occurs when I try to use irremote in the code.py. This is consistent with the CPX example as well. Given that, perhaps it is OK to move ahead with merging this PR and focusing on a potential issue with irremote.
Yay! I have a few MCP23S17 in my hands :)
@tulip sleet I am pretty well baffled by PR 4734 -- I added more to the comments -- I now have a trigger for the issue on a CPX or prikey_m0 -- No idea why, though... I have to go off for awhile and will resume troubleshooting later. I have no objection to merging pr 4734 and working on this as new issue. Whatever you think best.
Perhaps this would be a good topic for "in the weeds" today.
@prime flower can you possibly comment on this https://forums.adafruit.com/viewtopic.php?f=57&t=179044 -- Is there any chance that the FONA library will support the LTE module on the Particle BORON?
OK -- one more example.
On the CPX, I created a new code.py that just just uses the neopixels. It runs fine with this PR.
I also ran some more test on the pirkey_m0 and it appears that the issue only occurs when I try to use irremote in the code.py. This is consistent with the CPX example as well. Given that, perhaps it is OK to move ahead with merging this PR and focusing on a potential issue with irremote.
Since the issue also occurs on the CPX, I will continue troubleshooting there to ...
My guess is that this is some kind of storage-related flaw in the USB code or PulseOut. They don't share any code. It's probably some kind of second-order bug. I agree that we should go ahead and merge this PR to get USB working better now, so that main is more usable. I will debug this in a day or two, and have opened a new issue referencing the sample code above.
Hi - I'm getting ready to make some updates to circuitpython-org repo and submit a PR - but want to test before submitting. Can anyone confirm that the instructions in the README.md are up to date with the software versions needed? Specifically, the section: To test your changes local: ... 6 short steps.
I did attempt to do so directly on my Mac using the software versions specified, but it failed to generate and launch the jekyll server to test with. So I'm setting up a Debian VM which the instructions indicate is used for this. The Debian Stretch system indicated and Ruby versions appear to be pretty old, though, so just wanted to verify.
These changes clairfy the flow nicely - thanks! I did not test but you did. The build failures are due to GitHub cache failures. You could merge from upstream and re-run, because the cache key has already been changed.
Thanks Dan! I agree with merging.
I'd say we could use one more of the following:
- CIRCUITPY eraser - the CircuitPython build system knows the board configurations so that's why I based this on CPy. A "board database" would be nice in the long run, but it's not holding up progress. This requires only one build per board because it is not translation-dependent.
- A safe-mode-only build. This requires doubling the number of artifacts, which will significantly increase CI time. I would rather not do that.
- A build that d...
@dhalbert Thanks for the review! But let's get STM32 sleep merged in first. That way I can merge the API changes to all existing Alarm modules at once, plus the STM32 port has a minor API adjustment (makes PinAlarms use const for pin objects, like other pin-related modules) that is better to put in before this.
@tulip sleet when you're back in town: I think the best plan for sleep is
a) merge STM32 Alarms (do we need someone to help test this?)
b) I merge main into the API revisions and spruce up STM32 and NRF accordingly
c) merge API revisions in #4606
d) RP2040 Alarms PR can be submitted/reviewed, since it is built on #4606
No, wont be supported because the boron has an entirely different module than the FONA
When adafruit makes a LTE fona breakout, that'll get an official Adafruit_CircuitPython_ library. No guarantees whether an updated breakout will use the same modem as Particle or not.
@prime flower Thanks -- would you be able to comment in the Forum post -- to give an "official" Adfruit response.
Yeah sec.
Thanks!
https://forums.adafruit.com/viewtopic.php?f=57&t=179044&p=871641#p871641 < thanks for pinging me on this one Jerry
Hey @daring ridge! I'm looking over the README now, and comparing it with the GitHub action that runs for deployment. It looks like they're fairly similar, with these variations or details
- GitHub action is run on the "ubuntu-latest" image - probably 20.04 which is LTS
- The specific version of Ruby used is 2.7, not 2.5. Don't know if it makes a differences
- The commands run to install bundler and build are:
# Install bundler, and run
gem install bundler:1.17.3
bundle install --full-index
# Build site with jekyll
bundle exec jekyll build -d build
@hierophect Could you merge from upstream and fix the conflicts and also look at the few failed builds (looks like a missing include?)?
?serverinfo
It should work on MacOS, as far as I know. But I haven't specifically run it, so I'm not certain.
@tough flax Limor and PhilB put together a semi-automated generator, here: https://github.com/adafruit/PrettyPins I nabbed the connector to include in a file that I can pull from as needed with lines that match the spread of the pin labels.
@fossil gorge , thank you very much, that is extremely helpful! I'll give that a whirl.
@idle owl , thank you also. I tried on MacOS using the versions specified, but it failed late with an invalid ascii character during processing. I didn't dig too deep, though, perhaps it will work with the later version(s) that @fossil gorge found in the GitHub actions. Thanks!
This is supported in the underlying library (protomatter) but was never made available in CircuitPython. Hopefully it's "easy" :stuck_out_tongue_winking_eye:
@fossil gorge and @idle owl , I got it working directly on MacOS - thanks to both of you.
I still had to edit a couple of files to remove a non-US-ASCII character to get the generation to complete, but it shouldn't affect my update - this is extremely helpful. Thanks again to both of you!
You're welcome! Glad to hear it. Thanks for contributing!
Glad you got it going! Out of curiosity, which characters did you have to remove, and from where? (if you have those handy)
These two:
circuitpython-org/vendor/bundle/ruby/2.7.0/gems/jekyll-theme-primer-0.5.4/_sass/primer-support/lib/mixins/typography.scss:43: Invalid US-ASCII character "\xE2" (Sass::SyntaxError)
and
circuitpython-org/vendor/bundle/ruby/2.7.0/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:123:in `rescue in convert': Invalid US-ASCII character "\xE2" on line 5 (Jekyll::Converters::Scss::SyntaxError)
This caused an error when building on macos:
../../py/modmath.c:247:36: error: pragma diagnostic pop could not pop, no matching push [-Werror,-Wunknown-pragmas]
#pragma GCC diagnostic pop
^
1 error generated.
The pragma was half-removed during the merge of micropython.
Wow, so that's within the jekyll gems. eeenterestink
It's this sequence in all the occurances:
// Heading sizes - mobile
// h4<E2><80><94>h6 remain the same size on both mobile & desktop
Thanks for sharing that @daring ridge. Will be on the lookout for those. Was that in macOS, the Debian VM, or elsewhere?
That was Mac OS using Ruby 2.7. I did gem install bundler:1.17.3, but I think it used 2.1.4:
[bsd@yyz]:/bsd- bundler -v
Bundler version 2.1.4
[bsd@yyz]:/bsd-
So that may be the problem ...
Peculiar. Seems like another rabbit hole to dive into and sidetrack other things soon! 🙂
Again, I appreciate you providing that information and level of detail! 🙂
No problem at all! 🙂
say @idle owl you might be already working on that amongst your guides rework, but somebody this weekend mentioned that page, that uses D13 as default pin for blink (instead of maybe board.LED), the person was using a pico and came asking about it https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code
It's not in my rework, no. But it can be updated to board.LED. Not all boards have board.LED yet, that is part of my rework. As I get to their guides, I will be updating boards in batches. I have a list. The Pico guide has https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/blinky-and-a-button which uses board.LED.
Updated. Now we'll get feedback from folks using the board without board.LED. 😄
if mentions the QT PY, D17 for the Clue and BLUE_LED for the itsybitsy nrf52, maybe a general warning saying if it doesn't blink to look at the specific board's guide pinout to check the LED pin would guide people to where to look
it's hard to know what will help people the most 🤷
I took the time to narrow down the list to Adafruit boards, and I think I'll update them today or tomorrow. Alleviate the issue at the source.
There are 38 boards. Shouldn't be too bad. 🙄
it was someone who decided to read the whole "Welcome to CircuitPython" guide to familiarize themselves with it
There are more of those folks than you'd think.
That's the problem with including troubleshooting and other things that may not apply to every board. Some folks try to do all of it.
We do what we can to make it clear when things won't work. And we adapt where necessary.
That's where the templates will be super helpful - they're tailored to each board, so there's no warning about QT Py on a Pico page, etc. Though Pico won't get them because it's not an Adafruit board.
we could either modifiy VPi to make it more generic or We could start some virtualisation library from stracth. @still zephyr @thorny jay your thoughts..?
if someone would be so kind to merge this: https://github.com/adafruit/circuitpython/pull/4735
I seem to have lost my merge rights. (but that is okay)
Done, and I'll look into your status.
This afternoon.
Thank you @kattni & @bleything! ✨
Odd. I'll dig into it later. But you still have write access to the CP repo.
Yeah it was weird - it said I had write access so I could approve it, but that I couldn't merge because the branch was protected. 🤷♀️
oh no, no scratch for me, I like REUSE as much as possible, but a least link it with Blinka somehow 🤔
@pearl tapir Thanks for you answer in the issue https://github.com/adafruit/Adafruit_CircuitPython_VL53L0X/issues/27
<@&356864093652516868> Meeting in little over 30 minutes. If you're participating, please update the notes doc with your Hug Reports and Status updates. Thanks! https://docs.google.com/document/d/1R2Qq9dAKqrAh0wFuu1-X7r9HgPJf1bgLz45fklJHmfo/edit?usp=sharing
Google Docs
CircuitPython Weekly for 10 May 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to participate, add ...
Good afternoon all you wonderful people ☕
That's better than print() debugging 🙂
That's the new hot item -- celebrities doing computer sound effects. Next up, Morgan Freeman doing the Windows XP logon sound.
MicroPython 7.0.0-alpha.1-709-g256fcd6cc-dirty on 2021-05-10; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> from ulab import numpy as np
>>> np.arange(1, 24) > 7
array([False, False, False, ..., True, True, True], dtype=bool)
``` ooh the rich comparison stuff works in current circuitpython. It didn't work earlier, because we needed update from micropython to enable it
Just listening today.
calendar links are in the notes document
"lurking" is such a dark term
hears jaws music
lurk lurk
it's a common term on live streams and forums
with no particular negative implication
lurking
Hooray, the assembly is finished! Right now it's running an Adafruit CircuitPython led_animations example (on a RPi Pico2040) Just need to customize the code a bit, and then it will be done. Note to self: start earlier next year! https://t.co/Ej2bm0TBG6
Likes
237
This was my mother's day project today. I learned how to program this @adafruit magtag board with quotes from @GlennonDoyle's book, #Untamed, that are meaningful to me. Still needs some refining and a 3D printed case but I'm happy. I can do hard things. 👍 https://t.co/KBFp2Ynvyr
In CircuitPython, there are thousands of tests that verify the correct behavior of the core interpreter code. Here's a quick peek at how it looks to run the tests, and one bug we recently discovered and fixed thanks to the tests.
#adafruit #python #circuitpython
Visit the Adafruit shop online - http://www.adafruit.com
-----------------------...
All thanks to John Williams. 🎼
Embedded
Anne Barela (@anne_engineer) spoke with us about working as an engineer in the US Foreign Service and writing tutorials for Adafruit . Anne has also written two books: Getting Started with Adafruit Trinket and Getting Started with Adafruit Circuit Playground Express . To see Anne’s writing on
Since May 1, we have the following file and line modifications stats in circuitpython: 1129 files changed, 68239 insertions(+), 22170 deletions(-) -- big numbers, because they count all the micropython changes we've been bringing in.
Is .mpy stable now through 1.15?
@solar whale yes we think/hope so
I believe it is, there is nothing about it in the update notes for Micropython 13-14-15 that I could see
yup, post the M -> C change
we'll need a new alpha release to get the 7.x bundle to compile the latest mpy version
Yes, let's do that
I've done a few quick conversions with no issues.
same
yep
that's a question by the way, should displayio.release_displays() release the board.DISPLAY ? And if so is there a way to reinit it from python code ?
I think it should. you can reinit using the python driver but it's not simple
(one may want to change the init of the built in display)
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 import Py...
I'm sad I missed the precision timing discussion. can someone give me a link back to the discussion for later?
that was from @still zephyr's hug report
I assume they had discussed it here on discord, I'd read back if I could find the messages
I read through most of discord and didn't see it. may have been an issue
(I'm not through my email)
OK, I archive most of my github email without reading it 😕
I'll let you know if I come across it later
