This was a nice start, but I was unable to find time to finish it.
#circuitpython-dev
1 messages ยท Page 377 of 1
@lone axle Any chance you could test the Community CoC PR on cookiecutter to make sure it builds properly with the appropriate CoC for both the "community" and "adafruit" choices? I know you and I talked about it, and you were pretty sure I did it properly, but I would appreciate an actual test before I merge that PR.
I can but it'll be a few hours until I have a chance most likely.
@lone axle That works. I'll make a note on the PR.
I personally wanted events so I can tell when a key goes down and not have to maintain extra state myself. It's less useful for an HID gadget, where you are just copying over the up/down state to the report, but it is quite useful for a game or some stand-alone appliance. As @ladyada said:
being able to get events and also current key state is really valuable for UI and HID reports
Also for a MIDI keyboard, the events are nice.
Having it native is a higher bar than "nice-to-have" though. If we have a consistent current state API, then we can make a library to create events based on it for all implementations, not just native ones. A library would do the state tracking for you. One problem with a pure current state API is that it can miss presses. That's why gamepad latches presses and the current state API probably should as well.
How much code size is added by the event queue stuff? Moving it to a library woul...
Are you able to delete the old uploiad from 2019? I think the current version numbering will never be newer than that old version number.
https://www.python.org/dev/peps/pep-0440/#version-epochs A version epoch may help here?
However, by specifying an explicit epoch, the sort order can be changed appropriately, as all versions from a later epoch are sorted after versions from an earlier epoch:
2013.10 2014.04 1!1.0 1!1.1 1!2.0
I don't think I have access to delete it (and don't know how to if I do). Maybe @slender iron can. I was thinking when a non-dev release gets made that it would override that older one. But I'm not actually sure if it will or not, just a guess on my part.
I wasn't sure if Python handled the Debian-style version epoch.
it looks broadly similar but uses a different character
Yep @fluid moss, part of the confusion was that the RGB bit was labeled BGR in arduino, which differs from the datasheet.
@lone axle @stiff pelican @onyx hinge I've "yanked" the old release which makes it installable through pinning only
Thanks @slender iron
Thank you!
My 2 cents, without having examined the code yet:
- Are we trying to reduce this API before merging, to avoid having to reduce it later and cut functionality? If so, what elements are in question?
I did originally intend to pare down the options, but if you are OK with keeping them, thatโs fine with me too. I think we were approaching a consensus around https://github.com/adafruit/circuitpython/issues/1084#issuecomment-699491344.
- Related to the above, scanning the discussion,...
I was presented with multiple use cases. it was a goal to have all of them run quickly. For each case, there is a most convenient way to report and use the state of some keys. The reason I have provided multiple reporting methods natively is to make all these use cases nice and fast. Yes, I could choose one scanning mechanism, and layer others on top, in Python, but that would make the upper layers be slower.
@tulip sleet want to chat about โ๏ธ?
@slender iron Hi - I was cooking and eating. Sure.
np
@lone axle If that PR to cookiecutter works, please merge it after you've tested it. If it fails, obviously let me know and I'll deal with it tomorrow. Thanks again!
@lone axle Oh! I just saw you already commented.
I'll merge it. Thank you!
Hi!!
Just to add another possible motivation / reason for WebREPL.
BIPES (https://bipes.net.br/) project relies on WebREPL, which is great for wireless interactive debugging, programming, uploading and downloading files and interacting with MicroPython shell. It would be great with CircuitPython also!
We have about 3000 users now, and many users reported flexibility and ease with BIPES + WebREPL, all using a web browser.
By the way, we already use BIPES + CircuitPython on ESP32-S...
Is there anyone here well versed in Micropython board development? I have a custom board I built about 7 years ago, and of course the version of MicroPython on it is way out of date. I've tried to update the BOARD files to the more or less latest spec, but I'm still running into problems when running make
This is what I'm seeing:
Pastebin
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Figured it out
I was missing these four lines:
USB_VBUS,PA9
USB_ID,PA10
USB_DM,PA11
USB_DP,PA12
from the pins.csv file
To support fully variable (not just 2 sizes), we can set aside some bits in type->flags as suggested. It would be nice if we could
- allow builds that always make all type objects full size (binary size vs performance trade-off)
- have some freedom to re-order fields, or even move them between the mandatory and optional parts of the type object (with optionalโmandatory being easy and โoptional requiring more work)
Anyhow, I think the below design does this.
One critical part of t...
Very cool, and good to know that clz can be resolved at compile time on const inputs. There's a significant win here for ROM so keen to investigate, and would be great to ensure that CPy and MPy take the same approach.
Not sure if useful, but another approach I had considered for fully variable is to add an indirection via an index table (i.e. all types would pay for a fixed N-byte table, but then only for the slots they use, where N ~= 12). Sketch below:
#define SLOT_MAKE_NEW (...
It could be easiest to decide on a small (say 5-10) set of allowed variations of mp_obj_type_t and then provide macros to initialise types. Eg:
// Only with print, make_new, and a locals dict.
MP_DEFINE_TYPE_V1(
mp_type_simple,
{& my_type_type },
MP_QSTR_simple,
simple_print,
simple_make_new,
(mp_obj_dict_t *)&simple_locals_dict,
);
// Lots but not all slots filled.
MP_DEFINE_TYPE_V4(
mp_type_bytes,
{ &mp_type_type },
MP_QSTR_bytes,...
Firmware
Adafruit CircuitPython 7.0.0-alpha.3-97-g47a6b13d6 on 2021-06-22; Raspberry Pi Pico with rp2040
Code/REPL
import array
import board
import time
import pulseio
import pwmio
pwm = pwmio.PWMOut(board.GP0, frequency=38000, duty_cycle=2**15)
pulseOut = pulseio.PulseOut(pwm)
pulses = array.array('H', [1000,1000,1000,1000,1000])
while(True):
print(".")
pulseOut.send(pulses)
time.sleep(5)
Behavior
Occasio...
#1290 says the "actual resolution" of time.monotonic_ns is 1ms due to this being the unit at which common_hal_time_monotonic ticks. It appears that time.sleep also has an actual resolution of 1ms. It would help to state this in the docs so that people don't get unrealistic expectations of these functions.
I thought about using len() again. The Python doc for len says "Return the length (the number of items) of an object. The argument may be a sequence (such as a string, bytes, tuple, list, or range) or a collection (such as a dictionary, set, or frozen set)." Since a scanner like Keys is not directly accessible via [] or get() or an iterable, I think using len() probably implies a little too much about its capabilities.
So here is a crazy idea. Instead of the keys.pressed(key_number) function, use keys[key_number]. Then everything fits...
Finally... this is almost ready to merge. I re-wrote the SPI module, now it utilizes the idf's spi_master driver. I haven't tested the new module completely and some bugs might still be present, it would be really helpful if folks can give it a shot. :)
That's a nice consistent idea, though I liked the clarity of pressed(). There are some other API changes we are thinking about that might render this moot.
My preference would be to have as few options as possible to reduce complexity. clz is a neat trick but I'd like it to be simple to describe how it works. Simple is also easier to implement.
Looks great! Thank you!
I'd rather leave it vague so that it can vary by port. sleep should never sleep longer that the time given I think.
Please remove pressed and get_states_into. They provide more than one way to use the API and that may lead to confusion. They are also timing sensitive because they do not latch. If someone wants this API, they can be derived from the event queue.
One question about overflow as well.
Thanks! It's getting close.
I'm not sure you should clear on overflow automatically because client code may want to try and recover. Instead, I'd have clear() clear the queue and the overflow flag. I wouldn't make this settable and rely on clear instead.
Thanks @microDev1 ! The code looks good to me. Unfortunately, it looks like Kaluga 1.3 ran out of space in one language.
Could others chime in that they've tested this too? Thanks!
thanks to @onyx hinge we're 13 commits behind micropython!
Hi can anyone here check that the CircuitPython VSCode extension still works? I keep getting command not found when trying to run any commands and I'm seeing a few reviews stating the same, but this is my second time using VSCode so that could also be why
Right now I don't clear the queue on overflow (the doc above is actually wrong), but I do clear the internal state of all the keys, so they are reset to being all up (even if they are down). So maybe I should not clear the internal state on overflow, and I should clear the internal state and the queue contents on clear()?
This is actually a little bit tricky to accomplish because clear() is an operation on EventQueue, not on the scanners, and in fact the EventQueue does not even have a backpointer to its owning scanner. So maybe clear() should just clear the EventQueue, and there could be a separate reset() operation on each scanner which clears the internal state.
I'm seeing issues with this artifact relative to 7.0.0-alpha.3: ejecting CIRCUITPY and restarting on uncaught exceptions and also on trying to lock I2C:
Adafruit CircuitPython 7.0.0-alpha.3-99-gcc7d59c3a on 2021-06-23; FeatherS2 with ESP32S2
>>> import board
>>> i2c = board.I2C()
>>>
>>> while not i2c.try_lock():
... pass
...
...
...
$
@slender iron I think you're absolutely right to try to steer that discussion back towards what is an incremental improvement .. but I do want to find some syntax/macros that make further experimentation easier than my first round of experimentation..
"let's save 1.5kB now/real soon and maybe save more later" is a great plan
me, at my most productive. ๐คฃ
Makes sense that it could vary by port, and CPython is vague about it too. But in a microcontroller context, it would be nice to have an easy way to find out.
[adafruit/circuitpython] New comment on issue #4874: Wrong filesystem size on Arduino RP2040 Connect
Hi, I ended up here in this issue after noticing the file system size for the Arduino Nano RP2040 Connect is 1 MB rather than the expected 15 MB. Of course, this also means it's not possible to copy more that 1 MB to the file system so the remaining 14 MB go unused ๐
My guess is that the flash chip isn't correctly reporting its size.
I wrote a small pico-sdk application to see what the call to flash_do_cmd [here](https://github.com/adafruit/circuitpython/blob/6.3.0/ports/raspberryp...
{}
QSTR updated
``` I've failed to figure out what's printing this `{}`, it's probably a debug-print that is better off removed.
sometimes it includes some flash chip info in there instead of being empty
ah so it is desirable that it appears
Sekret {}.
"these are your father's curly braces" https://xkcd.com/297/
i don't know if it's left over from some flash toml debugging or not. I think whether it's printed may depend on the port
@onyx hinge Feather RP2040 build, for example:
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
{'sku': ['GD25Q64C']}
text data bss dec hex filename
244 0 0 244 f4 build-adafruit_feather_rp2040/boot2.elf
QSTR updated
i don't think it shows up on any other port
this was nrf
@tulip sleet Do we have a plan for alpha.4? I have a no-rush library PR waiting on it, and simply wanted to know if we had some idea when that might be so I know when to remind myself.
i think I will start on it after the keypad stuff is merged, which should be within a day or so. so maybe by the end of the week or early next week. It may be beta.0 instead of alpha.4
Right on, I meant whatever next release. There was an indices flag that we fixed, but it missed alpha.3 by 10 hours apparently.
@onyx hinge I think it's from cascadetoml
Why not copy the README.rst itself? There is a lot of duplication now.
@tannewt Ready for re-review.
-
acf90fb: much renaming:
num->number,col->column, etc. -
7774b18: Overflow handling changes:
a..overflowis now read-only. It is set when an event arrives but the queue is full. Nothing else happens immediately; the extra event is just discarded.
b.EventQueue.clear()will reset.overflowback toFalse, and also empties the queue. It does not affect the keypress history kept by the scannersKeys,KeyMatrix, or `ShiftRegiste...
@bronze shadow https://www.adafruit.com/product/5128
Strap yourself in, we're launching in T-minus 10 seconds...Destination? A new Class M planet called MACROPAD! M here stands for Microcontroller because this 3x4 keyboard controller ...
I love it
@sudden coral โ๏ธ
oooooooh that's awesome! also
Please note, the RP2040 chip does not currently have QMK support - this macropad is designed to be programmed in Arduino or CircuitPython! If QMK eventually does add RP2040 as a supported chipset (no ETA and no plans that we know of), we'll update this page.
some folks in the KMK Matrix/Discord have alluded to building hand-wired RP2040 boards successfully. if you could send @bronze shadow or I the pinout and diode orientation we could probably throw together a proper KMK board definition for this. rotary support (version... three? at least?) is WIP by a community member
I can get you a schematic or do the def myself
One minor thing. Looks good otherwise.
//| If a new event arrives when the queue is full, the event is discarded, and
//| `overflowed` is set to ``True``.
Reading through the docs in https://github.com/adafruit/circuitpython/pull/4891#issuecomment-862675187 and the example a comment or two below it, this looks nice to work with and it'd probably be pretty straightforward to port KMK over to this API and (1) rip out a bunch of messy DIY code I haven't really touched in years, and (2) get the C speed boost.
The only thing [our matrix implementation handles](https://github.com/KMKfw/kmk_firmware/blob/54f4644b5c8262618cff42e4ad7ac8f6b4eef6f7/kmk...
(Oh - is it safe to assume this would make whatever the next stable CircuitPython is after merge? We'd have to communicate a new minimum CPy version and rebase KMKPython off of that version, and we try not to rebase off of HEAD)
(Oh - is it safe to assume this would make whatever the next stable CircuitPython is after merge? We'd have to communicate a new minimum CPy version and rebase KMKPython off of that version, and we try not to rebase off of
HEAD)
Definitely yes, this will go in the next 7.0.0 alpha (or maybe it will be beta) release, and will be in 7.0.0 final.
My thinking was that we wanted the stubs package to clearly identify itself, which the "main" README.rst would not. I can copy it if that makes more sense.
Apparently if calling pwm_set_enabled() to disable PWM is done too soon after a pulseout is ended it can leave the pin high (Issue #4908) Inserting a short delay before the call seems to resolve the issue - testing was run for several minutes without reproducing the error.
Thanks for figuring this out. Is there already a report of this problem somewhere else? If not, it might be worthwhile filing an issue with your observation in https://github.com/raspberrypi/pico-feedback or https://github.com/raspberrypi/pico-sdk.
I have fixed the Kaluga 1.3 space and i2c.try_lock() issues. I haven't noticed any uncaught exceptions yet.
Thanks for your patience. Let's go with this for now, and we can think about improvements later.
Thanks for saving away these tests!
I remember there was some further testing with dynamic baud rate changes, but I don't remember the results. Could you record them here?
Hi folks, would you like to keep working on this? It sounds like there might be some pin cleanup needed, but otherwise it's close.
@BradChan Would you like to finish this off? DId you get a PID?
Confirmed i2c.try_lock() is good now.
Try this code to see the exception crash:
import board
import time
time.sleep(5)
import adafruit_dotstar
# status_light = adafruit_dotstar.DotStar(board.APA102_SCK, board.APA102_MOSI, 1, brightness=0.1)
while True:
print("", time.monotonic(), "\r", end="")
time.sleep(1)
control-c within the loop works fine unless the DotStar line is uncommented
This PR fixes pin assignments of I2S_SDIN/SDOUT of Wio Terminal, added at #4679. The initial implementation followed the schematics (https://files.seeedstudio.com/wiki/Wio-Terminal/res/Wio-Terminal-SCH-v1.2.pdf), where I2S_SDIN and I2S_SDOUT are defined as PA21(SDO) and PA22(SDI), respectively. This PR swaps the definitions to be consistent with other boards.
Has anyone taken a look at implementing promiscuous mode with Circuit Python + ESP32S2 ? I have tried a few approaches and no success.
Here is the sample code that I have been working on - after building using the make BOARD=unexpectedmaker_feathers2 command, the uf2 file is generated but freezes the chip when the esp_wifi_set_promiscuous(true) line is enabled.
Is there some other options that need to be set before setting esp_wifi_set_promiscuous ?
Similar to the AP Mode rec...
Thank you! Will merge after build completes.
When making a PR I have the test CI error on Invalid or non-existent authentication information. See https://pypi.org/help/#invalid-auth for more information. during the stubs phase, we should probably guard against that.
The S3 upload uses [ -z "$AWS_ACCESS_KEY_ID" ] || do_stuff...
(should that be in your stubs-related PR 4907 @onyx hinge ? )
@jaunty juniper quite possibly!
- name: Upload stubs to PyPi
if: github.event_name == 'push'
env:
TWINE_USERNAME: ${{ secrets.pypi_username }}
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
if ! [ -z "$TWINE_PASSWORD" ]; then do
echo "Uploading dev release to PyPi"
twine upload circuitpython-stubs/dist/*
fi
``` this?
I think so, though there might be a way to do that at the if: level with a github.event_name == 'push' && secrets.pypi_password != '' or something like that
(cleanly marking it unchecked in the jobs list)
I did it with [ -z ] of a branch of mine
The variable baud rate for commands vs display was found to have no affect on the reliably of the display so I stopped work on that aspect. The overall baud rate can still be controlled. I need to update the original issue with some more findings but still no solution. This PR would fix the issue but is more of a band aid then a long term solution.
Any clues from the debug serial?
It would be nice if it was unchecked in the jobs list!
same goes for the S3 job in that regard (not that its if clause is not already complicated enough)
@slender iron adafruit/esp-idf submodule needs to be rebased due to the change in commit history between v4.2 and v4.3.
I have updated my fork microdev1/esp-idf to v4.3 but I don't have the permission to push directly to adafruit/esp-idf.
I'm trying to read between the lines of the github documentation and find out what happens if you try to if an unset variable
This problem is still present in the latest main as of this writing, so the updating of TinyUSB did not fix this. There were significant changes to MIDI storage management when dynamic USB descriptors were added, so that is a place to look as well.
I will check this out once I got time, probably next week
maybe it's if: contains(secrets, 'pypi_password')
we are using the circuitpython branch in adafruit/esp-idf, but maybe we should create a circuitpython-v4.3 branch or something like that.
We need at least one fix from our branch: https://github.com/adafruit/esp-idf/pull/1, unless https://github.com/espressif/esp-idf/pull/6848 is in 4.3 now, but I don't think so (?)
no it isn't in v4.3... I patched the i2c-wifi bug in https://github.com/microdev1/esp-idf
even if you have pypi secrets in your repo, the step probably shouldn't run if you're not in adfruit, since that user wouldn't have the correct secrets. ```- if: github.event_name == 'push'
-
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository_owner == 'adafruit'
i sent you an invite to adafruit/esp-idf
@slender iron how would you like to handle updating adafruit/esp-idf? should we make a new branch for 4.3?
Fixes #4193 using the proposed simple solution.
When appending a layer (Group or TileGrid) to a displayio group, set the hidden_by_parent attribute to true if the group (the new "parent") is either hidden or hidden_by_parent. The *_set_hidden_by_parent functions propagate the value further down the tree as necessary.
This fixes in particular updating text labels while they are hidden, like you would with a pagination system, since it involves inserting one or more `TileG...
a new branch makes sense to me
@analog bridge ^
@slender iron @tulip sleet I made the new branch circuitpython-v4.3... should I make it default?
That's probably a good idea, otherwise it's kind of hidden. thanks!
folks with old cpy (i.e. prior to v4.3 update) will face build issues as they will get idf@v4.3 by default...
how about changing .gitmodules instead of making the v4.3 branch default.
[submodule "ports/esp32s2/esp-idf"]
path = ports/esp32s2/esp-idf
url = https://github.com/adafruit/esp-idf.git
branch = circuitpython-v4.3
does it matter if it's the default? Older builds just use a particular commit, not chosen by branch
this way is OK too
๐
Thanks for the update and your patience with my feedback!
[adafruit/circuitpython] New comment on issue #4874: Wrong filesystem size on Arduino RP2040 Connect
We generally don't use the pico-sdk for board defines because we supported more out of the box. Both GigaDevice and Winbond flashes will report 0x21+ for capacity.
For this, I think we'll want a small Python script similar to https://github.com/adafruit/circuitpython/blob/main/tools/gen_nvm_devices.py that generates a header file that either allows for the current detection or a fixed flash size. Then,the detection code could be overridden.
Does disabling PWM actually leave the pin in a know state or simply stop the counter to it? Maybe we want to force reset the pin instead of waiting a little time to hit the off phase of the pwm.
For the API, I'd suggest looking at how we do start_scanning() in BLE. We don't use callbacks due to their out-of-order nature. Instead, we return an iterator that yields objects.
Ya, I'm fine with that. I think we'll want to strip it down more aggressively though and then link to the main one instead of duplicating a bunch of info.
@anecdata Thanks for the thorough testing, the exception crash is now resolved.
We've discussed adding all of the deep sleep integration settings in a new PR, so if this is passing CI and other people can confirm that it works for their purposes under test, it should be good to go, right?
A small clarification, since numerical dates are weird. When is circuitpython day this year? ( 8/6/2021)
Is that the 6th of August?
yes
Thanks.
2021/8/6, to be unambiguous
I like more that format, but with dashes. So if you have a bunch of files and you "ls *" they show up nicely without extra work :).
i agree, great for timestamps, with leading zeros
@tulip sleet do you think bleak would have trouble with multiple services of the same uuid? I'm thinking ahead to cp serial
and whether I can use nordic uart service for it
it had this trouble in the past, but I think they fixed it. I'll find the issue
I think I'll do it verbatim except add a text descriptor to the characteristics to flag them for circuitpython
which should make them backwards compatible
๐
was fixed by using handles instead of uuids
i think so, I was going to put in a caveat, but then I wasn't sure
nrf52833 is out of space...
i can't remember that we ever got -flto working on nrf
I can't either
for micro:bit we can at least disable usb
pca10100 build failed for me though
turn off synthio?
@slender iron I finally noticed that the README.rst-stubs I had committed was not edited at all
now I understand why you were not happy with what was there.
Firmware
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Metro M4 Express with samd51j19
Code/REPL
import board
import pwmio
import pulseio
import time
import countio
def send_signal(freq,dc):
pwm = pwmio.PWMOut(board.D5, frequency=freq)
pwm.duty_cycle = int(65535*dc)
print('Sending Signal')
def capture_cycles(p, num_cycles, timeout):
p.clear()
p.resume()
start = time.time()
while len(p) < num_cycles:
if time.time()...
CircuitPython 6.3.0 on a Feather nRF52840 Express says:
>>> t
[2021, 6, 24, 19, 28, 37, 3, 175, -1]
>>> time.struct_time(t)
TypeError: time.struct_time() takes a 9-sequence
>>> len(t)
9
>>> time.struct_time(tuple(t))
struct_time(tm_year=2021, tm_mon=6, tm_mday=24, tm_hour=19, tm_min=28, tm_sec=37, tm_wday=3, tm_yday=175, tm_isdst=-1)
Standard Python 3.9.2 accepts constructing a struct_time from a list, and even CircuitPython's error message indicates a list is intended to...
I tried forcing the pin low after the pulse completed, but that did not
work reliably. Only
a delay seemed to work. I was able to reproduce the issue with a C program
using the Pico SDK,
so I will open an issue with the SDK.
On Thu, Jun 24, 2021 at 12:41 PM Scott Shawcroft @.***>
wrote:
Does disabling PWM actually leave the pin in a know state or simply stop
the counter to it? Maybe we want to force reset the pin instead of waiting
a little time to hit the off phase of the pwm.
...
nRF CircuitPython boards will now provide the file transfer
service defined here: https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer
USB capable boards will only advertise if previously bonded to a
device or if the reset button is pressed during the fast blue
flashes on start up. When pressed, the board will restart again but
the blue period will not flash.
Boards without USB will always advertise.
When previously bonded, the advertisement is private so that no
...
Just a note that promiscuous mode can be run concurrently with STA, AP, or APSTA modes, but Espressif recommends not using promiscuous mode along with heavy non-promiscuous traffic.
https://docs.espressif.com/projects/esp-idf/en/v4.2/esp32s2/api-guides/wifi.html#wi-fi-sniffer-mode
Okie doke. We can merge this in the meantime. Thanks @DavePutz
I believe the issue is because pulsein has no pre-defined protocol, so an arbitrary limit of 1 second was chosen to detect a runaway peripheral. If you chop up your capture cycles length into smaller chunks so that the 1 second limit isn't reached (a value of 500 worked for me) then you should be OK. I know this complicates your code, but there has to be some limit where pulsein can decide that "too much" data has come in.
Looks good! I did not test it (I don't have the apps).
I think it would be nice in the long run to factor out the file transfer protocol code in shared/bluetooth.c into its own library (repo?) or at least its own file.
@slender iron I will let you merge #4918, in case anything else has come up in the meantime.
not that I know of. I was just restructuring it a bit
making a bluetooth subfolder
you could test it from another CP device if you wanted to
using this code: https://github.com/adafruit/Adafruit_CircuitPython_BLE_File_Transfer
let's go ahead and merge; I won't hold it up for me to test, since that's what you've been doing all this time.
Looks good! I did not test it (I don't have the apps).
I think it would be nice in the long run to factor out the file transfer protocol code in
shared/bluetooth.cinto its own library (repo?) or at least its own file.
I just started on adding BLE serial support and I'm making a bluetooth subfolder similar to the usb one. I don't think it should be a separate repo because its build on top of common_hal APIs.
I'm sure there are more bugs but there will be either way ๐
I may take a stab at a webbluetooth page for it
right, i can always make an issue, and we'll get more testers on it sooner
i was thinking about the protocol parsing and structs stuff, but maybe it's too intertwined with the common-hal-specific code anyway
yeah, something like that, it's a protocol that stands independent of where it's used
the code is very clean; thanks for digging through all the new cases and fixing the broken edge cases in the old code
GitHub has a new beta feature, Issue Forms, which are nicer than Templates.
Mu will be using them: https://github.com/mu-editor/mu/pull/1663
Looks nice:

[adafruit/circuitpython] Issue opened: #4921 Serial data larger than 256 bytes not reading correctly
Firmware
Adafruit CircuitPython 7.0.0-alpha.3 on 2021-06-03; Raspberry Pi Pico with rp2040
Code/REPL
import usb_cdc
import binascii
while True:
# get serial data
while usb_cdc.data.in_waiting > 0:
print(binascii.hexlify(usb_cdc.data.read(256)))
Behavior
The data printed by the program does not match what I send.
Description
Any data I try to receive appears damaged or partially overwrit...
This has to be some kind of timing related problem. Here is my current code:
import usb_cdc
import binascii
expectedData = 560
bufferSize = 512
print("Buffer size: " + str(bufferSize))
while True:
# get serial data
while usb_cdc.data.in_waiting > 0:
data = bytearray(expectedData)
pos = 0
while pos < expectedData:
readNum = min(bufferSize, expectedData - pos)
time.sleep(0.01)
buffer = usb_cdc...
Is there something new that takes the place of this line? If I understand correctly this was making the package that gets uploaded to pypi. Is that handled somewhere else now?
To work around this 1s limit now I've been doing as you suggested where I capture a smaller set of pulses then append that to a separate list, clear pulsein, resume pulsein, and continue that process until I capture all the data for the time period I want. Would it be possible to remove the 1s limit and just use the maxlen as the limiter to prevent peripheral runaway in future updates of pulseio? Would it also be possible to update the current documentation of pulseio to include the caveat th...
Fixes #4921.
The usb_cdc.Serial read and write routines did not advance the buffer pointer after the first read or write, causing data to be read into the wrong part of the buffer, or writing duplicate data.
Tested with a Pi Pico and pyserial. Original reporter @acrankyturtle will also test.
The problem with only using maxlen is if a peripheral just holds the line
high (i.e. a very long single pulse). In that
case the maxlen would never be hit, so we need some sort of timeout. The
current pulsein API doesn't include a
timeout value; although that might be a good idea to look at in the future.
I agree that a mention of the limit in the
documentation would be a good idea.
On Fri, Jun 25, 2021 at 8:32 AM rsolow @.***> wrote:
To work around this 1s limit now I've been doing...
Seems to be fixed for my example, thanks!
However, I noticed another case, after first creating the objects. I'm thinking it's the same issue, as creating the PWMOut object starts the PWM, then creating the PulseOut object stops it.
Adafruit CircuitPython 7.0.0-alpha.3-418-g769805c9b on 2021-06-25; Raspberry Pi Pico with rp2040
import board
import pulseio
import pwmio
pwm = pwmio.PWMOut(board.GP0, frequency=38000, duty_cycle=2**15)
pulseOut = pulsei...
@acrankyturtle reports this fixes their problem.
Requiring the array.array to be exactly the right length means that if the messages have different numbers of pulses, there's going to be a lot of memory reallocation going on, potentially on quite large objects. An optional count argument would allow reuse of the same memory allocation for each message.
README looks good. Thanks!
Works for me! Thanks for picking this up @hierophect!
@slender iron #4195 is ready to merge... needs a review.
nice! ๐
Anyone on here that has run adabot locally before mind testing something for me? I would test it but I just got rate limited
This PR closes #3884.
- Adds
microcontroller.RunMode.UF2 - Adds
UF2,NORMALandBOOTLOADERrun-modes to esp32s2
I really want adafruit_pypixelbuf to be a drop-in replacement for _pixelbuf. This try/except import crap is frustrating. We did not think that through. There are very few Learn guides that trip on a search for "pypixelbuf". We should give some serious consideration to renaming it to adafruit_pixelbuf and renaming _pixelbuf to the same thing like adafruit_bus_device. The only time _pixelbuf is used is when I've written code that imports colorwheel() from it. So that's on me to figure out where I did that and update it if we decide to make such a change.
we could do this for 7.0.0. I'd say open an issue laying out the above. We can fork or copy the repo to provide both names.
I don't think we even need both names. Like I said, the only references directly to it are me importing colorwheel(). Most references to it are simply the library listings in guides which is what it is to update.
i just mean for back-compatibility with 6.x
Hmm. I suppose.
we'd need to think the exact naming changes through, but i think you have a good point
Filing an issue.
we could just make adafruit_pypixelbuf or adafruit_pixelbuf be an alias for the native module _pixelbuf, so importing either imports the native module if it exists. Maybe that is the easiest thing to do. We could also rename it
Hmm.
i think... not sure what the priority is for a native module over an existing one. Like, if you had time.py, and imported it, which would it import?
I don't know the technical options to make it happen, but as long as I can import one thing and have it work on all boards, I don't care how it's happening.
I don't know either.
We included colorwheel() in both _pixelbuf and adafruit_pypixelbuf, but to use it across all CircuitPython-compatible, it requires a try/except import structure. This was something we did not consider from the beginning.
We should rename _pypixelbuf and adafruit_pypixelbuf to match so Pypixelbuf is a drop-in replacement for _pixelbuf.
@dhalbert has suggested another option involving making the latter an alias for the former, so a single import works for both, but we're ...
@tulip sleet ^^ Issue filed.
This happening sooner rather than later would be ideal as I feel like we're in a pretty good place with there being only a few things needing to be updated if we make this change.
Resolved (as described) by #3454
@cwalther just a heads up that I'm also working on rebasing/reworking this too (so we don't overlap in case you were considering getting back into it)
@slender iron quick question, do you want the amount of filename storage memory the same across ports, or just runs?
NRF only has 256b of sleep memory, so it's kind of our hard cap if we want next-file length limits to be the same across all ports
if not I can give STM32 512b of filename storage and just cap NRF at 128
@tulip sleet you might have input on this too, maybe
8.3 filenames should be enough for everyone
nrf sleep memory limit could be made larger. It's just that it reserves some RAM that can't be used for other purposes. But the actual RAM blocks are much bigger: it's not limited to 256 for hw reasons.
the RAM sections are 4kB or 32kB depending on where they are.
@slender iron how can I help? (BLE)
@ionic elk runs, not ports
@dry dove the thing we need most now is apps to connect to the device
I think I have a reasonable handle on the nrf internals
(though esp ble support would be awesome)
apps I can't do much. I can check the esp. when you say esp ble support, what do you mean more precisely?
implement _bleio based on nimble in esp-idf (I think)
ideally we'd get ble-only CP on ESP32s
we have an HCI BLE implementation of peripheral mode on ESP32, but I'm not sure you would use HCI if you were doing a native implementation. We use the HCI BLE impl for ESP32 co-processors: https://learn.adafruit.com/adafruit-airlift-breakout/circuitpython-ble
cool lots to learn, I don't know _bleio and my esp32 knowledge is fairly meh. I will check back in a couple of days (:
thanks!
The first :param: directive needs to be preceded by a blank line. Currently (see above snippets), the parameters are all clumped into 1 paragraph.
I also noticed [the busio docs still link to the ...
ps - If not all boards have
adafruit_bus_device, it would be nice to see which boards (in the module support matrix) haveadafruit_bus_devicebuiltin. However, that might be a more complicated solution given that the matrix seems to be generated with a py script (I think). So, that should probably be a separate is...
The presence or absence of adafruit_bus_device is included in the latest (7.0.0) docs.
Awesome. Thanks.
If you would like to submit a simple PR for the doc errors, that would be great.
I'd be glad to submit a PR for this.
[adafruit/circuitpython] Pull request opened: #4928 update busio & adafruit\_bus\_device device docs
resolves #4927
I also found/fixed some typos while making sure that sphinx's interlinking from busio docs works properly.
Great, thank you. I was in fact thinking of having a go at it this weekend, but youโre so much faster than I that you better just go ahead. I first want to take a look at what you did in #3454 and test it, so by the time I get to it youโre probably done.
Is it clear what my planned change regarding REPL runs was? I donโt recall the exact code change off the top of my head, but it was about removing the special case with MP_OBJ_SENTINEL.
I just clones a fresh copy from the repository after the update of the esp-idf.
I did the usual
./install.sh
. ./esport.sh
then tried to build the merto_esp32s2 and the build stopped without completing. [ It stopped with ````
658/658] Generating ld/esp32s2.project.ld
Has something changed in the process or did I miss a step.
Here is the log
jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ make BOARD=adafruit_metro_esp32s2 clean
...
Updated to add:
I repeated this on my Mac and the build completed normally
the failure was on Ubuntu Linux (20.04)
Additional update: It also works normally on my Raspberry Pi4...
Can someone else try this on an Ubuntu Linux system and see if this is reproducible?
I think this is the right place to post this, so if not please let me know. I have a funhouse connected to a relay for a lamp and a strip of neopixels, and when the PIR senses movement it causes the relay to turn on, turning on the lamp, the neopixel strip to turn off (it acts sort of as a night light when the lamp is off) and then there is a countdown on the display to say how long until the light turns off if there is no PIR input. Simple issue with the display ... it seems to be getting cluttered with stray pixels within only a few changes of the labels. The only way I've found to get rid of them is to reboot the funhouse, but then they just come right back. Is there any code to just refresh the screen from time to time?
My Funhouse, showing the issue of the stray pixels cluttering the screen.
@neat current this is a known issue. See this PR for its status https://github.com/adafruit/circuitpython/pull/4793
Thank you! I'd searched for it but I may have been using the wrong words.
Maybe I'm a bit rusty with GitHub ... but how do I apply this fix?
Are you set up to build CIrcuitPython locally?
Nope. Using the Funhouse from the Adabox is my very first dive into Circuit Python, and I have not gotten that advanced with it yet.
What do I need to build the library files?
It's a "process" - you first have to configure your system to build CircuitPython -- see https://learn.adafruit.com/building-circuitpython once you can build it locally -- you can implement the PR by doing git fetch origin pull/4793/head:pr_4973 git checkout pr_4973 then rebuild -- or you can just wait for the PR to be resolved and merged ๐
Thanks for the help. Looks like I have some reading to do
Since it is a rather simple change you could just edit the source code locally and rebuild rather than fetching the PR.
As someone who started recently with CP, and within a week wanted to do things that required building it myself, I can confirm that the guides make building really easy!
@jerryneedell It builds fine for me on ubuntu-20.04 and the CI also uses that build environment.
Perhaps there is something wrong with the state of the repo.
I tried this as well. I first did a git pull on my clone of adafruit/circuitpython. I got some errors at the end of that:
Fetching submodule ports/esp32s2/esp-idf/components/mqtt/esp-mqtt
From https://github.com/espressif/esp-mqtt
2b20b51..f10321a master -> origin/master
Fetching submodule ports/esp32s2/esp-idf/components/tinyusb/tinyusb
From https://github.com/espressif/tinyusb
* [new branch] esp-based_on_334e95f -> origin/esp-based_on_334e95f
* [new branch...
Hmm -- I did a complete reinstall and am getting the same failure.
If I run it without the -j8 I get an error message
jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ make BOARD=adafruit_metro_esp32s2 clean
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
rm -rf build-adafruit_metro_esp32s2
jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ make BOARD=adafruit_metro_e...
Ah -- the error is there with -j8 -- just scrolls by too fast.
@tannewt I asked about this yesterday in the deep dive chat.
From the discussion here https://github.com/adafruit/circuitpython/issues/2206 with @dhalbert
I thought the new CP7 USB endpoint customisation might make this easier.
But sounds like there is another subtlety that makes it tricky.
Appreciate it isn't high priority just now.
-- Found PythonInterp: /home/jerryneedell/.espressif/python_env/idf4.3_py3.8_env/bin/python (found version "2.7.18")
That explains the Python error. If you do this after the source export.sh, what do you see?
halbert@tuna:~/repos/adafruit/circuitpython/ports/esp32s2$ which python
/home/halbert/.espressif/python_env/idf4.3_py3.8_env/bin/python
halbert@tuna:~/repos/adafruit/circuitpython/ports/esp32s2$ python --version
Python 3.8.5
From the discussion here #2206 with @dhalbert
I thought the new CP7 USB endpoint customisation might make this easier.
It doesn't really help that much, though the internal structure makes it a bit easier to add another MSC device. But there still has to be code behind that to make the SD card visible, and that's not easy.
Thanks for the PR @2bndy5.
ahh
jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ which python
/home/jerryneedell/.espressif/python_env/idf4.3_py3.8_env/bin/python
jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython/ports/esp32s2$ python --version
Python 2.7.18
``` something is using python -- not python3
My Mac and Rasberry Pi only have Python 3 installed
@solar whale On my system:
halbert@tuna:~/.espressif/python_env/idf4.3_py3.8_env/bin$ ls -l python
lrwxrwxrwx 1 halbert halbert 15 Jun 26 10:02 python -> /usr/bin/python
So /usr/bin/python on your system is pointing to python2. I would suggest doing sudo apt install python-is-python3
Normally there is no python on ubuntu, to prevent this kind of version problem. Unfortunately the esp-idf expects there to be a plain python
somehow yours got pointed to python 2.7
On my system:
halbert@tuna:~/.espressif/python_env/idf4.3_py3.8_env/bin$ ls -l python
lrwxrwxrwx 1 halbert halbert 15 Jun 26 10:02 python -> /usr/bin/python
So /usr/bin/python on your system is pointing to python2. I would suggest doing sudo apt install python-is-python3.
Normally there is no python on ubuntu, to prevent this kind of version problem. Unfortunately the esp-idf expects there to be a plain python.
Somehow yours got pointed to python 2.7
That fixed it -- something changed since it worked yesterday.... oh well, closing
@tulip sleet Thanks -- not sure what happened, but nice to have it fixed....
Yea, I took a look at what is required for the setup to be able to compile the MicroPython and it looks like a lot of messing around with OS stuff since I don't have a linux machine. Since this is just something I'm doing for funsies and not a high priority, I think I'll just wait until the fix is made available in the release.
Great, thank you. I was in fact thinking of having a go at it this weekend, but youโre so much faster than I that you better just go ahead. I first want to take a look at what you did in #3454 and test it, so by the time I get to it youโre probably done.
I really didn't have to do that much to #3454, it was mostly just checking that the merge didn't break anything, and replacing those gotos with a loop skip. It took longer to just grok how the code needed to maneuver around deep sleep ...
Added a link to the UF2 install steps.
[adafruit/circuitpython-org] New comment on pull request #722: Update unexpectedmaker\_feathers2\.md
Images automagically compressed by Calibre's image-actions โจ
Compression reduced images by <strong>73.4%</strong>, saving <strong>5.06 MB</strong>.
| Filename | Before | After | Improvement | Visual comparison |
|---|---|---|---|---|
| <code>assets/images/boards/large/adafruit_macropad_rp2040.jpg</code> | 313.69 KB | 64.69 KB | -79.4% | [View diff](/adafruit/circuitpyt... |
Added this to the FeatherS@, also adding to the pre-release.
cc: @UnexpectedMaker
I'm going to review\test circup PRs that have been waiting to merge. ...
Images automagically compressed by Calibre's image-actions โจ
Compression reduced images by <strong>1.1%</strong>, saving <strong>178 bytes</strong>.
| Filename | Before | After | Improvement | Visual comparison |
|---|---|---|---|---|
| <code>assets/images/boards/small/sparkfun_micromod_rp2040.jpg</code> | 7.70 KB | 7.62 KB | -1.0% | [View diff](/adafruit/circuitpython... |
I feel like this is the most important one
https://github.com/adafruit/circup/pull/109
did the unique ID of nrf boards in the USB descriptor change on purpose on 7.x vs 6.3 @tulip sleet ? /dev/serial/by-id/usb-Adafruit_Industries_LLC_Feather_nRF52840_Express_277393FAED062097-if00 vs /dev/serial/by-id/usb-Adafruit_Industries_LLC_Feather_nRF52840_Express_723739AFDE600279-if00
notice how the pairs of hex digits are swapped
Closes: #4917 -- alternative to #4930.
I suspect this is the leaner alternative. The enhancement to mp_obj_get_array should be considered for upstreaming.
testing performed (nrf52840):
>>> t = time.struct_time(1,2,3,4,5,6,7,8,9)
>>> time.struct_time(t)
struct_time(tm_year=1, tm_mon=2, tm_mday=3, tm_hour=4, tm_min=5, tm_sec=6, tm_wday=7, tm_yday=8, tm_isdst=9)
>>> time.struct_time(tuple(t))
struct_time(tm_year=1, tm_mon=2, tm_mday=3, tm_hour=4, tm_min=5, tm_sec=6, tm_wda...
Thank you! I have an alternate idea and would appreciate it if you can take a look. :)
I did change it on purpose. Someone pointed it was reversed from the canonical order. I cannot find that issue right now; it may not have been in the circuitpython repo. I will look some more later.
original issue: https://github.com/adafruit/ArduinoCore-samd/pull/167
it might still be in the wrong order, but I think at least the nibbles are in the correct order now
I'd say we could use one more of the following:
- CIRCUITPY eraser - the CircuitPython build system knows the board configurations so that's why I based this on CPy. A "board database" would be nice in the long run, but it's not holding up progress. This requires only one build per board because it is not translation-dependent.
Is there a how-to for this yet? I think anything that can be installed should have an uninstaller
We have a Metro M0 board that we cannot get to load an ...
Hi, I'm seeing the same hang reported in an earlier comment - I'm reading from the mic and then playing audio in a loop. I'm on v6.3. Is this a known issue still? Can I read from the mic and play audio in a different way to work around this?
Also not sure if I should open a new ticket for this..
# Restrict value to be between floor and ceiling.
def constrain(value, floor, ceiling):
return max(fl...
@rjsdotorg this bug was about erasing the contents of the filesystem on the flash, not CircuitPython itself. You can erase CircuitPython easily enough by simply flashing any Arduino program.
If your Arduino IDE can't flash it, it's not CircuitPython's fault.
I have tested the new version and it appears to work fine in my game console menu use case. :+1:
Some code review notes:
Your goto replacement brings some changes in behavior, but I believe they are inconsequential:
- In the case of a reload-on-success, your version prints โCode done running.โ, mine didnโt. Arguable which is better.
- If
result.return_code & PYEXEC_FORCED_EXIT, the new behavior is wrong. However, as far as I can see, that never happens (PYEXEC_FORCED_EXITis o...
@tulip sleet thanks, if it was deliberate that's good enough for me!
do you have a non-CircuitPython program that also generates it? I'd like to make it consistent with something
it's mildly inconvenient for some automatic script of mine when crossing the boundary, but so be it.
Firmware
Adafruit CircuitPython 7.0.0-alpha.3-433-g5a4a80336 on 2021-06-25; Raspberry Pi Pico with rp2040
Code/REPL
import board
import pwmio
import pulseio
import time
pwmOut = pwmio.PWMOut(board.GP0, frequency=5000, duty_cycle=0x8000)
pulsesIn = pulseio.PulseIn(board.GP1, maxlen=100)
#GP0 and GP1 are connected by a resistor
results = []
while True:
pulsesIn.clear()
for i in range(20):
while len(pulsesIn) == 0:
...
@rjsdotorg Please bring this up in https://forums.adafruit.com or in discord (https://adafru.it/discord) and we can help diagnose. There are many possible causes for this.
Deep Dive w/Scott: BLE Privacy #adafruit
JohnPark tannewt
My point is 3rd paragraph down the top is my background.
Hi John and Scott. I enjoy both shows. I am by training software engineer but a jack of all tech. I gather requirements design code deploy support and maintain many times for many types of needs on many hardware platforms from mainframes to midrange to Server farms to desktop in the IBM and Microsoft world. Networks from the old IBM token ring to todays microwa. Locally and globally needed solutions.. I learned for example power in brazil is shut off 2 hours a day at X time. Probably not today anymore.
That said I always loved electronics and electricity but self taught. I started getting into embedded hardware programming primarily because of healthkits, sparkfun but mainly Adafruit. Those in tech that have had many projects and hats know how hard of job what ladayada has successfully accomplishedโฆ Taking ART and Tech people and allowing them to enter the mystic world of digital circuits โฆ I donโt think people really know how hard it was to do what she has done to this point with Adafruit!! Its amazing. For example I see she wrote a C library for the new macro keyboard to import by python to make it faster.. I love that.. She filled a need and showed how to use python the best way!!!
So I was watching both you john and scott talk about true multitasking. For years multithreading programming could be the end of ones JOB so easily ๐ But along thread programming. Ladyada introduced the Adafruit ISO1540 Bidirectional I2C Isolator - STEMMA QT / Qwiic PRODUCT ID: 4903 .
The main reason I purchased some of them was to play around with modularity and pass state change information back and forth to get around single cpuโs Even though the SAMD51 is plenty fast for doing most things. Yes I2C isnโt my love protocol like spi but it works for the concept of taking a circuit that does a feature and add it to another circuit that needs itโฆ think of feathers!!!
But now the RP2040 PIO has raised some interesting circuit design possibilities and questions. I havenโt even touched PIO or even the RP2040. I like the SAMD51 and teensy 4.1.
So I just wrote this to through my 2 cents in the talk about multitasking.. No my way wont work for many of your customers but it could intro duce the concept of real multitasking and asynchronous programming..
By the way assembly language is my favorite language but not practical for these now a days speedy change needs. But I am diving into assembly again with the ARM chips. I wrote compilers and pc games video controllers with different versions of assembly codeโฆ
Thank you
Bye
Does that mean that if the total of the durations stored exceeds 1 second, it goes into the paused state, and then you have to remove some entries and call resume()?
len in PulseIn is described as "Returns the current pulse length", when really it returns the number of pulse durations currently stored.
[adafruit/circuitpython] Issue opened: #4934 bytes and bytesarray do not validate arguments properly
This is present in 6.3.0 and 7.0.0. I didn't test earlier versions yet. bytes(1,2,3) should raise an error, but it doesn't.
>>> bytes(1,2,3)
b'\x00'
>>> bytes((1,2,3))
b'\x01\x02\x03'
Same is true for bytearray. bytes() does not take the contents as a variable number of arguments. It needs a sequence as the first arg.
CPython:
>>> bytes(1,2,3)
Traceback (most recent call last):
File "", line 1, in
TypeError: bytes() argument 2 must be str, not int
M...
This is more complicated than it first appears:
>>> bytearray(1,2,3)
bytearray(b'\x00')
>>> bytearray(1,2,3,4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: function expected at most 3 arguments, got 4
>>> bytes(1,2,3,4)
b'\x00'
bytearray and bytes are treated differently.
I think the reason the length check for bytes() is not done is due to #2220. We'll need to do the check without undoing that fix.
Okay, so small dilemma that i'm not sure what's happening
i'm working on a RP2040 design and it enumerates over USB just fine, but if i try to use the raspberry pi Pico to test (it has the same flash chip) it just disappears
it'll come back if i hit reset once as the default RP2040 boot loader
"it just disappears": is it your new design or the RPi Pico?
my new design
i killed my Pico a while back hehe...
anyway, i figured the Pico uf2 should have worked having the same flash chip and whatnot. maybe i'm wrong
so did you add your design as another board in the pico-sdk, and compile as that board? if there is any difference in the design then it would be in the board definition files
aside from a reset button, it's generally the same. i'm not doing anything special like reassigning the boot button as a user button or anything
pins numbers match GPIO numbers
it uses the same SPI NOR Flash that the pico uses
all i could say then is to proofread your design and also if you have built multiple samples, see if they all act the same way, or see if it's just a soldering problem on one board
@ornate breach we had some trouble on our boards with the clock crystal capacitance being slightly higher and not matched as well to the crystal caps as they could be. This caused the xtal oscillator to take much longer to start. So I added a longer delay in the xosc initalization. See https://github.com/raspberrypi/pico-sdk/pull/457
if you are not using the identical crystal and caps, then that might be an issue. Because of the way the bootloader starts up, this does not prevent the bootloader from working, but can cause application programs not to work
[adafruit/circuitpython] Pull request opened: #4935 time enhancements \- reset epoch, wrapped millis
-
At soft reset, always reset the monotonic epoch. This means that a "fresh" session will not have the accuracy problems that result when
time.monotonic()becomes a large float and the precision decreases -
A new function
reset_monotonic_epochin supervisor can reset the epoch to now; Careful use within a program can preventtime.monotonic()from losing "too much" accuracy. -
A new function
ticks_msin supervisor returns the possibly wrapped time since the epoc...
I ended up having to use a different crystal due to availability at the time, the only difference though was the ESR which was adjusted by changing the series resistor on the return path
try setting PICO_XOSC_STARTUP_DELAY_MULTIPLIER to something like 64 (default is 1)
capacitance was the same, using two 27pF capacitors. it didn't have 50ohm ESR, but 100ohm so i just adjusted the series resistor from 1k to 0.95k
it's hard to scope it, because any probe on the xtal oscillator will add capacitance
i scoped failure boards before and it was fairly stable
but that doesn't necessarily tell me much
it's that the startup time was much longer than a ms, and at the beginning it was running much higher than the spec'd frequency, so the clock to the SPI chip was too high and was also erratic
it's just one thing to try, but it's easy to try
i wish i had a digital logic analyzer and put some probe points on the SPI lines
how to I change the PICO_XOSC delay, is that in the pick sdk?
yes, search for that symbol and change it somewhere. You could change the value temporairly where it's used in xosc.c so you don't have to hack the board definitions. Just to see if it makes a difference
okay, i'll give it a try
do i need to load the pico-sdk stuff before trying to load the circuit python uf2?
it's just one thing to try; i have no idea how likely it is that's the problem
it might be that i'm just missing a step in the process
you could try the qtpy uf2 if the pins work at all for you; i think it's the same flash chip
that one uses the 64mbit chip vs the 16mbit
no, i'm suggesting rebuilding circuitpython, or a pico-sdk example, for your board, to see what happens
if you load CPy, it will erase whatever else is there
i did attempt to build the qtpy rp2040 but that threw some missing import errors
In file included from ../../py/obj.h:33,
from ../../py/mpstate.h:35,
from ../../py/runtime.h:31,
from ../../extmod/ulab/code/ndarray_operators.c:3:
../../py/qstr.h:42:14: fatal error: genhdr/qstrdefs.enum.h: No such file or directory
42 | #include "genhdr/qstrdefs.enum.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
you could try the blink program from the pico-sdk. If you haven't use it before, then you can study up on how to build an example program. If you don't have any other working RP2040 boards, then of course get another Pico
make sure you start from a clean build
same missing import error
//| def ticks_ms() -> int:
to match the name
This is a simple set of additions and is elegant. Just one doc typo.
what is your build command line?
macOSX terminal, using make clean BOARD=adafruit_qtpy_rp2040
could you upload the whole output of a failed run here, use the + on the left to upload a file
I think it would be good to explain this in a comment. It seems like a pretty random number.
it should not throw any error on make clean. It should just do the rm -rf build-adafruit_qtpy_rp2040
what does arm-none-eabi-gcc --version print?
fairly certain i bumped it to 10 a while ago
the last thing i build was a 6.3 uf2 for a samd21
i'm surprised that causes that error, i would have not expected make clean to fail in any situation, since it doesn't really do anything except rm -rf
@rjsdotorg Please bring this up in https://forums.adafruit.com or in discord (https://adafru.it/discord) and we can help diagnose. There are many possible causes for this.
Will do. Thanks.
clean:
$(RM) -rf $(BUILD) $(CLEAN_EXTRA)
.PHONY: clean
i recloned and now this is the output if i try to build the Pico sh o/autogen_display_resources.o build-raspberry_pi_pico/autogen_display_resources.c Traceback (most recent call last): File "gen_stage2.py", line 2, in <module> import cascadetoml ModuleNotFoundError: No module named 'cascadetoml' make: *** [build-raspberry_pi_pico/stage2.c] Error 1
same error building the qtpy rp2040
do git submodule update --init
This filled up a couple of m0 builds (non-adafruit products). I turned off rotaryio to let them fit.
we may want to decide whether resetting "monotonic" or providing a wrapping ticks_ms is a better use of limited flash, rather than trying to do both.
I ran that again and then tried to build after make clean and still the same issue
another interesting thing is on Windows the device shows no drivers available for the RP2040..
on windows as well, whenever i drag the uf2 over to the device, it just restarts and doesn't load circuitpython. just brings back of theRPI-RP2
Checking to make sure the flash chip has all good joints on the pins and will attempt things again. Downside if not getting a stencil for this
Maybe I messed something up, ๐คทโโ๏ธ
I wonder, can you use memoryview and slices to work around this?
@idle wharf while there's no PR on circup, I was thinking we could move it from master to main, and to the circuitpython orga if that's validated
๐
Is there a Weekly Meeting doc for 28 June yet? I only see the 21 June doc pinned up top
@idle wharf thanks, I will rectify that shortly
@idle wharf check the pinned messages again, it should be there now
As discussed in #3410, this is a micropython-compatible (though differently named) function that allows creation of useful time and deadline functions in pure python.
Closes: #3410
An alternative to #4935 which only adds the wrapped ticks and doesn't change the monotonic reference time.
supervisor.ticks_ms() โ int
Return the time in milliseconds since an unspecified reference point, wrapping after 2**29ms.
The value is initialized so that the first overflow occurs abou...
Looks good! But given the simplicity of the Python code you suggest in the documentation, should we:
- Make a simple library?
- Implement those routines in a native module? Perhaps a new
ticksmodule, or added to supervisor?
Once #4903 is merged, we will have the room.
Firmware
Adafruit CircuitPython 7.0.0-alpha.3-433-g5a4a80336 on 2021-06-25; Raspberry Pi Pico with rp2040
Code/REPL
import array
import board
import time
import pulseio
import pwmio
pwm = pwmio.PWMOut(board.GP0, frequency=38000, duty_cycle=2**15)
pulseOut = pulseio.PulseOut(pwm)
pulses = array.array('H', [1000,1000,1000,2000,1,1000])
while(True):
print(".")
pulseOut.send(pulses)
time.sleep(5)
Behavior
The ...
I wonder, can you use
memoryviewand slices to work around this?
Can you create two Array with the same backing buffer? Though if you can, that would risk making really hard-to-trace bugs if you accidentally trigger a resizing operation.
Passing something that's not an Array, or is an Array with the wrong typecode, throws TypeError: Array must contain halfwords (type 'H'). I could investigate what it's checking exactly and whether there's a reasonable way to fool it.
Yes. After 1s pulsein automatically goes in to the paused state. I call clear() and then resume() to restart capturing pulses.
A couple of parameters were missing from the signature line for display.Display.__init__(). Also I reordered one :param: line.
Discovered this by accident while researching https://forums.adafruit.com/viewtopic.php?f=60&t=180704, which is not about the docs, but is an existing Blinka displayio issue: https://github.com/adafruit/Adafruit_Blinka_Displayio/issues/54.
A few boards are still missing board.LED, for example, the Metro M4 Airlift Lite. Let's do a little audit and add it to the remaining ones.
@slender iron Adabot is currently being a bit uncooperative, so in the case it doesn't get fixed in time for the weekly meeting, here's the report https://gist.github.com/dherrada/6d0c6fdf2047e4a88e7838d644f39723
?serverinfo
@onyx hinge do you have a few minutes for a short audio or video chat re RP2040 audiopwmio? I am trying to debug it and had some random questions
<@&356864093652516868> Hello! CircuitPython Weekly meeting is in a bit over 2 hours. If you'd like to participate (whether or not you're attending!) please add your Hug Reports and Status Updates to the notes document. If you're attending and participating, we'll call on you to read your updates. If you're text-only or missing the meeting, we'll read them off for you. Notes doc: https://docs.google.com/document/d/16nG56rv4MQlL4aoAd1B1IGLTNUuWtWuGYIobBSX9Vag/edit Hope to chat with you all soon!
Google Docs
CircuitPython Weekly for June 28, 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 I missed your question earlier .. would it work for me to show up 15 minutes early for the whereby meeting?
sure, thanks, if it won't interfere with your lunch
I'll grab something real quick then hop on whereby when I'm ready @tulip sleet
i still have to eat, so I'll be there around 15 mins before
thanks @trim elm
LGTM! Just a couple things that need to be addressed.
if (len != 9) {
mp_raise_TypeError(translate("time.struct_time() takes a 9-sequence"));
}
return namedtuple_make_new(type, len, items, NULL);
np
@onyx hinge Did this end up without a setup.py deliberately? https://github.com/adafruit/Adafruit_CircuitPython_OV7670
@idle owl it should not be in pypi. what is the correct thing to do? (whatever it is will apply to ov2460 too)
@onyx hinge Replace the text in setup.py with a specific text stating it should not be on PyPI.
And name it setup.py.disabled
@onyx hinge https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/main/setup.py.disabled
@idle owl if that PR is right I'll do another one against 2640
or whatever the other number is
oh I guess 2640 had the file already. yay me for getting it right half the time
@onyx hinge Approved the PR. Merge when passing.
๐ Happily lurking.
lurking
lurking today too
quietly listening today
lurking today
doo-doooo.
@slender iron , I'm not lurking today for once
@turbid radish Please add your updates to the notes doc! ๐
@idle owl ni - link?
to calibrate....anything >80F = "hot" in seattle
Google Docs
CircuitPython Weekly for June 28, 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...
๐ก๏ธ
Next week's meeting is on July 6 due to the US holiday observed on July 5.
CircuitPython on a calculator? ....yep, it adds up.
The circup one snuck in after I grabbed links. Here is a link to that project: https://github.com/adafruit/circup
Adafruit Industries, Unique & fun DIY electronics and kits : - Tools Gift Certificates Arduino Cables Sensors LEDs Books Breakout Boards Power EL Wire/Tape/Panel Components & Parts LCDs & Displays Wearables Prototyping Raspberry Pi Wireless Young Engineers 3D printing NeoPixels Kits & Projects Robotics & CNC Accessories Cosplay/Costuming Hallow...
- In the case of a reload-on-success, your version prints โCode done running.โ, mine didnโt. Arguable which is better.
This was intentional, I didn't want the code to restart without any text indicator that it did so.
- If
result.return_code & PYEXEC_FORCED_EXIT, the new behavior is wrong. However, as far as I can see, that never happens (PYEXEC_FORCED_EXITis only used in the context of the REPL). So Iโm not sure why these lines had been there to begin with.
I will double chec...
These are effectively replaced by the new keypad module (#4877)
@deshipu @ladyada
@idle owl can you add the direct link to that guide page in the chat and/or notes document?
Guide is here! https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/starting-over-fresh
ah I found the Arduino guide and of course it doesn't have that page. no wonder.
No, it wouldn't ๐
Currently keypad is not turned off for all SAMD21 builds:
https://github.com/adafruit/circuitpython/blob/ae5080955e4be9a7f958dc8197662080c39dbe95/ports/atmel-samd/mpconfigport.mk#L53
So we need to turn it back on for some or all, especially those boards that depend on gamepad or gamepadshift for most of their use (e.g. pewpew boards) but there may be space issues for larger languages.
correction: "IS turned off" ^^
what platform?
@slender iron live stream on friday right?

Cats are always cool ๐
up to 115-117F today
.....115-117? oh yikes. ๐ก๏ธ
that's 47ยฐC for all of you people who use celsius
And here I thought that 98F was hot in Northeastern PA
Per Google, the average Death Valley temperature in July is 116F.
(there is an icepack in the towel)
oh circuitpython org bundle ! that's cool we can test adding another bundle to circup with that (and also add it by default)
Baby sparrows in the "birdcam" birdhouse
Not to be confused with The Palisades in NJ along the Hudson River, also known for steep rock formations ๐
Nice! I'm interested in looking into the project bundling process as well. Hoping it will be possible to have community and circuitpython org libraries (and any future bundle libs) included in those project bundle downloads.
oh we had a couple of pigeon eggs in the attic, they are about to learn to fly
willfully misparses @jaunty juniper and wonders how a pigeon egg can fly
additional steps omitted for brevity ๐
https://learn.adafruit.com/retroreflective-green-screen-light-ring-controller I much want to build one of these as well
the circup version that was just released supports the community bundle, via a static list of bundles in the code (a bundle being identified by the user/repo string), you can just add "circuitpython/CircuitPython_Org_Bundle" to BUNDLES_DEFAULT_LIST to test how circup fares with it. The Bundle class init pretty much encapsulates all the url/file paths assumptions about the bundle format (plus the clean_library_name function)
my "ac" hack. mcp9600 tc with emc2101 controlled 12v pc fan ramping up based on temp. coded in cp. ๐
Nice, I'll give it a try
@onyx hinge If you get the reflective fabric from ebay, let me know. I'm hesitant to get a few yards of it without knowing the seller has the right stuff.
@modern wing I ordered mine on Ebay and so did Anne. We both ordered from different sellers. The stuff I got is definitely right.
@idle owl Awesome, thanks so much for confirming that. I'm assuming from the links in the guide?
I got my MacroPad just now
@modern wing I don't remember if it's from those links. Ping me after the meeting and I'll point you to the two sellers.
Sweet, thanks ๐
....wait, there's only 24 hours in one day?
Alpha if that's the case. Sooner is better.
@idle owl also curious how much material you ended up using.
@onyx hinge We ordered 6 yards. We haven't set it up yet, but we ordered "enough". The place that could get it here in time was 39in wide, so we'll probably double it up.
We have an idea of what we're doing and 6 will work for us.
My plan is going to mount it on a rope/metal wire, sew the seams, put in some grommets....and make it essentially a curtain. I totally don't have the space for a rigid setup, nor for a permanent installation.
co-locate it with stuff like hsv->rgb coverters?
I'm thinking that colorwheel is a conversion utility that takes a "linear" input and produces RGB for a given spectrum of colors.
^^ yes
spectrum could also be called a palette.
rainbowio
fancyLED would otherwise be a natural place for it
simpleio?
I for one didn't know _pixelbuf.colorwheel existed, and I keep having to copy and paste a wheel() function or self-contained module every once in a while
Another use of colorwheel is to create a bitmap palette list.
>>> _pixelbuf.colorwheel(22)
12403200
I made notes for ensuring they work the same.
Thanks everyone for another excellent meeting.
Thanks all
Thanks!
thansk everyone
We discussed this in the CircuitPython Weekly and decided that rather than rename anything, we can make a colorwheel() native CircuitPython module with a matching Python library for instances where the module is not enabled for a particular board (in the event that this is an issue).
We also need to ensure that the native module and the Python version work the same (there was concern about what is returned, a tuple or an integer - it appears the current Python version is different from t...
@idle owl I'm thinking:
- fork or otherwise copy the repo for
adafruit_pypixelbuf, rename it toadafruit_pixelbuf, and removecolorwheel(). Add the newadafruit_pixelbufto the bundle. Change guide code and neopixel/dostar libraries to useadafruit_pixelbuf.
Create a newadafruit_colorwheelPython library or whatever we want to call it. Implementadafruit_colorwheelnatively in 7.0.0 as well. Also in 7.0.0, rename_pypixelbuftoadafruit_pixelbuf.
the advantage of the copy/rename is that it's like a new version that we can use immediately
Then, what, archive adafruit_pypixelbuf? Or...?
later, after 7.0.0 stable is out
Ok, fair enough.
you can change adafruit_pypixelbuf.py to read from adafruit_pixelbuf import *.
or slightly more complicated if wheel is out of adafruit_pixelbuf
Oh hmm. Then you need both? But it's backward compatible?
so it would be a shell of a library
Well yeah colorwheel will break things. But that was expected.
feel free to close that PR in pypixelbuf I just filed, it probably ends up being unneeded with the rest of this
Ok.
it only exists for backward compatibility and then we can drop it.
Ok. I'm on board with this.
I will paste my tentative recipe in that issue
Sounds good. I think I follow anyway. I mean I follow the crux of it, not so much the technical aspect of it, but we'll get there.
i"m thinking:
Fork or otherwise copy the repo for adafruit_pypixelbuf, rename it to adafruit_pixelbuf, and remove colorwheel(). Add the new adafruit_pixelbuf to the bundle. Change guide code and neopixel/dostar libraries to use adafruit_pixelbuf.
Create a new adafruit_colorwheel Python library or whatever we want to call it. Implement adafruit_colorwheel natively in 7.0.0 as well. Also in 7.0.0, rename _pypixelbuf to adafruit_pixelbuf .
@jepler notes we can change `ad...
OK, afk! thanks again all, and have a great week
@tulip sleet can CP do hidraw?
@errant grail Disconnected you from the audio chat to avoid surprises.
Thank you.
There is latent support, but I haven't tried to get it to work. Currently it would supplant all other HID devices.
@tulip sleet ok. thanks. i'll take that as no. it'd be for a guide project, so don't want to do anything too hacky.
We had a stronger motivation once upon a time, to supplant FT232H, but the MCP221A stepped in
I read that as hi-draw and wondered what that even was. I realise now I am reading it wrong.
pronounced "hydra" ;-)
Well, it is now. ๐
for all the precision you need to get computers do what you want, programmers sure do love ambiguity
Agreed.
Here is the notes document for Tuesday'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/1g_QB0qxg528hkBo45Li_ROzIdkxiCx5j8t3EeJMPIxk/edit?usp=sharing
Google Docs
CircuitPython Weekly for July 6th, 2021 THIS MEETING IS ON TUESDAY! 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...
The silk indicates the rotary encoder pins to be ROTA and ROTB. The BOOT button pin on other RP2040 boards where it is available in CircuitPython is called BUTTON, so I added that as well.
Sorry I missed the meeting and did not provide notes. It was my first non teleworking day, I am/was wasted by commuting. Nothing to say anyway except group hug and that I am in a retrogaming trip on PS Vita, and Pi4.
no problem! thanks for saying hi
Hi everyone!
I have been trying to do a port for the SAML21, we have circuit python compiling alright but it isn't working, i have been trying to debug with cortex-M and visual studio code but have no luck finding the bug, we have already working a tiny USB port working (https://github.com/hathach/tinyusb/pull/895), we are using the same configuration on ASF4 for clocks and init them but it seems to be breaking when intializing the stack i think.
Does anybody here know how the ld constructor script works?
Does anybody have manage to debug circuit python with cortex debug?
I wrote the ld constructor script. We debug with Segger J-Link
i have a segger jlink plus, i have kind of debbuged with the GDB but when doing the steps in some time it gets like null pointer, so i was wondering if the ld script is working bad since it was intended for samd21 instead of saml21
In case it helps as a point of reference, I have done the rebasing here: cwalther/getprevtraceback2. I havenโt checked very carefully whether the merging is sane (in particular, whether the change to rgb_led_status.c should really be gone without replacement), but it compiles and runs.
The script is fairly straightfoward; it just figures out where to put things in flash and RAM, depending on the size of various features like microcontroller.nvm. It is not very architecture dependent. Does the SAML21 have something different about how it does the ISR vector? I'd suggest turning off as many features as possible, and then trying for a minimal implementation. If you have compiled DEBUG=1, the null pointer location should be identified. If you set a breakpoint at main(), does it fail before it gets there?
nope it is failing inside main()
do you know which line it's failing on?
im gonna debbug again to search it cause right now i dont remember, how do you use the segger jlink to debug? with gdb too?
yes, compile with DEBUG=1, set a breakpoint at main(), and then start single stepping. Or you could set a breakpoint on reset_info_safe_mode() which is called whenever something bad happens, and examine the stack.
Please document this. For ports where UF2 is the only bootloader we should make UF2 and BOOTLOADER equivalent.
Thank for taking a look at this! Just a couple things.
My typical pattern is:
Start gdbserver for the board
target extended-remote :2331
mon reset
load # if needed
mon reset
# set breakpoints
c
are you using external flash?
no im not using external memmory
that is probably simpler for now
so you can just start with the above, let's see where you get
I've fixed build errors and explicitly enabled keypad on:
- 8086_commander
- pewpew_m4
- ugame10
All other boards that HAD gamepad or gamepadshift seemed to already have keypad enabled.
this is completely typical for a new port bring up
Hi @tulip sleet im doing the compiling stuff and debbuging
did you refer to the wait_for_safe_mode_reset() function inside main?
no, reset_into_safe_mode() , which is in supervisor/shared/safe_mode.c
you can just say bre reset_into_safe_mode
HardFaultHandler in ports/atmel-samd/port.c calls it if there is a null pointer, etc.
this ' bre reset_into_safe_mode ' inside gdb client?
one early to do is to verify your clocks by using PWMOut to send out a signal of a known frequency and then measure it with a logic analyzer or scope
All other boards that HAD gamepad or gamepadshift seemed to already have keypad enabled.
Before I added keypad, pretty much all the SAMD21 CIRCUITPY_FULL_BUILD boards had gamepad, i.e. there was something like:
CIRCUITPY_GAMEPAD ?= $(CIRCUITPY_FULL_BUILD)
I had to set that to 0 for all SAMD21 to get the builds to fit. So if possible it would be good to put keypad back in the CIRCUITPY_FULL_BUILD
We have passed that test already, the clocks seems to be ok
right. that will set a breakpoint on that routine's entry.
FYI @gamblor21 for next time.
that whole guide may be helpful. It has J-Link and openocd mixed so ignore the openocd stuff
OK perfect
i will put the breakpoint there
I think this is not right? It's still inside i2c_device.
I was going to make these comments; I'm a little late.
I think this is not right? It's still inside spi_device.
do you know about the backtrace (bt) command?
@geecrypt Please open a new issue with a reference to this one. New issues are easier to track than comments on closed ones. Thanks!
when you hit the breakpoint, issue a bt so you can see the stack trace
@DavePutz Any thoughts?
ok its not breaking there
could you paste the error you see then?
Would you mind making a pull request to update this? It's from here: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/pulseio/PulseIn.c#L240
so i issue a Ctrl+c
after some Run and Ctrl+C i can see it does not move from the RTC function
why does circuit python uses RTC?
Its just they way the docs are laid out. Initially I tried ~adafruit_bus_device.i2c_device.I2CDevice, but the rendered docs didn't "auto-link" correctly. You're correct though; these classes do exist in their own module (as they do in the pure python lib also). I didn't pursue fixing this inconsistency because the tilda ~ hides the inconsistency.
to keep calendar time; you can set it to the actual time if you know it. So maybe do another build with CIRCUITPY_RTC = 0,
Same reply to previous comment about i2c_device
Since the new keypad module is taking over gamepad functionality,
I'm switching to it. If this works well, I will make the change
for the remaining boards.
I'm suspicious that there's some odd issue, but don't worry about it for the doc purposes. You did what you had to do. I was just helping a user today who seemed to be getting the builtin module in one case and the Python module in another, depending on how the import of adafruit_bus_device was done inside several different libraries. https://forums.adafruit.com/viewtopic.php?f=60&t=180698. That may be related to the linking difficulty you saw, but I'm not sure why.
Perhaps there is some difference with the RTC peripheral between SAML and SAMD
Please don't merge this until all examples and libraries have been updated.
but it was already declared on 0
๐ค
hmm, so are you saying it's looping in that interrupt handler? I don't remember if we enable the RTC all the time for other purposes. @steel granite mentioned a null pointer, but we're not seeing that right now
RTC is always on
i think that nuller pointer error was fixed with the new ASF4 because later i was able to see it too
since it powers monotonic
(later = last week)
ok, yes, the rtc is set up in ports/atmel-samd/supervisor/port.c, and perhaps there's something that must be done differently there. In fact, it has #ifdef SAMD21, so it's not doing anything for SAML21, I assume. There are many places where we check for SAMD21, so those places should be inspected for what you need to do for SAML21. Perhaps it's the same, so you could check for either.
ok
sorry, I have to go to a mtg now! will check back in a couple of hours
that looks ok
and its never getting into the 3rd breakpoint
the third breakpoint was at board_init(); and it never reaches it
Then you could "step" (gdb command) into filesystem_init, or set breakpoints inside it instead.
Yes! thanks we are right there haha
it seems to be this function on line 101 in filesystem.c
res = f_mkfs(&vfs_fat->fatfs, FM_FAT, 0, working_buf, sizeof(working_buf));
That's going to enter code that writes to the filesystem, which if I understand correctly is in the microcontroller's flash .. it could indicate a problem down in ports/atmel-samd/supervisor/internal_flash.h
we type next on that function and never stoped again
okay
or you could comment out the f_mkfs call and see whether writing to the flash is the only problem
you wouldn't get a CIRCUITPY drive but you might get a USB serial REPL
btw if flash code is wrong, problems could include erasing/writing the wrong block which would corrupt parts of the program firmware
well the flash code is the problem, and now i just realized the USB_init too haha
sounds like you know where to concentrate your efforts then! That's great progress.
thanks!
The messages given by standard Python when this constructor is used wrongly are varied:
TypeError: structseq() takes at most 2 arguments (5 given)
TypeError: time.struct_time() takes an at least 9-sequence (5-sequence given)
TypeError: constructor requires a sequence
TypeError: time.struct_time() takes an at most 11-sequence (14-sequence given)
In this case, I think it's worth considering that taking away one of those messages doesn't actually hurt error checking (incorrect c...
well now we have a Serial REPL working, the flash is the problem
That's another great step. I'd be thrilled to get that on my screen ๐ I'm sure you'll figure out the flash problem too @fathom violet
well it jst worked one time haha
[adafruit/circuitpython] Pull request opened: #4943 remove 'double\-wide' characters not in the font
I noticed the build printed things like
Font missing 3 characters
.. this is why.
We can't make it an error, because Japanese has hundreds of characters
not in the font.
On further reflection, I've accepted your suggestion. Thanks!
I'll re-disable gamepad whereever it doesn't fit based on the above builds, and then wait for the signal that this can be merged.
@jepler Thanks for making the requested changes. I pushed a commit to fix a minor issue with the docs.
Firmware
Adafruit CircuitPython 6.3.0 on 2021-06-01; Teensy 4.0 with IMXRT1062DVJ6A
Code/REPL
import board, digitalio
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
led.value = True
Behavior
N/A
Description
Obviously the code runs fine, and turns on the on-board LED. However, I also have an LED wired up to pin D11, and when I switch D13 out for D11 in...
LGTM! There is a missing " which is causing the CI failure.
msgstr "wรบ fว xiฤ rรน sleep_memory."
@jepler please don't disable gamepad on pewpew_m4 without first merging https://github.com/adafruit/circuitpython/pull/4942 โ the Stage library needs to be modified to use keypad.
Firmware
Adafruit CircuitPython 7.0.0-alpha.3-452-g8a5a7457a on 2021-06-29; Raspberry Pi Pico with rp2040
Code/REPL
import board
import digitalio
import pulseio
import time
#GP0 to GP1; GP2 grounded
print("start")
digitalOut = digitalio.DigitalInOut(board.GP0)
digitalOut.direction = digitalio.Direction.OUTPUT
time.sleep(5)
print("creating PulseIns")
pulsesIn1 = pulseio.PulseIn(board.GP1, maxlen=20)
pulsesIn2 = pulseio.PulseIn(board....
Firmware
Adafruit CircuitPython 7.0.0-alpha.3-452-g8a5a7457a on 2021-06-29; Raspberry Pi Pico with rp2040
Code/REPL
import board
import pwmio
import pulseio
import time
pwmOut = pwmio.PWMOut(board.GP0, frequency=10000, duty_cycle=6554)
pulsesIn = pulseio.PulseIn(board.GP1, maxlen=100)
#GP0 and GP1 are connected by a resistor
while True:
pulsesIn.clear()
while len(pulsesIn) < 20:
pass
for i in range(20):
pr...
FREEZE ../../frozen/circuitpython-stage/ugame10
Traceback (most recent call last):
File "../../tools/gen_nvm_devices.py", line 2, in <module>
import cascadetoml
ModuleNotFoundError: No module named 'cascadetoml'
make: *** [../../supervisor/supervisor.mk:63: build-ugame10/genhdr/devices.h] Error 1
what am I missing?
now I pip-installed cascadetoml, but I still get ValueError: Missing root .cascade.toml
maybe update submodules ?
oh weird
ah, it's because pewpew_m4 doesn't use a flash chip
oh well, I guess I won't do it before my vacation then, I will try again next week
the file it's looking for is data/nvm.toml/.cascade.toml, nvm.toml being a submodule
@tulip sleet FYI - regarding the issue I had recently with python2 vs python 3 on Ubuntu. It turns out that the problem was VirtualBox. I need it for a project I am doing and when you install it, it install python-is-python2 !! I kept installing python-is-python3 which uninstalls virtualbox6.1 -- All was fine but when I reinstalled Virtualbox6.1, it reinstalled python-is-python2 -- My workaround is to manually change the symlink in /usr/bin to point python to python3. Now I can build esp32s2 AND Virtualbox seems happy....
I don't understand how to do it. I clicked through what looked like the normal "contribute" sequence, and it seems to have filed the request against my own fork. And when I click the "new pull request" button over here, it seems to want to file it against micropython.
That is ... silly, and presumptive of virtualbox. I'm not sure why it should care, but I guess it has helper software that calls on python instead of python2.
Some googling indicated it is a known annoyance, but so far it seems OK with the symlink redirected. Python2 is available if it needs it.
i have found that the free vmware works better than virtual box and is less idiosyncratic, but it is proprietary. On the other hand, Oracle is hardly a paragon of any kind of virtue
I'm just realizing how many little pieces were set up beforehand to make the camera to displayio pipeline work .. bitmaps as memoryviews is a big one. Lucky(?) that I had happened to write that stuff in the recent past.
I should give vmware a try... but mostly I should finish the project (for my former employer) and be done with it.
Or have them provide me a Windows computer....
I like libvirt personally
@stuck elbow not familiar will libvirt -- I'll look it up as well. Thanks.
@solar whale it's the open source vittualization solution, it comes with a gui in the form of virt-manager, but you can also drive it entirely from the command line
I'll have to do some reading. It is not clear how I can use that for running the applications I need, but it looks intriguing.
libvirt generally uses KVM as the hypervisor
virt-manager is a GUI and installing virt-manager (its package name is just virt-manager) will install libvirt
libvirt comes from Red Hat
since you're on linux, its a million times easier to use and manage than virtualbox
and allows nice things like PCIe passthrough and full device virtualization via KVM and all the performance that KVM has
(since KVM is the default "driver" on linux)
Sounds great -- I just need to wrap my head around how to use it. Thanks for the tips.
tbh, just use virt-manager because the GUI in that is really straight forward
if you use your virtualbox VM's disk as the boot disk for your KVM VM, it'll just boot from where you left off
AH -- thats the big picture I was missing...
(that is if you don't need to convert the disk image first but that is just installing qemu-utils and using qemu's disk image converter)
virt-manager is the GUI
sorry I should have made that a little more clear
I use it basically daily because I'm a sysadmin by trade
That makes a lot more sense than what I was picturing. I will take a closer look at it.
nw!
This looks totally plausible but I can't test it.
This was tested by Discord user @ Zenith -- #help-with-circuitpython message

i reviewed & merged #4942
(โฏยฐโกยฐ๏ผโฏ๏ธต โปโโป
what did the table do to you? ๐
Hi all ๐ and @idle owl
I'm Silvia, and I'm new to contributing to Adafruit projects (or any open source project, actually)
So I picked a "good first issue" to start with.
Not sure it's the correct label for issue 18 https://github.com/adafruit/Adafruit_CircuitPython_TCS34725/issues/18 but whatever, go big or go home, right? ๐
I think I found the source for the calculations.
Nice! Ok. Have you worked with Git/GitHub before?
very little, and loooooong time ago, but i'm reading stuff to figure it out
your guide is very detailed and helpful, thank you
Ok, that's what I was going to suggest. Best thing to do first is comment on the issue to the effect that you think you've found the calculations and are choosing to work on it.
The next step is to implement it locally, and then submit a PR. We welcome early-and-often PRs - it's totally ok to submit something not ready to receive feedback on it.
I wanted to discuss it first, because I don't think there is actually much to do.
From what I can figure out, the code works fine at the moment, and the calculations are correct.
But since people can't figure out where they are from, I could add some comments about it?
Also, the simple example given for the library is not very useful, it doesn't show how to use the sensor to read colors, just the color temperature
Yeah that would work, but I'll be entirely honest, we're sometimes not great with keeping up with issues. That's why I suggested a PR, but I see what you're saying, and think commenting on the issue first would make sense.
Carter created the issue, so I can tag him to ask him to follow up with you.
there is also a PR for the issue, and both are rather old, so maybe it would be good to get rid of them ๐
We're trying to get through all the old PRs on libraries. Some will end up closed, yes.
@tulip sleet Ok I'm going in circles. I can't get the submodules to update on this repo. It appears to be tied to the move to main on the submodule repo. I really wanted to figure this out on my own, but this is turning into a waste of time. I need help.
which repo
git submodule update --init works, but it checks out a commit from 22 days ago, and won't find anything newer.
The circuitpython-org repo, and the adabot submodule.
cd into the the submodule repo. Then do git pull, and git checkout main. That should bring you to the latest commit on main
Ok, I wasn't sure that was a valid way to do it.
I did try that and it worked.
But then I second guessed it.
it's confusing because a submodule is set to a particular commit, which could be ANY commit. You've now advanced the commit to the one you want, so when you cd .. and do git status you'll see it's "modified", and then you can commit that
Ok.
I had to specify git pull origin main to get it to work. git pull told me to stuff it and be more specific.
however you do it, you just want to get to the commit you need, and then commit that commit in the parent repo
i think you could have done git fetch
That's where I'm now confused.
It wants to commit everything in the repo now doesn't it?
or git fetch --all to make sure
not the commit.
what's the message that makes you think that?
Hold on.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: adabot```This isn't the whole repo? It's only the commit?
The whole repo folder I mean, with files in it.
Or wait, it would be making the files all separate lines if it was doing that.
that just means that the submodule adabot's particular commit has been updated
๐ this is a more thorough explanation: https://git-scm.com/book/en/v2/Git-Tools-Submodules
@austere acorn Let me know when you've posted to the issue and I'll invite Carter to take a look.
I left a comment on the issue 18 github page, but I forgot to tag anyone
No worries, I was already on it, so I got the email.
we should probably spend some time refactoring the CI to only build the minimum needed
@dmcomm Would you like to help fixes these pulseio issues you are finding? We'd be happy to help get you modifying and debugging circuitpython internals. I'd suggest joining the discord and saying hi in #circuitpython-dev to get started. You can join via https://adafru.it/discord
I think we're sampling at 1mhz to get the 1us resolution. Any pulse shorter than that would break the contract for what we can measure and all bets are off.
These are 10us pulses in the example, which should be within the range of what it can measure.
Supposing there was a <1us pulse, it would be fair to ignore it completely, but I'd say switching the polarity of the output is still a bug. Either we detected it or we didn't.
If the pulses and gaps are both too short, then indeed all bets are off.
@tulip sleet Why is there no board.DISPLAY for the MacroPad?
I am looking at FunHouse and I don't quite follow how to add it.
Actually maybe I do.
Should I add it?
Nevermind.
I had the tab still open from an earlier commit. It's already in there.
Though I'm unclear on how board.DISPLAY is used now.
@gilded cradle Looking at PortalBase and FunHouse libs, it looks like board.DISPLAY is supposed to be the intialised display? But it's saying nonetype object has no attribute show when I try to use it on the MacroPad. Am I missing something obvious?
For a minute I thought maybe I had a version of CP too old to have board.DISPLAY in it, but it's there.
@idle owl I am not sure whether the MacroPad build has the display set up properly. I was going to look at that but don't have time at the moment.
Ok.
Sorry, that's more than I want to take on at the moment. If I'd known how this was going to go, I probably wouldn't have started, but I hope it was useful ;)
@idle owl @stuck elbow was helping out earlier with setting up the display, I think it got merged but there might still be problems (neither of us had the HW to test) -- https://github.com/adafruit/circuitpython/pull/4949
Hmm.
I'm running the latest build.
There haven't been any more since I grabbed the last one.
I use the same code on my samd21 board with that display, and it works, but maybe on the rp2040 you are supposed to refer to the display differently somehow
is there any other rp2040 board with a built-in display?
Not that we make, or that I have @stuck elbow
Says someone else tested it though.
So maybe I'm doing something wrong?
Yeah
but we didn't check if board.DISPLAY works
the board.DISPLAY doesn't seem to be doing what it should.
I copied that code from the samd21 boards
Ah. Hmm.
it might be a bug in the rp2040 port
@stuck elbow thanks for helping out @idle owl. It sounds like you may be on the right path.
@idle owl what's not working? i'm trying latest build and seems ok?
Adafruit CircuitPython 7.0.0-alpha.3-456-g826e25989 on 2021-06-29; Adafruit Macropad RP2040 with rp2040
@tidal kiln Seems ok how? That's what I'm on.
What did you do to test it?
That's why I'm not sure I'm doing anything right.
import board
import displayio
import terminalio
from adafruit_display_text import label
WIDTH = 128
HEIGHT = 64
display = board.DISPLAY
# Make the display context
splash = displayio.Group(max_size=10)
display.show(splash)
# Draw a label
text = "Hello World!"
text_area = label.Label(
terminalio.FONT, text=text, color=0xFFFFFF, x=28, y=HEIGHT // 2 - 1
)
splash.append(text_area)
while True:
pass
That worked?
yep. got hello world on oled.
check version also? it was merged only hours ago.
but before that there was no board.DISPLAY so it would be an AttributeError
yah...hmmm
and not None
This code runs, but I'm not seeing anything on the display but the same stuff as earlier.
@idle owl do you see the REPL on the display when you reset the board?
Yes.
Adafruit CircuitPython 7.0.0-alpha.3-456-g826e25989 on 2021-06-29; Adafruit Macropad RP2040 with rp2040
>>> import board
>>> type(board.DISPLAY)
<class 'Display'>
>>>
REPL stays up with that example running.
what do you get with that?
hmm..should i add a call to release to example above?
no you are not
There it is.
Ok. So whatever I did with it earlier was wrong, but board.DISPLAY definitely works, so I can use it in this library. As long as I figure out what I did wrong earlier. ๐
@stuck elbow @tidal kiln Thank you for going on this adventure with me ๐
np
I'm disappointed it was a me-problem and not a bug. I love bugs.
I'm sure there are plenty still lurking in there
@tulip sleet You're working on RP2040 audio, right?
One can hope!
yeah, but I stopped to do the keypad guide, then will go back to that
That's fine, wanted to know if it was sorted yet or not. I put a # TODO in the lib to add audio once it's sorted, and wanted to make sure I hadn't missed the fix going in already.
@tulip sleet I wonder how I should proceed with updating the Stage library code for pygamer/pybadge โ do we still want stage in them?
are there guides that use stage?
the ugame10 seems to be running super-slow with 7.0 for some reason, not sure if I can keep supporting it
@tulip sleet there is one
it's from before displayio IIRC
i don't know how to think about this now. we should figure out why ugame10 is slow, because it may be a symptom of a bug
could you ping ladyada in an appropriate issues? I would defer to her thoughts on that
I think I will create an issue for this then
@idle owl perhaps you should add a check to see if board.DISPLAY is None and if so, direct users to update their firmware?
@gilded cradle They need to be running the latest to have keypad anyway. So hopefully we'll have a new alpha release soon with all of that in it. Right now, you have to grab it from S3 regardless, so I don't see the point in having the check for backwards compatibility.
Ok cool.
you wouldn't get None, you would get an AttributeError, but of course you can check for that
Right.
Not concerned about that. I imagine we'll have a new alpha/beta by the time this lib is released.
@tulip sleet What happens if you button mash, is there a way for keypad to return an array or list or something?
Button mashing your example returns three things in pretty quick succession, but they appear to be separate events.
all the mashes correspond to keypresses. They are returned in the order scanned. So you can't distinguish mashing from consecutive. We could return a timestamp in the event, but we don't do that right now.
Ok.
do you have a use case for mashing?
My use case is button mashing. ๐
No, I am exploring what this can do and tried to do that and it didn't do anything different.
So I asked.
ok, I will add an event.frustrated flag
๐ Well played.
which corresponds to mashing
you really have to be very lucky to get two events in the same 20ms timeframe
especially since the buttons also bounce
Fair enough. I guess I was thinking of some previous code where it showed multiple keys at once. It's not a need, it was simply a question.
the way you usually do this, you record the press and release events, and keep track which buttons are currently pressed using that
Ah ok
So it's something to do in user code.
The library simply makes the keys object available.
so you totally can have several buttons pressed at once, you just get separate events for pressing (and releasing) each of them
Ok makes sense
yes, it's up to user code to track the state
Alright. I'm on board with that.
I'll have to put together an example for that I suppose.
I do this like this in the Stage library: https://github.com/python-ugame/circuitpython-stage/blob/b014aa045d9014b86a4ae583f452c6b8282a61b9/pewpew_m4/ugame.py#L29-L39
Ah
but that also latches presses, to emulate the original behavior of gamepad
last_state is what keeps track of what is currently pressed
(I use bits, but you can use a set instead)
Good to know.
is the idea with rtc.set_time_source that it can be set to a real RTC and then time.time() will be based on that? i.e. - be actual time if RTC is set correctly
>>> time.localtime()
struct_time(tm_year=2021, tm_mon=6, tm_mday=29, tm_hour=15, tm_min=43, tm_sec=56, tm_wday=1, tm_yday=180, tm_isdst=-1)
>>> time.time()
678296640
>>>
checking value in python3:
>>> time.gmtime(678296640)
time.struct_time(tm_year=1991, tm_mon=6, tm_mday=30, tm_hour=15, tm_min=44, tm_sec=0, tm_wday=6, tm_yday=181, tm_isdst=0)
(that's the epoch being 2000)
yes, I think that's the point
should the values above agree then? seems like localtime is working but time is not?
that happened during the Micropython merge, (and I agree with Scott that we can switch back to 1970) https://github.com/adafruit/circuitpython/issues/4893
ah...there it is...thanks.
(because there is more than just the doc to fix, for no known benefit)
looks like scott is arguing to go back also
ok. this is probably just a temporary thing with 7.latest.
thanks @jaunty juniper @tulip sleet
I thought I saw some code using set_time_source but I can't find it and this guide doesn't for example https://learn.adafruit.com/adafruit-pcf8523-real-time-clock/rtc-with-circuitpython#usage-2933510-5
i found it in an example in the GPS library:
albert@tuna:~/repos/adafruit/Adafruit_CircuitPython_Bundle$ ag set_time_source
libraries/drivers/gps/examples/gps_time_source.py
24:rtc.set_time_source(gps)
libraries/drivers/gps/adafruit_gps.py
315: """Return struct_time object to feed rtc.set_time_source() function"""
import board
import rtc
import adafruit_pcf8523
pcf = adafruit_pcf8523.PCF8523(board.I2C())
rtc.set_time_source(pcf)
that's what i'm doing. works fine now that i understand the epoch base.
ah I didn't ag in the right directory !
i love grepping through the bundle to find things
if only there was a way to pipe that output to something that would paginate it for easier viewing
You always want more, were you could do with less...
No objections from me. In general, preference is to do whatever cpython does. AFAIK, that's still 1970 based?
https://circuitpython.readthedocs.io/en/latest/shared-bindings/rtc/index.html#rtc.set_time_source can be set to MCU RTC or external
@unexpectedmaker, ESP-IDF4.3 was merged so you should be clear to look at this again.
@slender iron what is the status of BLE workflow? Is it possible to add boards which only support bluetooth?
the file transfer code is checked in
there isn't a ble-only example yet
but it shouldn't be too far off
I'm distracted by web bluetooth at the moment
the CP side isn't very useful without a host app
nice! ๐ thanks for the update.
by web bluetooth... you mean something like circuitpython.org/ide which can upload code over bluetooth?
serial is working too I think. I need to circle back and see how the CI did
yup
I may actually do it as code.circuitpython.org
since it reads better ๐
is there an easy way to turnoff tinyusb... I am assuming thats the only thing holding back ble-only board
I think CIRCUITPY_USB will do it but I haven't tried it yet
do you have an nrf board to try it on?
nope... I'll try to get esp32/esp32c3 working...
haha, that's a much bigger task
it'd be awesome to support though
I think I leak a little nrf stuff into the supervisor bluetooth stuff
yep need a new ble driver
I might have overthink this a little... I am also imagining a wifi-only workflow...
device on start-up will present as a wifi network... you can either connect to it directly and upload code or give it router's ssid/password to appear as a network drive
ya, that's a whole separate thing
haha... I haven't poked around the code yet... will be taking a look at adding ble-only board today.
at least there is repl over serial to fall back to
do you have any nrf you can test with?
not at the moment... I have a couple but they are already occupied in existing project... ordering one now
๐
I agree, since I don't know that switching to 2000 has any advantage (at least until 2038) I don't see why we should break compatibility with existing code and the Unix Epoch.
Note that technically the epoch is platform dependent in CPython https://docs.python.org/3/library/time.html
The epoch is the point where the time starts, and is platform dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC). To find out what the epoch is on a given platform, look at time.gmtime(0).
...
Close #4920 by adding an issue form for bug reports.
Some notes about my implementation:
- No fields are required.
- You can preview it in my test repo, because there is no way to do it natively.
@ajs256 Thanks for the PR.
I rebased your branch and pushed a commit containing a few more modifications.
@tulip sleet or @onyx hinge Are either or both of you around for a feature implementation question about this library I'm writing?