#circuitpython-dev
1 messages · Page 342 of 1
she might have been following directions from Limor. Something to discuss in the staff meeting, I think
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 :))
Thanks for adding. Could you please resize the images to better match the other images on the site? See https://learn.adafruit.com/how-to-add-a-new-board-to-the-circuitpython-org-website/preparing-the-images for some guidelines.
deep sleep question. with exit_and_deep_sleep_until_alarms the code restarts when it wakes back up? so really no need for an infinite loop like this?
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/ccb098eed8015569dcf73fb704a9bbfdbe5658ee/MagTag_Tides/magtag_tides_land_lp.py#L262
it exits the program, so no loop needed. The program restarts from the top, as if you pressed reset
Strange... I tested this with i2cperipheral which basically has same mechanics for init & deinit as busio.i2c and didn't have this issue. At the same time this issue appears when I switch to busio.i2c.
cool. thanks. guess i should change that code up. it works, just not in the way implied by the loop.
right, the loop is really misleading, but it's everybody's baked-in idiom
hence exit_and
yep. can also get there by adding this in to existing code.
Hey @tulip sleet how familiar are you with the ESP32S2 Flash?
Are we using the entire 4MB?
on modules like the wrover?
@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
ok I'll ask him once he's on
@tulip sleet Limor updated the MagTag CP install page. So that answers that.
@idle owl should also be added to Metro ESP32 guide?
No idea.
So we spend 3MB out of the flash on OTA?
It's not possible to mirror it. It's very MagTag-centric. The install pages are board-specific.
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.
@idle owl I think you could mirror that page https://learn.adafruit.com/adafruit-magtag/install-uf2-bootloader jsut by generalizing the last sentence, which is already caveated.
ah ok
The OTA partitions ota_0/1 contain the circuitpython firmware...
Sure, my question is whether the size can be reconfigured, or if that's enforced by the ESP32 architecture
I would love to see unicode though. I have plenty of storage on my microS2. 16MB that is.
Actually, I'm realizing that I may be underestimating the size of our ESP32 builds too
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...
I'm getting a PSRAM read error crash on my latest Wrover builds, is that a known issue?
I’m taking better shots tomorrow anyway, thanks for the learn guide heads up. Reading and photography for me tomorrow.
Thanks, that sounds good. :)
Happily lurking today, updated the notes doc.
Is anybody who is planning to talk NOT in the notes doc yet? I'll add you, just let me know!
lurking
had to patch the script.
replace:spi = busio.SPI(sck=sck, mosi=mosi, miso=miso)->spi = busio.SPI(clock=sck, MOSI=mosi, MISO=miso)
Whoops, that's a great example of why bare except: is a bad idea. Glad you got it working.
All combinations definitely don't work: it has to be like this (from the data sheet):

Closing since there is not actually a bug.
Hi, this is paulsk from Lisbon. I am listening.
welcome paulsk!
Hi, David from Belgium is lurking.
I want to make a Discord Mute/Unmute button using a QT Py and one of these: https://www.adafruit.com/product/1186
tnx @slender iron
Initial working version of light sleep and deep sleep, after several API iterations. Started coding from https://github.com/tannewt/circuitpython/tree/sleepio/ .
alarm.time.TimeAlarm implemented ...
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 ...
@lone axle you've got point, thanks!
https://github.com/adafruit/Adafruit_CircuitPython_MLX90395 https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests
First one is: "CircuitPython helper library for using the Adafruit MLX90395 tri-Axis magnetometer breakout"
I would strongly encourage development of the audioio module, as the STM32F405 is one of the more powerful processors in its class, and this module would facilitate applications that would be infeasible on lesser platforms.
@thorny dove you're not yet a member of circuitpythonistas. Are you planning to speak today?
@narrow dirge E. It's my 1st time. Like to just listen, but I have a question. Can I write it here?
@thorny dove yes you can.
@narrow dirge E. OK
And welcome, it's good to meet you.
@ 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?
Thank you @tulip sleet, save state will save the day!
@thorny dove I don't know. I think a good place to ask for help with the esp-idf is https://esp32.com/ the esp32 forum
Espressif ESP32 Official Forum
@narrow dirge E: OK, thank you.
good luck!
I do see that multiple projects all restrict pin numbers to 'range 0 34', but I don't know why.
I lost him
I can't hear either
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."
Feline interference.
@lone axle did the cat betray you
you can go on
@ionic elk you cut out
strapping pins are read on start up to change what it does on start up
I think my connetion is a bit spotty, just dropped out for a bit
Sorry @ionic elk, tagged the wrong person
are you resetting the psram pins?
I checked that, but it doesn't seem to be it?
hrm, well that's good 🙂
👍
I haven't seen any psram issues myself
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
I did a build with that flag and saw no improvement.
or could the babel data go in the filesystem?
even an 8MB external flash, could fit it on the 4MB filesystem https://github.com/adafruit/circuitpython/blob/main/ports/esp32s2/esp-idf-config/partitions-8MB.csv
I don't think babel is too picky where it goes
yup, I'm hosting next week too
It's just a way of organizing the data, as long as you have access to it it should be fine
👋
👋
Yay! Thanks everyone 🙂
Thanks all!
Thanks!
Thank you and have a nice and pythonfull week
I was thinking the same thing -- "oh no, did my network crash again today?"
Thanks.
Have a good week all! 👋
Strange... I tested this with i2cperipheral which basically has same mechanics for init & deinit as busio.i2c and didn't have this issue. At the same time this issue appears when I switch to busio.i2c.
Is that code available somewhere? Thanks
I have a open PR for i2cperipheral > 3768. The build artifacts are available here.
Test Code:
import wifi
import time
import board
from i2cperipheral import I2CPeripheral
i2c = I2CPeripheral(board.SCL, board.SDA, (0x40, 0x41))
while True:
print("Looping for fun\n")
time.sleep(1)
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
CircuitPython Weekly for 14 December 2020 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to participate,...
@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.
@idle owl yep sounds good.
Is the I2CPeripheral slave only?
probably shouldnt reply to a bot, lol
* Do we want the ability to update other flash partitions like `uf2`? _Note: This could be risky as there is no rollback available for these partitions._
Not now, let's start simple. :-)
@analog bridge is the I2Cperipheral slave only?
ya, peripheral is the new name for slave
Yes
so that is one difference btw the two. master vs slave.
Hi! Please create a PR to add the flash definition. Instructions are here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github Thanks!
@FoamyGuy what board are you on?
Would you mind posting a picture or screenshot of the oscilloscope? That'll show the issue in a second way.
My preference would be a set or tuple if we want to support multiple reasons. I'm not sure we do though.
I think we can simplify to one reason. For chips that are cumulative we can clear the state or prioritize the reason.
My preference would be a set or tuple if we want to support multiple reasons. I'm not sure we do though.
I think we can simplify to one reason. For chips that are cumulative we can clear the state or prioritize the reason.
This is OK with me. I think we can prioritize the reasons: I think there will be an overriding one that the user will really care about.
Looks good to me! Thank you!
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...
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.
@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. 🙂
This is the waveform with öevel_high = 32767
Waveform with high_level = 32768
Waveform with high_level = 65535
If you run the program posted above, you wil...
OK, will do more checks before to see if it would actually be an improvement.
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.
@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.
@idle owl OK
@tannewt It was definitely ESP32-S2 port. I tested some on MagTag and some on Unexpected maker Feather S2. I'm not 100% sure if I tested both versions on both devices or not though.
@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.
Not sure if the above is very clear. It's a combo of not checking enough the MagTag library and not really knowing what I am doing: https://github.com/dglaude/MagTag_PiHole/blob/main/code.py
@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.
@thorny jay maybe it could be easily done with passing a callback to the text_transform parameter.
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!
You could look how I did it with MatrixPortal: https://github.com/adafruit/Adafruit_CircuitPython_MatrixPortal/blob/master/examples/matrixportal_simpletest.py
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:
I found the SpaceX make good use of text_transform. Thanks.
Excellent
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
23 takes up less space than 0b00010111, two spaces vs. eight. 🤪
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...
Also print backtrace before reset when DEBUG. This will help debug
safe mode issues which calls reset.
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
This draft PR demonstrates one fix for the hang with the ESP32S2 when using wifi and i2c. Hang occurs when interrupting a program and resuming.
This code only creates the i2c driver once per i2c controller/bus, never deleting it.
There must be another underlying issue causing this, perhaps inside the ESP IDF.
Does this allow the pins associated with the I2C device to be used for other purposes?
Does this allow the pins associated with the I2C device to be used for other purposes?
By that do you mean in the same program? If so I have tried that. In a separate program yes as the pins are still setup in the constructor. I will try some more testing tomorrow on a better test setup. Currently everything is hanging from dupont wires and tape.
We should test on nRF and SAMD also. Unfortunately I don't have this sensor.
I did stumble across this interesting post about adding clock stretching to a different fuel gauge sensor, while I was looking for something else: https://www.esp32.com/viewtopic.php?f=13&t=15999
Maybe interesting: here is someone else who is doing install/delete/install, and having trouble: https://www.esp32.com/viewtopic.php?f=2&t=10995&p=44960
@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.
I think following should do. The reset reason in this case is
ESP_RST_SW. Should I make a PR?
Sure, go ahead, thanks! I forgot to do this before handing the sleep code back to @tannewt.
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)
Where should corrections to circuitpython.org be directed? Noticed that Saola wrover and wroom don't come up with the wi-fi filter.
The features column seems to be missing from the table.
I can try out out on those ports sometime today. I'll make note of my findings here.
@crimson ferry the repo for circuitpython.org is here: https://github.com/adafruit/circuitpython-org I would think an issue or PR there would be good. though I'm not actually sure how or where the filtering is implemented.
oh, I see microDev linked to that repo already
This PR fixes issue #3750.
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.OFFwould turn off all resets into safe mode, including brownout. This might be sufficient.BROWNOUT_SAFEMODE.OFFwould 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...
is there a reason why rotaryio is disabled on samd21, or is this just to save space?
@stuck elbow it's not disabled, according to the features lists on circuitpython.org
which board?
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 ...
@tulip sleet I'm looking at the message in the box at https://circuitpython.readthedocs.io/en/6.0.x/shared-bindings/rotaryio/index.html
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
@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
I'm confused about why this is happening, based on reading the code. I thought perhaps the new native implementation was faster. You could try adding some short delays in various places in the driver .py file. I wish I had one of these to test, or something that exhibits similar behavior.
It seems that this warning no longer applies.
thanks @analog bridge & @lone axle , it didn't occur to me that filtering would grab from the .md files
I think it's fine to remove this special-case notice. There are plenty of other modules that fall into this category, so I don't think we need to call it out any more. Reopening.
@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?
@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. )
@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.
Not sure either. One thing to consider is if we’ll add other memory accessors
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.
Ya I think it was memoryio
For a 6269 byte code.py file, would that be expected to cause two reloads when copied onto a PyPortal running 6.0.0?
it depends on how your host os writes to the filesystem
Don't remember nRF52840 boards doing that but perhaps I just wasn't paying attention. I'll ignore it for now.
I do want to note that the IDF includes this comment in the
gpio_reset_pinimplementation:
//for powersave reasons, the GPIO should not be floating, select pullupSo 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...
What should GPIO do when a processor is put into sleep mode? Doesn't that depend on what's attached to it for outputs?
I'd rather not have special files that indicate a setting. boot.py is really for settings.
I'm ok having a safemode.py though. We'd just have to caveat it with a bunch of warnings.
@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)
Sounds good, I don't need to do that, I'm just thinking ahead
@onyx hinge I did run across a modern bitmap font format someone made but I can't remember where I saw it
There's Joey's
He has a circuitpython module for our and everything, but I'm not sure how flexible it is
on esp32s2... is it possible to reset to uf2 bootloder from software?
we haven't added it yet I don't think
@onyx hinge bingo: https://gitlab.com/bztsrc/scalable-font2
It would be nice if the bitmap font supported antiquated too
that's what I'm thinking of
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();
}
currently common-hal/microcontroller/__init__.c common_hal_mcu_on_next_reset() only implements safe mode.
I think that's where I should place APP_REQUEST_UF2_RESET_HINT
if uf2 is not available on the board then reset reason would be UNKNOWN...
Many thanks MakerMelissa and all the AdaFolks!
can we somehow check if the uf2 bootloader is present on device
maybe read particular portion of the uf2 partition
@timber mango let's move here
yep
i can do that i mu right?
I don't think so. what OS are you on?
windows 10
yes
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...
Uses the IDF's reset reason. Does nothing before reset.
Fixes #3389
do you see other messages on the serial to usb output?
only what my code is printing
there should be a second serial with debug messages
coming from the usb connector on the saola board itself
Ok, thanks for the images! I'm not sure what the issue is and am not sure when we'll have time to look at it. Let me know if you'd like to help debug it. I'm happy to give pointers.
can you copy the backtrace line and paste it here? I can make sense of it with a script
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
hah
/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/....
sure
thanks! @tulip sleet or @ionic elk would be good folks to hunt down the issue
would be nice to be able to check the bootloader version from CP too INFO_UF2.TXT
@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
@ionic elk I think it's a failed assert. the top line in the screenshot says abort
@slender iron ah yeah I missed the screenshot
the code wont format properly in the comment
you can just post it and we can have a crack at it
nvm ill just make a pastebin
sometimes markdown likes some extra space between style elements
you can attach files on github too
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.
it wasnt supported apparently
@slender iron should I look at pr 3807 yet?
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
how fast are these issues usually fixed?
@timber mango what board are you using? I'm working on it now.
esp32-s2-saola-1
wroom or wrover?
wroom
@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?
Seems very clean, and I like the renaming to make things clearer. The logic in main.c looks good to me.
The number of neopixels could be a #define also.
board_reset_user_neopixels(USER_NEOPIXELS_PIN, 10);
board_reset_user_neopixels(USER_NEOPIXELS_PIN, 10);
@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?
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
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)
@ionic elk is seems to happen even with only print(get_voltage(ldr1), get_voltage(ldr2)) in the main while loop
@lone axle Ping.
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?
yep, is it printing too fast?
It should print very fast but it doesn't crash for me
you have the same board?
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.
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...
@idle owl I'm around now for a bit.
@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 ^
@ionic elk I didn't replicate it. I just built the firmware
I'm so far unable to replicate the crash on the Wroom or Wrover Saola 1 boards, with DEBUG on or off.
what do you each have hooked to IO3?
It's just floating
hrm, weird!
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
may be the bootloader you have installed
staying up a little late today... I am also unable to replicate this.
I am happy to help debuging this issue.
What interests me most, how is the DAC initialized and in which mode it is operated. Is this software part of open source?
As a check, I had run this code, The waveform looks ok.
analog_out = AnalogOut(board.A0)
while True:
for i in range(0, 65535, 64):
analog_out.value = i
Maybe the DAC is not operated in ...
they share the same datasheet
yeah I'd just landed on that same paragraph
@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
I wanted to use Debouncer with touchio input. So I went to the learn guide: https://learn.adafruit.com/debouncer-library-python-circuitpython-buttons-sensors/advanced-debouncing But maybe that part...
Awesome! Yes, it is all open source.
AnalogOut is not DMA'd and the source is here: https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/common-hal/analogio/AnalogOut.c
AudioOut is DMA'd and the source is here: https://github.com/adafruit/circuitpython/blob/main/ports/atmel-samd/common-hal/audioio/AudioOut.c
Build instructions for CircuitPython are here: https://learn.adafruit.com/building-circuitpython
but in the setup, do i have to do anything else than erasing the flash and then flash the circuitpython firmware?
The discord is a good place to chat with us too. https://adafru.it/discord in the #circuitpython channel
@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)
You shouldn't... you're running the firmware that @slender iron gave you, right?
@idle owl Yep, i can work on updating that guide to show the newer easier way to do that.
@tulip sleet I meant to remove USER_NEOPIXELS_PIN because it's only used in one place
@lone axle That would be amazing. Can you comment on the issue that you'll be looking into it?
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
oho, wait, I think I just got it
:O
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
@lone axle Greatly appreciated!
@tulip sleet but we don't use it anywhere else
must be
it only shows up after a while
yes ^
like it runs for a good 5s or more and then fails, is that what you have?
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
which code
the sketch I posted earlier. Maybe it'll happen earlier if I use yours
No, same deal, runs for ~5s and then dies
re-tested.... crashes for me too...
@tulip sleet I tend to like things factored out as needed. a define's impact can be unclear
huh. Did you also have to upgrade @analog bridge ?
I am on latest main.
because it definitely wasn't happening for my builds on a7ec4a048
which is only like, a day or two old
which version were you using where it worked
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.
Since it's only used here, I'd rather have it be inline. If we need it in more places, then we can factor it out. (Same with the pin define.)
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
twitch is in sync!
@ionic elk when youre back from your walk :)
Ok, un-drafted. I think all boards should build now. I've addressed your feedback too.
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.
I've tested this with code that uses both i2c peripherals, one with two i2c devices on it. I can interrupt the code with CTRL-C, continue with CTRL-D with no apparent issues. At the same time wifi is pinging some internet address. Also editing code and saving works as expected. I do not know if leaving the wifi driver always installed has any power and deep sleep issues.
this doesn't work in CPY but works in esp-idf... I am puzzled... 🤔
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
@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
lol, now i know. let me try again.
@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
I think it's memory corruption caused by the calloc. @tulip sleet was asking me about that.
is there a working version available yet?
@timber mango you can upload .bin files, right?
My implementation of the ADC in AnalogIn brought in a calloc from the example code in the IDF that isn't necessary and may have been causing memory corruption. Removing it resolves #3809 on my Saola 1 (Wroom).
Oh whoops forgot to take that out haha
👍
you think you could remove the ADC idx though xD
yeah sorry I got a compiler error and had to start over, it's still building
npnp
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)
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.
Bin
@timber mango new bin
Thanks
@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.)
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
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.
nina is the ESP32SPI firmware, it has an analog read function much like Espressif's example code
(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
I thought I did that, will now go back and make sure 🙂
watching batteries charge is worse than watching paint dry
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)
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
#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...
I'm wondering if its so you can log through a circuitpython reset from modules internal to circuitpython. The native esp logging facility sends everything out here
@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.
in case someone wants to test and fix my pin alarm code overnight: https://github.com/tannewt/circuitpython/tree/pin_alarm
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...
The other changes look great. I just am suggesting reducing NO_OF_SAMPLES to speed things up.
I discussed this choice of averaging 64 samples with @ladyada, and we thought we could reduce this to 2 instead of 64. I did some instrumentation and all 64 values were fairly close; there's not a lot of need to average so many samples.
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.
No, it won’t because the ESP32 does not have the native usb support the ESP32-S2 adds.
@slender iron following up on our previous secrets conversation. I wonder if you’ve seen this MP “environment variable”-like library. https://github.com/ShenTengTu/micropython-env
This PR implements CircuitPython OTA update!
Port(s) supported: (as of this PR)
- esp32s2
To-do:
- [ ] Error message clean-up.
- [ ] Finalize
OTAmodule and add docs. - [ ] Add ability to flash in continuous/discontinuous chunks.
Note: more info leading to this PR can be found at issue #3777.
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?
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
The following code when implemented in esp-idf works fine but doesn't in CPY.
Code Reference: TinyUF2 docs.
(void) esp_reset_reason();
esp_reset_reason_set_hint(0x11F2);
I am working on adding reset-to-uf2 bootloader from cpy.
esp_reset_reason_set_hint()setsRTC_RESET_CAUSE_REGwhich is used by TinyUF2 to determine if reset-to-uf2 was requested.- I can confirm that
RTC_RESET_CAUSE_REGis...
@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.
My OS is Win10
@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.
There is discussion of these delayed writes here: https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code#editing-code-2977443-16
@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
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?
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
I'm confused, which products is it: https://www.adafruit.com/product/4352 and/or https://www.adafruit.com/product/3938
We've upgraded our popular 4x4 Trellis Keypad kit with a super-specifically-laser-cut enclosure that turns your 4x4 'Trellis into a handheld Feather M4 Express-powered ...
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
tiling neotrellis with a trellis m4 controller
I made a custom case based off the trellis m4 kit but
Powering that from a laptop port is going to be problematic
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?
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!
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
Great! they are really bright and power-consuming without toning them down
S&T would be great!
@brazen cedar neat mash up of m4 neo with the trellis boards
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.
@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.
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().
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'
@hollow gazelle if this is easily reproducible, please file an issue
I saw this today... I am unable to remember how I fixed this... maybe just a power-cycle.
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
I'm not sure. You'll have to see what works.
This isn't intentional. I think we'll want to guard that with #ifdef DEBUG because that's when we enable UART logging for the IDF.
@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)
That seems reasonable. If you explicitly turn on DEBUG logging, don't allow Python to "steal" the UART, but otherwise allow it.
@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
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.
@simple pulsar https://github.com/adafruit/circuitpython/issues/2082
not reproduceable, updated libraries ( including an issue where I had an old .py, and a new .mpy in a library - haven't dug into the logic of how CP chooses which code to use )
.py overrides a .mpy of the same name, and check sys.path, because the current directory is searched before /lib
Thanks, I just wanted something to show Pimoroni if they query this.
@tulip sleet I haven't thought about it yet. you are ahead of me
I did an erase of the QSPI and that sped things up
goes grocery shopping
This has broken:
- https://github.com/pimoroni/circuitpython_adapter/blob/15751dcdce546a5382d442ebf344742adf76f9eb/library/circuitpython_adapter/__init__.py#L36..L46 - I'll discuss this with the Pirates
- and possibly https://github.com/adafruit/glitterpos which is rather unusual in having old copies of libraries in
lib- I put feedback in Guide system to check this.
The 6.0.x docs for I2C.writeto() still appear to list the stop argument. Am I looking at the correct docs? https://circuitpython.readthedocs.io/en/6.0.x/shared-bindings/busio/index.html?highlight=i2c write#busio.I2C
@simple pulsar that is a doc bug; the actual routine no longer takes stop
@idle owl Did this issue ever go anywhere? https://github.com/arofarn/NeoTrellisM4/issues/1 If not I can take it over if you wouldn't mind clueing me in on what needs to happen.
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
@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.
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
@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.
yes I do
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.
ok sounds good this will keep me busy for a while
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.
ok will do 🙂
CI failures are due to network issues. Looks good.
Just need more details in the comments. Otherwise the simple API looks good! Thanks!
Please explain where this flashes and when the new code is used (after reset I assume.)
Please also include a stub for the flash method. That way it can be autocompleted.
Changed incorrect product manufacturer and description. Added links for Arduino support and Docs.
@tulip sleet Can this be closed for now? https://github.com/adafruit/Adafruit_CircuitPython_HID/pull/54
@idle owl yes
Ok thanks.
Thanks for updating. I think I added this originally because that's all the info I could find. :) Current product photo is an official one taken by Adafruit.
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.
@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) },
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
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 🙂
sounds fun!
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.
Nevermind, I'll just live on happy with the fix that Bruce put together 🙂
lol, I did spend a lot of time doing all the same stuff. And thinking the same. The i2c code underneath is not super complex so should work. I keep thinking that the wifi code is the issue. it is rather huge. This works for now.
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. 🙂
@mightyohm is having trouble with beta.2 on a feather s2. Could someone retest please? Thanks!
Nevermind. It was a realterm issue on Windows.
@thorny jay I pinned this week's message. thanks!
I'm having the same issue with the feather m4 express
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.
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?
Yes, you can store different types in lists and dictionaries
So [1, 2, "hello"] is valid.
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,
...
Does anyone know if its possible to send a signal from one CircuitPlayground Bluefruit to another and vice versa?
I think you can use BLE UART
@dark shore (because nearly 2hours after)
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
@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.)
How do I create a debug build for esp32s2?
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 🙂
I did... but no success... are there levels of debug ?
let me do a retry...
nope
Are you connected "only" via USB?
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 🙂
thanks for the prompt replies @hearty tapir 🙂
following did the trick...
make clean BOARD=...
make DEBUG=1 BOARD=...
Thanks for the tip! Will give it a try 🙂
@analog bridge if you are not already using them, the ESP_LOGI() and related macros are handy.
enabled by DEBUG=1
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 ?
@analog bridge no REQUIRED and no KWARG_ONLY (or similar)
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} },
};
that looks right to me
I get TypeError: 'a' argument required on my.api(1)
and TypeError: function missing 1 required positional arguments on my.api(a=1)
I'm not sure you can do required but maybe positional
I checked wifi.radio.connect implementation which is similar and that works fine
does it allow the kwarg at all?
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
¯_(ツ)_/¯
what is your actual api? generally requiring kwarg makes uses more readable
its for ota.flash(buffer, offset)
and what doesn't work?
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} },
};
so ota.flash(buffer, offset=0) doesn't?
the function macro has a minimum positional count too
yes... along with ota.flash(buffer) doesn't work
what's the error?
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)
still have this line? https://github.com/adafruit/circuitpython/pull/3812/files#diff-b7ab73ee9037d22602617fc5b5ddf52bb038071efc76ee55b80fe4f61598d9ecR40
no.. its OBJ_KW
I don't think it's the allowed args check that you're hitting
so the 1 on that line says it must be given one positional argument
(usually there for self on methods)
oh I see...
#define MP_DEFINE_CONST_FUN_OBJ_KW(obj_name, n_args_min, fun_name)
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?...
@tulip sleet do you remember the fix for missing python on ubuntu? https://forums.adafruit.com/viewtopic.php?f=60&t=172754
@slender iron I answered in the thread sudo apt install python-is-python3
thanks!
@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?
I think you do want it. you just want 0 min args
because allowed_args will validate later
still getting errors with 0 min args... they are different though...
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
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)
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
@slender iron looks like I need a Deep Dive for this... do you have one already?
not that I can remember
I watched one where you explained displayio... I might do a re-watch. 🙂
heh, ya
Is this chat the preview for the stream tomorrow? 😄
that's giving me too much planning credit
thanks again... this resolved all my issues...
np 🙂
This was mistakenly changed in master instead of main.
Most of this was already done in the past, but there were a few more.
@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)
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...
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?
what is the name for technique of having two flash spots? dual bank?
selfupdate maybe?
dual bank is typical, i think
one plus for ota is that it is relatable and that the module will mostly be used for over-the-air updates.
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.
also if someone is interested ota module can be extended to nRF port which can be updated over BLE
I think you need more
//|
Thanks, did that!
Now CI is not running: "Workflow runs completed with no jobs"
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.
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.
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
Here is a video about the waveform counting from 1000 to 65535
https://www.dropbox.com/s/9r620vbzrwsiiid/MAH01524_2.mp4?dl=0
@brazen cedar the .count is returning the number of keys. It's here: https://github.com/adafruit/Adafruit_CircuitPython_seesaw/blob/master/adafruit_seesaw/keypad.py#L104
It shouldn't take that much time, but I don't think it will vary over time (does it?). So you could just retrieve that value once for each ntrel object and save it somewhere.
I was going to port my MicroPython library for the Seeed Chainable RGB LEDs (P9813 driver) to CircuitPython, but guess what?
https://github.com/mcauser/micropython-p9813
... It's DotStar compatible!
That means I can use all of the existing helper libraries, such as adafruit_led_animation 💥
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 ? )
@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.
- Added
alarm.sleep_memory, which is a bytearray-like object (similar tomicrocontroller.nvm) that can store state between deep sleeps. Implemented only on ESP32-S2, in the RTC slow memory. - Added setting
alarm.wake_alarmboth 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...
I am getting a CI error... librsvg2-bin fetch fails with a 404 Not Found error
https://github.com/microDev1/circuitpython/runs/1537007221#step:7:113
me too, I'm just trying a re-run; seems to something wrong with the azure ubuntu package archive
@tulip sleet re-run didn't work for me... I have tried close to 5 times...
I think we need to complain to github
the first time I got it was 6 hours ago... since then I have retried at different intervals
i'm writing up the contact form to github
i will try adding an sudo apt get update before the apt-get install
first
maybe also a fix-missing
not sure i want to do that first thing, becuase it may cause a secondary error
@analog bridge it's proceeding now
GitHub Actions was failing trying to fetch an Ubuntu package. Added sudo apt-get update before the apt-get install fixed the problem. Noticed simultaneously by @microDev1.
@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?
@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?
at the moment a pre-compiled ULP program is taken as a buffer
do you feel 4kB is plenty big for a ULP program?
the idea was to give you the lower half
using ulp_load_binary to put it into the ram
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
I think ulp only has access to the slow_mem_region
right, but I'm using the upper half of slow for SleepMemory
I'll get back to you in a while... its dinner time 🍽️
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
won't it add to the size of the new code considerably?
a whole module just to keep a few names in it
@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.
ok I am back now
sure I'll go with that naming
I haven't encountered ulp on any other platform except esp
@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.
I'll start writing some test programs to see how large they turn out.
One advantage of sharing slow_mem is that the ulp will be able to read data stored there.
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.
@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 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)
🙂
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
That's kinda surprising considering the lpc line is highly regarded. I haven't yet started using the imx stuff, though.
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
😔
It might be the EVKs in particular. I should give Arturo's feather a shot and see if it's less painful
@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?
@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
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 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
Ya, later today
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?
11am pacific?
Sure, I'll ping you then
Kk
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.
@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
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
yup
that title definitely looks related
@sour lynx yup, looks like that did the trick
Alright, i'll ping the maintainer of this part to get it merged into master soon.
looks like pins hold in that case too. I don't think it's holding when light sleeping based on time alone
It is already fixed in release/v4.2: https://github.com/espressif/esp-idf/commit/62aade0671e440472e4dc39a0684a5a4a4de7ef1
do you think we should be using 4.2?
at some point I feel like we should switch to a specific release
Speaking as a wireless-guy, 4.2 would be much appreciated 😄
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.
we don't have an api for usb host yet anyway
however if there is enough demand we might backport that to v4.2.
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
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.
The light sleep fix is actually in master, my bad: https://github.com/espressif/esp-idf/commit/5ad2ec79fd2cdb1c923c0232802beb1291fe1df4
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
@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?
@hearty tapir I don't think it's merged into the idf yet at all
it has been merged into master, not synced to Github yet.
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."
This allows CircuitPython on ESP32S2 to successfully connect to io.adafruit.com, like standard browsers and desktop https clients like openssl s_client, curl, and mbedtls ssl_client2. This problem...
If you need the TLS fix in release/v4.2, please mention it on the PR...
@sour lynx what would you recommend we follow?
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.
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
@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?
@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.
ya, I'll switch main to a different submodule source for the idf
What is the name of the "reserve RTC fast memory" flag? I have not found that particular flag. There is a flag about whether or not to use the fast mem as heeap
Ok, I'm happy to try/test if this is is any help.
thanks! I'll do it with my light sleep PR I want to get out today
@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
It looks like CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC
Reserve RTC FAST memory for custom purposes is the name. Its in bootloader config.
@onyx hinge I think I'll switch us to an adafruit fork of the idf
it'll be release/4.2 plus your patch
@slender iron that's fine -- being an adafruit fork is much better than being my personal fork!
ya, I'd feel bad pushing to your fork 🙂
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.
I can do it since I need it for light sleep
Much appreciated, thank you!
np
@analog bridge thanks, is there an issue that it's only available from one CPU? We have CONFIG_FREERTOS_UNICORE=y
I think that is for esp32 not s2
thanks for all of your help @sour lynx
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
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)
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
I agree, if you only need to preserve data over deep sleep, RTC_SLOW or RTC_FAST is better.
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.
I am running 4kB for ULP with CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM enabled
aha, I see, that is for the linker sections
ok, https://github.com/adafruit/esp-idf has a circuitpython branch that we should have match what we're using in circuitpython
are you reserving RTC memory by placing an array there with RTC_SLOW attribute, or just dereferencing its absolute address?
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.
That config will redirect RTC_DATA_ATTR labelled variables into RTC_FAST.
or can i force using the slow section?
If you don't enable CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM, then RTC_DATA_ATTR labelled variables will be in RTC_SLOW memory.
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?
There's also RTC_SLOW_ATTR if you prefer: https://github.com/espressif/esp-idf/blob/master/components/xtensa/include/esp_attr.h#L80
However, if you don't specifically care if it is in RTC_FAST or RTC_SLOW, it is better to use RTC_DATA_ATTR since it's more generic.
Not all future chips will have both RTC_FAST and RTC_SLOW, but they will have at least some kind of RTC memory. So RTC_DATA_ATTR will keep working.
If you use the ULP, you can set CONFIG_ESP32S2_ULP_COPROC_RESERVE_MEM to a non-zero value, which will reserve some part of RTC_SLOW memory for it.
this memory will be automatically used by ulp_load function.
ah good; would I also need to turn off CONFIG_ESP32_ALLOW_RTC_FAST_MEM_AS_HEAP?
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.
v good; the allocation and linker map mechanism is more sophisticated than I realized
this is extremely helpful!
thanks!
thanks! @sour lynx for all your help
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.
@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?
If I'm not mistaken, this is due to https://github.com/arduino/nina-fw
(or not?)
Adafruit fork is installed in Airlift products
I had some build errors, before I discovered the "gitsubupdate" command thanks to @tulip sleet 😉 and als spent some time on Google. 🙂
@ionic elk how do you want to chat?
The build wasn't running due to the merge conflict. I've fixed it so make sure and update your local copy.
I think you'll need ... anywhere implementation would have been, such as in a function call.
@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
@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
nice!
mainly focused on eink, but can update whatever else
was thinking next week - if that works for you?
ok...maybe shoot for monday?...may have to chat more than once over course of week
sure
What do you think about renaming this module dualbank?
Should this return a bool to indicate success or failure?
//| def flash(*buffer: ReadableBuffer, offset: int=0) -> None:
yup, np
I'm in amelia
@slender iron I put a patch together to address issue #3811 - any objections if I issue a pull request?
This addresses issue #3811
Same patch for all esp32s2 boards. Tested on featherS2 (see screenshot below).
Python code for test:
import board
import busio
uart = busio.UART(board.TX, board.RX, baudrate=115200)
uart.write(bytes("Test123", "utf8"))

I don't know why CI is sad panda though. Please let me know if I did something wrong.
I don't think we always define DEBUG
oh, I think dan has a fix for this
check his latest pr
I tested first to build with DEBUG=1, then without, then validated with above Python code.
Ok, will have a look
Want to only do this when data has been written to it? You could use an RTC register to track when it's been written.
Just a few comments/questions. Thanks!
Do we need this? I figured alarm.sleep_memory would be None if it's missing.
This has been throwing me off. I expect them to be the same. busio has the same pattern.
Instead of swapping them, set_bytes should take const uint8_t*.
this helped indeed, CI continues just fine and should be done/finished in a few minutes
@hearty tapir I don't see where we define DEBUG on the compilation line
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?
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
Ok, I thought that was what Makefile:120 does
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
enjoy
Without apt-get update, we were getting package fetch failures, starting today. Pulled out this commit from #3816 to get it in more quickly.
I pulled this out into its own PR, to avoid having to wait for the other PR.
@tannewt please check if my changes in the Makefile are valid. It works as expected, thanks for the due-dilligence. I didn't realise that the debug was enabled/disabled via sdkconfig files and DEBUG=1 on make command didn't set the CFLAG.

I hope this makes this a valid and complete pr now. 🙂
Not that my review makes any difference, but this worked perfectly fine for me! Build CI was happy afterwards. Thank you! :)
fyi digikey have the nordic ppk2 kit back in stock. for now 🙂
👍
Nope. Only switches to next_update partition.
dualbank no doubt better explains the general module functionality but I find OTA to be a more widely used term.
Raising an error at the moment.
is there a way to do timezones in CP? like have time.localtime(UNIX_EPOCH) return in local tz instead of GMT?
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
This fixes issue #3663
I started by reproducing the issue with some additional debug logs:

.. followed by a build with the fix and debug logs still enabled:

and here is the fix of the PR that just carries the fix, minus the extra debug logs:
 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
we don't seem to have the tm_zone attribute that was added to struct_time in python3.3
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.
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.
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...
@tulip sleet I have started work on ULP alarm. The changes are in my ulp-s2 branch. https://github.com/adafruit/circuitpython/compare/main...microDev1:ulp-s2
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?
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
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.
@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.
pin dfinitions are here: https://github.com/adafruit/circuitpython/blob/main/ports/stm/boards/stm32f4_discovery/pins.c
@tulip sleet this might be of interest https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-guides/ulp-risc-v.html#accessing-the-ulp-risc-v-program-variables
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
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.
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.)
yes, that is the case
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.
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
I don't think a separate compilation is possible. I am currently compiling the ulp code with ulp_riscv_example
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
I don't think I am conflicting with that... the ulp alarm implementation is pretty simple.
👍 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".
all thanks to your efforts with sleep api... everything is nice and straightforward
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
on to doing the naming change...
interesting...
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 🙂
@tidal kiln I wrote some code that may help with time zones -- https://emergent.unpythonic.net/01595021837 I am also aware of cgrover's https://github.com/CedarGroveStudios/Unit_Converter/blob/master/cedargrove_unit_converter/chronos.py
For my clock, I want automatic handling of Daylight Saving Time. However,
CircuitPython doesn't build in any distinction between local and UTC time, and
fitting in the entire Python3 datetime modul…
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.