#circuitpython-dev

1 messages · Page 315 of 1

manic glacierBOT
#

I'm sure why the merge check is failing. It seems to be indicating an issue with the white space that I can't see on my end.

pre-commit is complaining blank lines with spaces in them in pins.c. So check the blank lines between the pin lines.

Check if your editor has an option or a plug-in to trim trailing whitespace when it saves the file. I have that enabled in emacs and it saves a lot of manual fixing.

I was able to pip3 install pre-commit, and then run it by hand. The buil...

lone axle
#

@idle owl (sorry if you get double pinged, the bot ate my first one) RE: discord links in the repo readme files. I was able to re-use a few bits from adabot to check all of the repos and generate a report of ones that have the invalid discord links. There are many more with the invalid one, but there are some that have already been updated with the new correct one. https://gist.github.com/FoamyGuy/f913a47788fb8eede1747ffa4dc6ea7c

Gist

GitHub Gist: instantly share code, notes, and snippets.

manic glacierBOT
idle owl
#

@lone axle Hmm alright. For sure update cookiecutter. We'll have to decide what to do about the libs.

charred flare
#

What's the difference between with ESP32 Airlift breakout and the HUZZAH32 ESP32 Breakout when used as a wi-fi co-processor in CP?

#

anything?

manic glacierBOT
#

Probably unrelated but I've been plagued by MemoryError of 1784 bytes too for a while.

These occur all over the place in my code after the BLE comms have completed. I'd initially assumed this was related to dict enlargement based on the peculiar value and seeing an occurrence of it in https://github.com/jczic/MicroWebSrv/issues/5. I've been rewriting bits of the code to pinpoint where it occurs and oddly it will get reported even on a variable = None line. For start_scan elsewhere I ha...

tidal kiln
#

@charred flare airlift has nina firmware installed, which is what allows it to be used as a peripheral

solar whale
#

@charred flare you can use an ESP32 Breakout -- you have get the right pins and load the Nina Firmware to it.

charred flare
#

I figured, the product page says

Comes fully assembled and tested, pre-programmed with ESP32 SPI WiFi co-processor firmware that you can use in CircuitPython to use this into a WiFi co-processsor over SPI + 2 pins.

#

Which made me think it was the same nina firmware

slender iron
#

@onyx hinge sorry, got up early for a zephyr meeting and now just getting going. there is port_enable_ticks or similar that calls supervisor_tick. that could be shared for tasks that need periodic background triggers. we use the rtc for that interrupt and may use a second one to wake from sleep

onyx hinge
#

OK, makes sense.

#

we'll probably have to activate ticks when we have a display with auto-refresh, and when we might need to do filesystem background tasks .. I have the former implemented but only compile-tested. haven't gotten into the latter yet.

#

I remember now you said something about being up at 6AM for a meeting .. my condolences

manic glacierBOT
#

I am just using it to control a small fan, nothing fancy.
I don't understand anything you guys are saying but it sounds like you are saying that pin A5 cannot do PWM, if that is the case you probably should update the pinouts section for the ItsyBitsy M4 for it says, "A4 and A5 have PWM output.".

The pinout is for both Arduino and CircuitPython and with Arduino you can do PWM on that pin. With CircuitPython you cannot because our API allows you to choose PWM frequency.

There are tw...

slender iron
#

@onyx hinge Ya, activating ticks in that case is fine. Yup it's "face-to-face" meetings that are interesting, just early.

#

next wednesday too

manic glacierBOT
idle owl
#

@lone axle I've asked @trim elm to work with you on getting the libs updated. No rush on it, he's finishing up another project first, but wanted to let you know.

manic glacierBOT
lone axle
#

Is there something different about the cookie-cutter repo and how it uses Git compared to other library repos? I forked and cloned the cookie cutter repo. But my IDE thinks that none of the files within it have been added to the repo, which is not something I can recall ever seeing.

#

oh, looking back at the terminal I see now that I overlooked this error:

Receiving objects: 100% (702/702), 151.60 KiB | 2.44 MiB/s, done.
Resolving deltas: 100% (405/405), done.
error: unable to create file {{ cookiecutter.library_name }}/examples/{{ cookiec
utter.library_name | lower }}_simpletest.py: Invalid argument
error: unable to create file {{ cookiecutter.library_name }}/{% if cookiecutter.
library_prefix %}{{ cookiecutter.library_prefix | lower }}_{% endif %}{{ cookiec
utter.library_name | lower }}.py: Invalid argument
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

That is likely my issue.

slender iron
#

I'm not seen that. what OS are you on? maybe the file paths are too weird

lone axle
#

Windows

#

and yep, that was going to be my guess that it may not like the brackets used in filenames like that

#

or percents is probably the issue actually, not brackets

#

windows tries to resolve percents as shortcuts or something I think like %APPDATA%

#

I can try with linux in a bit.

onyx hinge
#

@gilded cradle hey, I'm adding a new board to circuitpython.org -- I created my new _board/boardname.md file. Building locally with jekyll, the boardname.html file gets generated, but I can't search it from "downloads". Did I miss a step? I can PR what I have in case you need to see it to answer.

#

hmm I kept fiddling with things and eventually it appeared ‽

prime flower
#

@onyx hinge thats pretty much my web dev experience

gilded cradle
#

@onyx hinge good to hear.

orchid basinBOT
manic glacierBOT
#

I took a look at this function and also in obj.c for the definition of mp_get_index and I think you are right that the error is caused here because theindex which is Zero is >= the length of the empty list len (See below code snippet from obj.c line 423).

As I’m totally unfamiliar with the usage reasons for mp_get_index (It looks like it is doing some kind of type conversion), I would suggest updating the insert function to only call mp_get_index if the list length is > 0.

I...

onyx hinge
#

thanks dan! Thanks dan!

slender iron
trim elm
#

@idle owl Can I push the discord link changes to master as long as I've verified nothing aside from the discord link was changed?

idle owl
#

@trim elm Hmm. Maybe PR a few first?

trim elm
#

@idle owl Yeah, that's probably smart

idle owl
#

@trim elm I mean it's probably fine, and obviously with version control we can roll back mistakes, but it's worth verifying first. PR a few and then we'll go from there.

trim elm
#

Yeah

idle owl
#

@trim elm I approved the last two, merge them once checks pass. And push the rest. But please verify each library once you've pushed, check the commit to make sure that's all there is to it. Basically so we're not finding out later that we borked something. PR to NeoPixel if it's needed, don't push directly.

#

Pypixelbuf as well. PR to that if it's needed.

trim elm
#

@idle owl Sure thing. I've already outputted the diffs to a file and verified that the changes were exactly the same, so I'm confident as far as that one goes, but I'll make sure they are passing the CI

#

Ok, both of those do need it so I'll do that first

idle owl
#

Thank you.

trim elm
#

Ah, neopixel_spi not neopixel needed it

#

Ok, just PRed pypixelbuf

idle owl
#

@trim elm Ok approved pypixelbuf. Please merge it once it's passing.

trim elm
#

Pushing everything else now

#

@lone axle In about an hour (it's probably going to take a while for all the Actions to run) can you verify that half of the libraries I've pushed to are passing CI? I'll do the other half

lone axle
#

@trim elm yep can do.

trim elm
#

@lone axle Also, I'm starting to think we might want to make a directory in the adabot library that houses scripts we've written to do specific things using Adabot. It might be worth making a PR with the script you wrote and a new directory to house stuff like that

#

Ok, they're all pushed. I'll go through in a bit and verify they're passing

#

@lone axle If you want to do the first half (JWT to CharLCD on your list) I can do the second half

lone axle
#

Okay yep I will get the first half once I am wrapped up with what I'm working on now. And I'll make a PR for adabot to add that later on tonight.

trim elm
#

Awesome! Thanks

bronze shadow
#

Does anyone know if something about import depth was changed in cpy 5.3? I updated to that from an older version though i don't remember which, and had my project breakwith RuntimeError: maximum recursion depth exceeded. For fun I loaded the 6.0.0 alpha and it was fine yet again.

#

Project in question if it concerns anyone is this https://github.com/KMKfw/kmk_firmware as it's quite the large bit of code for these tiny microcontrollers.

trim elm
#

@idle owl I found 10 of my ~125 that are failing on either pylint or build docs, that were not previously. No clue why that's happening, and the pylint failures should be easy enough to fix, but I'm not as sure about the sphinx failures. Regardless, I'll try fixing them all tomorrow morning (unless you'd like me to do them tonight, in which case I can).

idle owl
#

@trim elm Nope, I do not want you to do them tonight. 🙂 You should be done for the day.

tidal kiln
#

@idle owl is the pyportal library suppose to be uploaded to pypi?

idle owl
#

No.

tidal kiln
#

looks like it is

#

i just accidentally installed it 🙂

idle owl
#

Hmph

idle owl
#

I imagine it did not work.

tidal kiln
#

nope

idle owl
#

Ok, I'll pull it and re-release it.

tidal kiln
#

was after the blinka one, but guessed at lib name

#

and got the cp one instead

idle owl
#

Yeah that's bad.

#

Will do it tomorrow.

#

Need to give it a setup.py.disabled, release the CP lib, and delete it from PyPI.

prime flower
#

@tidal kiln @gilded cradle has been doing some work on the library, unsure if this is part of it

tidal kiln
#

cool. thanks. yah, no canadian rock band. tomorrows fine.

#

@prime flower semi-related, was trying to test something for that library

#

but pip installed the wrong one (my mistake)

gilded cradle
#

Yeah, the circuitpython version should not be on PyPI, but the Blinka version should. Perhaps in the release notes for the CircuitPython version, we can tell users to install the Blinka version instead.

idle owl
#

@gilded cradle Not sure I want to do that. It's not a bad idea, but I think we should stick to referencing only the lib in its release notes.

gilded cradle
#

Ok, then let's just not mention installing via PyPI (not sure if that's how we're already doing it).

idle owl
#

Yeah I'll get it fixed up.

tidal kiln
#

the CP version just shouldn't be there

idle owl
#

Right.

gilded cradle
#

Can we remove it?

idle owl
#

Yes, I will do it tomorrow.

#

It's already on my list.

tidal kiln
#

thanks @idle owl

manic glacierBOT
manic glacierBOT
#

Ubuntu 18.04
Fresh flash using adafruit-circuitpython-espressif_saola_1_wrover-en_US-6.0.0-alpha.1.bin

From mu editor
Starting Mu 1.0.3
2020-07-08 18:50:34,317 - root:113(run) INFO: uname_result(system='Linux', node='fredrick-Studio-XPS-435MT', release='5.3.0-62-generic', version='#56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020', machine='x86_64', processor='x86_64')
2020-07-08 18:50:34,317 - root:114(run) INFO: Python path: ['/home/fredrick/Development/circuitpython/ESP32-S2/venv/...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

The MemoryError: memory allocation failed, allocating 1784 bytes problems sound like a good match for symbol table addition as it explains why they occur within a certain area of code and shuffle around with code changes.

The start_scan buffer of 1800 seems to offer some useful if werid protection here. I may also "declare" all the variables outside the main loop.

turbid radish
#

?SERVERINFO

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

53

Voice Channels

6

Members

21978

Roles

32

manic glacierBOT
manic glacierBOT
#

The normal way we would debug this is to set a breakpoint on the exception handler and look at the backtrace. That requires connecting a J-Link or similar to the board. That's why I was hoping for a simpler example that occurs often enough to catch this, but I'm not sure that's possible here. Do you think any of that is possible?

The other thing I am looking at is generating and printing a stack trace when these exceptions happen. It looks like this is possible, if we add -funwind-tables...

manic glacierBOT
#

After running erase_filesystem() I can now mount and access the directories.
dmesg still reports some errors though...

root@fredrick-Studio-XPS-435MT:/media/fredrick/CIRCUITPY# sudo dmesg
[38447.024174] usb 3-2.3: USB disconnect, device number 11
[38455.438884] usb 3-2.3: new full-speed USB device number 12 using xhci_hcd
[38455.561785] usb 3-2.3: New USB device found, idVendor=239a, idProduct=80a6, bcdDevice= 1.00
[38455.561787] usb 3-2.3: New USB device strings: Mfr=2, Product=3, S...

#

here is what I see with dmesg (Ubuntu 20.04)

[82416.830309] usb 3-1.2.1: new full-speed USB device number 10 using
xhci_hcd
[82417.052646] usb 3-1.2.1: New USB device found, idVendor=239a,
idProduct=80a6, bcdDevice= 1.00
[82417.052651] usb 3-1.2.1: New USB device strings: Mfr=2, Product=3,
SerialNumber=1
[82417.052655] usb 3-1.2.1: Product: Saola 1 w/WROVER
[82417.052657] usb 3-1.2.1: Manufacturer: Espressif
[82417.052659] usb 3-1.2.1: SerialNumber: 0000000000000000160000000CFCDF
[82417.0...
prime flower
crimson ferry
#

@prime flower Seems to correlate with one of the CP fork issues iirc? What's the process... pull/merge from Arduino, or manually make the (simple) change in the CP repo?

prime flower
#

@crimson ferry which issue?

#

there isnt a process for this (yet) as our fork has yet to pull anything from upstream.

manic glacierBOT
crimson ferry
prime flower
#

I'm curious if large responses are getting dropped due to the linked PR

crimson ferry
#

I often get incomplete responses with 200 HTTP, heven't gotten to the bottom of it

#

@charred flare It's a simple matter to load the NINA firmware onto a standalone ESP32 with USB https://learn.adafruit.com/adding-a-wifi-co-processor-to-circuitpython-esp8266-esp32/program-with-esptool. (fwiw, Airlift add-on boards can also run Arduino 😉 ) ...unfortunately, there are three different procedures for loading/updating NINA on standalone ESP32s (e.g., ESP32 Feather), Airlift add-ons (e.g., Airlift featherWing), and boards with integrated ESP32 (e.g., PyPortal). Standalone definitely the easiest.

charred flare
#

@crimson ferry Yeah I tried that on the last one, to update the firmware and I couldn't get it to load for whatever reason. I'm going to try again on this new one when it arrives. I'd like to stay away from Arduino both for the language and the IDE has always been super buggy for me since I started with these boards here in the last few months. Just tons of issues uploading sketches, duplicate ports showing up, etc.

crimson ferry
#

@charred flare Yeah, I get spoiled with the ease of CircuitPython. If you still have the old one, I'd be happy to work through it with you to try to get it working. If so, let's take it over to #help-with-circuitpython

charred flare
#

Thanks. It's all soldered up and in place though. It works well enough for a dev board. Just needs its own wifi from an old router to connect reliably - for some reason. lol (doesn't like my main Netgear b/g/n router but is mostly fine with the old Netgear running dd-wrt)

manic glacierBOT
manic glacierBOT
#

Has discussed the VID issue before. It seems Nordic allows customers to use its VID in a product with its chip. Of course, there is a risk.

You can use our Nordic's Vendor ID. However, you will have a case that other customer also use our Vendor ID and use the same Product ID that you choose.

from https://devzone.nordicsemi.com/f/nordic-q-a/33851/nrf52840---usb-vendor-id-and-usb-product-id

#

Has discussed the VID issue before. It seems Nordic allows customers to use its VID in a product with its chip. Of course, there is a risk.

You are free to use the VID/PID provided by us free of charge as long as you use it on a product with Nordic chip in it.
The VID is registered in usb.org and it is our registered ID, so there will be no clashes with VID with other vendors, however the PID are chosen by us in our production line and we cannot guarantee that they cannot clash with oth...

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

53

Voice Channels

6

Members

21981

Roles

32

manic glacierBOT
onyx hinge
#

@tulip sleet any idea what the sam d21 equivalent of this is, before I go snorkeling in datasheets? I need to acknowledge the DMA "transfer complete" interrupt for a channel. audio_dma.c:288:9: error: 'Dmac' {aka 'struct <anonymous>'} has no member named 'Channel' 288 | DMAC->Channel[dma_channel].CHINTFLAG.reg = DMAC_CHINTFLAG_TCMPL; | ^~ ../../py/mkrules.mk:55: recipe for target 'build-feather_m0_express/audio_dma.o' failed

tulip sleet
onyx hinge
#

I guess it'll be multiple operations, similar to this? ```void dma_resume_channel(uint8_t channel_number) {
common_hal_mcu_disable_interrupts();
/** Select the DMA channel and clear software trigger */
DMAC->CHID.reg = DMAC_CHID_ID(channel_number);
DMAC->CHCTRLB.bit.CMD = DMAC_CHCTRLB_CMD_RESUME_Val;
DMAC->CHINTFLAG.reg = DMAC_CHINTFLAG_SUSP;
common_hal_mcu_enable_interrupts();
}

tulip sleet
#

so you set the ID, and then write a 1 to TCMPL, it looks like

#

.bit.ID = channel_id, then .bit.TCMPL = 1

#

i would think

onyx hinge
#

er I guess this is enabling the interrupt, not acknowledging it. Still, thanks, I think this points me on in the right direction

tulip sleet
#

Writing a 1 to this bit will clear the Channel ID (ID) Transfer Complete interrupt flag

onyx hinge
#

yeah I've now confusingly referenced several different registers

#

but I think I got the answer I need, thanks

tulip sleet
#

is the code above for SAMD51? I think it has a different method of specifying the channel. When the bits are written, indirect access to the corresponding Channel Interrupt Flag register is enabled. (SAMD21, in that screenshot)

onyx hinge
#

the pasted dma_resume_channel was for D21

#

the error line was code that worked on d5x/e5x but was a compile error on d21

#

ah, I think that line is not needed anyway, it's a relic of previous confusion over whether to use dma interrupts or event system interrupts, which was itself an entire digression because the real problem was a bug that masked interrupts after a length of time. ⏪

tulip sleet
#

@onyx hinge Occasionally I got back and read the ASF3 drivers, which are considerably easier to read. If you checkout circuitpython tag 1.0.0 and go to circuitpython/atmel-samd/asf, you can find the ASF3 drviers (they're probably available from Microchip as a zip file too). Interesting line there:

sam0/drivers/dma/dma.c
225:    } else if (isr & DMAC_CHINTENCLR_TCMPL) {
227:        DMAC->CHINTFLAG.reg = DMAC_CHINTENCLR_TCMPL;
ionic elk
#

What's the best way to submit a change to a library like Protomatter? Should I just fork and clone it separately, or is there some slick method of submitting a PR out of a submodule?

tulip sleet
#

@ionic elk you can add your own fork as a remote to the submodule clone, then you make changes there, and submit a PR from there.

slender iron
#

@bronze shadow what microcontroller were you running on?

manic glacierBOT
ionic elk
#

@onyx hinge when you have a sec can I ask you some protomatter questions?

manic glacierBOT
onyx hinge
#

@ionic elk sure, give me 15 minutes?

ionic elk
#

Sounds good

bronze shadow
#

@slender iron It's the Itsy Bitsy M4 Express

slender iron
#

hrm, I wouldn't expect the stack size to change. I know the STM stack size did

#

there is a performance regression currently but Jeff is working on it

onyx hinge
#

@ionic elk I'm at your disposal

ionic elk
#

Coolbeans - I'm trying to figure out how _PM_timerStart get the actual STM32 timer to do the register stuff they do?

onyx hinge
#

OK, let me look around at the code and refresh my memory

ionic elk
#

I don't see any place where TIM6 is actually passed to the Protomatter object

#

So I don't get how they're doing things like turning SR on and off

onyx hinge
#

I think it's hardcoded

ionic elk
#

but where?

manic glacierBOT
ionic elk
#

You've got stuff like tim->SR, where does the tim get assigned?

onyx hinge
#

here's where it's hardcoded in the core (ports/stm/common-hal/rgbmatrix/RGBMatrix.c): void *common_hal_rgbmatrix_timer_allocate() { // TODO(jepler) properly handle resource allocation including never-reset return TIM6; } and in protomatter (lib/protomatter/arch.h): ```
// Use hard-coded TIM6 (TIM7 is used by PulseOut, other TIM by PWMOut)
#define _PM_timerFreq 42000000
...
#define _PM_IRQ_HANDLER TIM6_DAC_IRQHandler

ionic elk
#

wait hang on yep just found that at the same time

onyx hinge
#

and t6_handle.Instance = TIM6;

#

but basically look for the number "6" in that source file arch.h I guess

#

I'm not proud, it was corner cutting

ionic elk
#

Ok. So, I need to replace all of this with a single call to the stm_peripherals_find_timer - but I guess that's how SAMD must do it so maybe I should just check out how that does it

#

thanks for the pointer

onyx hinge
#

in principle you get the "correct" timer pointer to void _PM_timerInit(void *tptr) in arch.h

#

but whether that happens yet or not I don't know

#

so anyway the right way is to pass the timer in to _PM_init, it gets to core->timer, which is then passed to _PM_timerInit cast to void*

manic glacierBOT
onyx hinge
#

normally common_hal_rgbmatrix_rgbmatrix_construct gets called with timer parameter as NULL, so it calls common_hal_rgbmatrix_timer_allocate and passes that to _PM_init where it gets stored to core->timer, and later core->timer is passed to _PM_init.

#

once you have all that happening, you can start to remove the hard-coding from arch.h in protomatter

manic glacierBOT
silver tapir
#

@gilded cradle It was so cool to see the pyportal electioncal on a biggger Raspberry screen. Looks great.

manic glacierBOT
gilded cradle
#

Thanks @silver tapir. 🙂

manic glacierBOT
#

I am not sure if there's anything to fix or work around on the software side. If there really is a glitch in the 3.3V rail that drops it below the 2.7V brownout level, then that's an electrical issue which could be significant. For instance, the external QSPI flash chips are not spec'd for operation below 2.7V, and could read or write bad data if their voltage dips.

idle wharf
#

That Fluff a great idea @stuck elbow !! I hope an ESP32-S2 one exists some day as well.

digital shoreBOT
#

dynoSuccess Dylan H#2310 was unmuted

slender iron
#

@trim elm don't ping a bunch of people at once

manic glacierBOT
#

This aims to fix #3134.

It sets the version and release values to the output of git describe --dirty --tags when sphinx-build is run in the build workflow. This overrides the value that is set in conf.py of 0.0.0.

I've tested building the docs using the -D flag and manually setting the version and release values and that seems to work just fine. But I do not know if this approach of using the output from git describe --dirty --tags will give the value needed. Either wa...

tulip sleet
#

@dherrada if those libs already have releases, no reason I know of not to release

#

you mean all the BLE ones?

idle owl
#

My bad, I asked Dylan to ping you four. Keep forgetting about the lockdown.

gilded cradle
#

Pretty much what @tulip sleet said. Though I can't think of any that shouldn't be released.

trim elm
#

Yeah, everything. I can link to the list if you'd like me to, but just assume that I'm releasing all of the libraries

tulip sleet
#

are there any that have never had a release?

trim elm
#

Not sure, but my script throws a TypeError when that happens so I look at those manually

manic glacierBOT
idle owl
#

@tidal kiln @gilded cradle Hah.... I went into my PyPortal lib directory and it was on a remove-from-pypi branch.... I had already done most of the work, but I neglected to delete it from PyPI. It's gone now.

slender iron
#

@prime flower can chat whenever you are ready

prime flower
#

@slender iron great, lemmie grab a water real quick

slender iron
#

kk

gilded cradle
#

Awesome @idle owl. It's possible that you deleted it and due to the cookie cutter naming everything Adafruit-CircuitPython-xxxx by default, I may have accidentally released to it when I was first creating the lib.

idle owl
#

@gilded cradle Who knows. I found the PR where I made it setup.py.disabled on May 4 I think. The last time PyPortal was updated on PyPI was April. Either way, it's gone now.

prime flower
#

@slender iron back! Amelia ok?

slender iron
#

yup

stuck elbow
#

@idle wharf esp fluff is hard to do, because antennas and RF stuff

idle wharf
#

@stuck elbow True. I guess the first decision would be on-board antennas or connectors.

stuck elbow
#

I will definitely want to do a PewPew with esp32-s2 at some point

#

but I will probably just use a module for it

manic glacierBOT
turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

53

Voice Channels

6

Members

21991

Roles

32

manic glacierBOT
idle owl
#

@gilded cradle Do you have a few minutes to talk about PWM on Pi? I'm trying to understand what I'm supposed to be doing to this servo guide.

gilded cradle
#

Sure

idle owl
#

Does it "just work" as is? Or does the code need to be updated to do something else to utilise Blinka's PWM

gilded cradle
#

It should just work as is.

idle owl
#

Fair enough, ok, so do you figure I simply need to include a wiring diagram using a Pi to indicate it works?

gilded cradle
#

You'll probably just need to make sure you have the latest version of Blinka.

idle owl
#

Update the code pages to reference "python" as well

#

Ok

gilded cradle
#

Yeah, it would probably be a good idea to have a wiring diagram.

#

I would test it of course. 😉

idle owl
#

Yah fair enough. I wasn't sure whether Limor wanted me to do that or you. I'll find out.

gilded cradle
#

Ok

idle owl
#

I was supposed to ping you about something anyway, not sure what specifically.

#

I have a Pi here, needs to be updated is all.

gilded cradle
#

Ok. Maybe she meant to ping me if it doesn't work or you get stuck?

#

Or you just have questions...

idle owl
#

About to find out.

#

Yep I'll be doing it.

gilded cradle
#

That works 🙂

jovial wasp
#

New to circuitpython and discord
Looking to use pedometer methods in adafruit_lsm6dsL LSM6DS33

Tag: 3.0.0 has support
Tag 4.0.0 does not have support

lone axle
manic glacierBOT
#

For the raw_data m_malloc here:

https://github.com/adafruit/circuitpython/blob/c1bcc25b88ff76dcbd7e365b3e9be7a94806f66b/ports/nrf/common-hal/_bleio/Adapter.c#L449-L453

What is the GC approach that stops this being GC'ed? I've seen discussions about this in the past and I thought it scanned python objects, the stack, registers and some explicit mechanism which may be MP_STATE_VM/MP_STATE_PORT ?

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Our Seeed friends have kindly allowed us to use their VID with a range of PIDs.
@ladyada Is it OK that I use Seeed's VID 0x2886 and the PID 0xf001 for our products in this project? One PID should be enough as all these products are based on nRF52840 and have the same driver for an OS.
You may ask why not buy a VID. Although being comparing to seeed, sparkfun, arduino and adafruit, we are still a small team with 3 persons and can not afford a USB VID yet. It doesn't break any rule by usi...

manic glacierBOT
#

we purchased a VID when we were only a few people too, about 10 years ago. if you are selling USB products, it is the cost of doing business, just like it costs money to buy components and PCBs :)

you can totally use VID/PIDs donated by others. it is important that each circuitpython board has unique VID/PID. having duplicates will cause problems for customers. please ask seeed to grant you individual PID's for each item so they are unique.

manic glacierBOT
onyx hinge
#

now I want this M60 keyboard 🙂

manic glacierBOT
manic glacierBOT
#
orchid basinBOT
manic glacierBOT
onyx hinge
#

@gilded cradle On Monday during the meeting can you paste the newsletter links in? I'll be mostly running the meeting, and Kattni will be doing the recording so she doesn't want to be entering stuff in her discord client.

onyx hinge
#

huh, apparently common_hal_mcu_disable_interrupts is pretty expensive on nRF

tulip sleet
#

@onyx hinge Do you have a minute to chat about background tasks? I have to add a background task to the general-purpose HCI _bleio code I'm writing, and would have to add it to every run_background_tasks() in all the ports. There is a lot of duplicate code in the multiple impls of that routine.

In your recent work on background tasks, are you refactoring any of this into some shared routine?

onyx hinge
#

sort of

tulip sleet
#

huh, apparently common_hal_mcu_disable_interrupts is pretty expensive on nRF
@onyx hinge Yes, it has to keep the BLE stuff running, so it can't really just disable all inteerrupts.

onyx hinge
#

I am focused primarily on making certain things happen due to interrupts, and those things are then pulled out of the per-port run_background_tasks

#

I don't think that'll get me to them being 100% identical but a good thing to do while I'm there would be to pull out the common parts into a supervisor function

tulip sleet
#

right, I expect there to be some per-port stuff, but they all have to check for usb, display, filesystem, etc. background tasks. I will just continue not assuming that but will be happy to adapt when I have to merge in and you have probably already merge in

onyx hinge
#

what time frame are you operating in? nRF went fast (I think that after my addition to that PR just now, it is faster than 5.3 and probably works right 🙂 but I didn't test the audop peripherals)

tulip sleet
#

oh, at least a week before any PR, and that would be incomplete functionality. There is a lot to do

onyx hinge
#

but that leaves stm, esp32, cxd, imxrt, etc

#

and litex, which I don't have hardware to test on. bummer.

tulip sleet
#

i will just add to atmel-samd for now and leave myself a big note

#

tnx

onyx hinge
#

OK, I think you should get your wish but I'm just not ready to guarantee it'll come in time

#

The bootloader allows you to load CircuitPython, Makecode, and Arduino programs. The bootloader is not CircuitPython. You can check the current version of your bootloader by looking in the INFO_UF2.TXT file when the BOOT drive is visible (FEATHERBOOT, CPLAYBOOT, etc.).

#

hm this boilerplate about what the UF2 bootloader enables is probably the same on all the boards, but .. I'm pretty sure https://circuitpython.org/board/same54_xplained/ doesn't support Makecode and idk about Arduino

The SAM E54 Xplained Pro evaluation kit is a hardware platform for evaluating the ATSAME54P20A microcontroller (MCU). Supported by the Studio integrated development platform, the kit provides easy access to the features of the ATSAME54P20A and explains how to integrate the dev...

tulip sleet
#

i wrote that boilerplate, I can caveat it.

onyx hinge
#

the device also doesn't ship with uf2 bootloader so the updater won't do many people any good ; but I think that since circuitpython is placed "above" the bootloader, it is probably needed before you load circuitpython on it. I did everything with the debug usb port of course

#

you need a different linker script to work on a bare board, right?

tulip sleet
#

you can turn off the bootloader updater box in circuitpython.org for that board if you want

#

only because the origin is different

#

i would not recommend changing the linker script, I would say CPy is not supported unless you install a bootloader

onyx hinge
#

How's this sound?

CircuitPython requires that the board be flashed with the UF2 bootloader. This can be done using the second USB connector, which provides a debug interface. After this has been done once, CircuitPython can be updated in the usual way using the UF2 bootloader, or by using the debug USB connector.

tulip sleet
#

would you add that to board description? The UF2 update boilerplate is shared across all the atmel-samd boards

onyx hinge
#

Yea I'm imagining that is going in the board md file above the bullet list of features

#

It also seems like the board doesn't actually run unless you have the debug interface going which is weird .. but maybe that's how they wanted it

tulip sleet
#

i think that's fine. We are talking about order-of-magnitude 10 people I think who will try this

onyx hinge
#

yeah, agreed

orchid basinBOT
gilded cradle
#

Sure @onyx hinge Do you just have them lined up beforehand?

onyx hinge
#

@gilded cradle yeah the links will be in the notes doc, copying them from the newsletter draft is something I will have done shortly before the meeting

#

what I've done when I'm in the "pasting links" role is try to paste them when the speaker is starting to talk about that item. it's not critical.

#

If there are multiple links, I often pick just one, according to my feelings. If there's a non-twitter link, I use that one 🙂

manic glacierBOT
#
/usr/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: build-feather_stm32f405_express/lib/protomatter/core.o: in function `TIM6_DAC_IRQHandler':
/home/runner/work/circuitpython/circuitpython/ports/stm/../../lib/protomatter/arch.h:811: multiple definition of `TIM6_DAC_IRQHandler'; build-feather_stm32f405_express/peripherals/timers.o:/home/runner/work/circuitpython/circuitpython/ports/stm/peripherals/timers.c:341: first defined here

protomatter will need to be ...

gilded cradle
#

Ah, ok. Thanks

onyx hinge
#

none of it is critical, but I always liked the links appearing in the channel when PT did it, so I spontaneously started doing it when he had to step back

manic glacierBOT
ionic elk
#

@onyx hinge Re: your comment, already did it

#

check out my PR to adafruit/protomatter

onyx hinge
#

@ionic elk okay, I was catching up on review requests and noticed it

ionic elk
#

👍

manic glacierBOT
manic glacierBOT
slender iron
#

@hybrid urchin hey! I got my orangecrab today!

hybrid urchin
#

\o/

slender iron
#

guess what I want to do? 🙂

hybrid urchin
#

I'm pretty sure I know what you want to see running on it 😛

slender iron
#

😄 I assume I want to start with the litex port we have

hybrid urchin
#

I'll write up a quick guide and make sure everything is still working. It's been a little while since I've had it running.

slender iron
#

ooooh, even better. I didn't know you've had it going

#

do you have it going with the ram and flash?

hybrid urchin
#

Yep! But that was basically all. Didn't have I/O or extra peripherials.

slender iron
#

kk, that's a start

#

digitalio and busio are the next things

#

I'm really interested in SoC design too

#

how fast can you clock the cpu?

#

you are using litex for the SoC right?

hybrid urchin
#

With the VexRiscv max speed is around 80MHz. I've gennerally had it set at 72MHz. There are lots of knobs to turn if you wanted to tune for performance.

#

Yep.

slender iron
#

very cool!

#

so excited to have pins to play with

hybrid urchin
#

With the current configuration litex supports, the DDR3 memory runs at 2x CPU speed.

slender iron
#

haha nice!

hybrid urchin
#

So I've been spliting the 128MB DDR3 into two areas for firmware/data. And there is a small routine that runs on startup that inits the DDR3, and copies the FLASH into the DDR3 memory space.

slender iron
#

that makes sense! it's still way more ram than we have on any other CP board

slender iron
#

@hybrid urchin is your repo public in case I want to poke at it later?

hybrid urchin
slender iron
#

ok awesome! Let me know when the SoC is available. I2C support will add support for most featherwings

#

it would be nice to have an iomatrix too. I know it's antithetical to fgpa design

hybrid urchin
#

Cool, iomatrix? is that for interfacing to pin-muxing?

slender iron
#

ya, to change peripheral to output pin mapping from circuitpython

#

k, I gotta make dinner. thanks! very exciting

hybrid urchin
#

Okay, I've pushed my test SoC. and some small changes to get it building. But it's from april and ~1000 commits behind the main branch.

Adafruit CircuitPython 5.2.0-24-gc88db8a4e-dirty on 2020-07-11; OrangeCrab with VexRiscv
>>> 
manic glacierBOT
manic glacierBOT
#

Initial starting point for adding the OrangeCrab board to the Litex port.

The procedure to actually run on the hardware is currently a little bit different from how the fomu port works.
You currently have to build the SoC that CircuitPython will run on, then combine the two into a single file that gets loaded onto the OrangeCrab. (There are ways we can decouple the SoC from the firmware, but this is the easiest way to get started)

See guide here: https://github.com/gregdavill/OrangeCr...

manic glacierBOT
manic glacierBOT
#

This code looks wrong for some values https://github.com/adafruit/circuitpython/blob/82427612d15ac85d0a34132ace7f8369dacd66ef/shared-module/audiocore/WaveFile.c#L223=L237

For length_read of 4 it's ok, 6 happens to work, but 5 and 7 would be problematic as they would yield pad lengths of 1 and 3, respectively, rather than the desired 3 and 1. I suspect that was intended to say something like:

            uint32_t pad = sizeof(uint32_t) - length_read % sizeof(uint32_t);

I...

manic glacierBOT
#

I think you're right about the first thing, please pull request the change especially if you have a test case.

I also think you're right that the intent of this code is to ensure that the size of the buffer returned to the caller is always a multiple of 4 bytes long, no matter whether it's 1 or 2 samples, 8 or 16 bit samples. (however, raw samples can be any length so the actual audio hal implementations can't depend on this in general)

Note that when looping samples are involved, they...

manic glacierBOT
manic glacierBOT
kind river
#

With Circuit Python on a larger FPGA like the ECP5, you could probably make configurable IO "cells" which each contain one of each peripheral. This would allow you to uses as many of any peripheral as you have pins for.

hybrid urchin
#

That makes sense! You might still want/need some form of muxing with modules that would span over multiple io cells though? for example SPI/I2C

kind river
#

That's how the Parallax Propeller 2 smart pins work. The XMOS chips also use a similar method where pins/ports can can be in/out/both and can be clocked by another pin or an internal clock that can optionally be exposed on a pin.

#

Both of these methods use generic logic that can be configured to act as various peripherals though, so they require more software support.

slender iron
#

@hybrid urchin I wasn't able to build the soc

#
4.39. Executing DFFLEGALIZE pass (convert FFs to types supported by the target).
ERROR: Conflicting init values for signal 1'0 (\soc_basesoc_interface_adr [5] = 1'x != 1'0).
hybrid urchin
#

Ohh, yeah. There is bug that a recent Yosys change has un-covered. Perfect timing right 😛

slender iron
#

ok, perfect

hybrid urchin
slender iron
#

ok, let me go snag an older toolchain zip

slender iron
#

kk, will try now

hybrid urchin
#

I'll try it here too, just to make sure I'm not sending you down a rabbit hole.

slender iron
#

looks like it got past that step

#

being thwarted by the mac security exceptions

ivory yew
#

idk if anyone ever wondered about it, but CircuitPython on the SAMD21 should take about 12us (2 * 5.67) to do an ADC conversion, and it won't be accurate if the input impedance is higher than 7kOhm.

#

As far as I can tell, Arduino's config is almost identical but they bump up samplelen to 2 which increases their total conversion time to about 14us (6.67 * 2) but also increases their max input impedance to ~60kOhm.

#

might be worth considering for us, as 7kOhm is pretty low especially if someone uses a 100k pot as a voltage divider to feed an analog input.

tulip sleet
#

Is our clock rate 1.5MHz as you set above in the calculator? I think we are using GLCK0 (48 Mhz) as the clock (ports/atmel-samd/peripherals/samd/samd21/adc.c): I don't see that we are setting the clock divider at all in common-hal/analogio/AnalogIn.c, so it looks like it might the default CTRLB.PRESCALER set to 0x0, which is divide by 4.

manic glacierBOT
#

Hi,

Requesting a VID/PID for a new Circuitpython, Feather form factor based board call TinkeringTech Scoutmakes Azul.
Will be submitting a PR to add to CP. Its based on the Adafruit nRF52840 express with some additions:

-128x32 OLED built-in
-USB type C
-Power switch

At the home stretch of getting the boards out.
https://www.instagram.com/p/CBdmkFbJNzQ

Thanks for the work on CP!

ivory yew
#

@tulip sleet iirc the prescaler is set in asf_conf

tulip sleet
#

aha, forgot that

ivory yew
#

DIV4 would be too fast

#

The fastest the ADC is supposed to run is 2100khz

tulip sleet
#
// <o> Prescaler configuration
// <0x0=>Peripheral clock divided by 4
// <0x1=>Peripheral clock divided by 8
// <0x2=>Peripheral clock divided by 16
// <0x3=>Peripheral clock divided by 32
// <0x4=>Peripheral clock divided by 64
// <0x5=>Peripheral clock divided by 128
// <0x6=>Peripheral clock divided by 256
// <0x7=>Peripheral clock divided by 512
// <i> These bits define the ADC clock relative to the peripheral clock (PRESCALER)
// <id> adc_prescaler
#ifndef CONF_ADC_0_PRESCALER
#define CONF_ADC_0_PRESCALER 0x3
#endif
#

yes

#

when we were first doing all this we tried to be approximately like Arduino, so as not to surprise people migrating over. But I would not be surprised that we lost track of that when I was converting from ASF3 to ASF4.

ivory yew
#

I think Arduino changed things recently as well, but I'm not sure.

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

53

Voice Channels

6

Members

22098

Roles

32

manic glacierBOT
#

This is not a new issue, I tested as far back as CP 5.0 with similar results. The issue seems to be that when a compute-intensive instruction is being run (and the 'a = 2**(65536*2)' takes about 4 seconds) there are no breaks to run any background tasks. As a result, the USB handshakes and commands take a very long time to complete. The only calls to run_background() happen when we move to the next line in the WHILE loop. Maybe we are getting one command through at a time?? Should there be so...

manic glacierBOT
manic glacierBOT
#

Relatedly, the current linker file only correctly implements the required workaround if SOFTDEVICE_RAM_SIZE is a multiple of 8K of at most 56K. The workaround is to give the SPIM3 a dedicated physical RAM block, and there are eight lower RAM blocks with a size of 8K and one 192K upper RAM block.

Also, I believe https://github.com/adafruit/circuitpython/blob/37e77b21cd3e33b00675310e4070e115d3c2357c/ports/nrf/boards/common.template.ld#L44 should be + LENGTH(SPIM3_RAM).

PS. Thanks for...

#

Relatedly, the current linker file only correctly implements the required workaround if SOFTDEVICE_RAM_SIZE is a multiple of 8K of at most 56K.

Right, this should be noted in a comment. The SOFTDEVICE_RAM_SIZE was determined by trial and error, and I always meant it to be a multiple of 8K.

Also, I believe

https://github.com/adafruit/circuitpython/blob/37e77b21cd3e33b00675310e4070e115d3c2357c/ports/nrf/boards/common.template.ld#L44

should be + LENGTH(SPIM3_RAM).
...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
onyx hinge
#

What's the minimum I need to do to see an nrf device in the bluefruit connect device? Just having it powered is not enough?

#

ok got it

#

@tulip sleet okay, whee, it looks like I have successfully moved the BLE background stuff into supervisor code while working on this stuff

#
...
+    #if CIRCUITPY_BLEIO
+    supervisor_bluetooth_background();
+    bonding_background();
+    #endif
...
}```
#

does that seem like it will fit your needs?

#

like you noticed the background functions are mostly similar, they call functions guarded by #if enables and bleio maybe fits into that mold

tulip sleet
manic glacierBOT
onyx hinge
#

That sounds good, if I get there second I'll deal with the merge conflicts

ionic elk
#

@onyx hinge My question about the protomatter merge conflict is more that the merge conflict is actively wrong? It claims there's duplicated code when there is no such thing. It's suggesting I have two copies of #define _PM_pinOutput(pin_) do { when you can look at the code and see that's not the case.

onyx hinge
#

In my experience, it doesn't matter whether I think git is wrong, I still have to deal with reality as git presents it to me. Sounds weird though.

ionic elk
#

I don't mean to just complain about it I was simply confused about how to solve it

onyx hinge
#

I intended my advice to be constructive, so I hope you'll accept it in that vein even if it was useless

#

if it's that weird I'd probably just manually make my edits on a fresh branch at the tip of master

ionic elk
#

No no it's all good I didn't mean it like that. I was just wondering if you knew about why it was doing the weird conflict message. Your suggestion is fine and might solve it anyway - which commit should I try to target, though, if master isn't working?

onyx hinge
#

I'd just say fix it while you're in there

ionic elk
#

Should I maybe choose one slightly behind master?

#

Oh ok that works too

onyx hinge
#

I am PRETTY sure it's utterly trivial to fix

#

but y'know .. when I'm wrong, don't hesitate to raise the issue again

manic glacierBOT
ionic elk
#

So ST, in their infinite wisdom, decided to name an enum value for their TIM6 IRQ two different things across chip families - TIM6_DAC_IRQn vs TIM6_IRQn. Is there any way for me to actually check whether an enum value like this is defined, like I can a macro?

#

Right now I get undeclared here (not in a function) errors but I don't know how to fix this for an enum?

manic glacierBOT
#

@riggs points out in #2946 that the nRF52840 has 8 8kB RAM blocks (RAM0 - RAM7), in the first 64kB of RAM. But we are currently using all those blocks for the SoftDevice application RAM (SOFTDEVICE_RAM_SIZE == 64kB). So the SPIM3 8kB block we reserved to overcome the SPIM3 erratum is too high in RAM, and is in RAM block RAM8, which is 192kB, not 8kB.

It appears that the SoftDevice RAM region must start at 0x0, so we cannot swap things around to fix this. Instead, we must reduce the size ...

lapis hemlock
#

@onyx hinge @tulip sleet do you have hardware that would be affected by this issue: https://github.com/v923z/micropython-ulab/issues/132 ? I think the solution is in upstream micropython. I will try to produce a fix today, and I just wanted to pass the information along, in case circuitpython has to be patched up, too.

onyx hinge
#

@lapis hemlock no, we don't use double-precision on any of our hardware

manic glacierBOT
#

Hi @dahanzimin, I have not been able to get a wechat because I do not know any mainland Chinese people who can help me with security verification. Would you be interested in helping me verify my account? I would love to discuss the STM32.

I'm very happy. I understand that you need to download the wechat app and register with your mobile phone number. Of course, I haven't registered wechat overseas, or how can I help you complete the security certification

lapis hemlock
#

@onyx hinge OK, thanks for the feedback!

manic glacierBOT
manic glacierBOT
#

Would it be possible (or reasonable) to use a timer at the start of such
operations to provide interrupts where background tasks could be run?

On Sun, Jul 12, 2020 at 5:58 PM Dan Halbert notifications@github.com
wrote:

The longint operations are single virtual machine opcodes; the background
task running does not happen during that time. That's the basic problem. We
could sprinkle calls to run background tasks through the longint code, but
we need to make sure that does not violat...

onyx hinge
#

<@&356864093652516868> The weekly meeting is coming up in about 10 minutes! Hope to see you there. Please, if you can add your hug reports and status updates to the doc, it's super helpful. And if you'll be lurking (just listening in), it's also super helpful to note that too

#

@slender iron just a reminder -- I would like you to do the overall section when we get into the state of circuitpython (as well as the core)

#

@gilded cradle will you be able to paste relevant links out of the notes doc as we go along?

modern wing
#

Good afternoon all you wonderful folks -- happily lurking today, and I've updated the doc to reflect as such 🙂

turbid radish
#

?serverinfo

digital shoreBOT
#
adafruit
Owner

adafruit#3230

Region

us-west

Channel Categories

8

Text Channels

53

Voice Channels

6

Members

22131

Roles

32

gilded cradle
#

@onyx hinge yes. All prepared.

onyx hinge
#

@gilded cradle appreciated very much

#

If anyone would like to do mic checks before we get started, now is a great time. Five minutes from now is too late

lone axle
#

🚫 🐿️

turbid radish
#

lurking

silver tapir
#

lurking

turbid radish
#

riiiiight

modern wing
#

I wish I had a GoXLR setup to pitch-shift my voice to sound like a chipmunk....because I'd never do that. That'd be mean 😛 🐿️

uncut nexus
#

Lurking today

stuck elbow
#

alurkin'

gilded cradle
thorny jay
#

Lurking.

errant grail
#

Text only

gilded cradle
slender iron
#

@quartz patio @pine rampart are you just listening to the meeting? (aka lurking)

gilded cradle
modern wing
#

Solar-powered blogs don't cast any shade 🙂

turbid radish
#

ugh

#

Tips: @anne_engineer

manic glacierBOT
slender iron
#

💯

silver tapir
#

Happy to translate.

errant grail
#

Hug to @onyx hinge specifically for the ulab learning guide. It's an excellent guide for the newbee (me).

silver tapir
#

Yey, two @idle owls are better than one.

modern wing
#

ImitationKattni has been asked kindly to follow the Code of Conduct. 😉

turbid radish
#

The Kattni from the Alternate Universe ((c) Star Trek) is a bit rowdy

slender iron
#

influxdb and grafana are great for storing sensor data too

thorny jay
#

@lone axle Can I have Pybadger library support for CLUE too and Mini PiTFT 240x240? And then I don't have to do anything anymore.

lapis hemlock
#

I am only lurking today.

slender iron
#

welcome!

lone axle
slender iron
#

esp32-s2 yes please

#

pulseio or analogio

thorny jay
ionic elk
#

@slender iron would probably make sense to do pulseIO since I've been working on it recently for i.MX/STM recently anyway

slender iron
#

sure! (mute your mic too)

ionic elk
#

whoops srry

slender iron
#

np

ionic elk
#

anyway, still need to get a control up and going for the ESP so I'll try and do that this week sometime

slender iron
#

kk, great!

turbid radish
#

It's a GitHub Awesome list

#

Beat ya

slender iron
#

yup 🙂

turbid radish
#

It is a lot of data

#

The 'Wing product pages have some info on compatible Feathers where things are a bit tricky

#

And third party boards can be very challenging

gilded cradle
#

Me too

turbid radish
#

Me too, no audio

thorny jay
#

Oups...

slender iron
#

@thorny jay can you hear us?

thorny jay
#

No

slender iron
#

hrm, try reconnecting

#

still can't hear you

thorny jay
#

Ok.

gilded cradle
#

You may need to restart discord

thorny jay
#

close the meeting

slender iron
#

we're trying to note it better on the downloads page and PRs welcome where we miss it

turbid radish
#

Thanks all

modern wing
#

Thanks!

gilded cradle
#

Thanks

silver tapir
#

Thanks for hosting @onyx hinge, was excellent.

thorny jay
#

By

modern wing
#

Indeed, excellent job @onyx hinge!

onyx hinge
#

@thorny jay Thanks for noting the limitation of the Espruino, pull requesting a change would have been perfectly appropriate

gilded cradle
#

You did great

silver tapir
#

We need to neotrellis that.

thorny jay
#

And I really like the sound of your voice and how you have a sentence for everybody.

#

And also give a warning to the next next speaker.

#

That is really great @onyx hinge

#

It is cross reference Youtube link to Github and Github link to Youtube.

#

How do you go from GoogleDoc to MarkDown?

#

Ok

#

Chronological order.

#

Monotonic(?)

#

Yes but not reverse way!!!

#

Bye!

onyx hinge
#

I could still steam ahead, it would just make a pull request

You’re making changes in a project you don’t have write access to. Submitting a change will write it to a new branch in your fork jepler/adafruit-circuitpython-weekly-meeting, so you can send a pull request.

#

I added this as a prereq in the doc

slender iron
#

@onyx hinge added you to the circuitpython team and gave that team notes permission

onyx hinge
#

👍

idle owl
#

@onyx hinge Thanks for adding it as a prereq to the doc.

orchid basinBOT
manic glacierBOT
#

Background tasks need to run at a "safe' time, when there isn't a storage operation in progress, etc. It is probably possible to add calls to check for background tasks before the storage allocations in the longint code.

Though it's not good the longint code locks out background tasks, it would be good to know the use case for doing longint operations with huge operands. When you first found this, were you trying to compute something, or was it just to see how well the longints work?

onyx hinge
#

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

manic glacierBOT
manic glacierBOT
#
[adafruit/circuitpython] New tag created: 5\.3\.1
orchid basinBOT
slender iron
#

Anyone object to removing displayio.Shape in 6.0.0? I don't think anyone uses it.

#

vectorio is probably better anyway

manic glacierBOT
manic glacierBOT
#

Hi, thanks for noticing this. I tested UART.readline() with 5.2.0:

readline() does not return a string, it returns a bytes. It returns None if there's nothing to read,. regardless of timeout = or > 0. It will return everything in the UART buffer when the timeout is reached, except that if there's a \n in the buffer, it will return only up to and including the next\n.

It should probably be noted that newline means exactly that; \n, and not \r. When testing I noted that ...

slender iron
#

Ok, I did a decent issue sweep. Didn't go through all of Long Term. I bet there are more issues we can close

manic glacierBOT
#

Currently that is handled by the LiteX bios. On startup the following things happen:

  • SoC starts executing at 0x00000000, this memory is frimware embedded in the gateware (litex bios).
  • We configure and validate that the DDR3 controller and memory is running correctly
  • We look in FLASH for a RISCV firmware. 0x20100000 the firmware is prefixed with a crc32 and length.
  • If crc check passes the firmware is copied into DDR3 memory address space, 0x40000000.
  • We jump to 0x40000000.

It...

#

Yes, sdcard-in-core and sdio both improve on this, unless I overlooked something. I did not specifically test for this, the following's based on my thoughts about how shifting things into the C core will relate to background tasks.

If you use either of these instead of adafruit_sdcard, then it is not possible to enter background tasks during an SD card I/O operation, so the case of reading/writing SD in the foreground will not cause any problem (other than a delay) if background tasks als...

#

Yes, I'll fix that.

It will be possible to simply reset the board, but with the current bootloader I'm not sure we can perform a "reset into the bootloader", the multi-boot features are different on ECP5 as they are on the ice40. In it's current form the bootloader is watching for the button to be pressed.

I'll need to think how we can handle this, it may require using volatile bits in a FLASH config register.

onyx hinge
#

@slender iron thank you for doing that! I don't know if it felt like a slog to you but from over here it is a great reminder that we've been getting things done. Go team! go community!

manic glacierBOT
manic glacierBOT
#

Added a call to RUN_BACKGROUND_TASKS in the loop in mpn_mul(). This allows USB requests to be processed during long-running multiplications. Tests were also run to check performance impact. Surprisingly, when using the test script from issue 2949 there was a 3-5% performance improvement with the change. Note that the second test mentioned in that issue (running 10**40000 from REPL) is not really affected by this patch, as tracing shows that the time for that command is actually being spent i...

manic glacierBOT
#

RUN_BACKGROUND_TASKS is not necessarily that cheap. I would suggest testing the performance impact on loops doing much shorter longint manipulations, such as multiplying two numbers that are only a couple of 32-bit words long. The #2949 code seems pretty pathological to me.

If we really want to worry about this, then I think we could check the lengths and only do this every <n> words, where n is order-of-magnitude 100 or 1000 or whatever. Or we could monitor a tick counter in an efficien...

manic glacierBOT
#

I have run multiple tests, using both short and long numbers; and the
version with the change to run background tasks
always is faster (1-5%) than the standard version. I currently have no
rationale for this; but the results are consistent.
So, I don't think there is a significant cost to the suggested change.
I will see what the performance impact of counting ticks would be; but
since just calling RUN_BACKGROUND_TASKS doesn't
seem to be costing us anything I'm not sure what the benefit would...

manic glacierBOT
#

Hi,

I need to use usb_hid for a Braille Display. Currently I am using a custom 
USB Descriptor and every time I am sending an OUT Report to the Itsybitsy M4 Express,
the usb_hid device implementation calls the wrong callback function. By sending an OUT Report, instead of entering
the "hidd_control_complete"(circuitpython/lib/tinyusb/src/class/hid/hid_device.c)
function, it enters the "hidd_xfer_cb"(circuitpython/lib/tinyusb/src/class/hid/hid_device.c)
function which calls "tud_...
manic glacierBOT
#

Like @dhalbert I am surprised at your benchmark results. At the tip of main, RUN_BACKGROUND_TASKS is fairly expensive (relative to 5.3.0) and I am working on addressing that at #2879.

If the finding that there's no important performance reduction (or indeed if there's a performance increase) with #2879 merged is duplicated, I think it makes total sense for this to go in.

When #2979 does land, supervisor_run_background_tasks_if_tick() (which is what RUN_BACKGROUND_TASKS expands to...

#

BTW, not that relevant to this issue but on the reacting within 700ms front, do you mean 70ms? One of my learn guides featured testing this using a CPX. Just under 200ms is generally achievable if you're very focussed and finger is resting on the button. Sub 250ms isn't too difficult and that includes a 74 year old friend in a noisy cafe. Graphs here: https://learn.adafruit.com/circuit-playground-bluefruit-quick-draw-duo/reaction-timer-results

manic glacierBOT
#

BTW, not that relevant to this issue but on the reacting within 700ms front, do you mean 70ms? One of my learn guides featured testing this using a CPX. Just under 200ms is generally achievable if you're very focussed and finger is resting on the button. Sub 250ms isn't too difficult and that includes a 74 year old friend in a noisy cafe. Graphs here: https://learn.adafruit.com/circuit-playground-bluefruit-quick-draw-duo/reaction-timer-results

Imm not sure what you mean about 70ms. There...

#

Bluetooth Low Energy advertises over one of three channels by design. This design is intended to reduce the chance of congestion or jamming breaking the advertising mechanism. In general, this makes a lot of sense in an uncontrolled environment but for some uses this isn't optimal as the expected number of received packets is 1/3 of transmissions.

  1. For exchanging data within a room which might be a classroom, I suspect the single channel approach is superior in terms of low-loss communic...
#

RUN_BACKGROUND_TASKS cannot take negative time. So I think there may be something wrong with the timekeeping if inserting it causes the tests to appear to run faster. A way to check this would be to do some kind of "wall clock" check, such as toggling a pin before and after the operation, and measuring the pin-toggle time with a Saleae or similar.

Another thing that might be happening is that inserting RUN_BACKGROUND_TASKS is causing the longint operation to be truncated or not finishe...

manic glacierBOT
manic glacierBOT
#

Addition and subtraction are probably quite quick relative to multiplication; and adding it to multiplication gets ** powers too. Division would be similarly long-running as multiplication. (think of how we write out addition and multiplication long-hand; you write down a "lot more" when multiplying two numbers than when adding two numbers. The performance of the "mpz" multiplication and addition code roughly mirrors the number of digits you'd write down doing long-hand arithmetic; heavy...

#

Bluetooth Low Energy advertises over one of three channels by design. This design is intended to reduce the chance of congestion or jamming breaking the advertising mechanism. In general, this makes a lot of sense in an uncontrolled environment but for some uses this isn't optimal as the expected number of received packets is 1/3 of transmissions.

This is not my understanding, and I re-checked with some websearching before replying. By default, a BLE advertisement is transmitted on all t...

manic glacierBOT
#

@dhalbert That's interesting, I wasn't aware of that. I need to double check the numbers in https://forums.adafruit.com/viewtopic.php?f=60&t=166440 as I thought they gave the appearance of transmission on one channel but perhaps not. It also changes the interpretation of the 5 second steps in https://forums.adafruit.com/viewtopic.php?f=53&t=165613 to be the receiver changing channel every 5 seconds.

For my current application I am just exchanging tiny amounts of data between N devices wher...

orchid basinBOT
manic glacierBOT
manic glacierBOT
#

When pasting blocks of code to the REPL there are lost characters very often. I don't see this on samd51, but I see it all the time on nrf52.

How to reproduce:

  • I use tio as my terminal program
  • Copy this arbitrary line of code: 123456789123456789123456789123456789123456789123456789123456789123456789%11
  • Repeatedly paste it into the REPL, hitting enter at the end if necessary

Expected behavior: The line of code calculates the number 1
Actual behavior: It frequently resu...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

"When you first found this, were you trying to compute something, or was it just to see how well the longints work?"

I was trying to test a tool which is very similar to Ampy, by trying out various types of "user" code to stress the part of the tool which breaks back into the REPL. I wanted to see what timeouts etcetera made sense.

manic glacierBOT
#

I think I can set-up a ci system, which builds the SoC and packages up the bitstream and generated headers, then you can include a tagged release?

I know Mithro has been talking about a "device-tree" like system. Which would ideally enable the SoC and CP/uP to be completely decoupled, but that's a reasonable amount of work to implement. Especially if it's only used by 1 platform.

Yup! We can download artifacts in our CI.

I like the device tree idea too. However, I think the pla...

manic glacierBOT
#

I upped the character count with some text from t'Internet and got a different bug. The console has frozen on me on a CLUE running 5.3.0. Here's one good then one that just stopped outputting

>>> len("What of the future? It is a matter of some concern to Real Programmers that the latest generation of computer programmers are not being brought up with the same outlook on life as their elders. Many of them have never seen a computer with a front panel. Hardly anyone graduating from scho...
manic glacierBOT
manic glacierBOT
onyx hinge
#

this is a surprising hardfault.. ```#0 HardFault_Handler () at supervisor/port.c:327
#1 <signal handler called>
#2 0x000299c6 in sd_softdevice_is_enabled (
p_softdevice_enabled=0x200155a5 <sd_is_enabled.lto_priv> "")
at bluetooth/s140_nrf52_6.1.0/s140_nrf52_6.1.0_API/include/nrf_sdm.h:346
#3 0x0002aebe in common_hal_mcu_disable_interrupts ()
at common-hal/microcontroller/init.c:55
#4 0x00031b44 in background_callback_add_core (
cb=cb@entry=0x20014abc <callback.lto_priv>)
at ../../supervisor/shared/background_callback.c:38
#5 0x0003a532 in background_callback_add (data=0x0, fun=<optimized out>,
cb=0x20014abc <callback.lto_priv>)
at ../../supervisor/shared/background_callback.c:59
#6 usb_irq_handler () at ../../supervisor/shared/usb/usb.c:93
#7 USBD_IRQHandler () at supervisor/usb.c:93
#8 <signal handler called>
#9 memset (n=8, c=0, s=0x2003fa0c) at ../../lib/libc/string0.c:93
#10 memset (s=0x2003fa0c, c=<optimized out>, n=8)
at /opt/gcc-arm-none-eabi-9-2019-q4-major/arm-none-eabi/include/string.h:33

#
   0x000299c4 <+0>:    svc    18
=> 0x000299c6 <+2>:    bx    lr
End of assembler dump.
``` stack looks fine, the address the result is to be written to is fine (it's a stack address).  is `sd_softdevice_is_enabled` OK to call from interrupt context?  _goes off to read docs_
#

no restriction on when it's allowed to call it is specified

#

@tulip sleet do you have any hints before I get too far in the weeds?

tulip sleet
#

did you erase flash or anything like that? If you just import _bleio does it crash. I'm wondering if the softdevice region of flash got erased

onyx hinge
#

I have been bootloading it and jlinking it all day. Let me check whether 5.3.0 has this problem and that would confirm that theory

#

it's a particle xenon fwiw

#

no, 5.3.0 is fine, it advertises and appears in bluefruit connect app

#

I assume it has to be my changes

#

it's perhaps unusual to enable/disable interrupts from an interrupt .. ?

tulip sleet
#

so with the new one if you import _bleio it crashes? The process of importing will call sd_is_enabled. you could also try 5.4.something or the 6.0.0 alpha

onyx hinge
#

I don't know for sure how much/little of my small script is needed to trigger. I can investigate further.

#

It was the smallest script I could run that got me to appearing in the bluefruit connect app ...

#

yes that is enough

#

though having done that the traceback is actually pretty different

#
327        reset_into_safe_mode(HARD_CRASH);
(gdb) where
#0  HardFault_Handler () at supervisor/port.c:327
#1  <signal handler called>
#2  0x00029a36 in sd_softdevice_is_enabled (
    p_softdevice_enabled=0x20015592 <sd_is_enabled.lto_priv> "\001")
    at bluetooth/s140_nrf52_6.1.0/s140_nrf52_6.1.0_API/include/nrf_sdm.h:346
#3  0x0002af06 in common_hal_mcu_disable_interrupts ()
    at common-hal/microcontroller/__init__.c:55
#4  0x00031978 in background_callback_add_core (
    cb=cb@entry=0x20014abc <callback.lto_priv>)
    at ../../supervisor/shared/background_callback.c:38
#5  0x0003a56e in background_callback_add (data=0x0, fun=<optimized out>, 
    cb=0x20014abc <callback.lto_priv>)
    at ../../supervisor/shared/background_callback.c:59
#6  USBD_IRQHandler () at supervisor/usb.c:99
#7  <signal handler called>
#8  0x00036da6 in tu_fifo_count (f=0x20012750 <_cdcd_itf+16>)
    at ../../lib/tinyusb/src/class/cdc/cdc_device.c:119
#9  tud_cdc_n_available (itf=0 '\000')
    at ../../lib/tinyusb/src/class/cdc/cdc_device.c:121
#10 tud_cdc_available () at ../../lib/tinyusb/src/class/cdc/cdc_device.h:178
#11 serial_bytes_available () at ../../supervisor/shared/serial.c:94
#12 mp_hal_stdin_rx_chr () at ../../supervisor/shared/micropython.c:40
#13 0x000709e8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
``` same thing, arbitrary code -> USBD_IRQHandler -> ... -> sd_softdevice_is_enabled
tulip sleet
#

the stack looks damaged. It should be clean all the way down

onyx hinge
#

I agree it's suspicious, but I'm not building with DEBUG= so I've shrugged it off. I feel like gdb does that to me a lot

tulip sleet
#

could you push your code to your repo?

onyx hinge
#

branch background-callback of jepler/circuitpython

#

I assume the problem is introduced at 4024e384d0a7 "nRF: Convert USB to run via callback"

tulip sleet
#

could a background callback you call add itself back on to the linked list or otherwise cause the linked list to grow?

onyx hinge
#

It's supposed to be safe to "add" a callback that is already added

#
+    CALLBACK_CRITICAL_BEGIN;
+    if (cb->prev || callback_head == cb) {
+        CALLBACK_CRITICAL_END;
+        return;
``` This test is supposed to stop without modifying the linked list if `cb` is on the list.  It could be on the list at the HEAD (if callback_head == cb) or anywhere but the head (if cb->prev is not NULL)
#

CALLBACK_CRITICAL_BEGIN is calling common_hal_mcu_disable_interrupts, so we aren't even getting to that test

#

just before 4024e384d0a7 usb is broken on nRF because I've stopped background tasks running all the time already, so it's not super-legit to test at that ref. You can sort of do it by calling supervisor_enable_tick() at the debugger prompt. When you do that, import _bleio works just fine.

#

Narrowing it down further ... With this change ALONE relative to origin/main@37e77b21c ("Merge pull request #3140 from dunkmann00/docs-version-conf") you get hardfaults at import _bleio: ```$ git diff
diff --git a/ports/nrf/supervisor/usb.c b/ports/nrf/supervisor/usb.c
index 3d2527faa..d8877fd08 100644
--- a/ports/nrf/supervisor/usb.c
+++ b/ports/nrf/supervisor/usb.c
@@ -88,6 +88,9 @@ void init_usb_hardware(void) {
}
}

+uint8_t some_global;
+
void USBD_IRQHandler(void) {
tud_int_handler(0);

  • sd_softdevice_is_enabled(&some_global);
    }
tulip sleet
#

the softdevice will hard-fault if it misses a timing window, which can easily happne if you have turned off interrupts, instead of using the softdevice critical section turn-off/turn-on routines (which do their own fancy work of scheduling)

#

though I don't understand why it should fail on the test.

#

is it possible that you turned off interrupts when the sd was disabled and then turned them on when it was enabled? Then the pair wouldn't match and there would be all kinds of havoc

onyx hinge
#

that's hardfault and not reset_into_safe_mode(NORDIC_SOFT_DEVICE_ASSERT); ?

tulip sleet
#

it doesn't call the assert routine unless you compile debug

onyx hinge
#

in the "this change ALONE", I'm confident I didn't newly enable or disable interrupts

tulip sleet
#

it just hardfaults

#

i would double-check for accidental recursive interrupt-off, though I read the code and I don't see that

onyx hinge
#

I have for sure written those during this PR, it did give me a day of head scratching last time

tulip sleet
#

also, the change above shares a global for sd_softdevice_is_enabled(), so maybe two interrupts are checking and one is getting incorrect results

onyx hinge
#

I'm not sure I understand what you're saying by that. This is the only "use" of some_global. I assumed sd_softdevice_is_enabled was storing 1 or 0 in it. I'm not sure what would be "sharing" anything. but if I misunderstand totally what sd_softdevice_is_enabled is doing...

tulip sleet
#

i'm not sure why the interrupt handlers share the some_global.

onyx hinge
#

I just called the variable some_global when I declared it for purposes of demonstration, its name is purely arbitrary

tulip sleet
#

right, that's not what I mean, but why is the IRQ handler checking that? What does it do with the result?

onyx hinge
#

yes, I'm happy to explain what I'm getting at with my snippet above

#

I have a bunch of code in my branch, and when asking for help it's better to provide a simpler case for what's going wrong. That is what I'm trying to do.

#

What's "new" in my branch is: Now, USBD_IRQHandler [indirectly] calls sd_softdevice_is_enabled, plus a lot of other stuff

tulip sleet
#

the sd_is_enabled static is shared across two routines, and if common_hal_mcu_disable_interrupts() is called twice in a row, or the state changes between the two calls, then things will get messed up

onyx hinge
#

question: is the problem "a lot of other stuff" or "IRQ handler calls SD"

tulip sleet
#

I think the problem might be that the "is SD enabled" bool value becomes stale and wrong

manic glacierBOT
#

Division does not seem to have the same issue. I generated some very large
numbers (i.e. 2**(65536*2) ) and tried various
division in REPL. All returned immediately (or close enough so I couldn't
see any lag). It seems only the large exponents
are causing an issue.
I agree that running more code really shouldn't take less time. But,
I've instrumented the mpn_mul() and looked at the timing
with a login analyzer. The average time in the standard code is 4.12
seconds, and in the code callin...

tulip sleet
#

i'm just wondering if that's possible

onyx hinge
#

the minimal code I add to get the flavor of hardfault is NOT an additional use (read or write) of the circuitpython global sd_is_enabled, it's an additional call to the SD-provided function sd_softdevice_is_enabled which is expected to assign the distinct global variable some_global

tulip sleet
#

i'm just wondering if sd_softdevice_is_enabled is detecting that something has gone wrong

#

i looked in Nordic DevZone and some people have hard-faulted calling it, though it seems to be for unrelated reasons

#

what happens if you compiled DEBUG=1?

onyx hinge
#

always on importing _bleio

#

so as soon as softdevice actually does become enabled

tulip sleet
#

it's really fishy the stack is smashed, not sure we are really seeing the correct backtrace

#

maybe the assumption you can call softdevice_is_enabled in an IRQ handler is wrong. Was that already the code?

onyx hinge
#

that is "new, for all I know"

tulip sleet
#

i mean, you added the SD call in the IRQ handler, is that right?

onyx hinge
#

yes

#

certainly the one that occurs indirectly from USBD_IRQHandler

tulip sleet
#

what is the reason for checking the sd status there?

#

thinking about this, they wouldn't want you to do that, because an SD routine can do arbitrary stuff, including messing around with interrupts itself

onyx hinge
#

A reasonable question 🙂 this new linked list has to be manipulated in atomic fashion. The way I have learned to do those things is by having a critical section which is not interruptible, and I assumed it was OK to build that out of common_hal_mcu_{en,dis}able_interrupts

tulip sleet
#

there are a limited number of backround routines, right?

onyx hinge
#

No, MP3Decoders have them and the number of them is not static and fixed.

tulip sleet
#

suppose there was just a volatile boolean for each one, which you checked and called if true. Then you don't need to add or remove them. ... ok, suppose there was a boolean for each category of background routines. Some of the background routines are fixed, and they can be checked with a simple booelan. For MP3, there could be a single background routine that can maintain its own worklist. would that work?

onyx hinge
#

It's not the design I've been working on for weeks, and it still means you have to check a BUNCH of booleans instead of JUST ONE pointer. Getting to a single check is something I also view as important.

#

If we have to say "well, softdevice is what it is", something will have to give.

tulip sleet
#

there could be a master boolean that says if any of the other booleans are set

#

i think it's true that it's basically complaining about calling SD routines in an interrupt handler, but I'm trying to find doc about that

#

the USB interrupts are prio 0, is that right, which is higher than the SVC call:

It's fine to call them from the interrupt as long as the interrupt runs at lower priority (ie a higher number) than the SVC call. So you can call the sd* functions directly if you are running at priority 6 or 7 (the two APP LOW priorities) but not from 2 or 3 (the APP HIGH ones) as they are higher than the SVC call.

onyx hinge
#

what is the priority of USB?

tulip sleet
#

i think it's set really high, but I'm not sure

#

it might be set too high.

onyx hinge
#

is it a static thing "USB is always high priority" or do we have a choice so that we can lower it to "so that softdevice works"?

tulip sleet
#

we changed the prio a long time ago during atmel-only days because we were losing interrupts, I think. I have to find that.

onyx hinge
#

there's a _NRFX_IRQ_PRIORITY_SET but it's not called by us

#

ports/nrf/nrfx_config.h:#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY 7

#

ah there are these

barren peak
onyx hinge
#
nrfx/templates/nRF52840/nrfx_config.h:#define NRFX_USBD_DEFAULT_CONFIG_IRQ_PRIORITY 7
tulip sleet
#
supervisor/usb.c
46:    NVIC_SetPriority(USBD_IRQn, 2);
onyx hinge
#

Update on testing nRF52840 boards:
1.) Feather nRF52840 Express - blinky works.

#

@tulip sleet thank you !

#
-    NVIC_SetPriority(USBD_IRQn, 2);
+    // 6 is max priority that still allows calling SD functions such as
+    // sd_nvic_critical_region_enter
+    NVIC_SetPriority(USBD_IRQn, 6);
barren peak
#

@onyx hinge thanks for the reply.I saw that thread but the conversation did not close.

#

experimental does not have nrf52840 yet as far as I can see

tulip sleet
onyx hinge
#

We've exceeded what I know about makecode, sorry I can't be more helpful

tulip sleet
#

i think it is a work in progress. The makecode folks might answer in #help-with-makecode eventually, or perhaps you can catch them when they are online

#

@onyx hinge I think it might make sense not to check for sd enabled all the time in the critical section routines, but instead to set a global that remembers the whether the sd is enabled. it only gets enabled/disabled one or two places. I'm not even sure it ever gets disabled programmatically once it's enabled.

onyx hinge
#

@tulip sleet when sd is enabled, it has to make sd calls to enter/exit critical sections so that won't help will it?

#
    if (sd_is_enabled) {
        sd_nvic_critical_region_enter(&is_nested_critical_region);
tulip sleet
#

right, hmm, well, you could use a different locking mechanism for your linked list, instead of critical regions

#

maybe there are some test-and-set primitives you can use?

simple pulsar
#

Hello. I've just noticed that CircuitPython 5.3.0 doesn't reload code if code.py/etc is copied to the board (CLUE) if the running code is in an input() statement. It looks like it's deferred until after the input() completes, i.e. user (eventually) enters something. Is that regarded as a bug?

tulip sleet
#

@simple pulsar i agree that's unexpected; thanks for an issue!

onyx hinge
#

I agree that is the current behavior, I run into it all the time.

barren peak
#

@onyx hinge @tulip sleet thanks

simple pulsar
#

I rarely use input(). I've gone retro for tty stuff. I'll file it.

onyx hinge
#

with the IRQ priority thing reverted, it looks like sd_nvic_critical_region_enter/exit are safe to call

tulip sleet
#

you mean just on nrf?

onyx hinge
#

sorry I said something confusing again 🙂

#

without changing the USB IRQ priority (so it stays at 2), it looks like sd_nvic_critical_region_enter/exit are safe to call

#

they don't actually "call the SD"

manic glacierBOT
tulip sleet
#

@onyx hinge sorry, we got a food delivery. What did you change so that it works again?

onyx hinge
#

I have 2.5 approaches. I don't know which one to take.

  1. Change the IRQ priority of USB, and anything that needs to schedule tasks, so that it is 6 instead of 2.
  2. Track "sd is enabled" via a global and check that instead of calling sd_softdevice_is_enabled
    2.5. Ignore whether we are using sd, and always use sd_nvic_critical_region_{enter,exit}
#

I implemented 1 and 2.5, at least in terms of adding calls to USBD_IRQHandler to the required functions

tulip sleet
#

sd_nvic_critical_region... require the SD to be enabled to work properly

onyx hinge
#

I see that's what it says there 🙂 but I also looked at the implementation, 😜

#

OK, won't go with 2.5 then

tulip sleet
#

i remember now trying to decide what to use. I also looked at the impl a year or two ago, and was confused.

onyx hinge
#

I squinted at it and said "I bet that's leaving interrupts (priorities?) 0 and 1 enabled, and masking the rest"

tulip sleet
#

yah, it's just a q of whether they might change it in the future..., i guess

onyx hinge
#

does soft reset disable softdevice?

tulip sleet
#

another q is if USB prio is made weaker again, will it get starved out as described in that PR I mentioned above. But we'd have to look at PulseIn for nrf

#

I think PulseIn was not the only case of stuff starving USB. audio might do it too

#

I think just checking a global is pretty easy

onyx hinge
#

what priority does PulseIn use on nRF?

#

nrfx_config.h:#define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 7

tulip sleet
#

so that's safe

onyx hinge
#

with only 8 levels I guess you run out pretty fast

tulip sleet
#

sd_softdevice_enable and _disable are each called only one place, in common-hal/_bleio/Adapter.c. A global would be fine.

#

i guess there could be a race condition at the global setting/cleraing, though

onyx hinge
#

does soft reset go through Adapter.c to disable softdevice?

tulip sleet
#

bleah, no mutex mechanism in M4 architecture...

#

so the only issue would be if you were using levels 0 and 1 when SD was not enabled, then it wouldn't really be a critical section for interrupts at those levels

onyx hinge
#

but circuitpython would have no cause to use them

tulip sleet
#

right

#

so changing to those seems fine to me, with maybe a cautionary comment in the micrcontroller source file that calls them

onyx hinge
#

are you happier with that than with changing the USB IRQ priority?

tulip sleet
#

i'm thinking that there's a race condition anyway already because the checking of is_enabled() is not atomic with the branch that chooses which enter/exit to use

onyx hinge
#

I think there's another bug too, the counting isn't done when softdevice is enabled

#

but in this kind of code it's very easy to talk yourself into a wrong interpretation of what's going on

#

(I mean, for me to talk myself into it)

onyx hinge
#

@tulip sleet I don't understand why on samd common_hal_mcu_disable_interrupts always calls __disable_irq(). I guess __disable_irq() is a no-effect instruction if IRQ was already disabled...?

tulip sleet
#

@onyx hinge yes, i think so, why bother checking

onyx hinge
#

dinnertime, I will have to conclude this at a later date

#

thank you for your time and help

tulip sleet
#

us too, pad thai in process, yw, and thanks for your patience on the dead ends

onyx hinge
#

yum

lone sandalBOT
wise yacht
#

Zzzzzzzz

lyric cipher
#

how do i make it so When a customer inputs an ODD number, you should light up a single red LED. When the customer inputs an EVEN number, the green LED will light up.

#

I'm new to this whole arduino thing and my code is making my led keep blinking even without input

tulip sleet
#

@lyric cipher you need to be running a Firmata client on the board so it can communicate with the host. But do you want to use Firmata? What board is it?

#

a regular Arduino?

lyric cipher
#

i think so my school gave it to me

#

arduino uno

tulip sleet
#

Have you tried a tutorial like this? <> You need to compile and upload Firmata onto the board

lyric cipher
#

ahhhh ok thank you

tulip sleet
#

I found that in the Python server in its #microcontrollers channel, after searching for "firmata"

#

@lyric cipher ^^

lyric cipher
#

I found that in the Python server in its #microcontrollers channel, after searching for "firmata"
@tulip sleet Ooooo thank youuu

woven shore
#

Is this is the right place to ask about circuitpython libraries?

#

Just wondering whether the board module is a dependency for busio

#

@gilded cradle I've been coding a lot on the Jetson Nano platform and the board module is tripping up some of my code

woven shore
onyx hinge
#

good morning .. still trying to get common_hal_mcu_disable_interrupts and _enable_interrupts working in the new way I need them to on nrf

manic glacierBOT
onyx hinge
#

@tulip sleet OK here's what I ended up with, I'd really appreciate your eyes on it before I proceed. https://github.com/adafruit/circuitpython/commit/aa87b2fea89b303b28095d23d171be200d44dc70 -- with the rest of the background task list stuff on top of it, everything seems to work, _bleio imported or not

GitHub

The motivation for doing this is so that we can allow
common_hal_mcu_disable_interrupts in IRQ context, something that works
on other ports, but not on nRF with SD enabled. This is because
when SD...

tulip sleet
#

@onyx hinge This looks very good, and I appreciate! Could you just add a comment at line 53 that warns that only levels 2-7 are disabled, and that levels 0 and 1 are reserved for use by the SoftDevice, and shouldn't be use by CircuitPython code? (I think that's right.)

onyx hinge
#

adding the comment in common_hal_mcu_disable_interrupts ?

tulip sleet
#

yah

onyx hinge
#

sure thing

#
+        //
+        // This only disables interrupts of priority 2 through 7; levels 0, 1,
+        // 5, and 6 are reserved for softdevice and should never be used, so
+        // this limitation is not important.
         sd_nvic_critical_region_enter(&is_nested_critical_region);
tulip sleet
#

i didn't know about 5 and 6, so our code should only use 2,3,4?

onyx hinge
#

oops I got the numbers wrong

#

let me double check

#

the 2 highest and 2 in the middle are taken by sd

#

but it's 4 and 5, not 5 and 6

#

eek I apparently have been getting SOME of my information from nrf51 series softdevice docs

#

OK, it's 0, 1, and 4 that are reserved. Not sure where I got that there were two middle priorities reserved.

#
+        // and 4, are exclusive to softdevice and should never be used, so
+        // this limitation is not important.
ionic elk
#

@slender iron there aren't any guides or notes or docs or anything about getting started with the esp32-s2 on circuitpython, right? I'm having trouble getting CMake to find the xtensa-esp32s2-elf-gcc compiler.

#

I think it's probably because I ran install.sh in my user folder? Not in the actual circuitpython directory? Do you have any notes on what I need to set my environmental variables to if I want it to build in Circuitpython?

solar whale
#

In the esp-idf folder run . ./export.sh

ionic elk
#

No changes. Still get

-- Found Git: /usr/local/bin/git (found version "2.24.1") 
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: xtensa-esp32s2-elf-gcc
CMake Error at esp-idf/tools/cmake/project.cmake:307 (__project):
  The CMAKE_C_COMPILER:

    xtensa-esp32s2-elf-gcc

  is not a full path and was not found in the PATH.
ionic elk
#

did all that.

solar whale
ionic elk
#

Wondering if I did it in the wrong place, though. Are specific environmental variables required?

solar whale
#

Yes. I think so.

ionic elk
#

Like does IDF_TOOLS_PATH need to change

#

could you tell me where it needs to go?

#

It doesn't specify any suggestions in the startup guide or the port

solar whale
#

I just followed that guide and it all works. I have to run the export.sh every time I open a new shell.

#

What OS are you on.

ionic elk
#

Hmm. So you followed the guide, didn't need to change any environmental variables (so presumably you have your tools in ~/.espressif), ran install.sh and export.sh from inside esp32-s2/esp-idf, and then ran make BOARD=<board> and it all worked?

#

I'm on mac OSX

solar whale
#

Ah . On Mac I also had to switch to bash shell.

ionic elk
#

Yeah I'm on bash.

#

Do you manually activate the virtualenv? I see that it creates one but I don't see instructions about actually turning it on so I assume the build process does that automatically if it needs it

solar whale
#

To do the . ./export.sh. Makes sure you have the . space ./...

#

No it does it.

ionic elk
#

Ok I re-ran install.sh within circuitpython and it seems to be working now. I guess it can't re-use the build tools across installations? Seems like it even re-downloaded everything.

manic glacierBOT
#

Invoking a "parallel build" in ports/esp32s2 fails with a variety of errors, probably because some elements of the build process are not designed to be run in parallel. This is unfortunate, because parallel building can greatly decrease build times especially on high performance desktop computers.

For instance, the first overt failure shown:

$ make BOARD=espressif_saola_1_wroom clean; make -j19 -O BOARD=espressif_saola_1_wroom
...
[29/30] Linking CXX static library esp-idf/driver/...
solar whale
#

Yeah. I won’t pretend to understand all that it does. Just happy it works!

ionic elk
#

Well it isn't compiling lol so I'm not done yet

#

pyparsing.ParseException: Parsing sections info for library /Users/hierophect/Firmware_Projects/circuitpython/ports/esp32s2/build-espressif_saola_1_wrover/esp-idf/esp-idf/xtensa/libxtensa.a failed. (at char 0), (line:1, col:1) ninja: build stopped: subcommand failed.

manic glacierBOT
solar whale
#

running on mine... just to be sure

ionic elk
#

this build process is also SUPER verbose, is there any way to trim it down?

#

@solar whale weird I tried just running make clean and built it again, and it worked?

solar whale
ionic elk
#

It was clean the first time too so I don't know what's up with that

#

^looks about the same as what I have now. thanks for your help!

solar whale
#

the mysteries of make...

#

You're welcome -- good luck.

ionic elk
#

yeah new toolchains are always hairy.

manic glacierBOT
ionic elk
#

@solar whale what are you using as your flash command? make BOARD=... flash?

solar whale
#

on the Mac -- that works for me

lone axle
#

Is there any known issue with github at the moment?

solar whale
#

on other OS I have to specify PORT=/dev/ttyUSB0 but the default on the Mac is good for me.

#

@lone axle I can access it.

lone axle
#

There is a PR whose fork/branch had more commits pushed to it. And those commits show up if I look at the fork/branch in question directly. But they never showed up in the PR.

silver tapir
#

@lone axle I pushed the re-request review to see if that triggered the second commit to get into the pr. But yeah, I'll try again in the afternoon.

#

Thanks for the review.

lone axle
#

I can test it out on my PyPortal later today as well.

manic glacierBOT
lone axle
onyx hinge
#

just getting to my first flash on Linux but yeah I need to specify BOARD= PORT= flash

#

Wrote 480256 bytes at 0x00000000 in 14.2 seconds (270.5 kbit/s)...
Hash of data verified.

#

does it put the repl on the debug usb port, or do I have to hook up real usb now?

solar whale
#

REPL is on pins 19/20

#

and PORT is necessary for all but MacOS

ionic elk
#

@solar whale I needed to do it on my mac

#

default was something like /dev/tty.SLAB_USBtoUART and mine was just a string of numbers

solar whale
#

ah -- well that makes sense

ionic elk
#

Ok, I guess I have something running? I get bootloader text on the USB to UART controller... but, uhh, now what?

#

Do we not have CDC USB running for the ESP32-S2 yet?

#

don't see a drive either

solar whale
#

mine comes up as /dev/tty.SLAB_USBtoUART

onyx hinge
#

The CircuitPython USB that provides filesyste etc, is not the connector on the board, you have to wire up your own usb connector

ionic elk
#

mine is tty.usbserial-1411120

onyx hinge
#

I'm just trying to find the info

lone axle
silver tapir
ionic elk
#

Oh that's right I need the other connector

solar whale
#

I see tty.usbserial-1411120 as well...

onyx hinge
#

OK yes, white to "19" and green to "20" and now I see CIRCUITPY

#
Adafruit CircuitPython 6.0.0-alpha.1-84-g910f69c42 on 2020-07-15; Saola 1 w/Wroom with ESP32S2
#

thanks @silver tapir that link was exactly the info I needed

manic glacierBOT
silver tapir
idle owl
#

@silver tapir What board? We can add it to the newsletter 🙂

onyx hinge
#

huh. this device comes up with different SNs. Usually it comes up as SerialNumber: 0000000000000000060000000EFCDF but at least twice it came up as 00000000000000000135DFF30EFCDF

silver tapir
idle owl
#

@onyx hinge It's a more precise version. 😉

onyx hinge
#

oh yes it must be floating point

#

anyway, goal achieved, I ran esp32s2 and it works after my background and usb changes. hooray.

#

and it's already 11AM

idle owl
#

@silver tapir Thanks! I emailed Anne with the Twitter link and the board link.

#

@onyx hinge 🎉

onyx hinge
#

fwiw I am NOT seeing the device come back after storage.erase_filesystem() ... hmm, I thought it was supposed to do an orderly reboot in fairly short order

solar whale
#

I needed to do a RESET after erase

#

or power cycle

idle owl
#

Hmm I thought you were suppose to reset after that.

solar whale
#

on other boards it does reboot -- not on esp32s2

#

but it will drop the USB connection on other boards -- still esp32s2 is different....

onyx hinge
#

OK thanks @solar whale nice to have it verified that it's not just me or my changes to the USB code

#

does anyone else work in a way that they would notice if the serial number was changing?

solar whale
#

never looked -- remind me how to read it?

onyx hinge
#

different ways on different systems.

solar whale
#

on esp32s2

#

via Mac

onyx hinge
#

on linux this tells me all the different serial numbers used by espressif devices that I've plugged in today: grep -A1 "Manufacturer: Espressif" /var/log/kern.log | grep SerialNumber | awk '{print $10}'

#

I've got 5 different serial numbers logged, including just "0" 😕

main meteor
#

Sounds like a timing/synchronization problem

onyx hinge
#

this is a problem for my workflow, I like to automatically reopen the repl by using tio /dev/serial/by-id/[something long that has the serial number]