#circuitpython-dev
1 messages Β· Page 307 of 1
this is fine, please merge when ready and we'll keep an eye on it
@half geyser because the displayio console can only show fixed width characters, and because storage is scarce, I think it was decided to avoid CJK characters altogether and force things into a little latin-shaped hole. UTF-8 would clearly be the coding method for any translation in CircuitPython.
however, I'd get the real dish from @slender iron if he's around
@onyx hinge Ah, displayio. Always nice to realize there are other ways of looking at the data. This is what I get for exclusively using a serial console and not considering other usecases.
hoo boy, github actions is not happy this weekend, and weblate's not making it better. Despite being set to only push changes after 24h, it has been seen immediately pushing change after change. Maybe it's related to this setting I changed so that it will "squash" multiple changes by one user? I don't know. Anyway, related or not, github actions is very slow to process the related PR and so that hasn't been mergeable all weekend
'night, talk to you all at the meeting tomorrow
@half geyser ya. I think it was mainly the on-screen font situation that dictated it. totally open to separating that from having a translation though
So we can link folks to a particular line of the matrix.
https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html
This patchset introduces a new .uninitialized linker section and places the RTC value into this section. It uses sentinal values to determine if the RTC offset is valid.
As part of this rework, the port_saved_word API was reworked to also use a value in this new section.
Thanks for the suggestion, @tulip sleet . ^ That PR uses your trick of placing the RTC offset in a new, uninitialized section so that it persists across reboots.
Sounds good to me, that seems to implement most things I wanted :)
I only looked at issues with the USB tag, guess I missed it.
If there is point to start with the raw hid, I might take a look. Been meaning to learn a bit about cpy core development.
I've added a new argument to the construct to decide if we listen for sigint (ctrl-c). I would like to add some callback support to uart, so it's easier to add multiple listeners, but that's out of the scope of this issue I think.
See PR https://github.com/adafruit/circuitpython/pull/2116, which optionally provides a RAW HID device, enabled by compiling with `USB_HID_DEVICES = "RAW". This is not included by default. Since RAW cannot have a report id, you can't include other devices in the same endpoint. But it could be additional USB device. We don't currently have a mechanism for a second separate-endpoint HID device.
We were contemplating using RAW to have CircuitPython communicate as a special-purpose device ...
I neglected to say I was seeing this issue on SAMD21 boards (CPX and Metro M0). I could not reproduce it on SAMD51, though it's probably an accident that it works :). The #2868 fix is specific to nrf, so we'll need fixes for other ports too.
Yes I have not forgotten about it :D
But since TinyUSB came a long its great to also profit from the increased flexibility and control that come with it.
I would also have thought to have it as a separate endpoint, I think its also solved in the Arduino core like that, didn't try raw in combination with a different hid device yet.
So what might be nice to have then is a way to create and manage multiple endpoints and assign each the device type the user wants?
Existing classes like keyboa...
@onyx hinge @half geyser as someone who spent an entire day trying to fit low res fonts of CJK on a 2MB nor flash recently, I can tell you it's not a super great idea right now. Not only does it fill up the ENTIRE flash filesystem for basically unreadably low resolution characters, it's also amazingly slow to fetch them out of the font. I chatted with Scott a bit and what it needs is a cache to store reference locations in the font file so it doesn't iterate through the whole thing every time it fetches a glyph.
Like, 5 seconds per glyph slow.
We need a "all characters same size, all in one bitmap, but on flash/SD" abstraction. Then the label is based on TileGrid rather than Label, and memory usage is more tractible too.
but .. I haven't found the tuits to make that happen
I'd still like to work on it but it'd be on my own time so it's behind a long list of other stuff
Fitting every CJK onto one bitmap is going to be one big bitmap...
well, I guess that's completely subjective on resolution
What's the res you were using per glyph?
I found that the limit of readability was around 16 by 16
for CJK. You can go lower for Hiragana and Katakana for Japanese, 9pt was readable
There's a number of characters that don't have simplified chinese characters that are just bonkers to try and store in any kind of readable resolution. ε is probably hard to read even in 16x
heck it's hard to read right here on discord
Just chiming in here with some extra context: The VCP TX/RX pins can be connected to the Morpho connector on most Nucleo boards. They aren't currently exposed in Circuitpython because I don't expose Morpho connectors through Board (since they don't even have soldered pins most of the time), and assume that if they want to use it they need to access it with Microcontroller.
Looks good to me. I chimed in a bit on the VCP TX/RX pin exposure discussion but it seems to already be resolved. Anything to do with Morpho pins is in the territory of "just change the build yourself" anyway.
But I don't think it's appropriate to say there aren't conditions where someone might want to use all pins on the Morpho connectors. The entire St-Link apparatus can be completely snapped off, after all.
@lucid solar I think the end goal for CJK is probably an SD card solution. I don't know exactly how that would play into translations. 16x CJK doesn't actually fit on a 2MB nor flash, it's a smidge too big - you have go just under the readability limit to get it on there, which was why I got so frustrated with it.
I'm thinking about some compression
well that and that my flashcard app took 40 seconds to load every card π
that was also sub-optimal
Not traditional compression though...specialised for this use case
@tulip sleet Thanks for the suggestion on the LED animations PR. I replied with a question and suggested change to your suggestion.
a ton of the glyphs have whole lines that are either black or white
That's an interesting idea
I watched some videos about how they made gameboy sprites and all the hacks for that...
Hmmm. Something that just encodes the starts and stops for black and white, maybe?
Assume white at edge, with an even number of changes
We'd have to analyze the data.
see what patterns there are.
Did you look at this font? http://unifoundry.com/unifont/index.html
GNU Unifont free software utilities
We could probably also just have a subset of the font to include per locale.
https://gist.github.com/k0d/5bed997418e8e724326d30b4e6ff4a64 if we look at this data you can see for sure that there are patterns.
It probably changes a lot depending on whether it's serif or not
I may be mis-interpreting here; but it is my understanding that with LEDs on PWM you want to set the frequency once (basically high enough to avoid flicker) and then modify the duty cycle to change the brightness. I don't think you need to keep creating and de-initing the PWMOut objects - just create them once and then keep altering the pwn.duty_cycle to vary the brightness.
Yesterday I read through the short ninja build manual and wonder if it's worth using the depfile feature that automatically discovers required header files by using gcc -MM -MF $out.d ... to write out all required headers for a given C file. Using depfile could help in several ways:
Besides eliminating the need to specify the implicit header dependencies for an given C file using | foo.h, it also makes the process more robust by ensuring no header files fall through. For example,...
I've been experimenting by directly modifying the build.ninja file and can get past the genhdr/qstrdefs.enum.h error, but I don't trust the generated file is corrected because I haven't yet corrected for all the modified paths in the $include_pre, etc. Which is worrying: the ad-hoc sed commands, clearly are not fault tolerant and I think the sed functionality should be merged into the python later. What do you think?
ninja_required_version = 1.1
# These variables are...
[adafruit/circuitpython] New branch created: audiocore\-rawsample\-sinewave
Digging through the source saw it is not supported. Maybe when I get some time if no one gets around to it I'll do a port.
@slender iron man, this mcu_pin_globals table has a LOT of C magic around it. I'm pretty stuck trying to get the actual pins out of it - I'm not grepping any locations in the code where that's done directly.
There's all this generic "table" struct stuff from Micropython, so I'm not even sure what its actual organization is. Is all that documented somewhere? Or is it just something you get used to as you go?
@ionic elk @onyx hinge you should definitely talk to joey castillo about the CJK font stuff
Yeah I've been meaning to I kind of put the project down for a little bit
@ionic elk I think it's an array of structs
I may go text only on this meeting, my 3d printer is printing and it's not one of those silent ones
focused on my robot stuff isntead
@slender iron I'm just going to break and look at it under the debugger
.. are we going to try this new video in "voice chat" feature that I saw discord plugging last time I restarted it?
@onyx hinge, we could
Let's say I am lurking once again, as I am required to do sport, but this time there are a few hug report in the meeting document.
@ionic elk the pin table is type mp_rom_map_elem_t[]
hm I connected to the voice channel and the "video" buttno is there but it says I "can't stream into this channel" so maybe it won't work out
@onyx hinge try now
@ionic elk, so it's an array of https://github.com/adafruit/circuitpython/blob/master/py/obj.h#L355
typedef struct _mp_rom_map_elem_t {
mp_rom_obj_t key;
mp_rom_obj_t value;
} mp_rom_map_elem_t;```
yup now I am apparently streaming my face to the voice chat
so mcu_pin_globals.map.table[i].value but I think it needs to be cast?
I think mcu_pin_globals[i].value and then cast
no, there's no "pop in" that I could see either
Ooooooo, video.
@slender iron you need the map, doesn't work without it
I think there's a bunch of stuff crammed into mcu_pin_globals
key information and stuff
I think it's just key and value
+mp_obj_t cp_enum_find(const mp_obj_dict_t *dict, int value) {
+ for (int i=0; i<dict->map.used; i++) {
+ const cp_enum_obj_t *v = dict->map.table[i].value;
+ if (v->value == value) {
+ return (mp_obj_t)v;
+ }
+ }
+ return mp_const_none;
+}
here's some code I have in an unsubmitted PR for factoring out "enum types"
it is looking through a dictionary (which the mcu_pin_globals is, after being cast), for an item where the "value" matches
it assumes that everything in the table is the same type, so that it can be cast to cp_enum_obj_t
Good afternoon -- happily lurking today π
@DavePutz I believe they are using PWM at a (relatively) low frequency to do the sequencing of the LEDs instead of doing the timing themselves with time.sleep or time.monotonic. I don't don't think the intent is to adjust the brightness.
@RetireeJay46 Am I correct? It's not a typical use of pwm with leds, but I don't see why it shouldn't work. Certainly deinit() should be releasing the timers so that seems like a bug.
Here's my run, modified to run on a CPX with the latest buil...
Sorry. Missing meeting today
More water for Scott to dump on his keyboard...
np, @solar whale. next week's is on tuesday
Lurking
lurking
<@&356864093652516868> Meeting notes doc is here - please add Hug Reports and Status updates even if you'll be attending the meeting, it's super helpful! See you in a couple of minutes! https://docs.google.com/document/d/15gBlvCmwW-f26oYTY5LI897XAfc5GpYlNC7httMFFqU/edit
Hello Scott
Can't reproduce on an m0 so it may be an M4 specific thing?

How do I get video on Android?
@timber mango no idea, I'm on desktop. It may not be enabled on all their apps yet, but make sure you have the latest update...
@prime flower you have to be in the circuitpythonistas role
we'll add you, but you have to agree to carry the card
@onyx hinge ah, ok. Yes, I'll carry the card.
@ionic elk XPS, i presume? that camera location is a hint. π
@prime flower bam you're a circuitpythonista
what's an xps
Dell XPS laptop. guess not.. hehe
Someone else put that camera in the most awkward position you can imagine? o_O
It looks like maybe it's the last person who turned video on who "sticks", so you may want to switch your video on/off with your mic
(it's brent for me now)
oh we're not even all getting the same people?
Lurking today
Lurking, hug report in doc
Text Only
lurking
@slender iron Could you please put me back in Circuitpythonistas?
We're #PrettyTypical !
I am working on adding the UDOO Bolt to Blinka.
i was able to pop out the player so I can see the video and the channel at the same time. Maybe Scott already mentioned that.
i just meant for me, not necessarily for recording
Mixer
MakeCode is on Mixer! Learn about coding using Microsoft MakeCode editors https://makecode.com.
Yea, Python on Makecode. Just the beginning.
Adafruit Industries, Unique & fun DIY electronics and kits : - Tools Gift Certificates Arduino Cables Sensors LEDs Books Breakout Boards Power EL Wire/Tape/Panel Components & Parts LCDs & Displays Wearables Prototyping Raspberry Pi Wireless Young Engineers 3D printing NeoPixe...
Tag Twitter #circuitpython-dev or email anneb@adafruit.com with news items
22 authors? π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§π§βπ€βπ§
We can remove that name from the logs if you want ("weblate"); sommersoft suggested it too
(we're going to get a weblate section on that page soon!)
@past ether are you just listening (lurking), or do you want to participate/have notes?
I see that too.
Sorry, lurking @raven canopy
no apologies necessary! just wanted to make sure. π
The SAMD51 ADC is odd and flaky in a number of ways, sadly, so not so surprising.
π― /2
I see the same person (with the spider robot) regardless of who is speaking.
@ionic elk Maybe try toggling your video off and on.
Because it's showing up permanently green for me as well.
Lucian is green bordered even with no video
Early days of Google Hangouts was whoever is noisiest.
maybe leave and come back
hehe. is it still beta? client versions per OS don't always track each other either, i think...
I left and came back is it still on me?
Discord likes you, Lucian. π
π« yay
What happened to Hierophect!
i was about to say. Dan and his cat look like Brent. haha
The video has live demo gremlins π
we're all about live demos around here right? gremlins and all.
@timber mango we're happy to have you here!
Thank you. π
can anyone else not hear him? I'm getting scott but not Jason
I hear Jason fine
I don't hear Jason
I do.
weird
but I do hear Scott
I do too.
Weird
If you switch the "e" in "weird" to before the "d," it becomes "wired." Coincidence?
@ionic elk is he muted for you in user volume settings when you click on him?
I checked that but it didn't seem to be it
and it's not disabled for anyone else is the funny thing, it's the only time it came up
Same here (mute for jasonp is unchecked) and have heard everyone else so far.
On my desktop I can't get back to the text.
@ionic elk ....have you tried quitting discord and starting it back up? [it's been acting pretty funky for me, until I did that. less troublesome now, but not perfect yet π ]
looks for talking neurons. they apparently escaped... π
It's not that big a deal - I'm chalking it up to quirky new software
Like I said it was only for jason
my bug doesn't need to jump in line in front of anybody
@onyx hinge It already has.
I'm just watching. Very interestingπ
π
Yes @tulip sleet Web Bluetooth Dashboard
@serene warren - can you share a link to that magpi article? Sounds like an interesting project.
Thanks!
You are welcome.
and I still can't hear Jason WACKY
what the heck mang
incompatible audio, or something?
@steel beacon are you lurking and just listening?
@ionic elk what was the name of the intelligent servo?
Hmmm, all speakers and video are awesome on my desktop. I just can't get back to text.
Dynamixel from Robotis, AX12. Here's my proto library https://github.com/hierophect/Circuitpython_Dynamixel
Yeah just saw it and wasn't sure what it was but it looked interesting
π welcome!
@ionic elk thanks!
I literally can't use normal servos anymore, they're so nice
They're barely more expensive for torque, but they don't go as low as the PWM ones in terms of weak but cheap options. So less appropriate for super duper tiny robots
stepping away for a second, will be back for in-the-weeds. @idle owl in case you need to take a note for a second
@solar whale Does the Teensy 4.1 displayio speed issue seem to be at all related to rotation? I also notice it on my 135x240@90Β° Can test more also with the 240x240 and 320x240... edit: n/m, doesn't seem to vary based on rotation.
@idle owl I've been zoning out looking at it all meeting lol
Wall is mezmorizing
@modern wing I haven't done the math, but that seems like something worth knowing. It's running off of a 5V10A power supply, and if it's at 100% brightness with power injected in two places, and hits a solid color, it browns out the Feather into DFU mode. It's currently running at 50% brightness.
did you consider using a PI GPIO to activate the reset pin directly? since if I understand right, that elimintes the bit of the software that's triggering the linux kernel bug
that's a nice size run!
Everybody loves a big honking button.
@onyx hinge its an option. i haven't gotten to the hardware/GPIO interaction part yet, so have been focused on software approach.
Loud and clear
Imma put this question in general again - does anyone have recommendations for a good editor or editor setup to create and modify rst documentation?
@ionic elk I've been writing RST for a decade an honestly I just use VSCode
I find using Sublime makes maintaining the column limit really annoying, and it feels like there's got to be some tool that does that for you
Does VSCode handle line breaks in paragraphs in an automatic way?
The column limit is a project-specific configuration. A lot of mine just did away with it. Nearly every modern editor has word wrap.
I've been disappointed with vim's support for editing things within the //| comment areas too
There's a VSCode plugin that can do hard wraps
do you use it?
occasionally?
ok, I'll give it a try. See how it compares to my sublime setup
tbh I really dislike hard wraps as a requirement. It makes diffs silly.
I'd tend to agree but it seems to make reading things or posting things on Github really inconsistent
If you don't put in line breaks Github doesn't wrap it at all and just adds a huge scroll bar
i have seen styles where each new sentence of doc stars on a new line, and you rely on the word wrapper to make nice paragraphs
so you can still use a line break to make shorter lines, but the diffs are a little easier to read
That's sort of my question, what kind of word wrapper does that? It's automatic, I guess?
I dunno this also goes for documentation written for super-strict projects like Zephyr which don't accept anything outside a very specific set of style rules.
when i saw it, it wasn't automatic. if there was any existing automation, I'd guess someone wrote some emacs code to do it
It's a guide.
Where the basic documentation is function per function, what does it.
What about taking the static version of the dynamically generated code result?
Yes, siddacious caught my intent. I wanted to create a device to check the frequency response of my vision in different parts of my visual field (straight ahead, quarter, and fully on the side periphery). And in doing so, I thought it might be interesting to have not just one LED blinking on and off, but to have up to five LEDs "walking" in sequence. But the intended use is irrelevant, the point of the Issue is that the timers are not released after doing "deinit".
And by the way, this ap...
Have to host another a call at 2:30. Thanks and have a great week all!
mp_printf(&mp_plat_print, ...) ?
(result, extra_info) = function(...., extra_info=True) vs result = function(...) # extra_info defaulted False
@lapis hemlock nice to see you!
could you raise an exception at the tail, and supply the result in the exception message?
@raven canopy no, because then you don't get a return value
Thanks for experience.
That would work nicely
mp_printf(&mp_plat_print, ...)?
@onyx hinge Thanks!
It's amazing to have more than 2 dozen people interested in our weekly meeting.
well, you could:
try:
foo = ulab.thing()
except ulab.ThatOneException as e:
foo = e.args.find_results_stringy_type_stuff
pass
not super clean...but doable. π
@raven canopy you're in "worse than the disease" territory now
ouch. π€£
see the calendar directly in your browser: https://open-web-calendar.herokuapp.com/calendar.html?url=https%3A%2F%2Fraw.githubusercontent.com%2Fadafruit%2Fadafruit-circuitpython-weekly-meeting%2Fmaster%2Fmeeting.ical
@slender iron One minor I noticed during the meeting -- your video was stuttering while everyone else was fairly smooth.
I am signing off now
@modern wing OBS probably. I'm convinced my machine is going to crash when I run the meeting next. like... hard.
It easily could be that -- it wasn't a problem, just something I noticed.
I was doing a few test streams with multiple monitors, usb mic, and OBS recording + streaming -- and my machine got so hot it could fry an egg, then crashed hard.
@modern wing But I did streaming and OBS and all of that on a 13" MBP with two 34" ultrawide Dell displays, and no issues. Could get that back up and running for streaming, but it's ridiculous that I even have to entertain that.
@tulip sleet Should I merge LED animations? I'm fine with that but didn't want to step on anything if you were going to.
@inland tusk I disconnected you from the voice channel since you left your video on
@idle owl I wish I could get that level of performance -- I have a late-2013 15" MBP (with nvidia graphics, i7, 16gb ram). And it's just...sigh...being an annoying thorn in my side when it comes to actually getting things done.
The performance I got out of it -- I could stream, not record. No external displays. And good luck if I recorded anything more than casual application use. A lightweight indie game? More than a few programs open? Video would get massively desynced.
@idle owl go ahead; i didn't want to step on anything you were going to do
@strong violet are you on here at all? the stub work I just did could be helpful in thonny
@low sentinel if you are around can you update your PR for new translations and then I'll merge it before anything else
@fiery silo meet, @onyx hinge and @ionic elk who are interested in CJK font stuff
(and scroll back for some recent discussion)
Which PR was this fixed in stm, what was the root cause?
Did you make sure pixelbuf is enabled on all boards with NeoPixel frozen in? Otherwise one will still need to install pypixelbuf.
Hi @fiery silo
We were discussing issues getting CJK unicode fonts to display in reasonable time periods, was wondering how that process was going on the open book. I was seeing 40s update times for just a handful of glyphs on an epaper featherwing, which seemed pretty off to me.
Was also discussing font compression with @lucid solar since a 16pt CJK font is larger than the nor flash that ships on most circuitpython devices
would love to hear your input.
@crimson ferry I did not notice any difference due to rotation -- with the st7789 on the teensy4.1
@slender iron yeah. That button is still flapping back to denying maintainer edits. π€·ββοΈ
Changes max SPI clock from 105.6MHz to 130.9MHz.
Based on NXP's clock config tool:
(The value of the register is divider-1)
Before:

After:

@low sentinel sounds like a bug. ping me after you update and I'll merge asap
half the time it's been me merging stuff
I really appreciate your patience with it
Fixes #2514
The TEMP peripheral requires OCOTP to get the calibration data.
@slender iron it's fine - I might be feeling a little gaslit by github but all's well.
Itβs updated. I've used --force few times in my career. I think this PR doubled it.
@gilded cradle Did you see my post about pins on the UDOO Bolt?
@low sentinel thanks! will merge as soon as CI is happy
Here is the notes document for Tuesday's CircuitPython Weekly meeting. Monday is a US holiday. 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/1YbprhPUrW1Tr1iMQszf3Hh231b5SAXxoHmjDRcRTRIM/edit?usp=sharing
@fiery silo I have uninformed opinions about text rendering but you should pay more attention to the ones who have applications in mind
I have this cool new feature where only one CIRCUITPY at a time shows up in Finder even with multiple boards connected, but resetting either makes it disappear and then the one I reset shows up.
I have a very interesting project that analyzes ultra sound signals 30 to 200 kHz running on a pyboard. Would would like to run on SAM51 board with Circuit Python for reduced power and size. The problem is the inline assembler doesnβt seem to be enabled for Circuit Python 5.3 Metro M4 Express. Used the fft written with inline assembly for MicroPython for my work. I know performance is not the main focus,but It would be nice if the performance tools were not locked out. I have seen in #1248 enabled for nRF Port.
@warm pelican Currently we don't enable that by default. we have an FFT implemented in C code in the ulab module. Have you seen that?
it's similar to what's in numpy
that is enabled in M4 and nRF
or you can build your own version with the assembler code enabled by enabling CIRCUITPY_ENABLE_MPY_NATIVE. See https://github.com/adafruit/circuitpython/pull/2271
it's only enabled by default on a few boards
but it's not too hard to do your own builds
No I will. The other problem is high speed A/D input. Need min 400 K Sample per sec. I was going to implement in assembly since timed input not available in Circuit Python.
Instead of raising a TypeError and then catching it, please just print out the info directly. Let's not make it fail due to this yet.
One request on how to handle the info.
Ya I asked for that more than a year or 2 ago.
If you feel like rummaging around in CircuitPython, we would certainly welcome a PR. How do you do it in MPy?
@kevinjwalters I would love to see us have a speech module like Micro:Bit: https://microbit-micropython.readthedocs.io/en/latest/tutorials/speech.html
I'm ok including bespoke modules as long as we have the space. Most of the new boards have plenty of space.
Looks great! Thank you!
Mpy has a timed analog input, it blocks but work for me. It can be very complicated. A more sophisticated way would be use DMA control.
@low sentinel merged!
Looks great! Thanks for doing this!
yes, we are thinking of DMA sort of like the PDM microphone input
the SAMD51 ADC is unfortunately fairly flaky in certain ways: lots of errata, so it may be some work to get it working properly.
So I am more of an engineer than a programmer - making new builds are way out of my comfort zone - access to the assembler would be nice.
Hmm, how would I access the pin members for that list? I don't really get the macro used when defining it,
#define MP_ROM_PTR(p) {.u32 = {.lo = (p), .hi = NULL}}. Would it just bemcu_pin_global_dict_table[i][1]when iterating?
This is only for object representation D which is for 64bit architectures. On our embedded platforms its just #define MP_ROM_PTR(p) (p).
It should be [i].value because the table is an array of mp_rom_map_elem_t and has key and value fields.
That is a bit of bad new about the A/D. So maybe timed acquisition would be easier.
it could work, it's just that it has various issues
we have a guide about doing builds:
you just have to add one line to enable the decorator
if you're willing to try this we can help you along and you can pick up the skill
Ok thanks for your help. I will check out the fft.
The 1050 EVK isn't building: https://github.com/adafruit/circuitpython/pull/2918/checks?check_run_id=682359651
Are you missing submodule updates?
@ArmstrongSubero Let us know if you need help when adding it. We love getting more contributors involved.
Yesterday I read through the short ninja build manual and wonder if it's worth using the
depfilefeature that automatically discovers required header files by usinggcc -MM -MF $out.d ...to write out all required headers for a given C file. Usingdepfilecould help in several ways:Besides eliminating the need to specify the implicit header dependencies for an given C file using
| foo.h, it also makes the process more robust by ensuring no header files fall through. For exam...
I only looked at issues with the USB tag, guess I missed it.
I added the usb label to the linked issue. Thanks!
[adafruit/circuitpython] Pull request review submitted: #2924 NRF: Persist RTC offset across reboots
This looks good to me! Do you plan on turning off all RAM banks except the one this lands in?
One comment about SAMD21.
Can you check that this builds on SAMD21? I believe debug builds don't have any space for it.
We should stop advertising when the address rotates. Keeping the advertising data static while rotating the mac address removes the anonymization aspect of it.
Looks good to me! Thank you!
Hi @slender iron, @onyx hinge, @ionic elk, Iβm just seeing this ping, reading back now
@ionic elk so for the Open Book I had been dedicating a whole 2MB Flash chip to just the font support; to keep text rendering times fast, thereβs no compression and a bit of wasted space, basically each block in each plane has a lookup table, so the code point is an index into the lookup table, and the value there is the address where the glyph data is stored
Lately Iβve realized itβs more cost effective to just have a larger main Flash chip and put the data that would be on the chip into a file on the file system and it seems just as performant
Is the code for your lookup table and such public?
Yep, this is my CircuitPython work on it: https://github.com/joeycastillo/babel/tree/master/CircuitPython/babel
One small bug to fix and then this will be ready. Thank you!
This should be the passed in param.
@fiery silo nice. How small were you able to get your unicode font?
And in here is the script I use to convert Unifont font data to a blob that has all the lookup tables and glyph data: https://github.com/joeycastillo/babel/tree/master/babelconvert
I never quite squeezed it onto 2MB which is why I was puzzled
Do you see any potential for doing all of this off an SD card, eventually? Or would that incur unacceptable latency issues?
Itβs just under 2 megabytes
So does your incarnation of Circuitpython have 2 flash chips, or an internal filesystem + dedicated font flash?
Iβve tested it both ways, there are two subclasses for it (FileBabel and FlashBabel) and I found the performance to be just about the same
I donβt know about an SD card but reading from a file on the QSPI flash was honestly maybe a little faster than from the secondary SPI chip I had been using
Will the software need a re-write to support SD? Or is it just using the existing circuitpython filesystem implementation?
Itβs just using the standard python open syntax, so I think it would just work
Nice. This all sounds great
OH but also, I should add, the 2 MB was only the basic multilingual plane, adding the supplemental multilingual plane made it more like 3 MB, and I know a lot of CJK glyphs are outside of plane 0
I'm not super concerned with that - I imagine most Kanji will be in the main section, right?
I'm not an expert on what lies in the main and supplemental planes
Thatβs my understanding, the most needed glyphs were put in plane 0 but also not an expert
I merged Sabas' PR in the SDK repo, think the SDK submodule needs to be updated to point to that https://github.com/adafruit/MIMXRT10xx_SDK/pull/3
I'm trying to do a proof of concept for a Japanese language app - I'd like to support everything eventually, but I can always just bump up to an SD card or a bigger nor flash if I need to
Also the script in babelconvert supports adding in the supplemental planes if you want to try that
Great, sounds like you covered just about everything
(And conlangs for Klingon support π)
You have any more of your PCBs left in stock? I'd like to pick one up
I do have the e-book wing PCB in stock, I am planning to do a run of the Open Book PCB as well but donβt have those yet
Cheers man, thanks for answering all my questions
For sure! Let me know if you run into any issues π
Hopefully should be able to tackle most of it myself, I had missed your Babel reps
Thereβs also some bitmask stuff in the Babel lookup tables (right to left support, whether a glyph is 8 or 16 wide, nonspacing marks), think itβs reasonably well documented but feel free to open issues if you find anything that needs more work
nice to see you here, @fiery silo. Love the e-book project. π
@ivory yew good to see you here too, and thanks!! π
@timber mango No, I missed it (but just saw it when I looked back). This part that you are dealing with is the most complicated part and often involves research, cross-referencing, and some guess-work.
Ok, removed the other bits.
Looks good to me. I chimed in a bit on the VCP TX/RX pin exposure discussion but it seems to already be resolved. Anything to do with Morpho pins is in the territory of "just change the build yourself" anyway.
I removed the delay and the IDLE task watchdog triggered. So, I reduced it to Delay(1) and left the flush.
@tannewt Can we ignore the failed checks? or should we run it again?
Is there a correct way to handle when black formats an if statement but it makes pylint complain about bad continuation?
@lone axle add a pylint ignore
No, because right now we don't actually power off -- we need to keep Bluetooth running.
The plan is to check to see if it's the year 2000, and if so set the current time to the time of code.py (under the theory that the file was just [re]-created), then that should persist across reboots and crashes for months:
import os
import rtc
import time
system_rtc = rtc.RTC()
if system_rtc.datetime.tm_year == 2000:
system_rtc.datetime = time.localtime(os.stat("/code.py")[8])...
So @slender iron I'll change the _bleio I'll convert the anonymous option to an int that defaults to None, and if set it will only advertise for that number of seconds.
@half geyser would that make it possible to advertise across mac update?
@slender iron No, because if it's nonzero I'd set adv_params.duration to something other than BLE_GAP_ADV_TIMEOUT_GENERAL_UNLIMITED
ah, and the mac is fixed for the duration of the advertisement?
That would cause it to be fixed for the duration, yes.
The MAC is fixed to a duration that is specified, but Nordic defaults to 15 minutes if it's unspecified.
By making it an int rather than a bool, we can specify both the advertising duration and the MAC rotation duration to be the same.
Or we could add another parameter duration that takes the amount of time to advertise, and keep anonymous a bool.
this indicates that the private address can change with the same advert
I'd suggest making it a bool that sets the duration to the remaining MAC lifetime
And leave private_addr_cycle_s to the default of 0? https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.s140.api.v7.0.1%2Fgroup___b_l_e___g_a_p___p_r_i_v_a_c_y___a_d_v___m_s_c.html
When working with the latest beta (5.4.0 Beta 0), it seems like CP is running a little slower than it was in 5.3.0.
Code to test:
import time
start = time.monotonic()
for _ in range(1000000):
pass
print("Time: {}".format(time.monotonic()-start))
Output (ran on an itsybitsy m4 express):
Version 5.3.0: 4.784 seconds
Version 5.4.0 Beta 0: 9.219 seconds
Can anyone else reproduce this?
@half geyser I guess you set the duration of the mac rollover and then the advertising duration to less than that
I don't see a soft device event to tell us when the mac changes
No, I don't think there is one. I think it's more a set-and-forget type deal. We could set the rollover time to be equal to the duration + 1, and then add a parameter to set the advertising duration.
that's fine with me
we want to prevent advertising the same payload with the new address
Yeah.
I didn't pay so much attention to that because I'll be rotating keys much more often than once every fifteen minutes, and I was going to stop/start advertising. But I could definitely see the appeal to codifying it in the API calls.
I'll go refactor now.
it's something people may forget and I don't want them to screw it up
This is expected because we now call the background tasks more than we need to. This is because we have to always run them in case we sleep afterwards.
@jepler prototyped a background task list here: https://github.com/adafruit/circuitpython/pull/2879
ok, I'm off. night all
I see. I stumbled across this while trying to loop through setting NeoPixel code that was working better on the older version.
Is this newer way better? Or just improves background task handling while losing some of the overall speed? (I don't know much (if any) about the background tasks in CP, so to me it just seems like a net negative, but that is probably just due to my ignorance)
@slender iron I know you are off now, but you will get this later. You can not protect people from themselves. Unfortunately, they are very often their own worst enemies. So, let us make the best Circuitpython that can be made!!
I'm protecting me from me. I always forget these sorts of things.
Add hiibot_bluefi board definitions.
I added a new property timeout that lets a user specify a number of seconds for the advertisement to time out. If no timeout is specified when anonymous mode is requested, then the maximum permitted timeout is selected (currently 180 seconds).
Additionally, I created a new property .advertising that indicates whether the device is still advertising.
This sounds like it's related to low power features mentioned in https://github.com/adafruit/circuitpython/releases/tag/5.4.0-beta.0 ? If that's the case, is there an argument and possibility of having the programmer explicitly choose and enable that feature in code.py or boot.py to reduce the overhead on the majority of full power applications? Or is #2879 effectively an automatic version of this?
tested this PR on a grand_central_m4_express
It works!
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.3.0-187-g82024d078 on 2020-05-19; Adafruit Grand Central M4 Express with samd51p20
>>> import sdcardio_test
['hello.py', 'images']
>>>
I had to make a few changes to the example since the Grand Central M4 does not use the statndar SPI bus for the SD Card. here is the example I ran
import adafruit_sdcard
import busio
import sdcardio
...
This looks like a debugging printout you meant to remove, comment out, or guard with an #if or #ifdef.
[adafruit/circuitpython] Pull request review submitted: #2919 \_bleio: support anonymous advertising
Minor things. Looks good otherwise! @tannewt, do you have further comments?
Also debugging (and it says "etvent" instead of "event")
Since the common_hal routine will ignore anonymous if there's no timeout, could you add a validation check for this, and complain if anonymous is set without a timeout?
We hope and expect to restore the lost performance by the time this comes out of beta.
Thanks for the feedback, @dhalbert . I've made all of those changes as requested.
@tulip sleet anything left for https://github.com/adafruit/actions-ci-circuitpython-libs/pull/8 ? (that's needed for any of the other repositories to pass CI with reuse lint)
Good catch. I removed that.
Okay, if you specify anonymous, it now requires you specify a timeout, rather than picking one.
I corrected the spelling on this one and commented it out, like the others.
@topaz quest It looks good! I had been awaiting an answer from Limor on the general idea, and she responded positively.
One minor q: you are leaving a blank line between the two SPDX lines. Is that just a style thing you are doing, or is it required by the spec? I'm just thinking about minimizing the size of small examples, etc.
It's not a requirement by the spec β it's just what reuse addheader generates by default β it keeps all the copyright tags together without spaces, then the license
so it can be removed after the fact and reuse lint won't complain at all
updating the pullrequest for testrepo now
Here is another example of using text in a tileGrid: https://github.com/kmatch98/simpleTerminal
In modifying a text editor for use with CircuitPython (see the modules branch of the MicroPython editor pye), I developed a simpleTerminal class that creates a tileGrid of text with some additions for cursor control. It has a wrapper class editorTerminal that handles some VT100 styl...
[adafruit/circuitpython] Pull request review submitted: #2919 \_bleio: support anonymous advertising
I didn't see a push (and I have a reversal of a request).
Sorry, I misunderstood the common_hal routine. I thought it was ignoring the anonymous if there as no timeout, but that was just because I was missing some code due to the way the diff displayed. It's fine to not specify the timeout if anonymous is True, as long as the constructor's documentation says that, and says what the timeout will be. So I believe your old logic is OK, if it's as stated above; just add more doc to the timeout arg description.
Yeah, I did a bit of research it is advisable prat to disable the interrupt before WFI() to avoid race condition. WFI() doesn't require interrupt enabled to wake CPU. It is best practice to also all DSB() before WFI() as well according to ARM docs. Here is the implementation of zephyr
https://github.com/zephyrproject-rtos/zephyr/blob/master/arch/arm/core/aarch32/cpu_idle.S#L75
There is a other useful doc from mbed as well.
https://os.mbed.com/media/uploads/pateshian/wfi_wake_up_from_sl...
background task are run in the caller mp_hal_delay_ms(), maybe we don't have to run it here, but rather move/sort it out. I am not so sure though.
I pushed to the wrong repo. Oops.
Also, alright, I reverted that change. I already added a note to the documentation regarding defaults of timeout when anonymous was specified.
[adafruit/circuitpython] Pull request review submitted: #2919 \_bleio: support anonymous advertising
OK, looks good to me. @tannewt, do you want to take a final look and merge if OK, since you had comments as well? I won't merge right now.
Correct, but you must run background tests after you disable interrupts, to ensure that e.g. the USB queues are empty.
yeah, I know that intention of yours, I am thinking a way to make tinyusb maybe cooperate better with wfi() :thinking: :thinking:
LGTM!
Looking at the raw log on RTD, I see that it initially installs Sphinx<2 and our requirements.txt is still pinned to 1.8.5. Do we want to upgrade RTD builds to match the CI builds? Obivously, its not broken so not a super-important or blocking issue...
@arturo182 temporary fix was in #2866, cause was _minimum_stack_size being set very small, and the "default" stack size is set based on minimum size. I haven't dug much deeper on the issue and it needs a proper, informed fix before I would consider closing this issue. I'll check it out for the i.MX as soon as I'm done with pin claiming (should be today).
[adafruit/circuitpython] Pull request review submitted: #2919 \_bleio: support anonymous advertising
Looks good to me! Thank you!
@gilded cradle I added the board detection that uses the check_board_asset_tag_value() function. It works and everything has passed PyLint. I think that completes the work on the adafruit_platformdetect library.
The goal is to be better than we were prior to the low power change. Before we waited 1ms between background task runs. Ideally with the new implementation we'll have a single lightweight check that enables us to do the background work as needed. This will mean we can be more responsive in the background while reducing the check cost.
Thanks @timber mango. I'll review it today.
@onyx hinge how does weblate merge changes back from git commits?
Cool!
@slender iron weblate gets notified on push to master and rebases its local changes
Hi, thanks for submitting. Could you limit the features to those in this guide?
https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-downloads
The features list is used to automatically generate search options. Spelling is important so we don't end up with a list that is out of control (it has happened before) by having lots of variations. You can always put anything cool that isn't on the features list down in the description.
No need for the intermediate a.
Please make sure the CI passes the "test" step before requesting re-review. The check doesn't work as is. https://github.com/adafruit/circuitpython/pull/2899/checks?check_run_id=687114845#step:18:13
print(f"Missing parameter type: {j.__dict__['name']} on line {j.__dict__['lineno']}\n")
print(f"Missing return type: {j.__dict__['name']} on line {j.__dict__['lineno']}")
print(f"missing attribute type on line {j.__dict__['lineno']}")
@onyx hinge it looks like CI is unhappy that the new ids are not in the language files
maybe we should remove that constraint
and assume translators will use weblate
@gilded cradle I am having great difficulty finding pin information for the UDOO Bolt. I found something that looks like it might be what I need but am not sure. The left side is the Bolt pinout. Is this what I am looking for?
LGTM!
Looking at the raw log on RTD, I see that it initially installs Sphinx<2 and our requirements.txt is still pinned to 1.8.5. Do we want to upgrade RTD builds to match the CI builds? Obivously, its not broken so not a super-important or blocking issue...
I was seeing this fail: https://github.com/adafruit/circuitpython/pull/2927
that is why I brought it up
I stopped us pinning to 1.8.5 but RTD is still I think. I updated recommonmark and it worked ok. New build is here: https://readthedocs.org/projects/tannewt-circuitpython/builds/11074950/
@slender iron I enabled an addon called "Update PO files to match POT (msgmerge)" and it looks like that has added the messages to nl.po in that pull request. I'll keep an eye open.
I bet this affects only the case where weblate added a language and master added new strings at about the same time
there are some settings, any idea which ones I want?
no fuzzy
updated, thanks
np
who wants to do the esp32s2 port review? @onyx hinge , @tulip sleet or @ionic elk
hmmmm I thought this was functionally the same as what I was already doing in my own local makefile mods, but it actually breaks DEBUG=1 builds, at least for samd. Will revisit .. sometime.
../../py/vm.c: In function 'mp_execute_bytecode':
../../supervisor/shared/translate.c:98:66: error: inlining failed in call to always_inline 'translate': optimization level attribute mismatch
98 | inline __attribute__((always_inline)) const compressed_string_t* translate(const char* original)...
@slender iron I can look
port_fixed_stack returns some block of memory if that's the only stack the port can use, otherwise it returns NULL?
how in the weeds do you want me to get about the build process?
not very. I want to clean it up over time
this is "it's all hacked together as a foundation for refinement"
i can take an uninformed look too
Why mess with MICROPY_PY_REVERSE_SPECIAL_METHODS right now?
because its a ULAB dependency
I really wonder at why DWORD get_fattime(void) is in some port-specific file but .. that's not a new-ism
You needed to turn off REVERSE for this port?
I need it on when ulab is
I'm still not getting the connection to the esp32s2 port
or is it just cleanup-level stuff?
ya, I probably just ran across it when turning things on and off
I can't remember now how I hit it
ulab has some constants that are missing without the reverse stuff
okay
could you set it on in circuitpy_mpconfig instead, depending on CIRCUITPY_ULAB?
everything outside the port itself seems sensible
@tulip sleet we should be able to enable it without ulab too
yes, i just mean that you shouldn't need to add it to the individual board files, it can be forced on for ulab and otherwise is user choice
shakes his fist at gitk why are you showing me renames that are nonsense? It's really not making it easy to review this PR
Β―_(γ)_/Β―
Because I don't have the hardware or toolchain to test on, I mostly looked at the changes introduced outside of ports/esp32s2. They seem sensible. I asked Scott about a few on Discord for more information.
There's sure to be more work to do in the port, but this is a great step and looks like a low chance of disrupting other ports.
there, you now have a review
thanks!
sure thing
next in the weeds maybe you can outline your plans for the build system cleanup so I can better hold your feet to the fire about it down the road
GNU Make is a devil I know, so I'll shed a tear when it's gone
i would suggest adding lots of // TODO whatever in various places to make it easy to find what still needs to be done, but maybe that's too much for this review.
like in digitalio, etc.
@tulip sleet I started filing issues instead: https://github.com/adafruit/circuitpython/labels/esp32s2
@onyx hinge make's logic is very confusing and we'd be better off with one system for all of circuitpython
ninja facilitates separating logic from the build dependency system
sure, I'm not arguing against anything.
(the start of the ninja stuff is here: https://github.com/adafruit/circuitpython/compare/master...tannewt:ninja)
that's ok too, but if you start removing stuff when you start with an existing impl, adding even just // TODO will mark it, to know what to look at when working on an issue. I'm just saying how I would keep track of things I forced (like output-only digitalio, etc.)
(if you find me making some kind of sunk-cost fallacy argument about build systems, though, please call me on it.
I've done that before in other projects)
i think that would be good. It's just I had missed some stuff when doing the nrf port and didn't discover it until later.
Looks good! ... Though of course I skipped over all the config stuff.
I think this could be in circuitpy_mpconfig.h, forced on if ULAB is on.
@slender iron sorry didn't see your message I've been working on i.MX stuffs. Still want me to review?
Nope, all good
@onyx hinge I have just merged a fix for your mysterious bugπ Thanks for taking the time for testing and reporting!
@lapis hemlock you're welcome. I ran across it by accident -- I'm curious what the fix was, so I'll check it out
Oh, no! You shouldn't see itπ³
oh, because "32000" could convert to type int16_t, ...
well at least it explains it! thanks again
Looks good! ... Though of course I skipped over all the config stuff.
Because I don't have the hardware or toolchain to test on, I mostly looked at the changes introduced outside of ports/esp32s2. They seem sensible. I asked Scott about a few on Discord for more information.
There's sure to be more work to do in the port, but this is a great step and looks like a low chance of disrupting other ports.
Ok, I moved it back to mpconfigport.h where the set to 0 was originally for SAMD21. The global defaults stay as they were, FULL_BUILD with a warning of ULAB on without it.
oh, because "32000" could convert to type int16_t, ...
@onyx hinge Right. I have also merged pretty printing. That might interest you. https://github.com/v923z/micropython-ulab/pull/114/
ok, cool!
ok, cool!
@onyx hinge And then theapproxsub-module: https://github.com/v923z/micropython-ulab/pull/118/ I haven't yet committed tests for that, though.
I was reading https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf and page 126, section 35.5 recommends "an initial 30s of 20ms intervals" for advertising if I'm understanding this correctly.
I tried it on CircuitPython and it didn't behave. I've just run it again against 5.3.0 with 20200519 libs.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit Circuit Playground Bluefruit with nRF52840
>>>
>>> from adafruit_ble import BLERadio
>>> from adafruit_ble.adve...
Yeah, it doesn't look like RTD has a config option either. Again, not broken so not anything to block on.
@tannewt @arturo182 issues reworked, this should be good for re-review.
@slender iron Congratulations on the esp32s2 !
π
are any available?
what do you mean?
looks like mouser has some
what is the difference between the 1RI and the 1MI
RF/IF and RFID β RF Transceiver Modules are in stock at DigiKey. Order Now! RF/IF and RFID ship same day
one has PSRAM and the other doesn't
the I is whether it has the antenna connector
R has
odd -- I could have sworn they were out of stock a minute ago -- thanks!
ya, me too
They were in stock 3 hours ago π I was checking for the modules...that's what I need.
@onyx hinge I forgot to ask yesterday: what is a JEplayer?
Is it something to do with owls?
@tannewt I'm wondering how I would go about doing this. Any suggestions?
@lapis hemlock it's an mp3 player app that runs on pygamer
Cool!
@idle owl Thanks for your help getting my library into the community bundle last week. You mentioned about submitting it for the newsletter (which I realized I missed for this week - holiday in Canada through me off!). Is there somewhere I should submit the info about it and the how-to tutorial I wrote up?
Hard to say TBH, maybe copying and removing files to and from the CIRCUITPY drive, also resetting while doing that stuff. Trying to fill the drive while doing other operations. Removing without unmounting, removing while something is copied over. Stuff like that.
Not 100% related to this issue, but I think the issue related to busio in general is closed now so just wanted to make a note. I spent a few hours yesterday testing and verifying SPI, and I spent a few hours today verifying I2C. I'm fairly confident now that those two peripherals are stable and ready to be used by the general public. Good to see you're on UART, @hierophect :)
Just re-tested all 6 inputs on the 1011 Feather and it's looking good so far. I will be creating a test jig for that one and I plan to have different resistor values connected to each analog in pin so I can test that the analog values are as expected.
Actually my bad, the issue is still open: #2483
Can you set the level while in input mode? I would have expected these to be reversed.
nrf goes into safe mode with a hard crash. atmel-samd just does HardFault_Handler(). (nrf scheme seems better?)
another reference from freeRTOS tickless mode, which do the same as this function
https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/master/portable/GCC/ARM_CM4F/port.c#L510
I did experiment with WFE instead of WFI, however that resulted in the system never sleeping for very long.
In FreeRTOS, vPortSuppressTicksAndSleep() looks like needs to be called from a critical section (i.e. when interrupts are disabled): https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/5d28744febb6788ff37ad51990848c7bd82296e6/include/task.h#L2538-L2544
I'm sorry, I misunderstood the wording there.
eTaskConfirmSleepModeStatus() is called from vPortSuppressTicksAndSleep() when interrupts are disabled to determine if it's safe to perform the sleep. You could do something similar here, where you disable interrupts and then go through each subsystem to determine if there are any pending buffers to flush.
The approach taken in this patch is to just go ahead and flush the buffers.
@tannewt @xobs we shouldn't run background task with interrupt disabled. This particular issue is mentioned by TockOS (note 3) a few months ago https://github.com/hathach/tinyusb/issues/279 . And I overlooked it. The correct implementation should be an function to check if there is anything to run with the event queue of tud_task(), if yes, don't enter WFI(), re-enable interrupt, and loop over again.
@xobs I just reference to freeRTOS to just point out that interrupt disabled is needed before entering WFI() as your PR does. The freeRTOS only enter sleep mode in idle task which guarantee there is no active event queue that is not processed. So yes, draining the event queue is a must, or we can just check the event queue, and skip the WFI until next time as suggested below which I think is a good approach as well.
There are two approaches that we can take, and I think @tannewt should decide which approach they think is best:
- Allow background tasks to be run with interrupts disabled. This is the approach that's started by this patch, but there may be many other minefields in other code that requires interrupts to be enabled in order to function properly
- Add a new
SHOULD_RUN_BACKGROUND_TASKSmacro that polls each subsystem, similar to howRUN_BACKGROUND_TASKSruns each subsystem. This `SHOU...
yeah you are spot-on and I am adding the usb event queue count API() just now. Your PR has already implemented 99% of the work. We only need to change the run background to if still has more background then skip before executing wfi().
Can anyone tell me what time.time() is supposed to do? I've had several HardFaults when using it, and I'm mystified as to what its purpose is.
I've tried passing it rtc.RTC(), but it says it takes 0 arguments. If I give it no arguments, it says AttributeError: '' object has no attribute 'datetime'
Ah, I see. It takes the time from the default RTC, which is set by rtc_reset(), except that function isn't called in the nrf port for some reason so it never gets initialized. I'll submit a PR to fix that.
The worrisome bit is that it caused a hardfault, which means there's memory corruption going on somewhere else...
On NRF, the rtc_reset() function is never called. As a result,
calls to time.time() return a cryptic error>
>>> import time
>>> time.time()
'' object has no attribute 'datetime'
>>>
This is because MP_STATE_VM(rtc_time_source) is not initialized
due to rtc_reset() never being called.
If CIRCUITPY_RTC is enabled, call rtc_reset() as part of the
reset_port() call. This ensures that time.time() works as expected.
Note that I would occasionally see HardFaults when calling time.time(), which is a bit concerning since it means that something was scribbling over memory. I'm unsure of how to debug that, though.
This patchset adds a new wdt module based on the WDT class provided by Micropython: http://docs.micropython.org/en/latest/library/machine.WDT.html
Note that on nrf, once the WDT is enabled it can not be disabled or have its duration modified without resetting the device.
Initially I had it enabled for all NRF platforms, however that caused several platforms to overrun their flash. So I have since disabled all platforms except Simmel.
Initially I had it enabled for all NRF platforms, however that caused several platforms to overrun their flash. So I have since disabled all platforms except Simmel.
I'm surprised by this, since there is still a lot of unused flash on nRF52480, even with an internal filesystem. What's an example of a platform that overflowed? Maybe you were compiling with optimization off?
@arturo182 have not stress tested Busio or DigitalIO yet, they're on the docket for today :)
Also testing this today
@arturo182 is the risk that the chip becomes unrecoverably bricked? Or is some essential information retained so it can be re-programmed over GDB or the DAP?
Todo:
- [ ] test drive overfill (fill all space)
- [ ] save file at unacceptable length
- [ ] yank drive while writing
- [ ] increase and decrease file size many times
To sum up current state:
- https://github.com/adafruit/actions-ci-circuitpython-libs/pull/8 is needed to make
pre-commit run --all-filespass when running as part of the CI; - once that's merged, https://github.com/adafruit/Adafruit_CircuitPython_TestRepo/pull/33 should pass CI and be ready to merge.
Should I wait for both to be merged before preparing the equivalent change for https://github.com/adafruit/cookiecutter-adafruit-circuitpython/, so we know what the final form of it ...
I guess it depends where the corruption occurs, the way I see it there are 3 areas, best to worst:
- the fatfs gets corrupted - you can erase it from CPY and you're good
- the CPY FW gets corrupted - you can reflash using tinyuf2
- the tinyuf2 bootloader gets corrupted - you have to reflash using the NXP USB ROM loader
I think the chance that the chip itself is bricked is quite low, never seen that happen.
Let me re-enable them for all platforms and re-build.
@half geyser something weird is going on with GitHub Actions. One of the subjobs was cancelled. I'm trying a re-run.
@tulip sleet if it's an unrelated subjob I'd just merge it
I love OPEN Source! If I need to figure out what is happening, I can just grab the source and look! There are no unknowns with OPEN Source. π π
@timber mango I love that also...yesterday JonnyB found a bug in Mu, this morning I download the source, fixed it and did a PR.
@slender iron there are random cancellations happening. The first try, the "test" job got cancelled (!).
i'll rerun after this batch finishes
So if you have a library, and that library has a folder with files in it, and the files in it get imported individually, do you call those things "modules"?
I think it is an accurate use of the term module. But I was never formally taught python conventions I could be wrong. It does seem to fit with the definition here too though: https://docs.python.org/3/tutorial/modules.html
@dherrada Please keep iterating until the CI passes.
@lone axle Thanks, I didn't think to try to google it since I figured someone here would know. Wasn't certain if we had CircuitPython specifics or not.
ok, @tulip sleet we'd need the test job to be ok
@blissful pollen Yes! Please email links to anneb (at) adafruit.com with "Python for Microcontrollers newsletter content" or some other indicator of what it is you're sending. That's probably the easiest way to do it.
I decided to take a look because reading your question it dawned on me that I tend to use "module" and "library" pretty much interchangeably but there was likely to be specific meanings for each that I should figure out and use so I don't potentially confuse anyone.
@idle owl yes. Roughly files = modules, folders = import packages
@lone axle Yeah I understood it to be module is part of a library. But then there's the "driver" and "library" interchange in my mind at times, so...
Β―_(γ)_/Β―
@ivory yew cheers
Things you upload to pypi are distribution packages.
Yes, it's good to do beforehand so that the pin doesn't glitch momentarily. Ivan was watching the stream and said it should be ok.
@idle owl Thanks will do that
@blissful pollen Thank you!
@gilded cradle There is something wrong here. I keep getting File "./udoo_board_ids_test.py", line 8 UDOO_BOLT: ( ^ SyntaxError: invalid syntaxWhat is wrong?python 3 UDOO_BOLT = "UDOO_BOLT" 4 _UDOO_BOLT_BOARD_ASSET_TAG = "SC40-2000-0000-C0|C" 5 6 # UDOO 7 _UDOO_BOARD_IDS = ( 8 UDOO_BOLT: ( 9 _UDOO_BOLT_BOARD_ASSET_TAG, 10 ), 11 )
@timber mango I'm not sure the larger context this code is from so maybe it's not the issue. But from that piece it looks like a dictionary definition is missing the quotes around they key.
I find myself making that mistake when I am switching back and forth between javascript python a lot.
@timber mango , sorry. I updated my snippet. I should have used braces.
@lone axle he's referring to https://github.com/adafruit/Adafruit_Python_PlatformDetect/pull/81
GitHub
Added board detection for UDOO Bolt using check_board_asset_value() and added it to detect.py
Ah I see. UDOO_BOLT is declared as a string variable further up which is why it doesn't need the quotes inside the dictionary definition.
@gilded cradle OK, it is done, works, passed CI!
I think I got all the changes you asked for. π
@gilded cradle Now, I have to do the tough part of adding a board to Blinka. I am having a lot of trouble finding the pin information though. Did you see the image of that I posted here?
I posted about this here https://forums.adafruit.com/viewtopic.php?f=60&t=165589&p=812615#p812615 and dastals suggested that discord would be a more effective forum.
Warning - before anyone tries this please make sure that you have a backup of your CIRCUITPY drive, and you know how to run a flash eraser specific to your CircuitPython board. e.g. https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/troubleshooting
I am using a Mac running 10.14.6 connected to an ItsyBitsy M4 Express running "Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit ItsyBitsy M4 Express with samd51g19"
I found that it I put this simple program into code.py, then my ItsyBitsy will not mount as a drive. To recover I had to enter bootloader mode, and erase the drive. Maybe there's a better way to recover, or there's something unique about my setup which causes this. I'm suspicious that the bignum code is not giving time to other code involved in handling the USB subsystem.
print("The waiting game")
i = 0
while True:
print("Looping {}".format(i))
i = i + 1
a = 2**(65536*2)
@unkempt pulsar I just tried your code on my ItsyBitsy M4 and it froze the board up. I can not connect to the REPL.
@timber mango No, I don't see an image. Maybe start here though: https://www.udoo.org/docs-bolt/Hardware_References/Pinout_Headers.html
@unkempt pulsar I suspect there is an overflow of some kind since you are running the loop forever.
@gilded cradle The information I refer to is the left part of the top image.
@timber mango note that this loop will execute very slowly due to the large exponent.
Ok @timber mango. See if you can use libgpiod. As a fallback, I made a sysfs pin class recently that should work.
Also check if udoo has their own gpio library
This PR enables one-directional UART to Busio, allowing for the definition of a UART line that has only the TX or RX pin.
Throws an error if you try to do this while also defining pins for flow control, since the two are basically incompatible as far as I'm aware. Also adds the reserved_uart table so the same peripheral instance can't be used twice, and fixes some bugs I found in the stm32 UART implementation while using it for reference (whoops).
resolves #2484
Jeff had mentioned that he found the UDOO had its own proprietary lib here: https://discordapp.com/channels/327254708534116352/327298996332658690/710323300093657129
@gilded cradle None of those are working for me to find gpios.
ahh. looks like the API is open at least: https://www.picmg.org/wp-content/uploads/COM_EAPI_R1_0.pdf
Going to follow this and #2898 up with a general Busio testing and cleanup PR that brings style in line across all three and enables proper pin resetting / never reset now that those functions are enabled.
not seeing a python library though for PICMG EAPI. π¦
Binaries! UGH! π¦
Neither am I.
Oh, there are .lib files. That must be the libs.
@timber mango i stumbled onto this, though it looks specific to the older UDOO Neo (and is quite stale): https://github.com/smerkousdavid/Neo.GPIO
it may provide some insight, but there are some scary messages in there (may brick the device, etc).
@raven canopy Yes, UDOO support is somewhat less than what I wish it were. I overcame that and still got an UDOO Bolt though, because it was the least expensive way for me to get a fully packed x86 box (32GB RAM and 1TB storage).
Hi @slender iron - I think I'm ready to do start the process for adding Evo M51 to CircuitPython. I'd like to get some guidance, first. Not so much on the mechanics - that's covered well in the learn guide. More philosophically...
When you have some time?
@old smelt Are you adding a new board to Blinka?
Ahhh, OK. The more the merrier! π
Does it do different tricks than the Adafruit board?
@old smelt I've got time now
I would like to see boards that have more SPI flash.
Besides devices like PyGamer, PyPortal, etc.
@xobs ok, despite some missing builds (which are not boards), we can see that it didn't quite fit in the pca10100 build (by 80 bytes), so that's the (only) one to fix.
Note that this patch doesn't actually work, because you cannot run
tud_task()with interrupts disabled, as it will possibly deadlock:
How often do you encounter the deadblock, I switch to your PR branch to try reproducing it. I know it is totally possible, but it is bit hard to encounter. I may just simulate it with other modified example, the goal is to check the corresponding registers to find a simpler alternative fix to https://github.com/hathach/tinyusb/pull/396 than invoking the ...
@timber mango I've just finished (this minute) routing a new board, that has SPI flash π
Up to 128mbit. The MCU is a STM32L433 with 256k/64k
@lucid solar nice! which flash chip?
@ivory yew W25Q128JVPIM TR
I think there's even larger than 128mbit, but the cost is crazy
I don't specifically...it's just I want to have the option.
hehe
https://github.com/k0d/plink if you want to check out the board. I've not pushed the latest changes though with the external flash. Only just finished routing it.
@ivory yew answering these in PCB-design channell
One other thing I'm puzzling over is why the flags (0x01) appear if I run dir() on an Advertisement object.
Adafruit CircuitPython 5.3.0 on 2020-04-29; Adafruit Circuit Playground Bluefruit with nRF52840
>>> from adafruit_ble.advertising.adafruit import AdafruitColor
>>> ca = AdafruitColor()
>>> ca.color = 0x112233
>>> ca
Advertisement(data=b"\x0a\xff\x22\x08\x06\x00\x00\x33\x22\x11\x00")
>>> dir(ca)
['__bytes__', '__class__', '__dict__', '__init__', '__len__', '__module__', ...
Translations update from Weblate for CircuitPython/master.
@xobs I was thinking 2 would be our approach to background tasks long term but @jepler prototyped a callback queue in #2879
Thank you! It's my fault for removing it I think. I was trying to prevent resetting the RTC time but all it does is reset the CP RTC object.
@Flameeyes you are welcome to make the PR. we won't want to merge until it'll be green.
I wouldn't prioritize this issue. It's too vague to replicate and debug. I also don't see this issue with SAMD so I'm not sure of the background.
So, my vote is to close but I'll leave it up to you two.
Discord set my last read pointer clear back to the 15th! I properly shut Cromium down.
Thanks for adding this! I have some API feedback.
//| has not crashed or locked up. You can enable the watchdog timer using :class:`wdt.WDT`.
@jepler Do you have time to look into using DMA interrupts instead of ticks?
I've just finished (this minute) routing a new board, that has SPI flash π
@lucid solar Wow! I would be happy with 8MB SPI flash on regular or new boards like the Feathers. 2MB is just too small now! π
2MB does get challenging for asset-intensive applications, but luckily so far I've usually been able to load only what's needed without moving to an 8MB board. It's RAM where I really need more than the 192k of most of the SAMD51 boards. 256k is good, but I know it's just a matter of time before that's not enough. Really digging the Teensy's 1MB.
I ran the basic tests and had no problems. Compared to most, the amount of flash on the EVKs is so monstrous that it's hard to even get to edge cases. It's possible something might crop up on the smaller feathers but I don't see any evidence of trouble so far - we can keep an eye on it but I'll close for now.
- adafruit/actions-ci-circuitpython-libs#8 is needed to make
pre-commit run --all-filespass when running as part of the CI;- once that's merged, adafruit/Adafruit_CircuitPython_TestRepo#33 should pass CI and be ready to merge.
Both of these are now approved and merged.
The recently merged #2898 adds just one thing you'll need to account for here, which is adding never-reset pins for the flash banks, USB and SWD pins. Should be just like the 1062: https://github.com/hierophect/circuitpython/blob/38fd9c25f22ec68920afcf736cb75d4d316ba8bb/ports/mimxrt10xx/boards/imxrt1060_evk/board.c
Happy to help if you've got any questions.
@crimson ferry It is not just assets such as images that will require more flash. Some scripts will require more libraries too, which use storage, even if you do load just the ones you need.
Good point, I do have to keep tuning my library loads too, though more for <2MB boards so I can use the same library load script for all devices (Teensy 4.0 only has 1MB of usable flash)
@slender iron What's a good development board to get for generally testing with CircuitPython? I'm not too sensitive to cost. I know having a board isn't necessary for overhauling the build system, but it's nice to see the thing one is building actually work. During the hackathon your build target was feather_m0_express. On Read The Docs, the suggested ports for SAMD21 link to using the Adafruit METRO M0 which supports GDB debugging (of the firmware?) which seems useful for CircuitPython development.
@stiff pewter I would suggest getting at least a SAMD51 (M4) board. Less memory constraints depending on what you might be interested in doing. The Feather nRF52840 comes with an SWD connector for debugging as well. The Metro M4 is also a good option if you want the debug option.
Seconding what Kattni says, the Metro M4 and Feather nRF52840 both have the debug header from the factory. I would not choose an M0 board, they have limited capacity and "debug builds" (optimizer disabled) don't even fit on them. Most of us use J-Link debuggers, they have an "edu" model (hobbyist/non-commercial) model that is quite inexpensive.
Is there much of a difference in getting the Metro M4 with WiFi (https://www.adafruit.com/product/4000) over the vanilla Metro M4 (https://www.adafruit.com/product/3382)? From CircuitPython's point of view is the WiFi version a super set of the Metro M4?
@stiff pewter same firmware for both. the airlift just has the library to use the ESP32 co-processor frozen into the firmware builds.
as he looks that up after the fact to verify. π
huh. i guess it doesn't have the library frozen in after all. but, still, same firmware.
It'd be awesome to have the result of the watchdog be configurable. For testing, raising an exception rather than restarting would be very helpful. I imagine it's possible that libraries take a while to return to the main code.
@dhalbert I fixed the other builds. Please take another look.
@slender iron Thanks for the tip to recheck Digikey stock on the esp32s2- -- will have one this weekend to try out. I was able to get the esp-idf installed and complete the builds. Looking forward to some new toys π
I can make one -- I thought it had a micro USB on it, no?
it's not connected to the native usb
so you'll be able to load firmware and see debug output but not see CIRCUITPY
oh -- now i remember seeing that - thanks for the reminder.
so esptool uses the onboard microUSB but need a breakout to see CIRCUITPY after install.... which one is REPL on?
good to know -- saved some head scratching.
I've been meaning to make an adapter board for it
in your spare time π
someday, I'll get inspired to give it a try.
I recommend it π
Please reuse error messages from other ports when it makes sense. That way there are less strings to translate. Here is what STM does: https://github.com/adafruit/circuitpython/blob/master/ports/stm/common-hal/busio/UART.c#L58
Do you mean:
//arrays use 0 based numbering: UART1 is stored at index 0
Please rewrite this check. It's not clear how it works.
Just a few minor things. Thanks!
I've failed to get my friend's children interested in RSSI measurements, unfortunately. My personal suspicious is PRNG would benchmark well against any measurement technique.
I've just taken a picture of what I see from an Android tablet showing a CPB advertising with the classic three 5 seconds steps: RSSI variation with Bluetooth LE Advertisement.
I put a question in about stepping RSSI from a CPB runninng CircuitPython sending BLE advertisements: https://forums.adafruit.com/viewtopic.php?f=53&t=165613 . Is there anything in the nRF52840 that allows this to be configured if it really is stepping slowly through channels 37. 38 and 39?
It's an XOR, converts both to bool and compares to ensure they're different. Would a comment be OK or do you have another notation for xoring that you'd prefer?
I was going to do this in a follow up PR, since I wanted to keep this and the reset pins PR separate. I2C, SPI, DigitalIO and PWM all need them too.
I've been meaning to make an adapter board for it
@slender iron I literallly have just finished designing one! Will upload to github in the morning.
Previously this would ignore where the slice started. So every slice would return [0:length of slice]
I have nothing more to add on top of Scott's comments :)
thanks @lucid solar !
Should I do the PR for our board as "me" or my Alorium Technology GitHub account? I actually have CircuitPython forked in both places. I was thinking from our Alorium account. Or does it even really matter?
either way
hey folks, I'll send the cookiecutter PR tomorrow β I ended up finishing my sony remote build tonight, to put away the rest of the tools π
@gilded cradle Is the information on the left side of that image enough to create a pin file for Blinka?
Thanks @dunkmann00! This looks like a definite improvement. However, I think that slices with negative "step" (also called "stride") are not properly supported yet. Please consider checking this and making another PR to improve it!
Testing performed: none
I get a truckload of files in frozen/ that have changed when I do a git status. I assume I do not add those for commit, right?
@old smelt try doing git submodule update. Those changed upstream, but they're not automatically synchronized when you do a git pull.
ok - will do
Still show up:
modified: frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center (modified content)
modified: frozen/Adafruit_CircuitPython_BusDevice (modified content)
modified: frozen/Adafruit_CircuitPython_Crickit (modified content)
modified: frozen/Adafruit_CircuitPython_DRV2605 (modified content)
modified: frozen/Adafruit_CircuitPython_DS3231 (modified content)
modified: frozen/Adafruit_CircuitPython_DotStar (modified content)
modified: frozen/Adafruit_CircuitPython_ESP32SPI (modified content)
modified: frozen/Adafruit_CircuitPython_FocalTouch (modified content)
modified: frozen/Adafruit_CircuitPython_HID (modified content)
modified: frozen/Adafruit_CircuitPython_IRRemote (modified content)
modified: frozen/Adafruit_CircuitPython_LIS3DH (modified content)
modified: frozen/Adafruit_CircuitPython_LSM6DS (modified content)
modified: frozen/Adafruit_CircuitPython_Motor (modified content)
modified: frozen/Adafruit_CircuitPython_NeoPixel (modified content)
modified: frozen/Adafruit_CircuitPython_Register (modified content)
modified: frozen/Adafruit_CircuitPython_Requests (modified content)
modified: frozen/Adafruit_CircuitPython_SD (modified content)
modified: frozen/Adafruit_CircuitPython_Thermistor (modified content)
modified: frozen/Adafruit_CircuitPython_seesaw (modified content)
modified: frozen/circuitpython-stage (modified content)
modified: frozen/pew-pewpew-standalone-10.x (modified content)```
Are you on Windows by any chance?
macOS
A bunch of those frozen submodules were copied over when i did the submodule update --init
You can always do git checkout --recurse-submodules frozen to reset those. My initial thought was that it could be reporting the line endings. But you can just reset them, since you haven't modified them at all.
Yeah, I haven't touched anything there.
Hello, was wondering if there was any update on this request for multiple spi displays? 5.3 is showing 'Too many display busses'. Thank you!
thanks @half geyser - that was the ticket!
extab is the exception table, which is used in unwinding support on ARM. I thought maybe the exception system of circuit python used this table, which is overflowing enough that it is no longer fitting inline. I noticed that atmel-samd stores the extab in a similar location, so I simply emulated it here.
If circuit python isn't using this data at all, it's safe to discard this section. We could also try building with -fno-unwind-tables which should also prevent the generation of this sec...
I'll do that. However, note that the name WDT comes from micropython, so this change breaks some compatibility with them.
I can place it there, but does that mean that we need to have a Watchdog on every platform? Or will it be like NVM, and will default to mp_const_none_obj if CIRCUITPY_WATCHDOG is 0?
On NRF, it is not possible to disable the WDT, nor is it possible to adjust the settings -- the WDT registers are only unlocked after a reset.
@slender iron I'm looking to refactor watchdog as per your recommendations, but I'm not sure which approach to take.
Should I place it under microcontroller.watchdog, where it's a microcontroller-level singleton, or should I continue to create a watchdog top-level module?
Soft watchdogs that can be used to raise an exception with long-running code seem like they should go under a watchdog module, but I'm mostly focusing on hardware WDT blocks. Should there be two different ones then?
@half geyser I think microcontroller and you can add an action attribute to switch between reset and exception
I encountered it maybe 20% of the time.
The problem always seemed to occur on the last packet as part of an MSC SCSI transaction (the same packet that causes https://github.com/adafruit/Adafruit_nRF52_Bootloader/issues/120 interestingly enough) that gets stuck in the queue between calling tud_task() and WFI. If tud_task() is called with data in the buffer, then it will deadlock.
Alright. I'm basing it off NVM, since that's the other approach I see that's similar.
I'll convert everything over to be called watchdog and/or WatchDogTimer, and move it under microcontroller.watchdog.
I encountered it maybe 20% of the time.
The problem always seemed to occur on the last packet as part of an MSC SCSI transaction (the same packet that causes adafruit/Adafruit_nRF52_Bootloader#120 interestingly enough) that gets stuck in the queue between calling
tud_task()andWFI. Iftud_task()is called with data in the buffer, then it will deadlock.
Thanks for the reply, I hardly got into it, I guess it ...
Sure.
I still need to rework my USB Beagle -- an inductor has decided it doesn't like its house on the PCB, and has started trying to separate from the PCB -- but I can test it.
This seems like a discussion for https://github.com/hathach/tinyusb/pull/396 though.
For this issue, I'm confused about what @tannewt means -- with the background_callback work, does that mean I should create a SHOULD_RUN_BACKGROUND_TASKS that includes a call to tud_task_is_queue_empty()? Or does the ad...
@half geyser sorry Iβm not at my computer. The module can be separate from microcontroller and be none of itβs not included in the build
Bedtime now
@slender iron I just got done refactoring it to be under microcontroller π¦
Oh no! Sorry! Will it fit on samd?
Hello π
is METRO M4 EXPRESS AIRLIFT WIFI still a good board to order ?
or there is a newer
Here's the cookiecutter PR: https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/75
There's probably more opportunities for templating the copyright for the generated repository, do let me know if you notice any.
@eternal meteor that board runs the current circuitpython. if your project calls for wifi, it's an excellent choice.
@eternal meteor #help-with-circuitpython is often a better channel for questions and help -- check it out
I put together a messy patch that implements what you requested. Documentation is unclear, but I wanted to make sure you were okay with the API before documenting everything again.
Example usage:
Simple usage:
wdt = microcontroller.watchdog.WatchDogTimer(5.0)
print("Sleeping for 3 seconds (shouldn't exit)")
time.sleep(3)
wdt.feed()
print("Sleeping for 3 seconds (also shouldn't exit)")
time.sleep(3)
print("Sleeping for 3 seconds without feeding WDT (should exit)")
time.sleep...
This looks good! This is a very interesting board.
Please also submit a PR to https://github.com/adafruit/circuitpython-org, to list this board on https://circuitpython.org. https://github.com/adafruit/circuitpython-org/blob/master/README.md describes what to include in the PR.
Thanks @tulip sleet! Looks like the next step is adding to circuitpython.org? I'll check out the README
I've updated the PR to use tud_task_event_ready() instead of running all background tasks. It does this because we don't have a SHOULD_RUN_BACKGROUND_TASKS routine yet.
Note that it keeps the bulk of the previous patches, because it uses common_hal_mcu_disable_interrupts() and common_hal_mcu_enable_interrupts() which don't handle recursion properly when the bluetooth radio is enabled. However, this version of the patch simply checks the tinyusb queue rather than running all backgro...
this now look a bit odd with latest push, I mean we shouldn't call this funciton within critical section at all. In fact, I think we don't ever disable CPSR-I when SD is enabled, and should use their sd_* API instead.
Thanks @xobs it look super clean now :+1: :+1: , @tannewt we should include the check for other background task that uses event queue mechanism like TinyUSB as well in the future. This should be applied to all other ports as well.
@simple pulsar I looked at your forum post about advertising, but I'm not sure what your question is. Note there may be scan responses going on between the advertiser and scanner, if they are set up: scanner asks advertiser for a second packet with more information, and it responds.
I don't know which scanning app you are using, but nRFConnect on Android is very good. Turn it to get landscape mode instead of portrait orientation: you see more info at once that way,
This was added due to tinyusb calling sd_flash_operation_wait_until_done() which calls sd_is_enabled(), which didn't work when interrupts were disabled.
@tulip sleet I want to replicate the kind testing you are doing @simple pulsar , maybe with two CLUEs. However, I am spread thin and reportedly lazy, so I'm not sure when I will do that.
@tannewt ready for another look.
ah, sorry, this is another issue out of my radar.
@slender iron I wish that we could switch to "#pragma once" for our header guards. The #ifdef-guard is standard but error-prone. #pragma is not standard, but it is supported in gcc, clang, and msvc. At $OLD_JOB we eventually concluded that -- aside from slavish adherence to standards -- there was no reason not to switch, and it reduced problems when people copied headers and didn't change the guards. Which ... I was just stumbling over this morning.
(the other reason is NIH, since #pragma once came from windows/dos first)
I didn't know GCC supported itβ¦ π€―
I'm not sure for how long, but at least years -- https://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
Pragmas (The C Preprocessor)
If I had to guess, I'd say we were on GCC6 at the newest when we made the decision to switch
there goes me and spending too much time in a bubbleβ¦
This PR address all issues around entering low power mode with WFI as implemented by other platforms (freeRTOS tickless, zephyrs cpu idle). Should be ready to merge, great work @xobs
In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as include guards, but with...
since 3.4 wow
3.4! who on Earth stopped me from using that for the past 15 years?!
@onyx hinge fine with me
I'll confess, I spent many years on the "But it's not portable (waaaahh)" side of the argument. I was wrong.
Iβm ok with us being gcc and clang only
@ionic elk I've run into something that's got me stuck. The ST HAL has some code for SDIO interfacing to MMC (SD) cards. I'm trying to use it. It's stuck in initialization, because it calls HAL_Delay(2U) but Hal_GetTick() never increases. @slender iron what's the over/under for this being related to lower power?
Sounds like an issue with whatever we have overriding Hal_GetTick, which relies on Systick which I assume is off or altered by low power
Actually no the override should be for Hal_Delay
at st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:390
``` that's not what gdb is seeing
I had one, but maybe it got removed? Anyway it's weak linked so it should be replaced by something low power friendly.
There's a lot of stuff in STM32 land that uses HalDelay so I'm surprised that it hasn't broken other stuff already
I can "return" from HAL_Delay and it gets stuck soon after, but not related to HAL_Delay
at st_driver/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_sdmmc.c:1146
1146 }while(!__SDIO_GET_FLAG(SDIOx, SDIO_FLAG_CMDSENT));
That one I'd have to look at the reference manual for
sort of suspect there's something about clocks that's missing, compared to the code I was being inspired by
You have the clock turned on for the SDIO, right?
no, that may be exactly what's missing
One thing that STM32 does is that in the Init for most functions, they call a function called "MSP Init" which is a weak linked function that typically contains whatever setup stuff exists for your particular board
Just one of many parts of the HAL that want you to have stuff set up for only one devboard
We completely removed the MSPInit stuff, so the function does nothing, but you have to do all the stuff it normally does manually - turn on the clock, set up the GPIOs with the right altfunction, etc
Issue#2894. When adding to a previously allocated tcc channel the tcc_refcount was not being incremented. This led to a deinit of the PWMOut not releasing properly, and so eventually running out of timers.
Check out Busio for some examples - I usually look at SPI, I think of it as my most "standard" module
I was looking but missed the clock call
If you're using CubeMX as a reference, there's some file called HALmsp_init.c or something like that. It has the MSP functions for whatever board you selected in the Cube GUI, and it's a good reference of what various peripherals need set up beforehand
yay now it can return from the constructor, but it doesn't successfully get the capacity (boo)
I tend to break out the clock calls into subfunctions since there's one for every peripheral instance
so you call them with a mask rather than a big if/else or case
@onyx hinge well it's a start
A good step for STM32 is to set up a catch for every HAL function that sees whether it's returning "HAL_OK"
A lot of the most common issues are ones where a HAL function is returning busy or is getting stuck inside the call somewhere at a flag check or something
ST debugging in a nutshell is basically stepping through the HAL functions trying to figure out what it's stumbling on
@tulip sleet @bright aspen I'm not sure if I know what my quesiton is either π Fundamanetally I'm not sure what the radio is up to. I've seen descriptions of advertising which sound like in a few microseconds it sends the same Advertisement over ch 37, 38, 39. My android tablet running the ble scanner shows distinct jumps every 5s which suggests what it receives is via a different channel so that suggest the nRF52840 is actually sending on ch37, then 5 seconds later ch38, etc. Is that the case? Perhaps this is all buried in the nordic docs? I've not yet delved into them.
@tulip sleet @bright aspen My current aim is just to optimise my settings having 2 or more adafruit nrf52840 devices do a 1:N broadbcast to each other. I'm trying to write a connection-less game. It works but the number of packets received for an N-second advertising period is very variable. I am scanning at the same time as advertising, btw. Another question for communication like this is is whether it's worth finding one channel that works well and sticking to it for a period of time / "session". I've seen some mention of a channel_mask for advertising that can be set. This might be a bit advanced for what I'm doing.
oooh it's alive. I read the capacity of this SD card. It's 64GB which is also nuts. I have the HAL_Delay problem still remaining to solve (workaround of typing "return" in debugger is not good) though
@onyx hinge Have you mounted a ~64GB filesystem on a CircuitPython device?
@simple pulsar yes, but only after reformatting it as FAT32. It came from the factory as exFAT.
Adding a reply to https://forums.adafruit.com/viewtopic.php?f=19&t=152188 would inform the people.
hmmm slight addendum to that .. the current adafruit_sdcard code reads it as 29GB capacity
my work in progress code reads it as 64GB capacity
the numbers of blocks returned on each system are different by a high bit: ```>>> hex(57933824)
'0x3740000'
hex(125042688)
'0x7740000'
I can't describe how to format cards as FAT because I use Linux and that's of no use to anyone who wouldn't figure it out on their own
"run mkfs.vfat with appropriate arguments (don't delete your whole computer)"
For instance, the following makes the audio output be 1V p-p at the output pins:
import samd
samd.reference_voltage_set(samd.ReferenceVoltage.V1_0)
samd.dac_reference_set(samd.DacReference.INTREF)
audio = AudioOut(...)
If this functionality is desired, I can continue to work on this PR.
This PR also includes the start of a (not properly divided out) API for enumerated types in Python that could reduce code size. A "cp_enum_obj_t" with convenience routines for finding a P...
@onyx hinge I think they are both sort of right. It sounds like the card is 64GB, but the maximum size of a FAT32 file sustem is 32 GB.
both lines "should be" the card capacity, neither is about the formatted filesystem capacity
I'm not sure about the maximum size of FAT32, linux shows a filesystem capacity well above 64GB. ```/dev/sdg1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors/cluster 64, reserved sectors 64, Media descriptor 0xf8, sectors/track 32, heads 64, hidden sectors 32768, sectors 125009920 (volumes > 32 MB), FAT (32 bit), sectors/FAT 15296, reserved 0x1, serial number 0xb4bd503c, unlabeled
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdg1 62489632 89600 62400032 1% /media/jepler/B4BD-503C
Yes, but ... On Windows, the maximum size of FAT32 is 32 GB. Buyer beware.
I don't use Windows so I can't verify that.
Who are you or Adafruit's customers going to believe? Bill Gates or Linus Torvalds?
π
@MiracleToast We don't have any plans to change the default setting. You can recompile CircuitPython to change CIRCUITPY_DISPLAY_LIMIT to whatever you need. What board are you using?
@simple pulsar you might simply have multiple devices that are intermittently transmitting in channels 37/38/39 and swamping them. 37/38/39 are not adjacent in frequency. Remember the 2.4GHz band is also used by WiFi and other things, and the channels for the different modes overlap. The Wifi channels are much wider (20MHz, spaced at overlapping 5 MHz intervals) than than the 1 MHz Bluetooth channels. Bluetooth hops around to avoid interference from other devices.
if there is a lot of local wifi usage, nad you can get the wifi usage locally to use 5 GHz, then you might see differences
+1 to unifying enums internally.
-1 to reference_voltage_set method names. Instead, make an object to represent the DAC and statically create an instance so you can do samd.dac.reference_voltage = 1.0. I'd use floats for the voltage value for consistency. If the provided value is unsupported you could either raise an exception or pick the closest value below it and expect it to be read back. (We use this approach for bus frequency.)
Thanks for looking into this @DavePutz ! Could further explain the cause of this? If we didn't increment enough, I'd expect it to release too early but not cause us to run out of timers. Thanks!
Looks good to me too! Thanks @xobs and @hathach.
-1 to
reference_voltage_setmethod names. Instead, make an object to represent the DAC and statically create an instance so you can dosamd.dac.reference_voltage = 1.0. I'd use floats for the voltage value for consistency. If the provided value is unsupported you could either raise an exception or pick the closest value below it and expect it to be read back. (We use this approach for bus frequency.)
Many of the reference voltage values cannot be represented exactly in floating point...
@tulip sleet I'm lacking some of the gizmos to look at this all directly. Is there any plans to expose the channel_mask feature for advertisement in CP? I'd imagine it's a bit niche and for most cases isn't a good ida.
Integer millivolts if necessary, but I think enums are more self-documenting because a user doesn't have to do anything else except tab-complete in the repl to find out the valid values.
someone building a covid tracker was interested in that, but there aren't a lot of use cases
afk for lunch and maybe for the day
@simple pulsar it would not be hard to add the channel mask, but i'm not sure how available it is on other underlying BLE implementations
A suggestion for the xor but good otherwise. Generally I find the implicit bool logic in C to be confusing because it's the inverse of bash (I think.) I much prefer always using == or != to produce a boolean value.
I think the implicit bool conversion makes it more confusing and a comment would help. I'd suggest:
// We are transmitting one direction if one pin is NULL and the other isn't.
bool is_onedirection = (rx != NULL) != (tx != NULL);
@slender iron for the esp32S2 USB breakout - it looks like D+ is GPIO20, D- is GPIO19, then GND and do you connect 5V or leave it off since the microUSB provides 5V already or is it OK for both to be present?
ok - thanks
@lucid solar did you push your saola breakout design yet?
Yes, but ... On Windows, the maximum size of FAT32 is 32 GB. Buyer beware.
@lunar crown that's just what you can format. Windows read bigger FAT32 just fine. Indeed most devices can take 64GB FAT32 SDXC cards despite only supporting SDHC.
Though I think more modern SDXC dropped SDHC compatibility (which might be what Jeff is experiencing)
Have you thought about adding this to analogio to make it platform-neutral rather than samd?
Huh, interesting. Is it needed for C++? Maybe we should leave it because we should add C++ library support at some point.
I was thinking it'd be like nvm where it is None when CIRCUITPY_WATCHDOG = 0.
@slender iron are you sure about white on 19? just checking since the breakout cable labels that as D+ but the board shows it as D-
We're using the Feather M4. I'll look at doing the recompile -- will that work w/ the latest cp v5.3. I noticed some folks were using two displays per bus -- do you know if we could have 4 displays on the primary SPI bus?
hmm -- I'm confused -- as usual
This shouldn't be built-in. It can be a member of the watchdog module.
I think you have one extra type here. This should be the watchdogtimer itself.
it looks like white is normally D- so that makes sense -- just the product description https://www.adafruit.com/product/4448 appears to have it reversed. I Posted a question to the forum...
Hi Scott,
The issue is that in common_hal_pulseio_pwmout_deinit() we have:
...
tcc_refcount[t->index]--;
tcc_channels[t->index] &= ~(1 << tcc_channel(t));
if (tcc_refcount[t->index] == 0) {
...
What I saw in a debugger was that refcount was going to 255; i.e. being
decremented
even though it was already at 0 (due to not being incremented properly).
Since it was
not then == 0, the code in the if statement would not be run, and the timer
not properly
released. Hope th...
I put together a messy patch that implements what you requested. Documentation is unclear, but I wanted to make sure you were okay with the API before documenting everything again.
Totally ok. Feel free to ping me on Discord when you get to your computer in the morning and we can video chat to sync up.
Example usage:
Simple usage:
I'd do:
# By default the watchdog has infinite timeout and raises an exception on timeout.
wdt = microcontroller.watchdog
# N...
@slender iron I didn't realise it was a public holiday today...ended up going out. Just back to the computer now. Am fixing something on the board, but will push in the next hour or so.
great! sorry to disturb your holiday. I was just excited for it
π I guess you'll order from OSH Park rather than waiting for me to send one when I order them from China. There are a few parts to solder...I'll give you a digi-key list.
ya, totally. I might tweak the design too to fit parts I have
I did Mini-USB-B as that's what I had...but have changed it to USB-C now.
I'm rerouting some of it...but this is basically it. Most of the things are optional...just wanted to make it flexible.
I'll probably use micro because it's easier to solder
I'll probably do my own because I want a feather header and to have it only as large as the saola. osh park has trained me to keep it small
time for a run now π
Aha...ok...I wanted something that can lay flat and be easy to plug in things.
ya makes sense π
@gilded cradle Why do I not see a lot of pin.py files in Adafruit_Blinka/src/microcontroller??
@simple pulsar I suspect you might be seeing a beating of the scan interval against the broadcast interval. Try tweaking some interval and duration numbers. (I'm still negotiating with alligators elsewhere.)
@slender iron should I update the cookiecutter code of conduct file from the code of conduct repository? they seem to be slightly different revisions right now
ah even a bit more complicated β the two copies in cookiecutter are different even π
I assume realigning them is a positive outcome so let me do that π
We can have more than one device on an SPI bus. Why are SPI displays treated differently? Why should SPI displays be treated differently?
@timber mango because they live under Adafruit_Blinka/src/adafruit_blinka/microcontroller.
That is where I am looking, and there are no other boards in there.
That's where the chips are: https://github.com/adafruit/Adafruit_Blinka/tree/master/src/adafruit_blinka/microcontroller
If you're looking in https://github.com/adafruit/Adafruit_Blinka/tree/master/src/microcontroller, that's the wrong folder
I forked Adafruit_Blinka and then cloned my fork. No, I am looking in Adafruit_Blink/src/microcontroller.
Ok, that's the wrong folder. That's where Micropython loads stuff from.
Ok, go up one folder from there and then into adafruit_blinka (all lower case) and then into the microcontroller folder under there.
It's kind of confusing, but once you realize there's 2 microcontroller folders it's a little easier.
