#circuitpython-dev
1 messages · Page 283 of 1
@simple pulsar cool! I really like the meowbit and hope I can get it squared away real soon.
Update fix (missing pragma gcc diagnostic push)
PR associated to #2540
@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.
ok. i'll add some text, so others will know as well.
@half sedge wanna take a look? pretty simple - just added some text up top:
https://learn.adafruit.com/circuitpython-libraries-on-any-computer-with-mcp2221/faq-troubleshooting
Perfect.
@proper swan please mute
@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.
thanks!
@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.
[belated hug report to kattni for taking the lead on pycon for adafruit people!]
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. 😉
Dual boot Win10/Win7 - life only would get better with XP in there
@simple pulsar, I can do a virtual machine for that
in the weeds
neopixel on MCU's without pixelbuf?
- mention circuitpyhonistas
@idle owl Don't hesitate to contact me about my demo for MLX90640. Right now it is just in the GitHub.
It's an "Ugly American" thingy 🙂
- google calendar?
@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.
- more advance planning, not 1 week
@idle owl On top of Adafruit web site, there was a hint about not shipping on the 20... I had no clue why.
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.
Finding the DOC file can be challenging. I scrolled like hell on discord to find it.
@half sedge I like to search for mentions of circuitpythonistas to find it, but .. it's not ideal
Hmm, we have #circuitpython2020 but no #circuitpythonshowerthoughts?
could the ICS file also have a link to the meeting notes doc (event description field?)
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.
Could we have a website widget or something?
all notes are here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/tree/master/2020
@ionic elk that's potentially what the jekyll plugin woiuld do, I think
and the notes include video links
Neither can I.
hang on..
looks like it "should be easy" to remove the need for re. in https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf/ I could cook it up if that's helpful.
Does it also help because this become asynchronous?
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...
Like launching an "effect" and then doing something else while it run? Like you would for audio?
it looks like it's not a submodule in the bundle
Are mpys big? M0's have small drives
If there is a bug, I will probably trip over it. 😃
K3wl as the kidz say
The downside to attending the live session, now nothing to watch in bed tonight.
Thanks all y'all!
I want to be ping.
@half sedge Done.
Beat me to it @idle owl, thanks 🙂
👋
< looking around for those purple PCBs >
👋
Thanks everyone!
Thanks everyone
Thanks everyone!
Great team. Thanks for the effort.
M0 is great for small thing (Trinket and Gemma).
What's the population of M0 boards out there? I'd imagine there's a lot of CPX's sold?
@slender iron I figured that out. I only buy M4 or newer boards now.
There are warning about M0 left and right, but it is not always clear what you loose.
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.
@onyx hinge ha! haven't even made an issue for that yet 🙂
and then the Gizmo.
That inflate the number of board...
We are not at 101 if you remove the Crikit and Gizmo.
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?
@half sedge we'll be there soon enough. no reason to nitpick the number
@gilded cradle you're welcome. Hugs back at'cha. 🙂
You need to reach 100 for 02/02 ...
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
@half sedge Crickit and Gizmo are not stand alone boards. 😃
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.
true
👋
@half sedge what do you mean 02/02?
When I muted/unmuted, did it give an audio alert for everyone else? Or is that contained on my end?
2nd February. 😉
is that when your talk is?
Yes. 😉
@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. 😀
🙂 My pending iMX PR adds three so don't worry
At one point I will have to freeze what I write in the slide. I was planning to update on the iMX LIVE.
I am really looking forward to Circuitpython on the Teensy 4.0 and i.MX boards when they are released!
Does the iMX board offer USB storage function like M0, M4 and nRF?
I have the same question for the STM32 kind of board.
@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.
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 🤷♂️ ]
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.
@modern wing I hope to meet you there
@half sedge yes, imx rt and stm32 show up as USB drives
I still plan to build my Mesh network here, with RFM69 radios. However, this new Bluetooth Mesh looks really interesting for short range stuff.
@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".
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
ESP8266 had two problem then, not having the UF2 AND not having the USB storage. And that rule it out.
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
@slender iron Will we have to use the MCU specific loaders when loading Circuitpython on the new boards?
the ESP32-S2 has native USB but it isn't generally available yet
Great, I have my fact right. That is the most important.
@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
@slender iron as you have noticed with the nitpicking of the 100 number, I do like to have the fact right. 😉
@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
I’ll get back to you in 5-10 minutes
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!
@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
@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.
@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.
@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 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.
@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.
@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.
@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.
Ok, sounds good. I'm happy to answer questions about board capabilities.
@timber mango I don't deal with deadlines well either. You could start by looking at existing PRs on the libraries. https://circuitpython.org/contributing
if you have a teensy 4 then help testing imx is welcome too
its very very early though
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.
@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.
If you want a lot of sensor right away without additional acquisition, go CPX, CPB, Clue.
@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.
you can do IR with CPB using external receivers
Yeah sure, I did IR with Trinket M0. 😉
you'd laso have to change the folder name to match ndgarage_ndbit7, you can use 'git mv' to do that easily
wanna name this ndgarage_ndbit6?
Fix #2539
The entries in the board's mpconfigboard.mk override any other entries.
Also, fixed a warning for bad use of backslash in a string.
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.
@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
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.
@timber mango should not be problem
I hope to have a PR in soon for the RFM69 to add "reliable datagram" (ack handshake)
@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.
The libraries would require the sensor/breakout/etc involved with the lib.
@solar whale Ah, cool! I am very interested in stuff like that. I am also a Ham N6BOT. 🙂
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>
@idle owl thanks for the kick in the pants about that and @slender iron thanks for the first step in doing better
@timber mango I was a ham but let my license expire 😦 I've been having lots of fun with the RFM69 and 9x boards.
Recording of today's is here: https://youtu.be/h-5J80RdBv0
Meeting notes are available here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2020/2020-01-21.md
Join here for the chat all week: http://adafru.it/discord
The weekly happens normally at 2pm ET/11am PT on Mondays except when US holidays occu...
@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.
you can also just press the up arrow
@timber mango probably meant @solar whale
np
OK, I am off now. I have to take my dog out and want to get back to my Arduino to Circuitpython conversions.
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,...
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...
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.
My PyCon 2020 tutorial proposal was accepted.
nice! 🎉
Congrats @idle owl !
woot @idle owl congrats
Yeah, good point. I guess rather than picking an actual random MAC we could hash the uid down to 46 bits and the odds of collision are still really rather low. Elegant.
rotaryio not currently implemented in circuitpython for STM32 based boards (e.g., STM32F405).
@idle owl hooray!
@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...
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
Just tagging #2021, so I have a mental reference in the future. 🐘
@tidal kiln are you interested in more pixelbuf work or should I do it?
@idle owl just saw. Congratulations, now the hard work starts
@slender iron related to open issues?
based on me catching up on things
I think NeoPixel_SPI should inherit from pixelbuf directly
and pixelbuf should manage the buffers itself
probably makes sense. there's not much code actually left in the neopixel class.
right, the code that things want to share should be centralized now
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...
ya, I'm just behind
hmm. if it's just always two buffers, i think the code could really be simplified.
limor pointed out it shouldn't be two until brightness != 0
which is a little more complex
but definitely something we taught folks
isn't it pretty much just a simple trade off on memory space?
otherwise why not have two buffers?
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
it is important for M0
so would still need some dynamic behavior on the buffers then?
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 ...
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.
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...
Fixes #2437 on circuitpython 5.0.0.
I tested this with the proposed change to the Circuit Playground library that caused the issue and it worked successfully. Thanks for the update!
I'd argue that we really don't want to pick random/hashed UAA addresses (eg: within Adafruit's OUI) ... they're supposed to be administratively controlled.
Better to use a LAA address where we get 46 bits of address space to play with and a much lower probability of collision.
Note: just built the docs locally. Everything looks good. Merging.
Why are you building CircuitPython for unix? What version of Mac OSX are you on?
Building unix version to
- execute tests
- 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
diagnostic push and pop pragmas are not balanced. gcc closes an eye on it. clang does not.
@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.
Thanks! It must have been added with a compiler update. I've built them before and not had a problem. I am now though so I'll reopen the PR.
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.
@tulip sleet feel free to post it. I’m grabbing dinner now before I head to choir
@slender iron doing some testing first; I may be seeing an issue with something (might be BLE library)
I'd rather leave them here for now. I think there is more rework todo around flash config settings and would rather leave this here until we rework it more broadly. Consider it temporary for now.
CircuitPython is fun. CircuitPython is more fun when you make bleep boops every time you modify your code: https://twitter.com/theavalkyrie/status/1219801536806649857
@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.
I think checking the register value will actually work once the bootloader sets it for its own use. Although it is preserved on reset, I believe it is zeroed on power up.
@idle owl I can make a PR for updating the frozen libs if you can test in the near future
The datasheet implies that it does but I haven't confirmed it:

We can't use RAM for this because we shuffle the underlying RAM banks on start up which moves the value that the UF2 bootloader sets to somewhere else.
@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
Automated website update for release 5.0.0-beta.4 by Blinka.
New boards:
- aramcon_badge_2019
- ohs2020_badge
- openbook_m4
- seeeduino_xiao
@tannewt It's not review-ready yet, but can I get your comment on the general idea of this change before I spend more time on my testing plan?
yay new release
thanks @tannewt @arturo182 @jerryneedell I will try to see if I could help on this issue :) . Another question, where should I find those mentioned scripts raytrace.py and llutm.py .
@arturo182 It is hard to whitelist since my IP is dynamic :)
Looks good! New boards as expected.
@tulip sleet That's fine. I missed these messages. Next release is fine.
i expect more bugs 🙂
@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 😦
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...
@tulip sleet I wouldn’t worry about it. I’m sure they’ll add single check rerun at some point
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.
@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
@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?
This is the problem that I'm facing
Before running the sketch I already load circuitpython into the board. Thus, circuitpy folder appear as seen here
@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...
@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?
I wasn't aware that you are already working on it. And looks like I wasn't up to date with the async status in MicroPython — I stopped following closely before it was implemented, and missed it, thanks for the correction.
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?
No problem. I wasn't "working on it", strictly speaking; my branch is more like a proof-of-concept hack to discover whether µPy might be up to the task. Much would need to be done, preferably by people who actually know their way around Micro/CircuitPython (I don't – not yet anyway), to transform it into a useable ecosystem.
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.
Off-by-one error 😆
Arturo182++
@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
yeah i pasted multiple lines and never had a problem
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?
try unmounting the disk maybe?
it's not mounted when in bootloader mode 😦 -- not UF2
ah, it's teensy, sorry, missed that
np - thanks for trying!
regarding the REPL crash on cut/paste, I found that:
from digitalio import *
from board import *
import neopixel
works OK
but
from digitalio import *
from board import *
import neopixel
import time
causes it to crash into bootloader mode
I'll see what I can do in the way of progress on this.
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...
@nickzoic Thanks for picking this back up, I'm excited to see progress on ethernet again (as I'd love to write a EthernetManager for CircuitPython's requests module). Please tag me in the pull request so I can test it on my hardware.
@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.
@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
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
right, you can verify by doing
>>> import sys
>>> sys.path
Yah which I did do. Ok, good to know that was right.
@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)
@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.
@gilded cradle do you have a comment on the MADCTL register, above? ^^
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
@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
and I think @micropython.native is only enabled in select builds; in other builds it is accepted but has no effect
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...
here's an example of directly embedding ARM (THUMB) instructions: https://gist.github.com/jepler/6cafc1b1337642cd8ddf2608302ae00d that I mentioned earlier this week
mpy-cross refuses to process the file fwiw
SyntaxError: invalid micropython decorator
That's quite possible
@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.
@smurfix I think I'm missing something. How does Trio create a continuation?
@tulip sleet, @onyx hinge my understanding is @slender iron wanted it done in software to avoid a tearing effect.
@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
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...
@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
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>?
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
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
ah
https://circuitpython.readthedocs.io/en/latest/README.html#differences-from-micropython <-- should we update this to include the latest supported ports?
@stuck elbow yes please
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?
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
@slender iron I wonder if the first point should be removed, since MicroPython also now supports SAMD boards
@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?
#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__)))
ah
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
you are giving it the address of the handle
does that bork with the optimizer?
no, the optimizer has nothing to do with it
in the pwmout you want to store TIM_HandleTypeDef *handle;
error: invalid type argument of '->' (have 'TIM_HandleTypeDef' {aka 'struct <anonymous>'})
hrm
maybe not
what do you get when you p/x *self?
are the values in the handle ok?
One thing for clarity. Good otherwise.
- Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.
There are Cortex A series that also start with i.MX.
@ionic elk check your git diff for any accidental changes
@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>}
please share it with me
I don't expect it to change. I want to make sure the values are correct
{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.
@slender iron tinylora might..lemmie check
@manitou48 would you mind posting your scripts you used in testing here?
let it be known that here lies the cursed change.
@slender iron nope - it doesnt, ladyada would know.
@timber mango I don't think we have an arduino library either
ok, thanks anyways!
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.
I'm not worried about the wording. It would be great to write up a full explanation of what the bug was and how this caused it. That way other folks can follow along and learn too.
@stuck elbow which is the first point you thought of removing?
The Flash file system is also still showing up as only 1Mbyte - is this expected?
@tulip sleet the one about CircuitPython supporting SAMD
as a difference from MicroPython
it's merged now
i think your new sentence is good: Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.
that is the second point, which I left there, just added the extra ports
I replaced the one about SAMD with USB
right, the new phrasing is good; the list of ports we support is still different (even if overlapping)
I have to admit that I'm still in shock about how fast the stm32 and imx ports are improving
the factoring-out of common code is pretty good, so one can really concentrate on the differences without tons of duplciated code
@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...
No major concerns from me. I like how the get_buffer calls are simplified.
I would rather not see as many void* and use mp_obj_t (which I think is a typedef for void*) because it implies that type info is in the first word.
I did these gymnastics on SAMD51 to try an minimize memory bus and DMA traffic by doing the one 32bit write instead of two 16bit ones.
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...
Thanks! I look forward to a PR fixing it.
We might want to discuss this further on Gitter or Discourse or somewhere else that's more suitable than a CircuitPython issue, before somebody actually starts coding.
We are on CircuitPython's Discord all the time, and there are weekly meetings there for discussing more fleshed out ideas in a bigger group as well.
@jerryneedell Thanks! I'll try and check out that crash soon. I'm glad it is working better.
The 1MB filesystem is correct. We use the first 1MB of external flash for the bootloader and CircuitPython. The Teensy has a 2MB flash which leaves 1MB for the filesystem. @arturo182's feathers have 8MB so the filesystem will be 7MB.
@ 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...
@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...
hi are you the same person who posted in the forum? if so paste the link here
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...
pystuff.zip
I've attached a zip with the circuitpython test scripts. The scripts ran with with previous release of Teensy4 circuitpython and they run with python3. here are some performance numbers
` sinperf fact llutm toggle raytrace(32x32)
pyboard 13679 2129 1593 13.9 us 5.384 s micropython v1.5
STM32F405 13114 1885 1984 5.123 s micropython v1.11
STM32F405 ...
@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...
Hello everyone! ... I have a problem with my new Hallowing M4: I would like a simple tone to be played at the touch of a touchpad. I tried to use the code contained here (https://learn.adafruit.com/circuitpython-essentials/circuitpython-audio-out#play-a-tone-7-3) but without success ... no sound is heard from the speacker that I connected. Could you kindly help me?
@nocturne coral Hi - could you post this question in the #help-with-circuitpython channel? This channel is for circuitpython discussion
Sure @prime flower , I'm sorry ... I did not realize! 😅
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
@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...
Greetings, Programs.
@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
@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
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!
@timber mango Thanks!
I never have understood kwargs, so am going to have to read up on that.
@slender iron What is the DCache? The data sheet mentions a "32 KB L1 Data Cache" - is that what's being referred to?
yup!
@tannewt I don't think I'll have time to look at the uf2 issue until Saturday or Sunday, sorry. You could maybe try tinyuf2, the tinyusb branch was just a proof of concept, but it was working on my Feathers (and still is, haven't flashed it since the original flash).
@bmeisels AramCon board is in beta.4, but it's showing up as "Unknown Board" in circuitpython.org. Could you submit a PR to https://github.com/adafruit/circuitpython-org/ to add it to the board list, so it will be labeled on circuitpython.org/downloads ? See the README.md there for details. It's easy: just a short text description and a photo in a few different sizes.
@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?
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
@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.
@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)
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....
How can i learn circuit python
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?
@shrewd moss Start here: https://learn.adafruit.com/welcome-to-circuitpython
Thanks @timvgso and @sai-ydev for taking this up - I've raised this issue a long while ago!.. I'm not much of a programmer, but if you need someone to test, I'm ready to help.
Mac Ha
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.
@dhalbert Sorry for the delay. I have been very busy.
I will open the PR over the weekend.
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.
- 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
- 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
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?
So, the bootloader was erased and I could it reinstal with this
https://learn.adafruit.com/circuitpython-on-the-nrf52/nrf52840-bootloader
Now I see the NRF52BOOT drive. 😉
@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```
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?
It looks like I can implement this the way it's done in AMTEL-SAMD or use the TIM_ENCODER functionality provided by the STM32. I saw this is in the comments for SAMD51 to be implemented later on.
Can I have some guidance on which way the good people at adafruit would like this to be implemented?
oh sorry, i mean the .uf2 file: adafruit-circuitpython-feather_nrf52840_express-de_DE-4.1.2.uf2
ok this board sounds heckin awesome!!!! https://www.crowdsupply.com/keith-packard/snekboard
@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?
use the build for that https://circuitpython.org/board/pca10059/
@solar whale yes, i did copy the psa10059 build on the drive. The drive vanished and nothing happend anymore, no drive at all. 😯
hmm -- just tried beta4 on mine and it comes up. What is your host computer?
Windows 10
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...
no usb device and no COM port
if you doubletap the reset button does it go back to the bootloader?
id did doubletap the reset button, nothing happened
try a few times it can be hard to do on those boards!
not the big button - the one that is "lying down"
yes i know, but nothing happened, no led, no drive
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?
ok, what happened when i plug in the module the green led flashes two times and then nothing more
that is typical -- then I see the CIRCUITPY drive
ok -- I just reflashed sd,bootlaoder and beta4 and it is working ok
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
I tried 4.1.2 and it also works but I think for BLE 5.0beta4 will be better
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?
yes -- and the NRF52BOOT --- leave it -- it will be replaced. THe file is always called CURRENT.UF2
just copy the new .uf2 to NRF52BOOT
Great, now i see the CIRCUITPY drive, thank you
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
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 😉
Thanks for the quick feedback. This won't resurface as a priority for awhile, so consider the ball firmly in my court.
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
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
sorry -- what is SES?
ah Segger Embedded Studio -- sorry -- no idea...
I'm strictly a command-line person 😉
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
@raven canopy I just noticed that the pylint examples directive was not updated on this (https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes) repository. I'd assume that's because it is a fork. I updated it manually, but I thought you should know that in case we use a similar workflow for other stuff.
@timber mango Good luck with it -- There may well be folks here later with SES experience.
@solar whale thanks so far, that has brought me very far today.
Glad I could help.
@onyx hinge I did a project with micropython also. The community and support really are lacking, and here I am.
@timber mango we're happy to have you!
@onyx hinge It looks like you are stuck with me! 😀
@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.
Great sleuthing. If you get to the point of a PR please tag me!
I am still having problems between Arduino and Circuitpython. I have rebooted several times.
@timber mango Which device are you using? and what kind of trouble you having?
Feather M0 Express - trying to use with Arduino.
@lone axle I get that when ever I try to program the board with Arduino.
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?
@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.
Ah
I ejected and unplugged the M4.
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.
I am running Raspbian on a Raspberry Pi 4. I can see the port fine.
Is Arduino IDE still set to the proper port though? perhaps it switched over when the M4 was plugged in
According to the Arduino IDE, the M0 has the port.
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
I already tried that without success.
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?
I also rebooted my Pi 4.
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.
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.
Did you program the M4 device with Arduino IDE while it was conencted? Or just have it connected for different purpose?
@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.
I have successfully programmed both devices when both were connected. I do not know what went wrong.
@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?
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.
seems like no, oh well
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?
My bad. I will create a new PR soon.
ok i tried to fix with github - might be ok now!
@ionic elk there shouldn't be. the only difference is where the structs are allocated
@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?
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...
@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
Thanks! I'd missed that line
np. careful. it's actually two lines 🙂
@tidal kiln just asked you to review: https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf/pull/10
I'm working on making the same API changes to _pixelbuf
If you are comfortable with the STM32 TIM_ENCODER then I think that would be preferable. I notice that the Atmel implementation has a todo for implementing it in the native hardware - might as well skip that step if we can.
@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?
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 ...
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...
like you mean circuitpy FAT handler would look for the path and delete any FAT entries?
@ladyada, yeah, that's really kind of bad, and it would confuse the host computer, which would have a different idea of what the filesystem looks like. I take it back.
what if we have a trashes folder but its like, non-writable?
what if we have a trashes folder but its like, non-writable?
I'll try that.
@ionic elk sorry I’m booked up today. I can help tomorrow though
It turns out there are no per-entry file or directory permissions on ordinary FAT filesystems, so there's no way to make just that folder be read-only.
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.
Such are the perils of wizardry
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.
This was caused by a dangling pointer error related to PWMOut. It will be resolved with the Meowbit patch.
We have backed out a change to neopixel that we think should fix this problem. Could you try this release: https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/releases/latest (5.0.0)? It is not in the bundle yet. Thanks!
@bitShakeMX Feel free to reopen this if you need further help.
Either method is completely new to me so I'll try and do it the right way!
No worries, will do. Because the W5500 library doesn't really have timeouts per se it'll need to be implemented as polling in our code, which is kind of awful.
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.cfor such common code. - Allocate space on the stack for up to 24 NeoPixels in nrf
neopixel_write/__init__.cto 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...
While it does fix the problem of circuitpython crashing it does not fix my overall problem of my lightsaber not functioning as it should, though that problem doesn't have anything to do with the crashing so I don't expect any replies on that here.
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 
@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.
@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
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.
Thanks, I will close this and hope you can solve the other problems in the forum thread.
@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
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
I understand a display library exists, but why isn't in the default CP build?
you mean frozen in?
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
it's a python library, we'd only consider freezing it in if serpente had it as an onboard display
did you mpy-cross it?
I didn't try to build the Adafruit OLED library
all I was asking is why it's not in there
there are many different python based drivers for various displays, we can't fit them all in flash
ok
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
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.
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
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)
but we only have 256kB of flash, so we're limited as to what we can freeze. There are many displays you might want to use with a board, so we can't freeze them all in https://github.com/adafruit?utf8=✓&q=displayio&type=&language=
like, .more than a dozen
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
these libraries are only one page long, it's just the init sequence for the display plus the constructor, e.g. https://github.com/adafruit/Adafruit_CircuitPython_DisplayIO_SSD1306/blob/master/adafruit_displayio_ssd1306.py
i'm not sure why you're running out of ram
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
which library exactly?
which oled library exactly
Adafruit_ssd1306.py
i2c_device.py
spi_device.py
Adafruit_framebuf.py
all had to be loaded in RAM
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
ok
i mean, you can use what you want, but they're different
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
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
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
What I plan to do, I just want raw I2C writes from C
existing display infrastructure doesn't help me
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
I know, I plan on building my own firmware image
do you want to hop into audio, as I think we're talking past each other a bit
not really, I'm done. Thank you.
ok, np, good luck!
🙂
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
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?
you were saying you were running out of RAM using the python modules
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
OK 🙂 I would disagree with the "pointless", but that's your take
limited use
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
I get that. This is the same reason I did a lot of libraries which support the ATtiny85. The constraints make it fun/challenging
i look forward to seeing what you come up. 🙂
thx
you can see it already 🙂 Just check out the videos I've done of my ss_oled library
Pimoroni I2C SH1107 display driven by an ATmega328 (slowed down to a reasonable frame rate)
This 11 frame animation fits in 1906 bytes when compressed with my inter+intra compression scheme. Code will be release soon :)
etc
Neat!
@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.)
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.
@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.
Yep, I'm gonna try playing around with Mixer this weekend a bit to see what I can do with it.
@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.
@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.
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.
Thanks for the reply! I will test with logic analyzer
Has the mu editor development halted?
@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.
@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 🙂
@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.
@obsidian compass well, I was hoping to try to cut a release today, but other work got in the way. I hope to get to it on Sunday. There is a fix for the OSX issues. You can try out the latest build (with fix) by downloading the unsigned app from here: http://mu-builds.s3-website.eu-west-2.amazonaws.com/?prefix=osx/
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.
@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.
@plucky flint awesome, thank you!
We should see a release on Sunday or (latest) Monday morning (UK time). In case you're interested, this is what I'll be doing: https://mu.readthedocs.io/en/latest/release.html
@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
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
Could you adjust the images for the one and lite images so they are 13:10 aspect ratio. The 2e looks good. sizes I like to use (same as you used for the 2e):
Large: 780x600
Small: 293x225
Thanks
Thanks for submitting this. Since this website is in English, most users will be English speakers only. Could we move the Russian link to the bottom? Thanks
Thanks for submitting this. Since this website is in English, most users will be English speakers only. Could we move the Russian link to the bottom? Thanks
Thanks for submitting this. Since this website is in English, most users will be English speakers only. Could we move the Russian link to the bottom? Thanks
Sounds like this would be similar to the Blinka pages. Good idea.
great! ready for review? I can add it to my list
Yep pushing now
well actually, probably needs a final test of all of this plus bootloader
so gimme a sec to do that
np, still getting through email
@CudaCoreRoo Noe and I got back to you on the forum so we should be able to get you sorted out there.
has fewer open tabs than he has had in a while
going through email = opening tabs to do
are there any existing boards for CPy that use the ST7735R?
Or do I need to convert the python bytearray to a C array
I think the hallowing m0 does
7735 is in the hallowing, the pyboard and the pybadge
And that ai version of pybadge, how was it called
edge badge
hallowing m0 has the defs, thank you!
how does it not work?
never starts circuitpython. You drag the UF2 over and nothing happens
how far does it get?
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.
@makermelissa As in these? https://circuitpython.org/blinka. I can create a PR.
This PR is now ready for testing! See updated description for bugfix details.
UF2:
firmware.uf2.zip
Screen test python:
https://gist.github.com/hierophect/1a9f14d3681d73dd7e003b8f41f6666e
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.
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.
Does it leak further 16 bytes with every function call, or does it only happen one per with?
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
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...
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
@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.
=== pass
=== print(abc)
<io.TextIOWrapper 20003080>
``` that will leave the variable itself existing and referring to (in my case) the closed file object
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?
@onyx hinge Right. I did put the with in a function. I just put the calling of the function up at the top level.
got it, then my explanation doesn't fit the facts
Somehow we are getting different results.
@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
@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
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).
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
can we build software for Windows and Mac with github actions?
@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?
@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
yes, mpy-cross can help with memory usage and startup time
@onyx hinge I don't know about Windows and Mac, but probably yes
On the non-express boards, the memory is the consistent issue for me
Is there no pure python mpy-cross?
This would be very helpful for our projects that use non-express boards
also, here are the available environments on Actions:
Windows Server 2019
Ubuntu 18.04
Ubuntu 16.04
macOS Catalina 10.15
GitHub Actions can run jobs in Linux, Windows, or MacOS. It says ARM too, so maybe we could build an RPi version (?).
ARM? where are you seeing that one @tulip sleet
@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".
ahh. for self-hosted probably, since there is an ARM version of Docker
Arg. I need to learn how to type that in.
i have to go cook, sorry, will stop by later
Thanks for thinking about this - it's not critical for me (I have the source!) but would be helpful long term
yep. self-hosted has a lot more VMs available:
https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-runners#supported-operating-systems-for-self-hosted-runners
obviously...
To clarify the environments available in GitHub Actions:
Windows Server 2019
Ubuntu 18.04
Ubuntu 16.04
macOS Catalina 10.15
- [Supported operating systems for self-hosted runners](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-sel...
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
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)
on windows, its a painful road, thats for sure.
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
I don't think I formatted that right. Ah. Now I have!
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...
eek
although...maybe mpy-cross won't need it? 🤔
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. 🌆
Oh, and the result from my "with" test:
158192 158176 158176 -16
158144 158144 158144 0
lol. @onyx hinge i too get into routines with my emojis. 🌵
saguaro is a nice woody word
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.
@onyx hinge @tulip sleet Maybe there is something wrong with my trivial class that makes the difference.
looks too simple to have bugs
I am building mpy-cross on windows with msys, if I remember right.
Ah. A simple bug. The worse kind.
@onyx hinge not tinny at all.
Looks like there's an area of the makefile where the process imports libraries for linking. Would it be possible to link libraries by appending them to this list?
LIBS := -lgcc -lc
ifndef INTERNAL_LIBM
LIBS += -lm
endif```
@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
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
ah, ok, great, an example is the best medicine
since the key HRM characteristic is notify only, there's no way to get its value except via CharacteristicBuffer or PacketBuffer
@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.
@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
@tulip sleet ya, that's kind of what I was thinking. will the SD store the last value for us?
i'm not sure, i'll read about it and try some things, thanks
's fine, division of labor on the ble stuff is good
@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
@bright aspen I recommend this stream if you are interested in memory debugging: https://www.youtube.com/watch?v=baa5ILZTRkQ
Live stream of @tannewt debugging memory issues in CircuitPython.
Visit the Adafruit shop online - http://www.adafruit.com
LIVE CHAT IS HERE! http://adafru.it/discord
Adafruit on Instagram: https://www.instagram.com/adafruit
Subsc...
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.
more important things to remember 🙂
@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).
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?
@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.
Thanks. Ha! I was just about to say almost exactly the same. I will do that.
@sommersoft and @dhalbert please take another look at this.
Also changes MicroPython so that native methods get a subclass instance instead of the native object directly. This may break things.
Did I just dream that there exists a neopixel with all white pixels? "WWWW"?
etc.
Still looks good :)
"mix down" [to one track] is what audio folks say, but it's kind of jargon, and I agree it could be confusing.
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. 🎉
"mix down" [to one track] is what audio folks say
Yep, that's why the term popped into my head on that comment. The old garage band days with a 4-track DAT recorder, and needing to record more than 4 tracks. 😄
Just ran this on a Metro M4 (from the artifact downloads; nice new page there). Everything checks out with my old test scripts from before.
@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.
Of course, I'll fix it but I think the pushed images size for the large and small format are exactly those 😔 but I'll double check then.
I'll also check the aspect ratio is correct as in the 2e.
Thanks for doing the review.
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.
@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
@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.
I was wondering if there’s any plan to introduce circuitpython in Google Summer of code?
@rasponicc , I know you have been wanting to contribute to CircuitPython, would you like to take this one up as a good first issue? I’m certain maintainers will help you out when needed.
cc @makermelissa , @ladyada , @dhalbert
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 ```
@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.
I'll do that right away, thank you @raven canopy
thank you for spotting it!
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?
Which version of CircuitPython does Blinka correspond to.
@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?
will definitely help, this is an excellent beginner issue :)
More specifically, which version of CircuitPython Bundle should I use with Blinka
you don't, those bundle are only for CP microcontrollers.
Blinka is most of the same libraries distributed through the normal Python mechanism
Ok. So do I need anything more than Blinka and the driver pointed to by the device’s product page?
I.e., from PyPi
yup
Ok, thanks. That should get me farther. Thanks.
^^ 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
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
The 5 neopixels under the display on the pybadge?
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!
@lone axle yes
@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.
@lone axle it has to do with esp32 feather wing and neopixel together.
I see.
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...
Umm it looks like I included something in this pull I shouldn't have. stay tuned.
@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-crossreally only tracks major version increases, I wouldn't have it compiled with every PR/push. I would place these Actions tasks either into thecreate_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...
@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...
Anybody around with macos? I am curious if the artifact from https://github.com/jepler/circuitpython/suites/420288500/artifacts/1342486 works
but I have no mac so I can't try it
(not actually static despite the filename)
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.
@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?
Agreed. It just seems like lot of effort and confusion for the possible need. Just an observation....
you could bring it to in-the-weeds on Monday, maybe somebody would know something
@raven canopy a number of the builds failed to upload, but it seems to have been an infrastructure problem;there were network failures
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?)
@sommersoft absolutely I'm open to re-working this into the form that is most useful. This is a proof of concept that we can build the binaries we want within github actions, and the rules can be copied (or cut) and pasted to a more appropriate place for sure!
@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."
@tidal kiln but has there actually ever been a need? Have they ever been different?
Between 2 and 3 IIRC
and the libraries were being released with the mpy-cross version, which just happened to be close to the CP version
It just seems like it’s been a lot of extra effort and confusion. Just my opinion.
the amount of confusion the other way was off the charts
i can't remember the exact details. scott/dan would.
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.
mpy-cross would probably change again if we took major improvements from micropyton
is there a linkable example to the above? (library issues)
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.
I think I build MacOS mpy-cross statically just by adding --static, though that may have been under msys on Windows.
Yes, will love to! Thanks!
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
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))
@makermelissa can you assign this issue to her? (@rasponicc)
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.