#circuitpython-dev
1 messages Β· Page 304 of 1
hehe doubt it
maybe i'll throw rasbian on an SD and test real quick. really wish they'd switch to a arm64 kernel; would make this easier than having to rely on Ubuntu's RPi images. π
night, all, @ivory yew you're welcome, and @raven canopy good luck!
but i understand the backport issues they'd have with older Pis
nn @tulip sleet! thanks for the bug report link!
Per @tannewt there is currently vertical TileGrid scrolling available in the C libraries. Access to the underlying library would likely speed up vertical scrolling of a TileGrid.
This is a request to allow python code access to the available underlying TileGrid C code for scrolling.
@ivory yew π (we had no doubt you'd get it... :D)
psh I did
I am well into uncharted territory right now
(for me, at least)
USB hosting, SPI slave, writing using Atmel/Microchip's silly C libraries.
ASF4. its... well, it is. hehe
Harmony is supposed to be different.
Maybe not "better", but different.
but meh, I'm invested here, so whatevs.
I've been super disappointed in the docs around this stuff
I mean, there's a literal 4 line example for SPI slave. A maybe a 2 sentence description.
The best part is when the docs say one thing, the errata says nothing, and it still doesn't work. I'm looking at you TC->PPW->direct_pin_capture. π
I'm beginning to think it's not hardware related, but rather to the fact that, in order to save space, I have CIRCUITPY_USB_HID = 0. I still see the HID descriptors in the config descriptor that gets sent out.
I think the nRF52833 is a red herring. Setting CIRCUITPY_USB_HID = 1 fixes the issue.
I'll update the title of this bug.
Simmel had USB HID disabled in order to save space. However, the board
configuration did not set USB_DEVICES, causing it to inherit the default
device bouquet of MSC,CDC,MIDI,HID. This in turn caused HID to be included
in the USB Configuration Descriptor.
For some reason, this was not a problem in an earlier version of tinyusb or
circuitpython. However, in the most recent version this has rightfully
caused asserts to appear during configuration.
Re-enable USB_HID for now, as it ...
Oh great, really fast fidning, I didn't even manage to find the 833 dk in my arsenal yet :D. Indeed the tinyusb latest does has some internal improvement for handling drivers lately.
I think the main thing I like about them compared to using toml, xml, json etc is that you can easily reference other nodes. For example gpios = < &gpiob 0x0 0x0 >;
One alternative would be to create some nice data structure in python? Then we don't need to parse it.
The reason I'd like to use a system like this is to avoid having too many places to change when adding a new port/soc/board.
@tulip sleet I've not made a note of the conditions but I've done some fairly normal things with Adafruit boards and managed to get Windows 8.1 in a state where 1) the device isn't recognised anymore by Windows and 2) a reboot is required and 3) shutdown of Window is borked and maybe pauses "forever" (at least 5-20 mins). It's very infrequent. I did have one just over a week ago. I might have seen this three times in total.
that sounds like a problem with Windows or one of its drivers
@stuck elbow That's what I would assume normally and was why I'd not mentioned it to date but Dan was talking about Linux keeling over due to possible USBisms.
@tulip sleet @onyx hinge Am I correct in seeing there's no unstable release right now of CP?
@idle owl I think that's right. @slender iron mentioned wanting to make an unstable release after lower power was merged so hopefully that'll happen soon
Ok. Thanks.
@tannewt ping for re-review
@lucid solar was your issue with UART reproducible (the BUSY issue you mentioned)? Or was it just a HAL question? If you were getting a HAL_BUSY usually that means something is wrong with the interrupts.
@ionic elk it's fixed, was because I was switching from interrupt based to polling, and it didn't reset properly.
I've been able to test this change on an Adafruit Metro M0 Express and also a Sparkfun RedBoard Turbo. I haven't noted any issues with either one of these boards, either.
Aha! Great you figured this out.
We should probably have a check in a .mk file that USB_DEVICES does not contain HID if CIRCUITPY_USB_HID is 0. The same should be true for CIRCUITPY_USB_MIDI. We might even do that automatically.
@prime flower You were tagged on this, in case you missed it. Thanks. https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT/issues/31
@prime flower Thank you for following up!
@xobs ran into TinyUSB problems (#2849) when USB_DEVICES included HID but CIRCUITPY_USB_HID was 0. The makefiles could check for this inconsistency. If USB_DEVICES was not explicitly set by the build, it could even be adjusted based on the values of CIRCUITPY_USB_HID and CIRCUITPY_USB_MIDI.
@raven canopy @tulip sleet yep - i'm seeing lock up's with arduino. it's a complete hardware freeze of the PC. mouse cursor doesn't even move. have to power cycle to recover. it happens with a basic sketch upload, right after upload is complete and it resets the board. of course it doesn't happen 100% of the time and i haven't been able to find a way to make it happen in a repeatable way for testing.
@tidal kiln i'm at 100% repro on a RPi headless with Ubuntu 20.04. its almost immediate once i go to bootloader. ssh pipe breaks, and activity LED is steady. still trying to get better traces, but the lockup isn't helping. π
yep. it's not an easy thing to debug. and i always run into it when i'm trying to get something else done. so just punch my way through.
@k0d it's an interesting idea to have the serial console simultaneously to USB - is there a particular application that you have this in mind for? Did you check out the port level supervisor/serial.c files that exist in most ports? Most of the time, it's automatic to switch to a serial connection when USB is set to 0.
Existing implementations aren't very sophisticated because the use is kind of rare, and they don't use the UART module (by design), so this is definitely a more complete imp...
The serial.c that exists already works if you don't have USB, but...if you want to continue to use the VCP even when USB is enabled then that does't work. When I'm developing it's much easier to have the VCP instead of the USB.
I understand it's not everyone would use this when developing, but I use it all the time.
I mean, there's a literal 4 line example for SPI slave. A maybe a 2 sentence description.
@ivory yew That's one reason I prefer register level. The data sheet is pretty thorough on what to do with the registers.
@tidal kiln Hmm, do you have any suggestions for wording on the note for saying lux isn't calibrated? Is "Note: lux isn't calibrated!" enough or is there some better way to word that with more information?
@idle owl that seems fine
@slender iron I'm not quite ready for that relentless experience just yet, but I certainly came close. π
@tannewt
I like this kind of syntax for defining the pins...what do you think?
@hierophect I thought of using the serial.c implementation, which I could do...but I'd have to tweak some things a bit because if USB is enabled, it uses supervisor/shared/serial.c.
I think it'd be better to call it console.c, which in turn uses serial.c/usb.c/display.c depending on what's available?
@raven canopy if you give a recipe for what you're doing on the RPi, I can try to reproduce and get a USB trace. Which boards do you see this on?
@tulip sleet Metro M4, bootloader 3.6 & 3.9. able to repro with a double-reset and screen session via reset(BOOTLOADER). again, this is only on the RPi w/20.04 which uses the dwc_otg driver. my laptop uses 18.04 & xhci and hasn't presented any issue for me.
@lone axle Do you have a CLUE?
do you see this only on M4?
well, so far yes. I tested a Grand Central yesterday (bootloader 1.x something) and it didn't have any issues; haven't tested newer bootloaders yet. i can try a M0 and nRF later.
i've been assuming that the issue was with my software/dependencies this whole time. its usually the case... π
do you mean you call reset(BOOTLOADER) in the arduino program? Does it do anything else before that?
@prime flower Thank you for labelling library issues - I really appreciate it!
no, in CircuitPython. connect board, CIRCUITPY enumerates. start screen session, and do:
import microcontroller
microcontroller.on_next_reset(microcontroller.RunMode.BOOTLAODER)
microcontroller.reset()
@gilded cradle Is this something you're able to look into? https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/77
@idle owl Yep I do.
@tulip sleet and double-tap triggers the same. no diff in the dmesg/udev that i can see so far.
@lone axle Interested in a coding quest?
@raven canopy @tidal kiln I'm trying to figure out if it's TinyUSB in CircuitPython or the bootloader USB impl (which is not TInyUSB except on nRF), or the Arduino USB.
Try Arduino Blink and see if double-tap does the same thing. That's yet another USB impl.
@idle owl yep, I can.
@gilded cradle Thanks!
@tulip sleet @raven canopy sry, can't help test right now.
now i have to remember where i put my Arduino... π€£
@idle owl For sure!
@tidal kiln np, if the RPi is reliably bad, we can get traces from that, and I don't have to keep waiting for my regular dev machine to reboot π
@raven canopy I meant Arduino Blink on the Grand Central
@lone axle Keen. I'll tag you on a GitHub issue I created, and we can start a discussion there.
@tulip sleet badly worded joke. i haven't loaded Arduino IDE in like 2 years. π
OK π good luck updating it all
so use Grand Central (which didn't have issues), not Metro M4?
@lone axle Mentioned you here https://github.com/adafruit/Adafruit_CircuitPython_APDS9960/issues/25
oh, I thought you were varying the bootloaders, no whichever one is bad is fine
kk
@tulip sleet Is this a bug? https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/55 Trying to label things and am not sure if any labels fit this one or not.
@idle owl it appeared to be a bug at first, but the underlying code is simple and seems to be doing the right thing. You or I could ping the OP and ask if this was resolved, since it's been a while
@tulip sleet no lockup with Arduino Blink -> bootloader via double-tap.
@tidal kiln and your issues may have different causes π¦
@idle owl np! I do that with the IO issues too, will keep doing on cpy-rel.
@raven canopy I have a real true blue Arduino UNO R3 and an Arduino Mega R3.
snagging a bite real quick before the meeting
@slender iron do you want to talk about PacketBuffer for 10 mins now, or can be after you have lunch after the meeting
@tulip sleet I can now
Good afternoon -- happily lurking for the meeting.
om nom nom complete
@onyx hinge something nice?
I'll be text-only today.
lurking today
Loud and clear Scott
lurking or text only. My notes are in the doc.
lurking
Lurking
oops, I forgot to go into the voice room (facepalm)
As a Hackathon exploration,Β we adaptedΒ an IoT Central Python library to create anΒ MQTT-based CircuitPython libraryΒ for Azure IoT.Β CircuitPython,Β AdafruitβsΒ stripped down version of Python for embedded development, is easy to use and significantly lowers the barrier of entry fo...
ICYMIΒ (In case you missed it) βΒ the IoT Monthly Newsletter from AdafruitDaily.com went out today! If you missed it,Β subscribe now!Β β Youβll get one fab newsletter each month. The next newsletter goβ¦
OK. It should be one topic for This week with two items below it.
https://twitter.com/matt_trentini/status/1256908219307323392 https://melbournemicropythonmeetup.github.io/March-April-News-Roundup/
Mentioned @adafruit, @CircuitPython and @tannewt in the latest MicroPython News Roundup:
Especially loving the inspiring way that you folks are running the business in such a difficult time. Stay safe and keep up the amazing work! β€οΈ
COVID-19 has interrupted the MicroPython Meetups! Rude. In lieu of a proper meetup, Matt decided to record a news roundup.
Not bias, it's a great news roundup.
https://twitter.com/MIT_CSAIL/status/1257323849131134976 https://link.springer.com/search?facet-content-type="Book"&package=mat-covid19_textbooks&facet-discipline="Computer+Science"
Springer just made 400+ textbooks free to download, including CS books on Python, deep learning, data science & AI.
Full list: https://t.co/Ny9NWjPeB1
#MondayMotivation #ML #DeepLearning #AI #CS #BigData #Python #Scala #TensorFlow #Programming #Coding
197
380
@timber mango i indented your bullets. is that what you wanted?
Arduino Compatible FPGA Board | Intel MAX 10 FPGA | Specs Available | Tutorials and Support| Made in USA | Order yours today!
Thought it would be fun to show a quick video of an Evo M51 board and an Adafruit Industries AirLift flinging some data to Ubidots.
Learn more about Evo here: https://www.aloriumtech.com/evo/
Learn more about Alorium Tech here: https://www.aloriumtech.com/
Other...
lurking
Whom ever fixed my status update, thank you. π π
iirc, libraries include all reviewers/commenters. core & blinka might be different. i'd have to re-dig into it.
@onyx hinge - thanks for posting those links. I'm on another call so just watching out of the corner of my eye. π
@old smelt you're welcome ! PT would talk and paste links at the same time, but lately I've been doing it to help out whoever's running the meeting
I used blinka for the first time this week, thanks @gilded cradle
That great to hear @lucid solar
@unkempt dove we're doing "hug reports". Will you have any to share today, or are you just listening (lurking)?
re: converting a m0 feather to a hostess featherwing - maybe. No promises.
I just ordered a Serpente today! Looking forward to it arrive.
@ivory yew What is a hostess featherwing?
@onyx hinge i am just listening thanks
welcome!
LOL
(guides github repo are still on travis at the moment)
TravisCI gets no love... π¦
ya, CI's are under appreciated
to be fair though, they can cause some frustration. hehe
and github actions is being annoying now...failing on my PR checks.
ya, actions has been unstable
π
hi
@slender iron Can we do my status update after yours? I need to head out in 10 minutes.
Thanks!
@slender iron have you tweeted about that? Happy to retweet it and see if any of my C++ friends have ideas.
Join Scott today as he streams at 2pm Pacific. The plan is to recap ESP32-S2 work Scott did this week and then start laying out pin definitions for the ESP32-S2.
Adafruit Industries, Essential service and business: Critical Manufacturing, NYC β Executive Order 202.6
https:/...
@timber mango a featherwing that handles USB hosting and communicates device data (like HID reports) to a host feather via SPI. No where near ready yet, I'm working through proof of concept stuff right now: https://twitter.com/theavalkyrie/status/1256449209609248768
So this isn't done yet, but let's talk about it.
For reference, this is part of the USB host stuff I ranted about earlier https://t.co/OsWGUAPIO8 https://t.co/EAaM3HWY5z
motorin'
@hierophect This is ready for review now, the CI checks are failing due to 'Github timeouts', if there are any real issues...I'll fix them.
yessss match cpython sockets
@inland tusk don't forget to mute again
yay for submitting that PR dan!
Turning on and off a USB powered device with bluetooth.
UsingΒ @adafruit nRF52840 Feather and their Bluefruit Connect app to control a USB powered disco light.
Possible thanks to @CircuitPython and @burtyb USB PWR SW 2:
https://t.co/pj41WdpwzA
Code:Β https://t.co/DRqCX7lQhm ...
+1 terraria -- really fun game, and the updates add a lot.
Love Terraria....I have my own server....have to invite you @lone axle
@slender iron I absorb new information like a sponge. π
π
when compressed does the information leak back out?
@ionic elk I am waiting for two Toasty boards. π
check with limor for exactly what she's looking for
Quick question, do we have international font support in DisplayIO?
Out here making mp3 players like it's 2004. I love it.
yay rfm9x fixes!
if I wanted fully translated debug information, for instance
Done. Just add wood!
@ionic elk depends what you mean exactly. Non-ASCII can be displayed. Terminalio has more limitations than the generalized Label.
Broom is a nice touch
@solar whale gorgeous shed, fancy coming to Sweden to build one for me?
advanced rendering like shaping and ligatures is way out there, right-to-left text layout is probably something you could code in Python as needed
Do we have character support for japanese/chinese?
Real on the nose for you to use your wood shed to store wood.
and of course just the problems of storing, say, a repertoire of CJK characters in RAM, which is how fonts work now
I see stuff get spit out as unicode so I figured I just needed to install something
but yeah given the sizes I wasn't sure if it was supported
@lucid solar would love to visit Sweden again, but I think I'm " one and done " for sheds ...
It almost certainly would be for the STM32-grade flash sizes but maybe not for other stuff
check joey about the international font stuff too
@slender iron is joey a person or a software
person
a "joey" is a baby kangaroo, obvs.
@ionic elk do you want to write up an in the weeds for what you're thinking about? or cover it outside the context of the meeting?
swdio sounds awesome
I was just curious if it was a quick answer I don't mean to drag everyone into a discussion!
joey castillo who is doing open book
sometimes
@ivory yew Uh oh! You are on @slender iron's radar!
I stay on his radar. I live like a mile away from him. π
ChipSnek
@slender iron you're referring to this, correct:
Adafruit CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
Yes, the Circuitpython brand needs to be protected.
Shrubery
eel theme here
There is already an alternate name in the recommendation on CP trademark.
CIRCUITSHRUBBERY
No. 2 The Larch
EmbeddedPy
I cannot find the name, but I read it while preparing my talk.
π³ π³ π³ π³
Can you not write something like "Based on CPY" ?
If you choose not to meet these requirements, then we ask you call your version of CircuitPython something else (for example, SuperDuperPython) and not use the Blinka logo. You can say it is βCircuitPython-compatibleβ if most CircuitPython drivers will work with it.
So I vote for SuperDuperPython
DefinitelyNotCircuitPythonISwear
The word "Circuit" should not be in any new name, but "Python" can be in the name. So it could be SHRUBBERYPYTHON or something of the same form. π π
Adafruit CircuitPython 5.2.0 (Non-Adafruit build) on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20 or something?
Based on Adafruit CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
@lucid solar I like that too
@ivory yew that's nice
Branding
While we are happy to see CircuitPython forked and modified, weβd appreciate it if forked releases not use the name βCircuitPythonβ or the Blinka logo. βCircuitPythonβ means something special to us and those who learn about it. As a result, weβd like to make sure products referring to it meet a common set of requirements.
CircuitPython 5.2.0 (Non-Adafruit build) on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20 I removed the Adafruit at the start @ivory yew
ShrubberyPython, based on Circuitpython, created by Adafruit Industries.
in REPL message: "CircusSnake (fork of CircuitPython) ...."
Probably remove the version # also
I like @lucid solar's + this:
Python based on Adafruit CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
Note: This is a non-upstream build of CircuitPython. This build is not supported by the CircuitPython community.
This notice can be removed by setting the INTERPRETER_COMMON_NAME build variable.
I wouldn't put the instruction there
I get the point of a different name, I just feel that we shouldn't call it something new....just write Python, for example.
@onyx hinge something like:
Python based on CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
Note: This is a non-upstream build of CircuitPython. This build is not supported by the CircuitPython community.
See {short_url} for more details.
I like that better @ivory yew
we can have a page explaining the branding stuff and how to remove the warning if you're establishing a real fork.
ShrubberyPython, based on Circuitpython from Adafruit Industries
I honestly don't think we need a default separate name if we do that^
"based on" -> "forked from" ??
"based on" has some precedence I think
"circuitpython-compatible"
ArduPy..."forked". kind of. trying to be diplomatic π
i also wonder about what the micropython folks will think about "based on", since we are "based on " MicroPython
We're not using any of their branding or trademarks, though
and that's the distinction
I'd like to see the warning contain something about tutorial compatiblity
like if they set the build variable for the name that could change to:
NewNamePython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
we'd drop the "based on CircuitPython" altogether if they set a new interpreter name
Sorry, I have to leave here the meeting.
Python for microcontrollers based on CircuitPython 5.2.0
* enable pull request creation (DONE, but re-disabled temporarily)
* enable google Cloud Translation (MT) (DONE)
* some sort of backups (DONE; digitalocean weekly backups)
---- soft launch here?
* Move the github authentication API keys to adafruit organization
* Move the github PR creation to adafruit organization (adabot?)
* enable weblate.circuitpython.org via DNS
---- launch here?
* Move the Google Clould Translation (MT) to adafruit organization
cost: $20 / 1 million characters translated (probably not a lot of $$)
* Move the digitalocean droplet to adafruit organization
Python for microcontrollers based on CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20 Note: This is a non-upstream build of CircuitPython. This build is not supported and may break compatibility with libraries and tutorials. See {short_url} for more details.
I'd like to somehow imply that using the Circuitpython trademark is also not ok but I dunno if that makes it bloated
Note: This is a non-upstream build of CircuitPython. This build is not supported and may break compatibility with libraries and tutorials and may not be distributed as an official CircuitPython build. ?
@ivory yew Noice. Concise
Python for microcontrollers based on CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
Note: This is a non-upstream build of CircuitPython. This build is not supported and may not be distributed as an official CircuitPython build, as it may break compatibility with libraries and tutorials
See {short_url} for more details.
I like it
got rid of the double "and"
"non-upstream build" -> "build of a fork of" ??
Note: This is a non-mainline build of CircuitPython. This build is not supported and may not be distributed as an official CircuitPython build, as it may break compatibility with libraries and tutorials
See {short_url} for more details.
Yeah I think a lot of custom builds won't consider themselves forks
which would be confusing
how about just "unofficial"?
fine with me
sure
it's symmetric with the mention of "an official CircuitPython build"
yup
think: USB logo/cert. at least, that's how i always analogize it. π
Python for microcontrollers based on CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand Central M4 Express with samd51p20
Note: This is an unofficial build of CircuitPython. This build is not supported and may not be distributed as an official CircuitPython build, as it may break compatibility with libraries and tutorials
See {short_url} for more details.
+++ b/_board/feather_m4_express.md
@@ -6,7 +6,9 @@ name: "Feather M4 Express"
manufacturer: "Adafruit"
board_url: "https://www.adafruit.com/product/3857"
board_image: "feather_m4_express.jpg"
+oshwa_certification: https://certification.oshwa.org/us000242.html
features:
+ - OSHWA Certified
- Feather-compatible
- Battery Charging
@tulip sleet Can you review this and merge it? I think it's set to go after my changes. https://github.com/adafruit/Adafruit_CircuitPython_GPS/pull/42
@slender iron ping me if you can't solve it within a day.
π
π
in about 3 weeks we DO have a deviation from Mondays. Check our calendar!
thanks everyone!
bye
It's gotten warm on the east coast too
oh oh, I forgot one other thing we'll need, a webhook from github to weblate so it updates when circuitpython master branch is pushed to
@onyx hinge I can help with all of that. I'm a github admin
@slender iron can you stick around now to work that out?
I think we've decide to live with this for now
@k0d you'll want to check this out once it's merged. Let us know if you have any trouble with the tools.
@tidal kiln If you get a moment to take a look at this PR - you commented on the issue this stems from. https://github.com/adafruit/Adafruit_CircuitPython_Motor/pull/42
PacketBuffer needs to know about its Connection to determine .incoming_packet_length and .outgoing_packet_length. When its Characteristic is remote, the Connection is know via the Service, but when the Characteristic and Service are local, the Connection is not easily found. Right now, PacketBuffer grabs the conn_handle by spying on GATTS write operations, and also notices disconnections.
It might make more sense for the Python program simply to pass the `Connection...
In 5.x, after #2799 is merged, PacketBuffer.packet_size is a synonym for PacketBuffer.incoming_packet_length, and is deprecated.
In 6.0.0, it can be dropped, after updating the libraries that use it.
One request about the CFLAG changes.
Please don't do this. Turning them off applies globally and we want to verify this in most places.
This is what I was thinking of for the "scroll": https://github.com/adafruit/circuitpython/blob/master/shared-module/displayio/TileGrid.c#L307
Not sure what a good Python level API would be.
I don't like DTS's use of symbols for many things. I'm totally ok with how we do it now because it's much clearer to me.
I think the main thing I like about them compared to using toml, xml, json etc is that you can easily reference other nodes. For example
gpios = < &gpiob 0x0 0x0 >;
I think that makes it harder to understand.
One alternative would be to create some nice data structure in python? Then we don't need to parse it.
I think we'll end up with TOML in the long run but it's a very low priority. What we have now is well documented and well understood.
The reason I'd like to ...
@deshipu has certified boards as well.
Note that I changed the build logic in lower_power to not include the TinyUSB code for HID and MIDI when it is disabled. That is why it changed with that PR and it's merge.
Closing this in favor of #2850 now that we understand the issue.
A few small concerns. In general this is super interesting! π
Why does this impact STATUS2? Shouldn't that be separate from no_reset_cmd?
I'd prefer to remove the else and just rely on the return. That way everything inside the else is indented less. Similar below.
@onyx hinge did you mean to include your checkout v2 change in the swedish PR?
Builds should default to a different name instead of CircuitPython. That way forks and their builds (including dev builds) are not branded as CircuitPython. Weβd have an environment variable to specify it and set it in our CI. No one else should set it to CircuitPython (but other names are totally cool.) Name ideas (bonus points for it being a Monty Python reference):
- VoltageEel
- ElectricEel
- ElectricSnake
- PhysicEel
- EelTronics
- EmbeddedEel
- Eels on a PCB
- Lumberjack
- Bl...
This looks good! Please comment on how you tested it on a non-STM board and then feel free to merge.
Do you mean to have this in this PR?
A few minor comments. Should be good to go shortly.
There is a bug here that needs an issue. If one catches the raised error and then calls readinto a second time the original packet length will be lost. This is an existing bug so I think it's ok to not fix here.
mp_raise_ValueError(translate("No connection: length cannot be determined"));
I feel like this is an implementation detail that we shouldn't reveal here. (Same below.)
All good if as intended. Feel free to merge.
Thank you for the PR!
I think that these changes are too invasive to take as is. (All of the _UNAVAILABLE defines are changing a bunch of stuff.) Instead, I'd like to see this build on top of UART by calling the common_hal constructor directly. The only thing UART will need to do it is a "alert me on a character" callback like tinusb has.
Leveraging the existing UART code will:
- Simplify the conf...
Why not turn this on at the start and leave it on?
@slender iron it should probably be its own thing but I don't think it'll hurt. Just bringing the new build up to standards
This is easy to fix. I will just discard the entire too-big incoming packet.
OK, though I think it will get explained to someone at some point.
Because the interrupt is only used when inside of 'runCodePy'....it's polling in the REPL...that's how the current implementation works.
I think that these changes are too invasive to take as is. (All of the _UNAVAILABLE defines are changing a bunch of stuff.) Instead, I'd like to see this build on top of UART by calling the common_hal constructor directly. The only thing UART will need to do it is a "alert me on a character" callback like tinusb has.
Leveraging the existing UART code will:
- Simplify the configuration in ...
True, but we don't disable and reenable the callbacks from tinyusb for it.
Maybe this is peculiar to this particular chip? See this recent PR too, which may or may not be relevant (perhaps the flag it references would be useful too): #2847.
The common_hal implementation of STM32_UART requires there to be an active 'python session', so it doesn't work in certain situations, this is kind of a higher level than the python uart modules. I find it hard to explain this, but it didn't work...I tired it...that's why this PR took so long to make.
Did you try statically allocating the struct for it? You should be able to pass in a statically allocated struct to the construct and then never_reset it to keep it alive throughout VM runs.
I'd need to create a buffer for the uart then..as the interrupt handler would be called and then we couldn't use polling in the same way. Hope you understand what I mean.
Did you try statically allocating the struct for it? You should be able to pass in a statically allocated struct to the construct and then
never_resetit to keep it alive throughout VM runs.
There are examples of that technique for displayio, such as the SPI object it uses.
Did you try statically allocating the struct for it? You should be able to pass in a statically allocated struct to the construct and then
never_resetit to keep it alive throughout VM runs.There are examples of that technique for
displayio, such as the SPI object it uses.
@dhalbert link to an example please? :)
Ya, the UART will need an added constructor parameter that passes in the ringbuf it uses rather than it allocating it.
@dhalbert link to an example please? :)
shared-module/displayio/__init__.c and .h. The primary_display_t objects in displays are allocated statically, and include displayio_fourwire_obj_t in a union. Fourwire includes an SPI object: see shared-module/displayio/FourWire.h.
Also see common_hal_busio_spi_never_reset() calls in shared-module/displayio/FourWire.c.
It's a bit complicated because dynamically allocated heap objects can get copied into the static space: s...
I sorted out the error when linking esp32s2. I needed -fno-rtti for linking and also -u newlib_include_pthread_impl
huzzah
Thanks for the correction
@tulip sleet @tidal kiln of course. spend an evening reading/setting up kdump, put 3.9 bootloader and CircuitPython back on the Metro M4...and now it won't cause the lockup.
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
I sorted out the error when linking esp32s2. I needed
-fno-rttifor linking and also-u newlib_include_pthread_impl
@slender iron is it linking 100% now?
Yup! Havenβt tested the binary though. I think I pushed the change
Will go heads down on it tomorrow
Iβm no expert, but if you open up being able to change which tile is at the origin, then any other types of scrolling could be added as wrappers around it.
Currently scrolling requires rearranging the tilegrid, which tends to be rather slow. If youβre mostly scrolling in one direction, then is actually faster to move a bunch of smaller tilegrids and just update the x,y locations of each.
So anything you can give access out of the C code will likely give performance benefits.
Maybe @desh...
I switched to using our own API under the aes namespace. As requested, I added functions such as decrypt_into() and encrypt_into() that will operate on a predefined buffer. I also added rekey() which can be used to set a new key or a new IV without reallocating the object.
Thanks very much for providing the review and comments. I've now made a few changes:
- Changed to class Counter
- Fixed (I think) the submodules
- Increment on every edge detection
- Changed the build so that other platforms are excluded (for now)
The build is still failing on the pyruler board (DE language) - any advice on how to get it down by 60 bytes?
Can anyone tell me the story behind SPIM3 on NRF? It seems like it's the preferred SPIM controller, but it also seems like it requires an additional 8 kB of RAM to work around a hardware bug. Is that correct? Why is it more desirable?
Hi Everyone, I'm a noobie in coding but very exciting by all the upcoming projects i can accomplish. I really would like to be able to code on circuitPython o my own, or at least modify the code the way i want. So i decided to start learn Python. As persons of experience, is it a good idea? do you have any recommendations? Thanks in advance and have a nice day !
Hi @timber mango and welcome 
Do you have a CircuitPython board?
Hi @lucid solar
i do, but maybe a little old now, i have a Playground Classic. which is not python language. I want to at least go to Express version
Yes, that's correct, it doesn't support CircuitPython. The Playground Express is a great board to get.
The best way to get started is to follow the adafruit tutorials. https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart
Make faster and easier than ever with MakeCode, code.org CSD, CircuitPython or Arduino!
It's always fun to get the Neopixel LEDs flashing first.
and i love LED π

An Update:
I've been trying to hunt down where the BLE libraries schedule a timeslot using the SoftDevice's Timeslots API on the nRF52840... Still haven't found it, but I'm thinking this concurrent multi-protocol idea isn't very feasible since
- The BLE stack has to be disabled when the radio is being used for a different protocol. I think the same applies to the ESB protocol. Also, I'm not sure if BLE configuration needs to be reloaded when its scheduled timeslot is executed.
- Ti...
With the most recent patches, issuing time.sleep(x) issues a wfi instruction. This aggressively puts the CPU to sleep. However, this appears to cause USB to no longer enumerate. While this is not an issue with a device that's powered off of USB, if a device has its own battery, then this will prevent the device from enumerating during sleep.
Steps to reproduce
The following code.py should trigger this bug:
from time import sleep
sleep(60)
I believe at least part of the problem is due to the fact that there doesn't seem to be anything listening to the USBDETECTED and USBREMOVED events. This patch adds that in:
diff --git a/ports/nrf/supervisor/port.c b/ports/nrf/supervisor/port.c
index 539a9cf90..24a0c4bdd 100644
--- a/ports/nrf/supervisor/port.c
+++ b/ports/nrf/supervisor/port.c
@@ -67,6 +67,10 @@ static void power_warning_handler(void) {
const nrfx_rtc_t rtc_instance = NRFX_RTC_INSTANCE(2);
+#if N...
@half geyser
Can anyone tell me the story behind SPIM3 on NRF? It seems like it's the preferred SPIM controller, but it also seems like it requires an additional 8 kB of RAM to work around a hardware bug. Is that correct? Why is it more desirable?
@half geyser SPIM3 can run at 32MHz; the other SPIMs can only run at 8MHz. The hw problem is that SPIM3 doesn't do contention management properly on the RAM block it's using, so any access to that RAM at the same time it's doing a transfer can cause corrupted data.
There is workaround code in nrfx that doesn't use a whole 8kB block, but it doesn't work with the soft device. (NRFX_SPIM3_NRF52840_ANOMALY_198_WORKAROUND_ENABLED)
We thought it was worth wasting most of the 8kB block (the buffer is potentially a lot smaller) to allow for higher SPI speeds, which is particularly important for driving a display.
the RAM is segmented into blocks or regions (I forget the exact terminology), and 8kB is the size of one of those
We allocate the SPIMs in busio.SPI() in order of preference, so SPIM3 gets allocated first.
Testing performed: simple scroller on stm32f405 feather, and re-tested simple scroller on nrf52840 feather
@tulip sleet do you have some time to help me with the debug_uart issue? I've got it to create it, but it HardFaults when trying to output the 'banner' (Adafruit CircuitPython 5.2.0 on ....) So I don't think it creates the object properly.
This should have been inserted with -Werror, which I forgot to include. But both the NRF and STM32 ports also need to do this because their SDKs invoke these warnings all the time. Would you prefer that the -Werror flag not be set until a later date?
Here's the fully workshopped version:
Python for microcontrollers based on CircuitPython 5.2.0 on 2020-04-09; Adafruit Grand
Central M4 Express with samd51p20
Note: This is an unofficial build of CircuitPython. This build is not supported and may not be
distributed as an official CircuitPython build, as it may break compatibility with libraries and
tutorials
See {short_url} for more details.
if we were to do it with a name I'd do something like this:
NiPython for microcontrollers based on CircuitPython 5.2.0 on 2020-04-09; Adafruit
Grand Central M4 Express with samd51p20
Note: NiPython is our name for unofficial builds of CircuitPython. These builds are
not supported and may not be distributed as official CircuitPython builds, as they
may break compatibility with libraries and tutorials
See {short_url} for more details.
I really feel that a new name would be very confusing and is not needed. Python for microcontrollers sounds right, it's not a new name...just a way of explaining what it is and what it is for. The 'workshopped version' that @hierophect wrote above, that's what I'd vote for.
I agree about avoiding a new name.
BTW, it turns out "NI Python" is used by National Instruments.
The phrase "Python for microcontollers" might cause confusion. That phrase is used several times to describe Micropython.
The phrase "Python for microcontollers" might cause confusion. That phrase is used several times to describe Micropython.
I don't see that as a big issue, it's used persistently in the Circuitpython docs as well. And I think it actually plays into the point, that without being official builds are just another subversion of the Micropython base concept but without any guarantees attached.
@lucid solar do you have a backtrace from the call to HardFault_Handler? Did you set a breakpoint there? Is your code committed?
yes, yes, no ;)
I've made MP_DEFINE_CONST_FUN_OBJ_0(debug_uart_obj, debug_uart); I assume that I have to call that at some point manually to init the object? As it's outside of the python VM?
is debug_uart a function? That is just a macro
Yeah, it is a func
right, you need to create it somewhere. I am guessing it creates the UART object in a static place, not on the heap.
@tulip sleet I'm missing something...just not sure where π
do you want this to be usable from Python, or is it some compile option for doing debugging prints from C code?
i thought it was the latter but may be wrong
When running code.py, it needs to catch ctrl+c, and outputs when print() is called
When waiting for "any key to enter repl", that's outside python, but needs to catch any key
When inside repl, it needs to catch the keys and print the output.
you mean it's a duplicate of the REPL serial connection?
so it doesn't need to be accessible from Python as board.DEBUG_UART(). Have you seen multiterminal? https://circuitpython.readthedocs.io/en/latest/shared-bindings/multiterminal/__init__.html
in micropython this is dupterm or something like that
but won't that stop working outside of code.py/repl?
yes, I'm just suggesting that it might be code to study
This should be available always...even if the py VM isn't running
so do you want the debug-uart to be created when CPy starts? Then it should be created in main.c or something main.c calls. And should it always be created? Are you dedicating some pins to it?
i'm thinking you could piggyback on the multiterminal code to do the input handling, since the mechanism is already there
it's not clear to me it does output too, but it could be extended to do that. I don't know of anyone using multiterminal now, so not sure if it definitely works
I was thinking of creating it in serial_init, as that's where usb_init is called
that sounds fine, but it's dedicated pins?
yes
so just call common_hal_busio_uart_construct() in serial_init(). You don't need the pins.c addition.
i see that common_hal_debug_create_uart() basically does that
yeah π
MP_OBJ_FROM_PTR(&debug_uart) in serial.c serial_init() doesn't do anything, that's just a type-casting macro
Yeah...ignore that...shouldn't have been committed
so if you call common_hal_debug_create_uart() in serial_init(), I think that should do it
ok...am testing on the board now...
n_bytes=<optimized out>,
has_finaliser=<optimized out>,
long_lived=<optimized out>)
at ../../py/gc.c:489
#2 0x08066d0c in common_hal_busio_uart_construct (self=0x2000a2a4 <debug_uart_obj>,
tx=0x809c628 <pin_PD08>,
rx=0x809c630 <pin_PD09>, rts=0x0,
cts=0x0, rs485_dir=0x0,
rs485_invert=false, baudrate=115200,
bits=8 '\b', parity=PARITY_NONE,
stop=1 '\001', timeout=1,
receiver_buffer_size=64)
at common-hal/busio/UART.c:218```
multiterminal was only ever implemented on esp8266
it goes into safemode after that
The trouble is that the UART constructor creates a buffer on the heap, and there's no heap yet
so you need to add some way to have a statically allocated buffer
(I think, still looking to confirm)
right, the _construct calls ringbuf_alloc()
Yeah...that's why I didn't think it could be done...(easily)
the _construct also looks for a free UART, but you want a particular one in mind. So don't call _construct, but do most of the work it does, using the dedicated UART and static buffer and object. Or add some args to _construct()
I'm wondering if this is useful on other than STM, as an option. There are times when we want to do debugging and USB is broken, but we'd want it to be compile-time optional and usually off, since we don't want to use up valuable pins
it's just the STM dev board that has these not-very-useful pins available?
@tulip sleet I asked for _construct to be used
well, we need an optional arg to pass in the ringbuf
and suggested adding a pointer parameter to _construct
ok, I didn't read the comments
and suggested adding a pointer parameter to _construct
@slender iron I missed that comment...or didn't understand it maybe π
I could have been more specific. sorry!
Nah, it was because I read that at ~02:00 and didn't re-read it today
ok, great minds think alike π
π
also you would need something to specify the specific UART periph you are using
do I need to have common_hal_debug_create_uart (shared_module)? or just call common_hal_busio_uart_construct directly myself?
if it's a convenient abstraction, then keep it. If you are not exposing this UART to Python, then it doesn't need to be in shared-module. It can just be some extra code in serial.c or somewhere in supervisor. share-module is for implementing things that have a Python interface
you don't need to pick the periph. just provide the pins to construct
ah good point
ok...I think I get it now...will test it out...
i thought the periph was special somehow
nope, it's just a UART connected to another chip
we might need a baudrate but that should be all I think
it'll simplify all of the init
do we need all the UNAVAILABLE stuff or is it just another UART?
or are there other reasons for that
we shouldn't
but we need to add something to uart to alert when a ctrl-c is entered
is there latent support for that via multiterminal?
no
multiterminal was only implemented on esp when all of the serial processing was port specific
it's still in the doc, maybe we should remove it
tx=0x809c690 <pin_PD08>, rx=0x809c698 <pin_PD09>, rts=0x0, cts=0x0,
rs485_dir=0x0, rs485_invert=false, baudrate=115200, bits=8 '\b',
parity=PARITY_NONE, stop=1 '\001', timeout=1,
receiver_buffer_size=64) at common-hal/busio/UART.c:181```
GPIO_InitStruct.Alternate = self->tx->altfn_index;
@lucid solar if you look for uses of MICROPY_KBD_EXCEPTION, that will help you find where the interrupt char (default is ctrl-c, but could be something else) is handled
@tulip sleet thanks, I think I understand that bit ok.
Whew, thanks! A lot of technical debt paid off, at the cost of too much time.
π
Two other hang ups I have about exposing this are:
- it causes the whole tile grid to refresh. Disabling autorefresh and resetting all of the indices is equivalent.
- It'd be better to scroll at a higher level because SPI displays have a native scroll in one direction that would be much faster to use.
Why did you add me as a reviewer? @dhalbert is enough.
Ya, let's do it separately. Thanks!
Am I Overthinking This?
It would be easier if I could treat the protocol being used as a singleton (only BLE is used or only ESB is used). This doesn't mean I'm giving up, I'm just having trouble reading the Circuitpython source code in regards to the SoftDevice implementation. I think I'll push forward with a custom build for the nRF52840 dongle (super cheap) that only employs the ESB protocol (and disallows BLE).
A custom build is probably easiest. Right now we only enable t...
@dhalbert - would you envision something like this?
import time
dir(time)
['class', 'name', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'sleep', 'struct_time', 'time']
time.time()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: No long integer support
time.mktime('12:34')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NotImplementedError: No long integer support
time.loca...
@timber mango Consider the Circuit Playground Express or Circuit Playground Bluefruit as the best place to get started. Both have all kinds of sensors, LEDs, buttons etc built in. The Bluefruit includes Bluetooth. There is a library designed to make getting started super simple. Here is the guide for it: https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/circuit-playground-express-library
@slender iron @tulip sleet does it make sense I also need to construct the TX/RX pins in serial_init?
the pin objects themselves are static; they aren't constructed
pin_PA_00 or whatever
When I try to write to the UART, it calls this mp_raise_ValueError(translate("No TX pin"));
what are your arguments to _construct()?
115200, 8, PARITY_NONE, 1, 1.0f, 64, buf_array);```
const mcu_pin_obj_t* tx = MP_OBJ_TO_PTR(DEBUG_UART_TX);```
$9 = (const mcu_periph_obj_t *) 0x0```
that is weird ... looking
I think you'll need to step through the complicated uart assignment code in _construct and see why self.tx is not being set. Check that the arg coming in is not NULL too , but it shouldn't be.
Tested on STM32 Feather F405 and Atmel-SAMD Feather M4 Express for regression, works on both.
@tulip sleet it's calling common_hal_busio_uart_write before common_hal_busio_uart_construct it seems
OK π
run_boot_py before serial_init
the idea is that boot.py is run before any USB setup, so it can modify it if necessary
Yeah, I see that...where is best for this code then?
if you want the debug uart to be functional then, then its initialization should be moved further back. It's fine to create a new routine if you have to
ok...thanks
a reminder that the code is not sacred, don't be afraid to change it, but consider the larger structure and keep the style, etc. this is probably obvious to you
Yeah, I try to not change too much...but sometimes you just have to.
void serial_init(void);
``` Just made this...simple I think
I'm doing pin resetting and claiming next, so these should be in for real by my next PR. I personally find leaving in references to SERCOM etc kind of confusing which is why I tend to remove these.
Ready for re-review. @arturo182 I have pin claiming/resetting in the works so I didn't add the comments back in since they'll be replaced with real versions in that PR.
@tulip sleet I've got it writing just fine now...still have to fix the reading, but that's something I can fix.
yay!
@hathach Does tinyusb use interrupts for these USB events? Sleep will wake and call tud_task after any interrupt.
The STM32 timer system has multiple different kinds of timers - basic, general purpose, and advanced - which are typically tied to pins or specific peripherals. In comparison to other ports, the timers have somewhat limited multiplexing to pins, with some timers only having a single viable pin and vice versa.
Currently, to avoid taking pin-timer combinations out of the "pool", multiple modules are competing for the "basic timer" set, which have no pin assignments at all. However, there ar...
Nice work! Getting close. Just a couple of other things. Thanks!
What should this be? The 10 looks like it is extra.
CIRCUITPY_COUNTIO = $(CIRCUITPY_FULL_BUILD)
π I'd like to see this because it'll make PulseIn and PulseOut work on all STM boards.
It's also relevant for Protomatter and RotaryIO which likewise won't work without it
This looks good to me generally, but I've got questions about your addition of the common-hal functions which imply iterable pins, which I've tried to avoid for this port.
I'd like to understand better why you needed these additions, given that I don't see them added anywhere in the rest of the PR. In general, the ST HAL does not recognize a global "pin number" system, and the GPIO banks are dangerous to iterate through due to overlap with system features (BOOT, OSC), which is why I opted for a bank vs mask approach across the STM32 port. If you have a particular implementation or algorithm that you need these for, let me know so I can take a look and potential...
I've created a new issue for this so we can discuss. #2856
Ideally, yes. The most space-saving way of doing this would be to have the implementations in time_module_globals_table[] all point to the same function that throws NotImplementedError, hwne there are no longints. The compiler might even do that merging automatically through optimization if they were broken out into separate but identical functions.
TinyUSB requires application to call tusb_hal_nrf_power_event() within the power handler.
https://github.com/hathach/tinyusb/blob/master/src/portable/nordic/nrf5x/dcd_nrf5x.c#L630
The power IRQHandler is used and shared with SoftDevice therefore it cannot be actively handled when SD is enabled. The above modification by @xobs is part of the initial init_usb_hardware() when enabling USB (with SD not enabled yet). I am not sure how WFI() affect the power peripheral, but in case it does...
Thanks for the updates! I think the module name should be aesio instead of aes to reduce the likelihood of conflicting with another library.
Is the in-place encryption a speed optimization or standard practice? I don't understand why it is preferred over a two-buffer option. I think we only need one of the two APIs, either in_place or into.
//| cipher = aes.AES(key, aes.mode.MODE_ECB)
//| .. class:: AES(key, mode=0, iv=None, segment_size=8)
Defaults should be placed in allowed_args above if they aren't just 0. Here is an example: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/busio/I2C.c#L74
I misunderstood that my main performance issue was due to the autorefresh that redrew the tilegrid after each change. I changed my code to turn autorefresh off before re-arranging all the tilegrids, followed by turning autorefresh on again. This made a huge improvement.
I'll close this out as a misunderstanding on my part about the performance limiting factor. For the scrolling I was doing, the limiting factor was the auto refresh, not the redefinition of the tilegrids.
common_hal_mcu_pin_number, common_hal_mcu_pin_claim and common_hal_mcu_pin_reset_number are functions added already to the nrf and samd ports, and required by rgbmatrix. See shared-{bindings,module}/rgbmatrix/RGBMatrix.c for uses.
protomatter has a fundamental assumption that there is a numbering scheme for all pins, and that given a valid pin number you can get pointers to the GPIO registers (set and reset at a minimum) and the bit offset within those registers for the set or res...
Issue #2812 - throw a NotImplementedError instead of "AttributeError: 'module' object has no attribute" for time functions that require long ints on platforms that do not support those.
It will now look like:
>>> import time
>>> dir(time)
['__class__', '__name__', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'sleep', 'struct_time', 'time']
>>> time.time()
Traceback (most recent call last):
File "", line 1, in
NotImplementedError: No long integer support
EduBlocks for CircuitPython has got a refresh in the beta. Some new features are:
- Account system for file saving and sharing
- Split view (Blocks and Python on same screen)
- Few ui updates
- Translations
@slender iron if you have some time to work on github settings now that we're shifting to hosted weblate .. the recommendation is to install the "weblate app". Apparently what I can do is "request" this, which I guess is going to be reviewed by a github project admin such as you?
https://docs.weblate.org/en/latest/admin/continuous.html#github-setup https://github.com/apps/weblate
" A request to install Weblate has been submitted on the @river quest account. "
(sorry for the unintentional mention, woops)
Sorry, I should have been clearer in #2812, I was thinking more like this:
STATIC mp_obj_t time_not_implemented(void) {
mp_raise_NotImplementedError(translate("No long integer support"));
}
MP_DEFINE_CONST_FUN_OBJ_0(time_not_implemented_obj, time_not_implemented);
and then reference that in `time_modules_global_table, for each unimplemented function, e.g., for one of them:
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&time_not_implemented_obj) },
Locally, I tr...
By the way, I would suggest that you not work on the master branch in your fork. Instead, create a branch for this particular fix, and commit to that branch. Then your master won't get out of sync with upstream. See https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/always-work-on-a-branch.
Also, you will need to do make translate before pushing your changes, because you've added a new translate() string. Otherwise the builds will fail.
@tannewt @hierophect @dhalbert
This PR has been rewritten from scratch, it now uses the common_hal to setup the UART. Much nicer, cleaner and logical! Many thanks to the pointers.
As soon as the CI checks are done, I'll open this up for review. There is a TODO note in supervisor/shared/serial.c, I actually don't know if we need to fix it. Please advise.
@slender iron can you create a doc for next weeks CPY meeting?
That explains why all I could find is the sd_enable() call in adapter.c which is called from _bleio's init.c; thanks for the help there. I didn't know that the softdevice could also help with file transfers. Are you referring to the flash memory API and/or the [Interrupt model and processor availability](https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/processor_avail_interrupt_...
@lucid solar yup! thanks for the reminder
No problem...just ready to start my hug_reports/status_updates
Here is the notes document for Mondayβs CircuitPython Weekly meeting. Everyone is encouraged to attend! Please add your hug reports and status updates even if youβll be attending the meeting - itβs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weβll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1bzaYoTmWls07acn7JB4z0CX9BiTymQH-22rwZzXIObE/edit?usp=sharing
@slender iron I was going to make a new release of ble MIDI. Your last release was 0.8.0. Do you want to keep the sub 1.0.0 releases or should I bump it to 1.0.0?
i'll do 1.0.0, since it's functional
π
will do in a bit; just going out
k, np
@slender iron great, I'll see what happens if I have it try to push changes back to github...
hmmm there's an option in weblate to update .po files from .pot files. I wonder if we could change 'make translate' to just update the .pot file.
On branch master
Your branch and 'origin/master' have diverged,
and have 1 and 15215 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
This seems really wrong
I didn't want that in case folks edit .po files manually
Circuitbrains is almost funded! The only need $671.00 more. I know we can help them. Several of us have already pledged for two of them. Are are others here who would like to see Circuitbrains become a reality?? https://www.crowdsupply.com/null-byte-labs/circuitbrains-deluxe/updates/reduced-funding-goal
I feel for those folks but I was worried about it from the moment I saw that it didn't come with USB. That's just such a big barrier to a board that seems Circuitpython focused.
being end-product/project focused, i can see why they only broke out lines. def not the "standard"
board, though.
Yeah it works great for things like Sol which have the USB port in a specific spot and us a different connector (USB B)
I'd love to see a breakout/programming board for it.
It probably wouldn't be too hard to make a USB "cover" that could be soldered or just pressed on top of it for programming. It would have been nice if the USB and power pins were together though.
on a busio.SPI object is there some way to access to baudrate that it was configured to use?
I found some old code trying to access that value like this spi._spi.baudrate. I'm not certain if it ever worked but now it does not because there is no _spi attribute.
It is the actual frequency, not the requested frequency, so you can tell how it got altered by the granularity of the peripheral setting
Re your push not working; try merging from upstream, then do a make translate, then push. Or if it's something else, could you show the error message here?
Thank you
@lone axle That's in a library? I think it could be useful to expose that from within libraries since user code accessing .frequency just get the default, 24MHz I think, since the bus is typically unlocked in user code.
It was not directly in a library, but rather was some code illustrating a problem in a library on this issue: https://github.com/adafruit/Adafruit_CircuitPython_TLC59711/issues/8
Using Adafruit_Blinka on Jetson Xavier and Following: https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/spi-devices instruction, the SPI baudrate stay at 10Mhz instead of the new specifie...
FYI https://learn.adafruit.com/adafruit-circuit-playground-bluefruit/circuitpython mentions 5 is still in beta.
They were printing the value of the baudrate to show that the library was not respecting previously set values.
.frequency does return 250000 for me if I don't configure the spi for anything specifically myself.
yeah, the only way to get the actual frequncy for a given SPI device now is to be within it's unlock code
But it could be useful to know the actual
it does also show new values if I set them with configure
but I believe that's configuring a global default, unless you are within the code that is accessing a specific device unlocked. for example, If I do .frequency in my user code, I'll get 24 or 25MHz, whatever it is, but as each library is invoked, those devices will use their own specific configured SPI frequencies (but the user can't find out what they are at the library API level)
because user code running devices through libraries only sees the SPI bus unlocked (corrected my just prior statement)
just realized I can cheat sometimes: with esp._spi_device as espspi: print(espspi.frequency)But for displayio.FourWire...?
Thanks that makes sense. I've now changed this.
No problem, thank you. I've changed this.
It was, sorry!. I've updated the example.
LOL```spi = board.SPI()
while not spi.try_lock():
pass
spi.configure(baudrate=microcontroller.cpu.frequency)
spi.unlock()
Why not just go ahead and multiply it by two, just to be sure you get the max.
π
engineers always multiply by two, right?
just in case
that did get me up to 45MHz on Teensy 4.0
No, they multiply by a power of 2 :wink: :stuck_out_tongue_winking_eye:
2 is a power of 2 :p
Of course, but that is finite. :p
SAMD51: cpu=120MHz, max spi=24MHz, esp=8MHz. Teensy 4.0: cpu=600MHz, max spi=45MHz, esp=7.5MHz
it would be useful to know what actual speed spi displays are running at
Is there a way to shift another ~512K of flash on the Teensy 4.0 to the CIRCUITPY volume? It seems it only gets 1MB of the 2MB, whereas SAMD51 chips with 512K+2MB get 2MB.
Itsy Bitsy
(1024, 1024, 2024, 544, 544, 0, 0, 0, 0, 255)
Teensy4.0
(512, 512, 2001, 8, 8, 0, 0, 0, 0, 255)```
ya, it shouldn't be too hard
should I make an issue?
most imxes will have more than 2mb though
so on 51J20 (like PyPortal) I'd assume only half of the on-chip 1MB is full?
Teensy's all I have for now (dev boards are overkill for me)
It's not critical right now, I can delete some libraries for peripherals I can use on other boards, I just got caught off-guard when I hit it sooner than expected compared to SAMD boards. Another 512K would be really nice though.
ya, we could adjust it. it's just hard to change in the long term without erasing the existing fs
ah, so someone loading 5.4.x or w/e would get zapped, makes sense. No issue then, I'll keep pushing with what's here π
π
Thanks for the explanation, @tulip sleet ! That really helps a lot.
I managed to convert one of the AHRS algorithms (Mahony the easiest) to circuitpython to see if it would run. Happy to report it seems to do okay on a Feather M4 express. I'm getting the same results as the original C arduino code and have it running on a LSM9DS1 sensor via I2C
https://github.com/gamblor21/CircuitPython-AHRS
Interestingly enough either North/South or East/West are reversed in the original and in my version - or I am doing something wrong with the sensor setup (quite possible)
I managed to convert one of the AHRS algorithms (Mahony the easiest) to circuitpython to see if it would run. Happy to report it seems to do okay on a Feather M4 express. I'm getting the same results as the original C arduino code and have it running on a LSM9DS1 sensor via I2C
https://github.com/gamblor21/CircuitPython-AHRS
@blissful pollen I had no idea what AHRS is, so I looked it up and gave you a PR. π
Several weeks ago, #2804 was merged that added uChip .bin files to the S3 archive with the .uf2 files, and it has been working great for nightly builds.
However, for the recent release of 5.3.0.uf2 there isn't an associated 5.3.0.bin file in the S3 archive I spot-checked a couple other boards using the BIN_UF2 f...
The actual library call takes the form of AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length); or even AES_ECB_decrypt(const struct AES_ctx* ctx, uint8_t* buf);. Internally it's a single buffer, so we need to do the copy.
This comes from when we were going for pycrypto compatibility. Since that's no longer a goal, I'll remove it.
I am using an M4 ItsyBitsy and would like to create a custom console for when I plug my computer into the USB port on the ItsyBitsy. I don't know how to access the Tx and Rx pins on the USB port and I don't know if I would be able to use them even if I did know what pins they were since the REPL uses them. And yes I know that there is input() and print() but I need background processes to occur even while the user is using the console (since input() holds the whole script).
Is there any wa...
I thought it was odd that it seemed to somewhat work even without that patch.
The strange part is I can see the events fire, and I see the tusb_hal_nrf_power_event() function fire with all three kinds of events, but it still just does not work. Do we need to be calling tusb_task() more often now? Should WFI be disabled when not connected to VUSB?
Here's a strange one: I'm debugging Circuitpython on an NRF52833. My debugger is a Raspberry Pi running openocd. For whatever reason, reset halt doesn't work. reset works, and halt works, but it just won't reset halt.
This is particularly frustrating because the only reliable way I've found to reprogram it is to do nrf51 mass_erase, followed by reloading the softdevice and bootloader.
Here's an interesting hint as to what could be going wrong: it can't reboot into the bootloader anymore. That is, resetting the device appears to reset even the POWER block.
I thought NRF52833 is not supported? only NRF52840
I've been adding support for it. The PCA10100 is supported, as is Simmel which is a thing I'm working on.
Ooh, I'm glad I mentioned something. That caused me to look into openocd. For whatever reason, a "sysresetreq" isn't working, but "vectreset" is. So in openocd if I do cortex_m reset_config vectreset then I can flash it.
Changes:
- Rebased onto current master
- Removed non-
_intoroutines (encrypt, decrypt, encrypt_in_place, and decrypt_in_place) - Renamed to
aesio - Fixed documentation as requested
- Removed checks from the
shared-modules - Made
modea property - Moved checks into their own function
- Enable variable-length CTS operations (previously was limited to
% 16bytes)
5.3.0 was released from a point before #2804 was merged, even though chronologically the release was made after the PR was merged. If the next release is made from master branch, then it will be included. If a 5.3.x with this fix is needed, a fresh PR onto the 5.3.x branch to make the same change would be required.
There are on TX and RX pins on the USB port β that serial port is virtual, simulated in software.
If you want non-blocking input, you will probably be interested in issue #231.
@idle wharf Hey thanks! By the time I was committing things I was half asleep so some more explanation is good
That's alright, I get the incentive to use the bitpacking to condense things. This is one of those areas where using the HAL impacts the structural approach. It might ultimately be more efficient this way - I've considered revisiting DigitalIO and if I do I'll take a closer look at how it's handled here.
Looks good to me too.
That explains why all I could find is the sd_enable() call in adapter.c which is called from _bleio's init.c; thanks for the help there. I didn't know that the softdevice could also help with file transfers. Are you referring to the flash memory API and/or the [Interrupt model and processor availability](https://infocenter.nordicsemi.com/topic/sds_s140/SDS/s1xx/processor_avail_interrup...
I thought it was odd that it seemed to somewhat work even without that patch.
The strange part is I can see the events fire, and I see the
tusb_hal_nrf_power_event()function fire with all three kinds of events, but it still just does not work. Do we need to be callingtusb_task()more often now?
My guess is that there is an interrupt we need to enable so that it wakes up from WFI. Did you confirm that it works when the actual WFI call is commented out? This looks very similar...
any objections to me releasing 5.4.0-beta.0 today?
@slender iron I've made a bit of progress with SWDIO, I've got an 'empty' module working (I can import swdio), so I understand what needs to be created. What I'm working on now is a 'spec' for the Python module itself, what methods/properties etc etc it needs.
@slender iron no objection, only encouragement!
nice @lucid solar !
@simple pulsar CPB guide updated. Thanks for catching that.
@tulip sleet If you have a moment: https://github.com/adafruit/Adafruit_CircuitPython_GPS/pull/42
@idle owl np - i've been writing some code for the CLUE, then realised most of it would work on CPB+Gizmo so I've made it run on both, hence the interest
Experiences a hang at startup at while(__HAL_RCC_GET_FLAG(RCC_FLAG_LSERDY) == RESET). Likely due to some problem with the LSE.
@slender iron would you consider problems with getting japanese/chinese characters to display in Circuitpython to be too esoteric to make issues of?
@slender iron would you consider problems with getting japanese/chinese characters to display in Circuitpython to be too esoteric to make issues of?
@ionic elk FYI: There are blog posts and learning articles about CP supporting Unicode Fonts... https://blog.adafruit.com/2019/05/29/new-guide-pybadge-conference-badge-with-unicode-fonts-conference-badgelife-circuitpython-pybadge-adafruitlearningsystem-adafruit/
My_Point: So I would think its expected to work.. π
@ionic elk an issue is always good. Not sure itβs worth the effort to fix though
Seems like it's an Adafruit_CircuitPython_Display_Text issue anyway
not really with anything core
Getting close! Just a couple more things to address. Once addressed unmark it as a draft and we'll do a final review. Thanks!
No need for the ifndef with ?=
It counts based on falling edges, right? Might want to be specific here.
@slender iron @ionic elk Could you advise what would be the minimum RAM/Flash for a STM32 CircuitPython compatible mcu?
for SAMD21s its 32k ram and 256k flash
192k flash would be equivalent if it had external spi flash
ok...I'm looking at the F411RE, that's got 512/128...so plenty π It's nice when I'm producing only a few boards, so an extra $ doesn't matter.
π
Looks much much better! Thank you! Just a few more things.
Why *static_rbuf? Don't you want to store the pointer?
Set this false in deinit. Never reset only prevents it from bulk reset. We should be able to deinit the specific object still.
Also in deinit you'll want to make sure it doesn't fail when freeing the static ringbuf.
No need for this. If it fails it'll safe mode because the VM isn't running and it'll try to raise an exception.
I sometimes get confused with assigning pointers etc, what would you do for it?
It was temporary...as in I would fix that before this PR is merged.
Do you know why '\b\b\b\b' is output in headline.c? I don't understand that at all.
This looks great! Thank you!
I think we'll want to move the memcpy into shared-modules so common_hals are given both buffers but we can do that change later.
Why would you want to deinit the object? If we do, then mp_raise_ValueError(translate("No TX pin")); is called if we try to use it...
It doesn't fail when freeing the static ringbuf, I've checked.
Found here: https://circuitpython.readthedocs.io/en/5.0.x/shared-bindings/rtc/RTC.html?highlight=rtctime
rtctime.struct_time -> time.struct_time
@slender iron @tulip sleet do you want to weigh in on the naming of this new module for interfacing to SD cards? sdcard_spi has been suggested. I only want to rename it once π
I think because
A SDIO (Secure Digital Input Output) card is an extension of the SD specification to cover I/O functions. SDIO cards are only fully functional in host devices designed to support their input-output functions (typically PDAs like the Palm Treo, but occasionally laptops or mobile phones). These devices can use the SD slot to support GPS receivers, modems, barcode readers, FM radio tuners, TV tuners, RFID readers, digital cameras, and interfaces to Wi-Fi, Bluetooth, Ethernet, and IrDA. Many other SDIO devices have been proposed, but it is now more common for I/O devices to connect using the USB interface.
SDIO is overloaded and it doesn't do any of these things
sdcardio is too much like "cardio?
there are already a couple of GitHub repos called "SDCardIO", which is actually good, I think, since this is related
what would be in the namespace below "sdcardio" (or whatever name)?
Sdcardio sounds like a heart exercise.
@tulip sleet right now a single class SDCard that is constructed almost like an adafruit_sdcard.SDCard (except that it takes a Pin, not a Digitalio, for the chip select line right now)
I kind of like sdcardio, despite the accidental "cardio" part, since it matches all the rest, and it's different than "sdio", which I agree would be confused with a widely (?) known acronym.
Curious if there are any thoughts to add a dev board+circuitpython support for the Dialog Seminconductor Smartbond DA145XX or DA146XX product lines?
"DA14695 Development Kit β USB" looks nice...it has a built-in debugger and hub so you can use the USB from the DA14695 and debugger at the same time.
I just got a DA14531-00FXDEVKT-U 2 days ago for a particular project I have in mind. Pretty cheap.
I would say DA14695-00HQDEVKT-U is the minimum you'd need...I might get one, I like the idea of the debugger/hub
Yeah, Keil debugging is a cinch. You can use JTAG or debug over UART
But if I remember correctly the newer DA145XX series consumes around half the power of the DA146XX
Shame they only do BGA packages...or it'd be nice to add to some projects I have
@onyx hinge sdio is my preference actually because we can make it a generice API for both SPI and SDIO modes. SDIO can then be supported with an available SDIO peripheral then
also consider it would be cool to allow boards to construct them and have them long lived
and substitutible for the "/" drive even
maybeeeeeee
@strange adder native USB is a must too. doesn't look like the DA14531 has it
oic, thanks!
π always interesting to see different micros
Is it possible to load a font from an SD card?
@ionic elk absolutely
@crimson ferry cool.
also, though, I'm finding that making a foreign-language text group takes a full 40 seconds to create? On both STM32 and Atmel M4
I always check "/" first, then if SD Card is present, check that if not found on "/" π
Seems crazy slow
fast SD card? i tend to use Class 10 / A1 or better (probably overkill), load font and load glyphs at startup doesn't seem to take much time
time is relative I supppse π
Hmm, this has got me thinking...maybe I can assign the ringbuf in serial.c instead...means I don't have to pass it into the constructor
I'm afraid if I go trying it on a 2.5MB font (chinese) it'll take all day
By which I mean 6 minutes. which is still a long time to make one text box
1.4 seconds for a 32-point font (220K), loading ~15 glyphs. About the same time to load ~45 14-point glyphs (SAMD51). I expected more variation.
That's a LOT faster than my setup
What's the alternative for lots of glyphs and / or large point sizes
Is it impacted by font size?
I would think so
@tulip sleet @tidal kiln just so i can jinx it, i think i've found the issue/solution to the bootloader woes. after comparing 3K lines of udev debug, tracking block setup/teardown, and testing a rule, i think we're running into this: https://github.com/systemd/systemd/issues/7587
i can't say definitively, but i think it may be either the HID objects or block device isn't getting torn down completely which throws the cycle of death when it re-enumerates.
What's the size of the font you're using? I've been trying it on 250kb-350kb fonts that are 12pt, and I'm getting about 40s for 12 glyphs.
The 32 is 220K, the 14 is 114K
Seems like my performance is clearly quite a bit worse
over an order of magnitude
1-2 seconds would be totally acceptable for my application but 40s is, uh, not
@ionic elk loading glyphs from a bdf file is a linear search through a text file
@slender iron yeah it makes sense to me that it wouldn't be super fast, but anecdata is reporting a load time of 1.4 seconds for a library and number of glyphs just slightly smaller than mine
so I'm guessing I've got something else going on
the glyph position in the font matters
ah, that could be it.
@slender iron what does FREEZE ../../frozen/circuitpython-stage/pygamer mean?
I don't suppose it'd be possible to give it an offset to start counting from? Hiragana starts at 12353, if it does that for every glyph, makes sense it might be bogging down
@lucid solar it means that the stage python code is parsed and stored into flash
@ionic elk you really want a cache of byte offsets into the bdf
utf-8 offset won't help you
aha...just wanted to check that it wasn't meaning that it was freezing the code at some point...as I'm checking that my changes build on a out-of-port board before I commit.
@slender iron I assume this would have to be a manual rewrite of Label then
not necessarily, the font loader that Label uses
are you doing this on adafruit time?
no of course not
π
personal project that I was hoping to get done in an hour this morning and didn't quit on because I'm stubborn
I moved it out of the constructor...much nicer code, managed to remove changes to ~5 files.
@ionic elk I understand that. π storing an offset cache in the BDF font would speed it up
also having label bulk load new glyphs would too
I don't see offset cache as an option in otf2bdf π¬ : is that something I need FontForge for?
there is a binary version of bdf called pcf that would also be faster to search since it's binary
you'd do it manually in bdf
How does label bulk load? Is that documented somewhere?
it doesn't bulk load "load_glyphs" to the font iirc
this is where it loads each character individually: https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/blob/master/adafruit_display_text/label.py#L124
So, some rewrites but not super crazy ones
optimizations
ye
Might need a pretty big table for Kanji
But if it's designed for SD use that might not be a big deal
From working today it seems like fitting a Kanji font of any readable size on 2MB internal flash is basically impossible. It's tantalizingly close but just barely doesn't fit.
did you talk with joey yet? he has his own format for storing a bunch of characters
I have not, maybe he could have saved me some pain today
FontForge is the devil by the way, I would recommend not recommending it.
do you know of something better?
otf2bdf works great
MakerMelissa recommends it in the badge tutorial.
If you just want to view them BirdFont is clunky but at least it doesn't segfault every other minute.
Strange, the failed checks don't happen when I build locally...it's also not related to my changes. Known issue?
Sorry if I've made some grumpy messages here, I spent a lot more time than I expected on FontForge today, sorry.
np, I'm heads down on esp32s2
@ionic elk I am sure anyone who has tried to use FontForge will understand. I installed and tried it once, got several segfaults, and immediately removed it. π
Strange, the failed checks don't happen when I build locally...it's also not related to my changes. Known issue?
The errors may be due to some kind of submodule sync problem: one is from STM, and the other has to do with protomatter. Could you merge from upstream and also do git submodule sync and git submodule update? Also make sure your pushes are from a branch with everything added.
Strange, the failed checks don't happen when I build locally...it's also not related to my changes. Known issue?
The errors may be due to some kind of submodule sync problem: one is from STM, and the other has to do with protomatter. Could you merge from upstream and also do
git submodule syncandgit submodule update? Also make sure your pushes are from a branch with everything added.
Fixed, thanks!
making some good progress on my USB host featherwing
got this tiny little bit of code working today:
hostess_midi_in = HostessMidiPortIn(spi)
upstream_midi_out = usb_midi.ports[1]
while True:
# Get a MIDI event from a USB
# MIDI device connected to the
# Hostess Feathering
midi_event = hostess_midi_in.read()
if midi_event is not None:
# Send the MIDI event to the computer
# over this Feather's USB MIDI connection
upstream_midi_out.write(midi_event)
print(midi_event)
Interesting. I've been anxiously awaiting the introduction of BLE audio profiles. It would seem Nordic semi is too.
Any information on being able to use Circuitpython on the STM32F405 to play wav files?
Thanks.
Mike
@vale spire does the xtensa stack grow up instead of down?
according to some doc I found, it grows down as we're accustomed to [Xtensa Instruction Set Architecture (ISA) Reference Manual p.588]
Really appreciate the time and feedback. Thanks
@lone axle Thanks again for pointing me in the right direction on a few things (USB host controller for UART and write access to the CircuitPython file system) and for your encouragement!
I can now present to you cyberDΓCK:
https://hackaday.io/project/171269-cyberdck-a-circuitpython-anatidae
You can now edit and run CircuitPython code all on the same hinged duck.
It was a fun couple of weeks and I learned a ton! Thanks to all the community members for their βcan doβ attitude and willingness to help us less knowledgeable folks get better!
A quick update on my reset issues yesterday: It seems that, for whatever reason, resetting this board (a Simmel board base on an nRF52833) now causes a brownout event. That's the source of my reset woes. The RESETREAS is all zeroes, which indicates a brownout. The GPREGRET and GPREGRET2 retained registers are also zero. Doing a core reset does not cause this problem. So it's not a problem with circuit python, it's a problem with how I'm using this chip.
I'll keep looking for the cause of the brownout. I don't think it's caused by VDD drooping during reset, since it's connected to a relatively beefy power supply. And the thing only draws a few mA.
@mental nexus that's rad.
Thanks @ivory yew , it was a labor of love.
In the process I created a simple text terminal class that can write to a display using displayio tilegrids. It has basic scrolling function and keeps track of the entry point. For the editor running on the crberDΓCK, I used three terminals, one for main text area, a highlighted one for the status row and one single tile terminal for the cursor. Iβve never released anything on github but if this could be useful to someone I can figure it out.
I'll keep looking for the cause of the brownout. I don't think it's caused by VDD drooping during reset, since it's connected to a relatively beefy power supply. And the thing only draws a few mA.
Interestingly, reset works just fine until circuit python is started, then it stops until I reflash the board. The plot thickens...
Huh. It's the write to NRF_UICR->REGOUT0 that's causing it. Interesting...
Setting it to 3.0V (instead of 3.3V) seems to fix the issue.
The voltage from the battery IS 9V
There are 6 number of globes.
How much voltage are across each globe
There is 1 glove and then 2 globe and then 3 globe. What are the brightness of the globes
Help
Can I not retain an arg pointer that I get in a shared-bindings _make_new function?
I have an arg like { MP_QSTR_some_list, MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} } and when I inspect it during _make_new it is sane (mp_obj_list_get shows lengeth=5) so I hold that .u_obj on a shared-module's some_type_t structure. Later when I go to use it, mp_obj_list_get shows length 1393 and I crash because there were only ever 5 items in the list.
edit:
self:20004570 calling action
self:20004574 doing action on self
Logging pointer addresses made it obvious that I was calling a function on the address of a member in another "class" function. :sigh:
Final update on my NRF52833 woes: VDD got disconnected, and I was powering it off of VDDH. This apparently works fine, except reset is all wonky as the regulator resets itself causing a brownout. I re-shorted VDD to VDDH, and now it's behaving like it should. Thanks everyone for hearing my stream of consciousness debugging session!
It does work if the WFI call is commented out.
Let me look through the USB interrupts and see what's going on.
@hathach You're right, I didn't see that the event was already being hooked. So the patch I made probably doesn't seem necessary.
However, it does appear as though the OUT data isn't getting ACKed for whatever reason. And it's always the same descriptor. At least it's consistent.
The contents of the USBD_INTEN register prior to unplugging:
(gdb) x 0x40027300
0x40027300: 0x0185d57d
(gdb)
And after plugging back in, while the host is waiting for the device to ACK ...
@broken kettle This doesn't really belong in #circuitpython-dev . However, did you figure it out?
Yeah I did mate @main meteor thanks for caring man love you β€οΈ
@mental nexus that is awesome!
Thanks @lone axle I really appreciate your help.
A recent very good guide article also needs precise timing to maintain the timing of its serial async protocol: https://learn.adafruit.com/clue-teletype-transmitter/code-the-tty-transmitter
When I connect it when it's in this state, this is the output I receive:
USBD Unplugged
USBD Bus Reset
USBD Setup Received 80 06 00 01 00 00 40 00
Get Descriptor Device
Queue EP 80 with 18 bytes
USBD Xfer Complete on EP 80 with 18 bytes
Queue EP 00 with zlp Status
USBD Xfer Complete on EP 00 with 0 bytes
USBD Bus Reset
USBD Setup Received 80 06 00 01 00 00 12 00
Get Descriptor Device
Queue EP 80 with 18 bytes
USBD Xfer Complete on EP 80 with 18 bytes
Que...
Description
Pressing Ctrl-C to interrupt time.sleep() will cause time.sleep() to instantaneously return on NRF until the board is reset.
Steps to reproduce
In the REPL, run:
import time
time.sleep(100)
While it's sleeping, press Ctrl-C. The REPL will come back. Then run:
time.sleep(100)
The REPL will return instantly.
Workaround
Performing a soft- or hard-reboot re-initializes the sleep timer and gets it working again.
@sour lynx do you know the best way to get the current stack pointer? I need it for garbage collection
Anyone have experience building older versions of CircuitPython? I have run 'git checkout' on 5.0.x and 5.1.x and they build; but when I load them they both end up in an infinite loop in DummyHandler.
@mental nexus Well, that's a hack that quacks! We may be only a small amount of 3D printing away from a CircuitPython TRS-80 Model 100.
Quack-hack, thatβs a good one. Iβm thinking itβs more VIC-20 or Commodore 64 but I picture it powered by a python that quacks running on a hamster wheel.
I'll have to ask one of my python-owning friends how successful they are at getting it into a hamster wheel.
@uncut nexus they should work. make sure you update submodules as well
yes, did that. Thanks!
@slender iron - does the platform you're needing a stack pointer for support '__builtin_frame_address(0)' in the compiler?
not sure. I didn't know that was an option
tries it
looks like it does! thanks @uncut nexus !
@sour lynx do you know the best way to get the current stack pointer? I need it for garbage collection
@slender iron There iscpu_hal_get_spfunction in#include "hal/cpu_hal.h"
however... keep in mind that with Xtensa Window ABI, not all previous stack frames are guaranteed to be on the stack.
at most 48 physical registers from the previous stack frames may still be in CPU registers, not flushed onto the stack.
I remember explaining to micropython folks how to handle garbage collection because of this, lemme find the bit of code...
Okay, totally not what i suggested, but also works: https://github.com/micropython/micropython/blob/e2def200bfb6f68801568c6b26f73ee86b549be2/ports/esp32/gccollect.c#L42-L47
basically, make a recursive function which uses 8 physical registers per call βΒ call it 64/8 times and all the registers are guaranteed to be on the stack.
Ok interesting! Will look a bit later. Mainly now Iβm not getting the right range with the getstartofstack method from free rtos
pxTaskGetStackStart(NULL) should be okay, i think
and the size should be about the size of the stack size you specify during task creation. For the main task (where app_main runs) it is given by CONFIG_ESP_MAIN_TASK_STACK_SIZE
Ya. Thatβs what Iβm doing for size. When I get the current frame itβs a higher address than the start of the stack though
is the "start" the initial SP address, or just the lowest byte of the allocated memory region?
n/m the docs say what it's supposed to mean
Returns the highest stack memory address on architectures where the stack grows down from high memory, and the lowest memory address on architectures where the stack grows up from low memory.
@slender iron Is using assembler a no-no here?
Ya. Thatβs what Iβm doing for size. When I get the current frame itβs a higher address than the start of the stack though
@slender iron makes sense β start of the stack is literally the start of the stack memory region, i.e. its lowest address
Not the logical start of the stack, i.e. address of the first frame.
@sour lynx thatβs not what the doc implies
@simple pulsar assembly is ok if thatβs the only way
Indeed! The doc says it is the other way around. Let me check what upstream freertos does.
I couldnβt find it in freertos 10
(Seems like itβs always the lowest address though)
yes... the definition we are using seems to match https://www.freertos.org/FreeRTOS_Support_Forum_Archive/January_2016/freertos_How_to_see_upper_lower_bound_of_a_tasks_stack_1e322e0bj.html
How to see upper/lower bound of a taskβs stack?Posted by awillson on January 15, 2016Hello, I am working on a RAM test routine that needs to skip the current RTOS taskβs stack. How can I retrieve the current taskβs upper/lower stack boundary? Thanks! How to see upper/lower bou...
So itβs always the lower address?
Yes, lower address.
Kk. Thanks!
It seems that this function comes from Segger SystemView patch: https://github.com/sifive/Segger_SystemView-metal/blob/master/SystemView/Sample/FreeRTOSV10/Patch/FreeRTOSV10_Core.patch
I made lots of progress yesterday
we have pulled it in the commit which has added SystemView tracing support: https://github.com/espressif/esp-idf/commit/8d43859b6ab
i guess we didn't check the docs. Have filed an issue internally to get this fixed.
is there a way to avoid rendering gigantic link preview images here?
tnx
fwiw this is where I pasted the docs from, I see now that it's "esp32" not "esp32-s2", sorry for any confusion.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/freertos.html
Only other weird thing Iβm seeing is that my makefile canβt build bootloader.bin but I can if I call ninja directly
Will keep poking stuff today. The partition api is working well for our file system
@onyx hinge the esp32 docs generally apply to the s2
welp, I have the right range now. circuitpython caused a freertos "stack overflow" with it's own canary value
@sour lynx is there any way to provide idf.py monitor an .elf?
@idle owl @slender iron I have some library code that uses time.monotonic_ns(). pylint on GitHub actions is complaining about this, because it's based on Python 3.6, which doesn't have monotonic_ns(). That I can understand, but I don't understand why https://github.com/adafruit/Adafruit_CircuitPython_BLE_MIDI doesn't have this problem also, because it also uses monotonic_ns(). Did either of you special-case that somehow?
the other libraries that uses monotonic_ns() have backup code to simulate it. On the nRF boards, that's not necessary, since it's always present
what is the complaint you are getting?
that the method doesn't exist
i don't get this when running pylint locally, because it's based on 3.8 locally, which makes sense
the latest GitHub Actions for ble_midi are fine, and don't show that error, which is the weird part
i don't see it special-cased in .pylintrc for the library
yes, there may be a diff for ble_midi. tnx
@slender iron oh, adafruit_ble_midi disables "no-member" at the very top; that's why
ah
i also used ulab in adafruit services, and blinka doesn't know about it, so it complained about import order. that's another problem, not a big deal
@onyx hinge looks like your stm rgbmatrix PR may have broken the build
You misunderstood one of my suggestions so I've been more explicit. Thanks!
CIRCUITPY_COUNTIO ?= $(CIRCUITPY_FULL_BUILD)
I expected you to delete the ifndef and endif and leave the ?= line.
CIRCUITPY_COUNTIO ?= 1
A recent very good guide article also needs precise timing to maintain the timing of its serial async protocol: https://learn.adafruit.com/clue-teletype-transmitter/code-the-tty-transmitter
This example isn't a reason to support precise timing from Python (which is impossible). It's a reason to expand PulseOut to support DAC output in addition to PWM carriers.
Is this on both nRF52840 and nRF52833? Please let us know what boards you've found this on. Thanks!
I don't know why you are seeing '\b's.
I think master is broken. It isn't a problem with this PR.
It's some sort of backspace character...are you happy with having this...if I fix the TODO message?
Yeah, I saw that the RGBMatrix PR broke things...so I'm just ignoring the CI checks now... :)
We may want to do deinit to allow the user to use the pins. Anywhere that uses it should make sure the object has been deinited first.
Ok, that makes sense. I'll fix that!
This is not just nRF. I see the same thing on Metro M0.
Ya, this is fine. It doesn't make sense to write a string of 0 length.
Ok, now I understand what was happening and would prefer the original way.
The original *static_rbuf version was copying the values in the struct into ringbuf_t within the object including the buffer length and pointer.
This is better than the version that sets it before because code outside of common_hal shouldn't access struct members except .base. The members of a common_hal struct are up to the implementation and external code shouldn't access them directly because they may no...
This broke somewhere between 3.1.2 and 4.1.2
This PR attempts to fix the low power issue in #2861 by adding a timeout for the LSE that attempts to swap over to the LSI on failure. Drafted because it still does not fully resolve the problem.
@tannewt requesting assistance. Can you replicate this on your feather?
@tulip sleet Did you get sorted?
@idle owl, yep, all set, though in the long run there are some things to fix, like adding dummy ulab to blinka and narrowing "no-member" in ble_midid
tnx
@tulip sleet Ok, sounds good.
@slender iron I just saw your note from an hour ago. I'll look into it. Wasn't it green when it went in!?
@onyx hinge I thought so too, or maybe there was one red-herring bad build
This example isn't a reason to support precise timing from Python (which is impossible). It's a reason to expand PulseOut to support DAC output in addition to PWM carriers.
Is there a ticket for that?
@onyx hinge @slender iron I have been building locally from the tip with no trouble. I just pulled and updated submodules (no changes) and built one each of stm, atmel-samd, and nrf with no errors
I see what's going on, I think
oh wait no, not on m4
@tulip sleet did you build stm32 feather or one of the stm boards that actually failed?
wait, is it m4/samd51 that's failing? Then I don't know what's going on after all
i didn't know what was failing, just feather, so no protomatter. Metro M4 is failing
../../lib/protomatter/core.c: In function '_PM_row_handler':
../../lib/protomatter/core.c:442:13: error: dereferencing 'void *' pointer [-Werror]
442 | *core->addrPortToggle = newBits ^ priorBits;
| ^~~~~~~~~~~~~~~~~~~~~
../../lib/protomatter/core.c:442:35: error: invalid use of void expression
442 | *core->addrPortToggle = newBits ^ priorBits;
| ^
STM32 has a hang at startup right now, just put in a revised issue and PR
https://github.com/adafruit/circuitpython/runs/633447824?check_suite_focus=true says in one spot it ran on ref https://github.com/adafruit/circuitpython/commit/e5be728c1c8a3a455b7095c9dab9e758c5016191
but if you look within the logs of build-arm capablerobot_usbhub, you see that it actually built:
e7eef6f0c Merge 6dfe9ab606352b36f8d295b250ac7118c459618b into 2d7cf4b792afa1b6755b9575b84cae4b65ae7ab9
which is not at all the claimed ref. The CI built some other ref than the one that the PR merged.
and this is checkout@v2, right? oy
yeah
PRs were flaky for at least a few days recently. I had a PR that didn't show two new commits until I pushed a third
I filed https://github.com/actions/checkout/issues/237 too, it feels weird enough that it's worth bringing to checkout maintainer's attention
@onyx hinge thank you figuring that out and filing the issue
@sour lynx is there any way to provide
idf.py monitoran .elf?
@slender iron no, looking at the code i don't see any. But you can runtools/idf_monitor.pydirectly β see --help for options.
Edit: idf.py finds the ELF file name from build/project_description.json β this file is generated by the regular CMake build. If you can overwrite project_description.json and put a custom ELF file name in there, then idf.py monitor will pick it up.
@gilded cradle Is there a way to tell which type of display is connected to the HT16K33 controller?
Commit causing the issue is ea760c042bcdff61792a4b5f3de0b3ec212c44c4: "Turn on MICROPY_OPT_COMPUTED_GOTO for 5x CPU-bound speedup". So probably there's something wrong with how MP_STATE_VM(mp_pending_exception) is handled when MICROPY_OPT_COMPUTED_GOTO is turned on
@sour lynx ok nice! Iβll try that
Confirmed that it does not boot with master at c3b3eb4c2
it does boot with 5.3.0.
@tulip sleet you're welcome. I wish I had also done more thorough local build testing but .. I didn't.
@timber mango I don't believe so. It's the same chip but just hooked up to LEDs differently, so there's not really a way to automatically ID it.
OK.
@idle wharf The channels correspond to different frequencies which propagate in very different ways in non free space plus possible effects on tx/rx in each device. Knowing them is at least beneficial in grouping the different RSSI data. How much information can be gleaned from them, particularly in a non-static environment, is an interesting topic. I've been sticking updates in https://forums.adafruit.com/viewtopic.php?f=53&t=164851 .
Nice job @simple pulsar or as we say in my family.... "Like a Walters!" π
@slender iron I watched your deep dive from last week... and wanted to let you know they're not boring.
I don't work down at the C\Hardware level and hearing you explain how things are mapped across each layer is very interesting and helps deepen our understanding of what's going (and what could possibly be going wrong) when we're up in the CP runtime.
thanks @idle wharf ! glad you are enjoying it
@lucid solar just pushed to my branch
@prime flower This is an interesting fix in Espressif IDF, was causing blocking in certain circumstances https://github.com/espressif/esp-idf/commit/0c7204e934b8abda433026f9ec9800c5380a657d
CI passes if you believe that :)
Does anyone know how Mu determines if it sees a CircuitPython device?
I am running a custom build for our board, and it appears to be working:
Adafruit CircuitPython 5.0.0-beta.2-13-g7387f6092-dirty on 2020-05-07; Alorium Technology Evo M51 with samd51p19
But when I try to use Mu for the Serial connection, I get this error:
Is it looking for a specific VID/PID?
@old smelt yep, VID/PID: https://github.com/mu-editor/mu/blob/master/mu/modes/circuitpython.py#L38
Ah. Ok.
Thanks.
Should that file also show up in the local install directory for Mu?
i'm not sure. i haven't dug into how they ship binaries (or not binaries) for each OS.
Ok. Don't see it in the app package.
I'll do some more digging. I can interact with the REPL via other means, so I'm good for now
Thanks
for your help!
yw!
In looking at https://github.com/hathach/tinyusb/blob/master/src/portable/nordic/nrf5x/dcd_nrf5x.c#L292-L297 it almost seems as though this isn't actually firing.
One thing I can see is that the _usbd_q is getting written to but not read from. If I break into the debugger while it's doing wfi, I see that wr_idx != rd_idx:
(gdb) p *_usbd_q
$10 = {
role = 1 '\001',
ff = {
buffer = 0x2000b740 <_usbd_qdef_buf> "",
depth = 16,
item_size = 12,
overwritable...
@old smelt Mu serial breaks for me when I have more than one CP device plugged in (contributing factor possibly renamed CP volumes, macOS)
This fixes connecting and disconnecting USB while executing time.sleep() on NRF. This issue may be present on other ports, so similar fixes should be implemented on other platforms as well.
The issue is that interrupts were still enabled while calling wfi.
This PR adds a patch to disable interrupts (and run background tasks with interrupts disabled to ensure buffers are drained) on the nrf platform: https://github.com/adafruit/circuitpython/pull/2868
I suspect other platforms will have similar subtle issues.
This patchset includes several minor fixes to Simmel fixes:
- Makes SPIM3 optional, for boards that don't want to dedicate 8 kB of RAM
- Disables SPIM3 on Simmel
- Enables
CIRCUITPY_AESIOon Simmel - Corrects the SPI_CSn pin mapping
Anyway, you can use Luma.OLED display library for most OLED displays. It can be used for Interfacing OLED matrix displays with the SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1331, SSD1351, SSD1362 or SH1106 driver in Python 2 or 3 using I2C/SPI on the Raspberry Pi and other linux-based single-board computers. More info: Luma.OLED docs.
Just in case anyone here is interested, I'm doing a live-streamed Q&A tomorrow at 9am PDT and talking about CircuitPython, the VS Code device simulator express plugin (currently supports cpx, microbit, and clue) and the PyBadge project I had put together for PyCon.
more details and a link at:
https://twitter.com/mbcrump/status/1258411407051116544
Note that this patch doesn't actually work, because you cannot run tud_task() with interrupts disabled, as it will possibly deadlock:
Program received signal SIGINT, Interrupt.
edpt_dma_start (reg_startep=0x40027010) at ../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:104
104 while ( _dcd.dma_running ) { }
(gdb) bt
#0 edpt_dma_start (reg_startep=0x40027010) at ../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:104
#1 0x0002f1f6 in xact_in_prepare (epnum...
Looks like it's not possible to run tud_task() with interrupts disabled.
@hathach do you have any suggestions for how we could do this?
I've applied this patch to my local copy of tinyusb, which causes it to poll the interrupt handler if interrupts are disabled. This seems to prevent the deadlock:
diff --git a/src/portable/nordic/nrf5x/dcd_nrf5x.c b/src/portable/nordic/nrf5x/dcd_nrf5x.c
index 12435ea2..acc1af58 100644
--- a/src/portable/nordic/nrf5x/dcd_nrf5x.c
+++ b/src/portable/nordic/nrf5x/dcd_nrf5x.c
@@ -101,7 +101,11 @@ static void edpt_dma_start(volatile uint32_t* reg_startep)
else
{
...
I submitted a PR for this here: https://github.com/hathach/tinyusb/pull/396
I've also found additional places where RUN_BACKGROUND_TASKS assumes interrupts are enabled, These have been rolled into https://github.com/adafruit/circuitpython/pull/2868
This patchset requires https://github.com/hathach/tinyusb/pull/396
There may be other areas where RUN_BACKGROUND_TASKS cannot be run with interrupts disabled, however this patchset covers all cases I've encountered so far.
What causes OSError: [Errno 5] Input/output error in the auto-reload terminal? Is there any way to get a more descriptive error?
Right now I'm seeing that happen when I save, but after about ten-twenty seconds it re-evaluates, even though I haven't saved it. Is the error due to a file that hasn't been fully flushed?
more descriptive errors take up flash space
If I do import io; io.open("code.py").read(), then exit the REPL, it works.
code.py is just print("Start")
It reloads itself after about 20 seconds and actually works, but it immediately says OSError: [Error 5]. Makes me think there's a synchronization issue somewhere. Where would be a good place to add a breakpoint to try and trap the error as it's generated?
