#circuitpython-dev

1 messages · Page 342 of 1

tulip sleet
#

I have personally found it easier just to use the DFU bootloader. In the long run we can include the UF2 bootloader with CircuitPython, so that when you lget both

#

she might have been following directions from Limor. Something to discuss in the staff meeting, I think

idle owl
#

Ok.

#

Thanks @tulip sleet @onyx hinge

hearty tapir
#

Hi @tulip sleet I'll try to somehow get this into my build tree to test another thing I did for "wifi_reset() that is not yet a pull request. Maybe together this will make a difference.

#

I have a question on i2c_driver_install, where I saw that the alloc is set to 0, where the esp-idf description/doc has this to say: In master mode, if the cache is likely to be disabled(such as write flash) and the slave is time-sensitive, ESP_INTR_FLAG_IRAM is suggested to be used. In this case, please use the memory allocated from internal RAM in i2c read and write function, because we can not access the psram(if psram is enabled) in interrupt handle function when cache is disabled.

#

Could this play a role? I also noticed that i2c never hits the deinit() function, but sticks to "deinited()" messages. I thought that "ctrl+c" should get us into the function that does a cleanup including a common_hal_reset(pins)

#

(I'm not 100% sure on the function names, just finishing some stuff at work :))

tidal kiln
tulip sleet
#

it exits the program, so no loop needed. The program restarts from the top, as if you pressed reset

manic glacierBOT
tidal kiln
#

cool. thanks. guess i should change that code up. it works, just not in the way implied by the loop.

tulip sleet
#

right, the loop is really misleading, but it's everybody's baked-in idiom

#

hence exit_and

tidal kiln
#

yep. can also get there by adding this in to existing code.

ionic elk
#

Hey @tulip sleet how familiar are you with the ESP32S2 Flash?

#

Are we using the entire 4MB?

#

on modules like the wrover?

tulip sleet
#

@tidal kiln it could be useful to leave the loop there, so one could substitute a light sleep, but adding a comment like #Never gets here for the deep sleep case

#

but really it's fundamentally different, so maybe better not to leave the loop.

#

@ionic elk I have zero idea; that's a @slender iron q

ionic elk
#

ok I'll ask him once he's on

idle owl
#

@tulip sleet Limor updated the MagTag CP install page. So that answers that.

tulip sleet
#

@idle owl should also be added to Metro ESP32 guide?

idle owl
#

No idea.

tulip sleet
#

i think so, should be mirrored if poss

#

another meeting q

ionic elk
#

So we spend 3MB out of the flash on OTA?

idle owl
#

It's not possible to mirror it. It's very MagTag-centric. The install pages are board-specific.

ionic elk
#

Is it possible to disable OTA and use that flash for something else? I was chatting with Joey this morning about trying to get Unicode support onto the ESP32S2 - it would need about 2MB.

tulip sleet
idle owl
#

Oh that page.

#

The whole discussion was referring to the Install page.

tulip sleet
#

ah ok

idle owl
#

So you confused me temporarily.

#

Made a note to mention it.

analog bridge
ionic elk
#

Sure, my question is whether the size can be reconfigured, or if that's enforced by the ESP32 architecture

analog bridge
#

I would love to see unicode though. I have plenty of storage on my microS2. 16MB that is.

ionic elk
#

Actually, I'm realizing that I may be underestimating the size of our ESP32 builds too

manic glacierBOT
#

Thanks for the script. I was able to find a few valid combinations. This definitely works for me.

Not sure whether all combinations should work though. Adding full output in case this is a bug:
(output contains additional mp_printf I added in SPI.c)

Works: sck=board.A1, mosi=board.A2, miso=board.A3
Works: sck=board.A1, mosi=board.A2, miso=board.A4
pad combination not possible: clk:1, mosi:2, dopo:255
FAILED: sck=board.A1, mosi=board.A3, miso=board.A2
pad combination not po...
#

I found it very helpful to have those information in the UART console, while working on the Wi-Fi / i2c related topics.
I don't believe there are any negative side-effects, but would love to hear from you.

I (4129) wifi_init: WiFi RX IRAM OP enabled
I (4269) phy: phy_version: 603, 72dfd77, Jul  7 2020, 19:57:05, 0, 2
I (4269) wifi:enable tsf
I (4269) wifi:mode : sta (7c:df:a1:a1:b2:c3)
W (4269) wifi: start
W (5589) wifi: scan
W (5829) wifi: scan
W (6159) wifi: scan
W (6429) w...
ionic elk
#

I'm getting a PSRAM read error crash on my latest Wrover builds, is that a known issue?

orchid basinBOT
modern wing
#

Happily lurking today, updated the notes doc.

onyx hinge
#

Is anybody who is planning to talk NOT in the notes doc yet? I'll add you, just let me know!

tidal kiln
#

lurking

manic glacierBOT
thorny dove
#

Hi, this is paulsk from Lisbon. I am listening.

slender iron
#

welcome paulsk!

thorny jay
#

Hi, David from Belgium is lurking.

gilded cradle
thorny dove
#

tnx @slender iron

onyx hinge
#

This week has been a whirlwind, with some final pushes before the end of the year. We merged in deep sleep support for CircuitPython and ESP32-S2 which means we can do MagTag projects that only update once a day. This week's EYE on NPI is the Nordic Power Profiler 2, so we picked one up and used it to verify the power used during sleep mode. In ...

▶ Play video
onyx hinge
#

@lone axle you've got point, thanks!

lone axle
onyx hinge
#

First one is: "CircuitPython helper library for using the Adafruit MLX90395 tri-Axis magnetometer breakout"

manic glacierBOT
onyx hinge
#

@thorny dove you're not yet a member of circuitpythonistas. Are you planning to speak today?

thorny dove
#

@narrow dirge E. It's my 1st time. Like to just listen, but I have a question. Can I write it here?

onyx hinge
#

@thorny dove yes you can.

thorny dove
#

@narrow dirge E. OK

onyx hinge
#

And welcome, it's good to meet you.

thorny dove
#

@ Jeff E. Thank you! I am using an ESP32-S2-Kaluga-1 dev board. Tried to run the ESP-IDF example/get-started/blink. The menuconfig doesn't allow to set the BLINK_PIN to GPIO45 which is the pin for the built-in LED of the Kaluga-1. It limits the input range to 0-34. I defined GPIO45 in the blink.c file. Build, Flash and Monitor OK. The monitor reports: LED on...LED off but I the built-in LED doesn't lit. This problem doesn't occur when running a similar sketch inside the Arduino IDE. Any Idea?

thorny jay
#

Thank you @tulip sleet, save state will save the day!

onyx hinge
thorny dove
#

@narrow dirge E: OK, thank you.

onyx hinge
#

good luck!

#

I do see that multiple projects all restrict pin numbers to 'range 0 34', but I don't know why.

ionic elk
#

I lost him

gilded cradle
#

I can't hear either

onyx hinge
#

The documentation says that some of the pins are special, but I don't know what it means: "ESP32-S2 has three strapping pins: GPIO0, GPIO45, GPIO46."

modern wing
#

Feline interference.

ionic elk
#

@lone axle did the cat betray you

lone axle
#

you can go on

gilded cradle
#

@ionic elk you cut out

slender iron
#

strapping pins are read on start up to change what it does on start up

lone axle
#

I think my connetion is a bit spotty, just dropped out for a bit

gilded cradle
#

Sorry @ionic elk, tagged the wrong person

slender iron
#

are you resetting the psram pins?

ionic elk
#

I checked that, but it doesn't seem to be it?

slender iron
#

hrm, well that's good 🙂

lone axle
#

👍

slender iron
#

I haven't seen any psram issues myself

ionic elk
#

As in, I don't have the reset functions in the reset_all_pins. But it might still be feasible that the PSRAM was relying on the individual reset_pin not working, and that could still be messing it up

supple gale
crimson ferry
#

or could the babel data go in the filesystem?

ionic elk
#

I don't think babel is too picky where it goes

slender iron
#

yup, I'm hosting next week too

ionic elk
#

It's just a way of organizing the data, as long as you have access to it it should be fine

onyx hinge
#

December 28: no meeting

#

thank you !

slender iron
#

👋

gilded cradle
#

👋

modern wing
#

Yay! Thanks everyone 🙂

balmy stirrup
#

Thanks all!

analog bridge
#

Thanks!

thorny dove
#

Thank you and have a nice and pythonfull week

modern wing
#

I was thinking the same thing -- "oh no, did my network crash again today?"

thorny jay
#

Thanks.

solar whale
#

Have a good week all! 👋

manic glacierBOT
idle owl
#

Here is the notes document for Monday’s CircuitPython Weekly meeting. It is at the normal time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1e1miP8rVwwTqvVSJ2tgXj8NzGZ4FctSDwVKyfVV27aM/edit

#

@lone axle As the MagTag and other Portal libraries are refactored, I have a couple of MagTag guides that need lib folder screenshots updated. We made the main page a single page mirrored into everything - so that'll be updated as we go, but there are at least two guides that require one extra library so those have screenshots on the Code page in that guide. I'll keep you posted if that works for you.

lone axle
#

@idle owl yep sounds good.

supple gale
#

probably shouldnt reply to a bot, lol

manic glacierBOT
supple gale
#

@analog bridge is the I2Cperipheral slave only?

slender iron
#

ya, peripheral is the new name for slave

supple gale
#

so that is one difference btw the two. master vs slave.

manic glacierBOT
manic glacierBOT
#

This might just be from my dev build but I want to document it in case others see it.

UART debug output:

W (26453) cp main: real deep sleep
I (26453) ALARM: start deep sleep
../../esp-idf/components/freertos/queue.c:1304 (xQueueGiveFromISR)- assert failed!

abort() was called at PC 0x400328fd on core 0

Backtrace:0x4002fe52:0x3ffcec80 0x400303f9:0x3ffceca0 0x4003803e:0x3ffcecc0 0x400328fd:0x3ffced30 0x4002a7f8:0x3ffced50 0x4002a98d:0x3ffced80 0x4002959a:0x3ffceda0 0x4000ffe5:0x...
opal crystal
#

Unrelated to @hollow gazelle’s original issue, but this code raise KeyError("...") from KeyError (which occurs a couple of times in https://github.com/adafruit/Adafruit_CircuitPython_MagTag/blame/main/adafruit_magtag/network.py) looks strange to me. @gilded cradle (blame says you wrote this), does this do what you intended it to do? I’d expect it to read

except KeyError as e:
    raise KeyError("...") from e

instead. Although, unlike in CPython, it doesn’t seem to make much difference in CircuitPython, which doesn’t seem to implement __cause__ but just stack the tracebacks (confusingly, in the opposite order to CPython), so the key from the original KeyError is lost anyway.

gilded cradle
#

@opal crystal I think I copied/pasted from the PyPortal library for that (which may have originally been also written by me back when this feature was required to be used by pylint and there was little documentation). Feel free to update to the way you'd expect to read it. 🙂

manic glacierBOT
opal crystal
#

OK, will do more checks before to see if it would actually be an improvement.

thorny jay
# idle owl <@!382939733107408897> As the MagTag and other Portal libraries are refactored, ...

I feel something could be automated here. It is a bit related to my "in the weed" discussion about making a zip file with all the up to date library needed for a guide. The same way, if in the learn system you have a list of library some *.mpy and some folder, then maybe the screen shoot of what the /lib library should look like could be automated. I don't know how much effort for how much benefit, but it is doable.

idle owl
#

@tulip sleet Hacky workaround for that stupid Eagle bug doubling the size of the exports.... Export it at half the size. Eagle: 0 - Me: 1.

#

@thorny dove I disconnected you from the CircuitPython voice channel - sometimes it's used for dev chats and anyone with the CircuitPythonistas role can voice chat in that channel, so I didn't want you to end up surprised if there were suddenly voices coming through your speakers.

thorny dove
#

@idle owl OK

manic glacierBOT
thorny jay
#

@gilded cradle in my "MagTag PiHole Display" I encountered a difficulty (in addition to the BMP), I need to update the progress bar based on value from the JSON. To get it visible, I do a refresh, but that is a second refresh, just after the one triggered by fetching(?) the value. There must be a better way. Maybe it is super easy to do already. Else, could there be a "callback" function to implement any display update (that require special computation) before rafreshing the eInk.

ionic elk
#

@slender iron I can confirm I'm getting a PSRAM crash on main using the Saola 1 Wrover

#
E (571) cpu_start: Failed to init external RAM!
#

Worth an issue? Or is it possible that it could just be me, somehow? nevermind, I'm an idiot. If anyone else gets PSRAM errors like this, make sure you didn't grab your WROOM board by accident when you meant to use a WROVER.

gilded cradle
#

@thorny jay maybe it could be easily done with passing a callback to the text_transform parameter.

thorny jay
#

How, the text_transform?! this is maybe how I can put a label before those number... Maybe I should read the doc of that/those library!

gilded cradle
#

The idea is that the callback expects 1 parameter and returns 1 value. You could do other stuff and even return the same value.

#

I've also used a lambda function when I didn't want to use write out a whole function:

thorny jay
#

I found the SpaceX make good use of text_transform. Thanks.

gilded cradle
#

Excellent

onyx hinge
#

huh, the binary format is .. bigger !? -rw-r--r-- 1 jepler jepler 89165 Dec 5 13:45 GothamBlack-50.bdf -rw-r--r-- 1 jepler jepler 174436 Dec 7 17:24 GothamBlack-50.pcf

tidal kiln
#

23 takes up less space than 0b00010111, two spaces vs. eight. 🤪

manic glacierBOT
#

I do want to note that the IDF includes this comment in the gpio_reset_pin implementation:

//for powersave reasons, the GPIO should not be floating, select pullup

So it's feasible that if someone who really cares about power savings might want to either tweak this in their own version, or implement a new pin modification function that sets the pins to this lower power consuming state.

#

@tannewt also, before I merge anything, my latest commit still wasn't quite what you'd asked for, since it still sets the IOMUX to 1 as per the default inside gpio_conf, which is PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO);. I got distracted by my board mixup but the alternative I was going to offer is the following:

io_reg = GPIO_PIN_MUX_REG[pin_num];
if (io_reg) {
	gpio_matrix_out(pin_number, 0x100, 0, 0);
	PIN_FUNC_SELECT(io_reg, PIN_FUNC_GPIO);
}

which halts GPIO output an...

manic glacierBOT
ornate breach
#

hey @tulip sleet are you available?

#

I had a quick question for ya 🙂

#

When making the bootloader for the samd21, a specific VID/PID is given for that board. And generally that same VID/PID combo is used for the base build for CircuitPython.

But when adding a secondary circuitpython build option, you need a secondary PID for circuitpython to pass the CI Tests.

With the Haxpress style boards, there isn't a way to setup the base bootloader to operate solely off the SPI Flash is there?

#

For me it feels a little odd that one would need two separate PID for essentially the same board as far as the samd21 bootloader is concerned

manic glacierBOT
manic glacierBOT
manic glacierBOT
tulip sleet
#

@ornate breach There are often three PIDs: one for the UF2 bootloader, one for an Arduino program when it is running, and one for CircuitPython. For instance, for the Gemma M0, UF2 is 0x001C, Arduino is 0x801C, and CircuitPython is 0x801D.

I'm not sure the intent of your question, but the reason for a different PID for Haxpress vs no-SPI-flash is so the host computer can distinguish the two boards. For instance, Mu or some other editor may want to treat them differently, because provide different functionality.

manic glacierBOT
jaunty juniper
#

hey, so is there any problem known with the OneWire library on ESP32S2 ? And where should I create an issue to signal that it failed to detect my DS18B20 on the Feather S2 ? (while it is detected on a M0 Express)

crimson ferry
#

Where should corrections to circuitpython.org be directed? Noticed that Saola wrover and wroom don't come up with the wi-fi filter.

lone sandalBOT
manic glacierBOT
lone axle
#

oh, I see microDev linked to that repo already

manic glacierBOT
manic glacierBOT
#

I had another idea for easily signaling that you don't want safe mode on brownout, and that would be to simply add a file to CIRCUITPY that has a distinctive name we can check for. Something like:

  • SAFEMODE.OFF would turn off all resets into safe mode, including brownout. This might be sufficient.
  • BROWNOUT_SAFEMODE.OFF would just turn off brownout safe mode, etc.

This filename thing has the advantage of being immediately visible, and easily removable (by loading a CIRCUITPY eraser...

stuck elbow
#

is there a reason why rotaryio is disabled on samd21, or is this just to save space?

tulip sleet
#

which board?

manic glacierBOT
#

Hello,

I am working on custom hardware based on nrf52840 IC and running Circuit Python on it.

This hardware have implementation of PA/LNA chip in the antenna section which is controlled via GPIO. Control of the PA via GPIO in user code is working correctly but has a lot of limitations. I am looking into how to implement the automatic PA/LNA switching via soft device which is capable of triggering GPIO pin via PPI features on TX and RX events.. I came across this explanation in Nordic de...

#

On: Adafruit CircuitPython 6.1.0-beta.1 on 2020-11-20; Adafruit Hallowing M4 Express with samd51j19

>>> sensor = LC709023F(board.I2C())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_lc709203f.py", line 102, in __init__
  File "adafruit_lc709203f.py", line 135, in power_mode
  File "adafruit_lc709203f.py", line 195, in _write_word
  File "adafruit_lc709203f.py", line 195, in _write_word
  File "adafruit_bus_device/i2c_device.py", line ...
stuck elbow
#

I suppose that's outdated

#

I will make a pull request to remove it I suppose?

#

hmm, the "edit on github" links doesn't work

onyx hinge
#

@stuck elbow yeah it is incompatible with how our docs work and we haven't figured out how to remove the useless link. You can find the related docs with a little "git grep", it'll be in shared-bindings/rotaryio/__init__.c or some sibling file, probably

manic glacierBOT
stuck elbow
#

@onyx hinge I think the link is enabled in sphinx configuration

#

I will look into it

manic glacierBOT
crimson ferry
#

thanks @analog bridge & @lone axle , it didn't occur to me that filtering would grab from the .md files

manic glacierBOT
onyx hinge
#

@slender iron Do you want slice assignment of bitmaps bitmap[14:28] = b'\xaa\xa8', or do you want to blit bytes into bitmaps bitmap.blit(0, 1, b'\xaa\xa8') ? (given bitmap = Bitmap(14, 14, 2))

#

.. or do we want Bitmap.from_data(14, 14, 2, b'....') to construct and populate a bitmap all at once?

slender iron
#

@onyx hinge blit I think. Make sure we could expand it later to do 2d copies from bitmap to another. (Slices can’t do that without an intermediate object. )

tulip sleet
#

@slender iron I'm thinking about the naming for the backup RAM access. Maybe alarm.sleep_mem or alarm.persistent_memory or similar. "Backup RAM" is kind of jargony. It could be in microcontroller, but probably better in sleep because it's not that useful without sleep.

slender iron
#

Not sure either. One thing to consider is if we’ll add other memory accessors

tulip sleet
#

i thought we had a draft PR for general peek/poke (or just peek), but I cannot find it. I'd like to reuse the nvm ByteArray some how, but maybe just its signautures.

slender iron
#

Ya I think it was memoryio

simple pulsar
#

For a 6269 byte code.py file, would that be expected to cause two reloads when copied onto a PyPortal running 6.0.0?

slender iron
#

it depends on how your host os writes to the filesystem

simple pulsar
#

Don't remember nRF52840 boards doing that but perhaps I just wasn't paying attention. I'll ignore it for now.

manic glacierBOT
#

I do want to note that the IDF includes this comment in the gpio_reset_pin implementation:

//for powersave reasons, the GPIO should not be floating, select pullup

So it's feasible that if someone who really cares about power savings might want to either tweak this in their own version, or implement a new pin modification function that sets the pins to this lower power consuming state.

We can always do this later. I'm sure there are bigger power savings to do before that...

simple pulsar
#

What should GPIO do when a processor is put into sleep mode? Doesn't that depend on what's attached to it for outputs?

manic glacierBOT
slender iron
#

@simple pulsar they should reset by default which is usually high-z

#

however, I'm adding a board_deinit function that can decide what to do

#

(this is not what the current code does)

simple pulsar
#

Sounds good, I don't need to do that, I'm just thinking ahead

slender iron
#

@onyx hinge I did run across a modern bitmap font format someone made but I can't remember where I saw it

onyx hinge
#

There's Joey's

#

He has a circuitpython module for our and everything, but I'm not sure how flexible it is

analog bridge
#

on esp32s2... is it possible to reset to uf2 bootloder from software?

slender iron
#

we haven't added it yet I don't think

onyx hinge
#

It would be nice if the bitmap font supported antiquated too

slender iron
#

that's what I'm thinking of

analog bridge
#

I found the following in TinyUF2 docs:

#
#include "esp_private/system_internal.h"
void reboot_to_uf2(void)
{
  // Check out esp_reset_reason_t for other Espressif pre-defined values
  enum { APP_REQUEST_UF2_RESET_HINT = 0x11F2 };

  // call esp_reset_reason() is required for idf.py to properly links esp_reset_reason_set_hint()
  (void) esp_reset_reason();
  esp_reset_reason_set_hint(APP_REQUEST_UF2_RESET_HINT);
  esp_restart();
}
tulip sleet
#

currently common-hal/microcontroller/__init__.c common_hal_mcu_on_next_reset() only implements safe mode.

analog bridge
#

if uf2 is not available on the board then reset reason would be UNKNOWN...

orchid basinBOT
analog bridge
#

can we somehow check if the uf2 bootloader is present on device

#

maybe read particular portion of the uf2 partition

slender iron
#

@timber mango let's move here

timber mango
#

yep

slender iron
#

making a debug build now

#

you'll need to watch the serial to usb output

timber mango
#

i can do that i mu right?

slender iron
#

I don't think so. what OS are you on?

timber mango
#

windows 10

slender iron
#

mu knows how to do the native serial

#

you are on a saola board right?

timber mango
#

yes

slender iron
manic glacierBOT
#

This changes lots of files to unify board.h across ports. It adds
board_deinit when CIRCUITPY_ALARM is set. main.c uses it to
deinit the board before deep sleeping (even when pretending.)

Deep sleep is now a two step process for the port. First, the
port should prepare to deep sleep based on the given alarms. It
should set alarms for both deep and pretend sleep. In particular,
the pretend versions should be set immediately so that we don't
miss an alarm as we shutdown. These al...

timber mango
#

when it stops it doesnt give any message, and mu freezes

#

until i reset the board

slender iron
#

do you see other messages on the serial to usb output?

timber mango
#

only what my code is printing

slender iron
#

there should be a second serial with debug messages

#

coming from the usb connector on the saola board itself

timber mango
#

ah ill try that

manic glacierBOT
slender iron
#

can you copy the backtrace line and paste it here? I can make sense of it with a script

timber mango
#

Backtrace:0x4002f902:0x3ffdc370 0x4002fea9:0x3ffdc390 0x40037b16:0x3ffdc3b0 0x400d847f:0x3ffdc420 0x400b2b1b:0x3ffdc440 0x400ae62c:0x3ffdc470 0x40091cd2:0x3ffdc490 0x4008d705:0x3ffdc4b0 0x4008d8e9:0x3ffdc4d0 0x4008d967:0x3ffdc500 0x4008d976:0x3ffdc520 0x4008d9a5:0x3ffdc540 0x4009a714:0x3ffdc570 0x40091deb:0x3ffdc610 0x4008d705:0x3ffdc640 0x4009b391:0x3ffdc660 0x40091deb:0x3ffdc700 0x4008d705:0x3ffdc730 0x4008d732:0x3ffdc750 0x400ac0a5:0x3ffdc770 0x400ac386:0x3ffdc820 0x4009e8a3:0x3ffdc840 0x4009eaca:0x3ffdc870 0x4009ecec:0x3ffdc8c0 0x4009ef67:0x3ffdc8e0 0x4002feb8:0x3ffdc900

slender iron
#

ooooh a new one

#

I'll start an issue

timber mango
#

hah

manic glacierBOT
#
/home/tannewt/repos/circuitpython/ports/esp32s2/build-espressif_saola_1_wroom/esp-idf/../../esp-idf/components/esp_system/panic.c:360
/home/tannewt/repos/circuitpython/ports/esp32s2/build-espressif_saola_1_wroom/esp-idf/../../esp-idf/components/esp_system/system_api.c:104
/home/tannewt/repos/circuitpython/ports/esp32s2/build-espressif_saola_1_wroom/esp-idf/../../esp-idf/components/newlib/abort.c:46
/home/tannewt/repos/circuitpython/ports/esp32s2/build-espressif_saola_1_wroom/esp-idf/....
slender iron
#

can you post your code.py to the issue? ☝️

timber mango
#

sure

slender iron
#

thanks! @tulip sleet or @ionic elk would be good folks to hunt down the issue

crimson ferry
ionic elk
#

@timber mango please also post the register printout if you have it, that can help indicate if it's a pointer issue or something like that

slender iron
#

@ionic elk I think it's a failed assert. the top line in the screenshot says abort

ionic elk
#

@slender iron ah yeah I missed the screenshot

timber mango
#

the code wont format properly in the comment

ionic elk
#

you can just post it and we can have a crack at it

timber mango
#

nvm ill just make a pastebin

ionic elk
#

sometimes markdown likes some extra space between style elements

slender iron
#

you can attach files on github too

manic glacierBOT
timber mango
#

it wasnt supported apparently

tulip sleet
#

@slender iron should I look at pr 3807 yet?

slender iron
#

you can. I only did draft because I may have broken some board builds

#

it's working here though I am seeing pretty regular hangs when the code is running

#

I don't think they are related

#

goes for a run

timber mango
#

how fast are these issues usually fixed?

ionic elk
#

@timber mango what board are you using? I'm working on it now.

timber mango
#

esp32-s2-saola-1

ionic elk
#

wroom or wrover?

timber mango
#

wroom

ionic elk
#

@slender iron you recreated this issue on your machine - did you just run the sketch on a Saola and it occurred? Or did you rewrite it/set up hardware?

manic glacierBOT
ionic elk
#

@slender iron @timber mango I'm so far unable to replicate the issue. Is there a shorter test sketch this comes up with? Do you know what line of your existing sketch it fails on?

onyx hinge
#

huh I guess it makes sense, but you can't use f""-strings in the bundle, as it is incompatible with mpy-cross 5.x

ionic elk
#

The trace indicates that it was an invalid ADC unit coming in, but every pin under IO20 except GPIO0 has an ADC unit associated with it and you don't use GPIO0 (that said there's no protection against GPIO0 right now so I'm adding that)

timber mango
#

@ionic elk is seems to happen even with only print(get_voltage(ldr1), get_voltage(ldr2)) in the main while loop

idle owl
#

@lone axle Ping.

ionic elk
#

hmm, still not getting anything. If you just run this:

import time
import board
from analogio import AnalogIn
ldr1 = AnalogIn(board.IO2)
ldr2 = AnalogIn(board.IO3)

def get_voltage(pin):
    return int(pin.value/100)

while True:
    print(get_voltage(ldr1), get_voltage(ldr2))

can you tell me if it still happens?

timber mango
#

yep, is it printing too fast?

ionic elk
#

It should print very fast but it doesn't crash for me

timber mango
#

you have the same board?

ionic elk
#

yes, Saola 1. That said, I currently have a wrover set up, so let me run my Wroom. If that's causing the failure, that'll be an interesting clue.

manic glacierBOT
#

Hi Dusan, are these settings you set once and then work automatically? If so, they can go in board_init. If not, I'm not sure where the best place would be.

Hello, thanks for your reply.

Yes, this is suppose to be set only once for a chosen GPIO pin (which is hw dependent) and after this the pin should be controlled by the soft device whenever there is an TX or RX being done.

I will try to implement definition of this function in board.c file and calling of the same with pin sele...

lone axle
#

@idle owl I'm around now for a bit.

timber mango
#

@ionic elk seems like it cant read the pins too fast.
`import time
import board
from analogio import AnalogIn

ldr2 = AnalogIn(board.IO3)

while True:
print(ldr2.value)`

#

still crashes ^

slender iron
#

@ionic elk I didn't replicate it. I just built the firmware

ionic elk
#

I'm so far unable to replicate the crash on the Wroom or Wrover Saola 1 boards, with DEBUG on or off.

slender iron
#

what do you each have hooked to IO3?

ionic elk
#

It's just floating

timber mango
#

same

#

but usually an ldr

slender iron
#

hrm, weird!

ionic elk
#

I mean, the trace seems like a reasonable issue, I was just on the lookout for some misplaced pin or something, but I can't get it to happen

#

By the way, are the Wroom and the Wrover supposed to have different UART reporting baudrates?

#

I notice my Wroom board is at 115200 and the wrover is at 9600. Minor annoyance

slender iron
#

may be the bootloader you have installed

analog bridge
timber mango
#

the exact board name is ESP32-S2-Saola-1MI

#

maybe i missed something in the setup?

manic glacierBOT
ionic elk
#

Hmm, my board doesn't say WROOM-1 like that one does

#

it's just WROOM

timber mango
ionic elk
#

yeah I'd just landed on that same paragraph

idle owl
#

@lone axle Does this make sense to you? As in, what dglaude is requesting be added to the guide - do you understand what they're asking for? Because I'm unclear. Also, if you think it's worthwhile, I was wondering if it's something you'd be interested in updating. https://github.com/adafruit/Adafruit_CircuitPython_Debouncer/issues/23

timber mango
#

but in the setup, do i have to do anything else than erasing the flash and then flash the circuitpython firmware?

manic glacierBOT
lone axle
#

@idle owl Ah yes I think I know what that is about. debouncer lib got an update that made it easier to work with touchio (and lots of other things really)

ionic elk
#

You shouldn't... you're running the firmware that @slender iron gave you, right?

lone axle
#

@idle owl Yep, i can work on updating that guide to show the newer easier way to do that.

slender iron
#

@tulip sleet I meant to remove USER_NEOPIXELS_PIN because it's only used in one place

idle owl
#

@lone axle That would be amazing. Can you comment on the issue that you'll be looking into it?

timber mango
#

right now im running the latest one on s3, cause the last firmware.bin he gave me made mu not respond

#

but its the same thing i think

ionic elk
#

oho, wait, I think I just got it

timber mango
#

:O

tulip sleet
#

Well, I liked the idea of having it because you can use it anywhere, otherwise you have to refer to the header or pins.c file to find out which pin it is

idle owl
#

@lone axle Greatly appreciated!

slender iron
#

@tulip sleet but we don't use it anywhere else

ionic elk
#

I had forgotten to update to the absolute latest master

#

maybe it's a new change??

slender iron
#

must be

timber mango
#

oh?

#

so i can downgrade and it should work?

ionic elk
#

it only shows up after a while

timber mango
#

yes ^

ionic elk
#

like it runs for a good 5s or more and then fails, is that what you have?

tulip sleet
#

ah well, I don't feel that strongly, but I thought it was helpful. It -could- be used instead of a pin number in pins.c, but that may be annoying

timber mango
#

which code

ionic elk
#

the sketch I posted earlier. Maybe it'll happen earlier if I use yours

#

No, same deal, runs for ~5s and then dies

timber mango
#

yep

#

nice

analog bridge
slender iron
#

@tulip sleet I tend to like things factored out as needed. a define's impact can be unclear

ionic elk
#

huh. Did you also have to upgrade @analog bridge ?

analog bridge
#

I am on latest main.

ionic elk
#

because it definitely wasn't happening for my builds on a7ec4a048

#

which is only like, a day or two old

timber mango
#

which version were you using where it worked

ionic elk
#

well, actually looks like a week. But still

#

a7ec4a048

#

Ok I'm stepping out to walk dogs but I'll dig more when I get back.

manic glacierBOT
timber mango
#

where do i get the bin for a7ec4a048? i only found adafruit-circuitpython-espressif_saola_1_wroom-en_US-20201204-a7ec4a0.bin on s3 which still crashes

hollow gazelle
#

twitch is in sync!

timber mango
tulip sleet
#

I was typing at a terminal when an alarm came up on my Amazon Echo Show. So I said "git stop alarm" to the Echo Show to get it to stop. That did not work.

manic glacierBOT
analog bridge
supple gale
#

right now i am as usual confused by submodules. Is it normal that after doing a pull from main I getting modified: lib/tinyusb (untracked content)
I do the usual submodule update --init --recursive and even did a full submodule deinit -f . and submodule update --init --recursive

#

And just noticed the same over in the tinyuf2 repo. So i guess something has changed in tinyusb land

tulip sleet
#

@supple gale we don't do --recursive in tinyusb because it brings in a bunch of stuff you don't need

#

in general we don't do --recursive because of that

supple gale
#

lol, now i know. let me try again.

ionic elk
#

@timber mango I have that build because I build the Circuitpython main branch for work regularly, it's not part of a release. Have you tried Circuitpython 6.1.0 Beta 2? https://github.com/adafruit/circuitpython/releases/tag/6.1.0-beta.2

GitHub

This is the Beta 2 release of CircuitPython. Please use 6.0.x if you need a stable version of CircuitPython on all ports except ESP32-S2. Please use this release or newer for the ESP32-S2. See port...

timber mango
#

I think i have, but ill try again

#

doesnt work

ionic elk
#

I think it's memory corruption caused by the calloc. @tulip sleet was asking me about that.

timber mango
#

is there a working version available yet?

ionic elk
#

@timber mango you can upload .bin files, right?

timber mango
#

to the esp32?

#

im not sure what you mean

ionic elk
#

Can you try that?

manic glacierBOT
timber mango
#

not crashing :D

#

its printing ADC idx: 1 though but im guessing thats no big deal

ionic elk
#

Oh whoops forgot to take that out haha

timber mango
#

:P

#

thank you so much for taking the time

#

you too @slender iron

ionic elk
#

👍

timber mango
#

you think you could remove the ADC idx though xD

ionic elk
#

yeah sorry I got a compiler error and had to start over, it's still building

timber mango
#

npnp

crimson ferry
#

I don't really have an understanding of C memory management... why did their example code not work in our environment?

#

(nina uses the calloc and it seems to be OK)

ionic elk
#

I don't know too much about calloc, but doesn't it come with some risk of memory fragmentation? Our test scrips were calling this particular calloc a LOT.

#

It wasn't freeing that memory so my expectation was that it was filling up the whole heap and causing memory corruption.

#

@timber mango new bin

timber mango
#

Thanks

crimson ferry
#

@ionic elk that makes sense, but memset without a calloc would need some pre-allocated memory? and if that's there already, then why does Espressif feel the need for calloc?

#

(I guess their example allocates once, then just reads forever, whereas we enter that code every time an analog input read is requested, hence perhaps our memory issue. But that doesn't explain why they needed the calloc in the first place and we don't.)

ionic elk
#

Calloc is probably just there to set it to 0

#

in one line

crimson ferry
#

ah, ok, thanks for bearing with me

#

in the nina case, the calloc is used, but it will run for hours and days of analogs reads. however, that is a much simpler memory environment than circuitpython

ionic elk
#

I'm just guessing as to their motivation. There's a couple ways to initialize a struct to 0 in C, and Calloc is not one that I'd ever personally pick. Most of the time we don't need to because we use static variables per module, and those are always initialized to 0

#

The calloc would be ok(ish) if we had a corresponding free()

#

I don't know what Nina is, but if they only have the one variable in the program lifetime, or free it after using it, that's probably ok. It's only an issue in cases like ours where you're calloc-ing stuff over and over without freeing any of that memory.

crimson ferry
#

nina is the ESP32SPI firmware, it has an analog read function much like Espressif's example code

ionic elk
#

(I should note that even with the free, it might run the risk of memory fragmentation, but I don't know the details of how Circuitpython manages that)

#

Hmm. Well, it could be worth testing it. Run the read a couple hundred/thousand times and see if it crashes

crimson ferry
#

I thought I did that, will now go back and make sure 🙂

#

watching batteries charge is worse than watching paint dry

ionic elk
#

Or just replace it with the local memset version and avoid the dynamic memory allocation altogether. I'd probably just skip to that tbh

#

no reason to have mallocs and callocs when you don't need them, and they really can mess stuff up.

#

(watch me be wrong about all of this and there's some horrible hidden reason that ADCs need to have their calibration memory in the heap that we find out about in a week)

crimson ferry
#

lol, like any complex system, I'm amazed daily that it works so well the vast majority of the time... a testament to the development community

slender iron
#

what is the esp error checking function?

#

I think @onyx hinge added it

manic glacierBOT
#

#3575 was of no help. For others who might get this same failure in the future, what worked for me was a fresh install of Ubuntu 20 LTS running under Virtual Box. I was only trying to build under Windows 10 WSL because that had worked previously for me with MicroPython. Some other things that may be helpful to others:
When you want to install ninja, it's actually called ninja-build.
The build process SEEMS to sometimes ask for "python" when it really wants python3. I made a link to force th...

#

This is on esp32s2 build, Saloa_1_WROOM board but likely applies to others.
I don't have the code in front of me, but roughly:

import board
import busio

uart = busio.UART(board.TX, board.RX, baudrate=115200)

It complains about the RX pin being busy.

Thinking you might at least be able to transmit, you try

uart = busio.UART(board.TX, None, baudrate=115200)

Now it complains about the TX pin being busy.

In ports/esp32s2/boards/espressif_saola_1_wroom/board.c there are thes...

manic glacierBOT
crimson ferry
#

@ionic elk Sure enough, nina crashes about every 1000+ analog reads. My overly-aggressive test script error-handling masked it. I guess I should PR that.

slender iron
manic glacierBOT
#

Strangely on nRF the beta.1 has the CRC error as well:

Adafruit CircuitPython 6.1.0-beta.1 on 2020-11-20; Adafruit Feather Bluefruit Sense with nRF52840
>>> import board
>>> from adafruit_lc709203f import LC709023F
>>> sensor = LC709023F(board.I2C())
>>> print("IC version:", hex(sensor.ic_version))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_lc709203f.py", line 124, in ic_version
  File "adafruit_lc709203f.py", line 184, in _read_wor...
manic glacierBOT
mild fog
#

Anyone know if HUZZAH32 ESP32 FEATHER is going to get circuit python support? Or does it maybe have it already? it doesn't specifically call out circuitpython at all on the page.

idle wharf
idle wharf
manic glacierBOT
brazen cedar
#

Hi, I'm writing some code for the Trellis M4 and when I save changes the board soft reboots and starts to run the code for a second or so, then it soft reboots again and runs the code completely. I'm using CP6 and I've reproduced the behavior using VS Code and Mu. Should a double soft reboot be happening? What am I doing wrong?

stuck elbow
#

your operating system is broken and is writing some files to it

#

it's "normal"

#

the board resets every time something is written to it

manic glacierBOT
tulip sleet
#

@brazen cedar what OS is the host computer? The restarts happens because CircuitPython detects a write to CIRCUITPY. If the host computer has some delays between writing pieces of the file and/or writing the metadata (e.g. directory entries), then you could see this double restart.

tulip sleet
#

@brazen cedar Both VSCode and Mu attempt to write out a file completely all at once (they "flush" the file write when doing it). It's possible Windows 10 is still delaying writing some metatadata, though I have seen this less often in recent versions of Windows 10. If you have any utility programs installed such as indexers, disk checking utilities, or backup programs, they can also decide to write to CIRCUITPY later, causing a spurious write.

brazen cedar
#

@tulip sleet one more question what does it mean when all the neopixels on a trellis m4 go red and the board freezes? I have to unplug the usb to get the CP drive access back

tulip sleet
#

that's not a deliberate thing. There's a status neopixel on the back of the board that indicates error states.

If your program turns on many NeoPixels at a high brightness, it can draw so much power from some USB ports that the voltage sags on the port, causing the microcontroller to detect a brown-out. You might try the same thing with a well-powered USB hub, or a separate 5V power supply to see if it happens. Do you see any errors in the serial console when this happens?

brazen cedar
#

well its a tiled trellis m4 and 6 neotrellis running from a laptop usb port, there's no error shown in the serial mon

#

debugging hardware is hard

tulip sleet
#
#

do you have 6 extra 4x4 trellis boards?

#

each neopixel can draw up to 60mA at maximum brightness. A laptop port cannot power them all when they're very bright

brazen cedar
#

tiling neotrellis with a trellis m4 controller

#

I made a custom case based off the trellis m4 kit but

tulip sleet
#

Powering that from a laptop port is going to be problematic

brazen cedar
#

trying to test before screw it all up

#

the goal here was to make a thin hellauntz. Is that possible with the pieces I have?

tulip sleet
#

i think so, but driving so many neopixels could be an issue. what do you have the brightness set to? Is it at the default 1.0? Try 0.1 or 0.2

#

You may want to bring this up in https://forums.adafruit.com, where there would be people more familiar with tricks about powering such a large array

#

the untz designs were not done for the integral M4 NeoTrellis, so you will need to work up your own software

#

it is an impressive build you have there!

brazen cedar
#

turning down the brightness seems to have stopped the brownouts. thanks!

#

maybe i'll give show and tell a demo once i get it working

tulip sleet
#

Great! they are really bright and power-consuming without toning them down

#

S&T would be great!

tidal kiln
#

@brazen cedar neat mash up of m4 neo with the trellis boards

thorny jay
#

Dear @split ocean and/or @idle owl I feel there is something missing in linking YouTube Video and matching Learn Guide from John.

I wanted to check Pyloton as I have just acquired part of the hardware... Because I know there is a video and a guide, I could find both. But for someone not checking every video and every guide from Adafruit... they might not know.
And there is no link to the video in the guide and no link to the guide in the video:

And this is really sad and might be the case for many other projects from John.

Also another video say "Learn Guide coming soon": https://www.youtube.com/watch?v=XeAFPAdH4dI
While this one properly link to the guide: https://www.youtube.com/watch?v=viR-2dUP55g

#

I understand that there is delay between the LIVE show and the guide. But once the guide is available, the YouTube video description should be updated. And reverse way, they guide can link to the full video and not only the short preview.

brazen cedar
#

@tulip sleet ok all the boards are being picked up but the refresh rate is very slow. The buttons should be all turned on 50ms apart then all turned off in the same manner. What I'm seeing now is the buttons have about a 2 sec delay until the next one turns on or off. Any thoughts about the speed issue I'm seeing? I'm so close to getting this working.

tulip sleet
#

we'd have to see your code

#

if you have auto_write on, then each time you change a neopixel, it will update. You may want to turn auto_write off and use the explcit .show(). Update all the pixels and then do .show().

hollow gazelle
#

Fetched latest S3 for #MagTag - crashed with NLR jump failed

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 3, in <module>
File "adafruit_magtag/magtag.py", line 34, in <module>
File "adafruit_magtag/graphics.py", line 33, in <module>
Auto-reload is off.
Running in safe mode! Not running saved code.

You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
MicroPython NLR jump failed. Likely memory corruption.
Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 6.1.0-beta.2-20-g133013083 on 2020-12-09; MagTag with ESP32S2

#

will try something less 'hot'

tulip sleet
#

@hollow gazelle if this is easily reproducible, please file an issue

analog bridge
#

I saw this today... I am unable to remember how I fixed this... maybe just a power-cycle.

hollow gazelle
#

restarting help, but using the latest bundled libraries I'm seeing some inconsistencies

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 3, in <module>
File "adafruit_magtag/magtag.py", line 32, in <module>
File "adafruit_portalbase/init.py", line 28, in <module>
ImportError: no module named 'adafruit_display_text.wrap_text_to_lines'

I hadn't needed adafruit_portalbase before - I guess I need to get the .py sources ( instead of the .mpy from the bundle )

#

( trying to get a preview of Adafruit_Learning_System_Guides/MagTag_Christmas_Countdown running )

#

above line 28 says:
from adafruit_display_text import wrap_text_to_lines
fetching sources now for adafruit_display_text
looking in my libs, I had a conflicting init.mpy and init.py -- ( I guess I need to improve my update the libraries algorithm 🙂
looks like new library needs 'adafruit_fakerequests' now

will ignore the above issues - probably just stuff out of sync

tulip sleet
#

@slender iron are you familiar with the RTC fast and slow mem on ESP32-S2? Did you make any decisions regarding these? either both can be powered during deep sleep, costing only ~5uA, it appears. slow mem is used for ULP and at one time half was reserved for IDF use, but that is no longer the case. Fast mem is not used by ULP, but right now CONFIG_ESP32S2_ALLOW_RTC_FAST_MEM_AS_HEAP=y is configured, which would conflict with writing to the fast mem for sleep memory (unless it got stashed and restored in regular RAM, and why bother, if we'd need the same sized region)

manic glacierBOT
tulip sleet
#

@slender iron I just want to make sure I am not stepping on some previous decisions

#

since we maybe want to make the ULP available in the future, i'd avoid slow mem

#

also there may be some issue about which processor can access fast mem

simple pulsar
#

Hello. For CircuitPython 6, what was the reason to remove stop keyword arg from I2C.writeto() ? It's mentioned in the release notes. It's broken some Pimoroni code I think.

tulip sleet
hollow gazelle
tulip sleet
#

.py overrides a .mpy of the same name, and check sys.path, because the current directory is searched before /lib

simple pulsar
#

Thanks, I just wanted something to show Pimoroni if they query this.

slender iron
#

@tulip sleet I haven't thought about it yet. you are ahead of me

brazen cedar
slender iron
#

goes grocery shopping

manic glacierBOT
simple pulsar
tulip sleet
#

@simple pulsar that is a doc bug; the actual routine no longer takes stop

brazen cedar
ornate breach
#

What is the CAN pin naming for CP?

#

Like in the pins.c file?

#

I haven’t looked to see if those files are in the main branch for the M4 CAN Express

#

Wait, I found it

idle owl
#

@brazen cedar It did not! I missed it entirely. The problem is now, however, that the repo has been archived. I think what would need to happen is you would need to fork it, make changes, and submit it to the Community Bundle from the fork... I think. Because it needed to be renamed to something more descriptive I guess, and no changes can be made to archived repos. We have a guide on creating and sharing a library (https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/overview). This lib would need some updates to be in line with what we typically like to see out of libs included in the bundle, though, it's not strictly necessary.

#

@brazen cedar The idea of submitting from a fork is that we want other folks to be able to contribute in the future if desired. And that can't happen on an archived repo. I'm not even certain the bundle addition works on archived repos, but it might.

brazen cedar
#

ok I'll give that link a read. I just used that library and it worked great and there doesn't seem to be any other solutions to tiling NeoTrellis boards with the Trellis M4

idle owl
#

@brazen cedar If you need help, we're around to provide assistance. Do you know much about using GitHub?

#

Because the forking it first bit isn't included in that guide as it's an unusual first step.

brazen cedar
#

yes I do

idle owl
#

Ah ok. Good. 🙂

#

The lib is still using Travis CI, we've switched to Actions. That's the main thing that would have to be updated. You could run cookiecutter to get all the basic files, and then paste the actual code into the files you end up with.

#

Attribute it all to the original author, and submit it like that.

brazen cedar
#

ok sounds good this will keep me busy for a while

idle owl
#

Let us know if you have any questions. It's best to simply ask, as I'm not always around and there are other folks who can help you as well.

brazen cedar
#

ok will do 🙂

manic glacierBOT
orchid basinBOT
tulip sleet
#

@idle owl yes

idle owl
#

Ok thanks.

orchid basinBOT
ornate breach
#

Okay, question.

#

Does CircuitPython support having two separate i2c bus pins, and if so... how would I differentiate in in the pins.c file.

#

I want to be able to have 2 i2c busses on a same51 board I'm designing, but i wonder if there are any issues that would prevent it from working as I have it set out.

onyx hinge
#

@ornate breach I don't think there's any standard for it, but one board did atmel-samd/boards/bdmicro_vina_d51/pins.c: { MP_ROM_QSTR(MP_QSTR_I2C2_SDA), MP_ROM_PTR(&pin_PB21) },

ornate breach
#

hmm. that might work

#

thanks 🙂

onyx hinge
#

I found that with a little git grep: jepler@rat:~/src/circuitpython/ports$ git grep MP_QSTR.*SDA | grep -vw MP_QSTR_SDA so you can see the other flavors

#

board.I2C() would always be the first/default one

#

that's about all I know

ornate breach
#

I wanted to make a same51 board with some CANBus, multiple i2c busses, a bunch of Analog, i2s and whatnot. so that's what i'm working on right now 🙂

onyx hinge
#

sounds fun!

hearty tapir
#

Would you expect a i2c-deinit() to happen when ctrl+c is hit?

#

I know that the fix suggested by @supple gale works (where the i2c_driver_delete is commented out) - but I believe it should work even if driver_delete() happens. I noticed with my debug logs (and a lot of prints - I don't know how to otherwise help myself) that the deinit doesn't happen and the only function that I see often is i2c-deinited() which returns self->sda == NULL and thus makes deinit() never work (I believe, as the early if will always trigger the return)

#

I now put i2c.deinit() in my code.py (finally: unlock/deinit) but it doesn't help with the issue. It still hangs after soft-reboot.

hearty tapir
#

Nevermind, I'll just live on happy with the fix that Bruce put together 🙂

supple gale
thorny jay
#

The google doc for next meeting notes is not in the pinned document. Could someone update? I wanted to make sure not to forget to do a Hug Report toward kevinjwalters @simple pulsar for the current and future work on Enviro+ FeatherWing. 🙂

slender iron
#

@thorny jay I pinned this week's message. thanks!

manic glacierBOT
#

Essentially complete, except for a newline somewhere in the documentation but I can't figure out where. I'd appreciate a hint if you have time to take a look. Thanks for fixing the branch.

Should tests be added to the tests directory?

The class is a strict sub-set of the c-version. I use it for communication between Python interpreters.

brazen cedar
#

Is it possible to cast different elements of an array into different types?

#

As I understand it with the flexible typing of CP I can make an array of different types, is that understanding correct?

ivory yew
#

Yes, you can store different types in lists and dictionaries

#

So [1, 2, "hello"] is valid.

manic glacierBOT
#

I've been using a FeatherS2 with the Adafruit 2.9" Grayscale successfully using very similar code.
My setup looks like this

# these are for the FeatherS2
epd_dc = board.IO3
epd_cs = board.IO1

displayio.release_displays()
display_bus = displayio.FourWire(board.SPI(), command=epd_dc,
                                 chip_select=epd_cs,
                                baudrate=1000000)
time.sleep(1)
display = adafruit_il0373.IL0373(
    display_bus,
    width=296,
  ...
dark shore
#

Does anyone know if its possible to send a signal from one CircuitPlayground Bluefruit to another and vice versa?

cursive condor
#

I think you can use BLE UART

#

@dark shore (because nearly 2hours after)

empty ocean
#

how do you get led 2 and 7 to light up when the bluefriut is tilted side to side, i just started and this is my first assignment lol if someone could dm the code i’d appreciate it

tulip sleet
#

@slender iron CONFIG_FREERTOS_UNICORE=y is set in sdkconfig.defaults, and is in the default sdkconfig. I don't know if this is a good, bad, or indifferent thing based on our use case. (It has something to do with RTC Fast Mem, which is why I stumbled on it.)

analog bridge
#

How do I create a debug build for esp32s2?

hearty tapir
#

When you compile the build, add DEBUG=1

#

make board=amazingcoolboard -other-options DEBUG=1

#

well, without the -other options .. it was just to illustrate

#

I add -j4 if I'm not mistaken 🙂

analog bridge
#

I did... but no success... are there levels of debug ?

analog bridge
hearty tapir
#

hold a sec

#

Did you change the settings via menuconfig before?

analog bridge
#

nope

hearty tapir
#

Are you connected "only" via USB?

analog bridge
#

Serial converter attached to default UART pins

#

I am doing a clean build now...

hearty tapir
#

Ok, that should work just fine. tx, rx, gnd - correct? You did connect tx->rx, rx->tx? (I recabled once and didn't notice that I put tx on tx .. didn't work ;))

#

Good luck 🙂

analog bridge
#

thanks for the prompt replies @hearty tapir 🙂
following did the trick...

#
make clean BOARD=...
make DEBUG=1 BOARD=...
dark shore
tulip sleet
#

@analog bridge if you are not already using them, the ESP_LOGI() and related macros are handy.

#

enabled by DEBUG=1

analog bridge
#

I was facing issues with the LOG stuff... turns out a make clean was required.

#

I had this issue earlier where a complete clean build is required to implement changes with sdkconfig, partition table etc...

#

A question regarding MP_DEFINE_CONST_FUN_OBJ_KW
lets say I want the following api...

my.api(a=1, b=2)
my.api(1, b=2)
my.api(a=1)
my.api(1)
#

how should my allowed_args[] look like to achive this ?

slender iron
#

@analog bridge no REQUIRED and no KWARG_ONLY (or similar)

analog bridge
#

this is what I have currently implemented

static const mp_arg_t allowed_args[] = {
  { MP_QSTR_a, MP_ARG_OBJ | MP_ARG_REQUIRED },
  { MP_QSTR_b, MP_ARG_INT | MP_ARG_KW_ONLY, {.u_int = -1} },
};
slender iron
#

that looks right to me

analog bridge
#

I get TypeError: 'a' argument required on my.api(1)

#

and TypeError: function missing 1 required positional arguments on my.api(a=1)

slender iron
#

I'm not sure you can do required but maybe positional

analog bridge
#

I checked wifi.radio.connect implementation which is similar and that works fine

slender iron
#

does it allow the kwarg at all?

analog bridge
#
static const mp_arg_t allowed_args[] = {
  { MP_QSTR_ssid, MP_ARG_REQUIRED | MP_ARG_OBJ },
  { MP_QSTR_password,  MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
  { MP_QSTR_channel, MP_ARG_KW_ONLY |  MP_ARG_INT, {.u_int = 0} },
  { MP_QSTR_bssid, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
  { MP_QSTR_timeout, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = mp_const_none} },
};
#

trying now with MP_ARG_KW_ONLY removed

#

still no success...
my.api(1, 2) works with kw_only removed... everything else fails

slender iron
#

¯_(ツ)_/¯

#

what is your actual api? generally requiring kwarg makes uses more readable

analog bridge
#

its for ota.flash(buffer, offset)

slender iron
#

and what doesn't work?

analog bridge
#

everything except

buffer = firmware
offset = 0
ota.flash(buffer, offset)

this is with...

static const mp_arg_t allowed_args[] = {
  { MP_QSTR_buffer, MP_ARG_OBJ | MP_ARG_REQUIRED },
  { MP_QSTR_offset, MP_ARG_INT, {.u_int = -1} },
};
slender iron
#

so ota.flash(buffer, offset=0) doesn't?

#

the function macro has a minimum positional count too

analog bridge
#

yes... along with ota.flash(buffer) doesn't work

slender iron
#

what's the error?

analog bridge
#

I get TypeError: 'buffer' argument required on ota.flash(buffer)

and TypeError: function missing 1 required positional arguments on ota.flash(buffer=firmware)

also TypeError: function missing 1 required positional arguments on ota.flash(buffer=firmware, offset=0)

slender iron
analog bridge
#

no.. its OBJ_KW

slender iron
#

I don't think it's the allowed args check that you're hitting

analog bridge
slender iron
#

so the 1 on that line says it must be given one positional argument

#

(usually there for self on methods)

analog bridge
#

oh I see...

slender iron
#

#define MP_DEFINE_CONST_FUN_OBJ_KW(obj_name, n_args_min, fun_name)

manic glacierBOT
#

Essentially complete, except for a newline somewhere in the documentation but I can't figure out where. I'd appreciate a hint if you have time to take a look. Thanks for fixing the branch.

I think you need more

//|

these lines lead to empty lines in the resulting rst. I think you need one after every section. See here for an example: https://github.com/adafruit/circuitpython/blob/main/shared-bindings/struct/__init__.c#L51

Should tests be added to the tests directory?...

slender iron
tulip sleet
#

@slender iron I answered in the thread sudo apt install python-is-python3

slender iron
#

thanks!

analog bridge
#

@slender iron thanks for your help 🙂
I don't think MP_DEFINE_CONST_FUN_OBJ_KW should be used in this case... what do you recommend instead?

slender iron
#

I think you do want it. you just want 0 min args

#

because allowed_args will validate later

analog bridge
#

still getting errors with 0 min args... they are different though...

tulip sleet
#

finding an existing function impl that is close to what I want and copying it is what I always do. Note that the _make_new ones are different

#

busio is full of examples

analog bridge
#

I get TypeError: 'buffer' argument required on ota.flash(buffer)

and TypeError: extra positional arguments given on ota.flash(buffer=firmware)

also TypeError: extra positional arguments given on ota.flash(buffer=firmware, offset=0)

slender iron
#

mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);

#

remove the -1 and +1

#

those are for self usually

#

struct is probably the most useful reference because it is module functions as well

analog bridge
#

@slender iron looks like I need a Deep Dive for this... do you have one already?

slender iron
#

not that I can remember

analog bridge
#

I watched one where you explained displayio... I might do a re-watch. 🙂

slender iron
#

heh, ya

hearty tapir
#

Is this chat the preview for the stream tomorrow? 😄

slender iron
#

that's giving me too much planning credit

analog bridge
slender iron
#

np 🙂

manic glacierBOT
manic glacierBOT
tulip sleet
#

@slender iron alarm.wake_alarm is actually not getting set yet, as of your last sleep PR. Is that in your current work? I was going to depend on it to figure out whether code.py is going through a deep sleep cycle for the first time or following times. If it's None, it would be the first time. (I realized we cannot use microcontroller.reset_reason because that is not faked by fake deep sleep (and it probalby shouldn't be).

#

if you haven't done it yet, I can add it to my sleep memory PR

#

(but it might conflict with your current sleep work)

slender iron
#

go ahead and add it

#

I did notice it yesterday but I'm focused on getting light sleep to wake up with a pin

#

it's waking up immediately...

analog bridge
#

I need some suggestions regarding the OTA module naming.
The module just takes a buffer and its not necessary for it to be provided over-the-air.
Considering this does it need to be changed?

slender iron
#

what is the name for technique of having two flash spots? dual bank?

#

selfupdate maybe?

tulip sleet
#

dual bank is typical, i think

analog bridge
#

one plus for ota is that it is relatable and that the module will mostly be used for over-the-air updates.

slender iron
#

I'd probably write it out overtheair

#

that way folks don't need to know the acronym

tulip sleet
#

From Nordic: This process of storing the received firmware in free memory and then copying it to the intended memory location during activation is called a dual-bank update. Dual-bank updates are the preferred method of updating firmware, because the current application is retained until the new firmware is verified and activated.

analog bridge
#

also if someone is interested ota module can be extended to nRF port which can be updated over BLE

manic glacierBOT
solar whale
#

I've always used the "dual bank" approach for updating software on satellites. Nice to be able to revert quickly if something goes wrong in the new version.

hazy plover
#

I agree with @solar whale due to similar reasoning on changeable message signs for traffic control. Not as hard to service as a satellite but people can get killed if the messages were garbled. We used cellular modems with poor link reliability.

brazen cedar
#

CP performance question for the NeoTrellis class. I've got this code:

while True:
    print("Main loop begin")
    for y in range(multitrellis._rows):
            for x in range(multitrellis._cols):
                print("X=", x, " Y=", y)
                ntrel = multitrellis._trelli[y][x]
                available = ntrel.count```
the count method at the end slows the loop down A LOT! What exactly is being counted? This code is adapted from the sync definition of the neotrellis class
tulip sleet
fluid moss
#

... It's DotStar compatible!
That means I can use all of the existing helper libraries, such as adafruit_led_animation 💥

hollow gazelle
#

Not sure where this discussion should be placed, but it is interesting to observe the structure, evolution, and refactoring from pyportal, matrixportal, to magtag and portalbase

One would guess that new products would be based on the new portalbase, but has there been guidance issued with respect to having portalbase support the matrixportal and the pyportal ( e.g. retrofit, or even just proof of concepts/validation of the portalbase )?

Who would be involved in this architecture discussion? ( @slender iron ? )

lone sandalBOT
tulip sleet
# hollow gazelle Not sure where this discussion should be placed, but it is interesting to observ...

@gilded cradle did the refactoring after some staff discussion. I am not quite sure I understand your question, but my understanding is that portalbase is not meant to be a replacement library for the individual libraries, but to be an internal base (the notional "superclass") for portal-like products. Each portal-style library has specialized features for that board, but they share a bunch of functionality that was factored out, as reflected in portalbase.

manic glacierBOT
#
  • Added alarm.sleep_memory, which is a bytearray-like object (similar to microcontroller.nvm) that can store state between deep sleeps. Implemented only on ESP32-S2, in the RTC slow memory.
  • Added setting alarm.wake_alarm both for real and simulated deep sleep. An object has to be created, so creation has to be delayed until the VM is up after restart.

alarm.SleepMemory, the class for the singleton alarm.sleep_memory, includes subscript and slice access code that was simply cop...

analog bridge
tulip sleet
#

me too, I'm just trying a re-run; seems to something wrong with the azure ubuntu package archive

analog bridge
#

@tulip sleet re-run didn't work for me... I have tried close to 5 times...

tulip sleet
#

I think we need to complain to github

analog bridge
#

the first time I got it was 6 hours ago... since then I have retried at different intervals

tulip sleet
#

i'm writing up the contact form to github

#

i will try adding an sudo apt get update before the apt-get install

#

first

analog bridge
#

maybe also a fix-missing

tulip sleet
#

not sure i want to do that first thing, becuase it may cause a secondary error

#

@analog bridge it's proceeding now

manic glacierBOT
analog bridge
#

@tulip sleet whats the state of current sleep api (are there still api tweaks be made?)
I would like to start porting my previous work on ULP and Touch alarms to the new api... can I start on top of current main?
will Touch alarm be a subset of Pin?

tulip sleet
#

@slender iron is working on regular PinAlarm at the moment. I'd suggest adding TouchAlarm to ~~alarm.pin ~~alarm.touch (EDIT: see below). I think the API is pretty stable at this point.

I am using the upper half of RTC slow RAM for SleepMemory. Using RTC fast RAM did not seem stable: something overwrote it occasionally, even after I researched all the relevant compile options. ULP executes out of slow RAM, as I think you know. How were you planning to get the ULP program into slow RAM?

analog bridge
#

at the moment a pre-compiled ULP program is taken as a buffer

tulip sleet
#

do you feel 4kB is plenty big for a ULP program?

#

the idea was to give you the lower half

analog bridge
#

using ulp_load_binary to put it into the ram

tulip sleet
#

can you avoid overwrting the upper half?

#

does ulp_load_binary only touch the RAM for the size it's given?

#

worst case you could read it and write it back

analog bridge
#

I think ulp only has access to the slow_mem_region

tulip sleet
#

right, but I'm using the upper half of slow for SleepMemory

analog bridge
#

I'll get back to you in a while... its dinner time 🍽️

tulip sleet
#

i think it will work out: we can share the RTC slow mem

#

@analog bridge re module placement, I think maybe it would actually be better to have alarm.touch.TouchAlarm (and alarm.ulp.ULPAlarm). The reason is that TouchAlarm might not be available on some platforms. We try not to have missing classes in modules to avoid support confusion. But if a whole (sub)module is missing, that's easier to explain. So alarm.touch.* might be missing, but it would be better not to have alarm.pin.TouchAlarm missing

stuck elbow
#

won't it add to the size of the new code considerably?

#

a whole module just to keep a few names in it

tulip sleet
#

@stuck elbow no, it's really just an extra dictionary

#

@analog bridge I'm thinking about the naming more, and I'd suggest alarm.sleep_processor.SleepProcessorAlarm instead of ULP. ULP is an ESP32-S2-specific term, and there may be other chips with something similar. If you know of an industry-generic name, we could use that. Module could be enabled by CIRCUITPY_ALARM_SLEEP_PROCESSOR ,etc.

#

@stuck elbow @slender iron likes things to fail early, on import (though given how submodules work, maybe you don't have to import the submodules specifically). So we try to make the granularity at the module level, rather than at inclusion/exclusion of an attribute (like a class name)

#

I feel less strongly about this, but it's ok by me.

analog bridge
#

ok I am back now

analog bridge
#

I haven't encountered ulp on any other platform except esp

analog bridge
#

@tulip sleet Have you enabled Reserve RTC FAST memory for custom purposes
from idf:

This option allows the customer to place data in the RTC FAST memory, this area remains valid when rebooted, except for power loss. This memory is located at a fixed address and is available for both the bootloader and the application. (The application and bootoloader must be compiled with the same option). The RTC FAST memory has access only through PRO_CPU.
analog bridge
#

Another config parameter of interest I found is RTC_DATA_ATTR and RTC_RODATA_ATTR variables into RTC fast memory segment
from idf:

This option allows to place .rtc_data and .rtc_rodata sections into RTC fast memory segment to free the slow memory region for ULP programs. This option depends on the CONFIG_FREERTOS_UNICORE option because RTC fast memory can be accessed only by PRO_CPU core.
gilded cradle
#

@hollow gazelle I just wrote PortalBase a week ago. I'm planning on moving MatrixPortal and PyPortal (both regular and Blinka versions) over to it soonish. I'm just trying to get some other projects with approaching deadlines out of the way first.

hollow gazelle
#

@hollow gazelle I just wrote PortalBase a week ago. I'm planning on moving MatrixPortal and PyPortal (both regular and Blinka versions) over to it soonish.
@gilded cradle thanks - i thought you were central to this upgrade :-). ( forgot about blinka)

gilded cradle
#

🙂

ionic elk
#

I cannot say I have ever worked with any platform quite as frustrating as these i.MX RT boards. Not even the hairiest, ugliest STM32 HAL bug can compare to how these i.MX devboards sometimes just refuse to be programmed

#

I have invented an entirely new, flowery set of language to describe these things

#

Has anyone else had luck getting them to play nice with the Jlink? They've started refusing all flash access for like the third time today and I'm starting to tear my hair out

ivory yew
#

That's kinda surprising considering the lpc line is highly regarded. I haven't yet started using the imx stuff, though.

ionic elk
#

I dunno! It's just been constant debugging problems for me, even when I was working on them last, a few months back. They disconnect, don't flash properly, don't halt properly, report incorrect flash information, etc etc. I have a big list of voodoo notes about how to make them behave properly

#

have to plug in everything in a specific order, never do certain commands, etc

ivory yew
#

😔

ionic elk
#

It might be the EVKs in particular. I should give Arturo's feather a shot and see if it's less painful

sour lynx
#

@slender iron Hi, I've got a question regarding the light sleep issue on the ESP32-S2. Do I understand correctly that light sleep and wake up works fine the first time, but not afterwards?

slender iron
#

@sour lynx the first time works but the wakeup source is time

#

I haven’t seen it work with a pin wake up

#

Deep sleep works but not light sleep

#

I’m using an internal pull so I was thinking i should try enabling hold

sour lynx
#

Hold is needed in deep sleep, but not in light sleep i think. I'll try to make a working example of light sleep with GPIO wakeup with C API. Then we can try to find what's different between that and circuitpython code.

slender iron
#

There is an example in the idf

#

Is it possible to check the wake status directly?

ionic elk
#

@slender iron do you have a sec today where we could chat about debug strategy on the i.MX? I've been pretty stuck for most of today. I'm hoping you might have some insight on why the Jlink isn't connecting to the right memory

slender iron
#

Ya, later today

ionic elk
#

cool

#

Anytime would be good for me, I'm flexible.

#

I'll pull up some TCP stuff in the meantime.

#

Do you have a general sense of when would be good for you?

slender iron
#

11am pacific?

ionic elk
#

Sure, I'll ping you then

slender iron
#

Kk

sour lynx
#

Yep, looks like IDF light_sleep example is not broken on S2. I am gradually modifying the example to look like the circuitpython code you have linked to.

slender iron
#

@sour lynx are you using an internal pull?

#

our copy of the idf is a bit old but I didn't see any related changes in the idf source

sour lynx
#

Could you please try applying this patch?

From 19fd0f563435240f3a7e523990f9423659e4517e Mon Sep 17 00:00:00 2001
From: ninh <liuning@espressif.com>
Date: Wed, 28 Oct 2020 22:46:04 +0800
Subject: [PATCH] fix reject lightsleep when using rtc gpio to wakeup

---
 components/hal/esp32s2/include/hal/rtc_io_ll.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/components/hal/esp32s2/include/hal/rtc_io_ll.h b/components/hal/esp32s2/include/hal/rtc_io_ll.h
index 65bfe92a2e..c64a35031a 100644
--- a/components/hal/esp32s2/include/hal/rtc_io_ll.h
+++ b/components/hal/esp32s2/include/hal/rtc_io_ll.h
@@ -277,6 +277,7 @@ static inline void rtcio_ll_force_unhold_all(void)
  */
 static inline void rtcio_ll_wakeup_enable(int rtcio_num, rtcio_ll_wake_type_t type)
 {
+    SENS.sar_io_mux_conf.iomux_clk_gate_en = 1;
     RTCIO.pin[rtcio_num].wakeup_enable = 0x1;
     RTCIO.pin[rtcio_num].int_type = type;
 }
@@ -288,6 +289,7 @@ static inline void rtcio_ll_wakeup_enable(int rtcio_num, rtcio_ll_wake_type_t ty
  */
 static inline void rtcio_ll_wakeup_disable(int rtcio_num)
 {
+    SENS.sar_io_mux_conf.iomux_clk_gate_en = 0;
     RTCIO.pin[rtcio_num].wakeup_enable = 0;
     RTCIO.pin[rtcio_num].int_type = RTCIO_WAKEUP_DISABLE;
 }
-- 
GitLab

slender iron
#

yup

#

that title definitely looks related

#

@sour lynx yup, looks like that did the trick

sour lynx
#

Alright, i'll ping the maintainer of this part to get it merged into master soon.

slender iron
#

looks like pins hold in that case too. I don't think it's holding when light sleeping based on time alone

sour lynx
slender iron
#

do you think we should be using 4.2?

#

at some point I feel like we should switch to a specific release

hearty tapir
#

Speaking as a wireless-guy, 4.2 would be much appreciated 😄

sour lynx
#

I think it is probably a good idea to track some release branch if not sticking to a release tag.
However building (in CI) against master is also not bad, since you will not have to do a lot of work at once if you decide to upgrade.

#

of the notable things you might want to pick from master i can probably only name USB Host driver — that is in progress and should be in master in about 2 weeks.

slender iron
#

we don't have an api for usb host yet anyway

sour lynx
#

however if there is enough demand we might backport that to v4.2.

slender iron
#

that might be causing the usb instability I think I've heard of

#

we also have that ssl fix still

#

is there a timeline for 4.3's release? maybe we just wait until then

sour lynx
#

feature freeze estimated around end on Jan 2021, should get to beta stage around March.

#

the main risk at the moment is C3 support, but it is looking good so far.

slender iron
#

nice!

#

we should probably switch to 4.2 then

#

we can track the release/4.2 branch

sour lynx
slender iron
#

master will be less stable though

#

I'm a bit afraid for us to use newer master

#

but if we switch to release/4.2 it sounds like we'll get S2 fixes still

hearty tapir
#

@slender iron I assume the patch that @onyx hinge put into his branch (that we use right now, if I remember well) would be in 4.2?

slender iron
#

@hearty tapir I don't think it's merged into the idf yet at all

sour lynx
#

it has been merged into master, not synced to Github yet.

onyx hinge
#

https://github.com/espressif/esp-idf/pull/6117 "@onyx hinge Just to keep you informed: this change has already been merged into our master. So it will be available on github the next time master is synced! Sorry for keeping you waiting."

sour lynx
#

If you need the TLS fix in release/v4.2, please mention it on the PR...

slender iron
#

@sour lynx what would you recommend we follow?

sour lynx
#

I'd recommend release/v4.2, if it has all the features you need for now. But I'd also recommend at least building against IDF master on some schedule.

slender iron
#

I'm not worried about a bigger switch

#

and if we do any S3 or C3 work then we'll do it for that

#

right now I'd like to get the S2 stable

hearty tapir
#

@slender iron is that something that you'd put into "main" and we git fetch/pull this to test or is that a separate branch then?

wild yew
#

@tulip sleet Hello Dan! Is there a way to use inline assembler in CircuitPython?? I'm trying to see if I can do interrupt handling, for example handling an external interrupt on a pin, or even a timer interrupt. I'm experimenting with the Adafruit Circuitplayground express.

slender iron
#

ya, I'll switch main to a different submodule source for the idf

tulip sleet
hearty tapir
#

Ok, I'm happy to try/test if this is is any help.

slender iron
#

thanks! I'll do it with my light sleep PR I want to get out today

tulip sleet
#

@wild yew You can use inline assembler (it may not be on by default), but having your own interrupt routines is problematic, because it would interfere with our own interrupt structure. We are going to have "wake from sleep" based on pins, and also have longer-term plans to have pin transitions be recorded and be available from an event loop to process

sour lynx
analog bridge
slender iron
#

@onyx hinge I think I'll switch us to an adafruit fork of the idf

#

it'll be release/4.2 plus your patch

onyx hinge
#

@slender iron that's fine -- being an adafruit fork is much better than being my personal fork!

slender iron
#

ya, I'd feel bad pushing to your fork 🙂

onyx hinge
#

I would be happy to set that up but as long as we've got to change SOMETHING, moving it to the right place is better.

slender iron
#

I can do it since I need it for light sleep

onyx hinge
#

Much appreciated, thank you!

slender iron
#

np

tulip sleet
#

@analog bridge thanks, is there an issue that it's only available from one CPU? We have CONFIG_FREERTOS_UNICORE=y

analog bridge
#

I think that is for esp32 not s2

slender iron
#

thanks for all of your help @sour lynx

tulip sleet
#

hmm, well, that flag is for the bootloader, not the ESP-IDF

#

the fast mem can also be used as heap, and it is used for the wake-from-sleep stub routine

sour lynx
#

The purpose of CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is to reserve common RTC memory range both in the bootloader and in the app.
It is a provision for custom bootloaders which need some way to communicate with the app (or vice versa)

tulip sleet
#

it seemed tricky enough that I thought the slow mem is better (and it seems to be the common one to use for persistent sleep mem)

#

thanks @sour lynx; the details of this are not that clearin the doc

sour lynx
#

I agree, if you only need to preserve data over deep sleep, RTC_SLOW or RTC_FAST is better.

tulip sleet
#

i was choosing RTC_SLOW over RTC_FAST. I tried RTC_FAST and it seemed to get overwritten, but only some of the time. I turned off RTC_FAST as heap

#

RTC_SLOW seems fine. The sharing with the ULP is ok, we can partition it.

#

give ULP the lower half; we take the upper half for persistent state. We don't anticipate huge ULP programs. @analog bridge also points out we could store data to retrieve put there by the ULP

#

I just added alarm.sleep_memory which is a 4kB bytearray of upper RTC_SLOW.

analog bridge
tulip sleet
#

aha, I see, that is for the linker sections

slender iron
sour lynx
#

are you reserving RTC memory by placing an array there with RTC_SLOW attribute, or just dereferencing its absolute address?

tulip sleet
#

using absolute address

#

0x50000... or whatever + 4096

sour lynx
#

That's risky, i think. I would suggest defining a static array of the size you need, and giving it RTC_DATA_ATTR. It will be automatically placed by the linker, and in case there is some other stuff placed into RTC_SLOW, the linker will check if everything fits.

tulip sleet
#

so then we should turn off CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM

#

i guess

sour lynx
#

That config will redirect RTC_DATA_ATTR labelled variables into RTC_FAST.

tulip sleet
#

or can i force using the slow section?

sour lynx
#

If you don't enable CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM, then RTC_DATA_ATTR labelled variables will be in RTC_SLOW memory.

tulip sleet
#

if we want to use the ULP, then we need a slow static array that starts at the beginning of RTC_SLOW, is that right?

sour lynx
sour lynx
#

this memory will be automatically used by ulp_load function.

tulip sleet
#

ah good; would I also need to turn off CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP?

sour lynx
#

not necessarily. All the RTC Fast memory which is not statically allocated for code and data (using RTC_FAST_ATTR, RTC_IRAM_ATTR, etc) will be added as a pool to the heap allocator. As long as you never dereference random raw addresses into the RTC memory, it should be completely transparent. Just some part of heap will reside in RTC_FAST memory.

#

Since it is 8kB, it might be enough for stack of 1 or 2 system tasks, like esp_timer or sys_evt, freeing up "internal" RAM for other things.

tulip sleet
#

v good; the allocation and linker map mechanism is more sophisticated than I realized

#

this is extremely helpful!

#

thanks!

analog bridge
#

thanks! @sour lynx for all your help

sour lynx
#

np! I'm not monitoring the discord, but in case you need something, @slender iron has a way to summon me

#

or post an issue on esp-idf Github if you run into a bug.

ionic elk
#

@crimson ferry you mentioned that you called the ESP32SPI firmware "Nina". I'm not finding anything on google for that name, is that some kind of nickname for the Adafruit library or is it different? Could you link the repo when you have a moment?

crimson ferry
hearty tapir
#

(or not?)

crimson ferry
#

Adafruit fork is installed in Airlift products

hearty tapir
#

I had some build errors, before I discovered the "gitsubupdate" command thanks to @tulip sleet 😉 and als spent some time on Google. 🙂

slender iron
#

@ionic elk how do you want to chat?

manic glacierBOT
slender iron
#

@tidal kiln a page on refresh for displayio would be good to add to your guide

#

as I want to tell someone to do manual refresh

tidal kiln
#

@slender iron fancy timing! i have a BC due next week that's a general update to that guide - and i wanted to chat with you at some point about it

slender iron
#

nice!

tidal kiln
#

mainly focused on eink, but can update whatever else

#

was thinking next week - if that works for you?

slender iron
#

yup! I'm around

#

color conversion is the other topic

tidal kiln
#

ok...maybe shoot for monday?...may have to chat more than once over course of week

slender iron
#

sure

ionic elk
#

@slender iron Hey Scott I'm sorry

#

I'm online now if you're around

slender iron
#

yup, np

ionic elk
#

I'm in amelia

hearty tapir
#

@slender iron I put a patch together to address issue #3811 - any objections if I issue a pull request?

slender iron
#

nope!

#

thank you

manic glacierBOT
hearty tapir
#

I don't know why CI is sad panda though. Please let me know if I did something wrong.

slender iron
#

I don't think we always define DEBUG

#

oh, I think dan has a fix for this

#

check his latest pr

hearty tapir
#

I tested first to build with DEBUG=1, then without, then validated with above Python code.

#

Ok, will have a look

manic glacierBOT
hearty tapir
slender iron
#

@hearty tapir I don't see where we define DEBUG on the compilation line

hearty tapir
#

I think the idea is, that usually it is not defined and then the pins should not be reserved - so that usually you could use TX/RX pins for UART.

#

Or do you mean I should have changed this in the workflow actions somewhere?

slender iron
#

if you do a DEBUG=1 build it's not set either

#

it's a mistake I made with the uart thing

#

we need to set DEBUG in our CFLAGS

hearty tapir
#

Ok, I thought that was what Makefile:120 does

slender iron
#

it changes the flags based on debug but doesn't actually pass it into the compiler

#

(that's where it should)

#

I guess there is NDEBUG already

#

lunch time for me

hearty tapir
#

enjoy

manic glacierBOT
tulip sleet
manic glacierBOT
hearty tapir
#

I hope this makes this a valid and complete pr now. 🙂

manic glacierBOT
supple gale
#

fyi digikey have the nordic ppk2 kit back in stock. for now 🙂

slender iron
#

👍

tidal kiln
#

is there a way to do timezones in CP? like have time.localtime(UNIX_EPOCH) return in local tz instead of GMT?

crimson ferry
#

Not that I’ve ever found, it’s always a separate calculation based on looking up the numerical time zone offset from the time zone string

#

and then adding those seconds

#

But if you set the RTC, time functions will pull from that and that can be the correct offset

manic glacierBOT
tidal kiln
#

i think i'm doing that

#

relying on libraries for that level

#

time.localtime() works as expected

#

just not with passing in a unix epoch time

#

i'm PST

#

with python3 on PC, get this:

>>> time.localtime()
time.struct_time(tm_year=2020, tm_mon=12, tm_mday=11, tm_hour=16, tm_min=6, tm_sec=25, tm_wday=4, tm_yday=346, tm_isdst=0)
>>> time.localtime(1607688632)
time.struct_time(tm_year=2020, tm_mon=12, tm_mday=11, tm_hour=4, tm_min=10, tm_sec=32, tm_wday=4, tm_yday=346, tm_isdst=0)
>>> 
#

on CP, get this:

>>> time.localtime()
struct_time(tm_year=2020, tm_mon=12, tm_mday=11, tm_hour=16, tm_min=6, tm_sec=22, tm_wday=4, tm_yday=346, tm_isdst=-1)
>>> time.localtime(1607688632)
struct_time(tm_year=2020, tm_mon=12, tm_mday=11, tm_hour=12, tm_min=10, tm_sec=32, tm_wday=4, tm_yday=346, tm_isdst=-1)
>>> 
#

note the difference in tm_hour for the second case of inputting an epoch time

crimson ferry
#

we don't seem to have the tm_zone attribute that was added to struct_time in python3.3

manic glacierBOT
#

Related to 2nd USB-serial channel wanted,
endpoint shortage and dynamic or static descriptor:

Perhaps we could have static descriptor with shared
endpoints for usb-serial and something-else, for example microphone.

Of course usb-serial and microphone cannot work
at the same time using the same endpoints.

but I was thinking - if in the OS the microphone driver is blacklisted,
then usb-serial may normally load and work.

brazen cedar
#

Are the chips that CP runs on multi-thread capable?

hearty tapir
# brazen cedar Are the chips that CP runs on multi-thread capable?

Yes, Jeremy, but threading is not a goal for CPY as it is intended for beginners. There are some light threading options, but a better and more comprehensive overview would be the deep dive by Scott from yesterday. You may want to watch it. The video on Youtube has time code so you should be able to skip to the section that interests you most.

manic glacierBOT
#

Hello,

I tried adding the mentioned code (with few little changes) within 'board_init' function, compiled without any errors and tried it with custom hw but its not working.

On the other hand, I tried adding the code in the _bleio/Adapter.c file within 'ble_stack_enable' function (right after the section where 'opt.common_opt' is used for 'conn_evt_ext'), compiled without any errors and it works!

Question 1: Any idea on the reason why the same code is not working when executed withi...

analog bridge
#

How do you plan to differentiate between the data stored in slow_mem (i.e. accessible to ULP) and the data stored in fast_mem?

#

Will there be a setting to mark data as shared/unshared in the api?

manic glacierBOT
#

The step after "I (4808119) wifi:AP's beacon interval = 102400 us, DTIM period = 1" is to obtain an IP address and initialisation of the TCP/IP stack. I believe you'll not see this issue again, as it was related to the duplicated esp_netif_init() and or the associated esp_event_loop_create_default() which @jepler fixed via https://github.com/adafruit/circuitpython/commit/dd108b755dc2bb886df14c9fcfcd4f09be61f2d4#diff-d3fbda07013b552de603fbc99e263532c77942ec1f4746a4b5aa755f7d3ae640

timber mango
#

Hi to all. I manage to install circuitpython on stm32f407 discovery board but simple blink program with on board LED (one of the 4 on board) don't work. Does somebody have pin declaration for this board under circuitpython, note I put my py program under main.py file name.

tulip sleet
#

@analog bridge Based on the conversation with igrr yesterday here, instead of trying to share slow memory, the ULP Alarm module could provide a mechanism to retrieve the data itself. The sleep_memory bytearray would not try to overlap with that. It's up to sleep_memory whether to store the data in fast or slow RTC memory.I think that we should not necessarily try to bypass the linker section mechanisms provided by the ESP-IDF.

So, in other words, the ULP alarm could provide its own data in/out mechanism. It could just pass a buffer back and forth. Or you could provide directly access with a duck-typed bytearray, like sleep_memory. We could modify the SleepMemory object to include a base and length, so there could be multiple instances (though both would still be singletons). One would be alarm.sleep_memory and one would be alarm.sleep_processor.data or something like that.

tulip sleet
#

do you want to reserve a fixed chunk of slow mem for data communication? Or, when you pass in the buffer that is the ULP program, you could also pass in an offset (or absolute address? I'm not sure), and a length that specify the data passing bytearray

analog bridge
#

so... I am assigning the complete 8kB to ULP now. I will have a template program in peripherals/ulp.c with a global bytearray declared... this will be linked in the main program by the linker script.

tulip sleet
#

that forces the bytearray to be fixed; I could imagine that one might not want that. The ULP program will know where it wants to put the data buffer and its size. I'd let it be determined at runtime, instead of adhering to a template. The ULP program generation would be done offline, and however that's done would output the location of the communications array.

#

There could be a helper library to do this, or some kind of mini-build system. Using the ULP is complicated, and someone is going to need to use an assembler or the C macros anyway. From the map produced by that process, one would know where the communications array was

#

the current ULP mechanisms are designed for a fixed program for a fixed application; we are trying to defer that to runtime

#

e.g. you might have a big program and small data output, or a small program with a really large array (a bunch of temp readings, etc.)

analog bridge
#

I'll give this more thought at a later time... I am currently facing difficulty in incorporating ulp compilation with cpy

#

should I make a draft PR? most of the alarm stuff is done and works well.

tulip sleet
#

yeah, I would do the ULP compilation separately, if that is at all possible, though the macros may not be strutcured for that. I'd expect the macros just to produce a C table of bytes

#

then that can be converted into a Python bytestring literal or a file that can be read

analog bridge
tulip sleet
#

A draft is fine. But there is churn going on re the supporting code in main.c and in alarm/__init__.c that you may have to change soon. My SleepMemory PR has some changes in it to the code in main.c and elsewhere that involve fetching the alarm cause and setting alarm.wake_alarm. Scott is also still working on PinAlarm, and that will have similar changes.

#

I could imagine writing a ULP assembler in Python or something like that, rather than relying on the macros.

#

the assembly code would just be python calls

analog bridge
tulip sleet
#

👍 I looked at the GitHub link you sent me. I didn't look in great detail but it looks good to me. We talked about changing "ULP" to "SleepProcessor".

analog bridge
#

all thanks to your efforts with sleep api... everything is nice and straightforward

tulip sleet
#

i admit I didn't find anything else with a ULP. I found a few chips with an M0 and an M4 core, where one might use the M0 only for lower power operations, but that's a big difference from the dead-simple ULP.
... Thank you - it was a team effort, and I really appreciate your deep ESP32 knowledge

analog bridge
#

on to doing the naming change...

tulip sleet
analog bridge
#

interesting...

hearty tapir
#

Hi @onyx hinge your changes in combination with the i2c change by Bruce made the Wi-Fi stuff rock solid for me. I issued one more fix for one of the open issues (where stop_scanning before scan would make the board hang) - but apart from this, I think the stability made major leaps forward. Thank you 🙂

onyx hinge
#
GitHub

A Cornucopia of CircuitPython Unit Converters and a Couple of Constants - CedarGroveStudios/Unit_Converter

#

with my code basically you use a Zone object zone = dstrule.US_Central and then you can get the current local time as a tuple, assuming the RTC is set to UTC time: tm = zone.localtime(). You can also pass in a unix epoch time in seconds to the localtime function. This isn't in git anywhere, just in a gist, so there's nowhere you can pull request to add other timezones.