#circuitpython-dev
1 messages ยท Page 326 of 1
(it's a room full of J-people .. at my old jobs the meetings with me, josh, james, and joel were tough)
https://circuitpython.readthedocs.io/en/latest/shared-bindings/time/#time.monotonic_ns "of the specified clock" ... um... what is specified ?
off to walk the dog --- good luck all!
enjoy!
@teal bear that's almost certainly my fault. there's only one clock ๐ that's documentation taken from desktop unix python3's time.clock_gettime_ns which actually does have multiple clocks it can refer to. A PR to remove the text about the non-existing clock specification would be very welcome. Thanks!
@onyx hinge I should modify the Debouncer library?
@onyx hinge will do. also.. clicking Edit at the top 404s
I need the lattest version of CP because it use the usb_hid report to tell me about CAPS_LOCK and other... so there is no version with both long integer and this.
@half sedge If you follow what I am suggesting, I think a change which does similar to Adafruit_CircuitPython_LED_Animation with the monotonic_ms function should be acceptable. Careful, I updated the link because it was to the wrong fork. ms not ns, because working in milliseconds is a pretty good compromise that gets accuracy but doesn't overflow for ~12 days
It's still not perfect, because I think as written it will give a Python exception at 12.4 days for platforms without longs
There are ways to deal with warp arround. When the value goes from very high to negative or near zero, it is possible to detect and deal with that.
I feel like not all consequence of removing long int have been identified.
@teal bear hmmm I don't know what to do about that link 404'ing, can you file an issue so we can at least remember it happens? It has to do with the way we generate our documentation in several steps, and I guess that works differently than readthedocs needs
@onyx hinge https://github.com/adafruit/circuitpython/blob/main/shared-bindings/time/__init__.c#L218 what should the doc be?
@teal bear desktop python3 documents it as follows: ```Help on built-in function monotonic_ns in time:
time.monotonic_ns = monotonic_ns(...)
monotonic_ns() -> int
Monotonic clock, cannot go backward, as nanoseconds.
it's very terse in the pydoc and there's probably a longer description in the online manual
cannot go backward - so it doesn't wrap, and "int" means forever?
"int" means the values are whole numbers (integers)
The code of Debouncer actually check if time.monotonic_ns is present: https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/blob/master/adafruit_debouncer.py#L67
It is present but not working:
import time
hasattr(time, "monotonic_ns")
True
time.monotonic_ns()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: No long integer support
Again you can check out the LED library, it also checks whether calling the function results in NotImplemented.
I believe this workaround is as complete as it can be
I agree with what you say about the ability of properly written code to deal with clock wraparounds. That's why I straw-proposed microcontroller.montonic_ms_wrapped earlier in this discussion. This is something where @slender iron also has opinions, so I'd recommend bringing your best proposal to an in-the-weeds sometime soon. Something that is (A) not placed in a desktop Python module like time -- microcontroller or rtc are the only places I can think of, (B) can work with/without longs, (C) does not have precision problems due to using float and (D) implementing in blinka is likely to be easy seem like a good set of considerations to meet. Showing that it's needed by 2+ libraries (LED animations & debounce) and showing how it could be used would be very good information to bring too.
That's above my head... I just want to use a library that is now broken. I understand most of it, but I don't have a solution to propose. I'll fill an issue and try to apply a check for NotImplemented... that might solve my problem, but not the underlying problem.
Thanks
I don't believe it has to be above your head, but I understand if you don't care to engage at that level.
I can raise the question "in the weed" and let you discuss between Pythonistas. ๐ For me, the best solution could be to restore long integer (if it's possible). But it start to be sad to work on M0, things seems to fall apart loosing feature left and right.
@onyx hinge int and "cannot go backward" together imply it will never wrap - is this correct?
It is not possible to satisfy all interests, even more so on the more resource constrainted boards. As always, you have the opportunity to use a custom build or an older version, if it better satisfies your particular needs.
@teal bear right, it increases forever, it never goes back to 0
sweet.
And yes we never foresee all the consequences of our decisions, it's impossible. We can always work to better foresee consequences, but we know each time we compromise that someone will be impacted more heavily by the decision than another.
"Return the current time in seconds since since Jan 1, 1970." https://circuitpython.readthedocs.io/en/latest/shared-bindings/time/#time.time
I think circuitpython's time.time uses a different epoch date
also most boards without a battery-backed RTC have time.time referenced to "no particular time, maybe the moment that power was applied or reset was pressed"
yeah. that's really what I was wondering about
The docs there could use some love
OverflowError: timestamp out of range for platform time_t
>>> time.localtime(2**30)
struct_time(tm_year=2004, tm_mon=1, tm_mday=10, tm_hour=13, tm_min=37, tm_sec=4, tm_wday=5, tm_yday=10, tm_isdst=-1)
maybe the docs are accurate (for time.localtime, on boards with long ints anyway)
time_ttime.localtime(946684800) is 1/1/2000 ... 946684800-1 is OverflowError: timestamp out of range for platform
time.localtime(2147483647) 1/19/2038 struct_time(tm_year=2038, tm_mon=1, tm_mday=19, tm_hour=3, tm_min=14, tm_sec=7, tm_wday=1, tm_yday=19, tm_isdst=-1)
time.localtime(2147483647+1) OverflowError: overflow converting long int to machine word
2147483647 - 946684800 = 1200798847 ... which is ... odd.
Limor confirmed that the all shipping revisions starting with Rev D had QSPI flash chips installed.
Note that when neither EXTERNAL_FLASH_QSPI_SINGLE nor EXTERNAL_FLASH_QSPI_DUAL is specified quad mode is assumed, so this is addressed by removing the setting altogether.
I only compile-tested this.
https://circuitpython.readthedocs.io/en/latest/shared-bindings/time/#time.monotonic_ns
click "edit on github"
https://github.com/adafruit/circuitpython/blob/main/shared-bindings/time/index.rst
404
for this one, correct seems to be:
https://github.com/adafruit/circuitpython/edit/main/shared-bindings/time/__init__.c
Jeff E.Today at 11:21 AM
@CarlFK hmmm I don't know what to do about that link 404'ing, can you file an issue so we can at least remember it happens? It has to do with...
This an improvement to Python3 compatibility. However, I note that standard Python signals an error when the specified size is nonzero and bigger than the buffer, which this code doesn't do (yet):
>>> import socket
>>> b = bytearray(7)
>>> s = socket.socket()
>>> s.recv_into(b, 8)
Traceback (most recent call last):
File "", line 1, in
ValueError: buffer too small for requested bytes
Feel free to merge and treat this as a separate issue if desired.
Thanks for working on this! I have some comments that probably stem from me suggesting incorrect code on Discord, I've tried to correct it and explain my logic.
I'd prefer to see no extra text written here. The reason is that string storage is precious, and I am not confident that the optimizer will eliminate the string by determining that USER_SAFE_MODE is an impossible value for reason. I intended that when USER_SAFE_MODE was entered but there was no BOARD_USER_SAFE_MODE_ACTION, the MANUAL_SAFE_MODE message would be displayed, but I got this wrong in the code I shared on discord. A second alternative would be to re-use the "Unknown reason" s...
#define EPOCH1970_EPOCH2000_DIFF_SECS 946684800 - this is the missing chunk: 946684800 + 1200798847 == 2**31-1
Jeff E.Today at 11:16 AM
@CarlFK that's almost certainly my fault. there's only one clock :slight_smile: that's documentation taken from desktop unix python3's time.clock_gettime_ns which actually does have multiple clocks it can refer to. A PR to remove the text about the non-existing clock specification would be very welcome.
It'd be nice to be able to specify the specific mac address of the access point you want to connect to as a backup/sanity parameter in multi-access point environments.
When connecting, the exact AP associated with seems to be chosen somewhat at random - sometimes it's the strongest signal, other times it definitely isn't. In the field with MicroPython based devices, I've seen it try to connect to an AP with an RSSI of -80, rather than the one right next to it at -45. To get around that, ...
While checking whether we can enable -Wimplicit-fallthrough, I encountered a diagnostic in mp_binary_set_val_array_from_int which led to discovering the following bug:
>>> struct.pack("xb", 3)
b'\x03\x03'
That is, the next value (3) was used as the value of a padding byte, while standard Python always fills "x" bytes with zeros. I initially thought this had to do with the unintentional fallthrough, but it doesn't. Instead, this code would relate to an array.array with a typecode...
This is cumulative with #3404 since that also fixed a case of an unintentional fallthrough.
It's considered a common mistake to forget 'break' between cases of a case statement. Help the compiler help us find them in the first place.
The failed checks are unrelated to the PR
??? 5 reviews needed?
guess they want to be sure
@onyx hinge That is weird: I'm looking for a setting that might have gotten changed accidentally.
@onyx hinge It's because it's a PR against master instead of main. Maybe Scott changed the minimum number as an alert that it was against the wrong branch.
Is main the new thing?
yes
it's been true for a couple of months at least
Maybe we should just delete the master branch now
@tulip sleet do you have the necessary permission to change which branch that PR points at? I know tannewt was able to do it for some PRs when doing the master->main transition
but I don't see a UI element for it, I could be missing it, I could have the details wrong, or it could be outside my permissions
I don't think that's possible; it just needs to be resubmitted as a PR against main. @teal bear could you rework? Thanks.
oh there it is
how did you do that magic?
click "edit" by the PR's title and then "master" becomes a clickable box. I selected "main"
great! thanks
do I need to do anything, or is it done?
Looks like it requires changing -- there are "conflicts"
Jeff fixed it
probably better to start a fresh branch and just make the change again. I think basically we reformatted all our docs since the old revision you based your PR on.
got it.
Thank you!
actually, probably not safe to delete the branch in case want to go back in time. It would be nice to lock it down but it doesn't appear possible.
replacing branch master with a tag master is suggested by some sources to in some sense keep it, but prevent being able to create PRs
however, I kinda suspect changing a branch to a tag may confuse existing clones when they pull again
You need to remove the QSPI pin definitions in the mpconfigboard.h for this board.
This is pinout and code of a board with esp32-s2, sdcard and optional lcd. HTH.
pinout with sdcard
pinout with sdcard and lcd
github with code
I think it's likely that it doesn't work due to the ignored value of write_value in common_hal_busio_spi_read, an esp32 flavored version of #3176. This function (at least handling the all-ones value 0xff) is required for SPI SD cards to work.
if (nbytes == 4) {
*value = hri_sdhc_read_BDPR_reg(hw);
} else {
sr = hri_sdhc_read_BDPR_reg(hw);
switch (nbytes) {
case 3:
value[0] = sr & 0xFFFFFF;
case 2:
value[0] = sr & 0xFFFF;
case 1:
value[0] = sr & 0xFF;
break;
}
}
``` this code can't possibly be right, can it?
(from asf4)
@tannewt - I had left this one for a while, getting back to it. The
pulseio changes are working fine on
an irremote, but the DHT11 is failing. We seem to be picking up 2 extra
values (83 instead of 81)
which is causing the input to fail. I will post a note when I've figured
out the issue, thanks!
On Thu, Sep 10, 2020 at 2:55 PM Scott Shawcroft notifications@github.com
wrote:
@DavePutz https://github.com/DavePutz Would you like me to finish this?
I think it has more to remove to leav...
We're discarding this in favor of #3406 , thank you
qt 3.14
trying to turn on pin PA18 to power the neopixel at boot
removing line 144 'solves' it!
see https://github.com/adafruit/circuitpython/pull/3219/files for possible reasons
ladyada@LimorFried MINGW64 ~/Dropbox/micropython/circuitpython
$ make -C mpy-cross
make: Entering directory '/c/Users/ladyada/Dropbox/micropython/circuitpython/mpy-cross'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated
Traceback (most recent call last):
File "../py/makeqstrdata.py", line 455, in...
We can either set the standard output encoding to utf-8 on all platforms when running this script:
diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py
index 721fa8320..d5502330f 100644
--- a/py/makeqstrdata.py
+++ b/py/makeqstrdata.py
@@ -16,6 +16,8 @@ import collections
import gettext
import os.path
+sys.stdout.reconfigure(encoding='utf-8')
+
py = os.path.dirname(sys.argv[0])
top = os.path.dirname(py)
which should ALSO solve it for windows .. or `sys.stdout...
I've added a commit to #3398 that will resolve this problem. If that PR takes long to merge, I can split it out into its own PR. However, as that open PR is working in the same part of the code, it reduces the chances of needing to resolve merge conflicts.
If the LED enable code works, ship it. there may be a more sophisticated way to do it but that looks like it should do for now.
@jepler my bad, I got the fallthrough definition wrong. Thanks for pointing that out.
Considering what you said about string storage, I implemented the following change to get to the Unknown Reason output.
break;
Following is the serial console output:
You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Unknown reason.
Please file an issue with the contents of your CIRCUITPY drive ...
๐ถ my code is in in the community bundle ๐ต
Sounds good, remove the fallthrough comment too and then accept your own suggestion and this should be good to go.
>>> _TICKS_MAX
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name '_TICKS_MAX' is not defined
``` huh haven't run into that in the repl before. I kinda know why it happens..
Yeah, const makes no sense in repl
I sometimes like to paste things from .py files into the repl, and usually it's just fine
probably if I'd done those lines together in the "paste" repl and they were evaluated together it would have worked? Not sure
@onyx hinge its the "_" that makes it not defined -- x = const(123) will define x
I have a new bluetooth board (custom hardware with and nrf52840) that is crashing whenever
import adafruit_ble
is run. If i remember correctly this can be caused by the lack of a soft device. I'm trying to use a jlink to upload the flash and sd but it seems to not work.
@marble hornet IIRC you should flash the sd first, before the firmware. just in case that helps
but that was from a long time ago... may have changed
when loading the bootlaoader I did make BOARD=feather_nrf52840_express erase make BOARD=feather_nrf52840_express sd make BOARD=feather_nrf52840_express flash
okay, i'll give that a try. i have been doing that but typing out the BOARD parameter every time
yes you need that -- sorry
To flash SoftDevice (and chip erase):
make BOARD=feather_nrf52840_express sd
The Adafruit_nRF52_Bootloader's readme says this
okay, i just re-tried those three steps and it it still crashing. it seems like the core goes of the end of the world...(?) after the import the device just hangs. the screen session does not disconnect and the device does not response at all. only hard-reseting it helps
any suggestions?
sorry -- you are way beyond my level of experience with it.
okay, thank you. I think i'm in a similar spot, do you know who would have some more experience with this?
@marble hornet maybe the flash operation is overwriting your sd - fiddle with the commands that the makefile executes
if does nrfjprog --erase or something like that maybe there's your culprit
also I THINK that instead of make BOARD=feather_nrf52840_express flash you need make BOARD=feather_nrf52840_express SD=<sd_version> flash
Hey guys, Sorry if this as been discussed already but I can't find anything using google and search on here.
I've been playing around with the Feather M4 express and an 64x32 RGB matrix. First thing I've been looking for when I started running demos is for a way to reduce the brightness.
I found that you can only turn on or off the LEDs by setting the brightness attribute to 1.0 or 0.0:
https://circuitpython.readthedocs.io/en/5.3.x/shared-bindings/rgbmatrix/RGBMatrix.html
Is there ...
The SD options are available when flashing the CP build, but not when flashing the bootloader https://github.com/adafruit/Adafruit_nRF52_Bootloader/blob/master/Makefile#L412 at least I don't see it.
I plan to raise this issue In the Weeds on Monday and if there is a consensus about approach I can be the implementor
Problem statement
Libraries and users need a way to manage time durations, and existing solutions are not entirely satisfactory. Thanks to @dglaude for raising this issue on Discord and github.
For consistency and portability reasons, we have only included compatible time-related functions ...
@slate scroll i gave a look at the flash rule and it does not Seem to have sd erasure in it. and i'll give the SD=<...> flash a try.
nah, @solar whale is right
huh?
try flashing the circuitpython hex by hand, without any erase flags
sd won't make a change during normal flash
do you have a debugger attached? maybe you can see if there's anything on the sd address
i do, is that 0x0 thorugh 0x25000?
through 0x26000
check the first 100 bytes
and do a hexdump of the sd as well - just to be on the safe side
but something tells me that's not it - every time I need to dig this deep with these mcus something else (and very simple) is wrong
also since you have a debugger, where does circuitpy crash?
will do. (am doing). i'm not super comfortable with using the debugger (i mostly have used if for flashing bootloader). i'm a jlink connected to a mac. may take a moment, i have to read the man pages
duh, I feel you, I'm not comfortable around debuggers either
keep in mind VSCode has amazing debugging experience, even for me. since you're getting your hands dirty, take a day to set it up properly
(and I can't stress enough that you got to try VSCode if you haven't)
yy
okay, i've dumped 0x0 -> 0x26001
want to see? it is non zero information
**as in upload ?
I don't have the SD handy, so just do a hexdump on the SD (the one you downloaded from adafruit) and check if the first bytes are the same with your dump
the one i downloaded from adafruit?
which one are you referring to?
ah
they are only different by a few bytes at the end. I dumped off of a feather 840 stock from adafruit (never programmed) and the custom board
$cmp dump-feathersd.hex dump-watchsd.hex
$dump-feathersd.hex dump-watchsd.hex differ: char 155649, line 728
perf, I don't think you have a problem with the SD then
I'd start debugging (crying as well)
i regret putting the swd pin on pogo pads ๐ญ
I'll just solder them, i haven't debugged before with a jlink, any guides, recourses, advice you would have found useful going it?
I'm trying to get readthedocs going for my community bundle. How do I get Sphinx to not freak out about the use of const in my library?
@ionic elk I'm not sure but we could look together at a module that uses const in the bundle. I spotted adafruit_fram.
it's a mock import thing; just double-checking
it has from micropython import const then later _MAX_SIZE_I2C = const(32768)
it does not have the mock import library enabled as far as I can see: ```# Uncomment the below if you use native CircuitPython modules such as
digitalio, micropython and busio. List the modules you use. Without it, the
autodoc module docs will fail to generate with a warning.
autodoc_mock_imports = ["digitalio", "busio", "micropython"]
actually not, but it's in blinka, so that covers it
is adafruit-blinka in your requirements.txt?
what is the mock import library?
no
I'm just following Scott's tutorial https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs
do that, that should fix it
adding adafruit blinka? But I'm not a blinka library
could it be used under blinka?
Are you getting this message locally or from ci? If locally, you may/probably need to install blinka yourself.
pip3
do not do sudo pip3
on windows, just pip
depending on how python is set up, pip might install for python2, not python3
the pakage name is adafruit-blinka so that's what you'd put on the pip commandline
@jepler Thank you for implementing my idea!
I've created a pull request on your local repo (https://github.com/jepler/circuitpython/pull/3) to do further optimizations.
i regret putting the swd pin on pogo pads ๐ญ
@marble hornet yea, always break them out properly (breadboard friendly)
Ok, I installed adafruit-blinka, but it still fails
is this even worth it? Like, the docs are up on readthedocs, the library works, is it actually required to do this?
I don't really even care about setting up github actions, is it required to be on the community bundle?
could you show the error?
could you push this to a repo so I could look at the whole thing and try it?
btw, if you enclose a link in < >'s, it will not add the attachment in discord
I don't see a from micropython import const in the code
is that actually required?
it should be, but it seems not to be
It doesn't seem to need it in testing
anyway, add that
nice, that solved it
what about the image thing? If I want to add images, do I need to copy them into the docs folder? or something
look at the adafruit_circuitplayground for how to do that; i know that library has them to show where the pins are on the board
ok. Thanks for your help, dan!
np, yw!
I think that guide could use an update, though. The github actions part is especially confusing, it doesn't really relate to what you see on Github at all. Might have changed as an update?
There's this whole select workflows thing
Anyway, heading out to lunch, again, appreciate the help!
if you can make simple updates, go ahead, else just clikc on the feedback link to at least note it. tnx
ok, will do when I figure it out
okay, I think it is a hw issue. i just flashed the custom firmware to an adafruit nrf52840 and it works. seems like nrf52840 cannot have a functioning (uf2) bootloader without the sd.
@marble hornet SD depedency was removed as of https://github.com/adafruit/Adafruit_nRF52_Bootloader/pull/128
But there has not been a release since then
@onyx hinge I am not bothering with #3404 because it's part of #3405, right?
@tulip sleet yes, I think so, unless #3405 is going to stall -- I (just) marked #3405 ready for review since it passed CI without further problems.
ah, great, I will re-review (I did an informal review)
@ciscorn I don't suppose you know if we have a way to resolve this?
Closing again in favor of #3396
I think it's likely that it doesn't work due to the ignored value of write_value in common_hal_busio_spi_read, an esp32 flavored version of #3176. This function (at least handling the all-ones value 0xff) is required for SPI SD cards to work.
The changes so far look fine, but why did you only enable it for atmel-samd, instead of enabling in in py/circuitpy_defns.mk in BASE_CFLAGS?
You're right that this isn't possible right now. It would need to be added "upstream", so I've filed a bug there: https://github.com/adafruit/Adafruit_Protomatter/issues/19
Until that feature is added and then made available in Circuitpython, depending on what you're doing, you can
- just select different color constants, like 0x7f7f7f or (127,127,127) instead of 0xffffff or WHITE or (255,255,255)
- modify your images before exporting them as bitmaps
- if you use paletted images, dy...
Sweet, thank you Ill test those out
For better or for worse, we apply more stringent warning flags to the atmel-samd port than to other ports. If you like, I can move it and we can find out how much more is caught with a wider net.
I think it's a good idea, since it could catch a number of port-specific bugs. The main issue I had with the nRF port and its hal layers is that it does #if on undefined preprocessor macros.
For better or for worse, we apply more stringent warning flags to the atmel-samd port than to other ports.
I looked in atmel-samd/Makefile and didn't see a lot of this. What are you thinking of?
Sorry for not being more specific, rather I have a general feeling of hitting some "wait, why didn't the compiler tell me" problems when not in the atmel sam port
huh https://www.githubstatus.com/ has lost the time series charts (and says everything is fine; which is odd because a bunch of github actions jobs seem to be stalled / not starting)
Thanks for making the changes I requested!
cxd56 and mimxrt10xx don't enable -Werror.
@dhalbert happy you're here, are these FALLTHROUGHs or missing break;s?
common-hal/_bleio/PacketBuffer.c: In function 'packet_buffer_on_ble_server_evt':
common-hal/_bleio/PacketBuffer.c:175:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
175 | if (self->conn_handle == ble_evt->evt.gap_evt.conn_handle) {
| ^
common-hal/_bleio/PacketBuffer.c:179:9: note: here
179 | case BLE_GATTS_EVT_HVN_TX_COMPLETE: {
| ...
@dhalbert happy you're here, are these FALLTHROUGHs or missing break;s?
Those are bugs! Both those cases are missing break.
Also you could remove the extraneous curly braces, which should only be there if there's a local declaration in the case arm. Thanks.
@tulip sleet so, does Adafruit have a set of git actions that they've designed and use? Are those available for public use?
I'm getting the vibe that I'm simply missing the actual workflows I need. Presumably I need to copy them from somewhere?
cookie-cutter gives you what we use, plus or minus modifications made in individual repos.
https://github.com/jepler/Jepler_CircuitPython_udecimal/ is something I recently cookie-cut (my first time) so you can also see the history of what I had to change post-cutting
you mean cookie cutter is supposed to install git workflows?
@onyx hinge
it didn't create anything for me. I don't even have a .github directory
maybe my cookiecutter version is old?
Whew. Got it in. Thanks for the reference material @onyx hinge
Anyone here ever have a problem trying to send MIDI SysEx over USB with CP?...... If so - I found da bug!
@queen widget I don't know midi but I'm happy to see bugs squashed
PR sent - but it is in an upstream library... so it make take a short bit to get it into CP.
Nice, thanks.
@queen widget after it gets merged to tinyusb feel free to shoot us an issue or PR so we don't miss updating it
will do!
@tannewt getting to some old emails, @dhalbert can allocate a pid
If anyone is running an ESP32-S2 with a parallel display, has anyone done a comparison with display update speed vs the pyPortal?
Hello,
I have tried to create my own board spec for Lilygo module, but I am getting following error. First I have got error about mismatching 2MB ram but installed 8MB which I have changed in configuration. But it probably caused that partitions does not match, which is what I understood from error invalid SPI size. I have even tried expand partition 4 to 512K, but it does not look like it helped.
Could you help me with that? Is there better place to discuss than here? It is very nice m...
It is better to do it like this because now I can allocate all available memory.
I changed it. Now I allocate all available memory.
There is a LONGLONG implementation of long ints which we don't use, is simply 64 bits of integer, not indefinite length. Unfortunately, it builds to be even larger than the regular MPZ implementation. But this is due to it dragging in double-precision float routines, which are huge and which should not be necessary. I am looking at how to prevent this, and perhaps LONGLONG could be included even in the smallest builds, which would make monotonic_ns be available for all ports.
Hello guys, I need your help. I am using the Seeeduino Xiao and I have installed the latest CircuitPython on it. The problem is that the displayio module is not available for this board. Why is this? How can I use the board with a display if the displayio module is not installed?
@wispy badger The Xiao's M0 microcontroller doesn't have a lot of resources, so not all the modules fit in the flash storage available. You can check out the page in our documentation called "Support Matrix" or the built-in help() for an accurate list.
@ionic elk remember how months ago you asked me to look into whether the RGBMatrix worked right on STM for me? welp.
The LONGLONG longint implementation uses 64-bit long long boxed integers. Because it's conceptually simpler than the MPZ implementation, it could be smaller in terms of firmware size. It would enable using time.monotonic_ns() on small builds, which is the primary reason I looked at this.
However, right now LONGLONG actually builds out to be larger than MPZ. This is primarily due to a few long long conversions to and from float that cause large double-precision floating-point li...
@tulip sleet I had wondered about that, good sleuthing about where the binary size growth comes from.
See #3416 about whether using LONGLONG for longints for the smallest builds is practical. The answer is it only fits for the smaller translations.
@onyx hinge yeah looks a little stretched. That's on my bugfix list after I get these ESP32 and SPI things taken care of
I'd have called it ghosting, I guess
is it possible to include DisplayIO on a SAMD21 by cutting other modules?
I know there's at least one M0 Express board with displayio but I don't know about non-Express boards.
@ionic elk on the bright side, https://oshpark.com/shared_projects/ahoBju6X featherwing works
Nice
@onyx hinge Thanks for the reply. I now get it. The FLASH storage of the board is not enough to fit all the modules. Boards with SAMD21 CPUs that include the displayio module use an external FLASH storage as well. Like the Serpente board -> https://www.tindie.com/products/arturo182/serpente-a-tiny-circuitpython-prototyping-board/
@tannewt I'll leave this issue open until soft_reboot approach is also implemented.
Reworked the check for pulsein. We couldn't use an input past the requested length as an indicator, as it seems that the DHT11 provides 83 bytes while the library code only looks for 81 bytes(1st two are ignored). Went to a check on the number of overflows on the 16-bit timer used for pulsein; 15 overflows works out to about 1 second. So, the current logic says that if there have been that many overflows since starting the current pulsein something is wrong and the RuntimeError "Input taking ...
Is there a default pin definition for a push button, something like MICROPY_HW_BUTTON ?
@ionic elk limor sez:
hmm probably a timing thing
looks like needs more NOPs on the address lines
check with heiro if thats something he can look at
sure
I dunno that it's intended to modify your priorities, but it has come up because of a forum thread
Good info from Limor, I don't know as much about the matrix communication profile as you two
I'm pretty close to finishing my existing bugfixes so I'd rather not context switch today until I'm done, but I can check it out right after
@analog bridge { MP_ROM_QSTR(MP_QSTR_BUTTON_A), MP_ROM_PTR(&pin_PA28) }, and { MP_ROM_QSTR(MP_QSTR_SLIDE_SWITCH), MP_ROM_PTR(&pin_PA15) }, in the pins file for the circuitplayground express
@ionic elk I'm sure that's fine
@onyx hinge I want to add a pin definition for the boot button on microS2. It just acts like a user button during code.py execution.
Can someone take a look at PR #3237 and tell me why two files (supervisor/shared/tick.c and supervisor/port.h ) show changes when they are identical between my branch and adafruit/main? I do not want to make any changes to those two files...
Hi folks- I'm interested in helping get the rotaryio library working on the ESP32S, and developing a simple library for the L293D motor driver . I have some limited C & Python abilities... any pointers on where to start - e.g. a recommended port to use as a reference for rotaryio and a good example of a basic library I can copy from will be appreciated! (Back story: been looking to make a low cost, approachable, robotics kit for quite a while. MicroBit almost did it... I think ESP32S does - WiFi, MicroBLocks, CP, ROS for programming- and I've sourced parts to make a 2 wheel cart + sensors for ~$30 Canadian.)
@tannewt suggested I chime in with this project I'm working on, circuitpyui. It's a bit basic at this point but has some of the same goals (adding interaction to displayio groups with touch and joystick control). Might be some useful stuff in there, like locating tapped views in a hierarchy and routing events to views that want to respond. There's an example for the PyPortal [here](https://github.com/joeycastillo/circuitpyui/blob/main/examples/Py...
I'll be lurking (on the road). My notes are in the document (more or less up to date). I'll try to connect for "in the weed" as there is a topic that interest me.
This PR adds a Readme to the ESP32-S2 port, containing information on how to connect, build, flash and debug ESP32-S2 development boards.
Added partially as an extension to #3392, since the configuration files for OpenOCD are presumably GPL and can't be included in the port, so I've documented how to find and modify them yourself. Also includes notes about flashing on Mac OSX figured out by folks on the discord.
@tannewt I opted to move the documentation to a new PR since we didn't have a Readme for the port: #3417
<@&356864093652516868> The meeting is coming up in about 10 minutes. If you plan to speak, please make sure you've at least added your name as a placeholder in the two round robin sections. You can also add notes and we'll read them if you are missing the meeting, don't have a mic, or prefer not to have your voice recorded for any reason. https://docs.google.com/document/d/1vPWZyHRhsrAMZdc7nQJCDBmshHgtot2UotPJuIgSM_U/edit?usp=sharing
@slender iron I'll work on taking notes, as far as I know you're running this one
yup, I'm planning on running it
The MAkeFile default is set for MACOS https://github.com/adafruit/circuitpython/blob/main/ports/esp32s2/Makefile#L35
using PORT=/dev/tty.SLAB_USBtoUART
which works fine without being specified on my Mac
Foe Linux, I have to specify PORT=/dev/ttyUSB0 or whatever is correct
earlier I popped an SD card out of one of those spring loaded sockets accidentally. It landed somewhere on the shelves'o'stuff. I wonder if I'll still remember that when I find it
The graphical side of circuitpython has been growing and, in my opinion, the lack of a unified user input scheme can be felt.
I think adding featureS like these can be broken down into several categories:
- the ui-tree, this is the data structure constructed by the developer of a ui-application that represents the onscreen data. This seems to be more than covered with the facilities provided by displayio. the only functionality it odes not seem to provide is bi-directional tree traversal...
see above -- the default is set for MAC, but needs to be specified for others.
Good afternoon all you wonderful folks -- happily lurking today, updated the note doc to reflect as such. 
I am text only today due to a scheduling conflict. I do have it noted in the document as well.
Lurking
Lurking
I remember when a team of construction folk were demolishing a dilapidated community center to build a row of townhouses.
For about 3 years, it was never-ending nail guns and reverse-beeping.
Lurking today
lurking
@silver tapir I'm moving your notes down in alphabetical order
Newsletter items - send to me on twitter @anne_engineer or GitHub pull request on https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/_drafts/2020-09-15-draft.md
@slender iron we'll let you run it everytime if you want
Sharing is caring ๐ค
No YT stream this time ?
That was special just for CircuitPython day.
Just listening today.
@analog bridge having trouble joining us on the discord audio stream?
@onyx hinge Yup! no audio
I mean that on Mac, my ESP32-S2 boards do not appear as tty.SLAB_USBtoUART, but rather the usbserial name listed in my example. I thought I didn't have to do it on linux but it was a while ago that I tried so I'm probably misremembering. In any case, I'll just note that you need to specify the port.
@analog bridge you should be able to listen in just with speakers, no mic needed. Either way, hope you can join us sometime in the future
@analog bridge scroll down in your list of channels and look for the voice section
If you click on that CircuitPython title with the speaker next to it, you should join the voice channel to hear us.
Yeah! now I am in 
Ah -- OK -- so the Mac Section is fine -- might want to mention the SLAB_USBtoUARt is the default if it works.... but for Linux, the PORT=/dev/ttyUSBx does have to be set.
"6.0.0" milestone bugs: https://github.com/adafruit/circuitpython/issues?q=is%3Aopen+is%3Aissue+milestone%3A6.0.0
23 pull requests merged
The oldest library PR was updated this weekend and is passing actions now! if anyone is interested in LED PWM driver breakouts we could use some eyes on reviewing.
will do
FWIW, I never saw the tty.SLAB_USBtoUART until UnexpectedMaker had me install some drivers.
I now find on MacOS I can connect to the the tty.usb* devices just fine.
2020-09-13 I built main and flashed with the following commands on MacOS.
make BOARD=espressif_kaluga_1 PORT=/dev/tty.usbserial-1413201 flash <-- over the external USB
make BOARD=espressif_saola_1_wrover PORT=/dev/tty.usbmodem01 flash <-- over the esp32s2 native USB
make BOARD=unexpectedmaker_feathers2 PORT=/...
lurking
sorry
What's an F1? An STM32?
yup
thanks
@slender iron I put in an "approve" review but didn't merge [for the recv(0) implementation]
๐
Anybody running an ESP32-S2 with a parallel display? Wondering if the 240 MHz gives 2x display update speed vs the PyPortal running at 120MHz with the M4. Is the parallel Bus code working for the S2? .......Trying to find a good excuse for buying a Saola ๐
Noted and noted...
So we could add a AirLift ESP32 in BLE mode connected to a ESP32S2 and have both WiFi and BLE... ?
@tulip sleet do you think there's a way to get the LONGLONG implementation to fit? how hacky? [OK I'll wait for In The Weeds]
Is it expected when building esp32s2 and flashing over the native USB, that in the end the reset will fail and you have to do that manually?
New long awaited feature in the next @CircuitPython firmware: reading USB HID report.
You can now read the state of NUM, CAPS and SCROLL LOCK.
Here using @adafruit PyRuler to display the status LED, but that can also change it.
Source code: https://t.co/YfskzlCUV0 https://t...
I found a way to communicate between a @adafruit PyRuler and a @8086NET Commander, both running @CircuitPython.
Any ideas on how to use that in a game.
Will you find the tricky way they communicate?
Hint: I shared a video and code in a previous tweet... https://t.co/NdyOlB...
Tiring? I bet!
Thanks. So if anybody has a use case for talking with 3 bits between two M0... I am interested.
@lone axle Are those video series on your youtube channel or for learn or something like that?
@ionic elk I think you identified that maybe other ports also missed implementing this feature of spi readinto
Yeah everything but atmel and i.mx doesn't have it
which is just, like, 4/6 but whatever lol
I'll read up on jepler_udecimal. This weekend I learned how Babbage's differential did it :).
but yes NRF, Spresense, ESP32 and STM32 would need it
@onyx hinge I can help you with code for that keyboard if you want
@stuck elbow awesome! they have some sample code and also I may give kmk a try
kmk is kinda overengineered...
way overengineered
my keyboards have like 100 lines of code
makerdiary has a matrix scanning library (implemented for nrf) that looks like it might be good to pull in to circuitpython
Matrix scanning? There is a CP library for that already.
@marble hornet whoops, I didn't list you in the notes doc for status updates -- did you have anything?
@onyx hinge i do
I have arturo's keyboard wing and want a lora communicator at some point made out of it
@ionic elk One of our speakers for Dรญa CircuitPython showed an M0 "fona", and added uf2 support for it.
https://www.makerfabs.com/maduino-zero-sim808-gps-tracker-v3.5.html
Watch. โค๏ธ
I like the LIGO ESP32 watch, but it's not -s2 ๐ฆ
Hmm, nobody said that they were going to start the C64-cpy project.. :). (the cortex A0 port)
Issue on CircuitPython Touch GUI: https://github.com/adafruit/circuitpython/issues/3391
@silver tapir I was looking at using the rpi3
I started compiling the micropython port for the pi, but haven't tested yet.
@onyx hinge the beefiest of issues, so thorough
pi3 only has one usb peripheral though
A set of CircuitPython programmable nsec and msec timers would be handy.
is it your goal to make it micropython compatible?
embedded storage hot potato
One annoyance is when you discover that library X does not work on hardware Y.
I was really surprised esp32s2 went to Main so fast...
If you don't know it is hardware and that was not build for that hardware, you discover when it is too late.
CIRCUITPY_DIGITALIO = 3/5 # 60% supported
The worth is if someone acquire a board for specific use, and discover it can not do that.
The documentation offers all you need to start developing with nRF52840 M.2 Developer Kit.
If you have many board, you just switch to another feather...
What boards a currently "low-power"? I think only the Feather S2 from @atomic summit
Most Adafruit board have an LED ...
nrf52840 I believe
@thorny jay I find it hard to understand the capabilities between any two boards on the store, but that's not a CP issue.
And, is there a way on software to call a deep sleep mode yet in cpy?
A buyer guide could help to say based on your needs what board is recommended.
What do you need? BLE? WiFi? QT? Screen? Form factor? ...
esp32s2 comes with ULP (Ultra Low Power) coprocessor
@ionic elk Some nice tools for this are either the ลณCurrent or the CurrentRanger. (andreas spiess has showed a bit of this in ytb)
@analog bridge The idf docs says that it is not working yet.
esp32s2 comes with ULP (Ultra Low Power) coprocessor
not sure if that can handle CPY
@analog bridge You can only run a bit of riscv C code when it's available.
@silver tapir which IDF features link are you looking at ? the last one I looked at was out of date
Andreas really was showing what it really mean to be low power...
@idle wharf How to use the ULP riscv core. When I say it, it just say "not yet..."
I'm actually learning how scott did the spram on the esp32s2, because I want to learn how to implement low power on the riscv core.
@silver tapir I can't google the ลณCurrent, does that have a different name for marketing?
๐
Thanks everyone!
Thanks!
Thanks!
If ever you have a summer time change, don't hesitate to warn non US.
Thanks everybody!
IDF Features : These two don't stay in-sync
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/esp32s2.html#limitations
Espressif ESP32 Official Forum
Sunday nov 1,2020, 2am is end of daylight savings in US
During Deep Sleep, microcontrollers consume very low currents, and batteries live longer. Unfortunately is not easy to measure these small currents. Today we will check out two small boxes which promise to make this possible. And we will use the 10โ000$ professional Keysight N...
I would be nice to share the PPM data in a group feed in AdafruitIO ๐
This is how the nov 2 meeting shows. The offset is noted specifically beacuse it's the next one after our change to standard (winter) time
Drags out the election for one more hour ๐ฆ
My first time listening live today.
@idle wharf happy to have you!
Oh the joule seems to be a bit $.
I think the trick with the Spiess ones, is that they are cheap.
Thanks @onyx hinge this whole group is pretty awesome ๐
So, $60 vs $700
And good luck if you try it with cuneiform :รพ
I do have a question but outside the meeting. In one of our talks, the owner of Electric Cats was talking about how to add cpy to your own boards. He had this question, so I relay it here.
How it the process for getting a usb PID for a circuitpython board? And what would be their limitations if any?
since they are a maker company making multiple boards they should consider purchasing a USB VID for themselves
I was thinking of talking about this, but for the rest of us, the ones we don't have companies with multiple boards.
@slender iron I'm working on the F1 port, it gets stuck in tud_msc_test_unit_ready_cb. Do you know how that works?
But I agree that for a company they should get their own.
for makers who aren't selling their stuff we can gift PIDs with the adafruit VID
Ah ok, so that would be the limitation. If I plan on getting 50 boards on tindie, then I should invest in getting my own.
@lucid solar not really sure what the issue would be
@silver tapir 50 different board designs then yes
But for like a badge, or demo project, etc, their fine. And how would one request a PID?
I meant 50 board of a single design.
a circuitpython based ammeter would be a great edition to the circuitpython ecosystem. since the profiler and profiled would be in cp. and hopefully bring the price down.
I don't have the expertise or time to develop the expertise to make a product like that but thought the idea was worth putting out there.
for 50 of a single board we could donate a PID
file an issue for it: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython/customizing-the-board-files#mpconfigboard-dot-mk-3033646-25
@slender iron Thanks for the info.
np
We are kinda trying to push more latam makers into building their own boards, and maybe start businesses around them.
@slender iron get_vfs(int lun)
what's a lun? ๐ I tried to find out, but I don't get it.
lun 0 is the main one right?
yup
mp_vfs_mount_t* current_mount = MP_STATE_VM(vfs_mount_table);
seems to fail here...
is that mount table set somewhere else? so it probably means the flash isn't being setup right?
I don't remember where
but yeah, if cdc works but not msc then it's usually a flash issue
not used to it getting stuck though
ok...thanks...I'll keep looking into it.
@marble hornet We sell breakouts that make current measurement easy: https://www.adafruit.com/?q=ina&sort=BestMatch
@silver tapir do you have a youtube playlist for the Dia CircuitPython videos?
@slender iron (or anyone else) I have 192kb for FLASH_FIRMWARE, that doesn't seem to be enough. It already feels like it's a minimal build, but do you know of something that will shrink it even further?
can you link me to a diff of what you have?
thanks!
can you link me to a diff of what you have?
@slender iron was this to me?
yes
there is also CIRCUITPY_FULL_BUILD that you should set to 0
the firmware.elf.map file is a good way to see what is included still
Yeah, I just don't know what is needed or not...
you should be able to turn everything off to start
But that shrunk it quite a lot...~7k left to remove
but I can get that by moving around the 'partitions'
make sure you build with -Os and --gc-sections
the SAMD21 builds also have lto enabled
not sure STM is setup for it
๐
-O2 (that's ok right?)
but I thought -02 includes -0s?
s is for "size"
Ah, I had it the wrong way round...
'Optimize for size. -Os enables all -O2 optimizations except those that often increase code size:'
@slender iron @tulip sleet @ionic elk this is good right? ๐
yup! ๐
Here is the notes document for Mondayโs CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youโll be attending the meeting - itโs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weโll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1lkj5xteD6rW1eqh9swbGeuidZTKsB3CtW2Lpgff1P3U/edit?usp=sharing
?serverinfo
@tulip sleet thank you, i'll pick one up on my next order. ..
do you have any tips for debugging _bleio? the watches crash on every import (except for one of them, which always times out on connections) and there definitely is an sd @ 0x0
aha the LED controller on the makerdiary keyboard is IS31FL3733A, I think.
Crumbs, had the day off with my toddler and totally forgot it was Monday!
It's pretty trivial to implement basic 64-bit integer operations using (int, int) tuples as the representation. Especially for the kind of operations that are usually done on timestamps: addition, subtraction, comparison.
If you interpret those tuples as 32.32 fixed-point, you get a range of about ยฑ60 years with sub-nanosecond precision.
@hybrid scarab sounds like a good use of your time!
hmm maybe there's no IS31FL3733A support in CircuitPython yet at all !?
True, god knows I spend too much time working
Trying to remember if I've written any code for IS31FL3733A ๐
Ah- no- IS31FL3730
and there's support for 3731 as well
Oooh 12x16
In this case there are 61(?) RGB LEDs, it's a keyboard backlight
Math checks out
Mapping the darn LEDs is the tricky part
I wrote a - bad - Python library for the IS31FL3730 about 5 years ago
@marble hornet I haven't seen that kind of crashing before. Your SD version should be 6.1.1, not 7.0.x, which is a 1k larger in size internally
this is a 52840, right?
ah, okay. let me see if I can find how to check that. when the sd is being flashed it erases 0 -> 0x26000 (iirc)
and yes!
that is right, 7.0.1 goes to 0x27000
ah, and (asking explicitly to be sure) that version does not work w/ cp?
the latest version of the nrf52 UF2 bootloader (not released yet, I think) will report the SD version in INFO_UF2.TXT
someone has an nRF52833 board def that (must) use 7.0.1, and that seems to be working
it think it is pretty much upward compatible
I'm building from master. looks like it is the right version.
you want to pull from main now
i think the uf2 bootloader is till using master, but circuitpython should be from main
I wrote a - bad - Python library for the IS31FL3730 about 5 years ago
@hybrid scarab I adapted an existing CP driver to support the Led Shim and Scroll pHAT HD.
checking the repo agrees about main vs master,
@thorny jay for the best ๐
if there is no SD present, it will note that too
Whoever made the mapping of the Led Shim... need to give me an explanation! LadyAda did not want a big table, so I made if/then test and math to make the mapping.
@dhalbert I think this is ready to go, both the related PRs are closed merged.
that's really cool! All six of the TG-Watch02B boards have 6.1.1 installed ; I'd love some guidance on how to proceed with an issue like this? if you wouldn't mind pointing me in the right direction or if you have some time (at some point) and wouldn't mind helping dig a bit deeper , either would be greatly appreciated.
Adafruit Forums: Pulse Oximeter Wireless Data Logger Example Getting Crazy Re (third page) shows some 3 byte and one 4 byte corruptoine to complete_name data which was noticed because the high bit set can cause UnicodeError exceptions from str() conversion on the bytes.
I wonder if we should have maintainers listed in board defs
so we know who to ping when someone needs support on a board
maybe port level?
perhaps port level but I'm more worried about simpler board-level issues
I'm just a little concerned about the implication of associating circuitpython maintainers with specific 3rd party products
Could you bump the submodule commits to the merge commits?
The merge commit for the latest asf4 is
https://github.com/adafruit/asf4/commit/84f56af13292d8f32c40acbd949bde698ddd4507
Currently this is at https://github.com/adafruit/asf4/tree/1b87f18f8091f258e63f85cef54bcc7bafd44598
Similar for samd-peripherals: merge commit is https://github.com/adafruit/samd-peripherals/commit/2ff4ab05101ce7d3e105009cc6612df6e992123f.
This is at https://github.com/adafruit/samd-peripherals/tree/15fd96...
Or would we be linking the people who actually submit board PRs?
The only edge case I see for that is if the person who submitted the pr is the person who made the board.
@ionic elk right, the maintainers of third-party boards wouldn't be us
I think an empty maintainer list is ok for third-party boards. at least then we have something to point to
wifi.radio.connect() works fine after a scan has been done, but without doing a scan first it does not return - keyboard interrupt after a few minutes gives a trace pointing to the wifi.radio.connect() line.
This is very repeatable as far as I've seen.
This works:
for network in wifi.radio.start_scanning_networks():
print(network, network.ssid, network.rssi, network.channel)
wifi.radio.stop_scanning_networks()
print(wifi.radio.connect("ssid", "pass"))
This wai...
I should note that I've seen a lot more board-specific support tickets in the forums than on github.
So you mean this mostly as an Adafruit product support thing? Less of a link-board-creators deal
if the third part vendor has support forums couldn't you link to those? like makediary's https://community.makerdiary.com/
Would probably want to verify that they were the ones who submitted the board def first, of course
Who reviewed this? It's a good change. I'm just surprised to see it merged.
If I can vote, I prefer having montonic_ns() to be 32 or 64 bit integer
and better not having ticks_add sub and or not mul mod etc
functions for time arithmetic
endtime = montonic_ns() + some_time
while montonic_ns()-endtime < 0:
pass
@ionic elk @marble hornet Exactly, most companies have support forums. I'm kinda ok pointing folks there even if they didn't add support because they should tell the board maker they want circuitpython support. ๐
@onyx hinge I swapped one issue from 6.0.0 to 6.x.x. I don't want to block 6.0.0 on esp being stable
(which is why I want us to explain stability of each port)
@slender iron seems reasonable
agreed
Ach, how do I solve Warning, treated as error: /home/runner/work/circuitpython/circuitpython/ports/esp32s2/README.md:document isn't included in any toctree again? I'm certain I've done it before but I don't remember the file I gotta edit
you need to add it to another table of contents
otherwise no one will be able to reach the doc
I think it's in docs/supported_ports or something
Ahh, gotcha.
I suspect it's connecting to the first channel that has an AP with the desired access point. The connect redoes a scan and stops on the first channel it finds. I added channel as an option to connect in order to speed up the connection process. That should solve your issue if your APs are on different channels.
Would you like to help add bssid to the Network class? It should be a straightforward edit to https://github.com/adafruit/circuitpython/blob/main/shared-bindings/wifi/Network.c#L7...
This URL returns a valid HTTP 200 status code, headers including a 'Content-Length': '0' header, and no message-body.
This URL / code:
for _ in range(0, 5):
response = requests.get("https://httpbin.org/status/200")
print(response.status_code)
print(response.reason)
print(response.headers)
print(response.text)
returns right away (less than a second) consistently in a browser or in python 3 (macOS).
In CircuitPython,...
Standard Python signals an error when the specified size is nonzero and bigger than the buffer, which this code doesn't do (yet):
>>> b = bytearray(7)
>>> s = socket.socket()
>>> s.recv_into(b, 8)
Traceback (most recent call last):
File "", line 1, in
ValueError: buffer too small for requested bytes```
@jepler Issue filed #3421 because it'd be a good first issue for someone.
I think it got marked as merged automatically because its commit is part of the commits #3405, which I reviewed.
Ok, I think all of this pertains to a Python library (or more than one). We can iterate on those much faster so we can continue it later on those libraries.
For the core, do you have a better idea of what the API would look like?
thanks for the explanation @tulip sleet
I agree with you about the motivation. It is a good thing to have.
I'm wondering what it means in practice. AKA, what is the API? Finding a matching API in CPython is the easiest approach but isn't always possible due to CircuitPython's constraints.
better not having to use special ticks_add sub and or not mul mod etc functions
Python has operator overloading. Whatever the type is, you should to be able to use +, -, <, etc. on it, that's not a problem.
How to enable WebREPL over BLE UART for NRF52 Circuitpython? The impression I have from documentation I found is that I need a custom build of Circuitpython. Is this available somewhere or do I build it?
I don't know of an easy way to enable it
This looks good to me! I'd wait a day to give @Andon-A a chance to comment on the API. He is working on https://github.com/adafruit/Adafruit_CircuitPython_VC0706/pull/18
@kamtom480 Feel free to mark comments as resolved as you do them instead of reacting with :+1:
So we need to:
- [ ] Figure out how to reset from software and save 4-bytes across the reset.
- [ ] Detect brown outs and safe mode when it happens.
- [ ] Intercept fatal error from the IDF and safe mode.
Awesome! Thank you @DavePutz. Looks great.
@slender iron thanks for letting me know about switching issue milestone -- in that case I didn't have a strong opinion, I just wanted to get the "no milestone" count down
totally, thanks for setting it
I just want to push us to stable faster than the esp32s2 will let us
lots of good stuff the other ports would already benefit from
Right, the struct-pack-compliance branch was strictly a subset of #3405 so github marked this PR as merged when that one went in. I agree it's a surprise to see a PR merged with no reviews(!). Should I refrain from working like this, when a "smaller" issue spirals out of control and becomes a larger thing?
I'm totally OK to have larger PRs when it happens. I'd just suggest closing the smaller PR in that case.
Could you explain briefly how this works? It's not clear to me from the code what units it now compresses.
Also, how does it compare to MicroPython's approach? https://github.com/micropython/micropython/pull/5861
Looks good! Thanks. I have not tried the OCD configuration myself. Looking forward to trying it.
OK, so, I've had a short look. I'm going to preface this with I am completely out of my league as far as this type of programming goes, and am primarily going off of how the usage example looks. I expect I'm going to make some assumptions that are wrong, so please do correct me!
I'm going to assume there's something to differentiate between how the camera is interfaced (SPI, I2C, UART, whatever) during initialization.
The VC0706 in particular, though, can take pictures at 640x480,...
Hi Richard! Thanks for adding a new ESP32-S2 board to CircuitPython. We're always happy to see more boards supported. The best place to get support developing with CircuitPython is the Adafruit Discord server, the #circuitpython channel specifically. You can join it by going to https://adafru.it/discord . Discord is blocked in China, so you can add me (tannewt) on WeChat if you are there.
The Factory app partition error is a red herring because we intend on placing the TinyUF2 bootloader t...
Here is a guide we have for adding a board in case you haven't seen it yet: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython
Which repo/branch is the "best" to start from for the esp32s2? Adafruit/circuitpython main? tannewt's wifi branch?
Adafruit/circuitpython main is good2go, native_wifi was merged
Now if you want something specific not yet done... might be in Tannewt's might be in someone else's fork...
Thanks @idle wharf ! Looking to make a simple l293d driver library, and then maybe try to port the the rotary encoder library.
Might be in your fork ๐
@idle wharf - Oh! I'm completely new to the CP source- can you give me a pointer to where it might live; I'm blindly cding around ports\esp32s2 ๐
@idle wharf - sorry, was re-reading readthedocs + github (FYI rotaryio page readthedocs page has a broken github link)
I'm wanting to be able to setup rotary encoders; as it's not on the suport matrix for the esp32s2 I assumed there's some work to be done. Just found the C code in shared-bindings... does everything in shared-bindings "just work"??? I'd assumed there's some work to be done & a "build it" flag to be flipped in the makefile.
I'm not a contributor to the C code, so I'll have to let someone give you a definitive answer, but i think if you look for where it exists in another port (like nrf) then I think you'll see what you're looking for. I'm actually trying to see if I can figure out RTC so if you figure out, let me know
Thanks @idle wharf - nrf looks to be an excellent suggestion for a reference to look at. And I quickly looked at the RTC and found this issue (https://github.com/adafruit/circuitpython/issues/2958) which reading through it gives me some more ideas at least of the moving pieces. Nothing like jumping in the middle and not knowing much about any of the directions ๐
@idle wharf what's not working for you with RTC? From that issue it looks to be working???
The specific RTC module is needed for some other libraries (mini mqtt )
So the common-hal/rtc needs to added. I might be able to figure out just from patten matching what is going on the other ports. (I donโt know C) but if not, thereโs an open issue on it https://github.com/adafruit/circuitpython/issues/3321
I think so, I definitely understand the style you're going for, and will certainly look towards the BLE adapter for inspiration. I'm thinking I'm going to write from the "top down", so the python layer first and then fill in what it needs to be usable. I'll open a draft PR when I feel like the python layer looks sound so we can make tweaks starting there, before ugly accidentally stumbles all the way down the hill!
Excited to get started!
Hardware safety question for esp32s2 saola - I'm got CP flashed via the built in usb socket. Next step is to add a socket for the built in usb. If I'm connecting to the same PC is it ok to have both sockets connected at the same time? Or should I leave the +5V from the breakout socket disconnected from the 5V (Vin?!) pin on the Saola? And if both USB sockets are wired up (ie usb V+ from breakout is connected to 5V pin on Saola) should a PC only be connected to one or the other?
for rotaryio you'll want to enable CIRCUITPY_ROTARYIO in mpconfigport and then add an implementation in ports/esp32s2/common-hal/rotaryio
@hearty forge I usually connect both
Thanks @slender iron ! Re the usb cables- there's "what you can get away with", and "what you should tell students/beginners..." Like current limiting resistors for LEDs (ie short term/low risk projects- risk it. For a medical device... don't ๐ ) Do you know which category plugging both in falls?
I've been doing it since I started working on it. both cables come from the same hub
I make no promises
@slender iron ๐
@slender iron - I'm 3-4 days away from a replacement + $100 minimum order... and I plan to sell/lend these to kids for minimum cost to make it as accessible as I can, so longevity is important to me... and my "save a penny" up bringing ๐คฃ
I'm going to do this tomorrow.
@hearty forge they are saola's? you'll be better off waiting for a better board then
@idle wharf I'm probably in a similar skill bracket, but mqtt is on my list of wanted features. I'll ping you when I get that far- if it's not already working, maybe we can figure it out ๐
@slender iron don't disagree, but I think/hope it'll be good enough to start with - ie learn, build just enough code, build some examples, do some trial runs, and see if there is some local interest. I've got a few spare- but I don't want to fry them as quickly as the first set of trinkets I got... accidentally got the 3.3V version ๐คฆโโ๏ธ
Hello.
How did your review of this PR go?
Last question for a couple of days- is the socket code at a point where you can write a basic tcp echo server?
@hearty forge no, I only did send and recv, not bind or accept
@slender iron - I think that would be enough to test ideas in a "backwards" sense. Really appreciate the answers; I think I have a roadmap for my project now, and a couple of places I might be able to help the project (flesh out some missing bits) because you and the team have done an orbit or two, providing some examples/scaffold for less experienced folk to start from. Super cool what you've all done!
thanks!
Do you happen to have any test/example code of where you left it?
bind and accept?
I didn't start it
though they are commented out in the shared-bindings code I inherited from micropython's socket
No- the send and recv- I'm very rusty; any memory-kicks are very helpful ๐
it is a subset of CPython's socket api
Doh- I was just reading over readthedocs & missed that- also was looking at the shared bindings. Think it's time to take a break. Brain is full!
readthedocs defaults to 5.3.1 which won't have socketpool so make sure you are looking at latest
Thanks @joeycastillo and @TG-Techie for the great comments and background. I like how the discussion is already going. Please forgive me if the words I use are inaccurate with typical terminology and feel free to correct me and clarify anything that I say here.
I've started thinking about the user experience. I agree with @TG-Techie that a full Model-View-Controller is probably more complex than most new users will be able to create as a first project. In particular, I'm concerned abou...
I looked at the other ports, picked the simplest one that had RTC an copied it.
In the original port it used tv in the espressif sample it used tv_now.
This is a partial implemenation for #3321
NOTE: I'm not sure if the calibration stuff which was essentially n\a in the one I copied should be implemented for the ESP32S2
Seems like its working...
>>> import time
>>> import rtc
>>> r = rtc.RTC()
>>> r.datetime = time.struct_time((2020, 9, 14, 23, 22, 15, 0, -1,...
Version 3, this one is pretty much a flat Planck, since I added two more columns of keys. I'm happy with it and I think I'm going to keep using it.
I still have the previous verson, but with RGB LEDs to assemble
I think I need a proper plate before this'll be usable. My first experience with keyswitch sockets hasn't been going well, and my attempt at a 3d printed plate didn't "fix" it. not flat or rigid enough, it keeps pulling some keys out of contact. but this isn't a channel about keebs so I'll stop there.
For my project I often have to deinit a pin from bitbanging, start SPI, deinit SPI, bitbang again etc...
After a pin or spi is deinit(),
it would be the best if the pin hardware can keep its electrical state before deinit().
For my use, only CLK pin is important to be glitchless.
Currently a 1-CLK glitch happens which is luckily of consistent shape and is workaroundable
in the code but I'd like to have cleaner solution if possible.
ESP32 (non-S2) with micropyhton has some SPI pinout w...
@Andon-A Thank you for your comment!
The VC0706 in particular, though, can take pictures at 640x480, 320x240, and 160x120, and can flip between those on a whim. It looks like your initializing it at one set size. This... works? but can be restrictive if, say, you want to take a smaller picture to transmit it over a packet radio faster. but also take larger ones to save to local storage. Again, a lot of this is stuff I quite frankly don't know enough about to know what I'm looking at, b...
Does the Atmega32u4 support circuitpython ? I saw circuit python classic, but is that well supported still?
gotcha
ooh I have received my own message in loopback mode on CANbus with sam e54
oh nice! ๐
I was going to ask you about how the CAN bus development was going @onyx hinge
My team is interested in using CAN bus as an interface for our VLC system
@hearty forge re: usb, can't you just leave the USB breakout cable power off? That's what I do. I just have power coming in over the UART-USB debug cable and the USB I just leave the power unplugged and it works fine
however when NOT in loopback mode, I don't receive my own messages or other messages on the bus
@ornate breach basic functionality is not yet ready for a pull request .. hopefully soon, then we can see what else is needed for it to be useful.
๐ sounds good, it'll be a few months before we are ready to even start implementing CAN
what is a VLC system in this case?
@onyx hinge I got my plate from lasergist
hm the transmit and receive programs both start to fail when I set non-loopback mode
I think this register's state is probably relevant: ACT: SYNC Node is synchronizing on CAN communication - Activity -- it sticks in SYNC when not loopback, but gets to IDLE when loopback
๐ฎ
With "loopback", it's a bit of a misnomer. It can be, and is, received by other devices on the bus.
oh, weird
So it seems like clocks are okay, my bits are all going at the right rate
Yeah I'll look again after food, and go back to the asf4 complete program that I think worked but I'm loopback mode
oh.. what was the link for requesting VID/PID for CP boards?
@idle wharf - sorry, was re-reading readthedocs + github (FYI rotaryio page readthedocs page has a broken github link)
@hearty forge I forgot to mention last night. re: that bad link. You can open an issue in github about it.
I feel like each display or control element's value should be persistent so that any other element could react to its value. And somehow each element needs to be "informed" to react to any change in the control. Rather than try to refresh the display elements every cycle, maybe each element needs the equivalent of "dirty-rectangle" tracking to trigger an update only when the value of a related object was changed.
I would caution against having this be part of what you are trying to achie...
@kamtom480 Could we pass a size into take_picture instead of passing it earlier? Would that cause to long of a delay?
I suspect this is an adafruit_requests bug rather than a CircuitPython bug. In python3 are you using real requests or adafruit_requests?
@nitz Sounds perfect! Thank you!
Could we pass a size into
take_pictureinstead of passing it earlier? Would that cause to long of a delay?
@tannewt We can pass the size in take_picture. There is no problem with that. The API will look like this:
cam = camera.Camera()
cam.take_picture(1920, 1080, buffer, camera.ImageFormat.JPG)
Should I change it?
Does the camera class need two separate variables for width and height? I know many (standard) cameras have locked sizes, so having both be passed separately seems strange on the surface to me
I'd do:
cam.take_picture(buffer, width=1920, height=1080, format=camera.ImageFormat.JPG)
@Andon-A I like having them separate because you don't need a tuple then to store them and you can also "label" them by making them keyword only arguments.
Real requests. Not sure how to do it with adafruit_requests (tried a few things), that's dependent on circuitpython core modules, no? Or would it be done with Blinka? If someone can point me in the right direction, I can probably figure it out.
Makes sense! And you don't have to pile consts and stuff to get there either.
One question. Otherwise, this looks good. Thank you!
Could you try removing this line instead? I think it will be on by default.
It doesn't look like we're returning pins to INPUT when reset. Would you mind trying to do
gpio_set_direction(i, GPIO_MODE_DEF_INPUT);
gpio_pullup_dis(i);
gpio_pulldown_dis(i);
Setting the pin to INPUT should float it and preserve the charge.
I improved the initial comment on this PR and also added an explanation in the comments of translate.h:
+// - code points starting at 128 (word_start) and potentially extending
+// to 255 (word_end) (but never interfering with the target
+// language's used code points) stand for dictionary entries in a
+// dictionary with size up to 256 code points. The dictionary entries
+// are computed with a heuristic based on frequent substrings of 2 to
+// 9 code points. These ar...
That did work! I retested on the Kaluga.
I don't think setting pin to input is good idea, because
Rest of hardware may pull it differently and we can't rely in charge
capacitance.
Correct way would be if clk pin was e.g. in output state and driving "1" out,
after deinit() it should continue to drive "1", not float.
On 9/15/20, Scott Shawcroft notifications@github.com wrote:
It doesn't look like we're returning pins to INPUT when reset. Would you
mind trying to dogpio_set_direction(i, GPIO_MODE_DEF_INPUT);...
http://httpbin.org/status/200 returns with 200 right away on numerous iterations (only one occurrence of "Unable to read HTTP response"; haven't been able to replicate)
For "https://httpbin.org/status/200", not sure how to get past RuntimeError: ssl_context must be set before using adafruit_requests for https for an apples-to-apples comparison
Actually, if I do everything in the right sequence from scratch, https results in ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)
Hmm @thorny jay :) did you have any luck using Gamepad on Commander?- I can't get it to work reliably in 6.0.0-alpha.3 but it did work OK in a self compiled 6.3.1 back when I submitted the patch to add it.
Could you comment this? It's not clear to me how it works. Are you essentially taking all strings between 2 and 9 code points and counting their occurrences over all of the other strings?
Hi @onyx hinge , I know I am late for the party, but I just watched the PythonDay video about sdioio. What I did not catch from the video or quick read from the guide is if PyPortal is properly wired for sdioio or only for sdcardio.
I get that the PyGamer is sdcardio and STM32 is sdioio. But do you have a table that say which is sdioio compatible?
Hmm @thorny jay :) did you have any luck using Gamepad on Commander?- I can't get it to work reliably in 6.0.0-alpha.3 but it did work OK in a self compiled 6.3.1 back when I submitted the patch to add it.
@copper crescent It was unsatisfactory, but my first use of it, so I could not tell if it was me or a problem.
I used nightly build because I needed the usb hid report.
err 5.3.1 even
@slender iron I am still getting the SSL failure on teh esp32s2 when I try this request response = requests.get("https://api.thingspeak.com/channels/1417/feeds.json?results=1") failes with ```Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "wifi_cheer.py", line 39, in <module>
File "adafruit_requests.py", line 507, in get
File "adafruit_requests.py", line 456, in request
File "adafruit_requests.py", line 405, in _get_socket
File "adafruit_requests.py", line 401, in _get_socket
OSError: Failed SSL handshake
I was "missing" button press or a bit of delay. I returned to using denounced library (that I had to fix).
Could not use 5.3.1 because usb hid report is only on 6.0.0.
@solar whale please open an issue to use the cert bundle we use in esp32 nina fw. my guess is that we don't have the root cert for that domain
right now the s2 is using the default bundle
ah OK -- and is it normal for the "star count" request to take a really long time -- like 20 seconds...
@thorny jay yeah, I'm seeing lots of missing button presses too
Should write a very simple test code that only does unitary test to confirm the feeling. An run on another hardware with buttons... but not sure what I have that will not require breadboarding or worse.
Not sure about the internals of gamepad implementation. But with long int removed from M0 it could be affected...
deinit should definitely float because you are done with the pin. That's what all of the other CP ports do already.
We don't actually support transitioning between bitbang and hardware output with any of our APIs like you are trying to do.
How are you switching your DigitalInOut to output? Perhaps it's causing the glitch.
That was discussed in the weed in last meeting 25 hours ago.
@solar whale ya I think so. it's doing a lot of json parsing
the following request work OK with and ESP32 with the NINA firmware, but not with the esp32s2 native wifi
response = requests.get("https://api.thingspeak.com/channels/1417/feeds.json?results=1")
fails with
Traceback (most recent call last):
File "", line 1, in
File "wifi_cheer.py", line 39, in
File "adafruit_requests.py", line 507, in get
File "adafruit_requests.py", line 456, in request
File "adafruit_requests.py", line 405, in _get_socket
File "adafruit_req...
OK -- not a problem -- just wanted to check -- seems to work reliably
@copper crescent Maybe I can try on uGame ... it has buttons, don't you have one too?
Don't change FULL_BUILD. Delete this line.
@solar whale the new requests changes parsing to be byte by byte. I think its slower but it'll use less memory
patience is a virtue
I suspect there is a middle ground we could do to grab 32 bytes at a time or something
@thorny jay no, I've dug out an M0 feather so I'll give it a go on that
to minimize overhead and memory
At this point -- just having it work is amazing
๐
Maybe try with the first build after your change was accepted. All build are on S3, so you can check it was working and got broken...
Sorry @copper crescent , I am on my phone and into a hot tub... except for my memory and idea, I am not really useful to dig into code or test right now.
@stuck elbow what USB PIDs do you use on your boards?
Did you get my report that commander reboot on SDcard insertion? Your support page did crash when I submitted all the details and I lost the detail output.
Yes. Same error with that exact code. I think there's just no default certificate in my python3 environment? I poked around the ssl module docs, it gets thick pretty fast. Still reading.
@thorny jay not a problem was just wondering if you had it working but it looks like it's OK on the Feather M0 Express with 5.3.1 but missing presses with 6.0.0-alpha.3 using the example code so it might not be all me ;)
@slender iron firmware-wise it's fluff m0
that's what I needed it for - to have a board that has all the pins but just naked samd21
@thorny jay Hmm no I didn't, feel free to email/msg details when/if convenient
@stuck elbow I'm trying to sort out CP USB PIDS and it looks like pewpew10 shares with gemma and ugame10 shares with the trinket
that's possible, they were made before I had my own PID
@slender iron if Adafruit could assign some of its PIDs, I see no problem with that, should I go the formal path with this through the bug tracker?
I can do it. I just want to know what you are using now
otherwise I can try getting some more from OpenMoko
/ what you need
pewpew m4 uses my openmoko pid, and fluff m0 got pid from adafruit, otherwise I don't have any more
so it would be nice to assign separate pids for pewpew10 and ugame, if possible
I don't think I have any more CP boards officially published
the keyboards are for my own use so far, and I still didn't finish the robots
kk will update pewpew and ugame
what is the id for fluff? I don't see it in our file
I'd like to ask for USB PID for the Fluff M0 board, documented at https://hackaday.io/project/171381-fluff-m0 please.
Fluff M0 VID 0x239A PID 0x00AF # bootloader
PID 0x80AF # arduino
PID 0x80B0 # circuitpython
except I don't have an arduino board definition
kk, do you expect to have one? or should we use it for one of your other boards?
@stuck elbow I believe you were behind the Gamepad library? Did you recently tested Gamepad code (the pin version)? Because we have a problem on Commander 8086 where it was recently added.
@stuck elbow ugame will be 0x80AF and pewpew10 will be 0x80D5
(I was a little confused that the top level makefile only generates documentation.)
No problem, anything else that was confusing as a first-time port builder? Would like to make this accessible as possible.
Yes It is causing the glitch.
IMHO, deinit() should at least have some parameter how to leave the pin
or it should leave it in the state it found. When a pin is deinit() it doesn't
mean we are done with the rest of hardware. Image half-bridge driver
solid state relays and similar things... going into input mode is not good.
Source is here, an example line when workaround is done.
https://github.com/emard/esp32ecp5/blob/master/circuitpython/ecp5f.py#L71
On 9/15/20, Scott Shawcroft <notific...
OK.. moving slower. I reverted that change.
With CIRCUITPY_RTC = 0 no RTC is available in the image so I think the original PR was the correct change. If I'm not understanding let me know.
OK, tried a bunch of things, even what seemed to be the recommended approach with SSLContext.wrap_socket() didn't get a connection, but this worked:
https = requests.Session(socket, ssl._create_unverified_context())
With this change to https://github.com/adafruit/Adafruit_CircuitPython_Requests/blob/master/examples/requests_https_cpython.py that code runs fine.
Then, ...
@maditnerd Please use:
MuseLab nanoESP32-S2 VID 0x239A PID 0x00DE # bootloader
PID 0x80DE # circuitpython
@slender iron thanks
@thorny jay I didn't test it properly, but I did try 6.x with pewpew m4 that uses it and it seems it worked
wahoo, packet reception now works. I had failed to set the data direction of the RX pin to input, so while I could (somewhat surprisingly!) monitor the logic level RX signal on the board and it showed what I expected, the CAN peripheral didn't get any data in.
@thorny jay I didn't test it properly, but I did try 6.x with pewpew m4 that uses it and it seems it worked
@stuck elbow Thanks, I tested on my Sam minifig (single button) that is also M4 and it works. Will investigate further... maybe an M0 issue???
possible
I didn't touch pewpew10 in a while, I recently have very little usable time
Does ugame use gamepad? I will have a new usb ID... so I need to test. ๐
it does
wait, pewpew10 doesn't, it scans buttons as a part of metrix display routine
but ugame and pewpew m4 both do
Tested & working:
- Send standard packets
- Receive standard packets (1 FIFO, no filter)
Interoperation between SAM E54 Xplained running this tree and MicroPython running on STM32F405 Feather with an external transceiver was also tested. (SAM-to-SAM is not actually tested yet)
Many other aspects of a full implementation are not yet present, such as error detection and recovery.
The listener program should be started before the transmitter program. Otherwise, the tr...
nice @onyx hinge ! that was going to be my other guess
I'm happy I didn't spend much more time stuck.
๐
Looks great! I've fixed it up to pass.
๐ nice
['\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00', '\x00\x00\x00\x00\x00\x00\x00\x00.\x00\x00\x00'โฆ``` that's not healthy
noooopeeee
@jepler - do you know what the intent was for PR #3244? I asked @xiongyihui but have not received any response. Since qspi_disable() is called in port_sleep_until_interrupt(), any routine that calls mp_hal_delay_ms() will turn off QSPI. In effect, this disables QSPI by default at boot time when USB is not connected, as several startup routines have short delays in them. The effect on the Clue is to disable the display (which uses SPI) and there does not seem to be any way to turn it back on....
@thorny jay @stuck elbow looks OK here on a Feather M4 too but not the Feather M0 or Commander (M0)
I have some buttons on an 405f board. and I should be looking into debounce some day. would it help someone if i tested something?
I hope 405f is an adequate nickname
(I was a little confused that the top level makefile only generates documentation.)
No problem, anything else that was confusing as a first-time port builder? Would like to make this accessible as possible.
Over all, very impressed - better than what I got to see over peoples shoulder 10 years ago from commercial vendors (worked adjacent to base port devs.) it would be helpful to have a few short readme files sprinkled around in the HAL, binding, driver directories for both the ...
@idle wharf - re read the docs links to GitHub - All items that are generated from init.c files have broken links - https://github.com/adafruit/circuitpython/issues/3400
Building the docs is hard. I ran into an issue with some Microsoft docs where whole sections were missing.
Very minor point... tty.SLAB_USBtoUART* will have a number appended if there is more more than one USB-to-Serial device and the target of interest isn't the oldest one connected, so it may not work by default on macOS.
QSPI is not SPI. Normally, they don't affect each other. Does SPI share pins with QSPI?
Over all, very impressed - better than what I got to see over peoples shoulder 10 years ago from commercial vendors (worked adjacent to base port devs.) it would be helpful to have a few short readme files sprinkled around in the HAL, binding, driver directories for both the shares and port directories. I imagine if youโve seen a BSP package before/HAL abstractions it might be a different kind of confusing due to some of it being for python bindings.
In case you haven't seen, all of the ...
@unexpectedmaker, please test your board with this change. My UM feather S2 isn't coming up with the bootloader.
Probably not the cause, but from reading the config files and pattern matching, wonder if it's to do with /docs/autoapi/templates/python/module.rst - search for index.rst. To me the paths that I think this template generates match up to the incorrect links on RTD.
I've built the docs locally and the resultant structure is quite different than RTD- so I'm lost as to how to reproduce it locally.
But after some googling, I think the GitHub links on RTD are added by their theme, which ...
Over all, very impressed - better than what I got to see over peoples shoulder 10 years ago from commercial vendors (worked adjacent to base port devs.) it would be helpful to have a few short readme files sprinkled around in the HAL, binding, driver directories for both the shares and port directories. I imagine if youโve seen a BSP package before/HAL abstractions it might be a different kind of confusing due to some of it being for python bindings.
In case you haven't seen, all o...
@slender iron Thanks for answering my flash question to unexpectedmaker the other day, looking at the build files had me baffled. I'm guessing bigger partition in general for esp32s2 is due to the added network modules, but curious why an extra bump on larger flash modules?
just to give us more headroom
I'm worried we'll run out with ~1400k
and for really big things people will use an SD card
got it, thank you
np
I've never had processor-internal time.time() go bad on me before... glitch in the matrix?```>>> time.localtime(time.time())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: overflow converting long int to machine word
time.time()
2206332817```
(Feather M4)
so I guess I should put a check in for seconds values > 2**31 - 1 before doing time stuff on them
From what I can see SPI and QSPI do not share pins on the Clue.
From boards/clue_nrf52840_express/board.c:
void board_init(void) {
...
&pin_P0_13, // TFT_DC Command or data
&pin_P0_12, // TFT_CS Chip select
&pin_P1_03, // TFT_RST Reset
...
&pin_P1_05, // backlight pin
and in supervisor/qspi_flash.c:
nrfx_qspi_config_t qspi_cfg = {
.xip_offset = 0,
.pins = {
.sck_pin = MICROPY_QSPI_SCK, // defined as NRF_GPIO_PIN_MAP(0,
19)
...
@tannewt sure, I think I can get this going. You're right that bssid to the Network class was pretty easy once I got a better feel for the layout of things, since it's already stuffed into wifi_network_obj_t along with everything else from the esp-idf's wifi_ap_record_t. I just need to add it as a parameter to the connect call and then I'll open a PR.
Trying to understand rotaryio and have found that CIRCUITPY_ROTARYIO = 0 in all the mpconfigboard.mk files- even the ports that list it as available in the support matrix on RTD. How does this flag work? Is there another layer of config that flips this prior to building it?
Thanks โค๏ธ , i'll check what i've done (probably rewatch @tannewt video), and do a pull request on both adafruit/circuitpython and adafruit/circuitpython-org
I asked my sister (who is a photographer) to take a picture of the board.

Added nanoesp32 s2 board using usb vid/pid from #3351
@hearty forge That's odd. What are some examples of boards that set CIRCUITPY_ROTARYIO to 0 but have it?
One thing that just occurred to me is that, if possible, it might be useful to support .mpy files in this function. Currently, .mpy isn't supported during a board restart.
Hello. Is there a single github repository where all the uf2 files are stored for the sample program which comes with each Adafruit device? I thought there was one but can't find it.
uf2 files are not stored in a git repository
and they don't contain sample programs either
Often (but not always) they pre-loaded demo contnet is available in the Downloads section of the device specific guides.
@robertgallup I am not sure what you mean. Do you mean you can't have code.mpy?
If something.py and something.mpy both exist, then something.py will take precedence.
@lone axle I spotted that for CLUE but not CPB with a very quick browse.
@simple pulsar coincidentally I was just looking for the CPB pre-loaded demo the other day and Jerry had a copy of it that he was able to share with me. If you just need a copy of it, not an official source I can pass that along to you.
I think I tested it a while ago, and indeed code.mpy or main.mpy weren't picked up.
We should fix that, but it's easy to have a code.py that imports the actual program.
It does seem to be missing from the main device guide for CPB though I did notice that as well.
@dhalbert @deshipu Yes. I haven't tested code.mpy, but main.mpy is not recognized. There was a discussion about this on Discord some time back.
Sure, but it's always some extra memory, and the reason for using mpy is to save memory in the first place.
@stuck elbow Isn't https://github.com/adafruit/Adafruit_Arcada/blob/master/examples/full_board_tests/arcada_clue_test/arcada_clue_test.ino the sample progam that comes on the CLUE?
no idea, but it's not a uf2 file for sure
Yes, I think so. But it's not a uf2 file. It's .ino file.
Usually the demos are Arduino programs that sometimes also serve as factory test programs
I'm not 100% sure what Arcada is all the way. But I think perhaps CPB does not support that? which is maybe why it's not included in that repo.
And the reason for this restart() function is to avoid using import to begin with.
I think it's just a matter of adding code.mpy and main.mpy to:
Just in case it becomes helpful. Here is the pre-loaded CPB uf2 file that Jerry shared with me. I'll be out for a bit.
The items I raised concerns about in the past have been addressed. No testing performed.
It came up here: https://forums.adafruit.com/viewtopic.php?f=58&t=166081
That would be a simple fix for the standard restart. :-) With this new function, you'd either have to accept the full file name, e.g. cool_program.mpy' or make sure to check for the .mpyversion (I guess the same way thatimport` currently works.)
@stuck elbow I do see a few .uf2 files in this repo: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_MakeCodeDemo.uf2
Where's best place to read about vectorio ? I saw it mentioned on https://github.com/adafruit/circuitpython/releases/tag/5.4.0-beta.1 but the link's not working yet https://circuitpython.readthedocs.io/en/latest/autoapi/vectorio/index.html
Turns out it's over at https://circuitpython.readthedocs.io/en/latest/shared-bindings/vectorio/index.html#
I think there was an intention at one point to have a repo of the factory loads for each board https://github.com/adafruit/circuitpython-default-files It would be handy to have versioned firmware and software for each board as-shipped.
@crimson ferry Yes, that's what I was thinking of, but I'd forgotten it was CircuitPython-centric.
Looks good! Thanks. I have not tried the OCD configuration myself. Looking forward to trying it.
Is this still happening for you? I might want to test it on STM32 and ESP32, see if it occurs on those too.
@k0d are you able to push your USB changes to this PR?
@tulip sleet re CIRCUITPY_ROTARYIO my search didn't include the ?= makefile operator (it's new to me)- it's defaulted to enabled in /py/circuitpy_mpconfig.mk. Which I believe means it's enabled by default, disabled for a specific port/board. Which if I'm inferring the meanings correctly makes a lot of sense: py/circuitpy_mpconfig.mk defines which features are considered core platform ones (being disabled is for a port/board is an exception) and which ones are optional (being enabled for a specific port/board.)
@hearty forge I think you've figured it out! Yes, the ?= is pretty new, and is easier to read
@tulip sleet I agree- once you know about it ๐
This looks great to me! Thank you!
@idle wharf did you try deleting the CIRCUITPY_RTC line?
Seeeduino Xiao and OLED with CircuitPython
@idle wharf did you try deleting the CIRCUITPY_RTC line?
@slender iron No I didnโt. I see what youโre asking for now.
Thanks @astrobokonon! If you need help, the Adafruit Discord is a good spot to get help if you need it: https://adafru.it/discord
I'd rather not support mpy at the top level because it obfuscates the running code and is impossible to edit.
A fair point. But, I'm curious, why is non-editable, obfuscated code undesirable? Are you worried about nefarious applications? Or, is it against the hack/education ethic of CircuitPython?
Looks good to me too!
When we're building ESP32S2, we should be using the IDF as it is in the repo, not in our HOME directory (even though the setup process does put a copy there). And by this I mean we should use CP/ports/esp32s2/esp-idf/export.sh not the GET_IDF alias created in the IDF setup guide which runs HOME/esp/esp-idf/export.sh Correct ?
@tulip sleet do we have a specific variable for appending CFLAGS to make? So I can run something like make BOARD=blahblah BUTALSO=-Wno-unused-variable
not that I know of
Thinking of maybe adding $(ADDFLAGS) for voluntary temporary warning suppression then?
for debuggin
@kamtom480 I have a Spresense board and camera, and thought I would try out your PR when reviewing it. I loaded the bootloader and other firmware, v2.0.000 successfully. I built the firmware, first from your PR branch and then from main after the merge. In both cases I built just fine, and did make BOARD=spresense flash. But after flashing, I did not get a /dev/ttyACM0, but only /dev/ttyUSB0. I did unplug and plug in the board after flashing when it did not work immediately after flas...
@ionic elk how about BUILDER_CFLAGS or USER_CFLAGS or something like that, to make it clear it's CFLAGS?
USER_CFLAGS sounds good
or maybe EXTRA_CFLAGS or ADD_CFLAGS? To make it clear that these are added on. Referring to a builder as a USER is always a little confusing
whee, CAN bus error handling works now. If I provoke errors by randomly un-plugging the network wires I can get to BUS_OFF state, which leads to a restart and continuation of successful transmission. ```
'Sender ___' 254 _canio.BusState.BUS_OFF
RESTART
'Sender ___' 0 _canio.BusState.ERROR_ACTIVE
[Rebased to clear out some merge conflicts due to camera
I tried this on a feather_m4_ express and reproduced the problem with CircuitPython 6.0.0-alpha.3-106-g66cf6c46c
BUT
I updated the libraries to the most recent (9/15 bundle) and the problem went away.
This is puzzling since adafruit_busdevice has not bee updated recently.....
adafruit_rfm69 has, but it is not clear how that could impact this issue...
I'll update to current main and try it a few more times ,,,,
How fast is our NOR flash usually? In terms of SPI speed?
When we're building ESP32S2, we should be using the IDF as it is in the repo, not in our HOME directory (even though the setup process does put a copy there). And by this I mean we should use
CP/ports/esp32s2/esp-idf/export.shnot the GET_IDF alias created in the IDF setup guide which runsHOME/esp/esp-idf/export.shCorrect ?
@idle wharf I use the idf in the repo. The tools live outside it though.
@ionic elk I think 40mhz or so
Assuming the order is well defined for evaluation of list elements something odd is going on here as monotonic_ns() is briefly jumping backwards:
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit CLUE nRF52840 Express with nRF52840
>>> import time
>>> good = not_as_good = 0
>>> while True:
... t_t = [time.monotonic_ns(), time.monotonic_ns(), time.monotonic_ns(), time.monotonic_ns()]
... if sorted(t_t) != t_t:
... not_as_good += 1
... print("OH NO", ...
@tannewt Yes, when I remove the CIRCUITPY_RTC line completely RTC is present in the build.
Also tried on teensy4.1 -- same result
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.3-165-g9256e6b37 on 2020-09-11; Teensy 4.1 with IMXRT1062DVJ6A
>>> import board
>>> board.SPI().try_lock()
True
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.3-165-g92...
@ionic elk that is the speed cap for a given port. the chips themselves can usually do 40ish iirc
ag -Q SPI_FLASH_MAX_BAUDRATE ../..
../../supervisor/shared/external_flash/spi_flash.c
151: if (spi_flash_baudrate > SPI_FLASH_MAX_BAUDRATE) {
152: spi_flash_baudrate = SPI_FLASH_MAX_BAUDRATE;
../../supervisor/shared/external_flash/external_flash.h
44:#ifndef SPI_FLASH_MAX_BAUDRATE
45:#define SPI_FLASH_MAX_BAUDRATE 8000000
../../ports/mimxrt10xx/mpconfigport.h
34:#define SPI_FLASH_MAX_BAUDRATE 24000000
../../ports/atmel-samd/mpconfigport.h
44:#define SPI_FLASH_MAX_BAUDRATE 8000000
79:#define SPI_FLASH_MAX_BAUDRATE 24000000```
@jepler @tannewt Report from looking at this this morning. Delay obviously changes a lot based on the size of the incoming data. Measuring the duration of the memset with the DWT at 168MHz, these are the timings I got:
- 3 byte flash setup read: 886ns delay vs 91ยตs read time (~1%)
- 512 byte flash read: 73.6ยตs delay vs 3.2ms (~2.3%)
This is of course not variable with the speed of the SPI line, so it'll be a more significant delay compared to the actual transaction the faster the SPI ...
This appears to be resolved - as well as being duplicated -- see #3266
@slender iron observing it with DWT, I'm seeing about 3.2ms for a 512 byte flash transaction, which would imply a speed of about 160kB/s if you disregard overhead
DWT? on what port
you are probably including the erase time
a 512-byte memset() taking 3.2ms?
that and writing 512 bytes is really reading 4k, erasing and then writing back 4k
No, this is just the actual SPI transaction itself for 512 bytes, occurring somewhere in the flash code.
I'd suggest using a saleae to check SPI baudrate
DWT->CYCCNT = 0;
start = DWT->CYCCNT;
memset(data, write_value, len);
mem = DWT->CYCCNT;
result = HAL_SPI_TransmitReceive(&self->handle, data, data, (uint16_t)len, HAL_MAX_DELAY);
end = DWT->CYCCNT;
- or other logic analyzer
lunchtime, I'll read back later
Well, the actual speed isn't too big a deal, unless you suspect that's way to slow and might be another issue. The end conclusion is that adding the memset adds about 1-2% of the read time
If you're measuring just the TransmitReceive time of the SPI transaction, it should be about the bit rate divided by the number of bits (which is 8 times the number of bytes)
Backing up, this is all trying to figure out whether we should double the size of SPI_Read's write_value variable, so it can have an "invalid" state that implies we don't care about the value of the write line during a read. That lets us skip the memset and only do an SPI read instead of a transaction. I don't personally know enough to judge whether a 1% to 2% loss is worth putting in a change like that
That number looks close to 1.28MHz, what bus rate are you looking for
The native USB is on the breakout board I think. Could you post a picture of your setup?
a function parameter generally doesn't "cost" more if it's 32 bits than if it's 8 bits
(the first 4 parameters to a function are passed in registers, which are all 32 bits)
So (543700 - 12368) = 531332 clock cycles via DWT, x (1/168MHz) = 3.16ms, /512 bytes is 161.8 kB/s, right?
@onyx hinge my concern with the API thing is whether it's worth the time to change all the APIs and whether it's considered a breaking change
I can at least confirm that the SD card seems to be working?
Thanks, you are right, it was hiding under the board, which I had mounted on a holder.
Running the read directory sketch from here https://learn.adafruit.com/micropython-hardware-sd-cards?view=all#tdicola-circuitpython seems to do what it's supposed to, spits out all the invisible junk that my mac put on the card ๐
adafruit_sdcard defaults to 1,320,000 bits per second SPI rate which is close to the time you are seeing in HAL_SPI_TransmitReceive (1.3MHz/8/512 = 3.15us)
We're not going to change how deinit works. If hardware requires a particular default state a pull resistor should be used.
Thanks for a link to your source. I suspect you may want to change this: https://github.com/emard/esp32ecp5/blob/master/circuitpython/jtag.py#L43-L45
The clock line is POL = 1 which means the default state is high between transactions. (According to Wikipedia) Setting .direction...
reference for baudarate of adafruit_sdcard: https://github.com/adafruit/Adafruit_CircuitPython_SD/blob/master/adafruit_sdcard.py#L104
.. so the SPI transfer is taking the expected length of time.
how long is the 512 byte memset() taking?
yes, thanks! Sorry I thought you were talking about bytes/s
it is confusing and I could be clearer. I am just familiar with always operating in bits when talking about SPI rates so I didn't call it out as well as I could have.
So everything is fine in terms of SPI speed. The memset takes 73.6us
I added the timings in the OG issue: https://github.com/adafruit/circuitpython/issues/3176
ah I saw it go by but then couldn't find it here in discord
3 byte flash setup read: 886ns delay vs 91ยตs read time (~1%)
512 byte flash read: 73.6ยตs delay vs 3.2ms (~2.3%)
Let's consider the 512 byte read, but at a variety of rates. We can predict how long the SPI transaction will take at different rates, and that the memset will take the same length of time in each case
Actual DWT Values:
- Flash init of length 3:
- Start = 3, memset = 152, transaction = 15426
- Percent: (152-3)/(15426-152) = 0.97%, ~1%
- Flash read of length 512
- Start = 3, memset = 12368, end = 543700
- Percent: (12368 - 3)/(543700 - 12368) = 2.32%
^ see above for actual DWT cycle numbers
The intent of #3244 was to turn off the QSPI peripheral while going to sleep so that the high speed clock would be turned off and save a bunch of power. It should start back up at the next file access.
The SPI to the display should be separate from QSPI. Perhaps the SPI isn't keeping the high speed clock active?
right exactly, this is a set delay
at 8 MHz, 512 bytes would take 512us, so the overhead of 74us becomes 14%.
1Mbaud seems pretty standard, the BMP280 and several other sensors run off of it. What are some devices that go up to 8?
SD cards are operated at 8MHz by sdcardio https://github.com/adafruit/circuitpython/blob/main/shared-bindings/sdcardio/SDCard.c#L47
14 percent is pretty gross, but will it matter for those applications?
compared to not working at all it'll be awesome
it's a good start
24 clocks to memset 1 byte is slower than I expected.
Well, I was asking all this to see if the API change was justified. My impression is that it is.
what API change?
no API change, just implementing the write_value of SPI.readinto on STM32
