#circuitpython-dev

1 messages ยท Page 327 of 1

onyx hinge
#

oh, wait, I think the internal API change is: communicate to the common-hal whether there's a write_value specified or not

ionic elk
#

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.

onyx hinge
#

adding this flag or distinguished value doesn't help SD cards because they essentially always use write_value

ionic elk
#

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

slender iron
#

no, just always do the memset

ionic elk
#

Ok, sounds good, that's all I needed to hear ๐Ÿ˜„

slender iron
#

and if people find it too slow, they can optimize it

#

but the behavior will be more correct now

onyx hinge
#

@ionic elk did you change optimization flags when doing this measurement?

ionic elk
#

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?

manic glacierBOT
ionic elk
#

I figured it wouldn't be too crazy of a difference since neither operation is too nested

onyx hinge
#

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;
}

manic glacierBOT
#

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.

ionic elk
#

Is there a good way to mark variables as un-optimizable so that I can use them for debugging in higher optimization settings?

onyx hinge
#

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)

manic glacierBOT
ionic elk
#

like my DWT start, mem, end vars in the example above?

slender iron
#

@ionic elk I mark them as volatile

onyx hinge
#

I would suggest volatile as a first try too

ionic elk
#

^aha good trick yes

robust kernel
#

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?

manic glacierBOT
#

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...

hearty forge
#

@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.)

ionic elk
#

Finally done with that issue! On to RGBMatrix.

robust kernel
#

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?

hearty forge
#

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.

robust kernel
#

thanks @hearty forge !

slender iron
#

@hearty forge why do you want to change the docs?

idle wharf
hearty forge
#

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

slender iron
#

looks

hearty forge
#

(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?! ๐Ÿคฃ)

slender iron
#

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

manic glacierBOT
#

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

hearty forge
#

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.

slender iron
#

sounds good

teal bear
manic glacierBOT
thorny jay
#

@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.

Gist

Testing gamepad module on uGame10. GitHub Gist: instantly share code, notes, and snippets.

ionic elk
#

@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.

manic glacierBOT
stuck elbow
#

@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

manic glacierBOT
thorny jay
#

@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.

cobalt grail
#

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?

slender iron
#

@cobalt grail what version of adafruit_requests are you using?

cobalt grail
#

6x-mpy-1.6.0

slender iron
#

try the latest checked in version

#

I don't think the latest has been released

manic glacierBOT
#

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...

slender iron
#

(I requested your review 6 days ago)

manic glacierBOT
cobalt grail
#

@slender iron Same thing. Do I need to initialize something first?

slender iron
#

what is your code now?

cobalt grail
#

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'```
slender iron
#

I thought it would give you a reasonable error message

cobalt grail
#

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
#

๐Ÿ™‚

cobalt grail
#

@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.

slender iron
#

how old is your build? there was a bug fix to circuitpython

manic glacierBOT
cobalt grail
#

Ah! OK, updated to todays build and it works! Thanks!

#

I did run out of memory on line 55 though.

manic glacierBOT
#

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,...

manic glacierBOT
robust kernel
#

thanks @idle wharf !

manic glacierBOT
#

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...

copper crescent
#

@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 :(

manic glacierBOT
#

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...
hearty forge
#

@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...

molten zephyr
#

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.

tulip sleet
#

@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.

molten zephyr
#

Super cool, I'll keep my eye on it then. Thanks for the heads up.

manic glacierBOT
ionic elk
#

@slender iron sorry, will check out tomorrow morning first thing.

crimson ferry
#

Is there a manual step to turn a library merge into a release?

solar whale
#

@crimson ferry on the right of the page, click on โ€œreleasesโ€ then tap โ€œdraft a new releaseโ€

#

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.

crimson ferry
#

@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.

onyx hinge
#

@gilded cradle ^^ who would I ask about this?

solar whale
#

@crimson ferry I'm sure permissions can be granted.

gilded cradle
#

@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.

onyx hinge
#

Thank you!

gilded cradle
#

@onyx hinge code is still there, but the module data is not. I'm not sure what generated it.

raven canopy
ionic elk
#

@slender iron any particular sketch you'd like me to test on your SPI PR? Or will anything running on the WROVER be valid?

slender iron
#

@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

ionic elk
#

Also, how do you flash a .bin file by itself? Doesn't seem to be in docs

slender iron
#

I'd look to see what command the makefile runs

onyx hinge
#

@slender iron thank you for your reviews lately. I'm concentrating on getting functionality complete before I incorporate your suggestions.

manic glacierBOT
#

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...
#

"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...
slender iron
#

@onyx hinge all good ๐Ÿ™‚

manic glacierBOT
#

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...

manic glacierBOT
#

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...
teal bear
#

@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?

onyx hinge
#

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

teal bear
#

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

slender iron
#

@teal bear I don't consider optional kwargs clutter

#

though I think start and end match other apis better

onyx hinge
#

@slender iron OK I think I got all your review items but you wrote a LOT so I probably missed one. ๐ŸŒฎ time here, ttyl.

slender iron
#

๐Ÿ‘ I've queued up all my review items and will probably do it last

onyx hinge
#

Do you want me to rebase to drop out those two commits that are unrelated, but well-intentioned changes?

manic glacierBOT
slender iron
#

@onyx hinge how about after I reply to comments? I think a rebase will mess up the existing comments

#

since the commits change

onyx hinge
#

@slender iron yeah that was my concern too! Rebase is nice but github doesn't always cope with it as well as it might.

slender iron
#

yup yup. I'm ok waiting. I can ignore for now

onyx hinge
#

What if @classmethod Message.rtr(rtr, length) ... ? but srsly ๐ŸŒฎ ๐Ÿฅฃ etc

slender iron
#

I'm around all day so go eat

teal bear
#

@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

slender iron
#

and ya, that would work. though I don't like the rtr acronym

onyx hinge
#

I'm just excited the implementation is coming together

slender iron
#

@teal bear it's there to allow subslicing without creating an intermediate object

#

that's why its start and end

teal bear
#

@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.

manic glacierBOT
teal bear
#

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

manic glacierBOT
#

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.

solar whale
#

@slender iron Woohoo! SPI working on saola_wrover -- I can talk to my rfm9x!! Thanks!

slender iron
#

great! thanks for testing

analog bridge
#

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.

slender iron
#

nice! like what?

analog bridge
#

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.

slender iron
#

kk, let me look

#

most of our sleep support is currently automatic when time.sleep has been called

analog bridge
#

time.sleep should be light sleep on the s2 ?

slender iron
#

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"

analog bridge
#

deep sleep on s2 only keeps the RTC peripherals on

slender iron
analog bridge
#

I have implemented some of those wake up features... timer, wakeup on io state change

#

cpy starts from scratch

slender iron
#

cool! I'd love to add deep sleep support

analog bridge
#

code.py needs to check on startup the wakeup reason

slender iron
#

yup

#

looks to see if he wrote up an issue with ideas

analog bridge
#

will be updating my fork with the changes

slender iron
analog bridge
#

there is no rtc_io support on cpy yet ?

slender iron
#

do you mean the low power processor accessing io?

#

probably not

analog bridge
#

the risc-v co-processor is a different story altogether

slender iron
#

haha, ok. what do you mean by rtc_io?

#

what can I help you with?

analog bridge
#

Only half of the gpio's can be assessed by the rtc peripherals

analog bridge
#

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

slender iron
#

is that when the rtc is using them as a wake up source?

analog bridge
#

yes

#

they need to re configured as normal gpio via a deinit function after they are set as rtc_io

slender iron
#

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

analog bridge
#

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

slender iron
#

makes sense

#

I don't think we're there yet ๐Ÿ™‚

#

having deep sleep apis would be awesome

#

it'll require smarter libraries potentially too

analog bridge
#

๐Ÿ‘ blinkacomputer

manic glacierBOT
analog bridge
#

I want to combine all the different wakeup functions into a single setConfig func.

slender iron
#

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

analog bridge
#

here is what I have planned the code.py to look like:

#

one sec..

slender iron
#

do you want to voice or video chat?

analog bridge
#

let me figure out where my mic is .....

slender iron
#

kk, ๐Ÿ™‚

#

I'll go refill my water

#

back

analog bridge
#

no mic found guess will have to better preparation next time

slender iron
#

no problem ๐Ÿ™‚

ionic elk
#

@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.

analog bridge
#
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

slender iron
#

so I was thinking we'd have one module for each type of alarm

#

let me rewrite your example

tulip sleet
#

@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.

analog bridge
#

ulp is what I am calling it as in (Ultra-Low-Power) ๐ŸŒฉ๏ธ ๐Ÿ”Œ blinka

slender iron
#
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?)

analog bridge
#

thanks for the example implementation....... makes me understand better, let me look into this....

slender iron
#

๐Ÿ™‚

#

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

analog bridge
#

there are 7 wake up sources listed in esp-idf

manic glacierBOT
#

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...
slender iron
#

โ˜๏ธ is the light sleep version

manic glacierBOT
#

@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...

analog bridge
#

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

slender iron
#

right, but that is good because support will vary between ports

analog bridge
#

supervisor.runtime.alarms.append(time_alarm)

manic glacierBOT
analog bridge
#

supervisor.runtime.alarms.append(time_alarm) why are we supplying what alarm is configured ?

slender iron
#

I feel like we need to tell the supervisor to pay attention to it

#

I'm open to other ways to do it

analog bridge
#

I think your approach is more consistent with other things in cpy

slender iron
#

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

analog bridge
#

There are some very specific wake up functions for the s2 which would hardly be compatible with other ports

slender iron
#

like what?

#

its ok to have modules that are only implemented by the s2 to start

analog bridge
#

esp_sleep_enable_ext1_wakeup, esp_sleep_enable_touchpad_wakeup

#

the touchpad thing requires a lot pre configuring of the gpio

slender iron
#

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

analog bridge
#

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

slender iron
#

I think the tricky part will be recreating the alarm object

#

nice!

#

and for deep sleep handling on/off usb

analog bridge
#

I tested the timer-wakeup....... it is like being reset with complete power cycle

slender iron
#

makes sense

#

starting with that as the first alarm could be good

#

even though it's equivalent to time.sleep() for light sleep

analog bridge
#

it is the easiest ๐Ÿ™‚

slender iron
#

๐Ÿ™‚

analog bridge
#

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

slender iron
#

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

analog bridge
#

Hmm... will give that a shot

#

Nice chat @slender iron, bye for now ๐Ÿ˜ด

slender iron
#

thanks! good night

analog bridge
#

deep dive tomorrow ?

slender iron
#

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

analog bridge
#

that wont be a problem....... will meet you in the deep dive ๐Ÿ™‚

molten zephyr
#

@tulip sleet Would you expect pull/937 to work on a circuitplayground bluefruit?

tulip sleet
#

@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!)

manic glacierBOT
#

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.

slender iron
#

@tulip sleet a release on your radar before your vacation? otherwise I'll either do one today or tomorrow

tulip sleet
#

@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

slender iron
#

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

tulip sleet
#

i could write the release notes if you want to demo actually making the release

slender iron
#

help with that would be great

#

we can sync tomorrow on it

#

I would like to get another out this week

tulip sleet
#

sure; i'm afk for several hours starting in about half an hour

#

i'll ping you in the morning

slender iron
#

np. I gotta eat lunch

#

๐Ÿ‘

thorny jay
onyx hinge
slender iron
#

as long as it actually picks the latest version. I think that the 19.... was prerelease

manic glacierBOT
#

@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.

manic glacierBOT
manic glacierBOT
#

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...

onyx hinge
#

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

manic glacierBOT
#

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_timerFreq to 84000000 but they still don't match up ex...
manic glacierBOT
#

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 ...

ionic elk
#

@onyx hinge did you mention you have an STM32 version of the RGBMatrix feather on the way?

onyx hinge
#

@ionic elk I have a batch of the boards from oshpark and I verified that it works recently.

#

well, works except for the smearing

ionic elk
#

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

onyx hinge
#

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.

ionic elk
#

Yeah I'll just get one there, thanks for the link! I was finding my password to sign into the site

manic glacierBOT
ionic elk
#

@onyx hinge I see that breakout doesn't have a power plug, do you just power it over USB?

onyx hinge
#

no, I power it from a wall wart

#

I power the MCU via usb and the panel via wall wart

ionic elk
#

Oh so the panel cable goes elsewhere, doesn't connect to PCB at all.

onyx hinge
#

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.

ionic elk
#

Yeah I should be able to finagle something similar

manic glacierBOT
#

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!

onyx hinge
#

I can't find the item right now

ionic elk
#

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

onyx hinge
ionic elk
#

Oh I meant I'm good, I have lots of stuff like that

#

just gotta wait on the boards themselves

onyx hinge
#

mine was consistent, I would have said. If there are whole rows swapped from run to run .. that may be a different thing

ionic elk
#

swapped?

#

I just see a lot of pixels smearing from side to side per row

onyx hinge
#

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

ionic elk
#

I have not seen your photo, have you posted it in the issue?

onyx hinge
#

jas, I may not have shared it here

ionic elk
#

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

onyx hinge
#

I haven't logic-analyzed or analog-scoped it lately

ionic elk
#

^that's generally the problem I see, though with mine I see it as "sideways", not sure how yours is oriented

onyx hinge
#

vertical in the photo is controlled by address lines, horizontal is controlled by shift registers

ionic elk
#

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

onyx hinge
#

that's the way all the 64x32 are, if there's a "short" direction that's "address" and a "long" direction is shift register

manic glacierBOT
ionic elk
#

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

manic glacierBOT
onyx hinge
#

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

ionic elk
#

@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.

lone sandalBOT
manic glacierBOT
#

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      :...
manic glacierBOT
#

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
...      ...
onyx hinge
#

@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

onyx hinge
#

that video is with feather m4 express (samd51)

#

turns out I had the "output enable" and "latch" pins switched in my pinout. ugh whoops

ionic elk
#

@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

manic glacierBOT
#

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...
onyx hinge
#

@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

ionic elk
#

I deliberately used red so that I only had to monitor the red color lines, since I only have so many probes

onyx hinge
#

I see.

ionic elk
#

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.

onyx hinge
ionic elk
#

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

onyx hinge
#

I think I never saw everything you wrote in this issue ๐Ÿ˜ฆ

ionic elk
onyx hinge
#

yeah that one

prime flower
#

@onyx hinge that power supply is large!

onyx hinge
#

thanks, I bought it a long time ago

#

it's also warm, I'll probably run it all winter

ionic elk
#

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

onyx hinge
#

thank you, I'll fix that!

#

The text is right, the diagram is wrong

ionic elk
#

Yeah - it's correct in the code

#

So it's also wrong for the ST board, right? Maybe that just migrated over somehow?

onyx hinge
#

I'm not sure at this point, I'll check that next

ionic elk
#

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

onyx hinge
#

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

ionic elk
#

A saleae might simply be missing the peaks of the pulses, though, since the sampling rate is ehh

onyx hinge
#

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

ionic elk
#

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?

onyx hinge
#

but I think on that page, OE and LAT match from the fritzing diagram to the text. Can you double-check me?

manic glacierBOT
ionic elk
#

@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

manic glacierBOT
ionic elk
#

part 607

#

So you're getting good results on that screen now?

onyx hinge
#

yes

ionic elk
#

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?

onyx hinge
#

not with STM, no.

ionic elk
#

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?

onyx hinge
#

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.

thorny jay
#

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.

onyx hinge
ionic elk
onyx hinge
#

thanks, that I'll fix

#

smh, I am so bad at fritzing

ionic elk
#

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

onyx hinge
#

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)

ionic elk
#

What's the picky requirement? timer presence?

#

PWM?

onyx hinge
#

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"

ionic elk
#

A single GPIO port you mean?

onyx hinge
#

right

ionic elk
#

Oh I see so you can run just one GPIO write

onyx hinge
#

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.

manic glacierBOT
ionic elk
#

@onyx hinge freeze is in _PM_swapbuffer_maybe, there's an infinite loop

onyx hinge
#

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.

tulip sleet
#

@onyx hinge I am going to try to restart the stalled approved PR's, one at a time, so I can merge them.

onyx hinge
#

@tulip sleet thanks. as noted above I tried resetting #3242 about 40 minutes ago

ionic elk
#

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...

onyx hinge
#

It's the same as whatever I posted before but with width=32 instead of width=64

ionic elk
#

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

onyx hinge
#

... 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

ionic elk
#

What is color depth? Is that a measure of the PWMOut LED intensity management?

#

Doesn't actually affect pinout or anything?

onyx hinge
#

no.

ionic elk
#

how about AutoRefresh, do we need that?

#

I see it in some examples but not others

onyx hinge
#

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

ionic elk
#

I see you don't even include it in your constructor, does it default to width if you don't set it?

onyx hinge
#

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)

manic glacierBOT
ionic elk
#

@onyx hinge Could you send your entire test sketch? The ohai one?

onyx hinge
#

there's no sketch

#

I paste that in the repl, then type into the repl

ionic elk
#

Nevermind I had a pin unplugged

#

it's working great now! woot!

crimson ferry
#

Is there any way to access the bootloader version from CircuitPython code?

ionic elk
#

I mean except for the crash. Gonna try adding the timer to never_reset and see if that helps

manic glacierBOT
#

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...

ionic elk
#

@onyx hinge There's one thing I'm confused about here - so, _PM_timerInit and common_hal_rgbmatrix_timer_allocate both allocate timers?

onyx hinge
#

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

ionic elk
#

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

manic glacierBOT
#

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...

tulip sleet
#

@onyx hinge Does PR #3398 (dict compression) supersede #3370 (bigrams)? I'm just trying to be clear in the release notes.

slender iron
#

@crimson ferry I don't know of a way to read the bootloader version from circuitpython

crimson ferry
#

thanks

#

I was just thinking of automating manual checks for current bootloader

onyx hinge
#

@tulip sleet yes

slender iron
#

you could programmatically kick to the bootloader but I'm not sure if there is a programmatic way out of the bootloader

crimson ferry
#

but the bootloader is somewhere on flash, so it's conceivable that core code could access it?

slender iron
#

yeah but I don't know if the placement of the version number is consistent

#

it probably isn't

onyx hinge
#

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"

tulip sleet
#

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.)

slender iron
#

ok, thanks!

onyx hinge
#

@ionic elk excellent! I will try to test it today.

analog bridge
#

Can a usb drive call for eject / dismount ?

tulip sleet
#

no, very unfortuantely

#

otherwise we would definitely use it

analog bridge
#

@tulip sleet , I was going through microcontroller.reset() code saw warning regarding improper use of that function could lead to data corruption

tulip sleet
#

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)

analog bridge
#

currently working on deep sleep stuff equivalent to having a reset....

slender iron
#

@analog bridge we shouldn't deep sleep when on usb

tulip sleet
#

if you are connected to USB, I don't see a strong need for deep-sleep, since you have a power supply

analog bridge
#

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 ?

slender iron
#

I think it's much more likely USB is connected because you are developing your code

tulip sleet
#

the power consumption of the rpi swamps that of the board

analog bridge
#

so no checks for usb then before sleep

manic glacierBOT
#
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...

slender iron
#

you should only deep sleep when usb data is not connected

analog bridge
#

also there are several other things need to be taken care of like io and wifi state

#

before sleep

slender iron
#

deep sleep or light sleep?

analog bridge
#

deep

slender iron
#

wifi is disconnected right? io except triggers should be deinit as well

tulip sleet
#

@onyx hinge I am manually re-running the PR's in order to throttle job queuing. WIll merge approved PR's when done.

onyx hinge
#

@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

analog bridge
#

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

tulip sleet
#

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.

onyx hinge
#

I got my matrixportal!!!7

tulip sleet
#

i am being release-meister

slender iron
#

@analog bridge ya, we do something like that when the VM finishes anyway

tulip sleet
#

is the idea that deep sleep would only happen between VM instantiations anyway? I thought so becuase RAM is not maintained (right?).

slender iron
#

that was my thinking

tulip sleet
#

a small amount of startup state would be maintained in backup RAM (so no need to write flash), I would think

analog bridge
#

@tulip sleet no ram only rtc peripherals are awake

tulip sleet
#

i thought there was a small chunk of RAM available if desired

manic glacierBOT
slender iron
#

ya, there is RTC ram that can be kept alive

analog bridge
#

pretty limited though...

tulip sleet
#

just so the restarting program can be passed some info about what to do

slender iron
#

right, the program will be able to get the reason it woke up

tulip sleet
#

even a few integers is enough

analog bridge
#

wakeup reasons are implemented well on s2

manic glacierBOT
analog bridge
#

about the wakeup reason thing, @slender iron what format should I use to return it ?

tulip sleet
#

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

analog bridge
#

here is what the idf spits out (ESP_SLEEP_WAKEUP_TIMER, + other parameters mostly int)

slender iron
#

in my API I was thinking alarm objects

#

so that would be a TimerAlarm object that would compare equal to the original

analog bridge
#

I am using microcontroller instead of supervisor, my deep sleep call is microcontroller.sleep()

slender iron
#

ok

analog bridge
#

the wakeup reason part should be implemented in microcontroller ? example call microcontroller.getWakeAlarm()

manic glacierBOT
slender iron
#

@analog bridge I think so. Python style is get_wake_alarm but that's a detail

analog bridge
#

will get all these things in check once we get basics done

slender iron
#

ok cool!

analog bridge
#

nice chat @tulip sleet & @slender iron...... back to code blinkacomputer

slender iron
gilded cradle
#

Yes, thanks

craggy drift
#

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?
slender iron
#

@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

craggy drift
#

kk cool

manic glacierBOT
craggy drift
#

another thing - i don't have a vid/pid yet
can i just request one on the repo before I make the PR?

slender iron
#

for open source hobbyist boards you can create an issue for one

craggy drift
#

sounds good, thank you :)

manic glacierBOT
#

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...

#

There are 2 test cases here.

  1. Boot on battery power only.

  2. 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.
...

manic glacierBOT
onyx hinge
#

@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 to common-hal too?
  • 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.h header, ```
    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.

slender iron
#

sorry @onyx hinge I was eating lunch. I think that forward declaration would work

slender iron
#

@tulip sleet want to sync on the state of the release?

tulip sleet
#

@slender iron just got back from an errand, sure

slender iron
#

I'm in the CircuitPython channel

tulip sleet
#

is:pr is:merged sort:updated-desc

manic glacierBOT
gilded cradle
#

@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?

slender iron
#

to survive power disconnect too?

gilded cradle
#

yes

#

preferably

slender iron
#

nvm or writing to the fs

gilded cradle
#

nvm?

#

Oh, is that a module?

#

I get it means non-volatile memory

slender iron
#

yup, it's a 256 byte or bigger area

#

acts like a bytearray

gilded cradle
#

Awesome. That's exactly what I need. Thanks

slender iron
#

great!

manic glacierBOT
#

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.

manic glacierBOT
atomic summit
#

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....

atomic summit
#

A restart fixed it.. sheesh.

hearty forge
#

@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.

atomic summit
#

@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!

hearty forge
#

Me too.

atomic summit
#

But, no PSRAM is active.

hearty forge
#

Wow- that's a sick board. Looking forward to hearing when you've get the PSRAM back!

atomic summit
#

Maybe PSRAM is still not merged.

idle wharf
atomic summit
#

Yeah, not sure if that has the SPI fix Scott was working on.

#

Seems to still be in a branch on his fork.

hearty forge
idle wharf
#

If you're looking at fix-spi-ram

ha yes ^^ that

atomic summit
#

Ok, so I guess I need to menuconfig to enable it?

idle wharf
#

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

hearty forge
#

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?

atomic summit
#

idf.py menuconfig from inside the esp32s2 folder

hearty forge
#

oh... that's slick.

idle wharf
#

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.

atomic summit
#

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

idle wharf
#

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

hearty forge
#

@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.

#

But how do you create a uf2 file from the esp32s circuit python binary?

idle wharf
#

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.

hearty forge
#

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 ๐Ÿ˜‰

idle wharf
#

I think the partioning scheme needs to become stable first too

atomic summit
#

@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

idle wharf
#

I think I had that same error let me check my seach history

hearty forge
#

which board?

idle wharf
#

Yep... I did and I was building the Kaluga at the time

#

I had to redo something in my ~/esp/esp-idf

atomic summit
#

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.

idle wharf
#

When all fails update the things one more time

atomic summit
#
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...

idle wharf
#

Did you do clean after you updated submodules?

atomic summit
#

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.

hearty forge
#

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?

idle wharf
#

He probably only has the FeatherS2 ๐Ÿ˜‰

atomic summit
#

I'm only building my boards - and today only my FeatherS2

#

@idle wharf ProS2 as well ๐Ÿ˜‰

idle wharf
#

UnobtainiumS2 more like

hearty forge
#

๐Ÿ™‚

idle wharf
#

@atomic summit Can I check something on my FeatherS2 for you ?

atomic summit
#

I just want to see PSRAM and Flash correct...

#

trying to build a CPY version for my test jog to use.

idle wharf
#

Tell me the commands, i'll run them. Then I'll make the menuconfig edits and run it again

hearty forge
#

^^^ far more useful than me- I did just build for FeatherS2 & Saola Wrover, and it worked.

idle wharf
#

os.statvfs('/')
(2048, 2048, 5969, 5912, 5912, 0, 0, 0, 0, 255)

gc.mem_free()
8194368

atomic summit
#

ok, so PSRAM worked for you?

idle wharf
#

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

atomic summit
#

That's 8MB

idle wharf
#

I could drop you my .bin

atomic summit
#

na, need to see why I cant build

#

then I need to see why PSRAM wasn't present before

hearty forge
#

Is the statvfs showing 16Mb flash? I don't know what it's outputting..

idle wharf
#

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)

atomic summit
#

I'm killing off my esp32s2 folder...

idle wharf
#

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.

hearty forge
#

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.

idle wharf
#

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 !

hearty forge
#

You too- and anytime. Good luck @atomic summit !!

atomic summit
#

Just did a fresh repo install.. still no PSRAM showing up. ๐Ÿ˜ฆ

#

Tried 3 boards... can't be the hardware

manic glacierBOT
grim dagger
#

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?

lone axle
#

@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.

grim dagger
#

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?

lone axle
#

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.

tulip sleet
#

This might be due to really old Python, or perhaps because of an encoding issue on the platform. @grim dagger ^^

grim dagger
#

Apparently attributes like 'reconfigure' were introduced in Python 3.7, so CircuitPython appears to be dependant on it now.

lapis hemlock
#

@gilded cradle Is Blinka the hardware abstraction layer for the raspberry pi, or is it something more?

onyx hinge
#

@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.

grim dagger
#

I got a build, so I'm happy. Just need to find out where the uf2 file went...

tulip sleet
#

@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.

onyx hinge
#

@grim dagger look in the build-<boardname> directory for firmware.uf2

#

@tulip sleet I think getting CAN merged on monday may be optimistic

tulip sleet
#

we'd like to speed up the beta cadence anyway; the alpha cadence has been 3-4 weeks, which is too long

manic glacierBOT
#

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...
onyx hinge
#

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

tulip sleet
#

@onyx hinge I merged the weblate PR, and it didn't cause merge conflicts (CAN PR already had merge conflicts).

onyx hinge
#

OK, thanks

tulip sleet
#

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.

onyx hinge
#

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

tulip sleet
#

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

lone axle
lapis hemlock
#

But these are all single-board computers that run linux, right?

lone axle
#

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

lapis hemlock
#

I believe they all run linux, but I am not certain
@lone axle If so, then why just not run the circuitpython linux port?

lone axle
#

Hmm, I'm not sure if I could answer that. Tbh I didn't know there was a circuit python linux port.

lapis hemlock
#

That's where we test, because that is much faster, than compiling and uploading the firmware.

lone axle
#

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

lapis hemlock
#

But linux does that, too.

lone axle
#

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?

lapis hemlock
#

A linux executable.

lone axle
#

does it have something like board that is aware of all of the pins and other on-board hardware devices?

lapis hemlock
#

No, and that is why I was asking, where exactly blinka is.

lone axle
#

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.

lapis hemlock
#

I think you are right.

onyx hinge
#

I wonder who wrote this lib .. copyright notice 11-12 years ago, no name, comments in german, copied widely

thorny jay
#

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. ๐Ÿ˜‰

lone axle
#

Shawn has been on Show & Tell I think recently he was there showing a voice activated street fighter "Haduken" controller.

grim dagger
#

@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.

atomic summit
thorny jay
#

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...

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!!!

kind river
thorny jay
#

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?

gilded cradle
#

@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.

atomic summit
#

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.

slender iron
#

ok, how does one run menuconfig? (and that's cool- linux kernel style!)
@hearty forge For CircuitPython do make 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

atomic summit
#

@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!

slender iron
#

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

hearty forge
#

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!

marble hornet
#

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).

atomic summit
#

@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.

slender iron
#

@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

hearty forge
#

@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.

atomic summit
#

Thanks @slender iron !

hearty forge
#

@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.

slender iron
#

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

hearty forge
#

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.

atomic summit
#

hmm adafruit_requests is in the frozen folder, but I can't import it.

slender iron
#

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

atomic summit
#

ahh, ok.

manic glacierBOT
atomic summit
#

requests = adafruit_requests.Session(pool, ssl.create_default_context()) throws AttributeError: 'module' object has no attribute 'Session'

slender iron
#

what version of the library did you copy over?

atomic summit
#

Is the version in the repo the latest ?

slender iron
#

no

atomic summit
#

The one from the frozen folder. not your new optimised one?

#

ok.

#

I know you made an optimised version.

slender iron
#

the frozen libs aren't updated frequently

atomic summit
#

Yeah, I'm just taking a lot of this for granted... sorry.

slender iron
#

you are learning ๐Ÿ™‚ I understand its new

atomic summit
#

It's like "the same" but not "the same" ๐Ÿ™‚

slender iron
#

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

atomic summit
#

same same but different

#

Oh excellent. So I need to get my updated board definitions in as a PR asap ?

marble hornet
#

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

lapis hemlock
#

@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?

slender iron
#

definitely

marble hornet
#

or run a script on safemode boot

slender iron
#

though we're going to try and be more rapid with releases

atomic summit
#

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

slender iron
#

you can do two definitions if you like

#

or two sets of pin names

atomic summit
#

Well it's I2C, so not sure 2 sets of pin names will work if libs are looking for defaults

thorny jay
#

@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.

atomic summit
#

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 ?

slender iron
#

either in the bundle or from the repo

lapis hemlock
#

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 with circuitpython. For one thing, you have numpy on the raspberry pi, but we had to develop a stripped-down version of that for circuitpython. And that is only one library. There are many more that are available under raspbian, but not in circuitpython.

atomic summit
#

The bundle? Is that a CPY thing?

slender iron
#

yup

#

it's a zip of all the libraries

thorny jay
#

@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.

atomic summit
#

wow, so much to re-learn for CPY ๐Ÿ™‚

thorny jay
#

Also, getting rid of the underlying OS might be interesting.

atomic summit
#

Thanks for the hand holding Scott!

hearty forge
lapis hemlock
#

@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 the unix port of circuitpython, 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?

hearty forge
#

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(!)

thorny jay
#

@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? ๐Ÿ™‚

hearty forge
#

@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
#

@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.

hearty forge
#

(What @thorny jay said to @lapis hemlock ๐Ÿ˜‰ )

lapis hemlock
kind river
#

The Pi 4 would be ideal as it can be both a USB device and host.

slender iron
#

but only on the type c

#

which is also the power source

kind river
#

Yeah

slender iron
#

circle is gpl3 which won't mix well with circuitpython's mit license

kind river
#

Oh, that's unfortunate.

slender iron
#

yup

#

boochow's code is MIT though

#

I think the usb peripheral is already supported in tinyusb too

atomic summit
#

Ok, what's the deal with time.time() and time.localtime()?

#

both lockup my boards

slender iron
#

its a bug

atomic summit
#

Know bug ?

slender iron
#

there is an issue already

atomic summit
#

Ok, cool, thanks

slender iron
atomic summit
#

so no other way for me to get a timer/stopwatch happening right now?

slender iron
#

time.monotonic()

#

and time.monotonic_ns()

#

time and localtime crash because they need RTC stuff setup

atomic summit
#

Yeah, I just saw in the issue.

#

ok, monotonic works for me, thanks!

lapis hemlock
#

Just out of curiosity, how seriously are you considering a circuitpython port for the raspberry pi?

slender iron
#

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

lapis hemlock
#

ideally someone else would take a stab at it
@slender iron Yeah, that's always the case ๐Ÿ˜‰

slender iron
#

๐Ÿ˜„

#

I think my fpga interest could be better for adafruit

#

rpi hardware is hard to make money on

atomic summit
#

@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.

lapis hemlock
#

@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.

slender iron
#

@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

atomic summit
#

yeh, all of the response.json bits seem to take the longest

slender iron
lapis hemlock
#

Thanks!

slender iron
#

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

kind river
#

Could it choose the parsing method based on available RAM or something?

slender iron
#

I think I'd just fetch 32 or 64 characters at a time

#

and it'll speed it up a lot

kind river
#

Yeah, that would work

atomic summit
#

or having a way to tell the jason library the "character chunk size" ?

#

with the default leaning towards memory optimisation not speed

idle wharf
#

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 ๐Ÿฅƒ

GitHub

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(t...