@jraynes Does 128 work? Maybe it needs to be a power of two.
#circuitpython-dev
1 messages · Page 363 of 1
I forgot to reply back with a few notes after playing around yesterday.
- I was trying to play audio while also running some NeoPixel animations. When both were playing the audio distortion would randomly come in and out. Disabling or pausing the NeoPixel animations while audio is playing seems to have completely cleared up the audio distortion except for the initial audio file (next bullet). I don't know if this is a CPU/memory thing or if I just can't do audio and animations at the same ...
Unify this with the similar message above.
Could we just have a Palette object available as .palette instead? That would allow for transparency and such.
In fact, maybe we should switch to returning the pixel index here so that it's truly a value. Then TileGrid could map that to a color with its pixel_shader (like odb.palette).
thank you ! I didn't test.
My testing: https://www.youtube.com/watch?v=1BxlNVgzosY
The blue LED in background is the PWM audio.
What do you think about not taking a buffer and having a write method instead that queues data up? That way you can pipe midi from BLE or USB directly into this object.
Thanks! That's awesome. One question about the API. I think we'll wait to wait until after 6.2.0 to merge this. That will give us time to refine the API if we need to.
@tannewt it does thank you! Would be nice if the error message was a bit more helpful than "could not initialize" here
Address Dependabot security alert. I am flying a little blind here, but we're just upgrading from 2.3.0 to 2.3.1.
Images automagically compressed by Calibre's image-actions ✨
Compression reduced images by <strong>36.6%</strong>, saving <strong>3.67 MB</strong>.
| Filename | Before | After | Improvement | Visual comparison |
|---|---|---|---|---|
| <code>assets/images/boards/large/adafruit_feather_rp2040.jpg</code> | 323.23 KB | 98.85 KB | -69.4% | [View diff](/adafruit/circuitpyth... |
The "s" in "internet" is for "security".
Bumps kramdown from 2.3.0 to 2.3.1.
Commits
See full diff in compare view
Dependabot will resolve any conflicts with this PR...
OK I do NOT understand why we got that ^^^ immediately after I incorporated Dan's change to use 2.3.1. It seems like 2.3.0 was maybe written in two separate places?
Gemfile.lock: kramdown (2.3.0)
Gemfile.lock: kramdown (~> 2.0)
three .. three times
Gemfile.lock: kramdown (>= 1.17, < 3) four times
Firmware
This occurred on
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Matrix Portal M4 with samd51j19
Code/REPL
Here is a sample program that demonstrates the problem and my boot.py
import supervisor
import time
run_reason = supervisor.runtime.run_reason
time.sleep(1)
print("run reason == {}".format(run_reason))
print("Exit via supervisor.reload()")
supervisor.reload()
import supervisor
import storage
...
ooooooh,
<!-- Optionally, add any other information like hardware connection, scope output etc.
If you have already done some debugging, mention it here. -->Removing this line resolves the issue.
it's our own issue template that keeps adding this to issues people file
Multiple times it has occurred that people left this line in a PR by mistake. it makes it look like they failed to include some useful information, but really is just a misunderstanding. Delete the text to reduce the chance of misunderstanding.
@dhalbert There shouldn't be anything breaking the Circuitpython API in here, it'd just add extra work for @jun2sak if merged before their PR. If we merge NRF first, then I'll handle the merge here in this one.
I agree. I myself saw this in some posts and was confused.
@tulip sleet you still awake? Quick question about power - Jun2Sak actually triggers a full chip reset when common_hal_alarm_pretending_deep_sleep evaluates that the chip woke from fake deep sleep (otherwise going to REPL). Thinking about it, do we want to make that standard? It guarantees that the chip wakes in the same way as a true deep sleep. The only trick is remembering what woke the chip up, which is easy on STM32 with the backup registers but I dunno about other ports.
a full chip reset would force usb to re-enumerate, and would break a serial connection. Maye that is the problem I am seeing with his current PR ?
like if you pressed the reset button
we don't want that to happen, we want you to stay connected so you can ctrl-c, see what it prints, etc
I think I just had a lightbulb moment about what I saw with the latest version of the PR. thanks for asking !
I noticed it when asking about the decision to put return false after common_hal_alarm_pretending_deep_sleep returns in main, which had me thinking "wait this can't be right"
maybe jun2sak is on windows and using something like Tera Term, which reconnects automatically
I see your point about the reconnect
or at least easily
yeah that seems totally plausible for why you're seeing different stuff
i will put a comment in the PR tomw, or you can
I defer to your understanding of the deep sleep USB philosophy, if you can spare the cycles to look over that section again
I thought something was up with it, but I just figured we needed to nail down whether all ports should go one way or the other
i did not mean to ask them to do a full reset
i think there may have been a misunderstanding
I will make a quick note as a part of my comment about the return false but I think you might want to follow up with your own input
i will, thanks. good night!
yah sorry for late ping
not an interruption, np
I see that the reset_cpu() in alarm_pretending_deep_sleep actually hard reboots the CPU when waking, circumventing the alarm detection process entirely. Unfortunately, this may actually be what is causing @dhalbert's problems with USB, because it will force re-enumeration. Since the idea of fake sleeping is to avoid any serial disconnection, we may need a different strategy here. @dhalbert will have more details.
@mental nexus (listening to the weekly) a good place to stick links to all the things is Awesome CircuitPython. You mentioned a FAQ for example and I didn't find it there ... That's a resources I need to learn to use more more myself.
https://circuitpython.org/awesome
I see your point, but:
- that would make looping (or even passing the same AudioSample to
play()repeatedly) impossible; - the protocol for
audiosample_reset_buffer_funhas no way to report failure if the AudioSample is not rewindable; - if the queued MIDI stream depletes during playback, the playback will stop, instead of waiting for new input. For real-time input, when the MIDI events arrive at the same speed that they're played, this would happen after every event!
Perhaps a ...
VID/PID as assigned by Espressif (see https://github.com/espressif/usb-pids)
Thanks for the suggestion. I agreed to create a starting list of memory-management ideas on github and then all can add their own tidbits and discussions. Main goal is to have a place to bridge the gap between the basics and deep dive. Once it gets created, Awesome CircuitPython is a good place to link it to.
Here is the rough cut first notes from the meeting.
- See “Memory” in: https://learn.adafruit.com/welcome-to-circuitpython/frequently-asked-questions
- Deeper dive via microPython and very relevant to CircuitPython: https://docs.micropython.org/en/latest/reference/constrained.html
- @lone axle did a Friday stream on saving memory on the EZbake oven specifically for the PyPortal Titano: https://m.youtube.com/watch?v=lDAyfZp_350&feature=youtu.be
- @slender iron did a deep dive https://www.youtube.com/watch?v=baa5ILZTRkQ&list=PLjF7R1fz_OOXBHlu9msoXq2jQN4JpCk8A&index=49&t=4s
Any other intermediate-level guides or examples for problem solving?
Tips:
- Do a gc.collect() prior to large allocations
- There was the "use bytearray" advice.
- And use binary font (unsure).
- Reduce color depth.
- Avoid recursivity? To avoid “pystack exhausted”
- Use generator rather than build big list.
Could we just have a
Paletteobject available as.paletteinstead? That would allow for transparency and such.In fact, maybe we should switch to returning the pixel index here so that it's truly a value. Then TileGrid could map that to a color with its pixel_shader (like odb.palette).
To be perfectly honest I couldn’t decipher the syntax to make something act as a .palette getter and setter property versus just a plain function. Can you point to a good example? This may be...
Thank you! I saw some small items to correct.
Please update these files with your own copyright information. E.g., "Copyright (c) 2021 <your name>", adding "for <company name>" if applicable.
I keep trying the dailies and not much progress thus far. Normally I'd blame this on the computer but this is a stock Dell XPS desktop and I'm concerned that this isn't an isolated issue, albeit not widespread.
... what if you could circup install-example....!
.. and make the 'invalid pin' messages standard.
Closes #4502
Running uart_test_script on the rt1010-evk:
>>> import uart_test_script
RX pin: board.D6 TX pin: board.D7
RX pin: board.D6 TX pin: board.AUDIO_BCLK
RX pin: board.A0 TX pin: board.AUDIO_MCLK
RX pin: board.AUDIO_SYNC TX pin: board.AUDIO_MCLK
RX pin: board.USER_LED TX pin: board.AUDIO_MCLK
RX pin: board.D0 TX pin: board.D1
could even extend it with circup install <package> --include-examples
The examples are included in the bundle .... (meaning its very doable)
The question would then become where are they copied to and which one, since several are board\network variant specific
good question, I haven't thought it through
hey @slender iron, sorry for the dumb question, but what is the actual specific point in main.c where Circuitpython is actually running the user code? Is it after mp_init in start_mp?
looks
I'm trying to understand out where the alarms are reset in relation to the user code and regular VM resets
so just after start_mp
Ok, so all of start_mp runs, and then hits maybe_run_list. Thanks!
Could I put a comment in there to that effect?
totally
Cool. That whole system has been a bit of a mystery to me, I probably should have asked sooner.
np 🙂
it's good to wait to learn something until you need to know
otherwise you'd spend all of your time learning
@hierophect want to take a look? You've been in this code most recently.
Current build 3/29/2021 new firmware build after disabling modules
BOARD=adafruit_feather_rp2040
ERROR:
kevin@Aorus:~/circuitpython/ports/raspberrypi$ make BOARD=adafruit_feather_rp2040 Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity. make: *** No rule to make target 'common-hal/sdioio/SDCard.c', needed by 'build-adafruit_feather_rp2040/genhdr/qstr.split'. Stop. kevin@Aorus:~/circuitpython/ports/raspberrypi$
Module settings i...
this isnt a bug, we dont have SDIO support at this time
To be perfectly honest I couldn’t decipher the syntax to make something act as a
.palettegetter and setter property versus just a plain function. Can you point to a good example? This may be moot if we redefine this to be a palette object.
Sure! The key thing is that there is an intermediate "property" object that stores pointers to the getter and setter functions. See: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/digitalio/DigitalInOut.c#L224 (This is how prope...
Build 3/29/2021
Trying to make a 'lite' system but the build system is ignoring the module setting for FRAMEBUFFERIO and with V=2 it appears to be building modules that are disabled.
ERROR:
`kevin@Aorus:~/circuitpython/ports/raspberrypi$ make BOARD=adafruit_feather_rp2040
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
make: *** No rule to make target 'common-hal/sdioio/SDCard.c', needed by 'build-adafruit_feather_rp2040/genhdr/qst...
@jraynes can you make a separate issue for improving the error message? That isn't the same as this issue of missed characters.
Those are all really good points. I'd like to get @jepler's thoughts on it too since he has thought about MP3 streaming some.
@onyx hinge Do the iMX chips have a temp sensor built in?
Is there a temp sensor built into every chip we have a board for at the moment?
Also if any CircuitPython Librarians have a moment: https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/1499
@idle owl let me find out!
Cheers.
>>> import microcontroller
>>> microcontroller.cpu.temperature
67.0
>>> microcontroller.cpu.voltage
>>>
``` so temperature is implemented and returns a number (67 seems high!), voltage returns None
Fair enough
maybe temp is in farenheit when it should be celcius
Google is not giving me a clear answer on whether there are microcontrollers without temp sensors.
return temp;
``` seems simple enough
Yeah that does seem more like Fahrenheit.
I'm sure there are but most of the ones we use have it
* return current temperature with degrees Celsius. docs say it's in C. Maybe it runs warm in that CPU.
Trying to write up the template for CPU temp and trying to figure out how to word it. Is why I'm asking.
Could be!
Especially with what you've been testing I suppose.
I don't see that there's a CPU voltage monitor
Seriously though, I've never seen a board return that high. I should tank something with some kind of display code or whatever and then check it.
I should go touch the CPU package and see if it's hot
Knowing a board can return that high means I need to word this page differently. We're usually saying "oh it sucks for precise temp, but for ambient, it's good enough!" Which is apparently a lie for that board.
I got a QTPY to 55°C by running a full brightness rainbow neopixel strip (testing using the stemma qt connector for signal and power)
not that I recommend doing that
this CPU doesn't seem like it can be 67°C inside, the package is warm to the touch but just barely, so it doesn't seem likely to be over 40C. But at the same time, it's warm enough that it's not going to be a good way to estimate the ambient temperature.
I'm not making it "do" much, it's just sitting at the REPL
it does return different numbers, but clustered around 67/68
Hmm.
the code's not doing anything obviously wrong
but it doesn't seem like it can reach 62°C after being off for >5 minutes then on <20 seconds
Hmm no.
pointing a hot air gun at it makes the temperature go up, and taking it away makes it go back down again. Putting a fingertip on it makes it go DOWN from 68 to 65
so maybe it is real? If it's not over body temperature then touching it should make it go up
breathing onto it also lowers it a bit I think
hard to say
spraying isopropyl alcohol on it got it down to 61
and blowing on that got it down to 59
Too bad the datasheet isn't amazing and lists some operating temperature or some such. 🙄
(I realise that's too much to ask of a datasheet.)
so in summary, I dunno. It sure senses change in temperature but verifying the base temperature seems hard
it supposedly is factory calibrated!
the calibration is being used
Fair enough
I haven't tried printing the calibration values, but I don't know what they should be either
someone else has seen high-seeming temperatures, no satisfactory resolution to their problem https://community.nxp.com/t5/i-MX-RT/i-MX-RT1064-TEMPMON-Accuracy/m-p/1062068
NXP Community
Hi Tim, Have you tried the example using MIMXRT1064-EVK? I tried to reproduce this and the temperature seems to be reasonable using temperaturemonitor SDK 2.8.0 example. Best regards, Felipe
Well. Good to know now I guess.
OK very interesting, I un-plugged the shield that was on this thing and the temperature went right down to 33 which is very plausible
Huh.
What was the shield?
What was I even trying to say here? "This works on the Adafruit CircuitPython boards it's built into the microcontroller used for these boards." Missing some punctuation and words there apparently.
it's a GPS shield (non-adafruit)
Hmm. Wonder if it does stuff automatically then.
In googling about this I ran across a page that suggested it could happen if you had an I/O pin shorted, so the first though I thought of was removing the shield
That makes some sense
yeah
so now I need to figure out whether there's something wrong with the shield. the GPS works (sends messages over UART)..
But could have something else going on.
right
@tulip sleet if I am understanding the alarm system correctly, when you use light sleep and access alarm.wake_alarm, it is actually a different alarm than the one that is returned by the sleep function itself. The alarm returned by sleep is the true alarm, while the global alarm is a copy just like deep sleep. Is this intentional?
That would be true for deep sleep, because the original alarm object is gone. But for light sleep, I thought it was just assigned to alarm.wake_alarm
two ways to get the alarm, via return or via alarm.wake_alarm
No. alarm.wake_alarm is not capable of accessing the "true" alarm from deep sleep since it does not have access to the internal alarm array
this is true for both light and deep sleep
i think it should not be true for light sleep; the alarm object is available and should be used for both. Where is the copy done?
the return version has the alarm array to work with, so it can search it and return the actual alarm instance that was passed in. But common_hal_alarm_get_wake_alarm always works with null parameters for the array, meaning the global instance of the alarm will always be a constructed one, not the true alarm
no reason to make a copy for light sleep
isn't there a common_hal_set_wake_alarm()? There used to be; I used it to set the module dictionary entry
I think in the light sleep case we want to replace alarm.wake_alarm with the actual, true wake alarm, not make both alarms default to the constructed copy. So I think the best case is to store a "most recent wakeup alarm" as a static object within the alarm module, and overwrite alarm.wake_alarm with it, if it is available (not NULL)
it's alarm_save_wake_alarm() in shared-bindings/alarm/__init__.c.
@tulip sleet yes, but all it calls is _get_wake_alarm(0, NULL);, which translates to "make me a new alarm copy"
ok, that changed from when i wrote the code, I think
originally I had the wake-up code call alarm_save_wake_alarm() directly
there doesn't seem to be a schematic available, but it kinda looks like this shield is designed only for 5V microcontrollers and has pull-ups to 5V. Yeah that's not good
I'd still like to revisit the names of these functions, having the request for a fake alarm to be made being signaled by null parameters still feels very obscure to me and I'd rather it just be a new set of functions that specify what they're doing more clearly.
that is a good idea
Anyway, for now I will have it override with the static object, and I'll revisit later to see if I can simplify the program flow a bit somehow.
Ewps. At least you figured it out?
@tulip sleet We haven't gone and turned off the CircuitPython code error LED blink codes anywhere, have we?
we are thinking about not doing it over and over, but no, that was going to be in 7.0.0. Is there a board that's not working?
No, I'm creating the "Status LED: NeoPixel" template, and stated that the LED does bootloader status, and CircuitPython error codes. Wanted to make sure I wasn't making things up.
it will still be true, but we want to reduce the frequency so as not to run down batteries, etc.
Yep that makes sense. I wasn't going to mention the repeated nature of it. So that works.
@tulip sleet Could you review this? I'm leery of making multiple PRs to Learn at the same time because of merge conflicts and I would like to work on some more template code. It's a basic touch/blink example with the touch pin being a variable and instructions to change it. It's mean to be copied and pasted without the docstring into a template code embed and have that variable changed. I am basically the only one who will be using it anyway, but I tried to make it so others could as well. https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/1499
would you want to do led.value = touch.value or is that more obscure?
Oh, right. Bleh. No, we want it to be more "readable" so we include a "this could be more 'Pythonic' but it's not because readability" in the template
So, while it's shorter, we apparently opted to go with the longer versions for these intro things.
I actually think it would be good to mention the "more Pythonic" version at some point; people will catch on.
But I honestly forgot that touch returns true/false.
Yeah I agree, really. The paragraph reads: Note that the code is a little less "Pythonic" than it could be. It could also be written as led.value = touch.value. That way is more difficult to understand if you're new to programming, so the example is a bit longer than it needed to be to make it easier to read.
similar is a blinky that does led.value = not led.value and needs only one sleep instead of two
Yes.
ok, so I understand, and it looks fine otherwise. Not sure about "little red LED" as opposed to just "red LED" (how little is little). Maybe it's a "wee red LED" 🙂
but that's fine too, if it's in the spirit of the context
Oh man, I like "wee" much better.
I refer to it as "little" because it's "littler" than the NeoPixel/DotStar
Since they can be red as well.
If you make them.
it seems like an affectionate term here, as opposed to "small", then, which is your point
True
i'll approve it either way
Cheers
neat nordic ble number "database" https://github.com/NordicSemiconductor/bluetooth-numbers-database/pull/44
I just got a general protection fault (Kubuntu 20.04). 6.2.0-beta.4 version of circuit python, I had unmounted the CIRCUITPYTHON device, and then powered off the PICO. Until now turning off auto mount and unmounting the device has saved me from getting these. This appears to be in the ACM/CDC driver though which I have never seen happen before. Although I got this luckily linux didn;t totally crash and I was able to reboot gracefully.
[684258.426420] general protection fault: 0000 [#1...
My attempt to get the Linux maintainers interested in this did not go well, basically "if it hurts don't do that". An abrupt device removal is not something they wanted to handle. MY original diagnosis was not quite correct. See the first post's links.
Removing an ACM/CDC device "abruptly" is normal there is no other way. This latest crash of mine is not MSC but ACM/CDC and appears to be deep in the USB stack. This has to be a linux driver bug I would think.
I think there are multiple ways Linux can be upset with connect or diconnect. The original way I was seeing was that an abrupt disconnect and reformat of the CIRCUITPY filesystem confused Linux. That appeared to be on reconnect. However, we have also seen these disconnect bugs. If you are willing to submit this to Ubuntu with kdump info and maybe write to linux-usb, that would be great. I have found one disconnected reference in recent linux-usb emails that sounds similar, but I haven't fou...
Hello,
With Raspberry Pi Pico: installed firmware using UF2 is Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Raspberry Pi Pico with rp2040.
In Thonny, when trying to create a ULAB array that is 1024 length, I receive "RuntimeError: pystack exhausted".
import ulab test_array=ulab.array=([])
I did not want to include the large array here, but its 1024 length of float64...basically a hanning window array.
I also tried just values 1-1024 int and it gave the same error.
I ...
was the assert(self->rx) a known failure, since we just checked self-rx above, so we know it's false
compare that to the self-tx and self-uart usages below
What's the general guidance or standard work for asserts() in circuit python.
Are they turned off in releases?
Are they expected to catch run time execution errors ( e.g. bad data ), or just the impossible / can't happen errors
https://en.wikipedia.org/wiki/Assertion_(software_development) suggests that in contrast with error handling, "Using assertions as a general-purpose error handling mechanism is unwise: assertions do not allow for recovery from errors; an assertion failure will normally halt the program's execution abruptly; and assertions are often disabled in production code. Assertions also do not display a user-friendly error message."
In computer programming, specifically when using the imperative programming paradigm, an assertion is a predicate (a Boolean-valued function over the state space, usually expressed as a logical proposition using the variables of a program) connected to a point in the program, that always should evaluate to true at that point in code execution. A...
http://www.linux-usb.org/usb.ids suggests that USB VID 16D0 is "MCS", which doesn't seem appropriate here?
Ahhh, I just found https://www.mcselec.com/index.php?page=shop.product_details&flypage=shop.flypage&product_id=92&option=com_phpshop&Itemid=1 which makes sense :smile:
hello everyone,
i want to start an project with an micro-Controller...
ich need:
- network.lan (looks like is disabled by default in Micropython)
further i need:
- JSON
- send via MQTT
- HTTPS-Server
can anyone tell me if these elements are available in CircuitPython?
-> is there a support, if it doesn't work?
best regards
@loud berry I suppose a raspberry pi would be best for this.
then you can use regular python
i need a PoE-Supply, i want to use an ESP32
well, esp32 is not supported by circuitpython
it's a pitty... anyway, thanks!
Out of curiosity, is there a manual process which needs to be performed when a new board is added for it to be available on circuitpython.org ? I received my Neo Trinkey yesterday (WHEE!) but didn't see an image there. Nor did I see one today. However, checking the latest CP build actions output, there is a package there.
@hollow gazelle I think most builds are done with -DNDEBUG, which turns the assert() macro into a do-nothing operation.
For conditions that could arise by executing Python code, the core C code should throw a Python exception or return an error value (which would be turned into a Python exception at a higher level), whichever one makes sense.
We had the "Remote Wakeup" bit turned on in the USB configuration descriptor we send to the host. This is problematic for two reasons:
- We don't handle remote wakeup; we should be calling
tud_remote_wakeup()at appropriate times. - Some chips don't fully support USB suspend/resume, notably RP2040 and STM. TinyUSB has workarounds for some but not all of these. See https://github.com/hathach/tinyusb/pull/700 for some discussion. It is on TinyUSB's agenda to work on this further.
Some ...
Can you verify that you've correctly shown the source code you are executing? The code you showed gives a different error, because you cannot assign to 'ulab.array':
>>> import ulab
>>> test_array=ulab.array=([])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object cannot assign attribute 'array'
To create an array filled with 1024 zeros of a given type, you should instead write
>>> test_array = ulab.zeros(1024, dtyp...
.. as noted by @d-c-d
asserts are turned off except when a debug build is built. We use them very rarely in CircuitPython itself: there are some asserts in supervisor/shared/memory.c, for example. The SDK's we use have many more, and they have their own mechanisms for enabling or disabling.
we agree, they are not too useful, since often the effect is just that the board stops working
I think this came up because I added one, and it was .. not correct.
i saw that after I read my mail 🙂
@jun2sak I missed the fact that you are hard-resetting the board. That is why the USB connection is going away for me, and maybe sometimes for you. On Windows, Tera Term recovers from this better. The CPU should not be hard-reset after a simulated deep sleep.
Browsing the most recent pystack issue, #4516, I wonder if there should be a function to set pystack limit just like stack limit, and for any stack limit set function to return its actual set value, since "If its too large, the default will be used."
This allows more options to be overridden to 0 in an mpconfigboard.mk.
Improved:
- FRAMEBUFFERIO, FULL_BUILD, BITOPS, PWMIO, RGBMATRIX, OTARYIO, PULSEIO, WATCHDOG
Still problematic (pull requests welcome):
- RP2PIO & NEOPIXEL_WRITE, possibly only if a status neopixel is defined
- BITBANGIO, possibly only if BUSIO is enabled
- RTC
Incidentally, with RP2PIO & NEOPIXEL_WRITE, BITBANGIO, and RTC re-enabled I get
323956 bytes used, 720524 bytes free in flash firmware space o...
👍 an issue would be welcome
thanks, Dan, I'll file one for a set stack limit return value... looks like we've discussed pystack before and it's more complicated across ports https://github.com/adafruit/circuitpython/issues/4103
supervisor has a function to "Set the size of the stack for the next vm run."
https://circuitpython.readthedocs.io/en/latest/shared-bindings/supervisor/index.html#supervisor.set_next_stack_limit
But "If its too large, the default will be used." The function has no return value. Returning the actual value set would be useful. to know whether the request was successful, or for programmatically obtaining the default limit.
Closing for now. Best places to ask for support like this are https://adafru.it/discord and https://forums.adafruit.com.
@Embedinno How are you doing on this? Would you like to leave this issue open?
@tannewt described a path forward. Closing for now. Happy to help further if you are still stuck.
Have you resolved this problem? Please try the latest beta. If you are connected to USB, then it will not go into real deep sleep.
Closing due to no activity. Please re-open or ask for support via https://adafru.it/discord and https://forums.adafruit.com if you are still having trouble.
Closing for now due to no activity. If you would like to add the MicroMod as a board and are getting stuck, let us know. We would welcome a PR for the board.
This is now fixed by #4499 and #4508.
I think we should raise NotImplementedError for SAMx5x in 7.0.0. Whether this works or not varies by individual chip, so something is marginal.
@tulip sleet Do we have any boards that don't have at least one pin that you can read the analog value of using analogio and printing pin.value?
That you can think of anyway.
That was weirdly out of order.
Thanks @onyx hinge - I did NOT dig into the code further, perhaps these asserts are designed to catch the configuration errors in the CP build that could be detected (only?) at runtime. I would agree that this is a reasonable middle ground for assert that matches the "don't use asserts to catch Python errors", right?
Oh, the issue that triggered my question does look like python code triggered it. '''uart = busio.UART(None, board.TX, baudrate=9600)'''
@tulip sleet I guess it doesn't matter. Nevermind my question.
The template wouldn't go into a guide that the board didn't support it, so it's fine.
I'm trying to figure out wording for explaining analog pins etc.
Right, Pimoroni doesn't have their own USB VID.
Thanks @jepler and @d-c-d
@hollow gazelle yes, I think the correctly-written assert would have been triggered by the code in that issue, however at the same time as I added the (slightly wrong) assert i also corrected the logic to ensure that a Python error was previously generated. So if I'm right about what I implemented, just calling busio.UART with wrong args cannot cause the assertion error.
pystack exhausted isn't impacted by set_next_stack_limit. The stack limit is the C stack (which used to include python data too.) It is usually hit by deep python recursion. Generally, we may want to increase the size a bit.
Ok for the CircuitPython-compatible microcontroller boards, are all GPIO pins digital or analog or both? Or are there GPIO pins that don't have one of those functionalities?
@DynamoBen #4517 (now merged, so you can try "Absolute Newest") might be yet another reason for this problem, so if you wouldn't mind testing again, that would be great.
There are definitely restrictions on certain boards with certain pins. For instance, on SAMD boards not all pins can be analog something or other, I believe, and I think STM may be similar.
It is not a safe assumption to make
Hmm.
But are all GPIO pins either analog, digital or both?
Is that what makes them GPIO
GPIO would mean they can be DigitalInOut
But on ESP32-S2, for instance, some "GPIO" pins have restrictions. I think one is input or output only, for instance. It's a sloppy term.
Ok. I'll avoid GPIO here then for sure.
yeah, that's a good idea, it really doesn't mean a lot
Is this safe? Your microcontroller board has both digital and analog signal capabilities. Some pins are analog, some are digital, and some are capable of both. Check the Pinouts page in this guide for details about your board.
It then goes on to explain what analog signals are, but I'm trying to get an intro in there.
that sounds good
Ok thank you
@timonsku #4517, which was just merged, might have something to do with this. If you could try the Absolute Newest build (or rc.0 when it comes out), we would be grateful. Also we have updated TinyUSB a few times which might have already helped. Thanks.
@jepler my apologies.
Yes when creating an empty array it gives that error. I updated my post to show some sample values I am loading into the array. I basically created a numpy hanning window of 1024 values on my personal machine, then copied it over to Thonny connecting to RP2040; I am trying to perform FFT using ULAB (can't quite figure out if there is a way to get frequencies yet but the transforms work).
Any direct array creation that is about 200 plus records gives me the pystac...
Thanks! @me-no-dev, this works... the changes are in my
update-run-modebranch. :)
@microDev1 Could you make your changes into a PR?
This may be fixed by #4517, which was just merged. It is in "Absolute Newest" and will be in rc.0. Could you re-test?
@idle owl There's also the nuance of "analog" PWM out vs. DAC true analog out ...the latter often limited to one or two pins
@crimson ferry Right. That will be explained in two other sections. PWM and Analog Out.
I'm sure I'll be back with more questions when I get there.
@wifijt Did you ever figure this out?
the silkscreen is wrong, its documented in product page
the silkscreen is wrong, its documented in product page
Aha - thanks! OK, closing.
I had a strange problem with circuit python last night. I wonder if its worth reporting even though I have no idea how to reproduce it. For each print statement I deleted (or commented out) a character would be removed from the name of a function call and it complained that there was no function by the truncated name. Deleting enough code eventually swallowed up the entire function call and it died for some other reason. Adding the code back allowed my code to run normally again. Power cycling the board fixed everything. Maybe the parser got clobbered by a buffer overrun?
@alpine nimbus it could have been some odd corruption of the filesystem. I would recommend doing a storage.erase_filesystem() after you've saved your work. What editor are you using?
mu
I have no explanation then 🙂
hmm, the file itself didn't seem to be wrong, just the parser's interpretation of it
Mu's idea of what was in the file vs what was actually on CIRCUITPY may not have matched
The OS does caching, etc.
the problem persisted even after restarting mu
writes are done to a USB devices as blocks of bytes, not as "files"
and i didn't lose anything after restarting the board
although maybe i had undeleted everythign at the time I rebooted. i forget
when you restarted the board, the OS would have re-read the metadata of the CIRCUITPY filesystem. Yes, it could be an internal issue, but the one-off errors don't sound like something going on in parsing
also, I wasn't editing the function call. it kept getting shorter and shorter after I deleted lines in other parts of the file
if the function name straddled a block boundary, for instance, then rewriting only one block but not the other would shorten the name (assuming you made single character changes, like adding # to comment out, etc.)
commenting out a line had the same effect as deleting the line
the file would have gotten completely re-read on each save, it's not incremental, and the internal heap is also cleared and restarted on each save (auto-reload restarts the Python VM). So this is why I think it's more likely to be a filesystem issue. ... It could also have been some odd problem with Mu's editor widget. When you restarted the board, some things got reset.
OK, thanks. I'll erase then.
oh, here's a clue. I just noticed a file named CALIBR~1.PY, which looks like a DOS file name. I'm on a mac. That's a file I deleted a while ago
it does sound like there's a least some mild corruption.
if the board was ever reset or unplugged before the OS wrote something back, that will make corruption. Sometimes it's not obvious right away
@onyx hinge I used your fancy git ls-files command to figure out which Adafruit CircuitPython compatible boards do not have board.A1.
ooh I am glad you were able to adapt the example
Took a few tries, but I think I got a valid result in the end.
ports/atmel-samd/boards/pirkey_m0
ports/atmel-samd/boards/rotary_trinkey_m0```
Which makes sense. I checked a couple others I was unsure about and they have A1.
I don't do much atm with the RP2040 but when I get back to it I'll make sure to update and let you know if I see it again.
Rose had to help with diffing the files, but I adapted your example myself. 😊
A friend randomly suggests "I wish Adafruit guides would list the libraries you need in alphabetical order like they show up in the file explorer"
^^ and separate folders from files
I do it in in order usually, I thought...
Since I'm usually reading it from the lib folder.
i'll admit i'm not that organized, or at least not consistent 😦
a screen cap of the lib folder is my fall back 🙂
this particular friend is good with the commandline so I suggested circup to him
Fair enough.
and maybe we'll have this web-based bundle builder, that would be very neat
[adafruit/circuitpython-org] New comment on issue #491: Board\-specific or project\-specific bundles
Done! See https://github.com/adafruit/Adafruit_Dynamic_Bundler. I added some parameters and examples to the Readme.
friend likes circup 🙂
Good to hear.
en_GB translation was thoroughly done by @garethcoleman (thanks!).
thanks @tulip sleet -- I had meant to file a similar PR but must have forgotten
thank you! good to merge if build succeeds.
I am trying to do all the odds and ends for rc.0
You folks are plowing through it too!
When creating a literal sequence, the amount of pystack used is proportional to the size of the sequence.
>>> eval(str(list(range(367))))
[0, 1, ¸, 365, 366]
>>> eval(str(list(range(368))))
RuntimeError: pystack exhausted
To allow a list of 1024 numbers to appear in a literal list or tuple value, even if there are no other function calls, imports, etc., involved, it appears that pystack would need to be enlarged by about 2700 bytes (to somewhat over 4200 bytes total) ...
[I have updated the title and changed the text of the initial comment where it said 'ulab.array=([...])' but intended 'ulab.array([...])'. Another comment makes a similar error, which I did not correct]
"bogus assertion". Hah!
Ok so CircuitPython. And analog values. 16 bit values, right?
Yes, analog values are scale to 16 bits. even though the actual resolution might be lower.
Ok
This page is turning out to be way longer than the original.
Explained ADC, explained analog signals, explained potentiometers.... now explaining the 16-bit values....
e.g., the actual resolution might be 12 bits (0-4095) so we multiply by 16 (or shift left 4 bits),
Maybe too much? I don't know. Limor asked for me to explain what a NeoPixel is on the NeoPixel page, so I feel like we're trying to be more explainey with these new pages.
But I kind of think it's not too much. We have glossed over this concept in pretty much every guide that does anything with it. I found one that has a SUPER detailed explanation. Everything else is mostly gloss or doesn't mention any of it. We need something in the middle. Not a deep dive, but not hand-waving either.
Hi folks. Thank you all for thinking of me and checking in
@tough flax Hey! Glad to see you!
hey @tough flax !! yah, excellent to hear from you!
Whew. I think this page is looking good.
Significantly longer than its predecessor, but has some simple explanations of things that we haven't really covered in a simple manner.
Hmm. I have two different values for the max 16 bit analog value: 65535 and 65536. One is 2^16 -1, the other is 2^16. Which one is correct? I understand that rarely do you reach that max value anyway, but what is the proper theoretical max? @tulip sleet
hi there. is there a benefit of using a mpy file instead of a .py file? I only found information about creating them
@valid bison Hello! .mpy files are smaller, and have less memory impact. So if you're using a board with less memory, such as a SAMD21, or a SAMD21 non-Express, you'll definitely want to use .mpy files. Or, if on larger boards, you run into a memory allocation failure, you can switch to .mpy files.
ah thx. Does it make a difference in execution speed?
Not that I'm aware of.
It should make a difference for execution speed. The parsing and translation to VM code is already done. But this need confirmation.
Now, it might only accelerate loading time, not execution time... so if you use that imported code many time, you will only notice at loading time.
I guess it is a value from zero to 2^16-1. So the max would be 65535, the max value you can put on a 16 bit integer value.
It does not seems hard to reach the maximum 3v3 will give you the max if 3v3 is the reference value... but I don't play much with analog. My worry is when you are above as many documentation warn you about not going above it.
And then ESP32-S2 that cannot measure up to the max and start degrade it's measurement.
There might be a nice writing by Stargirl about analog reading and how it is done on SAM microprocessor. She did a few very good blogpost, so it must be where I read about that.
I think I explained things pretty well, albeit basically.
Though there's always room for improvement.
It appears that MacOS changed something that caused HID to stop working. This was already true with iOS: the presence of the gamepad HID device causes other HID devices to not work for iOS.
I will test this myself with a custom build. You can turn off the gamepad HID device if you want to try a custom build: https://learn.adafruit.com/building-circuitpython/customizing-usb-devices#customizing-usb-hid-devices-3084080-4
Where is it? Is it recent? I might have read it from you!
There's a new back-end feature in the Adafruit Learn system where you can create a template page, and the main content of it is immutable, but there are sections where you can add things like wiring diagrams for a specific board. The plan is to basically redo the CircuitPython Essentials guide in templates, so instead of a general set of pages, each one is tailored for each board. So every Adafruit CircuitPython-compatible board will have its own set of specific pages that show things.
This is one of those templates. So it's not published yet because I think my plan is to make all the templates and then add them a a group to the guides.
Also I finished it half an hour ago 🙂
@idle owl we might never reach the 16 bit maximum if this is a 12 bit maximum multiply by 16... 4095*16 = 65520 ... we will never reach 65535 on that platform. 😦
Right exactly. I did note that.
Not in exactly that way, but I noted that it's normal to not reach the maximum.
What you said is correct, but I think that goes one step deeper than I want to go with this page.
And not all board have the same "resolution". 🙂
Also true.
Right now, I've implemented deep sleep, and added an external battery. I haven't experienced the issue since.
The list_clear would crash if we tried to clear a NULL list. (It
can happen if we haven't tried to discover any services.)
@slender iron #4522 looks good to me, and I tested a simple central role to check the discovery fix. I would feel fine adding this before rc.0; you too?
that is completely not surprising
😄
[adafruit/circuitpython] Pull request review submitted: #4522 Fix central pairing and crash on clear
This looks good and central service discovery tests out OK. The discovery thing basically finishes off #3228 properly; that code looked pretty familiar.
[adafruit/circuitpython] New tag created: 6\.2\.0\-rc\.0
[adafruit/circuitpython] New branch created: 6\.2\.x
Automated website update for release 6.2.0-rc.0 by Blinka.
New boards:
- rotary_trinkey_m0
- franzininho_wifi_wroom
- adafruit_funhouse
- franzininho_wifi_wrover
- sparkfun_nrf52840_micromod
- sparkfun_pro_micro_rp2040
- adafruit_qtpy_rp2040
- sparkfun_thing_plus_rp2040
- adafruit_itsybitsy_rp2040
New languages:
- en_GB
Reverts adafruit/circuitpython-org#660. kramdown 2.3.1 breaks github-pages-207. github-pages-214 fixes that but it has other changes. This is temporary.
Bumps kramdown from 2.3.0 to 2.3.1.
Commits
See full diff in compare view
Dependabot will resolve any conflicts with this PR...
- Update to github-pages-214, which updates many things including to kramdown 2.3.1.
- Original 6.2.0-rc.0 download counts had quotes around them, causing weird ruby errors.
- Add UK English to language dropdown.
[adafruit/circuitpython-org] New comment on pull request #663: Bump kramdown from 2\.3\.0 to 2\.3\.1
Looks like kramdown is up-to-date now, so this is no longer needed.
create_website_pr.yml failed on the latest release creation because it referenced requirements-dev.txt before the circuitpython repo was cloned.
We need to fix this before any further release, and backport it to the 6.2.x branch.
Short calls to time.sleep(t) end up sleeping for 1.0+t seconds. Found this by sleeping for short periods between bit-banging through the phases of a four-phase stepper. It would simply stop multiple times per minute for exactly one second, then continue.
This happens on multiple Sense boards but I have not been able to reproduce it on the M4 running it for (only) 10 minutes.

...
In the Wio Terminal pin definition, the original SD_DET assignment (=PC21) collides with GYROSCOPE_INT. According to the schmematics, SD_DET is connected to PD21.
In addition to the existing ESC[K sequence, the following two escape sequences are implemented.
- ESC[yy;xxH : move cursor to (xx, yy) position
- ESC[2J : clear screen
@microDev1 Could you make your changes into a PR?
This is stuck due to idf@v4.2. In my implementation, the function calls used to achieve this are part of idf@v4.3.
@tulip sleet were you able reproduce the i2c-wifi issue with IDF?
For example, this can be used like the following (on Wio Terminal):
print("\x1b[2J")
print("\x1b[5;10H+---------------+")
print("\x1b[6;10H| Hello, World! |")
print("\x1b[7;10H+---------------+\n\n")
I encountered a question with a situation like that in #help-with-circuitpython, and assuming that the cause was that the literal array was created on the stack before being put in a variable on the heap, I suggested cutting it into parts of 300 items length (approx).
long_list = [0, 1, 2 ... 1000]
# pystack exhausted
long_list = [0, ... 300,] + [301, ... 600] + [601, ... 900] + [901, ... 1000]
# works
oh shoot... I accidentally created a new branch on core... was editing a file using web-editor and thought It was on my fork. 🤦
it can be deleted once #4528 is merged
Thank you! I was going to do this first thing in the morning, but your morning is earlier :)
Which version of CircuitPython are you testing?
Please do not use profanity.
/* Set deadtime count, we set this to about 650ns */
uint16_t deadTimeVal = ((uint64_t)PWM_SRC_CLK_FREQ * 650) / 1000000000;
Don't we usually configure the PWM peripheral so that it can give 100% duty cycle? "Dead time" is useful in motor control scenarios but not necessarily for the things our users use PWM for..
I started to work on reproducing i2c-wifi interaction bug. I could not get a crash, but I have seen that the log information when using a debug build differs when my xSemaphoreGive() is present vs not. I gutted the interrupt handler routine and I may need to put some things back.
I have pushed what I did so far to https://github.com/dhalbert/i2cwifi, in case you want to look.
When I was debugging the original problem, I was not seeing a crash, but instead that things became unresponsive. And when I looked at the running tasks in the fixed vs unfixed case, they looked superficially the same:
gdb) i thread
Id Target Id Frame
* 1 Thread 1073346568 (Name: main, State: Running @CPU0) 0x401752bd in tu_fifo_count (f=0x60023)
at ../../lib/tinyusb/src/common/tusb_fifo.c:300
2 Thread 1073610488 (Name: IDLE0) 0x40176c12 in esp_pm_impl_waiti ()
at ../../esp-idf/components/esp32s2/pm_esp32s2.c:479
3 Thread 1073613136 (Name: Tmr Svc) 0x4003419c in prvProcessTimerOrBlockTask (xNextExpireTime=<optimized out>,
xListWasEmpty=<optimized out>) at ../../esp-idf/components/soc/src/esp32s2/include/hal/cpu_ll.h:33
4 Thread 1073573936 (Name: usbd) 0x40034b45 in xQueueGenericReceive (xQueue=0x3ffd0be8 <_usbd_qdef+8>,
pvBuffer=0x3ffd7a10 <usb_device_stack+2184>, xTicksToWait=<optimized out>, xJustPeeking=0)
at ../../esp-idf/components/soc/src/esp32s2/include/hal/cpu_ll.h:33
5 Thread 1073345452 (Name: esp_timer) 0x40034b45 in xQueueGenericReceive (xQueue=0x3ff9e350, pvBuffer=0x0,
xTicksToWait=<optimized out>, xJustPeeking=0)
at ../../esp-idf/components/soc/src/esp32s2/include/hal/cpu_ll.h:33
6 Thread 1073730444 (Name: tiT) 0x40034b45 in xQueueGenericReceive (xQueue=0x3fffc4b0, pvBuffer=0x3fffd330,
xTicksToWait=<optimized out>, xJustPeeking=0)
at ../../esp-idf/components/soc/src/esp32s2/include/hal/cpu_ll.h:33
7 Thread 1073737860 (Name: wifi) 0x40034b45 in xQueueGenericReceive (xQueue=0x3fffe994, pvBuffer=0x3ffe1850,
xTicksToWait=<optimized out>, xJustPeeking=0)
at ../../esp-idf/components/soc/src/esp32s2/include/hal/cpu_ll.h:33
8 Thread 1073734504 (Name: sys_evt) 0x40034b45 in xQueueGenericReceive (xQueue=0x3fffd4e8, pvBuffer=0x0,
xTicksToWait=<optimized out>, xJustPeeking=0)
at ../../esp-idf/components/soc/src/esp32s2/include/hal/cpu_ll.h:33
Unfortunately when trying to track things down, I found that I ended up inside the closed-source esp-idf wifi stack
I guess this can now be posted as an esp-idf issue.
I was preparing to do that, but figured I immediately be asked for a test program.
We have heard about wifi/i2c issues with ESPHome / Home Assistant as well, but I haven't looked into that in any detail.
do you want to post the issue, or would you rather that I did?
you can go ahead as you have already done more research on this 🙂
I think we were trying to figure out where to patch the Home Assistant
or even if it was possible
I have much less experience writing ESP-IDF C code, though; would you be willing to work on the test example a bit?
ok... is it i2cwifi.c?
yes, i copied the structure of that example from the esp-idf examples. have you written standalone esp-idf programs?
(it took a while just to get it to compile 🙂 )
yes... but nothing very complicated
ok, so, if you feel like playing with it, great; I think I will only be able to show that the debug UART output differs
but that may be sufficient for a bug report
\o/
it's just a tag for now, so the prompts reflect moving on from 6; we won't create any alpha releases until 6.2.0 is out the door, because circuitpython.org only can handle one stable and one unstable release at a time
oh
@tulip sleet does it mean I can prepare a PR to upgrade ulab to their main branch in our main branch though?
yessir, i was going to say it's clear for that and any other incompat changes
looking forward to that PR
you don't have to "sir" me 🙂
any further 6.2 work will be in the newly created 6.2.x branch
a little mild jokey; I was up til 1am fighting with circuitpython-org
I found this interesting thing this morning: https://github.com/nektos/act
would be a way to test changes to actions .yml files; that was what caught me last night
@anecdata Hey, sorry for the late response, you were right about the command, I didn't copy and paste it properly in this issue.
It should have been like this: python esptool.py -c esp32s2 --port COMx --after=no_reset write_flash 0x0 <firmware.bin>
However I think this isn't the issue here.
I've been able to get the ESP32S2 to work over the last couple of weeks by plugging it into another USB2.0 Hub that worked with it this time, and I also noticed that can also work on some USB 3.0 po...
Not sure about this error message:
https://github.com/adafruit/circuitpython/blob/main/ports/nrf/common-hal/_bleio/__init__.c#L50
@slender iron Does it refer to a "nordic soft" "device" or a "nordic" "soft device"? Why the word "soft"? Seems I am missing something?
it's Nordic's term for the standard firmware library that provides basic system functions, the BLE stack, etc.
"SoftDevice"
A SoftDevice is a precompiled and linked binary software implementing a wireless protocol developed by Nordic Semiconductor.
Hm. Sounds like we are leaking implementation details to the end user?
we use the softdevice for BLE and other things. you don't have to - there are other libraries that do the same thing (e.g. zephyr has its own BLE stack)
I think this leak is ok - it's informative, if confusing, and then someone will ask, and we can help
What I mean is that we can't reuse that error message for other MCU's.
But thanks for the clarification! 🙂
i guess it could be "third-party firmware out of memory", but that's pretty vague
or maybe it's second-party 🙂
in this case
Well, I would argue the "nordic soft device" is vague enough so I actually had to ask. 😆
BLE firmware out of memory ?
that could be ok, but it's actually more than the BLE firmware, because the SoftDevice manages some other things
a good suggestion is welcome! I think the point is to point the finger at non-circuitpython code but still make it identifiable if reported to us
yessss! I have a PWM
Backport of #4528 to 6.2.x branch, so we can use this fix to build further 6.2.x releases.
After this change, the following program works for me on the MIMXRT1010-EVK:
import pwmio
import board
p = pwmio.PWMOut(board.D13, frequency=1_000_000, variable_frequency=True)
p.duty_cycle = 32868
while True:
pass
Querying and varying the duty_cycle and frequency work as well.
The lowest frequency obtainable is about 2kHz; there is an additional divider which would allow lower PWM frequencies (I think 1kHz is important for servos?)
In the commit message...
50 or 60 hz needed for servos
Also, the pwm "X" channel is probably not working.
@tulip sleet i2cwifi.c does not result in a hang for me.
right, it doesn't hang. the issue in CircuitPython is not a simple hang either; it might be too many itnerrupts, etc.
the CPy problem disconnects USB, but the threads that are running appear to be ok
all I have is that the debug trace is different with and without my change. I did remove all the stuff in the interrupt handler, and want to try put it back, a bit at a time
okay so this is not an idf issue after all...
!
thanks for looking into this @tulip sleet
I think we will have to stick with a patched idf even for V4.3...
wait, but you said it's not an IDF issue??
ya... from what I understand this is a corner case which isn't properly handled in idf
i am not sure about a corner case; what we see is that if you delete an I2C driver instance, it somehow affects the functioning of I2C, if started after the deletion. The destruction of the semaphore somehow affects the wifi. But I tried a non-static semaphore, and I also did some test where I made sure that the I2C driver storage block was not being reused (I did not free()) the block, and it still had the problem. So it seems more like a semaphore/event queue problem. I cannot get inside the wifi stack to see what's actually happening :/
it would be great if we can get someone from espressif involved in this because of the closed source wifi stack... that's why the pitch for an esp-idf issue
right, exactly, but I don't yet have a good test case for them. I don't think they want to try to debug CircuitPython. We talked about this internally and I may just go ahead and post the issue and say that a test program is under development, but do they have any idea. I did ping igrr on this earlier but did not hear from him
I don't think there's any harm in posting an issue at this stage...
i will go ahead and do that -- I am less busy with 6.2.0 stuff now and can take the time; thanks for your thoughts on this
thanks for your efforts 🙂
I am doing some CI stuff now and wondering why every board build is done separately...? Is their any issue with building the boards in the same environment?
According to the link it will be softdevice, however in the core is soft device.... 🤔
Do you mean building all the boards for a particular architecture in one environment? The current scheme of building one board in each job allows for max parallelism. We used to build all the SAMD boards in one job, the nRF in another, etc. It took a long time
Grabbed latest just now, no change in behavior. Runs for a little while and then stops.
Code looks good but you'll need to fix the CI.
I do like my devices hard though. 😎
Thank you! Clear screen will be helpful! I checked and this added 152 bytes to the Hallowing M0 Express build, 600 bytes remain. It should be worth having for that cost.
@tannewt Is "needs the ability to specify an array of 1024 float values inline, in a module directly imported from code.py or the repl" a concrete enough story, and one we want to support? If so, it points to increasing the pystack to somewhere around 4200 bytes. If not, hopefully a different technique like one of the ones I suggest above will work for our original reporter.
I'm totally open to increasing the pystack size. We just need to remember that it's a tradeoff with heap size.
...
Thank you all for the support. I think the suggestions are great and even just importing from a file is sufficient for me. Now, I cannot speak for the average user and if there is enough use case to create large arrays of static values, then it may be worth it without compromising a lot of performance.
Thanks again for looking into this, I leave the rest to you great developers!
I apologise, that comment was a leftover from the issue template that I missed and left there by accident.
We took that out of the issue template; it was confusing, in this case both to you and me.
I just re-tested on High Sierra 10.13.6 and Big Sur 11.2.2. In neither case did the mouse work in the stock build, but if I set CIRCUITPY_USB_HID_GAMEPAD = 0 in mpconfigboard.mk for the board I was using, the mouse does work. If you would like help with the custom build, feel free t...
In CircuitPython 7.0.0 we plan to make it possible to turn these devices on and off in boot.py. In that case, we would probably also turn off Gamepad by default, in order to make Keyboard and Mouse work out of the box on all platforms.
HID Gamepad causes MacOS and iOS not to respond to HID Mouse. in 7.0.0, disable HID Gamepad by default, assuming that dynamic HID descriptors are implemented. Addresses #4479.
Setup
- Firmware: CircuitPython 6.2.0 beta 3 (en_US)
- Board: Raspberry Pi Pico
- Host: Apple MacOS Big Sur 11.2.2 on MacBook Pro 2014
Reproduce
- Load this code as
code.py
import time
import board
from digitalio import DigitalInOut, Pull
import usb_hid
from adafruit_hid.mouse import Mouse
button = DigitalInOut(board.GP16)
button.pull = Pull.DOWN
mouse = Mouse(usb_hid.devices)
while True:
time.sleep(0.1)
if button.value:
print('CLICK!')
...
I got this issue mixed up with #4479. The report of beta.2 working is surprising, and I will see what is going on. Nevertheless, see #4531.
Aha: the YouTube video https://www.youtube.com/watch?v=MjCFJCfq8ko cited above shows a mouse being used on Linux. This is a MacOS-specific problem. Closing this in favor of #4479, but they were both helpful.
@tannewt This does not contain any PacketBuffer-specific fixes. Were you referring to this PR in https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/91#issuecomment-812089166 ?
@tulip sleet hey dan sorry to bother you again, but would you have a minute to spare today? I'm in some debugging trouble and could use a second opinion
@dhalbert Nope, I haven't pushed the packet buffer fixes yet and ya, those fixes were what I was referring to. Will push them this afternoon.
@ladyada this is ready-ish for testing. I have not added:
- never-reset PWMs (like for backlight)
- correct checking for PWM sharing
- support for "X-channel" PWM, if possible (no code in SDK for it) - this affects only pin A2 (and ESP_READY) on the metro m7 1011
- ... more that I forgot
However, frequencies down to 15Hz and duty cycles from 0..65535 work for me.
tested on metro m7 with a range of frequencies!
working on updating ulab but not sure how to resolve this ... checking consistency... /home/jepler/src/circuitpython/shared-bindings/ulab/numpy/approx/index.rst: WARNING: document isn't included in any toctree (and other ulab submodules)
hm there ends up being no numpy/index.rst file.
i would build the tip of main now and see the old ulab struct to compare; you're probably doing that already
@ionic elk btw, now that I've branched 6.2.x, your reworking of the internal API naming, etc., is free to proceed
there's an extra level, ulab/numpy/approx vs ulab/numpy .. that's part of it
there is max toc nesting of 3, I think, would that make any diff?
@tulip sleet ok, should we merge my PR for it?
right, I could put in some time to do that
push to their PR with the changes, if it's open to contributions
we still need to remove the hard reset in that pr too
by the way, re: Jlink disconnecting due to the optimization settings, this is the error I'm getting ERROR: Cannot read register 0 (R0) while CPU is running
does the stlink work with gdb, maybe better?
I thought the j-link was quite good, though
I just don't understand why optimization settings would full on disconnect my debugger. That seems so bizzare.
none of these problems happen with a normal build, only debug ones
I'd like to just ignore it and solve bugs manually with the regular builds, but I'm worried that whatever it is could be mysteriously screwing up my program in any number of ways
i looked at the Makefile; I see nothing fishy in there
update the J-Link sw if you have not done so in a while
they update like once a week
Gotta look up how to do that again
@tulip sleet I have to back out my other changes, but adding a module-level docstring for those intermediate modules seems to be the trick -- https://github.com/v923z/micropython-ulab/pull/359
must have notes on it somewhere
is this on Linux or Mac or WIndows?
Download the latest SEGGER trial versions, eval packages and user manuals!
@onyx hinge that seems very odd, but sphinx is far from my favorite tool
bleh, no dice.
This includes ulab with https://github.com/v923z/micropython-ulab/pull/359 added. We can anticipate that a future ulab release will be made before CP7.0 goes out stable :)
Testing performed: On the unix port, ran ulab.numpy.linspace(0, 10) and the result looked plausible.
The upgraded version of ulab is nearly fully incompatible with 6.x, but is much more compatible with a subset of numpy & scipy. We believe this provides a better path for users of standard Python systems too.
It doesn't fail when I'm stepping through it either
only when I continue with no breakpoints
how does CP do the I2C pull up check?
I think it pulls the pin down and reads it
internal pulls are much weaker (higher resistance) than the i2c pull-ups are supposed to be
so internal pulls are required?
no
it pulls the pin down, waits 10us, lets go, waits 3us, and sees if it's high
the 3us is the longest to wait for satisfactory 400kHz operation
// We must pull up within 3us to achieve 400khz.
common_hal_mcu_delay_us(3);
how is the pull down done?
so pulldowns
so it does rely on internal pull downs?
just to test
yep. just asking about the test.
yeah, the pull-ups are not enabled during normal operation
if it instead switched to output and switched the pin low, and the pin was connected to vcc, you would get a short
yep. thanks. code listing helps...pretty simple test.
@tulip sleet hmmm I think I figured out why it's tossing the JLink - for some reason, the optimized debug code isn't connecting to USB, so it enters actual deep sleep
unoptimized I should say. I wonder if it's too slow?
tested on metro m7 with a range of frequencies!
Switched MISO and SCK pins to match board layout.
@tulip sleet want me to PR the packet buffer fixes to 6.2.x?
does it fix some common problems that people are encountering?
i would try to get it in right away, maybe do an rc.1 tonight
- Allow for ctrl-c during a write.
- Handle disconnects when acting as a client.
go ahead and PR to main; I can take a look. I am a little inclined to just wait if there are no known roadblocks
i am just thinking of doing 6.2.0 final on Monday or Tuesday; does that seem too soon to you
nope, I know the spresense folks want it
and that will enable us to do 7.0.0 alphas
yes, both are good reasons, and we can do 6.2.x's with these small changes if we want
yup yup
there are plenty of worse problems still present 🙂
i am willing to cherry pick; I would only do it if we felt there was a strong blocker in 6.2.0 final. Getting 7.0.0's going is good because people will be testing other things too; we can always say: it's fixed in unstable, please try
yup yup
kind of a saleae / kicad attitude
and we don't need to wait months for 7.0 stable either
yeah, i think it would be when i.mx was settling down; the BLE workflow would be nice, but it can be minimal in the first versions
I think that's the last fix for the BLE entry change
ya, we'll see how far I get
we can always do 8.0
🙂
if chrome can do 89, we can do 8
yup yup
we have plenty of numbers
anyone want to answer a ulab question on the forum? https://forums.adafruit.com/viewtopic.php?f=60&t=177511
I think I saw them here so it may have been answered on discord already
I hadn't realised there was so much code shared here. What's the explanation for the difference between nrf and raspberrypi implementations for level changes while the voice is playing?
Hey there fine folks! I'm looking at the list of issues, to see where I might be able to help, and I saw the SD card library (https://github.com/adafruit/Adafruit_CircuitPython_SD/) has a few issues I'd like to take a shot at, particularly #8. I assume the same library should work with any device with native SD or a breakout, correct?
there are now native implementations sdioio and sdcardio, which are missing only on the smallest boards
This library is called back from native code, and there are inherent problems with that.
so this lib is less important than in the past
I see. So would it be fair to say that this library is destined for the "archive" list soone than later?
Gotcha
Makes sense
as long as there are boards that can't fit the other impls, it has a place, but if someone wanted to do SD card operations with any seriousness, we would recommend an M4 or other board with more flash
sorry if it's a letdown; @onyx hinge you may have something more on point to sya
I'd say that's about right, we can't just remove it because there are some limited scenarios where it's the only option
Not a letdown, no worries! Just trying to see where I can help out, and thought I'd try starting with the more "generic" type hardware/issues. More proverbial bang for the buck
Will keep looking, and iterate through some infrastructure issues as I look
I would love your help with something
Oooh, sorry.l.. I'm all booked up! 😛
😦
ok
I am guessing that this is made json/github but I do not know how to start or where 🙂
Ok. I was looking at that one earlier actually, and was going to look into it. I guess it just got bumped up the list! 🙂
...right under "supper", which apparently needs my attention!
oh really? that would be awesome
Really! 🙂
Thank you 🙂
You're welcome!
Gonna deal with feeding family, and then will come back and look into it
I'll probably reach out if I have questions or want to run some ideas by you
Thanks no rush, if you teach me I can do it (y)
Ok, that can work too
Good 🙂
Learn and teach together!
yes lets do that
This is CircuitPython 6.2.0, the latest minor revision of CircuitPython, and is a new stable release. See Port status below for details on port stability, and Known Issues for known problems. If you find any issues with this release, please file an issue.
Download from circuitpython.org
Firmware downloads are available from the downloads page on [circuitpython.org](https://c...
I have to go through the comments in more detail but to give some clarity, I found the old non-M4 specific code in the history and restored that with the ifdef statements. I will look at the questions everyone has raised but I did not write a lot of the code myself. I had found it, restored it and tested it on the RP2040 and it worked. I will try to determine more of the "why" it worked.
@tulip sleet I'm thinking that some of my debugging troubles are because the STM32 RTC does not reset when the MCU does (due to Jlink or otherwise). Thus, when it crashes and de-enumerates USB, it will not re-enumerate until the power is cycled (because the tick count is already way higher than the USB delay). I can reset it in the HardFault handler, but what is the Circuitpython standard for timekeeping - should I make it so the tick count is reset every time Circuitpython is reset/woken from deep sleep, so the state is the same as after a power cycle?
Alternatively I could make the USB delay relative to when it begins looping, rather than an absolute based on the global tick
Scott talked about making time.monotonic() start from zero on a reload/reset. The STM32 RTC is much fancier than many of the others. There is tick counting and there is time keeping. The ticks could start from zero but the RTC does not need to be reset. You just need to keep an offset, which is something we talked about.
what does the ESP32 usb delay do? Does it also delay only the first time?
I haven't really checked in detail. I only know about this STM32 issue because the RTC specifically doesn't reset with everything else, it keeps going, which has caused me all kinds of headaches
but I imagine is useful in general
I don't know how standard that is, I'd have to read about the ESP32-S2 one to see if it's the same
@still zephyr - I had a bit of a look at what the CP bundle is doing to build up that page. Looks like there are a few systems coordinating to build it, but no JSON or other such input.
btw is the reset line from your j-link hooked up to the boardd?
maybe the esp32 behavior is alos not good, I don't know. But I think the hard crash would cause it to start over
Just in this case, it wasn't helping with the USB not enumerating, because it basically stays timed out forever after the board is powered on
the RTC in the nrf52 gets reset all teh time
it is just a tick counter
i would not necessarily expect USB to recover after a hard fault anyway, but I guess it would be nice
I will try putting in a tick offset and see how that goes. If it doesn't work, I may revert to just resetting the RTC every time we start up and revisit this issue later
I'd like USB to recover after I hard fault and re-flash the board!
it won't even do that
😮
That is the good news?
Somewhat. Still need to dig into the part that does the work, but it appears to mostly be a script that loops over the driver and library directories to get the necessary data, and then generate the page
It looks like there might be a portion, like adding the generated page to the repo, that's handled by Adabot. But that is about it
yeah I was looking at Adabot yesterday, but I could not figure out anything
A good place to look at how it's being done is to look at the build.yml and release.yml files in the Adafruit bundle's repository
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/blob/master/.github/workflows/
And some of the scripts it uses are here:
https://github.com/adafruit/circuitpython-build-tools
Just in case one day you have this error in the CI: Inline strong start-string without end-string.
Only the CI will catch it, if you build you documents locally using sphinx-build -E -W -b html . _build/html the error will not be there.
The CI will report a line, but the line is wrong. Not luck looking for that in google.
**Title*
should be like this
**Title**
Looks like it's a strictness check
oh you're looking for where it's called from
@jaunty juniper but how to build the *.md file?
oh I see
We just need to give it the current bundle_path
But the community bundle is there https://github.com/adafruit/adabot/blob/a6c26692e55cd3f9ff9eccdcc66967f17fa32080/adabot/circuitpython_bundle.py#L42
@tannewt can I have a re-review & merge now that it's green?
oh looks like it explicitely excludes the community bundle
https://github.com/adafruit/adabot/blob/master/adabot/circuitpython_bundle.py#L59-L61
https://github.com/adafruit/adabot/blob/master/adabot/circuitpython_bundle.py#L186-L192
😮
So why included in the search list to not included after
seems to be only for that file I guess
that's where I would look for a change, the hard part being testing it
I guess printing update_info and exiting at line 380 would do it
the line updates.append(("https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md" has to be changed with the bundle repo name in it I'd say, and the test at 60 removed and then what happens
lines 97-99 should be guarded by the removed test, or parametrized somehow
is there any way to test this, I mean like try it?
with clone of the community bundle locally?
like bundle_path[-1].replace("_"," ").title() to generate the name on line 97/99
yes, I would try running python3 circuitpython_bundle.py
you would clone the bundle repos and also update submodules
that's how you pull all the libraries in
ok Ill do that
https://github.com/adafruit/Adafruit_CircuitPython_Bundle#development
After you clone this repository you must run
git submodule initand thengit submodule update.
ah actually adabot-cron calls it with python -m adabot.circuitpython_bundle (in a venv) so I would do that (with python3)
Thanks
@jaunty juniper is a lot more helpful than I've been!
Thanks Hugo
You're welcome. I tried, and hopefully was marginally helpful
Of course, you still could help 🙂
I am not so sure, when you hear it from neradoc it seems so easy, but I am not so sure myself
Everything always seems so easy when someone who knows what they're doing explains it. Then the "here, you try" moment appears and it's like everything I saw or heard fell out of my head onto the ground!
I've fought with the bundles in the past when I looked at circuitpython-build-tools 😉
@still zephyr thank you for looking into the Community Bundle issue ❣️
I forked circuitpython to my github, cloned that to my local ubuntu, built my rp2040 board but the update.sh (git pull && git submodule sync && git submodule update --init) script I'd run every day didn't seem to do anything. I discovered remote, added that then fetched/merged, I show I have 6.2.0-rc.0 but how to I use 6.2.0-rc.0 to build a board?
is make BOARD=somethingsomething failing ?
No, I was removing modules and broke the build tools, they say it is fixed with 6.2.0-rc.0
have you run pip install -r requirements-dev.txt ?
I believe there's some new things in it (the file itself was recently added)
just ran it, everything is already satisfied
How do I just git requirements-dev.txt
I'm sorry, I don't know what you mean, I'm also not super knowledgeable on the build process, you might have to wait for somebody else to be there
git restore requirements-dev.txt grabed the April 1 version, mine was 3/27
no difference, everything was already there
ll
So all we need here is to expose it in a constructor.
Hi. Is there a library available which allows to detect button double clicks or long clicks. Similar to this one? http://www.mathertel.de/Arduino/OneButtonLibrary.aspx
No problem :). We need to thank @jaunty juniper , so far I am seeing that we need to change the common_funcs.get_bundle_submodules function, and for sure some hard-coded stuff as Neradoc mentioned yesterday. But I am getting the list now, next steps deal with the .md file
[adafruit/circuitpython] Pull request opened: #4538 update tinyusb to fix midi buffer overflow issue
update tinyusb to fix #4190 , should wait for user confirmation before merging.
@DynamoBen I make an PR #4538 that should fix this issue, I have run your code on pico for an hour, and it still blink as normal. also attached the uf2.zip here firmware.zip for quick testing.
This includes ulab with v923z/micropython-ulab#359 added. We can anticipate that a future ulab release will be made before CP7.0 goes out stable :)
Version 3.0 should not change how ulab behaves, it should only add a new module: https://github.com/v923z/micropython-ulab/pull/327
However, I thought that circuitpython would stay with the legacy branch for the 6.x series. Has anything changed?
Add the alias boards to the modules Support Matrix (on readthedocs).
This moves the notion
add list with manual brand names for aliases
the new info in the support_matrix is used in build_board_info.py
However, I thought that
circuitpythonwould stay with the legacy branch for the 6.x series. Has anything changed?
This has not changed. The main branch for circuitpython is now the start of 7.0.0. 6.2.0-rc.0 was released this week, and we created a new 6.2.x branch for it. We hope 6.2.0 final is imminent.
accidentally validating the PR form because of weird shortcuts makes me want to cry >_>
I've thought about a more appropriate term a bit more: how about "system firmware"? If you want to PR a change to CircuitPtyon for generic mentions of "Soft Device" and "SoftDevice" converted to "system firmware" or some similar phrasing, that would be great. I agree "Soft Device" should not have a space, as well.
(I found the Nordic choice of "SoftDevice" to be confusing as well when I first saw it, and the acronym "SD" overlaps with SD cards.)
@timber mango thank you for the issue cleanup!
Here's an idea about using Python exceptions to allow something like a button push or other external interrupt to interrupt normal program flow, without having to provide general interrupt handlers or having to poll.
For example, suppose you want a button push to interrupt a NeoPixel animation, and go on to the next animation. Instead of checking for the button push at various strategic places, we could just ask that a transition DigitalInOut cause an exception to be raised. The outer lo...
The same idea could also be used with timers. A timer would go off and raise an exception. I'm not sure where to put that functionality. Both the pin capability above and the timer capability could also be part of alarm, but for pins, the above seems cleaner. Or perhaps alarm might be refactored in some way.
im intrigued - mostly because i think it would be an easy-ish (comparatively) thing to do!
Here are some initial thoughts.
- It risks running afoul of places where people wrote 'except Exception as e:', unless this new kind of exception is outside of the Exception class hierarchy (like KeyboardInterrupt is).
- More generally, there is a lot of code which assumes that exceptions can only happen at known moments, except for program-terminating exceptions like KeyboardInterrupt generally is. We could fix the code once we know about it, of course.
- Would the 1ms tick need to b...
Code looks good but you'll need to fix the CI.
Basic PWM now works, and has been tested on the MIMXRT1010-EVK and a prototype Metro M7 1011: #4530
Basic PWM has been enabled, but there are still limitations. Here are the ones I know of:
- [ ] never-reset PWMs (like for backlight)
- [ ] correct checking for PWM sharing
- [ ] support for "X-channel" PWM, if possible (no code in SDK for it) - this affects only pin A4 (and ESP_READY) on the metro m7 1011
- It risks running afoul of places where people wrote 'except Exception as e:', unless this new kind of exception is outside of the Exception class hierarchy (like KeyboardInterrupt is).
I think except Exception as e: is kind of poor practice, and presumably someone using TransitionException would know that would happen.
- More generally, there is a lot of code which assumes that exceptions can only happen at known moments, except for program-terminating exceptions like Keyboar...
@hathach it does keep blinking, but now I'm back to the original problem. The code continues to run but MIDI stops being sent.
If all one cares about is the first transition, debouncing can be handled in the except:
except digitalio.TransitionException
animation_number = (animation_number + 1) % NUM_ANIMATIONS
time.sleep(0.1) # debounce
@astral tinsel what error are you getting when trying to compile circuitpython?
I am still seeing message fine with my pico, tested on ubuntu 20.04

@hathach OK but I'm on Win10
If all one cares about is the first transition, debouncing can be handled in the
except:except digitalio.TransitionException animation_number = (animation_number + 1) % NUM_ANIMATIONS time.sleep(0.1) # debounce
Is a TransitionException a one-time event? If not, it can re-trigger inside the Except.
(btw, i dont really trust transition irq s - they can get lost. i like level type :)
Is a TransitionException a one-time event? If not, it can re-trigger inside the Except.
Good point. Details to be worked out.
Safer if one time:
while True:
# Triggers once only. Re-enabled each time around the loop.
button.raise_exception_on_transition(digitalio.Transition.DOWN)
try:
while True:
# Animation can be interrupted at any time,
# not just when it finishes.
run_animation_once(animation_number)
except digitalio.TransitionException
animation_number = (animation_number + 1) % NUM_ANIMATIONS
Thanks for testing, seem like this is another the issue than the one is fixed in the #4538. Will reopen this
I have been looking forward to this - thanks!
My change is suggested, your choice. I'll approve if you don't want to do it now.
Could use $(shell find ...) here for arbitrary depths.
https://stackoverflow.com/questions/4036191/sources-from-subdirectories-in-makefile
@tidal kiln would you just RMA this? https://forums.adafruit.com/viewtopic.php?f=60&t=177389
it's very weird
I could ask them to try resoldering the usb
@slender iron @tidal kiln the bit being changed is 0bnnn0nnn in the two examples they gave
so I'd suspect a stuck bit somewhere in the hw; worth replacing, seems to me
not USB connector
yah, that soldering looks fine imo
and connection issue would be more random
@slender iron just replace it. actually RMAing would be up to limor. i can respond if you want.
np
+1 for this. Why not point the existing alarm api to raise an exception. We already use interrupt in fake deep sleep.
import alarm
import board
pin_alarm = alarm.pin.PinAlarm(board.IO0, edge=True)
while True:
# Triggers once only. Re-enabled each time around the loop.
alarm.raise_exception_on_alarms(pin_alarm)
try:
while True:
# loop
except alarm.PinAlarmException
# handle interrupt
People ask if CircuitPython supports interrupts. It does not support user-written interrupt handlers in the way that MicroPython or Arduino do. However, it of course does use interrupts internally for specific functionality, such as PulseIn, countio, rotaryio, etc., etc.
MicroPython supports Pin interrupt handlers and [Timer-based interrupt handlers](http://docs.micropy...
Primary use case for me is pin and timer interrupts that will preempt long or unpredictable-length code, like Requests.
here is a fun nrf hang: https://gist.github.com/tannewt/889b2a7f70265198514f79e84dea4636
calling usb background from an interrupt
Wohooo. Just got CircuitPython compiling on my Mac. Thanks for good documentation!
Anyways, I need some help. I have forked the repo, cloned it to my local machine, added adafruit/circuitpython as upstream and ran the command git fetch upstream. Seems not to be enough to see all the latest code?
Did you use git submodule update --init # note no --recursive
?
I did. As well as git submodule sync
try git pull upstream main
Thanks @analog bridge that did it.
So. How do I get my clone fork on Github updated now that my local repo is up to date?
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: extmod/ulab (new commits)
modified: lib/mp3 (new commits)
modified: lib/protomatter (new commits)
modified: lib/tinyusb (new commits)
modified: ports/esp32s2/esp-idf (new commits)
modified: ports/raspberrypi/sdk (new commits)```
However, I thought that
circuitpythonwould stay with the legacy branch for the 6.x series. Has anything changed?This has not changed. The
mainbranch forcircuitpythonis now the start of 7.0.0. 6.2.0-rc.0 was released this week, and we created a new6.2.xbranch for it. We hope 6.2.0 final is imminent.
@dhalbert Thanks for the clarification! By the way, if you think that https://github.com/v923z/micropython-ulab/pull/327 has any relevance for circuitpython, you coul...
first you need to perform git submodule update
Is there an easy way to know what linguistic version of the firmware is running? The idea would be to have a multi-lingual program that will display by default message in the language of the firmware (assuming it is what the user expect/want).
a submodule update will resolve the unstaged submodule changes, then you can do a git push
This will be more involved than you realize.
There isn't any way to find out currently. CPython has a locale module, but it's large and is not recommended for finding out the current locale. There is os.environ['LANG'], which works only on Linux and Mac, supposedly. I will rummage around and see if there any proposals, since CPython doesn't support translations now anyway.
Not really looking for a "standard" way. an CP way would be good enough. Maybe a string to be translated would contain the language name... and getting that one will be the answer.
https://bugs.python.org/issue16344 discusses internationalizing the CPython error messages. There was a draft PEP it appears, but it has disappeared
we could add supervisor.language or something like that. I'm not sure where else it would live right now
there is no circuitpython module; maybe there should be, but it's another thing to take up valuable space in the smallest builds
Changed error message to display the generic term 'system firmware' instead of the Nordic specific term 'soft device' as suggested by @dhalbert.
Tada! My first pull request!
Something broke my code and I noticed while upgrading to rc0:
report = int.from_bytes(usb_hid.devices[0].last_received_report, 'big') # See https://github.com/adafruit/circuitpython/pull/3302
TypeError: object with buffer protocol required
I remember someone wanted to simplify the reading of usb report.
I was doing this to get NUM/CAPS/SCROL LOCK:
leds[0].value = (report & 0x01) == 0x01 # NUM LOCK
leds[1].value = (report & 0x02) == 0x02 # CAPS LOCK
leds[2].value = (report & 0x04) == 0x04 # SCROLL LOCK
I added support for NUM LOCK, CAPS LOCK, SCROLL LOCK and COMPOSE in adafruit_hid.keyboard in https://github.com/adafruit/Adafruit_CircuitPython_HID/pull/62
Edit: @thorny jay
@cobalt grail Not in Weblate?
I changed the english error message in the .c files, need to wait for a merge before I can do the actual translation. 🙂
So, not in weblate.
Yes I changed the message this morning in weblate following dan<s recommendation, but Thank you, now I need to go back an re-translate 😆
Yeah, I thought it would be kinda strange if only non english speakers would get proper error messages. Besides, @slender iron always nags about pull requests when I nag about his error messages.
Thanks for pointing out the jargon and fixing it!
Adding bool to constructor to reverse direction would probably solve this. It looks like this would about 10 lines of code. Bool change operation from += to -=. Logic is incremental encoder so reversing the pins will just change the direction.
Probably should add bool to structure here.
https://github.com/adafruit/circuitpython/blob/51...
Do a make translate and commit and push again. That's often necessary when messages change.
@jaunty juniper 👀
Not sure why that was in the code I copied but it was causing an error so removed now. Thanks.
Thanks, I fixed my code to use that function... but it does not explain why my old code failed after upgrading.
I looked at this more, and did some instrumentation of the current code and your PR #3967. I instrumented the interrupt handler and noticed it is losing interrupts sometimes (though that may be due to my print statement). A couple of observations on the base algorithm:
- If interrupts are missed, then there will be missed counts, because the count-to-4 logic won't count to 4 by the next detent, and will get out of sync.
- If we can determine the quiescent state (at a detent, usually 11), ...
What is usb_hid.devices[0].last_received_report actually returning? You could print it, and print its type, so we could see what the issue is.
I think it was None. I am afraid I scratched my original code to fix it. Looking for the gist where I would have published that.
so maybe that is what is returned if a report has never been received
i'd have to check that
yes:
//| last_received_report: bytes
//| """The HID OUT report as a `bytes`. (read-only). `None` if nothing received."""
so it has been this way before, maybe it just never happened to be tested in a case where no report was yet received
Thanks for pointing out the jargon and fixing it!
Do I need to do anything else besides push the make translate change?
that should be it. There is a new way to check for these and other issues in advance:
pip3 install pre-commit
cd <your-repo>
pre-commit install
Nice. Will try that.
pre-commit will run a bunch of checks before it actually does a commit, so various things can get caught in advance of pushing. I think it may do a translation check, but I can't remember if we got that to work or not
you only need to run pre-commit install once on the repo. You can also run the checks by hand before even trying a commit by doing pre-commit run --all or something like that
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Translations.............................................................Passed
Formatting...............................................................Failed
It fails on Formatting - FileNotFoundError: [Errno 2] No such file or directory: 'uncrustify'
Glad to see imxrt port getting some love <3
oh, you gotta install that beforehand. I need to put that in the guide brew install uncrustify i guess. Tell me if that works and I'll put it in the guide. It is a C-code formatter
i know how to install it for linux
Yep, brew managed to install it. No it says FileNotFoundError: [Errno 2] No such file or directory: 'black'
hmm, pre-commit should try to install it, I thought
Might be a Mac thing?
you can do this
$ cd circuitpython
$ pip3 install -r requirements-dev.txt
I may just be mistaken. I do these installations once and then forget because they work happily ever after
To late, alreayd running brew install black
use the pip3 version, not brew
Ah.
they may not be the same, and we use the pip3 version in general
e.g. pre-commit on GitHub will use it
Oh, that was a long list of requirements.... 🙂
Nope.
File "/Users/jonny/Developer/circuitpython/tools/codeformat.py", line 186, in <module>
main()
File "/Users/jonny/Developer/circuitpython/tools/codeformat.py", line 182, in main
batch(command, lang_files(PY_EXTS))
File "/Users/jonny/Developer/circuitpython/tools/codeformat.py", line 164, in batch
subprocess.call(cmd + file_args)
File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 349, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/Cellar/python@3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1823, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'black'
And
Requirement already satisfied: black in /usr/local/lib/python3.9/site-packages (20.8b1)```
I don't get it.
black not found
did you ctrl-c the brew install black? It may have left it in a partially installed state
try brew remove black
or uninstall i forget which
pylint would also have been installed, I think; can you run pylint?
Which pylint says not found.
no, it's not installed, sorry
🙂
which mypy
well, try the brew uninstall of black and then pip3 install it
yes, maybe the linking stage got interrupted
Yeah, that did it!
Check Yaml...............................................................Passed
Fix End of Files.........................................................Passed
Trim Trailing Whitespace.................................................Passed
Translations.............................................................Passed
Formatting...............................................................Passed```
Tada! 🥳
Thanks for the help!
yw!
i updated the guide to include uncrustify. The pip3 install -r requirements-dev.txt was already on the "Build CircuitPython" page, because it requires cloning the repo first
I do not know if this is helpful or not. I made this translation by reading ARM instruction set documentation: (Note I have not tested this. It may have errors.)
const uint32_t upper = (1 << (bits - 1));
const uint32_t lower = 0 - upper;
int32_t lo, hi;
// asm volatile ("smulwb %0, %1, %2" : "=r" (lo) : "r" (mul), "r" (val));
int64_t tmp = mul * (val & 0xFFFF);
lo = tmp >> 16;
// asm volatile ("smulwt %0, %1, %2" : "=r" (hi) : "r" (mul), "r" (val));
int64_t tmp = mul *...
Is there a casting error possible? (I am not sure it matters.)
I was not completely sure which range gets saturated to be honest either.
https://www.keil.com/support/man/docs/armasm/armasm_dom1361289886623.htm
This is interesting; I'm not sure whether it's applicable or not:
Branchfree Saturating Arithmetic
https://locklessinc.com/articles/sat_arithmetic/
@dhalbert if you're ready to give this a review, I can handle the merging on the NRF port.
@dhalbert this is (finally) finished and ready for review, whenever you have time. In particular, note the changes in 9240146, which handles the light sleep object assignment problem we talked about (not yet fixed for ESP32-S2).
I hadn't realised there was so much code shared here. What's the explanation for the difference between nrf and raspberrypi implementations for
levelchanges while the voice is playing?
There were problems with the non-ASM math which is why "level" didn't work. Sorry I was not super familiar with audiomixer to start and missed testing the level parameter. The latest build should have it working.
Maybe. I fixed the errors so it now works and seems acceptably fast on the RP2040. I think with a bit of work the above ASM may be able to be used without the float being used, but in that case you may need an int64 which I'm not sure limits us on some boards or not? I did upload the fixed code so it can at least work, not sure if its worth continuing on the potential speed improvement or PRing this now?
I do not know if this is helpful or not. I made this translation by reading ARM instruction set documentation: (Note I have not tested this. It may have errors.)
Cool thanks. I did look at it and I think with looking at it, it may work. The question I'm thinking about is if this way of doing it is meaningfully faster then the other way.
Hi Circuit Python Team
We have added our new board HunterCat NFC https://github.com/ElectronicCats/HunterCatNFC
https://electroniccats.com/store/hunter-cat-nfc/
Thanks
I do not know if this is helpful or not. I made this translation by reading ARM instruction set documentation: (Note I have not tested this. It may have errors.)
Cool thanks. I did look at it and I think with looking at it, it may work. The question I'm thinking about is if this way of doing it is meaningfully faster then the other way.
I just went through the git log and found this:
https://github.com/adafruit/circuitpython/blob/362c1664ae5979f288e8cb12d528f8cd44100410/shared-...
can we create an exception in CPY where some data is passed through the exception... something like following
try:
# underlying c code triggers exception
except FooException as e:
print e.foo
ya, python supports that. it should be possible
Also note that slower clock does not always mean less power because it takes code longer to execute. My understanding for low power is that you want to process quickly so that you can get to sleep faster.
I agree this should be enabled at some point though for overclocking when power doesn't matter. We could make it settable from boot.py only.
Clock generally predicts higher power consumption. It is complicated. It depend on a number of things. For some parts this can be true. You...
I do not know if this is helpful or not. I made this translation by reading ARM instruction set documentation: (Note I have not tested this. It may have errors.)
Cool thanks. I did look at it and I think with looking at it, it may work. The question I'm thinking about is if this way of doing it is meaningfully faster then the other way.
Stupid idea, but I will say it anyhow. That logic may force the compiler to optimize in M4 and run basically the same instructions on M0/M0+. Pe...
I was looking though the release notes of the 6.2 betas and I found as of beta 4 USB cdc is disabled by default. What is the reason for this?
it caused incompatibilities with existing tools that access the REPL
two reasons:
1 - the ports where not always in the expected order (REPL first) on windows, so Mu would not see the REPL for example
2 - workarounds using the cdc channel names would not work with the current version of pyserial
it will come back in 7.* when we have the feature to enable/disable USB endpoints in boot.py
Thanks, I need it for a project so I will compile it from source. Will the order be correct on Linux?
I think it should be when ordered by path, but also the REPL name is "Circuitpython CDC ..." and the other is "Circuitpython CDC2 ..."
from serial.tools.list_ports import comports
for port in comports():
print(port.device, port.interface)
/dev/ttyACM1 CircuitPython CDC2 control
/dev/ttyACM0 CircuitPython CDC control
/dev/ttyAMA0 None
ACM0 is the repl here
Thanks, makes much more sense now
the issue with pyserial is that on windows port.interface is empty and on mac it's the same value for each port. If you need that on those platforms, Dan wrote a library with fixed versions of comports() because the pyserial repo seems to be inactive and our PRs are left unmerged so far.
https://github.com/adafruit/Adafruit_Board_Toolkit
I did some more work on this and came up with the following api:
import alarm
import board
touch_alarm = alarm.touch.TouchAlarm(board.IO6)
alarm.raise_exception_on_alarms(touch_alarm)
try:
while True:
pass
# loop
except alarm.AlarmException as exc:
if exc.args[0] == touch_alarm:
# handle interrupt
print(exc.args[0].pin)
This is similar to the existing alarm api and also reduces the exception to only one (i....
I’m fully Linux for dev work and embedding into applications so it won’t be an issue, thank you for all your assistance
I am trying to make a custom build but I keep getting errors. I followed all setup instructions from the documentation and I tested it on macOS Big Sur and Ubuntu 20.04.
On Ubuntu I get the following error:
`ubuntu@circuitpython:~/circuitpython/ports/raspberrypi$ make BOARD=raspberry_pi_pico
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated
Traceback (most recent call last):
File "gen_stage2.py", line 82, in <module>
...
I managed to make a build form the 6.2.0-beta.4 tag with the CIRCUITPY_USB_HID_GAMEPAD = 0 flag and I confirm that the mouse does work on macOS Big Sur.
@gilded cradle Hi, I have some doubt about display (minipitft 240x240) on CP (with physical wiring to Pi) on a mcu and display on a Raspberry Pi Zero. I have the feeling that there are difference in API.
#it is in:
import adafruit_rgb_display.st7789 as st7789
#...
display = st7789.ST7789(
I had to replace:
colstart=0,
rowstart=80,
with this:
x_offset=0,
y_offset=80,
Now that the code is working on the Raspberry Pi Zero, I will see if the same code works on the Raspberry Pi Pico (with pin adaptation).
Ok it is a difference between adafruit_st7789.ST7789 and adafruit_rgb_display.st7789 but because the guide https://learn.adafruit.com/adafruit-mini-pitft-135x240-color-tft-add-on-for-raspberry-pi/python-setup mostly talk about the 135x240 screen and lack 240x240 example code... I adapted working code from one world to the other world.
Now I am a bit confuse on why use adafruit_st7789 or adafruit_rgb_display when you want to drive a st7789. What is the "right" thing to do? Is one the old way and the other the new way?
What you need is a clocking manager for each port. Under the covers each module that needs a clock will register a callback to that specific clock. When you change the frequency it will compute the correct settings. Manager will then call each handler notifying it of the new clock value.
Handlers will throw exception if failure occurs for "critical" clocks. Others can fail silently as they are best effort. USB for example is critical clock, while SPI is not. This is a poor example, because...
@microDev1 Thanks for doing a proof of concept so fast! I am interested in having these even in small builds, so we have to think about how to make alarm pervasive and still fit. It may not be possible. Perhaps we would leave the sleep functionality out, but I think we may still have to remove something else from small builds to make it fit.
Hi, just one question about a comment.
Is this comment outdated? math is not removed, and nothing is frozen.
@thorny jay I use adafruit_st7789 for displayio on MCU (it's just the init), and adafruit_rgb_display.st7789 on Pi with Blinka (and PIL)
Hum...
So if I want to run the same code on both a Pi Zero and a Pi Pico... what would you use (for the LCD)?
More or less the same code. 🙂
And I am currently trying to find the most simple way to know where the code is running.
something in os. or board. or sys.
Does displayio work on Pi? I think I tried that and couldn't get it going, so reverted to PIL.
I can import it...
What is more, I would suggest updating the MacOS Setup guide to replace the
brew install gcc-arm-embeddedwith the manual installation (similar to the Linux setup). That is because thegcc-arm-none-eabi-10-2020-q4-major-mac.tar.bz2package is not signed and the MacOS prevents executing the compiler binary with the "Unidentified Developer" error. Thegcc-arm-none-eabi-10-2020-q4-major-mac.pkgpackage is "Signed and notarized" and it works fine.
Thanks for noting this! This is a movi...
sys.implementation.name will tell you what kind of Python you're running
cpython on Pi; circuitpython on MCU
other ways to differentiate: sys.platform, os.uname()
displayio should work https://learn.adafruit.com/running-pyportal-code-on-blinka-with-displayio I don't recall what issue I had
Would it make more sense to first create a settable clock speed for "on next reboot", and then progress to what you're mentioning above? Many of the applications for lowering the clock speed will not need to be done on the fly. For instance, what sent me down this rabbit hole was that the stm32f405 jams gps antennas while running at 168mhz.
Following the guide at https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython/ :
- copied
boards/simmel, which is another nRF52833-based board; - updated
mpconfigboard.mkwith
USB_VID = 0x0d28
USB_PID = 0x0204
USB_PRODUCT = "micro:bit"
USB_MANUFACTURER = "BBC"
- updated
mpconfigboard.hwith
#define MICROPY_HW_BOARD_NAME "micro:bit"
#define DEFAULT_I2C_BUS_SCL (&pin_P0_26)
#define DEFAULT_I2C_BUS_SDA (&pin_P1_00)
#define D...
The level per voice works on revised changes with my code. My code avoids voice 0 and uses 1-12, btw.
.. 2.1.5 was rather old, and @v923z kindly created a 2.6.0 release tag for us.
However, we still need fixes to build: https://github.com/v923z/micropython-ulab/pull/360
We'll upgrade ulab again before 7 goes out stable, so we can work on incrementally improving the documentation situation.
The nRF chip on the micro:bits is not connected directly to the USB pins; it goes through the interface unit microcontroller, as you may know . So I'm not surprised you are not seeing the REPL. All the current CircuitPython code assumes that the REPL is over USB. We never supported the micro:bit V1 with CircuitPython. There is a specialized port of MicroPython that did a lot of squeezing to get it to fit in the small RAM and flash space.
Currently, we would not support the micro:bit V2 bec...
I have been playing with the enhancements to ulab and bitmap with the clue fft example https://learn.adafruit.com/ulab-crunch-numbers-fast-with-circuitpython/fft-example-waterfall-spectrum-analyzer
Per row, here are some timings. Reading the audio samples takes about 16ms, and doing the fft calculations another 7ms, both approximate. Using assignment via bitmap memoryview is fastest, taking about .5ms per row. Using arrayblit is next, taking about 1.2ms/row. Using the looped pixel assignment is slowest, taking about 12ms/row. Going from 12ms to .5ms is good, for the part we optimized; but even before starting it was the smaller part of the whole process, so overall it goes from about 36ms to about 24ms, only 33% faster.
If we could sample in the background, then either arrayblit or memoryview are fast enough that we could continuously display the fft of our audio signal which is really awesome! audio improvements like that are something we'd love to see. (assuming sampling itself doesn't take away any CPU time, the fft+bitmap update code only needs about 8ms out of every 16ms, or 50% of the CPU)
Eventually, when CP7 is closer and these things are nailed down, we'll have to update the ulab guide.
The nRF chip on the micro:bits is not connected directly to the USB pins; it goes through the interface unit microcontroller, as you may know . So I'm not surprised you are not seeing the REPL. All the current CircuitPython code assumes that the REPL is over USB.
Yes, but the interface controller is supposed to expose the specific pair of nRF pins (P0.06 and P1.08) as a USB serial interface -- that's my understanding from their schematic page. Mass storage experience aside, why does the...
why does the non-direct USB connection stop the REPL from working?
The CircuitPython REPL code is sends and receives characters over USB serial port using TinyUSB, not via the UART port you mentioned (P0.06 and P1.08). There is some latent support for this in the nrf port, but we haven't tried it out in a while and it may have gone stale. Try setting CIRCUITPY_REPL_UART = 1 in mpconfigboard.mk, which primarily controls code in ports/nrf/supervisor/serial.c.
[note edit in previous comment]
So far in testing, this does seem to have improved in rc.0! I will continue to test this weekend before I have to put my MatrixPortal back into "production mode" on Monday. I'll reopen if I run into this issue again.
Built myself locally, and looked it over. Looks good here.
I understand in theory how to load the code. I understand in theory what you can do with that second core that may be of interest. In theory I understand the appeal of Python here and how it could be terrible yet passable.
What I do not understand is how you plan to implement it and provide something like real time. I am also curious to know if you know where that issue could exist.
The RP2040 provides the raw materials to achieve it. They are cost optimized and will not play nice with ...
mp_repl_autocomplete already had special handling to autocomplete the import statement; this PR makes it more useful by autocompleting modules to import.
The actual change is minor: 11 lines of new code; the rest is a refactoring of a massive, do-it-all, deeply nested function.
It is required to call .dirty() with appropriate arguments after modifications through the buffer protocol, or the display might not be updated correctly.
I've played with this a bit locally with #4547 with an adapted FFT waterfall and it is the fastest method I found to update bitmap content. However, both this and arrayblit were about 10x faster than repeated assignment to b...
There's no code per se, because it locks up during disk activity and/or soft reload. I assume that the code from the guide will set up the conditions for eventual failure:
displayio.release_displays()
matrix = rgbmatrix.RGBMatrix(
width=64, bit_depth=4,
rgb_pins=[board.D6, board.D5, board.D9, board.D11, board.D10, board.D12],
addr_pins=[board.D25, board.D24, board.A3, board.A2],
clock_pin=board.D13, latch_pin=board.D0, output_enable_pin=board.D1)
display = f...
This looks great. Something I've often wished for. Didn't test.