#circuitpython-dev
1 messages · Page 323 of 1
i dont
Me either
Waiting for Limor to make a Feather. 🙂
I do not have one
haha, ok. @keen fiber has a few he's willing to send folks
I just thought it was a question asked out of board-om. But hey, that's really cool too.
Also, is your latest revision of the Feather Adaptor board OK?
I haven't fully tested it but the usb works
not yet
I was late for the UnexpectedMaker release.
The one comming from Brazil will cost a fortune to deliver.
Is Arturo working on something too?
If anyone is in Seattle I have 2 pre-release featherS2s and i'm happy to give one away.
I have to saolas, happy to share one within CR or Centralamerica. Still don't have the feather adapter.
@slender iron I don't.
I'd like to make a Saola to Feather adapter... just to do it.
ok, hopefully Jeremy will reach out to you all
Don’t have one. Waiting for code to settle out a bit and see it take wings with a Feather.
@thorny jay which one is from brazil?
We already discussed that. Cat thing?
@slender iron I see on the site where we can order a PCB for the Saola to Feather (https://oshpark.com/profiles/tannewt), But that is just the PCB, right? What about the rest of the components is there a parts list someplace?
@slender iron is there a feather out/coming out?
There is not other part? This is just rewiring, and maybe the USB, and maybe a resistor or two?
@idle wharf that is just the pcb. but if you want one just get one from me. I have the parts too
there is a stemma connector and jtag connector too
optional of course
@ionic elk unexpectedmaker has one and limor will design one eventually I'm sure
In Belgium, when someone release a book, he need to send two copy to the state library. Maybe there should be a recommendation that when someone make a Feather, they send two copy to Adafruit, so that at least you can verify if a port is working.
For those with the pre-release UM FeatherS2's, Seon did say that the production boards will have pin changes. The Current builds work with the pre-release boards. I don't know if there will be two boards in the CP build system or if we'll need to manually modify the config and build for pre-release boards in the future.
hopefully two builds
@thorny jay I have verified that the stemma connector and led work on the v3 saola feather board
does the manufacturer need to request the USB IDs and such to get a board into circuitpython and circuitpython.org? Electronic Cats (Bast WiFi) will need a board def, and Gravitech Cucumber (one version is, afaict, Saola compatible, but another has onboard I2C peripherals and therefore pin commitments)
@slender iron how do you tend to trace resets with GDB? Something in DisplayIO is causing a complete hard reboot of Circuitpython on the STM32 but I can't pin anything down from the reset handler
@ionic elk often I find the backtrace is damaged but I have one stack frame with a routine name. I set a breakpoint there.
I don't have anything in this case, unfortunately
Just, "reset handler"
It's something in release_displays that shuts down the entire board - where even is the define for that? it isn't in shared-bindings/displayio/display.c
can you just set a breakpoint at release_displays, and then single-step ("n")
figured I'd try and break on that and then just step until it blows up
there we go 🙂
ah it's in the init.c, that's why
When I accidentally trigger Single stepping until exit from function Reset_Handler by trying to step from reset_handler, is there any way to recover GDB? Seems like it just hangs without being able to take any input
@ionic elk can you just ctrl-C? If not, it's something bad. You could also try disconnecting the J-Link which might cause it to get upset and go back to the command prompt.
Yeah I often get crashes with GDB that I can't ctrl-C out of, I was wondering if there was some trick that didn't involve power cycling or closing my terminal tab
Anyway sorry for clogging the channel with questions, this current Meowbit bug is quite frustrating so I might be projecting a bit
I'm running into an issue with displayio dirty rectangle tracking. I'm creating a first bitmap (self.bitmap) and put it in a group. Then I create a new bitmap that is pointed to by the same name (self.mybitmap). However, displayio doesn't realize that the content of the bitmap has changed. I think this is because the dirty rectangle tracking doesn't get triggered when the first bitmap is deleted and the new bitmap is created.
I can get the display to redraw the image, but only if I pop the bitmap's tileGrid from the group and put it back in the group. But I need this bitmap to updated automatically without fiddling with the group.
Do we need a function to "dirty" the bitmap rectangle when it gets deleted? Is that even possible for CP to react automatically when a bitmap is released? ...In reality the bitmap doesn't exist anymore so how could it retain a dirty rectangle?
i also have it hang when doing tab completion. It is not really hanging, it's just doing a very long search. have to wait 10's of seconds for it to come back
@mental nexus are you actually replacing the bitmap in the group? If something else has a reference to that, it will not change what the group is holding on to. An object reference is a pointer, so changing one reference will not change the other.
e.g. group has a ref to bitmap A. Object X also has a ref to bitmap A. Changing Object X ref will not change group's ref
I've got a tileGrid that holds a bitmap_label and I'm adding a setter to change the text, to regenerate the bitmap inside the bitmap_label.
Basically, I'm rerunning the bitmap_label's init function to recreate all the internals, including the tilegrid and bitmap inside the tilegrid.
is the gorup holding the tileGrid or the bitmap_lable?
Group is holding the bitmap_label, which is a subclass of a group.
This bitmap_label(a group) holds a tileGrid which holds a bitmap.
Then I have a higher level group (with 4 labels) that I display.show.
my_group=displayio.Group(max_size=4)
my_group.append(rainbow_tile)
my_group.append(text_area2)
my_group.append(text_area3)
my_group.append(text_area)
display.show(my_group)
I change the text in text_area (which is a bitmap_label).
If I ungroup text_area and regroup it, then it shows up ok.
I think displayio doesn't realize that it needs to updated the screen with the new bitmap.
Or is there a way to force the display to redraw everything? I tried setting
display.auto_refresh=False
display.auto_refresh=True
but that didn't work.
changing the contents of a group should trigger a refresh
you're not supposed to be able to change a BitmapLabel's text
@text.setter
def text(self, new_text):
raise RuntimeError(
"text is immutable for bitmap_label.py; use label.py library for mutable text"
)
! Yep, I'm working to make it mutable so it will be more like label.py
Hmm... Ok, I'll make a simpler example to evaluate it. If I can't get it to work then I'll raise an issue.
note that deleting a bitmap won't delete it because it's still referenced by the tilegrid
I am toggling the text between two different strings, and I see the memory usage alternate back and forth (after a gc.collect). So, I think it's actually getting deleted, but I could be wrong. I'll make a simple example and then go from there.
@slender iron I'm trying out your requests on FeatherS2.
pool = socketpool.SocketPool(wifi.radio) is giving me an error: ValueError: SocketPool can only be used with wifi.radio.
Prior to calling SocketPool, I do connect.
print("ip", wifi.radio.ipv4_address)```
But it prints NONE and then I have an IP...
are you in the REPL?
hrm
But I could be in the REPL
I've only heard about the socketpool error in the repl
connect should return none on success. it'll raise an error otherwise
Got it.. for some reason I thought I saw it return True in the past.
Could Saola v. FeatherS2 have any impact ?
ya, it used to return a bool
but I changed it last week
the wifi.radio check should be very simple so I'm not sure why it's ever an issue
you could just comment it out 🙂
yup
K, I'll go try that
Did we change something about how we handle "auto_brightness" as a DisplayIO setting? Just figured out that it was disabling the screen on the Meowbit (among other issues) but I'm puzzled as to why it didn't when the board was first being developed.
This PR issues a number of bugfixes related to the Meowbit STM32F401 development board. These include:
- Meowbit configuration file was incorrectly altered to include a low speed oscillator (LSE) resulting in a looping hang at startup. Fixed by removing this reference.
- In general, boards with a LSE configuration problem would unsuccessfully attempt to auto-recover, making an already confusing problem worse. This "feature" has been removed.
- A null pointer dereference in `common_hal_p...
Hmm... Ok, I think it's sinking in a little about the tilegrid reference issue. If I create a new bitmap, the tilegrid still references the old bitmap reference, even though the name of the new bitmap is the same as the old bitmap? So is there any way of changing a bitmap inside a tilegrid (maybe even changing the bitmap x,y size) and making it keep the same reference?
Here's my test code. I can only get it to redraw if I call again display.show(myGroup) after modifying the bitmap and tilegrid. https://gist.github.com/kmatch98/0cfd1a2a5ae4dab7969ccef01be4b797
I'll be back.. my code was a mess. 😉
@slender iron Ok commenting out the check works... HTML request, JSON request and a 404 (on purpose this time) also worked fine.
void common_hal_socketpool_socketpool_construct(socketpool_socketpool_obj_t* self, mp_obj_t radio) {
// if (radio != MP_OBJ_FROM_PTR(&common_hal_wifi_radio_obj)) {
// mp_raise_ValueError(translate("SocketPool can only be used with wifi.radio."));
// }
}
for fun I tried bad_pool = socketpool.SocketPool("this is bad")
And got Bad Session... which doesn't seem horrible.
nice!
@mental nexus correct, the name isn't used by the tilegrid to know the bitmap. you should just create a new tilegrid for a new bitmap
In my color setter I create a new Bitmap, a new TileGrid and a re-init the self Group (super.init) and re-append in the new TileGrid. But I still have to call display.show(myGroup) for it to update on the screen. Is this a reference issue or a displayio dirty rectangle issue?
Oh, just got it! I shouldn't re_init the self group with super().__init(). Instead I should just pop off the tileGrid and append the new one into the self.
I guess this is the difference between mutable and immutable objects..... Still a lot to learn! Thanks for the guidance pythonistas!
How should we think about core modules for CP in relation to the EPS32S2 port?
For example RTC (which is a requirement for NTP). Is there a checklist of done, not started, assumed no work, etc.. or should we just ask as we see things ?
You can schedule a workflow to run at specific UTC times using POSIX cron syntax. Scheduled workflows run on the latest commit on the default or base branch. The shortest interval you can run scheduled workflows is once every 5 minutes.
This example triggers the workflow every 15 minutes:
on: schedule: # * is a special character in YAML so you have to quote this string - cron: '*/15 * * * *'https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onschedule
It seems like it should be adabot-patchable to add "run the workflow on the main branch daily/weekly, to make sure we hear about pylint / other background changes that would affect releasability of bundle libraries. Thoughts @idle owl @raven canopy ? Should I file an issue in adabot where we could discuss it?
A workflow is a configurable automated process made up of one or more jobs. You must create a YAML file to define your workflow configuration.
@onyx hinge Definitely file an issue on Adabot for discussion.
@idle wharf we usually track with github issues. there is an esp32s2 label where they should be
if they aren't then please file an issue there
thanks !
Here is the notes document for Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1fzARe32tu1diEPjFla3ipsz6jJehwYHlF7LYdjLaMYw/edit?usp=sharing
Thanks @slender iron
np 🙂
What was the lowest pull up resistor value that you used? The rising edges will be more vertical with lower resistor values. I was using 4.7k resistors when I tested it but I know 2.2k is also used when the bus has high capacitance.
The falling edges are dictated by the micro's ability to drain the charge from the bus and is usually not a problem.
The background tick changes were left in because frequencyio/FrequencyIn.c still depends on them. Should we look at changing that as well? I don't have a FrequencyIn test, though.
I think we should worry about FrequencyIn separately and keep this PR simpler.
FrequencyIn is pretty easy to test with a PWMOut from a second board. It's less critical if it stops as well because it will have done a measurement already.
It does not look like you can manage or use any system time with RTC.
Note: This is the lowest level dependency as I work up the stack to using the Azure IoT Library.
Board: FeatherS2
Build: 08-23-2020 Code built locally
>>> from adafruit_ntp import NTP
Traceback (most recent call last):
File "", line 1, in
File "adafruit_ntp.py", line 40, in
ImportError: no module named 'rtc'
>>> import time
>>> time.time()
Traceback (most recent call last):
File "", ...
This looks great! Thank you!
I'm not sure I'd do this here. The VM should be handling every pending exception to print the traceback or clear it silently. Is there an exit from somewhere that could clear it instead?
@daveputz I've invited you as a collaborator to CircuitPython so you can review this PR and others. :-)
Ok, everything is passing now. Please take another look.
haha, ok. @keen fiber has a few he's willing to send folks
@slender iron I have some esp32-s2's and the v1 of the feather board, PM me your address and I'll send them out. Not sure if I can send overseas, will depend on the cost, that gets very expensive very quickly, but I'll try.
microDev1 microS2 VID 0x239A
PID 0x00C5 # bootloader
PID 0x80C5 # arduino
PID 0x80C6 # circuitpython
I have one very minor question/comment about include style but it looks good to me. Thanks for putting this together.
This file is different than the other PulseOut.c files in common-hal, in that it appears to access the pulseio file include through "shared-bindings/pulseio/PulseOut.h". Should we make that consistent across all files, or add in a direct reference to pulseio in the spirit of include what you use?
Could be revisited as part of a more general inclusion style review.
I'll try a control from main today. That error indicates some kind of invalid memory access, but not a null dereference as per EXCVADDR being nonzero.
@tulip sleet do you happen to have a STM32F405 feather on hand?
Conversely @onyx hinge do you happen to have a linux machine?
@ionic elk yes I do
Do you think you could try the STM3F405 feather on it? Trying to verify https://forums.adafruit.com/viewtopic.php?f=60&t=168430
I use my STM32F405 feathers on linux exclusively, but I'll take a look at that post
I unfortunately have neither a windows 8 machine or a linux
I'm trying it on Windows 10 just to check
yeah my stm32f405 CIRCUITPY drives mount fine on debian buster with kernel 5.2.17
interpreting their last message >>> storage.erase_filesystem() Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Hardware busy, try alternative pins something's wrong and I don't think it's the OS that is trying to mount CIRCUITPY
Tried this PR on both a Clue and PyBadge, when running the test in issue #2689 I get:
...
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
MicroPython NLR jump failed. Likely memory corruption.
I would expect we would just return to a REPL prompt.
Ya, generally it's better to include what you use but ensuring that in a manual way is impossible. I think this is fine for now.
@onyx hinge hmm, that error message is related to something being reserved in never_reset.
I wonder if they have something in their code.py that is actually reserving something about the flash access. That's a pretty harmful edge case that I'd like to cover... @slender iron is it possible for someone to put something in their code.py that actually disables their ability to delete their code.py?
@ionic elk I answered in the thread about the drivers, but I have no idea about the "alternative pins" message. I have never seen that before.
That's an error that occurs in BusIO when the pins are reserved for an SPI, I2C or UART bus. It implies that something is actually conflicting with the access to NOR flash.
Totally a guess by inspection, but ..
supervisor_flash_init calls spi_flash_init which will create the SPI bus object. but if the JEDEC ID isn't read back, it returns without setting flash_device to non-NULL
each subsequent call to supervisor_flash_init will AGAIN call spi_flash_init, which would then fail in that way
so I bet that e.g., if you popped the SPI flash chip off, or source code changed it to use the wrong pins, you could get no CIRCUITPY drive appearing, no os.listdir('.'), and that error message from erase_filesystem()
Interesting sleuthing!
Probably worth testing, though it would require me to ruin a feather, presumably
I think you could just swap the SPI buses in the board config
or just change the CS to be the wrong pin, leaving the rest of the bus settings intact
I don't want to disturb either of my stm32f405 feathers if I can avoid it
Yeah it'd be nice to have an alternative program we could load up that serves only to wipe the drive so it can't mess with a fresh Circuitpython install
Maybe I should make one in Arduino or something that you can just pop on there with DFU-Util
It seems like maybe a not-good thing for you to be able to totally wipe the actual SoC but still be vulnerable to software issues because the NOR flash isn't empty.
Yeah same here. My testing concentrated on what happened during sys.stdin.read() or input(). During a long running print operation, or a long running math operation (17 ** 17777) my code causes a crash (into safe mode, if you're lucky).
Thanks @DavePutz -- please take another look at this PR if you've got time. I've updated it with two additional sites to check for KeyboardInterrupt. They eliminate the safe mode resets I was able to reproduce, both printing large objects (a la #2689) and doing a long running calculation (l = 17 ** 1777). The long running calculation and the print of the long int that it results in are still not interruptible, but the KeyboardInterrupt is still handled when completed which also prevents ...
As noted by @jepler, spi_flash_init within supervisor_flash_init is responsible for creating the NOR flash device based on pins assigned in the board profile. However, if the JEDEC ID is not returned by the NOR flash, no error is currently logged, allowing the device to proceed as if it has a filesystem but without any actual filesystem capabilities. This could be altered to emit some form of failure mode to inform the user that there is a hardware issue with their NOR flash.
This PR adds the TRNG to ESP32-S2, based off the cxd56 implementation, which has a similar system call. This will enable use of os.random().
It also fixes a serious but overlooked issue with the STM32 os.random call where it would not supply values past the first 8 bit number. (Yikes!)
@onyx hinge I feel like I've asked this before but should we enable ulab for ESP32?
Or does it have port specific features that need to be implemented?
Also, just kind of broad question here - should we have a link to the ReadTheDocs on Circuitpython.org? Seems kind of funny to me that we don't, I'd figure it'd be handy to have as a header link right there next to Downloads
Sounds like a good idea. You could open an issue on circuitpython-org
re ulab: it's port-independent, as far as I know, so if it would fit, great!
Cool, I'll do both.
This PR enables ulab for the ESP32-S2, since there's no reason not to.
@tidal kiln mind taking a look at this: https://forums.adafruit.com/viewtopic.php?f=60&t=168474&start=15
I'm not sure how to help them further
thanks
@slender iron yah, i can take over that one. responded and will monitor.
thanks!
@tulip sleet FYI -- I am working o getting some Salea pictures of the SPI issue I am having with the RFM69 baurdrate. It's a bit tricky to capture what I want -- so many transactions.... but -- I was working on a port someone made for running the rfm69 code on MicroPython and ran into the a similar issue! I also had to slow it down to 1MHz to avoid what appears to be some bits getting "Shifted"... Not sure if that is a clue but it is interesting that it happens there as well. I am going to update my open PR to adjust the baudrate and add some other changes as I continue the investigation.
@solar whale that is interesting! good luck! Does the data going to the RFM69 look ok, or does it look corruped? ... or I guess, that's what you're trying to discover
@slender iron is it possible for someone to put something in their code.py that actually disables their ability to delete their code.py?
@ionic elk Wait, that would actually be a great feature. I am interested in ways to freeze a project in a CP board once it is perfect. Making CIRCUITPYTHON read-only, or not visible or any way to prevent end-user to break it.
still not sure -- I need to find a good way to catch it " in the act" -- may need to add a signal that I can toggle for a trigger when the issue occurs
One request about the board id. Otherwise it looks good. Thanks!
Please rename the board name to include your brand as well as the board name so microdev_micro_s2 or something similar. I'm expecting many S2 boards and micro_s2 is pretty generic on its own.
@thorny jay you can make the drive read-only from the computer in boot.py
Yes, thank you. And there are some learn guide that link that to the state of a GPIO so that you can unblock that when needed.
Want to do a for loop here too? It will likely speed this up because it'll use all 32 bits from the lower level instead of just the first 8.
It looks like this is only truly random when WiFi or Bluetooth is on: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/system.html#random-number-generation
Do you think it's worth accounting for that?
I noticed that but I wasn't sure what the best philosophy here would be. If you know a flag I can check to see whether Wifi or Bluetooth is on, some bool is_wireless_on() equivalent, I could have this return false until it's true. Or I could throw a custom error to make it clear that they can get TRNG by enabling wireless.
I didn't even bother to check that that function returns a 32bit number, good point. I'll swap it over to match.
If speed is a concern, do you want me to add in some way of keeping the TRNG on rather than enabling and disabling it every time? Or is that NBD?
@tulip sleet hmm -- also FYI -- lowering the baudrate on the Raspberry Pi from 5MHz to 1 MHz significantly degrades its performance...lots of missed packets. Nothing is ever simple.
or maybe something else going on -- never-mind ...
@jepler I'm fixing this today. Do you think you could provide me with a test sketch I can use to verify the fix? Something with a clear differentiation between the desired/undesired behavior. I can use my logic analyzer to view the same waveforms you did if you give me that same sketch. If it's just the same one jerryn provided let me know.
I don't know what the right answer is here, but pseudo-random is fine for many purposes other than cryptographic. Users can also seed with their own entropy. It would be a shame to disable random completely when wi-fi is not up. Maybe an alert in the docs would suffice.
I'd like to understand the significance of write_value a little better - most of the ports ignore it, and the ones that don't pass it directly into their SPI HALs. Is there something that STM32 does here that's nonstandard?
@onyx hinge This is has been a "Known issue" for a while in the release notes, but is it now fixed with the advent of C-based sdcardio?
displayiooperations that read from an SD card (e.g.,OnDiskBitmap) will interfere with other SD card operations and can cause lockup. To work around this problem, do not read or write files on the SD while the display is updating, and vice versa.
@tulip sleet I believe based on the structure of the code -- but never actually tested -- that the displayio caveat applies only to adafruit_sdcard, not to sdcardio or sdioio.
I think that's true too. I will try to rephrase it to direct people to use sdcardio.
thanks!
@onyx hinge Sorry, another question. The weblate PR's sometimes include the contributor, and sometimes not. I would like to give them credit. Could you point me to a weblate URL that would list them?
good question! I'll take a look
@tulip sleet there's a report I can generate, you may not have the privileges to do it... I'll get you a report starting july 23 and then figure out if I can let you do it yourself
sorry, I'm going to redact that to remove the emails, just another second
thanks. I have the major additions in the PR's
-
Portuguese (Brazil)
- Wellington Terumi Uemura (70)
-
Japanese
- Taku Fukada (776)
-
Dutch
- _fonzlate (39)
-
Spanish
- dherrada (2)
- Alvaro Figueroa (49)
-
French
- Nathan (18)
-
Swedish
- Jonny Bergdahl (15)
i have some of those; maybe I don't have ones who don't have a github ID? Or they haven't ID'd as that.
@tulip sleet did you create a login on weblate? you should be able to just log in with github
yes, i did, some time ago.
Yes I suspect people who don't "log in with github" probably don't get listed as author. not sure though.
can you DM me the e-mail or weblate user id you used?
it doesn't seem to be weblate user dhalbert
i seem to have logged in as other than github. I'll get it to you.
aha there you are
you should have administrative access now. To get this report, it's under "insights" > "translation reports" https://hosted.weblate.org/projects/circuitpython/main/#reports
I seem to be halbert?
YOU ARE HALBERT.
🤖
my thought exactly
bingo, I have the report tyvm
I'm happy to add anyone else who would be doing releases, just ping me
I don't know what the right answer is here, but pseudo-random is fine for many purposes other than cryptographic. Users can also seed with their own entropy. It would be a shame to disable
randomcompletely when wi-fi is not up. Maybe an alert in the docs would suffice.
Circuitpython's built in random module is already pseudorandom, and should activate automatically when urandom is not available. But urandom itself is supposed to be TRNG (True Random Number Generation), and is repres...
@anecdata are you using the random module? You should still be able to access pseudorandom numbers without this specific OS feature. I may have mistaken CIRCUITPY_RANDOM for standing in for the TRNG when it was actually a flag for both. If that's the case, once it's re-enabled you'll be able to get pseudorandom values even when TRNG is turned off.
@ladyada What module does your Saola have? Does it have PSRAM? I suspect your issue may not be related to this PR.
Sorry, yes, I conflated the two since the random module went away from esp32-s2 in a recent build, and I don't think os.urandom() was present either. So I think it will be all good. Thanks.
Sorry, yes, I conflated the two since the
randommodule went away from esp32-s2 in a recent build, and I don't thinkos.urandom()was present either. So I think it will be all good. Thanks.
That was probably my fault, I removed CIRCUITPY_RANDOM because I thought it was the flag for the TRNG only. It must have also disabled the pseudorandom numbers, which I didn't intend.
Tested on PyBadge, Clue, and esp32s2. All look good. Thanks, @jepler ! This also fixes issue #2689 and thus PR #3312
Fixed by PR #3318. Closing.
@onyx hinge you online?
more or less
I was hoping to ask you how you got those logic analyzer readings for the SPI issue on the SD card. Where did you attach the probes?
stm32f405 feather's built in one?
I'm really not sure what's going on with it - I can't seem to turn up anything for "write values" or anything of that sort
anyway https://www.sparkfun.com/products/9419 in some cases
yeah
that'll let you stick yourself in the middle of anything that's microsd shaped
Ah, I'll try and pick one of those up. So you use that with the feather's exposed SPI line
if it's a breakout or what have you, then using stacking headers or something would be good
is it this issue you're looking at? https://github.com/adafruit/circuitpython/issues/3176
I'm very puzzled by this issue because this write value thing is ignored by every port except atmel and i.MX... so it seems weird to be something to mess up. And I don't have any examples on "doing it manually" or something like that
Yeah that one
probably since that was with the adalogger featherwing I just used both of them in a breadboard or something like that
huh that would seem to mean that sdcard wouldn't work except on samd and i.mx....
I'm wondering if it isn't the write_value and instead something like needing pullups, or it's sending the wrong data...
Well, you tested it on the NRF, which completely ignores it. So clearly it's doing it automatically or something
one idea that had occurred to me was: the important values to support are 0x00 and 0xff. so you could switch the pin away from being a special function, set it to TRUE for 0xff and FALSE for 0x00 .. then if some oddball wants 0xaa you just throw an error "hardware can't do it"
I'd have to do that in the middle of the transaction though, which isn't possible
I agree, nrf doesn't consult that parameter at all
or it is but I'd have to write my own SPI register code, I can't do it with the HAL. But like I said this all seems weird and it doesn't seem like it should be required. It isn't mentioned in the docs or on the wikipedia page for SPI
Oh? Hmmm. I'll add that to my searches and see if I can turn anything up
http://elm-chan.org/docs/mmc/mmc_e.html is my main reference for SPI SD card interfacing
AHA. here is a topic on it, I just had to add in the SD part to my googling https://community.st.com/s/question/0D50X00009XkdpZ/sd-card-using-spi-initialization-stm32f303-issue
in diagrams like this http://elm-chan.org/docs/mmc/i/rm.png where DI (that's in to the SD card) is high, I think it really means high
neato
The DI signal must be kept high during read transfer (send a 0xFF and get the received data).
Yeah here's a reply in that thread:
*The porblem is in the SPI HAL function for receiving.
The SD cards are expecting an 0xFF value on the MOSI Pin, so the SPI has to send 0xFF when receiving the byte answer from the card (or MOSI has to be kept HIGH for the 8 clocks) and that is not necessarily the case with the HAL_SPI_Receive function.
To solve it, one should use the HAL_SPI_TransmitReceive function like this:*
uint8_t MySPI1_ReadByte(void){
uint8_t ReceivedByte = 0, Dummy = 0xFF;
while ((HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY));
HAL_SPI_TransmitReceive(&hspi1, &Dummy, &ReceivedByte, 1, 5000);
return ReceivedByte;
}
That's similar to what I proposed in my patch, except I allocated a buffer as big as the send buffer which was awful. but doing one byte at a time seems awful too.
The DI signal must be kept high during read transfer (send a 0xFF and get the received data).
-- from my reference
What I can do is maybe put in an if statement if the write_value is high, and only do this weird hack if it is
that would be every SPI SD operation
right, but it won't impact other SPI use
I can also maybe check and see if Micropython does something different.
Anyway, thanks for your help!
you're welcome. any of that I should add on to the bug report?
I'll add stuff on as I progress. I've got a bug journal going
I'll link the issue I found on google.
Looks like this is a limitation of the ST HAL in regards to handling the MOSI line when using an SD card.
https://community.st.com/s/question/0D50X00009XkdpZ/sd-card-using-spi-initialization-stm32f303-issue
I'll look around for other workarounds since this one seems kind of slow. Micropython, STM32Duino, and even the ST FatFS library must all deal with this issue somehow.
index 0354d64ad..f54da9439 100644
--- a/ports/stm/common-hal/busio/SPI.c
+++ b/ports/stm/common-hal/busio/SPI.c
@@ -349,7 +349,39 @@ bool common_hal_busio_spi_read(busio_spi_obj_t *self,
if (self->miso == NULL) {
mp_raise_ValueError(translate("No MISO Pin"));
}
+
+ // Set the miso pin back to GPIO and drive a value on it
+ if (self->mosi) {
+ if (write_value != 0 && write_value != 0xff) {
+ mp_raise_ValueError(translate("Only write values 0x00 and 0xff are supported"));
+ }
+
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ GPIO_InitStruct.Pin = pin_mask(self->mosi->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Alternate = 0;
+ HAL_GPIO_Init(pin_port(self->mosi->port), &GPIO_InitStruct);
+
+ // set the PIN to HIGH if write_value is 0xff, LOW if it is 0x00
+ HAL_GPIO_WritePin(pin_port(self->mosi->port), pin_mask(self->mosi->number), value);
+ }
+
+
HAL_StatusTypeDef result = HAL_SPI_Receive (&self->handle, data, (uint16_t)len, HAL_MAX_DELAY);
+
+ // set mosi back to its special function
+ if(self->mosi) {
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
+ GPIO_InitStruct.Pin = pin_mask(self->mosi->number);
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
+ GPIO_InitStruct.Alternate = self->mosi->altfn_index;
+ HAL_GPIO_Init(pin_port(self->mosi->port), &GPIO_InitStruct);
+ }
+
return result == HAL_OK;
}
something like tihs, which I wrote but didn't compile-test
or do it just for 0xff even, if it's expensive
my intuition says even if HAL_GPIO_Init is a bit expensive, it's less so than 512 separate 1 byte SPI reads
ICBW and I'm happy to hear it if I am
It might be possible to just run HAL_GPIO_WritePin(); without changing the altfn
Anyway I gotta run for a class. I'll try this tomorrow.
see ya, thanks for looking at it!
@ionic elk did you look into Limor's S2 problem at all?
@DavePutz thanks! To actually complete the review there are a couple more steps. Easiest is to: click "files changed", click "review changes", click "approve", click "submit review". Once there's an approving review, someone can actually merge the PR.
@idle wharf just pushed a fix for the wifi.radio error
😄 I have updates to adafruit_requests as well. will push those shortly
Question, do I have to have the submodule updated for CP when you make that kind of change or just the new library in my /lib on the device ?
I'm referring to the things in Frozen
@slender iron
Bad code on purpose
print("\nBad Session")
bad_pool = socketpool.SocketPool("this is bad")
SocketPool error again... but only on bad pool (i.e. not a wifi.radio).
Bad Session
Traceback (most recent call last):
File "code.py", line 40, in <module>
ValueError: SocketPool can only be used with wifi.radio.
I don't have your new requests obviously
Ha... yesterday when I said it prints Bad Session... oh that was my print.
And that error is what we WANT to see. Got it.
So my failure test case was handled correctly.
All is good. Ship it. 😉
ya, you can only supply wifi.radio atm
0 based index fix.
heh, yup
Exciting to see so much lighting up on the S2. Thank you !
Just a few questions. Nothing major.
Is this reusing the struct from the SD?
Should we raise an exception when the Characteristic is remote? Do we raise NotImplementedErrors in the cases that aren't implemented yet?
Please include the commit here too. That way we can track any fixes/changes to upstream.
This is our own definition, but it used the SD structs internally. It's actually empty now:
typedef struct {
// ble_gap_enc_key_t own_enc;
// ble_gap_enc_key_t peer_enc;
// ble_gap_id_key_t peer_id;
} bonding_keys_t;
I could have commented a lot of this out completely, but I tried not commenting out everything, in order to allow some code to still stand uncommented. However, its doesn't really matter.
Currently the scanning and connection routines raise NotImplementedError, so there's no way to even get to this path in the code, because there's no way to create a remote Characteristic. So I didn't bother to add raises in cases like this.
Include the full name here too (with "microdev", capitalized correctly). For instance, one of our boards is the "Adafruit Trinket M0".
Thanks for your suggestions. I made the necessary changes to include microDev in the board name.
Thanks for your suggestions. I made the necessary changes to add microDev to the board name.
It would be great to have secondary USB-serial channel
for bidirectional interface to external RX/TX pins
(possibly also other control lines RTS CTS etc if techology allows)
This would replace need of additional USB-serial cable.
I downloaded this
Adafruit CircuitPython Saola-1 WROVER board
and tried to get free memory but about 64K is free where 2MB PSRAM
should be on WROVER board
import gc; gc.collect(); gc.mem_free()
63792
Is there some recommended pinout (schematics) to
connect and example commands how to mount SD card
to Saola-1 WROVER module?
I'd like simple example how to mount SD card in 1-bit (SPI) mode
(pin saving) and 4-bit (MMC) mode (faster).
Hey @emard the ESP32-S2 support is still in progress but good news the PSRAM support is in this PR: https://github.com/adafruit/circuitpython/pull/3315
I will continue following this PR thread so we can close this issue
I built the saola-wrover with this but I don't see the ulab module. Do I have to do something else?
The build was failing due to some trailing whitespace in a few files. I edited most of them in github, but making the sdkconfig file empty in github failed (some kind of github bug). So I cloned and pushed the changes.
@microDev1 If you can set your editor to automatically delete trailing whitespace on save, that will prevent these kinds of minor issues. Some editors have a setting, and some have a plugin to do this.
@dhalbert Just added PSRAM support to sdkconfig
I tested PSRAM support on microS2 and it works. 👍

Hi, you need to pull my changes from your repo, since your push put back the trailing whitespace.
woohoo! just tried pr_3315 -- PSRAM on esps32s2 on saola_wrover ```
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.2-358-gf39708abb on 2020-08-26; Saola 1 w/Wrover with ESP32S2
import gc
gc.mem_free()
2048784
seems to be working OK -- with blinky and I2C sensor test OK
Has anyone else tried importing ulab on an esp32s2 now that is enabled in main? When I build it, it still does not show up.
It is not enabled in the pr3315 build
Works on my saola_wrover
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.2-358-gf39708abb on 2020-08-26; Saola 1 w/Wrover with ESP32S2
>>> import gc
>>> gc.mem_free()
2048784
>>> ```
@slender iron sorry, I ran out of time yesterday before a class. I'll check out the exception thing now
Did limor tell you what module she's using on the Saola?
@slender iron hi, when you are breakfasted and settled could I talk to you about the Adapter constructor? I could make it a real constructor, but then to do it properly I need to add it as an argument all over the place, to avoid using the single instance as a global. This is certainly doable but is a lot of work and could be deferred.
Also I did make draft release notes yesterday, so a release could be done quickly. Q is whether there are outstanding PR's to include (probably microS2, not sure whta else0
I originally did it this way in rough imitation of displayio.DISPLAY. There is no explicit constructor for the default display, and there wouldn't be for the singleton adapter either. Unlike DISPLA`, there does need to be some initialization done to use the singleton adapter. The idea was that it would live across VM's, like the DISPLAY.
It is possible to make the Adapter not be a singleton, but it requires passing it around many more places than it is currently. Right now it's reference...
@ionic elk should ulab now appear in esp32s2 builds? or am I missing something?
I was puzzled by that as well. I don't know what's going on with that. I admit I didn't test Ulab since I actually don't know how, I've never used it, but I thought that as a common-hal independent module it was just as simple as turning on the build flag.
It was kind of a quick afterthought from putting in Random
All done. Thanks for your quick responses!
One request about the board id. Otherwise it looks good. Thanks!
@ionic elk ok -- just wanted to be sure it was not something I had misconfigured.. not a problem -- I just wanted to test it. no need at this time.
Thanks for restoring random
@xiongyihui This looks good as it stands. Do you still consider it a draft, or have you finished your testing?
@ionic elk are you looking to fix the ulab issue? I tried a build to check it out but I've never built ESP32S2 and had trouble
I'm no longer digging into this on my end since it works consistently now. I hope someone will benefit from this ticket if they run into similar troubles. Unless you want to add a placeholder for SDASETUP (which is only possible on M4), then I would close this issue. Thanks for your help!
@tulip sleet yeah my starting docket for today is:
- investigate Limor's PSRAM crash
- find a ulab control test, test on STM32, then figure out why it isn't on ESP32
- Continue working on SD SPI bug
@kwwals Could you submit a PR for the SDASETUP change? Did you make that change in your own fork? It sounds like it's helpful.
@tulip sleet to build ESP32 requires installing the IDF and running . esp-idf/export.sh every time you want to use make, have you done that?
I did the first but not the latter, thanks. I had to install cmake and ninja-build
I have prepared a draft alpha release, and am just trying to figure out what should be in it
I'd vouch for my PulseIO additions and Random addition but not for my ULAB thing, yeah
Oh and the meowbit fix
huh that ulab thing is weird, it SHOULD just be setting the define in the .mk file.
¯\_(ツ)_/¯
yeah, it looks fine, I'm confused. I looked at all the uses and I don't see anything missing.
esp-idf wants a plain python. should it be python2 or python3?
also weird, no boards show ulab in the shared-bindings matrix https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html
It sets up its own virtualenv so I don't think it matters
halbert@salmonx:~/repos/adafruit/circuitpython/ports/esp32s2$ source esp-idf/export.sh
Setting IDF_PATH to '/home/halbert/repos/adafruit/circuitpython/ports/esp32s2/esp-idf'
Adding ESP-IDF tools to PATH...
/usr/bin/env: ‘python’: No such file or directory
You can't use your own virtualenv either, by the way, so be careful of that. If you try to run esp-idf setup inside one, it'll bork out
Hang on let me get my "Adventures in [redacted]" computer problems journal entry for it
@tulip sleet I have built the esp build on systems where python is /usr/bin/python is python2. I believe that the way our github actions work, python is /usr/local/bin/python is python3.
IIRC I had to make sure python ran as python3 for esp32s2 builds to work
it is calling esp-idf/tools/idf_tools.py. It's using parenthesized print statements, so looks like py3
Don't you have to set an environmental variable for the python location
nope, I am using the system python3 and also installed python2. I have an alias py for convenience, but there is no plain python, because I want to catch things that don't say which python they want
I could install python-is-python3
but i have not
I can confirm that I ran the install process with the default python 2.7 that is installed on Mac machines. It then installed a virtual environment to do everything else
/usr/bin/python
jepler@babs:~/src/circuitpython/ports/esp32s2$ source esp-idf/export.sh
...
Done! You can now compile ESP-IDF projects.
Go to the project directory and run:
idf.py build
jepler@babs:~/src/circuitpython/ports/esp32s2$ which python
/home/jepler/.espressif/python_env/idf4.2_py2.7_env/bin/python
``` After sourcing the environment script, it should be their own python
it is a python binary, not a symlink or similar ```-rwxr-xr-x 1 jepler jepler 3689352 Jun 25 21:15 /home/jepler/.espressif/python_env/idf4.2_py2.7_env/bin/python
I have tested it. It works well. I would use it in the M60 keyboard. Do you have any other ideas?
idf_tools.py has #!/usr/bin/env python at the top. That's what I have to address.
i don't generally use a virtualenv. I kind of hate them if I don't need them
Weird, that would have caused problems for me too, and I'm not sure why it didn't
I think it must work with either one
i'll just try python-as-python3
it does not
I concur, I don't have python 3 set up as the default on my machine, I only access it through virtualenvs, so it must work with either
I struggled with systems that had python (python2) -- just decided to get rid of python2 ....
@tulip sleet have you tried it with python 2 and had it fail?
i am trying it with python3 right now
python-as-python3 worked for my Linux box.
@solar whale with macs I find it's more trouble than it's worth to try to get rid of system installed stuff. Easier to just have virtual environments and bash reconfiguration than actually trying to uninstall anything
i concur with the ubuntu decision never to use bare python if you can help it
but you can't to the idf install in a virtualenv
in a virtualenv or a VM?
@solar whale I'm confused that you had issues with the idf using python 2.7. I don't see how it could possibly have worked for me if it was incompatible, I only have python 3 in virtualenvs
Yes, I certainly can later. Since I'm unfamiliar with the build system, I actually don't know how to differentiate between SAMD21 and SAMD51 within I2CPeripheral.c. It also doesn't use ASF4 like Scott mentioned.
@ionic elk Now that you mention it, it may npt have been an issue on the Mac -- I don't recall. It was a problem on Linux and RPi
now it is upset that my pygdbmi is too new
@tulip sleet this seems super weird to me, this is the whole point of it making a virtualenv
no argument there
this puts whitespace at the end of var: VAR = 1 # helpful comment
why did it not bork my other enables I wonder
Is that seriously the first time I've left a comment on a makeflag?
Oh yeah, I guess it would have been, since normally you just delete them off the mpconfigport.mk list when implemented. Oh well. I'll get a fix up shortly.
gah:
RROR: gdbgui 0.14.0.0 has requirement pygdbmi<0.11,>=0.10.0.0b0, but you'll have pygdbmi 0.9.0.2 which is incompatible.
from esp-idf/install.sh
looks like maybe gdbgui got a version bump but they didn't address that yet
@ionic elk thanks. I was going to toss a PR up but something got borked in my tree
something about the content of boards/microdev_micro_s2/sdkconfig is making my git very grumpy
it insists I've modified it, haven't encountered this before
also weird, no boards show ulab in the shared-bindings matrix https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html
@onyx hinge i'm fairly confident it doesn't show up because theshared-bindings/ulabfolder doesn't exist anymore (was only for docs, iirc). https://github.com/adafruit/circuitpython/blob/575516072038d470210e1944cbdaaf6868116f39/docs/shared_bindings_matrix.py#L45
might need to re-direct that discovery to circuitpython-stubs?
@onyx hinge i edited that file through github to fix a whitespace problem in the micros2 PR. But it didn't work, twice. I then cloned it and pushed a change. Meanwhile, microdev1 edited it to add PSRAM. But it passed the tests. Maybe pull/merge again?
@onyx hinge not a submodule issue?
the file originally had a blank line but was otherwise empty. The github web editor did not succesfully let me remove the blank line.
Also, what's a good, quick way to test whether ulab is working?
@ionic elk import ulab; ulab.zeros((3,3))
thanks
warning: CRLF will be replaced by LF in ports/esp32s2/boards/microdev_micro_s2/sdkconfig.
The file will have its original line endings in your working directory
``` the content of that file has DOS line endings
Cloning into 'circuitpython'...
remote: Enumerating objects: 113, done.
remote: Counting objects: 100% (113/113), done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 129597 (delta 64), reused 56 (delta 24), pack-reused 129484
Receiving objects: 100% (129597/129597), 77.55 MiB | 43.44 MiB/s, done.
Resolving deltas: 100% (95682/95682), done.
jepler@rat:/tmp$ cd circuitpython/
jepler@rat:/tmp/circuitpython$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ports/esp32s2/boards/microdev_micro_s2/sdkconfig
no changes added to commit (use "git add" and/or "git commit -a")
``` somehow that is causing on two computers that the file is detected as "modified" by git version 2.20.1, even on a clean clone
@tulip sleet I just reran my install without issue ...
Package Version
--------------- --------
bitstring 3.1.7
Brotli 1.0.7
cffi 1.14.0
click 7.1.2
cryptography 2.9.2
Flask 0.12.5
Flask-Compress 1.5.0
Flask-SocketIO 2.9.6
future 0.18.2
gdbgui 0.13.2.0
gevent 1.5.0
greenlet 0.4.15
itsdangerous 1.1.0
Jinja2 2.11.2
MarkupSafe 1.1.1
pip 20.0.2
pycparser 2.20
pyelftools 0.26
pygdbmi 0.9.0.2
Pygments 2.6.1
pyparsing 2.3.1
pyserial 3.4
python-engineio 3.12.1
python-socketio 4.5.1
reedsolo 1.5.3
setuptools 46.1.3
sh 1.13.1
six 1.14.0
Werkzeug 0.16.1
wheel 0.34.2
My git (2.20.1 on debian buster) has a lot of trouble with the content of this file, due to DOS-style line endings. Even a fresh clone claims the file is modified!
jepler@rat:/tmp$ git clone https://github.com/adafruit/circuitpython
Cloning into 'circuitpython'...
remote: Enumerating objects: 113, done.
remote: Counting objects: 100% (113/113), done.
remote: Compressing objects: 100% (86/86), done.
remote: Total 129597 (delta 64), reused 56 (delta 24), pack-reused 129484
Receivin...
ah -- older gdbgui
I can confirm a null reference exception when attempting to use DisplayIO on the Saola Wrover. Investigating.
yes, i was installing fresh, so it installed the latest gdbgui for me, which caused minor havoc.
14.0.0.0
@sommersoft speculates:
i'm fairly confident it doesn't show up because the shared-bindings/ulab folder doesn't exist anymore (was only for docs, iirc). https://github.com/adafruit/circuitpython/blob/575516072038d470210e1944cbdaaf6868116f39/docs/shared_bindings_matrix.py#L45
might need to re-direct that discovery to circuitpython-stubs?
@raven canopy just special-casing it seems like it could work too
it could, definitely.
is going to the stubs a better solution you think?
long-term, i think stubs is a better option. then it doesn't depend on external changes (unless the stubs process changes)
@tulip sleet once you have a stable build method, I hope you'll update the "building CP" guide....
Going to make some lunch. Fix for makefile whitespace problems after I come back.
@ionic elk @onyx hinge thanks for tracking that down
np
I kept trying to figure out what I was doing wrong....
@slender iron I'm just going over this week's meeting and I saw you fishing for volunteers for a learning opensource alternative.
Not sure if somebody already started the discussion about it but, for the circuitpython day I had to build a website based on markdown files and static images. I used Hugo for it and it's really simple to use and to have a site up and running. I know almost nothing on the html/css/js side.
Hugo is writen in Go. To be honest I didn't look for an alternative written in Python which I'm sure would not be frowned upon here.
I have not tried to replicate some of the complex parts of learn, like pages, and mirrors, but it already handles very nicely the topic of translations.
For diacircuitpython.org I have a workflow of pushing to github, then fleek (hosting provider that uses IPFS to distribute the content) builds a container with hugo, and hugo transforms the markdowns to the nice site itself.
If anyone has a suggested alternative for Hugo, maybe python based, I could setup a workspace for making pages/mirroring work.
@microDev1 Note there was a line-ending issue; we're fixing.
Closes: #3331
Also adds code to speed up shared-bindings-matrix on multi-core systems, reducing it from ~1minute to ~30seconds on my laptop (2.6GHz 2C/4T) and from ~25 seconds to ~4 seconds on my desktop (3.6GHz 8C/16T)
The order of the files is different now (it is ordered by name, not by port-then-name), but I did my best effort to compare them and determine that only "ulab" was added to the matrix.
Thanks for the quick merge on that newline thing @tulip sleet
@silver tapir checkout https://awesome-python.com/#static-site-generator I use Pelican from that list. I've not tried the others so I can't say which is "best".
A curated list of awesome Python frameworks, libraries and software
Did limor tell you what module she's using on the Saola?
@ionic elk No, not that I saw. My guess is that the error happens on both.
Thanks, will try pelican first.
@slender iron hi, when you are breakfasted and settled could I talk to you about the Adapter constructor? I could make it a real constructor, but then to do it properly I need to add it as an argument all over the place, to avoid using the single instance as a global. This is certainly doable but is a lot of work and could be deferred.
Also I did make draft release notes yesterday, so a release could be done quickly. Q is whether there are outstanding PR's to include (probably microS2, not sure whta else0
@tulip sleet does it need to be an argument if you allow setting the global for the time being? that seems like a reasonable middle ground
@silver tapir neat! That sounds like a good place to start. I think having metadata on guides is helpful too
@slender iron in the case of hugo, that is handled. So for example, for diacircuitpython.org/content/speakers/alvaro.md
In there you have company, city, photoURL, social networks, key, name, etc.
nice! I'd have to look more closely at learn vs hugo
I'm headed out on a run now before it gets hotter
@pastel panther and I are going to chat about canio API soon in the Amelia voice channel. Some provisional versions of the API: https://gist.github.com/tannewt/89ee082de9f5a98675df901cdcfbe951 and http://zaphod.unpythonic.net/canio-provisional-docs/html/shared-bindings/_canio/index.html @slender iron a ping for you just in case you wanted to join us in particular
@teal bear in case you have feedback see the above links ^^, dunno where you are in your canbus research / learning the micropython version. FWIW we are targeting the SAM E54 microcontroller first, so STM32F405 will be a secondary or later implementation in CircuitPython.
@slender iron I realized that _bleio.adapter = Adapter(...) is not possible, because adapter is a module attribute, not a property. So I'd have to provide something like _bleio.set_adapter(). I can still do the constructor for Adapter, but does this make it less attractive to you for now?
@tulip sleet I looked a bit into why modules couldn't have properties, but couldn't figure it out. I guess adding it is .. not exactly in scope of what you're doing
even in CPython, it's not used very often. I keep bumping into this every year or so
Yeah, though in circuitpython it would be the "obvious" way to make a built-in module have modifiable things, like _bleio.adapter, board.DISPLAY, tc
I think in "real" python it's rightly a bit of an antipattern
right, so I think we should try to be pythonic
Ugh this makefile comment thing sucks it makes the definitions so ugly
bleh
let's move to ninja
you can set sys.path, etc.
but that's pretty old-school, i guess
@ionic elk are there other cases where there was a comment on the = line?
.. not in circuitpython ```>>> sys.path = []
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object cannot assign attribute 'path'
you can mutate the thing that sys.path names, though
@tulip sleet Yeah I wrote the porting guide as a massive block of assignments you copy and paste - all of them had descriptive assignments.
I actually had this as a bug further down my list, because I was finding that assignment of DisplayIO and other features was failing at random
Fixing for all ports now
is that issue esp32-specific, having to do with converting the makefiles? I don't remember this being an issue before, of picking up the trailing whitesapce
(and also adding countio which wasn't in there for some reason)
we could put code somewhere to say CIRCUITPYTHON_ULAB = $(strip $(CIRCUITPYTHON_ULAB)) and so on for each variable, ugh
just before all the uses/tests of them
but I am not sure it's an issue in regular make
no, it occurs for any assignment where you put a trailing comment. It's a POSIX thing
@onyx hinge brb
I think any trailing whitespace might cause it, but when there's not a comment your editor or the pre-commit hooks tell you about it
yeah it's "supposed" to work that way, or at least it's now treated as a feature. See also: how do I create a makefile variable consisting of JUST a single space
For a space you need to get a space into a string, I find the easiest way is like this:
space := space += $(subst $(space),;,$(string))That works because += always space separates the value of the variable with the appended text.
https://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html I've seen other ways as well
Sometimes you need to hide a comma or a space from GNU Make's parser because GNU Make might strip it (if it's a space) or interpret it as an...
(the last is replacing the blanks between words with semicolons, it's not showing how to get the space in the var)
anyway this is all a tangent, and I've fallen into the trap of wanting to show off how well I know Make
scars, I got's em
Stu Feldman was on sabbatical from Bell Labs at Berkeley when I was there. I will go back in time and tell him not to do that. (It may have been later than that anyway.)
My gut tells me, many of these behaviors were initially just coincidences of the implementation, but people elevated them into features and now new implementations have to work in the same way.
the whole "tab starts an action" was original to make
@onyx hinge it looks like my MacBook decided to install an update before booting. "ETA" is ~2 minutes
@pastel panther no worries. Do you have a potato you can use instead in the meantime?
@onyx hinge I'll try my phone? It's saying 30 mins now
@onyx hinge thanks. I have been poking at MPs canbus stuff, slowly getting a feel for how to work with it.
I'd be happy to try out my ... poc/test/get my feet wet code as soon as you have something I can run on my STM32
Just made a quick tool that parses the circuitpy_mpconfig.mk file and tells you what "category" every module is in: https://gist.github.com/hierophect/521277cfdf1f3b8321b2ec3b5c37c2e4
Eventually I'd kind of like to add some comment convention to this file that allows me to automatically sort these into "Core", "Dependent" and "Auxiliary" modules for auto-documentation purposes. So a porter can know what's considered "core" to a port, what modules they unlock without further effort by implementing core modules, and what modules are considered "very optional" for lack of a better term.
Examples being Busio and DigitalIO (core), DisplayIO or GamePad IO (dependent), ps2io and ble_file_service (Auxillary)
@slender iron I realized that
_bleio.adapter = Adapter(...)is not possible, becauseadapteris a module attribute, not a property. So I'd have to provide something like_bleio.set_adapter(). I can still do the constructor for Adapter, but does this make it less attractive to you for now?
@slender iron and, to top it off, the current adapter singleton is a static, not a heap object, so I have to change the references to that everywhere if it's going to be assignable
I don't like how the current init is implicit
@slender iron you have to do _bleio.adapter.hci_uart_init(...) or the equivalent. BLERadio() does this for you, but it's not implicit in _bleio. I'm not sure what you mean by implicit.
I had BLERadio handle the common case of having an on-board adapter
it's unclear to me that hci_uart_init creates the adapter
it doesn't, it just sets up communication with it and initializes it. It's basically some_object.init()
but not __init__()
_bleio.adapter exists beforehand, but it's not usable
i could call it "setup", if the init seems confusing
that is what constructors are
constructors create and initialize an object. This is more like spi.configure()
but spi was not usable before configure
spi is usable after construction because it has defaults
This sparkline library is so cool can’t believe it’s taken me this long to try it out! Thanks @mental nexus !
i could set up an on-board adapter when the pins are known. I just needed an escape hatch to handle off-board adapters. I started to write the init code in C but it was easier to do in Python
I have to create a UART object, some digitalio object, and toggle some pins. that code is in python now
this feels a lot like displays and they magically work after construction
so I'd model it after them
so for on-board displays, the code in board.c takes care of the init. Otherwise there's a heap-created display that has python initialization code. i can't remember how you attach an off-board display to make it be like displayio.DISPLAY (or can you not do that)?
@bleak tiger Thanks for the positive feedback. And gotta give thanks to @lone axle for a lot of testing. Also, there's an example with tick marks and tick-mark labeling if you want to snazz it up a bit. It's like a tiny baby step toward matplotlib.
@tulip sleet it won't be display.DISPLAY but it will be used by the core
it will last past a VM restart?
yes, up to release_displays
i am looking at the code. OK, so to be like display, I can do this:
- Use the onboard ESP32 if it's present. It will get set up and will be _bleio.adapter.
- If there is no onboard ESP32, _bleio.adapter will be non-functional, and you can call the constructor, and it will either magically become
_bleio.adapter, or you can do_bleio.set_adapter(), and internally it will copy the object struct into the static object, or something similar. Alternatively you could call_bleio.adapter.configure()instead of the constructor for the off-board adapter; that is just a renaming of hci_uart_init
in the display case, the first display magically becomes the REPL display, but it does not become displayio.DISPLAY.
@mental nexus yeah tried that too, very nice! Going to setup a plot for each of the sensors on the enviro+ wing with some coloured backgrounds, should be fun
It's hard to tell, because we don't have build sizes on the ESP32-S2 yet, but I guess ULAB is too big for the ESP32-S2?
@pastel panther @slender iron thanks for the chat, it was helpful
We'll chat again on September 1 at the same time, if anybody else is interested
Or I need to move something around
@onyx hinge @pastel panther the S2 does have can but it's called the Two-wire Automotive Interface (TWAI)
@slender iron good find
yeah, and I'm in better shape
@slender iron it is in usb_midi where you have a mutable globals dict, so you can change usb_midi.ports
Something fun came in the mail today for future CP fun.
@onyx hinge after reviewing the MCP2515 datasheet, the only thing that stood out wrt filters are that it supports filter priority as well as identifying which filter resulted in acceptance
and that it can support filtering on standard or extended identifiers. If an for standard frames, any additional bits that would be applied to an extended frame ID are applied to the first two data bytes. It calls this out as being useful for filtering frames for high level protocols which presumably make use of those bytes for identification
Hi! We would like to add a second CDC interface to our USB descriptor but it requires dynamically changing the descriptor because of the limited endpoints. We have an existing issue for this here: https://github.com/adafruit/circuitpython/issues/231 It also has a lot of background related to what you are trying to do.
Hi! We haven't tested SDCards with the S2 yet. The SPI based SD library and it's examples should just work. Most pins will work up to 40mhz. You'll need to pick specific pins to get up to 80mhz. They allow for the SPI peripheral to talk to pins via the IOMUX directly.
We don't have any examples using SDIO to talk to the card and I'm not sure the ESP32-S...
@onyx hinge Here's my bookmarks for CAN stuff including some HLP (high level protocol) stuff:
@slender iron I'm receiving the following error when I try to enable Ulab on the ESP32: esp_image: Image length 564688 doesn't fit in partition length 524288. This then spirals off into a number of other booting and SPI errors.
- this seems like a really large size for the circuitpython build to be, is that normal?
- Is there some way of regulating where larger modules like ulab are positioned in the partition table?
full error set:
E (323) esp_image: Image length 564688 doesn't fit in partition length 524288
E (323) boot: OTA app partition slot 0 is not bootable
E (327) esp_image: image at 0x90000 has invalid magic byte
W (333) esp_image: image at 0x90000 has invalid SPI mode 224
E (340) boot: OTA app partition slot 1 is not bootable
E (345) boot: No bootable app partitions in the partition table
ya, that's normal. the idf is giant
my native_wifi branch bumps it up a lot
I've got some changes to module enable in my PR too
I was going to try and reduce the inline limit
But if you have a better suggestion I'm happy to do that instead
I don't think that'll help
don't worry about ulab until the native wifi stuff hits
it changes the partition table
Ok, I'll reduce my latest PR to just fix the comments issue.
I wouldn't worry about turning it off and on. I just know that generating the numbers can take time too so you might as well use all of the bits.
Thanks for adding this. Would you mind limiting the features to those specified in this guide? https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/adding-to-downloads
Thanks
@pastel panther thanks, just saw your messages
I'm not aware of a flag. I'm a bit surprised there isn't a way to just ask random about it. I think this is fine for now because we'll fall back to a non-random seed anyway.
@ionic elk did you find the issue with displayio?
I confirmed it but haven't found it yet
did you try it on a wroom? it'd be good to determine if it is because of the psram
you can just load the wroom build onto the wrover too
(the reverse won't work because the ram will be missing)
@slender iron what do you mean by because of the PSRAM? as in, the lack of psram on the wrover would be causing the issue? Running her displayio code def crashes the wrover
I can test it on main though and see if it still happens
it's blocking my psram PR even though I suspect it's unrelated 🙂
testing on main would work too
also wow yeah the inline limit doesn't affect the flash size at all? is there a reason for that?
probably because we don't run lto
I'll test on main real quick here and make a new issue if it shows up so your PR can go in
thanks!
Thanks! Build instructions are here: https://learn.adafruit.com/building-circuitpython
Here is an example of conditional code for the SAMD51: https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/common-hal/busio/UART.c#L108
When making an assignment such as CIRCUITPY_MODULENAME = 1 in a makefile, make will automatically add any trailing whitespace to the value of the assignment, which can cause evaluation failures down the line. Normally the compiler will warn you about this, but when the assignment is followed by an inline comment, CIRCUITPY_MODULENAME = 1 #somecomment, this warning is omitted.
Unaware of this I mistakenly included several inline comments in the STM32 and ESP32 ports, as well as in the ...
@slender iron it occurs on main. Making new issue.
thanks!
As noted during testing by @ladyada, the ESP32 encounters an error when attempting to connect to an SSD1306 I2C screen using the following DisplayIO sketch (tested on Saola 1 Wrover devboard):
import board
import busio
import displayio
import adafruit_displayio_ssd1306
displayio.release_displays()
print(dir(board))
i2c = busio.I2C(board.IO8, board.IO9)
display_bus = displayio.I2CDisplay(i2c, device_address=0x3d)
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=1...
@ladyada @tannewt I've confirmed that the issue with DisplayIO also happens on main and thus is probably unrelated to this PSRAM update. I've opened a new issue for it here: #3334. @ladyada if you'd like to keep testing this PR, I think most other sketches should still work, you just got unlucky with the one you tried landing on a new bug! It only occurs when the screen is physically plugged in, so removing it should allow you to recover your filesystem.
I've submitted a question to Espressif about it but I'll just leave it as is for now. I'm also surprised there isn't a clear way to tell if it's supplying "real" TRNG or not, seems pretty unsafe.
I got this odd string for translation in webplate. Is there a reason for all the white space?
if (!carrier || pin || frequency) {
mp_raise_NotImplementedError(translate("Port does not accept pins or frequency. \
Construct and pass a PWMOut Carrier instead"));
}
This is in PulseOut.c. I don't think that produces the expected output?
Unscientific observation: I was getting these panic stops A LOT @ 6bpp… but was also monitoring the serial port and editing code on the board at the same time. Disconnect board so it’s standalone, it generally seems stable even with bit_depth=6. I’ll make noise if that changes.
@cobalt grail it's a weird thing that @ionic elk did. I believe they were already talking about it
@slender iron any pin restrictions on the esp32s2 TWAI?
¯_(ツ)_/¯
probably not since it's only 1mhz
@onyx hinge no, looks like its only routed through the gpio mux
good
@tulip sleet On the *man use of tabs, did you hang out with Eric Allman too? He's a tab lover.
@cobalt grail it's a weird thing that @ionic elk did. I believe they were already talking about it
@slender iron Yeah, I noticed it stuck more than my translation at 99%.. Well.... 🙂
Since e121e267adacf6 (#3332), the shared bindings matrix uses the stubs. Therefore, we must build them! This should fix the failure to build the docs on readthedocs.org.
Neither @sommersoft nor I saw this locally since we had previously built the stubs. github CI didn't see it, because it manually builds the stubs in an earlier step of the build process, and does not clean the tree in between.
🤦 I actually had this thought when I first looked and saw circuitpython-stubs in the raw RTD logs, but I forgot to check the order. Thanks for following up on the RTD build!
@simple pulsar Yes, I was a contemporary of Eric Allman also, but never had to write sendmail files until much later.
SMP Debian 5.7.10-1 (2020-07-26) x86_64 GNU/Linux
crashes often when using ESP32-S2 and it's starting to become annoying.
Kernel just freezes, I can't see nothing like register dump in syslog to see
in which function and source line crash happened.
Normal workflow that triggers crash every cca 10-20 retries is this:
cp demo.py /media/user/1234-5678/
screen /dev/ttyACM0
import demo
... it uses SPI and bitbang IO ...
Ctrl-D
editing demo.py and cp again and linux freezes, o...
Thanks for fixing all of these. Very obscure!
I'm wondering if we should call this out_report or received_report to distinguish it from the regular IN report. What do you think the best terminology is?
Merge conflicts here. Is this otherwise good to go? @tannewt did you have anything further?
Should I wait for this for 6.0.0-alpha.3?
I'm trying to access a parent's getter and setter using __set__ and __get__ in CircuitPython, but it doesn't allow it. This code works in python (2.7.16) but not in CircuitPython. Is there an alternate way to access a parent class getter/setter in CircuitPython?
CircuitPython error:
File "code.py", line 39, in <module>
File "code.py", line 34, in scale
AttributeError: 'property' object has no attribute '__set__'
Here is my code. This works in python 2.7.16 but give the above error in CircuitPython.
class simpleGroup(object):
def __init__(self):
self.funny=0
@property
def scale(self):
print('simpleGroup getter being called')
self.funny=2
return self._group_scale
@scale.setter
def scale(self, new_scale):
print('simpleGroup scale setter was called with value: {}'.format(new_scale))
self._group_scale=new_scale
class simpleLabel(simpleGroup):
def __init__(self):
self.label_scale=None
def printsomething(self):
print('this is a test')
@property
def scale(self):
print('simpleLabel getter being called')
return simpleGroup.scale.__get__(self)
@scale.setter
def scale(self, new_scale):
print('simpleLabel scale setter was called with value: {}'.format(new_scale))
self.label_scale=new_scale
simpleGroup.scale.__set__(self,new_scale*5) # Set the simpleGroup's scale to (5 * input value)
print('1 ***')
my_simpleLabel=simpleLabel()
print('2 ***')
my_simpleLabel.scale=1
print('3 ***')
print('my_simpleLabel.scale initial value: {}'.format(my_simpleLabel.scale))
print('4 ***')
print('my_simpleLabel.label_scale: {}'.format(my_simpleLabel.label_scale))
print('5 ***')
my_simpleLabel.scale=2
print('6 ***')
print('my_simpleLabel.scale initial value: {}'.format(my_simpleLabel.scale))
print('7 ***')
print('my_simpleLabel.label_scale: {}'.format(my_simpleLabel.label_scale))
Here is the output from python 2.7.16:
iMac:Kevins programming mxxxx$ python "code 3.py"
1 ***
2 ***
simpleLabel scale setter was called with value: 1
simpleGroup scale setter was called with value: 5
3 ***
simpleLabel getter being called
simpleGroup getter being called
my_simpleLabel.scale initial value: 5
4 ***
my_simpleLabel.label_scale: 1
5 ***
simpleLabel scale setter was called with value: 2
simpleGroup scale setter was called with value: 10
6 ***
simpleLabel getter being called
simpleGroup getter being called
my_simpleLabel.scale initial value: 10
7 ***
my_simpleLabel.label_scale: 2
It also works fine on python 3.8.2
micropython (and therefore circuitpython) takes some shortcuts for speed in cases like this, so I'm not surprsed
thanks for the merge again! I verified the docs build and that ulab appears in the matrix
@tulip sleet I’m trying to “intercept” the setter and do some stuff and then call the parent class setter. Do you have any suggestions on an alternate approach?
I think I need direct access to the parent class’s scale variable because displayio uses that to scale this object on the screen.
C inserts a bunch of extraneous whitespace when you extend a string over multiple lines with "". This doesn't matter for SQL queries, which is what I was used to using it on, but it makes for some gross translations and error formatting.
This PR fixes the recent error string additions that included this style issue.
hey folks... I've built a cool little macropad using an itsybitsy m0. Works great and I'm super happy with it. Only thing that bothers me is it showing up as an external drive all the time.
Is there a way to toggle its ability to show up as an external drive? (primarily because it triggers a warning to my employers security dept every time I plug it in!) 😄
Maybe one of these cables where you can turn off the data lines? https://www.adafruit.com/product/1620?gclid=Cj0KCQjws536BRDTARIsANeUZ5_TMnTGmyyAuPXbstSfp9HHrnY5ddtANEaEEMu71pv_msK7NS_KcbMaAjWyEALw_wcB
Oops! you probably need data if it’s a keyboard!
Yeah... it might help 😄
Ha
I was thinking maybe there was a simple toggle hidden away in the REPL or something?
you'd have to rebuild circuitpython from source to disable the drive
(and I'm not sure exactly what changes you'd have to make)
Yikes... that sounds over my head
@mental nexus As an example, there's this existing bug: https://github.com/micropython/micropython/issues/2720. I was going to suggest using super(), but ran into that problem. However, I tried it with a setter and it seemed to work (it may have shadowed the parent property: I'm not sure). ... Definitely test with 3.x, not 2.x, as micropython targets 3.4 and later
I found this on MicroPython vs CorcuitPython descriptor support: https://github.com/micropython/micropython/issues/3644
I note in https://github.com/micropython/micropython/wiki/Differences simplified support for descriptors is now implemented, as an opt-in feature I have been trying to port some CircuitPython libra...
I can’t decipher all of it but some notes from Scott suggest that CircuitPython can use property descriptors (?)
we do: they're used in the adafruit_ble library extensively
If they are present in CP, maybe am I doing something wrong in my code?
It may be a limitation of the superclass (Group) being a native C class as opposed to a Python class, but that's just a guess.
see examples of __set__ in https://github.com/adafruit/Adafruit_CircuitPython_BLE/blob/master/adafruit_ble/characteristics/__init__.py and elsewhere in the library
i guess the point is that we define __set__, we don't use it on existing properties, so that's not a good example
but normally, I would expect you to use super().__set__()
@onyx hinge is there a forum (or a github issue) where I can chat about some canbus timestamp thing that is in the stm32 and maybe all but I don't know and would like to help with this if I can
@slender iron were you expecting that I would implement the hard-reset for ESP32 to flip it into Bluetooth HCI mode in C now, as part of the constructor? I said I could do that, but I don't think I confirmed that's what you preferred. I may add some options like the polarity of the reset pin, etc, since it can vary. And there will be limitations if/when we start supporting other adapters that have different hard-reset sequences. (There is a soft reset, but it requires that the adapter is in HCI mode).
@dhalbert Want to approve? Seems like it's ready to go in.
Looks good, and has been confirmed as working. Thanks!
@tulip sleet I hadn't thought about it. Up to you.
I think I will leave it out for now, because it makes the core it very device-specific. The disadvantage is that you need the BLE library, or at least copy its reset sequence, but that's not a big deal.
I tried using super, but get the message:
AttributeError: 'super' object has no attribute '_group_scale'
Here is my updated code.py:
class simpleGroup(object):
def __init__(self):
self.funny=0
self._group_scale=1
@property
def scale(self):
print('simpleGroup getter being called')
#self.funny=2
return self._group_scale
@scale.setter
def scale(self, new_scale):
print('simpleGroup scale setter was called with value: {}'.format(new_scale))
self._group_scale=new_scale
class simpleLabel(simpleGroup):
def __init__(self):
self.label_scale=None
def printsomething(self):
print('this is a test')
@property
def scale(self):
print('simpleLabel getter being called')
return super().scale.__get__(self)
@scale.setter
def scale(self, new_scale):
print('simpleLabel scale setter was called with value: {}'.format(new_scale))
self.label_scale=new_scale
super().scale.__set__(self,new_scale*5) # Set the simpleGroup's scale to (5 * input value)
print('1 ***')
my_simpleLabel=simpleLabel()
print('2 ***')
my_simpleLabel.scale=1
It gives the error on the line my_simpleLabel.scale=1
you need to call super().__init__ in simpleLabel.__init()__ to create the attribute, right?
I tried that too and it doesn't work, same message.
class simpleGroup(object):
def __init__(self):
self.funny=0
self._group_scale=1
@property
def scale(self):
print('simpleGroup getter being called')
#self.funny=2
return self._group_scale
@scale.setter
def scale(self, new_scale):
print('simpleGroup scale setter was called with value: {}'.format(new_scale))
self._group_scale=new_scale
class simpleLabel(simpleGroup):
def __init__(self):
self.label_scale=None
super().__init__()
def printsomething(self):
print('this is a test')
@property
def scale(self):
print('simpleLabel getter being called')
return super().scale.__get__(self)
@scale.setter
def scale(self, new_scale):
print('simpleLabel scale setter was called with value: {}'.format(new_scale))
self.label_scale=new_scale
super().scale.__set__(self,new_scale*5) # Set the simpleGroup's scale to (5 * input value)
print('1 ***')
my_simpleLabel=simpleLabel()
print('2 ***')
my_simpleLabel.scale=1
Error message: AttributeError: 'super' object has no attribute '_group_scale'
well, maybe not. I would say you don't need to do this as a subclass, you could just incorporate a simpleGroup inside simpleLabel. That would get around all this.
also no need to do (object), btw
The (object) was required for python, it acted strange without it (would not show my print statements or execute the getter/setters).
for python 2.7, yes, I think
Alternate is to define a Group.set_scale function up at the C-level. I really want bitmap_label to be a Group subclass so it acts just like label.
but don't use 2.7
ok, will focus on 3 going forward.
2.x is discontinued and no longer supported as of January 2020
some people like Red Hat will be doing security fixes, but not python.org
This is basically just the https://github.com/micropython/micropython/issues/2720 bug, I think
@mental nexus i still think you'll find composition easier to deal with, compared to inheritance. its a little extra work to avoid circular references, but the base class can still be exposed if desired. here is an example using FrequencyIn:
https://gist.github.com/sommersoft/2334fc628cd2897a72f1672aad8f2cd1
It would be nice to fix that sooner or later.
@raven canopy I'm totally new to composition, I looked over your note yesterday but struggled to understand it. Can I use composition with the builtin C classes (like displayio.Group)?
In my case, displayio somehow uses the scale in the Group to set the display scaling for this object. I'm not sure if displayio will "know" the value of scale if I redefine it separately in my new class.
i'm not well-versed in displayio, but from the python side i don't know of any impediments.
Currently my class "Label" is a subclass of Group. This group contains a tilegrid. If I'm following your suggestion, I can redo my structure like this:
My class "Label" is a subclass of Group. I instance a "local_Group" set the scale, and put my tileGrid into it. Then, I append "local_Group" into the self (a Group).
Structure idea (where "->" means contains)
Current: Group -> TileGrid
Proposed: Group-> Group ("local_Group") where I can directly set the scale -> Tilegrid
Hmm... I'm still not sure that fixes my getter/setter override issue or not, but I can give it a try.
@teal bear if you prefer to discuss things on github, you can add it to the existing issue about CAN bus here: https://github.com/adafruit/circuitpython/issues/2527
Add CAN bus API. Very common in cars and robots. https://en.wikipedia.org/wiki/CAN_bus
@mental nexus yeah, that proposed seems right. the "difficult" decision part is how you want to access the base Group's methods. if you want access to all of them, it requires either overriding each method/property, or accessing them via the composed attribute. i'll update the gist i linked to show what i mean here.
Ok I’ll check it out and then take another try at it.
I am working on a CAN implementation for SAM E54 mcus. It will be called _canio and we're working on defining the initial scope and API structure. There are several different sketches of how the API might look, including https://gist.github.com/tannewt/89ee082de9f5a98675df901cdcfbe951 and http://zaphod.unpythonic.net/canio-provisional-docs/html/shared-bindings/_canio/index.html
Has anyone dealt with the ESP32 spitting out a corrupted backtrace before? Backtrace:0x4001abc1:0x3ffde130 |<-CORRUPTED I'm hacking away at it with printf debugging but it's kind of a pain...
If we do not consider to add a out_report property to usb_hid.Device, I would prefer to use report. Otherwise, would use out_report and in_report.
@raven canopy thanks for the updated gist, I think that’s how I can do it. I’m lucky that a Group can contain a Group so I can use that ability so I my label can still subclass Group and continue a Group too. I’ll check to see what impact this will have on displayio performance since it will have another layer stacked in there. Thanks to you and @tulip sleet for the discussion on these esoteric topics. I wasn’t planning on finding cracks in the MP/CP structure, I’m just trying to draw some text on the screen! Thanks again!
@ionic elk I don't have a good way of debugging it
I had some weird failed to flash events last night with my ESP32-S2 WROVER. It all worked fine. Then 20-30 minutes I couldn't flash it at all, seemed to be timing out. I then set it aside for a while and later it worked fine again.
The one thing I was doing which was different than what I normally do is I had both the external USB (the one on the WROVER) and the native USB (the esp32-s2 usb on my breadboard) hooked up simultaneously to my Mac. Is that a bad thing to do? Maybe power from both sides is evil?
I should mention in the time I set it aside my FeatherS2 worked fine with the same build tool chains\code\etc.
(saying things out loud helps) I should have tried disconnecting the power from the native usb connection...
@slender iron I've tracked the DisplayIO error a bit and it is implying the problem is inside a ValueError call??
I've seen similar quirkiness on macOS with ESP32-S2. CIRCUITPY comes and goes, USB comes and goes from my tty listings (and sometimes names change). I haven't really found a pattern. I do like to have both serial connected, but 5v only on the USB connector, not the native.
Doesn't look like I can merge until @tannewt signs off.
@ionic elk /shrug
@idle wharf I regularly leave both USBs plugged in
@xiongyihui We have send_report(), which sends the IN report (obviously). Since there is no receive_report(), I was thinking the .report property should be .out_report(), to distinguish it from the IN report, since the OUT data in .report is not the same as the IN data send by send_report().
@crimson ferry that's exactly I was seeing...
It could be something I'm doing in code isn't quite ready for prime time and makes things unstable, I haven't narrowed it down yet
@slender iron I saw you doing that on deep dive and I was like OH I should try that so I can see both sides of what's going on. Is that cable you use with the switch toggling power or data on\off ?
@crimson ferry yeah, that's why I wanted both sides hooked up to see the raw (?) output on the external USB. I'll try it with out power on both connections tonight.
@idle wharf it toggles data but blips power as it does it
Thanks to you both, that give me some ideas !
I've been on linux recently though, not mac
I have a DELL XPS15 running windows I can try too... I also could try it from a PI or BB Black.. If it keeps happening I'll see if I can pin it down to being just on Mac or not. I think that would be helpful to know. Intermittent issues are very discouraging for folks not used to that ...
@dhalbert Is this the same issue you were seeing on other ports?
I'm running Linux dalinar 5.8.3-arch1-1 #1 SMP PREEMPT Fri, 21 Aug 2020 16:54:16 +0000 x86_64 GNU/Linux and haven't had an issue.
@emard Are you using an intel based system?
@jepler Mind reviewing this?
I'm new to canbus, so I am treading lightly.
I would like this to be exposed:
32.9.3 CAN mailbox registers
...
Bits 31:16TIME[15:0]: Message time stamp
This field contains the 16-bit timer value captured at the SOF transmission.
I don't know if this is a general canbus thing that is expected ...
Yes it's intel based system, and circuitpython is connected
to port of USB HUB (I tried different ports, makes no difference)
Bus 001 Device 005: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 122
model name : Intel(R) Celeron(R) N4000 CPU @ 1.10GHz
stepping : 1
microcode : 0x32
Ok, I'm feeling somewhat defeated by this DisplayIO error. Through repeated use of ESP32 log messaging I've pinned down the null dereference to this exact point: https://github.com/adafruit/circuitpython/blob/24fb08dbd9a16e83aded3f0874bc96fcd0462fea/py/runtime.c#L1527, but... there's nothing there. The pointers that go into it are valid, and the call itself is actually just an inline macro with nothing interesting about it. https://github.com/adafruit/circuitpython/blob/24fb08dbd9a16e83aded3f0874bc96fcd0462fea/py/nlr.h#L144
So I'm stumped. It could be an interrupt call that just happens to show up here for some deterministic reason? The backtrace is corrupted so no clues there. @slender iron if you have any ideas I'd love to hear them, honestly can't think of what to even try here.
if the stack is corrupt then its possible its all invalid
what would that mean?
you could see if there is freertos checks you can enable
For the record, taking out the original mp_raise_ValueError call that starts this whole rabbithole lets the code proceed normally until it tries to release a display that doesn't exist
I haven't figured out to do a deliberate crash like I use asm("bkpt"); for
I've been tracking it with ESP_LOGE messages, like this:
E (434) hiero: Port Init Success
E (1374) hiero: ENTERED I2C DISPLAYIO
E (1374) hiero: BLOC
E (1374) hiero: ENTER I2C PROBE
E (1384) hiero: EXIT I2C PROBE
E (1384) hiero: BLOC
E (1384) hiero: Device ADDR 3d
E (1394) hiero: ENTERED VALUEERROR
E (1394) hiero: BLOC
E (1394) hiero: BLOC
E (1394) hiero: ptr: 0x3f0056e8, ptr: 0x3f00d128
E (1404) hiero: ENTERED VLIST
E (1404) hiero: BLOC 0x3ffc69f0
E (1414) hiero: BLOC 0x3ffc69f0
the nlr stuff is going to read back up the stack to unwind
I'd be curious if the stack is already corrupt when the ValueError is attempted to be raised
How would one check such a thing?
you could try crashing earlier but I'm not sure how
Seems fine. No hardware to test. Good catch on the cause of the crash, too bad the compiler wouldn't help out with a diagnostic.
I am disappointed that gcc did not show a diagnostic for this. Amazing! glad you found it.
👍
still calls nlr raise, so it should be similar I'd think
yup
with commits? or just the same in-code message strategy I've been doing?
Or actually moving the call up in the program?
Blows up as soon as Port.c. I'm thinking that any call to ValueError is actually busted
Lovely, a french guide (not CP): https://learn.adafruit.com/makecode-fr but I believe this is in Canadian French. Not really shocking and totally understandable in France, Belgium and elsewhere. But I was surprised by at least one word that I would not have used. 🙂
@thorny jay The translator is Canadian, but worked with the original author who speaks non-Canadian French in the review process. Hopefully it's enough for you to understand it?
Yes, it's OK. I don't know if there is a neutral French that avoid words that would be strange to one side or the other.
Fair enough.
I was unsure at the begining, then I found "présentement" and I said to myself... I would never use that (but I understand it).
Also not sure if I should use Colour or Color here. 🙂
The translator wants to translate more guides, and we're starting them with the CircuitPython guides. I imagine we wouldn't mind assistance reviewing them.
Both work 🙂
Yes I can try to help and re-read. My spelling is far from perfect, but I can spot stuff.
Please try to bear in mind it will have been written in Canadian French. Ideally we can reach a happy medium.
@thorny jay sounds like the words are just strange/dialect, not inappropriate? We'd change the latter for sure.
It's perfectly fine. Don't worry.
OK
I know in the subtitle world or movie dubbing, when you get the "wrong" file you can get a good laugh.
I know there are words between british and american english which are totally inappropriate in the other but are words you say to children in one
it can be a source of amusement but only in the right crowd, not in an adafruit guide
Not sure if that helps, but I stopped having those problems with SAMD21 after downgrading my kernel to 5.4.0-42 — not sure if you can test with a different kernel, but that could help confirming it's the same bug.
no usb_hid on stm32f405 feather? Is it the USB descriptor limitation?
er @ionic elk ^
Doing my homework, the difference are more "visible" in oral french, because it is less formal and the pronunciation might be different. In writing, it become less obvious. Actually, I noticed because I was hearing the word and it came with a quebec accent. So there seem to be no worries to have on written guide. The difference might be that in Quebec they try to avoid word that are too English (in order to protect the language where they are a minority) where in France, there is a better acceptation of English (technical) terminology and less attempt to find a French version of the word.
Of course, while watching movies, having the right version can be key. 🙂
This sounds similar to #3268, which occurs on other platforms. See the links there to the linux-usb mailing list and to the Launchpad bug report.
There may be multiple crash causes. I fixed one, which is that storage.erase_filesystem() would frequently crash the Linux host. I was told that Linux would not guard against strange behavior by the USB filesystem.
People have also seen crashes on disconnect (e.g., pulling the USB plug). It's not clear whether this is filesystem-based, or du...
@dhalbert in my case it was a crash on disconnect or hard reset
@onyx hinge I don't know, somebody changed the USB system - I don't even see a category for "USB_DEVICES" in the mpconfigboard.mk files anymore so I have no idea what's set
This is a screenshot of some SPI transactions at 2MHz baudrate on a SAMD21 with the RFM69 radio -- you can see a longish transmission at the end when a full packet is sent. What I don't understand is why there is all this "dead" time. why is there a full ms between SPI transactions. The code is just polling a flag then sending the packet when it is ready. The bottom panel is CS and it is only toggling about once every ms. Does this have something to do with the "power savings" changes?
Is there some option to prevent USB input devices from being
enumerated at ESP32-S2 (keyboard, mouse, consumer control.
and something input generic)
They appear by default even though no user's python code
is handling them.
hmm defining CIRCUITPY_USB_HID stops it enumerating. Probably isn't enabled due to the endpoint limit, but unlike esp32s2 exceeding it doesn't cause a prompt crash(?)
I'm sure I used that option in my PewPew boards to disable midi and hid, but it seems that it's not there anymore...
It used to be USB_DEVICES = "CDC,MSC in mpconfigboard.mk.
See supervisor/supervisor.mk for how USB_DEVICES is set. It is not computed based on whether various modules are enabled or disabled.
USB_DEVICES = "CDC,MSC,AUDIO,HID" was the full list.
You can adjust which HID devices are present as well. The full list is:
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
The USB devices are enumerated after boot.py runs, but before code.py or the REPL runs. It can't be done completely on the fly without doing a USB reset; you can't ad...
EDIT to previous comment: "now", not "not"
no, adding the endpoint limit check at 4 doesn't trigger an error at build time. shrug oh well, I can live without
I didn't THINK it's any chip specific stuff to implement HID, but what do I know
no, it's not
..and fix a problem with an off-by-1 error in the check
Letting this hang until pidcodes approves seems like a mistake, given that pidcodes has gone dormant. Since it's in a PR to pidcodes, and presumably no one else has asked for the same PID (maybe double-check) in another PR, I think we could go ahead and approve. Sound ok to you, @tannewt?
For Reference if anyone is looking, here is the same SPI sequence but on an M4 -- the CS toggling is ~ every 250 microsec.
Through repeated use of ESP32 log messaging I've pinned down the null dereference to this exact point: https://github.com/adafruit/circuitpython/blob/24fb08dbd9a16e83aded3f0874bc96fcd0462fea/py/runtime.c#L1527, but... there's nothing there. The pointers that go into it are valid, and the call itself is actually just an inline macro with nothing interesting about it. https://github.com/adafruit/circuitpython/blob/24fb08dbd9a16e83aded3f0874bc96fcd0462fea/py/nlr.h#L144
I thought this might be...
Can I use DigitalInOut inside boot.py? So that once we can control the USB devices in there, I could make the MSC enabled only when a certain key is held on my keyboard, or something like that?
sure, other people do that kind of thing all the time, mostly to enable/disable remount of the filesystem to rread/write
Mentioned this awhile ago on Discord, but thought I'd chime in here.
I'm working on a tutorial and have a bunch of example scripts all stored on the CIRCUITPY drive. Switching between them requires manually renaming or copying files to code.py/main.py. This gets tedious so I wrote a menu script that lists the available other scripts on the CIRCUITPY drive. Selecting one runs it using Import. This works, in general. The problem is that larger scripts can overflow the heap when imported even...
neat. that solves my problem
I have exactly the same use case for my game consoles.
We would not enhance sys.exit() for that purpose, because we aim to be a subset or the same as the CPython version. But we could certainly add it to supervisor, such as adding an arg to supervisor.reload().
Ok, I gotta back up a bit. @tulip sleet @slender iron , what exactly is "nlr"? and what version of nlr_jump are we using, and why? There's several different varieties, most of which are written in assembly.
what is setjmp?
multi-frame jump in C, quite old
And what is it doing, exactly? I can see that it takes an obj_t casted as a pointer. But from there on out I'm lost
Adding it to supervisor.reload() would be perfect.
you set up something that will catch a raised exception, and then call a routine. If that routine or something it calls raises an exception, it returns back to the catcher. Basically try-except in C
Blows up as soon as Port.c. I'm thinking that any call to ValueError is actually busted
@ionic elk Sorry, in the code. It won't work if the VM hasn't started yet.
@slender iron should it return a null reference exception if the VM isn't started?
I don't think so
i had the exact issue when working on _bleio HCI. I threw an exception when VM wasn't ready, and I got an nlr error which printed out on the next REPL invocation.
but it should call the function still
Call which function?
if you do an nlr_jump and there's nothing to catch it, that's trouble
I'm sorry for asking all these questions but this is all so over my head, what is supposed to be catching what?
reset_into_safe_mode
I haven't worked with the exception system before so I'm learning a lot for the first time looking into this
I don't understand the nlr stuff very well either
So, if I understand this correctly, the NLR jump is trying to go to someplace in memory that maybe isn't set up to receive it yet?
it's trying to unwind the python stack
Though I don't understand how a function would not be set up, is that a VM thing? I must sound like an idiot here, I haven't worked with the VM at all
what does unwind the python stack mean?
it means stop the function you are doing and continue the outer function to give it a chance to catch the error
and repeat if the outer function doesn't catch it
stop the python function, you mean. So, this is a way for the python code to do the try-except stuff
right?
correct
that makes a lot more sense, ok
C code can also invoke Python exceptions. We do that al lthe time, but we're assuming you invoked the C code from Python.
and that's why this would all fail if the stack is corrupted already
or if the C code was not called from Python
if there's nothing to "back up" to, the jump in memory will explode
yes, it's an uncaught exception, and it goes out through the roof
hmmm. Well, I know that it's being called from python, because it only happens when I have the specific line in the python code, and even then, only when the I2C device is successfully plugged in
But I'm not really sure how to move the exception back in the python code to try and find where it breaks. Do I try to figure out what common hal calls the python code is making, and stick random valueerrors in their construct functions?
you can set a breakpoint on mp_raise_msg() and see what things look like from there.
and I usually put a bunch of print statements inside the python code to see how far it got before the crash.
I guess I'll get GDB up and running then, no putting it off any longer.
But I know pretty clearly where the exception is failing
It's just not clear where the stack corruption is happening
i couldn't find it in discord, but did you see a memory error 65536 something before that?
or maybe that was someone else's problem
Here's my issue https://github.com/adafruit/circuitpython/issues/3334
so do you know which python line is throwing the error?
This is a null reference exception that occurs in display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=64) in a ValueError message call inside I2CDisplay construct
^so yes
but there's already an I2CDisplay constructor call in the previous line?
anyway, yes, set the breakpoint on that mp_raise, and you should be able to poke around and find out what's going on
i gotta go pick up a grocery order
While I don't have breakpoints, I've been poking around with the messaging, and nothing is out of place. All the input variables to the exception are fine
but the stack might have been smashed up before that somehow
But it sounds like those aren't actually the issue, it's the destination that it calculates
right
what kinds of things can smash up the stack?
out of bound overwrites to a buffer on the stack
ah
it -could- be a problem with the nlr implementation for ESP32, but that's less likely
One last question before you grab your groceries, what's the intended behavior if you call a ValueError or something before the VM starts, like in port_init
what is it supposed to do?
it resets into safe mode with an NLR error that will be reported when you go into the REPL
So clearly the IDF is interfering with our ability to drop into safe mode, in that case
MICROPY_NLR_JUMP_FAIL is the safe mode reason
if you set a breakpoint at reset_into_safe_mode(), you imght see something. I think Scott mentioned that already?
I don't think so, the IDF is stepping in way before we get to that point
At least I think so... hard to check with the messaging approach. I'll probably work on getting my GDB on the ESP32 set up in the short term.
I have ported a small project for ECP5 JTAG programmer
from micropython to circuitpython:
https://github.com/emard/esp32ecp5/tree/master/circuitpython
Last known good circuitpython that runs it correctly was this:
adafruit-circuitpython-espressif_saola_1_wrover-en_US-20200827-fe73cfb.bin
In later versions 2MB PSRAM support appears which is absolutely great,
but now SPI is either not working or has issues if initialized and deinitialized often.
This project needs to switch betwe...
good luck! it will be worth it for now and the future
Anyway, I'll let you get to your errands, thanks for your help!
What happens with SPI? It's possible the external RAM prevents DMA.
(I have a JTAG library started here: https://github.com/adafruit/Adafruit_CircuitPython_JTAG based on tinyfpga's programmer for the Mach XO2)
I'd say SPI doesn't work at all now :) but I don't know the details,
for this I must analyze and investigate more.
Apart from glitches, what I see currently that it SPI doesn't send correct
data I pass it (probably it sends all 00 or FF) and reads all 0. Only the
bitbanging part is still working.
This project esp32ecp5 is in use whole year for micropython ESP32-WROOM for
ECP5 and now I got it also to work on ESP32-S2, almost at the same speed as
on micropython ESP32 dual core.
I've just been doing a substantial amount of testing using 20200825 on 5.3.0. I've probably done about 200 tests of my game across all the devices. One CPB with TFT Gizmo just spat out this very odd 65536 failure:
TXing <RpsRoundEndAdvertisement manufacturer_data=<ManufacturerData company_id=0822 data=03 43 fe 01 03 03 00 15 03 51 fe 14 > > interval 0.042
Listening for (<class 'RpsEncDataAdvertisement'>, <class 'RpsKeyDataAdvertisement'>, <class 'RpsRoundEndAdvertisement'>)
Traceb...
I have been refining a data logger running Arduino code on a Feather M0 with a 3.5" TFT over the last 2 years. I write Python programs as a day job and would like to transition the project to circuit python. My concern is whether circuit python on the M0 will be fast enough to refresh the display every second. If not every second, every 10 seconds? (I don't want to invest the porting effort if the result is unlikely to be performant.
The "every 1 seconds" should be fine. But the issue might be the memory on a M0 if you want to use displayio.
Can someone cross-check and confirm?
Most m0 boards do not have displayio. Check the support matrix for the board you are considering.
Yes, I saw that from another post. I'm actually using the Adafruit Feather M0 WiFi with uFL - ATSAMD21 + ATWINC1500. Is there a table somewhere that lists all the Feather CPU boards with their relative processor power?
@lethal maple the ATWINC1500 is not supported by CircuitPython. We are using the ESP32 co-processor instead for wifi
M0 (SAMD21) < nRF52840 (M4 internally); 64 MHz clock < SAMD51 (M4 internally); 120 MHz clock. The STM boards you could also go by clock speed. The SAMD and nRF have the best support, with the STM not far behind. i.MX is missing some things. See this: https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html
I have tried this pinout but it doesn't work for my ESP32-S2 and
adafruit-circuitpython-espressif_saola_1_wrover-en_US-20200827-fe73cfb.bin
gpio_csn = board.IO34 # SD_D3
gpio_mosi = board.IO35 # SD_CMD
gpio_sck = board.IO36 # SD_CLK
gpio_miso = board.IO37 # SD_D0
full source for my SD mount attempt is here:
https://github.com/emard/esp32ecp5/blob/master/circuitpython/sdmount.py#L1
A CLUE just blew up with another distinctive number 42241. I checked my notes and I've had two of these before on a CLUE.
TXing <RpsRoundEndAdvertisement manufacturer_data=<ManufacturerData company_id=0822 data=03 43 fe 03 03 03 00 1b 03 51 fe 1a > > interval 0.042
Listening for (<class 'RpsEncDataAdvertisement'>, <class 'RpsKeyDataAdvertisement'>, <class 'RpsRoundEndAdvertisement'>)
Traceback (most recent call last):
File "code.py", line 448, in <module>
File "rps_comms.py", ...
Thanks for adding this. So that we can keep a consistent interface, could you place the additional information under the description section? Thanks.
Yes, no problem. I moved the lib reference under the features.
hello!
I’m trying to make a “BLE HID receiver” - gets a BLE HID report and passes it through to USB HID. Problem is I’m not sure how to get the report from the BLE connection - I tried .device[0].report to the connection (it’s a ReportOutobject) but it’s always a bytearray with ‘0x00’. pointers? I know that the BLE HID central is not implemented but I don’t need to translate the report to a letter, I just need to pass it through
@tulip sleet got a minute for some SPI/sleep questions?
ah -- you must be busy -- nevermind -- I'll check back later -- need to head out soon myself. I'm trying to understand why polling an SPI register is taking so long. On M0 there is ~ 1ms between reads, on M4 about .25 ms... just wondering if this has something to do with the "sleep_until_interrupt" in port.c -- Is there a way to disable the power savings sleeping?
I'll be AFK for a few hours -- will check back later.
@tulip sleet I was just having another look at https://github.com/adafruit/circuitpython/issues/3119 and I might have discovered something else. I have a basic start_scan running on REPL just listening for anything and it terminates early. I set it running with timeout=7200.0 and it stopped after about 10-11 minutes. Is there any legitimate reason for it to terminate early?
@slate scroll a "BLE HID receiver" has to be a central, because it's talking to a remote BLE HID peripheral. So I'm afraid you're out of luck at the moment, sorry!
@simple pulsar there may be a scanning timeout deep in the nrf SoftDevice. I'd have to look it up
@solar whale I was on but had not started discord. do you see the same problem in 5.3.1, before the sleep stuff was added?
@simple pulsar the scan timeout we pass to the SD is a uint16_t in 10ms units, so maybe it's overflowing
I was getting 18000 ads at around 650 seconds when I specified 7200.0 with a little bit of variance on both time and count. I'm just trying it without a timeout
yes, so 7200 seconds is 7200*100 10ms units, which will certainly not fit in 16 bits
we should validate the timeout size
the actual max would be 65535/100 seconds
Ah, sounds about right, it's lasted 648.035, 648.112, 648.035 in my tests which is a bit under what one might expect. These are on-device values based on time.monotonic_ns() so perhaps they're not spot on but it's more than a few ppm.
(7200*100) & 0xffff
64640
sounds close!
646.4 seconds is what 7200 will truncate to
it's just an accident that 7200*100 truncated to 16 bits is close to 65535
Shall I log a ticket for this?
I can do it quickly.
The timeout size for an nRF SD scan (if one is given) is 16-bits, which is in units of 10ms. common_hal_bleio_adapter_start_scan() should validate that the incoming timeout will fit. Currently it does not, so any value gets converted to 10ms units and then is truncated to 16 bits.
My REPL experiments with timeout=7200.0 yielded actual durations of 648.035, 648.112, 648.035 based on time.monotonic_ns() timing on a CLUE (with auto_refresh off) running 5.3.0.
Merged this for now; if necessary we can change the VID/PID later.
The ESP32-S2 includes a limited hardware security module which Espressif calls the Digital Signature Peripheral.
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/peripherals/ds.html
The Digital Signature (DS) module provides hardware acceleration of signing messages based on RSA.
It uses pre-encrypted parameters to calculate a signature. The parameters are encrypted using HMAC as a
key-derivation function. In turn, the HMAC uses eFuses as input key....
@tulip sleet Thanks -- good idea -- I'l try 5.3.1 -- I was also just hoping to understand the sleep a bit better.. When does it sleep?
it sleeps when it has nothing else to do. It checks for background tasks every msec or less. If there's an interrupt it wakes up before the msec is over. The SPI code is synchronous, so it should not be sleeping when trying to read.
if it were async, then there would be an interrupt to service reading the data, and it should not be delayed
but is a "while" loop "nothing to do" so if I am polling in a while loop does it sleep?
@slender iron @onyx hinge @ionic elk I have merged a few more minor PR's, and plan to do an alpha.3 release today. Anything left that you think should go in?
@solar whale what are you calling in the loop/
testing with 5.3.1 is the definitive test, though. I can discuss in theory but if there's a bug that would show the difference
if you are calling SPI.read_blah() it should not sleep
ok -- yes -- calling .read_into()
I'll do the 5.3.1 test -- will take a few minutes to get setup
@tulip sleet hmm -- same under 5.3.1 -- so why so slow?
could you point to the code?
@tulip sleet nothing from me. Thanks!
@solar whale it uses BusDevice. Is it on its own SPI bus? If so there's no real reason to use SPIDevice to lock the bus, etc.
It is same SPI bus any otehr device will use
I don't see anything obvious going on but there is a lot of code between each read. you could comment out parts of it and see where it's spending it's time. You could toggle some pins to note where you are
why does this have its own read_into instead of using the regular one?
I have no idea ... that was before my time....
maybe I should try reworking it to use the otehr one.
but first maybe try to see where it's spending its time. Comment out things and see how long a single read takes with time differences, maybe
OK -- I'll keep exploring = maybe try some other SPI devices as well-- thanks
This broke in the build: https://github.com/adafruit/circuitpython/runs/1042094212?check_suite_focus=true. Maybe it's due to ESP-IDF changes?? I will revert this out for now.
@sabas1080 could you take a look?
Reverts adafruit/circuitpython#3238
Build broke; see https://github.com/adafruit/circuitpython/runs/1042094212?check_suite_focus=true
@slender iron could you approve this revert? https://github.com/adafruit/circuitpython/pull/3342. The BastWifi build broke (it worked a few weeks ago, but something has happened in the meantime). Thanks.
@onyx hinge ^^ could you approve instead? Scott is afk. tnx
@tulip sleet taking a look
@tulip sleet you're confident that this is a real problem with the bastwifi PR and not a cache problem or temporary network problem? fatal: clone of '/home/runner/work/circuitpython/circuitpython/ports/espressif/asio.git' into submodule path '/home/runner/work/circuitpython/circuitpython/ports/esp32s2/esp-idf/components/asio/asio' failed
I can re-run. I was suspicious because it was the only bad one. I'll let you know if it repeats.
A good build said: -- Initialising new submodule components/asio/asio... Submodule 'components/asio/asio' (https://github.com/espressif/asio.git) registered for path 'components/asio/asio' Cloning into '/home/runner/work/circuitpython/circuitpython/ports/esp32s2/esp-idf/components/asio/asio'... Submodule path 'components/asio/asio': checked out '3b66e5b051381fb70de9c2791df70a06181c64e3'
A bad one said: -- Initialising new submodule components/asio/asio... warning: could not look up configuration 'remote.origin.url'. Assuming this repository is its own authoritative upstream. Submodule 'components/asio/asio' (/home/runner/work/circuitpython/circuitpython/ports/espressif/asio.git) registered for path 'components/asio/asio' fatal: repository '/home/runner/work/circuitpython/circuitpython/ports/espressif/asio.git' does not exist fatal: clone of '/home/runner/work/circuitpython/circuitpython/ports/espressif/asio.git' into submodule path '/home/runner/work/circuitpython/circuitpython/ports/esp32s2/esp-idf/components/asio/asio' failed
I'll approve so you can merge depending on the result of a re-run
thanks!
Approved pending a double check that this is a "real" failure, not a spurious failure. @dhalbert will verify and merge if the problem repeats on a fresh Actions build.
@tulip sleet I'm on the trail of this rgbmatrix crash but I think it's not desirable to continue to hold the release for something that only got handed to me last night / this morning
i expect another release as early as next week, so i think it's fine
@gilded cradle - Darn. Looks like another PR on the horizon. The Markdown Preview in VSCode adds the newline. Grrr... Sorry!
Ok @old smelt, should be a fairly easy fix. There's a way to compile locally to check. You can find them in the Repo readme: https://github.com/adafruit/circuitpython-org/blob/master/README.md
I should add those to the circuitpython.org learn guide.
Ok thanks!
@tulip sleet re: release, everything I had in the pipeline has been merged! Still hacking at DisplayIO and my SPI bug but those don't need to go in yet. So go for it.
@tulip sleet the asio thing is a failure I've seen before
the re-run is being successful. it was an unfortunate coincidence that particular board failed and led me astray :/
I've seen this failure before and don't think its a board issue.
its the downside of git submodules
The failure was a red herring. The re-run ran fine. Out of all the boards, just the seemingly relevant one happened to fail. Closing without applying.
Note that the build breakage wasn't caused by this PR. It is flakiness in the ESP build.
Fine with me to merge too.
Note that the hardest part of this is storing the filename because the heap gets reinitialized before running the file.
Ok, we'll need to retest SPI. Please let me know if you have a simple test case that fails.
What CPython API would you implement with this peripheral? Or what would the CircuitPython API be?
Good point. Is this same issue handled in supervisor.set_next_stack_limit()? Or, is it a different problem?
Ya, it is similar but stack size is a fixed size so it's easy to just statically allocate it. We could simply have a char* array with a limit to start. If folks hit the limit often we could either increase it or make the allocation dynamic.
Greetings - I have question about renaming a board in the repo, is that ok to ask here?
Yes, you can ask it here.
I have one board in the repo - bdmicro_vina_m0, with another being submitted soon. vina_m0 is getting some updates and for consistency, I'd love to rename it to bdmicro_vina_d21. Would I do that (on a branch of course), using the usual git-mv operations, and update any other references to vina_m0 to vina_d21? Then submit a pull-request? Or is there another way you'd want me to approach that?
And sorry if I missed an FAQ or similar on this. Thanks!
ulab.linalg.norm function is in the documentation but not present on my version of circuitpython.
I'm using the following board:
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit Grand Central M4 Express with samd51p20
Thank you.
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit Grand Central M4 Express with samd51p20
>>> from ulab.linalg import norm
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name norm
@daring ridge yes, that's exactly what we'd expect, and you'd also want to update the circuitpython-org repo. Don't forget to look in all your board files to update the name as well.
@idle owl how would you recommend I add test running to the github actions workflow? maybe a new yaml file?
only a few repos have tests
Excellent, thank you @tulip sleet. I don't yet have it on circuitpython-org repo. It's not quite ready for my web site, so I figured that could wait until then.