#circuitpython-dev

1 messages · Page 283 of 1

idle owl
#

If you add your status updates and hug reports to the notes document, we can read them off during the meeting when we would get to you.

ionic elk
#

@simple pulsar cool! I really like the meowbit and hope I can get it squared away real soon.

manic glacierBOT
half sedge
#

@tidal kiln Whatever works for you and you feel would be best for reader. For me it can stay as it is, now that I know why.

tidal kiln
#

ok. i'll add some text, so others will know as well.

half sedge
#

Perfect.

slender iron
#

@proper swan please mute

half sedge
#

@tidal kiln @gilded cradle On page https://circuitpython.org/blinka some of the board have white background rather than "dark". I don't know where those picture are coming from, but it would be great to have all of them the same.

slender iron
#

thanks!

gilded cradle
#

@half sedge The dark ones are the official ones taken at the Adafruit factory and the white ones are the ones that didn't have the nice photo available.

onyx hinge
#

[belated hug report to kattni for taking the lead on pycon for adafruit people!]

half sedge
#

Yeah someone in Adafruit make all those picture and that's why it is so homegenous. If it's photoshop, then maybe that expert can cheat those white background. 😉

simple pulsar
#

Dual boot Win10/Win7 - life only would get better with XP in there

gilded cradle
#

@simple pulsar, I can do a virtual machine for that

tidal kiln
#

in the weeds
neopixel on MCU's without pixelbuf?

onyx hinge
#
  • mention circuitpyhonistas
half sedge
#

@idle owl Don't hesitate to contact me about my demo for MLX90640. Right now it is just in the GitHub.

serene warren
#

It's an "Ugly American" thingy 🙂

onyx hinge
#
  • google calendar?
gilded cradle
#

@half sedge, the white ones were mostly added by community members, so those photos were found online. It would be nice to have just the dark background with no product just to paste the board on top of.

onyx hinge
#
  • more advance planning, not 1 week
half sedge
#

@idle owl On top of Adafruit web site, there was a hint about not shipping on the 20... I had no clue why.

lone axle
#

Would it make sense to have a section of circuitpython.org for the meeting with links and info? It could also have any notices about schedule change.

onyx hinge
half sedge
#

Finding the DOC file can be challenging. I scrolled like hell on discord to find it.

onyx hinge
#

@half sedge I like to search for mentions of circuitpythonistas to find it, but .. it's not ideal

ionic elk
#

Hmm, we have #circuitpython2020 but no #circuitpythonshowerthoughts?

graceful heart
#

could the ICS file also have a link to the meeting notes doc (event description field?)

half sedge
#

A meeting has: (1) a date that is planned (2) a doc to fill in (3) a video after the fact

#

I don't know how to find (2) and (3) in a consistant way.

ionic elk
#

Could we have a website widget or something?

slender iron
onyx hinge
#

@ionic elk that's potentially what the jekyll plugin woiuld do, I think

slender iron
#

and the notes include video links

idle owl
#

Neither can I.

tidal kiln
#

hang on..

onyx hinge
half sedge
#

Does it also help because this become asynchronous?

manic glacierBOT
#

I have to admit that I am impressed with the explicit cancellation scopes, but I wonder how hard it would be to actually implement this in CircuitPython. We don't have all the usual exception handling machinery that grown-up Python has, you can't even inspect an exception object inside Python code. The talk mentions that before 3.7 Trio had to do some magic with ctypes to rearrange the stack for the cancellation to work properly — obviously we can't do that in CircuitPython, but of course som...

half sedge
#

Like launching an "effect" and then doing something else while it run? Like you would for audio?

onyx hinge
#

it looks like it's not a submodule in the bundle

simple pulsar
#

Are mpys big? M0's have small drives

timber mango
#

If there is a bug, I will probably trip over it. 😃

simple pulsar
#

K3wl as the kidz say

serene warren
#

The downside to attending the live session, now nothing to watch in bed tonight.

errant grail
#

Thanks all y'all!

half sedge
#

I want to be ping.

idle owl
#

@half sedge Done.

modern wing
#

Beat me to it @idle owl, thanks 🙂

onyx hinge
#

👋

errant grail
#

< looking around for those purple PCBs >

graceful heart
#

👋

raven canopy
#

Thanks everyone!

gilded cradle
#

Thanks everyone

modern wing
#

Thanks everyone!

serene warren
#

Great team. Thanks for the effort.

half sedge
#

M0 is great for small thing (Trinket and Gemma).

simple pulsar
#

What's the population of M0 boards out there? I'd imagine there's a lot of CPX's sold?

timber mango
#

@slender iron I figured that out. I only buy M4 or newer boards now.

half sedge
#

There are warning about M0 left and right, but it is not always clear what you loose.

onyx hinge
modern wing
#

I have a bunch of M0s here for future projects -- as long as I keep in mind the limitations, they're great for what they are and when they were released.

tidal kiln
#

@onyx hinge ha! haven't even made an issue for that yet 🙂

half sedge
#

and then the Gizmo.

#

That inflate the number of board...

#

We are not at 101 if you remove the Crikit and Gizmo.

modern wing
#

Hey everyone 🙂 So, I have a question that I didn't want on the call, but I think this is a good crowd to ask.

I'm thinking about attending the OHS2020 in NYC. As someone who's a relative beginner in Open Hardware, would the event be beneficial for me?

Or is it more geared towards established, experienced hardware creators?

slender iron
#

@half sedge we'll be there soon enough. no reason to nitpick the number

plucky flint
#

@gilded cradle you're welcome. Hugs back at'cha. 🙂

half sedge
#

You need to reach 100 for 02/02 ...

ionic elk
#

I was also thinking about going @slender iron, do you think it's worth it for just the day?

#

bit of a hike for me

timber mango
#

@half sedge Crickit and Gizmo are not stand alone boards. 😃

onyx hinge
half sedge
#

No but there is a CPX + Gizmo and a CPX + Crickit

#

So because a special compilation is done to overcome memory issue if it had been mpy, that make additional board in the download section.

ionic elk
#

true

solar whale
#

👋

slender iron
#

@half sedge what do you mean 02/02?

modern wing
#

When I muted/unmuted, did it give an audio alert for everyone else? Or is that contained on my end?

half sedge
#

2nd February. 😉

slender iron
#

is that when your talk is?

half sedge
#

Yes. 😉

timber mango
#

@half sedge Well, OK, maybe. If it were my choice though, I would only include boards that can actually run Circuitpython, not add on boards with stand alone boards. That is just me though. 😀

slender iron
#

🙂 My pending iMX PR adds three so don't worry

half sedge
#

At one point I will have to freeze what I write in the slide. I was planning to update on the iMX LIVE.

timber mango
#

I am really looking forward to Circuitpython on the Teensy 4.0 and i.MX boards when they are released!

half sedge
#

Does the iMX board offer USB storage function like M0, M4 and nRF?

#

I have the same question for the STM32 kind of board.

timber mango
#

@modern wing I also have several different flavors of M0 Feathers here, which I will use for testing circuits or Arduino stuff now. I only buy M4 or later boards though.

modern wing
#

Full agreement, there's little reason to buy the older M0 when so many newer, faster choices exist. But I only say that for those who own an M0 board (or several....or too many like me) that they're still very capable in many ways.

#

@slender iron I briefly looked through the OHS videos that @onyx hinge linked -- I'm sold. I'll be there, and hope to see y'all there too. [missed out on early bird pricing, but oh well 🤷‍♂️ ]

timber mango
#

I would really like to see some M4 boards like the M4 Express that have much memory with built-in WiFi, RFM69, RFM95, and Bluetooth though. also want several of the M4 Bluefruit boards too, including the CPx Bluefruit. I want to see if they can run my robot script.

onyx hinge
#

@modern wing I hope to meet you there

slender iron
#

@half sedge yes, imx rt and stm32 show up as USB drives

timber mango
#

I still plan to build my Mesh network here, with RFM69 radios. However, this new Bluetooth Mesh looks really interesting for short range stuff.

half sedge
#

@slender iron Great, so they are not second class citizen. AFAIR the STM32 needed a special trick to upgrade. Is it the same for i.MX?

#

I mean, not all board are "drag and drop" the "firmware".

slender iron
#

correct, most boards do not have the UF2 firmware by default

#

the iMX EVKs have a separate drag and drop loader though that can take a .hex file

half sedge
#

ESP8266 had two problem then, not having the UF2 AND not having the USB storage. And that rule it out.

slender iron
#

and the Teensy's TeensyLoader works too

#

correct both the ESP8266 and ESP32 use a USB to serial converter IC that prevents us from supporting other USB like showing up as a drive

timber mango
#

@slender iron Will we have to use the MCU specific loaders when loading Circuitpython on the new boards?

slender iron
#

the ESP32-S2 has native USB but it isn't generally available yet

half sedge
#

Great, I have my fact right. That is the most important.

slender iron
#

@timber mango on existing boards yes, for future adafruit boards we plan on shipping with the UF2 bootloader. (Not sure about the current STM32 feather though)

#

it's early

#

arturo has been hard at work on UF2 for the iMX

timber mango
#

Could we use Ampy with the STM32, i.MX, and Teensy 4.0?

half sedge
#

@slender iron as you have noticed with the nitpicking of the 100 number, I do like to have the fact right. 😉

slender iron
#

@tulip sleet want to do the beta release or should I?

#

@timber mango probably but it isn't recommended. Using the drive is what we support

tulip sleet
#

I’ll get back to you in 5-10 minutes

timber mango
#

I know, @indigo wedge has been doing fantastic with the i.MX stuff. It would be great to have UF2 on as many boards as possible. I have gotten quite spoiled by it!

slender iron
#

@half sedge Just beware that it can be distracting and potentially hurtful. Its not fun to be told you are wrong.

#

🙂

#

@timber mango yup, I need to test my PR with it this week

timber mango
#

@slender iron I have a lot of time to devote to testing if you need other testers for hardware stuff. I am pretty good at tripping over bugs and other issues.

#

I am on disability.

half sedge
#

@slender iron Yeah, it's a problem. It is also a problem to be me, because it mean I want to be sure of what I say, so I have to "research" and sometime I prefer not to guess and say I don't know. I have been a trainer (Cisco, Checkpoint, Nortel Networks) and so I was trying to avoid to propagate wrong information as much as possible.

slender iron
#

@timber mango be careful what you wish for. 🙂 we always have stuff to test. Do you have any things that interest you most?

timber mango
#

@timber mango I think most, if not all, of us share that. I have learn ed to lighten up on jumping on errors if they are not serious ones though.

slender iron
#

@half sedge We're moving fast enough that the number changes regularly. Please don't discuss it further here. Feel free to put whatever number you are comfortable with in your presentation. In the end, its always growing and things are good. A few numbers different is a small error.

half sedge
#

@slender iron Numbers are not an issue, I can always say "around". Right now it is 100+ board 200+ library ... My worries are to say something plain wrong. Like board X can do Y. Then someone acquire X and figure out Y is not working. I would feel gulty of giving wrong information that lead to wrong decision.

timber mango
#

@slender iron I am interested in all sensors and fast MCUs. I enjoy connecting all sensors to any MCU I can get my hands on. Right now, I am particularly interested in distance sensors and anything with accelerometers like IMUs, etc., as well as the newer Feathers Adafruit is working on. I want to translate as much Arduino code over to Circuitpython as I can and get sensors working on new boards. Conversions are one thing I am really good at, but I do not deal with deadline pressure well.

slender iron
#

Ok, sounds good. I'm happy to answer questions about board capabilities.

manic glacierBOT
slender iron
#

if you have a teensy 4 then help testing imx is welcome too

#

its very very early though

half sedge
#

I wanted to do some recommendation, so right it was "avoid M0" except for limited usage. Try to go for Express board to have more storage. Today go CPB rather than CPX except if you want IR, or really want to use MakeCode right now.

tulip sleet
#

@slender iron before beta I see need for fixing #2540/#2541, and increasing CP stack size (very simple PR). I'm confused about #2541 build failure; maybe needs make translate? But the failure is not the usual one.

half sedge
#

If you want a lot of sensor right away without additional acquisition, go CPX, CPB, Clue.

timber mango
#

@slender iron I wish I had a Teensy 4.0, but I do not have one yet. OK, I will start looking at PRs then.

slender iron
#

you can do IR with CPB using external receivers

half sedge
#

Yeah sure, I did IR with Trinket M0. 😉

slender iron
#

@tulip sleet kk

#

thanks @timber mango

manic glacierBOT
timber mango
#

I have a couple RFM69HCW radio breakouts I want to connect up to new boards too. I also have a Bluefruit SPI module, but I am not sure if it would be worth doing anything with now since the ESP-SPI was released.

idle owl
#

@timber mango There are definitely library PRs that are still open because they need testing. No idea whether you have the hardware for it or not, but it's worth looking at the list on circuitpython.org/contributing

timber mango
#

Would an RFM69 module work with boards that already have WiFi or Bluetooth? I am thinking it should be possible if a different CS were used.

solar whale
#

@timber mango should not be problem

#

I hope to have a PR in soon for the RFM69 to add "reliable datagram" (ack handshake)

timber mango
#

@idle owl I have mostly M0 stuff. I also have a Feather M4 Express and an Itsy Bitsy M4 Express, which is the only current hardware I have.

idle owl
#

The libraries would require the sensor/breakout/etc involved with the lib.

timber mango
#

@solar whale Ah, cool! I am very interested in stuff like that. I am also a Ham N6BOT. 🙂

slender iron
#

Hi all, next week's CircuitPython meeting is on Monday at 11am Pacific / 2pm Eastern as usual. Here is the notes doc: https://docs.google.com/document/d/1FqFlX9sNJzdI8y41KqMu7kV0GPW8o7mzWxOoowAwOqA/edit?usp=sharing We've pinned this mention so you can find it all week and add stuff. All are welcome to attend. <@&356864093652516868>

onyx hinge
#

@idle owl thanks for the kick in the pants about that and @slender iron thanks for the first step in doing better

solar whale
#

@timber mango I was a ham but let my license expire 😦 I've been having lots of fun with the RFM69 and 9x boards.

slender iron
timber mango
#

@idle owl Yes, I know. I get new sensors as fast as I can, but am stuck with what I have for now. I am very interested in stuff I can use on my robots, like IMUs, Accelerometers, Magnetometers, Gyros (or any combination), distance sensors, etc. I am addicted to sensors and robots!

#

I just discovered I can use sed commands for editing posts here. So COOL!!

#

@solar whale Awesome! Maybe we can work together on getting RadioHead compatible stuff done for Circuitpython.

stuck elbow
#

you can also just press the up arrow

onyx hinge
#

@timber mango probably meant @solar whale

timber mango
#

@onyx hinge Yes, I did!

#

@onyx hinge Sorry about that.

onyx hinge
#

np

timber mango
#

OK, I am off now. I have to take my dog out and want to get back to my Arduino to Circuitpython conversions.

manic glacierBOT
#

What do you mean, no async with? The code below worked since February 2019. (async with/for by itself was added in January 2016.)

… and no, there is no async while. CPython doesn't have that either.

$ cat test-trio.py
#!/usr/bin/env micropython

import trio
async def bar(s,n=None):
    try: await trio.sleep(s)
    except: return
    print("Slept",s)
    if n: n.cancel_scope.cancel()
async def foo():
    async with trio.open_nursery() as n:
        n.start_soon(bar,...
manic glacierBOT
#

NB, I am not deeply enough into how micro/circuitpython is built to assess any code size questions. There's probably a fair bit of trimming that can be removed from Trio, and if we decide to do this then at some point we'll have to think about feature (im)parity and related matters.

Call stack hacking is/was necessary for Trio IIRC in order to collect the frame information so that a MultiError (the exception that's raised when more than one subtask of a nursery raises an exception at the s...

manic glacierBOT
#

I'd recommend using a logic analyzer to sniff the data lines to the flash. That way you can easily understand how far the process is getting. This clip can make it easier: https://www.digikey.com/product-detail/en/pomona-electronics/5250/501-1311-ND/745102

The other way to debug it is to see how far it is getting from the code side. However, it is much trickier.

I would expect it to work but it might have a quirk of some sort that the config isn't accounting for.

idle owl
#

My PyCon 2020 tutorial proposal was accepted.

slender iron
#

nice! 🎉

modern wing
#

Congrats @idle owl !

tidal kiln
#

woot @idle owl congrats

manic glacierBOT
tulip sleet
#

@idle owl hooray!

manic glacierBOT
#

@deshipu, thanks for spotting this and the fix!

It actually highlights a deeper problem. I think I should've had the base[module]["default_value"] factor in the port-wide configs, versus relying solely on the top-level config.

That is why it wasn't working for the PewPewM4; the top-level is also 0 for network. So by adding the port-wide config to the end of the board config contents, this was being masked and the conditional wasn't flagging the exclusion.

I may address that late...

slender iron
#

@tidal kiln are you interested in more pixelbuf work or should I do it?

onyx hinge
#

@idle owl just saw. Congratulations, now the hard work starts

idle owl
#

@onyx hinge indeed.

#

Thanks everyone

tidal kiln
#

@slender iron related to open issues?

slender iron
#

based on me catching up on things

#

I think NeoPixel_SPI should inherit from pixelbuf directly

#

and pixelbuf should manage the buffers itself

tidal kiln
#

probably makes sense. there's not much code actually left in the neopixel class.

slender iron
#

right, the code that things want to share should be centralized now

tidal kiln
#

ok. and then there's that other quick fix i did - but probably not correct because of how brightness works.

#

oh..reading your comment there now...

slender iron
#

ya, I'm just behind

tidal kiln
#

hmm. if it's just always two buffers, i think the code could really be simplified.

slender iron
#

limor pointed out it shouldn't be two until brightness != 0

#

which is a little more complex

#

but definitely something we taught folks

tidal kiln
#

isn't it pretty much just a simple trade off on memory space?

#

otherwise why not have two buffers?

slender iron
#

yup

#

memory

tidal kiln
#

is that no longer important? seems like there's where a lot of the complexity is coming from.

#

trying to only go to two buffers if needed

slender iron
#

it is important for M0

tidal kiln
#

so would still need some dynamic behavior on the buffers then?

slender iron
#

ya, but hopefully less

#

I can take a stab at it

manic glacierBOT
#

On Wed, 22 Jan 2020, at 10:07, Dan Halbert wrote:

Re hashing: I don't have much experience with this, but I read some stackoverflow answer which pointed to one of the functions mentioned here: https://en.wikipedia.org/wiki/List_of_hash_functions#Non-cryptographic_hash_functions

Normally I'd just use N bits out of an SHA1 from axtls, which is pulled into MicroPython to support uhashlib ... but I'm not sure that we link that generally in CircuitPython.

I was looking at a very similar list ...

tidal kiln
#

i think you should take that one. i could code it. but there are subtle design trade off things that i think you are going to be better at making calls on.

slender iron
#

will need to make sure that the built in _pixelbuf does it too

manic glacierBOT
#

Adafruit has purchased a block of MAC addresses, OUI = 98:76:B6 , which are
the upper three bytes of the MAC address.
(OUI = Organization Unique Identifier) (check out
https://www.wireshark.org/tools/oui-lookup.html or Google "OUI lookup" )
If you follow the rules about how MAC addresses are supposed to work, you
should retain these three upper bytes as fixed.
That only gives you the lower three bytes, or 24 bits to hash into.
You have some implied responsibility to not assign the same MAC...

manic glacierBOT
#

Building unix version to

  1. execute tests
  2. work on extensions

Below info on os and compiler:

Darwin betel 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64

Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin19.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

tulip sleet
#

@slender iron I finished all the PR's I think we need and did a draft release, if you want to look it over before I push the button.

manic glacierBOT
old smelt
#

So, I just discovered that if you put an HID Keycode for the up arrow in an infinite loop, it suddenly becomes challenging to edit your code. Unless the code change you want to make is in the TOP of the file.

slender iron
#

@tulip sleet feel free to post it. I’m grabbing dinner now before I head to choir

tulip sleet
#

@slender iron doing some testing first; I may be seeing an issue with something (might be BLE library)

manic glacierBOT
ivory yew
manic glacierBOT
tulip sleet
#

@idle owl I can make a PR for updating the frozen libs if you can test in the near future

manic glacierBOT
tulip sleet
#

@idle owl I merged CPX lib update, if you want to make a release

#

@idle owl I am going to go ahead with the beta, since we'll have another one soon enough

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 5\.0\.0\-beta\.4
orchid basinBOT
manic glacierBOT
ivory yew
#

yay new release

manic glacierBOT
idle owl
#

@tulip sleet That's fine. I missed these messages. Next release is fine.

tulip sleet
#

i expect more bugs 🙂

tulip sleet
#

@slender iron release is done. The sparkfun_qwiic_micro_no_flash build failed through no fault of its own: that instance failed installing deps. I guess we could do that build by hand and upload the artifacts, or just forget about it. I sure wish we could re-run a single check 😦

manic glacierBOT
#

The two issues raised here have split into a couple of different places, so I'm going to close this one for clarity and work can continue over there:

The docs and source seem to support socket.settimeout but it appears to invoke a method (syscall?) on the NIC, which throws:

See #2097 for work on adding settimeout to WizNet 5500. Once I actually get something working I'll backport it to MicroPython too.

The issue I am reporting is that the Wiznet 5500 has no on-board long term me...

slender iron
#

@tulip sleet I wouldn’t worry about it. I’m sure they’ll add single check rerun at some point

eager condor
#

Hi. I am new here. im trying to add external spi flash to feather m0 basic and make it work with the adafruit_spiflash library to store wav file in the external spi flash. anybody can point me in the right direction on making this work.

wind trellis
#

@eager condor I'm not totally sure what you mean by "point me in the right direction," but it sounds you are essentially trying to turn a Feather M0 Basic into a Feather M0 Express. So a good place to start--if you haven't done it yet--would be studying the schematic diagram of that board to see how the external SPI flash is connected on it. https://learn.adafruit.com/assets/40553

eager condor
#

@wind trellis yes exactly, essentially I'm trying to turn it into express. I understand where the pin of the SPI flash is connected by looking at the schematic. So are you trying to say i just have to solder the external SPI flash according to schematic of M0 express then my problem with the library will be solved?

manic glacierBOT
#

@arturo182 I wasn't able to get the UF2 bootloader going on my 1010 EVK. I tried to load the feather_mimxrt1011 version from commit 8d7dffe16901833041e75c3e3b6874e490cc4e6b but wasn't able to double tap reset. Is there another spot I should look? It didn't look like TinyUF2 had everything.

@jerryneedell This disables the DCache. Let me know if it fixes your issues on Teensy 4.

@tannewt -- this appears to have worked!! I can read the library files now -- I2C test worked with msa301...

wind trellis
#

@eager condor That's a good question, and I'm probably not the best person to answer it. (But I happen to be awake right now.) Is it showing the correct JEDEC ID for your flash device? If it is, it seems to be close to working. Have you formatted the flash file system?

manic glacierBOT
wind trellis
#

What's printing the "Adafruit M0 Express CircuitPython Flash Example" message? Is that a demo from somewhere, or a program you've written, or something else?

manic glacierBOT
#

I think at the moment the most important question is what kind of functions need to be exposed to the Python side of things so that async libraries could be implemented in the first place. Right now I'm mostly thinking about a select-like call, that could wait on multiple events at once (files, uart/spi/i2c, gpio changes, timers, etc.). Without this, we are reduced to a busy loop with polling, which can be sufficient for a proof-of-concept for the API, but not really useful.

indigo wedge
#

🤔

wind trellis
#

Off-by-one error 😆

solar whale
#

Arturo182++

solar whale
#

@indigo wedge have you ever tried cut/paste into the REPL on an iMX board? For the teensy40 it put the board into bootloader mode ....

#

it does depend on how big the cut/past is

indigo wedge
#

yeah i pasted multiple lines and never had a problem

solar whale
#
from board import *
import neopixel
import time
 
pixpin = D3
numpix = 16
```  kills the teensy40
#

is there a way to get out of bootloader mode without disconnecting the USB?

stuck elbow
#

try unmounting the disk maybe?

solar whale
#

it's not mounted when in bootloader mode 😦 -- not UF2

stuck elbow
#

ah, it's teensy, sorry, missed that

solar whale
#

np - thanks for trying!

manic glacierBOT
#

A Unix-style "select" actually isn't a good match for an async main loop. You don't want, or need, to shoehorn every feature that might conceivably wake up a task into a common select call. It mostly-works for Unix because almost-everything is a file descriptor there, but no sentence that starts with "everything is a …" makes sense on µPy.

Here's how I would handle things:

  • Whenever something happens, presumably that something triggers an interrupt.
  • The interrupt handler just hook...
manic glacierBOT
tulip sleet
#

@indigo wedge I typed that by hand sorry 🙂

#

will fix

idle owl
#

@tulip sleet Ok so freezing a module. Moves it from what-memory to what-memory? I want to explain it for a guide on a deliberately technical page, so it doesn't have to be super basically explained, but still easy to understand.

tulip sleet
#

@idle owl Normally, when a module is imported:

  • if it is a .py, it is compiled into byte codes, which are put in RAM and then executed there
  • if it is a .mpy, it is already compiled into byte codes, and they are put in RAM
  • if it is a frozen .mpy, then the byte codes are already in directly accessible memory (flash, not RAM), so they don't have to be copied in RAM. So it saves RAM.

(You can also have frozen .py files, which we never use; it's kind of pointless, since they would still have to be compiled._ <--- no need to explain

idle owl
#

And to verify, because the code looks different than I remember but I may be misremember, the code looks in root, then frozen, then /lib because of the sys.path bit at the beginning. Accurate? I know why we did it, and I'm certain that's the order we chose, but the code didn't verify it for me.

#

Ah ok.

#

Perfect thank you

tulip sleet
#

right, you can verify by doing

>>> import sys
>>> sys.path
idle owl
#

Yah which I did do. Ok, good to know that was right.

onyx hinge
#

@tulip sleet @slender iron We've seen that displayio performance can be low due to non-"0" software rotation. I notice in the controller datasheet for the pyportal's lcd, mirror and transpose can be done at the controller instead of software via a "MADCTL" register. Do you know whether there's a reason this solution wasn't adopted for that particular hardware combination? (https://github.com/adafruit/circuitpython/issues/2386)

GitHub

CircuitPython - a Python implementation for teaching coding with microcontrollers - adafruit/circuitpython

half sedge
#

@tulip sleet Do frozen mpy run slower (because flash is slower than RAM), especially on super fast microprocessor?
This relate to things @slender iron said recently while working on i.MX.

tulip sleet
#

@gilded cradle do you have a comment on the MADCTL register, above? ^^

onyx hinge
#

I doubt anybody has done a measurement with circuitpython, but I'm going to expect not noticibly. A Python bytecode is probably only read every 100 or 1000 or 10000 CPU cycles

tulip sleet
#

@half sedge Fetching the bytecodes from flash is almost certainly swamped by the code needed to execute them

#

if we compiled directly to machine instructions, yes (and there's a decorator to do that)

#

but I'm not sure we've tried freezing native compiled stuff

#

@micropython.native is the decorator. Note that this does not produce very efficient code. It's just short-circuiting the bytecode opcode dispatch by calling the routines that execute the opcodes directly

onyx hinge
#

and I think @micropython.native is only enabled in select builds; in other builds it is accepted but has no effect

tulip sleet
#

right

half sedge
#

Thanks @tulip sleet , I did read somewhere in the explanation between .py .mpy and frozen .mpy that the later could be slower. Your explanation is much better, I hope to recover the learn guide or else from where I remember this...

onyx hinge
#

mpy-cross refuses to process the file fwiw

#

SyntaxError: invalid micropython decorator

stuck elbow
#

@onyx hinge I think you have to specify architecture

#

when calling the mpy-cross

onyx hinge
#

That's quite possible

bright aspen
#

@onyx hinge My feelings on 100 or 1000 or 100000 cycles are the same as Mabel's in Pirates of Penzanze: "It seems so long." Those numbers are probably right. Just changing a pin output value takes 6 microseconds on Feather M4 Express. In grandpa voice: back in my day (FORTH) we'd step through code in just a couple machine cycles. I assume the 1000 or 100000 cycles are I/O or something. Or some big things are done in a single step.

manic glacierBOT
gilded cradle
#

@tulip sleet, @onyx hinge my understanding is @slender iron wanted it done in software to avoid a tearing effect.

slender iron
#

@onyx hinge I didn't want to use MADCTL because the displays ram update can occur orthogonal to the display refresh direction which ensure tearing as they cross

#

my goal instead was to basically MADCTL how we fill the buffer before we blast it out over DMA

#

so that bitmaps should always be read by row rather than column

#

this can break down if the areas we refresh have lots of columns but few rows

#

we could speed up fatfs in that case if we had a mode where we only read the bytes we need rather than a whole 512 byte sector

manic glacierBOT
#

use case...

I have a class that handles UART communication with an audio Bluetooth module. It has two levels of flow control, RTS/CTS and "OK". Messages belong to a particular channel and those have to be split apart on receiving and either queued or callback'd. Currently, a polling loop calls update() often. (Well, actually, it is named spin(), but I noticed that Debounce has update().) The function update() is expected to return quickly if it has nothing to do. I have goofed and let code...

ionic elk
#

@slender iron do you have a sec for an optimization question?

#

I'm having the const pin value of pulseio_pwmout_obj_t get overwritten by the use of an ST HAL macro and I'm not sure how that's happening

slender iron
#

const pin*?

#

a pointer?

ionic elk
#

I enter this function:

void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) {
    uint32_t internal_duty_cycle = timer_get_internal_duty(duty, self->period);
    __HAL_TIM_SET_COMPARE(&self->handle, self->channel, internal_duty_cycle);
    self->duty_cycle = duty;
}
#

and as soon as I hit the __HAL_TIM_SET_COMPARE, self->tim->pin, in const mcu_tim_pin_obj_t *tim;, is overwritten from the useful value in flash of 0x804b774 <pin_PC07> to junk value 0x20002b00 <displays+168>

#

is this related to how the optimizer passes in this: self=self@entry=0x20002b68 <displays+272>?

slender iron
#

it seems suspect to me that it overwrites a value in flash

#

are you sure the pointer value isn't changing?

#

that would be in ram

ionic elk
#

it doesn't overwrite the value in flash, it just changes the address of the pointer from one that's pointing to flash to one in ram

#

that's what I mean

slender iron
#

ah

stuck elbow
slender iron
#

@stuck elbow yes please

ionic elk
#

And this is more just a debugger question, but when I step past __HAL_TIM_SET_COMPARE, I'm booted all the way out into the containing function? Do you know why GDB wouldn't step to the self->duty_cycle = duty?

timber mango
#

Hi, I just bought an itsybitsy m4 and am wondering about which aes lib to use that makes use of the crypto-engines on the chip. I have seen messages talking about how this is not yet supported in circuitpython but does anyone know about an arduino library that does? @slender iron

stuck elbow
#

@slender iron I wonder if the first point should be removed, since MicroPython also now supports SAMD boards

slender iron
#

@stuck elbow probably. I'm not looking at it now. feel free to make all the changes you feel are appropriate and I'll review in a PR

#

@prime flower do we have an arduino library that uses the crypto parts of the samd51?

#

@ionic elk not sure. let me look at what TIM_SET_COMPARE is doing

#

what is the overall issue?

ionic elk
#
#define __HAL_TIM_SET_COMPARE(__HANDLE__, __CHANNEL__, __COMPARE__) \
(((__CHANNEL__) == TIM_CHANNEL_1) ? ((__HANDLE__)->Instance->CCR1 = (__COMPARE__)) :\
 ((__CHANNEL__) == TIM_CHANNEL_2) ? ((__HANDLE__)->Instance->CCR2 = (__COMPARE__)) :\
 ((__CHANNEL__) == TIM_CHANNEL_3) ? ((__HANDLE__)->Instance->CCR3 = (__COMPARE__)) :\
 ((__HANDLE__)->Instance->CCR4 = (__COMPARE__)))
slender iron
#

ah

ionic elk
#

overall issue is that this function effectively deletes the pin out of the structure for some reason, so it never gets passed to the de-init functions, and never gets removed from claimed_pins or never reset

slender iron
#

you are giving it the address of the handle

ionic elk
#

does that bork with the optimizer?

slender iron
#

no, the optimizer has nothing to do with it

ionic elk
#

Oh I see you mean I should be passing it by value

#

no, that doesn't work

slender iron
#

in the pwmout you want to store TIM_HandleTypeDef *handle;

ionic elk
#

error: invalid type argument of '->' (have 'TIM_HandleTypeDef' {aka 'struct <anonymous>'})

slender iron
#

hrm

#

maybe not

#

what do you get when you p/x *self?

#

are the values in the handle ok?

manic glacierBOT
slender iron
#

@ionic elk check your git diff for any accidental changes

ionic elk
#

@slender iron yeah sorry Sublime does this thing where it sometimes carries over characters or even copy past commands after I do them in other windows?

#

anyway, did the test, *self doesn't actually change at all? It literally just overwrites the pin, which is a sub-value of tim

#

everything in the whole struct is the same but this: {tim_index = 3 '\003', altfn_index = 2 '\002', channel_index = 2 '\002', pin = 0x804b77c <pin_PC07>} goes to this {tim_index = 3 '\003', altfn_index = 2 '\002', channel_index = 2 '\002', pin = 0x20002b00 <displays+168>}

slender iron
#

please share it with me

#

I don't expect it to change. I want to make sure the values are correct

ionic elk
#
{base = {type = 0x804cf3c <pulseio_pwmout_type>}, handle = {Instance = 0x40000400, Init = {Prescaler = 0, CounterMode = 0, Period = 1679, ClockDivision = 0, RepetitionCounter = 0, 
      AutoReloadPreload = 0}, Channel = HAL_TIM_ACTIVE_CHANNEL_CLEARED, hdma = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, Lock = HAL_UNLOCKED, State = HAL_TIM_STATE_READY}, chan_handle = {OCMode = 96, 
    Pulse = 0, OCPolarity = 2, OCNPolarity = 8, OCFastMode = 0, OCIdleState = 256, OCNIdleState = 512}, tim = 0x2001f9e4, channel = 4 '\004', variable_frequency = false, duty_cycle = 0, 
  frequency = 50000, period = 1680}
#

gah, this is all a red herring. That tim is probably a dud pointer and it's just ending up here by chance.

prime flower
#

@slender iron tinylora might..lemmie check

prime flower
#

@slender iron nope - it doesnt, ladyada would know.

slender iron
#

@timber mango I don't think we have an arduino library either

timber mango
#

ok, thanks anyways!

manic glacierBOT
#

Sorry, this wasn't a well thought out comment. I wanted to make a note for myself (in my comment history) of where this happened in the review process - the introduction of the intermediate variable for mcu_tim_pin_list[i] here caused a dangling pointer that had a cascade of bad effects, and I'd definitely like to make sure I don't make such a glaring error in the future, so I wanted to put in a reminder I could search for. Not professional wording though, I apologize.

tulip sleet
#

@stuck elbow which is the first point you thought of removing?

manic glacierBOT
stuck elbow
#

@tulip sleet the one about CircuitPython supporting SAMD

#

as a difference from MicroPython

#

it's merged now

tulip sleet
#

i think your new sentence is good: Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.

stuck elbow
#

that is the second point, which I left there, just added the extra ports

#

I replaced the one about SAMD with USB

tulip sleet
#

right, the new phrasing is good; the list of ports we support is still different (even if overlapping)

stuck elbow
#

I have to admit that I'm still in shock about how fast the stm32 and imx ports are improving

tulip sleet
#

the factoring-out of common code is pretty good, so one can really concentrate on the differences without tons of duplciated code

manic glacierBOT
#

@Dar-Scott It doesn't. CPython uses fancy syntax around generator functions and calls them coroutines. µPy does the same thing. A coroutine is not a continuation as that word is usually used, because it's not a copyable object.

To explain: Python only allows you to continue a coroutine (you call its send method) and you get a value and some state back (at the next point the coro uses yield (not yield from) which is where you continue with the next send). This is not a symmetric re...

#

I recognize we all have different notions of what is simple. I like the idea that CircuitPython implements something simple and the big boys can create from that tools they like. These are my notions of simple.

Moving functions around as data is sometimes hard to grok, but it seems to be introduced early and is an important concept. I think we can assume that concept, at least to the extent of modifying examples. (Coroutines, as the term is commonly used, can be confusing, because they are...

#

Sure thing. A dangling pointer was created by attempting to use intermediate variables to increase readability in this section, by creating a copy of the static constant list, mcu_tim_pin_list[i], in an intermediate variable called l_tim. The self->tim member was then based off the l_tim copy, which then dropped out of scope and caused errors later in the program when essential pin information was overwritten without notice. I should have noticed the repercussions this would have before i...

#

@ smurfix My ignorance is showing here. You seem to have stepped around what I was trying to ask and I suspect that is because it is obvious. How do you save where you are in Python? I can picture an ad hoc method that saves lambdas representing the rest of the work, but that means translating the code in a special way that does that, and that becomes interesting in compound statements. I think I am stuck on some 20th century concept.

#

@Dar-Scott This was done in Python initially only for the so-called "iterator generators", functions that instead of (or in addition to) return use yield. "Calling" such a function produces an iterator object, which executes until the first yield, and then you can call next() on that object to get it to execute to the next yield and so on. Then a yield from statement was added, which basically iterates over another iterator, and yields each value it gets from it.

Th...

manic glacierBOT
#

@Dar-Scott You don't. It's implicit when you create and use a generator. The "yield" which you use when executing the generator's code saves the call stack and returns a value to the caller, which then calls send to get your generator to continue where it suspended itself.

There is no other way to create that call stack. The only way to "make something suspendable" is to convert the whole thing to async functions by liberally sprinkling "async" and "await" keywords onto your code. The on...

#

CircuitPython crashed and went into safemode when saving the code from this website from Mu: https://learn.adafruit.com/lightsaber-featherwing/software

I've been attempting to get this lightsaber to work for a while with no success, but this is the first time I've had a crash so something must have been changed within the last hour because I just updated all the files in the library folder. I'm running the latest version of CircuitPython 4 and using the latest CircuitPy 4 library files. Th...

#

That's correct. I've been experiencing issues and was told on a reddit thread I started that I should try using an older neopixel library file, so I did that, but now it seems circuitpython 4 just completely crashes when saving that lightsaber code. using CircuitPy 3 doesn't crash, but it does present me with the same 'no sound, no light effects' issue I've been having for a week.

Adafruit thread: https://forums.adafruit.com/viewtopic.php?f=57&t=160960

Here's the reddit thread too: htt...

#

@smurfix Reading your approach with interrupts I can't help but note that this is exactly how the select function need to be implemented internally (keeping a list of references to objects that have something to show, and then returning it as soon as it's non-empty or there is a timeout), except it wouldn't use any library-specific objects internally, so that multiple different libraries could be implemented using it on the Python side. Sure, those references would need to be more than ju...

nocturne coral
prime flower
#

@nocturne coral Hi - could you post this question in the #help-with-circuitpython channel? This channel is for circuitpython discussion

nocturne coral
#

Sure @prime flower , I'm sorry ... I did not realize! 😅

simple pulsar
#

Are there some notes summarising technical aspects of the L1 cache blues on that fast processor that was mentioned on/after the Tuesday meeting?

#

If the chip in question was the NXP iMXRT1062 on the Teensy 4.0 then there's a lot of detail on this page including a few surprises like the RAM not all behaving in the same manner: https://www.pjrc.com/store/teensy40.html

manic glacierBOT
#

@deshipu The generator function is what I was missing.

Your meanwhile is clean and simple. As is, it is reduced to polling, but allows a certain expressiveness is describing processes. It can be expanded to add priorities, or deadlines. Some sort of interrupt or callback might speed that up. The use of select() might work but it requires some notion of selectables.

I guess I was trying to add to CircuitPython rather than using Python (which includes user definable generator function...

timber mango
#

Greetings, Programs.

ionic elk
#

@slender iron figured out my other display problem - is there an option to invert the backlight LED? It seems like background tasks for displayIO likes to enforce that it's 1, even if brightness is set to 0

#

On the meowbit, the BL pin needs to be held low, not high

slender iron
#

@simple pulsar yup, I've seen that. the trickiness we've been seeing has to the DCache which isn't covered there

#

@ionic elk you may need to add a kwarg for inverted backlight

timber mango
#

I just submitted a PR for the ht16k33 library. I found some errors in processing floats and negative numbers, which I did not find when I made the original change. All fixed!

#

I think I will create a new Github account as "geekguy" just for doing Adafruit stuff. Too confusing submitting stuff as hybotics!

idle owl
#

@timber mango Thanks!

timber mango
#

I never have understood kwargs, so am going to have to read up on that.

simple pulsar
#

@slender iron What is the DCache? The data sheet mentions a "32 KB L1 Data Cache" - is that what's being referred to?

slender iron
#

yup!

manic glacierBOT
eager condor
#

@wind trellis the "Adafruit M0 Express CircuitPython Flash Example" message is from the sketch and yes it is a example/demo provided by the Adafruit_SPIFlash library. Yes it is showing a correct JEDEC ID I think. The tutorial provided by adafruit didnt mention anything about formatting the flash file system. But if I want to format it do you know any example that I can follow?

umbral ice
#

I'm tearing into rotaryio for STM32F405 this evening. I've found the HAL reference for the STM32, but not one for SAMD (not critical but would be nice).

I'm comparing some of the syntax to DigitalInOur.c and I can't follow this part:

#

It reads to me:
return ... some stuff
: -> I don't know what it means to start a line with a colon
? -> same goes here for the question mark

raven canopy
#

@umbral ice the ? ... : ... is a ternary operator that is shorthand for if ... then ... else. It works out as ? valueIfTrue : valueIfFalse.

The line separations are purely for readability; since it is all contained in parens, the complier sees it as one expression.

#

also, re: SAMD HAL - the SAMD21 doesn't have a peripheral for encoders, so the code is rolled by hand using an EIC. there is a TODO: to add usage of the SAMD51's encoder peripheral.

umbral ice
#

@raven canopy Thanks for the explanation, it's helpful. I saw the note about using the SAMD51 peripherals. What's the name of the encoder peripheral? (I'll track it down in the HAL document)

raven canopy
#

QEDC iirc from the sheet. let me pull it up real quick

#

nope...PDEC, chapter 53. It has a QDEC capability. so close 😄

#

scratch that. its been too long since i worked in the core....

umbral ice
#

I'm seeing chapter 65, HAL TIM Generic Driver as looking right

#

HAL_TIM_Encoder()

shrewd moss
#

How can i learn circuit python

timber mango
#

I have a weird problem that seems to do with both Arduino and Circuitpython. I have a Feather M0 Express I am trying to use with Arduino now. When ever I program the M0, I get a "FEATHERBOOT not found" message but no error(s) from the Arduino 1.8.10 IDE. I have no idea what is wrong. Is this worthy of an issue?

manic glacierBOT
manic glacierBOT
#

Thanks for the kind words @ngmacha. There's a mcp23s08_blinkandbutton.py demo in the branch I linked to above, if you have an mcp23s08 and would like to try it. It's fully functional afaik, and I'd like to hear about problems if any. If you need help running it on a different board or want it to do something beyond blinking LEDs or whatever, I'll do what I can.

lone sandalBOT
manic glacierBOT
timber mango
#

Hello I'm new here,
I need some basic information about circuitpython on a nRF52480 Dongle. I have some Dongle with no firmware on it. I want to do two things.

  1. I want to flash the firmware adafruit-circuitpython-pca10059-de_DE-4.1.2.bin on it to play with it in the first step
  2. I want to develope some special C-Modules like in MicroPython in the second step.

What I want also is to program (build and flash) the firmware via Segger J-LINK and with some IDE.
Question: If there some Information or tutorials to build and flash the firmware on Windows with Eclipse or SEGGER SES Embedded Studio or some other IDE?

Thanks for your help
Frank

timber mango
#

What i did, maybe it wasn't that good, I flashed the .bin - file on the dongle with the j-flash lite app from SEGGER and maybe I erased the bootloader. Is in the .bin file everything included?

lone sandalBOT
timber mango
solar whale
#

@timber mango sounds like you are back on track -- make sure you load the sd as swell

#
make BOARD=pca10059 sd
make BOARD=pca10059 flash```
lone sandalBOT
timber mango
#

hello @solar whale , yes i did load the sd, now the firmware must be flashed. I think i just copy the .dfu file in the drive, is this correct?

manic glacierBOT
timber mango
#

oh sorry, i mean the .uf2 file: adafruit-circuitpython-feather_nrf52840_express-de_DE-4.1.2.uf2

charred blaze
solar whale
#

@timber mango yes -- just copy the .uf2 file to the NRF52BOOT drive -- You should then see a drive called CIRCUITPY

#

If you are going to use BLE, I suggest going to the 5.0Beta4 release of CircCuitPython.

#

wait

#

Don't use the feather_nrf52840 build!!

#

you have a Dongle, pca10059, correct?

timber mango
#

@solar whale yes, i did copy the psa10059 build on the drive. The drive vanished and nothing happend anymore, no drive at all. 😯

solar whale
#

hmm -- just tried beta4 on mine and it comes up. What is your host computer?

timber mango
#

Windows 10

solar whale
#

can you see if it is recognizing any USB device -- I don't have a Windows system so I'm not sure how to look.

#

also can you try to open a terminal session to the REPL if there is a port to talk to...

timber mango
#

no usb device and no COM port

solar whale
#

if you doubletap the reset button does it go back to the bootloader?

timber mango
#

id did doubletap the reset button, nothing happened

solar whale
#

try a few times it can be hard to do on those boards!

#

not the big button - the one that is "lying down"

timber mango
#

yes i know, but nothing happened, no led, no drive

solar whale
#

hmm -- let me take a few minutes to hook up my J-link and go through the whole process. Did you load the sd first then the bootloader?

timber mango
#

ok, what happened when i plug in the module the green led flashes two times and then nothing more

solar whale
#

that is typical -- then I see the CIRCUITPY drive

#

ok -- I just reflashed sd,bootlaoder and beta4 and it is working ok

timber mango
#

that's crazy, i must erase the chip with the j-flash tool and after that i could program the bootloader again. I think i have a misunderstanding on how to use it

#

ohh, beta4, i will try it

solar whale
#

I tried 4.1.2 and it also works but I think for BLE 5.0beta4 will be better

timber mango
#

what i see in bootloader mode is only slight glow of the green led

#

what to do with the CURRENT.UF2 which is already on the drive?

solar whale
#

yes -- and the NRF52BOOT --- leave it -- it will be replaced. THe file is always called CURRENT.UF2

#

just copy the new .uf2 to NRF52BOOT

timber mango
#

Great, now i see the CIRCUITPY drive, thank you

solar whale
#

yay!

#

it is a small drive on the pca10059!

#

about 239Kbytes

#

now a doubletap of the reset should get you back to bootloader if you want to ever update the CircuitPython image

timber mango
#

ok, firstly i thought to flash the .bin file with the JTAG on flash, i don't even know if that works. Would it work?

#

yeah, an now the green led really flash 😉

manic glacierBOT
solar whale
#

It's bin a long time since I tried that -- I'm not sure of how to work with the bin file any more. May need a different bootloader

timber mango
#

ok, i saw the bootloader source support the SEGGER Embedded Studio, thats great i will try that next but do you know how i can the circuitpython framework include in a SES project?

#

mostly for debugging purposes

solar whale
#

sorry -- what is SES?

#

ah Segger Embedded Studio -- sorry -- no idea...

#

I'm strictly a command-line person 😉

onyx hinge
#

I did a quick project with micropython last night (esp32 temperature logger to adafruit.io) and it reminded me (A) how critical the CIRCUITPY USB device is to a quick workflow and (B) how great the depth of support is from the bundle of circuitpython modules, almost all of which (C) have adequate-to-great docs

trim elm
solar whale
#

@timber mango Good luck with it -- There may well be folks here later with SES experience.

timber mango
#

@solar whale thanks so far, that has brought me very far today.

solar whale
#

Glad I could help.

timber mango
#

@onyx hinge I did a project with micropython also. The community and support really are lacking, and here I am.

onyx hinge
#

@timber mango we're happy to have you!

timber mango
#

@onyx hinge It looks like you are stuck with me! 😀

bright aspen
#

@onyx hinge I've been tinkering with SDcard and SPIDevice libraries. (Well, butchering my copies, mostly adding pulses on pins.) I noticed that every SPI call takes a minimum of 20 us. I think there are ways to speed this up for use with a faster clock without complicating things, maybe simplifying things. One notable time consumer is divmod(). In the process of cleaning up a few things here and there, I reduced the decrease in what gc.mem_free() returns to 32 bytes. It is not zero, but close. I don't know where that is, but my current suspicion is with. That is, there is no net loss from the start of enter and the end of exit in SPIDevice, but there is after the with.

#

Ha! In trying to type in some functiion names, I discovered how underline.

onyx hinge
#

Great sleuthing. If you get to the point of a PR please tag me!

lone sandalBOT
timber mango
#

I am still having problems between Arduino and Circuitpython. I have rebooted several times.

lone axle
#

@timber mango Which device are you using? and what kind of trouble you having?

timber mango
#

@lone axle I get that when ever I try to program the board with Arduino.

lone axle
#

I'm not very familiar with the process of programming them with Arduino, based on the fact that it's looking for FEATHERBOOT I assume it needs to be in bootloader mode. Does the status RGB led turn the correct color when you double tap reset to go to bootloader?

#

Have you ever successfully programmed this device with Arduino before, and it's just not working now? Or is this the first time you are trying it with this device?

timber mango
#

@lone axle I have programmed it with Arduino before. This problem started when I had a Circuitputhon board (Feather M4 Express) connected at the same time as the M0 with Arduino.

lone axle
#

Ah

timber mango
#

I ejected and unplugged the M4.

lone axle
#

Perhaps the COM port #s got switched up or something. I would check in Device Manager (or equivalent for your OS) and make sure the M0 still has the COM port that Arduino IDE is trying to communicate over.

timber mango
#

I am running Raspbian on a Raspberry Pi 4. I can see the port fine.

lone axle
#

Is Arduino IDE still set to the proper port though? perhaps it switched over when the M4 was plugged in

timber mango
#

According to the Arduino IDE, the M0 has the port.

lone axle
#

This page: https://learn.adafruit.com/adafruit-feather-m0-basic-proto/using-with-arduino-ide also mentions if you do get stuck in a weird spot where it won't take a new program it could be worth a try to explicitly put it into bootloader mode by double tapping reset button. Then check for the new COM # (it should change compared to "normal" mode I think) and try programming it from Arduino IDE pointing to the new COM port

Adafruit Learning System

Wanna play with the ARM Cortex M0 chipset?

timber mango
#

I already tried that without success.

lone axle
#

May be worth trying to reboot the pi too, if you haven't done that. Could be just something weird leftover from when the M4 was plugged in that could get cleaned up during a reboot?

timber mango
#

I also rebooted my Pi 4.

lone axle
#

Hmm, thats about it for my ideas unfortunately. Sorry 😩 . Only other thought I have is to try checking to see if the Arduino IDE is still capable of writing to a different device and if not perhaps remove / re-install the IDE. But that's probably a longshot.

timber mango
#

Yeah, I think I have tried all the obvious stuff, which leads me to look for other stuff. I have no idea though. Will try reinstalling the IDE.

lone axle
#

Did you program the M4 device with Arduino IDE while it was conencted? Or just have it connected for different purpose?

raven canopy
#

@trim elm I'd say you're correct, that display_shapes didn't patch beacuase it is a fork. it's probably not showing up as a result from the list_repos() function. I'll try to remember to verify later.

timber mango
#

I have successfully programmed both devices when both were connected. I do not know what went wrong.

tulip sleet
#

@timber mango that message about FEATHERBOOT is probably because the drive appears and then disappears quickly during programming. Are you successfully uploading? If you double-click, is the red LED pulsing slowly?

timber mango
#

I can put the M0 into bootloader mode and FEATHERBOOT shows up as a drive.

#

It seems to program correctly from the Arduino IDE, but I do not get any output in the serial monitor. It acts like some sort of serial port issue.

#

I did reinstall the 1.8.10 IDE.

#

@tulip sleet Yes, the red LED pulses if I put the M0 into bootloader mode.

#

I just got a notice of updates to the boards - am updating now. Includes updates to M0/M4 boards.

#

Board definitions, tools, HUGE update.

#

Everything was way out of date, I am sorry to admit. I usually take care of updates ASAP. This may fix my problems.

#

Updates take a LONG time at Cell speeds.

onyx hinge
#

Can I switch the analog reference voltage in circuitpython?

#

(pygamer/samd51)

onyx hinge
#

seems like no, oh well

manic glacierBOT
ionic elk
#

Is there a significant difference between displays that are declared in the board.c file vs ones that are declared at runtime in code.py?

slender iron
#

@ionic elk there shouldn't be. the only difference is where the structs are allocated

manic glacierBOT
#

@tannewt so, I'm on the very last remaining bug with the meowbit, which is a TX Not Empty error causing a timeout in SPI write (we opted not to give a timeout period when creating the module) when the screen enters bug display mode after an error (doesn't happen if you release displays). I've got something that's weirding me out.

When I have a sketch with display code, it likes to skip to Code done running. Waiting for reload. even if there's an infinite while loop of delays or prints a...

#

How are you initializing the display? Is an exception printed to the serial output?

It does not get that far (serial output). The code is:

  • initialize the display
  • run some display stuff
  • infinite loop of prints ("hello")

I'll see like one or two hellos and then it does a soft reboot

Code done running. Waiting for reload.
soft reboot

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

after which it enters the cr...

ionic elk
#

@slender iron is there a REPL command to force a circuitpython to force erase its external flash filesystem? I tried reducing the SPI timeout value and it appears to have bricked my external flash, even once reverted

ionic elk
#

Thanks! I'd missed that line

tidal kiln
#

np. careful. it's actually two lines 🙂

slender iron
#

I'm working on making the same API changes to _pixelbuf

manic glacierBOT
ionic elk
#

@slender iron Been hacking at this display bug for a couple hours now and I think I have to ask for help again here - do you have a minute today?

manic glacierBOT
#

Detailed repro info:

  • This now works successfully if you have a release-displays at the beginning and the end of the code, implying the recent bugfixes have resolved the major issues with release-displays. If you give a nice long delay before the code ends you'll see display activity.
  • However, there is still a crash that occurs if you remove the final release-displays. Once crashed, debugger reveals the code is stuck in a TX not empty loop in HAL_SPI_Transmit.
    • Function of failure ...
manic glacierBOT
#

I re-tested this on IOS 13.3 on an iPhone 6S, and it's still a problem. I can delete, say, code.py in the Files app, but when I browse away to another device and then browse back to CIRCUITPY, code.py is still there, and it's also still there if I remove the board and plug it into a regular host computer.

We could special-case the .Trashes folder and have anything moved into it automatically be deleted immediately. I'm not sure if that's a great user experience, but maybe it's no wor...

slender iron
#

@ionic elk sorry I’m booked up today. I can help tomorrow though

manic glacierBOT
timber mango
#

Things kept going worse and worse with Arduino, so I just nuked ~/.arduino15 and am reinstalling everything from scratch.

#

Unfortunately, starting over from scratch sometimes is the only way to fix a problem.

ionic elk
#

Such are the perils of wizardry

timber mango
#

I had that game when it came out. 😎

#

I think it was one of the very first 3D dungeon exploration games, even though it was not with true 3D backgrounds and terrain.

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

Fixes #2341. Soft-reload was not turning off NeoPixels on Circuit Playground Bluefruit.

  • Add code to CPB board.c to turn off NeoPixels.
  • Refactor the port-independent NeoPixel reset code to avoid code duplication. Add supervisor/shared/board.c for such common code.
  • Allocate space on the stack for up to 24 NeoPixels in nrf neopixel_write/__init__.c to enable PWM-based NeoPixel writes without a VM but with the SoftDevice enabled. I chose 24 because it's less than 400 bytes on the s...
manic glacierBOT
lone axle
#

The Bluefruit Playground Community Edition is live now on the play store: https://play.google.com/store/apps/details?id=com.adafruit.bluefruit_playground&hl=en_US adabot

Circuit Playground Bluefruit is the most fun you can have with a circuit board – and Bluefruit Playground makes it even better.

Connect Bluefruit Playground to a Circuit Playground Bluefruit board and you can:

• Control LED color & animation
• View continuous light se...

prime grove
#

@slender iron quick question for you

#

OLED display support is missing in the Cortex-M0 build of CP. Is this because you ran out of FLASH space?

#

If this is the case, I plan to add my ss_oled library to it and solve the problem.

lone sandalBOT
onyx hinge
#

@slender iron hold on, the DAC "DATABUF#" registers are at 0x...14 and 0x...16. Doesn't that mean they could both be written by one DMA just like i2s? And ditch this double DMA thing once and for all?

#

at least for the sane case to use, signed 16-bits, with the channels in the right order

manic glacierBOT
#

I realized that we weren't doing this on some other boards with user neopixel strings, and added them.

Working on this made me think there could be a board.NEOPIXEL_COUNT constant available on the boards that have on-board user neopixels. But that's a feature we could add later. Also, right now, pybadge (5 neopixels) and pybadge_lc (1 neopixel)` share the same build, so we'd need to split those builds.

tulip sleet
#

@prime grove which board build is it, and do you mean displayio isn't present at all?

#

CPX doesn't have displayio unless you use the special circuitplayground_express_displayio build

prime grove
#

The Serpente board

#

building the bare CP firmware, there's no specific OLED library, but displayio seems to be there, 12k remaining space

#

@tulip sleet

tulip sleet
prime grove
#

I understand a display library exists, but why isn't in the default CP build?

tulip sleet
#

you mean frozen in?

prime grove
#

yes

#

I assumed it was due to a lack of space, that's why I hoped someone would have a quick answer instead of me cloning, building only to see it fail

tulip sleet
#

it's a python library, we'd only consider freezing it in if serpente had it as an onboard display

prime grove
#

hmm

#

not a great answer

#

it won't load dynamically due to lack of space

tulip sleet
#

did you mpy-cross it?

prime grove
#

I didn't try to build the Adafruit OLED library

#

all I was asking is why it's not in there

tulip sleet
#

there are many different python based drivers for various displays, we can't fit them all in flash

prime grove
#

ok

tulip sleet
#

there are two things going on here: enabling/disabling native (C-based) modules, and freezing in compiled python code when there's room and it supports on-board peripherals

prime grove
#

I don't really want to use Adafruit's OLED library. I want to port my own. I was just curious why something very popular wasn't already included.

tulip sleet
#

so on the Circuit Playground Express, we freeze in the Python modules for the onboard accelerometer, etc. We only do this because freezing the Python modules saves significant RAM space on import

prime grove
#

exactly

#

I understand the mechanism

#

that's why it was disappointing to not be able to use the OLED from python on the Cortex-M0 by loading the library dynamically - out of memory. Something most users won't be able to do (rebuild firmware)

tulip sleet
#

like, .more than a dozen

prime grove
#

I get it

#

I'm wondering if these types of libraries are taking up more space because they're written in Python vs all native.

#

Thanks for answering my Qs

tulip sleet
#

i'm not sure why you're running out of ram

prime grove
#

If I import Adafruit_OLED as a run-time library, it fails with out of memory

#

it depends on a couple of other libraries that don't appear to be "frozen" in the default M0 firmware

tulip sleet
#

which library exactly?

prime grove
#

The I2C and SPI communication libraries

#

Let me see if I can find the exact names

tulip sleet
#

which oled library exactly

prime grove
#

Adafruit_ssd1306.py

#

i2c_device.py

#

spi_device.py

#

Adafruit_framebuf.py

#

all had to be loaded in RAM

tulip sleet
#

you don't want to use adafruit_ssd1306.py, you want to use adafruit_displayio_1306.py

#

the framebuf stuff is old, you want to use the displayio stuff instead

prime grove
#

ok

tulip sleet
#

i mean, you can use what you want, but they're different

prime grove
#

as I said, I don't really want to use the Adafruit OLED library, so don't worry about guiding me to get that working

tulip sleet
#

I'm saying that the native displayio module takes care of a lot of stuff that used to be in framebuf or would have been in a display-specific module

prime grove
#

ok

#

I don't plan on using framebuf with my code - too limit

#

ed

tulip sleet
#

so I'd suggest exploring displayio and using the https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306. All the latter does is set up the int sequence for that paritcular display. Everything else is generic via displayio

prime grove
#

What I plan to do, I just want raw I2C writes from C

#

existing display infrastructure doesn't help me

tulip sleet
#

so that would be a special-purpose native module you'd have to implement yourself, as I think you want to, but we have no way of importing an external native module

prime grove
#

I know, I plan on building my own firmware image

tulip sleet
#

do you want to hop into audio, as I think we're talking past each other a bit

prime grove
#

not really, I'm done. Thank you.

tulip sleet
#

ok, np, good luck!

prime grove
#

🙂

tulip sleet
#

i will also just say to make sure to use the .mpy versions if you're ram-limited because you can run out of RAM due to compilation as opposed to raw space

prime grove
#

now you lost me

#

I want to add a C module to the CP build for Cortex-M0. It will be completely written in C and not need much RAM. What does MPY have to do with that?

#

.MPY versions of what?

tulip sleet
#

you were saying you were running out of RAM using the python modules

prime grove
#

I did an experiment to try to use the OLED display with the M0. It led me down a path to learn more about how CP works.

#

I don't need to use that for anything, it was just an experiment

#

It's clear that dynamic loading of python libraries on a system with a small amount of RAM is kind of pointless

#

My plan is to use up to the max of the 12k remaining flash space to implement my ss_oled library so that it's accessible from python and provides more functionality and speed than what is currently available

tulip sleet
#

OK 🙂 I would disagree with the "pointless", but that's your take

prime grove
#

limited use

tulip sleet
#

the M0 boards were always a compromise in terms of RAM; they're good for small projects. The M4 boards are roomy enough for most things

prime grove
#

I get that. This is the same reason I did a lot of libraries which support the ATtiny85. The constraints make it fun/challenging

tulip sleet
#

i look forward to seeing what you come up. 🙂

prime grove
#

thx

#

you can see it already 🙂 Just check out the videos I've done of my ss_oled library

#

etc

lone axle
#

Neat!

bright aspen
#

@onyx hinge Since you are down deep into audio DMA, I'll mention that @lone axle, in a discussion in #help-with-audio, noted that building two single-channel audio out objects on different pins fails because of a resource scarcity. (I forgot what, locked audio or running out of DMA channels or something.)

lone axle
#

Thank you Dar, yep that is true. The exception message was something like "DAC already in use" when I tried to initialize a second AudioOut object on the other pin. In my case I was using A0 and A1 on the NeoTrellis m4 express, which are the left and right audio channels that go to the 3.5mm jack.

#

If I used deinit() on the first one, then I could create the second and play something out of it. So by doing that in between each tone I was able to play the tones back and forth in succession on the two different audio channels, but never playing both at the same time.

#

I did eventually figure out that the AudioOut constructor has left_channel, and right_channel parameters and using those does allow me to play tones out of both audio channels at once. Though I have not yet figured out a way to independently play two different tones out of each channel at the same time. Which is perhaps not necessary, but I think might be a fun way to make some bleep bloops.

bright aspen
#

@lone axle Perhaps the mixer is a good workaround or even the right way. I do see a use case where the two audio channels are owned by two different objects, say a parrot and a tactile click or music and doorbell.

lone axle
#

Yep, I'm gonna try playing around with Mixer this weekend a bit to see what I can do with it.

bright aspen
#

@lone axle And you might be able to create your own audio layer in Python. I do note that @onyx hinge seems to be seeing some DMA starving and a Python layer might make that worse. The idea is interesting to me, though.

bright aspen
#

@onyx hinge @slender iron Kibitzing again. It would be good if the time to prepare an audio output buffer Is closer to the average time to compute that buffer through all the layers, not the maximum time. One method, maybe, is to add an update() method to playables. If it is never called, the behavior is as is. If called a layer tries to prep. If it has nothing to do, it calls the update() for the next layer. If a player calls update() often, or maybe even just after it gets a buffer, then maybe this would smooth out the time to get a buffer of audio. I would like to add a Python layer that allows me to queue sounds without missing a sample time, and to add my own block memory. Maybe this would help.

main meteor
#

I used a similar approach in my clocked DAC app: I set up a circular buffer and would add more when there was room, and send samples on a regular basis. A little checking showed how full it tended to be under various conditions.

manic glacierBOT
obsidian compass
#

Has the mu editor development halted?

tulip sleet
#

@plucky flint is in charge of Mu development, not us. I see PR's and issues all the time. It is definitely not halted but he is doing other things also.

obsidian compass
#

@tulip sleet yeah 🙂 , I asked here in general because it’s editor of choice for Circuitpython. It is not working well with Mac upgrades so went to check new releases but there isn’t. @plucky flint hope we can see new releases soon 🙂

ionic elk
#

@slender iron you still have a sec today? I've made some progress on this bug but I'd still really appreciate your input!

#

I've been doing Saleae captures this morning and I see a major flash/display conflict right at startup, but I'm not confident as to what exactly Display is trying to do.

plucky flint
lone axle
#

Is there any where that lists the specific model of the screens used the PyPortal and PyBadge devices? Mostly I'm curious if they are amongst the screens supported by the Adafruit_CircuitPython_RGB_Display driver library. I wasn't having much luck looking at the Tech Spec's page for those devices.

plucky flint
#

@tulip sleet 👍 definitely not halted. But I'm very time poor right now. I need to try to find some extended time to do code and issue gardening WRT Mu.

obsidian compass
#

@plucky flint awesome, thank you!

plucky flint
slender iron
#

@ionic elk yup, I have time in an hour or so. I have a person coming to quote some gutter work and they'll be here shortly

#

@onyx hinge I think you still need to check if they are writable together...

#

could always try it and see

#

Registers can be 8, 16, or 32 bits wide. Atomic 8-, 16- and 32-bit accesses are supported. In addition, the 8-bit quarters and 16-bit halves of a 32-bit register, and the 8-bit halves of a 16-bit register can be accessed directly.

#

I think they are listed as two 16-bit registers

#

but maybe that is just a documentation thing

onyx hinge
#

I'll put it on my list of stuff to try. it would be a super nice simplification

#

but that DAC hardware is tricksy so you never know

orchid basinBOT
slender iron
#

@ionic elk free now

#

@onyx hinge yup yup. I don't remember trying it myself

orchid basinBOT
ionic elk
#

@slender iron Amelia?

slender iron
ionic elk
#

@slender iron FIXED. DONE WITH MEOWBIT

slender iron
#

yay!

#

did you move the init into board.c?

ionic elk
#

Aw what is that png

#

yes

slender iron
#

great! ready for review? I can add it to my list

ionic elk
#

Yep pushing now

#

well actually, probably needs a final test of all of this plus bootloader

#

so gimme a sec to do that

slender iron
#

np, still getting through email

slender iron
#

has fewer open tabs than he has had in a while

ionic elk
#

oh you're one of those are you

#

the bajillion tab people

slender iron
#

going through email = opening tabs to do

ionic elk
#

are there any existing boards for CPy that use the ST7735R?

#

Or do I need to convert the python bytearray to a C array

slender iron
#

I think the hallowing m0 does

stuck elbow
#

7735 is in the hallowing, the pyboard and the pybadge

#

And that ai version of pybadge, how was it called

slender iron
#

edge badge

ionic elk
#

hallowing m0 has the defs, thank you!

lone sandalBOT
ionic elk
#

hmm, defining the screen in board.c makes the bootloader not work?

#

why would that be?

slender iron
#

how does it not work?

ionic elk
#

never starts circuitpython. You drag the UF2 over and nothing happens

slender iron
#

how far does it get?

ionic elk
#

haven't dug into it too much yet but strikes me as weird

#

maybe a hard crash?

#

I'll just open that up as a new issue, I don't want it to hold up this PR now that all the crucial bugfixes are in.

manic glacierBOT
#

Hello! I am attempting to add an option into the gcc call that CircuitPython uses to compile one of the modules. I am working to include a separate shared library for wrapping C++ into C for use in CircuitPython, and this requires citing a .so file that was generated with g++ when calling gcc. Is this possible, and if so, where do the gcc file falls live? I found .p files that are automatically generated when I attempt to build a board, but I’m not sure if these include the gcc call.

bright aspen
#

Is this worth creating an issue? A function with a trivial "with" without "as" does not lose memory, a function with a trivial "with" including "as" loses 16 bytes as reported by gc.mem_free(). This does not seem to be collectable. That is, after three calls to gc.collect(), the loss is sustained. This is in contrast to simply setting a variable to a value in a function; that is recovered immediately after the return even without a gc.collect(). Both will set the variable within the function, but the "with" seems to leak memory.

stuck elbow
#

Does it leak further 16 bytes with every function call, or does it only happen one per with?

tulip sleet
#

does 16 bytes vary with the length of the as name?

#

I think it may be that the name is added to a dict, and that may grow the dict

#

@bright aspen ^^

#

for instance, does this further use 16 bytes:

with ... as abc:
   pass
with ... as abc:   # does this use up more bytes?
   pass
manic glacierBOT
#

The CircuitPython compilation process generates a bunch of .o files that are linked together into a single .elf. .so is for run-time dynamic linking, which I don't think makes sense here. For instance, here's the final linking step from ports-atmel-samd/Makefile:

$(BUILD)/firmware.elf: $(OBJ) $(GENERATED_LD_FILE)
	$(STEPECHO) "LINK $@"
	$(Q)$(CC) -o $@ $(LDFLAGS) $(OBJ) -Wl,--start-group $(LIBS) -Wl,--end-group
	$(Q)$(SIZE) $@ | $(PYTHON3) $(TOP)/tools/build_memory_info.p...
onyx hinge
#

all "with" might not be created equal, here's a little test I ran on an m4 (pygamer): ```=== import gc
=== def f():
=== with open("/main.py") as abc:
=== pass

=== def g():
=== abc = open("/main.py")
=== abc.close()

=== def test(cb):
=== for i in range(10):
=== gc.collect()
=== orig_free = gc.mem_free()
=== for j in range(10): cb()
=== new_free = gc.mem_free()
=== gc.collect()
=== gc.collect()
=== gc.collect()
=== gc.collect()
=== post_free = gc.mem_free()
=== return (post_free-orig_free, new_free-orig_free, post_free)

=== print(test(f))
=== print(test(g))

(0, -960, 156656)
(0, -960, 156656)

#

so my finding would be that they both temporarily allocate the same amount (960) and they both eventually free it all (0), leaving 156656 bytes free in RAM

#

of course not all objects that you "with" might be created equal..

#

if I only gc.collect() once, sometimes they print nonzero values in the first returned value (so gc.collect still had more to collect), which I don't know what that means

bright aspen
#

@onyx hinge That is almost like mine, except I use my own trivial class, I don't loop and I cut and pasted the code at the top level instead of being smart and passing in a function. And I have only 3 collects.

#

Oh, I'm using Feather M4 Express.

onyx hinge
#
===     pass
=== print(abc)
<io.TextIOWrapper 20003080>
``` that will leave the variable itself existing and referring to (in my case) the closed file object
tough flax
#

So, because I'm cheap & trying to use Trinket M0s... 🙂

I am hitting memory issues regarding a big table. We've gotten past this (thanks @tulip sleet & others) by running mpy-cross on the file. I'm thinking that it would be helpful if there were a site out there that takes a .py file and gives the .mpy file. For those who don't have/want the CP source, it might be handy.

Before I stand one up, does something like this exist?

bright aspen
#

@onyx hinge Right. I did put the with in a function. I just put the calling of the function up at the top level.

onyx hinge
#

got it, then my explanation doesn't fit the facts

bright aspen
#

Somehow we are getting different results.

tulip sleet
#

@tough flax no, we don't have anything like that, but it would be nice! We've been negligent in adding mpy-cross executables to the releases. We should at least link to them from circuitpython.org

onyx hinge
#

@tough flax that sounds like an interesting service to offer. I wonder if it would fit into the model of aws lambda or similar

#

mpy-cross is probably NOT resistant to malicious inputs

#

so that's something to consider before offering a web service

#

at the very least there will be inputs that crash mpy-cross, and many crashing bugs are also "gain access to the server environment" bugs when investigated closely

tough flax
#

Well, then I think having the executables would be a great help

#

I'm looking at a table (up to 24x24x1byte) that folks will want to edit. Turns out that putting that into CP code is actually pretty memory intensive (the code takes up way more code than the actual data).

tulip sleet
#

I'll make an issue to put them on circuitpython.org. Adding them to each release by hand is painful, though it could be automated. I have to build them separately for Mac, Linux, and Windows

onyx hinge
#

can we build software for Windows and Mac with github actions?

tulip sleet
#

@tough flax Would it make sense to make a special purpose thing that compiles the table, and spits out a binary file, which can be read by your code?

tough flax
#

@tulip sleet has a nifty trick about character arrays appending to each other... but telling a user to edit those /uXXX codes won't work. Editing an array w/constants will but takes up way too much space.

#

Yeah @tulip sleet we could do something that makes one of your arrays from the input

#

It's just that the mpy-cross would solve lots of OTHER memory issues

onyx hinge
#

yes, mpy-cross can help with memory usage and startup time

tulip sleet
#

@onyx hinge I don't know about Windows and Mac, but probably yes

tough flax
#

On the non-express boards, the memory is the consistent issue for me

raven canopy
tough flax
#

Is there no pure python mpy-cross?

orchid basinBOT
raven canopy
#

also, here are the available environments on Actions:

Windows Server 2019
Ubuntu 18.04
Ubuntu 16.04
macOS Catalina 10.15
orchid basinBOT
raven canopy
#

ARM? where are you seeing that one @tulip sleet

tulip sleet
#

@tough flax no, mpy-cross is a variation on raw MicroPython

bright aspen
#

@tulip sleet I increased the length of the name of the variable, created two variables with two "with" statements, and even increased the size of of the value returned by enter. Still 16. So, I guess it is not left in a dictionary and it is not related to the number of variables. (I haven't tried a more complicated "with".

raven canopy
#

ahh. for self-hosted probably, since there is an ARM version of Docker

bright aspen
#

Arg. I need to learn how to type that in.

tulip sleet
#

i have to go cook, sorry, will stop by later

tough flax
#

Thanks for thinking about this - it's not critical for me (I have the source!) but would be helpful long term

orchid basinBOT
onyx hinge
#

I think I know enough things to get an arm-native (like for rpi) binary from an x86_64 ubuntu builder system, if we get to the point where that's an important missing piece to add. IMO for people with compilers available, like rpi systems, making the circuitpython-build-tools install mpy-cross as an executable program would be a great option too

#

but that doesn't serve windows users very well, afaik, they don' t have compilers available easily

bright aspen
#

This is my "with" test:

import gc

class With_test:
    def __init__(self):
        pass
    def __enter__(self):
        return None
    def __exit__(self, p0, p1, p2):
        return False

# with
test = With_test()
def test_fun_with():
    with test as x:
        pass

gc.collect()
mf0 = gc.mem_free()
test_fun_with()
mf1 = gc.mem_free()
gc.collect()
gc.collect()
gc.collect()
gc.collect()
mf2 = gc.mem_free()
print(mf0, mf1, mf2, mf2-mf0)

# assignment
def test_fun():
    x = 42

gc.collect()
mf0 = gc.mem_free()
test_fun()
mf1 = gc.mem_free()
gc.collect()
gc.collect()
gc.collect()
gc.collect()
mf2 = gc.mem_free()
print(mf0, mf1, mf2, mf2-mf0)
raven canopy
#

on windows, its a painful road, thats for sure.

onyx hinge
#

heck I'd rather use my past-life experience and cross-build windows mpy-cross.exe on linux, not just for an extra level of meta-ness but because it's easier

bright aspen
#

I don't think I formatted that right. Ah. Now I have!

raven canopy
#

with gcc9, RPi is going to be better off cross-compiling anyway. just ask @solar whale how long it takes to compile arm-none-eabi-gcc on Raspbian...

onyx hinge
#

eek

raven canopy
#

although...maybe mpy-cross won't need it? 🤔

onyx hinge
#

I found that with enough memory and a USB hard drive some super important environment tweaks, it was a shade faster to build a large piece of software (linux kernel) natively on pi4 (4GB model) than on an x86_64 system with 16 threads using the "qemu-static" method. for whatever that's worth to nobody.

#

mpy-cross can probably just use the system's gcc

#

but by default gcc writes temporary files to the very slow /tmp on SD card and then reads them back as it does the steps of compilation! and that tanks compile performance, even if you move your source code onto a USB hard drive or ssd. TMPDIR=/dev/shm (use ramdisk for temporary files) fixes that

#

or maybe it's TEMPDIR, thanks linux for making things easy 🙂

#

🤏

#

@bright aspen ```156304 156288 156288 -16
156256 156256 156256 0

#

something is different about our two examples, I wonder what 🙂

#

man I need to vary my emoji more. 🌆

bright aspen
#

Oh, and the result from my "with" test:

158192 158176 158176 -16
158144 158144 158144 0
raven canopy
#

lol. @onyx hinge i too get into routines with my emojis. 🌵

onyx hinge
#

saguaro is a nice woody word

solar whale
#

As to compiling gcc9 on an RPI , don’t bother on less than a 4. But “ set it and forget it” 😉 it takes many hours.

lone sandalBOT
bright aspen
#

@onyx hinge @tulip sleet Maybe there is something wrong with my trivial class that makes the difference.

onyx hinge
#

looks too simple to have bugs

tulip sleet
#

I am building mpy-cross on windows with msys, if I remember right.

bright aspen
#

Ah. A simple bug. The worse kind.

idle owl
#

@onyx hinge not tinny at all.

manic glacierBOT
tulip sleet
#

@slender iron is _bleio.PacketBuffer working? I could use it for HRM because of the variable length notify-only characteristic. I didn't know if you wrote anything on the adafruit_ble side for it either. tnx

slender iron
#

ya, it should work

#

I was thinking of just adding a kwarg to Characteristic instead

#

because we only ever want to fetch one value (unless we do actually want to buffer)

#

AMS uses it

tulip sleet
#

ah, ok, great, an example is the best medicine

slender iron
#

🙂

#

its probably more complicated than what you need though

tulip sleet
#

since the key HRM characteristic is notify only, there's no way to get its value except via CharacteristicBuffer or PacketBuffer

bright aspen
#

@onyx hinge @tulip sleet I moved my testing inside a function as the test by @onyx hinge and there is no memory loss seen within the function. However, the call of that function from the top level loses 16 bytes, but not if that is in a loop. This is starting to look trivial. Maybe.

tulip sleet
#

@slender iron maybe I should fix basic _bleio.Characteristic to handle notify events and just save the most recent value so it can be read with .value

slender iron
#

@tulip sleet ya, that's kind of what I was thinking. will the SD store the last value for us?

tulip sleet
#

i'm not sure, i'll read about it and try some things, thanks

slender iron
#

np

#

thanks for looking at it. I got mine today too

#

working on _pixelbuf though

tulip sleet
#

's fine, division of labor on the ble stuff is good

slender iron
#

🙂

#

I'm happy with PacketBuffer so far

onyx hinge
#

@bright aspen once again I appreciate you digging in and bring lots of detail to these questions, even if the resolution is "maybe it doesn't matter". Determining where to NOT spend further time is something I am not always the best at

slender iron
modern wing
#

That's a good video on memory, glad you didn't forget about it.

#

In all seriousness, it really is a good video. I remember watching it live, and realizing just how much I forgot through the years.

slender iron
#

more important things to remember 🙂

bright aspen
#

@onyx hinge Maybe it does matter. A gc shouldn't be needed. I was looking at SDcard.readblocks() earlier, which uses spi_device and this was the last bit I could not get rid of in memory usage (though collectable).

onyx hinge
#

if it's truly the with-object, then maybe there's a way to manually write it as try/finally that doesn't behave that way, I don't know. It's true, it would be nice to get to 0 new-bytes-to-gc in SDcard.readblocks, that would have a positive effect for JEplayer / mp3 playing in general

#

if divmod takes measurable time, did you investigate replacing it with bitops, since 512 is a nice binary number?

#

I don't know if that tuple creation + denaturing causes allocations that go to gc, too

#

spi busdevice's __exit__ also allocates a 1-byte bytearray

#

that could be turned into static storage maybe

#

or .. wouldn't buf = b'\xff' work?

bright aspen
#

@onyx hinge Great minds think alike! I did change the divmod in my butchering to // and used a 511 mask but moved it inside the assert. I got rid of an unneeded slice and that helped. I did not see a way to speed up crc without obfuscation. And I did change the __exit__ so all the work is in __init__, creating a bytearray attribute that is written in the exit. One thing I thought about with the with is to drop the as and set card directly.

#

Whoops. Definitely the wrong markdown.

onyx hinge
#

just a single backtick for inline-code

#

x >> 9 might be faster than x // 512

bright aspen
#

Thanks. Ha! I was just about to say almost exactly the same. I will do that.

manic glacierBOT
onyx hinge
#

Did I just dream that there exists a neopixel with all white pixels? "WWWW"?

tulip sleet
#

etc.

manic glacierBOT
raven canopy
#

wouldn't you know it. the night i'm ready to update both my laptop and run config scripts on the rosiepi, to install gcc9...arm website is down. 🎉

manic glacierBOT
bright aspen
#

@onyx hinge I found it. It was the *exc in the __exit__ definition. I changed that to 3 parameters. I haven't tested for a multiblock read.

orchid basinBOT
half sedge
#

Any FancyLED expert to say if I should have used it's gradiant to palette for this example https://github.com/adafruit/Adafruit_CircuitPython_MLX90640/blob/master/examples/mlx90640_pygamer.py ?
It works as it is, and give credit for the gradiant code, but maybe this is reinventing the wheel from a Circuit Python point of view.

onyx hinge
#

@bright aspen excellent find. If you PR it, tag me!

#

@half sedge I think there is good value in the example being self-contained, so copy-and-credit facilitates that while acknowledging the source

half sedge
#

@onyx hinge There is also value in using existing CircuitPython library to reduce the size and abstract some part.
What I did not verify is if the palette you can create with FancyLED are compatible with the one you use in displayio...
In displayio I have used integer tuple with 3 value from 0 to 255. While FancyLED seems to normalize on tuple from three float from 0 to 1.
It would make sense to be compatible.

obsidian compass
#

I was wondering if there’s any plan to introduce circuitpython in Google Summer of code?

orchid basinBOT
obsidian compass
#

Under "Library Installation" section on this above guide

#

I think it should be "adafruit_logging" and not "adafruit_logger"

#
adafruit_minimqtt
'adafruit_logger'
adafruit_esp32spi
adafruit_bus_device 
neopixel.mpy ```
raven canopy
#

@obsidian compass you're correct. the library's name was changed a while ago, and that obviously didn't get updated. there is a link to provide feedback on the guide page, in the lower left. that would be the best way to get that reported.

obsidian compass
#

I'll do that right away, thank you @raven canopy

raven canopy
#

thank you for spotting it!

obsidian compass
#

In most of Airlift external ESP32 feather wing guides, I've observed this

#
# If you have an externally connected ESP32:
# esp32_cs = DigitalInOut(board.D9)
# esp32_ready = DigitalInOut(board.D10)
# esp32_reset = DigitalInOut(board.D5) ```
#

However this isn't working for me using ESP32 featherwing on PyBadge

#

This works for me: esp32_cs = DigitalInOut(board.D13) esp32_ready = DigitalInOut(board.D11) esp32_reset = DigitalInOut(board.D12)

#

Since feather is a generic layout across boards shouldn't pin mapping be also constant?

patent wagon
#

Which version of CircuitPython does Blinka correspond to.

half sedge
#

@patent wagon That is an interesting question... I would guess "latest" and the same you get for library installed with pip.
I would say CircuitPython version is important when you actually run CP, and that is not the case with Blika (you run CPython from your machine). It is also important for mpy that need to match Circuit Python version, but with Blinka, you don't use mpy files but the my files.
Please someone has an authoritative answer and can correct me if I am wrong?

orchid basinBOT
patent wagon
#

More specifically, which version of CircuitPython Bundle should I use with Blinka

quasi fjord
#

you don't, those bundle are only for CP microcontrollers.

#

Blinka is most of the same libraries distributed through the normal Python mechanism

patent wagon
#

Ok. So do I need anything more than Blinka and the driver pointed to by the device’s product page?

#

I.e., from PyPi

quasi fjord
#

yup

patent wagon
#

Ok, thanks. That should get me farther. Thanks.

tidal kiln
#

^^ above is correct.

#

Most product guides will have a "Python & CircuitPython" section

#

for Blinka, you'll want to follow the "Python" part - which should show installing the library via pip

obsidian compass
#

Is it not possible to use the display of PyBadge and ESP32 feather wing at same time? It says D8 in use...

#

Ok got it working together, I think it's neopixel and display together? Something's not right

lone axle
#

The 5 neopixels under the display on the pybadge?

river quest
#

hi folks, here's the DRAFT of the upcoming “Python for microcontrollers” newsletter that ships out tuesday at 11am ET via adafruitdaily.com - please send any links, news, events and more via an issue/PR, or @ us or really any thing 🙂 we'll get it added!

https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/_drafts/2020-01-28-draft.md

obsidian compass
#

@lone axle yes

lone axle
#

@obsidian compass did you get it working? I am pretty sure that it's possible to use those neopixels and the display at the same time. I can test it real quick here. I don't have the ESP32 feather wing though, so I can't speak to that part really.

obsidian compass
#

@lone axle it has to do with esp32 feather wing and neopixel together.

lone axle
#

I see.

manic glacierBOT
#

these are attached as artifacts of the github actions build. More work would be needed to get them to a useful spot, such as on circuitpython.org. Related to https://github.com/adafruit/circuitpython-org/issues/53

A macos build isn't done, but it should not be too tough given that compatible builders are provided.

Testing performed: that all the programs run and print a message that no input file was provided, when run on the appropriate host. (wine64 in the case of the windows execut...

manic glacierBOT
#

@jepler, you sure made quick work of this!

I do have some higher-level suggestions, which likely require some other points of view besides mine.

  • Since mpy-cross really only tracks major version increases, I wouldn't have it compiled with every PR/push. I would place these Actions tasks either into the create_website_pr.yml/tools/build_release_files.py, or in a separate workflow that was triggered on release.

  • The "get it to circuitpython.org" question would be easily answer...

raven canopy
#

@tulip sleet random question: did we experience a GitHub Actions rate limit last week? i want to say i saw that discussed, but just want to verify...

onyx hinge
#

but I have no mac so I can't try it

#

(not actually static despite the filename)

solar whale
#

Is there yet any difference between the 4.x and 5.x CIrcuitPython bundles? I did a recent version compare and they were identical. Just wondering if it is really useful to have 2 versions.

onyx hinge
#

@solar whale I think the split was envisioned as one way to allow 4.x and 5.x to ship different sets of modules, but you may be right that this facility is incomplete or not being used yet.

#

I think that historically between 3.x and 4.x maybe, the .mpy files were just incompatible, whether or not the .py files would have been

#

so maybe it has to do with the possibility of that, which is not actual at this time?

solar whale
#

Agreed. It just seems like lot of effort and confusion for the possible need. Just an observation....

onyx hinge
#

you could bring it to in-the-weeds on Monday, maybe somebody would know something

tulip sleet
#

@raven canopy a number of the builds failed to upload, but it seems to have been an infrastructure problem;there were network failures

manic glacierBOT
#

I have prepared some rules for building mac mpy-cross. I did not static link this one, and I have no way of running/testing it. if someone can pick the binary up and give it a run, please let us know. Note that it builds on Catalina so for all I know Catalina is a minimum version to run it; I don't know much about how cross-version stuff goes on macos. (sensing a theme yet?)

tidal kiln
#

@solar whale i think that was done for simplicity. there was confusion between CP versions and bundle (mpy-cross) versions. so just decided to always have a 3.x, 4.x, 5.x or whatever bundle version available regardless. and those versions match the CP firmware version. in that regard, it has been very useful. "using CP 4.x? then grab bundle 4.x. done."

solar whale
#

@tidal kiln but has there actually ever been a need? Have they ever been different?

tidal kiln
#

they were at one point, early on

#

the mpy-cross version used by CP was changed

solar whale
#

Between 2 and 3 IIRC

tidal kiln
#

and the libraries were being released with the mpy-cross version, which just happened to be close to the CP version

solar whale
#

It just seems like it’s been a lot of extra effort and confusion. Just my opinion.

tidal kiln
#

the amount of confusion the other way was off the charts

#

i can't remember the exact details. scott/dan would.

solar whale
#

As I recall, mpy-cross changed between 2and 3. That was a big deal. But i cringe when I see someone blaming the libraries for issues related to a move from 4 to 5.

onyx hinge
#

mpy-cross would probably change again if we took major improvements from micropyton

tidal kiln
#

is there a linkable example to the above? (library issues)

solar whale
#

My point is that there has never been a difference between 4.x and 5.x of even 3. x but lots of implications that it was necessary to update.

#

If mpy-cross changes, clearly it has to be dealt with.

manic glacierBOT
onyx hinge
#

since I spread some FUD about whether mpy-cross is safe to run on untrusted input, I'm running a fuzzer on it to see if there are any easy to provoke crashes. I'll report my results. (a fuzzer is a program which tries to find inputs that make another program crash or misbehave)

#

so far it did find one assertion crash so that's fun

#

a syntax error not detected where it should be, leads to an assertion error later on. The minimized test case is: class R: def _():0 async def _():() async for x in():0 try: while 0:() except:() and python3 says SyntaxError: 'async for' outside async function for this case.

#

even more minimized: async for x in():0

onyx hinge
#

another assertion hit by p000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

#

but if the only problems are assertion errors, that's fine for service-ifying mpy-cross. I feel much better about that idea now, with 2 hours of testing done...

#

and 1 hang: mpy-cross compiling print(a ^ (-1 << 2006860))

orchid basinBOT
ionic elk
#

To folks who write guides: is there a particular approach to creating python virtual environments that's consistent across Learn guides? There's a couple different options for it and I want to make sure I'm matching to the convention if there is one.

pastel panther
#

@ionic elk I can't speak for other guide types but they aren't used for the CP code in product guides

#

I think in general they're not used in guides for "normal" circuitpython but perhaps it is more common to use them with Blinka