#circuitpython-dev
1 messages Β· Page 311 of 1
ooh I got something to appear on the SDIO "CMD" pin on samd51
@idle owl yup! maybe add "in both human and machine readable forms"
Will do, thanks
@ionic elk ah, I think it's in the arm architecture docs
(I'm renaming master to main at the moment)
@slender iron if you're referring to this: https://developer.arm.com/docs/ddi0489/d I haven't found it to be very informative. But I guess I'll just do trial and error.
I think so but the PDF is easier to read for me
the PDF download is identical, as far as I can tell looking at it
ya, I'd expect it to be
Had one github action to update: #3024
Yay! -my "fast" blink works now -- thank you @DavePutz
<@&356864093652516868> Heads up, the master branch is now available as main and all PRs have been updated
Anyone know if the new STM32F405 board supports nvm? It's not in the product support matrix which is the only place I know where to look to find out, lol
@slender iron what should we do with our forks and our local copies?
@tulip sleet you can git fetch main, git checkout main and then git branch -D master.
@charred flare it does not appear to be implmented...yet --- ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.4.0-beta.0-450-ge8d8004da-dirty on 2020-06-02; Feather STM32F405 Express with STM32F405RG
import microcontroller
dir(microcontroller)
['class', 'name', 'Pin', 'Processor', 'RunMode', 'cpu', 'delay_us', 'disable_interrupts', 'enable_interrupts', 'nvm', 'on_next_reset', 'pin', 'reset']
len(microcontroller.nvm)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: object of type 'NoneType' has no len()
microcontroller.nvm[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not subscriptable
This is not hard to do in CSS, something like:
.warning {
position: fixed; /* Set to fixed position */
top: 0; /* Position at the top of the page */
}
Aww, thanks @solar whale
@ivory yew but I need to set the default branch in my fork, etc., too, I would hitnk
ah for the fork you'll just need to git fetch upstream main, then git push fork main, then you can edit the setting in github.
replace upstream and fork with whatever you named your remotes
Thanks, and the Hanselman blog entry @slender iron mentioned helps too: https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx
I'm having the HARDEST time finding a board/wings/etc that do what I want and do them well, lol.
Started with M0 proto (cause I had it) and bought a bluefruit LE, couldn't get it working for some reason and ran out of memory for CP, iirc
So I got a 32U4 Bluefruit and @tulip sleet helped me with some bluetooth stuff but ultimately I decided to scrap BT and go with wifi for updates.
So I bought a ESP32 Airlift and got that connected but it wouldn't reliably connect to my normal Wi-Fi but I got it working most of the time with an old router.
So I bought a RaspPi Zero Wi-Fi with the intent of using it with a fadecandy board but the abandoned that Idea.
So I bought a ESP32 Huzzah that had everything and got it running MP (since no CP) easily enough and found a great Wi-Fi manager (https://github.com/tayfunulu/WiFiManager) that's worked flawlessly. But turns out MP on the ESP32 can't drive neopixels without random flickering, yet.
So... now I'm out looking again, lol.
@tulip sleet I don't use my fork's default branch at all
don't you update it from time to time git checkout main; git fetch adafruit; git merge adafruit/main
@charred flare what are you trying to do
no, I just always start from adafruit/main
i try to keep my main in sync, and then i branch from it
just curious if there has been thought given to migrating "all" the Adafruit repos to "main" ... yikes...
@solar whale I mention it on the issue
sorry -- will read it now
np, all I did was mention it
Oh, just make neopixel animations and talk via the internet. I have a working prototype with the 32U4 and airlift - it's just got that annoying wifi issue (I forget what exactly the problem is). I was also hoping to play with threading in MP to have it check online while keeping the animations going instead of having to pause.
@charred flare The thing that sounds like it's worth fixing is "ESP32 Airlift and got that connected but it wouldn't reliably connect to my normal Wi-Fi"
we would like to know if you have some idea of what the issue was
Right, I'm using it now. I don't recall why it was cranky with my normal AP. It works - mostly. But I'd like it to work always and on my normal wi-fi network. The same ESP32 chip running MP and that wifi manager worked great.
we all talked about it here a while ago. rssi was fine, etc. shrug
Does this https://github.com/tayfunulu/WiFiManager look like anything close to being usable in CP and the Airlift?
Out of curiosity
I think working always will be really tough
fixing sporadic issues is challenging
Ok, 5.4.0 Beta 1 is fully released and blogged
lol well I guess I meant working on my normal AP as well as it works on the others.
wifi manager expects to store data locally. In CIrcuitPython, you'd have to store it on the SD card unless you remount CIRCUITPY to r/w. In MicroPython there is nothing to prevent both MPy and the host computer from writing to the filesystem simultaneously (and causing corruption). So we disallow that.
what is your AP brand and model?
you could file an issue against the ESP32SPI library with details of the router and the errors you're seeing. We might not be able to debug it right away, but other people might chime in if they're having similar troubles.
Yeah I read about the r/w stuff. Interesting, you can write to SD though in "normal" mode in CP? Shame I don't have a SD card slot! lol
Uh... Netgear WAC104. It's working on a Netgear N600 though.
Let me see what I can do about that. π
@charred flare Have you updated the firmware version on your ESP32 AirLift board? (not your CircuitPython board)
Hmm... I don't believe I have. That could be an idea.
@charred flare The ESP32 runs its own firmware (nina-firmware) which handles the wifi "stack". It communicates over SPI with the CircuitPython board.
We have a guide on updating nina-fw over here: https://learn.adafruit.com/upgrading-esp32-firmware
yeah I supposeit could be older firmware - who knows when this board was flashed
thanks! I'll see
Adafruit ships with an older version of nina-fw, as far as I know. The latest nina-fw version is built on ESP-IDF v3.3x (LTS).
Hmm. Wonder what's on the ESP32 Huzzah. worth a try though!
P.S. it's working fine on my normal AP at the moment π€£
before it would only connect about 1 in 10 tries and now it's connected 100% of tries
literally just changed the ssid in secrets.py
Ok, I've had less connection attempt issues when updating the nina-fw version.
ah! it just did ti
'failed to connect' 'no such ssid'
I'll go try the update and see if that fixes it
also you might check about any firmware updates for the AP itself
I concur with @prime flower - the number of failures is reduced with the updated NINA FW. Still good to catch the exception and retry.
they do still happen, but much less frequently
@charred flare NVM on the STM32 is on my todo list but hasn't been high priority so far. It's a little complicated by the STM32 flash system, which makes it more complicated to implement then on the other ports.
@gilded cradle @idle owl hmm I wonder why this library is not enable for blinka (setup.py.disabled)
Now that's an idea @tulip sleet
@ionic elk well if you can write to the SD card in "normal" mode I can just do that. I just need to save variables and preferences between reboots
@onyx hinge which library?
It's actually technically in already, but it takes currently requires entire flash sector (16kb minimum) which is kind of ridiculous for most boards, so it isn't defined on most of them.
@gilded cradle https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/blob/master/adafruit_debouncer.py
yeah telling you which one would be helpful wouldn't it
How's touchIO coming on that board? That's the only other missing feature I need
hopefully Jeff will get SDIO working cleanly on STM32 soon
I'm not sure @onyx hinge. Maybe due to https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/blob/master/adafruit_debouncer.py#L59 ?
Oh right, I remember reading that now
@gilded cradle getting rid of const() would be a small price to pay
@onyx hinge I think putting it in a try/except block can get around that. I'd imagine there's probably a CPython equivalent for const.
there's really not
well, I don't know of one
gently backtracks from acting omnicient
Ah, then yeah. Makes sense to just remove the const. Perhaps a little refactoring is in order
anyway, it's not vexing me, but I just noticed it
At the moment, I'm testing displayio drivers and converting them release on PyPI .
π
@tulip sleet do you know if the read and write methods of uart should be async?
meaning write returns before everything is transmitted
i'll look
it's a bit weird because we use stream to provide the apis
the common-hal routines busy-wait until the write is completed
io_write() is non-blocking, but then we loop until the write is completed
what port are you looking at?
atmel
same thing in nrf; they both call RUN_BACKGROUND_TASKS while waiting
in common_hal_busio_uart_write()
kk
we could reconsider that, in the long run, since it could be pretty slow
happy to match other impls at this point
I actually tried that in developer mode (with position: sticky). Didn't work for me (yet). Also, there is no unique ID for that box; just using admonition or warning would apply to any of them in the documentation. Which, we have some scattered throughout.
That box is inserted by RTD's rendering, so without a good way to CSS it, there's not much to do. I peeked in the RTD docs, and it's barely mentioned that this happens, and there is nothing really beyond that. https://docs.readthed...
This PR adds some additional flexibility to the MPU setup code in port.c, enabling the F7 series of STM32 microcontrollers to use the ITCM and DTCM sections of tightly-coupled memory. Also moves F7 stack to DTCM memory.
Should result in a speedup across all F7 dev boards. Tested on F767 Nucleo, and H743 Nucleo for regression.
@k0d, want to give this a spin on your F746?
Resolves #2782
I'm not sure I fully understand how Sphinx and Read the Docs work together to create the docs pages (or if there are other components at work). So perhaps I am overlooking something. It looks like there is support for custom js code: https://docs.readthedocs.io/en/stable/guides/adding-custom-css.html
It would be ideal if that warning already had a unique id or class to target with a CSS rule. But since it doesn't maybe it's possible to use custom JS code to find the version warning box bas...
I have some displayio code that's competing with some audio that's playing from a wav file using WaveFile class and the audio is suffering on 5.3.0 on a Circuit Playground Bluefruit with TFT Gizmo (i.e. PWM audio). Was there a recent improvement/tweak to the buffering for audio? There is something going on with https://github.com/adafruit/circuitpython/pull/2879 but I've not looked inside that yet.
I actually just found out why setting the position in CSS isn't working. RTD's theme sets overflow-x: hidden on the entire HTML body, which breaks the usage of position.
Disabling overflow-x allows it to sticky, but there are some side-effects (more than I'm aware of, I'm sure).
I can at least select the only box we're worried about with the proper CSS selector:
.document > .admonition {
position: sticky;
top: 0px;
}
One side-effect I'm seeing is some ...
@lone axle @tulip sleet @slender iron this is what I'm seeing with the CSS mentioned in #3022.
I have no idea. CSS boggles my mind
yeah...same. i learned a few months ago that it is Turing complete. like...wha?
That looks pretty good to me except the blue class boxes going over it. I wonder if there some z ordering that can help it. Definitely same here though on CSS boggling the mind π
I'm gonna go for a walk here in a minute but maybe I'll try to poke around some with the chrome inspector when I get back to see if I can get those blue boxes going behind
The grey boxes for properties seem to be affected as well:
its related to the display: table setting. messing with that will likely destroy the page. like, explosions.. π₯ π
lol π
(I never knew about position:sticky before this is a neat trick to trow in the bag)
hey @prime flower you still around?
@lone axle z-index: 2 seems to work for the box. good thinking!
@charred flare Sorry about that. The bot tagged your post. We've had a massive uptick in spammers so we've enabled a lot of automated moderation things to try to help.
was it the #'s?
I'm thinking probably, based on what of your message I could see
@lone axle thoughts?
@charred flare But I'm not certain what part of it triggered the bot.
was told it was the excessive #'s lol - it's all good
This invocation produces fairly good results for me on Chrome:
.document > .admonition {
position: sticky;
top: 0px;
background-color: salmon;
z-index: 2;
}
body {
overflow-x: unset!important;
}
4.x and earlier don't seem to call the docs/static/customstyle.css on RTD, so that will need to be fixed for it to be applied I think.

@raven canopy @trim elm any word on the adabot arduino lib count mismatch?
@pastel panther its...unexplainable. at least, for me at this point.
fair enough!
i think i've ruled out authentication differences, though it did highlight that there are problems there (filed an issue already).
ah, that was going to be my guess. I know I've had mysterious adabot adjacent issues due to cached/default creds
and to note, adabot's nightly run shows the same non-ladyada results that we get.
the confusing part for me is that ladyada gets valid results. if they were garbage, i think this would be easier to narrow down. π
I feel like it's got to be credentials, right? Like, we tried using her token and still got different results
the only differences i can think to explore are run environments (OS, python, etc) and repo settings.
so either:
- we weren't using it correctly
- she wasn't actually using it
- they're sending diff results for the same credentials based on...?????
yeah, the different results with the same creds is what has me π€―
I'm going to go ahead and declare that the creds are different
like, I want to see the actual bytes going across the network before I believe differently
I'll settle for raw TCP, I suppose
could be. maybe verify with her how the ADABOT_... env vars are set on her system?
I'll ask in a bit
but that would also make me lean further into the repo settings, since different creds would yield different results.
@onyx hinge No, I did not see that (I have been looking for an appropriate mailing list to get notified of these updates). I see they did bump from gcc 9.2.1 to 9.3.1. I looked over the buglist briefly of fixes and didn't see anything that looks like we could use it. We could wait for 5.4.0 final and then switch.
since there's a range of factors in GH settings that could affect how different creds change results, I think it would be wise to settle on verifying same creds before going further
unrelated: why didn't i use pytest to start with? π€¦
(.venv) ~/Dev/rosie_pi/RosiePi:$> rosiepi itsybitsy_m4_express 1234
=============================================== test session starts ================================================
platform linux -- Python 3.7.4, pytest-5.4.3, py-1.8.1, pluggy-0.13.1
rootdir: /home/sommersoft/Dev/circuitpython
collected 1 item
../../circuitpython/tests/circuitpython/rosie_tests/test_digitalio.py b"['__class__', '__name__', 'INPUT', 'OUTPUT']\r\n"
. [100%]
================================================ 1 passed in 0.10s =================================================
========================= RosiePi ==========================
Initiating rosiepi...
------------------------------------------------------------
- Date/Time: 10-Jun-2020,10:04:31
- Test commit: 1234
- Test board: itsybitsy_m4_express
============================================================
Connecting to: itsybitsy_m4_express
------------------------------------------------------------
Connected!
Board info:
- Serial Number: 44B26E5A3335833502020253035450FF
- Disk Drive: /media/pci-0000:00:14.0-usb-0:3:1.2-scsi-0:0:0:0-part1
sorry. wall-o-text...
Ok, recap, is there a guide or list of instructions or something on what to do with this whole main business?
So far it seems like :
git fetch upstream
git checkout main
git branch -D master
and then something about the default branch settings?
This is somewhat complicated by the fact that the ST documentation's description of how to calculate this value is "use CUBE MX".
@ionic elk what are you trying to do?
I recommend doing git checkout upstream/main if you want to be on upstream's main branch
@ionic elk I found https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx to be quite helpful
It looks like SCLL and SCLH are just counts for clock cycles in the low and high states. My guess is that they delegate to CubeMX because they assume folks don't understand the source clock value.

Yeah I've been working through the math with that very table.
What's with the ratios of this table? For 100k SCLL is 1.3x SCLH, but for 400k it's 3 times. Is that just part of the I2C spec?
The cube calculations are definitely kind of weird, too. They're in the right ballpark of what you'd expect for frequency, but only just - they seem weirdly imprecise for values that have 8 bits of precision.
@tulip sleet If I want to add a library to the frozen directory - how do I do that so it becomes a submodule?
you add it like any other submodule to the frozen dir, and then add it to mpconfigboard.mk for the particular board
cd circuitpython/frozen; git submodule add ...
ah -- looks simple enough -- thanks
@slender iron Just took a look at how stm32duino handles I2C timing calculations and holy shamoly they've got like 500 lines of code dedicated to it. So, question for you, would you rather we:
a) skip this, add a parameter in mpconfigboard.h for I2CTIMING and tell H7 and F7 board creators to use CubeMX the way the docs do
b) copy in the stm32duino stuff as best as possible with attribution
c) recreate it from scratch (might take a while)
I'm leaning toward a) for now this seems kind of ridiculous for 4 boards. Or even 10 boards.
Reminds me of the time I wanted to replace a lookup table with Boolean expressions "to save gates". It may have done so, but it sure isn't a model of clarity!
Yeah I really hate directing people to "JuSt UsE CuBemX loL" but at a certain point I just wonder if it's worth the testing pain. Even if I implement this I'm not sure I'd be able to fix it if something went wrong.
Or rather, I could, but it'd waste time I could be spending on new modules
I am trying to add support for Set_Report to allow for getting the current values of capslock. numloc, etc but it seems like https://github.com/adafruit/circuitpython/blob/main/shared-module/usb_hid/Device.c#L86 this callback isnt being run
i successfully added a propert report to Device but it isnt updating to the value
void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) {
usb_hid_device_obj_t* hid_device = get_hid_device(report_id);
if ( report_type == HID_REPORT_TYPE_OUTPUT ) {
// Check if it is Keyboard device
if (hid_device->usage_page == HID_USAGE_PAGE_DESKTOP &&
hid_device->usage == HID_USAGE_DESKTOP_KEYBOARD) {
if (bufsize) {
hid_device->report = buffer[0];
}
}
}
}``` this is my version of the function
but even c void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) { usb_hid_device_obj_t* hid_device = get_hid_device(report_id); hid_device->report++; } doesnt do anything which leads me to believe it isnt being called at all
if anyone has any ideas why that callback isnt being called please ping me
Currently, most F7 and H7 boards have a static and incorrect value for their I2C frequency. This PR adds new I2C timing definitions to the board profiles of all H7 and F7 MCUs, ensuring they all meet the 400k standard for Circuitpython. These values should be obtained by board authors from the CubeMX program, which has a utility to best-fit this value based on the MCU type, clock speeds, and desired I2C frequency (standard or fast mode).
While these macros are a bit of a copout from calcul...
@left mirage this was worked on in the past but there were still some things to fix up, which you may have encountered too: https://github.com/adafruit/circuitpython/pull/2366
i actually hadnt seen that pull request but i was looking at https://github.com/adafruit/circuitpython/pull/2366/commits/ad6cee833d5b2b7d924614fddeee7c760aacb455
i did notice the tinyUSB report_type error
but i was still unable to test even that because it seems that now the callback is not being called by tinyUSB at all
I don't remember if the issue was in TinyUSB or some setup issue in CircuitPython. This whole thing is on our to-do list, but we haven't looked at it in a while. Thanks for taking a look, and open an issue in TinyUSB if you think there's an issue there.
im gonna take a look at the tinyUSB code and see if something changed for those call backs
@timber mango maybe of interest to you ^^
Please don't include other changes just to avoid merge conflicts later. It makes the review tougher.
Reuse error messages if you can so they are standard across ports and don't require additional translation.
mp_raise_ValueError(translate("Unsupported baudrate"));
I actually saw this one and skipped it because I didn't feel "baudrate" is a common description of I2C frequency, but I can swap it in if you think it's sufficiently clear.
Ya, I agree it isn't ideal. Maybe look at the other ports and see what they return? If you do add a new string you could improve the other ports too.
It's calculated based on the bus frequency, which varies based on clock configuration. That said, it'd probably be better to have these as family-wide defaults in mpconfigport.h, which can simply be overwritten at the board level.
@left mirage that pull request worked back when I tried it, but only on samd21 and not on samd51, so I suspect there is some missing machinery in tinyusb itself
Looks like NRF and i.MX don't actually pull errors at all for nonstandard frequencies (neither does STM32 for the F4). Atmel and cxd56 currently use "unsupported baudrate" - Atmel is doing something more complicated I think, but cxd is basically the same as this. Want me to match them or change all to a new string?
Either is fine with me. Up to you.
@stuck elbow i'm using a trinket m0 so thats the samd21 but that pull request failed now so im thinking maybe some commit on tinyUSB broke circuit python's callback
@tulip sleet in regards to the bus-device timeout PR, while it cannot fix the I2C hang I've found it useful for detecting when the device is hanging and have it reset itself. do you think it would be better to close the pr or leave it open? I defer to your judgement
@marble hornet I 'd rather fix the underlying problem in the long run, so we don't have to add a new workaround API. What we hope to do is to detect the stuck bus and then unstick it (if you toggle the clock line 8 or 9 times that usually works). But if it's working for you now, of course, keep the code for yourself until we get a chance to fix it. Which board are you using?
The hiibot bluefi have added to CircuitPython since 5.4.0 Beta 0. Please show the hiibot bluefi board.
https://github.com/adafruit/circuitpython/releases.
@tulip sleet Iβm using my custom watch board. It is (very!) electrically similar to the nrf52840 feather express. I get about 0 to 1 spi and i2c hangs per day. I also notice it happens more when editing code on the device
Do you think it is a Nordic silicon problem or a low level software one?
@slender iron Hey! I just published version 0.7.1 of the Atom CircuitPython package, and subsequent to our chat last time, started a blog! https://josephbanks.me/atom-circuitpython-v0-7-1?utm_source=discord&utm_medium=adafruit
@tannewt let me know if this looks good to you now that @k0d has taken a look
I am planning to update my memory-sipping textMap class to add vertical text scrolling capability. I would appreciate any suggestions yβall have to consider incorporating on text scrolling usage. @lone axle and @onyx hinge especially since you two have seen the evolution of this. https://github.com/kmatch98/CircuitPython_textMap/issues/11
@mental nexus Sweet! I actually just found myself wondering about whether that supported scrolling the other day. I want to make a PyPortal script that will fetch a readme.md from github and then render it using your markdown tool. I think my only really suggestion is try to keep the interface generic enough that it can be adapted for use with a touch screen as well as D-Pad up/down buttons.
If the developer can do something like text_box.y_scroll += 1 or text_box.y_scroll -= 1 I think it could cover both scenarios.
Rotaray encoder scrolling sounds fun too, albeit perhaps a bit awkward
Thanks for the suggestions. Let me think on it a little more and give you a proposal on the class functions to see if it will fit your needs.
@marble hornet if you have the timeout code running on your board, and you get a timeout, can you retry and get the peripheral or do you lose the peripheral until reset or power cycle? The I2C fix I was refererring to is to catch devices that are completely stuck and try to reset them.
I've been getting into sample playback on the CPB and it's reminded me of just how noisy the PWM vs PAM8301 combination is. I've found another forum post with essentially same observations. Was this combination used for testing during the development of PWMAudioOut? https://forums.adafruit.com/viewtopic.php?f=60&t=166318
I'm trying to find ways to improve the memory usage of the rfm9x library and I ran across this ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.4.0-beta.0-300-g37a7cf993 on 2020-05-24; Adafruit Feather M0 RFM9x with samd21g18
import gc
gc.mem_free()
21808
import adafruit_rfm9x
gc.mem_free()
6448
gc.collect()
gc.mem_free()
12112
Fantastic @idle owl! Thank you π
Reverts adafruit/circuitpython-org#483
@BradChan
@solar whale interesting! I'd be curious to see the memory changes done. It could be something about the state of the stack because the mark process is imprecise
@mental nexus I'd love to support native display scrolling but it's usually aligned horizontally rather than vertically
@slender iron the big problem is that on the M0 boards -- there is not enough memory for the initial load -- i suppose I could import then force gc. - do you have any suggestions about where to look to try to minimize that?
imports should forces a gc after
but maybe a stack value hasn't been cleaned up at that point
@slender iron I tried scrolling some text and itβs less than satisfying. For now may have to fall back to page redrawing instead of scrolling. Understood that builtin scrolling may be necessary to achieve smoother behavior. FYI this is a 240x320 external display connected via SPI.
I see that PyPortal has DMA. Too bad I canβt pry mine away from my daughter. π
ya, scrolling without display help is tough because you have to re-send every pixel again
Got it. Will come up with another way for now.
hierophect asked in the discord about a way to hide the notification if it is made sticky. I agree that we should try provide a way to do that if possible.
Here is a bit of Javascript that will hide the notification when it gets clicked on:
$(".document > .admonition").click(function(){$(this).hide()});
I tested in with the browser console on the live docs page and it seems to be working.
Clicking on the latest version link does fire this listener and hide the bo...
Just FYI, I recently set my touchpad to turn off when I have a mouse plugged in. I just plugged my CPX in, and my touchpad stopped working.
Apparently the CPX is detected as a mouse.
The PyPortal scrolling is a lot better, but a little bit of stutter. Since the PyPortal uses DMA it has a big impact on redraw speed of bitmaps.
Heya @ruby smelt, I got word that you were having an issue with your Feather Sense where you had to set a data rate to get accelerometer and gyro measurements. I wasn't able to reproduce the issue running the same demo on my feather sense, however we recently released an update to the Adafruit_CircuitPython_LSM6DS library that runs the gyro and accelerometer to address an issue that some CLUE's were having, so that may have fixed the issue you saw.
Please download the latest bundle for your version of CircuitPyhon here: https://circuitpython.org/libraries and copy over the updated adafruit_lsm6ds.mpy into your feather's CIRCUITPY/lib folder and try again.
@ me here to let me know how it goes, or leave a comment in this issue https://github.com/adafruit/Adafruit_CircuitPython_LSM6DS/issues/18
Thanks! Sorry for the hassle
Discord user "Pamz" reported on #circuitpython: Hi, I am testing Bluefruit feather sense I received couple days ago using this demo code: https://learn.adafruit.com/adafruit-feath...
Instead of pre-made bundles, suppose we had a web service on circuitpython.org that would bundle up a set of named libraries into a .zip file. The URL would specify the list of libraries. We could then use such URL's in Leanr Guides to download exactly what was needed for a particular project (or board). The guide author could easily construct the URL's to include what was desired.
Conceptually, something like (not real URL's):
https://circuitpython.org/library-zip?zip=lsm6ds,lis3mdl,ap...
I think I discussed that need "in the weed" a few month ago where I suggested bundle easy for CLUE or other board full of sensor. There was a consensus that there was something nice to have, but maybe no followup.
That could be used in learn guide too, where my pain is to gather all the needed file from the latest bundle. And also because there are folder and files into the root and my operating system sort separatly folder (on top) and file (at the bottom). So practicaly, every lib I need...
This one is odd and potentionally along the same lines. I did a very minor tidy and copied the code across to a CLUE's CIRCUITPY and it blew up with a MemoryError:
NO collect mem_free 17072
Traceback (most recent call last):
File "code.py", line 962, in <module>
MemoryError: memory allocation failed, allocating 2048 bytes
Code done running. Waiting for reload.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the ...
@prime flower keep a closer eye on this thread: https://forums.adafruit.com/viewtopic.php?f=60&t=166139
if the learn guide no longer works then we need to fix it
Is it possible to get the bus frequency in the code and switch between the known values? I don't think this should be something a board has to worry about.
@slender iron that was why I have been looking at the memory usage of the rfm9x lib.
@dhalbert Sounds good to me.
@slender iron right now the only board that has to define the I2C definitions is the F746 discovery, since it has overwritten clock values. I don't think that's excessive since getting clock values from CubeMX is pretty standard anyway. Finding timing best-fit from clock frequency values is about 500 lines of code for stm32duino which is why I felt it was overkill for only one non-adafruit board, but I can spend some time next week working on it if you'd prefer.
The main issue with building bundles on the fly is that we use Jekyll, which builds a static website ahead of time when any changes are added to the repository. This would be trivial in something like PHP, but in order to use it with our current setup, we would need to have pre-defined bundles or use some external service.
The main issue with building bundles on the fly is that we use Jekyll, which builds a static website ahead of time when any changes are added to the repository. This would be trivial in something like PHP, but in order to use it with our current setup, we would need to have pre-defined bundles or use some external service.
In essence, @dhalbert is suggesting a dumb and minimal server that does nothing, but collects a handful of files from pre-defined locations (these .mpy files are on gi...
@tulip sleet I thought maybe using an Atmel START project on grand central would be a feasible way to verify the SDIO functionality with "known good" code. However, I am extremely tripped up by clock generation in START and so I can't get past initialization. Do you have any advice? Is this not such a great way to approach the problem?
@onyx hinge it is basically terrible. I was not able to get a clock generation setup that corresponded to ours without showing errors.
i'm not so much bent on it necessarily matching cpy, but something that works on the HW would be nice
You might look in their forums, e.g. this search (https://community.atmel.com/search/site/atmel start samd51 clock setup), e.g. https://community.atmel.com/forum/samd51-trouble-sdhc-using-internal-clocks?skey=atmel start samd51 clock setup
there might be some more general help there with a sample setup as well. Also there are example projects in atmel start you could start with
right now my problem is not even getting through the clock tree initialization in my START project so that's ... at least 2 questions down the road
There is another tool that comes from the MicroChip side of the company, which I haven't looked at: https://www.microchip.com/mplab/mplab-harmony
Accelerate your embedded software development with MPLAB Harmonyβs easy to use drivers and middleware.
In essence, @dhalbert is suggesting a dumb and minimal server that does nothing, but collects a handful of files from pre-defined locations (these .mpy files are on github, aren't they), and serves the zipped file to the user. You don't need external services for that. In fact, you could take something like flask, and then with 20 lines of python code you are done.
I understand that. The website is static, so it doesn't run on Python and can't even run flask. Being able to specify in a U...
@onyx hinge https://start.atmel.com/#examples/sdio includes a SAME54 example which is basically a fancier SAMD51. It would include a clock configuration in the example.
I understand that. The website is static, so it doesn't run on Python and can't even run flask. Being able to specify in a URL and have it return the files in a zip without knowing which files ahead of time is a dynamic function and easy to do with server-side scripting languages. We do have JavaScript available, which is how most of the magic happens already, so it might work if we can leverage that.
So you want to do this on client-side?
I was assuming we might need to get the webdev folks like @jwcooper involved to host the dynamic part elsewhere in our web infrastructure. It doesn't necessarily have to run under GitHub pages, though perhaps it's possible to do with JavaScript fetching the components of the zip and then pasting it together.
Ah, ok. Yes, if we had the dynamic service running elsewhere, that would work too. There's a library called JSZip that could assemble it though with JavaScript.
I was assuming we might need to get the webdev folks like @jwcooper involved to host the dynamic part elsewhere in our web infrastructure.
From Melissa's comments I gather that, although the web site is static, it is generated anew each time you change something in the code base. But if it is so, then you could have the board definitions on client side (in the HTML file itself), they would always be up-to-date, and then the browser could cobble the parts together.
The list of library files could be in the static site, or it could be fetched from some other place. Then some Javascript could make AJAX calls to get the individual library files, and then use JSZip. I don't know if we can then present the zip file as something for the user to download. I hope so. (I always run into security considerations when looking at things like this.)
From Melissa's comments I gather that, although the web site is static, it is generated anew each time you change something in the code base. But if it is so, then you could have the board definitions on client side (in the HTML file itself), they would always be up-to-date, and then the browser could cobble the parts together.
Yes, that would be pre-defined bundles as originally suggested and that would be doable for sure. Dan was suggesting dynamically built bundles for learn guides an...
A Javascript client solution is probably less attractive to produce Learn Guide bundles, since you can't pass args to process to circuitpython.org. The Javascript would have to get downloaded with the Guide page. @jwcooper do you have any comment on the best mechanism?
From Melissa's comments I gather that, although the web site is static, it is generated anew each time you change something in the code base. But if it is so, then you could have the board definitions on client side (in the HTML file itself), they would always be up-to-date, and then the browser could cobble the parts together.
Yes, that would be pre-defined bundles as originally suggested and that would be doable for sure. Dan was suggesting dynamically built bundles for learn gui...
@slender iron would it be possible for us to make @onyx hinge's practice of listing the commits included in each release a standard practice for all releases? It's super handy for quickly tracking what fixes are included in each version when helping people out.
A Javascript client solution is probably less attractive to produce Learn Guide bundles, since you can't pass args to process to circuitpython.org. The Javascript would have to get downloaded with the Guide page. @jwcooper do you have any comment on the best mechanism?
Your original example, https://circuitpython.org/library-zip?libs=lsm6ds,lis3mdl,apds9960,sht31d,bmp280,register,bus_device&project=sense_board&version=5.x
would simply return an HTML file, always the same, no matter what...
Your original example, https://circuitpython.org/library-zip?libs=lsm6ds,lis3mdl,apds9960,sht31d,bmp280,register,bus_device&project=sense_board&version=5.x
would simply return an HTML file, always the same, no matter what. The browser would then parse the address.
Pretty much, except a JSON file would probably work better. ;) Then it would pass the relevant files into JSzip and return the result to the user.
@slender iron Finding timing best-fit from clock frequency values is about 500 lines of code for stm32duino which is why I felt it was overkill for only one non-adafruit board, but I can spend some time next week working on it if you'd prefer.
@ionic elk This wasn't my suggestion. Can you get the bus value and simply map it over rather than compute it?
Pretty much, except a JSON file would probably work better. ;)
Details. :)
Then it would pass the relevant files into JSzip and return the result to the user.
Right.
@slender iron would it be possible for us to make @onyx hinge's practice of listing the commits included in each release a standard practice for all releases? It's super handy for quickly tracking what fixes are included in each version when helping people out.
@ionic elk I don't know what you are referring to.
in one set of release notes I had links to PRs not sure if that's what is indicated
@slender iron I think I still need a better idea of what you mean. The idea with the clock overrides is that the frequency can be overwritten to any value, and the I2C timing "code" will be different for every frequency. So there isn't really a generic way to map it unless we pick some specific frequencies to favor over others.
@onyx hinge yeah I just thought it was a nice touch, it's been handy for helping people find the best release to use for a given bug they were encountering. Saves digging into git. I don't know how much extra work it is though, no worries if it's a pain in the butt π
@slender iron back on the I2C thing I definitely agree it isn't ideal to have the I2C timing codes in a board def, but I'm still trying to get a handle on how essential the entire clock override thing even is, it was kind of a bonus feature/cleanup I fit in alongside some required LSE and speed fixes. I think implementing the best fit code would be a lot of work on a need that isn't really verified, which is why I've been suggesting "shortcuts" even if they're a little crude.
this will get you the PRs themselves by number: $ git log --oneline --first-parent 5.2.0..5.3.0 | grep -oE '#[0-9]+'
@ionic elk @slender iron I can see the timings listed in the cubemx data files...maybe we can extract them?
which you kinda need to know to write the section, making it a link is just including the PR# itself
@lucid solar I mean I guess one way to do it would be to have a big lookup table for every frequency at every I2C speed... but still, I'm just wary of spending more time on this without explicit request from @slender iron , every other board uses the max speed right now so this is all just kinda for the F746Disco if implemented?
@onyx hinge yeah I just thought it was a nice touch, it's been handy for helping people find the best release to use for a given bug they were encountering. Saves digging into git. I don't know how much extra work it is though, no worries if it's a pain in the butt π
@ionic elk Ah! Ya, maybe. Release notes are a bunch of work but adding the PR numbers may not be. I was already looking at similar data.
I think you could do more scripting on top of it, use the API to retrieve the name, the author, the reviewers, etc.
@ionic elk I'd prefer to standardize the clock speed rather than trying to support every configuration.
@onyx hinge I agree but think it should be edited. I don't like release notes that are just a dump of commit messages. We already have a source for that.
PR titles are hopefully good though
ya, at least a good start. autogen -> edit makes sense to me
Indeed I believe it was @dglaude that put this idea in my head a while back ;)
I for one love this approach! The idea of a web service that will return a bundle based on an arbitrary list of libs is great. I think it would also be useful to have a complementary web service for CRUD-ing named bundles with a static URL where the content of the URL would be kept up to date with the current version of the libs.
We could then provide an AJAX-ey UI for guide authors and people registering ...
@slender iron so, just to recap - clock speed and I2C timings now standardized by default for every board that doesn't explicitly override it, like the F746Disco (and even for that board the override is kind of an experiment with this RAM thing). So right now this I2C timing thing is totally optional, it's only required if you want to mess with your clock settings for some reason. Are you ok with keeping it in in the current form, in that context?
I don't think the 746 should be special
Ok that's a different thing then.
@raven canopy any idea whether this data can be accessed from the github API? I didn't find it yet. Screenshot from https://github.com/adafruit/circuitpython/pull/3026
Right now it's kind of an example for how theoretical clock-overriding can work. I figured it'd be the most useful for people who are creating boards that they want to hit a very particular power-profile with. But again all of it is optional.
(it's just coincidence that I'm also talking about an STM PR, it was the first one with a linked issue I found)
@ionic elk I think it makes things more complicated than it needs to be
@slender iron could we chat about this for a sec? I'm not really getting what your goals are
in amelia?
sure
@onyx hinge not that i know of. i peeked in the API docs, and i didn't see anything. looking at the page source, it seems JS-powered. but the source target isn't an API endpoint.
@raven canopy interesting. I didn't find it either.
i wonder if the v4 API has it...
@ionic elk what's the current status with stm32 and master? because it seems nucleo_f746zg is crashing now.
@lucid solar not sure what issue you are having, but just to make sure, did you know about the transition of the top branch from master to main?
@solar whale nope...missed that one...
yes -- try checking out main
ok...do you know the reason for the change?
see https://github.com/adafruit/circuitpython/issues/3021 historical meaning of "master"
ah...does it mean history as in 'master/slave'?
yes- exactly
ok...I see...then I support the change π
Is my understanding correct on variables prefixed with _ not being visible outside of that library? I was just having a look at an mpy file and noticed they appear as is inside there.
they only disappear if they are in the top level and are in const(...). Then the compiler removes them. Otherwise it's just a convention.
I thought there was one solitary area where python enforced this but I must be confused. It could have been using const() has caused that confusion.
if you do tab completion you don't see the _ stuff unless you expliclity type a _. But yes, const() is special, and is specific to micropython/circuitpython
@tulip sleet Yes, that's it, thanks. I've just updated my description in https://github.com/adafruit/Adafruit_CircuitPython_BLE/issues/83
@tulip sleet With that code being out of date you mean it's using the from adafruit_circuitplayground.bluefruit import cpb ?
no, see discussion just a few mins ago in #help-with-circuitpython re Animation.group, etc.
I'll make it clearer
Since my commit to add VCP, USB has stopped working. It seems that @tannewt updated tinyusb at the same time...between my commit and the merge and there is a problem. I'm looking into it, just didn't fix it yet so I'm making an issue so it doesn't get lost.
I just noticed this, maybe we can get rid of some of the gyrations in our github actions checkout: https://github.com/actions/checkout/releases/tag/v2.2.0
Fetch all history for all tags and branches when fetch-depth=0
Hey folks, x-posting from #general-tech.
I'm be chatting with Scott today at 4pm PDT.
Details on tuning in: https://twitter.com/nnja/status/1271557967150641152
PythonTea is back today at 4pm PDT with special guest @tannewt!
We're going to talk about https://t.co/xn6tRqfeLd, a tool he's been working on to help share info on voting in the US, CircuitPython & more.
Tune in on Twitch to chat with us live at https://t.co/DrZhxy1cpI
@onyx hinge how hard would it be for you to set up your STM32 with RGBMatrix again?
I'm having a really hard time getting decent behavior out of mine and I'm starting to worry it's not just a connection issue
It's not how I wanted to spend my friday evening
I can put it back together, mention it to me in the monday meeting if I don't say something first
Ok, I'll send you a ping then.
When you were assembling yours, did you find that you could get usable performance using jumpers? Or was soldering a perfboard an absolute necessity?
I breadboarded it.
no flickery pixels or anything?
I'm trying to remember if it was this one or nRF that I never actually wired up all the address lines though
https://blog.adafruit.com/2020/05/10/testing-out-rgb-matrix-support-in-circuitpython-for-stm32f405-st_world-stmicroelectronics/ It worked for limor
I'm more just asking from a possible EMI or noise perspective, so that would be any chip
double image but that's more an artifact of the camera shutter than bugs
both nrf and stm I just breadboarded
yeah that looks just like my setup... HMMMM
My Feather M4 express works fine to but I haven't tested it with my jumpers yet... If it is a code thing I wonder what could have changed.
you could try at the specific commit where the support was merged, or the specific commit that was the last commit in the pull request. Making sure that the protomatter submodule matches with git submodule update.
it seems to me that if both of those fail, it's an indication that it's not some unidentified code change.
Good idea. Just tested the M4 Express with jumpers, and it has no problems, which seems like a preliminary indication of code problems
I'll try the old commits and narrow it down tomorrow.
Has anyone figured out which build to use to test ESP32-S2 I2C? It seemed like esp32s2_busio branch of tannewt's repo, June 3rd commit being the latest successful one (WROOM en_US build of "Build CI #216: Commit c447c9f pushed by tannewt"), but: CircuitPython 5.4.0-beta.0-390-gc447c9f35 on 2020-06-03 I2C Initializion Error: name 'busio' is not defined
For displayio I assumed it only updated parts of the screen which changed? Is that the case? I've discovered something bizarre I can do with a TFT gizmo where the person holding it (me) can act as a conductor and pass signals between pins accidentally. You can see the effect on the display in https://www.youtube.com/watch?v=h5VPk8JsDXk - I can make it draw on parts of the screen where the object (sprite) is not supposed to be. If displayio was only updating the real sprite position then I'd expect it to leave debris on the display? The real sprite position is vertically central and on the left.
The CircuitPython code running on this Circuit Playground Bluefruit rotates through three non-moving sprites on the left side of the TFT Gizmo screen at 00:00 to 00:04.
If fingers are pressed firmly against the pad/screw heads of the Gizmo over SCL/SDA/RX/TX then this can c...
maybe the signal corruption is also causing the location skewing?
I just had a variant of this on 5.3.0 on a Circuit Playground Bluefruit (CPB). This is what was on the serial console.
wins 0, losses 0, draws 2, void 0
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
TXing soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
Traceback (most recent call last):
s over USB to run the...
@tidal kiln They are bizarre but I'm okay with the position changes. What's weird is they get cleaned up when I take my fingers away from the pads. I'd expect the debris to be left on screen if displayio was only updating the true area/location of the sprite, i.e. a 48x48 patch on the middle left.
Will circuitpython add the GPIO External Interrupt funtion later?
Have you tried pre-allocating the buffer for audioio, so that it can reuse the same part of memory?
@deshipu Not yet, but allocating that early and once is a good idea, thanks. The feature looks like part of 5.x WaveFile.
buffer(bytearray) β Optional pre-allocated buffer, that will be split in half and used for double-buffering of the data. If not provided, two 512 byte buffers are allocated internally.
That mentions 2x512 which doesn't match 2048. I wonder if it scales to the sample_rate.
Hmm, I switched to this
gc.collect()
file_buf = bytearray(2048)
audio_out.play(WaveFile(audio_files["welcome-to"], file_buf))
And I now have three boards all that have bizarre errors including one in the HardFault_Handler. I think something is crapping all over memory.
My Trinkets are not even on battery but are requiring too much manual resets, and adding more hardware starts to look expensive. Given that there is no quick fix/option in CircuitPython yet, I am looking into a workaround in the C code.
In my view, it would be ideal to exit the safe mode after for example 2 minutes. In the function wait_for_safe_mode_reset (supervisor/shared/safe_mode.c), would it be fine to call reset_cpu(); after a few ticks or would that reset the device into safe ...
I had some code which was working well until I changed the WaveFile use to include a pre-allocated 2048 bytearray. That new code fell over in different bizarre ways on three boards, one went into the hard fault handler.
I've experimented a bit with REPL and I believe one way of triggering this is with adafruit_ble's start_scan(). This is where the real application falls over too although it's interesting that it worked perfectly with WaveFile doing its own thing for buffers.
Here's ...
I have a Git question: In order to make a PR on a library I fork the library, then clone my fork locally. I make a new branch and make the changes in it, then push and make my PR to merge from my new branch to the Adafruit forks main branch. The PR gets accepted, so now adafruit\main has those changes but foamyguy\main does not. What is the proper (or easiest) way to get those changes into my fork's main branch? So that if I make other new branches in the future for other PRs I can be starting from the same place as adafruit\main.
Deleting the fork in github and making a new one works, but takes a while. If there's a way for me to get my fork updated that would be ideal. I could merge it locally and push but I think this would make extra commits if/when I made a new PR. I'm thinking either squash, or rebase can help with this. But I don't know much about them to be honest, and don't want to mess anything up for the main fork.
After the Adafruit repo has the megred PR, I do the following git fetch upstream master git merge upstream/master git push origin master
that updates my local copy of the upstream (adafruit) master -- then merges it in to my local master -- the pushes that to my fork
I'm still using master for the libraries since thay have not been ported to main...yet
Perfect. Thank you, and yep same here but I'm anticipating that coming
Do you think there is likely to be trouble with this PR? https://github.com/adafruit/Adafruit_CircuitPython_PyBadger/pull/33 The fork it's from is 2 commits behind adafruit\master
in the changes I do not see removals of the things added with those commits (a button debouncing example) so I think it shouldn't get removed when/if this PR is merged.
But I didn't notice that it was behind until a few minutes ago.
I think - if there was a conflict, it would tell you
Okay thank you π I am working on another update now to add support for the Pew Pew M4 which has a similar screen to PyBadge and similar button set, plus a handy little badge clasp cutout at the top.
As long as the things that were added are not touched by your changes, it should not matter
Thanks for doing these updates! As usual a simple change mushroomed into more than you bargained for!
Yep. I'm happy to work on it, am learning lots about this library and how it is structured to work with all of the different devices.
Oh, I need to add the unsupported exception to the acceleration property
yes, the way I do things is to have both my fork and the repository I will submit pull requests to as "remotes" in get terminology. I tend to use "origin" for where I'll submit PRs to, and "jepler" for myself, remote names can be whatever you want. So I start a new branch with git fetch origin; git checkout -b newbranchname origin/main^{} which is a bit of an arbitrary incantation but works well. Later, I git push --set-upstream jepler newbranchname before submitting the pull request.
I don't "maintain" the main branch of my own fork, it just sites whereever it was when I forked it
@tulip sleet If you're doing work in the BLE area, you might want to take a glance at https://github.com/adafruit/circuitpython/issues/3030 - I can reliably cause disasters with start_scan() and playing looping audio at the same time including hard fault / safe mode / random errors but only when supplying a buffer to WaveFile.
Wow this whole time I never scrolled down on the sidebar and thought there were only help channels not language-specific channels. π
@wise shard learn much can you by lurking here Obi wan (sorry Star Wars is on)
Something is clearly going wrong with storage management, so we'll need to look at the heap allocation that happens during scanning, and whether the internal audio buffers are being managed properly (they are on the root pointer list, etc.). @jepler does this ring any bells w/r/t audio?
Thanks for coming up with a really simple example that is just audio playing in the background during a scan. That narrows things down considerably, since there's no audio Python code that's being called in...
I have also seen a hard fault using WaveFile(buffer=), and bluetooth wasn't involved. @deshipu It looks like you contributed the buffer= code, is it working for you?
BTW, it works in my code for a bit and even when there's displayio animations going on. There's some sort of combination effect here, possibly more heavy use of memory or GC'ing revealing a bug.
are the "latest" docs pages intentionally 404 for some modules? For instance this page works: https://circuitpython.readthedocs.io/en/5.0.x/shared-bindings/os/__init__.html but this one does not: https://circuitpython.readthedocs.io/en/latest/shared-bindings/os/__init__.html
I see. Will the links built into the version dropdown at the bottom left fix themselves eventually or is there something required on our part to get those back to working?
the "versions" links just change the /5.0.x/ -> /latest/ component, they don't fix other parts of the URL which may differ.
I wonder if it's possible for the "latest" one to behave slightly differently and change more of the URL. The way the docs get built is still a bit of a mystery to me honestly. But I'd be happy to spend some time trying to get that "latest" link fixed if possible. I keep clicking it and winding up on 404 pages π
Hm it's not as simple as "renaming" things to appear under /shared-bindings/ instead of /autoapi/ -- for instance, TileGrid used to get its own page: https://circuitpython.readthedocs.io/en/5.0.x/shared-bindings/displayio/TileGrid.html but it became just an anchor on the overall module page in main: https://circuitpython.readthedocs.io/en/latest/autoapi/displayio/#displayio.TileGrid
huh that is weird. The source says: ```shared-bindings/displayio/Palette.c://| palette[1] = b'\xff\xff\x00' # set using 3 bytes
the 5.0.x docs say: palette[1] = b'\xff\xff\x00' # set using 3 bytes
so far so good
the latest docs say: palette[1] = b'ΓΏΓΏ' # set using 3 bytes
somehow the escape codes have been interpreted into characters
This improves, but does not entirely fix, the broken links that result from the autoapi change. It fixes module-level links, but class links still do not work (e.g., /shared-bindings/displayio/Palette.html (5.0.x) is now just /shared-bindings/displayio/#displayio.Palette).
I noticed that this bit of documentation in shared-bindings/displayio/Palette.c:
//| palette[1] = b'\xff\xff\x00' # set using 3 bytes
gets rendered as
palette[1] = b'ΓΏΓΏ' # set using 3 bytes
i.e., the hex escapes are being interpreted. It appears that this happens at the step where the .pyi file is converted to a .rst file, as the generated files have these contents:
autoapi/displayio/index.rst: palette[1] = b'ΓΏΓΏ' ...
@lone axle fwiw I appreciate your remarks about doc paths and agree with them, I just don't see a way to get 100% compatible with the old version links... I'll continue poking around. Thanks for raising the issue again.
Thank you for looking into it π
Definitely we should report it, I think here: https://github.com/readthedocs/sphinx-autoapi/issues. I looked and didn't immediately see an existing issue.
Now updated with some additional redirecting logic that should get the per-class pages redirected as well
On reflection, I think this may be "correct", and there's an easy fix. I've incorporated it in #3031 where I was already working on the docs, but I can split it out if desired.
If you write
"""This is a byte string with hex escapes: b'\x00\xff'"""
then the string will actually have those characters with code points 0 and 0xff in it. By changing these docstrings to raw strings we get what we want.
@prime flower @slender iron I am about to give up on finding a way to use feather_m0_rfm9x board for anything more than the examples in the library. Adding a sensor like the bme280 in the example that started this, may not be feasible any more. How hard do we want to try?.... the only way i was able to get a stripped down version (no reliable datagram) to fit was to remove "math" but that is needed by the bme280 lib.... As to reducing the rfm9x library size, I have found a few hundred bytes, but we need much much more than that and the same goes for the bme280 lib. Perhaps we should talk "in the weeds" tomorrow about the planned support for M0 boards going forward - especially the non express boards. Should we just to update the guides and remove the M0 boards at this point. This is the guide that has prompted this https://learn.adafruit.com/multi-device-lora-temperature-network I think we were still in 3.x when it was written
I think this corrects most of the M/S terminology that does not depend on upstream libs such as asf4, softdevice, etc., renaming things.
Note that there is an incompatible new name for the i2csecondary module and its contents, with no backwards compatibility alias. Technically, semver says that this requires a major version bump. Just sayin'.
Disclaimer: All I know about SAMD51 ADC's is what I picked up while looking at this issue.
- This is not just 5.4 related. I was able to reproduce on a PyBadge back to CP 5.0
- The hang is in ports/atmel-samd/asf4/samd51/hal/src/hal_adc_sync.c, line 121:
'''
while (!_adc_sync_is_channel_conversion_done(&descr->device, channel))
;
'''
This can loop forever. I added code to put in a loop counter and exit after some number of attempts. While this eliminated the hangs it did not resol...
@solar whale @prime flower @slender iron Is the "base free memory" tracked per board for new versions of CP to see how it varies?
@simple pulsar Not sure if this is what you have in mind, but it is reported with the build -- not sure if it is tracked ```jerryneedell@jerryneedell-ubuntu-macmini:~/projects/circuitpython_jerryn/ports/atmel-samd$ make BOARD=feather_m0_rfm9x
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated
Note: compression increased length 'USB Busy' 8 9
185568 bytes used, 2592 bytes free in flash firmware space out of 188160 bytes (183.75kB).
8940 bytes used, 23828 bytes free in ram for stack and heap out of 32768 bytes (32.0kB).
Converting to uf2, output size: 371200, start address: 0x2000
Wrote 371200 bytes to build-feather_m0_rfm9x/firmware.uf2
third line from last
I was just tihnking it's a key metric as it's needed to verify that intended changes have the desired effect and make sure there are no unintended changes. Software seems to generally bloat over time and can make the M0 boards less viable over time. In this case it's invalidated Learn Guides like the one in question here mentioned in https://forums.adafruit.com/viewtopic.php?f=60&t=166139 (assuming this one is simple case of interpreter growth in memory usage). I've bought CPX boards for most of my friends and a few Gemma M0 too so I have an interest in this too.
I'm not sure memory has been impacted that much as CP has grown, but the memory usage of some libraries has. I think that is the problem with the rfm9x example. The m0_rfm9x can run the current rfm9x library and its examples, but it can't handle adding a big sensor or display which people often want to do -- and was done in the impacted guide. So the board is not "useless" limited in application with CP..
Sorry -- I have to go AFK for the evening -- Happy to discuss this more tomorrow.
@solar whale Sure, have a good evening. One set of datapoints from REPL: I had a CPX nearby still running 4.1.0 and that has mem_free() showing 21680. Just upgraded it and 5.3.0 is 20880
Are there some commits here that were already merged? DTCM and ITCM support, etc.? Maybe do a merge from upstream and push again?
Ah, I see, a docstring is just a string, subject to escape processing. The alternative would be to use double-blackslashes.
@dhalbert check again? I think I rebased against a wrong branch due to muscle memory.
@dhalbert check again? I think I rebased against a wrong branch due to muscle memory.
Yes, looks good now. Re API I2CSecondary change: we could advance the beta to 6.0.0, or we could alias the old name for now. I don't think it's that big a deal to advance to 6.0, because the sleep stuff is a major inflection point anyway, and it's going to be a while before this beta stops being beta. This would give us the opportunity to make some other breaking changes that are on hold for 6.0.0 also.
It is not systematically tracked. I did notice that there is a script that is supposed to help you locally build selected commits and track how size is affected, but it probably has not worked in a very long time: tests/codestats.sh
the default stack size is something that was increased during the v5 development cycle, so the proportion of your e.g., 23828 bytes that are allocated to each one is different than it used to be (more for stack)
@lone axle I don't bother keeping my main branch up to date. When I start a new working branch I just use adafruit/main
Ah, that makes sense. Thank you
This version of actions/checkout will
Fetch all history for all tags and branches when fetch-depth=0
We leave the tags fetch in place so that actions in cloned repos work. Cloned repos' tags do not necessarily match adafruit/circuitpython, but we want version reporting to be able to use adafruit/circuitpython tags when they are most relevant according to "git describe"'s heuristics.
Submodules are different, as they always point to the repo specified in .gitmodules, so they don't ...
(I managed to not work on circuitpython for nearly 1.5 days out of my 2-day weekend ... then it all came crashing down and I did work)
@onyx hinge https://www.youtube.com/watch?v=UPw-3e_pzqU
Just when I thought I was out...they pull me back in.
hehe
-1. Context matters. This is newspeak.
Can the main code in CircuitPython be deployed as code.mpy ? I see there's an old issue for this: https://github.com/adafruit/circuitpython/issues/145 It just struck me that it might help with getting that Feather + Sensor + Radio code working again.
@simple pulsar quick test on a CPX makes it seem like no to me. I mpy-cross'd a code.py file and dropped it in CIRCUITPY but it does not get run when the device boots up.
@lone axle Interesting. It's fairly easy if a little unnatural sometimes to punt out loads of the code into another file, mpy-cross that and just import it, of course.
yep, we've used a similar process for devices that are getting deployed in fixtures.
being able to launch code.mpy directly without the extra file and import would be nice though π
It does start to obscure the code so it's not all positives. This sort-of came up in the discussion on https://forums.adafruit.com/viewtopic.php?f=60&t=165419
@simple pulsar I fwd'd the lora radio+bme info. to ladyada. I'd like to update the guide to use a more powerful feather (m4) and the radio featherwing instead. imo adding code as a mpy would obfuscate the code :\
@simple pulsar I looked into it at one point and didn't find a way. However, you can reduce your code.py to 'import realcode' and have your realcode in a .mpy file.
I don't think that just adding .mpy to a list of extensions worked
btw for squeezing into limited RAM, did you investigate reducing stack size via boot.py?
Me? No.
It was increased to fit the do-everything library on cpx; you might be able to decrease it for your particular use-case, or it might be ineffective.
(apparently, importing large mpy files takes a lot of stack)
the stack size increase for the CPX library was needed because of a 5 or 6-level-deep call chain during __init__(). __init()__ for the main class gets called during import because of the assignment to the singleton cp.
We had this assignment before, but the addition of a subclass in the CPX library and I think some additional nesting in some device libraries caused the stack overflow
@tulip sleet In current state of CP bleio, is it possible to be an HID keyboard (or mouse) for multiple computer simultaneously? The CP board would keep advertising itself, and accept other client. When I read example code, everything seems so easy, but I don't see where I specify what connection to use for those HID message. I am learning by example right now because it lack a bit of documentation right now.
@thorny jay You would need to create multiple instances of HIDService, and refer to the .devices for each one, e.g. https://github.com/adafruit/Adafruit_CircuitPython_BLE/blob/master/examples/ble_hid_periph.py#L34. I think the nRF softdevice can handle only one set of advertising at a time: you can't start up multiple separate advertisements. There may be other restrictions or bugs that are not obvious π
Thank you, I'll give that a try. So I can advertise one, get a connection, then advertise a second HIDService. Do I need two "ble = adafruit_ble.BLERadio()" or iterate on the ble.connections. There seems to be dragon everywhere. There are very few lines of code, and still behind you can feel that some complex stuff are going on in the library.
Hi all and especially <@&356864093652516868>! The CircuitPython weekly meeting will be in about 15 minutes. If you have a chance to update the notes doc with your hug reports and status updates, that would be excellent https://docs.google.com/document/d/1CZOWdmPGYcvt9WVl_NBxi-M3RXRtTklC13YtziBAu_Y/edit?usp=sharing
If you're going to be "lurking" (that is, you'll be in the audio channel but will not contribute during the round robin sessions), we need to know that. You can let me know here in the chat by saying "lurking", but adding it to the notes doc is even better.
If you're not yet a circuitpythonista but would like to be informed of meetings, let one of us know and we'll add you. We also have a calendar that you can view online or add to your favorite calendar app https://raw.githubusercontent.com/adafruit/adafruit-circuitpython-weekly-meeting/master/meeting.ical https://open-web-calendar.herokuapp.com/calendar.html?url=https%3A%2F%2Fraw.githubusercontent.com%2Fadafruit%2Fadafruit-circuitpython-weekly-meeting%2Fmaster%2Fmeeting.ical&title=CircuitPython Discord Meeting schedule&tabs=month&tabs=agenda
I've got a huge Python on Microcontrollers newsletter cooking and it'll be in mailboxes Tuesday morning. If you'd like to subscribe, go to www.adafruitdaily.com and click on the Python on Microcontrollers newsletter
GMail already refuses to show the entire email. π
Yes, we include a "click for browser view" at the top of each one
Contributions to newsletters gratefully accepted, you can submit a GitHub PR on the latest at https://github.com/adafruit/circuitpython-weekly-newsletter/tree/gh-pages/_drafts
@tannewt @k0d this should be ready for a final check-over. As per Scott's request, the I2C timing overrides for the F746 Discovery have been removed.
Lurking
Lurking
lurking
maybe you can use ffmpeg to convert all the pitches up an octave or two?
lurking
lurking
The chipmunks are eating our garden strawberries, you can have them
lurking, may run off briefly to get some food too
Text only today.
Lurking
lurking today
Having easy, cross-platform python support for wireless BLE has been a challenge for many years. Thanks to dan halbert's great work on CircuitPython bleio and the Python bleak library, we now have many of our CircuitPython BLE examples working on desktop Python! Finally, heart...
Still experimenting with blending LED colors in semi-translucent resin. Now trying the technique in wearables (of course). The cuff bracelet contains two side emitting LED strips facing opposite directions. https://t.co/zCVybwG2qM
162
Installation of the Musique Concrète Clock.
A hybrid repair of a damaged heirloom clock using the original acoustic whistles and chime wire. The sound components are activated by servo motors and a solenoid driven by an Adafruit Cricket, custom I2C host interface module, and P...
@turbid radish that last one's a twitter handle right?
yes
@gilded cradle I guess the displayio work is reflected in some other repo than the main blinka one?
Yes @onyx hinge https://github.com/adafruit/Adafruit_Blinka_Displayio
the stats underrate you tragically
Yeah, it would be nice if it included all the Blinka-related ones too
that should be fairly easy. just need to add the repo for collection.
as will be in my status, i'll be giving some attention in that area, so feel free to put up a new issue
@slender iron If you have a link to the Python Tea video that'd be great. I just went poking for 30 seconds and didn't find it -- https://www.twitch.tv/nnjaio/videos says it can't show me a list of videos for some reason
hmm. i just watched it a few hours ago. twitch is now reporting "temporarily unavailable". changed the filter from "Featured"...there they are!
Β―_(γ)_/Β―
I review guides
ooh congrats on your guide @lone axle
@inland tusk so please close your camera
I
π
I am lurking
@inland tusk gonna hop back in?
Same here with text selecting
Yes I am but I am going to be lurking
kk
Did we loose recording because we lost @idle owl's computer?
Con-Kattni-ate
DΓ©jΓ vu.
It will not let me into video chat
ya, we're not doing it anymore
okay
because it limits the number of people who can join the meeting and most folks don't use it
def test_available_members(board):
""" Verify the attributes and members available in ``digitalio``.
Expected result: ['__class__', '__name__', 'DigitalInOut', 'Direction',
'DriveMode', 'Pull']
"""
expected = {'__class__', '__name__', 'DigitalInOut', 'Direction',
'DriveMode', 'Pull'}
with board:
board.exec("import digitalio")
result = board.eval("dir(digitalio)")
final_result = set(result)
assert not final_result.difference(expected)
Doh! I knew I was forgetting a hug report π . Thank you for working on that sommersoft!
@onyx hinge lol! no π
Installation of the Musique Concrète Clock.
A hybrid repair of a damaged heirloom clock using the original acoustic whistles and chime wire. The sound components are activated by servo motors and a solenoid driven by an Adafruit Cricket, custom I2C host interface module, and P...
Would be interesting to hear in a sentence or two why the adafruit_ble is useful on a desktop? (I have never tried BLE programming on there).
so you can talk to BLE devices (both CircuitPython and others) from ordinary host computers. For instance, you can now use our CircuitPython library code to talk to, say, a heart rate monitor from the host computer.
Note that the bleak implementation can -only- act as a central, not a peripheral
status-update-afterthought-screen-grab:
@simple pulsar how do the results change if you double the time between announcements?
It is frequent for "networked" device to be "synchronised" in their behaviour.
I don't know enough BLE to know if this "fills" the available time, letting some device starve instead of being able to send, which is why I suggest doubling the time
Sorry I missed today's meeting, but I'm excited to be a mod and help out! π
Glad to have a new mod!
There may be a "sub-culture" of folks modifying existing libraries to work better on the M0. I've done that with a few that were critical to older projects. How about creating a community-based repo for those?
I think the Community Bundle works.
Indeed. Not obvious in this case, but will be something I'll consider now.
Maybe the guides could be expanded upon to show the use Featherwings and Feather M4s
I wonder about the CPX synth stuff I did with adafruit_midi - that was very tight on memory - https://learn.adafruit.com/cpx-midi-controller
Do we need a Trinked M4?
@thorny jay there's not a SAMD51 in the right package, I think
you need to go up in footprint to itsy bitsy
Trinket M0 uses a 32-pin package; SAMD51 only has 48 pin and up
I recycle Trinket M0 to do USB host thing.
it could conceivably be done with a BGA package, but those are harder to manufacture, and the ItsyBitsy is still pretty small
the qfn samd21s are really small.
USB_DEVICES
not much incentive to go to bga unless you already have a bga part and you're paying extra for that manufacturing cost anyway
Thanks Kattni!
@tulip sleet @ionic elk @slender iron I'm debugging an issue with USB not working on the STM32F7 after the VCP code was added. It turns out that a variable is being optimised out. Which is why it worked on my machine as I had debug enabled. Do you know how we can stop it being optimised out? https://github.com/adafruit/circuitpython/blob/9285252fbcbe4db654bc69621210883380fb6981/ports/stm/common-hal/busio/UART.c#L43
@lucid solar is it the "optimized out" you see in GDB? That doesn't necessarily mean it's gone completely, just that its lifetime/scope is narrowed and it is not available. Maybe you need to make it volatile? That's often a debug/non-debug build difference. The debug version is sometimes accidentally volatile.
Hmm...I've added volatile and it didn't fix it.
Now it seems to not be optimised out though....
another difference would be that it is not being initalized properly, and so the debug version accidentally works due to a different random initilaization
When I check the variable, it seems to contain the correct data, even in non-debug version
@tulip sleet sorry -- I'm just missing something -- where do I ahve to set USB_DEVICE to turn off USB_HID and USB_MIDI?
@lucid solar are you seeing that it's being read incorrectly? this may be a red herring; for instance, debug/non-debug can also cause timing differences which might cause working/nonworking
I was just setting CIRCUITPYTHON_USB_MIDI=0 in mpconfigport.mk
Mind adding a section on the renaming to the design guide here? https://github.com/adafruit/circuitpython/blob/main/docs/design_guide.rst
Thanks for kicking this off!
Have you seen discussion that replaces master with microcontroller? I think main might be clearer because microcontroller applies less well to a raspberry pi.
What do these actually mean? Are there better names than these?
Want to reduce this to one definition?
@solar whale set USB_DEVICES="CDC,MSC,HID". The default is "CDC,MSC,AUDIO,HID". (order doesn't matter)
@tulip sleet if I remove lines 69 and 70 (https://github.com/adafruit/circuitpython/blob/9285252fbcbe4db654bc69621210883380fb6981/ports/stm/common-hal/busio/UART.c#L69) it works just fine...but that's a hack, not a fix.
It really feels like it's something totally unrelated, and it's just this where it fails.
yeah, i'm not sure what uart has to do with USB here
I agree!
is there a check to use UART for output if USB is not present, or something like that?
They are linked in supervisor/serial.c
What's weird is it doesn't crash, it just usb doesn't work...the uart works fine
@ionic elk may have some inkling, sorry. did you make both never_reset_uart[] and reserved_uart[] be volatile? Or maybe it's a race condition?
I tried with both as volatile
@tulip sleet thanks for your help so far. I'm going to watch Brian Lough's stream now...so I'll get back to it tomorrow.
If it doesn't crash, how do you know the point at which it fails?
@ionic elk going through all the code disabling it line-by-line.
@tulip sleet sorry to keep bugging you on this - is there an example board where USB_DEVICE is used like that - I can't find one.
Yeah I'm not sure what's up with that one line causing that level of issue
@solar whale most STM32 boards have incomplete lists of USB devices due to limited endpoints, you could check them out
@solar whale ports/stm/boards/stm32f412zg_discovery/mpconfigboard.mk
just wondering why pewpew10 works as is?
@lucid solar my intuition for anything that disrupts USB is usually a clock or timing issue. When things start failing at random points, I usually worry that flash is being overwritten or the debugging link is being shut down. Do you have a debugger?
other than the STLink, I mean
I use the STLink on board...why would it be different?
I don't think there should be any reason, just wondering.
I've got an external STLink v3...I guess I can try it...maybe it's a power thing....as the device doesn't really shutdown.
A pty is a pseudoterminal, a kind of virtual serial port. You need it in specific cases where a (sub)program does certain interactive things like provide rich line editing. There are two ends to these, traditionally called m----- and s----. In general m----- is the side used by the "controlling" code and s---- is the side used by the "controlled" code.
In Python, they renamed these in 2018, adopting the "parent" and "child" nomenclature for documentation purposes. I could mirror tha...
@prime flower @slender iron @tulip sleet woohoo! major breakthrough - I have built CP for the m0_rfm9x board with the current library frozen in -- I had to take out a lot and can now see what I can put back --
@solar whale Nice! Does BME280 fit as well?
have not tried -- yet
@slender iron The first half of the video doesn't have anyone else's audio even though OBS was hearing it - so apparently the crash corrupted one of the audio tracks. The second half of it has both. What should I do here.
I doubt it
@solar whale out of curiosity - were the removals mainly the new features (crc, node addressing)?
I was hoping the same thing that happened last time it crashed would happen - where converting the vid for YouTube saved part of the whole thing, but there's not even anyone else's audio on the original, so there's nothing to convert.
Concatenate it and post it without half the audio? Post the second half? Skip the video this week?
I did not remove anything for rfm9x -- from CP i had to remove several modules (analogio,rtc,rotaryio,touchio,midi,hid,neopixel_write)
@prime flower with a smaller rfm9x -- I should be able to put some back
@solar whale ah, ok I misread. That is exciting!
Yes -- renewed my enthusiasm!! I have to go AFK for now but will continue on this tomorrow.
sweet - let me know if you need help splitting apart the RFM9x library.
Sadly I now see that in 2018 they turned down this change :(
Fixes #2973.
Tested with a heart rate monitor advertisement with this program:
from _bleio import adapter, Address, ScanEntry
def p(x):
print(tuple(hex(b) for b in x))
# Reverse the two prefixes to test both orders.
prefixes = b"\x07" b"\x03\x0D\x18\x0A\x18\x25\x17" b"\x03" b"\x19\x41\x03"
p(prefixes)
HRM_ADDR = Address(bytes(reversed(b"\xEC\x5D\x34\x85\x99\x11")), Address.RANDOM_STATIC)
# active=False: skip scan responses
for se in adapter.start_scan(...
@onyx hinge might I ask why primary/secondary was selected for the I2C terminology? Is that following a standard set by another project?
When I was looking around I thought that name combos like manager/subordinate and monitor/subsystem had the advantage of keeping the acronym, and also retained good information about the device relationship. Seems like they might be good for beginners who are looking at mixed documentation about their devices.
@ionic elk I am mostly just trying to follow along with others' best recommendations. I thought we were going towards main/secondary, since those conserve the letters m/s as initials, leaving MOSI and MISO "intact", but it's possible as always that my wires got crossed
main/secondary is definitely better! Though I still feel it doesn't really reflect the actual relationship between the devices so much. I really like manager and monitor because they reflect the actual information pathways even better than master did - it implies a two way reciprocal flow of information.
I don't know if there's a particular reason why git used master at all, but it doesn't seem to me like we need to be married to main for everything - it's a great name for a repository but I don't think it says much about communications.
git's master came from the same etymology as a master recording, but it's such an arcane derivation that clearer alternatives should definitely be used. π
Etymology is a rabbit hole I find myself falling down frequently.
yeah I see a big bonus of all this is that all these old terms were never very descriptive or useful anyway. Like "slave" devices rarely even have that role, it's actively misleading
just remember that etymology is useful for history and not a rulebook. :3
The last one I fell down was: Why is french "fromage" when so many western European languages are similar to "cheese".
Yeah like most SPI/I2C devices are fully independent devices.
anyway I'm just brainstorming, as long as the acronyms stay the same that's the big thing for me. I'd like to ease guides and introductions for beginners as much as possible.
Yeah keeping MISO/MOSI the same is good.
Though we can drop the SO and call it "Main in", "Main out"?
No, you need to keep it, just in case you have the lesser-used connections SOSO and MIMI
Suz used something in her guides that was good and kept the acronyms. Let me find it.
wanted to put in my two cents and some of the alternatives I found. manager/subordinate is my vote, if it counts for anything. A boss and employees seems the closest to the actual relationships my devices have
@idle owl I think all video even though some audio is missing
this is good: https://twitter.com/noopkat/status/1256795369301700608
(sorry was at lunch)
@slender iron Ok. Thanks.
Never apologize for lunch.
unless it's a bad lunch
do you have multiple audio track setup during the recording? maybe it's just not the one that gets played
@ivory yew oh neat that's a nice comic, so there is some precedent
Yeah and Suz is great. I'd listen to her over me any day. π
@slender iron I tried looking to see if there was another track anywhere, VLC isn't seeing one on either video, including the one that worked properly.
Single track only.
kk. how about recording a head up and concating it at the start
that way podcast folks will know what's up
um... ok. will do.
if that's too much work then notes-only is fine
Anybody want to help me workshop this possible new text for our design guide document, docs/design_guide.rst? ```
Terminology
As our Code of Conduct sates, we strive to use "welcoming and inclusive
language." Whether it is in documentation or in code, the words we use matter.
This means we disfavor language that due to historical and social context can
make community members and potential community feel unwelcome.
Two specific terms to avoid except where technical limitations require it are
"master" and "slave". In general, prefer the terms "main" and "secondary",
though other terms may be preferable in specific circumstances. Note that
"technical limitations" refers e.g., to the situation where an upstream library
or URL has to contain those substrings in order to work. However, when it
comes to documentation and the names of parameters and properties in
CircuitPython, we will use alternate terms even if this breaks tradition
with past practice.
Redlst/Greenlist has been suggested.
yeah we have something called service_uuids_whitelist at least
meh, colors have different meanings in different cultures (streetlights in some countries are blue, not green). Allowlist/Denylist is getting some widespread adoption.
fair enough.
blocklist clearlist came up for Rails
they went with allowlist/denylist though: https://github.com/rails/rails/issues/33677
Per https://twitter.com/dhh/status/1032050325513940992, I'd like for Rails to set a good example and tone by using better terminology when we can. An easy fix would be to replace our use of...
Terminology
-----------
As our Code of Conduct states, we strive to use "welcoming and inclusive
language." Whether it is in documentation or in code, the words we use matter.
This means we disfavor language that due to historical and social context can
make community members and potential community feel unwelcome.
There are specific terms to avoid except where technical limitations require it.
+----------------+-------------------+
| Preferred term | Deprecated term |
+================+===================+
| Main | :strike:Master |
| Secondary | :strike:Slave |
| Denylist | :strike:Blacklist |
| Allowlist | :strike:Whitelist |
+----------------+-------------------+
Note that "technical limitations" refers e.g., to the situation where an
upstream library or URL has to contain those substrings in order to work.
However, when it comes to documentation and the names of parameters and
properties in CircuitPython, we will use alternate terms even if this breaks
tradition with past practice.
looks good
@slender iron it's fine. I think I got it.
thanks @idle owl
I don't that we need to use the same terms for SPI as I2C
the other thing I was thinking about was the role of who controls the clock
clocker vs clockee
yeah tbh "Controller" and "Device" are good terms, but they absolutely break the acronyms for SPI.
π
I think you could mention that these terms are actually more technically descriptive as well
It's not the point but it rounds out the argument. These were never good names to begin with and code makes more sense when they're changed.
Main/Secondary for SPI, Main for git, Controller/Device for I2C, and allow/denylists for General ?
wouldn't it be better to keep I2C and SPI the same? Since they're interchangeable for many devices?
Lots of screens can be either I2C or SPI, it seems more beginner friendly to be consistent
fwiw I agree, I was trying to interpret what @slender iron was saying above about the terminology not necessarily needing to match
- @ivory yew 's contribution of the controller/device terms
Yeah I'm just thinking of a prospective new user with an SSD1306 moving from SPI to I2C and finding all the terminology about the protocol changing
Eh. I don't know. The cognitive overhead of two separate protocols is more significant than the overhead of differing terms.
In fact, differing terms may help them more quickly identity which protocol is being used.
But it's hard to say without actual user studies
that's true. It's only a concern where the two protocols are interchangeable, such as for the screens.
We can also take a step in a good direction now, and refine the suggestions later
Screens are pretty confusing altogether. Some even support parallel interfaces. It's gonna be hard and it isn't going to be because of pin labeling.
Agreed.
So, testing shows that if the loop limit is increased to 255 and the mp_printf is removed then Python calls to microprocessor.get_voltage() will succeed. @dhalbert , that would require making changes to the asf4 library. Is that something we could/would do?
Also, more than anything a glossary helps and actively linking to the glossary when jargon comes up is super useful.
Idk how the Adafruit learning system works but I've written lint checks for things like that before.
(fwiw documentation and developer experience is my area of expertise)
I don't think it has checks like that but there is a lot about Learn I don't know
@dhalbert Can we close this? Didn't your bootloader changes fix this?
Man little popups for glossary terms would be a spiffy feature
π€
One question. Looks good otherwise! Thanks for doing this!
An author of sphinxcontrib-redirects. We should probably remove the TODO here (in fact I thought I had -- I'll make a TODO about it :rofl:)
I don't think main/secondary are great terms but do keep MOSI and MISO working. I'd rather not see MOSI influence naming for other protocols
I still like host/peripheral.
Looks good! Thank you! Just need to remove debug comments.
Only because HIPO and HOPI are a lot of fun to say.
MController / SDevice.
Mackerel / Sardine
We won't be adding the external interrupt callback that MicroPython has.
At some point we'd like to support external interrupts as a sleep wakeup though.
Thank you! We should probably hook up a pypi release for the stubs as well.
whoo .. that's more time than I intended today, working on things that are not SDIO. Important things to do, I believe, but .. not SDIO
We have already forked asf4 and fixed a small number of things, so there's no problem. I haven't had a chance to look at this in detail yet.
Looks good! Thank you! Just need to remove debug comments.
Oops! So much for hurrying up before lunch :)
What is Philips/NXP recommendation for I2C alternative naming?
I like Host/Peripheral @ivory yew
@thorny jay If you're interested in helping, why not investigate and let us know.
I do not wish to participate in newspeak. I just want to highlight that there is a great benefice in all the industry using the same name. If new protocol can avoid using those words, that is fine. But it will not be possible to remove it from all the documentation and memories. But anybody new comming into electronics will have to know both names, the politically correct and the previous ones. Does this help with learning electronic... I am not sure. But then again, I am not a native English speaker and not from the US (yes I believe this is mostly an US issue). So those names are just technical terminology to me.
PS: CP may also have an issue with translation if those words are use in error message. French was mostly done already, when I wanted to help... so I have no clue if there are a lot in there.
@thorny jay These terms are not a political question. This is about inclusiveness. Please see the full draft from Jeff above for full details
I accept others' reports that these terms hurt them, and I am acting to make things better. Perhaps you can accept that there is a uniquely American reason that these things need to be done, and at least stand aside and let us do it.
Speaking of standing aside, I'm 10 minutes late for an online meeting. β°
When I say "politically correct" (maybe a false friend from French) is not about politics, it is about using a new/other word when the old one is becoming controversial. Maybe you call that "respectful term"?
Is this ticket still relevant?
@thorny jay "politically correct" is a charged term to me as well because some use it to undermine the discussion. We are knowingly changing terms to be more inclusive and also more specific where we can. It will cause some confusion but we'll document it and teach it.
@prime flower I did not "freeze" the bme280 lib - I don't think that is a good idea since other sensors may be used but the demo code from the guide does run with my modified build. I finnally found my bme280! I will now work on seeing what I can ad back to the CP build and what I can do to reduce the size of the rfm9x lib... so far I have re-instated analogio and neopixel_write
We may be forgetting some sync-wait we need during the setup of the ADC. We may not need to change the ASF4 code.
Rather than requiring that USB_DEVICES be changed when CIRCUITPY_USB_HID and CIRCUITPY_USB_MIDI are changed.
If this passes the CI, then it will be okay to accept a different PR which actually uses the computed value. However, this PR is only being prepared so that the CI can check the intermediate state in which USB_DEVICES_COMPUTED is checked against USB_DEVICES.
If it is possible, it would be nice to avoid the need to change USB_DEVICES when changing CIRCUITPY_USB_HID and ... _MIDI. If #3037 passes CI, then this PR doesn't change anything about available USB devices, it just allows the value to be calculated in all cases.
(though of course it will fail .. there seem to be a bunch of boards that differ that I did not find in my pre-push checks .. mostly it looks like CIRCUITPY_USB_MIDI is enabled when USB_DEVICES doesn't have audio)
ah -- I was puzzled by why the pewpew10 build worked as it is currently written - it does not set USB_DEVICES.. ii turns out, it does not! I just built it for the current main and it does not boot to a CIRCUITPY drive -- similar to what I saw on the m0_rfm9x
I guess it has not been tested...
I think this also has to include the atmel-samd pewpew10 build
see comment in #3037
@tannewt I think that for the cases that are failing here, what we actually want to do is bring the CIRCUITPY_USB_yyy macros in line with the USB_DEVICES, rather than the other way around; they seem to be situations where some element of USB is disabled to cope with a board-specific limitation, whether it's memory or USB endpoints available.
The failed doc build pointed the way to quick checking for all ports locally.
ports/atmel-samd - 8086_commander: ../../supervisor/supervis...
I am trying to make a build of circuitpython for the cpx with an edited version of the circuitplayground library frozen into it. When I ran make I got these fatal outputs, but it did generate a firmware.uf2 file. Do these outputs indicate a problem?
Basically, the build process is checking that the version of each frozen module being included is a tagged release
if this is deliberately not the case and is printed just as a warning, I think you can safely ignore it
And/or is there some other step I need to take in order to make a test build beyond putting my edited code at frozen/Adafruit_CircuitPython_CircuitPlayground and running the make?
I think it says "fatal:" but doesn't impede the build finishing
I got a uf2 file and put it on my device but it seems like my changes aren't there.
Okay cool. I will poke around some more. Just wanted to make sure that wasn't telling me that it won't work.
Got it figured out, deleting the old build and starting fresh did the trick.
We won't be adding the external interrupt callback that MicroPython has.
At some point we'd like to support external interrupts as a sleep wakeup though.
Imagine that scene, I want to use a GPIO input (SWITCH) to control several funtions of a system, and maybe some funtions have delay inside. And how could check the SWITCH efficiently without External Interrupt in CircuitPython?
@ionic elk I'm encountering a hardfault on stm32f405 feather .. it looks like a hard coded number of ports doesn't match the hardware... I think I can fix it, but I just want to make sure I'm not out on left field. ```>>> import microcontroller
import digitalio
digitalio.DigitalInOut(microcontroller.pin.PD02)
at this point the serial connection drops and then if you're lucky you getYou are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.```
It seems that some code is configured to assume there are only 3 ports, but PD02 really is on the package and really is needed for SDIO.
The schematic shows that there are also a couple of "PH" pins but those have a dedicated function and should not be exposed via microcontroller.pin afaik
Oh shoot I totally missed PD2
it's the only D bank GPIO on the 64 pin packages
and yes, on everything but the super high pin count packages, H bank GPIOs are used for the oscillators only and aren't appropriate to expose
Anyway that's almost certainly the issue.
thanks, building and testing now
what's an example of a UFQFPN48 , should I double check if it has any oddball D bank pins?
STM32F411CG
and I don't spot a random D-bank pin anywhere there
no PD2 for sure
@onyx hinge I've checked a couple of them also...didn't find any D-Bank...but F was for the OSC...
Thanks @lucid solar !
hm my first stab at it didn't work
must be gremlins, I re-powered jlink and the board and it does work. so yay for small victories
@onyx hinge sorry stepped away. Nice!
I think PD2 is just one of these little easter eggs STM32 likes to leave in their everything
Pin PD2, which is used in SDIO and available for DigitalInOut use, was mistakenly left out of the microcontroller/Pin.c bank array, and accessing it would cause a hardfault. This PR correctly adds this bank to the package array.
So, I'm trying to checkout https://github.com/adafruit/circuitpython/pull/2918 with github CLI, and it's checking out something completely different???
Oh, I see, it's a micropython PR.
@hierophect hihi can we bump the STM stack size or was that done in a 5.4.x release? a customer is hitting the stack limit
This is probably a newer issue because I "fixed" the CIRCUITPY_ directives to remove TinyUSB code here: https://github.com/adafruit/circuitpython/commit/dcb0e50f040c4213a7591253cb3a0bb4ea9a178d
@ladyada yah STM32 stack size was bumped in 5.4.x to 24kb. I'd like to revisit it though and figure out why it's not dynamic.
Fix for stm32 was in #2866. Issue isn't closed since it includes the i.MX, which I haven't fully investigated yet (I know it isn't the same trivial fix that STM32 needed).
@hierophect ok so they just need to use latest 5.4? ill let em know!
@ladyada yeah let me know if it works! If anything goes wrong I'll put it at the top of my todo.
We don't need a dynamic stack when it's in a different memory region (DTCM or CCM) than the heap (DMA-able RAM).
@tannewt yeah I'd probably just add a check to exclude the F7 and H7 chips
It can't load a bin at all right? Otherwise you could do both UF2 and bin.
I believe you should also disable CIRCUITPY_USB_(MIDI,HID) for all of the things that disabled it in the descriptor. That will free up more space.
@jepler Yes, for cases where the compute is a superset, we should disable the corresponding CIRCUITPY define. That will free up code space.
@ivory yew hey I'm chasing down some stuff about USB devices and I found this: ports/atmel-samd - winterbloom_big_honking_button: ../../supervisor/supervisor.mk:138: *** Computed USB devices '"CDC,MSC,AUDIO"' different than hard-coded USB devices '"CDC,MSC"'. Stop.
I think that AUDIO indicates MIDI-over-USB. If so, should big honking button have it, or not have it?
Ya, a better response is that we should change unix.
None of these terms make sense to me. As someone who hasn't used pseudoterminals, they don't make it clear how they are used. Would emulator, subterminal be clearer?
This looks good to me! Thank you!
okay, noted, I'll address it.
thanks. :3
since Winterbloom stuff tends to be pretty specialized, I'm pretty aggressive about disabling features.
I have totally overlooked a fundamental issue: if the html file is stand-alone, and is supposed to get the data, how do you want to manage cross-origin requests? You need either a key from a provider, or your server has to allow that, and then you would have to host the data (files).
https://github.com/creack/pty/commit/7dc38fb350b1d71383eed149e73acb7bae231ddb (openpts for the go language) chose pty/tty, which are related to how the device nodes were named on old unix system.
This PR adds a gnss (Global Navigation Satellite System) module. It currently allows you to get positioning information such as: latitude, longitude and altitude.
Everything has been tested on the Spresense board.
This is only the basic version of the module. In the future I would like to improve it with new features.
@tannewt just spent a minute double checking this - yeah, loading a bin on it requires taking off the cover and soldering on a header for the SWD pins, and then using an external programmer like an STLink. It doesn't expose the BOOT0 pin (and shorts it to ground, as far as I can tell) so you can't load with USB DFU either. I think UF2 only is a safe bet.
@indigo wedge I haven't really touched mimxrt ADC yet, so this could be a dumb question, but why are pins B0_12 to B0_15 labeled ADC1? The RefMan says they're ADC2.
you mean in 1021?
i didn't make that pin def π https://github.com/adafruit/circuitpython/blame/241ef528417c266fd396f61763fdc65be99229bb/ports/mimxrt10xx/peripherals/mimxrt10xx/MIMXRT1021/pins.c
@ionic elk looking at the 1020 RM some pins can be used with ADC1 and ADC2
ADC1_IN2 GPIO_AD_B0_15
ADC2_IN2 GPIO_AD_B0_15
@indigo wedge no, the 1060. I'm working on the 1050 atm
ah sorry
i'd assume same situation
or i screwed up
very much a possibility π
@slender iron hi, do you have time for a vid chat re Blinka_bleio and ESP32 BLE?
@tulip sleet yup!
After exiting mp_hal_delay_ms() a check is needed to reset a ctrl-c keyboard exception; otherwise subsequent sleep() calls will return immediately.
@tulip sleet I'm not sure why it works but I've introduced a small degree of application level jitter into the Advertising and I can work around the bug/phenomena that I mentioned in yesterday's meeting. I put a graph comparing the two in a second post on https://forums.adafruit.com/viewtopic.php?f=60&t=166440
Continues off of #2918, adding support for the imx.RT 1052 EVK board. Fixes to this PR include adding the new reset register values (based on reference manual), never_reset flash pin protections, and an updated SDK submodule.
Currently not working - I don't believe the flash_config.c file is set up correctly. After loading the chip with a Jlink, the debugger reports a location that's partway into the program, not at the reset_handler as it should be. @arturo182 or @tannewt, do you have a ...
Hmmm.. anyone on the Blinka team know if mouse & keyboard can be read/reacted to on RPi?
@tough flax I don't know whether it's "built in" yet or not. If not, I have some Python code that works with general mouse/keyboard on Linux systems but it's not aligned to blinka yet
just some code from my far, far past that could be relevant
it's probably old enough that it needs python3 conversion
https://gist.github.com/jepler/f4bbcc5c1667753506ab994f36040a52 It's all my code, I will relicense it under the circuitpython license if it is of value to the community
Thanks! I have a user who is trying to use a touchpad (t650) to control a device. It seemed easier to use blinks than to try usb host mode with two devices.
I haven't used it with a mouse / trackpad in a long time, it may or may not work.
looks like it needs adaptation for current systems and python3
version that works with python3 (yay) https://gist.github.com/jepler/3fbf1ed75ae435361c38ce57838d8019
hey
I tested this again with 5.4.0.beta1 it has gotten much better but there is still some difference between the two playbacks.
The issues that I believed were similar that I had noticed on the Neotrellis M4 seem to be resolved entirely now. Perhaps they were not as connected as I had thought. #2996 might have been the relavent fix for the issue I saw on the Neotrellis I think.
Update: the issue is not present when doing a debug build. So it seems that something is optimised out or the timing is affected. Still diagnosing...
ho wont to go to voice chat?
@gentle bronze I'm having an issue with USB and the serial console on a nucleo board. When I run it in debug mode it's fine, but when it's using optimization the USB stops working. Do you think you could help me debug the issue?
For the RSSI stepping I mentioned in Monday meeting I just tested some boards from power-up and they appear to somehow synchronise within 8-11 seconds https://www.youtube.com/watch?v=TezUYj9Bobs
Two Adafruit CLUEs and two Circuit Playground Bluefruits (CPB) running a CircuitPython program which advertises and scans for 30 seconds when a button is pressed. The boards have been powered on in a random, staggered fashion with a few seconds between each one. The advertisin...
Thinking about this more, I don't really like the main/secondary name for SPI. I think "host" and "device" or "peripheral" are more descriptive. (The latter matches the name SPI.) It matches our existing model for bus devices as well. We can keep the MOSI and MISO names where we have them and simply document them in host and device terms.
There is a bit of weirdness around whether the code is the device or is talking to a device. The BLE apis have this challenge as well where a Charact...
I don't think this is right because it would prevent the keyboard exception from being raised and stopping the code.
@slender iron having been looking at the conversations online (there's a lot of them now that Github has swapped over from Master to Main), main/secondary is by far getting the most traction. Even the wikipedia page for SPI has it as a suggestion right now.
@slender iron I still think mark/scott is better π
@ionic elk I've nearly traced this bug with the nucleo. It seems that it's likely down to some alignment issues. Does it sound right to you? any thoughts pop up from related/past issues?
I've never had alignment problems, sorry
@slender iron Gitlab and Rails are already using Allowlist/Denylist, so I think there's better precedent there as well.
Ok...basically when I enable the middle line it causes the issue...it seems any time I access the i var. It's somewhere else in the code it fails...but this must be the trigger.
reserved_uart[i] = false;
} ```
It doesn't fail exactly...but it causes something else to not work. I've disabled all the lines that use reserved_uart...but left it inside the loop...and USB now works again.
I had an alignment issue in Zephyr that also caused something to stop working that was unrelated to the code I added.
Arm+Alignment+Optimization = headache
Sounds like the right approach. This is definitely a weird bug, because reserved_uart is basically only used for resetting the USART peripheral on a soft reboot?
Wait no, that's never reset. This is just for reserving UARTs from being used over each other
uart_taken = true;
continue;
} ```
that's the first time it uses it...and it fails there
You aren't actually calling any of this from python, right? It's created entirely within C
correct...the only thing python does is blinky...
and this is disabling USB somehow?
so right now, you've got a build where if you just don't reserve the UART, both VCP and USB work
something like that...but if I totally disable VCP...it still doesn't work.
What I'm trying to figure out here is whether it might simply be that VCP being on is causing the timing issues with USB, and that by removing the reservation system, you are breaking VCP in some way that is enabling better USB timing.
I thought that...but it can't be...I totally remove VCP and it still doesn't work.
Because there is an existing "bug"/missing feature in UART which is that the writes are blocking and don't service tusb while running - if you write a very large string, it might take so long that it breaks your USB connection.
I'm 99.99% certain it's not that.
Just double checked the routine. Can you check the state of the reserved_uart array before and after the problem?
or after the uart_reset function runs, I mean
Yeah...
Because yeah, definitely weird that writing all 0 to an unused array is causing USB to crash
@ionic elk so...if I delete the 2 lines from the if statement it works...if I add one back...either of them...it doesn't matter...then it breaks the usb again
Is there any difference from that and what you said before? Did you find out what the array was before and after?
It doesn't matter...it's not the value of the array that counts...it's the fact it reads that memory.
The value of the array is correct π I did check.
So it's 0 before and after? I asked because I was thinking maybe it was pointing to the wrong location in memory somehow
and overwriting something
@lucid solar basically, what I'm trying to figure out is whether this section of code is actually doing anything at all that could even possibly be causing a problem under normal circumstances. If it is in fact taking an array full of 0s (which it should be, in both the line 69 and 70 cases, if there are no UARTS declared as never_reset), setting some values to 0 again (thus changing it not at all) and still crashing USB, at that point I would say you probably have memory corruption. Maybe a dangling pointer somewhere.
@ionic elk can you reply on the PR so we can have the discussion there?
in which case you could check out where it's allocating the i variable to in memory and set a watchpoint on it or something
My preference is for the existing terminology as suggested. I've seen main/secondary gaining traction for SPI online following Github's main transition, and I strongly value the compatibility with existing acronyms, especially when considering 3rd party boards and libraries. I don't feel that Host and Peripheral are as beginner friendly terms as I think they are mostly familiar to people of a technical background.
For AllowList/DenyList, there's already a more concrete precedent, as [G...
Thank you for this! It's exciting to see more updates for cxd56.
Why would someone use stop over deinit?
Why not just have the constructor do all of this?
//| """Get updated positioning information from Global Navigation Satellite System (GNSS)
@hierophect My guess is that the flash data structures aren't correct and you are still in the ROM bootloader. You can use a logic analyzer on the SPI flash chip select line to see if code ends up being loaded off of it.
This fix does not stop the ctrl-c exception from being handled - the
exception is noticed in
mp_hal_delay_ms() as we are looping and counting ticks, where it causes an
immediate exit
from the function. Testing shows that with this pull request change sleep()
is still interruptible
with a ctrl-c. Hope this helps,
-Dave
On Wed, Jun 17, 2020 at 11:26 AM Scott Shawcroft notifications@github.com
wrote:
@tannewt requested changes on this pull request.
I don'...
My preference is for the existing terminology as suggested. I've seen
main/secondarygaining traction for SPI online following Github'smaintransition
Where? Are there examples of other hardware projects switching to it?
I don't feel that Host and Peripheral are as beginner friendly terms as I think they are mostly familiar to people of a technical background.
Why not? Main and Secondary feel like they could apply to anything.
For
AllowList/DenyList, there's already a...
@tannewt where could I find the configuration for that? On closer inspection of flash_config.c, it seems to be more or less identical across all the i.MX chips we support. I'll take a look at the SPI chip, but do you have a sense of which file I should be researching/tweaking to resolve the issue?
After sleep exits is the whole code.py stopped with a backtrace?
I'm happy to rework this PR to reflect whatever the consensus terms are.
I found this recently updated Microsoft docs page: https://docs.microsoft.com/en-us/uwp/api/windows.devices.spi?view=winrt-19041
SPI terminology arose in the 1980s, and so some of the language used in the standard is anachronistic. In this documentation we use the term host to refer to a device from which the clock signal originates; and peripheral to refer to a device that may use and forward the clock signal, but that doesn't originate it. Other documentation resources for SPI might us...
@tannewt I have not seen any other hardware projects adopt new terms for SPI - I'm going off the conversations, comics, proposals etc that I've seen on twitter/reddit/hackernews.
What I regard as most important is not breaking the acronyms. That's partially from a personal perspective - I don't think I could pull off using broken acronyms for my own projects, without the clout of company like Adafruit backing it up. Host and Peripheral strike me as server admin or USB terms, and I don't f...
@ionic elk I fixed it!!!!!!!!! π π :)
STATIC bool __attribute__((aligned (4))) reserved_uart[MAX_UART]; Just had to add the aligned attribute to that.
huh
I guess it gets joined with some memory that's USB related...and then it freaks out...I wonder...do we enable the MPU at all on STM32?
We have the MPU on the F7 and H7 series, yes, but only for broad swaths of memory
I'm not sure why it would be worrying about the distinction between USB and text flash
I believe my 'fix' isn't the right one...meaning that the USB memory should be aligned...not this one. But at least I'm getting closer.
I also found a small/medium, sized project here that looks to have gone with main/secondary: https://github.com/noopkat/oled-js/commit/20f7d8d86510ead599aad25fdb79495a0f29fe49
This is a diff between the memory maps of before and after the fix. It should help to find the memory that's not aligned correctly.
I poked around a bit more but have not really run across any other projects that have made the move yet within the context of SPI / I2C. It seems at this point there is lots of discussion ongoing, but not a lot of actual precedent set.
Personally I probably lean toward using main/secondary in order to reduce confusion with acronyms (MI, MO, MISO, and MOSI) that are printed as pin labels on some devices. However I do also agree they are somewhat vague so I am not staunchly opposed to host/p...
I just checked the website:
https://circuitpython.org/board/meowbit_v121/
It still does not have a .UF2 file to download.
@Mr-Coxall I think it may show up on the downloads page when there is a new release made. If I understand correctly the change has been merged into the repo but there hasn't been a new release of circuitpython yet since then so it's not visibly on the download page yet.
@ionic elk @slender iron So, the issue is...after using the reserved_uart variable (so it doesn't get optimized away), the memory is shared with the claimed_pins or never_reset_pins. Which means that the USB's reserved pins get reset at some point, so obviously it fails. Having those aligned to 4bytes...fixes the issue.
Expect a PR quite soon!
I'm going to condense my opinion down here and say that what I really care about is not breaking acronyms that appear on silkscreens - I think it's a significant obstacle to both new users and 3rd party developers. I would weigh the accessibility of the terms over their technical precision in this case, since the exact roles of SPI devices vary a lot anyway.
When compiling with optimizations on, an issue occurs where the claimed_pins/never_reset_pins memory location is shared with another variable. This causes some bad memory read, so the USB pins ended up being reset. Setting these to have an alignment of 4 bytes resolves this.
Tested on nucleo_f746zg
No, there is no backtrace. Current incorrect behavior also does not stop
the whole
code.py or generate a backtrace when a sleep() is interrupted with a
ctrl-c.
It just makes subsequent sleep() calls return immediately. Do I need a
call to mp_obj_print_exception() or some other function to generate a
trace? Thanks!
-Dave
On Wed, Jun 17, 2020 at 12:54 PM Scott Shawcroft notifications@github.com
wrote:
After sleep exits is the whole code.py stopped with a bac...
Wait, so the optimizer is causing an overlap of arrays? That sounds like a dangling pointer
@ionic elk no...it's static memory...
So why are they allowed to overlap?
They're not overlapping exactly...one sec...
The answer shouldn't be alignment, this kind of overlap should never be happening in the first place.
Can we video chat? should take only a couple of minutes for me to explain...
Sure, I'd like to get a sense for whether this could be affecting other STM32 boards
Ok...I'll go to my other computer (mic doesn't work on this..)
I'm in amelia
@ionic elk https://docs.google.com/document/d/1fyu_dsBDuDqXeeW4nAlbL50MVxkjPoHHh8c9jqBohVA/edit?usp=sharing
Create a new document and edit with others at the same time -- from your computer, phone or tablet. Get stuff done with or without an internet connection. Use Docs to edit Word files. Free from Google.
We could put "Main (host)" and "Secondary (peripheral)" in the docs as explanatory comments (or the other way around, depending on the actual API args, etc.)
@ionic elk @lucid solar as one of you mentioned, I would be suspicious that something else is unaligned (or the wrong length), and is overlapping into one of those arrays, not that the compiler needs it to be aligned. My very first PR to circuitpython was fixing a USB thing (in atmel-samd) that was mistakenly not aligned to a 4-byte boundary. https://github.com/adafruit/circuitpython/pull/118
@tulip sleet can you help me to understand what the conditions of this kind of overlap are? I'm just struggling to understand the context in which static arrays would need this kind of alighment protection
With a bug like this I like to understand why it came about and how to avoid it in the future and I'm really not sure of either in this situation.
@ionic elk i don't think these arrays themselves need alignment. I think some other storage adjacent or near to them is smashing them, perhaps due to misalignment. E.g., an on-chip peripheral is expecting an aligned block of storage, and it's not aligned. Or, the length of such a block is not a multiple of 2 or 4 or something, but should be, and so it gets overrun.
In other words I think aligning the uart bool arrays is a red herring, and is a second-order bug
It's the claimed_pins that are being problematic....not the uart arrays...
Which means USB pins gets reset.
I have other questions about that. Normally, reset_all_pins, which is the only thing that interacts with the never_reset array, doesn't run unless you soft-reboot. Is that the only time your USB problems show up as well? Or do they appear right away?
right away, but port_reset gets run twice it seems, something to do with clean_up_after_vm(?)
claimed_pins and never_reset_pins aren't attached to registers by themselves, they're just masks for pin searches and reset behavior. So them getting overwritten with new values shouldn't be a big issue in and of itself.
oh hmm yeah that'd do it
So USB gets set up after the first port_reset, and then gets reset in cleanup
ok
yeah
@tulip sleet my first impression of this is that it might be a dangling pointer allowing values to get overwritten. But would alignment actually resolve that?
i think it's an accident. Note in that file that the ports[] array is just before the pins arrays. so maybe that is being overrun or misinterpreted somehow. I'd look at the .map file generated by the linker to see what is adjacent to the pin arrays, in case there was some reordering.
another thing to test would be to insert a two element uint16_t array before claimed_pinsp[], to see if it makes the problem go away. You'd have to make sure it wasn't optimzied away.
green is with the alignment 'fixed'
also, @lucid solar, I'm wondering why reserved_uart would ever get optimized out, if the UART module is included in mpconfigport.mk. uart_reset is called by supervisor, and in turn uses reserved_uart, so I'm not sure how the compiler would think it's ok to get rid of it
@ionic elk no idea...but it does π
No wait...it works when it's optimized out
having it there causes the issue
Yeah but I think it could be related. Something about the contents of UART.c not being given the correct consideration by the compiler
i don't care so much about the diffs; please show me the original map file without the alignment. I want to see the adjacency
there is always a reason. There is a tiny possibility this is a compiler bug, but it's much more likely to be something else smashing the location. You could set a watchpoint on the arrays to see if they are getting smashed, and if so, where
@tulip sleet https://gist.github.com/k0d/4b16df1bb18e1b8fc132cc647a0ce351#file-foo-patch-L2147 I just found that this is the first part where it crosses a word boundry...happens to be the usb descriptor....coincidence? π
the usb descriptor might need to be word aligned, but isn't. I'm still having trouble reading the diffs, just show me the .map
the diffs are missing information I want to see
I'll get them shortly...I have to recompile with the issue etc...
if you have a debugger you can watch the location in memory you think is being corrupted, and any CPU access to it will act like a breakpoint
exactly
e.g., watch -l &reserved_uart[8] if you think something's touching the first byte past reserved_uart[]
but that means you have to have a good guess about exactly what is being touched that shouldn't be
you could also add some code that checks to make sure the values are what you expect (e.g. write your own watchpoint code)
@lucid solar which board are you compiling for? I can try it here too.
nucleo_f746zg
just checking, are you using a gcc 9 compiler
yeah...the one from 'brew'
@tulip sleet BTW, that BLE deafness occurs with just two devices chatting, My guess-a-workaround seems effective so I can make my application more robust using that: https://forums.adafruit.com/viewtopic.php?f=60&t=166440&p=816177#p816177
@tulip sleet
so these are all adjacent, which makes me think something's being overwritten:
.bss._setup_packet
0x000000002001a3c8 0x18 build-nucleo_f746zg/lib/tinyusb/src/portable/st/synopsys/dcd_synopsys.o
.bss.never_reset_i2c
0x000000002001a3e0 0x4 build-nucleo_f746zg/common-hal/busio/I2C.o
.bss.reserved_i2c
0x000000002001a3e4 0x4 build-nucleo_f746zg/common-hal/busio/I2C.o
.bss.never_reset_spi
0x000000002001a3e8 0x6 build-nucleo_f746zg/common-hal/busio/SPI.o
.bss.reserved_spi
0x000000002001a3ee 0x6 build-nucleo_f746zg/common-hal/busio/SPI.o
.bss.never_reset_uart
0x000000002001a3f4 0xa build-nucleo_f746zg/common-hal/busio/UART.o
.bss.reserved_uart
0x000000002001a3fe 0xa build-nucleo_f746zg/common-hal/busio/UART.o
.bss.claimed_pins
0x000000002001a408 0xe build-nucleo_f746zg/common-hal/microcontroller/Pin.o
.bss.never_reset_pins
0x000000002001a416 0xe build-nucleo_f746zg/common-hal/microcontroller/Pin.o
.bss.nesting_count
0x000000002001a424 0x4 build-nucleo_f746zg/common-hal/microcontroller/__init__.o
0x000000002001a424 nesting_count
@ionic elk do you know what _setup_packet is?
@tulip sleet @lucid solar Perhaps obvious, but you could also stick some blocks of known bytes in between / around to see if they get over-written.
maybe _setup_packet is the wrong size or is being overwritten. I know there were some buffer size issues in TinyUSB recently, but I don't know if they were related to this
@simple pulsar v good idea; easy to check
I'm going to take a break from this...will check back to it tomorrow.
@trim elm setup_packet doesn't sound familiar to me
i think it's just some internal buffer that we wouldn't know about without reading the code, but it may be set up by an API call.
@lucid solar Thank you for spending time on this. These kinds of bugs can be very diffcult to track. I apologize if I sounded too directive.
@onyx hinge Jeff, I have committed the sosfilt function to https://github.com/v923z/micropython-ulab/tree/sosfilter. If you tell me where I find the circuitpython stubs, and how you want to integrate them, I will take care of the documentation.
Oh, snap! You'll need this, too: https://github.com/v923z/micropython-ulab/issues/126
@lapis hemlock in the circuitpython source code there is shared-bindings/ulab. It has index.rst as well as a number of files called __init__.pyi
OK.
our doc building process and stub building process do .. stuff .. with it that I am not familiar enough with to really explain
I can't get this done tonight, but I will try my best.
er I guess index.rst is a generated file, my mistake
thanks for taking this on! There are not enough hours in the day/month/years
You tell me! Preaching to the choir...
@tulip sleet @ionic elk I've narrowed it down to these variables... .bss.never_reset_spi 0x000000002001a3e8 0x6 build-nucleo_f746zg/common-hal/busio/SPI.o *fill* 0x000000002001a3ee 0x2 .bss.reserved_spi 0x000000002001a3f0 0x6 build-nucleo_f746zg/common-hal/busio/SPI.o .bss.never_reset_uart 0x000000002001a3f6 0xa build-nucleo_f746zg/common-hal/busio/UART.o .bss.reserved_uart 0x000000002001a400 0xa build-nucleo_f746zg/common-hal/busio/UART.o .bss.claimed_pins 0x000000002001a40a 0xe build-nucleo_f746zg/common-hal/microcontroller/Pin.o .bss.never_reset_pins 0x000000002001a418 0xe build-nucleo_f746zg/common-hal/microcontroller/Pin.o *fill* 0x000000002001a426 0x2
@onyx hinge Is shared-bindings/ulab/... meant to be for documentation only? In other words, if we put these files on /v923z/micropython-ulab, where should we place them, so that we can get away with a single PR, if we change something in the docs?
in the case of ulab only, shared-bindings contains only documentation
in I believe all other cases, there are .c files instead which contain the "pyi" "code" as comments prefixed with //| , and no .pyi files are committed
@lucid solar so it's not the i2c never_reset and reserved?
bss._setup_packet
0x000000002001a3c8 0x18 build-nucleo_f746zg/lib/tinyusb/src/portable/st/synopsys/dcd_synopsys.o
.bss.never_reset_i2c
0x000000002001a3e0 0x4 build-nucleo_f746zg/common-hal/busio/I2C.o
.bss.reserved_i2c
0x000000002001a3e4 0x4 build-nucleo_f746zg/common-hal/busio/I2C.o
.bss.never_reset_spi
0x000000002001a3e8 0x6 build-nucleo_f746zg/common-hal/busio/SPI.o
that come before?
@onyx hinge If you want, we can incorporate the docs in the source code. I just would like to minimize the expenses on your side.
but maybe the i2c arrays are getting overrun past their bounds?
suppose you made never_reset_spi really large, but NOT a multiple of 4
@lapis hemlock It depends how much work you want to do, and how you weigh the value of having the docs and the source integrated in a single file. I think Tannewt values it highly; seeing it next to the code you're editing is a good hint that you need to keep the docs up to date
e.g. set MAXSPI to 130 or something
@tulip sleet it's never_reset_pins for certain