#circuitpython-dev

1 messages · Page 329 of 1

analog bridge
#

@slender iron I added UF2 on microS2 and made a PR on uf2-esp32s/multiple_flash_sizes for it

slender iron
#

haha, ok

analog bridge
#

also @slender iron I used the custom stubs function to get the gpio responsible for causing wake up from deep sleep and it works quite well.

#

thanks for the suggestion

slender iron
#

nice!

analog bridge
#

@slender iron deep sleep api discussion if you are free ?

#

I have got some updates

#

I am considering creating a new module named alarm for getWakeAlarm() instead of implementing it in microcontroller.

slender iron
#

that seems ok

#

I can't voice chat now because I'm tethering

#

(my power is out)

analog bridge
#

microcontroller will only have a function to call for deep sleep which won't be visible from code.py as we only call deep sleep when we exit from code.py

#

draft PR coming soon 🙂

manic glacierBOT
#

Thank you!!! This approach looks really good overall. I have a question about reload_on_success but it should be easy to sort out.

If this is used in an OTA case maybe we want something like "errors_ok=False" where a failure in the next code reverts what is run back to code.py. When on USB, I think an error would be ok.

Wild idea, what if you use the same approach to save the traceback string and provide it to the code.py? That way an OTA could capture the error.

manic glacierBOT
#

SH1107 DisplayIO Support Update

I thought I would use this draft PR to keep posting progress on trying to get SH1107 supported under DisplayIO.

TL;DR:
I'm stuck because DisplayIO seems to expect the display controller to auto-increment past page (page mode writes) or column (vertical mode writes) boundaries. SH1107 requires you to set the page or column address at the end of each boundary or it will just wrap and start updating the same page or column of memory. I'm not sure this...

grim dagger
manic glacierBOT
manic glacierBOT
#

I think you can add a second quirk (or just call this the sh quirk and have it do two things.) The second thing you could do is change the subrectangle that is updated here: https://github.com/adafruit/circuitpython/blob/main/shared-module/displayio/Display.c#L277 Basically change each subrectangle to be the smallest area you can update.

Thanks. I might try switching to 'vertical' mode as well, then the display will have a horizontal orientation naturally without the user having to set ...

#

When a pin is listed in board, it should print out with its first board name instead of microcontroller.pin.

Code is here: https://github.com/adafruit/circuitpython/commit/168aa394dba31449cdb267444992b4f636906aaa#diff-df3dad56701b150d4292baceaa18e2c2R77

With a pin definition like:

STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
    { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO17) },
    { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO17) },
}

Thi...

manic glacierBOT
#

@tannewt Is it really just this simple?

diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c
index 1294b78f0..409d998ee 100644
--- a/shared-bindings/microcontroller/Pin.c
+++ b/shared-bindings/microcontroller/Pin.c
@@ -71,7 +71,7 @@ STATIC void mcu_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
     qstr name;

     get_pin_name(self, &package, &module, &name);
-    mp_printf(print, "%q.%q.%q", MP_QSTR_microcontroller...
slender iron
crimson ferry
#

cool, I test it out this eve

slender iron
#

that should fix the "run out after 21" bit

#

I still don't know why the esp32spi doesn't like the reuse

crimson ferry
#

same-enough IDF I'd expect (though there's the Arduino abstractions), almost points to NINA, but I really don't know either

slender iron
#

I think fixing this socket leak will at least succeed

crimson ferry
#

oops, you get the idea

slender iron
#

heh, I missed words too

balmy stirrup
#

Question - Is anyone having issues with today's 6.0.0-beta with saving a code.py file and having it update real-time on your device? What I am experiencing is when I made changes, for example change something simple like ->

cp.red_led = True

Changing it to False and clicking save is not updating live on the device. Has anyone else seen this or could someone else possibly build from source and see if you can reproduce?

slender iron
#

what OS are you on?

balmy stirrup
#

Windows

slender iron
#

the host OS sometimes waits to write to the flash

balmy stirrup
#

Yea I read that however time is passing and still not updating.

#

even if I go into the REPL and ->
import code
No effect

slender iron
#

hrm

#

do you mean it isn't reloading at all?

balmy stirrup
#

If I reboot the device the code changes take effect which is not expected behavior.

#

I am reproducing this on my MAC as well.

slender iron
#

huh, could be a bug

#

what board are you using?

balmy stirrup
#

The Circuit Playground Bluefruit.

slender iron
#

go ahead and file an issue. that way others can try and reproduce

balmy stirrup
#

6.0.0-beta.0-46-gdd86cb00a-dirty on 2020-09-23

slender iron
balmy stirrup
#

Thanks

slender iron
#

np

manic glacierBOT
#

Issue: When I take a simple code block
`
from adafruit_circuitplayground import cp

while True:
cp.red_led = True
Then make a change such as the following
from adafruit_circuitplayground import cp

while True:
cp.red_led = False
`

Expected Behavior: The device will no longer illuminate the D13 LED
Actual Behavior: The device continues to illuminate the D13 LED

  • Note: When I reboot the device any drive persistent saves will take effect however the expected b...
balmy stirrup
#

@slender iron I just did another pull and rebuilt. Strangely I am not seeing the issue.

slender iron
#

interesting

balmy stirrup
#

Let me try to reproduce with my MAC brb.

slender iron
#

kk

balmy stirrup
#

Closed...

slender iron
#

🙂

#

now we have one more closed issue

balmy stirrup
#

YAY and stuff!

manic glacierBOT
balmy stirrup
#

Parallel dimension @pastel panther well played!

manic glacierBOT
crimson ferry
#

@slender iron lol I was getting errors before dinner, but I see you updated now 🙂

#

still getting every other socket: RuntimeError: Failed to send 3 bytes (sent 0)

slender iron
#

yup, I didn't fix that 🙂

#

I think I'm going to pick up my split esp32spi code

crimson ferry
#

it does fix the running out of sockets though 🙂

slender iron
#

yup, that was my hope

crimson ferry
#

wait, spoke too soon:```Fetching text...
22 RuntimeError: Failed to send 3 bytes (sent 0)

Fetching text...
23 Socket missing recv_into. Using more memory to be compatible
RuntimeError: Timed out waiting for SPI char

Fetching text...
24 RuntimeError: Expected 01 but got 00

#

maybe different issue

slender iron
#

ya, that's a nina thing I think

crimson ferry
#

had to reset... the esp32 got into an unhappy state

slender iron
#

I reworked timeouts in my split branch that may help

crimson ferry
#

should I wait if you're still tweaking?

slender iron
#

the requests change is ready to merge I think

#

there are just a number of bugs

crimson ferry
#

I'm running again to see if it dies in the same place

slender iron
#

I saw it after a while too

manic glacierBOT
#

My though is that RTRs and normal messages are not functionally the same so using the same class for both is a bit awkward. If there were two types, then you'd have to know which type to pass into readinto to be filled by the next message of unknown type.

On the receiving end especially, you're going to want to know if it's an RTR message so at some point I would expect code like


while not timeout_expired():
    message = <MessageGiver>.next_message
    if message is None:
   ...
crimson ferry
#

yeah, iteration #22 again

#

oops, sorry, cancel that, that's the expected even-iteration error

#

so it will run, presumably until it hits the (NINA) "RuntimeError: Timed out waiting for SPI char" error... will try to replicate

slender iron
#

ya, I think the nina timeout is too low generally

#

I need to dust off my split branch and make it backwards compat

crimson ferry
#

sequence this time:```Fetching text...
34 RuntimeError: Failed to send 3 bytes (sent 0)

Fetching text...
35 Socket missing recv_into. Using more memory to be compatible
RuntimeError: Unable to read HTTP response.

Fetching text...
36 RuntimeError: Expected 01 but got 00```but control-C, control-D got it back on track... I suspect if I catch the SPI error and esp.reset and retry it would

#

be fine... I'll play around some more

slender iron
#

ya, I think so

#

the pyportal level is really aggressive in catching errors

#

frustrating for debugging but good for retrying

crimson ferry
#

I pretty much operate at Requests level these days, do my own timeouts, retries, exception handling

slender iron
#

thanks for the testing 🙂

crimson ferry
#

np

#

sorry, I jumped the gun and thought pr addressed chunked, but you said if was for running out of sockets and that's looking good now

manic glacierBOT
peak thicket
#

A question about Phillip Burgess's Moon Phase Clock, can the code be converted to work with the original PyPortal? If so can someone give me a lead on how to go about it.

manic glacierBOT
thorny jay
#

A question about Phillip Burgess's Moon Phase Clock, can the code be converted to work with the original PyPortal? If so can someone give me a lead on how to go about it.
@peak thicket Yeah, that could be great, actually a few of the Matrix Portal demo could work on PyPortal. For the Moon, I am afraid the BMP used will be low resolution and so not that nice. What I saw is 100 BMP files, but I don't know how they have been generated. Except for that the code get the time from internet, does some computation, and then ask an API with the real time (maybe UTC or something like that).

prime cove
#

I posted this in the help-with channel, but digging into it a bit more, it might be more appropriate here:

uart = busio.UART(board.TX, board.RX, baudrate=9600)
msg = bytearray("hello world\n")

while True:
    uart.write(msg)
    time.sleep(.05)
    data = uart.read(len(msg)) 
    print(data)
    data = ''
    time.sleep(1)
#

When I run this code on a grand central m4 with nothing connected to it, my uart.read statements return "hello world\n"

#

If I run this on TX1/RX1 or TX2/RX2 this does not happen

#

is there some sort of unique shared buffer on the default uart that causes this?

onyx hinge
#

I don't know why that would happen, absent a connection between the RX and TX pins that would "loop back" the signal from the transmit pin to the receive pin.

prime cove
#

Yeah, nothing is physically connected to it. No matter what length message I send, I get equal bytes back in my rx buffer

#

@onyx hinge I've actually got a second grand central, but without headers. That board is acting properly. I've updated both boards to 5.3.1 and double checked the code to be identical. Any idea what could be going on there?

#

I double checked with a multimeter that there is no electrical connection

prime cove
#

I'm starting to think it may be an electrical issue after all. Using jumper wires on my board without headers, if I hold the ends of the wires in separate hands I am able to replicate the behaviour I see on my board with headers

simple pulsar
#

@prime cove What happens if you ground the relevant rx pin?

prime cove
#

Grounding RX cleans it up

simple pulsar
#

Sound like a quirk with the input left floating?

prime cove
#

I think the headers might actually be adding enough capacitance to cause an issue. If i leave them floating on the headerless board I don't see the issue.

simple pulsar
#

For comparison, this is what fingers can do on the TFT Gizmo and these aren't even floating inputs! https://www.youtube.com/watch?v=h5VPk8JsDXk

The CircuitPython code running on this Circuit Playground Bluefruit rotates through three non-moving sprites on the left side of the TFT Gizmo screen at 00:00 to 00:04.

If fingers are pressed firmly against the pad/screw heads of the Gizmo over SCL/SDA/RX/TX then this can c...

▶ Play video
prime cove
#

For sure! Fingers definitely cause problems, I just haven't run into headers having this sizeable of an impact before

balmy stirrup
#

Is there a way to disable the REPL in CP? In MP it is done by going into the ports folder of choice and editing main.c however the structure is different here and wanted to better understand how to do this if one was to ever create an app where we did not want REPL access.

stuck elbow
#

you can disable the CDC USB device

#

then you don't have the USB serial at all

balmy stirrup
#

How would I disable that? In addition what if I wanted to have serial coms is there another option?

stuck elbow
#

there was an option for compilation for selecting which USB devices are to be active

#

CDC, MSC, MIDI, etc.

#

no idea for if you want serial but not REPL

balmy stirrup
#

I am looking for how CP implements main.c in a given port. In MP, main.c allows me to disable the REPL. There has to be something in CP that will allow this thus allowing a serial com however not having access to a REPL.

stuck elbow
#

might be outside of use cases for CP

balmy stirrup
#

If CP was to be used on more sophisticated devices where security is an issue like a medical device, etc this feature must be available.

stuck elbow
#

it is mostly for education, after all

#

yea, don't use CP on medical devices

balmy stirrup
#

Obviously not now but I am just trying to think about ways we can push the CP into more advanced applications in addition to it being educational thats all.

stuck elbow
#

MP is more suited in that area

balmy stirrup
#

If anyone can point me in the right direction to disable the REPL that would be great.

#

Yes MP is more suited I agree I am just looking at additional options for future needs that's all.

stuck elbow
#

sure, you might have some luck searching the github issues

#

I think this might have come up before

balmy stirrup
#

I would like to see CP in a place where people will not be able to say, "Oh CP, it can't do that!" With unittesting and an ability to disable REPL it just opens potential doors for advanced makers.

stuck elbow
#

sure, but the development focus is still gong to be the first 10 minutes of user experience

#

there is issue for disabling those USB devices at run time, by the way

#

then it doesn't even require recompilation, and you can have something like "hold down this button at boot to have serial and usb disk"

simple pulsar
stuck elbow
#

yes

balmy stirrup
#

Thanks @simple pulsar I am still looking for a way to disable the REPL rather than the USB altogether.

crimson ferry
#

@slender iron I went way out on a limb and tried to kick off multiple requests and collect the responses later in a low-tech-async way, but got "Newer Response closed this one. Use Responses immediately." I assume that's expected.

simple pulsar
#

@balmy stirrup You could add that as a comment to issue ticket. You want serial output (and input) but no REPL, then?

balmy stirrup
#

@simple pulsar what I am looking for is an easy way to:
1)disable REPL (like going into a given ports main.c in MP)
2)disable USB (for instances where you want both a REPL and USB no access)

manic glacierBOT
#

How would one accomplish the two following tasks very specifically?
1)disable REPL (like going into a given ports main.c in MP)
2)disable USB (for instances where you want both a REPL and USB no access)
3)have full serial input and output available

The potential use case will NOT be default or standard it would be an option for advanced uses in the even CP were to be used in more advanced IoT devices where security is of primary concern. This can create significant potential for CP ho...

ionic elk
#

I think this is ST's replacement for the F1 line, basically?

#

I don't think they're too special right now because a lot of their chip lines aren't out yet, but I'll be interested in them once they get the CE lines (max RAM/Flash) released - they'll be the most powerful chip I know of for the QFN48 chip size.

balmy stirrup
ionic elk
#

@slender iron as for the GigaDevices, I guess they're actually a legitimate ARM licensee, which I'm not sure about for some of the sketchier clones. They claim to have done their entire own implementation, they just based it on the STM32 to make it "compatible". That said, I don't hear very good reviews for it - most people don't feel the chip's extensive errata and poor ADC performance make up for the small drops in pricing, when compared to the F103 or F401 which are often just as bottom barrel inexpensive

silver tapir
#

@onyx hinge I'm trying to translate to spanish "Already have all-matches listener". What would "all-matches" means in this context?

#

I'm trying to read the src, but the msg vs the conditions on the 'if's are not clear to me.

balmy stirrup
#

@slender iron :
1)You mentioned in git issue 1015 that CIRCUITPY can be edited to disable USB where specifically is that in main.c as there are many references as I would like to test disabling the USB drive however still having the ability of the internal .py modules to write to the disk (for example saving a setting throughout runtime)?
2)Where would one place a specific frozen module assuming there is no boot.py or USB to run if no REPL or USB or boot.py was present when flashing the drive? I am looking to where I can place a .py file which will be frozen and then ran on boot.

idle wharf
#

@balmy stirrup I have been wondering if over time there's room for the current maker\beginner CP and then through a series of CP add-ons (maybe a configurable build system) which enable\disable "advanced" features which might also be prohibitively complicated for makers\beginners another CP version to support "advanced" needs. Definitely NOT a fork though.

balmy stirrup
#

@idle wharf I agree that is exactly where I am going with this. It is not about changing the initial "experience" of CP. That has to be as basic and simple as possible to gain maximum new maker converts. I just want to understand how I may do some of these "advanced" techniques so that I create a detailed tutorial for anyone looking to use CP in a more advanced way.

idle wharf
#

I think that what is "advanced" would be an interesting list to put together.

slender iron
#

@slender iron I went way out on a limb and tried to kick off multiple requests and collect the responses later in a low-tech-async way, but got "Newer Response closed this one. Use Responses immediately." I assume that's expected.
@crimson ferry Yup, because you may end up reusing the socket for the next request.

#

I don't think they're too special right now because a lot of their chip lines aren't out yet, but I'll be interested in them once they get the CE lines (max RAM/Flash) released - they'll be the most powerful chip I know of for the QFN48 chip size.
@ionic elk The access line actually goes down to 32qfn which is on the trinket and gemma. STM32G491KC/E. 112K ram and 256 or 512k flash. marked as q1 2021

#

@onyx hinge I'm trying to translate to spanish "Already have all-matches listener". What would "all-matches" means in this context?
@silver tapir A match is a set of condition for what messages to listen to. an all-matches listener includes all messages off of the bus

silver tapir
#

@onyx hinge Thanks.

slender iron
#

@slender iron :
1)You mentioned in git issue 1015 that CIRCUITPY can be edited to disable USB where specifically is that in main.c as there are many references as I would like to test disabling the USB drive however still having the ability of the internal .py modules to write to the disk (for example saving a setting throughout runtime)?
2)Where would one place a specific frozen module assuming there is no boot.py or USB to run if no REPL or USB or boot.py was present when flashing the drive? I am looking to where I can place a .py file which will be frozen and then ran on boot.
@balmy stirrup 1) You can disable MSC in the USB descriptor or set it read-only in boot.py. I'm not sure what portion of the issue you are referring to. 2) I don't know. We don't support that. A system without USB isn't CircuitPython to me.

#

and if you do want to use CircuitPython code in a secure environment, it is your responsibility to make sure it is secure. Other contributors and I do not.

balmy stirrup
#

@slender iron I understand it would be my responsibility I am just trying to understand the "how" I apologize if it somehow offended.

slender iron
#

As long as you understand it's on you I'm fine with you exploring it.

balmy stirrup
#

I would not expect an open-source community to provide security I don't think anyone would. I am just trying to understand what is possible. Any code and it's application is the responsibility of the developer never the community.

manic glacierBOT
#

As you've seen, CircuitPython unifies main.c outside of ports. It is the equivalent of MicroPython's port/*/main.c but applies to all ports.

Take a look in supervisor for the serial APIs. It should be possible to disable USB and interface with a UART there.

Please continue to ask about this on Discord or a separate issue. This issue isn't a great place because it's specifically about changing the USB descriptor, not disabling it.

slender iron
#

👍 I want to be explicit with that because I think some folks think that it's secure by disabling USB.

balmy stirrup
#

The intent of my question was not about getting an answer on how to secure a device. I understand your position. Disabling a USB does not at all secure a device I just wanted to understand better how it worked to help others if they wanted to build more advanced applications rather than hearing - "Oh that's something you should just do in C, C++ or MP". I respect your position and understand and will follow your advice in the issue comment.

manic glacierBOT
#

MIDI SysEx messages are sent out the USB MIDI port are garbled.

Example:

import usb_midi

usb_out_port = usb_midi.ports[1]
sys_ex_test_msg = bytes([0xF0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xF0])

usb_out_port.write(sys_ex_test_msg)

The host system should receive an 11 byte MIDI SysEx message.... however it receives:

10:43:23.628    From CircuitPython usb_midi.ports[1]    SysEx       
    F0 01 02 01 01 02 02 01 02 03 01 02 04 01 02 05 01 02 06 01 02 07 01 02 08 01 ...
queen widget
#

@onyx hinge - as per our prior discussion, I filed this issue so that CP is sure to pick up a newer tinyusb with this fix at some point.

analog bridge
#

@slender iron I am getting the following Build CI error with the deep sleep implementation.

slender iron
#

@analog bridge when you have a name in single backticks like the alarm on discord, read the docs tries to link it to it's doc

#

if it isn't an object then you'll get the error

#

you can either correct it to match the name or wrap it in double backticks

manic glacierBOT
analog bridge
#

@slender iron unable to find alarm in the code

slender iron
#

look in the comments

#

in the //|

analog bridge
#

I have deleted them all....... let me re-check

onyx hinge
#

@slender iron do you want me to change canio.Message in response to @pastel panther 's comments? I don't see a way to make eveyone happy. Also worried that I'm attached to my design and not being objective.

slender iron
#

I haven't gotten to that yet

#

still going through emails

analog bridge
#

still can't find alarm and I deleted all the //|

onyx hinge
#

@slender iron OK thanks!

analog bridge
#

@slender iron can you have a look at the code when free

slender iron
#

did you make a PR yet?

#

just make the draft even if the CI is broken

#

that way when I find it, I can comment on it 🙂

analog bridge
#

Just realized that I did make a PR on the my fork's main branch

manic glacierBOT
#

@jepler Yup, those seem like good changes. I would like recv to be receive though. Full words are easier to understand and we don't have an existing API we're trying to interoperate with (/me looks at socket).

@siddacious Are you proposing dropping readinto in favor of splitting Message into two types, Message and RemoteTransmissionRequest? I like that too. readinto isn't that helpful because you've already set filters so you only receive objects you are interested in.

onyx hinge
#

@slender iron so canio.Message and canio.RemoteTransmissionRequest? and drop Listener.readinto altogether?

slender iron
#

that's what I'm thinking

#

and then RemoteTransmissionRequest has size only and Message only has data

pastel panther
onyx hinge
#

OK give me a bit of time to get this together @slender iron @pastel panther

manic glacierBOT
onyx hinge
#

readinto can take two objects and return one of them 😜

manic glacierBOT
#

Why are you including .py files in the board directory? If you are trying to ship with a demo that uses it, then the files should live on the FAT filesystem along with the example code.py.

Generally, frozen modules should only be used to save RAM on constrained devices like the SAMD21. The ESP32-S2 doesn't have that constraint and really shouldn't have frozen modules. Frozen code is hard to understand because it isn't on the drive. It's typically older code and it's impossible for the user...

onyx hinge
#

@pastel panther @slender iron size= or length= for the constructor argument / property of RemoteTransmissionRequests?

ionic elk
#

@slender iron re the STM32G49, is that something you'd be interested in, then, once it's available?

#

chips that small would make for some interesting projects, that's a lot of flash/ram for such a tiny chip

#

circuitpython that fits in your ear canal

manic glacierBOT
#

It seems as though the fix for nRF52840 Revision 1 Errata V1.4 - 3.8 in qspi_disable() is doing something to the SPI. If I comment out the two lines from that errata, SPI works correctly. Then running on battery I do not see QSPI in the peripheral list generated by the script above from @xiongyihui . However, I don't have a way of measuring any differences in the current draw from the battery with or without that code. I have not been able to find any reference saying what the line
`*(v...

analog bridge
#

@slender iron I fixed the Build CI error that I mentioned earlier 🙂

#

Getting a draft PR ready blinkacomputer

slender iron
#

@ionic elk ya, I'm very interested in it

#

@onyx hinge I guess length to match len()? size is ok with me too

manic glacierBOT
manic glacierBOT
#

Why are you including .py files in the board directory? If you are trying to ship with a demo that uses it, then the files should live on the FAT filesystem along with the example code.py.

Generally, frozen modules should only be used to save RAM on constrained devices like the SAMD21. The ESP32-S2 doesn't have that constraint and really shouldn't have frozen modules. Frozen code is hard to understand because it isn't on the drive. It's typically older code and it's impossible for th...

onyx hinge
#

will PR, as well

#

just want to have a high probability that this is the last go-round of changing API for now 🙂

#

hmmm something about that doc is incomplete puzzled

#

or at least the diff is incomplete

manic glacierBOT
#

Thanks to @siddacious for finding various problems and suggesting improvements to the API.

Net doc changes from this PR: https://gist.github.com/jepler/37722372347f6847278a67db3cc718c5

Revised loopback test program, passes on SAM E54: https://gist.github.com/d8aedc6b12615970531f54a2f35b9b41

High level summary:

  • renamed Listener.read -> receive
  • removed Listener.readinto (no zero-allocation CAN reading)
  • added RemoteTransmissionRequest class (no voodoo switching between rtr ...
simple pulsar
#

Do updates to MicroPython get reviewed procedurally?

onyx hinge
#

@simple pulsar if there's a change you think needs to be made in circuitpython, your best bet is to PR it against Circuitpython.

manic glacierBOT
crimson ferry
#

@slender iron idk pythonic-ness, but new network stack... thinking of operationally like the move from RGB_Display --> displayio, would they go in parallel so stuff doesn't break and people have time to migrate code while still updating bundles

slender iron
#

@crimson ferry ya, agreed. I'm just worried I've broken the existing code with the requests switch

silver tapir
#

btw, there is a current issue in the github actions platform in case anyone sees anything weird in checks running right now.

#

'message': 'Github Actions Unavailable. We are working to restore all services as quickly as possible. Please check back soon.'

manic glacierBOT
#

Ok, I played around with this on my Kaluga

diff --git a/shared-bindings/microcontroller/Pin.c b/shared-bindings/microcontroller/Pin.c
index 1294b78f0..5fc402316 100644
--- a/shared-bindings/microcontroller/Pin.c
+++ b/shared-bindings/microcontroller/Pin.c
@@ -71,7 +71,7 @@ STATIC void mcu_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
     qstr name;

     get_pin_name(self, &package, &module, &name);
-    mp_printf(print, "%q.%q.%q", MP_QSTR_microcontrol...
idle wharf
#

You can all prolly see my last comment, but I wanted to ask as well. What's a good test case for a non-board pin where Print(module.pin_name) should be something other than board.pin_name.

slender iron
#

@idle wharf probably easiest to just remove a pin from pins.c temporarily

manic glacierBOT
grim dagger
#

@slender iron @onyx hinge some good progress with the SH1107 OLED FeatherWing:

slender iron
#

@grim dagger awesome! @meager fog is going to be so excited!

grim dagger
#

The problem I’m having now is the label text wraps at the halfway point!!!

#

Top string is supposed to be 0 thru F

#

And when it wraps it takes some of the 2 nd half of the bitmap with it!

#

But the circuitpython output text works fine

lone axle
#

is it display_text.label?

grim dagger
#

@lone axle Yes

lone axle
#

do shorter strings work fine? like 0-6 only or something?

grim dagger
#

@lone axle Yes... in the scaled font at the bottom SH*T works great! 🙂

lone axle
#

Can I see your code that makes and shows the labels? gist/link or here if it's short. I don't know much about that feather wing but I am pretty familiar with the label module maybe I can help try t figure out what could be going on.

grim dagger
#

I also see a problem where it isn't releasing the display (re-load errors out no display) and D9 is busy sometimes.

manic glacierBOT
grim dagger
#

Draw some label text

text1 = "0123456789ABCDEF"
text_area = label.Label(terminalio.FONT, text=text1, color=0xFFFFFF, x=8, y=8)
splash.append(text_area)
#text2 = "DisplayIO on:"#text_area2 = label.Label(terminalio.FONT, #text=text2, color=0xFFFFFF, x=24, y=16)
#splash.append(text_area2)
text3 = "SH*T"
text_area3 = label.Label(terminalio.FONT, text=text3, scale=2, color=0xFFFFFF, x=4, y=44)
splash.append(text_area3)

lone axle
#

Nothing jumps out as immediately strange to me with that. That is very odd behavior though I've never seen it jump back ontop of itself like that

#

I am curious how many characters it can handle before it wraps weirdly like that. And whether inserting newlines works correctly or not. But to be honest I'm not sure if either would get us closer to solved.

#

I can say there is no intentional wrapping built into the label at all so typically if you have a string that is to long the user code must put some newlines or using scrolling or some other strategy to show it.

grim dagger
#

The special thing about text is it is using pretty smallish-subrectangles. I didn't see any special clipping logic that might affect that though. I deliberately made various sized bitmap squares on the 2nd half of the screen to see if there was some issue with boundaries but they work fine.

lone axle
#

It might be worth trying the bitmap label to see if it is any different you can easily swap by changing your import to from adafruit_display_text import bitmap_label as label

#

it uses one larger bitmap to store all of the glyphs instead of many tilegrids

grim dagger
#

O.k. will try that now.

lone axle
#

We'll want to figure out what is going on with the regular label either way though that is definitely weird!

grim dagger
#

I should probably clean up the code and commit it to update my Draft PR

#

I feel like it's close now...

manic glacierBOT
#

Commented out IO0

diff --git a/ports/esp32s2/boards/espressif_kaluga_1/pins.c b/ports/esp32s2/boards/espressif_kaluga_1/pins.c
index c1657d6c0..bd095d287 100644
--- a/ports/esp32s2/boards/espressif_kaluga_1/pins.c
+++ b/ports/esp32s2/boards/espressif_kaluga_1/pins.c
@@ -1,7 +1,7 @@
 #include "shared-bindings/board/__init__.h"

 STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
-    { MP_ROM_QSTR(MP_QSTR_IO0), MP_ROM_PTR(&pin_GPIO0) },
+    // { MP_ROM_QSTR(MP_...
idle wharf
#

That helped! Thanks @slender iron Gotta go find takeout I'll pr later tonight.

grim dagger
#

@foamguy bitmap_label seems to work fine.

lone axle
#

Interesting. The differences between them could be a hint about why the other is not working. I'm not I know enough about some of the internals to know where that hint leads though.

#

For some reason the many tilegrids approach is getting thrown off somehow by some of them getting moved to the wrong spot it seems.

#

the way it copies the background with it extra weird too.

#

what kind of feather is running that?

grim dagger
#

I'll go clean up my code to make it presentable 😉 I probably over-simplified something. That is the 128x64 OLED FeatherWIng. It uses a different control chip than before.

manic glacierBOT
manic glacierBOT
#

I have done a clean up and committed changes "Mostly-working-version with comments".

I have also updated the driver and the example code: https://github.com/mdroberts1243/mdroberts1243_CircuitPython_DisplayIO_SH1107 (don't know how to contribute that!)

Currently everything looks like it is working except label text (bitmap_label will work fine). An easy way to see the problem with text is to run the example code and then enter the REPL. You will see that the terminalio<?> output work...

grim dagger
#

REPL on SH1107 FeatherWing. Note the input characters wrap: I entered "print(1)" but when you hit return you see the console output render across the whole width of the screen. A similar problem exists with label text too.

manic glacierBOT
#

Not 100% certain whether the underlying issue is in displayio or RGBmatrix. Regardless: sometimes after changing elements of a displayed group, nothing happens on the display, or only some of the changes take effect. Is there a way to force a full repaint for good measure?

This is sometimes seen on the Moon clock. It might stick on the splash screen (though I’ve confirmed it’s doing Moon math and updating elements in the active displayed group), or might only redraw a subset of elements on...

#

You'll need to add the prerelease board name to the github workflow to get the CI to pass: https://github.com/adafruit/circuitpython/pull/3463/checks?check_run_id=1162679057 and adjust the line endings for these two files: https://github.com/adafruit/circuitpython/pull/3463/checks?check_run_id=1162679034 (Exactly one line at the end.)

Because I think it's confusing for folks having just on the FS when they might not understand why it's there, when on "constrained devices" they don't ...

manic glacierBOT
grim dagger
#

what kind of feather is running that?
@lone axle Sorry I didn’t scan your question very well. I’m using the STM32F405 Feather.

grim dagger
#

REPL on SH1107 FeatherWing. Note the input characters wrap: I entered "print(1)" but when you hit return you see the console output render across the whole width of the screen. A similar problem exists with label text too.
@slender iron It occurred to me that each character in a label, and probably in input text, is rendered separately. In this mode of the controller I set a page 0-15 as I move horizontally across the screen. Perhaps there’s a circumstance where I mask only the lower three bits of the page to set it, dropping the upper bit and causing the wrap? Doesn’t explain why I saw some of the bitmap copied over though. In other operations the page will auto increment letting you paint the whole line.

grim dagger
#

O.k. I think I have a working quirk and driver and example code for the SH1107 128x64 Featherwing! Issue was where I masked the x address to form the set page command. Now I can get to sleep!

manic glacierBOT
manic glacierBOT
#

I played around with this a bit and came up with a conditional statement that outputs what I think is correct, but I'm not sure if there is some legacy behavior or other requirement about always having "pin" in there, I could add that back in for when the package is not present.

diff --git a/ports/esp32s2/boards/espressif_kaluga_1/pins.c b/ports/esp32s2/boards/espressif_kaluga_1/pins.c
index c1657d6c0..bd095d287 100644
--- a/ports/esp32s2/boards/espressif_kaluga_1/pins.c
+++...
wooden lichen
#

I have a question is there something like upip from micropython for circuitpython? This would be handy for the esp32-s2 boards

balmy stirrup
#

@wooden lichen you can simply copy the lib of choice to the usb drive of the board in CircuitPython which makes it very handy.

#

@wooden lichen https://circuitpython.org/libraries To install, download the appropriate bundle for your version of CircuitPython. Unzip the file, open the resulting folder and find the lib folder. Open the lib folder and find the library files you need to load. Create a lib folder on your CIRCUITPY drive. Copy the individual library files you need to the lib folder on your CIRCUITPY drive.

manic glacierBOT
#

Based on @tannewt’s first comments on #3454, let’s collect some more detailed requirements.

My work so far has concentrated on the game console use case, which I envision as follows (@deshipu or @robertgallup, correct me if you have any additions):

  • There is a menu, main.py (written by us experts), and a number of games: game.py, game2.py, … (written potentially by beginners).
  • Turning on the device boots into the menu, which lets the user choose one of the games.
  • Choosing “ga...
#

Thanks for the comments! Together with the implementation experience, they enable me to identify more higher-level requirements and I decided to go back to #1084 to discuss that, or should we continue everything here?

Wild idea, what if you use the same approach to save the traceback string and provide it to the code.py? That way an OTA could capture the error.

Sounds good, but maybe that would best be tackled in a separate PR? I’m not sure offhand how easy that is to obtain – is it s...

wooden lichen
#

@balmy stirrup Thanks! I knew that already but I really liked the upip method!
It is not as important with circuitpython since it is much easier to transfer libraries

lone axle
#

it's not the exact same, but if you are familiar with pip or npm it will be somewhat similar to you.

balmy stirrup
#

Very cool @lone axle I did not know that was there. Thanks!

balmy stirrup
#

@idle wharf yesterday we spoke briefly about some steps for an advanced use case for CP. I put together a little tutorial if you are interested to experiment with @ https://github.com/mytechnotalent/CircuitPython_Frozen_Boot_No_REPL
I want to explicitly clarify that this is just some information for those who ever want to try to do some advanced projects with locking down some features. This is NOT the norm of CP as CP is designed to be beginner friendly and open-source however I wanted to create something for anyone who had a desire to experiment with advanced features this is not an attempt to try to change the direction of CP in any way at all.

manic glacierBOT
#

For what it's worth, I've done a fair bit of displayio using various 5.x versions on CLUE and TFT Gizmo and haven't seen bugs like this. The one thing I have seen is surprising visual (and audio) effects of handling the pads which can happen with the TFT Gizmo depending on how you hold it: Circuit Playground Bluefruit with TFT Gizmo vs fingers - curious video artefacts - this doesn't sound anything like what's being described in issue ticket, t...

lone axle
#

@balmy stirrup this is great info. Thanks for creating this document and sharing it. While it's not the primary purpose of CircuitPython it can still can be very helpful. My company occasionally will get tasked with setting up some hardware doo-dad that interacts with some of the software we wrote. We use CircuitPython because it lowered the barrier to entry for hardware to a point where we could actually make neat things that do what we need. We don't use it for anything particularly sensitive but we did look in to a sort of locking process to limit them as much as we could after their deployed. Looks like your process is more complete than ours was definitely bookmarking this for next time.

manic glacierBOT
#

You may already be aware of this but there's a way of dumping the screen to a file described in [https://learn.adafruit.com/saving-bitmap-screenshots-in-circuitpython](Adafruit Learn: Saving CircuitPython Bitmaps and Screenshots) using the adafruit_bitmapsaver library. That might be useful for debugging to gather a bit more information on where the problem is likely to lie.

balmy stirrup
#

@lone axle thank you so very kindly for that! I really appreciate that and was very afraid some would misunderstand my intention. I LOVE the CP community as you all are so inclusive, non-judgmental, so friendly to help and you generally feel like a family. The CP community is so inviting to new makers and this little option that I put forth is only to help those who wanted to pursue something like you are referring to foamyguy. Thank you again!

prime flower
#

@balmy stirrup This is really interesting, thanks for sharing. While this definitely isn't the norm, it may be useful for people creating test jigs

#

or commercial products where they don't want to give the user access to modifiable firmware for whatever reason

balmy stirrup
#

@prime flower thank you! That was the idea when coming up with it as I did a similar tutorial for MicroPython. I just wanted to have an option for people to build upon, an entry point so to say if they had such a need.

manic glacierBOT
#

Great requirements spec! A couple of things caught my attention.

  1. What's the use case for the requirement to reboot into game.py on a USB file write (in the case A table, above) ? (I'm not sure this is necessary/desirable for my use case -- but, possibly because I'm overlooking something.)

  2. Exception handling. For my case, if "game.py" is running and I want to stop it and return to the main menu, I would expect to use CTRL+C, CTRL+D. From my read, it sounds like you're proposing thi...

#

If you are working on your game, and modifying the file, you want to see your changes taking effect immediately without having to select it from the menu each time.

OK. I see. To me, this seems like a special case that might lead to unintended consequences/confusion in other applications and might be better handled by a developer disabling or bypassing the menu during development (e.g. renaming "game.py" to "code.py"). But, that's from my particular perspective.

manic glacierBOT
#

Can you think of a concrete example of a situation where it would be unintended or confusing?

I might be misconstruing this, but let's say that I'm working on a suite of programs. I might be making a change to a file other than the one that's currently running. In this case, I'd rather re-run from the top. Or, I might be adding a new game and want to see if the menu picks it up properly. Again, I'd want to rerun the menu. Trying to infer developer intent from a USB write can be difficult...

#

I have (or will have, in stm32 canbus) a function where it should be impossible to reach the end, so I put in a safe-mode reset at the bottom:

int find_unused_slot(void) {
    // precondition: you already verified that a slot was available
    assert(available_slot());
    for (int i=0; i<NUM_SLOTS; i++) {
        if (slot_free(i)) {
            return i;
        }
    }
    safe_mode_reset(MICROPY_FATAL_ERROR);
}

However, the compiler still gave a diagnostic, because saf...

wooden lichen
#

@lone axle I also didnt know that!

manic glacierBOT
#

Thanks, that helped me understand why you see it as an “exception” or “special case”. I was operating under the assumption that “the general rule that currently controls autorun” was equivalent to “always rerun the file that’s currently running”, because there was only one file that that could be, so it wouldn’t be an exception. But now I see that that’s not true: If you only have main.py and main.py is running and then you save a new code.py that didn’t previously exist, it will run code.py....

manic glacierBOT
idle wharf
#

@balmy stirrup thanks for posting that and I want to 2nd @lone axle as well. This looks very interesting as a tool for specific needs.

#

I have never heard of circup either. Lol.

manic glacierBOT
#

The way I see it, the easiest to understand and explain behavior (apart from the current "always run main.py or code.py") would be:

  • if a program finished running, or there was an error (including KeyboardInterrupt), go back to the default behavior of running the main.py or code.py, and, depending on the options, show REPL, exception message with a pause, or reset immediately.
  • if there was a filesystem change, reload the currently running program.
manic glacierBOT
manic glacierBOT
hearty forge
#

@slender iron & community- thank you, thank you, thank you for creating YouTube Deep Dive timeline notes! This group is a sterling exemplar of a positive online community! 👍

manic glacierBOT
hearty forge
#

Beginner question re debugging native USB on the saola-wrover- where to start? I'm not getting any hint of connection on Mac or Windows with CP. I've added a micro break out (5V->5V, GND->GND, D+ -> pin19, D- -> pin20, ID -> floating. All connections are at the end with the tact switches.) I may have broken some config- I got the breakout attached days after practicing compiling/downloading only via the built-in USB serial connection. I had downloaded U2F bootloader to the board and did have to do a full flash erase to be able to re-program it with CP. I've built the latest source code with both the latest IDF toolchain and the one embedded in the CP repo. USB breakout is connected by ~5cm of soldered on ribbon cable. I've checked for continuity and shorts. It does provide power... just no hint of CDC or mass storage. The RGB led does what I expect if CP is running, and I can get into safe mode by tapping the flash button at the right moment (LED stays yellow.) The IDF log on the builtin USB serial reports that CP is the app to be run. This is happening on two boards so far. I'm hoping I've missed a step? Is there an initial "image" that needs to be downloaded (like the optional SPIFFs for Arduino ESP8266?)

manic glacierBOT
#

esp32s2 has distinct register bits so it looks like all 4 modes would be supported, but at another level the API only supports 3 of the 4 combinations.

            uint32_t lom: 1;                    /* MOD.1 Listen Only Mode */
            uint32_t stm: 1;                    /* MOD.2 Self Test Mode */

but

static inline void twai_ll_set_mode(twai_dev_t *hw, twai_mode_t mode)
{
    if (mode == TWAI_MODE_NORMAL) {           //Normal Operating mode
        hw->mode_reg.lom ...
solar whale
#

@hearty forge I think you have D+/D- swapped -- D- is pin 19 D+ is pin 20

manic glacierBOT
hearty forge
#

@solar whale Doh! You're right. @slender iron the info on https://circuitpython.org/board/espressif_saola_1_wrover is backwards. The esp32s2/readme is correct. It's funny- there were three of us working on this last night, we had both this & the espressif schematic open and none of us caught this. Love an easy fix though!

ESP32-S2 Saola-1 is a small-sized ESP32-S2 based development board produced by Espressif. Just about all of the I/O pins are broken out to the pin headers on both sides for easy interfacing. Developers can either connect peripherals with jumper wires or mount ESP32-S2 Saola-1 ...

solar whale
#

Ah -- I see - taht should be fixed in the write-up The micro USB connector on the Saola is wired through a CP210x USB to serial converter chip for debugging and programming. The native USB is not available on a USB connector - instead you’ll want to pick up a Micro B USB connector breakout, Type C USB connector breakout or USB data cable and hand-wire D19/D20 to D+ and D- pads. @slender iron who can fix that?

slender iron
solar whale
#

doing it now

slender iron
#

thanks! wroom and kaluga may have the same error

hearty forge
#

@solar whale - you beat me to it - thanks!

solar whale
#

ok -- I'll check and update

orchid basinBOT
manic glacierBOT
solar whale
#

Kaluga is correct -- WROOM does not have as much detail -- so it's not "wrong"

slender iron
#

kk

ionic elk
#

@slender iron @onyx hinge quick interesting note that I realized today - one advantage of the F103s is that they have CAN at smaller package sizes than a F4. No F4 access chip has CAN, which means no QFN48 CAN chips. However, a QFN48 or QFN32 F103 will still have it

solar whale
slender iron
#

@solar whale I don't know why that triggered but I'm ok merging it

solar whale
#

ok -- will do.

manic glacierBOT
ionic elk
#

@slender iron probably a real dumb question here, but I can't seem to get Circuitpython builds to find "driver/adc.h"? Looking at Busio/I2C, it's literally the exact same thing, #include "driver/i2c.h", but for my file I get No such file or directory. Is there something I need to change in the makefile?

slender iron
#

ya, likely the include path list

ionic elk
#

I mean, how would it be different for two files that are both in the driver directory?

slender iron
#

you are assuming there is only one driver directory

ionic elk
#

No, nevermind you're right components/driver/include/driver/i2c.h vs components/driver/esp32s2/include/driver/adc.h"

slender iron
#

👍

ionic elk
#

also, what the heck with these file paths espressif

#

sure, just spam random combinations of driver, soc, include, src, and esp32, and hide all your files in different parts of it

manic glacierBOT
#

I have a large-ish program (RPN calculator with decimal arithmetic) that runs on this hardware combination. After reloading it an indeterminate number of times, I get an inexplicable traceback like

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
  File "code.py", line 4, in 
  File "__init__.py", line 5433, in 
RuntimeError: Corrupt raw code

or I'll get a full hang after trying to enter sa...

ionic elk
#

@slender iron now I'm getting error: "CONFIG_IDF_TARGET_ESP32" is not defined, evaluates to 0, even with all the header files of I2C

slender iron
#

ya, that's because of the undef warning

#

@onyx hinge is it -Isystem to ignore that?

ionic elk
#

undef warning?

#

why would this happen with AnalogIO and not I2C though?

slender iron
#

I fixed the idf to avoid the warnings for what we use

ionic elk
#

file by file?

onyx hinge
#

@slender iron -isystem.

The header files declaring interfaces to the operating system and runtime libraries often cannot be written in strictly conforming C. Therefore, GCC gives code found in system headers special treatment. All warnings, other than those generated by ‘#warning’ (see Diagnostics), are suppressed while GCC is processing a system header. Macros defined in a system header are immune to a few warnings wherever they are expanded. This immunity is granted on an ad-hoc basis, when we find that a warning generates lots of false positives because of code in macros defined in system headers.

#

Header files found in directories added to the search path with the -isystem and -idirafter command-line options are treated as system headers for the purposes of diagnostics.

slender iron
#

@ionic elk try ☝️

#

we should switch to it so we don't need to have a fork of the idf

ionic elk
#

that's a CFLAG?

onyx hinge
#

I didn't read back but .. to silence warnings from headers we don't maintain, change -I path to -isystem path

ionic elk
#

doesn't do anything as a cflag

onyx hinge
#

let me look back and see if I have anything else to add, I don't have the context yet

ionic elk
#

and no instances of -I path

#

So to clarify, you edited within the IDF to remove warnings within the I2C drivers?

#

@slender iron

onyx hinge
#

so for instance git ref 760a171903e0f is where I changed nrf/Makefile to use -isystem for several directories inside nrfx/

ionic elk
#

what is -isystem though? Is it a CFLAG?

onyx hinge
#

It is a flag received by the C compiler

#

Makefile:INC += -Iesp-idf/components/esp32s2/include

#

these 'uns

ionic elk
#

can you provide a link for your git ref

#

or a means of accessing it?

#

Sorry if that's a dumb question, i've just never accessed a git ref directly on github like that before

#

apparently I can't search it

slender iron
#

@ionic elk I did change the idf but I don't want to keep doing that

onyx hinge
#

you can "git show 760a171..."

#

in a terminal

slender iron
#

instead replace -I with -isystem when you add a path to the include search

onyx hinge
#

so say you have this line in components/soc/include/hal/gpio_types.h: :#ifdef CONFIG_IDF_TARGET_ESP32
and you have Makefile:INC += -Iesp-idf/components/soc/include and you #include "hal/gpio_types.h" which happens to resolve to components/soc/include/hal/gpio_types.h. This file will have normal processing of warnings. If you change -I to -isystem (add a space, too) then it will get processed as a "system header", according to what I pasted from the docs above

ionic elk
#

oh sure for a diff on my host system

#

I got hung up trying to figure out how to view it on github

onyx hinge
#

oh github is awful for certain tasks

ionic elk
#

what actually needs to be a system header, though?

#

my adc.h file? some other file?

slender iron
#

any include paths for the idf

onyx hinge
#

tannewt is suggesting that, as we don't want to resolve compiler warnings in the idf headers, we make those paths all -isystem.

slender iron
#

because we don't want to change those files

onyx hinge
#

we DO want to resolve compiler warnings in our own headers

ionic elk
#

Oh, making every path Isystem

onyx hinge
#

making every esp-idf path -isystem

#

Lowercase i

#

-isystem esp-idf/gnawing-my-own-leg-off-brb

manic glacierBOT
#

I fixed the masking error I had in setting the page on the controller and now all the basic operations work. You can use it with the REPL even.

How do I contribute the driver and example code linked above? Not sure how to create a "Pull Request" for something new.

Let me know if you need anything else.

-mark.

For the driver we can either fork your copy into the adafruit org or you can transfer it. We'll maintain it since we sell a product with the display. Would you ...

ionic elk
#

well, it moved it along I guess, now the error is :

GEN build-espressif_saola_1_wrover/genhdr/qstrdefs.preprocessed.h
GEN build-espressif_saola_1_wrover/genhdr/qstrdefs.enum.h
ERROR: Empty preprocessor output - check for errors above
manic glacierBOT
onyx hinge
#

afk, possibly for the weekend.

manic glacierBOT
#

I think it may be clearer to add an if before this one where SH1107_addressing is true. This condition then goes back to normal as an else if on the quirk. Then, set both subrectangles, like you do above, and rows_per_buffer to 1 so you don't need to set remaining_rows to 1 each loop below. This approach also matches the if body here which sets both of those variables. I think the logic in the loop will just work as it originally was then. The only thing you'll need to add there i...

#

I think we should close this in favor of #3400

Can you link to the processes and/or scripts that are responsible for generating the .rst files? I assume it's run by Actions?

https://github.com/adafruit/circuitpython/blob/main/.github/workflows/build.yml#L70-L77

make stubs strips the //| lines out of the .c files in shared-bindings to create .pyi files. sphinx-build then uses the autoapi plugin to convert .pyi to .rst which is then rendered to the docs.

#

Not 100% certain whether the underlying issue is in displayio or RGBmatrix. Regardless: sometimes after changing elements of a displayed group, nothing happens on the display, or only some of the changes take effect. Is there a way to force a full repaint for good measure?

You can force a full repaint by switching the top level group to a different group and back. However, I don't think we should do that. Instead, we should figure out what the bug is.

How are you changing the elements...

#

I fixed the masking error I had in setting the page on the controller and now all the basic operations work. You can use it with the REPL even.
How do I contribute the driver and example code linked above? Not sure how to create a "Pull Request" for something new.
Let me know if you need anything else.
-mark.

For the driver we can either fork your copy into the adafruit org or you can transfer it. We'll maintain it since we sell a product with the display. Would you ...

#
* with an exception: wait in the “Press any key to enter the REPL. Use CTRL-D to reload.” state so that the user can see the traceback.

I'm not sure you actually want to ever enter this state because in the game console case you may not be connected to a host computer. I suppose you could reset the device to get out of it though. An alternative would be to have another .py or main.py to handle exceptions, kind of like a 404 page. That way it can be branded and also read inputs li...

manic glacierBOT
#

This force push

  • squashes and rebases the previous commits
  • fixes the inconsistency in next-code-state preservation between a reload during execution and a reload during the wait state
  • adds lots of options (keyword arguments) for prototype testing that can be removed again when considered useless.

By the way, are the artifacts from the automated build available anywhere? The logs say Artifact xxx has been successfully uploaded! but don’t say where. That would make it easier for pe...

#

Also, congrats! You found all of the boards with displays initialized in board_init. You'll need to add extra , false to all of those calls to make the compiler happy.

O.k. That was a bit tedious!

Also, there is an issue in build-arm (electronut_labs_blip) where it complains about too few arguments on the set region to update... I suppose they've made their own copy of that for some reason? I probably need to change that too...

#

I'm not sure you actually want to ever enter this state because in the game console case you may not be connected to a host computer.

But then, if you don’t happen to be connected to a host computer, you can’t see the traceback (on the display of the device) and don’t know what the bug in your game was. (The game console use case I have in mind is more aimed at (beginner) game developers than game players. They may be “playing”, not “developing” the game at this moment, but still be inte...

orchid basinBOT
manic glacierBOT
ionic elk
#

@slender iron what would it mean for qcfgs and qstrs to be empty? I tried running make translate, but that hasn't helped

slender iron
#

did you clean and rebuild?

ionic elk
#

yes

slender iron
#

hrm, weird

#

I've never seen that before

ionic elk
#

Alright I've tried a bunch of stuff and I gotta say I'm totally stumped here.

#

Is there a way I can turn it off? or something?

slender iron
#

no, QSTRs are all of the string inlining

manic glacierBOT
ionic elk
#

found it, was a -isystem on a non-idf line that did it

manic glacierBOT
#

Let me amplify on a hastily written answer.

When calling read() or next(), the software has to commit to taking the next messge that has arrived on this FIFO, regardless of whether it is a RTR or not. This is true of all 3 HW implementations I've looked at (SAM E, STM, and ESP32S2).

Having the common_hal routine read into a single structure which can accommodate either type of message is the simplest way I see to do it. Adding a "peek" routine, a union type, or other complicat...

manic glacierBOT
#

I have made all the requested changes and updates. But a few boards are still failing the checks but due to messages related to the number of arguments passed to displayio_display_core_set_region_to_update. The errors seem to be the same. Boards include: electronut_labs_blip, pewpew_m4, pybadge, pybadge_airlift, pygamer, pygamer_advance, pyportal, pyportal_titano, ugame10. Many of these didn't show this problem until after the original common_hal function changes were made.

@tannewt I ne...

manic glacierBOT
analog bridge
#

@slender iron I would like to have a discussion about deep sleep api implementation, ping me when you are free. 🙂

slender iron
#

@analog bridge I’m off for the weekend. Will ping you if I have time but may not until Monday

analog bridge
#

np..... 🙂

orchid basinBOT
quiet orchid
#

Is it possible to record audio using the mic on the Neotrellis M4 board? I was able to test the audio level, but couldn't find anything regarding recording or playing back a mic input

manic glacierBOT
manic glacierBOT
#

Right, I also came to that conclusion when I was mulling it over under the shower. That actually seems the more elegant solution to me. The ability to retrieve the last exception is required either way.

So until someone convinces me otherwise, I think there is no need to have different next file names for different outcomes. The capabilities of the current prototype plus retrieving the last exception are sufficient.

manic glacierBOT
manic glacierBOT
lone axle
#

@quiet orchid do you mean the microphone in line that is in the headphone jack? To the best of my knowledge there isn't a microphone directly on the NeoTrellis

manic glacierBOT
#

Translated into prototype-speak, that option would be a combined reload_on_error = reload_on_success with a default of False, while the rest would be fixed at sticky_on_reload=True, sticky_on_error=False, sticky_on_success=False, if I understand you correctly. Works for me.

However, for now, until we have established that the “retrieve last exception” feature is feasible and can land at the same time (which I intend to try, but no promise), I would prefer to keep `reload_on_error...

quiet orchid
#

@lone axle yes, I guess I should have specified that. When having a mic plugged in to the headphone jack, is it possible to record audio using that

lone axle
thorny jay
#

Maybe this is for @tulip sleet : I have just upgraded my PyPortal to 6.0.0b0. So I figured I should upgrade AirLift to NiNa 1.6.1 (is there any better?) and then I should try https://github.com/adafruit/Adafruit_CircuitPython_AirLift but I believe that "_bleio" should be added to the build of PyPortal. So simple_test.py failed. It is already in "Adafruit Metro M4 Airlift Lite" but I think it should be in every PyPortal and PyBadge Airlift ... and possibly other board that could use the AirLift Feather Wing.

quiet orchid
#

@lone axle that looks pretty close to what I wanted to do. At the moment I was looking into using the pyaudio module but was having trouble adding that to the board (how would I do that?). Thanks for the link

lone axle
#

@quiet orchid PyAudio is a CPython ("Normal" Python) module. It cannot be used on CircuitPython devices. The libraries that work on CircuitPython devices are made especially for them typically.

#

On Raspberry Pi and other SBC devices you can sort of mix "normal" python with CircuitPython by using the Blinka compatibility layer.

#

but not on Microcontroller devices like the Neo Trellis M4

quiet orchid
#

Darn so that was an hour wasted. Is there a list of modules that are circuitpython specific on the circuitpython website?

manic glacierBOT
#

If I'm reading this correctly, I think for my case, all of the sticky_on_... flags would be False which looks like the default? So, in my main menu, to jump to a menu choice, I would use:

supervisor.set_next_code_file(filename='example.py')
supervisor.reload()

Is that correct?

And, if I press the reset button or disconnect/reconnect the device, everything returns to default, running code.py or main.py?

lone axle
#

All of the libraries in either of those bundles should definitely work on CircuitPython microcontrollers I believe.

quiet orchid
#

Thanks for helping. I will look over these

manic glacierBOT
#

If you’re okay with staying in the “Code done running. Waiting for reload. / Press any key to enter the REPL. Use CTRL-D to reload.” wait state after example.py has finished, that is correct, except that the filename argument is positional-only (that is not deliberate, but I didn’t see any way of making it positional-or-keyword).

What I do is

supervisor.set_next_code_file(selected + '.py', reload_on_success=True, sticky_on_reload=True)
supervisor.reload()

The `reload...

manic glacierBOT
#

I went ahead and wrote what I think you want. It adds about 300 lines of largely duplicate code, because

  • now common hal's implementation listener's receive needs two copies of the code, to read the HW registers into two different structures
  • and an additional common hal send remote transmission request API is now needed, which duplicates copying the new rtr structure into the hw registers

This also amounts to about 300 extra bytes of firmware, but for me it is the duplicated code t...

crimson ferry
#

@tulip sleet Would it be possible / make sense to list NINA >= v1.7.0 as a Dependency on the Airlift library page? cc: @thorny jay

manic glacierBOT
#

Untested! I don't have my QT Py or flash chip yet! (and I didn't get the flash before it went out of stock)

This adds a variant of the QT Py modeled after the Trinket M0 Haxpress, which will require the GD25Q16C external SPI flash chip for its CIRCUITPY filesystem. Among other things, it is able to fit support for long ints. There's about 5kB flash left in the de_DE build.

tulip sleet
#

@crimson ferry @thorny jay 1.7.0 doesn’t work properly with HCI BLE. We are working on another build. If it worked for you that would be very surprising to me

manic glacierBOT
onyx hinge
#
manic glacierBOT
grim dagger
#

Working with the STM32F405 Feather. Currently trying latest CP 6.0 Alpha. Using the AS7341 Colour Sensor and the provided simpletest example. After a while I see an I/O error:

F1 - 415nm/Violet [ 1129] *
F2 - 445nm//Indigo [ 2306] **
F3 - 480nm//Blue [ 3045] ***
F4 - 515nm//Cyan [ 4840] ****
F5 - 555nm/Green [ 7406] *******
F6 - 590nm/Yellow [10540] **********
F7 - 630nm/Orange [14415] **************
F8 - 680nm/Red [ 3623] ***


F1 - 415nm/Violet [ 1129] *
F2 - 445nm//Indigo [ 2306] **
F3 - 480nm//Blue [ 3045] ***
F4 - 515nm//Cyan [ 4839] ****
Traceback (most recent call last):
File "main.py", line 23, in <module>
File "adafruit_as7341.py", line 311, in channel_555nm
File "adafruit_as7341.py", line 382, in _configure_f5_f8
File "adafruit_register/i2c_bit.py", line 70, in set
File "adafruit_register/i2c_bit.py", line 65, in set
File "adafruit_bus_device/i2c_device.py", line 143, in write_then_readinto
OSError: [Errno 5] Input/output error

Is this a known error? I have even worse results if I'm heavily loading the I2C with the SH1107 OLED FeatherWIng.

pulsar bobcat
lone axle
#

@grim dagger make sure you have the newest version of the bus_device library. I think that might have been a known issue that got resolved.

#

@pulsar bobcat I do not think that the pybadger library is deprecated. It should still be included in the bundle. I just downloaded a fresh copy of the bundle right now and mine does contain the pybadger library:

pulsar bobcat
#

I think I figured it out. I have a capitalization problem. the author of the code used PyBadger for the module name when it is pybadger in the library

#

There are other issues that I'm finding going line by line. I may submit a PR to update it if I get it working. Thanks for looking 🙂

lone axle
#

Ah, I see now. Yep I think the import needs to be lowercase like from adafruit_pybadger import pybadger

grim dagger
#

@grim dagger make sure you have the newest version of the bus_device library. I think that might have been a known issue that got resolved.
@lone axle Seem to have the same issue using the latest adafruit_bus_device/i2c_device.py source from github. I might try and figure out how to drill down on this a bit since I have similar problem with my SH1107 driver too.

thorny jay
#

@crimson ferry @thorny jay 1.7.0 doesn’t work properly with HCI BLE. We are working on another build. If it worked for you that would be very surprising to me
@tulip sleet I did not go for 1.7.0 (or one found in a ticket), but the released 1.6.1. Also I was stop when _bleio was missing from PyPortal.

#

What I wonder is what hardware will get _bleio build into their image? Anything with build-in AirLift should get it. Maybe PyGamer too as you can plug a AirLift FeatherWing behind. Then anything with Feather form factor might also use the FeatherWing.

pulsar bobcat
#

@lone axle After fixing the pybadger typo in code.py I'm getting this error:

  File "code.py", line 19, in <module>
TypeError: 'PyGamer' object is not callable```
If I add
```from adafruit_pybadger import PyGamer```
then I see this error:
```Traceback (most recent call last):
  File "code.py", line 14, in <module>
  File "adafruit_pybadger/pygamer.py", line 138, in <module>
  File "adafruit_pybadger/pygamer.py", line 68, in __init__
  File "adafruit_pybadger/pybadger_base.py", line 147, in __init__
ValueError: SPEAKER_ENABLE in use```
I am at a loss. This guide is not that old, but it already has broken library imports.
lone axle
#

@pulsar bobcat There is pretty active development in both the libraries and the core system, 9 months is longer than it seems like it might be. I am sorry you are running into these issues though. I don't have the thermal camera but I have a pygamer I can try to get the code into a state where it won't crash from that library

pulsar bobcat
#

I just found something in the forums about this. between january and march the library was changed and it broke the guide

lone axle
#

I think it doesn't need to use a constructor any more. It gets initialized on import now I believe.

#

Since the code also calls the constructor it tries to do some things twice and the pins are already in use.

pulsar bobcat
#

so this isn't needed? panel = pybadger(pixels_brightness=0.1) # Set NeoPixel brightness

lone axle
#

I think that is the case. But I'm not certain, and I don't know if there are other issues beyond that or not.

#

Grabbing my PyGamer to give it a try on my end.

pulsar bobcat
#

👍 thank you. I looked in the learning system for an some other guide for an example CircuitPython initialization for the PyGamer, but there aren't all that many guides for it

lone axle
#

for me it is past the pybadger library issues and now failing because it doesn't find the thermal cam (expected in my case)

#

Had to remove the constructor (the line you posted above) and also tweak the import to rename it to panel so the rest of the code will work:

from adafruit_pybadger import pybadger as panel
pulsar bobcat
#

@lone axle that did the trick! Thank you so much

lone axle
#

Nice, you are welcome. I will submit feedback with the updated code so we can hopefully get that guide updated

hearty forge
#

Hi- I'm trying to get uf2 working on a saola-1-wroom. I suspect I've missed a step (pre-erasing or loading the flash?) it's stuck at a red neopixel; uf2 log messages are:

#

I (324) spi_flash: dtctd chip: gnric
I (328) spi_flash: flash io: dio
I (332) cpu_start: Starting schdulr on PRO CPU.
I (337) uf2: Hllo
I (337) uf2: _part_ota0->typ = 0
I (337) uf2: _part_ota0->subtyp = 0x10
I (347) uf2: _part_ota0->addrss = 0x10000
I (347) uf2: _part_ota0->siz = 0x160000
I (347) uf2: _part_ota0->ncryptd = 0
I (357) uf2: flash->chip_id = 0x204016
I (357) uf2: flash->siz = 0x400000
I (367) uf2: block_ras = 0x10000`

#

Looking at flash_hal.c I suspect I don't have the expected partition table on the flash.

#

The readme has a section about partitions, but I'm not seeing instructions for how to write out the partition table- what have I missed? 😉

hearty forge
#

Another weird thing- why is every 'e' being stripped by ESP_LOGI()?

hearty forge
#

added a log message after TUSB task is created (line 81 in main.c) - it displays, but not sure if TUSB task starts. Also never get the purple LED...

manic glacierBOT
#

Recent ESP32-S2 release can mount SD card,
after setting pinout and SPI, this works
storage.mount(vfs, "/sd")
os.listdir("/sd") lists files stored on the SD card.
['KERNEL.SYS', 'COMMAND.COM', 'INVADERS.COM', etc..

Now I want to copy a file from PC to the mounted SD card
but linux PC usb-storage interface doesn't "see" mounted
"/sd" directory

cp README.md /media/guest/CIRCUITPY/sd/
cp: cannot create regular file '/media/guest/CIRCUITPY/sd/': Not a directory

manic glacierBOT
#

A small status update:

  • I decided to build the quirk for the GrandCentral M4 Express board I bought.
  • The SH1107 quirk built and ran fine with my driver
  • I wasn't able to recreate the lockup/freeze that I saw on the STM32F405 Feather, even after hammering the I2C bus with continuous updates (moving "SH1107" around the screen with random increments)
  • In separate testing I found I would see OS ErrNo 5 (I/O Error) on the STM32F405 when running the simpletest for the AS7341 as well.

So...

tulip sleet
#

@acoustic forum Yes, it should work on anything you can connect an AirLift to and that has the firmware space. In practice, this would not include SAMD21 or non-Express boards. And of course we would omit on nRF. RIght now it is only on the Metro M4 AirLift due to use still trying to get a good firmware build (that was the test board). We will add it it to lots more boards later.

manic glacierBOT
#

The performance of CircuitPython on a Teensy 4.0 is very disappointing.

I have an application where the Teensy 4.0 running CircuitPython should be ideal.

After reading some comments (issue #3062) about how slow the Teensy 4.0 is updating a SPI driven display, I used a Teensy 4.0 in a Teensy-to-Feather Adaptor to compare performance of the M4E and Teensy 4.0.

Both T4.0 and M4E are running CircuitPython 5.3.1 andbootloader 3.10.0.

I reproduced the complaint about the T4.0 taking abo...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

I can confirm this problem is with the STM32F405 Feather and 6.0 alpha (latest). I can reproduce the problem quite easily with the AS7341 sensor and its simpletest. Reduce the sleep time to have the problem manifest quicker. It is even easier to reproduce the problem using the SH1107 quirk and the SH1107 128x64 OLED FeatherWing. When using the OLED I just move a lable around on the screen pseudo randomly to quicken the

I've seen I/O errors on write and write_then_readinto.

I have not...

manic glacierBOT
#

@phrogger Very interesting findings! The port is still in an early stage and development focus of the core team has currently shifted in favour of the ESP32-S2. I would also be interested in further work on this port and you seem to know a fair bit about the i.MX RT. I think everyone would welcome more helping hands on the port if you would like to help out! I wanted to dive deeper into it but got distracted by other things unfortunately and not knowing all that much about this MCU to begin w...

dense pike
#

I’m hopping I posted this in the correct place.
Hi, has anyone used the ‘SparkFun Pulse Oximeter and Heart Rate board’ (see details below) and is there a CircuitPython library that would work with it? I know SparkFun has an Arduino Library for it but I really want to use CircuitPython and the Feather nRF52840 Sense.

Thanks in advance.

SparkFun Pulse Oximeter and Heart Rate Sensor - MAX30101 & MAX32664 (Qwiic)
Id# SEN-15219
Link: https://www.sparkfun.com/products/
15219?_ga=2.83573398.1233392454.1601214429-1269510697.1563593287

The SparkFun Pulse Oximeter and Heart Rate Monitor is an I²C based biometric sensor. Utilizing two chips from Maxim Integrated, the SparkFun Pulse Oximeter and Heart Rate Monitor has both the MAX30101 biometric sensor and MAX32664 biometric hub.

onyx hinge
#

@dense pike #help-with-circuitpython is a slightly better channel for "how do I" type questions. I looked in our CircuitPython bundle but I don't see max30101 or max32664 listed.

#

those chips do connect via standard I2C and the datasheets are available, so if you want to learn about writing register-level code in CircuitPython this is something you could consider taking on

slate scroll
#

@tulip sleet I don't know who else to ask, but would a Rust part in CPy be merged? I want to write a matrix module for example and I was thinking to write it in Rust. Write just the bindings that I need and combine the rust build system with the existing one

#

the idea is that the only additional build dependency to be rustup, nothing else

tulip sleet
#

@slate scroll I don’t know that anyone has tried that yet. We have not even tried to integrate C++ code. Have you seen ulab, a numpy-like module that is included in most larger builds?

slate scroll
#

As far as I can see, it's in C and a tiny bit C++.

#

Oh you meant for the matrix. I meant a keyboard matrix, not an algebric matrix

#

would you (adafruit) be willing to go veeeery slowly towards rust? if you can't answer, who can I ask?

tulip sleet
#

I don’t know anything about the C abi vs the Rust abi. Also, whether there’s a rust runtime library that would be brought in

slate scroll
#

it's very close to C from what I know and is compatible (I wrote a hello world in Rust that called the Arduino Framework)

tulip sleet
#

We are very unlikely to try to move CircuitPython towards being written in Rust, given that we’re still merging Micropython occasionally

slate scroll
#

meh, it's a shame...

tulip sleet
#

There was a user on discord that was doing everything in Rust on samd21 or 51, but it was not mixed with CircuitPython. It was part of some embedded rust build system

slate scroll
#

yea, there is the rust-embedded HAL, but that's not what I'm suggesting. I just want to call the existing C functions of CircuitPython from Rust, (almost) no external library dependencies and call Rust code from CircuitPython

#

I may do it just for a blog post anyway, I'll keep in mind that it probably won't merge

#

thank you! 🙂

manic glacierBOT
#

@PTS93 I am currently doing a C-Language project on iMX RT1052 bare metal, no RTOS, and still learning how to manage the beast. At least in my case, the entire compiled program and data will fit in the tightly coupled RAM without paging, so I expect to get the full performance of the processor.

Paging can slow things down, and the speed of the memory/bus where the code is resident can change the overall performance.

There is also an option called XIP (execute in place) where instead ...

teal bear
manic glacierBOT
#

If you got to f.e. https://circuitpython.readthedocs.io/en/latest/CONTRIBUTING.html
Clicking on any link that is supposed to go to a markdown file in the github repo yields a 404 because it removes the file extension.
F.e. instead of linking to https://github.com/adafruit/circuitpython/blob/main/CODE_OF_CONDUCT.md (notice the .md)
it links to https://github.com/adafruit/circuitpython/blob/main/CODE_OF_CONDUCT

The markdown file this page is based on is correct though, it includes...

#

Yea afaik there were some plans for CPY's architecture on how to deal with the segregation of memory. @tannewt or @arturo182 might have more to say about this.

If you want to evaluate further it is probably also a good idea to work with version 6 beta of CPY or a nightly release, it wont very change much for the i.MX RT but it is closer to the main development branch.

Compiling CPY is very straight forward and not hard at all to get started on. For the i.MX RT port the NXP SDK is pulled...

lethal maple
#

Trying to run adafruit_io_weather.py example app on original PyPortal. Runs to getting weather record from IO, but draws 404 error line 497 in adafruit_io.py. I think the location_id passed from line 64 of adafruit_io_weather.py is wrong. Comment says to obtain code from io.adafruit.com/services/waether. There it says the locationValue is a string (lattitude,longitude) but the library is looking for location_id as an int. So where do I get the int location_id?? (yes, I have the Adafruit IO Plus subscription.) Thanks!

onyx hinge
#

also if you found a problem with our guide code please use the link to report a problem that is on the website; if you found a bug in the library or documentation, you can file it on github. Thanks!

lethal maple
#

@onyx hinge Thanks, will repost there.

onyx hinge
#

Great, thank you!

idle wharf
onyx hinge
#

I guess that's not for VS Code though, just Visual Studio. I don't use either one. Sorry for the noise.

ornate breach
#

Is there a current CP build for the QT PY?

#

I'm not finding one on circuitpython website

#

I see it on the S3.. now to load it on the QT PY

dense pike
#

@narrow dirge E. thanks will repost to help-CPy

soft dove
#

Can someone tell me whether there is any difference in how the HID lib works between most CircuitPython boards and the Trinket M0 and related boards like the PyRuler? The examples in the lib bundle and on the Adafruit Learning system do not work on the Trinket M0. The examples and Learning System guide import usb_hid and initialize the keyboard with kbd=Keyboard(usb_hid.devices) which generates an error on a Trinket M0. The Pyruler sample code calls Keyboard with no argument which works on a Trinket M0.

#

I'm using CircuitPython 5.3

teal bear
#

@teal bear I am very intrigued by this. I’ve been wondering if/how you could do this with VSCode. Let us know what you learn.
@idle wharf I think this is a dead end. looks like the vis thing is for in memory data structures, not std out spew

idle wharf
#

Boooo ! That stinks.

#

I wonder if the folks over on the Msft Python discord would have ideas

#

Its not the most active place though

#

They also need to fix VSCode crashing when the USB drive goes away (on MAC anyway)

teal bear
#

I wouldn't be surprised if there is another plugin. someone else pointed me at this a few days ago, I have only put enough effort into getting this far

idle wharf
#

I’ll do some hunting tonight.

slender iron
#

would you (adafruit) be willing to go veeeery slowly towards rust? if you can't answer, who can I ask?
@slate scroll I'm interested in this. I think the module level is totally ok to do this at.

manic glacierBOT
#

T4.0 SPI single byte transfer events are spaced 7200 ns (7.2 us) apart

This looks like a red flag to me. The SAMD51 is fast with SPI because it uses DMA. If the iMX isn't using DMA then this could be the culprit.

My intent was to setup the iMX so that the core CircuitPython VM code live in ITCM, the stack in DTCM and the caches were left for parts of CircuitPython used off and on. There is definitely tuning to do.

As, I wrote that, I realized displayio buffers live on the stack whi...

slate scroll
#

@slender iron

I’ll start writing a PoC this week

manic glacierBOT
#

I don't understand how to apply your recommendation in
my code. So protocol must first start in bitbanging mode
and then switch to SPI. If I try to init SPI then, it will be
rejected reporting some error like "pin already in use".

My solution to avoid this error was to deinit the pin and delete it.
It is very slow then, I suppose I needs a lot to allocates objects and memory.

#

OK, let SD-over-USB be a feature request,
it's ok for me to appear as another drive.

Intuitively, I have expected this to "just work".

Now I need to first upload file from USB to internal flash,
write my own copy.py application, upload it too, then
enter python prompt and finally copy this file from flash to SD.

On 9/28/20, Scott Shawcroft notifications@github.com wrote:

We don't support the SD card over USB. The USB Mass Storage protocol works
on the blocks below the filesystem. So...

slate scroll
manic glacierBOT
manic glacierBOT
tulip sleet
#

@soft dove the change to require an argument to Keyboard was made quite a while ago, well before 5.3.x. Make sure your libraries are up to date, and confirm the CPy version. Post the exact error you are seeing if you still have a problem.

tulip sleet
#

@slender iron Could you give me pointers to specs for that debug edge connector and the matching physical connector? I think I have another application for some really cheap system like that

manic glacierBOT
ionic elk
#

@slender iron is the way to add new components to the ESP32 the ESP_IDF_COMPONENTS_LINK variable in the makefile? There's a note that says order matters for it, and I assume there was something in the IDF you based it off, but I can't seem to find an example makefile that includes the esp_adc_cal component I need.

#

Is ESP_IDF_COMPONENTS_LINK an original creation? it doesn't show up on google at all, so there doesn't seem to be any way to determine what the "right" order is

timid wind
#

Hi Everyone. I'm trying to add a new driver busIO for one CPy platform on a forked version of the repository. Development of this new driver requires constant recompilation and transfer of uf2 to device. I'm getting fatigued by the amount of time this cycle takes (in excess of a minute and a half) and I'm wondering if there are some features I could disable to reduce this time. Is there some guide I've missed or advice anyone can impart? I'm on MacOS if that helps.

onyx hinge
#

@timid wind If your board as a SWD connector, I recommend getting and learning how to use the j-link. you can load a new firmware over j-link, and in my experience it has faster cycle times than using uf2. For some ports, the build time itself can be decreased by disabling lto, which requires editing a Makefile and removing "-flto" in a few places (this applies to samd and nrf but I think not to others). that's about it for my immediate suggestions.

#

@soft dove answering late, but I think the difference is that old versions of circuitpython didn't require (or accept) usb.hid_devices in the constructor to Keyboard() but it's required now; this was changed so that BLE HID devices could work too.

#

@ionic elk best guess, while ESP_IDF_COMPONENTS_LINK may be based off of some example somewhere, it's something created/used by us. It just gets expanded to list the libraries in order, with paths added: Makefile:ESP_IDF_COMPONENTS_EXPANDED = $(foreach component, $(ESP_IDF_COMPONENTS_LINK), $(BUILD)/esp-idf/esp-idf/$(component)/lib$(component).a)

#

Using the linker's special --start-group and --end-group flags might work instead and not require a special order to be given

ionic elk
#

right. But unfortunately, it's apparently not compiling the component I need, so I must be missing a setting even earlier

#

build-espressif_saola_1_wrover/esp-idf/esp-idf/esp_adc_cal/libesp_adc_cal.a: No such file or directory

onyx hinge
#

The idea is, with static linking, if you link liba and libb, the order matters. If liba uses symbols from libb, liba needs to be earlier.

#

--start-group / --end-group lets the linker consider the things between those things multiple times, until no more symbols are resolved

ionic elk
#

What's frustrating is that espressif does not have makefiles of the typical variety, and esp_adc_cal is not mentioned in any build files of the idf, and it's not documented in their online docs, so I guess I'm on my own figuring out how to actually make it compile?

onyx hinge
#

was there another part to your error message?

ionic elk
#

Oh yeah sorry No such file or directory

#

edited above too

onyx hinge
#
# ToDo: re-enable adc-cal for other target
if(NOT ${target} STREQUAL "esp32")
    return()
endif()

idf_component_register(SRCS "esp_adc_cal.c"
                    INCLUDE_DIRS "include"
                    REQUIRES driver)
``` I notice this in components/esp_adc_cal/CMakeLists.txt of esp-idf -- that __MAY__ mean that it is disabled for esp32s2
ionic elk
#

wat

#

the example literally has ifdefs for esp32s2

timid wind
#

@onyx hinge thanks for the tip on -flto! Much quicker. I have tried to program my board (adafruit clue, nrf52840) using SWD but it doesn't seem to flash the VM portion. I assumed it was write protected (which is probably why you are recommending J-link? 🙂 )

ionic elk
onyx hinge
#

@ionic elk can you build the example or are you just assuming that if the example is there it builds?

ionic elk
#

... yes I guess I am assuming they aren't shipping broken examples 🤦‍♂️

onyx hinge
#

@timid wind I would expect any swd adapter (like, say, one working with openocd) to work the same for uploading firmware. I just happen to do it with jlink

timid wind
#

@onyx hinge Ok, I'll give it another go then 🙂 are there any existing APIs for logging to memory? I see mention of "ramlog", is that the best interface to use?

onyx hinge
#

I dunno about that

ionic elk
#

@onyx hinge thanks for pointing that out though, I hadn't considered that as a possibility.

onyx hinge
#
        //Convert adc_reading to voltage in mV
        uint32_t voltage = esp_adc_cal_raw_to_voltage(adc_reading, adc_chars);
        printf("Raw: %d\tVoltage: %dmV\n", adc_reading, voltage);
#elif CONFIG_IDF_TARGET_ESP32S2
        printf("ADC%d CH%d Raw: %d\t\n", unit, channel, adc_reading);
#endif
``` in that example, it looks like the esp32s2 build would skip performing the calibrated conversion and just show the raw value
ionic elk
#

Are we somehow looking at a different example? I literally don't see that preprocessor code in the file I'm looking at

#

Or is my esp-idf mismatched from the online version?

#

yep that's it. Our idf is out of date as of july 9th

onyx hinge
#

okay ... ?

ionic elk
#

@slender iron what's the process for updating the IDF? You mentioned you had edited some files? As Jeff has helped me discover above, they only recently added support for the ADC calibration components, which I'd like to include in our ADC implementation as they compensate for non-linear parts of the ADC readings. ESP32-S2 ADC readings are reportedly not very accurate without it.

onyx hinge
#

Mechanically, you have to git merge the branch we're using and esp-idf's master branch, which has conflicts at the moment. Then PR it to the place we get our module from (https://github.com/tannewt/esp-idf.git) and once that PR is merged, PR the update of the submodule in circuitpython.

#

that'll have a second level of work because one of the conflicts is in lwip, which is also forked into tannewt

#

a fun way to blow a day, or more if this is out of your git comfort zone

analog bridge
#

make translate script doesn't include ports/esp32s2 directory. Is this intentional ?

onyx hinge
#

@analog bridge almost certainly an accident!

#

please PR a fix

analog bridge
#

@onyx hinge currently working on applying a fix for translating strings referenced form header files, will update the translate script along with it.

onyx hinge
#

excellent, thank you!

ionic elk
#

hmmmm, it's definitely a lot of work, but I'd also really like to have this ADC calibration step. ADC readings without it can be off by hundreds of mV.

#

so report other testers, anyway

#

agh I need to stop getting mad about bugs before double checking my release version. Discovering your righteous indignation was actually foolish assumption is the worst feeling.

onyx hinge
#

Together we found the right info, my default of looking with git grep in the files I have, instead of on github using the web ui, let us get enough conflicting data to figure out the actual problem

ionic elk
#

Yes my foolishness was luckily contained, with your gracious help! Still embarrassing though 😆

ornate breach
onyx hinge
#

^ @slender iron ?

ornate breach
#

I was potentially going to use the PID codes open source path, but I want to make sure I evaluate all my options. I need to get a VID/PID this week so I can get the binaries for the board for CP

manic glacierBOT
ornate breach
#

For doing the DAP process too

manic glacierBOT
slender iron
#

@slender iron Could you give me pointers to specs for that debug edge connector and the matching physical connector? I think I have another application for some really cheap system like that
@tulip sleet debug-edge.io

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

55

Voice Channels

6

Members

25078

Roles

35

slender iron
#

Is ESP_IDF_COMPONENTS_LINK an original creation? it doesn't show up on google at all, so there doesn't seem to be any way to determine what the "right" order is
@ionic elk Order doesn't matter any more. That comment is old

ionic elk
#

ah

#

I'll delete it when we update the IDF I guess

hearty forge
#

Yes my foolishness was luckily contained, with your gracious help! Still embarrassing though 😆
@ionic elk I’m facepalming myself - I’ve been using a different idf version and didn’t realize there were changes in the version with CP. If you hadn’t bought this up I’d still be stuck with no ideas how to progress (trying to get uf2 working- my board is crashing in tinyusb). Now I have an idea of where the user error is 🙂

slender iron
#

@slender iron what's the process for updating the IDF? You mentioned you had edited some files? As Jeff has helped me discover above, they only recently added support for the ADC calibration components, which I'd like to include in our ADC implementation as they compensate for non-linear parts of the ADC readings. ESP32-S2 ADC readings are reportedly not very accurate without it.
@ionic elk All my updates are for the include stuff. So if you can switch back to mainline IDF with -isystem that would be best

ionic elk
#

Oh, that might be a nice update - that'd just be updating the submodule, then?

slender iron
#

@onyx hinge do you know if it’s still possible to request a VID/PID in this manor for my samd21 board I’m developing?

https://github.com/adafruit/circuitpython/issues/2322
@ornate breach I'd prefer folks use pid.codes going forwards

GitHub

We built a board roughly based on the trinket m0 with IR receive/transmit capabilities. It's a shitty addon for conference badges. Hardware and software are all opensource: https://github.c...

#

@ionic elk yup

#

(I didn't know about -isystem when I started it)

ionic elk
#

Ok, I'll do that. Should I open a new PR for it, or fold it into my ADC PR?

slender iron
#

kk, breakfast time for me and the 🐱

#

either way

ionic elk
#

Ok I might do a new PR just to keep them distinct then

slender iron
#

kk

ornate breach
#

@slender iron thanks

timid wind
#

Is there a special flashing process for loading a new hex file via GDB with the Adafruit Clue?

(gdb) load build-clue_nrf52840_express/firmware.hex 
`/Users/XX/ports/nrf/build-clue_nrf52840_express/firmware.elf' has changed; re-reading symbols.
Loading section .sec1, size 0xf8 lma 0x26000
Loading section .sec2, size 0x9000 lma 0x27000
Loading section .sec3, size 0x10000 lma 0x30000
Loading section .sec4, size 0x10000 lma 0x40000
Loading section .sec5, size 0x10000 lma 0x50000
Loading section .sec6, size 0x10000 lma 0x60000
Loading section .sec7, size 0x10000 lma 0x70000
Loading section .sec8, size 0x10000 lma 0x80000
Loading section .sec9, size 0xd67c lma 0x90000
Start address 0x27000, load size 485236
Transfer rate: 151 KB/sec, 978 bytes/write.

The command seems to execute successfully (as above), but the microcontroller is not executing the newly loaded code...

#

I verified this by setting a while(1) in the constructor of some code I am adding. The newly loaded file has this loop removed, yet the MCU is still sitting in that same constructor (though now one line further on in the program as the while(1) has been removed from the symbol file).

onyx hinge
#

@timid wind use the elf file

#

Gdb firmware.elf

#

Though.. I'm not sure why loading the hex wouldn't work, it's just not what I do

#

And I don't specify any argument to "load"

timid wind
#

Ok, thanks for the help @onyx hinge

onyx hinge
#

<@&356864093652516868> It's about 1 hour and 15 minutes until our weekly meeting. If you plan to speak during the Hug Reports or Status Updates, please add your name the notes document in each section. Adding your notes ahead of time is also super helpful! If you have notes but can't (or just prefer not) to go on mic, note that you're "text only". If you can't add yourself to the document for any reason, please let me know and I'll add you. If you're not in the document, we will assume that you are "lurking" (just listening in) and skip over you during the Round Robin sections. Thanks!

Here's the link to the notes doc: https://docs.google.com/document/d/11JULkBnDzsJVIfGiiqWPszEd7mb001P7qg-8LyucmcE/edit

#

If you're not yet a circuitpythonista but want to speak during the meeting, just let me know and I'll add you. I'll be taking notes today and Scott will be running the meeting. See you soon!

#

@timid wind I checked my gdb configuration, and I use an alias that does: mon reset / load / mon reset. A typical "load" looks like ```Loading section .isr_vector, size 0xf8 lma 0x26000
Loading section .text, size 0x787d0 lma 0x27000
Loading section .data, size 0x53c lma 0x9f7d0
Start address 0x27000, load size 495108
Transfer rate: 53722 KB/sec, 15003 bytes/write.

analog bridge
#

@slender iron deep sleep api discussion before/after/in CPY meet ?

slender iron
#

@analog bridge we can do it in the weeds at the end of the meeting

#

I have a meeting before the public one

orchid basinBOT
onyx hinge
#

@idle owl it's QTPY_BOOT as the filesystem/volume name btw

idle owl
#

@onyx hinge Thanks!

onyx hinge
#

We're finishing up our internal meeting, thanks for your patience!

#

@slender iron I wonder if the terminal should have a non-scrolling ("roll") mode where it just starts painting at the top when it reaches the bottom. It would eliminate scrolling but you have to become familiar with it

modern wing
#

Happily lurking today -- updated the notes doc to reflect as such adabot

ionic elk
#

🐱🤮

tidal kiln
#

lurking (until in the weeds)

solar whale
#

we had the same issue a few minutes ago...

modern wing
#

I just joined.....cat whatsitnow? I'm glad I joined late 🙂

onyx hinge
#

hello!

turbid radish
#

lurking

orchid basinBOT
onyx hinge
#

@grim dagger are you planning to speak in the meeting today?

lone axle
grim dagger
#

@onyx hinge Just lurking to see what this meeting is like

onyx hinge
#

ooh I had not seen the eyes guide, I just heard about it

#

@grim dagger 👍

lone axle
thorny jay
#

Lurking not present.

lone axle
turbid radish
old smelt
#

Lurking.

onyx hinge
tidal kiln
#

oof. best wishes @tulip sleet and speedy recovery.

blissful pollen
#

Hope you feel great soon @tulip sleet !

onyx hinge
#

David G said he was lurking and/or not present

analog bridge
#

Get well soon @tulip sleet

idle owl
#

I don't hear him.

modern wing
#

Indeed, welcome back Kattni 🙂

idle owl
#

Thanks!

lapis hemlock
#

@onyx hinge Thanks, I am OK, only a bit busy.

onyx hinge
#

One of my non-adafruit-associated friends excitedly shared TG's watch progress with me, it was cool to see that come back around. small world.

solar whale
#

will try.

onyx hinge
#

You could use kmk instead, it's made of circuitpython 😉 @lone axle

stuck elbow
#

@lone axle I just joined so I didn't hear well, but I have experience with QMK

onyx hinge
#

there are also some "simple" keyboards for circuitpython, if you feel kmk is heavyweight

#

@stuck elbow foamyguy was mentioning it

lone axle
#

That is definitely my ultimate intention (KMK). This one is running on Pro Micro's though so needs to be Arduino style, it's a Dactyl that my wife is building.

onyx hinge
#

keyboards are great projects (for some kinds of people anyway)

stuck elbow
#

@lone axle I'm happy to help

analog bridge
#

@ionic elk 👍

stuck elbow
#

I used QMK in the 5plit clone I made

lone axle
#

@stuck elbow Thank you! I will get what I have so far put into something coherent and then ping you once I've got my specific questions nailed down

onyx hinge
#

"git submodule sync" will be a step you'll have to remember

#

seems like running the idf's "install" script is pretty quick the second time, it avoids redownloading

solar whale
#

Take printout of the CAN dump to your local garage -- I'm sure they'll understand it.

ionic elk
#

@onyx hinge did I mention my findings about STM32 CAN to you last week?

balmy stirrup
#

Sorry late lurking.

onyx hinge
#

@ionic elk I don't recall, feel free to repeat it

stuck elbow
#

lurking too

ionic elk
#

I found that the F103 has CAN at way lower flash and package sizes than the F4s

#

So once that port is in, it might be a good target for the API

onyx hinge
#

oh yeah I did see that go by! We're starting with the STM32F405 since it's in a shipping Adafruit product but adding others would be great too.

ionic elk
#

no access-tier F4 board (F401, F411, most of the common cheap ones) supports CAN, but the F103s do

#

So if people want to make a 32QFN board with CAN, or an STM32 SoC that's under $2, they have to use an F103

onyx hinge
#

does it have enough ram & flash for ciruitpython?

modern wing
#

🏔️

gilded cradle
#

🐐

ionic elk
#

Yeah higher level F103s do - that's what Dahanzimin and Mark Ollson are interested in. Normally, F103s get beaten on most other metrics by the Access level F4 series. But apparently CAN is an exception, where no Access F4s have it

onyx hinge
#

@ionic elk ow

In low, medium-, high- and XL-density devices the USB and CAN share a dedicated 512-
byte SRAM memory for data transmission and reception, and so they cannot be used
concurrently (the shared SRAM is accessed through CAN and USB exclusively). The USB
and CAN can be used in the same application but not at the same time.

ionic elk
#

OH NO I missed that

#

That makes things a bit more complicated then

onyx hinge
#

that's about page 654 in RM0008 Rev 20

ionic elk
#

I could still see us supporting it but we'd need some kind of mediator system. Might not be worth it. I wonder if the STM32G series will have that problem

onyx hinge
#

I have another obligation and will be leaving before In The Weeds today. Nice to hear from everyone!

ionic elk
#

@analog bridge did you want to talk about deep sleep?

tidal kiln
#
class Foo:

    _SOME_VAR = const(23)

    def __init__(self):
        print(_SOME_VAR)
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18
>>> import foo
>>> f = foo.Foo()
23
>>>
lapis hemlock
#

@onyx hinge 👋

tidal kiln
#
class Foo:

    _SOME_VAR = const(23)

    def __init__(self):
        print(Foo._SOME_VAR)
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18
>>> import foo
>>> f = foo.Foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "foo.py", line 6, in __init__
AttributeError: type object 'Foo' has no attribute '_SOME_VAR'
>>> 
analog bridge
#

@ionic elk will be having a discussion probably after the meet

tidal kiln
#
class Foo:

    _SOME_VAR = 23

    def __init__(self):
        print(Foo._SOME_VAR)
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18
>>> import foo
>>> f = foo.Foo()
23
>>> 
gilded cradle
#

I'm not sure if CircuitPython makes use of the decorator @staticmethod, but a possible solution.

#

Of course that doesn't address variables.

stuck elbow
#

const only works on globals anyways

ionic elk
#

python preprocessor

lapis hemlock
#

The idea is that you want to substitute the constant value directly in your code. If you write some Python code that uses a (global) variable, then looking up that global variable is relatively expensive (in time). If it's a constant value then you could just write that constant value in the code directly (eg i2c.send(0x42, 0x54)), but that would make it difficult to read (don't want magic numbers!).

Micro Python recognises the "x = const(123)" pattern in your script and during the compile stage will replace "x" in your code with "123", in that module/file. This makes it a lot faster when running.

The reason it also uses RAM is because it still puts "x" in memory as a global variable, in case someone external to the module also wants to use this constant; eg mpr121.DEBOUNCE will still work.

The recommended use for const is: use it when you have a global variable which is a constant integer that is set once and never changed.```
#

It is also about speed.

gilded cradle
#

Oof, had I known that, I would have used it in the RA8875 library which would be helpful, but I guess it doesn't matter if it's going away.

teal bear
#

Whats going away?

idle owl
#

The use of const() in libraries.

lone axle
#

@teal bear potentially the use of const() in library code. It's being discussed in the meeting going on in the voice chat.

idle owl
#

Looooong term going away. Like years in the future.

teal bear
#

got it. was thinking I wouldn't be able to use const in my code. was very confused.

idle owl
#

@teal bear Totally unrelated.

stuck elbow
#

actually const does two things, it does the search-and-replace mentioned above, which gives a speedup, and if the variable starts with _, it doesn't store the name

slender iron
balmy stirrup
#

What about in supervisor/share/usb/usb.c there might be something there your looking for. That is where you work with usb_msc_mount(); and usb_msc_umount();, etc.

solar whale
#

⚒️

manic glacierBOT
idle owl
#

Way later hug report: Thanks @slender iron for running the meeting today 😄

analog bridge
#

@balmy stirrup thanks for mentioning that.......will take a look at it 🙂

#

👍

gilded cradle
#

Thanks

modern wing
#

Thanks 🙂

analog bridge
#

thanks!

balmy stirrup
#

Welcome @analog bridge!

crimson ferry
#

@ionic elk for esp32-s2 ADC, are there any new APIs exposed, or do we assume for example, fixed bit width and attenuation, and calibration uses the efuse values when present?

modern wing
#

Here in PA, the humidity is off the charts -- it's 70, but feels like 90.

ionic elk
#

No, not right now. @slender iron is that something we'd ever consider adding?

#

we assume bit width of 13 and attenuation of 11DB

#

that said, I don't think there's much point to adding variability for most use cases, 11DB is the only setting that covers the entire 0-3.3V range (others only go up to lower voltage values) and I'm not sure that the bit width can even be changed on ADC2

slender iron
#

@ionic elk not to the global API. if folks want implementation specific classes they could be added on a per-port basis

analog bridge
#

@slender iron where will we be running further conversations discord or github ?

slender iron
#

for the usb connection we can chat on discord. otherwise the github is good for discussion

solar whale
slender iron
#

@solar whale yes and there is a corresponding issue

#

I know you don't like using code.py so I'm wondering if it could be helpful for you

solar whale
#

Thanks -- will look at it.. I have not been following the discussion closely.

slender iron
#

👍

analog bridge
#

@slender iron custom wake stub is also concerning me........

slender iron
#

I don't think it's critical for this first PR

#

getting the type of wake is enough to start with

analog bridge
#

ok....cool 🙂

tidal kiln
#

hmmm. ok. so it's the additional optimization of the leading _ that's preventing using the class prefix, since the name isn't stored. without it:

class Foo:

   SOME_VAR = const(23)

   def __init__(self):
       print(Foo.SOME_VAR)
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit ItsyBitsy M0 Express with samd21g18
>>> import foo
>>> f = foo.Foo()
23
>>> 
slender iron
#

👍

tidal kiln
#

so in that ^^ example, what was gained by use of const()?

slender iron
#

¯_(ツ)_/¯

tidal kiln
#

@stuck elbow thanks for pointing out the _ behavior with const(). do you know what the benefit of use of const() without leading underscore is? for example above

stuck elbow
#

speed

#

it doesn't do name lookup

#

but not inside a class, only when it's a global

tidal kiln
#

if used in a class, like above, is anything gained?

teal bear
#

where #help-with-mu ? (only 1/2 kidding)

stuck elbow
#

no, const does absolutely nothing when it's not on a module level

analog bridge
#

@onyx hinge including ports/esp32s2 in make translate also includes bunch of esp-idf strings

#

what is the best way to deal with it? I was thinking -prune

blissful pollen
#

Question: if I want to contribute my volume based LED animation and a timed sequence animation code to the animation library, is the basic process just get it into git, put in a PR and go from there? Not sure if there is any vetting process if it is needed/wanted, etc. thanks

slender iron
#

@blissful pollen yup! I think a PR to the library is the place to start

idle owl
#

@blissful pollen The PR is essentially the vetting process. We can decide on how to move forward within the PR.

manic glacierBOT
blissful pollen
#

Thanks @slender iron @idle owl, so I put together the PR with the code and then you can decide where to go. Still a newbie with git but I think I can handle that. Thanks

idle owl
#

@blissful pollen Always happy to answer questions. Don't hesitate to ask. Also there's a guide 🙂

blissful pollen
#

I saw the guide, next step to review it again!

onyx hinge
#

@analog bridge I agree -prune will probably work. one thing, cross reference with what is supported in the find on macos, which is probably not equivalent to linux in all cases.

#

you could also be more specific with the input list of paths so instead of giving find the argument ports/esp32s2 and working on everything below, you could list ports/esp32s2/*.[ch] ports/esp32s2/common-hal and so on

pastel panther
#

@onyx hinge Are the masks for the SAM-E can filter per-filter? As in the mask given to a Match only applies to the given filter?

onyx hinge
#

I am not sure whether we intentionally find translate() strings from other submodules, so maybe you want to use a form of git ls-files (consider files known to git, and not including submodules) instead of find .. oh wait, we do, within ulab

#

@pastel panther if I understand your question, yes. One filter could be "just address 0x408", another could be "if the low 0xff bits match 0xaa", etc.

#

in my mind (even though I keep saying both things) they are matches, not filters, since they specify what to include

pastel panther
#

right, I agree with that term

#

I'll have to check the DS but I think the MCP's masks are global, applying to all filters/matches

onyx hinge
#

When mask is specified, the check is packet.id & match.mask == match.id & match.match I think

#

(sometimes the hardware supports that the bits can also include the "is-rtr" and "is-extended" bits but that is not exposed to CP)

pastel panther
#

yaa

manic glacierBOT
onyx hinge
#

so yeah it looks like for rxb0 you can accept either 2 specific addresses, or 2 masked matches but only if their masks are equal

#

and for rxb1 it would be 4, but all their masks have to match or they have to all be specific addresses

#

which is "fine", in that the docs say (or are intended to say), if the HW can't do it, an exception will be thrown

pastel panther
#

right

onyx hinge
#

not even the "simple" filter examples in my loopback test program look like they'd fit in this implementation though. bummer.

pastel panther
#

ya

onyx hinge
#

may I just add that I am amused by the register named BUKT

analog bridge
#

@onyx hinge thanks for the suggestions.... can you link an example for git ls-files implementation

pastel panther
#

lol, I thought the same

onyx hinge
#

@analog bridge I may be on the wrong track with git ls-files, but here's an example: $ git ls-files "ports/atmel-samd/**/*.c" | wc 247 247 11778 $ find ports/atmel-samd/ -name "*.c" -print | wc 563 563 28750 so find finds 563 files including in the submodules like ports/atmel-samd/peripherals.h and generated source files like ports/atmel-samd/build-snekboard/autogen_display_resources.c, while git ls-files doesn't.

pastel panther
#

If I'm reading/understanding correctly, the MCP can support:

RXB0:
1x Filter+Mask or
2x Filter w/o mask

RXB1:
1x Filter+Mask or
6x Filter w/o mask

which I think is rephrasing what you said

#

(or several filters sharing a mask)

onyx hinge
#

@pastel panther coudn't it support [Match(id=37, mask=0xff), Match(id=54, mask=0xff)] ?

#

ok yeah

pastel panther
#

ya

onyx hinge
#

or [Match(id=37), Match(id=54)]

pastel panther
#

yar

#

I think Match(id=N) implies mask=FF

onyx hinge
#

for a single non-extended address the mask is 0x7ff or something? 11-bit addresses?

analog bridge
#

we don't get strings from other ports submodule.......

onyx hinge
#

possibly another problem with how I drafted the docs, it says a zero mask gives you a single address

#

@analog bridge we get strings from at least extmod/ulab which is a submodule, so its individual files would not be shown by git ls-files.

pastel panther
#

If you specify an extended id for a filter, it will apply to 11-bit addresses as well and will use the "extra" to match against the first two data bytes, because reasons

onyx hinge
#

yeah it looks like MCP2515 can't match an extended address only, or a standard address only?

pastel panther
#

they suggest it helps with some HLAs that use the first two data bytes as identifiers, presumably while sticking with a 11-bit id

analog bridge
#

@onyx hinge will take a look into it.... 🙂

pastel panther
#

@onyx hinge I'm going to add some more tests to verify the behavior

onyx hinge
#

@pastel panther sure, please do. did you figure out a good way to have an "apply this test only to this HW" in the tests?

pastel panther
#

yes-ish

#

just wrapped a try around the import of canio

onyx hinge
#

soon stm32 and sam e5x may have different filtering capabilities too

#

woof

pastel panther
#

That was hastily thrown together/chopped up to make pylint happy

onyx hinge
#

my code seldom makes pylint happy

#

maybe it's a knack I'll learn, maybe not

pastel panther
#

I may try to spike on using the CP unit test lib that ... personiforget wrote

#

oh hey, can we change Listener(match=XX) to Listener(matches=XX)?

#

I try to noun my args and I read match as a verb

onyx hinge
#

sure, why not

#

match and matches are both nouns aren't they

pastel panther
#

sure, but if match is a noun, passing it several seems strange

#

I'm mildly embarrassed that I care about such pedantry

onyx hinge
#
//|         """Construct a Match with the given properties.
//|
//|         If mask is not None, then the filter is for any id which matches all
//|         the nonzero bits in mask. Otherwise, it matches exactly the given id.
``` I want to change the Match doc to say this and fix the implementation to , er,  _match_
#

this I think would make a mask of 0 match everything(?)

pastel panther
#

yes, I believe so. And 0xFF would be an exact match

#

which I assume would be the default if no mask is provided

#

which is what the docs say 😅

#

(or will)

onyx hinge
#

hehe

#

int id_bits = args[ARG_extended].u_bool ? 0x1fffffff : 0x7ff;

#

I think those are the full bits of an extended or standard address, 0xff is fewer than all of them

#

I don't think that's important to your point, just being pedantic

pastel panther
#

we should start a club, but I'm sure we'd never agree if it should be a club, organization, or fraternity

#

😉

#

what is id_bits used for? is it masking something?

ornate breach
#

@slender iron when I build my uf2 for my board, where does that get stored?

slender iron
#

its in the build folder too

#

as firmware.uf2

ornate breach
#

I see it, thank you

idle owl
#

@solar whale I disconnected you from the CP audio chat.

pastel panther
#

the sight of your first firmware.uf2 is a glorious thing

ornate breach
#

indeed 🙂

onyx hinge
#

firmware.elf is my favorite

ornate breach
#

seems very magical 🙂

#

So now the trick is to do the DAP

slender iron
ornate breach
#

Also, I'm realizing that some pin selections are not that great so revisions are in place, but that's why we prototype 🙂

onyx hinge
#

@pastel panther any other changes to ask for while I'm touching that PR yet again? You have until I'm done with my pre-push testing, which does involve hooking up that SAM E board again so you've got a bit of time

manic glacierBOT
#

There is a logic error in the supervisor memory allocation functions that causes the supervisor heap to get into an inconsistent state, eventually resulting in crashes, when allocations are freed in a different order from the reverse of how they were allocated (leaving holes). Apparently nobody has been doing that so far, but now my recent experiments on #1084 at one point did.

free_memory() relies on having allocations in order, but allocate_memory() does not guarantee that: It reuses...

pastel panther
#

@onyx hinge lemee see 👀

solar whale
#

@idle owl thank you! forgot.

idle owl
#

@solar whale No worries!

solar whale
#

@slender iron I'm sorry, but I've run out of time and won't be able to do any testing of PR 3454 until I get back this weekend. I read over the discussion and don't have any concerns but there are a lot of options/kwargs to understand and it'll take more time than I can give it today.

slender iron
#

@solar whale k, no problem. lots of kwargs is my worry too and I need to wrap my brain around it too

manic glacierBOT
#

This is good sleuthing work!

I think there's little reason to support a zero-byte supervisor allocation, and every reason to avoid having to give the supervisor heap a non-zero initialization.

Will this change allow a supervisor block that is deallocated from the middle to be allocated again, if the new allocation fits? This would be very beneficial for the framebuffer displays, RGBMatrix and SharpMemoryDisplay.

slender iron
#

@onyx hinge want to push the changes you made to the CAN impl? you replied but didn't push from what I can see

onyx hinge
#

@slender iron yup, getting close, siddacious and I were discussing some other stuff

slender iron
#

what API discussion were you alluding to earlier?

onyx hinge
#

here in this channel, renaming a parameter and changing how a defaulted parameter behaves

#

In my opinion it is mere code duplication and does not improve things

slender iron
#

I did just eat lunch 🙂

#

so, I think you can share the code but it'd be better to do it like display_core

onyx hinge
slender iron
#

where you have the Message.c and RemoteTransmissionRequest.c files everywhere but then call out to a shared impl in shared-modules

onyx hinge
#

Is that what the 14d14d commit does?

manic glacierBOT
pastel panther
#

@onyx hinge re: the above docs+implementation update for Match will that be the whole docstring for Match? You're proposing to remove the " If extended is true then only extended addresses are matched, otherwise only standard addresses are matched."?

#

If so I don't disagree, just clarifying

onyx hinge
#

@pastel panther no I just trimmed for the sake of brevity

pastel panther
#

ah

manic glacierBOT
#

This is good sleuthing work!

It taught me how to use a Raspberry Pi with OpenOCD as an SWD debugger, which I’m sure is going to come in handy again! :)

I think there's little reason to support a zero-byte supervisor allocation, and every reason to avoid having to give the supervisor heap a non-zero initialization.

OK, will force-push the other solution. Should I try to adjust rgbmatrix_rgbmatrix_make_new() to that situation? I didn’t actually test it (so my analysis may be wron...

pastel panther
#

welp, ugly duckling that it is the MCP won't work that way by default, I don't think

slender iron
#

@onyx hinge yes mostly. I think you also want receive to return mp_obj_t and have send take a mp_obj_t

pastel panther
onyx hinge
#

@slender iron OK I thought I already changed receive to return mp_obj_t, maybe I didn't. I can change send to take an mp_obj_t as well.

slender iron
#

you did, it's just not in the PR commit you linked me to