#circuitpython-dev
1 messages ยท Page 327 of 1
Wait, that requires an API change in at least common_hal, right? because we need to double the size of write_value? it doesn't propagate up to the python end
write_value needs to be 2x size so it can be an invalid token, signifying that we can skip the memset because we don't care.
adding this flag or distinguished value doesn't help SD cards because they essentially always use write_value
but the python stuff doesn't need to know that, it just gets set as the invalid token by default and if they don't specify it, it'll be ignored
no, just always do the memset
Ok, sounds good, that's all I needed to hear ๐
and if people find it too slow, they can optimize it
but the behavior will be more correct now
@ionic elk did you change optimization flags when doing this measurement?
I did move it down to DEBUG yeah, since it was optimizing my DWT variables away.
so that probably makes it slower too
In a bad way, I think? Because the memset probably isn't any slower, but the SPI read might be?
Seems like a concurrency issue when reading the underlying timer(s).
I figured it wouldn't be too crazy of a difference since neither operation is too nested
memset is something built from source, so it would be slower if optimization is off (often, on desktop systems, the standard library is optimized even if your program is built for debug)
interesting, memset() only optimizes storing zeros [by storing them 4 at a time if the output is also aligned] ```void *memset(void *s, int c, size_t n) {
if (c == 0 && ((uintptr_t)s & 3) == 0) {
// aligned store of 0
uint32_t s32 = s;
for (size_t i = n >> 2; i > 0; i--) {
s32++ = 0;
}
if (n & 2) {
((uint16_t)s32) = 0;
s32 = (uint32_t)((uint16_t)s32 + 1);
}
if (n & 1) {
((uint8_t)s32) = 0;
}
} else {
uint8_t *s2 = s;
for (; n > 0; n--) {
*s2++ = c;
}
}
return s;
}
It's against the open, accessible philosophy of CircuitPython.
The only advantage of it is reducing memory overhead during load. Otherwise, plain .py should be used.
Some folks think the obfuscation provides a level of secrecy of their code but that's more of an illusion than reality. All variable names are preserved and no optimization is done on the byte codes that I know of. So, it'd be straightforward getting something like the original code back. Only comments would be missing.
Is there a good way to mark variables as un-optimizable so that I can use them for debugging in higher optimization settings?
anyway I think don't sweat the speed, it looks like there would be a reasonable speed-up available when someone goes looking (by adding an optimization of memset)
like my DWT start, mem, end vars in the example above?
@ionic elk I mark them as volatile
I would suggest volatile as a first try too
^aha good trick yes
Ok, thank you for the comments! I think it's a good balance between a fully greedy solution and one that won't take forever. :-)
Let's say I wanted write a python script to do a bunch of things and one of those things was calling a circuitpython board (like the M4 feather express) to periodically do something for me (like step a nema 17). How would I do that? How would I call a circuitpython board from a python script?
Some SPI devices on STM32 have been having difficulty connecting, particularly SD cards and some breakouts such as the NRF24L01. This is because the STM32 HAL does not have defined behavior for its output pin (MOSI) when performing Reads - SD cards and the NRF24L01 require specific values such as 0xFF or a key value, but during a HAL_SPI_Receive, this line will typically just be random junk. This is supposed to be handled by setting the write_value parameter - however, the STM32 port prev...
@robust kernel assuming your python script is on a computer, or another circuitpython (CP) board, you'd connect the two via a serial port (network connection etc) and have the python script on the CP board poll the serial port (or other connection) for a command, and execute it (step the motor.)
Finally done with that issue! On to RGBMatrix.
Thanks @hearty forge. Do you have any example code for that? So, just to be clear, you're talking about communication over an ethernet cable?
I'm noticing there's some disconnect in the way the docs appear/are ordered between the GH repo and especially RTD. If you browse GH and look in /docs you get the info re building the sphinx docs; worse, on mobile you don't see the list of other files. I'd like to move /docs/index.rst -> /docs/readme.rst, and /docs/readme.md -> /docs/build-the-docs.md (and update /conf.py to use readme.rst as the first page of the docs.) If that seems reasonable I'll make a pull request in a day or two. I'd also love to see the sphinxdoc templates/machinery moved out of there too... but I don't know if that can be done with out breaking RTD.
@robust kernel - sorry, no; you're a couple of steps ahead of me- I just got a CP capable board, and am at the research stage of figuring out what I need to do to make what I want ;-). But I'm not talking about an ethernet cable specifically- just some kind of connection. The simplest might to use a usb cable from the computer -> the CP board... the REPL uses this. You should be able to do the same from your code running on the CP. I couldn't find a learning guide covering using the USB serial port (the UART examples are about setting up a 2nd (3rd...) serial port) but did find this stack overflow: https://stackoverflow.com/questions/48922189/receive-data-from-host-computer-using-circuit-python-on-circuit-playground-expre . But the built in USB serial port might be used for other things- eg where error messages are sent. That might mess up your communication. If it was me, I'd pretty quickly move to using a 2nd serial port as per the learning guide (https://learn.adafruit.com/circuitpython-essentials/circuitpython-uart-serial) that's dedicated to my motor control commands, leaving the built in USB-serials for error messages/REPL etc. Slightly annoying (but very useful) having the two cables for development but I think it's good practice to have a dedicated coding/debugging port.
thanks @hearty forge !
@hearty forge why do you want to change the docs?
@robust kernel There are some examples of controlling CP boards over Bluetooth in the learn guides https://learn.adafruit.com/category/circuitpython . The #help-with-circuitpython channel will be a great resource as well.
On mobile, go to repo. Go into Docs. List of files is truncated. You see the "how to build sphinx docs" readme... you might assume the docs directory is only about sphinx and miss all the golden info there. By swapping the files around, GH should show the contents of the (current) index.rst file as the description for the directory. This is based on the assumption that I'm not the only person in the world that fills waiting time in queues etc browsing github ๐
@slender iron
looks
(ok, double checked, once you click into a directory on GH mobile, it does show all the files... but the readme content is presented larger, and that's what I read first. I can't be the only person that reads readmes?! ๐คฃ)
maybe the readme just needs a link to the built docs
the docs on the repo itself don't include any of the api info since its in the .c files
Agree. Having all code as .py would be optimal. But, since microcontrollers are resource constrained there are reasons for using .mpy files (e.g. the library bundle). And, once CircuitPython allows .mpy for modules, you can have a top level main.py that just imports a .mpy and it seems like you're back to code that's not open and accessible. So, not allowing .mpy at the top level doesn't seem to gain much and creates an artificial inconsistency. FWIW
There are the micropython library doc files. Made it harder to casually spot porting.rst which answers most/all the questions I ended up bringing here- and the other "so you wanna make a port" info. How about I try moving the readme.md and adding a new one with links and a bit of info in my fork. I'll ping here when it's done. If you like, it becomes a PR.
sounds good
I would squeeze this in somewhere: # https://learn.adafruit.com/building-circuitpython
I didn't know about it til asking https://forum.micropython.org/viewtopic.php?f=17&t=8553 but MicroPython can access memory via machine library. The docs say read but the reply implies write works too. Is there a reason not to use that as a basis for this functionality?
That has three different sizes mem8, mem16 and mem32. That might be to allow single/atomic reads/writes?
Pic looks awesome! I've merged both PRs so I'll close this. Thanks for the addition!
What if the data section is > 64k? Why not create a separate section for canram? How big is it?
Here is a first pass. Thanks for your work on this!
What does this have to do with this PR?
common_hal_canio_message_rtr_set(self, mp_obj_is_true(rtr));
@stuck elbow @copper crescent I have a piece of test code for uGame10 that test gamepad: https://gist.github.com/dglaude/431d076106891bf14c081e36fe4653a1 Right now, the feeling with the latest 6.0.0.alpha3 found here https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/ugame10/en_US/ is that I am frequently loosing key press. Something like 1 out of 10, but this is very variable. Once again, that is an M0. I guess I need to test various version to see if there are release where things where OK and then try to identify when it went wrong.
@onyx hinge have you bricked any of your RGBMatrixes?
Mine isn't responding to anything right now and I'm wondering if it's just dead
But I dunno how hard that is to do
.... aaand nevermind bonking it on the table made it work.
@kevinjwalters I think that the API is similar. I was assuming we'd do atomic writes if the data given is the correct length and alignment. Acting like a bytearray means it only works with ints 0 - 255 but also avoids the issue of needing longints for 32 bit values.
Vina M0 got some updates - including a rename. Rename the board to VINA-D21, update the boardfiles appropriately, and update the build.yml workflow to reference the new board name.
Tested using latest code as of now:
Adafruit CircuitPython 6.0.0-alpha.3-284-gc55deb54f-dirty on 2020-09-16; BDMICRO VINA-D21 with samd21g18
@thorny jay thanks for checking, I hope to be able to look into it during the weekend, but if you have the time don't wait for me
I did some further testing, and it isn't only the display that's affected. An externally connected SPI device works with USB power but
does nothing with battery power. Logic analyzer shows no activity on the pins to the device at all. So, it looks like all SPI is affected when qspi is disabled.
@thorny jay thanks for checking, I hope to be able to look into it during the weekend, but if you have the time don't wait for me
@stuck elbow This is really hard to test. I have revised the test code to avoid any sleep that would disturb the result (but still having some debouncing). And I need to find a version with an obvious difference, with one version working and one not. I try to click Left/Right alternatively and if I see twice LEFT or twice RIGHT I assume it a missing key press. Right now alpha0 and alpha3 seems to behave the same.
I got Adafruit CircuitPython 6.0.0-alpha.3-142-g683462c1b installed on a ESP32-S2-WROOM module. Can someone post a simple example of how to do a get request. I think I got lost reading old docs? I get the error AttributeError: Objektet 'NoneType' har inget attribut 'getaddrinfo' so I think I miss some initialization?
@cobalt grail what version of adafruit_requests are you using?
6x-mpy-1.6.0
Hardware itself controlled by python code may not always require identical
electical condition as safe-to-leave state after deinit() because hardware has
memory too
Imagine red and green traffic light semaphores on a street crossing
and we want to
stop current circuitpython for a while for some reason - to use
different driving
method e.g. pwm, to upgrade or out of memory happened and it will force
deinit(). If there's no traffic some pull resistors will let all
lights be red or all off,
but...
(I requested your review 6 days ago)
@hierophect Please take a look.
@slender iron Same thing. Do I need to initialize something first?
what is your code now?
Just the line 'adafruit_requests.get("http://wifitest.adafruit.com/testwifi/index.html")'
Returns
Fil "<stdin>", rad 1, i <module>
Fil "adafruit_requests.py", rad 291, i get
Fil "adafruit_requests.py", rad 182, i request
AttributeError: Objektet 'NoneType' har inget attribut 'getaddrinfo'```
Btw; it has been pointed out to me that code.py should be localized as well. "Hello world" is not a swedish phrase. ๐
๐
@slender iron 8.8.4.4 ping 0.025 Traceback (senaste anrop): Fil "code.py", rad 34, i <module> Fil "/lib/adafruit_requests.py", rad 507, i get Fil "/lib/adafruit_requests.py", rad 494, i request Fil "/lib/adafruit_requests.py", rad 102, i __init__ RuntimeError: Unable to read HTTP response.
how old is your build? there was a bug fix to circuitpython
What do you think about leaving the board ID alone? aka, not renaming the folder. That will preserve the link to past versions. You can still change the product name it reports as.
Ah! OK, updated to todays build and it works! Thanks!
I did run out of memory on line 55 though.
That would work, of course, and then just update the board files. Would that cause confusion for end users and customers with regard to what board it refers to? For example, in the CircuitPython-org repo for firmware updates and similar?
I'd rather rename it if possible - but if it is a serious pain, then what you propose would work also. I just worry that customers might get confused as to what board to build if building from source. And it will seriously grate against my OCD. :-)
And,...
Followed the instructions and seem to work fine, as well as the debug stuff which I've never done before.
I agree on clarifying the port directory as an instruction.
thanks @idle wharf !
Closes #3403
I couldn't figure out a way to avoid doing a last minute conditional check in common-hal/wifi/Radio.c because the bssid_set flag needs to be set only if you're specifying a specific MAC. If you're not passing in a bssid, but you happen to still set the bssid_set flag, the connection will fail and you'll end up returning WIFI_RADIO_ERROR_NO_AP_FOUND so that's no good (and a bit confusing).
I needed a way to check the bssid length as an initial sanit...
@thorny jay for me going through the downloads for the Feather M0 Express GamePad was OK (as in I get >=8 out of ten presses registered) in 10c5bf6 but broke (lucky to get 2/10) in b3b6a64 - looks like quite a few changes between those two though :(
@DavePutz I tested it on nrf52840 m.2 devkit which has a SPI display. Turning off QSPI doesn't affect the SPI display.

My test code is:
import time
import board
import digitalio
@micropython.asm_thumb
def mem(r0):
ldr(r0, [r0, 0])
@micropython.asm_thumb
def mem_write(r0, r1):
str(r1, [r0, 0])
peripherals = {
'RADIO': 0x40001000,
'UART0': 0x40002000,
'UARTE0': 0x40002000,
'SPI0': 0x40003000,
'SPIM0': 0x40003000,
'SPIS0': 0x40003000,
'TWI0': 0x40003000,
'TWIM0': 0x40003000,
'TWIS0': 0x40003000,
'SPI1': 0x40004000,
'SPIM1': 0x40004000,
'SPIS1': 0x40004000,
'TWI1': 0x...
On issue #3360, it seems turning off QSPI doesn't affect the SPI display too.
@teal bear thanks for the link. So much good docs... just not always easy to discover one silo from another. Will try to put something coherent together...
I realize this is pretty open ended, but can the community help with this type of thing?
The code for this project needs extensive revision due to changes in CircuitPython. Sorry!
https://learn.adafruit.com/circuitpython-ble-remote-control-on-off/server-code
Or has anyone done any office hours or recorded sessions where they tackle something like this? I'd be glad to help, not sure where to start though.
@molten zephyr It's on my list to revise this code, but I don't have a schedule at the moment.
However, I'm working on similar code right now, so it's not far from my current work.
Super cool, I'll keep my eye on it then. Thanks for the heads up.
Thanks! No testing performed on my end but this is much what I expected to see
@slender iron sorry, will check out tomorrow morning first thing.
Is there a manual step to turn a library merge into a release?
@crimson ferry on the right of the page, click on โreleasesโ then tap โdraft a new releaseโ
This is using the old page format, but the rest of the information is ok https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/releasing-on-github
Note: if it is an existing library, all the steps after updating the description are automatic. I just cut/paste and edit the description from the previous release.
@solar whale Thanks. I don't see any way to create tags or releases. It's an Adafruit library, I probably don't have that level of access.
huh did the list of the supported modules intentionally disappear from the circuitpython.org website? Am I looking in the wrong spot?
@gilded cradle ^^ who would I ask about this?
@crimson ferry I'm sure permissions can be granted.
@onyx hinge, it wasn't intentional as far as I'm aware. It might be some PR didn't pull in changes before getting merged or something along those lines. I'll see what is causing it to not appear.
Thank you!
@onyx hinge code is still there, but the module data is not. I'm not sure what generated it.
when the release workflow failed (https://github.com/adafruit/circuitpython/runs/1042872921?check_suite_focus=true#step:9:1), the manual update didn't include the support matrix data (https://github.com/adafruit/circuitpython-org/pull/530).
With the fix to shared_bindings_matrix.py (https://github.com/adafruit/circuitpython/pull/3352), future releases should update the info again.
@slender iron any particular sketch you'd like me to test on your SPI PR? Or will anything running on the WROVER be valid?
@ionic elk I just did a write of known values and checked the output with a logic analyzer
and then did a read of high and low
Also, how do you flash a .bin file by itself? Doesn't seem to be in docs
I'd look to see what command the makefile runs
@slender iron thank you for your reviews lately. I'm concentrating on getting functionality complete before I incorporate your suggestions.
I don't see any issues with the Saleae. However, I'm unable to get my standard BMP_280 test working on this or the old pre-sram version, and it sounds like there may still be an issue with the SD card similar to the one on STM32-S2. I'll investigate those and make new issues if required.
I could not figure out how to ensure a build-time diagnostic if the data does not all end up below 64kB.
"How big is it" depends on the max message size, number of RX FIFO entries, the number of RX filter entries, and the number of TX FIFO entries we decide on. Right now it is configured for near-minimal RAM usage:
#define COMMON_HAL_CANIO_MAX_MESSAGE_LENGTH (8)
#define COMMON_HAL_CANIO_RX_FIFO_SIZE (3)
#define COMMON_HAL_CANIO_RX_FILTER_SIZE (4)
#define COMMON_HAL_CANIO_TX_FIFO_...
Nothing. It's here by accident. If I rebase the branch I'll try to drop this patch. Here's the explanation for that change from its commit message:
supervisor: Improve serial connection detection
These changes remove the caveat from supervisor.runtime.serial_connected.
It appears that _tud_cdc_connected() only tracks explicit changes to the
"DTR" bit, which leads to disconnects not being registered.
Instead:
* when line state is change...
The implementation of "Message" is shared among all ports, so I placed the implementation in shared-module. Is that correct? Is the only problem that the related function declarations go in shared-bindings/<module>/<type>.h and not in shared-module? I had not figured out this pattern yet. :frowning:
"Remote Transmission Request" (RTR) messages have a size but no meaningful data: rtr_message = Message(id=0x408, rtr=True, size=8)
Non-RTR messages have meaningful (hopefully) data: std_message = Message(id=0x408, data=b'adaf00')
For readinto (which can result in an RTR message or a non-RTR message), one Message class has to allow both options. So that constructing an RTR message didn't require allocating a dummy bytes() object of the desired length, I made data and size (could...
Unrelated commit in this branch. Its change message:
samd: SPI: improve conditional code
I recently misdiagnosed a "maybe-uninitialized" diagnostic as a bug in
asf4. However, the problem was in our SPI code.
A special case for samr21 MCUs was being applied to same54p20a and possibly
other D5x/E5x MCUs, since the check was simply for pin PC19 existing at all.
Change the check to use the macro PIN_PC19F_SERCOM4_PAD0 which is only
defin...
@onyx hinge all good ๐
CAN can only send messages of specific lengths. Basic CAN messages can have zero to 8 bytes, while CAN FD (which we don't do yet) adds specific larger lengths (16, 24, 32, ...). It's fair to require users of the library to supply a length that matches what we support, in exchange they get notified when their message isn't an appropriate length.
The use case for specifying size and data would also call for adding a start= argument: the hypothetical `Message(id, data=buf, start=32, size=8...
Both STM32 and SAMD51 support 4 modes: normal, silent, external loopback, and silent loopback. For feature parity with the MicroPython CAN implementation, we need to support all 4 modes.
- normal mode: this is self explanatory. Send and receive messages
- silent (also known as monitor) mode: Sniff a CAN bus while being confident you won't disrupt its operation
- (external) loopback mode (also could be called "tx only"): super useful when developing CAN transmitter code because it me...
Doing the latter, the parameter will be called match.
@onyx hinge Message(id, data=buf, start=32, size=8) is start and size to make it easier to deal with the message data being a fixed size, and likely the user only wants to use a few of the bytes?
@teal bear yes, similar to what busio.SPI.readinto does (though what I proposed doesn't exactly match, it uses start= and end=, while for the rtr case I really think the parameter needs to be size= or length=): https://circuitpython.readthedocs.io/en/5.3.x/shared-bindings/busio/SPI.html#busio.SPI.readinto
but that's hypothetical and not initially what I'm going to implement
it's really in "You Ain't Gonna Need It" territory, copying up to 8 bytes around 2 or 3 times is not going to have a huge impact on performance, so just write message(id, data=buf[32:40]) in this case
I think it clutters the api, which makes it harder to understand. not insurmountable, but I suspect it isn't necessary, and the user will need to deal with serializing data anyway
@teal bear I don't consider optional kwargs clutter
though I think start and end match other apis better
@slender iron OK I think I got all your review items but you wrote a LOT so I probably missed one. ๐ฎ time here, ttyl.
๐ I've queued up all my review items and will probably do it last
Do you want me to rebase to drop out those two commits that are unrelated, but well-intentioned changes?
I'd like to move away from mpy in the long term. Allowing code.mpy will make that harder.
@onyx hinge how about after I reply to comments? I think a rebase will mess up the existing comments
since the commits change
@slender iron yeah that was my concern too! Rebase is nice but github doesn't always cope with it as well as it might.
yup yup. I'm ok waiting. I can ignore for now
What if @classmethod Message.rtr(rtr, length) ... ? but srsly ๐ฎ ๐ฅฃ etc
I'm around all day so go eat
@slender iron if other api's have similar thing, then it is less clutter and more consistent, but I'm still a little skeptical it makes it better for the user
and ya, that would work. though I don't like the rtr acronym
I'm just excited the implementation is coming together
@teal bear it's there to allow subslicing without creating an intermediate object
that's why its start and end
@slender iron I get what is doing, I just think it is out of place
I can give you 10+ optional parameters that might be helpful, and anyone reading the docs would be a bit overloaded reading about all these nifty options.
Thank you all. Looks like discussion has settled on this PR and it's been tested. So, approving and merging.
Makes sense. And, as you point out, there is very little real advantage for .mpy at the top level. And, it's not required for my use case. :-)
not kidding: I would like a list of bit sizes, so that I can pack 10 6 bit numbers into a 64bit message.
but I don't think this is the place for that
@bd34n I think some of my confusion comes from the current state of your board. Is it already for sale? Are you ok losing the link to the stable 5.3.1 release?
If you are ok with that then I'm ok with you changing the board id.
This seems very weird that USB vs battery would be different. Does the Clue wake up OK in this case? It seems like it must be related to the regulator: https://cdn-learn.adafruit.com/assets/assets/000/087/877/original/adafruit_products__CLUE_sch.png?1580423083 The only difference it will see is 5v from USB vs <4.2V from the battery.
@xiongyihui Is your schematic open source? I wonder how the power circuitry differs.
@slender iron Woohoo! SPI working on saola_wrover -- I can talk to my rfm9x!! Thanks!
great! thanks for testing
Hi guys, I got inspired by @ionic elk low power talk in the last cpy meet and started implementing some esp32s2 specific deep sleep functions in a separate module.
nice! like what?
Currently I am stuck and need some help regarding it
Hi @slender iron I have created a new common-hal module which calls the various deep sleep modes on the esp32s2.
kk, let me look
most of our sleep support is currently automatic when time.sleep has been called
time.sleep should be light sleep on the s2 ?
ya, the deepest sleep that preserves ram and the cpu
on arm it's the WFI instruction
we don't have an API yet for "set these wakeup sources and start from scratch when we're woken up"
deep sleep on s2 only keeps the RTC peripherals on
here is where we could light sleep: https://github.com/adafruit/circuitpython/blob/main/ports/esp32s2/supervisor/port.c#L176-L192
I have implemented some of those wake up features... timer, wakeup on io state change
cpy starts from scratch
cool! I'd love to add deep sleep support
will be updating my fork with the changes
ok great! here is one issue: https://github.com/adafruit/circuitpython/issues/696
there is no rtc_io support on cpy yet ?
the risc-v co-processor is a different story altogether
haha, ok. what do you mean by rtc_io?
what can I help you with?
Only half of the gpio's can be assessed by the rtc peripherals
the functions calls are similar, they just return different errors and also there is a check for if the io can be accessed from rtc peripheral
is that when the rtc is using them as a wake up source?
yes
they need to re configured as normal gpio via a deinit function after they are set as rtc_io
so they can be read as normal pins?
I was thinking of this as two steps. 1) Add the notion of "alarms" that can wake you out of a light sleep (#2795) and then 2) set alarms to wake you up from a deep sleep
2 would light sleep when on usb and auto-reload on wake to mimic
waking from a deep sleep when off usb
yes, the idf has some pre-configured wakeup functions linked to the io, if you want to have specific tasks for them then that is where risc-v comes into action
makes sense
I don't think we're there yet ๐
having deep sleep apis would be awesome
it'll require smarter libraries potentially too
๐ 
One small potential bug. Otherwise this looks really good! What is left to do?
How about adding an else condition to set bssid_set to 0? That way you can use bssid for one connect and then not for the next one.
I want to combine all the different wakeup functions into a single setConfig func.
why?
I was thinking you'd create one or more alarm objects that you pass into a sleep function
the function then returns the alarm that woke it
do you want to voice or video chat?
let me figure out where my mic is .....
no mic found guess will have to better preparation next time
no problem ๐
@analog bridge if you come up with a common-hal implementation that'd be a good basis for implementing the same thing in STM32 - I know a number of people using CPy for environmental monitoring that would jump at that.
here is my code.py implementation:-
import ulp
ulp.check() //returns wakeup reason
ulp.setwakeup(IO, board.IO0, 1, true) //IO: wakeup_func, board.IO: interrupt pin, level: 1/0, bool: enable internal pull up/down
ulp.setwakeup(TIMER, 1.0) //TIMER: wakeup_func, 1.0: time in sec
//Can have multiple wakeup func set at same time
ulp.start()
Having a setConfig func instead of multiple wakeup func directly exposed will reduce complexity and as @ionic elk points out.... will enable better support for other ports
so I was thinking we'd have one module for each type of alarm
let me rewrite your example
@molten zephyr I totally forgot that I had actually done most of the work to rewrite the BLE remote control switch almost a year ago, but hadn't had time to set up a test. Please see the changed files in https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/937/files. I did a smoke test of these but didn't have a chance to actually test the sending and receiving. If you would like to take a look and try them out, that would be great. You can add comments to that pull reaquest.
ulp is what I am calling it as in (Ultra-Low-Power) ๐ฉ๏ธ ๐ 
import supervisor
import pinalarm
import timealarm
active_alarm = supervisor.runtime.active_alarm # returns wakeup reasons, either objects equivalent to pin0_alarm or time_alarm. None if this is the first run.
pin0_alarm = pinalarm.PinLevelAlarm(board.IO0, True, pull=digitalio.Pull.UP)
time_alarm = timealarm.DurationAlarm(1.0)
supervisor.runtime.alarms.append(pin0_alarm)
supervisor.runtime.alarms.append(time_alarm)
something like this
individual alarm modules for each type because availability will vary between ports
can also do supervisor.sleep_until_alarm(pin0_alarm, time_alarm) for a light sleep
(though maybe it should be in microcontroller?)
thanks for the example implementation....... makes me understand better, let me look into this....
๐
the deep sleep is implicit by exiting code.py
I think we had some discussion about the best way to do that.
implicit is a bit weird but I wanted to make it clear that the python vm is done at that point
it basically makes code.py the inside of a loop
there are 7 wake up sources listed in esp-idf
Here is an example:
import supervisor
import pinalarm
import timealarm
pin0_alarm = pinalarm.PinLevelAlarm(board.IO0, True, pull=digitalio.Pull.UP)
time_alarm = timealarm.DurationAlarm(1.0)
while True:
# start with a light sleep until an alarm triggers.
alarm = supervisor.sleep_until_alarm(pin0_alarm, time_alarm)
# do something based on what alarmed
if alarm == pin0_alarm:
print("pin change")
elif alarm == time_alarm:
print("ti...
โ๏ธ is the light sleep version
@tannewt, totally understandable, I should have clarified when I submitted the PR. Vina-m0 is not for sale and never will be in the form it was. It got to a "coming soon" state. Then based on work on the M4 (D51) sister board, I went back and reworked some key areas on M0 (D21) to make them consistent w/regard to parts and on-board capabilities and redid all the PCBs, etc. I do have VINA-D21 up now, though. I'm working on getting the manual and associated documentation in order - I swear, tha...
I am kinda confused as to which one is the better approach
We won't have all the alarms under one roof with your method
right, but that is good because support will vary between ports
supervisor.runtime.alarms.append(time_alarm)
Below is an example. It is the deep sleep variant of this light sleep example.
import supervisor
import pinalarm
import timealarm
alarm = supervisor.runtime.active_alarm
# do something based on what woke us up
if alarm == pin0_alarm:
print("pin change")
elif alarm == time_alarm:
print("time out")
pin0_alarm = pinalarm.PinLevelAlarm(board.IO0, True, pull=digitalio.Pull.UP)
time_a...
supervisor.runtime.alarms.append(time_alarm) why are we supplying what alarm is configured ?
I feel like we need to tell the supervisor to pay attention to it
I'm open to other ways to do it
I think your approach is more consistent with other things in cpy
do you think it'll limit anything?
one thing that can be annoying is if we get the alarm module api boundary wrong
for example if pin level and pin edge aren't always supported but we put them in the same module
There are some very specific wake up functions for the s2 which would hardly be compatible with other ports
esp_sleep_enable_ext1_wakeup, esp_sleep_enable_touchpad_wakeup
the touchpad thing requires a lot pre configuring of the gpio
I could see how to make those APIs generic
the first is "multi pin alarm"
and the second is "touch alarm"
the s2 will probably be the only port to implement it but another theoretically could
let me come up with a template for both of the approaches on different branches in my fork
I have already got it part-way working
I think the tricky part will be recreating the alarm object
nice!
and for deep sleep handling on/off usb
I tested the timer-wakeup....... it is like being reset with complete power cycle
makes sense
starting with that as the first alarm could be good
even though it's equivalent to time.sleep() for light sleep
it is the easiest ๐
๐
back to the problem I am facing with my approach
since I am calling different functions with different variables to be supplied, how can I implement that (i.e. a single function with different variables depending on wakeup type)
I use MP_DEFINE_CONST_FUN_OBJ_VAR
you shouldn't ๐
you can just accept up to the number of positional arguments you need
and change the parsing based on the first one
thanks! good night
deep dive tomorrow ?
yup! though I don't want to keep you up even later ๐
will either talk about uf2 or do a release
we'll see what I feel like
that wont be a problem....... will meet you in the deep dive ๐
@tulip sleet Would you expect pull/937 to work on a circuitplayground bluefruit?
@molten zephyr there might be some pin differences. I tested it on a couple of Feather Bluefruit Sense boards (similar to plain Feather nRF52840. Otherwise it should work (but I did not test the sending part!)
How do I never timeout? I want this without an outside loop:
for message in can.listen():
print(message)
Ya, I'm not sure what the right term is. I'm suggesting making a peer to the .data and .bss definitions in the linker script that would be the first to end with > RAM which places it in RAM at the start. I think it'd be:
.canram :
{
. = ALIGN(4);
*(.canram)
} > RAM
Then .data you remove AT (_sidata) in favor of AT> flash_firmware next to > RAM iirc. (Check the iMX RT linker scripts.) AT> is where the data ends up in the binary and the > is where it is linked to.
Ya, placing the implementation here is what I'd do. I think you've changed it to how I would do it.
Anything called by shared-bindings goes in the shared-bindings .h file because it is a shared C api that all implementations must provide. The struct for the type is implementation specific so it either goes in common-hal or shared-modules and is why I prefer getter and setter functions instead of accessing the struct directly.
Okie doke. Will merge after the CI catches up.
@tulip sleet a release on your radar before your vacation? otherwise I'll either do one today or tomorrow
@slender iron I could do one tomorrow. I was awaiting a bunch of PR's which have now happened.
if you are bored you could do one :), but I'm happy to do the work
i was doing rpi ble stuff today
ya, I think we want #3432 and #3431 in at least
lets check in tomorrow and see. I'm considering doing it on my stream
though I need to stop procrastinating on the uf2 stuff
i could write the release notes if you want to demo actually making the release
help with that would be great
we can sync tomorrow on it
I would like to get another out this week
sure; i'm afk for several hours starting in about half an hour
i'll ping you in the morning
Since I have seen this baby on my radar, I wanted to suggest a release: https://circuitpython.org/board/matrixportal_m4/
@slender iron we do want to be using current black in new cookiecuttered repos, yeah? https://github.com/adafruit/cookiecutter-adafruit-circuitpython/pull/89
as long as it actually picks the latest version. I think that the 19.... was prerelease
@tannewt the only thing I'd like to do is to look at the set of parameters exposed after a connection is established to check/verify the details of the connection and know that you're connected where you think you are - right now there's really just common_hal_wifi_radio_get_ipv4_address to get the assigned IPv4 address, from which you can infer the subnet, but it'd be nice to have the gateway and the explicit subnet since they're all from the same esp_netif_ip_info_t struct.
@astrobokonon What do you think about doing that in a follow up PR? This looks good as-is.
@tannewt Yeah, I can do that in a different PR for sure.
This hangs, and the usual workarounds didn't work. Dan and I worked on it for awhile last week on Discord.
.. it doesn't really make a difference (the old code created an empty else{} statement) but this is more correct.
I recently misdiagnosed a "maybe-uninitialized" diagnostic as a bug in asf4. However, the problem was in our SPI code.
A special case for samr21 MCUs was being applied to same54p20a and possibly other D5x/E5x MCUs, since the check was simply for pin PC19 existing at all.
Change the check to use the macro PIN_PC19F_SERCOM4_PAD0 which is only defined if special function F of pin PC19 is SERCOM4 PAD0.
Reorganize the code a little bit so that brace-matching in editors is not confused by...
These changes remove the caveat from supervisor.runtime.serial_connected (that it always returns True if USB serial console was ever opened, even if USB is later unplugged).
It appears that _tud_cdc_connected() only tracks explicit changes to the "DTR" bit, which leads to disconnects not being registered.
Instead:
- when line state is changed explicitly, track the dtr value in _serial_connected
- when the USB bus is suspended, set _serial_connected to False
Testing performed (usi...
Phew, the not-related-to-canbus improvements are pulled out to their own PRs, to rebased out of canio later in the review process. It looks like a lot but it's all pretty minor stuff
Returning to this issue, notes so far after using a Saleae to capture the signal differences between the STM32F405 Express and the M4 Express. Test sketch: https://gist.github.com/hierophect/a8c75eed9725b4e2a3683a9ead61c5f7. I observed LAT, OE, A, B, R1, R2, and CLK. @PaintYourDragon and @jepler, here are my findings so far:
- ST frequencies on the A and B lines were over twice as fast as the SAMD. I cut them in half by doubling
_PM_timerFreqto 84000000 but they still don't match up ex...
I should amend the above to say I'm getting completely different data from R1 out of my saleae now, so I'm suspecting a hardware error on that, if one that frustratingly was exactly the same across both the SAMD and ST across two trials, apparently.
I think this might need to be tackled by someone with an oscilloscope.
Despite the silk on the dock board, the SDA/SCL pins weren't defined. Though, they were already defined in mpconfigboard.h.
Same for RX/TX. It looks like it declared TXD and RXD, so I didn't want to remove those, but I think it makes sense to have the "standard" pin names, but I moved ithem to illustrate they were all referencing the same pins.
I mimicked the whitespace I saw in the ...
Thank you for this fix and cleanup. Just a query.
Is it worth checking for SAMx21 architecture here, or is that macro def unique to this particular case?
At some point I will take another look at this, as it's useful to check for imminent brownout.
@onyx hinge did you mention you have an STM32 version of the RGBMatrix feather on the way?
@ionic elk I have a batch of the boards from oshpark and I verified that it works recently.
well, works except for the smearing
Think you could send me one? I'm always paranoid that my RGBMatrix results are being tainted by bad connections
Since I seem to get such variable results moment to moment
let me find the link
I can send you one if you need it, not sure it'd be any faster than ordering at oshpark. they're pretty fast.
Yeah I'll just get one there, thanks for the link! I was finding my password to sign into the site
The build checks for trailing whitespace. There is trailing whitespace on lines 64, 68, 89, and 94 (at least).
It would be OK to remove the TXD and RXD names in favor of TX and RX, especially if this is a recently added board.
@onyx hinge I see that breakout doesn't have a power plug, do you just power it over USB?
Oh so the panel cable goes elsewhere, doesn't connect to PCB at all.
right
I soldered a 2x10 female connector to the bottom, female headers out the top, and put the stm32f405 pins in it. And hooked power to the RGB matrix power pins. There's a 'barrel plug to screw terminal' item at adafruit.
Yeah I should be able to finagle something similar
Doh, that's what I get for trying to just do a quick edit from the github website. I pulled the branch locally and was looking at every line, losing my mind... because an addon cleaned up the whitespace for me. ๐
Re the TXD/RXD: I feel similarly. I wasn't the one who added this board, and I didn't want to break anyone's things, but I did take a look at the official examples, and none of them are using those pin names, so I'll remove them!
I can't find the item right now
Just concerned that it'll be a little while, sounded like people were hoping to get this one wrapped up. It's definitely one of my least favorite bugs, just because my hardware feels so unreliable.
the smearing seems different every time I plug stuff in
Oh I meant I'm good, I have lots of stuff like that
just gotta wait on the boards themselves
mine was consistent, I would have said. If there are whole rows swapped from run to run .. that may be a different thing
that's yet a third thing
my photo shows the address lines not being settled when the enable goes on
pixels smearing from side to side would be about the relation of clock & data, but also I've seen it when the power is not adequate
I have not seen your photo, have you posted it in the issue?
https://github.com/adafruit/Adafruit_Protomatter/issues/13 is about a condition where some of the address lines get inverted, which leads to a pristine display except some whole rows are swapped with each other
jas, I may not have shared it here
this is the problem I encountered
Are you viewing it over an oscilloscope or a logic analyzer, by the way? Because my major concern right now is that when I flip my analyzer to analog, it shows the R1 line as having a lot of very low-voltage pulses
I haven't logic-analyzed or analog-scoped it lately
^that's generally the problem I see, though with mine I see it as "sideways", not sure how yours is oriented
vertical in the photo is controlled by address lines, horizontal is controlled by shift registers
but the intensity of the problem varies. Sometimes it seems like it's just a couple flecks like that, sometimes it's like a huge blur across the whole width of the display
that's the way all the 64x32 are, if there's a "short" direction that's "address" and a "long" direction is shift register
Could you also change the TXD and RXD in the other makerdiary boards to TX and RX? Or does the silkscreen say "TXD" and "RXD", in which case I'm not sure what to do. These are the only boards that use that "D" suffix,
I'm not sure which is which for me, since it's a 32x32
I'd have to figure out a way to determine that that's obvious even with the bug
unless it's possible to tell just by looking at the PCB on the back?
Anyway I'll stop taking up your evening, thanks for the help and links
OK, I looked at the silks, and the Arduino-shaped M.2 devkit uses TX and RX on the board, so that change makes sense. The other boards seem to use TXD and RXD fairly consistently, so we can leave them alone. So the changes you made so far are fine.
There seem to be other labels on some boards that are not included, but we don't have to fix those here.
So, on the Pitaya Go (pitaya_go), they list them as TXD/RXD in their pinout, but just the PXX on the silk. the MDK, they list TXD/RXD in the pinout, as well as on the silk. Same goes for the M60 keyboard.. The MDK Dongle [Seems to skip them entirely](https://github.com/makerdiary/nrf52840-mdk-usb-dongle/b...
And I should check for comments before replying!
I'll make a list of pins that seem to be missing tomorrow and will make a sweep and see if I can get them all.
Thanks for looking. We generally try to use the silk markings as "ground truth", and then add aliases as appropriate for convenience.
whatever direction the lettering goes by default is the row / shift register direction
you could also configure it as fewer pixels wide and that is the row / shift register direction
@onyx hinge Hmmm... that definitely makes me wonder what's going on then, because I'm getting smearing in across the line of letters, not up and down.
I was able to reproduce this on Kaluga and the FeatherS2.
Build is off of adafruit/main as of Midnight 9/18 (Pacific)
In the REPL
>>> import time
>>> dir(time)
['__class__', '__name__', 'localtime', 'mktime', 'monotonic', 'monotonic_ns', 'sleep', 'struct_time', 'time']
>>> time.localtime()
KALUGA Debug
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4008e9aa PS : 0x00060430 A0 :...
I had a PyPortal plugged in and thought it was worth a test to check behaviour there. I'll leave it running for an hour but it looks good so far.
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit PyPortal with samd51j20
>>> type(1.3)
<class 'float'>
>>> import time
>>> good = not_as_good = 0
>>> while True:
... t_t = [time.monotonic_ns(), time.monotonic_ns(), time.monotonic_ns(), time.monotonic_ns()]
... if sorted(t_t) != t_t:
... not_as_good += 1
... ...
@ionic elk another "in my experience", the 2x8 connector's long direction has always been up & down, and the in-to-out connector direction is horizontal
that video is with feather m4 express (samd51)
Stm32 feather glitches are different
turns out I had the "output enable" and "latch" pins switched in my pinout. ugh whoops
@onyx hinge I hope you didn't spend too much time figuring that out! It was the first thing I mentioned in my issue comment yesterday
Oh nevermind it was the third thing. It should have been the first.
Also note that I found it was 2x too fast - changing _PM_timerFreq 42000000 to 84M helped bring it more in line with the M4
I encountered this on STM32 with a build derived from 6.0.0-alpha.3-267-gd774678a0, but from the traceback it seems like it MIGHT be a general problem. Or it MIGHT not.
You don't need a matrix attached to reproduce this.
Just run:
>>> import board, rgbmatrix, framebufferio; m = rgbmatrix.RGBMatrix( width=64, bit_depth=4, rgb_pins=[board.D13, board.D12, board.D11, board.A4, board.A5, board.D6], addr_pins=[board.A0, board.A1, board.A2, board.A3], clock_pin=board.D5, latch_pin=board...
@ionic elk I feel worse about your time wasted than mine
Are you deliberately using red colors? If not, red is sure a sign of low voltage. Red LEDs have the lowest forward voltage so they continue to kinda work when the rest of a matrix is faltering
I don't see any blinkas on your displays so I guess you are setting up labels so maybe they're deliberately red
I deliberately used red so that I only had to monitor the red color lines, since I only have so many probes
I see.
I'm suspicious of my hookup right now though, because even just bumping my setup makes a lot of flickering happen. So I'm going to try connecting it a little differently and see if that helps.
ok so you think there's a pinout or source code bug on this page? https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython/feather-m4-express
When I swapped OE and LAT it seemed to have helped a bit
but now the problem is all over the place
@onyx hinge No I'm thinking that I might have a bad cable or my feather is making lousy connections
I think I never saw everything you wrote in this issue ๐ฆ
yeah that one
@onyx hinge that power supply is large!
well, actually, now that I look at my old posts, it's clearly going out to the sides as well as up and down
Did you not get a notification for the issue? I noticed nobody else replied either, everyone's been doing the email chain which is a little confusing
maybe I did something weird with an edit and it didn't tell anybody
OK, you're right that https://cdn-learn.adafruit.com/assets/assets/000/094/722/medium640/led_matrices_protomatter-featherm4express_bb.png?1600099496 has the LAT and OE pins switched
thank you, I'll fix that!
The text is right, the diagram is wrong
Yeah - it's correct in the code
So it's also wrong for the ST board, right? Maybe that just migrated over somehow?
I'm not sure at this point, I'll check that next
Anyway, my other big concern, looking at it, was that my Saleae seemed to indicate there was really low voltage pulses on the R1 line. Do you have an oscilloscope you could check that out with?
I was wondering if we needed to change pullup settings or something
that if I'm using a cable, the capacitance of the line is too high, and the no-pull Push-Pull drive setting on the pin isn't able to yank it up and down fast enough or something
if there's a higher drive mode available, it should probably be enabled. However, if you're seeing something different on just ONE of the 6 RGB lines .. I would suspect something other than pin drive strength
A saleae might simply be missing the peaks of the pulses, though, since the sampling rate is ehh
that's possible too
you could see if it's any different if you have "wide" vs "narrow" artifacts, "." vs "_"
but that won't ultimately tell you more about rise time
I think the first step is let's just confirm we have the correct pinout 100%
Do you happen to have one of these 32x32 matrixes?
So my board swaps D9/D10 compared to the text from https://learn.adafruit.com/rgb-led-matrices-matrix-panels-with-circuitpython/feather-stm32f405
but I think on that page, OE and LAT match from the fritzing diagram to the text. Can you double-check me?
this matrix is the 4mm pitch one, https://www.adafruit.com/product/607
Soon after submission, 30+ CI tests succeeded, then 100+ seemed to stall in a "waiting" state for a couple of days. I rechecked this morning and it looks like the "waiting" tests failed. The Details link for the failures doesn't show any useful information. Any idea what happened?
@onyx hinge My way of recognizing the LAT was that it seems to be the one with the longer pulse at the start (see blue above)
Yeah mine is 4mm pitch. had to look it up since I got it on Digikey
GitHub actions sometimes has problems. I have asked it to re-run the jobs, but that doesn't always work either. If it does, great. If not, the next thing to do is push a commit that does nothing -- you can create such a commit at the commandline with "git commit --allow-empty", assuming you have no modified files.
yes
so now the only issue I have is soft-resetting https://github.com/adafruit/circuitpython/issues/3440
Hmm. Well, I'm going to have one more go at getting it working but if you've got no problems we should probably just close the issue. Are you sure there's nothing that needs to be added to the guide?
Have you tried it with cables, instead of your featherwing?
not with STM, no.
I know it's a pain, but maybe we should give that a shot? Or just double check your featherwing schematic to make sure it isn't doing anything that isn't documented in the cable instructions?
I seem to have mislaid the schematic, but the only difference I am aware of is swapping LAT and OE compared to the text and image on the stm32f405 page of the guide. There aren't even any passives, just connectors.
For matrix troubleshooting, I also suggest displaying something clearly Red, Green and Blue. On my hardware, some pin where swapped (or I made a mistake). Maybe some basic code in the guide to identify that case.
I think that the remaining problem we're trying to diagnose/solve is an all-red display looking like this: https://user-images.githubusercontent.com/5904176/85605349-1114b580-b620-11ea-81c6-7cb4d4cd7ad1.gif
Also, is B0 here supposed to be G1?
And so just to triple check here, OE is actually supposed to be on D9, and LAT on D10, right?
That's what my testing indicated but I'm just trying to be super sure
The RGB and CLK pins are "intensely picky" about where they go. If the constructor accepts them, it is supposed to be an acceptable combination. Otherwise, what counts is matching the wiring to the constructor
so you can swap OE and LAT wires as long as you swap 'em in your code
but if you swap R1 and LAT it'll probably complain
(assuming they're on different ports)
RGB and CLK all have to be on "a port", and preferably within 8 bits of that port.
because the code needs to set them all with single stores
the rest "eh who cares"
A single GPIO port you mean?
right
Oh I see so you can run just one GPIO write
so like PA0 .. PA7
so it writes some data as RGBRGB, then toggles CLK, then writes some more data as RGBRGB. With a minimum of instructions, so a maximum of fast.
This is the one part of the Arduino code where some knowledge of the underlying hardware is required. rgbPins[] and clockPin must all be on the same GPIO PORT peripheral (e.g. all PORTA, all PORTB, etc.). The other pins have no such restrictions. Additionally, if the PORT has an atomic bit-toggle register, RAM requirements are minimized if rgbPins[] and clockPin are all within the same byte of that PORT*. They do not need to be contiguous nor in any particular sequence within that byte. If not within the same byte, next most efficient has them in the same upper or lower 16-bit word of the PORT. Scattered around a full 32-bit PORT still works but is the least RAM-efficient option. [https://learn.adafruit.com/adafruit-protomatter-rgb-matrix-library/arduino-library]
github actions ain't happy today .. a bunch of my PRs from yesterday still haven't finished CI.
I depend on the storage to be initially zero'd. (for VM resets I zero it in common_hal_canio_reset, but that's run POST VM, not PRE VM, right?) This means it needs to be between _szero and _ezero, which are both inside .bss. How much surgery do you want me to do here?
@onyx hinge freeze is in _PM_swapbuffer_maybe, there's an infinite loop
So what's supposed to happen is, the timer routine will set that flag back. So my guess was that after a soft reset, the timer routine was not being executed.
@onyx hinge I am going to try to restart the stalled approved PR's, one at a time, so I can merge them.
@tulip sleet thanks. as noted above I tried resetting #3242 about 40 minutes ago
Can you send me your code for the 32x32 matrix?
the 607?
A soft reset will remove the timer - does it need to add it to never-reset, or is it an issue with the RGBMatrix not resetting when it should?
probably wants never reset, since it was counting on always having the same timer and never de-initing it before...
Also, can we document somewhere the actual order of the construct pins? and what bit depth means?
I assume it's R1, G1, B1, R2, G2, B2 and ABCD but I think it'd be good to write that down somewhere
... sure ? not sure what you mean by "actual order"
oh, yeah, that's the order
bit_depth is the color depth, sensibly ranges from 1 to 5 (or maybe 6). Increases memory usage and color ... depth
Feel free to improve the in-tree docs, they're probably egregiously bad
What is color depth? Is that a measure of the PWMOut LED intensity management?
Doesn't actually affect pinout or anything?
no.
auto_refresh defaults to True, as a FramebufferDisplay parameter
color depth: the number of effective bits of each primary color. 1 = 1 bit of R, 1 bit of G, 1 bit of B = 8 colors. 4 = 4 bits of R, 4 bits of G, 4 bits of B = 4096 colors
neither of those affects pinout
if you redundantly specify height= to the RGBMatrix constructor, it will complain at you if it doesn't match the number of addr_pins
otherwise, height= has no bearing on pinout
I see you don't even include it in your constructor, does it default to width if you don't set it?
no, it defaults to whatever the number of addr_pins indicates
well, technically, the number of addr pins and the number of rgb pins together set the height
it's just there so that if you specify height= and it's wrong, you get an error.
(it wasn't initially in my design, it was a requested addition)
I have cancelled all the pending jobs in numerous PR's, and am going to re-run the PR actions one PR at a time.
Yeah, if readinto gives you a message with the RTR flag set, you set data, clear RTR (hmmm .. so setting data should clear RTR?) and send it back.
@onyx hinge Could you send your entire test sketch? The ohai one?
Is there any way to access the bootloader version from CircuitPython code?
I mean except for the crash. Gonna try adding the timer to never_reset and see if that helps
If I choose normal/silent/external loopback based on rx/tx being specified or not, then I still need a bool parameter to specify internal loopback / hot selftest mode. Is that better than the way it is now? Each way I can think of writing it, the asymmetry bugs me.
Just as a point of information, We tried a Feather nRF52840 Express with a
TFT Featherwing and see the
same issue - the display lights up (backlight?) but does not show any
outputs from the code.py script. So, this
does not look like just a Clue issue.
On Thu, Sep 17, 2020 at 7:55 PM Yihui Xiong notifications@github.com
wrote:
The schematic is at https://github.com/makerdiary/nrf52840-m2-devkit
โ
You are receiving this because you were mentioned.
Reply to this email directly, v...
@onyx hinge There's one thing I'm confused about here - so, _PM_timerInit and common_hal_rgbmatrix_timer_allocate both allocate timers?
For the STM implementation it looks like _PM_timerInit is taking a passed in timer and initializing it. though, I don't know what stm_peripherals_timer_reserve is
maybe that call doesn't belong there
afk
Yeah it's redundant I was about to type the same thing you just did haha
reserve doesn't actually do anything other than try to set an array bit high though so it wasn't actually doing anything
Fixed the crash
When soft-reset on STM32, RGBMatrix currently gets stuck in _PM_swapbuffer_maybe, as the timer IRQ it relies on to exit an infinite loop is disabled by the reset process. This PR adds timers used by the RGBMatrix constructor to the never_reset array so this does not happen. Tested on STM32F405.
Also removes some timer debug messages that were accidentally left in from a previous PR.
Resolves #3440. Mentioned in #3051 but ultimately unrelated to the issue there, which seems to have jus...
After having discussed things with @jepler, it seems like the root of this issue was the aformentioned documentation mixup in the guide page, where the fritzing pinout of the Feather M4 Express had the LAT and OE pins swapped.
<img width="369" alt="Screen Shot 2020-09-18 at 12 52 28 PM" src="https://user-images.githubusercontent.com/5904176/93624241-0fa02280-f9ae-11ea-9008-91bffbf779e4.png">
The actual code and layout of the Featherwing were both correct, so this caused no issues when a...
@onyx hinge Does PR #3398 (dict compression) supersede #3370 (bigrams)? I'm just trying to be clear in the release notes.
@crimson ferry I don't know of a way to read the bootloader version from circuitpython
@tulip sleet yes
you could programmatically kick to the bootloader but I'm not sure if there is a programmatic way out of the bootloader
but the bootloader is somewhere on flash, so it's conceivable that core code could access it?
yeah but I don't know if the placement of the version number is consistent
it probably isn't
I glanced at the uf2-sam repo and I see no indication it places bootloader info at a fixed address. If it did I'd expect to see signs of it in the "ld file"
if memoryio is going in, it could be used to scan for a string prefix
@slender iron I finished the draft of the beta.0 release notes. I'm re-running approved PR's one at a time, and then merging them, and will add them to the release notes as they are merged. I still have to add the contributors. I'll do that when I have all the PR's. (I have a graphql query for them.)
ok, thanks!
@ionic elk excellent! I will try to test it today.
Can a usb drive call for eject / dismount ?
@tulip sleet , I was going through microcontroller.reset() code saw warning regarding improper use of that function could lead to data corruption
I looked for it several years ago when originally working on the Windows "doesn't flush promptly" issue.
it's up to the host to flush writes to the USB drive promptly. MacOS does it well. Windows was terrible (up to 90 seconds), but it may have been fixed in Windows 10 2004 (I have to vet), and Linux is meh (could be 10-15 seconds)
currently working on deep sleep stuff equivalent to having a reset....
@analog bridge we shouldn't deep sleep when on usb
if you are connected to USB, I don't see a strong need for deep-sleep, since you have a power supply
maybe if connected to a raspi on battery power... will rarely have a situation like that
need to have a check for usb before sleep ?
I think it's much more likely USB is connected because you are developing your code
the power consumption of the rpi swamps that of the board
so no checks for usb then before sleep
circuitpython/ports/atmel-samd/asf4$ git grep -l PIN_PC19F_SERCOM4_PAD0
samd21/include/pio/samr21e16a.h
samd21/include/pio/samr21e17a.h
samd21/include/pio/samr21e18a.h
samd21/include/pio/samr21g16a.h
samd21/include/pio/samr21g17a.h
samd21/include/pio/samr21g18a.h
The SERCOM0 exceptional pad placement is only in the "samr" family MCU headers, so this conditional block wouldn't be entered on any SAMD/E builds. But if it did, it's OK(-ish) If Pin C19 has function F as SERCOM4 PA...
you should only deep sleep when usb data is not connected
also there are several other things need to be taken care of like io and wifi state
before sleep
deep sleep or light sleep?
deep
wifi is disconnected right? io except triggers should be deinit as well
@onyx hinge I am manually re-running the PR's in order to throttle job queuing. WIll merge approved PR's when done.
@tulip sleet OK -- is throttling by github what we assume is happening? they haven't posted any notice of service interrupts when I last looked.
I'll try to stay out of the way -- I only restarted the one set of jobs earlier
idf docs say to call for wifi radio disable before sleep but it would be shutdown anyway
even if the disable func. is not called
It should happen automatically. I don't know why when there is a huge backlog it starts to stall completely. It should not do that. Maybe they have some kind of timeout of excessive queue-waiting times, but that seems like a bad idea. I think it's just a bug. I haven't looked in their issue list yet.
I got my matrixportal!!!7
i am being release-meister
@analog bridge ya, we do something like that when the VM finishes anyway
is the idea that deep sleep would only happen between VM instantiations anyway? I thought so becuase RAM is not maintained (right?).
that was my thinking
a small amount of startup state would be maintained in backup RAM (so no need to write flash), I would think
@tulip sleet no ram only rtc peripherals are awake
i thought there was a small chunk of RAM available if desired
Looks great! Thank you! I'll let @dhalbert merge.
ya, there is RTC ram that can be kept alive
pretty limited though...
just so the restarting program can be passed some info about what to do
right, the program will be able to get the reason it woke up
even a few integers is enough
wakeup reasons are implemented well on s2
@askpatrickw want to take a crack at this? I have a feeling we're trying to get the time from an uninitialized RTC object.
about the wakeup reason thing, @slender iron what format should I use to return it ?
you may want to look at the other architectures to see what they have (e.g., bytestring instead of a single integer) to make a uniform API
here is what the idf spits out (ESP_SLEEP_WAKEUP_TIMER, + other parameters mostly int)
in my API I was thinking alarm objects
so that would be a TimerAlarm object that would compare equal to the original
I am using microcontroller instead of supervisor, my deep sleep call is microcontroller.sleep()
ok
the wakeup reason part should be implemented in microcontroller ? example call microcontroller.getWakeAlarm()
Thanks @xiongyihui! The power does look different on the feather as well.
Looks like vbat goes through the diode of the transistor before the regulator.
@DavePutz do other things work ok? This is so weird that it works on USB but not battery power.
@analog bridge I think so. Python style is get_wake_alarm but that's a detail
will get all these things in check once we get basics done
ok cool!
nice chat @tulip sleet & @slender iron...... back to code 
@gilded cradle this?
Yes, thanks
Hi! I have a couple board questions - is there any other criteria other than "can get the board somehow" for inclusion? I have an open-source SAMD51 design that I want to run CircuitPython on (https://github.com/Stary2001/greenpill). Also I've noticed this comment in some board definitions
// out on connectors are labeled with their MCU name available from
// microcontroller.pin.``` - all pins on this board are labelled with the microcontroller names, so would this be ok to just have pretty much just i2c/spi/uart etc in pins.c?
@craggy drift if the microcontroller names are used on the board I'd still put them in board
so folks don't need to look two places
kk cool
Okay it looks like most of the other boards matched their silk. I actually found a typo in the Pitaya Go silk, so I made them an issue for that.
So on the user button for the M.2 Devkit, the silk says "USR->D2", because it's tied to D2 as well as that button. The pin name in CP was named "USR_BTN", which makes sense, but doesn't match the "U...
I believe port_reset is called before any VM run too so you should be ok if it zeroes things.
another thing - i don't have a vid/pid yet
can i just request one on the repo before I make the PR?
for open source hobbyist boards you can create an issue for one
sounds good, thank you :)
I can follow whatever value other APIs use (-1? None? infinity?) to indicate a "never timeout" condition in the Listener constructor.
However, I think that this is probably not good style and wouldn't be usable in any but the simplest cases, because it never provides the opportunity to do anything else while waiting for a message.
or I could return None (instead of raising StopIteration) in the case of timeout with 'for message in can.listen()'. I was just trying to implement what I thought we had agreed (admittedly I initially drafted it and may have glossed over concerns) about how the potentially blocking operations would work.
I think there is a question whether .data is mutable or not. You can't automatically clear RTR if you mutate part of .data
The pin name in CP was named "USR_BTN", which makes sense, but doesn't match the "USR" on the board. Opinions there?
We usually call buttons BUTTON_A, BUTTON_UP, and the like, so BUTTON_USR is would be consistent with other boards.
We are having trouble with the automated builds on GitHub getting swamped and stalled for some reason, so I will be canceling the runs for your pushes for a while to let other PR's finish, and then when this is ready to test and merge I will re-run man...
I determined that the calls to common_hal_time_delay_ms() in common_hal_displayio_fourwire_reset are the reason for this issue. Since common_hal_time_delay_ms() ends up calling port_sleep_until_interrupt(), which is where qspi_disable() is called; I suspect there must be some timing issue with disabling QSPI while the fourwire is being initialized. @tannewt , I see those delays were added in a commit for e-paper. If these delays are needed for e-paper to work, is there some other way to acc...
You could have the fourth "hot selftest" be when neither TX or RX are provided. However, that is likely to cause more confusion than solve it. I think we either 1) don't support "hot selftest" or 2) add an enable property that turns external connection off and on.
The Message.data property returns an immutable bytes copy of the data, so you can't mutate it.
@DavePutz why would that only break when on battery power?
@tannewt - qspi_disable() only does the disabling when USB is not connected.
There are 2 test cases here.
-
Boot on battery power only.
-
Boot on USB Power with battery plugged in and then remove USB power
without reseting.
Both the CLUE and Feather with TFT work ok for test case 2 .
Both fail for test case 1.
On Fri, Sep 18, 2020 at 1:57 PM Scott Shawcroft notifications@github.com
wrote:
@DavePutz https://github.com/DavePutz why would that only break when on
battery power?โ
You are receiving this because you are subscribed to this thread.
...
OK, now one of RX or TX can be omitted, and silent/loopback will be specified separately. They aren't checked for appropriateness, so for instance you can specify tx=CAN_TX, rx=None, silent=True and you will never be able to recieve or transmit anything.
@slender iron I've got a question about "what goes in shared-bindings headers", haven't quite wrapped my head around it yet.
- you mentioned a case where the implementation is in
shared-modules, does it apply tocommon-haltoo? - why not use forward structure declarations so that the "implemementation header" (the one with the structure definition) can be made totally unavailable in the shared-modules? E.g., to excerpt a hypothetical
shared-bindings/canio/CAN.hheader, ```
extern const mp_obj_type_t canio_can_type;
typedef struct canio_can_obj canio_can_obj_t; // <- forward declaration of the common-hal type (NEW)
void common_hal_canio_can_construct(canio_can_obj_t *self, mcu_pin_obj_t *rx, mcu_pin_obj_t *tx, int baudrate, bool loopback, bool silent);
(instead of including `common-hal/canio/CAN.h` to get the definition of the structure)
the definition of the structure in common-hal or shared-modules just needs to be changed from typedef struct { ... } canio_can_obj_t to typedef struct canio_can_obj { ... } canio_can_obj_t, so that it has a typedef name
alright I think that's about a wrap for the week. stay safe out there.
sorry @onyx hinge I was eating lunch. I think that forward declaration would work
@tulip sleet want to sync on the state of the release?
@slender iron just got back from an errand, sure
I'm in the CircuitPython channel
is:pr is:merged sort:updated-desc
No worries about the cancels, makes perfect sense!
Okay, I did BUTTON_USR where it made sense (either having USR on the board, or if the button was unlabeled,) so that way it will have consistency among that family.
Any others to take a look at?
Only one thing: this is BUTTON_USER, and the others are BUTTON_USR. Did you mean USR? I looked at the silk and I don't see a label, but maybe I missed it.
@hierophect Could you open issues for the suggestions in your second paragraph? Thanks.
@slender iron, do you know if there's a way to make a variable or setting persist between sessions of CircuitPython without writing to an SD card? Like maybe creating a file in the program area or something?
to survive power disconnect too?
nvm or writing to the fs
Awesome. That's exactly what I need. Thanks
great!
I smelt some hot electronics earlier and my finger picked up some heat around the CLUE speaker. I had a bug in some code which was trying to play a looping RawSample with a sample_rate set to the bogus value of 0.
The CLUE may warrant some extra caution with the output to the speaker. I think it's a simple transistor affair and a continuous high output allows a relatively hefty current through tiny speaker and limiting resistor.
Never mind. I see it says "USER" on the silk in the middle of the board. I missed that first time around.
Thank you for the original work, and your patience and diligence. :+1:
@DavePutz
You can try to disable QSPI when USB is connected. Only need to change the line at https://github.com/adafruit/circuitpython/pull/3244/files#diff-46ca91d54ad3cf6fcc4906eecc666ebaR45 to
if (NRF_QSPI->ENABLE) {
I tried it. The SPI display still works when QSPI is off and USB is connected.
I'm unable to build since updating about 30 mins ago.
grabbed latest from main, did submodule update. made sure I had the latest idf stuff (install.sh) and did an export.
getting a stack of this type of thing....
#if LWIP_SUPPORT_CUSTOM_PBUF
^~~~~~~~~~~~~~~~~~~~~~~~
esp-idf/components/lwip/port/esp32/include/lwipopts.h:186:41: error: "CONFIG_LWIP_IP4_FRAG" is not defined, evaluates to 0 [-Werror=undef]
#define IP_FRAG CONFIG_LWIP_IP4_FRAG
^~~~~~~~~~~~~~~~~~~~```
I'm using the idf inside the esp32s2 ports folder.
I've done the usual make clean - still no go
Going to restart....
A restart fixed it.. sheesh.
@atomic summit - I just updated the idf tools (there were updates on Tuesday.) I have them outside of CP. Updated CP. Got errors... ran make clean a couple of times, and now it's building. With everything moving quickly I suspect things might need to be very cleaned after updates.
@hearty forge Yeah, cleaning seems to be temperamental for me.
Ok, I've built latest, can confirm I'm seeing the 16MB Flash working... 12.2MB partition available for code... w00p!
Me too.
But, no PSRAM is active.
Wow- that's a sick board. Looking forward to hearing when you've get the PSRAM back!
Maybe PSRAM is still not merged.
Looks like it was https://github.com/adafruit/circuitpython/pull/3315
Yeah, not sure if that has the SPI fix Scott was working on.
Seems to still be in a branch on his fork.
I think it is... https://github.com/adafruit/circuitpython/pull/3393
If you're looking at fix-spi-ram
ha yes ^^ that
Ok, so I guess I need to menuconfig to enable it?
I've heard they mentioned on one of the streams, but I don't recall what it does exactly.
So let's go with Yes. I mean what bad could come of it
ok, how does one run menuconfig? (and that's cool- linux kernel style!)
Poking around there appears to be SPI ram config in ports/esp32s2/boards/*/sdkconfig - maybe something in there?
idf.py menuconfig from inside the esp32s2 folder
oh... that's slick.
The bad that can come from it is a stray sdkconfig file at the folder you are when you run it. So I assume you should run it from the specific boards folder.
haha, I have the same set of errors again... clean doesn't fix it again.
guess I'm gonna restart again
sheesh
@idle wharf you can't run it from the board folder
needs CMakeLists.txt
Got it !
I wiped my repo folder this week too and started over as well.. its going around
how do you validate all the storage\memory types on the FeatherS2? I hav mien up and running with a new build
@idle wharf thanks for the stray file warning. I did a git status and noticed it. Removed it so I don't brick things unintentionally.
The UF2 bootloader covered at the end of todays live stream with Scott sounds pretty cool. If I'm understanding correctly, on power up, there's a DFU/recovery mode in rom -> UF2 (chance to upload application- CP) -> application (CP) -> edit python files.
Seems straight forward to build and flash the active branch (https://github.com/tannewt/uf2-esp32s/tree/multiple_flash_sizes)
But how do you create a uf2 file from the esp32s circuit python binary?
The flash command is also part of the make process make BOARD=unexpectedmaker_feathers2 PORT=/dev/tty.usbmodem01 flash
That's how I build and update my boards.
Yip- that part I've managed. It's how to generate a uf2 for the proposed new stage 2 bootloader. Ah... found tools/uf2/utils/uf2conv.py ... looks like it'll need some tweaks for esp32s. I'll wait a bit ๐
I think the partioning scheme needs to become stable first too
@idle wharf you got PSRAM working as well?
I'm still getting #if LWIP_COMPAT_SOCKET_INET == 1 errors when building
#if LWIP_COMPAT_SOCKET_INET == 1
^~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors```
more specifically
I think I had that same error let me check my seach history
which board?
Yep... I did and I was building the Kaluga at the time
I had to redo something in my ~/esp/esp-idf
I just did a git submodule update --init --recursive and it fixed it...
even though I did that 1 hour ago to fix it last time.
When all fails update the things one more time
QSTR updated
make: msgfmt: No such file or directory
make: *** [build-unexpectedmaker_feathers2/genhdr/en_US.mo] Error 1
>>> elapsed time 16s ```
now I get this... which is new...
I was building 30 mins ago... no issues... changed nothing...
Did you do clean after you updated submodules?
I don't quite understand why this (circuitpython) build system is so brittle.
I build MP from source ever few days... an treat it really mean and still never fail a build.
yeah, clean doesn't help.
Building a different board for the first time- just noticed it looks like clean only cleans for the specified board. I wonder if you need to clean for all boards you may have built, as there are shared bits?
He probably only has the FeatherS2 ๐
I'm only building my boards - and today only my FeatherS2
@idle wharf ProS2 as well ๐
UnobtainiumS2 more like
๐
@atomic summit Can I check something on my FeatherS2 for you ?
I just want to see PSRAM and Flash correct...
trying to build a CPY version for my test jog to use.
Tell me the commands, i'll run them. Then I'll make the menuconfig edits and run it again
^^^ far more useful than me- I did just build for FeatherS2 & Saola Wrover, and it worked.
os.statvfs('/')
(2048, 2048, 5969, 5912, 5912, 0, 0, 0, 0, 255)gc.mem_free()
8194368
ok, so PSRAM worked for you?
I am not sure what the values should be so if you say yes. then yes.
I'm building off of adafruit/main and I did a pull before I jumped onto discord again, so its all the latest
That's 8MB
I could drop you my .bin
na, need to see why I cant build
then I need to see why PSRAM wasn't present before
Is the statvfs showing 16Mb flash? I don't know what it's outputting..
I don't know if that is the right way to check that
maybe stat
os.stat('/')
(16384, 0, 0, 0, 0, 0, 0, 0, 0, 0)
I'm killing off my esp32s2 folder...
I always just clone the repo again... but I'm in Seattle.
When I visited Melbourne I definitely noticed some things were slower from Australia.
block size, fragment size, size of fs in fragment size units. So 2048 * 5696 = 11.125Mb (!)
Heh- last summer I went back to NZ to help my Dad pack up the farm... his internet was a 3G modem that was "working" due to a bounce of a local hill. It worked amazingly well... until a tree shifted, or a bird flew by, or the wind moved the trees ๐ You could probably hear my kids screams as Netflix dropped from at least Australia. I don't mention I have a fibre connection here on Vancouver Island.
That's a far flung family from NZ to CA, truly global, very cool !
I'll hit you up for more VAN Island info if we're ever allowed to goto Canada again. I'm needed to take the Jeep there and to do some surfing.
OK, I'm going to shut down. Best of luck Seon and good to chat Julian !
You too- and anytime. Good luck @atomic summit !!
Just did a fresh repo install.. still no PSRAM showing up. ๐ฆ
Tried 3 boards... can't be the hardware
If the answer to my question is "yes", this is good to merge.
with "never_reset", does stm_peripherals_timer_free in common_hal_rgbmatrix_timer_free() remain enough to fully deallocate/free/reset the timer?
I'm trying to get started building circuitpython. Following the tutorial: https://learn.adafruit.com/building-circuitpython/build-circuitpython . But I don't get very far in the make of the STM32F405 Feather board:
:~/circuitpython/ports/stm$ make V=1 BOARD=feather_stm32f405_express
GEN build-feather_stm32f405_express/genhdr/mpversion.h
GEN build-feather_stm32f405_express/genhdr/qstrdefs.enum.h
Traceback (most recent call last):
File "../../py/makeqstrdata.py", line 20, in <module>
sys.stdout.reconfigure(encoding='utf-8')
AttributeError: '_io.TextIOWrapper' object has no attribute 'reconfigure'
../../py/py.mk:337: recipe for target 'build-feather_stm32f405_express/genhdr/qstrdefs.enum.h' failed
make: *** [build-feather_stm32f405_express/genhdr/qstrdefs.enum.h] Error 1
make: *** Deleting file 'build-feather_stm32f405_express/genhdr/qstrdefs.enum.h'
Can anyone help me get past this first hurdle?
@grim dagger are you able to build any other boards?
Did you run these two commands also?
git submodule sync --quiet --recursive
git submodule update --init
most of the time when my builds don't work it's due to me forgetting to run those.
I'm trying to build the Metro M4 Grand Central now. It is progressing better. Maybe it is something to do with the feather stm32f405 files.
The M4 failed too. Just took longer.
make V=1 BOARD=grandcentral_m4_express
GEN build-grandcentral_m4_express/genhdr/mpversion.h
GEN build-grandcentral_m4_express/genhdr/moduledefs.h
GEN autogen_usb_descriptor.intermediate
GEN build-grandcentral_m4_express/genhdr/qstr.i.last
GEN build-grandcentral_m4_express/genhdr/qstr.split
GEN build-grandcentral_m4_express/genhdr/qstrdefs.collected.h
QSTR updated
GEN build-grandcentral_m4_express/genhdr/qstrdefs.preprocessed.h
GEN build-grandcentral_m4_express/genhdr/qstrdefs.enum.h
Traceback (most recent call last):
File "../../py/makeqstrdata.py", line 20, in <module>
sys.stdout.reconfigure(encoding='utf-8')
AttributeError: '_io.TextIOWrapper' object has no attribute 'reconfigure'
../../py/py.mk:337: recipe for target 'build-grandcentral_m4_express/genhdr/qstrdefs.enum.h' failed
make: *** [build-grandcentral_m4_express/genhdr/qstrdefs.enum.h] Error 1
make: *** Deleting file 'build-grandcentral_m4_express/genhdr/qstrdefs.enum.h'
BTW, I did do the git submodule steps succesfully prior.
I didn't notice, but the make of the cross compiler failed in the same way:
mark@mark-ubuntu-8460p:~/circuitpython$ make -C mpy-cross
make: Entering directory '/home/mark/circuitpython/mpy-cross'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR updated
Traceback (most recent call last):
File "../py/makeqstrdata.py", line 20, in <module>
sys.stdout.reconfigure(encoding='utf-8')
AttributeError: '_io.TextIOWrapper' object has no attribute 'reconfigure'
../py/py.mk:337: recipe for target 'build/genhdr/qstrdefs.enum.h' failed
make: *** [build/genhdr/qstrdefs.enum.h] Error 1
make: *** Deleting file 'build/genhdr/qstrdefs.enum.h'
make: Leaving directory '/home/mark/circuitpython/mpy-cross'
Is there a dependency on an OS version of python for the circuitpython build?
I am not certain. I do think Linux / Mac is suggested there are ways to do it in windows but it mostly boils down to running a linux VM in one way or another.
What is your Environment @grim dagger ?
This blurb is in the guide:
We recommend using the Ubuntu distribution of Linux or one of its variants (Kubuntu, Mint, etc.). The instructions here assume you are using Ubuntu. The 18.04 LTS (Long Term Support) version is stable and reliable.
So it looks like Ubuntu 18.04 is the the Linux OS version dependency (or recommendation at least). Personally I have built on Debian instead of Ubuntu as well without any issues.
This might be due to really old Python, or perhaps because of an encoding issue on the platform. @grim dagger ^^
It appears that it is due to python3 being at 3.6 in ubuntu 18.04. I followed instructions to upgrade python3 to 3.7 https://dev.to/serhatteker/how-to-upgrade-to-python-3-7-on-ubuntu-18-04-18-10-5hab and I appear to be making circuitpython now.
Apparently attributes like 'reconfigure' were introduced in Python 3.7, so CircuitPython appears to be dependant on it now.
@slender iron I presume, you have seen this: https://www.crowdsupply.com/excamera/gameduino-3x-dazzler
@gilded cradle Is Blinka the hardware abstraction layer for the raspberry pi, or is it something more?
@tulip sleet @grim dagger I recently made a change which causes circuitpython to need python 3.7 or newer to build. That's not intended, and I'll be making a pull request to resolve the problem soon.
I got a build, so I'm happy. Just need to find out where the uf2 file went...
@onyx hinge I am deferring merging the weblate PR yet for beta.0 because it keeps getting revised on each merge, and also because I thought it might cause merge conflicts on the unmerged PR's. Do you think the latter is likely, or should I go ahead and merge it? Also, are you shooting for the CAN PR to be in beta.0? Scott will be making the actual release on Monday or so.
@grim dagger look in the build-<boardname> directory for firmware.uf2
@tulip sleet I think getting CAN merged on monday may be optimistic
we'd like to speed up the beta cadence anyway; the alpha cadence has been 3-4 weeks, which is too long
This construct (which I added without sufficient testing, apparently) is only supported in Python 3.7 and newer. Make it
optional so that this script works on other Python versions. This means that if you have a system with non-UTF-8 encoding you will need to use Python 3.7.
In particular, this affects a problem building circuitpython in github's ubuntu-18.04 virtual environment when Python 3.7 is not
explicitly installed. cookie-cuttered libraries call for Python 3.6:
- nam...
I wonder if we should have the circuitpython build process depend on the oldest python we want to have anyone able to build with. This problem would not have occurred if we installed 3.6 in the github actions
@onyx hinge I merged the weblate PR, and it didn't cause merge conflicts (CAN PR already had merge conflicts).
OK, thanks
Re Python 3.6: My Blinka _bleio libraries need at least 3.7, and preferably 3.8. That doesn't mean the build stuff has to depend on them, but 3.7 is two years old now, so I don't know how much we have to cater to older Pythons.
I glossed over that part of your question, sorry. I think that weblate only modifies the ".po" files, which aren't routinely modified in non-translation PRs. However, different PRs that all modify the ".pot" file still get conflicts. One way to resolve this is to not require it for CI to pass, but instead to have a process that regularly PRs the necessary circuitpython.pot changes. Unfortunately, weblate can't do this for us.
current debian and ubuntu versions have 3.7, but the still-supported older 18.04 LTS does not.
"still supported" by canonical, that is
Yes, I'm of two minds about this. 18.04 is still perfectly fine, but Python 3.6 has disadvantages. I think there are apt install packages for 3.7 and 3.8, not just PPA, so we could make it a requirement for builds.
i don't think they displace the python3 version, they just add python37 or '8. I need to look at that
@lapis hemlock it supports many devices beyond Raspberry Pi: https://circuitpython.org/blinka
But these are all single-board computers that run linux, right?
It is the name for he abstraction layer for those boards. It also is the name of the purple snake character if you've seen it in other contexts.
I believe they all run linux, but I am not certain
I think it would definitely need to run Python with PIL at a minimum if not linux
I believe they all run linux, but I am not certain
@lone axle If so, then why just not run the circuitpython linux port?
Hmm, I'm not sure if I could answer that. Tbh I didn't know there was a circuit python linux port.
That's where we test, because that is much faster, than compiling and uploading the firmware.
Ah, I see.
Part of what is in Blinka I think is the platform detect logic so it can know which device its running on
But linux does that, too.
I'm not sure what the differences would be. What is the output from building the circuitpython linux port?
a linux img of some sort?
A linux executable.
does it have something like board that is aware of all of the pins and other on-board hardware devices?
No, and that is why I was asking, where exactly blinka is.
I do think those might be inside of Blinka. Here is an example of a pin mapping file for beaglebone blackhttps://github.com/adafruit/Adafruit_Blinka/blob/master/src/adafruit_blinka/board/beagleboard/beaglebone_black.py.
I think you are right.
say hasn't Shawn Hymel come by Show & Tell? He did some CAN/OBD-II stuff in Arduino .. but it's been 5 years ago now. https://github.com/ShawnHymel/CarHUD/blob/master/Libraries/Canbus/Canbus.cpp
I wonder who wrote this lib .. copyright notice 11-12 years ago, no name, comments in german, copied widely
we'd like to speed up the beta cadence anyway; the alpha cadence has been 3-4 weeks, which is too long
@tulip sleet I don't wait for alpha anymore... I download the "nightly build" from S3. ๐
Shawn has been on Show & Tell I think recently he was there showing a voice activated street fighter "Haduken" controller.
@tulip sleet One consideration for 3.6 vs. 3.7. I'm on 18.04 LTS, upgrading to 3.7 was easy with the link I referenced above, but then when I rebooted I couldn't open terminals. So I had to find a way to set the terminal to use the older python 3.6 to get past the issue. Also, mu-editor didn't install/work with 3.7 either, so I'm running it now in a venv with python 3.6.
But... my build is working on my STM32F405 Feather, so I'm in good shape to look at hacking the displayio I set out to do.
Yay, finally!
No, and that is why I was asking, where exactly blinka is.
@lapis hemlock Will have to ask @gilded cradle for definitive but CircuitPython on SBC use the normal Python, but add a layer between the hardware (GPIO/SPI) and CircuitPython libraries. It does other magic found in Circuit Python C code like Display IO. Now, AFAIK, it is not limited to SBC. You can use Circuit Python (libraries and Blinka) on PC or Mac (or Linux on Desktop). You would use https://circuitpython.org/blinka/ft232h/ or https://circuitpython.org/blinka/mcp2221/ to have GPIO but could run your code on your PC, and have some I2C sensor connected to a Stemma cable (for the MCP2221).
Wouldnโt it be cool to drive a tiny OLED display, read a color sensor, or even just flash some LEDs directly from your computer? Sure you can program an Arduino or Trinket to talk to these devices and your computer, but why canโt your computer just talk to those devices and s...
Actually, I would love to see a "native" CircuitPython that run on Raspberry Pi hardware. And you can read that two ways. The first way would be to run on Raspbian, but that you would not run CPython at all and be more compatible, using that you would know that you are not using anything from the language that works in CPython but not on CircuitPython. The second way would be to work on metal, without any OS on the Pi. Both would be great!!!
I think the easiest method would be a minimal buildroot image, but CircuitPython could be ported to https://github.com/rsta2/circle.
Right now, I believe the "unix" build of CP (in the same sense as the unix build of MicroPython) does not have it all and is only used for CI on GitHub... so you would miss a lot. But if a buildroot image is done, it could be similar to PiratePython, a solution developped by Pimoroni to build stand-alone Python on a Pi.
For running on circle (BMC64 is a also using circle to run on metal and emulate a C64 using GPIO for a real C64 keyboard) could be great. But there again you will miss a lot from Circuit Python if nothing is done to support HDMI output.
I am not sure there is a possible sponsor for such a work... except for the community, who would benefit from that? Adafruit? Raspberry Pi Foundation?
@thorny jay @lapis hemlock I'm not aware of a CircuitPython port that is compiled and runs on natively Linux. Blinka is a hardware compatibility layer and runs on a bunch of single board computers so you can run many of the examples and libraries in CPython for linux with little to no changes. It is written in Python.
Does anyone know if there is any wifi api reference? or an example script? I know @slender iron had a bunch of test code he was using when he was working on it, but I can't find anything included with the PR.
ok, how does one run
menuconfig? (and that's cool- linux kernel style!)
@hearty forge For CircuitPython domake BOARD=<board name> menuconfig
I don't quite understand why this (circuitpython) build system is so brittle.
@atomic summit The idf's build system doesn't integrate very well with circuitpython's
@slender iron It seems that something is just getting cached - not sure how, but a clean usually isn't enough, and I have to reboot my Mac for things to start working again.
Clearly something awkward in my environment, but I don't see the same behaviour with MPY builds.
if I can pin it down, I'll let you know!
what is the output of your git status?
my guess is that your environment is using a diffferent copy of the idf
the errors you were seeing happen when a header file isn't setup for the -Wundef setting we have for circuitpython
you'll see my fork of the idf has a lot of #if -> #ifdef
Iโm on Mac and using the IDF from espressif (not the one in CP). Did a git pull on both espressif and CPs repos last night (and again โcause I forgot to pull the sub modules) and everything built. Both the saola and @atomic summitโs board. I think I got lucky but it has worked.
@slender iron I quickly tried your uf2 port for saola. Noticed a missing carriage return in the log messages on the built in serial and no purple led. Ran out of time to try flashing CP as a uf2 but liking the idea!
hey, could i ask some questions about cp's main.c file? i'm confused about some of the safemode stuff (and generally curious too).
@slender iron Is there any Wifi API examples/reference floating around?
Working on my featherS2 test jig - and need to test wifi as part of the process.
@hearty forge when you want the uf2 bootloader make sure you are connected to native usb
@marble hornet during the week is better. I'm off and on today
I think I talked about safe mode a week or two back during my stream
@marble hornet Scott did do a good walk through of safe mode and what it aims to do on one of the recent (last 4?) streams.
Thanks @slender iron !
@slender iron yip. But looking at the code I thought it went purple if thereโs invalid ota0 - which it should be as I havenโt uploaded one yet. Iโm probably wrong- I did it late, thought Iโd see if i could compile it in prep for the next time I have time to play and more awake.
if it enters the uf2 it'll go red and then green when connected to usb
the purple is brief as it waits for a second button press
Thatโs what I was looking for to see if I can tap fast enough and not have to add the cap and resistor. I donโt even see a blink :-). Iโll have to find the delay again and bump it up a lot.
hmm adafruit_requests is in the frozen folder, but I can't import it.
you need it on the filesystem
the frozen folder is optional to include in builds
and generally not a good idea to use unless you really need it
ahh, ok.
I'm sorry, can you rephrase? stm_peripherals_timer_free does undo never reset, is that your question? What do you mean by "remain"?
requests = adafruit_requests.Session(pool, ssl.create_default_context()) throws AttributeError: 'module' object has no attribute 'Session'
what version of the library did you copy over?
Is the version in the repo the latest ?
no
The one from the frozen folder. not your new optimised one?
ok.
I know you made an optimised version.
the frozen libs aren't updated frequently
Yeah, I'm just taking a lot of this for granted... sorry.
you are learning ๐ I understand its new
It's like "the same" but not "the same" ๐
we'll be releasing a beta early next week if you are about to ship boards with it, that'd be a good version to use
same same but different
Oh excellent. So I need to get my updated board definitions in as a PR asap ?
thanks for the prompt responces @slender iron and @hearty forge I'll take look to see if i can find those.
I was curious about the 'wait_for_safe_mode_reset', i'll see if those answer my question.
I need to turn off, brownout safemode activation for my watch for now and reset after a dealy instead
@thorny jay @lapis hemlock I'm not aware of a CircuitPython port that is compiled and runs on natively Linux. Blinka is a hardware compatibility layer and runs on a bunch of single board computers so you can run many of the examples and libraries in CPython for linux with little to no changes. It is written in Python.
@gilded cradle By native, do you mean that it has a notion of the underlying hardware?
definitely
or run a script on safemode boot
though we're going to try and be more rapid with releases
Issue is I have changed some pins on the featherS2 final production - so not sure how to handle the pre-release and production variants of the board
Well it's I2C, so not sure 2 sets of pin names will work if libs are looking for defaults
@lapis hemlock Circuit Python is not a "compiler" on SBC, it is just Blinka and Circuit Python Library. So CPython is used on SBC. Where Micropython can be run and used on a Raspberry Pi and fully replace the CPython.
so might make an extra board definition for now... it can always be removed down the line.
Sorry @slender iron - Where do I find the newer requests ?
either in the bundle or from the repo
The second way would be to work on metal, without any OS on the Pi. Both would be great!!!
@thorny jay What would be the advantage of that? Are you after speed, or something else? Because as far as functionality is concerned, you can't really beat the standard python interpreter withcircuitpython. For one thing, you havenumpyon the raspberry pi, but we had to develop a stripped-down version of that forcircuitpython. And that is only one library. There are many more that are available under raspbian, but not incircuitpython.
The bundle? Is that a CPY thing?
yup
it's a zip of all the libraries
@lapis hemlock For me, the advantage would be simplicity and compatibility. You can be 100% sure your code to use the same language subset on a SAMD and an Raspberry Pi. Today it is possible to write something with Blinka that work on the Pi but fail to work on a Feather.
wow, so much to re-learn for CPY ๐
Also, getting rid of the underlying OS might be interesting.
Thanks for the hand holding Scott!
@atomic summit might be this video: https://youtu.be/0xyeEGdmLKE around 30 mins.
Join Scott as he discusses using SPI with PSRAM enabled (and many other random topics). Visit the Adafruit shop online - http://www.adafruit.com
LIVE CHAT IS HERE! http://adafru.it/discord
Adafruit on Instagram: https://www.instagram...
@lapis hemlock For me, the advantage would be simplicity and compatibility. You can be 100% sure your code to use the same language subset on a SAMD and an Raspberry Pi. Today it is possible to write something with Blinka that work on the Pi but fail to work on a Feather.
@thorny jay The underlying issue of my original question was, whether it would be possible/would make sense to simply take theunixport ofcircuitpython, and run that on the raspberry pi. That would solve the compatibility problem.
Also, getting rid of the underlying OS might be interesting.
@thorny jay But there must be some benefit of doing that, mustn't there?
Am I the last person to discover that YouTubes auto captions are searchable!? Just in case I'm not the only one: on a video, on the line with the thumbs up, share, etc, click on the ellipsis "..." open transcript. There's a vertical "..." where you can toggle time stamps, making it easy to copy & paste to a text file. Click on a line and the video jumps to the right time stamp(!)
@lapis hemlock Maybe a topic for Monday in the weekly meeting for the "In the Weed" section. For me, a PiZero could be a very low cost but Powerfull MCU to run CircuitPython. By getting rid of the underlying Operating System you get rid of a lot of problem, update, attack surface, maintenance issue, sd card usage, ... if it is Circuit Python that you want, why take a "bloated" operating system with you? ๐
@thorny jay - there's been some tangents on Scott's deep dive video's re a bare-metal CP port for RPi. There are some potentially nice places for bare CP on Pi- e.g. advanced robotics - get a big performance boost but not have to worry about all the overhead of a full multitasking OS. I can see that really help for teaching advanced concepts and not having to deal with OS management.
@lapis hemlock Maybe a topic for Monday in the weekly meeting for the "In the Weed" section. For me, a PiZero could be a very low cost but Powerfull MCU to run CircuitPython. By getting rid of the underlying Operating System you get rid of a lot of problem, update, attack surface, maintenance issue, sd card usage
@thorny jay This is a fair point.
(What @thorny jay said to @lapis hemlock ๐ )
@thorny jay Is this what you meant? https://github.com/boochow/micropython-raspberrypi
The Pi 4 would be ideal as it can be both a USB device and host.
Yeah
I was looking at this as a place to start: https://github.com/bztsrc/raspi3-tutorial
circle is gpl3 which won't mix well with circuitpython's mit license
Oh, that's unfortunate.
yup
boochow's code is MIT though
I think the usb peripheral is already supported in tinyusb too
its a bug
Know bug ?
there is an issue already
Ok, cool, thanks
so no other way for me to get a timer/stopwatch happening right now?
time.monotonic()
and time.monotonic_ns()
time and localtime crash because they need RTC stuff setup
@slender iron This is more up-to-date: https://github.com/ZuluSpl0it/micropython-raspberrypi
Just out of curiosity, how seriously are you considering a circuitpython port for the raspberry pi?
not that seriously. ideally someone else would take a stab at it
my main interest is in bringing displayio to hdmi
but the limited usb is a bummer
ideally someone else would take a stab at it
@slender iron Yeah, that's always the case ๐
๐
I think my fpga interest could be better for adafruit
rpi hardware is hard to make money on
@slender iron I'm curious how long that code.py wifi test code takes to run for you... 73sec for me. That last "get stars" takes over 70 seconds.
@slender iron Can you reveal, which FPGA you are working with? I have flirted with the idea of trying out some FPGA for a long time now, but was always dissuaded by the fact that open-source tools are far and between.
@atomic summit I think the json parse is really slow atm
@lapis hemlock I've been looking at the mach xo2 because you can load the bitstream over i2c
yeh, all of the response.json bits seem to take the longest
@lapis hemlock https://oshpark.com/shared_projects/b9Zj372R
Thanks!
there is optimization we can do there. json used to load the whole string in memory and then parse it
it's fast but uses memory
now json parses character by character. good for memory but bad for speed
so there is a middle ground we need to reach with it
I was thinking a starting point for the fpga would be replicating 74xx series logic
Could it choose the parsing method based on available RAM or something?
Yeah, that would work
or having a way to tell the jason library the "character chunk size" ?
with the default leaning towards memory optimisation not speed
Re: time.allmethods crashing. https://github.com/adafruit/circuitpython/issues/3439 If someone who knows C wants to grab that it looks like a great first contribution for someone. I took a few attempts and since I donโt know C got lost and ended up under my desk with the whisky ๐ฅ