#circuitpython-dev

1 messages ยท Page 344 of 1

slender iron
#

the python file in tools can help

ionic elk
#

@slender iron got a sec today to talk sockets?

slender iron
#

later yes. not now

ionic elk
#

๐Ÿ‘

manic glacierBOT
#

Since we've eliminated the obvious on our end and at weblate, I've submitted a github ticket--I don't think it is viewable by the public but it is "Pull request displaying incorrectly #946332" and the link that works for me is https://support.github.com/ticket/personal/0/946332

In certain PRs, we get a different (incorrect) view of the changes in the PR, compared to on the git commandline.

One such PR is https://github.com/adafruit/circuitpython/pull/3792

It shows commits s...

manic glacierBOT
#

I might be inclined to work on this a bit if I can't easily satisfy my use case with a hackier system, so I'd love to collect some more thoughts about how this could/should work.

In my mind I've got two clear use cases: 1) something like image transfer, where a device with a camera needs to backhaul a small .jpg or something for processing on a gateway. 2) (my current need) in-the-field live firmware update. A gateway advertises some kind of FW update service where a device with a lower ve...

mild fog
#

CircuitPython for prototyping has been off the charts fantastic. I really cant offer enough gratitude for how great it's been to work on adafruit feather hardware and to use circuitPython to bring it all together. I'm curious though, if I were able to take my prototype that consists of, say a feather and a few feather wings, but I wanted to reduce costs and make a specific PCB with just the components I need, could I still use circuitPython provided that the components chosen were the same as the components needed from the feather boards? Are there any difficult problems with making the jump to more custom boards while trying to stay in the CP world?

#

(other than the problem of designing and sourcing said board)

fathom shell
# mild fog CircuitPython for prototyping has been off the charts fantastic. I really cant ...

If you want to use a SAMD51 and simplify the process a lot, check this out. When this comes back in stock, it's a pricey way of skipping a lot of steps https://www.adafruit.com/product/4802

mild fog
#

The project is based off of the nRF52840

fathom shell
#

Ah gotcha

manic glacierBOT
slender iron
#

@mild fog you can definitely run CP on a custom board

#

@ionic elk I have a little time now

mild fog
onyx hinge
manic glacierBOT
orchid basinBOT
manic glacierBOT
analog bridge
#

@slender iron I have updated the ota PR.

manic glacierBOT
#

Hi,

Now, after many hours of source code readings, trying some debug code, I have to say that I am lost. I never wrote much code in C. Mostly some small Arduino code running the bare metal. But the code base for CircuitPython is using so much wrapper code to have all the boards supported is killing me. Compared to one of my very first software on a C64, printing Mandelbrot fractals on the screen, this is beyond my brain.

Back to the topic

If a RawSample() is played, only the first cy...

manic glacierBOT
inland tusk
#

@slender iron aew you deep diving today

manic glacierBOT
manic glacierBOT
#

I recently experienced that shortly after starting CircuitPython, JTAG debugging on the Kaluga would stop. I think this may be due to #3643, though I didn't bisect it. I can work around it by making the jtag pins never-reset, but I'm not sure if this is the right fix since this (I think) would stop people using them as GPIO in general.

+    common_hal_never_reset_pin(&pin_GPIO39);
+    common_hal_never_reset_pin(&pin_GPIO40);
+    common_hal_never_reset_pin(&pin_GPIO41);
+    commo...
crimson ferry
#

Is anyone else still seeing issues with I2C on ESP32-S2? I get intermittent forever-waits (can ^C) on i2c = board.I2C() after soft reboot using 6.1.0-beta.2-89-gf2204d7d8 on 2020-12-16

manic glacierBOT
#

It's actually sleeping for the correct duration, but after it finishes, it's not displaying a new line + >>> on the REPL.

I noticed this by pressing the down arrow on my keyboard after the sleep duration finished, while it looked like it was locked up ... but it wasn't locked up at all!
It just didn't move down to the next line, ready for the next command.

vivid temple
#

yeah but in some of the videos lady ada was showing a prototype so i wonder if it will still be released or not?

ornate breach
#

All were released

#

Metro ESP32-s2 is currently out of stock

crimson ferry
#

There have been some other very cool prototypes shown #TopSecret but "don't ask", and who knows if or when they'll see the light of day

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Here is the test code I'm using:

import alarm
import alarm.pin
import alarm.time
import time
import neopixel
import board
import digitalio

if alarm.wake_alarm:
    print("awake", alarm.wake_alarm, alarm.wake_alarm.pin)
else:
    print("no wake up alarm")

enable = digitalio.DigitalInOut(board.NEOPIXEL_POWER)
enable.switch_to_output(False)

# Sleep for 5 so USB can start.
time.sleep(5)

pixels = neopixel.NeoPixel(board.NEOPIXEL, 4)
pixels.fill(0x0f0000)

time...
analog bridge
#

@tulip sleet Is there an easy way to disable usb check... (i.e. force deep sleep).

#

when debugging...

hearty tapir
#

@analog bridge I think it was mentioned that the deep sleep is a "fake deep sleep" while you have the REPL active. I believe you'll have to do something through the battery pins to power the board. Scott yesterday showed during the Deep Dive stream how to monitor the power consumption etc, you may find it handy.

analog bridge
#

hi @hearty tapir yes... I know about the fake deep sleep... I am looking for a way to force deep sleep even when on usb.

#

currently working on TouchAlarm implementation...
I am able to get it working if I explicitly call esp_deep_sleep_start() just after I set the alarm... but it doesn't work with existing sleep workflow...

manic glacierBOT
manic glacierBOT
#

@PaintYourDragon Until this PR is merged, it won't appear on S3. You need to get it from the Actions build instead.

How to navigate there: Click the "Checks" tab below the PR title, then click "artifacts", and find the "adafruit-magtag-..." zip near the top of the list.

Direct-er link: https://github.com/adafruit/circuitpython/suites/1687216126/artifacts/31633147

manic glacierBOT
#

HEUREKA!

We have here different problems like wrong signal levels and missing the last value of the array. I noticed that small changes in values are better converted than a jump from 0 tp 65535. Creating an sample array containing several hunderts of 0,65535,0,... I observed that when a level was low the next level was higher than the average max level. Touching the wire of A0 also injected some noise which can be seen on the scope. Energie problem?

Yes. In Circuitpython the max sample...

tulip sleet
# analog bridge <@!329766224093249548> Is there an easy way to disable usb check... (i.e. force ...

I had added such a provision to the original API, but it was too easy to get in a unbreakable boot loop in which USB went away before a looping sleep could get interrupted. This happened the very first time I started debugging sleep, and I had to erase flash completely to get out of the loop.

Are you trying to power via the USB port but have no data? I tested some of the time with a power-only USB cable. I have a switchable one and also one where I have just cut the data leads. Otherwise I also used ESP_LOGI() a lot. Also you could have CircuitPython write to a UART instead of to stdout if you are trying to instrument the CPy program.

#

If you just want to hack it temporarily for debugging, I think it would be sufficient to change this to if(true), in main.c:

                if (!supervisor_workflow_active()) {
                    // Enter true deep sleep. When we wake up we'll be back at the
                    // top of main(), not in this loop.
                    alarm_enter_deep_sleep();
                    // Does not return.
analog bridge
tulip sleet
#

yes, because the GPIO state is reset. We'd want to turn these off anyway even if it wasn't automatic to save the current consumption of those LED's. The power-on LED (not on GPIO) on the MAGTAG has a high-value resistor to minimize its consumption as well, and it's pretty dim as a result.

#

I think in the case of the status NeoPixel that is turned off deliberately, since just disabling the pins that feed it would not turn it off

onyx hinge
#

I think there's a problem with adafruit_bus_device-in-core and bitbangio.I2C. When I try to use this combo on esp32s2, I get a hang; if I hit ctrl-c it becomes a panic error. ```E (44776) i2c: i2c_master_cmd_begin(1113): i2c driver not installed
../../esp-idf/components/freertos/queue.c:719 (xQueueGenericSend)- assert failed!

#

I suspect that the in-core version of adafruit_bus_device assumes the device is a native busio.I2C device but it is not necessarily

tulip sleet
#

the four front-panel neopixels have a transistor for power control

analog bridge
#

is gpio reset called before entering deep sleep?

onyx hinge
#

.. unless anyone has quick words I'm going to file an issue about it ..

tulip sleet
#

i think so, but I'm not sure where.

analog bridge
#

I am asking this because touch pad needs to be initialized before entering deep sleep... if io is reset before entering deep sleep, it will de-initialize touch pad

tulip sleet
#

it may just be a side effect of esp_deep_sleep()

#

i don't see a call to our own reset routines.

onyx hinge
#
True
[11, 112]
>>> bus = bitbangio.I2C(board.IO10, board.IO11); bus.try_lock(); bus.scan(); bus.deinit()
True
[]
``` though .. bypassing `adafruit_bus_device` bitbangio.I2C sees only an empty bus ๐Ÿ˜ฆ
manic glacierBOT
tulip sleet
#

there is a call to board_deinit(), before both fake and real deep sleep, but that routine is empty on most boards. On the magtag it deinits the eink display

analog bridge
#

if I explicitly call esp_deep_sleep_start() just after setting the alarm... it works

tulip sleet
#

quoting from the esp doc:

In deep sleep mode, CPUs, most of the RAM, and all the digital peripherals which are clocked from APB_CLK are powered off. The only parts of the chip which can still be powered on are: RTC controller, RTC peripherals (including ULP coprocessor), and RTC memories (slow and fast).
One thing we may want to handle:
Some ESP32-S2 IOs have internal pullups or pulldowns, which are enabled by default. If an external circuit drives this pin in deep sleep mode, current consumption may increase due to current flowing through these pullups and pulldowns.

To isolate a pin, preventing extra current draw, call rtc_gpio_isolate() function.

For example, on ESP32-WROVER module, GPIO12 is pulled up externally. GPIO12 also has an internal pulldown in the ESP32 chip. This means that in deep sleep, some current will flow through these external and internal resistors, increasing deep sleep current above the minimal possible value. Add the following code before esp_deep_sleep_start() to remove this extra current:

rtc_gpio_isolate(GPIO_NUM_12);

analog bridge
#

for touch_alarm to work esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); needs to be called

tulip sleet
#

so you are calling esp_sleep_enable_touchpad_wakeup(void) ?

analog bridge
tulip sleet
#

you may want to take a look at Scott's PR for pin alarms, which is not merged yet. It mostly works but has some issues, but I think pin alarms and touch alarms are going to be very similar

#

the esp_sleep_pd_config() may happen automatically, similar to using rtc fast mem. It may record that you need that when you do esp_sleep_enable_touchpad_wakeup()

analog bridge
#

I tested this but not doing automatically in case of touch

manic glacierBOT
#

On the Kaluga, I have two sensors attached to the I2C bus at IO10/11. They are detected if I scan with busio.I2C but not with bitbangio.I2C. When I scope bitbangio, there is literally no activity on the pins 10/11; there is the expected activity with busio.I2C.

>>> import board,bitbangio
>>> bus = bitbangio.I2C(board.IO10, board.IO11); bus.try_lock(); bus.scan(); bus.deinit()
True
[]
>>> import busio, board
>>> bus = busio.I2C(board.IO10, board.IO11); bus.try_lock(); bus.scan()...
analog bridge
#

I did some more tests now with forced deep-sleep enabled...
there's definitely something between setting up touch-pads and starting deep sleep which is causing touch-pad to de-initialize

tulip sleet
#

the sleep doc is not very clear about how to set up the touch pads. is there an example of deep sleep touch you are using as reference? i thought it would be quite different than regular touch, considering how the pin level checking is also different (only certain pins, etc.)

analog bridge
#

the basic touchpad initialization is same for normal as well as sleep... some extra parameters need to be dialed in for sleep

#

there is more info about that on the touchpad page instead of sleep_modes page

blissful pollen
#

@onyx hinge So looks like its an bitbangio.I2C issue not the bus device? I can look at the bus device if you think that's the problem, but may take me a couple days

onyx hinge
#

I think there are multiple problems going on. I would appreciate if you can take a look at bitbangio.I2C + built-in busdevice, that would be helpful

#

you can probably do it on whichever micro is convenient for you

blissful pollen
#

Sure never played with the bitbangio before, so totally possibly I didn't account for something

manic glacierBOT
#

Running the following sequence twice in the same REPL causes CircuitPython to reset (not into safe mode, just a "normal" reset!)

Tested on a kaluga with DEBUG=1 at f2204d7d8

(tio is my terminal program)

import busio, board; bus = busio.I2C(board.IO10, board.IO11); bus.try_lock(); bus.scan(); bus.deinit()
True
[11, 112]
>>> import busio, board; bus = busio.I2C(board.IO10, board.IO11); bus.try_lock(); bus.scan(); bus.deinit()
True

[tio 10:05:07] Disconnected
[tio 10:05:41]...
tulip sleet
#

@analog bridge ah, I see where the reset is is happening, I think, it's in cleanup_after_vm() in main.c, which calls many reset routines. That gets called when code.py finishes running.

Scott's pin alarm code may defer setting up the alarms until after the program has stopped running, to get around this, or else he prevents reset on certain pains, but I think the former is more likely.

#

so I'd take the lead from his code

thorny jay
#

The 32blit kickstarter (from Pimoroni) is reaching the backer. Any CircuitPythonista have one? That is an STM32 board possibly supported by CP already.

analog bridge
tulip sleet
#

yes, it does call reset_port()

#

so that would prevent messing up those pins before going into deep sleep (my quick surmise)

analog bridge
#

๐Ÿ‘ @tulip sleet thanks again for bug-fixing

tulip sleet
#

what bug did i fix? ๐Ÿ™‚

analog bridge
#

ok... for clearing things up

tulip sleet
#

ah ๐Ÿ˜‰

tropic rain
#

What is the proper way to report a bug? Here or github?

tulip sleet
#

github is best; if you're not sure you can ask here first, but github is a much better to-do list

#

thanks!

manic glacierBOT
tulip sleet
#

@tropic rain which board are you using that doesn't have json?

#

and what version of CPy/

tropic rain
#

Circuit Playground Express. I'm trying to show images on the TFT Gizmo. boot.out.txt is
Adafruit CircuitPython 6.0.0 on 2020-11-16; Adafruit CircuitPlayground Express with displayio with samd21g18
and I'm using libraries fro adafruit-circuitpython-bundle-6.x-mpy-20201216

tulip sleet
tropic rain
#

Thanks, I'll give it a go.

manic glacierBOT
#

Somehow, this IS due to adafruit_bus_device-in-core. I substituted the old Python-coded one by trickery. I copied it to a folder old_bus_device so that I could use the following sequence in the repl:

>>> import old_bus_device
>>> import sys
>>> sys.modules['adafruit_bus_device'] = old_bus_device
>>> import adafruit_bus_device
>>> adafruit_bus_device
<module 'old_bus_device' from '/lib/old_bus_device/__init__.py'>
>>> import 
>>> import board, busio, adafruit_lc709203f; bu...
#

Testing performed: on esp32s2 kaluga with LC709203 sensor on the pins shown below, use the repl to check the cell voltage:

>>> import board, busio, adafruit_lc709203f; bus = busio.I2C(board.IO10, board.IO11); dev = adafruit_lc709203f.LC709023F(bus); print(dev.cell_voltage)
3.807

(this bug is not esp32s2 specific and was reported to affect other ports as well, but the LC7โ€ฆ sensor is sensitive to this bug in a way other sensors apparently are not)

Closes #3795

manic glacierBOT
#

I changed the code in \circuitpython\ports\atmel-samd\common-hal\audioio\AudioOut.c

starting at line 189

if (channel0_enabled) {
        #ifdef SAMD21
        DAC->EVCTRL.reg |= DAC_EVCTRL_STARTEI;
        // We disable the voltage pump because we always run at 3.3v.
        DAC->CTRLB.reg = DAC_CTRLB_REFSEL_AVCC |
                         DAC_CTRLB_LEFTADJ |
                         DAC_CTRLB_EOEN |
                         DAC_CTRLB_VPD;
        #endif
        #ifdef S...
idle wharf
#

I worked on a fix for Circup so it would automatically update its version from the release tags. Can someone with Library experience have a look at my changes. I don't know how to test this locally. The CI runs clean and I can install my branch and it works fine, but can I test the semver part without merging and attempting a release?

https://github.com/adafruit/circup/pull/46

tropic rain
manic glacierBOT
#

I havenโ€™t been looking closely at my fork. Mostly looking at some Wifi i2c
issues. Iโ€™ll take a look and see what I can do. Thanks

On Fri, Dec 18, 2020 at 12:33 PM xmmpru83 notifications@github.com wrote:

@skieast https://github.com/skieast ur fork is broken. tinyusb
outdated, some mistake on the board.h path as well...
just clone the latest CP, copy those 2 folders of the lily, modify board.c
to point into supervisor/board.h like all other boards.
build flash and go.

โ€”
...

manic glacierBOT
#

i think this board is too fresh.. very unsupported, im not able to make it run..

SPIWP:0xee
mode:DIO, clock div:2
load:0x3ffe6100,len:0x8
load:0x3ffe6108,len:0x17ec
load:0x4004c000,len:0x930
load:0x40050000,len:0x2cc8
entry 0x4004c1b4
ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x7 (TG0WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x4002ec30
0x4002ec30: _xt_highint4 at /root/circuitpython/ports/esp32s2/build-lilygo_ttgo_t8_s2_st7789/esp-idf/../../esp-idf/components...

manic glacierBOT
manic glacierBOT
#
  • Characteristic and descriptor max_lengths can be zero. Fixes #3746.
  • Assure that start_scan() timeout is either zero or >= interval. This is a guess for this fix, but it coincides with working values reported in #3826. Fixes #3826.
  • Assure that start_scan() max timeout is not too large for a uint16_t when passed to nRF SD. Fixes #3340.
  • Fixes small advertising interval values. Fix check and make sure it's at least 0.02001, to allow for rounding issues, as discussed in #2930. F...
timber mango
#

Hey guys im trying to get a python device that runs a simple script and maybe has like a screen on there so I can display messages to show when something finished. Can anyone refer me to a not-sold-out device?

idle wharf
# timber mango Hey guys im trying to get a python device that runs a simple script and maybe ha...

That last link was bad advice...
How about Feather S2 https://www.adafruit.com/product/4769 and one of several Feather Displays. https://www.adafruit.com/?q=feather+display&sort=BestMatch
"at" me in Help-with-projects if you need more ideas.

fathom shell
idle wharf
timber mango
#

I already went with py portal

fathom shell
#

Also thoughts on a pyportal? I think it's overkill now but I suggested it because it has no soldering involved and has a big screen

#

ah right wifi was a req

timber mango
#

So with py portal I can just press a button and it works?

fathom shell
#

how do you mean?

timber mango
#

like is there a button on it that runs the script

fathom shell
#

So with circuitpython your code.py or main.py script runs automatically on bootup until it ends

timber mango
#

oh nice

#

so when does the script start?

#

Isnt there some kind of indicator

fathom shell
#

*after boot not on boot

timber mango
#

wait so I just plug it in, edit the file, and boot it up?

fathom shell
#

When it powers on it boots up and then runs the code in code.py and uses any libs referenced therein. You can load your code and then restart and it will automatically run.

timber mango
#

oh cool so I can use it as long as it has a wifi connection?

fathom shell
#

You should be able to use it without wifi

timber mango
#

I dont need the usb in at all times right?

#

@fathom shell

fathom shell
#

You do for power

strange pike
timber mango
#

So can I just get a portable charger for it @fathom shell

fathom shell
#

you're gonna want to be careful about input voltage, I'd see if you can find a 5V only charger to be safe

manic glacierBOT
manic glacierBOT
#

I think this may be a better solution. The original .tx_power was added when I was not as aware of the many variant ways of controlling tx power. Another place to look is what the bleak-related and Bluetooth HCI interface provide, so we can make this work across other platforms. I think it may not actually be possible to change the power in the ESP32 HCI firmware (I cannot remember at the moment and am away from be able to look this up).

Functions
esp_err_tesp_ble_tx_po...
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

My basic wish is to have second USB-SERIAL device in
ESP32-S2 which will lead to hardware TX/RX lines.

I was thinking - if descriptor must be static, and list all supported
device for which same endpoints have to be shared, then
perhaps on the OS (at least linux) is possible to blacklist unneeded
drivers, so that actually endpoints will be used only by not blacklisted
drivers, and things may work. (at least in heory)

manic glacierBOT
#

This PR adds support for setting a Touch Alarm.

Port(s) supported: (as of this PR)

  • esp32s2

Test Code:

import time
import alarm
import digitalio
from board import *

led = digitalio.DigitalInOut(LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True

time.sleep(5)

print("WakeAlarm :- ", alarm.wake_alarm)
print()

alarm.exit_and_deep_sleep_until_alarms(alarm.touch.TouchAlarm(IO1))
tulip sleet
#

@tough flax asks:

I know that CP's USB stack uses TinyUSB and that TinyUSB supports WebUSB.... but do know if CP can benefit from that code? Can WebUSB talk to the serial port for example?
It can, though I don't know much about it. Here's a sample serial terminal: https://googlechromelabs.github.io/serial-terminal/ (https://github.com/GoogleChromeLabs/serial-terminal). I get a lot of <CONNECT><DISCONNECT>, but I find that if I turn on "Flush on enter", that problem goes away for a while, at the expense of only echoing on "Enter". I'm assuming this can be fixed. We are already using WebUSB as an alternate upload tools for the ESP32-S2 boards: https://learn.adafruit.com/adafruit-metro-esp32-s2/web-serial-esptool. Repo is at https://learn.adafruit.com/adafruit-metro-esp32-s2/web-serial-esptool
@gilded cradle did the upload tool.

analog bridge
#

@tulip sleet alarm.wake_alarm is taking weird values... It takes the value of previously set object. Example in the following case it takes value of <DigitalInOut>

led = digitalio.DigitalInOut(LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True

print("WakeAlarm :-", alarm.wake_alarm)
tulip sleet
#

that is some kind of bug then. It's a static entry in the module dictionary for alarm

#

i will look at that; i added it recently, in a bit of a hurry to make a demo work

#

it was there but unimplemented before that

manic glacierBOT
analog bridge
#

above is with code in PR #3850.
in my local branch... I implemented a way to get alarm.wake_alarm.pin for touch_alarm and now I get the same crash as the one scott is getting with pin_alarm

tulip sleet
#

are you using alarm_set_wake_alarm() and/or alarm_save_wakeup_alarm() in shared-bindings/alarm/__init__.c?

analog bridge
#

I didn't alter that... yes alarm.wake_alarm is using the existing implementation.

tulip sleet
#

I will take a look, something sounds definitely odd.

analog bridge
#

the weird thing is that it works when I do ctrl+c just before print(wake_alarm) in main code and instead use repl to get wake_alarm

tulip sleet
#

ok, I was going to test it in the repl first! ๐Ÿ™‚

#

we have to delay setting alarm.wake_alarm until the VM and heap are set up when the program restarts

#

since it creates an object

analog bridge
#

yes I noticed that while digging into main.c

manic glacierBOT
#

Yes I'd like to have this secondary CDC /dev/ttyACM1
and a possibility to bridge its traffic to external pins TX/RX

it would be practical to run usb-serial bridge in
"background" of esp32 so that more user code
can work too if technologically possible.

On 12/19/20, Dan Halbert notifications@github.com wrote:

I'm not quite sure what you're looking for. We have been thinking about a
secondary CDC serial connection over USB (e.g. you'd have /dev/tty/ACM0
for the REPL connection, and...

kind river
gloomy shuttle
lone axle
manic glacierBOT
#

I've got a MatrixPortal board running CircuitPython which is having some issues. If I connect the board to a PC (or any device that can handle the MatrixPortal's USB serial output), then the board runs fine for extended periods of time. If I hook it up to a charger (or a PC that is sleeping, etc), then the board will eventually hang.

I've run a few experiments and been able to demonstrate that I can get the board out of the hung state by waking the PC it is connected to.

Here's a si...

#

Several of the pin mappings in the pins.c file for the umfeathers2 are not constant with the other feather boards.

Notable are D5,D6,D9,D10 -- many in the "short side".
https://github.com/adafruit/circuitpython/blob/main/ports/esp32s2/boards/unexpectedmaker_feathers2/pins.c#L50

Since it is "feather" it would be nice to keep the names consistent.

Is there some reason why this is not desirable or possible for this board?
I'll be happy to create a PR to rename them if no one objects.

#

Sure. It's not a big deal, but I just put my umfeathers2 into keyboard-feathering and have gotten most of the functions working OK but I had to do a lot of pin remapping that I think could be avoided. Also there is one hard code pin in the featherwing_keyboard library (D6) that won't work as is. Perhaps that should be fixed in the library and passed in as an argument like all the other pins.

I agree that for other boards, it may not be worthwhile, but since the "feather" layout is so comm...

tulip sleet
#

@tough flax I was told we got WebSerial working, but not WebUSB. But I think the demo I posted is WebSerial.

thorny jay
#

Thanks to @tulip sleet sleep memory, I made a kind of booloader for the MagTag. You can choose from 4 usage, hold the corresponding button, turn on the MagTag... and it will start that program at every startup (even after sleep): https://twitter.com/DavidGlaude/status/1340365817138044933?s=20

I made a boot manager for the MagTag by @adafruit to choose between many project from the learn guide.

With a little bit of @CircuitPython in https://t.co/54VinvBcT7 holding a button and turning on select one usage of the connected eInk display.
https://t.co/pTidfyIJnp

manic glacierBOT
#

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

We want to provide run-time choice of the USB devices that CircuitPython presents. That is #1015. Blacklisting might work on Linux, but we want an easier mechanism and one that is OS-independent.

tough flax
#

@tulip sleet I get that WebSerial is easier, but it's still experimental on Chrome (and unavailable elsewhere) so that's kind of a problem... but I will take a look

manic glacierBOT
lone axle
#

@thorny jay That is awesome!

thorny jay
#

Great that you like it.
I wonder if I can do "import table[2]" to put the boot config into a file. Also have another meaning for 0 because that is uninitialised memory value, so a power on without pressing a button.

manic glacierBOT
#

Update: Yesterday I finished my project to the point where I could plug in the battery and let it run overnight sitting on the fridge near the router. It managed to last the night without crashing from a network error.

Today I updated CP to the latest daily build and am still seeing intermittent connection errors from the computer in the back room. Sometimes "unknown error" and sometimes "No network with that ssid". When this happens, I re-save in Mu and it usually works on the first or se...

manic glacierBOT
#

@endico, here is what I needed to do to get the proper retries to work and restart things correctly ( from the christmas countdown for context )

`

create MagTag and connect to network

try:
magtag = MagTag()
magtag.network.connect()
except (ConnectionError, ValueError, RuntimeError) as e:
print("*** MagTag(), Some error occured, retrying! -", e)
# Exit program and restart in 1 seconds.
magtag.exit_and_deep_sleep(1)

`

languid sage
#

HELP!!! is anyone, besides me, trying to install the weather forecast display on the MagTag??? I'm having nothing but grief. I get a note about adafruit_imagload (from line 4 of the code) but adding that library to the lib folder results in other errors. and... OBTW the doc does mention this (not with the list of other libraries, but on a different page), but when I install it from the latest bundle (20201219) all I get is more errors (from line 176). Does this stuff get a QC check???

thorny jay
onyx hinge
#

__import__ is available, the other solutions likely are not.

tulip sleet
lone sandalBOT
manic glacierBOT
#

Hi,

Thanks for your email. Where we can locate the VID/PID for this board?

Thanks

Sharnon

From: 'ladyada' via Engineering engineer@gravitechthai.com
Sent: Sunday, December 20, 2020 12:20 AM
To: adafruit/circuitpython circuitpython@noreply.github.com
Cc: gravitech-engineer engineer@gravitechthai.com; Mention mention@noreply.github.com
Subject: Re: [adafruit/circuitpython] Add Gravitech Cucumber R board definition (#3349)

hihi - from the git history and lack of respons...

thorny jay
#

I am trying to "rate" the MagTag guide based on criteria. The goal is to identify those that could get some love. This is all related to beeing able to put more project on a single MagTag and have a selection button to switch from one usage to another. Here is a read-only version of the document in sharing. Maybe to be discussed "in the weed" (I made it read/write by all to help reading or contribute): https://docs.google.com/spreadsheets/d/1ZBrLID3p-dKbLkJ6x4Uq77l1FHkGS5ZRIoqBoD2kw_w/edit?usp=sharing

ivory oak
#

on circuitpython.org what is the difference between CircuitPython 6.1.0-beta.2 and Absolute Newest? Where is the current Stable release?

feral spoke
#

I'm looking in to some custom built split keyboards and was wondering if anyone knew if I could run CircuitPy on this keyboard with the Elite-C controller?
https://splitkb.com/products/kyria-pcb-kit

splitkb.com

Available, but in limited stock! More will come in by next week. The Kyria is a 40% split keyboard. Its main features are a large and customizable thumb cluster that allows you to move more work from the pinkie finger to the thumb, an aggressive column stagger that allows for a more comfortable hand position, andย two r

jaunty juniper
feral spoke
jaunty juniper
#

that's feathers. Not all feathers support CPY, it runs on a few supported 32 bits chips with enough ram and flash

#

supported boards are listed on circuitpython.org, and any board with a similar chip can probably be added to it (provided the native USB is available on the board)

feral spoke
#

Maybe I should ask a different way. Can I put a CircuitPy boards on that keyboard and manage it with python?

jaunty juniper
#

oh probably

solar whale
#

@jaunty juniper Are you asking if you can enter keystrokes to the REPL from a keyboard attached to a board running CircuitPyhton? I have not seen any examples of that. Has anyone?

jaunty juniper
#

you meant to tag @feral spoke ๐Ÿ˜‰ it's a good point, I might have misunderstood the question

solar whale
#

yes, thanks.

feral spoke
#

@solar whale I just want to use python to customize the firmware of the keyboard vs C and the QMK....but I like the PCB and layout of that board.

solar whale
#

OK -- I guess I misunderstood. Not something I am familiar with. Sorry I can't be of any help.

manic glacierBOT
thorny jay
ionic elk
#

Doesn't somebody make circuitpython powered keyboardy stuff? I can't remember who though.

feral spoke
#

Yes there is a MK60 board out there, but I want to use a diff board, but run python for firmware

idle wharf
#

I hope that helps.

#

(And that it is correct)

manic glacierBOT
thorny jay
#

And I am not official. ๐Ÿ™‚

thorny jay
# ivory oak on circuitpython.org what is the difference between CircuitPython 6.1.0-beta.2 a...

Ok, CircuitPython 6.1.0-beta.2 is one particular chosen Absolute Newest from a few weeks ago. And by it's name, it is a beta release. But it is also the recommended version for MagTag and other ESP32S2 board. Absolute Newest is build every time one PR is accepted. It's name should contain the GitHub hash for that particular change in the code. In addition, when someone propose a PR, artefacts are created and compiled by the CI (and can be retrieved to test that particular build). Cc: @idle wharf

idle wharf
#

@thorny jay nailed it...

#

I only use my esp32s2 boards so I forgot about 6.0 ๐Ÿ˜‰

strange pike
feral spoke
thorny jay
#

This is not Feather size, maybe ItsyBitsy?

#

There are people from Adafruit that build their own keyboard. This may make more sense to them, and there might be a channel for those discussion.

strange pike
#

teensy 4.0 has a circuitpython release, and that's probably closer to the intended form factor

thorny jay
strange pike
#

the nice-nano should work, it's nRF52840-based

thorny jay
#

Good luck finding one...

feral spoke
#

hmm..looks interesting...and it's wireless too ๐Ÿ™‚ What is the chance that @meager fog chimes in on this topic? ๐Ÿ˜‰

hollow kraken
#

Hi here! I'm cross posting a question here that was originally posted on help-with-projects. I'm working on trying to get a low cost switch interface for assistive tech users to plug their audio jack switches into in order to connect to a computer. I've been successful with getting a bluetooth version working using the Itsy Bitsy running circuitpython but when trying to connect the switch using the QT Py via USB/ HID, in the accessibilities setting (Mac 10.1 5) I get the following error: Unsupported switch input. Try a different switch or change the mode of your switch hardware. Is there something in the library settings related to USB connection I can change to have the computer "see" the switch. The keyboard HID works as expected and sends keystrokes without an issue.

feral spoke
#

welp... the nice-nano being 3.3v doesn't support OLED and LEDs on the keyboard. Maybe I just have to wait longer until the interwebs has a good split keyboard design that I can run a python based firmware ๐Ÿ™‚

strange pike
manic glacierBOT
#

I spent a while looking at the assembly code of both the good and bad versions. I don't see an error in the assembly code. It's a bit tricky to read because xtensa uses register windows, which make the registers used for in/out arg passing vary based on the caller or callee, and also based on whether it's a call8, call4, etc. See http://wiki.linux-xtensa.org/index.php/ABI_Interface.

We are debugging https://github.com/adafruit/circuitpython/blob/39233510392107e9087e90757dd96da88b78b0f7...

hearty tapir
#

I'm unlucky with the MagTag ... when I have time and realise that there was a notification email, it is already gone from the shop again. ๐Ÿ™‚

#

I guess that this will not change over the holiday period now, so I'll continue to play with my featherS2 ๐Ÿ™‚

manic glacierBOT
#

If we could set a watchpoint...

@dhalbert You can set a watchpoint from within the program using cpu_hal_set_watchpoint.

https://github.com/espressif/esp-idf/blob/b0150615dff529662772a60dcb57d5b559f480e2/components/hal/include/hal/cpu_hal.h#L101

https://github.com/espressif/esp-idf/blob/b0150615dff529662772a60dcb57d5b559f480e2/components/hal/esp32s2/include/hal/cpu_ll.h#L103

Do I understand right the gist of the issue: you are saving a micropython object in RTC slow memory bef...

crimson ferry
#

I've got a makeshift MagTagAlike with a FeatherS2 and EPD FeatherWing queued up to work on ๐Ÿ™‚

#

Kind of how I used Feather M4 + TFT FeatherWing (and still do) before PyPortals were available

manic glacierBOT
#

This PR adds a few new features to support running a TCP server on the ESP32-S2:

  1. Adds bind, listen and accept, which allow connecting to remote sockets and sending/receiving data from them.
  2. Removes the property that all sockets of type SOCK_STREAM automatically use MbedTLS instead of the LWIP socket API, and makes that decision on the fly based on what functions are used first.
  3. Adds in additional logic to the various send and receive functions to determine when to use TL...
manic glacierBOT
hearty tapir
#

@crimson ferry did you see any Beacon again? ๐Ÿ™‚

hearty tapir
#

It is so disappointing if you theoretrically know what you want to achieve but C has a different agenda ๐Ÿ˜ฆ

#

I'm trying to come up with a workaround for https://github.com/espressif/esp-idf/issues/6267 by checking if the struct member is NULL for &self->ap_info.record.country, but instead it is actually "<null>". I put an "else" in there, to disregard this for now and use esp_wifi_get_country(&self->ap_info.record.country) instead, which appears to work fine - but when I later try to access "self->ap_info.record.country" I have a backtrace. I think that my approach to overwrite that portion with valid data is not that valid.

crimson ferry
#

@hearty tapir I have not seen a Beacon again

hearty tapir
#

I can at least confirm that none happen during a backtrace either ๐Ÿ˜„

#

I saw plenty this night

manic glacierBOT
#

Our board doesnโ€™t have any bootloader in it. There are two USB ports. One connect to the FTDI chip and another one connect directly to the ESP32-S2 OTG port. We can get one if it is necessary for circuitpython to work.

From: 'ladyada' via Engineering engineer@gravitechthai.com
Sent: Monday, December 21, 2020 12:38 AM
To: adafruit/circuitpython circuitpython@noreply.github.com
Cc: gravitech-engineer engineer@gravitechthai.com; Mention mention@noreply.github.com
Subject: Re: ...

crimson ferry
#

FeatherS2 with ESP32S2
6.1.0-beta.2-124-gfd21ff59d on 2020-12-18

import supervisor

time.sleep(5)
print(supervisor.runtime.run_reason)
supervisor.reload()```repeatedly gives```soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
supervisor.RunReason.AUTO_RELOAD
```but expected `supervisor.RunReason.SUPERVISOR_RELOAD`?
crimson ferry
#

Also get AUTO_RELOAD by typing CTRL-D in the REPL (expected REPL_RELOAD)

crimson ferry
#

Pressing the reset button on the Feather S2 gives microcontroller.ResetReason.POWER_ON supervisor.RunReason.AUTO_RELOAD expected STARTUP?

manic glacierBOT
manic glacierBOT
#

@dhalbert You can set a watchpoint from within the program using cpu_hal_set_watchpoint.

Great to know, thanks!

Do I understand right the gist of the issue: you are saving a micropython object in RTC slow memory before sleep, and (at least) one object field has incorrect value after wakeup?

No, it's not that tricky. the object is created after CircuitPython restarts, when the VM and our object heap should be in good shape. We check what kind of event woke us up and then create ...

ivory oak
#

@thorny jay you may have nailed what you answered, but didn't fully answer my question. To the beta description and absolute newest are one in the same. If the magtag is running beta code, I would say its not a production board. Why would something like this get released to the masses on beta code?

jaunty juniper
#

ah you are saying that the MagTag page doesn't have a stable release

ivory oak
#

@jaunty juniper if what @thorny jay said, its running the beta which is not a stable release according to their description and absolute newest also does not sound like the stable release either. So my question is what is the stable release for the Magtag?

thorny jay
#

Sorry, I don't have to deal with this. I do not work for adafruit. Maybe you should wait for working hours in the US and/or contact the support. This is a community and I am an happy customer running the latest 6.1. on my MagTag. I have happily run many of the guide and made my own project with it. Regards.

minor glade
manic glacierBOT
turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

56

Voice Channels

6

Members

26263

Roles

34

ornate breach
#

really growing eh @turbid radish

#

we'll hit 27K in no time ๐Ÿ˜„

turbid radish
#

Yes, that's what I'm monitoring. I must be sure we have the milestone graphics in time for the milestone

ornate breach
#

๐Ÿ™‚

analog bridge
#

@tulip sleet regarding wake_alarm... delaying saving it does seem to work... I have modified the code and now I save the wake_alarm manually from code.

import alarm
alarm.save()
print(alarm.wake_alarm)
#

Is there a callback to know whether or not the heap is configured?

tulip sleet
#

@analog bridge There is bool gc_alloc_possible(void). And the new obj allocator should return NULL if there's no heap. But you should not need to make this decision at run-time. we should be setting that object when the heap is ready. It seems like we're calling all this too soon. I am planning to take a further look today.

manic glacierBOT
tulip sleet
manic glacierBOT
manic glacierBOT
#

the object is created after CircuitPython restarts, when the VM and our object heap should be in good shape.

I ran some tests and found out that delaying the object creation does seem to work.
I am calling alarm_save_wake_alarm() from user code :- https://github.com/adafruit/circuitpython/commit/16a203febe1678fa6845de51ae051d5844f793c3

import alarm
alarm.save()
print(alarm.wake_alarm)

Above delays setting wake_alarm by 90 ms and avoids the crash.
It looks like ...

manic glacierBOT
#

Doing a debug build after the gcc10 PR now fails. The failure can be avoided by removing -flto, but that can cause firmware overflow. It has to do with the inlining.

../../py/vm.c: In function 'mp_execute_bytecode':
../../supervisor/shared/translate.c:125:66: error: inlining failed in call to 'always_inline' 'translate': optimization level attribute mismatch
  125 | inline __attribute__((always_inline)) const compressed_string_t* translate(const char* original) {
      |         ...
onyx hinge
#

<@&356864093652516868> It's about 2.5 hours until the last Circuit Python Weekly of the year -- there's no meeting on the 28th of December. Please add your notes to the document if you can. If you plan to speak, at a minimum we ask that you add your name as a placeholder. If you haven't participated before, ping me to make sure you're a member of the circuitpythonistas role. If you're just listening in (lurking), no need to do anything. Link for the notes doc: https://docs.google.com/document/d/1s3bS3z-5WW_0D5NdlRlKpDB-n_aP6eMbeFvtknM59nA/edit?usp=sharing

turbid radish
#

I will not be at the meeting, I have an appointment

onyx hinge
#

Take care!

manic glacierBOT
manic glacierBOT
#

Adding info from #3833 - storage.remount("/", True) resulting in RuntimeError on 6.1.0-beta.2

When working through this CircuitPython storage example on QT Py M0, running 6.1.0-beta.2, it fails to work properly - the temperature logging file is never created and the filesystem never switches to read-only. Checking boot_out.txt, I find the following traceback:

Traceback (most recent call last):
  File "bo...
hollow kraken
# tulip sleet I'm not sure what kind of HID device switch devices present themselves as. Could...

Thanks so much for getting back to me. This is an example of a commercial switch interface: https://www.rehabmart.com/product/atec-usb-computer-switch-interface-38517.html. I don't really know how it presents itself but I have been successful with connecting switches just using the standard Arduino library although I can't remember what board I was using. I'm going to try and load the CP 5 firmware when back from work and see if that might resolve things? Tried the Trinket (not MO) and it's HID/ keyboard library. Will report back and see if that works.

ionic elk
#

This isn't the first time I've seen CPython returning more specific errors in practice than the source code implies it should. Does anyone happen to have insight on why this happens?

prime flower
#

@ionic elk When I run MiniMQTT on CPython, it returns a socket.timeout which I can Except. It also does not close the socket if nothing was received within the timeout, the esp implementation seems to close the socket which is problematic for MiniMQTT because the client should poll for new data from the broker/server.

#

I'm about to eat lunch but can talk more later.

ionic elk
#

@prime flower sure, as per your post the problem is almost certainly this block

if (received == 0) {
    // socket closed
    common_hal_socketpool_socket_close(self);
}

but I'm trying to figure out what to replace it with... I've been rooting around the Cpython module trying to figure out how they do things

prime flower
#

yep - points that's it

ionic elk
#

I guess that Cpython routes everything through sock_call_ex which I think is done to make things asynchronous. It handles timeouts and sorts null returns into errors, rather than the socket functions themselves doing it.

#

so I don't know how relevant it is. I could simply put in an OS error in that bloc instead of the socket close, but I don't know if that's the behavior we want?

#

This isn't the only case where I'd like to bring our socket module in line with Cpython so I'm trying to wrap my head around how they do things

prime flower
#

Yeah, understood.

#

Could we instead raise a timeout error if nothing has been received by the server during the time the client attempted to read?

ionic elk
#

I don't think we have any non-blocking capabilities at the moment

#

I don't know if we'd need to do that through FreeRTOS or what

#

LWIP does not have obvious looping operations that we could extract out and put our own background tasks calls into

prime flower
#

for now I can roll without non-blocking sockets, I'll just use a timeout and handle that. ESP32SPI impl. of MiniMQTT uses that and is OK.

tulip sleet
ionic elk
#

@prime flower for now, so you're unblocked, would you like me to just swap out the socket close for a quick OSERROR(0) so you can keep working?

#

we could always revise it later

#

I don't think the socket close should be there in any case, but there could be other reasons I don't know of for why that's in there.

prime flower
#

@ionic elk Ok, sure. I'll try it out once you've added that.

manic glacierBOT
#

I may be doing something wrong or misinterpreting, but supervisor.RunReason isn't acting as I expect.

FeatherS2 with ESP32S2:

6.1.0-beta.2-124-gfd21ff59d on 2020-12-18

import time
import supervisor

time.sleep(5)
print(supervisor.runtime.run_reason)
supervisor.reload()

repeatedly gives

soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
supervisor.RunReason.AUTO_RELOAD

but expected `supervi...

ionic elk
#

hmmm. I'd like to fold this into my existing PR, since that needs a lot more error stuff added to it anyway, but I may need to check out other things that are messing up the build

#

@prime flower do you have a local build setup for Circuitpython? You could try deleting the socket close yourself as a branch.

#

if not I could put in a new PR for it

prime flower
#

@ionic elk I dont for ESP-IDF builds

idle owl
#

@idle wharf You around?

#

I'm only partially here, in a meeting, but looking into Circup.

idle wharf
#

I'm around

idle owl
#

You seemed hesitant with your automation PR. Reason?

#

I was about to merge it and then read closer.

idle wharf
#

I can't prove that it works locally

idle owl
#

Hmm.

idle wharf
#

But someone who does this all the time might look at it and go... "that's fine."

idle owl
#

We can always revert it. Maybe it's worth merging to run it.

#

Ah ok

#

I see what you meant. I'll look at it closer and then probably merge it and we'll see what happens.

#

I'm not certain why it wasn't done that way to begin with.

#

Which is my only hesitation.

manic glacierBOT
idle wharf
#

It seems like circup isn't plugged into the library process since its not in the bundle so maybe it was more of a one off and got lost ? (Totally guessing and assuming stuff)

idle owl
#

Right. But automating version numbers seems like a logical desire.

#

Regardless of ties to lib process.

#

ยฏ_(ใƒ„)_/ยฏ

idle wharf
#

Totally agree with you

idle owl
#

Anyway, my vote is merge and revert if necessary. You in?

idle wharf
#

I'm in !

idle owl
#

Excellent. I'll do that and release it and see what happens. And have you test it.

idle wharf
#

You can't fix things if you don't break them. ๐Ÿ˜‰

idle owl
#

Valid!

#

I'll keep you posted, working around meetings.

idle wharf
#

I'm doing the day job, but can keep an eye on this too. Its easy enough to test it.

#

Thanks for following up @idle owl !

idle owl
#

You're entirely welcome! Thank you for keeping it on our radar.

#

@idle wharf Green! And PyPI shows it updated!

#

Test it at your convenience ๐Ÿ™‚

#

Make sure it actually runs - in the event that we made it so not everything gets packaged properly.

idle wharf
#

checking it right now

#

@idle owl circup list, freeze, show, update all worked. Pip list shows the version correctly. circup --version does not. I'll open a bug for that and will fix it tonight.

idle owl
#

@idle wharf Brilliant!

#

@tidal kiln You around today?

tidal kiln
#

@idle owl not fully. but what's up?

idle owl
#

@tidal kiln If you have time today to update it, or potentially reword the guide to not require the screenshot, that would be great. If not, I'll add it to a todo in Basecamp for when you return.

tidal kiln
#

hmmm. i should maybe redo that more like the weather guide.

#

and just mirror pages

idle owl
#

@tidal kiln Oh I didn't even notice you hadn't mirrored pages. Yes, entirely.

tidal kiln
#

thank for pointing that out. i'll take care of it.

idle owl
#

I'm going to add a warning that you should leave on that page. Otherwise, it's all you. Thank you!

tidal kiln
#

np

#

i won't be in meeting BTW FYI etc

idle owl
#

Thanks for letting us know

tidal kiln
#

have a good one ๐Ÿ™‚

idle owl
#

You too!

modern wing
#

Good afternoon all you wonderful folks -- happily lurking, last notes doc of the year updated.

idle owl
#

Thank you for updating the doc!

modern wing
#

14" in Northeastern PA, 5" in Bergen County NJ

idle owl
#

๐Ÿ™‚ That's teamwork.

#

@inland tusk Are you participating today?

#

@strange pike Are you listening in today? Or would you like to participate?

idle owl
#

Excellent, welcome!

lone axle
manic glacierBOT
#

I'll need to set up circuitpython build environment again to debug this, but upon cursory look i don't see anything wrong with I2C APIs usage. Just a few notes, i doubt any of this is the cause of this issue, though:

  1. https://github.com/adafruit/circuitpython/blob/fd21ff59d996274f7c11e3b907dd81eff411d0b3/ports/esp32s2/common-hal/busio/I2C.c#L93 Binary semaphore is used to implement exclusive access to a resource, instead of a mutex semaphore. Mutex semaphores in FreeRTOS implement priori...
tulip sleet
#

@onyx hinge there is a mild echo through your audio. It's turning green when kattni is talking

onyx hinge
#

weird, I turned down my headphones volume

tulip sleet
#

and i can hear you typing

idle owl
#

It sure is nice!

solar whale
#

I'm out of alphabetical order -- oops...

manic glacierBOT
#
Saved PC:0x40028200

Indicates the value of CPU program counter at the time when the watchdog triggered. 0x40028200 seems to be part of the vector table, specifically the Level4InterruptVector. This interrupt level is associated with various debugging features. On the ESP32-S2 these are interrupt watchdog interrupt and memory protection interrupt. Normally this level 4 in...

solar whale
#

no problem

idle owl
#

@gloomy shuttle Are you listening in today?

gloomy shuttle
idle owl
#

Excellent, welcome! We have a notes doc that we use for keeping track of folks, and I wanted to make sure I had you accurately in the list as listening in.

thorny jay
#

Jeff, if you can read that for me. Thanks.

thorny jay
#

That is good question... what show are cancel and what show are running. I would love to try to make it for Show & Tell.

idle owl
#

Show and Tell is on this week.

ionic elk
#

@prime flower what board are you using?

prime flower
#

@ionic elk for what?

ionic elk
#

I thought I could get you a board bin mid CI but actually I guess I can't

prime flower
#

Magtag

#

oh

ionic elk
#

anyway #3854 has the fix in and should pass CI pretty soon. Fixed the stub stuff

prime flower
#

@ionic elk whoo! I'm working on some other tasks before tackling that - how would I pull a .bin from the CI?

#

didnt know that was possible...

ionic elk
#

I can actually just build you one rn

prime flower
#

๐Ÿ™‚ that'd be great

ionic elk
#

but yeah once it passes CI it'll have a list of builds

onyx hinge
ionic elk
prime flower
#

sweet, thank you!

lone axle
prime flower
#

@lone axle frame looks useful, can I put other widgets within a frame?

lone axle
#

It doesn't have any specif API for adding things inside but that is the intended use yep. For now its just up to user code to position things inside of it.

idle owl
#

@gilded cradle Was there some iteration of the MagTag lib that needed ESP32SPI at some point?

lone axle
#

It is extending Group though, it could perhaps override append() to handle the positioning and put stuff inside visually.

gilded cradle
#

No...

idle owl
#

Hmm ok.

#

Thanks.

idle owl
#

@candid sun Is there a specific reason why the MagTag Daily Christmas Countdown needs the adafruit_esp32spi library? I'm not seeing it used in an obvious manner.

solar whale
#

latkes are good for all occasions

candid sun
#

@idle owl i think i was thinking that the magtag library needed it

manic glacierBOT
idle owl
#

@candid sun Alrighty. I'll ask Noe to test it without.

candid sun
#

@idle owl apologies if i was mistaken. i can also test if that's helpful

idle owl
#

@candid sun Sure! That would also work.

#

@candid sun No apology needed - I'm going through the MagTag guides to get a warning added about updating libs, so now's the time to find it. ๐Ÿ™‚

ionic elk
#

assuming magtag 2.9 grayscale

solar whale
candid sun
#

@idle owl cool cool ๐Ÿ˜บ yeah just tested and it does not need that library

idle owl
#

@candid sun Excellent, I'll pass that on. Thank you for testing!

modern wing
#

Thanks everyone ๐Ÿ™‚ Happy holidays -- hope you and yours have a safe and enjoyable season.

thorny jay
#

Thanks.

strange pike
#

happy holidays all

candid sun
#

@idle owl no problem!

modern wing
#

One more year in the bag ๐Ÿ™‚

prime flower
#

@ionic elk Thanks for the quick fix, will test and update the issue later today. Fighting with a compiler and CI script rn ๐Ÿ˜ 

#

...the discord angry emote is really angry

modern wing
#

Woah, very angry indeed. Got up off the wrong side of the bed levels of anger ๐Ÿ™‚

solar whale
#

๐Ÿ‘‹

onyx hinge
#

@lone axle I disconnected you from the voice channel

lone axle
#

Thank you

hearty tapir
onyx hinge
#

Here is the notes document for Mondayโ€™s January 4's CircuitPython Weekly meeting. It is on January 4 (we are skipping a week during the holidays) 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/1pOGIqgcxtlSQ3GSRD1UtbvKXwCyFx_1Gx_n2GhrGD8A/edit?usp=sharing

hearty tapir
#

The good news is that I see a country code where before was no country code. I'll still need to cleanup the extra characters there and I don't believe what I do is "valid" (even a LinkedIn Learning C-course later).

ionic elk
#

my MagTag is complaining about display rotation with a fresh install:

  File "adafruit_magtag/graphics.py", line 57, in __init__
AttributeError: 'EPaperDisplay' object cannot assign attribute 'rotation'
#

Have I goofed on something simple? This is a fresh install

#

ah I guess it's a feature so recent it's not even on my main branch yet

hearty tapir
#

This is as good as it gets ... feels a bit hacky, but the workaround works fine. ๐Ÿ™‚

manic glacierBOT
#

If I move the network setup outside the loop... this runs indefinitely.
I wonder if re-re-initializing the network is creating a mess....

....
print("Get on the network")
wifi.radio.connect(config.SSID, config.WIFI_PASSWORD)
print(f"ip: {wifi.radio.ipv4_address}")
print(f"hostname: {wifi.radio.hostname}")

## SETUP BLOCK ##
print("Setup Requests & IO_HTTP")
POOL = socketpool.SocketPool(wifi.radio)
REQUESTS = adafruit_requests.Session(POOL, ssl.create_default_context()...
hearty tapir
#

@slender iron would you mind to have a look at my concerns (that I'd annotate on GitHub) and advise better ways if my solution is invalid or unsecure? (referring to the above screenshot)

slender iron
#

@hearty tapir I don't mind looking at things on github. just tag me

#

is way behind on email at the moment

slender iron
manic glacierBOT
jaunty juniper
#

oh I am having "AttributeError: 'SPIDevice' object has no attribute 'spi'" with the sdcard module but there is already an issue about adafruit_bus_device in core being out of whack, which seems to be the problem

tidal kiln
#

@idle owl tides guide updated - lib folder screen cap updated and mirrored in more pages from magtag main guide

solar basin
#

I followed the ESP-IDF Getting Started guide for MacOS and got an error when trying to compile the hello_word example. I'd like to use the IDF for my Feather S2 or MagTag.

#
FAILED: esp-idf/cbor/CMakeFiles/__idf_cbor.dir/tinycbor/src/open_memstream.c.obj
slender iron
#

@solar basin I've never actually used the idf on it's own

#

what version of the idf are you using?

solar basin
#

I pulled the repo and switched to 4.2 because I saw you had targeted that in CircuitPython

manic glacierBOT
#

The problem is that we are hanging indeifinitely in the while loop in the code below.

void tc_reset(Tc* tc) {
    tc->COUNT16.CTRLA.bit.SWRST = 1;
    while (tc->COUNT16.CTRLA.bit.SWRST == 1) {
    }
}

COUNT16.CTRLA.bit.SWRST is actually a write-only bit. I believe we are checking for SWRST finished in an incorrect wayI think it should be:

    while (tc->COUNT16.SYNCBUSY.bit.SWRST != 0) {

We need to check the SYNCBUSY register bit, not the bit we set. Th...

slender iron
#

@tulip sleet has the crash I hit on thursday been solved?

tulip sleet
#

@slender iron nope. I determined that it wasn't a compiler bug, as far as I can tell looking at the assembler code. microdev thinks the object is being created too early. If they defer creating the object, it works

#

i wrote up my research in the PR

slender iron
#

ok, thanks!

#

I'll take a look at it tomorrow

#

I have many emails to read first

tulip sleet
#

my first prio based on the mtg today is to fix the storage.remount() bug. I was also working on the FrequencyIn bug. I found a problem, but it doesn't seem to be the cause of the bug.

slender iron
#

kk, ya it's good to have you bug hunting

manic glacierBOT
tulip sleet
#

@slender iron also Limor is quite interested in a second CDC channel, and not necessarily gating that on the presence of dynamic USB descriptors. Second CDC is a 6.2 kind of goal for the new year

manic glacierBOT
#

Reported by @neradoc on Discord, this issue is separate from other problems encountered with adafruit_bus_device.

It wasn't immediately clear why adafruit_sdcard uses this property (efficiency?) but as the property was not _spi it was arguably fair game. Possible resolutions that occurred to me:

  • change adafruit_sdcard to not use the property and leave in-core adafruit_bus_device unchanged for the purposes of this PR
  • add the property to adafruit_bus_device and leave `adaf...
onyx hinge
#

@jaunty juniper I think that's distinct from the other issues I've reported, so I filed a fresh issue for it. Thank you for your report!

slender iron
#

@tulip sleet I think we should do dynamic descriptor

#

with the move memory work from cwalther it should be pretty straightforward

ornate breach
#

Hey @slender iron or dan, question for you

tulip sleet
#

@slender iron I think there are two levels: one is just turning existing devices on and off, and the other is allowing user-specified HID descriptors. Also there's USB and there's HID. The CDC is not HID-related.

#

but we can strategize later...

ornate breach
#

I'm writing some driver code for a board I plan to develop support for with circuitpython, and I am starting with the C code side of it. Do I need to define a specific i2c read/write method for either the C or circuitpython driver code?

tulip sleet
#

if the chip you are using is already supported, then you don't need to write driver code

ornate breach
#

as far as I can tell, it isn't supported

#

yet

tulip sleet
#

sorry, I misunderstood, this is an I2C device... I was thinking you were porting CPy to a new boqard

ornate breach
#

I think @meager fog may be developing a board around the Atmel QT touch chips but I'm not confident

tulip sleet
#

if the chip is similar to one we already have a driver for, then you can probably take some of that code. You don't need to write C code

#

not atmel, but just came out

ornate breach
#

yeah, MPR121 is an older cap touch chip and she did a Great Search about capacitive touch chips which is sort of what inspired the board I'm working on

#

I am writing both circuitpython and an arduino library for it. Kind of a big undertaking for me since I've not really done this before

tulip sleet
#

take a look at existing drivers that access registers on I2C peripherals. I don't think what you want is new, it can all be done in CircuitPython. We have the register library to help

ornate breach
#

I'll take a look at the register library, I think Kattni suggested it as well

slender iron
#

@tulip sleet think your ble fix pr should go in a 6.0.1?

tulip sleet
#

what do you think the timeline is for 6.1 stable? I think it's kind of unknown, could be 2-4 weeks.

#

yes, it probably should, and also the storage.remount fix

slender iron
#

ya, I agree. I'd like to do another beta

tulip sleet
#

which looks quite simple; i am fixing it now

slender iron
#

but not really ready for stable

#

kk, lets merge those two into 6.0.x then

tulip sleet
#

i have to take the adafruit magtag rename out of the ble PR

#

i can make a new pr and cherry-pick the ble fixes out of the main PR branch

manic glacierBOT
slender iron
#

either way

tulip sleet
#

let's merge this PR and I'll make a new PR with git cherry-picks.

slender iron
#

no

tulip sleet
#

i am a bit baffled by the frequencyio bug, which also rightly should go into 6.0.1

slender iron
#

fixes should go in their release branch first

#

so we can merge the release branch back into main without two fix commits

tulip sleet
#

ok, no problem, i will revert the magtag name commit and repush and

slender iron
#

๐Ÿ‘

tulip sleet
#

will re-request a review

manic glacierBOT
manic glacierBOT
#

I'm not sure if there is a reason that is 1:1 with manual disconnect, so maybe that's better as a variable. There's also the possibility of manual disconnect coinciding with some network issue that also triggers a disconnect (probably rare).

This mentions Reasons for various disconnect causes, but doesn't mention a Reason associated with with a manual disconnect.

manic glacierBOT
#

In my mind I've got two clear use cases: 1) something like image transfer, where a device with a camera needs to backhaul a small .jpg or something for processing on a gateway. 2) (my current need) in-the-field live firmware update. A gateway advertises some kind of FW update service where a device with a lower version can request the new code.py, copy it over, and restart.

I'm picturing that the device will have a BLE Server that allows a Client to read and write its files. The "hey I...

#

What I'm reproducing now is a wifi.radio.connect issue and possibly the original issue is fixed.

Consistent failure on the 2nd loop fails.

>>> import wifi
>>> from time import sleep
>>> import config
>>> import ipaddress
>>> while True:
...     wifi.radio.connect(config.SSID, config.WIFI_PASSWORD)
...     print(f"Ping: {wifi.radio.ping(ipaddress.ip_address('8.8.8.8'))}")
...     sleep(60)
...

Clean build on main
idf.py --version
ESP-IDF v4.3-dev-1198-gd0674...

idle wharf
#

@slender iron I wanted to help push the ntp library over the finish line.
Should I send you a PR or would you prefer I go direct to the NTP repo?

manic glacierBOT
#

(Same as #3848, but applied against 6.0.x instead of main; MagTag name fix not included because board is not in 6.0.x)

  • Characteristic and descriptor max_lengths can be zero. Fixes #3746.
  • Assure that start_scan() timeout is either zero or >= interval. This is a guess for this fix, but it coincides with working values reported in #3826. Fixes #3826.
  • Assure that start_scan() max timeout is not too large for a uint16_t when passed to nRF SD. Fixes #3340.
  • Fixes small adve...
#

Fixes #3709.

Undoes https://github.com/adafruit/circuitpython/commit/bda3267432aee57e704a20308b724369cceeb6ca from #3680. The problem is that a board that starts unconnected does not start with unejected drives; they should be ejected when boot.py is entered.

The original change saved 20 bytes. I tried reversing the sense of the ejected[] array, calling it not_ejected[]. (mounted was too confusing, because it has two meanings: one for TinyUSB, and one for the filesystem.) But t...

manic glacierBOT
manic glacierBOT
tulip sleet
#

^^ @slender iron I think I have a fix for the pin alarm crash. I committed it locally but can't push to the PR branch:

halbert@salmonx:~/repos/tannewt/circuitpython$ git push
remote: Permission to tannewt/circuitpython.git denied to dhalbert.
fatal: unable to access 'https://github.com/tannewt/circuitpython.git/': The requested URL returned error: 403
#

I'm a little confused because I thought that wasn't the usual error when I didn't have maintainer permission to push to a PR. But maybe I'm wrong.

#

in any case, you can apply the patch file to try.

hearty tapir
#

Wow, that sounds amazing! ๐Ÿ™‚

#

(I mean that the issue is fixed, not that you have permission issues :))

lone sandalBOT
tulip sleet
#

This kind of error happens more often than I would like. We create an object on the heap, but forget to make sure that whoever is holding that object is included in the gc mark phase, so that the original object is not garbage collected. The holding pointer is in static storage and we forget to have it scanned by the gc.

One way this is done is to include the pointer to the object in the ROOT_POINTERs. The other is to write a special gc routine that knows where these pointers are. It should be on a checklist that whenever we create a statically allocated thing, we need to make sure that if it holds any Python objects, they get included in gc.

hearty tapir
#

I'll push a PR this (my) evening for "wifi.radio.ap_info.country". I'm not sure if I'd need to keep this detail in mind as well.

tulip sleet
#

well, I'll take a look when reviewing ๐Ÿ™‚

hearty tapir
#

That would be great, thank you ๐Ÿ™‚

#

I've completed LinkedIn Learning courses on C Essentials, something on C Structures and Embedded Applications in C - but taking courses doesn't teach experience ๐Ÿ™‚

tulip sleet
#

The radio object is a singleton, and has its own gc routine: see common_hal_wifi_radio_gc_collect() in common-hal/wifi/Radio.c

hearty tapir
#

Yes, that is the one you added ๐Ÿ™‚

tulip sleet
#

most embedded programs don't have gc ๐Ÿ™‚

hearty tapir
#

(when the bug hunting for i2c remove/deinit went on)

tulip sleet
#

so if you have added a Python object to the wifi_radio_obj_t struct, it needs to get added to that routine

hearty tapir
#

I'm planning to add a debugger (jlink or similar) to my setup - but I need to be careful not to make it a shopping spree

tulip sleet
hearty tapir
#

I'm overwriting an existing structure partially to workaround the ESP-IDF bug that is currently present - therefore this may be a cornercase.

tulip sleet
#

but it only helps a little with ESP32-S2 debugging, providing the basic JTAG interface

hearty tapir
#

Yes, that is the item I have already bookmarked. This will certainly be in the shopping cart sometime soon. I prefer to combine some parts to make the shipment more economical.

slender iron
#

@tulip sleet I literally just woke up thinking that was likely the issue. The extra log causes the pointer to linger on the stack and get collected

#

@tulip sleet do you need an ssh remote instead of an https one?

tulip sleet
#

no, i have not needed an ssh remote when doing this in the past. In any case, I think you can just git am the patch file. I made the patch from the top of the repo

slender iron
#

Kk

onyx hinge
#

@slender iron can you remind me why do we not use the "stub" for uploading esp32s2 firmware with "make flash"?

analog bridge
#

nice find @tulip sleet ๐Ÿ‘
one question... Is cleanup_after_vm() called after _setup_sleep_alarms()?

tulip sleet
#

@analog bridge it is after a deep sleep, because the VM is shut down, since the program exits

slender iron
#

@onyx hinge I think it was because the USB bootrom can't do it

onyx hinge
#

@gilded cradle weren't you successfully using the stub with the USB on magtag to program it?

gilded cradle
#

@onyx hinge yes, I use stub loading. It writes a small binary program directly to ram and tells it to run.

tulip sleet
#

@slender iron it may possible have to do with your repo not being a direct fork of adafruit/circuitpython, but of micropython instead. Not sure. I tried a couple of other things, not worth spending a lot of time on.

slender iron
#

@tulip sleet weird it looks like it should work

#

I just pulled the patch in now

analog bridge
#

@slender iron should I wait for PinAlarm pr to get merged... than I can resolve conflicts with TouchAlarm

slender iron
#

yes please

tulip sleet
#

you may want to modify your code based on imitating the final version of pin alarm

slender iron
#

@tulip sleet what was weird about how the full example worked?

#

was it light sleep?

tulip sleet
#

maybe, i never got a .wake_alarm that was not None, but the simpler example seems to be good, and prints the pin name

#

or maybe it was a display refresh issue, but I'm not sure.

#

i added the sleep_memory thing to make sure it was cycling

onyx hinge
#

@slender iron flashing magtag (with a debug build) takes ~17s with stub, ~37s without stub. --after-reset=hard_reset doesn't work over USB, but the stub DOES work and is faster overall. Maybe some older esptool did not have a working stub for usb? github shows that was added in May 2020..

manic glacierBOT
#

Thank you for the pointers @igrr!

  • I eliminated the semaphore (it is used to implement Python-level locking of the device, and is not relevant to the code that causes the problem) without affecting the outcome
  • I did not have success setting a gdb breakpoint at *0x40028200, it was never triggered.
  • I did observe that during a "normal" failed I2C probe, i2c_master_cmd_begin() returns -1. However, when the I2C device is re-used, it is returning ESP_ERR_TIMEOUT.
  • If I introduce i2...
slender iron
manic glacierBOT
onyx hinge
#

@slender iron thanks, done!

manic glacierBOT
slender iron
#

ok, I've pushed the fixed version of pin alarm. Thanks @tulip sleet !

solar basin
#

So, I finally managed to get the IDF working, but I can't find any instructions for flashing CP back onto the FeatherS2

manic glacierBOT
#

Hi @djix123, thanks for the PR! The Blackpill does not have silkscreen markings for a default I2C channel, and there are actually 8 different equally viable combinations of I2C outputs on the pins it exposes. We don't typically mark pins as default unless they are clearly outlined on the silkscreen as such.

If you selected these pins for compatibility with python sketches written for the Feather F405, please note that:
myi2c = board.I2C()
is functionally identical to:
`myi2c = busio....

tulip sleet
#

@solar basin hold down the DFU button, and press reset. Then it will be in bootloader mode and you can use esptool.py to upload the .bin, or follow simpler directions in the magtag or Metro ESP32--S2 guides. You can install a UF2 bootloader so you can load UF2's in the future.

last flame
manic glacierBOT
solar basin
#

Thanks!!!

last flame
#

after entering bootloader mode as @tulip sleet mentioned

solar basin
#

You all are awesome as usual!

tulip sleet
#

@slender iron is there some debugging you want to do on light sleep? I started reviewing days ago but stopped due to the bug.

crimson ferry
#

fwiw, re: --no-stub, I found that I didn't need it when using the UART-to-USB, but did need it when loading over native USB (esp32-s2)

manic glacierBOT
analog bridge
#

I have run into an issue... cleanup_after_vm() is called after _setup_sleep_alarms() and resets the previously set touch configuration.

#

Is it advisable to use something like peripherals_touch_never_reset() to prevent this?

tulip sleet
#

@analog bridge, yes, exactly, you could use the same technique used for pin alarms, if that makes sense in this case. In any case you'll need to special-case those pins.

analog bridge
#

using never_reset(pin) won't work here as cleanup_after_vm() calls touchpad_deinit().
I am using prepare_for_deep_sleep() which is called from alarm_enter_deep_sleep() for touchpad configuration in case of actual deep sleep but the issue here is with pretend-to-sleep whoes configuration is set in _setup_sleep_alarms().

manic glacierBOT
slender iron
#

I think we'll want to stop doing light sleep at all but that's an existing bug

#

esp light sleep shuts everything down

tulip sleet
#

@analog bridge can you just keep some info that touchpads will be used for sleep, and suppress the call to touch_pad_deinit()?

#

@slender iron I think "Circuitpython Light Sleep" != "ESP32-S2 Light Sleep". Other chips make it easier to keep some peripherals awake during a lighter sleep, I would think. We could make CPy Light Sleep for the ESP32-S2 not doing anything more than time.sleep() does.

alpine nimbus
#

I was just writing up installation instructions for my new MagTag projects and I realized how many libraries are necessary just for a plain MagTag installation. 10! That's at least 3 more than a few weeks ago when I started. What's the point of refactoring if the new libraries are required anyway? It just makes it more complicated for newbies. I can think of at least 3 libraries that I'm not using, fakerequests, neopixel and io. (i guess neopixel is used to flash when its booting up or starting the network or something)

#

although I used fakerequests during development and it rocks

analog bridge
#

@tulip sleet ok... I'll go with peripherals_touch_never_reset() to suppress touch_pad_deinit().

tulip sleet
#

or could you just pass params to touch_pad_deinit()

analog bridge
#

that would require altering peripherals_touch_reset() function which will break consistency with other module reset calls

tulip sleet
#

@alpine nimbus the refactoring makes it easier to keep all the "portal"-type code working the same way. ... We have been talking about a way of specifying a single URL that would download a custom zip package of the specified libraries

#

but that requires web infrastructure work; not hard, just another thing to do

alpine nimbus
#

@tulip sleet Thanks. That would be. nice

slender iron
tulip sleet
slender iron
#

@alpine nimbus you can also use the magtag without the library

#

splitting the big library apart should hopefully make it easier to use the pieces you need

alpine nimbus
#

The neat thing about the magtag (or at least my project that uses it) is that you don't need to do soldering or know anything about electronics and not much about software. I'm trying to make it as easy as possible for non-tech people to set up so that would help a lot.

manic glacierBOT
alpine nimbus
#

One person already told me he bought a magtag because of it although he's a software dev so I doubt he'll have any trouble.

alpine nimbus
#

Oh, I just thought of something. Maybe in the future MagTags will ship with software already loaded so people won't need to install any libraries at all. The board in the new adabox is like that but I don't know about standalone boards.

manic glacierBOT
orchid basinBOT
#

Learning guides aren't the only place this would be used. I just released a small MagTag project on github with an eye toward making it as easy as possible for non-technical people to use. Currently there are ten libraries that need to be installed and with the refactoring I imagine that will increase. Instead of listing them all, I pointed people to the MagTag guide. It would be even nicer though if I could just give people a single link.

orchid basinBOT
manic glacierBOT
manic glacierBOT
tulip sleet
#

@ruby lake where did you get that link from?

ruby lake
#

one moment

#

The link is contained in the sentence "For example, the Circuit Playground Express guide has a great page on how to install the library bundle for both Express and non-Express boards."

manic glacierBOT
tulip sleet
#

@ruby lake - fixed - that phrasing was from ages ago when the entire bundle could fit. Thanks!

ruby lake
#

I figured some things just sneak into the cracks, I just happened to by tinkering with a gps feather.

manic glacierBOT
manic glacierBOT
lone sandalBOT
manic glacierBOT
#

To reject things with the wrong type, you can simply check that the type is the desired one, similar to this code in canio:

        mp_obj_type_t *type = mp_obj_get_type(match_objects[i]);
        if (type != &canio_match_type) {
            mp_raise_TypeError_varg(translate("expected '%q' but got '%q'"), MP_QSTR_Match, type->name);
        }

To make it work with busio and bitbangio (core implementation) you can just check the object's type and make a decision, similar to thi...

#

I understand the 3 methods you suggested @jepler. The first one is probably pretty quick to do, the second I'd have to figure out how to test bitbangio (core). Would the third with pure python fix all the problems? Would that result in a slow down for having this all in the core (the original point?).

I understand in the theory of what you're suggestion @dhalbert but I'm thinking that will take me a bit longer to figure out.

I should be around on discord for the next bit if someone want...

blissful pollen
#

@onyx hinge Just to confirm here would the 3rd method for bus device be the best then? It will probably take me a bit longer (maybe) but if it will work better no issue

onyx hinge
#

I believe it's the best all-around solution for compatibility. For code size and performance, well, it needs to be tested. but before it can be tested, it will need to be written.

#

I think right now we have a little bit of wiggle room on binary size due to the gcc10 transition, though I don't know the exact "free space" figures for the most constrained builds.

blissful pollen
#

It doesn't seem that hard just have to wrap my head around it. If its too slow could probably do a detect native I2C and if anything else do the python

onyx hinge
#

that's sure an alternative -- mix two approaches

#

Apologies for giving you background you didn't need, but perhaps it will be helpful to someone else interested in the task

blissful pollen
#

No worries it was all super helpful, I just want to make sure I do the best solution to it

#

I found when I did it the first time I used other modules as examples, having someone point out look here and there is a huge time saver, rather then having to hunt for them

manic glacierBOT
#

After tracing this more carefully this is due to raising an exception in an interrupt handler, which does not work properly:
https://github.com/adafruit/circuitpython/blob/8b03951fee166b1eea06d114fc347982b7b186bf/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c#L85.
This is inside frequencyin_emergency_cancel_capture(), which is called from frequencyin_interrupt_handler().

frequencyin_emergency_cancel_capture() gets called almost immediately after the FrequencyIn() is create...

#

Fixes #3788.

More info in https://github.com/adafruit/circuitpython/issues/3788#issuecomment-749839525:

Remove this mp_raise:
https://github.com/adafruit/circuitpython/blob/8b03951fee166b1eea06d114fc347982b7b186bf/ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c#L85.
This is inside frequencyin_emergency_cancel_capture(), which is called from frequencyin_interrupt_handler(). Interrupt handlers should not raise exceptions.

Simply commenting out the `mp_raise_RuntimeError()...

manic glacierBOT
night perch
#

When the necessary socket bind/accept/listen support is added for esp32s2, would that theoretically allow waking from light sleep when the device receives an incoming connection? Or would simply keeping the wifi connection alive rule out sleeping?

manic glacierBOT
tulip sleet
#

@night perch we ended up not being able to use ESP32-S2 light sleep because it disables nearly all the peripherals. So we are just going to idle now during "light sleep". We will do some measuring to see if there is some power consumption reduction while idling.

manic glacierBOT
night perch
tulip sleet
#

thanks! it will need revision soon: we'll add pin alarms and touch alarms when they're merged in

manic glacierBOT
crimson ferry
#

Is this line in start_station redundant? https://github.com/adafruit/circuitpython/blob/8b03951fee166b1eea06d114fc347982b7b186bf/ports/esp32s2/common-hal/wifi/Radio.c#L59 looks like it sets the wrong enum type/value, and it's overwritten correctly anyway in connect shortly after start_station is called: https://github.com/adafruit/circuitpython/blob/8b03951fee166b1eea06d114fc347982b7b186bf/ports/esp32s2/common-hal/wifi/Radio.c#L157 (scanning also calls start_station, but I don't think it requires any particular interface config/constant)

manic glacierBOT
#

Weโ€™re in the process of getting VID.

Thanks

Sharnon

From: 'ladyada' via Engineering engineer@gravitechthai.com
Sent: Wednesday, December 23, 2020 1:18 AM
To: adafruit/circuitpython circuitpython@noreply.github.com
Cc: gravitech-engineer engineer@gravitechthai.com; Mention mention@noreply.github.com
Subject: Re: [adafruit/circuitpython] Add Gravitech Cucumber R board definition (#3349)

@gravitech-engineer https://github.com/gravitech-engineer hi please reply to the req...

manic glacierBOT
hearty tapir
#

It likely errors out, we could check with ESP_ERROR_CHECK(). I wonder now, if this is the corner case that you mentioned in which an APSTA is visible .... assuming you do import wifi and scan, but don't issue a connect.

hearty tapir
#

I've now tried a lot of different combinations and still I have no luck to catch a beacon.

crimson ferry
#

I haven't caught another either, and I'm starting to question my sanity at the time I did ๐Ÿ˜‰

manic glacierBOT
hearty tapir
#

I wonder if "git" wakes up in the morning and thinks "What weird effect could I come up today with to confuse BennyE?!"

hearty tapir
crimson ferry
#

I get a bunch of Espressif "Sentry_" SSIDs with some hex digits, I assume they're some kind of security device in the neighborhood or in visiting cars

hearty tapir
#

(I do remember that you mentioned that it was your board mac + 1)

#

From a security POV many of the security-devices are questionable .. ๐Ÿ˜‰

crimson ferry
#

(yes, the Beacon MAC was base+1, as expected for AP)

hearty tapir
#

@tulip sleet I don't really understand why the CI is unhappy with PR #3868 but at least all the xtensa builds were successful. I should probably apply the following to my PRs "Am I confident to make this a PR without a DRAFT PR first? If yes, make it a DRAFT" ๐Ÿ˜„

tulip sleet
#

the trailing whitespace checker checks for that and also missing newlines at the end of files. Some editors have a setting or a plug-in to automatically clean up trailing whitespace on each line and at the end of a file, and ensure that they end with a newline.

hearty tapir
#

I'm using vim in my Win10 Ubuntu WSL. I haven't done any specific tweaks to make tabs spaces or similar. Do I need to do something about this? I'm planning to add some more wifi related enhancements.

hearty tapir
#

I've always manually hit the spacebar, there should be no tabs nowhere ๐Ÿ™‚ I'll look at the links, thanks

strange pike
hearty tapir
#

@crimson ferry , are you going to fix the Radio.c line 59 or should I?

hearty tapir
tulip sleet
crimson ferry
#

@hearty tapir Feel free, I'm still very early in the learning curve on C/C++, structure of the core, etc. I'm hoping I can focus on code and let GitHub do the builds for me (I know nothing about building software), but it's going to be a while before I'm comfortable PR-ing anything.

tulip sleet
#

of course many more modern editors like vscode also have nice autoindent

crimson ferry
#

(...just when I thought I was making some progress understanding parts of Radio.c (which make some sense being tied to a good API), I remembered about shared-bindings which lives between languages and is still pretty mind-boggling)

hearty tapir
# crimson ferry (...just when I thought I was making some progress understanding parts of Radio....

I saw the shared-bindings during some of the deep-dive streams already and therefore took something that existed already (rssi) as example and walked through the files to understand the structure before adding the country code. I picked the country code, as I thought it would be the most simple element and didn't (possibly) imagine I'd run into the esp-idf bug that I now (hopefully) workarounded.

crimson ferry
#

That's my plan too, try to find something simple that has good close templates in other features.

manic glacierBOT
tulip sleet
#

@slender iron I am going to start release notes for a 6.0.1 release that includes the merged and pending fixes: BLE, remount (EDIT:remount error started in 6.x, so not included), FrequencyIn. ... Do you think it's worth backporting the json speedup? that is well-loved and is the only other thing I can think of at the moment.

manic glacierBOT
#

I wired up a couple of LEDs and can confirm that open drain doesn't work, or at least not as I expect it.

In push/pull mode, one LED lights brightly depending whether the pin's value is True or False.

In open drain mode, neither LED lights no matter whether the value is True or False. However, the upper LED should light when value is False.

image

I did verify that in input mod...

manic glacierBOT
#

This appears to be another problem due to adafruit_bus_device-in-core. The pure Python version first tries a zero byte write to probe for the presence of a device at an address, though if that is not possible (when is it not possible?) it also tries a 1-byte read:

        try:
            self.i2c.writeto(self.device_address, b"")
        except OSError:
            # some OS's dont like writing an empty bytesting...
            # Retry by reading a byte
            try:
...
crimson ferry
#

main() in main.c is run once and only once, on power-up, right? So I'm guessing that the case where wifi_inited would be true when port_init() calls wifi_reset() is RFU; ditto for the use of wifi_ever_inited (we never deinit wifi currently except at power-up)?

manic glacierBOT
#

I replicated this, but it seems to depend on the host computer!
On Linux using picocom: this works:

Adafruit CircuitPython 6.1.0-beta.2-125-g3b4c14f3e on 2020-12-21; Adafruit QT Py M0 Haxpress with samd21e18
>>> import time
>>> time.sleep(2)
>>> 

On MacOS 11.0.1, using screen, I have to type return to get the prompt to appear:

Adafruit CircuitPython 6.1.0-beta.2-125-g3b4c14f3e on 2020-12-21; Adafruit QT Py M0 Haxpress with samd21e18
>>> import time
>>...
idle wharf
#

Iโ€™m not sure when WiFi is stopped in CP though.

#

Maybe when code.py vm is killed and you move to REPL vm?

hearty tapir
#

I played around with that, when we tried to fix the i2c issue. We no longer remove the event loop and also netif init only once

#

That is the function I also suggested to Scott, but after the i2c fix by Bruce it was no longer necessary

slender iron
tulip sleet
#

@slender iron I didn't decide but did put the json fix in the release notes. I will do some PR's for you or jeff to review

#

considering how slow the old json is, i think it's almost a bug that got fixed

crimson ferry
#

@idle wharf afaict, wifi is only stopped (and [re-]started) using radio.enabled. Thanks for that link, I hadn't spotted that call in the API yet.

idle wharf
#

I scan that forum every couple of weeks... occasionally asking questions.

crimson ferry
#

I had been using enabled to try to reset wifi for a while to try to get around a bug, but it didn't do much discernible... maybe related to that post

hearty tapir
idle wharf
#

WiFi does have some things that need to be worked out.
If you do while True: connect, ping, sleep(60) you will fail on the 2nd or third loop.

manic glacierBOT
crimson ferry
#

@hearty tapir it was a long shot to try enabled, probably are Requests issues

trim elm
#

@tulip sleet You wouldn't happen to have a .uf2 or .bin for the magtag for the very latest version of CircuitPython (with the Alarm library that had SleepMemory added) would you? I'm working on building it myself but it seems to be a pretty long process the first time

crimson ferry
#

@idle wharf common_hal_wifi_radio_connect doesn't currently check for existing connection/enabled, but I'm not sure the implications of that... there is a note on esp_wifi_connect: "2. If the ESP32 is connected to an AP, call esp_wifi_disconnect to disconnect." but there isn't an error response that says, "hey, you're already connected" so maybe it's no problem

#

none of the Espressif examples I've found have restart or even shutdown scenarios for connections or wi-fi running or wi-fi init, but they do say netif_init only once, and netif_deinit isn't implemented

hearty tapir
#

this is why there was โ€ždestroy()โ€œ used

idle wharf
crimson ferry
#

@hearty tapir which led to my question about why we need to call wifi_deinit and netif_destroy in wifi_reset if it's only called on power-up (above) ...maybe RFU or a low-power thing?

trim elm
#

@idle wharf I had no idea that was a thing. Probably should have read a bit further down the downloads page lol. Thanks!

slender iron
#

@tulip sleet at my desk now

tulip sleet
#

i am trying out the 6.0.x with json speedup build. Want to take a look at the PR's?

slender iron
#

yup, I can

tulip sleet
#

something weird is going on with the json update; still testing

#

ok, I was building it with gcc10 by mistake

onyx hinge
#

should we suffix the build invocations so they call for arm-none-eabi-gcc-9.2.1 instead of arm-none-eabi-gcc ?

tulip sleet
#

it was just my problem lcoally, but we could do that. it's not a CI problem

#

for Scott, that wouldn't work if his toolchain advances versions due to arch keeping up with the latest

onyx hinge
#

it would make it possible to move seamlessly between 6.0 and 6.1 without modifying PATH which would be nice

tulip sleet
#

do you want to backport that change to 6.0.x, or just do it going forward on main?

onyx hinge
#

a reasonable question... I could arrange my symlinks so that the unsuffixed one was 9 as long as I needed it to be

hearty tapir
#

It is that example that let me try out esp_wifi_clear_default_wifi_driver_and_handlers()

manic glacierBOT
slender iron
#

@tulip sleet I was thinking about that but it would help older portal projects

#

though they can always move to the beta

tulip sleet
#

i will test on a metro esp32-s2. The test json limor gave me is too big for samd51 anyway

slender iron
#

whoa. too big for samd51 is very big

tulip sleet
#

the file is like 250k

crimson ferry
#

@hearty tapir nice one, that's got a little of everything

manic glacierBOT
tulip sleet
#

@slender iron we could discuss in the meeting tonight; it's getting relatively close to that time anyway, and maybe we don't want to release 6.0.1 on Christmas eve

slender iron
#

ya true. we could do next monday I think

tulip sleet
#

i could make a new beta earlier than that if we wanted with the BLE and FrequencyIn fixes, so anyone who's stuck could be pointed to the beta. But I"m not sure how stable main is right now

hearty tapir
#

or at least very similar.

slender iron
#

@tulip sleet I think I'd rather just post the beta on monday as well

#

we can merge before that so S3 picks them up

tulip sleet
#

yes, so we can decide on the json->6.0.1 tonight, and merge that or close it, and merge the rest as soon as approved

slender iron
#

kk

thorny jay
#

There is that discussion about the power LED on the MagTag and @ladyada that want to have it.
But I discovered there is a way to have a LED only when 5V is present and not on when battery powered, this is what the FeatherS2 is doing:
The red power LED doesn't light up when running off battery
That is by design! The power and charge LEDs and corresponding 2K resistors drain the battery, so they have been isolated to the 5V power domain, so they will only light up and draw power when the board is either being power by the USB plug, or by a 5V power source connected to the 5V header pin.
(see https://feathers2.io/)

tulip sleet
#

@thorny jay @meager fog used a 10k resistor on the power LED to minimize the draw. I think it may have been conscious choice to have it powered in both domains, but I am not sure. Of course, one might use a USB power pack connected to USB as well, but usually those are hefty, so lighting an LED is not a big deal.

manic glacierBOT
thorny jay
#

Discovering my FeatherS2, the replacement just arrived today. That is two travel from Australia to Belgium. ๐Ÿ™‚

manic glacierBOT
gilded cradle
#

Ok @slender iron, got it

slender iron
#

thank you!

slender iron
#

@tulip sleet need my review on anything else?

tulip sleet
#

@slender iron #3872, and #3870 if we decide to pull the JSON fix into 6.0.x

slender iron
#

donezo

tulip sleet
#

thansk!

hearty tapir
#

@slender iron I'll change the esp_wifi_get_country() to return mp_const_none if != ESP_OK. Does the way the cstr looks like ring any bell?

lone sandalBOT
manic glacierBOT
#

I'm trying to make the Stage library run on the Meowbit, but in order to do that, I need to re-initialize the display. I'm doing it with this code:

import board
import digitalio
import gamepad
import stage
import displayio
import busio
import time


_TFT_INIT = (
    b"\x01\x80\x96" # SWRESET and Delay 150ms
    b"\x11\x80\xff" # SLPOUT and Delay
    b"\xb1\x03\x01\x2C\x2D" # _FRMCTR1
    b"\xb2\x03\x01\x2C\x2D" # _FRMCTR2
    b"\xb3\x06\x01\x2C\x2D\x01\x2C\x2D" # ...
#

Thanks, I'm setting the pixels like the following:

# Enter this from REPL
import board
import busio
import displayio
from adafruit_matrixportal.matrix import Matrix

matrix = Matrix(bit_depth=2)
display = matrix.display
bitmap = displayio.Bitmap(64,32,2)
palette = displayio.Palette(2)
palette[0] = (0,0,0)
palette[1] = (255,0,0)

grid = displayio.TileGrid(bitmap, pixel_shader=palette)
group = displayio.Group()
group.append(grid)

display.show(group)
bitmap[1,1] = 1
```...
manic glacierBOT
tulip sleet
manic glacierBOT
tulip sleet
#

@slender iron #3830 (pin alarming) looks like it needs make translate

slender iron
#

kk, will do in an hour. on the wrong computer atm

hearty tapir
#

lol, this country.cc is the second issue I'll have to open with espressif. Even when using the esp-idf directly, it has a length of six instead of two.

crimson ferry
#

what's the esp32s2 magic to get the ESP_EARLY_LOGW and similar to show up in the debug console?

tulip sleet
#

@crimson ferry you need to compile with DEBUG=1 on the command line. I have not tried the EARLY versions, just the regular ones.

crimson ferry
#

sorry for the dumb questions, I'm starting at zero... I don't find DEBUG in any of the config files at circuitpython/ports/esp32s2/

manic glacierBOT
hearty tapir
#

@crimson ferry I've had the same confusion ๐Ÿ™‚ your make command needs to look like this: make BOARD=boardname DEBUG=1

crimson ferry
#

oh, I was hoping to use GitHub to do the builds for me (to defer that learning curve)

hearty tapir
#

@slender iron are you ok with mp_obj_new_str(cstr, strlen(2)); and a reference to the ESP-IDF issue ID ?

slender iron
#

strlen(cstr) right?

#

@crimson ferry what OS are you on. building isn't toooooo bad

hearty tapir
#

no, actually not strlen(cstr) as the country.cc object of ESP-IDF function has a bug

slender iron
#

strlen(2) isn't valid

hearty tapir
#

Oh, I meant to type: mp_obj_new_str(cstr, 2);

slender iron
#

ya, that's ok

hearty tapir
#

I'll get famous within espressif ๐Ÿ˜„

#

@crimson ferry if you're on Win10, I can recommend the WSL Ubuntu 20.04 LTS - this is what I use ๐Ÿ™‚

#

(Windows Subsystem for Linux = WSL)

crimson ferry
#

@slender iron I'm on macOS (11). Using Github to build may be a moot point... I assumed Actions would fork over too, like we grab artifacts from your repo to test. But no joy.

slender iron
#

I have latest mac so I can help

#

the docs on learn should be correct

crimson ferry
#

OK, thanks, I'll start there

slender iron
#

np

manic glacierBOT
manic glacierBOT
#

encoder.position does not change (first tick is not recorded) when reversing direction.

I have found encoder.position to accurately report while consistently incrementing or decrementing (clockwise or counterclockwise), but it does not report the first tick when changing direction.

Similarly, if the user toggles back and forth between two adjacent (tick) positions, no change is ever reported by encoder.position.

Hardware setup: this [guide](https://learn.adafruit.com/rotary-encoder/...

#

I've seen what looks like read() not returning on a UART creating with timeout 4 seconds on standard TX/RX on a Feather nRF52840 Express. The code gets stuck here:

Traceback (most recent call last):
  File "code.py", line 267, in 
  File "code.py", line 265, in 
  File "lib/pimoroni_pms5003/__init__.py", line 156, in read
KeyboardInterrupt:

Code done running. Waiting for reload.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

Press any ke...
manic glacierBOT
#
[adafruit/circuitpython] New branch created: revert\-3874\-ble\-fixes\-6\.0\.x\-to\-main
tulip sleet
#

@slender iron I should have merged your pin alarm PR first. But I merged the ble fixes to main, and that caused another make-translate conflict. Sorry. I can revert the ble fixes temporarily, or you could do make translate again on the pin alarm PR.

slender iron
#

np, I can fix it up

#

I won't today though

#

I'm just about done

tulip sleet
#

np

manic glacierBOT
manic glacierBOT
swift moss
#

Is there circuitpython support for the feather S2 built in wifi?

swift moss
#

Thanks, just found it.

manic glacierBOT
half geyser
#

Is anyone here an expert at Github? I'm trying to create a PR (for the issue mentioned above), but it just keeps telling me "Unicorn!".

half geyser
manic glacierBOT
strange pike
#

did you clone the repo to your account? might still have the clone set to master and need to manually modify

half geyser
#

It really wants to merge to micropython/master, to the point where I discovered that Github's UI lags, and I accidentally opened two PRs to micropython even though the UI said circuitpython.

#

My fork has fomu set as the default branch.

manic glacierBOT
solar whale
#

@tulip sleet @slender iron I released an update to the Adafruit_CircuitPython_RFM9x Library. Will the next release of CP (6.0.x or 6.1.x) routinely be updated to incorporate the new release for the feather_m0_rfm9x build or do should I created an PR to update it?

hearty tapir
tulip sleet
#

@solar whale It is not automatic that they get updated; it tends to get done in batches. Do you feel it is a regression for 6.0.x from, say, 5.3.1, or that it is a kind of showstopper bug? Then happy to include it. You could submit a PR against 6.0.x (you have to change the branch dropdown when you submit the PR.

manic glacierBOT
#

The space character is actually correct to refer to the "Any Environment" (0x20) opposed to just "Indoor" or "Outdoor". As per feedback by espressif and also after reviewing different documents, this appears to be correct. As strlen() reads until a \0 character, I suggest we stick to the 2 to read just the country code. I've updated the comment accordingly and no longer refer to a bug. It is mainly my misinterpretation/lack of knowledge here.

solar whale
#

@tulip sleet It is nothing major, just some enhancements to incorporate some errata from the radio datasheet and an update to the RSSI calculation. No real functional impact and no API changes.

#

If I submit a PR agains 6.0.x, then will that also get incorporated into main.

tulip sleet
#

not automatically, and given that it's minor, i'd rather just have it in main, and whoever wants it can get the beta. We are only fixing regressions or showstopper bugs in 6.0.x right now. But we should probably make a habit of updating the libraries shortly before every announced release. I have it semi-automated in terms of fetching the latest tagged commit.

solar whale
#

That would be good. I'll go ahead in put in a PR for main.

tulip sleet
#

Or just open an issue for 6.x.x, because we want to update all of the libraries

solar whale
#

OK -- will do!

manic glacierBOT
solar whale
#

I did verify that is still fits for en_US and zh_Latn_pinyin ... still several k to spare.

manic glacierBOT
halcyon latch
#

Hey, wrt circuitpy implementation of neopixels, I can't find anything on the documentation about querying them to find out what color they are- can they do this, or do I just have to keep track of it elsewhere?

lone axle
#

@halcyon latch I think you can access them by index on the pixels object:

pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixels[0] = (10, 0, 0)
print(pixels[0])
halcyon latch
#

Oh! That makes life a lot easier, thank you!

solar whale
#

@tulip sleet I just created a build from main for the feather_mo_rfm9x and it did not build in busdevice -- It built OK yesterday -- did something change?

tulip sleet
#

sorry wrong issue, edited

solar whale
#

hmm -- thats too bad...

tulip sleet
#

we know how to fix it but it is a regression for the moment

solar whale
#

ok -- thanks

#

still works the "old fashioned" way -- loading the libs.

blissful pollen
#

I'm hoping to fix busdevice over the holidays. I think I know what to do and understand how the other types work now too

solar whale
hearty tapir
#

Ordered myself an Adafruit Feather STM32F405 Express, a J-Link Debugger and some Nordic stuff via Digikey as Christmas present ๐Ÿ™‚

tulip sleet
#

v nice!

hearty tapir
#

Rabbit holes everywhere .. I need to be careful ๐Ÿ˜„ haha

manic glacierBOT
astral seal
#

Is it ever planned to use Websocket as a Circutpython lib?

jaunty juniper
#

I use uwebsockets on micropython and have been successfull in using it on Circuitpython with a few modifications (that I should probably post somewhere) https://github.com/danni/uwebsockets

astral seal
#

can you send me the modify version?

jaunty juniper
#

so I have this, it worked with my obs websockets code on the FeatherS2, but it's super hacky, based on an older version of uwebsockets, and it doesn't implement SSL (though that should be easily added back in)

manic glacierBOT
#

We got the present setting when I tried copying Arduino register settings to CircuitPython: 61698eb5d8d04da3a85dbbb42edc86858d42036b

The mismatch between the associated GCLK and the register setting was noted in that commit.

Before that, it appears we used GCLK5 at 2MHz and used DAC_DACCTRL_CCTRL_CC1M which was "correct" (1M is for 1.2MHz < GCLK_DAC โ‰ค 6MHz)

I don't know whether I made an error selecting the combination of CC100K and 12MHz, or whether that is truly what Arduino does--...

jaunty juniper
#

I only use it through obswebsockets too

astral seal
#

its not working with Adafruit Matrix Portal

#

i need a websocket Lib for my twitch IRC action project