#circuitpython-dev
1 messages Β· Page 380 of 1
hrm, any led flashing?
Yes , when I type it flashes but nothing on terminal session
yello LED by the reset button blinks when I type in screen , but nothing displays. it is 115200 baud, correct?
yes -- it flashes
alos flashes if I disconnect screen.
On a few occasions I saw the CP banner in the webusb display after connecting to the USB device
Is https://github.com/adafruit/circuitpython/pull/5010/checks?check_run_id=3088486929#step:14:667 because I included a comment about _pixelbuf being deprecated?
are you doing webusb at the same time as screen?
the serial doesn't do connection detection like the native usb one does
it's because there is no longer a definition for _pixelbuf in the generated documentation, I think.
but it persists over reset
Do I make it not appear as code? Or what do I do instead?
You can generate the documentation locally by going to the top level of the circuitpython and doing make html.
i'll look at the PR. Still working on the little library.
I included this line //| Also available as `_pixelbuf`. This usage has been deprecated. Which is what I think it's failing on.
@slender iron just tried screen from linux as well -- same -- no reponse
We do double backticks in libraries to get Sphinx to back off. Does that work here?
This failed hard, hah.
Trying again after installing sphinxsearch.
That did not help.
[1724605.094634] cdc_acm 3-3.3:1.1: ttyACM0: USB ACM device
[1724605.096983] hid-generic 0003:0D28:0204.013E: hiddev0,hidraw1: USB HID v1.00 Device [ARM "BBC micro:bit CMSIS-DAP"] on usb-0000:00:14.0-3.3/input3
[1724606.114643] scsi 8:0:0:0: Direct-Access MBED VFS 0.1 PQ: 0 ANSI: 2
[1724606.115072] sd 8:0:0:0: Attached scsi generic sg3 type 0
[1724606.115556] sd 8:0:0:0: [sdd] 131200 512-byte logical blocks: (67.2 MB/64.1 MiB)
[1724606.115818] sd 8:0:0:0: [sdd] Write Protect is off
[1724606.115820] sd 8:0:0:0: [sdd] Mode Sense: 03 00 00 00
[1724606.116072] sd 8:0:0:0: [sdd] No Caching mode page found
[1724606.116075] sd 8:0:0:0: [sdd] Assuming drive cache: write through
[1724606.160220] sdd:
[1724606.162065] sd 8:0:0:0: [sdd] Attached SCSI removable disk
``` @slender iron thsi is what Linux sees
yeah ,there are a bunch of things to install to do that
ModuleNotFoundError: No module named 'sphinx_search' I can't figure out what it wants.
@solar whale that's correct because the host is talking to the interface chip
Like the only module I could find was sphinxsearch to install. Other iterations of it don't exist.
Note that function availability shouldn't vary with board. variation should be done at the module level. For string support we could support supplying a file-like object that code just be a string buffer.
Trying readthedocs-sphinx-search.
@solar whale I'd suggest trying the ble side again. (I'll be in a meeting in two minutes.)
It's doing more than it did before.
Thanks -- I'll keep poking at it
Alright! got the same as the remote failure.
@tulip sleet Double backticks seems to have gotten rid of the failure. I got this though. Which I think might be unrelated? WARNING: RSVG converter command 'rsvg-convert' cannot be run. Check the rsvg_converter_bin setting
Looks good! Some things to change.
_pixelbuf is no longer an auto-generated module name. The easiest thing to do here is probably to just do:
//| Also available as ``_pixelbuf``. This usage has been deprecated.
return mp_obj_new_float(common_hal_adafruit_pixelbuf_pixelbuf_get_brightness(self_in));
These should not be double underscore. They were before only because of the leading underscore on _pixelbuf.
common_hal_adafruit_pixelbuf_pixelbuf_construct(self, args[ARG_size].u_int,
that is new; i have not seen that before
The docs built though and it worked. So good enough. Looking into the changes you asked for now.
@tulip sleet Is it all references to common_hal__adafruit_pixelbuf that should be single _ ? I have 48 references found.
yes, change all of 'em
On it.
I started to mark them, and then realized there were MANY
Yeah I wanted to make sure that I was right in changing all of them since you didn't mention them all. Before I hit go on 48 things. π
Also released Pixelbuf as 1.1.0. Good thing version numbers don't cost anything.
@tannewt I see that the
Makefilenow relies on a scripthexmerge.pywhich is not in the source tree.
Where is it supposed to be taken from?
We store python build dependencies in requirements-dev.txt so you should be able to pip install -r requirements-dev.txt to get everything you need.
@tulip sleet Everything is failing. Seems unrelated to my PR.
I would be happy to help with testing this build, but I am completely baffled about how to use the board.
I have occasionally managed to get the serial device to spit out the CP version info (see screenshot), but nothing else. I can see the CIRCPY BLE device but have made no progress connecting to it.
Should I be able to get to the REPL via something like screen? I can connect, but get no responses....
Clearly, I am missing something. Are there any instructions for using code.circu...
i'll take a look in a bit
Ok, thank you.
@slender iron maybe it's worth writing a straw Guide for how to try the BLE workflow?
Looks good! Thanks @DavePutz. CI issues are unrelated so I'll merge now.
I am using an M1 Mac -- I can try going back to an Intel Mac as well if that may be a problem.
keypad.EventQueuehad the wrong name for its type name.EventQueue.overflowedwas missing from the class dict.
Build failures are due to xtensa build caching. Nothing to do with your changes. To fix, we need to change the cache key:
Change
.github/workflows/build.yml, line 534:
OLD
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210506
NEW
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210716
In general, we update the key to today's date.
It is not clear to me at...
@tulip sleet I assume this is related to ^^ "AttributeError: 'Keys' object has no attribute 'overflowed'
uh, yeah, nothing like finding bugs in your own code when trying to use it π
happy to have you approve it if you'd like
Am I right in thinking build artifacts don't show up until it's done building?
I need a build for CPB.
I can make one quicker, hold on
for CPB, with .overflowed
Ok, without changing the way the library works, I don't know how to implement this into it. The code runs at least, so your build works. But just like the key event requires you to get() in the loop, this code requires you to call update() in the loop.
value_when_pressed=True for the CPB buttons, I think
they are connected to +v, not ground, is that right?
That's all I've been using.
no BLE on CPX, so maybe try that
Testing on CPB first because CPX requires building.
I am the guy that tested the BLE workflow on the MagTag... I can now confirm that the MagTag is not using an nRF chip. π€£
but it still has antennas π
@tulip sleet How would I make it return what it used to return with I think was a tuple with the button name versus True or False.?
i will look
return tuple(self._states.was_pressed(i) for i in range(2))``` works for `True` `False`.
I'd have to hook up something running 6.x and verify.
@tulip sleet >>> print(cp.were_pressed) {'A'}
I wish I knew who or what was even using this feature.
But I'd rather not break anything in this library.
self._states.update()
ret = set()
for button, key_number in (("A", 0), ("B", 1)):
if self._states.was_pressed(key_number):
ret.add(button)
return ret
did you do the same thing?
No, that was from an old thing.
To show you what it did.
@tulip sleet Attempted heap allocation when VM not running. is how the CPB is crashing.
that is either the new BLE code or the new HID code
but maybe more likely the former
LOL I had the board upside down. Trying to test the buttons.
two more ways to do it:
self._states.update()
ret = set()
if self._states.was_pressed(0):
ret.add("A")
if self._states.was_pressed(1):
ret.add("B")
# OR
self._states.update()
return { ("A", "B")[i] for i in range(2) if self._states.was_pressed(i) }
"Why isn't button B working?!" "Oh, button A works....... wait did I make the pins backwards?" No. No I did not.
there you have a set comprehension
Ooooh.
I like it.
Also this crash is getting beyond frustrating.
I made it work.
I'm done testing on CPB.
I have replicated this issue, with the same code, on a Circuit Playground Bluefruit writing to a Pyportal Titano
(CircuitPython 6.3.0).
The code hangs on the CPB when trying to verify if UARTService in connection, and if I turn off the Pyportal, the code on CPB crashes with this traceback:
File "adafruit_ble/__init__.py", line 75, in __contains__
File "adafruit_ble/__init__.py", line 52, in _discover_remote
Same code works correctly when connecting 2 Circuit Playground Bluefr...
I think I would make key_states.py be a tiny library, because it's generally useful. Not sure what the name would be: "adafruit_keypad_helperoradafruit_keypad_states` or something like that
@tulip sleet I straight up included the Keystates class in the CPlayground library
But yeah.
are you using pressed() for button_a and button_b? That's why I included both.
Yes.
great, that was the idea
return self._states.pressed(1)```
I figured π
That's button B.
Which I added first, which is why I was so confused by it not working initially because the board was upside down. π
I'm worried about library size for this, hope it doesn't blow out the builds when frozen
that won't make it smaller though, the same code will need to be frozen.
Oh hmm right.
Because the helper would have to be added.
pbblltthhh.
Testing builds.
yah, the helper could be made less general, maybe, if it doesn't fit. Main thing is to run over the events. I do wonder if were_pressed() is used by anybody.
then you wouldn't need keypad or the helper at all
used in Pyloton, but nothing else, in Learn repo
Hmm.
I don't even know who added it, Radomir maybe. But the refactor makes the history lead to me.
I was right, apparently.
Testing the build with your PR.
@tulip sleet I picked German. It's fine. What other ones are close?
Japanese
@tulip sleet Also fine.
I'll PR it to the lib so we can get it released, and then get the frozen mod updated.
@tulip sleet Sphinx is failing with this TypeError: can't multiply sequence by non-int of type 'key_count' on this line: https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/2e300a8599376ddf6186cbbe0acd03ac69532e58/adafruit_circuitplayground/circuit_playground_base.py#L49
groan, I think it's because it doesn't know the type of scanner, but then it should just give up
I don't know why it thinks the type is key_count
I don't either.
Hello,
I am using a Raspberry Pi 4 with a DHT11 module and used the code given in the example "simple dht test" while changing it to the pin I am using. it says "Unable to set line 18 to input".
hi, could you re-ask in #help-with-circuitpython ? That channel has more helpers. This is more for CircuitPython development. THanks.
... I see you did. That is the best channel to ask in, but if you don't get a response, try https://forums.adafruit.com
@tulip sleet Ugh, I can't even do int() because it whinges about it can't be key_count.
i am cloning your repo to try some thigns
Ok.
! halbert@salmon:~/repos/kattni/Adafruit_CircuitPython_CircuitPlayground$ pre-commit run --all
black....................................................................Passed
reuse....................................................................Passed
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
pylint (library code)....................................................Passed
pylint (examples code)...................................................Passed
That doesn't build Sphinx.
oh, sphinx, ok, hold on
You have to do sphinx-build -E -W -b html ./docs/ _build/html from /
And then begin the good fight.
Sorry, just now seeing this. Happy to try to remember what I learned about this sensor. At one point last year I basically had the datasheet memorized π
Looking forward to seeing your library completed!
@idle owl I think this might be due to the error I fixed in the circuitpython PR you just approved. The error there was that both EventQueue and Keys were accidentally named Keys. So maybe it's confused due to that?? We can merge that and see what happens after its stubs are built. I don't even know where sphinx gets info about keypad
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Raspberry Pi Pico with rp2040
Code/REPL
import board
import pulseio
import time
#GP0..N chained together
numPulseIns = 6
print("start")
time.sleep(1)
print("creating PulseIns")
pulseIns = []
for i in range(numPulseIns):
pin = getattr(board, "GP%d" % (i+1))
print(pin)
pulseIn = pulseio.PulseIn(pin, maxlen=52)
pulseIns.append(pulseIn)
time.sleep(1)
print("hi...
but that build also failed due to the cache key. π¦ can you reapprove and it will rebuild and then I will merge.
My pixelbuf PR passed! π
i will merge it
I am looking at this as a replacement for adafruit_debouncer for use with an Adafruit Adafruit NeoKey 1x4 QT I2C Breakout. That library supports keys attached to pins but it also supports a boolean function. This is needed because the board is I2C instead of they keys being directly connected to pins, if I understand things correctly.
neokey1 = NeoKey1x4(board.I2C())...
There were issues with conflicting values in global variables when more than one PulseIn object was active at the same time. Those variables were moved to the pulseio pulsein object to keep them separate. This also corrects the problem noted in issue #4945 where the script would hang if more than 4 pulseins were active at once. The limit is now enforced at 8 (2 PIOs with 4 State Machines each). Note that if some other module is already using state machine(s) the limit will be less than 8.
This is not a library per se but is native C code. So the low-level background scanning would need to do I2C transactions to read the keys. We will consider adding more native C scanners. Feel free to open an enhancement request issue.
@tulip sleet Ok this was way more than time than I planned to put in today. I'll take it elsewhere later, but my point is, I'm done for today. Googling dealing with Sphinx warnings is failing to come up with anything useful. I don't know how to tell it to bugger off about that. Try rerunning it once things are merged, but I kind of doubt that will fix it. But I also have no idea where it's getting its information. I included keypad in the autodoc_mock_imports so it should be ignoring it. Anyway, have a nice weekend. I'll pick this up on Monday with you if it doesn't get sorted today.
you too, have a nice weekend!
@lone axle NeoPixel received the same treatment if you want to test it. And to test Trinket/QT Py, you'll need the Python version of adafruit_pixelbuf which I just added to the bundle today, so you'll need to get it from the repo directory until tomorrow.
I'm out!
Gonna try out neopixel next. See ya, have a nice weekend!
ok thanks
@slender iron The stubs uploader is failing after merging. This started today. Could you take a look at https://github.com/adafruit/circuitpython/runs/3089813225?check_suite_focus=true and similar? Thanks. The stubs build OK locally. I think this may be a credentials issue. I remember we had to change some token recently?
not at all!
I'm out of brain for today. file an issue?
Per https://github.com/adafruit/circuitpython/pull/4891#issuecomment-881718203, in reference to https://github.com/adafruit/circuitpython/pull/4891#issuecomment-881716673 about the NeoKey 1x4 QT I2C Breakout, and other hardware like the NeoKey Trinkey (cap touch, where touchio library is currently used), here's an enhancement request issue for the new keypad library to handle more hardware types by adding mo...
@dhalbert https://github.com/adafruit/circuitpython/pull/4891#issuecomment-881718203 Just today I came across a use case with the NeoKey Trinkey where it would be nice to have a single lib handle events & debounce, etc. for both the switch and the cap touch, so created the issue https://github.com/adafruit/circuitpython/issues/5014#issue-946683683. I hope the issue meets guidelines - I'm happy to rework it if not.
Remove if from a couple of conditional lines: there is no following then.
This should fix the stub upload failures when a PR is merged, which cause the whole composite job to fail.
I'm driving the SAMD21 DAC to generate a pulse going into an audio recorder AUX channel for video/multicam/audio syncing. Yes, this is Yet another linear time code (YaLTC for short). The pulse is triggered by a GPS PPS. For now I'm using an ISR within the Arduino IDE with trinket, QT-Py and Feather M0 proto boards for my prototypes (with your Quectel L80 breakout/wing boards). I know I could have used the PPS signal itself, fed into the audio recorder input but I want to keep the IC count ...
submitted a PR fix
Is there a better place than here for a general git question?
Well, #help-with-git, though it's lightly populated.
Ah, I didn't spot that one. I'm just a little confused with some of the concepts around branches and updates
I'll pop my question in there and come back here if I get crickets XD
If there a way to disable the "USE_FAT" param in the uf2_samdx1 so a board doesn't show up as a USB Mass Storage device?
i tried defining it a 0 but that didn't work
I think it is CIRCUITPY_USB_MSC you want
Iβll give that a try
well it built so i'm guessing it will work. Thanks for the help π
@onyx hinge Thanks for the jpeg capture demo it is working well. Have you noticed that the stored images appear to be very dark compared to what is on the scrren when they are captured?
@solar whale I agree, and I'm looking for a solution. In general terms, I think that switching between the RGB and JPEG modes is resetting a bunch of stuff including automatic gain / exposure compensation; and I think the solution is to figure out how to freeze those settings when switching, instead...
OK -- thanks for confirming. I just wanted to make sure it was not something on my end. I'll look at it as well.
@ornate breach the "new way" is via boot.py -- https://circuitpython.readthedocs.io/en/latest/shared-bindings/storage/index.html#storage.disable_usb_drive
I was trying to disable it in the base bootloader
this board uses the SAMD21G17A which can't run circuitpython due to RAM and storage restraints
oh! my mistake
but that is good to know in the future though π
By the way, this interrupt disabling in the time functions may still be affecting other modules, like pulseio, pwmio, or audioio, so maybe it would be good to revisit it when there is some time.
Could you elaborate on this? I am thinking there might be issues about this elsewhere as well. What did you fix in your own code? Thanks.
I basically count the frames in _pew and use that for timekeeping in the pew library, so that I don't have to use time.monotonic() or time.sleep(), which both have code that disables the interrupts for a time to read a multi-byte register atomically.
Are you saying the interrupt disabling in time.sleep() etc. loses ticks, or just delays them?
What's the difference between a lost timer tick and a delayed one?
If the tick incrementer loses ticks, then the time "clocks" will run slow. If the time incrementer ticks are delayed, then there will be jitter in the time reporting, but we won't lose time in the long run. But I think I may be missing your point.
Oh, so you would get clumps of ticks, but on average the number of ticks would be correct? Considering that the brightness of the LEDs is affected (see the horizontal lines on the last video), I would say they are getting lost, but I can't be certain if the background flicker that is also present is not due to them also being delayed/clumped.
I made some signal captures on the original issue #3504 β maybe that will be helpful.
Note that the UF2 run-mode on esp32s2 is not working at the current stage... there is already an issue describing this #3813.
Hi @kevinjwalters From my reading of your linked comments above, what I'd getting is the data limitations of the I2C implementation were due to the ESP's memory constraints, rather than from the SPS. If that's true, are you able to query the full data from the SPS over I2C? If so, than I have no real need for an UART implementation, and I can use your I2C directly.
Thanks much for your efforts!
Hi! Why do MagTag & FunHouse (ESP32-S2) CP builds have audiobusio, audiocore and audiomixer when neither have the pins to allow an I2S board? (I realize that DAC & I2S are currently waiting on IDF updates but was surprised to see the other needed libraries there)
todbot: I think i2s works on esp32-s2 in circuitpython (though the necessary pins may not be exposed on either of those boards you mentioned)
wait, how was that even accepted by the shell as valid? both dash and bash error on it here.
OK, did we just overlook that it wasn't passing CI?
I have tested the same code on CP 6.x and it works fine.
Re-tested on a QT Py RP2040, and pruned the program a bit. I've revised the original post above.
The errors vary, so this appears to be memory corruption, and I think it's due to the OnDiskBitmap.
OK, did we just overlook that it wasn't passing CI?
Yep. It was only on merge commits, so it was reported to the merger, but not anywhere else.
Merging... the ci failure is due to esp-idf cache key which has already been fixed in main.
@DavePutz Thanks for reporting and fixing this, changes look good... just some nitpicks.
It seems likely to be related to the palette changes I introduced in 7. Assign it to me if you like.
It seems likely to be related to the palette changes I introduced in 7. Assign it to me if you like.
You are more the expert on this, sure, thanks. I am still doing the DMA debugging.
Yes, it all comes back and looks plausible over i2c. Here's a run I did last week, I think it's documented as taking a while for numbers to stabilise on first start.
>>> import sps30_simpletest
Found SPS30 sensor, reading data...
Concentration Units (standard)
---------------------------------------
PM 1.0: 3 PM2.5: 11 PM10: 21
Concentration Units (number count)
---------------------------------------
Particles 0.3-0.5um / cm3: 0
Particles 0.3-1.0um / cm3: 14
Pa...
There is a fix for reset to uf2 for tinyuf2 due to changes to latest IDF https://github.com/adafruit/tinyuf2/pull/130 . Using the latest 0.5.0 should probably work fine.
Made the suggested changes; except *buffer type was not made volatile. This was to avoid a type conflict with passing it to m_free() in the dinit routine. In any case, since it does not change during the life of the pulsein object it does not need to be marked volatile.
Hi! I'm a hobbyist who enjoys making stuff. I have an EE degree, but have never really programmed consistently to make progress past the basics (i.e. I have to look things up from scratch every time). That said, I have some basic understanding of what I'm trying to accomplish, but often struggle to find an efficient way to accomplish it.
I usually find myself thinking in state machines. It helps me logically decide what to do and to stay organized. I think a good interrupt use case is...
Is it looking like ESP32-C3 boards without UMS are going to be permissable ports?
Using the old API, some output is produced in the time between creating the PWM object and creating the PulseOut object. Will the new system prevent that?
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4-115-g3c25d8e2a on 2021-07-18; Raspberry Pi Pico with rp2040
Code/REPL
import board
import pulseio
import pwmio
import time
while(True):
pwm = pwmio.PWMOut(board.GP0, frequency=38000, duty_cycle=2**15)
pulseOut = pulseio.PulseOut(pwm)
time.sleep(5)
pulseOut.deinit()
pwm.deinit()
time.sleep(1)
Behavior
Sometimes the line is high after creating the PulseOut object. I guess ...
I'll grab this one since I'm already working in OnDiskBitmap today.
- Fix out of memory write in constructor
- Allow constructing from filename, rather than from open file object, to improve usability
Closes: #5008, #4197
@ITACAInnovation please review this for your board. I wasn't sure why you had some pins set to not reset.
Hi @tannewt
thanks for the help, the pins should never reset because they control some hardware which should keep pre-defined values in order not to cause specific situations issues. I will check the compiled source on a board and be back to you with eventual changes to the source.
?serverinfo
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.3-437-g394087869 on 2021-07-19; Adafruit CLUE nRF52840 Express with nRF52840
Code/REPL
print("hello")
Behavior
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
hello
[tio 10:31:37] Disconnected
[tio 10:31:41] Connected
Auto-reload is off.
Running in safe mode! Not running saved code.
You are in safe mode because:
CircuitPyt...
Re-tested this on 7.0.0-alpha.4 and got a different stack:
#0 reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM) at ../../supervisor/shared/safe_mode.c:123
#1 0x000287ce in gc_alloc (n_bytes=n_bytes@entry=16, alloc_flags=alloc_flags@entry=0, long_lived=<optimized out>)
at ../../py/gc.c:508
#2 0x00027dc8 in m_malloc_maybe (num_bytes=num_bytes@entry=16, long_lived=long_lived@entry=false)
at ../../py/malloc.c:103
#3 0x00037636 in mp_obj_new_exception_msg_vlis...
What's the impact of this on builds without long ints?
The time, etc. operations that depend on longints are still turned off at compile-time by a longint check, not by checking which epoch is in use. So I think this should be fine. Before the merge from upstream, we were using 1970 as the epoch.
Re-tested this on 7.0.0-alpha.4 and got a different stack:
This new traceback may be #5018
@DavePutz noticed:
Re-tested this on 7.0.0-alpha.4 and got a different stack:
#0 reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM) at ../../supervisor/shared/safe_mode.c:123 #1 0x000287ce in gc_alloc (n_bytes=n_bytes@entry=16, alloc_flags=alloc_flags@entry=0, long_lived=<optimized out>) at ../../py/gc.c:508 #2 0x00027dc8 in m_malloc_maybe (num_bytes=num_bytes@entry=16, long_lived=long_lived@entry=false) at ../../py/malloc.c:103 #3 0x0...
<@&356864093652516868> Our weekly voice meeting is later today, in about 95 minutes from now. If you have notes for us or plan to speak, please update https://docs.google.com/document/d/1fV_bv403ON4s5V7kyC9SQQU09w5qNU4zhW7QKJ92fHw/edit?usp=sharing -- if you plan to listen in, no need to do anything. Listeners should also feel free to come and go during the meeting, if you can't stay for the whole time. Scott is hosting today, I believe.
CircuitPython Weekly for July 19, 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you canβt make the meeting and would still like to participate, ad...
@tulip sleet This is still failing. I reran it over the weekend. I am not sure what to do with it. I'll do some more digging today, but google was not helping. https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/106
Yes, as ble-only. No immediate plans for us adafruit folks to work on it though
I haven't had time to try this again. I hoped the stub uploading would fix it, but I guess not. I can look at it later. In the meantime, you could disable the pylint warning, since it's specious.
@tulip sleet It's Sphinx, not Pylint. I'll check into it a bit, but won't spend too long on it.
oh yeah, I forgot that again. if there is some way to ignore the warning...
That's what I'm going to try to figure out.
Happily lurking, while debating what's good for lunch....
Sorry skipping the meeting again, nothing from me in the doc. Nothing is more or less what I have done in CP this week. π¦
Hope you are safe from flooding.
@thorny jay "Nothing" is perfectly fine too. No reason to be sad -- take care of yourself, take care of each other.
Thanks. No worries, I am far from water and "high". So the news of Belgium (and Germany and other) being flooded reached the US...
Just lurking today
Hey, folks. We're finishing up an internal meeting. We'll be here soon.
Oh yes -- We've seen a lot of depressing pictures! Hard to imagine what people in the impacted regions are dealing with.
Lurking today
Just listening today.
Issue #5016. Implemented method suggested by the Pico SDK development team to make sure a pin is left low after finishing a Pulseout using PWM.
Could you URL-point to their suggestion here? Thanks.
The suggestion was made in an email to me when they closed my SDK pull request. They said they will put a comment in the pwm.h header file documenting that the pin will be left in whatever state it is in when the pwm is disabled, but I don't know if that is done yet or not.
We're finishing up our internal meeting, be with you soon <@&356864093652516868> !
If the teacher does not show up by 10 after -- class dismissed...
It's your tuition π
(whatever you do, don't -- or do -- calculate how much each class "costs". It's....terrifying.)
Lurking
lurking
@solar whale any interest in adapting the jpeg camera example to rp2040 and seeing if it works?
@onyx hinge Be happy to give it a try -- probably not until tomorrow or Wednesday though.
@solar whale I'll let you know if I beat you to it
I just "tore down"my RP2040 setup -- lots of wires to reconnect π¦
It is.
indeed
Last week, we added two boards to Adafruit.io WipperSnapper β our no-code IoT project interface for adafruit.io. WipperSnapper now supports the Adafruit MagTag 2.9β³ and the Metro ESP32-β¦
This morning while at work, I received an email from Github, letting me...
Join Scott and guest @jim_mussared (@jimmo on GitHub) as they talk about MicroPython and debugging the native emitter.
Scott is sponsored by Adafruit to work on CircuitPython. Support them, and by extension Scott, by purchasing hardware from https://adafruit.com
Jim is sponsored by George Robotics to work on MicroPython. Sponsor them on GitHub...
When you think about embedded programming, does it bring low-level languages and tools to mind? Maybe Embedded C or even Assembly language? Thanks to the groundbreaking work by Damien George back in 2014 to create MicroPython, Python is one of the very solid choices for building tiny programmable devices.
Got it. Here's a link to the closed SDK issue, specifically the code suggestion: https://github.com/raspberrypi/pico-sdk/issues/488#issuecomment-882478098
Thanks @turbid radish !
And @lone axle for posting the links here π
[I sincerely thought that was outside my window....]
My dog just went running to the window
haha, no worries. stay cool. π§
No problem -- She thought it was the chewey.com order
@lone axle you had success printing the keycaps? I was intensely worried it wouldn't work for anyone but me
Thank you Hierophect for all your work and dedication!
π Thank you!
have not printed any yet, I'll you know when I do though. I intend to try out some different techniques for making contrasting colors for the number cutouts
@lone axle keep me up to date with the results
Keycaps? Am interest
@onyx hinge "Also known as the Clackulator, if you pick Blue keyswitches" π
That has nothing compared to an IBM Model M buckling spring keyboard. β¨οΈ
clack-CLING.
-draws the ire of everyone within earshot-
I think my Model M is why the people at my old job thought I was so competent. I wasn't, I was just assertively loud.
Mah baby
"jeff, we like the cut of your jib! You're being promoted!"
I'm using a far quieter keyboard with Blue and White switches as my primary, but the Model M is my favorite
Can't be THAT noisy typing while on the phone for work, lol
@hathach Thanks for dropping by and notifying about that change.
I tested with TinyUF2 0.5.0 on my microS2 and it works like a charm!
Thanks all. Hope everyone has a good week! π
Thanks all for supporting CircuitPython
thanks!
Thanks
Thanks 
Thanks all!
Thanks all!
I barely heard about it either (just a random item I saw on reddit late last night)
I just tested this with TinyUF2 0.5.0 and this seems to be fixed.
He was probably trying to be funny and troll the angry trolls ... that's how I saw it
People on Twitter like to jump on any angry bandwagon
There are huge farms dedicated specifically to farming bitcoin
that are basically just wasting energy
https://en.wikipedia.org/wiki/Bitcoin#Energy_consumption_and_carbon_footprint probably covers the basics of the energy footprint argument for these distributed ledger systems, but I can't verify how accurate/bent it is.
Bitcoin (βΏ) is a decentralized digital currency, without a central bank or single administrator, that can be sent from user to user on the peer-to-peer bitcoin network without the need for intermediaries. Transactions are verified by network nodes through cryptography and recorded in a public distributed ledger called a blockchain. The cryptocur...
There's solid merit to both sides, which makes it trickier
I'm signing off for now. π
I appreciate you taking the time now for this, thank you.
Good explanation of it all thanks
Thanks for all of this and for the explanation
[I really do need to read up more on blockchain & NFTs -- coming from just a basic understanding of bitcoin, NFTs are new for me -- and I didn't immediately grasp the strong negative response from folks.]
@tulip sleet I just tested a bunch of esp32s2 uf2 reset issue and they all seem to be fixed with TinyUF2 0.5.0.
The initial negative responses I saw on Twitter seemed to be more about "oh no, Adafruit is doing a promotional post about NFTs, they sold out" , rather than the NFTs themselves and the issues around them
Which is why they were taken as just some random trolls who like to get angry about random buzz words (my opinion)
I just tested this with TinyUF2 0.5.0 and this seems to be fixed.
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4-109-g29aab69fb on 2021-07-17; microS2 with ESP32S2
Code/REPL
# Following is a forced way to enter safe mode.
# This also happens when safe mode is triggered automatically
# (i.e. due to crash, unhandeled exception etc.).
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.SAFE_MODE)
microcontroller.reset()
Behavior
- The onboard led goes
quick blue pulse-...
Hi, @solar whale I wanted to check if your MagTag was now running fine the COVID percentage app: https://github.com/adafruit/Adafruit_CircuitPython_MagTag/issues/62#issue-909578497 because in my case, despite updating the magtag library it fail. Then updating the firmware to adafruit-circuitpython-adafruit_magtag_2.9_grayscale-en_US-20210718-3c25d8e.uf2 it keep failing. It reboot without error message in magtag.network.connect()
@thorny jay I do not have it running now. I will give it a try later today (or maybe tomorrow)
Thanks, no emergency. Maybe check the issue, I will update there, even if I guess this should be a new issue.
Having had an account that was hacked and used for crypto spam, I can see why the post caused a kerfuffle
Some of the anger was due to perceived mocking some of the replies with the AI generated images PT was posting
The whole situation is a bit complicated and I hope it comes to a neutral conclusion
I don't think it's fair to rag on anti-NFT people the way you might for more obvious social causes
Yeah, not fair to rag on anyone. PT said he'll be issuing an apology this week. I couldn't understand what exactly was considered mocking, but that doesn't make their feelings less valid
Since Adafruit was joking about NFTs with the "not forever trinkeys" a little while ago, I think this was probably just a huge misunderstanding handled badly... so I hope too that it comes to a good conclusion soon.
What release will the fix be in?
@tulip sleet Disconnected you from audio.
OK, now I understand better about the effect on non-express boards and agree that we can make this change across the (er) board.
Tested with program in original issue, and also smoke-tested passing in a filename.
Thanks!
Thank you for testing this. That's a relief.
sweet!! Thanks guys for all your efforts!!
@idle owl the combo .bin files here: https://learn.adafruit.com/adafruit-metro-esp32-s2/install-uf2-bootloader#step-2-download-the-tinyuf2-combo-dot-bin-file-here-3077972-6 and maybe elsewhere now need to be updated: there is a new version of the tinyuf2 UF2 bootloader that fixes a bunch of related issues. Do you remember where these came from? Are they the combined.bin files in the zip release files at https://github.com/adafruit/tinyuf2/releases/latest ?
Maybe we should rewrite the page to point to there and have unzip instructions, so we don't need to keep updating.
I have no idea, tbh. I was given the files, or it might not have even been me that added them. They exist for MagTag and I want to say FunHouse as well?
yes probably, that's a mirrored or template page, I guess
yah mirror
I will do a bit of a rewrite. Do you have any example of "download this and unzip and get this file?" There is not a link to "fresh bootloader" in circuitpython.org for the ESP32-S2 boards. Maybe I should add that...
Not sure I follow what example you're looking for.
"Please download this .zip file and then extract combined.bin" from it, is what I want to say. Not sure I need to elaborate further or not.
Also, I just figured out where it's getting information about scanner. This doesn't clear up much for me in terms of fixing it, but it's getting it from the base class __init__: File "/Users/kattni/repos/Adafruit_CircuitPython_CircuitPlayground/adafruit_circuitplayground/circuit_playground_base.py", line 109, in __init__ self._states = KeyStates(self._keys) is the line in the traceback immediately before what Sphinx fails on.
Nah, I wouldn't elaborate beyond that. I think that's fine.
There are ways to suppress warnings, but I can't figure out how to configure it. So I'm fighting with that right now.
if there were any type annotations there, I would think that was causing the problem. It may be doing type inference to figure out the type of the argument. :/
Hmm. Bleh.
I will take a look more in a bit after I rework that page and then close a bunch of issues related to TinyUF2.
No worries. It's on my list too.
To me that traceback has the smell of when sphinx is using a "mock" for something, and the result doesn't work out. In particular, the thing that should be an int must be coming from a mocked module instead.
I don't know how that helps deal with this specific case though
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Adafruit MagTag with ESP32S2
Code/REPL
Demo code can be fetched from here:
https://learn.adafruit.com/adafruit-magtag-covid-vaccination-percent-tracker/code-the-vaccination-tracker
Behavior
MagTag Vaccination tracker crash in magtag.network.connect() between 7alpha3 and 7alpha4
I tested MagTag Covid percentage tracker with 7.0.0-alpha.3 and 7.0.0-alpha.4.
Somewhere...
If I mock the entire module, it fails in a new and definitely-mock related way. So I don't know that that clears much up.
Wait I just got it to pass.
It also doesn't document the majority of the library if I mock it. sigh.
Thanks @microDev1 and @hathach!
Thank for taking a look at this! Just a couple things.
@idle owl I'll have a patch to offer you in a bit, I think
autodoc: failed to import module 'bluefruit' from module 'adafruit_circuitplayground'; the following exception was raised:
Traceback (most recent call last):
File "/Users/kattni/.virtualenvs/pylint/lib/python3.6/site-packages/sphinx/ext/autodoc/importer.py", line 70, in import_module
return importlib.import_module(modname)
File "/Users/kattni/.pyenv/versions/3.6.8/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/kattni/repos/Adafruit_CircuitPython_CircuitPlayground/adafruit_circuitplayground/bluefruit.py", line 173, in <module>
cpb = Bluefruit() # pylint: disable=invalid-name
File "/Users/kattni/repos/Adafruit_CircuitPython_CircuitPlayground/adafruit_circuitplayground/bluefruit.py", line 49, in __init__
super().__init__()
File "/Users/kattni/repos/Adafruit_CircuitPython_CircuitPlayground/adafruit_circuitplayground/circuit_playground_base.py", line 107, in __init__
self._states = KeyStates(self._keys)
File "/Users/kattni/repos/Adafruit_CircuitPython_CircuitPlayground/adafruit_circuitplayground/circuit_playground_base.py", line 50, in __init__
self._pressed = [False] * self._scanner.key_count
TypeError: can't multiply sequence by non-int of type 'key_count'```
Is the entire thing for context.
I can't figure out how to use nitpick_ignore properly apparently, or it doesn't apply here, and suppress_warnings I think doesn't apply either. We have to do something with the code, I guess?
Fair enough.
This should be fixed now, with the latest merge, and also with the latest TinyUF2. Update your TinyUF2 bootloader to at least 0.5.0, following the instructions here: https://learn.adafruit.com/adafruit-magtag/install-uf2-bootloader
@idle owl do you want me to push it direct to the pull request branch if I can, or do you want me to share it here so we can talk about it and you can apply it?
Either works for me. Try pushing first I suppose.
This should be fixed now with the latest TinyUF2. Update your TinyUF2 bootloader to at least 0.5.0, following the instructions here: https://learn.adafruit.com/adafruit-magtag/install-uf2-bootloader. Thanks @microDev1 for testing and @hathach for the TinyUF2 fix.
This should be fixed now with the latest TinyUF2. Update your TinyUF2 bootloader to at least 0.5.0, following the instructions here: https://learn.adafruit.com/adafruit-magtag/install-uf2-bootloader. Thanks @microDev1 for testing and @hathach for the TinyUF2 fix.
Pushing will force me to do the git needed over here to update my local copy.
The idea is, instead of relying on the way that sphinx tries to automatically create a version of some module that is not available ("mock" it, as in a "mock-up"), we just provide our own mock. Unlike theirs, key_count turns out to be a number.
Hey it builds.
the main downside of this is .. I don't think we have done it this way before, so it risks being an oddball that nobody else will understand
or if we've done it similarly I haven't found where we did, and so I did it a slightly different way
I don't think we ever have.
the problem may come up with your next gamepad conversion and if so you have a potential solution in hand
Indeed. Thanks!
I'm headed out for the day, cheers
Cheers!
Tomorrow!
Could you test this with a build that includes #5017? That fixed a bug in OnDiskBitmap, which is used to provide the background image for this project. The bug was a memory smash which causes unpredictable symptoms.
@tulip sleet The CircuitPlayground library is updated and released, and therefore ready to be updated in the next CP build.
Er, CP release.
I can update all the frozen libs; anything else pending of interest there?
Not that I'm aware of. The HID thing is done, right? And the gamepad.py file is an example, so the rename of it to avoid conflicts doesn't apply to the lib?
Hopefully the test builds I did with the KeyStates code in the CP library were accurate. There seemed to be plenty of space left, but... yeah.
Exactly
@idle owl I forgot I had automated updating the frozen libs:
$ cd circuitpython
$ git checkout -b new-branch-to-update-frozen-libs
$ make update-frozen-libraries # does all the work!
$ git commit -a -m "update frozen libraries"
$ git push ...
i keep rediscovering this each time
Update frozen libraries. Especially important to update the CircuitPlayground library, due to keypad/gamepad/pixelbuf changes.
Hah! Nice!
I tested with adafruit-circuitpython-adafruit_magtag_2.9_grayscale-en_US-20210719-1b17b08.uf2 an artefact of #5017 and it reset loop in the same call as alpha-4.
Please notice that it crash very early in the program... before doing the background part.
Actually there might be no need to reduce the code to a minimum since I know where it crash:
from adafruit_magtag.magtag import MagTag
from adafruit_progressbar.progressbar import ProgressBar
# Set up where we'll be fetching dat...
No problems, I am glad that helps
Maybe I shoud rename the title to:
"from adafruit_progressbar import ProgressBar" make "magtag.network.connect()" crash.
Now I have a very small piece of code and adding one like make it crash...
from adafruit_magtag.magtag import MagTag
# If I put the following line, it make "magtag.network.connect()" crash.
#from adafruit_progressbar import ProgressBar
DATA_SOURCE = "https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/vaccinations/country_data/Unit...
I see no glitches with this change, so let's merge it for now, and we'll keep some kind of issue open about doing more research about the fundamental problem.
If you have the time and the willingness, try diving down in to the library to narrow the problem further, emulating what the library is doing, and not using the library itself. A lot is going on in the constructor MagTag() and the connect().
The immediate problem has been fixed by #4793, but the reason for this issue stll remains undiagnosed. So we'll leave this issue open.
I'm running into this issue as well.
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/1IO_iC2RE9w83MMxA-Gy5T3VeeAy3HbuCkSOehqth15I/edit?usp=sharing
CircuitPython Weekly for July 26th, 2021 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...
OK, but as policy there:s nothing preventing a submission of a third party board just because it lacks UMS though?
USB? A board would need to support the BLE workflow.
Yeah, assuming that. I was just noticing that most/all of the early boards coming out of china didn't implement the native USB.
The C3 doesn't have built in USB so BLE will be the only option for it
It has a built-in usb to serial converter, not a generic USB peripheral.
Every board I've seen thus far uses an external UART, not even the built-in. Probably recycled old designs.
ah interesting! maybe early issues of the chip had issues with the built in one
My understanding is that the main module-maker is trying to maintain some level of pin-compatibility at the module level, so maybe it was just chosen not to break them out. That would make some amount of sense.
hello! Someone on the mpy forums is asking about the {i2c,spi}.{try_lock,unlock} methods and whether we have plans to add them to upstream. I have some guesses, but I'm curious as to what the contention scenario they're protecting against is -- https://forum.micropython.org/viewtopic.php?f=2&t=10862
@vale spire its a bit of a nice to have for a parallel future. it does also allow us to use the busses "internally" which we do for displays
thanks @slender iron ok awesome 2/2 on my guesses then π
yup π
its usually managed by our bus device library
which uses context managers to try_lock and unlock
it should be fine to omit the locking stuff from a ported driver too
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Adafruit Feather nRF52840 Express with nRF52840
Code/REPL
import sys
sys.print_exception
Behavior
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'print_exception'
Description
We were using the sys.print_exception function to add tracebacks to our log entries, similar to what CPython allows. Unfortunatel...
I'm driving the SAMD21 DAC to generate a pulse going into an audio recorder AUX channel for video/multicam/audio syncing. Yes, this is Yet another linear time code (YaLTC for short). The pulse is triggered by a GPS PPS. For now I'm using an ISR within the Arduino IDE with trinket, QT-Py and Feather M0 proto boards for my prototypes (with your Quectel L80 breakout/wing boards). I know I could have used the PPS signal itself, fed into the audio recorder input but I want to keep the IC count...
great, ok, thanks @slender iron !
@anecdata Thanks, and apologies for the duplicate. I am curious how merging in a MicroPython update removed so many things from the sys module, despite them still being present in the usys MicroPython module?
What release will the fix be in?
It'll be in the next 7.0.0 alpha. Before that you can follow the Absolute Latest link from circuitpython.org/downloads and snag the latest build. (It takes an hour or two after merge but is then available.)
I think this is two separate issues. The first is due to us trying deinit objects that we never initialized. The pin_number is invalid because it was never set.
I've been hunting the second one as well and will reply on #5018.
This is the bug I got frustrated chasing. The err_code 7 is invalid parameter from the softdevice but when I break on the add_characteristic call the parameters look ok. I thought this might have been an initialization issue of what we're passing in but I'm not certain it is.
I've seen it happen sporadically on start up as well.
@anecdata Thanks, and apologies for the duplicate. I am curious how merging in a MicroPython update removed so many things from the
sysmodule, despite them still being present in theusysMicroPython module?
I removed print_exception during the merge because it was not CPython compatible. We hadn't validated sys previously. What else did I remove?
This includes any boards that have _bleio implemented via HCI.
Fixes #4969
10 ns is the PPS GPS spec, the actual sync precision (in postprocessing the wav file on the desktop) is more or less an audio sample, eg 20 ΞΌs for 48kHz sampling (as illustrated in this project log. My python code would do Direct Digital Synthesis of a 2FSK word encoding 24 bits of UTC time.
π
@tannewt I think I was reading things wrong in terms of how much was removed from the sys module. As a minimum, print_exception and atexit seem to no longer be there, but are still present in MicroPython. Additionally (and I'm not overly clear on this one), exc_info is used by some MicroPython modules, but not documented under usys. So I'm not sure if it actually exists or not.
I removed print_exception during the merge because it was not CPython compatible.
I assume `ate...
Can anyone find out what the lcd or I assume oled the https://www.ableton.com/en/push/ midi controller by ableton is using? I want to us it is a project.
@tannewt it's not fixed (I don't think the new code gets called by the constructor).
I wanted to save time and money on not getting junk by using their stuff which is proven, Yeah I think its 290 by 160. I dont know any good suppliers to see if they have a any.
good-display.com is reputable
@DavePutz Should the constructor call send() with no pulses to get things in the right state?
Is anyone interested in trying an N-Key Rollover demo with MacroPad? I don't have a MacroPad π and while the code works on linux and a feather m4 (with a different Keys constructor) it would be nice if it was tested on a macropad and on a Windows or Mac PC... https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/1620 https://learn.adafruit.com/customizing-usb-devices-in-circuitpython/n-key-rollover-nkro-hid-device?preview_token=914QX6KznVpzWkMDw8Y8rg
Are these messages (seen in the learn system when running pylint) important? internal error with sending report for module ['Piano_In_The_Key_Of_Lime/NeoPixelAll.py'] module 'isort' has no attribute 'SortImports'
I have this installed on a macro pad and connected to a Mac -- any special tests to conduct?
1222333weqewqewqesdadsadsazcxzcxzcxzsadasewqe212ewdsad
Glad to help -- working on cables to test JPEG on RP2040 -- may take some time..
Especially with my assistant!
I removed print_exception during the merge because it was not CPython compatible.
I assume
atexitwas removed for the same reason, because in CPython the same functionality is fulfilled by the dedicatedatexitmodule? I understand the desire for compatibility, but it seems problematic to remove working functionality with no replacement.
Correct. It should be relatively easy to move to a dedicated and compatible atexit native module. I don't think it's problematic because a...
@tulip sleet do we need our own branch of pico-sdk still?
good point, maybe not now, though it may return in the future. the only issue I would see is if any skew re tinyusb is an issue
I am getting CPy to compile with 1.2.0 right now: several new or renamed #if flags, etc.
hence my q re tinyusb
that's good. If I can get it to compile with straight raspberry_pi/pico-sdk, then that is best. I'll do a diff to check whether there are any significant remaining differences
if you could still check the board defs for any errors that would mess us up that would be great
i am not sure about flash size and timing divisors, etc
you can review and I will merge if ok but then not use
... I see you answered my questions in your comment
we don't use the sdk board defines either
sorry in advance for having to update the files and flags since we're not using cmake
It's nice to have an assistant to keep you warm and make sure you're doing it right! And taking enough assistant-petting breaks....
@solar whale nice assistant. pretty sure they regularly attend the CP weekly meeting. so you should be in good hands...or.. 
@onyx hinge got ,y pico /ov2640 /st7789 wired up and I'm running the ov2640_displayio_pico_st789_2in.py -- it works, but my image is only showing as 160x120 -- did you get that on the pico?
it is set for 320x2440, but it gets scaled down ...
BTW -- the example is set to use the test pattern
I recall a similar issue with ov7670 and I don't recall how I got around it.. I'll keep trying...
FYI -- the ov7670 works OK ..
I think the issue here is that anytime a PWMOut is created with a duty
cycle it starts outputting immediately. I don't think
that can be changed - there are library examples that depend on that
behavior. So, the best we can do is turn off the
PWM when a PulseOut is constructed, meaning there will likely be some
(unwanted) output on the pin. I'll make
that change and submit a new PR.
On Tue, Jul 20, 2021 at 10:21 AM Dan Halbert @.***>
wrote:
@DavePutz https://github.com/DavePutz Sh...
I have a style question - is there a reason why few of the functions in the supervisor/shared/memory.c module use a supervisor_ prefix? I feel like it would make them much less ambiguous when used in main.c
right now we have calls to free_memory and allocate_memory, which to the inexperienced might even look like standard library calls. Wouldn't supervisor_free_memory be better?
@tulip sleet you probably used this for the USB descriptor stuff so maybe you have comment
Even the parameter to these functions is supervisor_allocation *
I agree with you. They could be supervisor_allocation_whatever or just supervisor_whatever. Feel free to clean up. They are not used that many places so longer is fine. As Scott says, that's what editors are for.
I think just supervisor_ should be fine, to match the struct. Functions would be:
- supervisor_free_memory
- supervisor_allocation_from_ptr
- supervisor_allocate_remaining_memory
- supervisor_find_hole
- supervisor_allocate_memory_node
- supervisor_allocate_memory
- supervisor_get_allocation_length
supervisor_move_memory has the prefix already, for some reason
@tulip sleet I wired this thing up. And it worked on the first try but the key events being returned were the wrong keys. Realised I had column and row pins swapped. Fixed that, and now no events are being returned. You did not include a wiring diagram in your guide to show how the pins should be laid out in the row_pins and column_pins arguments to match the matrix. I assume that's where the issue is as it "worked" initially.
the diodes on this board are "backwards" from usual. Try setting columns_to_anodes=False in the KeyMatrix() constructor.
Ooh getting events. Getting multiple keys per single key press though.
sigh.
Only on the first column.
Pressing and releasing 0 gives me <Event: key_number 0 pressed> <Event: key_number 6 pressed> <Event: key_number 0 released> <Event: key_number 6 released>
When I wrote the guide I think the NeoKey was not in the store yet. I can add more info. I deliberately did not label the schematic because it was only a discussion item.
6 gives 6 and 12, 12 gives 12 and 18, 18 gives 18 and 24, and 24 gives only 24.
I can try wiring up mine and see what happens. I am about to be afk for a bit.
maybe doublecheck the list of pins in the rows and columns args. Maybe a one row is a column or vice versa
Ok.
It's not.
They're on opposite sides of the Feather, so it's difficult to mix them up.
Tried wiring the row to a different pin, but same results.
@tulip sleet I feel like I asked you this before but the #ifdef EXTERNAL_FLASH_DEVICES and #if CIRCUITPY_USB_MIDI supervisor allocations were removed for a reason, right?
They're in the old PR of my rebase and I wanted to make a note of why they aren't in the current main
@tulip sleet Probably worth mentioning, if I remove the first pin from column_pins and row_pins, then press a key in the second row and column (now the first), it does the same thing. Which means it's not my wiring I guess?
can you show a picture?
i am going to eat and then will wire the board up
Follow up fix for issue #5016.
Difficult to get a picture of.
Here's my code: ```py
import board
import neopixel
import keypad
pixels = neopixel.NeoPixel(board.D4, 30, brightness=0.3)
key_matrix = keypad.KeyMatrix(
row_pins=(board.D12, board.D11, board.D10, board.D9, board.D6),
column_pins=(board.A0, board.A1, board.A2, board.A3, board.D24, board.D25),
columns_to_anodes=False,
)
while True:
key_event = key_matrix.events.get()
if key_event:
print(key_event)
Also, right after a soft reload, it returns this with press and release of 0: code.py output: <Event: key_number 0 pressed> <Event: key_number 6 pressed> <Event: key_number 6 released> <Event: key_number 6 pressed> <Event: key_number 0 released> <Event: key_number 6 released>
Then it returns this on subsequent presses: <Event: key_number 0 pressed> <Event: key_number 6 pressed> <Event: key_number 0 released> <Event: key_number 6 released>
i just finished wiring up one too. will try
Fingers crossed it fails for you as well because otherwise I'm super confused.
Always on the first key press of the reload doesn't apparently matter what key I press: <Event: key_number 6 pressed> <Event: key_number 12 pressed> <Event: key_number 12 released> <Event: key_number 12 pressed> <Event: key_number 6 released> <Event: key_number 12 released>
afk.
i am seeing similar weirdness, once I fixed my wiring errors
The matrix class worked fine for me on the clackulator, which is a 4x5 matrix. I have a sheet of snap-apart but haven't wired it yet.
is yours columns_to_anodes=True? I may have some logic wrong
it's whatever the default was, I think
worked fine for me on a non-diode matrix as well. Yes, the default is True
row_pins=(board.A2, board.A1, board.A3, board.A0, board.D0),
column_pins=(board.D25, board.D11, board.D12, board.D24))
``` is my constructor
oh is the ghostly key always the one "below" in the scan order?
that's gotta be a clue
yes, so my loop may be wrong, though I think Limor tested it
The Kaluga devkit has a set of 6 buttons that act as a kind of analog keypad (each one causes a characteristic voltage to be seen on an analog input, due to some resistors). Is it unreasonable to think that there could be an analogkeys class to work with this?
adafruit doesn't seem to design or stock boards with these kinds of keypads so it's probably not a priority
After the script stops with the exception thrown the final gc_sweep
will call any finalizers and they usually call deinit. deinit on
invalid objects can wreak havoc by changing random memory or
(hopefully) crashing. This fixes ensures the object is deinited
until initialization succeeds and the object is valid.
Do the same fix for I2C and SPI too.
Fixes #4700 and fixes #5005
That will ensure it is always the latest instead of a .x or feature
branch.
Fixes #4632
Not tested but is copy and paste of existing stubs logic. Will check after merge.
The changes all match what is in deinit and the power of two check looks correct to me.
Didn't approve this yet as I'm still not 100% sure with the translations including other changes - which I think you said is removed on the merge. But didn't want to blindly approve them.
translation changes are fine, I didn't look in detail at the rest.
This ends up being complicated, because of the way that ulab and circuitpython are interdependent -- to move ulab.ndarray to ulab.numpy.ndarray in the documentation requires a tandem change in both projects, or there are build errors. This is one of the reasons that ulab's PR https://github.com/v923z/micropython-ulab/pull/423 encountered build errors.
I believe that if this PR comes up green, and the ulab branch in adafruit/ulab-circuitpython comes up green, that it should be safe to ...
Hey all, I am building a weather station and I want to make the Anemometer Wind Speed Sensor wireless. Either ble or wifi. Does this idea sound plausible or am I wasting my time?
It is possible, you may find more help in the #help-with-projects area. If you tag me I can give you some advice there
@idle owl the matrix scanning problem is a timing problem. I'm switching a pin from output back to input, and it takes a little time to do that. This causes false reads. Need to think about the best way to fix this, but that's the problem. I thought it was some very odd problem with pullups and pulldowns, but it was just timing. Will work on it more tomorrow.
Not tested but is copy and paste of existing stubs logic. Will check after merge.
I tested this by creating a new branch and it works. The test CI run is here.
Fixed now, thanks :)
@DavePutz I agree the brief unwanted output on the pin is expected behaviour with the current API. I asked in #3264 whether it could be removed in the new API.
@idle owl here is a test uf2 for your feather f2040. Works on my NeoKey matrix without false results.
Switch ports/raspberrypi/sdk to be the 1.2.0 release of raspberrypi/pico-sdk.
Tested in various ways, including with a couple of I2C sensors and with the MacroPad display.
Note that changing a submodule's URL (which this does) can cause your repo clone to get out of sync and cause confusing build errors. Do a git submodule sync --recursive; git submodule update --init at the least.
KeyMatrix was giving false readings with the NeoKey Ortho matrix, with the first column's key in most rows.
This was extremely confusing for a while, because it seemed to be related to pulls not being set properly. But the problem was really that when the row is changed from an output back to an input, it took a little too long to switch levels, due to the relatively weak internal pull resistor. Adding a delay of even 1us fixed the problem. But the best fix is to flip the output value ba...
@tulip sleet if you swap rows and columns, isn't that the same as changing the diode direction? did the 5x6 ortho misbehave the same way if you did this (before #5031) ? I was about the perform the experiment but maybe you know already
it is the same, but I added the argument to make that not necessary, since the keyboard has literal rows and columns, and it would just cause confusion.
either way it's the rows that are driven and the columns that are read?
I did not have a diode keyboard to test before I got the NeoKey, and was testing with a phone-style keypad with no diodes. I think Limor tested with a proto NeoKey and it worked, but the margin of error is so small that it could be sample-related
right
I could have written two sets of nested loops and chosen one based on diode direction, but the current code is smaller - it chooses whether to pull up or down based on the diode direction
yeah the code is more compact than what I imagined
i used some existing code from somewhere as a model
this was extremely confusing because I added some resetting of the pulls at one place, and then it worked, and it looked for a while as if you could only change the pulls when the pin was set to output. But that was a complete red herring: the extra setting was adding enough extra time to fix the problem.
the pull resetting in DigitalInOut is somewhat torturous
I don't quite see why it makes a difference, but that's probably down to me not having enough electronics experience.
Whether the row output is pulled or driven to its "not scanning this row right now" value, it can't cause current to flow through the diode any more or less, since it's in the reverse direction. It is the pull on the column input that would be draining away whatever voltage there was from earlier driving the row output in the way that lets current flow.
I wonder if what you added is a complicated but short delay
if the pin is changed when it's an output and is using the push/pull active drivers, then plenty of current is used to change the level: the inherent capacitance charges quickly. But if I switch from output to input and just change the level by setting the appropriate pull up or down, then the inherent capacitance is charged only by the current through the pull resistor, which is something like 60k-80k. That's a much lower drive current than the active output drivers. So the capacitance takes longer to charge. It's still only a tiny amount of time, but it was enough to make a difference.
in other terms, the drive impedance of an output is much less than an input with pulls
yes, it's true adding the setting is also adding delay, but it is also driving the pin quickly to the other state. So they both help.
the latter is "more correct". The pins can change state at multi-MHz rates when actively driven, so I take advantage of that fact, rather than relying on the passive-pull RC time constant, which can vary.
I originally had an mp_hal_delay_us(1) in there, but it bothered me, and decided that slamming the output the other way was the right thing to do
but how can driving the ROW output drain away charge stored in the capacitance on the COL input? Isn't that current flowing against the diode direction?
if that question is still nonsense, we can just cap the discussion and move on
the diodes are reversed, so conventional current flows from the row to the col. The row was high, and the code was forcing it low with a pulldown after reading. But when it switched to the next row, the row was still charged from the previous high. The pull-down was going to pull it down eventually, but not quite soon enough. We only saw the false events on the first key in the row
i think that is true; i didn't actually analyze the current flow last night, but looking at a schematic now confirms it to me, I believe
i thought at first it might be a neokey error, though I couldn't imagine what it would be. I made an interior 2x2 matrix and tested with that, and confirmed the layout was fine
fwiw qmk uses a delay after unselecting a row https://github.com/qmk/qmk_firmware/blob/master/quantum/matrix.c#L119
same idea
in any case this seems like a "the proof of the pudding is in the eating" sort of change, it's only testing that'll show if it's an adequate fix. Some keypad might have a lot more capacitance, or some microcontroller a weaker internal pull resistor.
i corrected what I think is a typo in the explanation above. The row charge is the one that needs to drain
the pulls are quite variable, spec'd 60k-80k, no more accurate than that. and it depends on the wiring too
it could have to do with cache line boundaries even, too, delaying code execution, etc.
OK, I think that makes a bit more sense. The residual row charge can still pass through the diode and be driving the column to its "pressed" value, so draining it away by driving the row in the opposite direction makes that stop happening sooner.
yes, that's my hypothesis
Thank you for talking that through with me until I could get a handle on it.
np, i need to verify my thinking too. the weird thing is that the setting the pulls when it was an input seemed not to work, but what was really happening is that it was working slowly. if the pulls got set when it was an output, then it seemed to work, but that was because the output was slamming it fast to the correct direction.
for instance, I tried setting the pulls twice, and that didn't help, but that's because that extra work took a lot less than a microsecond
and the reason you wouldn't drive the row the opposite way whenever it's not the active row is because of diodeless matrices
i think I may have deduced that at one time but forgot it, eys
there are actually very few "textbook" explanations of how to write this code, sort of like rotary encoders are also poorly explained. There is little canonical theory.
Not sure how much of a use case there is for this; but moved global variables to the pulseio_pulseout object to support multiple pulseout sessions. It's cleaner code in any event. Verified that pulseout now works with two IR transmitters.
Works!
I'll review the PR.
whew, glad! that was painful for us both
Tested successfully with the NeoKey Ortho Snap-Apart full sheet. Thanks for the fix!
thanks for the merges @analog bridge
PR submitted https://github.com/adafruit/Adafruit_CircuitPython_OV2640/pull/9 Works but only for 320x240 image π¦
@tulip sleet https://github.com/adafruit/circuitpython/pull/5031 failed on this: https://github.com/adafruit/circuitpython/pull/5031/checks?check_run_id=3124882348. Seems unrelated. I won't merge it until you take a look though.
@gilded cradle The keypad module won't work on Blinka yet, right? Has it been added that I missed?
Is that in the core?
@gilded cradle Yes.
I don't think it was added. Which hardware does it support?
A number of things, but in this case, the NeoKey Ortho Snap-Apart. (Also MacroPad, but Blinka wouldn't help there.)
Working on the guide for the NeoKey Snap and wanted to make sure I shouldn't be making the page "Python & CircuitPython" versus making it "CircuitPython" only.
I have one of those 1x4 i2c things, but I don't have the ortho.
The I2C thing uses seesaw I think. Or something like it. So it's a different concept.
I think anyway.
Oh, gotcha. I think we're out of stock on the orthos, so I can't add it at this time. If you'd like to give it a go, you can.
Ooooh no. That's way outside my wheelhouse. rainbowio already Python-compatible code, heh. keypad is a whole other beast. In this case, it's supporting a key matrix, e.g. you give it columns and rows, and it knows what to do to find the keys.
I'll name the page "CircuitPython" for now, and we can always update it if/when we add keypad to Blinka. Thanks!
@idle owl wasn't there already a circuitpython matrix library or something? Would that work?
Oh, looks like it has neopixels, so nevermind.
looks like some network failure; thanks; i merged anyway
Hmm, it might, Dan would know, but having that lib work doesn't make the code I use for CircuitPython be Python-compatible. That's the issue. Most of our CircuitPython code "just works" on Blinka. That would be the expectation here.
I don't need it to work on Python. I only need to make sure I document things properly π
Ok, nice!
the keypad module does background scanning; we'd need a thread or a process to do it properly
Yeah I figured it would be something complicated.
Fair enough
i don't think the implementation will be that complicated, but I'm not sure of the use cases.
Threads aren't really hard to implement (I did it with displayio), it just needs some initial setup
Ah fair enough.
Well, complicated to me π
NeoKey Ortho Snap on a Pi? Seems like a reasonable use case.
But I guess we can wait until someone wants it.
I put in a request to be notified when more orthos are in stock, so I can add it after that.
Right on!
@maholli @PranavMKrishnan I have some low-level hardware experience with the D51, but struggle where to insert the needed hardware instructions in this project. Please contact me directly for details, maybe we can do this together.
is the MacroPad going to get u2if support like the other RP2040 boards?
@gloomy shuttle What's the use case?
It's someone else who put together the U2IF support. Dan didn't handle that.
I have been playing with a the u2if, neokeys, and i2c rotary encoder on my mac but the MacroPad would provide faster input than reading i2c
Hmm fair enough. Presumably that would work. I'll mention it.
it is not important but thought it was a nice usecase for keypad and Blinka.
Yeah, I can see that. Not a big deal for me to mention it. I'll make a note to let you know what I find out.
@solar whale that's awesome, thank you!
CircuitPython version
CircuitPython 7.0.0 Alpha 4 (not sure, but I cloned it from https://github.com/adafruit/circuitpython.git)
Code/REPL
git clone https://github.com/adafruit/circuitpython.git
cd circuitpython
git submodule sync --quiet --recursive
git submodule update --init
# Install pip if it is not already installed (Linux only)
sudo apt install python3-pip
# Install needed Python packages from pypi.org.
pip3 install -r requirements-dev.txt...
CircuitPython version
Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; FeatherS2 with ESP32S2
Code/REPL
import keypad
import microcontroller.pin as pin
import time
row_pins = [pin.GPIO43, pin.GPIO44, pin.GPIO37, pin.GPIO35, pin.GPIO36, pin.GPIO5, pin.GPIO6]
column_pins = [pin.GPIO17, pin.GPIO18, pin.GPIO13, pin.GPIO12, pin.GPIO6, pin.GPIO5]
neo_pin = pin.GPIO11
keypad = keypad.KeyMatrix(row_pins=row_pins, column_pins=column_pins, columns_to_ano...
@tulip sleet do you have any testing/reports about KeyMatrix on esp32s2? because it floated to the top of my box of feathers, I put a Feather S2 together with the ortho keypad, but even after (I think!) getting the matrix pins named correctly it's not working. It never registers any keypresses. I'll hook up a scope and see if it's scanning..
OK it was something with my anodes but also I still have some pins wrong / some rows & cols aren't working
No, you are the first person to test this that I know of.
Only pins that support both input & output have integrated pull-up and pull-down resistors. Input-only GPIOs 34-39 do not. from doc
are we not checking for those special pins in DigitalInOut? We should throw some errors
I don't know
row_pins = [pin.GPIO43, pin.GPIO44, pin.GPIO37, pin.GPIO35, pin.GPIO36]
column_pins = [pin.GPIO17, pin.GPIO18, pin.GPIO13, pin.GPIO12, pin.GPIO6, pin.GPIO5]
neo_pin = pin.GPIO11
keypad = keypad.KeyMatrix(row_pins=row_pins, column_pins=column_pins, columns_to_anodes=False)
``` This is what "works" except that no key on the GPIO13 column registers.
i looked - no, there is no special consideration for those pins in DigitalInOut
I'm having trouble verifying the pin numbering of the feather s2, the included card's "IO numbering" doesn't seem to match this schematic at all https://feathers2.io/images/FeatherS2_Schematic.pdf
do you have a Metro - that would be easier
I do but it's all hard-wired now π
sorry - i have about three of them
and I just had the one key sheet
@onyx hinge does this help? https://feathers2.io/images/feathers2_pinout_extended.jpg
I was confused on the FeatherS2 I think the silkscreen is the IOxx numbering, but the board def has a lot of Dx/Ax which matches common feather layouts
@lime trellis that matches the printed card I have
after a bit of manual checking, I jumped to the conclusion that the silk numbers were the microcontroller.pin.GPIOab numbers
the schematic PDF I found has IO numbers that don't match much of anything
oh wait, I copied a number wrong maybe?
yay, okay, now all keys work π
@dxstp I couldn't find your contact info anywhere on your github. If you're on adafruit's discord, that might be the easiest place to discuss. You can reach me at the same username: maholli, there as well. Otherwise, please send me an email. Address can be found here: https://maholli.com/
@slender iron is the hack chat in about 1h from now?
yes, 3pm ET
@slender iron @onyx hinge @idle owl I wrote 7.0.0 alpha.5 draft release notes. It did not take that long. I think we may as well do an alpha.5: there are fixes that we are recommending Absolute Newest for, and there are no imminent PR's I know of (still plenty to fix). The last release was 13 days ago. I can start a release build now if you agree.
I agree completely.
I'm about done with the arduino file size one
er, drive size
@onyx hinge I just pushed cascadetoml 0.3.1 to remove the print that bugs you
@tulip sleet I think you have the pulse of 7.0.0 better than I do.
so if you say it's good to go I say go for it
@slender iron I can wait for that if you'd like
will this be the first one with the reduced type object stuff? that'll probably cause a bug πͺ³
yes, it's in there, we can rely on our intrepid testers π
π huh the "bug" emoj is a cute little inchworm looking fella
i think split types is pretty solid, actually, considering it's been in use through lots of recent bug fix testing for various native modules
@onyx hinge when you have a minute can you also look at https://github.com/adafruit/Adafruit_CircuitPython_OV2640/pull/8 trivial change but may as well get it in.
thanks!
For RP2040 boards, we now change the default flash size based on
the configured flash. We will still try to read the size from the
flash first.
Fixes #4874
@solar whale done! I don't think I need to make a release just for examples changes .. (I did a release today for jpeg so it would get in the bundle)
No problem, just wanted βoff my plateβ. Thanks
π sitting down to lunch so I don't act hangry during the hack chat
I don't think I need to from cp
is it pinned somewhere?
the change is just cosmetic for jeff
its not required
np, yes, strictly cosmetic
i cloned your repo and will do some test builds while it's buildling
kk
I think I'm missing a memo here. Between the information at the top of this pull request and @todbot's Gist from 5/17/21, I got to https://github.com/Billfred/Serpente-iPad-HID/commit/affb16ef655ac5fc5fdbf9196b0c88baee582c0d for boot.py on my Serpente R2. Reset the board, and boot_out.txt reads:
Adafruit CircuitPython 7.0.0-alpha.4 on 2021-07-08; Serpente with samd21e18
boot.py output:
Traceback (most recent call last):
File "boot.py", line 19, in <module>
AttributeError: 'modul...
@slender iron I tried 7.0.0-alpha.4 and your new build on the Arduino Nano, and both times it is about 1MB. Is that right?
maybe i need to reformat
that was it, needed storage.erase_filesystem()
we need a space to chat about implementing the SAMD51/E51 deep sleep, should we chat in this channel or make a group chat?
Tested on various Adafruit RP2040 boards, and on Arduino Nano RP2040 Connect. The latter now gets the correct size after doing storage.erase_filesystem().
Will merge after builds complete.
This channel is fine. Better for other folks to provide input if needed.
@Billfred Please see https://learn.adafruit.com/customizing-usb-devices-in-circuitpython and https://circuitpython.readthedocs.io/en/latest/README.html for a more complete version of the latest information> if you have trouble please ask in https://adafru.it/discord or https://forums.adafruit.com.
ok, question about the alarm. if the cpu is in light sleep, any interrupt will wake it. normally, the RTC is set before issuing the sleep command. the rtc can operated as 32 bit counter, or in calendar mode. what is the maximum time to set for sleep?
In an effort to implement D51/E51 deep sleep, @pearl hare has offered some of his low-level SAMD51/E51 experience.
@ionic elk (or <@&681912791711350805>) is it safe to assume deep sleep register twiddling is mostly contained in these directories?
https://circuitpython.readthedocs.io/en/latest/shared-bindings/alarm/time/index.html describes the behavior. So it seems like you'd just use the clk running time.monotonic() ?
that is very abstract. an always increasing value with an unknown reference point.
what is the resolution of this time? clock cycles? seconds?
@pearl hare does this help?
here's the stm32 implementation of timealarm: https://github.com/adafruit/circuitpython/blob/8723a0335fa6ee488fc6a51ab2c67f751e69b4f9/ports/stm/common-hal/alarm/time/TimeAlarm.c#L114
and here's where (I think) it's retrieving the number of ticks the provided monotonic time (in seconds) should correlate to
https://github.com/adafruit/circuitpython/blob/8723a0335fa6ee488fc6a51ab2c67f751e69b4f9/ports/stm/common-hal/alarm/time/TimeAlarm.c#L43
also look in main.c
Yes, those directories contain the port specific code for alarm module.
stm32_peripherals_rtc_assign_alarm_callback(PERIPHERALS_ALARM_B,timer_callback);
stm32_peripherals_rtc_set_alarm(PERIPHERALS_ALARM_B,deep_sleep_ticks);
these are the functions where it gets interesting! looks like this is a simple RTC in counter mode. don't know how to drill down to it in github.
The initial alarm PR https://github.com/adafruit/circuitpython/pull/3767 and subsequent PRs to port it to other chips are a good reference.
looks like that comes from circuitpython\ports\stm\peripherals
a tick is 1/1024 of a second based on the rtc from power up (usually)
so the RTC must be set to 1kHz mode. the SAMD5x has a 32-bit counter.
I think we run it in 32khz and then have 32 "subticks"
let me calculate.. if it is set to 1kHz, it wraps around after 50 days
with 32 khz, it's 1.5 days
on overflow it'll interrupt and we'll store the overflow in ram
it has two interrupts. one for overflow (OVF), one for compare match (CMPn)
https://github.com/dxstp/same54_init/blob/master/e54_init/my_init/rtc.c
this is the low-level code to setup the RTC
So these came from circuitpython\ports\stm\peripherals\rtc.c but I can't find the equivalent peripheral config for the SAMD port
it has to be modified a bit, but this should be easy
This will also help in understanding the alarm logic.
pretending to sleep doesn't need hardware specific code, is that working?
No I don't believe that's been stood up yet either (on the SAMD). That is, no one has started to port alarm over
time.sleep() will use wfi on samd I think
looking at /ports/atmel-samd/peripherals
there is no RTC module in there. in fact, the directory is empty.
atmel-samd\peripherals\samd
you're right
gets linked up based on the makefile
the peripherals folder is for samd abstractions that aren't in asf and aren't cp specific
so we add an rtc.c and use the same function prototypes as in the STM port?
have you looked in common-hal/rtc?
that's where the common function prototype stuff should be
(I'm also in a hackchat atm)
its a sub-module
so it seems like everything in stm/peripherals/rtc.c should've been in common-hal/rtc/?
it is factored out for coding convenience. It is meant to be non-CircuitPython specific hal-related code
gotcha
the samd-peripherals separate repo is like that
peripherals contains the code that is shared between more than one common-hal module
two things: that functions to implement and where to put it. only low-level stuff.
sorry: what functions
we are all in another video/text chat right now that is happening simultaneously, so bear with us
The Adafruit crew will host the Hack Chat on Wednesday, July 21 at noon Pacific / 3pm EDT
so I am exploring the idea of having a bundle of keyboard layouts that would be compatible with circup, so you can install the one you want, without stuffing the hid library, right now it's mostly a test for making a bundle that works with circup, it only has an example layout and an exemple keycodes module, https://github.com/Neradoc/Circuitpython_Keyboard_Layouts
@lime trellis and I are still unsure where to put the RTC low level stuff. I could use some empty functions and a place where to put the implementation for SAMD. I saw that ASF is used?
here for example: samd-peripherals/samd/sam_d5x_e5x/adc.c
if you can avoid using ASF easily, that would be nice, because ASF4 is kind of terrible to use: you have to use the app builder and updating the generated stuff is painful. We have a long-term goal (probably not ever going to happen) of not using ASF. ASF3 was a lot easier.
samd-peripherals is a separate repo: https://github.com/adafruit/samd-peripherals
the README explains the point of it
I don't think there is a lot to do with the RTC. https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/supervisor/port.c
more of the work is setting the alarms
Really wish I had thought of some fancy solution to soldering up this NeoKey Snap. Instead it's a mess of wires. π¦
@onyx hinge What did you do with yours to make it one piece?
Automated website update for release 7.0.0-alpha.5 by Blinka.
New boards:
- microbit_v2
@idle owl 3d printing π
@onyx hinge Fair enough.
I'll share the stl file, it's designed for heat-set inserts but you could probably use a long screw & a nut on the back side instead
I think we have the heat inserts and the Hakko compatible tip for them here.
No idea where but I'm pretty sure we do.
M2.5 though
https://www.mcmaster.com/94180A321/ or similar
@slender iron is tempting me to buy one of those ploopy trackballs. I used to love my trackball (it was the 90s) but never upgraded to one with a scrolly.
Oh Adafruit only ever sold the M3 I guess.
I could re-do the file for M3s if you want, it would just be a few minutes
If you want to, I won't turn it down.
Ah right. Hmm.
Nah you're probably right. I can do it with the 2.5 plastic standoffs and screws I bet though.
@pearl hare So i think the take away with deep-sleep is that there's enough difference between ports that you should start with implementing pieces of ports/atmel-samd/common-hal/alarm/time/TimeAlarm.c and begin determining what low-level ASF esque functions you'll need. Then search in the various ASF, ASF4, and ports/atmel-samd/supervisor/port.c (among others) to see if they exist
I bet you want to put the nylon screw in from the bottom and a hex nut on top, so it's less scratchy
I have a baseplate on it that Noe designed earlier today. But it doesn't hold a Feather.
Nylon screws holding that on.
yeah I saw Noe's design as well, but I'd already done this and I like how it also holds the microcontroller
Agreed.
I made a 3d printed plate too, but I used a 0.76in spacing instead of 0.75 so I need to re-print it. should be quick, I just need to change a parameter
I have only one more Feather RP2040 that isn't header soldered (only ever had 2 total I think) so I'd have to sacrifice that to the NeoKey Snap to have this same setup. Could probably use an M4 instead, should have a ton of those.
They're all out of stock ATM.
should work with basically any feather
as I mentioned, I used a Feather S2 and lucked out on the pins I chose
Right, I know. And this code is specifically using pins that are on all of the Adafruit Feathers.
I stayed away from D24 and D25.
I don't know if it's obvious from my photo, but I only put 4 screws for the keypad (1 in from each corner) + 3 for the feather (feather s2 doesn't have the 4th hole)
It was sort of clear?
snaking the wires under the bars was a bit of a pain, use tweezers or something to guide the wires
wiresnek.
the bars aren't as tall as the cylinders, I put the bars against the table but maybe it would have been better to put the bars against the board. I was making it up as I went.
doing it my way ends up trapping the wires which seems preferable, less chance of pulling on them
Yeah that's fair.
Totally unrelated: one thing I will say about this Corsair keyboard I use is the volume controller on it is SO smooth. If it wasn't tied to something that increases volume in my ears, I'd probably fidget with it regularly.
Sideways rotary encoder probably.
File under things I would have laughed at the idea of me even having a clue about 4 years ago.
@pearl hare @lime trellis woof I missed a lot of conversation here so I'm still getting caught up. I use STM32 peripherals/ to factor out chip peripherals that are used in multiple common-hal modules. The RTC is manipulated by Port.c, the RTC module, and Deep Sleep, so it was a good candidate for that stuff to be moved out.
I haven't totally figured out how the SAMD would need to be organized yet, but I think it is pretty similar to STM, where sleep modes are managed by the PWR module but the RTC is also part of that "domain", as is the low power SRAM
Their volume control is other worldly... Meanwhile, I have headphone volume that jumps 2-6 points per touch of the wheel or keyboard combo XD
I didn't realize we had an ASF avoidance goal - in this particular case, it would make things very easy since it has one-line calls for setting up light/deep sleep, but if the API is prone to changes that's obviously a no-go.
Oi. What keyboard do you have?
@ionic elk all the hri_* functions in ASF basically are "bare metal" functions. if you plan to avoid ASF, move the implementations from there into the project.
This one :D with some of the White keys from Adafruit mixed in
@pearl hare yes I've sometimes done the same thing with STM32 when the API doesn't fit well, though with STM32 the HAL is much more desirable since it covers the hundreds of minute differences between ST's sprawling chip lines
Also, pretending to sleep is not necessarily non-hardware-specific. You still need the alarms to go off, and prevent essential stuff from being turned off by the "reset" that occurs at the end of the VM run
Regarding TimeAlarm: you must be conscious of what timekeeping you are using, and how it triggers an interrupt. Circuitpython is not amazing about sorting timekeeping right now and there are often multiple sources of "ticks", some of which will shut off during deep sleep, some of which won't. Obviously, any form of timekeeping that shuts off during deep sleep is unnacceptable
In the ST case, ticks are measured with the RTC module, and an alarm can be set with the same system. However, this is not true for the ESP32S2, for instance. Start from the port implementation of "get_time_monotonic" and extrapolate from there
STM32 uses a calendar interrupt. So it does not compare to an absolute ticks time, and can support much larger intervals
But that calendar interrupt is calculated using a ticks basis
for SAMD, RTC is the tick source you want to use. it has to be set to trigger an interrupt if a value place in a compare register matches the current tick counter. if you're pretending to sleep, you handle the register, but don't issue the sleep command (__WFI()).
So, question, does the SAMD RTC have calendar registers that it increments based on a tick value?
same is available in SAMD. RTC can be set to calendar mode
I'd have to look at what "calendar mode" is
the RTC clock has to be set to 1kHz to work correctly
ST just has a calendar and ticks
far as I can recall
I would imagine we want to use a calendar for interrupts, if possible. Deep sleep should be able to go for long periods of time
the question is, how long is necessary? with an rtc counter in 32 bit mode, you reach the overflow in 50 days with an 1khz clock source.
I don't know, we've never had a port where we had to ask that before. They all use calendars
and still the resolution is 1ms
For consistency, it would be ideal if SAMD did the same
well the purpose is to save power. if you wake up once a day and count the days you woke up, you won't lose an incredible amount of power.
Sure, this is more about style/maintainability than nitpicking performance
I'm maybe not understanding correctly. Since a calendar interrupt is available on SAMD, why don't we use it?
in calendar mode, the resolution seems to be down to 1 second, is that also consistent?
Yes, we don't go lower than seconds for deep sleep
Several ports don't support sleeping for intervals lower than 5s at all
(deep sleeping. Light sleeping is more flexible)
I mean in general if you're sleeping for very short periods, time.sleep() is usually equivalent to light sleep performance anyway
in ports/atmel-samd/supervisor/port.c, I see that the RTC is set to 32 bit counter mode
Let me check out the datasheet here so I understand this counter vs calendar mode business
you can switch the modes. but calendar mode needs a 1khz clock to work correctly. and I don't know the implications if the supervisor initialization is changed.
the RTC_handler() in port.c seems to assume a specific clock frequency.
void RTC_Handler(void) {
uint32_t intflag = RTC->MODE0.INTFLAG.reg;
if (intflag & RTC_MODE0_INTFLAG_OVF) {
RTC->MODE0.INTFLAG.reg = RTC_MODE0_INTFLAG_OVF;
// Our RTC is 32 bits and we're clocking it at 16.384khz which is 16 (2 ** 4) subticks per
// tick.
overflowed_ticks += (1L << (32 - 4));
}
Hmm. While I'd rather not mess with that, if it's being clocked at 16kHz, that's a 3 day maximum sleep time. Which probably isn't terrible, since most projects will be in the 1h to 24h range, I would imagine, but still kind of restrictive
Since the program will assume that every wake happens at the datetime it was requested, and we don't have a mechanism for indicating that a wake isn't "real", we'll want a ValueError for any time over 3 days
it's not a very strong ASF avoidance goal. It's very aspirational, not really executed. It works now, and isn't worth changing at the moment.
What's ASF?
the firmware HAL layer provided for SAMD
Ah
@tulip sleet I'm not desperate to use it, since the chip variety seems lower within the SAMD port
https://start.atmel.com/ you have to use this builder tool to generate ASF4. There is no zip download
I like mine!
Most chips don't have calendar rtcs. usually they are counters, not clocks. STM is weird that it's only calendar
counter modes are much simpler
I shouldn't have generalized - RP2040 has a calendar mode, but ESP32-S2 actually doesn't use an RTC peripheral at all, and NRF is polling. I guess I should check out what the maximum intervals for NRF and ESP32S2 are, come to think of it
RP2040 was fresh on my mind but you're right
@tulip sleet want to chat about the audio problems tomorrow? may help to generate more ideas to try
sure; i'll ping you in the morning when I see you on
kk, I've got a doctor appt at 11 my time and meeting with trevor at 1. free otherwise
if you want to do email before 11, that's ok, we could do it after. Or that first and then email for you. THere is not as much of a PR backlog at the moment.
Sounds good. I'll ping you when I'm around since you'll almost certainly be around before me.
The newer modules are socketpool and ssl.
Fixes #3924, related to #2021, closes #1880, closes #2273, closes #2274
Thanks! There's one thing I wanted to ask about..
It seems like the value passed to mp_raise_OSError is generally a positive errno value.
py/mperrno.h:#define MP_ENOENT (2) // No such file or directory
...
ports/unix/modffi.c: mp_raise_OSError(MP_ENOENT);
but sometimes they're raised as negative values
extmod/vfs_lfsx.c: mp_raise_OSError(-MP_ENOENT);
Does the positive/negative distinction mean something? Should a named constant such as MP_NOENT be used here instead of the number 2?
@slender iron Wouldn't removing socket break regular py compat?
CircuitPython's socket module isn't in any builds. With Blinka, import socket will use the platform's own Python module
Hi. If there are no objections I would like to take this issue on!
@NathanY3G thank you for offering! I've assigned the issue to you. Let us know how we can help you get up to speed working on the CircuitPython coreβour Discord is a great place to find help as well, just drop in to #circuitpython-dev and ask a question.
I would like to help with CircuitPython Audio. I have Metro M4 and FeatherS2 boards, and the MAX98375 amplifier breakout, with a mostly working drum sample player on each board.
is there a way to drop a circuitpython uf2 on a board and not have it expose the code.py as a disk drive?
sorry, rephrase. not expose code.py ON the disk drive
@calm aspen the latest versions of CircuitPython 7.0 alpha allows you to disable the CIRCUITPY drive entirely if that is what you want to do. See this guide https://learn.adafruit.com/customizing-usb-devices-in-circuitpython I am not aware of a way to "hide" a specific file.
Thank you Jerryn, that was what I was wondering and didn't explain the ask very well. I was curious if there was a way to hide the drive entirely. thanks!
@tulip sleet I just noticed that there's no alpha.5, at least on this board page: https://circuitpython.org/board/qtpy_m0/
Note: If you soldered the optional SOIC-8 SPI Flash chip on to your QT Py, see the βQT Py Haxpressβ page to make use of the extra space!What a cutie pie! Or is itβ¦ a QT Py? This diminutive dev board comes with our favorite lil chip, the SAMD21 (as made famous in our GEMMA M0 and Trinket M0 boar...
@calm aspen Be careful and make sure you know how to delete boot.py from the REPL or get into safe mode so you can load new files if you need to.
@tulip sleet @onyx hinge There don't appear to be any alpha.5s on circuitpython.org
my fault - I was waiting for the builds to finish and forgot to merge this
I hope it was OK to merge now, since I just did
Is there plans for 6.3.1 or 6.4 before 7.0.0 releases?
@idle owl adafruit_ticks is a new timekeeping library that uses the new supervisor.ticks_ms but is also back compatible to time.monotonic_ns or time.monotonic for compat with 6.x. It is 556 bytes mpy-compiled for 7.0. Is it reasonable to contemplate moving the LED animation library to use it?
no plans - 6.3.0 is in pretty good shape, and 7.0.0 is also in good shape
Okay cool
In fact, the 6.3.x milestone was down to 0 issues and we removed it; there are no changes in the 6.3 branch since 6.3.0 was released.
new information could change our plans, of course, but the circuitpython issue tracker tells us no 6.3.1 or 6.4 is needed.
Thatβs good to hear π
7 seems like it will be really good
Do we know the point when CP gets too much for samd21 to run?
It seems like weβre getting really close to that point
@slender iron will other nrf52832 boards be supported by CP once the micro-bit is working? I was going to to respond to this forum post and tell them the nrf52 Bluefruit LE not supported but wanted to check if it was a possibility https://forums.adafruit.com/viewtopic.php?f=57&t=181466
Ah -- nevermind -- I see microbit is an nrf52833..my mistake.
The nrf52832 boards require different compile options and a different SoftDevice. It was painful, and we (I) removed support a while ago. It could be put back but they are fairly weak chips in terms of RAM, etc.
so I doubt whether we would try that.
yeah -- I see now that the nrf52833 has twice the RAM as the largest nrf52832.. makes sense. https://infocenter.nordicsemi.com/index.jsp?topic=%2Fstruct_nrf52%2Fstruct%2Fnrf52.html
Ha -- it looks like the nrf52833 actually has native USB, but the mircobit just does not use it....pins AD4/AD6 <https://github.com/microbit-foundation/microbit-v2-hardware/blob/main/V2/MicroBit_V2.0.0_S_schematic.PDF
yep
@v923z can you take a look?
I'm on it.
Wow I guess I missed it but when did the Circuitpython PR list drop down to five?
I visited the page and got confused, I thought I was looking at someone's fork
it was down to 3 couple days back
good stuff
We could potentially add all the settings to the CI over in micropython-ulab once this is sorted, let me know if you have an interest in me doing that.
Do you mean that the dimensions could be checked out, one by one? I think that wouldn't be a bad idea. I would have to re-write the test scripts, though. I think, at the moment they are really geared for 2D.
New PR to avoid force pushing rebase over the old one. In retrospect, I don't think this needs any special interaction with deep sleep, since it's really for passing tracebacks and deep sleep exceptions don't have those. If code needs to detect if the last exception was deepsleep vs startup, it should just use the alarm module as per usual. Tested on a Feather M4 Express, works as expected. Useful for #1084.
Heads up for @tannewt to take a look at the string stuff in this since I'm not sur...
Superseding with #5037 to avoid force pushing the rebase.
A SocketPool instance acts like a socket module. CP's socket module is from when native wiznet support was added. The wifi stuff never used it
Looking forward to it :)