#circuitpython-dev
1 messages ยท Page 250 of 1
yes, it's not intuitive to a beginner
but hopefully easy to explain, and thus the guide update
and can always update and improve as we go
I have a possible bug. Does anyone have a Feather M0 running Adafruit CircuitPython 4.0.1 on 2019-05-22 they could check something for me?
it seems to be an error with importing adafruit_ssd1306
If so try the following code: ```import board
import busio
import digitalio
import adafruit_ssd1306 # bad if done here
btns = list()
for inp in [board.A3, board.A4, board.A5]:
da_btn = digitalio.DigitalInOut(inp)
da_btn.switch_to_input(digitalio.Pull.UP)
btns.append(da_btn)
import adafruit_ssd1306 # fine if done here
i2c = busio.I2C(board.SCL, board.SDA)
oled = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
oled.fill(0)
oled.text('Hello', 5, 0, 1)
oled.text('World', 5, 10, 1)
oled.show()
old = [x.value for x in btns]
while True:
for i in range(len(btns)):
v = btns[i].value
if v != old[i]:
print('%d %s becomes %s' % (i, old[i], btns[i].value))
oled.pixel(1, i*10, not v)
oled.show()
old[i] = v```
Line 4 vs line 12 being commented seems to toggle an error. line 4 will result in :main.py output: Traceback (most recent call last): File "main.py", line 4, in <module> File "adafruit_ssd1306.py", line 38, in <module> File "adafruit_framebuf.py", line 342, in <module> MemoryError: memory allocation failed, allocating 136 bytes
Seems odd since my perusal of adafruit_freambuf.py does not seem to have 342 lines.
Though I am using the .mpy version downloaded tonight.
If someone can reproduce, I will file a bug
Adafruit CircuitPython 4.0.1 on 2019-05-22; Adafruit Metro M0 Express with samd21g18
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 4, in <module>
File "adafruit_ssd1306.py", line 38, in <module>
File "adafruit_framebuf.py", line 342, in <module>
MemoryError: memory allocation failed, allocating 136 bytes
might not be a bug, but just the limited space on the M0
ok, it's legit.
if it's a bug, it'd happen on M4 as well
try with the line 4 commented out and line 12 uncommented
I ran it with 'import gc' and had about 2K space free when using line 12 instead of line 4
Never got past line 4 to print the gc output otherwise.
yah, i get past it if i comment/uncomment
Adafruit CircuitPython 4.0.1 on 2019-05-22; Adafruit Metro M0 Express with samd21g18
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 14, in <module>
RuntimeError: SDA or SCL needs a pull up
don't have anything wired up, so hit the I2C pull up issue
if i insert this: ```import gc
print(gc.mem_free()) # this fixes it
could do a gc.collect() also
There seems to be an issue with adafruit_framebuf.py (perhaps in conjunction with adafruit_ssd1306.py) in some circumstances.
This is observed when running
Adafruit CircuitPython 4.0.1 on 2019-05-22; Adafruit Feather M0 Express with samd21g18
and using libraries from the 4.0 bundle downloaded today the following behavior is observed:
In the code below line 4 and 12 are identical. Which one is uncommented determines which behavior is seen.
import board
import busio
...
This is going to be a tough one to track, as all my attempts to instrument the code to find out what is happening cause the problem to move / evaporate.
I don't think this is a bug per se, but is due to memory fragmentation and when garbage collection is triggered. We see this kind of thing due to the limited RAM available on M0 boards. As mentioned in discord, you can intersperse gc.collect() calls between imports and that may help.
Hi folks - right now, what's the recommended solution for a simple CircuitPython board with WiFi support? Feather M4 + Airlift Wing? Metro M4 Airlift? Is there a board (like the M0+WiFi) that has wifi built in in a Feather Form factor? I don't think the ESP32 runs CP right?
If you have enough experience with the memory management system to assert this, then I bow to your expertise.
Question: Give that adafruit_framebuf.py has 148 lines, how is the following happening:
... File "adafruit_framebuf.py", line 342, in ...
The things that make me scratch my head include:
- Calling gc.mem_free() shows at least 2K free once code starts executing. (ok so free might not be contiguous)
- Calling gc.collect() doesn't change anything. Grated, for some me...
I agree that it's more problematic than I'd normally expect. I'll try to reproduce this with a debugger running and see exactly where it's failing internally in terms of memory.
https://github.com/adafruit/Adafruit_CircuitPython_framebuf/blob/master/adafruit_framebuf.py is 409 lines. Where did you see only 148?
OK, my total mistake there. I landed on https://github.com/adafruit/micropython-adafruit-framebuf/blob/master/framebuf.py which of course is not the right repository. I need to read what google gives me more carefully.
I edited my earlier comment with the second example code to make it easier to understand what code was just run in the output that shows memory usage.
@tough flax I think you hit the two main strategies that are currently available and fully supported by Adafruit. You can substitute an ItsyBitsy M4 (or any Adafruit M4 board) for the Feather M4. And you can substitute an Airlift Breakout or an ESP32 Breakout or even an ESP32 Feather (no stacking onto a Feather M4 though). There are some supported 3rd-party M4 boards out there: https://circuitpython.org/downloads There's no CP to run directly on an ESP32, just the NINA firmware that acts as a co-processor.
CircuitPython Organization
There is a 3rd-party single-board M4+ESP32 out there,https://circuitpython.org/board/sam32/ (I have no experience with this one) I can't find it for sale, but it's open source hardware afaict.
An open source โswiss army knifeโ for hardware and IoT applications. This board is designed for quickly prototyping a wide range of makerspace, university, a...
@tough flax In general - something that uses ESP32 as a SPI peripheral. Starting with 4.x, there won't be CP builds for ESP.
ESP8266 is no longer supported. With 4.x we've chosen to focus on microcontrollers with built-in USB to ensure a consistent CircuitPython experience across all boards we support.
@idle owl @slender iron do either of you know how easy or not it is to use cookiecutter for non-python projects? I have arduino in mind
I imagine it'd be easy. it just generates files
I was mainly wondering if the templating works well for non-python stuff, so I could sub-in class names, etc
Hello gang
I was going over Dave's guild on his trinket m0 hack
Is there a list of flash IC's that will work with this mod
Does any one k ow if the AT25SF041 4mb serial flash 8-soic will work the same way
@modest atlas here's a list -- that's also where you add a new one, when needed: https://github.com/adafruit/circuitpython/blob/master/supervisor/shared/external_flash/devices.h
Ok, my brain is fried but here is displayio with partial updates: https://github.com/adafruit/circuitpython/compare/master...tannewt:dirty_area?expand=1
it almost works perfectly except with the quotes demo which leaves some pixels unchanged
I've got what may be a weird question... is there a way to write error messages to SD card? My PyPortal sometimes hangs but with the display frozen not on the REPL. TIA! -z
@tired cloak Do you mean having the errors that normally appear on the REPL get written to the SD card? If so, I don't think that's possible at the moment though redirecting stderr would be a nice feature.
You can write to files on the SD card though you'd have to do it manually:
https://learn.adafruit.com/micropython-hardware-sd-cards?view=all
Yes, the REPL errors. For some reason, after running it connected to a PC for multiple days it didn't hang, but moving it just out of reach (by like 10 feet) and it hangs, but I can't see why.
I may look into adding serial/sd output to try to identify where it is hanging, but I suspect it is a weird internet connectivity issue. (Also running one of the AdaBox 011 examples, so I doubt it is the code.)
Hi,
I'm interested in audio applications using the nRF52840, as far as i know there is no support (yet) for the I2S peripheral on this device.
I did a very basic research and i think i know the big picture on how to add support for this and i would like to know if I am on the right track or if there is work already done in this regard, so i won't duplicate it.
So the nRF hal is based on nrfx which already have support for the I2S peripheral. I should implement I2SOut.h and `I2SOut....
This updates the Orange Pi image to the latest one taken at Adafruit and removes an old image that was an artifact of the image optimizations.
@C47D #1035 already has this as a goal.
I did a very basic research and i think i know the big picture on how to add support for this and i would like to know if I am on the right track or if there is work already done in this regard, so i won't duplicate it.
I don't know of anyone working on it at the moment. I have PDMIn started, but its kind of stalled as of late. I will throw this out though: AudioOut also isn't done yet on the nRF52, which has proved a bit of a barrier to ver...
Add pygamer's pin to support SD card
Ref: forums post
Code used to test:
import sys
import os
import adafruit_sdcard
import board
import busio
import digitalio
import storage
# Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs,...
I have ported the Trio core to MicroPython. No interrupt support yet, because lack of time, but adding that shouldn't be too difficult.
Interrupt handling would most likely look like this:
import trio
async def main():
p = Pin(โฆ)
async for evt in p.interrupt():
print("Hey, pin changed:", evt)
trio.run(main)
Hi,
Here's the ongoing work for the support of I2S on nRF targets, i do have a Feather nRF52840 express, so i'm planning to test with it (i haven't looked if i have i2s pins available on the breakout pins).
I am still new to CP codebase so if you see anything wrong don't hesitate on letting me know, that is why i rather have this PR publically available and not in a local machine.
Regards,
- Carlos
<@&356864093652516868> Here is the notes doc for Monday's CircuitPython Weekly 11amPT/2pmET. Everyone is welcome! Please add your hug reports and status updates, even if you'll be attending the meeting - it's super helpful! If you're going to miss the meeting, feel free to add your notes as well and I'll read them off as we get to them. Thanks! https://docs.google.com/document/d/1E9pEBg_u_hkA36JRgLDmqVWBWV5UJeNeyQ0wacl1R8E/edit?usp=sharing
CircuitPython Weekly for June 10th, 2019 Video is available here on YouTube. Join here for the chat all week: https://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel on Discord for notices of change in time ...
Thanks @sommersoft, #1932 is the WIP for this.
Demoing Circuitpython on the PyBadge at Maritime DevCon.
Hi,
I did a simple loop test in python to compare to my STM32F4 based MicroPython board and the results are quite unexpected. CircuitPython is 16x than MicroPython slower for equivalent CPU frequency.
Details available here:
https://forums.adafruit.com/viewtopic.php?f=60&t=152372&p=753830#p753830
Test code:
def test():
s = time.monotonic
count = 0
r = range(0, 10000000)
startTime = s()
for count in r:
pass
endTime = s()
du...
I expected NOT to get an import error for ustruct? : >>> import ustruct Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: no module named 'ustruct' Adafruit CircuitPython 4.0.1 on 2019-05-22; Adafruit ItsyBitsy M0 Express with samd21g18
@bronze geyser we changed ustruct to just struct.
@raven canopy ah - thank you. There seems to be learning docs and docs in general that have ustruct.
yeah, guides may be outdated. if you come across one, please submit feedback on the guide. the libraries have all been updated to at least try both ways, for backwards compatibility.
well, this one works https://learn.adafruit.com/pm25-air-quality-sensor/circuitpython-code ... however, it implies there is a ustruct...this confused me (but i am extremely easily confused)
yeah, there's the fallback for ustruct:
try:
import struct
except ImportError:
import ustruct as struct
it first tries struct, and if that fails it assumes 3.x and then attempts to import ustruct
Hi,
Thanks for your patience, I did a quick debug session for this and noticed a couple of things:
-
The
common_hal_pulseio_pwmout_set_duty_cyclebreakpoint is hit and then i continue but the LED takes a little while to lit or sometimes i doesn't lit at all, at the end of the attached log there's an exampleself=0x20001ca8 <rgb_status_r>, duty=12336)but the red LED remains off.
Is this somewhat expected? -
When the
common_hal_pulseio_pwmout_set_duty_cyclebreakpoint is hit...
I just had a pull request build fail. It says the build failed, but it isn't clear to me what about the build failed.
Can someone point me to the clue?
OK, it looks like a missing docstring. Fixed that.
Will the CI run again or is the pull request dead now?
it will run again when you push the commits
Should a FeatherM4 get hot when driving a Feather Oled? Something between the battery connector, NeoPixel and M4 is getting really hot (as in too hot to touch). If I disconnect the oled, it doesn't happen. I don't know enough about the
board layout to understand what it might be.
No, it shouldn't get hot.
@obsidian dome Could you start a forum thread about this, with a photo of the boards showing your soldering? Describe how you're connecting the board. That will help our hardware support people help you.
Will do.
Has anyone gotten the ssd1306 to scroll? Reading https://cdn-shop.adafruit.com/datasheets/SSD1306.pdf i see it can do it. I have been able to make it happen a couple times, but not reliably. Given that I2C can get painfully slow, I was hoping to off-load some of the display animation to the ssd1306 itself.
Hum... it looks like the commits I pushed after my pull request are taken into account ? Is it normal ?
How do I make this for an rgbw neopixel?
@shazz Your PR is merging against a branch (master), not a particular commit. Is that what you mean?
Yes... I did not know... I thought it was for a commit.
So I guess I need to rollback then create a branch for my tests with Scott :)
<@&356864093652516868> Here's the notes doc for today's CircuitPython Weekly. Everyone is welcome! Please add your hug reports and status updates to the doc even if you'll be attending. If you're not attending, you can still add your updates and I will read them off as I get to them. Meeting is today at 11amPT/2pmET. Talk to you soon! https://docs.google.com/document/d/1E9pEBg_u_hkA36JRgLDmqVWBWV5UJeNeyQ0wacl1R8E/edit?usp=sharing
CircuitPython Weekly for June 10th, 2019 Video is available here on YouTube. Join here for the chat all week: https://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel on Discord for notices of change in time ...
@gilded cradle The name badge running on the PyBadge was great at the conference. I was constantly getting asked about it.
No, they didn't record them. It's a small (700 attendees) regional conference with a tight budget. They're looking into recording for the future. It's too bad, there were some really good talks. Many were hyper-regional, but there were plenty of general ones.
Aww, well I'm glad it was such a big hit.
I see that the adafruit_ssd1306 is using the (older) framebuffer instead of (newer) displayio. Is anyone looking at switching it over?
Yeah, we were waiting until CircuitPython 4.0 stable was released and now that it has been, we can start looking at adding monochrome and eInk displays soon.
Good afternoon folks -- finally able to make the call live, and I'll be lurking due to background noise 
๐
I'm mostly lurking in the live chat because I'm at work (on my lunch break, but still...) Nit O
But I made it!
<@&356864093652516868> Meeting starts in a couple of minutes!
lurking ๐ต
lurking
"We're going to drive this back-end loader through the property. I'd be a shame if that house got in the way."
Lurking today
crunched the flora and fauna completely
lurking (distracted by rl ๐ฆ )
Thanks ๐
@minor plume If you want you can post any hug reports or updates here (@ me) and @idle owl can read them
@pastel panther Sounds good. I do have a hug report for the animated Pride jewelry I made with a Feather and a NeoPixel Featherwing. I've posted a writeup and the code at https://github.com/tammymakesthings/fw_neopixel_pride
CircuitPython Organization
I also want to get more involved with contributing to Circuit Python, but I found out this morning I need to get the okay from my employer's Legal team first. ๐ Hoping to get that this week.
@minor plume Did you want that included in the notes?
@minor plume thank for checking that first
@pastel panther The hug report can be. The other I'd rather not have in the notes.
OK!, no problemo
๐ฅ
so - is clock streching OK -- just an issue with MCP9600?
http://ww1.microchip.com/downloads/en/DeviceDoc/MCP9600-Data-Sheet-Errata-80000741C.pdf see the second column
(i bad ad tyuping)
"EVERYONE IS awersome!" ๐ (yes awersome)
i've been meaning to dig deeper into the stubs. scanned the PEP, but just barely.
welcome!
+1 for the quad featherwing kits. They're earmarked for my next order.
Updates: I'm designing a CircuitPython/Maxbotix LV-EZ4 sensor for my car to avoid running into the wall when I'm parking at home, because I have bad depth perception. I'm also getting my first 3D printer this week, which I'm very excited about.
@minor plume I would love to hear more about your sensor for parking!
me too!
@obsidian dome I'm planning to blog about it and also do a project writeup on github when it's done.
put me down as a third! ๐ 3โฃ
Blog is tammymakesthings.com, but I'm trying to move it to GitHub Pages/Jekyll before I update it.
Where do you blog? I've got a number of projects I would like to shar and I am looking for how to best do this.
Right now my blog is on Wordpress, but I'm trying to get Jekyll set up and migrate it this week/weekend.
(My Wordpress site also hasn't been updated in a year, which I'm trying to fix.)
:badger:
๐ ๐
"ohhh! its a snake!" 
Also lurking ๐
๐
statusssss update = <-- progresssss + distractions -----> ๐ฎ
ADD-A-
@raven canopy dem's some sweet logs
@minor plume mangled the notes that @idle owl read, sorry ๐ฆ
Nice! I'm getting my 3rd 3D printer this week.
@pastel panther No worries, thanks for trying. ๐
@gilded cradle What are you getting? I'm getting a Creality Ender 5. Seemed a reasonable place to start...
I'm getting a Prusa MK3S.
Nice!
multitasking...
Thanks
@gilded cradle What are your other printers?
A Creality Ender 3 and a Custom one based on the MendelMax that I built and upgraded multiple times.
Nice ๐ I have a Prusa Mk2S -- pretty solid. I want to get the multi-material upgrade eventually.....
Yeah, I was eyeballing that
I started with a Mini Delta, eyeing the Prลฏลกa i3 Mk3S as a next step.
@obsidian dome are you using a monochrome screen?
yeah, ssd1306 is monochrome
kk, we'll get to that in the weeds
In-the-weeds How to poll the interupt pins on the MCP23017?
k displayio only supports 16bit screens now
@inland tusk looks like int_flag and some associated functions are available: https://circuitpython.readthedocs.io/projects/mcp230xx/en/latest/api.html#adafruit_mcp230xx.mcp23017.MCP23017.int_flag
@raven canopy thanks Iwill look into that. But I need to for more than one chip.
you're very welcome, charles!
Thank you all ๐
has anyone done the solenoid drum kit in circuitpython?
Thank you, all! I'll try to not be text-only next time.
thanks!
Thanks everyone
Thanks Kattni!
thanks everyone!
I'm going to bounce, ya'll have a good one ๐
Have a great week -- off to the farmers market ๐
@minor plume Are you planning on putting the LV-EZ4 on the car or on the garage? If the car, then where is your readout? On the garage wall I could see creating a light that displays how close you are to ideal position.
if it was a function of the garagewall, would work for any vehicle parking there... ๐ฎ
You could get fancy with a light like https://www.adafruit.com/product/2993
@obsidian dome On the car. Sensor on the license plate frame to a display inside the car, is my current thought. But we'll see.
I don't have a garage where I live. My parking space is against the side of the house.
ah, silver lining... if function of vehicle, works for any parking location ๐
Yup.
if you use a 1 meter neopixel strip as your indicator, it could be a one-to-one display of distance to object ๐ฎ
My concern becomes dirt and debris smacking it while driving. That could take it out fast. Need an appropriate cover.
Version 1 I'll run a wire from the sensor to the display. Version 2 I'd like to use BLE, but will see.
And making a cover is part of the reason I bought a 3-D printer. That will be one of my first projects, I think.
rain?
You could use something like https://www.adafruit.com/product/2424 which would look right at home in a car.
It doesn't rain often here, but yeah, need to figure out how to waterproof the sensor.
I know a lot of cars have some sort of range sensor in the rear bumpers these days. I wonder what they use.
I wonder if there's a laser sensor I could use for V2? Those would be easier to waterproof, I'd think.
And you could turn up the voltage to "vaporize obstacle" ๐
Some are ultrasonic, some are radar.
did someone already mention on 4010? https://www.adafruit.com/product/4010
@tidal kiln can you think of any other debugging for this: https://forums.adafruit.com/viewtopic.php?f=60&t=152610 ?
I "always" have problems with permissions(?) with downloaded files... (I'm a proud tinfoilhat wearer, and usually have security jacked way higher than it needs to be, and suffer the side-effects) ... could the MacOS be "being helpful" in the background on the files created by the downloaded files? (which it seems ran OK)
just a conspiracy theory, I'm a PC user mostly, know just enuf to ask silly questions
@slender iron more of @tulip sleet question probably. the known things are generally here:
https://learn.adafruit.com/welcome-to-circuitpython/troubleshooting#circuitpy-drive-does-not-appear-20-12
but always seems like there are new and exciting edge cases
dan - see link above.
MacOS, they get PORTALBOOT but not CIRCUITPY folders
or circuitpy serial apparently
we have also seen CIRCUITPY fail to appear when certain MacOS RAID drivers are installed
if they've installed software for a third-party external drive it might interfere
also make sure they're running latest Mu
@tidal kiln ^^
@slender iron probably easiest is to suggest they try another, preferably non-mac, computer and see what happens
np. if it starts looking like what @tulip sleet is suggesting, then he's more knowledgeable about that stuff than i am
@slender iron also maybe link to here:
https://learn.adafruit.com/welcome-to-circuitpython/advanced-serial-console-on-mac-and-linux
as another way to try and get at serial console
yup, on it
@tulip sleet Regarding sorting which board and therefore what things to init etc, what about using if hasattr(board, 'ACCELEROMETER_INTERRUPT'):? It looks like both PyBadge (nonLC) and PyGamer both have it, and presumably PyBadgeLC would not.
Haven't loaded the LC firmware yet to test
@idle owl, that's one way, but os.uname() will give you the actual name of the board. If you're looking for functionality, testing pins is good. If you're looking for "is it this board", then I'd use uname
ok thanks
`os.uname[1] or [2] or something, not sure which
Ah ah :) A little messy for a 1-line commit :) but I'll do better next time !
Try commenting out the -flto line in the makefile and doing it again. (only samd51 may have the space for it though.)
I use this https://github.com/bnahill/PyCortexMDebug to inspect the TC registers and the PORT to check the mux settings.
This doesn't surprise me because performance hasn't been our focus. I'll probably take a glance for simple improvements in the next couple weeks but we'd totally take PRs that improve things.
I only got a SAMD21 device and if I comment out the -flto line the flash isn't enough :/.
I will check the repo, thanks for the link.
RosiePi is now running tests... input() was tricky; kept putting the REPL into autoindent mode, which manifested backspace ctrl characters. Now to write some deeper tests...
https://gist.github.com/sommersoft/cc34a28d89fc10f263a7a23c3574535d
I did some research on this. I looked at the stm32 port settings in MicroPython. In our ports, we use MICROPY_VM_HOOK_LOOP and MICROPY_VM_HOOK_RETURN to call run_background_tasks()` very frequently. This happens after every jump opcode and every return. We do this to service USB background tasks that need to use polling instead of interrupts.
If do not define the HOOK macros to call run_background_tasks() , your timingtest and a similar one done with explicit increment and test cod...
Thanks Dan! Interesting findings! "This happens after every jump opcode and every return" looks pretty scary :)
so everything happens here, ans especially usb_background(), right?
// aka MICROPY_VM_HOOK_LOOP and MICROPY_VM_HOOK_RETURN
void run_background_tasks(void) {
// Don't call ourselves recursively.
if (running_background_tasks) {
return;
}
assert_heap_ok();
running_background_tasks = true;
#if (defined(SAMD21) && defined(PIN_PA02)...
Further testing: I have turned on MICROPY_OPT_COMPUTED_GOTO which is a performance enhancement in the VM interpreter (adds about 1700 bytes ti firmware). This further speeds up the basic timing loop by a factor of 5. Together these seem to account for pretty much all the speed differences.
The basic test I am using (to avoid any issues about how range() is implemented:
import time
def test():
i = 100000
startTime = time.monotonic()
while i > 0:
i -= 1
...
@tulip sleet You said I could load the LC firmware on the non-LC PyBadge? Did I misunderstand that?
yes, exactly
have to build it by hand, hold on
... we don't have a board def yet, only a bootloader for LC
@tulip sleet Ah. That would explain it.
Took me a while to get back to this but just found my electronics and reassembled with CPX and worked out I had a duff breadboard track.
Just tested your version and it's far, far worse!
Interesting ! I'll try tonight on my pygamer to enable MICROPY_OPT_COMPUTED_GOTO and disable CIRCUITPY_DISPLAYIO. I'll post my results here.
@tulip sleet @idle owl Regarding the PyBadge LC, I think it uses the same firmware as the PyBadge. I noticed a resistor in the product photos for the neopixels that isn't present on the full PyBadge and I believe the purpose of that is to set the middle neopixel as neopixel 0.
@idle owl @gilded cradle MakeCode folks are using the board info in the bootloader to determine what's on the board. They store board-specific info (what kind of joystick, light sensors, etc.) in the Arcade bootloaders. We don't have ready access to that without adding some C code to CPy.
Ok, that makes sense about it being a different bootloader.
Hmm. Checking for button presses only works with a delay, otherwise it returns 0 more than half the time even if something is pressed
Yeah, I had to put in a delay as well. I think the way it was designed was to give you it's last state, but it doesn't seem to maintain that state and instead clears the state when reading.
Bleh ok. Hmm.
Maybe it might be worth filing as a bug?
Possibly
I think @stuck elbow wrote it. I just don't know if that was the intended behavior.
Turning this on gives about a 5x speedup (!) for CPU-bound code.
I expect the first submission of this PR to fail because it won't fit on some boards. I'll adjust with further commits.
At least we could find out if if was intentional.
Yeah
Had a message fail to send: If you want to file an issue, that would work.
Ok
One of the things that I found while working with GamePadShift is that reading it too fast will sometimes return 0 even if there are buttons pressed. I believe this is because it shifts the bits out when it is read and doesn't maintain state. I'm not sure if this was the intended behavior or just a result of a fast CPU reading faster than the shift register is reading the buttons. I think it would be useful to maintain the state after reading the buttons so subsequent reads don't show up as n...
yeah @deshipu mentioned this before i think? it would be nice if we had a queue of button presses!
@tulip sleet nice job on the performance stuff!
It's not a bug, this is how it is supposed to work, and how it is documented. Reading the buttons state clears the buffer, and it will remain empty until new button presses are registered. This is shouldn't be a problem in any normal application, as the buttons are being read every 30ms or so, and no human is able to see that.
I suppose it can be surprising if you read the button state in a tight loop more than once per frame, but why would you ever need to do that?
We could make it work as expected if instead of clearing the buffer, we set a flag that tells the code that updates the buttons to clear the buffer when it reads their state. But I don't think it's worth the effort without an actual use case that would require it.
The use case is @kattni is working on a library to make accessing buttons easier and is running into them returning 0 sometimes when they're still being pressed.
Is there code available?
She'll have to give that to you. However, I had to add a delay for the same reason in https://learn.adafruit.com/pybadge-conference-badge-multi-language-unicode-fonts
It's a sparse WIP. I can create a quick repo and push the code if you want it. It's designed to work on PyGamer/PyBadge, though only tested on gamer so far.
I'm writing a library that's meant to be designed like the Circuit Playground Express cpx library - a general purpose wrapper library that makes all the functionality of the boards available in one place. The first thing I did to test the button code was the equivalent of print(pybadger.get_pressed()) in a while True: loop. It d...
I will try to propose a pull request that lets you use it like that.
Forgot to git add tools/git-checkout-latest-tag.sh in #1909. I had added a Makefile target that used this script.
@slender iron (thanks for above) I'm submitting the MICROPY_OPT_COMPUTED_GOTO PR against master, but would you want it against 4.0.x instead? (Prob not). If 4.0.x, I'll be doing another PR to pull in the latest 4.0.x changes, because I need some of them to shrink a few more builds properly.
@tulip sleet I think master. we should do 4.1.0 soon
it sped up celeste load times from 5+ seconds to under 2 ๐
woot! how about game play?
I was thinking we should do the audio mixer stuff with 5.x too
some of it is now too fast ๐
lol. Also, we could tighten up the background task stuff and achieve I think maybe 2x there (3x is if it's not present at all). We call some of the background tasks only at certain intervals, but I'm not sure what intervals we can tolerate. E.g. have to ask Thach what the tusb task max interval is. Also should inline some of that if possible
ya, agree there is room to improve that too
@C47D Please email me, scott@adafruit.com and we'll get you more boards. Thanks!
Create an empty lib directory (folder) when the root filesystem is created. Suggested by @ladyada.
I figured it had to do dynamic rescaling and sizing of apps!
@tulip sleet are you fixing the broken builds for the speedup?
yes, on the phone but will start again in a few
kk, just didn't see anything going by
@slender iron, starting another batch of builds I think will partially fail. will ping you when ready
kk, I'm having space issues in m0 builds too
do you have a PR in the pipelin?
i mean, do you have a PR you need to get in for the beta
getting close https://github.com/adafruit/circuitpython/compare/master...tannewt:dirty_area?expand=1
ya, the partial updates
excellent
fixes three issues ๐
[:bowling pin:] * 3
@tulip sleet what do you think about disabling gc optimization instead of your vm one?
to make things fit? I shrunk stuff a lot so once this PR works you may have an easier time
did you test the diff? (time and space)
space was over 1k free on hallowing
didn't test speed
but I'd take slow memory over slow vm
yah
# optimising gc for speed; 5ms down to 4ms on pybv2
$(PY_BUILD)/gc.o: CFLAGS += $(CSUPEROPT)
ya, I commented it out
could try -O2
but we could do it for m0 only
yes, definitely, not sure how much time we're losing by pruning the inlines lower and lower
But I think the VM improvement would swamp that
so hallowing m0 is the stumbling block now with your new code?
I can fiddle with that while the build is going
one of the worst
I'm looking into function inlining to figure out why that knob wins us back space. also tried one lto partition and only got a 100s of bytes back
well, any function that's called twice or more but is smaller than the threshold will get inlined. is that what you mean?
I'm looking to see what functions those are
all functions called only once will get inlined, I think
so we could mark some noinline directly
i have a script for that, I think. I'll look
#!/bin/bash
arm-none-eabi-nm --print-size --size-sort --reverse-sort --radix=d $1
named elf-function-size
what does it do?
feed it an elf file, it prints out the size of all functions (and other sized things)
right
i used it to find very big functions and see why they were so big and did I need them
it actually might not skip the inline ones, because it incldues all the lto symbol names
hrm
00057288 00000036 T mp_sys_exit.lto_priv.1727
00081792 00000036 T mp_stream_close
00111340 00000036 T mp_obj_get_float
00075988 00000036 T mp_math_radians.lto_priv.1314
00075952 00000036 T mp_math_degrees.lto_priv.1315
etc
i wonder if they're there for debugging or whether that info is elsewhere in some -g table
00110528 00000032 T mp_obj_len
00100796 00000032 t mp_obj_is_float.lto_priv.1555
00100796 00000032 T mp_obj_is_float.lto_priv.1554.lto_priv.1746
00100796 00000032 T mp_obj_is_float.lto_priv.1553.lto_priv.1755
00100796 00000032 T mp_obj_is_float.lto_priv.1552.lto_priv.1756
00100796 00000032 T mp_obj_is_float.lto_priv.1551.lto_priv.1759
also, unrelated to this, we might want to be grabby in travis and start splitting up into 7 or 8 jobs instead of 5
I used to use nm for that.
I think I'd rather try and optimize the build
00037900 00000632 t mcu_processor_get_temperature
@slender iron ok, the VM opt PR is all successful
i've been pushing some heuristic methods around in my head to only build what needs to be built. for instance, if a PR has changes to only ports/nrf/*, then there is no need to build samd. but, if changes are in shared-bindings/etc, then a full suite build is needed.
obviously, this doesn't speed up any individual builds. which would still be a good goal to have, imo. ๐
the other approach could actually be to share more files between builds
have to track flags better then though
yeah. if only cacheing propagated across stages... ๐ฆ travis docs mention uploading to S3, iirc.
inline limit is such a big stick
we are reaching the limit with the pinyin translation. Basically I turned off nearly all inlining, I think. When the limit is 23 it frees up a tremendous amount of space, which might be a lot of the hri routines
the temperature code could use some algebra
it's pretty much copy/paste from atmel
-fno-inline
Do not expand any functions inline apart from those marked with the always_inline attribute. This is the default when not optimizing.
Single functions can be exempted from inlining by marking them with the noinline attribute.
with 23 its 2494
the hallowing has longints turned on; I turned it off in the CPX Crickit build, Gemma, and Trinket
i turned those off months ago, not recently
sorry for the slow review @tulip sleet I want to figure out what the inline stuff is doing
np - I thought you were doing that in your own PR.
@dhalbert, with the last CircuitPython source code, when I add #define MICROPY_OPT_COMPUTED_GOTO (1) I got this error at compilation time:
In file included from ../../py/vm.c:129:0:
../../py/vmentrytable.h:27:5: error: "__clang__" is not defined, evaluates to 0 [-Werror=undef]
#if __clang__
^~~~~~~~~
../../py/vmentrytable.h:116:5: error: "__clang__" is not defined, evaluates to 0 [-Werror=undef]
#if __clang__
^~~~~~~~~
cc1: all warnings being treated as...
Change both #if __clang__ to #ifdef __clang__. The original is a bit sloppy and we turn on warnings on that.
Thanks!
So I ran again the same test with MICROPY_OPT_COMPUTED_GOTO enabled and CIRCUITPY_DISPLAYIO disabled:
Results: 35.3ms
So a huge improvement but still some room for optimization to reach the ~10ms on an equivalent 120MHz STM32F4 board with MicroPython.
Good job @dhalbert !
Thanks! The next step is more work, which is to figure out how to call the background tasks only as often as necessary. That will get the next 2-3x speedup, I think.
We really appreciate your taking the time to do this comparison and point out the big disparity.
Just tried at 200Mhz: 21.2 ms.
Ah ah, no issue :) It forces me to go into the details to get a better understanding of CircuitPython, I like that. But a beer in the Walking City downtown would be appreciated too.
Anybody up late for some PyPortal debugging?
I'm getting this:
Saving data to /sd/buttons.json
Read 12000 bytes, 16565 remaining
Traceback (most recent call last):
File "code.py", line 84, in <module>
File "adafruit_pyportal.py", line 612, in wget
OSError: [Errno 5] Input/output error
OSError:
It creates the file buttons.json in the right place, but it's empty
Seems it can read from the SD fine but fails on the write() call
I am going to manually load up the SD card with the data I need - I need this to move forward, but down the road, I think there's an issue here
When reading the accumulated button presses in gamepad and gamepadshift,
don't clear the buffer to "no buttons pressed", but instead set it to
the current (last checked) state. This clears the accumulated presses,
but retains any ongoing ones.
This fixes #1935
That jogged my memory: I saw breakage a long time ago when I set the inline limit relly low: #322. I tested it briefly with 23 but it was really just a smoke test
USB_MIDI is turned on for all builds. We could turn it off for small builds. Saves 728 bytes.
I looked at the pinyin translation in hopes of trimming it a bit. It's not that verbose in terms of character count: it's the double-byte characters that really push it up.
Using regular -Os instead of -O3 (SUPEROPT) for gc.c saves 2144 bytes.
Using regular -Os instead of -O3 (SUPEROPT) for vm.c only saves 524 bytes.
My inclination is to slow down gc for CIRCUITPY_SMALL_BUILD and/or for the overflowing builds, as you suggested. Then we can dial way back towards normal on CFLAGS_INLINE_LIMIT. I'll work on setting up compilation flags for this.
@slender iron I'm on track with turning off -O3 for gc.c for certain builds. I had to fix a debugging typo that turned off -O3 for vm.c also, which I didn't intend. Oddly, that caused tests/micropython/extreme_exc.py to fail, but only on the native gcc used by travis, which is quite old. It didn't fail on my more recent native gcc.
@tulip sleet
have you tried gcc 9 yet?
I'm wondering if it'll speedup lto
that does look like the difference between samd and nrf build times
doesn't look faster to me. on my arch box a translation is still 17 sec
gcc 9 for arm? No, haven't tried it yet. There's no ARM release yet for that. I tried gcc 8 a while ago, and it was very similar: a trinket build was maybe 100 bytes smaller
there should be a new bi-annual ARM release soon, within a few weeks
@slender iron &
this new stuff I did this morning means the clean builds for pinyin are no longer necessary, so that will speed things up a bit
ya, arch builds it themselves. will compare size
not sure the arm release is very different than upstream
i dont' really expect lto to get much faster: it has to do a lot of work
alot of the work is loading in large files I think. if they get smaller then it could speed up
limiting it to one lto partition is a couple second speed boost and a few hundred bytes I think
@slender iron PR #1934 succeeded; no more teeny inline limits. Smallest is 55.
I have to take J to an appt in 15 mins. Will be out for several hours.
ok, great! will merge in and get my pr sent out
do you still want to try for a beta tonight, or no rush?
no rush if you are out. we can always say it's coming soon
ok - not sure when I'm back but will be before meeting
np
ea760c0 Turn on MICROPY_OPT_COMPUTED_GOTO for 5x CPU-bo... - dhalbert
aa3316b Merge remote-tracking branch 'adafruit/master' ... - dhalbert
0b3f297 shrink a bunch of builds to fit - dhalbert
1bb4fcc Turn off SUPEROPT on gc.c instead of trying to ... - dhalbert
ba1b36a Uncomment vm.c SUPEROPT (debugging typo); trim ... - dhalbert
@stuck elbow I'm going to rebase your fix so it goes out in the next stable release
(and merge into 4.0.x)
@tough flax I had a similar issue yesterday with sd write as well, freshly formatted card, wasnt sure if it was my hardware or the code at the time
Very strange - today, that same device decided to just "disappear" 1/2 the /lib directory contents. It wasn't even connected to a PC
Now I get this when trying to copy in adafruit_display_text
@slender iron Do you Limor's input on that? I think it was primarily for her use in the end.
I don't think it's worth it regardless. 800 bytes is a lot for something not used often
Ok.
Merged.
thank you!
Yep!
I'm releasing it now
Right on
Different operations to the display tree have different costs. Be
aware of these costs when optimizing your code.
- Changing tiles indices in a TileGrid will update an area
covering them all. - Changing a palette will refresh every object that references it.
- Moving a TileGrid will update both where it was and where it moved to.
- Adding something to a Group will refresh each individual area it
covers. - Removing things from a Group will refresh one area that covers all
previous loc...
@slender iron Is there a built in font anywhere in CircuitPython or related stuff? That doesn't require you to have a separate bdf or bin file or whatever else.
yup! in terminalio
Oh! Beautiful. Ok. Thanks.
@tidal kiln Thanks, already got it working ๐
@slender iron Am I seeing right that terminalio.FONT is one size only?
yup
Ok, thanks.
you can scale it in a group though
it'll look chunky
Fair enough
@tulip sleet i'm here
if you take a look at the CPX schematic, that's a great example.
do you have any adafruit samd21 or 51 boards?
I do
any express boards?
Adalogger M0. And I think the Feather BLE.
No CPX.
the .sch file doesn't name the flash chip. Looking through the tutorials to see if it's said there.
you can get a small version of circuitpython on the adalogger. Microsoft wrote a nicer bootloader that appears as a USB drive, and you just drop files on it. Also it emualtes the arduino bootloader
CPX flash chip choices are here: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk#L12
mostly we've ben using the GD25Q16C
getting CPy on your adalogger: https://learn.adafruit.com/welcome-to-circuitpython/non-uf2-installation. It's worth looking at the whole guide if you're new to CircuitPython to see what its capabilities are.
@rose root btw: https://learn.adafruit.com/make-it-pulse
Yeah I really like the pulse sensor. It comes out really clean too.
If you could move the IR LED (which I think is closer to the center) next to the light sensor, you could do pulse oximetry.
we'll take note of that!
Also, any thoughts on adding a battery charger to the CPX? That was pretty critical for my smartwatch.
reason for no battery charger was that LiPO batteries aren't that great for primary classrooms, because they're dangerous if punctured, bent, etc. So we encourage AA battery holders, etc.
That makes sense. I was debating whether to go with LiPo or coin cell myself.
I settled with LiPo somewhat reluctantly, but this year I'm putting the watch in an enclosure so that will make me feel better. I'm teaching high schoolers so I'm a bit more at ease. If these were middle schoolers though, definitely not.
that sounds ok. Coin cells might not last that long.
Yeah. They're a bit smaller than AAA batteries, but I could get some rechargeable ones. Their capacity is a bit of the downside though.
@rose root sorry, distracted by video and a PR. Take a look and see what you think.
No worries. Iโm distracted by Ask An Engineer. Iโll dig in a bit. I probably wonโt get it running for this year, due to time constraints but Iโm already working on a version for next year anyway. I also want to use this design for college students too. I need a few more sensors. Environmental, UV, etc.
Also, whatโs PR? Lol.
pull request, in github ๐
Got it. Hahaha.
I am working on a a personal project that needs Uv Index I purchased the SI1145 for my raspberry pi . There are no Adafruit_CircuitPython_SI1145 libraries,drivers in python for this sensor to be used with a raspberry pi.
Please create a driver so I can get UV Index readings from this sensor
be rotated (missing "d"). Could you also whether it's clockwise or counterclockwise?
I'd use size_t instead of int32_t.
missing newline at end of file
maybe not - I looked on stackoverflow, and, it depends.
hiya that sensor isn't recommended for UV readings, as it does not have a true UV sensor. try the VEML7700!
yup, good catch. in general coordinates are 16 bit and scale 8.
was experimenting but not needed.
easier to read either way. :-)
Didn't work with naive memset. This has the advantage of knowing the array type and that it is aligned.
shhh... That was meant to be a secret Git Bot ๐ ๐
@slender iron I just changed run_background_tasks() in a very simple way to run the tasks only every msec. That gives a 2.2x speedup. 1 msec is good for USB, according to thach. is 1 msec ok for display refresh (or even longer? how long?). Only other one to worry about is the ethernet support background task.
void run_background_tasks(void) {
if (last_finished_tick == ticks_ms) {
// Wait at least a msec between running background tasks.
return;
}
...
so combination of this and the other is >10x
hey @gilded cradle Which display that adafruit carries (and has displayio support or can with a bit of work) has the largest pixels? I want to work on some graphics stuff that would me much easier if I could see single pixel errors without squinting and turning my head sideways
Heh, I have a flip-dot display where each dot is about 60mm across, but AdaFruit doesn't carry it and I sincerely doubt displayio supports it.
@tulip sleet the displays should regulate their own timing via queue_refresh. may need to make it faster to get to though
1 ms isn't great because the frames don't always align on those bounds
@slender iron is a working CDC but now MSC likely a flash chip issue? If so, I should be able to get a working CPY drive by enabling INTERNAL_FLASH_FILESYSTEM=1 instead of QSPI_FLASH_FILESYSTEM, ya?
@slender iron Since 60fps is 16.67/msec per frame, I thought 1msec might be fast enough. Do you want it to be on 1msec boundaries? The display refresh should run for no more than 1msec itself so that USB gets serviced often enough.
@pastel panther, it's the HX8357 display.
You could use RA8875, but it doesn't currently have displayio support yet
Oh goodie, I have one of those
how hard is it to get 8-bit support working with it in CP? The pyportal uses 8-bit, right?
Yeah, it does. I just haven't tried it yet.
@pastel panther ya, CDC but no MSC implicates the flash chip
@tulip sleet ideally we can line up with the displays actual refresh signal
Still haven't ruled out a soldering issue but trying to get the super small winbond W25Q80DV working by adding a def to the flash devices.h didn't help so far
I usually add a breakpoint here: https://github.com/adafruit/circuitpython/blob/master/supervisor/shared/external_flash/external_flash.c#L211
then from the debugger you can verify that you matched the id correctly
@slender iron The check is
bool displayio_display_frame_queued(displayio_display_obj_t* self) {
// Refresh at ~30 fps.
return (ticks_ms - self->last_refresh) > 32;
}
so it looks like checking this every 1msec will be fine. The current impl is still on a msec boundary because it's checking ticks_ms, it seems to me.
true for now but at some point it may change
Ah excellent thanks. On the topic of gdb, when I was working on the bitmap stuff I got tonnes of milage out of turning off the size optimization whle debugging. Is that still a good way if you have the space, or is there something else I could be doing? My main issue was with arguments being optimized out
celeste isn't running the right speed so that may be part of it
do you mean you tried my change or do you mean tip of master rightn ow
@pastel panther I usually turn lto off but not change -Os. anything optimized out you can mark volatile temporarily ๐
or you mean less < 1msec granuarlity may be necessary?
Ya I tried that previously and I guess wasn't satisfied for some reason. Maybe it was just that I had to do it for everthing I cared about and turning off -0s was just easier?
i was thinking about adding several counters to the tick interrupt routine to count when a particular background task needed to be run. They would then set a global flag for that background task, saying "yes, please run me the next time you check"
still, 1msec granularity on a 30fps frame rate seems pretty granualar if it's 1/32
i can submit a PR with the current simple patch and we can hold it for further testing. I still need to vet that 1ms is good enough for network
network is 1 second (!)
void network_module_background(void) {
static uint32_t next_tick = 0;
uint32_t this_tick = ticks_ms;
if (this_tick < next_tick) return;
next_tick = this_tick + 1000;
...
oh, also audio_dma_background() to consider. Do you think that def might need <1msec?
audio depends on the buffer size
Anyone want to pick this up to get it in? Does it just need an update to master?
@tulip sleet anything else you want to get in for 4.1.0-beta.0?
no, i think it's good!
kk, will kick it off now before I eat lunch
i'll away from home for a couple of hours shortly.
k np
Someone care to summarize where we're at on this?
Why do you need to change it as you go?
@iraytrace any update on this?
@tannewt The ATECC608A requires the frequency to be decreased to wake the chip up, then increased again when a command needs to be sent.
Automated website update for release 4.1.0-beta.0 by AdaBot.
New boards:
- electronut_labs_blip
@slender iron About to cookie BusDevice_Debug - realising that the way we cookie things means that the repo name and the lib name have to be consistent (unless I go through and change a bunch of things manually afterwards, which I can do if needed). It's not currently consistent with BusDevice/adafruit_bus_device. Should I go with Bus_Device_Debug for the name?
Any particular reason?
reads better to me?
fair enough
not sure how to describe
No worries
debug is an adjective I think. modifying bus device
@slender iron @idle owl Does alphabetical ordering/grouping come into your decision? (I know nothing about what you are discussing, btw)
@simple pulsar Not really. It's going to be a short lib that inherits bus_device but allows for debug statements.
On a different subject, I'm thinking about implementing a msgpack library as I've been playing with CircuitPython code to read IR from MakeCode. Would Adafruit want a small general purpose msgpack library? I was going to implement the small subset needed for MakeCode IR protocol but the rest could be added later. I need to see how much can be reused from existing libs too.
libraries are always good. I don't know what msgpack is though
Yet another XDR type thing but focuses on compactness https://github.com/msgpack/msgpack/blob/master/spec.md
It sounds like the JSON generation realised their stuff was getting a bit bulky at times
I think that (and the ability to transport binary information) is what's behind BSON as well.
I'm glad good old XDR is still remembered.
I remember when XML started being used a lot for pasisng data around and I thought I wonder what's going to happen next
sounds like protocol buffers
Each generation has their XDR!
Ok, I'll take a stab at a very small version that respects the M0 world but allows more to be added as people want to do more with it.
thanks! having the same api as the normal python module is a bonus. I wouldn't name it the same though
I've glanced at two python modules, will take that into account
Trivia: Just realised ASN.1 might battle XDR in age terms.
@tannewt I can take a look at it later tonight, if it needs update i can do it until tomorrow night.
There's some odd search behaviour with circuitpython.readthedocs.io, see my post on https://forums.adafruit.com/viewtopic.php?f=58&t=152497
Installing a new .uf2 never used to wipe my CIRCUITPY, but adafruit-circuitpython-pyportal-en_US-4.1.0-beta.0.uf2 did. Expected? circuitpython also seems much larger, I assume general practice now will be not to load the whole lib bundle even on 8MB devices.
Change in Group behavior? ValueError: Layer already in a group. when trying to add the same group to more than one layer (used to be allowed).
Where's the best place for beta feedback? Wow, displayio is ๐ (fast), nice!
@crimson ferry Please file issues in the circuitpython repo, like any other bug. Thanks!
OK, thanks. Sometimes I don't know if it's a bug or me doing something n00b ๐
@crimson ferry I loaded the beta three different boards, including a PyPortal, and it didn't erase CIRCUITPY. I'm mystified why yours would get erased.
And it's true that the lib is getting larger all the time. We've modified the guides and stopped recommending copying over the whole thing. Now just copy what you need.
Sounds good. The wiping could have been spurious, or more related to me renaming my CIRCUITPY last night... looking like something local... macOS Finder shows the new name, but bash shows 11 space chars for the Volume name. I'll start over clean and sort it out.
So yeah, my secret project is now public: https://blog.europython.eu/post/185584014022/europython-2019-warning-spoiler-alert
@timber mango Congratulations!! We'll publicize this well via our usual outlets.
Try the 4.1 beta and see how much faster it is for your games.
Just put 4.1 beta on a pew-pew 10 -- works fine!
\o/
unfortunately the europython ones will ship with 4.0.0-rc3 or some such
because I had to provide the firmware to be flashed to the factory up front
@tulip sleet - I was inspired by your Show and Tell update regarding the speed-up with 4.1 Beta. I'm seeing ~2X increase in speed from reset to initial
....draw of the screen.
Oh and it it's refreshing much faster, too. Nice. Thanks!
What's the secret to that 5X improvement? ๐
Is there anything started to have Arcada equivalent with CircuitPython?
asking for a friend ๐
fyi - I added sep in CPython 3.8. :)
@slender iron this is weird:
../../shared-module/displayio/TileGrid.c: In function 'displayio_tilegrid_get_refresh_areas':
../../shared-module/displayio/TileGrid.c:443:52: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
if (displayio_area_size(&self->dirty_area) <= 2 * self->pixel_width * self->pixel_height) {
^~
cc1: all warnings being treated as errors
Only happens when I compiled an nrf build with DEBUG=1. Doesn't happen on non-DEBUG or on atmel-samd DEBUG builds. Changing 2 to 2U makes it go away. I'll include that in next BLE PR.
@lethal abyss @idle owl is working on a badge focused abstraction and we intend to have a gaming one
Good news. I'll watch what will come, I will test it and use it for sure. If I may help, i will
@lethal abyss I'll keep you posted as I get something worth testing ๐
@idle owl ooops, spotted ๐ no problem, I'll be around ๐
@slender iron With displayio if I create some rects and text using splashby appending, I'm finding if all I have is that set of code in there, and nothing in a loop, it appears for a moment, disappears, and the code finishes running. Is that how it's supposed to work? If I wanted to simply create that set of things and have them remain on the display, does that mean a while True: pass below it?
Because it works with the pass in a loop below the code.
But it feels like it might be a kludge.
@idle owl can you post your full example?
@crimson ferry I hadn't thought of reusing a group in more than one parent but with the dirty area tracking I needed to do it because the child elements only have one set of areas
Adafruit Feather M4 Express with samd51j19 (31b)
CircuitPython 4.1.0-beta.0 on 2019-06-13
CircuitPython Library Bundle 20190613
2.4" TFT FeatherWing
This test will initialize the display using displayio
and draw a solid red background
"""
import board
import displayio
import adafruit_ili9341
import time
spi = board.SPI()
tft_cs = board.D9
tft_dc = board.D10
displayio.release_displays()
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
...
For comparison, hx8357 with 3.5" FeatherWing works fine in this config.
@slender iron Thanks, I figured it was some optimization or tightening some loose checking. I've changed my code.
Added a loop cointer so it's clear the print statements are unique. Some code uses a little more of the top of the screen than others, but never more than half, that I've seen.
<img width="957" alt="Screen Shot 2019-06-14 at 11 56 24 AM" src="https://user-images.githubusercontent.com/16617689/59525236-74abc500-8e9b-11e9-9f5c-810561ae1aec.png">
Well, now that I'm banging on it more, it seems that maybe the init just got in a funny state. I'm able to get the whole screen now. Successive reloads didn't clear something, had to remove battery and completely power down. Thought I had done that last night, but possibly not. I'll close this if I don't see any strangeness in the next couple of days.
Yeah, sometimes when working with displays they'll stick with the first init codes they see and if you don't unplug completely this can either lull you into a false sense of security or see issues where there aren't any. I've had it happen to me a few times while working on the drivers. :)
Perhaps the display isn't resetting properly.
It's possible my display is quirky, I don't have a 2nd to test. But I put 4.0.1 back on and it worked fine. But 4.1.0-beta.0 is still acting up after that.
I'm thinking maybe partial display updates exposed something. Do you happen to have a PyPortal to test with? It also uses the ili9341?
PyPortal terminalio is fine, but I believe it uses parallel interface to TFT, not SPI.
Yeah, but at least it's a good data point. I can hook up a display in a little bit and see if the behavior is the same on mine. I also have a few different ili9341 displays.
Or maybe the new interpreter speedup means it needs a delay now somewhere in the Python code?
Pro tip: save your changes, or the updates won't apply. ๐คฆ
Ugh, weird.
Agreed. I looked at the sheet, and from what I can tell it's similar to a clock stretch, by holding SCL high for a minimum amount of time to wake from sleep.
Dropping the frequency does seem the best approach. I peeked at the M4 sheet and saw an SCL hold register/property, but that would likely be just as bleh to implement; if it would even address this. Not to mention far less useable across the ecosystem.
Oddly (though perhaps related), I'm not seeing discernible speedup on the 2.4" FeatherWing.
@slender iron I'll post the code in a bit, I got into something else in the meantime. :multitracking:
ya, I'm off to solder for a bit
So is this a yay or nay for having a driver?
Related:
https://forums.adafruit.com/viewtopic.php?f=8&t=152822
Ok, here's what I observed while testing it using the above code. When you start it, it paints a red rectangle on the entire screen fine and then prints test starting from the bottom.
Each time you save the file it repaints the red rectangle just fine showing that the init commands seem fine. However, the terminal seems to shrink a little each time. So this may be related to terminalio.
@gilded cradle heya - I'm testing a PyBadge and I'm not sure how to read button presses from CircuitPython (the front btns)
Take a look at https://learn.adafruit.com/pybadge-conference-badge-multi-language-unicode-fonts/pybadge-buttons
Perfect! thanks
๐
@gilded cradle yup, works ๐ thanks for writing that code
btw super helpful explanations in that guide
i read over some of the arcada stuff this AM and was like "why are the bits being masked"
๐
trying to get a pyportal project working. the url returns a json blob with entries[] and I need the data out of those entry objects... I'm not grokking how to do that with json_path
Just seen a 1.78 speedup on itsy bitsy M4 using 4.1.0-beta for my CPU-bound code compared to 4.0.1 - wow, don't need any C modules! Thank you ๐
are you using the pyportal library? @tulip river
yeah
@tulip river assuming a JSON structure like:
[{"status":"At home",
"date":"- Monday, May 1, 9:54 PM",
"graph":"https://host/graph.png"}]
the image_json_path I use is image_json_path = [0, 'graph']
i.e., take the 0th element from the JSON list, and get the graph element from there.
if you call fetch it will return the JSON blob as a Python list
and you can use that to access the data
...a list of Python dictionaries actually
how familiar are you with Python lists/dictionaries?
very, I'm just not familar with how pyportal exposes things
(now that I reread, cater probably is more on the right track than I am)
ah. then you're probably closer than you think.
you can check the source code:
https://github.com/adafruit/Adafruit_CircuitPython_PyPortal/blob/master/adafruit_pyportal.py#L711
but also some of the examples might help
cater so if I use json_path["entries"] I should expect to just get the list of entries back
maybe not best....just the first i thought of...
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/PyPortal_Tides/pp_tides.py#L51
as a first pass, just do something like that and then print the return
to see what you've got
raw_info = pyportal.fetch()
print(raw_info)
hopefully once you see that, it'll be obvious how to access
combo of indexing and dictionary keys
thanks, I think that will get me on the right track
cool. good luck!
btw I'm trying to display some ship info on a pyportal https://aprs.fi/page/api
using that api... thats the goal
looks like all the info is rooted at "entries"
so that's what you'd set for json_path when creating your pyportal object
similar to "predictions" here:
https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/PyPortal_Tides/pp_tides.py#L16
and then fetch will return a list of dictionary(s) with all that data
ex for getting latitude:
raw_data = pyportal.fetch()
lat = raw_data[0]["lat"]
@idle owl I just started to explore pygamer with Circuit Python. Is your current work about having something kinda like adafruit_pyportal? I mean, something that helps having main elements grouped in a class (screen, pad, buttons...)
For now, tell me if I'm wrong, but it is up to anyone to gather compatible libraries to write anything involving pygamer?
(hope my english is clear enough)
@lethal abyss Yes, it's similar to PyPortal in that it will handle all of the setup for all the components of the board in one place. You'll import this library, and then have access to all of the main functionality of both PyGamer and PyBadge. Right now, yes, it is up to you to gather the necessary libraries and write code that sets all of the hardware up. It will be easier once Adafruit_CircuitPython_PyBadger is completed.
Ok, it makes sense
so really, if I can help, coding, doc, tests, let me know. it is a very nice product I'd like to use in the little coding club I founded and Python is such a success with kids...
Adding board support for PyBadge AirLift M4.
no es "yield" tal cual?
En otras traducciones recuerdo hemos dejado allocation, porque montรณn suena raro y poco entendible
"PyBadger" ๐
badger badger badger badger badger badger mushroom mushroom
โ we have pygamer kits in stock right now but they're going FAST! โ https://www.adafruit.com/product/4277
for those who want to try it out - check out @rhthomas code here!
https://github.com/adafruit/Adafruit_CircuitPython_NRF24L01/pull/1
let my distributor buy me one ๐
they're not available for disti's at this time
and wont be till we can have significant stock - so it may be a month
only digikey will have em earlier
Me parece bien, lo mismo para yield, palabras reservadas de C, python, etc. No?
@sabas1080 Tenรญa pensado retomar este PR en cuanto llegue a casa, si puedes haz el review, para que en cuanto llegue lo corrija.
@stuck elbow @slender iron Computed Goto? That's a phrase from the past: https://en.wikipedia.org/wiki/Goto#Computed_GOTO_and_Assigned_GOTO ๐ฑ
GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function call normally returns control. T...
Easily done on an 1802 CPU, since you can do the math in a register, then make that register the program counter.
Hi,
I just figure out that there is a 'slight' difference when reading files from the flash or from the SD card.
Version: master (6/16/2019)
File generation (copied to the flash and to the SD card
time dd if=/dev/urandom of=test.dat bs=1 count=1M
Code:
import sys
import os
import adafruit_sdcard
import board
import busio
import digitalio
import storage
# Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board...
When I see this error ```Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 5] Input/output error
it is a problem reading the program from the Files system -- not related to the actual code or hardware.
try copying your program over again and making sure the file system has been properly synched.
In fact I ran the test code:
- from the flash
- from the SD card
- from the REPL (line by line)
same result.
I also reformat the SD card. No change.
Running script from the SD card works, but that's really this readinto() which fails.
Ah, looks it comes from here in extmod/vfs_fat_file.c
STATIC mp_uint_t file_obj_read(mp_obj_t self_in, void *buf, mp_uint_t size, int *errcode) {
pyb_file_obj_t *self = MP_OBJ_TO_PTR(self_in);
UINT sz_out;
FRESULT res = f_read(&self->fp, buf, size, &sz_out);
if (res != FR_OK) {
*errcode = fresult_to_errno_table[res];
return MP_STREAM_ERROR;
}
return sz_out;
}
then....
I made a port of Pyportal Openweather project to my pygamer.
I added a esp32 as wifi co-processor.
It is mainly an aggregate of several Adafruit Guide adapted to Pygamer.
Hope it can help someone.
https://github.com/titimoby/Pygamer_Openweather
There is maybe a link... in this case read crashes after 200 bytes (versus hangs when write more than 1023 bytes).
Bu in any case, there is an issue with reading and writing on the SD card...
ya, thats the same person. i think this is a very low priority driver, but if someone wants to do it, that would be very welcome :) they may benefit from checking the silabs fm transmitter, the 'i2c data access technique' silabs uses is similar
What is the brand, model, and size of the card? Some cards work worse than others.
We have a C-based library we are planning to use instead of the python-based SD library.
I should say thinking of substituting, since we may not have space on some boards.
That's a SanDisk 8GB micro SDHC class 4.
I will try with some others...
<@&356864093652516868> Meeting is the normal 11am Pacific/ 2pm Eastern time here on Discord tomorrow in the CircuitPython voice channel. Notes doc is here: https://docs.google.com/document/d/17bOJ2-2B11kmfcJQzcs_5tMk-FBWzA_SeUYtInaBws8/edit?usp=sharing
so like
I've done the tutorials and stuff for the circuit playground express and I'm a little stumped at what to do now.
@tulip sleet and @slender iron Any idea what this is about? I can't use gdb or JLink commander for some reason
@pastel panther do you see the same thing if you do JLinkGDBServer -device ATSAMD51J19 -if SWD ? I wonder if you're not connected properly. Try it on a second board.
I don't think the 10 here is correct because COLMOD only takes one parameter: https://newhavendisplay.com/appnotes/datasheets/LCDs/ST7789V.pdf page 224.
CASET and RASET aren't needed in CircuitPython because the display code sends them for individual refreshes.
sys.settrace could be a very useful tool for performance analysis via python rather than requiring a lot from the VM/C itself.
There is a PR to micropython for it here: https://github.com/micropython/micropython/pull/4265 from @malinah
Hi everyone, nice work with the displayio stuff, I just connected a display and got the REPL on it for free ๐
I see I got demoted from circuitpythonista, makes sense ๐
why does it make sense?
now if only there was an easy way to get input into that repl as well
cause i stopped contributing
yeah i was wondering if there was an easy way, i would love to be able to easily use my qwerty keyboard with repl
@stuck elbow did you see my FeatherWing? ๐
Not sure if you would be interested in hacking on it, I could get you a unit once I assemble more ๐
I did
it surely looks great and there is a million things that could be done with it if only one had time for it... ;-)
I had to pause my CircuitPython stuff for a while, and now I have a pile of things to catch up to, with displayio having partial updates now
I would love to play with your featherwing, but I can't really promise I will get to it any time soon
I should receive the PyGamer in a few hours
@indigo wedge by the way, you you also have one of those lora featherwings?
they would make a great combo
@indigo wedge do you have an int pin on the keyboard driver chip?
Yes but it's optional, you can also poll the fifo state
Since we all know circuitpython and interrupts don't mix ;)
I don't have a Lora feather, hope someone else might get something going there
@indigo wedge you left the Adafruit server a while ago! That's probably why, or maybe it was even automatic when that happened.
hi! i'm making BLE progress - you'll see more library work and bleio soon.
the keyboard featherwing is really neat
I've been trying to minimize my SW work and focus on HW so really happy with the bring-up. I used all components that already had circuitpython libraries so it was just a matter of changing some pins ๐
Wanted to say thanks to everyone for their awesome work on CP and the libs
yw! if you're around today we have our weekly audio meeting 2pm Eastern time
not sure if I have anything to say but I might listen in ๐
welcome to stop by - we have a lot of progress happening. previous notes here https://github.com/adafruit/adafruit-circuitpython-weekly-meeting
Yes, I updated my custom samd51 board from 3.0-beta to master and wow, so much good stuff ๐
more people on the team and more outside PR's :cornucopia:
and talking about your latest hw is right on topic
Yes, soon I'm gonna be looking for people who would like to write some code for it, in exchange for free HW ๐ But first I need to assemble more than 1 unit
stop by with some photos, etc.
I have many, is this the right channel to post them?
sure!
Here's some nice ones https://twitter.com/arturo182/status/1139987695814492160
Aww, only shows one
I also made a video demoing CP on it and explaining the HW:
Portable Python!
That's the dream ๐
I have it on my phone...
But can it blink a LED? ๐
is it just me, or are PyGamer's JOYSTICK_X and JOYSTICK_Y swapped?
or am I holding it wrong?
I've used this Adafruit Si1145 board with an Arduino and would really appreciate a CircuitPython driver to use with CircuitPlayground Express and Itsybitsy M4 Express. Now the sun might come out in UK anytime soon it would be really helpful.
MiniTFT FeatherWing exhibits the same display bahevior: graphics are fine, terminalio loses about one text line per reload.
@stuck elbow i'll have a look as soon as I'm home. That's weird
duplicate of https://github.com/adafruit/circuitpython/issues/1941
please sub there :)
@indigo wedge I will absolutely help with software in trade for hardware
(probably even without it, but my free time is spare)
@indigo wedge welcome back! I added you to circuitpythonistas
๐ @indigo wedge. welcome back!
@slender iron thanks ๐ณ
@tidal kiln heya - reading over your displayio guide (really useful). what do you like using for building/displaying/modifying spritesheets?
actually, haven't done much of that since guide.
recommends Aseprite
i think i just used gimp for the guide, since it was so simple
^^ there you go. pretty sure @stuck elbow has done ~99999999% more of this than i have )
yep. was fine for a quick one off.
anybody got a link to the guide?
displayio guide?
yeah
thanks!
the sprite coverage is very basic
I got the bouncing balls demo going!
also maybe checkout some of what JP's been doing lately? he's been doing lots more sprite gamey stuff recently.
@tulip sleet does the trinket_m0 build not have displayio support? I saw it has the CIRCUITPY_SMALL_BUILD set but drawing a line from that to displayio support isn't clear to me
45:# Some are always on, some are always off, and some depend on CIRCUITPY_FULL_BUILD.
55:CIRCUITPY_AUDIOBUSIO = $(CIRCUITPY_FULL_BUILD)
60:CIRCUITPY_AUDIOIO = $(CIRCUITPY_FULL_BUILD)
65:CIRCUITPY_BITBANGIO = $(CIRCUITPY_FULL_BUILD)
91:CIRCUITPY_DISPLAYIO = $(CIRCUITPY_FULL_BUILD)
96:CIRCUITPY_FREQUENCYIO = $(CIRCUITPY_FULL_BUILD)
101:CIRCUITPY_GAMEPAD = $(CIRCUITPY_FULL_BUILD)
111:CIRCUITPY_I2CSLAVE = $(CIRCUITPY_FULL_BUILD)
147:CIRCUITPY_PIXELBUF = $(CIRCUITPY_FULL_BUILD)
(CIRCUITPY_FULL_BUILD is the opposite of CIRCUITPY_SMALL_BUILD)
@stuck elbow do you have your ball.bmp handy?
@tidal kiln @stuck elbow
I keep hitting a NotImplementedError: True color BMP unsupported when exporting a 16b BMP with GIMP. What export settings did y'all use?
image -> mode -> indexed
it should perhaps be updated to use OnDiskBitmap?
@stuck elbow You cant export an indexed image with transparency as a bmp?
you can select one color to be transparent
@stuck elbow slow compared to holding it in memory? That's not fair ๐
that's what palette.make_transparent(15) does
^^ that. but i'm not sure how you actually come up with the index value for any given .bmp file
does imageload not have the same support for bitdepths as OnDiskBitmap? Perhaps that should be addressed by them sharing some code?
imageload is in Python, OnDiskBitmap is in C
I want to discuss the possibility of copying an OnDiskBitmap as Bitmap in today's in the weeds
@stuck elbow Got it going with the indexed bitmap, thanks!
Some updates to above comments:
The 2.4" FeatherWing does appear to run faster with 4.1.0-beta.0 fresh out of a power cycle.
But now working on the 3.5" FeatherWing more, I am seeing some quirky behavior. It's in a super slow mode now that I can't get out of even through reverting to 4.0.1 (or back) and / or power cycling. Could be specific to my unit (I only have the one to test), or it possibly implies there is some static storage on the display chip that isn't getting completely rese...
@stuck elbow no one listen to me or I am such a bad communicant ๐คฃ
https://photos.app.goo.gl/eUryVp7JGrxAUMyQ6
That was the reason I asked how to activate stage module. At least now I know how to compile CircuitPython ๐
do all of the express boards support FULL_BUILD?
just a hug report today
Lurking
that's so crisp @errant grail
lurking
wants a tote bag with blinka..
@idle owl @slender iron Just lurking
@lethal abyss I think the stage module is enabled in the official pygamer firmware
Figures
lurking
Adabox has arrived at my door
@tulip sleet you are unmuted
Python seems to be the fastest growing programming language. It is also widely used to program Raspberry Pis, and it is on the verge to become available on o...
ADABOX is out! https://www.adafruit.com/adabox012
Adafruit Industries, Unique & fun DIY electronics and kits : - Tools Gift Certificates Arduino Cables Sensors LEDs Books Breakout Boards Power EL Wire/Tape/Panel Components & Parts LCDs & Displays Wearables Prototyping Raspberry Pi Wireless Young Engineers 3D printing NeoPix...
EuroPython 2019 attendees getting CircuitPython-powered PewPew Game Consoles! They are looking for attendees to help Radomir with workshops on the PewPew. See more on the blog post and on the PewPew workshop page.
https://blog.europython.eu/post/185584014022/europython-2019-warning-spoiler-alert
https://ep2019.europython.eu/events/pewpew-workshops/
8/8/2019 is CircuitPython day! 8/8/2019 is CircuitPython day! This year, weโre in the planning stages and will have live videos, celebrations, and more for this very snake friendly date! For now, weโre starting to assemble the artwork in our public DropBox CircuitPython folder, check it out
https://www.dropbox.com/sh/cod3wllmyninyn5/AADC6Z5EhEsG18X8WDRMEZuta?dl=0
If you need to get in touch with us for planning your event and more, email: circuitpythonday@adafruit.com
Bluefruit Circuit Playground Express is in early prototyping phase
https://youtu.be/6VQpo3v5jo8
We have a buncha' updates on circuitpython.org, specifically in BLINKA! Thanks Melissa!
https://circuitpython.org/blinka
Discord now offers "server boosts" we have 6 on our server (level 1), if we get to 10 boosts we get a banner and some other good features for the community: 150 emojis, 256 Kbps audio, server banner, 50 mb uploads for all members. Stop by and boost!
https://adafru.it/discord
Company note: Adafruit is hiring too! We're looking for PHP developers in the NYC area! Email: apply@adafruit.com
Circuit Playground Express Bluefruit prototype update #adafruit #bluetooth #iot Visit the Adafruit shop online - http://www.adafruit.com --------------------...
CircuitPython Organization
hihi here for a few mins
๐
that's fast :P
I increased the speed to try and beat the frame rate
you may want to add display.wait_for_frame() in the loop
Note that board.JOYSTICK_X and board.JOYSTICK_Y are reversed, because that's how they are in the current builds.
Inspired by @split ocean 's proto MIDI input wing.
And Jumper Wire already works with Stage
woo for a clean office!
Nice! I'll have to try that out @stuck elbow
What is the "trick" for setting the baudrate for a display -- I am using a 2.4 inch TFT featherewing on a feather_nrf52840 and it works, but thr REPL updates are very slow -- IIRC there is a simple way to tweak the baudrate
make sure you are using 4.1.0
@idle owl can you just scale the pixels on the display?
@slender iron I am -- do I just let it default or do I need to explicitly set it?
default but I haven't test with nrf much
OK -- I'll compare to feather_m4
and not all displays have hardware scrolling that is actually useful
ya, nothing uses hardware scroll now
OK -- may just be "they way it is" I'll poke at it.
its usually the wrong direction
@pastel panther hope you still have time for mushroom farming!
@solar whale I'll find some (likely growing in a warm damp place)
didnt test hardware, just looked at PR for typos :)
hi im back
@meager fog We're in the weeds on version numbers and bleio
Thanks!
@slender iron defaults write com.apple.finder AppleShowAllFiles YES
idk where it is in finder, I have an Alfred3 command
oh, then killAll Finder after
En otras traducciones se ha dejado como perifรฉricos
La traduccion adelante lo maneja como Brillo
otras traducciones dejan como perifรฉricos
Deje algunas correcciones y algunas sugerencias @C47D
Well hello! I've just arrived from Twitter, Adafruit suggested I join :D
@sly falcon just a heads up -- I have run into an issue loading the NINA_W102-1.3.1.bin file via the Metro_m4 passthru on an metro_m4_airlift. If I build it from your master repo, it loads and works OK but if I buil it from the Adafruit nina_fw repo, the load fails partway trough with a timeout ... see examples ```jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/nina-fw$ /usr/local/bin/esptool.py --port /dev/ttyACM0 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.3.1.bin
esptool.py v2.5.1
Serial port /dev/ttyACM0
Connecting.....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse
MAC: c4:4f:33:0e:a9:dd
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1129472 bytes to 610164...
Writing at 0x00024000... (26 %)
A fatal error occurred: Timed out waiting for packet header
jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/nina-fw$ cd ../../docmollo/nina-fw/
jerryneedell@Ubuntu-Macmini:~/projects/docmollo/nina-fw$ /usr/local/bin/esptool.py --port /dev/ttyACM0 --before no_reset --baud 115200 write_flash 0 NINA_W102-1.3.1.bin
esptool.py v2.5.1
Serial port /dev/ttyACM0
Connecting.....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse
MAC: c4:4f:33:0e:a9:dd
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 1129472 bytes to 610173...
Wrote 1129472 bytes (610173 compressed) at 0x00000000 in 53.7 seconds (effective 168.4 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
``` first is from Adfruit repo, second from yours -- for both I just do make the 'make firmware` Have you built it from the Adafruit repo?
This is repeatable...
Can you try with no stub? I think it's --no-stub
still faield with --no-stub ```jerryneedell@Ubuntu-Macmini:~/projects/adafruit_github/nina-fw$ /usr/local/bin/esptool.py --port /dev/ttyACM0 --before no_reset --no-stub --baud 115200 write_flash 0 NINA_W102-1.3.1.bin
esptool.py v2.5.1
Serial port /dev/ttyACM0
Connecting.....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse
MAC: c4:4f:33:0e:a9:dd
Enabling default SPI flash mode...
Configuring flash size...
Auto-detected Flash size: 4MB
Erasing flash...
Took 3.69s to erase flash block
Writing at 0x0005e400... (34 %)
A fatal error occurred: Timed out waiting for packet header
How are you powering this device? Can you ensure it has a clean power supply?
The only reason, currently, I can think different firmware causes a crash is that the bit sequence has an effect on the power system
Another option, is trying a slower baud rate. This may help mitigate power sag due to flashing.
same failer with external 9V suppy -- interstingly -- without --no-stub it get to 26% -- with it it gets to 34%
What board are you flashing?
Same percent?
yes
I mainly wanted to see if there was someconfiguration diff betwen the repos. I'll try to dig into it.
What other binary files do you have instead of the one you are flashing now ?
Since you're writing at 0x0, this flash binary must have very large strings of padding. Either 0xFF or 0x00 is usual. I suspect 0xFF since that is the cleared state of NAND flash
Ic an load other from the adafruit guide and I can load the one I build from docmollo's repo ,, just not the one I build from adafruits repo.
Do you have an application.bin, a partition.bin and a bootloader.bin that you can flash individually ?
They should be in the build outputs
I can try that.
You'll need to know their addresses.
Bootloader is usually 0x1000, partition table is 0x8000 and application is 0x10000
Start with the bootloader if you can. See if you can flash that
actually, the build provide the list -- I'll try it ```python /home/jerryneedell/projects/esp-idf-3.2/components/esptool_py/esptool/esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /home/jerryneedell/projects/adafruit_github/nina-fw/build/bootloader/bootloader.bin 0x30000 /home/jerryneedell/projects/adafruit_github/nina-fw/build/nina-fw.bin 0x8000 /home/jerryneedell/projects/adafruit_github/nina-fw/build/partitions.bin
0x30000 is an unusual choice but so be it :)
Try flash them individually if flashing them in a one liner does not work
But. That command should flash them one after the other anyway
I'm just not sure how much information it gives. I don't recall if it tells you which image failed
hmm -- it seem sto have loaded ...
https://github.com/adafruit/circuitpython/blob/master/ports/esp32/partitions.csv
This partition table says the app is at 0x10000
Unless I do not understand
and it seems to work ... interesting -- thanks for the guidance --
No problem.
Writing the entire flash like with the all in one image is very abusive on the flash and heavier on the power system.
still no clue what the differenc is between the images -- I'll dig into that later
Check your versions btw. Ensure you are running the firmware you think you are. If you have written your firmware to the wrong address it may not be immediately obvious
I'll reload an older version then repeat
One image is bootloader, partition table and application all in one file. But with lots of padding between them so that they end up in the right place
The padding can cause trouble in the right conditions
well -- I was able to revert to an old version then reload the new one with the multiline command and it seems happy and reports the correct version ... progress -- thanks again.
No problem. You may wish to raise the issue in GitHub. Telling them what you encountered with which board and your work around. Tag me if you like @NeverCast
Is this not CircuitPython?
This is the firmware you are using right ?
adafruit fork https://github.com/adafruit/nina-fw
I see
Perhaps @meager fog may wish to open the issues on that repo or suggest the correct means of reporting them. Otherwise, yes, drop it on
https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/issues/ I guess. Since you got a response last time
@solar whale do you know if the Adafruit fork is largely diverged ? If Adafruit tracks Arduino you could report the issue up stream.
Not sure -- I'll see what responses it gets from @sly falcon and @meager fog first.
Ah you posted a comment on an unrelated pull request on an unrelated repository haha.
well -its a related PR in a related repo.
This is why the readme should tell one where they may direct their issues xD
In this case, I think it is getting to the correct people for now.
You have a formatting issue on your comment btw. Your paragraph is inside the log snippet
Gracias, corrijo mรกs tarde.
Con respecto a algunas palabras que deje en ingles es porque corresponden a parรกmetros de funciones, ยฟCrees que deberiamos seguir dejandolas en ingles o las traducimos?
@granite thicket thanks -- fixed comment
@slender iron Is there a well-known set of things that don't get reset upon reload, or is it more likely that an on-board or connected peripheral is holding some state (e.g., some pin assignments, SPI frequency in some cases)?
only things used by the supervisor shouldn't be reset.
@solar whale @granite thicket I turned on issues
ya, that's the python api for it
it's not a simple question
LOL, suspected not. thanks!
np, is there something specific you are wondering about?
Thanks for that, tannewt
0bc7417 Add pybadge airlift, sans-tft - brentru
4092294 tft working init. sequence, still undersaturated - brentru
207dc88 removed incorrect gamma code, looks better now - brentru
6a37f4f added board to fastest travis_boards - brentru
ea2c068 COLMOD is 1 param, remove CASET/RASET in Circui... - brentru
Looks like you need to rebase to make git happy.
@slender iron Not miission-critical, just trying to understand for design and debugging. Things like when displayio.release_displays() or other explicit startup deinit-type actions are needed, SPI behaviors, any (presently to me) unknown unknowns, etc.
should this be width_in_tiles?
Yup! Terminal only changes y so I didn't notice. Good catch!
More testing in the Gist comments. Observations:
-
"slow mode" seems independent of whether an external display is actually connected
-
therefore, seems to be tied to processor / circuitpython rather than the external display hardware
-
hardware reset button during run seems to be a trigger for slow mode
-
slow mode persists across reloads
-
SPI frequency is sticky across reloads in normal mode, not in slow mode
-
normal mode can be re-established by reloading without displa...
hi, i found bugs using circuitpython with TSL2561 and MPL3115A2 on a Raspi i2c bus, what should i do ?
MPL3115a2 : in file "adafruit_mpl3115a2.py" line 117 [[if self._read_u8(_MPL3115A2_WHOAMI) != 0xC4]] should be commented to get readings. Using the test script by Tony DiCola, only temperature and pressure readings work, the altitude reading hangs the script
TSL2561 : have to run "i2cdump -y 1 0x39" before each reading, using the test script (so cmd is i2cdump -y 1 0x39 >/dev/null 2>&1 && python3 TSL2561-test.py)
@timber mango you should open issues in the library github repostories describing the problem https://github.com/adafruit/Adafruit_CircuitPython_MPL3115A2/issues https://github.com/adafruit/Adafruit_CircuitPython_TSL2561/issues
ok, thanks ! Can I copy/paste what I wrote here, is that enough ?
That should be fine
thanks ๐ have a nice evening ! ++
You're welcome -- you too!
@gilded cradle w
wha
agh
enter is next to h
what display needed chip select toggled every command? the 1ms delay is killing our speed
I think it was the ST7789
Originally I was going to make it a flag that got passed in
ya, I'm wondering how long we actually need it high
Probably not that much. I think it is supposed to be closer to 10 microseconds
So maybe start with 100 uS and see if it still works
kk, that'll be much faster
Do you have that display on hand?
ya, the pygamer advance is a 7789
Ok, that works
my guess is that the clock speed is the limit
I think it'll probably work without a delay at all, but we threw it in for faster procs
ya, I think I'll do 1 us to be safe
Sounds good
