#circuitpython-dev

1 messages Β· Page 303 of 1

manic glacierBOT
slender iron
#

@lucid solar Interesting! I'd love to see your draft of it. I don't know cmake so it'd be tougher for me to do.

lucid solar
#

I'm also making sure you can build it directly without having to use their ./install.sh scripts etc.

slender iron
#

πŸ’―

#

the mp build gets tricky once you get to qstrs and translations

manic glacierBOT
#

Note that this uses the capitalised module name Crypto to be compatible with the pycrypto module at https://www.dlitz.net/software/pycrypto/api/current/Crypto.Cipher.AES-module.html

I've added documentation, but I'm not sure if I documented it correctly.

Let's not match pycrypto at the package level. Lets only have the aes module API match. That way we can turn on and off crypto algorithms at the module level. So, the cross-platform import would be:

import sys
if ...
#

@dhalbert All requested changes have been implemented. Thank you for the guidance.

Comments

  • With how supervisor_flash_init() is structured in external_flash.c, it was necessary to add an extra define of EXTERNAL_FLASH_NO_JEDEC in my mpconfigboard.h file to establish the proper flash device. This is because members of the flash_device struct are not yet accessible at that point, but the JEDEC response is used in establishing it.

  • Three new members were added to `external_...

#

We don't want to mimic pycrypto. I got the wrong python module. (PyCrypto was last released in 2013.) It looks like cryptography is the recommended package: https://docs.python-guide.org/scenarios/crypto/

Instead, I think we want our own APIs that only feature encrypt_into and decrypt_into that both take two arguments, the source and destination buffers. They can be the same or different. Omitting the methods that return new memory means folks are less likely to generate a bunch of g...

slender iron
#

@tulip sleet do you have cycles today to do further lower_power tests for me? I'm curious if master has a problem for and and if you can repro on a debugger

tidal kiln
#

@slender iron i've lost track of things - what's the desire for pixel_order? should it be a string, a tuple, or support both?

slender iron
#

looks

#

I imagine it should use the pixelbuf variables and not care what the value is

tidal kiln
#

where are those defined?

tulip sleet
#

@slender iron I can try master, within an hour or so.

slender iron
#

@tulip sleet ok, that would be awesome. poking at it now. chatting with helen soon I think

idle owl
manic glacierBOT
tulip sleet
#

@idle owl when I'm creating an alias for a readthedocs subproject of circuitpython, should the alias use dashes or underscores? I seem to be finding both

manic glacierBOT
tidal kiln
tulip sleet
idle owl
#

@tulip sleet Look at the RTD link in the README of the lib. And make it exactly what it is in the README.

tulip sleet
#

got it; there is also a link in the release notes, so maybe one is wrong

idle owl
#

Ah fair enough. Go with the README one.

#

And use that elsewhere.

tulip sleet
#

ok README has underscores. I'll fix the release notes

#

tks

onyx hinge
#

@idle owl thanks, done!

idle owl
#

@onyx hinge thank you!

tulip sleet
#

@slender iron I am not seeing the same Metro M0 trouble on the tip of master that I am seeing on lower_power.

#

also I still hate sphinx:

/home/halbert/repos/Adafruit_CircuitPython_BLE_BerryMed_Pulse_Oximeter/adafruit_ble_berrymed_pulse_oximeter/__init__.py:docstring of adafruit_ble_berrymed_pulse_oximeter.PulseOximeterValues.finger_present:1: WARNING: duplicate object description of adafruit_ble_berrymed_pulse_oximeter.PulseOximeterValues.finger_present, other instance in api, use :noindex: for one of them
#

sphinx is generating useless "alias for field number <n>" for namedtuples that conflict with the real docstring ... actually this appears to be an artifact of CPython, which generates useless docstrings, and sphinx doesn't override them properly

#

(That's why I didn't respond to you so promptly)

slender iron
#

@tulip sleet I don't think I've ever reproed the partial enum you see. can you send me a uf2?

#

one thing I've seen is the DFLL not coming up

tulip sleet
#

did you see the extraneous reset in the trace?

#

This is built from a completely updated clone of your repo, for Metro M0, so it should be the same as yours

slender iron
#

I think my tinyusb asserts are on but I don't hit any

tulip sleet
#

did you look at the trace i put in the issue?

slender iron
#

ya, it hung after set configuration

#

I've not been able to replicate that

tulip sleet
#

what's the hardware you have that's running Arch?

slender iron
#

a regular tower computer

#

not sure what it is

tulip sleet
#

what motherboard, and is it an Intel CPU?

slender iron
#

no, a ryzen

idle owl
#

@tulip sleet What did you end up doing for the namedtuple Sphinx issue? The last time I ran into it was another one of your libs, and we tweaked it until it passed, but the "alias for" lines are still in the docs.

tulip sleet
#

@idle owl not solved yet; it seems to have reappeared maybe with 3.0.3 of sphinx, or maybe it was always there

#

total pain

idle owl
#

We found one workaround but it was complicated and extraneous and I'm not even sure sommersoft ever got it to work.

tulip sleet
#

@slender iron do you have an vanilla intel box or laptop you could try?

slender iron
#

my thinkpad might be an intel

tulip sleet
#

could boot off an ubuntu dvd; that might replicate it

slender iron
#

can you get it to happen when on a debugger?

#

oh, I do have a nuc too

tulip sleet
#

i haven't tried yet

idle owl
tulip sleet
#

@idle owl yes, I was doing the same as that one; I'm going to try that one again and see if it fails anew

idle owl
#

Ok.

tulip sleet
#

@slender iron I can certainly try it in the debugger but I wasn't sure what to look for

slender iron
#

once it stops you can see if it's in the sleep_until function

#

that's mostly what I'd expect

#

or it could be some other timing loop that is wrong

tulip sleet
#

What I was thinking of doing was triggering a pin on each call to TinyUSB task and see whether it's late

#

compared with the same thing in master

slender iron
#

do we actually need to call it regularly or just after any interrupt?

tulip sleet
#

i thought we had to call it every msec; that's what Thach told me

#

in the lastest master, do you do that still?

#

I think we should ask him about it when he gets up

slender iron
#

in the lower power we only call it when awake

#

the frustrating part is that it works for me

tulip sleet
#

right, it's clearly some timing thing that's different on your USB hardware or the drvier

#

what does your thinkpad run?

slender iron
#

Β―_(ツ)_/Β―

#

haven't used it in a while

tulip sleet
#

i mean, is it linux or some old windows?

slender iron
#

linux

#

my tower can run windows 10

tulip sleet
#

if you can bring up the thinkpad and bring it up to date with whatever, just try it, but mainly let's wait for Thach and ask him if we WFI and don't call tud_task is that fatal?

#

it's possible he's scheduling something that needs to be done not on an interrupt but sometime after an interrupt

slender iron
#

I didn't think it was that smart

#

but could be

tulip sleet
#

is there a timer interrupt every msec

#

i.e. does the WFI return every 1/1024 of a sec?

slender iron
#

only if ticks are enabled

#

which you could turn on to try

#

but we also disabled wfi and had the issue

tulip sleet
#

definitely; how?

#

it still might not be calling the background task every tick

#

for some reason

slender iron
#

it should over-call it if wfi isn't called

tulip sleet
#

so maybe I should instrument that call to the tud task and look at it on the Saleaea

slender iron
#

ya, and see if you can see where it is with a debugger

#

does the neopixel ramp up and down?

tulip sleet
#

or maybe you turned off some interrupts? did you redo the priorities

#

yes, the board seems fine; I just can'talk via USB

slender iron
#

I think I replaced systick with rtc but nothing else

tulip sleet
#

anyway, how do I enable the ticks? I'll try that just in case

slender iron
#

there is a function to do it in supervisor/port.c

tulip sleet
#

I'll try that; I'll turn it on at the beginning of main or something

slender iron
#

πŸ‘

#

I appreciate the help

tulip sleet
#

@idle owl it's actually still broken in heart-rate: it doesn't throw errors but the documentation is missing:

idle owl
#

That's odd, it was included previously - I remember the documentation existing with the aliases below it.

#

Maybe when built locally or something. I have no idea.

#

Be back in a bit. Recording.

slender iron
#

@tulip sleet looks like my nuc may have tickled it

tulip sleet
#

@idle owl mine has py:attribute, heart-rate has just :attribute::, which I think might be a bug: the leading : is wrong. If I remove that, I start to get

/home/halbert/repos/Adafruit_CircuitPython_BLE_Heart_Rate/adafruit_ble_heart_rate.py:docstring of adafruit_ble_heart_rate.HeartRateMeasurementValues.heart_rate:1: WARNING: duplicate object description of adafruit_ble_heart_rate.HeartRateMeasurementValues.heart_rate, other instance in api, use :noindex: for one of them
#

@slender iron excellent (I guess!). I'm just trying to get the pulse ox library into the bundle because the guide went live

slender iron
#

I wonder if I'm calling it too fast

tulip sleet
#

@idle owl I'm going to do this for now, just to get it to sort of work. I'll file a bug on sphinx eventually.

manic glacierBOT
#

Hi @tannewt I've got it kinda passing the script you wrote (it's been working great so far). However, I do have two questions, first, it didn't pass unless there was no leading whitespace, how does this affect the python examples in the code.

Secondly, the script fails on __init__.c which doesn't have any associated stub files. What should I do about that? It always gets checked last, so I can still go through all of the other files, but I just wanted to check if there's anything I s...

raven canopy
#

@tulip sleet catching up on the scroll-back; i took most of the day away from the PC.

the namedtuple alias thing is certainly annoying. like Kattni said, we dug into it, and the 3.x "fix" was the error getting thrown. there is an issue about the alias fields though: https://github.com/sphinx-doc/sphinx/issues/7353
i did try building with the workaround mentioned in the issue, but my notes (DMs w/Kattni) said it failed; i just don't remember why.

tulip sleet
#

@raven canopy thanks, I found that workaround, but it's from 2015. There may be some other way. I might submit a new issue because of the index warnings, which are more trouble (since we treat them as errors). I made it into a bulleted list for now instead of using attribute. Apparently CPython may generate those useless docstrings. I would like any supplied docstring to override those for namedtuples.

raven canopy
#

huh. it does appear that CPython creates the aliases...

>>> bar = namedtuple("bar_tuple", ("foo", "bar", "baz"))
>>> help(bar)
Help on class bar_tuple in module __main__:

class bar_tuple(builtins.tuple)
 |  bar_tuple(foo, bar, baz)
 |
 |  bar_tuple(foo, bar, baz)
 |
 |  Method resolution order:
 |      bar_tuple
 |      builtins.tuple
 |      builtins.object
... methods removed ...
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  foo
 |      Alias for field number 0
 |
 |  bar
 |      Alias for field number 1
 |
 |  baz
 |      Alias for field number 2
slender iron
#

@tulip sleet I think the host controller is changing behavior because we're responding faster

#

and tinyusb is assuming we can handle the tx complete interrupt before the next setup packet arrives

tulip sleet
#

do you want to bring this up with Thach?

#

We could have him debug this with lower_power

slender iron
#

ya I'll ask him about it

tulip sleet
#

is it also dependent on the chip periph? Why don't we see this on SAMD51 or nrf, for instance?

slender iron
#

I think xobs is seeing the same on '833

tulip sleet
#

aha, ok

slender iron
#

the SAMD51 may be fast enough to handle the tx complete before the next setup packet

tulip sleet
#

i can try on an 840 also

slender iron
#

I think we're responding faster to the string descriptor fetches which is making the host assume we're fast

tulip sleet
#

'840 seems OK, so the SAMD21 is really the test

slender iron
#

are you trying with a debugger?

#

there may be tinyusb asserts that fail with asm("bkpt")

tulip sleet
#

no, I can do that

simple pulsar
#

For displayio has there been any discussion on the Labels for being able to choose different gravity/justification? I'd like to be able to do top left positioning.

tulip sleet
#

do i need to compile DEBUG to enable the asserts?

slender iron
#

that I don't know

raven canopy
#

@tulip sleet there is an older CPython issue about this as well. not much movement on it though. seems the most effective workaround (applies to Sphinx and CPython help) is to subclass namedtuple, and supply the desired docstring. but then...might as well just write it as a class. :D
https://bugs.python.org/issue16669

#

not trying to interrupt debug; can be dealt with later

tulip sleet
#

no prob; i am time-sharing

#

also trying to make a Staples order πŸ™‚

raven canopy
#

hehe. ISRs everywhere!

tulip sleet
#

@slender iron I see no bkpt asserts either way on '840, but that doesn't mean xobs isn't seeing them. But I'm glad it's reproducible for you. I think Thach can help us.

#

taking a break now

slender iron
#

kk, thanks!

#

I'm curious if the tinyusb examples have the same problem

manic glacierBOT
#

One approach considered by the Covid Watch distance estimation team is separate consideration of RSSI based on the channel the advertisement came in on. The Covid Watch anonymous exposure notification app needs to make good exposure estimations. CircuitPython is used with small boards for experiments and testing.

The change would be in _bleio.

Perhaps _bleio.ScanEntry could have a new property called channel. It might be obtained from this (as suggested by another):

https://infocent...

marble hornet
#

what is the difference between py/runtime.h and py/runtime0.h ?

tulip sleet
#

@marble hornet that's a good question; I haven't figured out why both exist

marble hornet
#

maybe it's like coke vs coke0 πŸ˜‰

raven canopy
#

a quick diff was not very helpful. but runtime0 is included with 4 files in py/.

tulip sleet
#

if you grep for either's inclusion in various files, there are a lot of examples, and I don't detect an obvious rhyme or reason. I looked at the micropython issues and PR's and also didn't come up with an explanation

#

the redundancy bothers me

marble hornet
#

i'm attempting to write a module based on the extending circuitpython guide. in the shared bindings the bindings include an __exit__ method but i don't see the __enter__ method defined . the comments say it is made via a "Provided by context manager helper." but i don't see where it is used

#
//|   .. method:: deinit()
//|
//|      Deinitializes the Meaning and releases any hardware resources for reuse.
//|
STATIC mp_obj_t tinydisplay_tinytft_deinit(mp_obj_t self_in) {
  shared_module_tinydisplay_tinytft_deinit(self_in);
  return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(tinydisplay_tinytft_deinit_obj, tinydisplay_tinytft_deinit);

//|   .. method:: __enter__()
//|
//|      No-op used by Context Managers.
//|
//  Provided by context manager helper.

//|   .. method:: __exit__()
//|
//|      Automatically deinitializes the hardware when exiting a context. See
//|      :ref:`lifetime-and-contextmanagers` for more info.
//|
STATIC mp_obj_t tinydisplay_tinytft_obj___exit__(size_t n_args, const mp_obj_t *args) {
  shared_module_tinydisplay_tinytft_deinit(args[0]);
  return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(tinydisplay_tinytft___exit___obj, 4, 4, tinydisplay_tinytft_obj___exit__);
tulip sleet
#

so it's provided by the superclass?

#

Display?

marble hornet
#

it doesn't subclass anything

tulip sleet
#

or there's a default __enter__() which doesn't do anything

raven canopy
#
 { MP_ROM_QSTR(MP_QSTR___enter__), MP_ROM_PTR(&default___enter___obj) }

trying to find where the default __enter__ is.

tulip sleet
#

when you enter a context manager

#

bingo

marble hornet
#

ah

raven canopy
#

also, it looks like runtime0 is the result of some refactor...

#

maybe unfinished?

tulip sleet
#

do you have a PR #?

marble hornet
tulip sleet
#

it's from 2018, so it may be outdated

raven canopy
marble hornet
#

okay:

#

here is what i tried SRC_SHARED_MODULE += tinydisplay/__init__.c tinydisplay/TinyTFT.c

#

and i am getting this error

#
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
make: *** No rule to make target `shared-module/tinydisplay/__init__.c', needed by `build-pyportal/genhdr/qstr.i.last'.  Stop.```
#

rule?

tulip sleet
#

I would say mostly ignore that guide, and just look at an existing module, and model what it does

#

makefile rule

#

what existing module is similar to this?

marble hornet
#

oh, noted. should it be worth taking the guide down? or a warning at the top? and it will be a procedural display library, like the python rgb_display but in c

#

so i'm not totally sure. i'm just trying to get methods and properties working on an object

tulip sleet
#

which native module is this most simlar to? maybe the new RGBMatrix? (I don't mean in the details, but the purpose).

#

i'll add a red warning to that guide

marble hornet
#

looking to see which it would be most similar to...

#

i'm drawing a blank, displayio is kind of close in that it lets a user control the screen

tulip sleet
#

do you have port-specific code, or can it all be in shared-module?

marble hornet
#

it should all be in shared module

tulip sleet
#

does it need to live across VM instantiations? E.g., are you showing the REPL or something like that?

marble hornet
#

no, it won't need to

tulip sleet
#

_pixelbuf is straightforward (even if it is an _ module). See where that is added, turned on and off, etc.

#

it is only shared-module, no common-hal

#

emulate that. Search for where it's mentioned in the makefiles, etc.

marble hornet
#

ah /py/circuitpydefns,mk

#

for starters . thank you

tulip sleet
#

i refactored all that a while ago. I didn't really know about that guide. I've put a warning on it.

#

ok, πŸ’€, good luck!

marble hornet
#

sleep well. thank you (i think it is working! )

manic glacierBOT
slender iron
#

@gentle bronze you around?

gentle bronze
#

@slender iron yup

slender iron
#

We found a weird issue on samd21 in my lower power branch. Let me go up to my computer

gentle bronze
#

ok

slender iron
#

kk, so I think the issue is that we're calling tusb_task more frequently than before

#

its weird because trcpt and setup received bits are set

#

I can only repro it with an intel system too

#

my macbook and ryzen pcs are ok

#

but my intel nuc has issues

gentle bronze
#

it is different, the nuc120v is more difficult to work with, I couldn't get it running on my board at all. majbthrd could get it running on his dev board (different one) though.

slender iron
#

right, different nuc πŸ™‚

#

dan sees it have after set configuration

#

mine stops after get string descriptor

gentle bronze
#

hold on, I am checking out your tree to test with.

slender iron
#

k, I'll try with a tinyusb example

gentle bronze
#

and use jlink rtt viewer for the log, that hopefully would not intefere with the timing.

slender iron
#

looks like it worked ok

#

and it's running even faster than circuitpython is

gentle bronze
#

building for metro m0

#

@slender iron I didn't follow low power issue, could you sum up the major modification it does πŸ™‚

slender iron
#

we switch timekeeping from systick to the RTC

#

in samd21 that meant we run gclk2 faster than before

#

we also always call tusb_task instead of at a 1 ms-ish interval

#

sleeps should actually sleep by calling wfi

gentle bronze
#

πŸ‘ πŸ‘

slender iron
#

let me know if you can reproduce it. I was happy I could earlier

gentle bronze
#

I am able to reproduce it, it stall every request after the first device descriptor, very consistent

slender iron
#

great! that's the first step

gentle bronze
#

It must be late for you, please take the rest, I will do a bit of bisect to catch up with the low power changes first

#

then try to narrow down the issue πŸ™‚

slender iron
#

πŸ™‚ will go watch tv soon

#

I'm in seattle so it's only 10pm

gentle bronze
#

great, though it is still late. I will get you updated if I could figure out something.

slender iron
#

πŸ˜„ thanks!

gentle bronze
#

no problems πŸ™‚

manic glacierBOT
gentle bronze
#

@slender iron btw, do you know from which commit the issue occurs

slender iron
#

no I don't unfortunately

gentle bronze
#

no problems, I do a binary search πŸ˜„

slender iron
#

it's probably worth looking at which commits are in the samd directory

#

since many of them will be for others

gentle bronze
#

ok

#

good suggestion

slender iron
#

I can help too

gentle bronze
#

it is OK, I could narrow it down for several trials:)

slender iron
#

I get a bit further if I do: ```
// Handle SETUP packet
if (USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.bit.RXSTP)
{
// This copies the data elsewhere so we can reuse the buffer.
dcd_event_setup_received(0, _setup_packet, true);

USB->DEVICE.DeviceEndpoint[0].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP | USB_DEVICE_EPINTFLAG_TRCPT0;
return;

}

#

yup, that seems to fix it for me

#

based on one trial πŸ™‚

#

ok tv time. thanks @gentle bronze !

gentle bronze
#

great finding, I will double check it with manual, and update tinyusb if needed

gentle bronze
#

I tried but it doesn't fix the issue, samd doesn't reponse correctly, I will do more check

#

basically, samd response with device descriptors contents for all the GET_DESCRIPTOR request (string/configuration etc ...)

plucky flint
#

Morning @here - today is MicroPython's 7th birthday. I can't think of a nicer way to celebrate than to publicly thank Damien for all his friendliness, extraordinary effort (lots of that) and technical excellence. e.g. I just tweeted this: https://twitter.com/ntoll/status/1255412859435126785 Thanks, and apologies for the loud "PING" in this channel.

Today is @MicroPython's 7th birthday. πŸŽ‚

Please join me in thanking Damien et al, who run this amazing project. My work with MicroPython has been some of the most friendly, fun & rewarding of my career.

How about you? Share your MicroPython positive story to celebrate!πŸ”¬πŸβ€οΈ

manic glacierBOT
onyx hinge
#

@ionic elk stm32 and timer/counters question. I'm working on rgbmatrix/protomatter for stm32f405 feather. Is statically allocating TIM6, the "other" timer with no associated PWM pins, reasonable? Any hints for debugging my register setup of the timers? I feel like I am more in the "cargo cult" stage of trying to get this to work, than the "understanding it" phase, and it's been frustrating me for a bit of time now. I can share my WIP code with you if it's helpful.

#

between not being familiar with stm timers and not quite grasping how protomatter needs to use them it's been vexing me and I'm not making progress.

manic glacierBOT
ionic elk
#

@onyx hinge You'll be competing with RotaryIO, which will also need an unallocated timer and I had using TIM6, though I haven't progressed very far on it. It seems we're outstripping these "unallocated" timers - what we might need is some kind of intermediary that has a list of low-priority timers it can check and dynamically allocate.

#

STM32 basic timers like TIM6 and TIM5 are further complicated by not being fully represented by the stm32 HAL (presumably because they're not really intended for "timer" use but more for DAC stuff?). You have to manually go in and implement on the register level via the reference manual. And if you ever switch to a general purpose everything changes and you have to rewrite.

onyx hinge
#

I have a whole raft of pins, I could later change to use a timer that is related to one of those pins I guess

#

I actually do have my interrupt executing now, yay.

slender iron
#

It'd be good to add a generic way to grab a free timer. Many chips don't have basic ones

#

@gentle bronze any insights on my usb issues?

gentle bronze
#

@slender iron yeah, it is a race condition with setup packets, I have a solution, only need to check with manual a bit more

slender iron
#

ya, seemed like a setup packet was catching up to OUT completion

gentle bronze
#

yeah, it is right after the out, causing missing setup, though the event still registerred and dcd duplicate the old setup packet as new. Should be a quick fix, just a bit more reading

onyx hinge
#
$68 = {ptr = 0x2001f3a0, length = 3168}
``` Is the stm stack smaller than the "usual" stack?  I am hitting `reset_into_safe_mode (reason=HEAP_OVERWRITTEN)` a lot.  The stack at the time this occurs looks "sane, but full".
#
ports/nrf/mpconfigport.h:#define CIRCUITPY_DEFAULT_STACK_SIZE            0x6000
ports/atmel-samd/mpconfigport.h:#define CIRCUITPY_DEFAULT_STACK_SIZE                (24*1024)
ports/stm/mpconfigport.h:#define CIRCUITPY_DEFAULT_STACK_SIZE            ((uint32_t) &_ld_default_stack_size)
``` I can sort of tell that the stm approach is trying to do something allowing the default stack size to be in the linker file .. but it's a wildly smaller stack than nrf and samd...
slender iron
#

what board are you on?

onyx hinge
#
ports/stm/boards/STM32F405_default.ld:_minimum_stack_size = 2K;
#

the stm feather (f405)

slender iron
#

I thought the stack was dynamically sized

#

the .ld stuff is just to make sure we have a minimum size

onyx hinge
#

(gdb) p next_stack_size
$72 = 2048

#

static uint32_t next_stack_size = CIRCUITPY_DEFAULT_STACK_SIZE;

#

right now it's also being used as the default "next stack size"

slender iron
#

that's pretty small πŸ™‚

onyx hinge
#

I can chuck an issue in github, add a workaround in my boot.py, and probably get on with things. Mind if I do?

slender iron
#

you can just increase it πŸ™‚

#

even samd21 is 4096

#

samd51 is 24*1024

#

it'd be cool to move it to CCMRAM which is 64k

onyx hinge
#

I think I need to avoid getting side-tracked, I'm at 1 week with nothing to show for my rgbmatrix port to stm 😦

slender iron
#

totally

#

(but don't worry, you are learning a new platform)

simple pulsar
#

@onyx hinge I raise you, two days spent just drawing plots of a rather simple passive filter.

onyx hinge
#
86        if (current_safe_mode > BROWNOUT && reason > BROWNOUT) {
(gdb) where
#0  reset_into_safe_mode (reason=HARD_CRASH) at ../../supervisor/shared/safe_mode.c:86
#1  0x0802f2a8 in HardFault_Handler () at supervisor/port.c:244
#2  <signal handler called>
#3  0x0803088e in allocate_stack () at ../../supervisor/shared/stack.c:61
#4  0x0bff133a in ?? ()
``` well that didn't go so well
manic glacierBOT
#

Due to hitting the stack overflow error, I noticed that the stack size is much smaller (2kB) than nRF, samd51 (24kB).

My particular code is work in progress RGBMatrix, so the stack-overflowing code is not something that you can easily reproduce.

I tried increasing it to 0x6000 (24kB) by boot.py:

supervisor.set_next_stack_limit(0x6000)

but this leads to crashing errors! 0x2000 works, and I don't get the errors anymore. However

  • default stack size shoul...
onyx hinge
#

OK, moving on/back

manic glacierBOT
lucid solar
#

@slender iron esp32s2 port is going to be quite hard, there's a lot of linking config we need to sort out. I believe I know why it was crashing the linker now, we were not including some .ld files that it needs...so I think it was confused how big some sections were and that caused some crash.

manic glacierBOT
lucid solar
#
-L/Users/mark/src/esp-idf/examples/get-started/blink/build/esp-idf/esp32s2
-Tesp32s2_out.ld
-uapp_main
-L/Users/mark/src/esp-idf/examples/get-started/blink/build/esp-idf/esp32s2/ld
-Tesp32s2.project.ld
-L/Users/mark/src/esp-idf/components/esp32s2/ld
-Tesp32s2.peripherals.ld
manic glacierBOT
tulip sleet
#

@ionic elk I removed the ld-defined minimum stack size in the atmel and nrf ports when I parameterized .ld files. There may be an inconsistency in the stm port.

manic glacierBOT
#

I recently added a dfu-flash option to STM32 in #2819. Other ports that support it include NRF with a dfu-flash and the cxd56 which has custom flashing with their ".spk" file.

This seems like something where there's going to be some natural port-level implementation differences. STM32 has the built in dfu bootloader that is always accessible and thus makes the most sense as the default flash command, compared to atmel and NRF which have an easier time fitting in a UF2 bootloader since i...

onyx hinge
manic glacierBOT
ionic elk
#

@slender iron by the way, I wrote a bunch of implementations for rotated rectangles and images when I was working on ExpressionEngine. Is that something you might be interested in having in DisplayIO someday?

manic glacierBOT
manic glacierBOT
#

Hi @tannewt I've got it kinda passing the script you wrote (it's been working great so far). However, I do have two questions, first, it didn't pass unless there was no leading whitespace, how does this affect the python examples in the code.

By removing the whitespace you are making it so the script doesn't include it in the .pyi file. (You can see the results in the circuitpython-stubs directory.) So, you aren't fixing it, you are removing it from the process.

Secondly, the ...

#

@tannewt

dherrada@dherrada-MacBookPro:~/adafruit/stubs/circuitpython$ python3 tools/extract_pyi.py shared-bindings/busio circuitpython-stubs/
circuitpython-stubs/busio.pyi
Traceback (most recent call last):
  File "/home/dherrada/.local/lib/python3.6/site-packages/astroid/builder.py", line 168, in _data_build
    node = _parse_string(data)
  File "/home/dherrada/.local/lib/python3.6/site-packages/astroid/builder.py", line 446, in _parse_string
    node = _parse(data + "\n", type_...
#

@tannewt

dherrada@dherrada-MacBookPro:~/adafruit/stubs/circuitpython$ python3 tools/extract_pyi.py shared-bindings/busio circuitpython-stubs/
circuitpython-stubs/busio.pyi
Traceback (most recent call last):
  File "/home/dherrada/.local/lib/python3.6/site-packages/astroid/builder.py", line 168, in _data_build
    node = _parse_string(data)
  File "/home/dherrada/.local/lib/python3.6/site-packages/astroid/builder.py", line 446, in _parse_string
    node = _par...
gentle bronze
slender iron
#

nice! I was thinking it might be due to delaying the interrupt handling

gentle bronze
#

it is hardware race condition, samd doesn't have an way to NAK setup, it will just always acked. We need to ready the buffer at anytime.

slender iron
#

I didn't think the usb spec allowed NAKing a setup

gentle bronze
#

I actually make the race worse when doing the last clean up, by moving the setup prepare after the status complete. But it must be before queueing the last status (both IN and OUT status)

slender iron
#

right, if the assert didn't catch it first

gentle bronze
#

ah, I mean a way to not acked and discard setup. normally other mcus has special sram/pointer to store setup

#

anyway, the samd controller is very fast in this regard πŸ™‚

slender iron
#

right, that makes more sense

ionic elk
slender iron
#

@ionic elk sure

gentle bronze
slender iron
#

@gentle bronze ya, looking now. is it always a ZLP?

gentle bronze
#

the status is always ZLP and has opposite direction to the setup[0]'s bit7

slender iron
#

kk

#

I'm testing it now

#

works!

gentle bronze
#

yeah πŸ₯³

#

merged now, please bump it up. time to πŸ’€

slender iron
#

Yup! will do. Thanks again!

gentle bronze
#

no problem, I am happy to help πŸ™‚

#

see you later πŸ™‚

slender iron
#

good night

#

@tulip sleet USB should be working in lower_power now. I think I have two boards I need to find space for

tulip sleet
#

excellent! I'm still working on PacketBuffer and its vagaries with connection handles. It has been painful.

#

the connection handle is not easily found. I saw how you cached it and thought I could get it from the service, but that doesn't work for local services

slender iron
#

what do you need it for?

tulip sleet
#

and there is no "read" evt, so we couldn't get it if the client is just reading

#

I needed the connection handle to get the mtu for packet length

slender iron
#

there is a way to inject yourself in a read

tulip sleet
#

yes, I know about that (authorize stuff), but I hoped to avoid that

slender iron
#

k, that's all I know of

#

what use case just does reads and needs packetbuffer?

tulip sleet
#

ble_midi_simplein, for example

slender iron
#

midi should only be using notify and write

#

it does do a read at the beginning but it's not critical I believe

tulip sleet
#

the characteristic assigned to packetbuffer is notify/read (remember my "pathological" remark?)

#

it just has to do with the buffer setups in the MIDI service

slender iron
#

right, the read is just for a single read at the start

#

not for the actual midi packets

tulip sleet
#

so the packet size for that read is always below MTU?

#

even if MTU is 20?

#

i thought it was using the same characteristic bidirectionally, either for sending midi notes (et al) or receiving them

slender iron
#

it is bidirectional. write and notify are opposite direction

tulip sleet
#
def __init__(self):
        super().__init__(
            properties=Characteristic.WRITE_NO_RESPONSE
            | Characteristic.READ
            | Characteristic.NOTIFY,
#

for _MidiCharacteristic

slender iron
#

right. the read is only for the initial read

tulip sleet
#

so "a packet that has no payload" is going to be <= 20 bytes?

slender iron
#

it is empty

tulip sleet
#

i thought it had headers?

#

ok, so they mean really completely empty

slender iron
#

packets usually have a header byte but this packet is empty

#

I'm not sure any implementations actually check it's contents

tulip sleet
#

the current MIDI code does this in __init()__:

        self._in_buffer = bytearray(self._raw.packet_size)
        self._out_buffer = None
#

but we don't know packet_size without knowing the MTU, so I rewrote it to delay creating this buffer. I see that you adjusted the size by re-checking .packet_size, so maybe you were assuming it might be too small and then grew it as necessary. There were other services (e.g. heart rate, iBBQ), where I just called packet_size once in __init()__, and I now defer creating the buffer until connected

#

I will have some draft PR's for those

slender iron
#

sure, that's fine

#

it can change

tulip sleet
#

anyway, I got waylaid because I thought the service had the connection handle, which it doesn't unless the service is remote, because there's no way to find out the connection handle for a local service with a connection. You have to spy on it like you did in PacketBuffer. I wondered why I didn't run into this in CharacteristicBuffer, but it's because I never implemented writing.

#

service->connection is null for local services even if connected

slender iron
#

CharacteristicBuffer doesn't try to be exclusive to a single connection

tulip sleet
#

gatts write doesn't care what the conn_handle is, but notify/indicate do

#

yeah

slender iron
#

ah right, doesn't characteristicbuffer just notify on every connection?

manic glacierBOT
tulip sleet
#

it only implements read, not write or notify, so it never ran into this problem

#

all it does is get notified

#

it doesn't send out notifications

slender iron
#

kk. that must be how the general set value for notify works

tulip sleet
#

but PacketBuffer does

slender iron
#

right

tulip sleet
#

sd_ble_gatts_hvx() needs a real connection handle, but sd_ble_gatts_value_set() doesn't care about the connection handle unless it's writing a CCCD

timber mango
ionic elk
#

it looks like a pretty neat board

#

It'll be cool to try running some really crazy displayio stuff and see how it goes.

#

Though... that means I'll have to get displayio enabled for the H7

slender iron
tulip sleet
#

i forgot about that. so packet buffer could do the same thing, instead of caching the conn_handle

manic glacierBOT
tulip sleet
#

did you consider doing that, instead of grabbing the conn_handle on certain events in PacketBuffer?

slender iron
#

I didn't want to do that because it feels like the wrong model because midi is one to one in my mind.

tulip sleet
#

i'll leave it alone for now. I don't know if BLE MIDI is meant to support fanout to write-only devices, but from the spec, it sounds like not (like the single read packet)

slender iron
#

kk, time for a run

thorny jay
#

I'll contact the maker/vendor (8086.net) but I have a strange behaviour with the Commander board. Mu does not find the serial interface. However, if I use device manager to find the serial port, then use Putty to access COM26, I have the REPL.

#

Any idea?

#

That sound like a Mu problem. But it works on this computer with every other board I have (all Adafruit).

tulip sleet
#

Mu looks at hte USB PID/VID to see if it's a board it can talk to

thorny jay
#

So when new board appear...

tulip sleet
#

for Adafruit boards, it just checks the VID (Vendor ID).

#

What is the VID/PID for the Commander board?

thorny jay
#

I might need to boot in Linux for that... dunno how to do it in Windows.

tulip sleet
#

the check for only the Adafruit VID (as opposed to particular PID's) is relatively new

#

you can look at the properties in Device Manager

#

what version of Mu are you using?

thorny jay
#

\VID_3171&PID_0101&MI_00\6&1f2d2266&0&0000

#

1.1.0.alpha.2 (I need to upgrade).

tulip sleet
#

that already has the adafruit VID-only check

thorny jay
#

I upgraded the bootloader and CP.

tulip sleet
#

but the Adafruit VID is 0x239a

#

here the VID is 0x3171, and Mu doesn't know it

#

you can hack mu to add it

thorny jay
#

The VID/PID is in the bootloader?

tulip sleet
#

no, when CIRCUITPY is running (actually both, but Mu doesn't care about the one for the bootloader)

thorny jay
#

There are only a handfull of Commander (there was 5 in stock and it is brand new). I already aquired great stuff from 8086.net, so I felt like I should support and spend on this "unique" device.

#

I have a working solution with Putty.

#

I'll share this conversation with the maker, he might want to ask Adafruit for a VID/PID or check with Mu?

tulip sleet
#

he paid for 0x3171 already

manic glacierBOT
#
[adafruit/circuitpython] New branch created: 5\.3\.x
tulip sleet
#

@thorny jay you can add the board to mu/modes/base.py

#

i'm a little confused about the list there; there's also adafruit.py, which has the wildcard entry

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 5\.3\.0
tulip sleet
#

ah no, add it to modes/circuitpython.py

#

i was looking at old code

orchid basinBOT
onyx hinge
#

@tulip sleet @slender iron is there something that needs to be done for board sorting due to me releasing 5.3.0? I am still fuzzy on that.

tulip sleet
#

the download counts are all zero to start, and we have to update them by hand. with zero counts, they show up in reverse alphabetical order, I think

#

I haven't started owrking on that yet. You could add fake download counts to sort them alphabetically or something. "Adafruit" comes conveniently at the beginning of the alphabet

#

maybe it should be fixed so that they show up in alphaetical order if the counts are zero

#

for now

ionic elk
#

@slender iron can I get an openMV-H7 PID?

thorny jay
#

@tulip sleet Yes, you made it... it works now. I will try to make a PR for Mu. Thank you so much.

tulip sleet
#

@ionic elk limor maintains the file of the PIDs. She pushes to an internal repo periodically, but it's probably best to ask her

#

I periodically refresh that to add a bunch of empty slots

ionic elk
#

Ok, sure. I don't know the workflow there, I just know it's usually Scott who posts the VID/PID collection for people.

#

@meager fog could I get an openMV-H7 PID?

tulip sleet
#

maybe send her an email or open an issue so she can queue the work. She could pass it to me too but she's pushing to that repo all the time

#

open a circitpython issue

#

and assign her

onyx hinge
tulip sleet
#

I;m afk for an hour or so

idle owl
#

@tidal kiln This issue: https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/issues/11 doesn't make sense on this library anymore, as the solution appears to be changing the Group full message, which isn't generated by the library. Dan created another issue referencing it on CircuitPython - am I ok to close this one?

#

Or should I leave it until the issue is resolved?

manic glacierBOT
idle owl
#

@slender iron Where are we at with pixelbuf? Asking as I'm going through lib issues and some are related or potentially resolved by pixelbuf, and I'm not sure of the status.

onyx hinge
slender iron
#

@idle owl @tidal kiln should be reviewing NeoPixel_SPI which has an open PR to update to newer pypixelbuf

#

@onyx hinge ya, fine with me

idle owl
#

Ok thanks

manic glacierBOT
#

This PR adds basic pin and clock definitions for the OpenMV-H7 board. The OpenMV-H7 is a development board for embedded machine vision using the STM32H743 processor. More information about the project can be found on on the website, OpenMV.io.

This PR is naturally a little anemic for the scope of the OpenMV project, since it doesn't support the board's primary feature, the OV7725 Camera. OpenMV as supported with Micropython is an expansive project that actually uses ...

tidal kiln
#

@idle owl yah, i'd say leave it open until the other issue is resolved. if that one results in changes that will work for also fixing the issue in Display_Text then can close it

idle owl
#

@tidal kiln Ok.

tidal kiln
#

looks like the issues have been cross referenced?

manic glacierBOT
idle owl
#

@tidal kiln They have.

timber mango
#

Though... that means I'll have to get displayio enabled for the H7
@ionic elk This is a good thing, right? πŸ˜‰ I am looking forward to doing some crazy stuff with this too, especially for robotics. πŸ™‚

tidal kiln
#

cool. is there a pressing need to close it?

manic glacierBOT
idle owl
#

@tidal kiln No, I'm cleaning library house basically. It's welcome to stay open, but if it could be closed, I wanted to close it. Trying to clear out some of the longstanding issues, but there are many that cannot be closed still. So it is what it is.

slender iron
#

any objections to me turning off bitbangio in the specialty cpx builds? we need to turn pixelbuf on to make the upcoming frozen neopixel useful

idle owl
#

No. Do it.

slender iron
#

πŸ‘ also means my lower power stuff will fit

idle owl
#

Also good.

tidal kiln
#

@idle owl ^^ fyi

slender iron
#

ok, awesome!

idle owl
#

@tidal kiln cheers.

timber mango
#

I am also getting a few display featherwings. I want to see if I can add multi-display support to the HT16K33 library for the alphanumeric and 7-segment displays. I could not quite fit the matrix displays into my Digi-Key order though because priorities.

ionic elk
#

@timber mango it shouldn't be tough to get displayio into the H7. The only reason it isn't already in is because DisplayIO by default requires PWM, which requires timers, which have some significant differences on the H7 series. But I think I can just turn it off with a flag, it's been a little while since I worked with it.

#

I agree it'd be a nice feature to have since powerful LCD capability is probably one of the top use cases for a chip that overpowered alongside camera work and DSP.

timber mango
#

I agree it'd be a nice feature to have since powerful LCD capability is probably one of the top use cases for a chip that overpowered alongside camera work and DSP.
@ionic elk Overpowered is good! πŸ˜‰ I am very excited about the Toasty board! I see a lot of possibilities for this board in my projects. It is breadboard friendly too! πŸ˜‰

#

I wish I had been able to fit a couple of nice TFT displays into my order.

manic glacierBOT
bright aspen
#

I'm a little confused about crypto. I can see things are happening, perhaps with the cryptography library. Is all of cryptography being added, or just parts. Will it be broken into pieces?

manic glacierBOT
slender iron
#

@bright aspen definitely pieces so that we can enable/disable based on the board

#

xobs has a PR for AES currently

copper crescent
#

@thorny jay I added a PR a month ago to add commander support to Mu but not heard anything yet.

thorny jay
#

Oups. I did not check. So I made a duplicate...

#

@copper crescent Any plan in enhancing your documentation. I have tested most part using Adafruit documentation. I could write some stuff, like a bigger demo.

#

My commander run the lattest CP and lattest bootloader. So far, so good.

copper crescent
#

@thorny jay yes, I'm planning a week off the dayjob to try and catch up with things like that. :)

manic glacierBOT
ionic elk
#

@slender iron what is the official name of the driver software for the i.MX series? Does it have a manual somewhere?

slender iron
#

not that I know of. I usually just look through the source and data sheet

manic glacierBOT
#

I'm finishing up the process of releasing a high performance RPC library for the OpenMV Cam. This lets you use all the interfaces on the board to move large data structures (images or whatnot) at high data rates. For example, the library lets you call a function on the camera, pass a unlimited length (e.g. 2^32-1) byte struct to the camera, and then get an unlimited length byte struct result.

For example, I have SPI transferring RAW QQVGA RGB565 images between one OpenMV Cam and another at...

marble hornet
#

okay: I am still trying add a new module in c. there continues to be build errors (see below) b/c the module does not have a rule to make it. from what i can see there are three places new module (w/out port specific code) need to be tied in:

  1. py/circuitpy_defns.mk in the SRC_SHARED_MODULE_ALL list and SRC_PATTERNS
  2. py/circuitpy_mpconfig.h for defining the extern _mp_obj_module_t
  3. py/circuitpy_mpconfig.mk for defining the contstant used to turn the module on or off

am i correct in my assessment that these are all the place? where else does it?
if so i am still getting build errors.
@tulip sleet gave me some good pointers to help find this information, these are all the places that pixelbuf is defined that i could find through a search tool but i;m not sure where else to add them.

marble hornet
#

the error is: the display is named tinydisplay and has been tied into the above three mentioned locations```
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
make: *** No rule to make target shared-module/tinydisplay/__init__.c', needed by build-pyportal/genhdr/qstr.i.last'. Stop.

raven canopy
#

@marble hornet can you push your code to a branch on your fork? would be easier to spot any disparities for folks that are up-to-speed on it. (i haven't in a while, but willing to take a look)

marble hornet
onyx hinge
#

@marble hornet you should create that above-named file (relative to the top source directory), as an empty file if necessary.

marble hornet
#

thank you! i'm getting a difference error now! (schrodinger's "yay")

marble hornet
#

where can i find the docs for mp_arg_check_num ? i'm curious what the laster argument is, and why it is often true EX:mp_arg_check_num(n_args, kw_args, 0, 0, true);

#

if there are docs for the inner working ?

raven canopy
#

no docs that i've ever seen. just the source code...

#

for which, there is a lot. πŸ˜„

marble hornet
#

IT"S WORKING !

raven canopy
#

πŸŽ‰

marble hornet
#

and of much code that is sure

#

i have a question about how MP_QSTR work?

#

it seems like sometimes they are only used in one place and not defined as variables

#

is there source code manipulation to turn QSTRs into c char arrays in the background?

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

@hierophect some parts in the nRF52 family, for example, also contain crypto accelerators for certain primitives. For example, AES128.

@tannewt that new library looks like it would be complicated to implement. They decouple modes from algorithms from encryptors from backends. The best example appears to be from https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/#cryptography.hazmat.primitives.ciphers.Cipher:

>>> import os
>>> from cryptography...
marble hornet
#

I am trying to write a getter for a new class (TinyTFT working title). the attribute i want to return is an instance of displayio's displayio_display_obj_t when given as an input it works fine, however the compiler says that is in an incompatible pointer type with an mp_obj_t.
does it need to be wrapped in something?

#
../../shared-module/tinydisplay/TinyTFT.c:11:16: error: incompatible types when returning type 'displayio_display_obj_t {aka struct <anonymous>}' but 'mp_obj_t {aka void *}' was expected
     return self->display;
            ~~~~^~~~~~~~~
../../shared-module/tinydisplay/TinyTFT.c:12:1: error: control reaches end of non-void function [-Werror=return-type]
 }```
#

when it is passed in you heave to get the display itself by getting .u_obj from the argument
args[display_arg_index].u_obj) what is the wrapper that contains the .u_obj?

manic glacierBOT
#

I chime in a bit, since I added a Arduino library supported for ARM CryptoCell CC310 on nrf52840. Unlike AES on all nrf52 which is shard with SoftDevice, CC310 subsystem is separated and available to use, it is more powerful and could do lost of crypto with arm/nordic a.lib . I have used it for computing the ECC DH

https://github.com/adafruit/Adafruit_nRFCrypto

https://infocenter.nordicsemi.com/topic/ps_nrf52840/cryptocell.html?cp=4_0_0_5_5

![image](https://user-images.githubuserco...

#
manic glacierBOT
manic glacierBOT
tulip sleet
#

@marble hornet

i have a question about how MP_QSTR work?
it seems like sometimes they are only used in one place and not defined as variables
is there source code manipulation to turn QSTRs into c char arrays in the background?

#

Yes there is a source code preprocessing step that finds all the QSTR's and generates the appropriate code for them. If you change a QSTR, do a clean make because the dependency checking for QSTR's won't find the changes (or at least it didn't used to)

manic glacierBOT
marble hornet
#

@tulip sleet i was just curious if it was pre-processed or some combination of c features (but i could;t find any from googleing).

solar whale
#

FYI -- I built 5.3.0 after the release yesterday -- the build went fine, but they do not have the 5.3.0 tag -- is that expected?

#

Adafruit CircuitPython 5.3.0-54-g2d7cf4b79 on 2020-04-29; Adafruit PyPortal with samd51j20

#

I pulled from master -- It looks like the released version is the latest commit to the. 5.3.x branch. and I should have just checked out the 5.3.0 tag.... Someday I'll get this straight πŸ˜‰

tulip sleet
#

@marble hornet QSTR stuff is specific to micropython, I think (it's not a general tool). The ideas may have been copied from elesewhere.

marble hornet
#

it's an elegant solution (though these eyes at least.)

#

what does the Q sand for?

tulip sleet
#

🀷

manic glacierBOT
#

In https://github.com/adafruit/circuitpython/pull/2799/commits/b0383f4aff0259b9d3fdcf23aa736fc973b1eff6, I removed PO-Revision-Date from circuitpython.pot template and from all the .po files, and it seems to have worked. I'm not sure if it's going to be restored by some .po tools, but it should help fix some unnecessary merge diffs. I don't see any reason for that field since the file is under source control and its history can be tracked.

raven canopy
#

public reminder: verify that you're using good USB cables. been fighting a sneaky USB bug on RosiePi for over a week when attempting to upload firmware. cable works on multiple computers; assumed it wasn't the issue. came to the end of my research abilities, threw a hail-mary on a different cable...issue solved.

ionic elk
#

I exile haunted cables to the ghost-box

solar whale
#

Life is too short for bad cables ...

ionic elk
#

it has markings of warding to keep the spirits contained

raven canopy
#

i mean, the RPi is the only one that has issue with it. it still has capability. this is an old motorola cable, which are quality in my experience. (granted, all of that belief is what got me here in the first place. πŸ˜„)

onyx hinge
#

sounds like they wouldn't want to change their software to omit that data

manic glacierBOT
tulip sleet
#

@onyx hinge could we just remove it from the commited files? does weblate get upset if it's missing, or does it just restore it?

onyx hinge
#

it'll put it back every time, I think

tulip sleet
#

that's ok, if we just remove it before the commit

#

i think that would save useless diffs

onyx hinge
#

it's weblate that creates the PR, and I think if a human adds commits on top outside of the weblate service they get stomped on

tulip sleet
#

I just did this once : sed -i '/^"PO-Revision-Date:"/d'

#

oh, i didn't realize it created its own commits

onyx hinge
#

right, the idea is to use this web service to make it easier for community to contribute localizations

slender iron
#

@onyx hinge do you want to merge 5.3.0 for the website or should I update the download count for it?

onyx hinge
#

@slender iron oh I thought I had merged it ☹️ but I most certainly didn't do anything about download counts, because I couldn't figure anything smarter than hand-editing a huge json file and just "nope"'d out of it

#

if you can do it, that would be awesome and I'll owe you for it

slender iron
#

ya, nope is fair

#

dan has the ball rolling for it so I don't mind doing it manually

#

will do it into your PR

onyx hinge
#

you rock, thanks!

slender iron
#

np

onyx hinge
#

oh no wonder I'm hungry, it's lunchtime in the central US

lucid solar
#

I'm hungry as it's evening meal time in CET. But my lovely wife is making fish & mash 🐟 πŸ₯”

#

Can someone explain safemode for me? what causes it to go into it?

tulip sleet
#

CPy goes into safe mode for various reasons. it is a hard reset followed by NOT running boot.py or code.py

#

reasons include: fatal error (e.g. hard fault), power brownout

#
typedef enum {
  NO_SAFE_MODE = 0,
  BROWNOUT,
  HARD_CRASH,
  USER_SAFE_MODE,
  HEAP_OVERWRITTEN,
  MANUAL_SAFE_MODE,
  MICROPY_NLR_JUMP_FAIL,
  MICROPY_FATAL_ERROR,
  GC_ALLOC_OUTSIDE_VM,
  PROGRAMMATIC_SAFE_MODE,
  NORDIC_SOFT_DEVICE_ASSERT,
  FLASH_WRITE_FAIL,
  MEM_MANAGE,
} safe_mode_t;
ionic elk
#

I've always been curious what you can actually do from safe mode. What was the original purpose of it? Can you get it to reveal information about the crash?

#

Or is it just the above enum?

lucid solar
#

@tulip sleet thanks, will look into it after food

manic glacierBOT
slender iron
#

the goal is to give you drive access if your user code gets you into deep trouble

tulip sleet
#

examples: bad user code, a bug in CircuitPython, power sag (we see this on the Trellis M4, for instance: user code turns on all 32 neopixels full blast, which draws too much current from a USB port)

#

there has been discussion of a setting to NOT go into safe mode when there's a power sag, for (example:) proper operation of solar-powered devices

manic glacierBOT
slender iron
#

@onyx hinge website PR has download counts now

slender iron
#

@tulip sleet do we have bootloader updater for nrf?

tulip sleet
#

not yet, thach is working on it

slender iron
#

kk

#

thanks

manic glacierBOT
timber mango
#

I exile haunted cables to the ghost-box
@ionic elk If I prove a cable (any cable) is bad, I cut the connectors off and scrap them. I check the wires for continuity, and If the wire is good, I keep it for future use. Otherwise I scrap that too. I can not have bad or even flaky cables around.

manic glacierBOT
#

I can see the appeal of this when used in a product. Is it feasible this could be added as a build flag?

Note that CircuitPython is not intended for use in a product and we provide no warranty. It's up to a product creator to understand CircuitPython enough supply a warranty to their customers.

If they ship with a custom build of CircuitPython they should call it CircuitPython-compatible and not vanilla CircuitPython. CircuitPython has more meaning than just the code base.

#

@tannewt I don't mean a literal commercial product necessarily, and I don't mean to imply anything by that statement regarding warranty or legality. I think the point here is that removing the automatic terminal display just adds a bit of polish when a project is demonstrated to non-technical users. Even just from an aesthetic standpoint I think this request is valid - if an artist was using DisplayIO for something and doesn't want a bunch of technical output on reboot, is that so unreasonable?

manic glacierBOT
lucid solar
#

@slender iron I'm getting tired, so I've commited and did a draft PR of what I've got so far. I'll come back to it either later tonight or tomorrow.

manic glacierBOT
#

Also, any builds with custom C that is not in this repo of CircuitPython make the build CircuitPython-compatible and not vanilla CircuitPython.

I don't want to weigh in too heavily on this issue, because it is not impossible to insert a custom module, even now. But is the distinction really so important for you? I mean, as soon as you make circuitpython open source, it is not in your hands anymore what others do with it. The question is only how hard you make the modifications.

I c...

tulip sleet
#

@slender iron could i have yet another video chat with you re packet_size?

slender iron
#

yup, got a bit of time now

simple pulsar
manic glacierBOT
#

@v923z I don't think Scott is rejecting the idea, so much as establishing what the labeling guidelines will be if it is implemented and what's considered priority for the sponsored-by-Adafruit team. I'd also be very excited to see C modules supported and I saw it in three Circuitpython 2020s, so I don't think anyone would object to a PR being submitted to align with Micropython's implementation. It's just not high on the list for sponsored folks.

I see "Circuitpython" as a label as importa...

onyx hinge
#

It'll keep for In the Weeds on Monday, but I made good progress with weblate today, and I wonder what should definitely be done before inviting people to use it. "Soft launch" would mean actually asking people on Discord to use it, with the understanding that it might not work out in the end. "Launch" meaning stuff like newslettering and blogging it and being relatively committed to running the service as long as it's bringing in quality translations. Here's my internal list, with the (DONE) tasks being stuff I accomplished today: ``` * enable github auth (DONE)

  • enable pull request creation (DONE, but re-disabled temporarily)
  • enable google Cloud Translation (MT) (DONE)
  • some sort of backups (DONE; digitalocean weekly "system level" backups)
  • make sure we can accept the PRs it generates - (danh's metadata problem)
    ---- soft launch here?
  • Move the github authentication API keys to adafruit organization
  • Move the github PR creation to adafruit organization (adabot?)
  • enable weblate.circuitpython.org via DNS
    ---- launch here?
  • Move the Google Clould Translation (MT) to adafruit organization
    cost: $20 / 1 million characters translated (probably not a lot of $$)
  • Move the digitalocean droplet to adafruit organization
slender iron
#

it adds pypixelbuf as a pypi dep for neopixel

manic glacierBOT
#

Also, any builds with custom C that is not in this repo of CircuitPython make the build CircuitPython-compatible and not vanilla CircuitPython.

I don't want to weigh in too heavily on this issue, because it is not impossible to insert a custom module, even now. But is the distinction really so important for you? I mean, as soon as you make circuitpython open source, it is not in your hands anymore what others do with it. The question is only how hard you make the modifications.
...

#

Yes, the CircuitPython trademark and brand is incredibly important to me. Losing control of what it means to be CircuitPython means that guides, drivers and experiences will not match user's expectations. By being open source, we give others the right to use the code, not the trademark. I outlined more about it here: https://github.com/adafruit/circuitpython#branding

Fair enough. I wasn't trying to fan the flames, and I can definitely understand and respect this standpoint. Thanks ...

manic glacierBOT
onyx hinge
#

@slender iron (I can review that PR but not merge it apparently)

#

(the neopixel one, that is)

slender iron
#

@onyx hinge ya, it's locked down so we don't break folks

#

I can add ya

slender iron
#

Ok! Lower power is merged and NeoPixel on PixelBuf is released!

#

let's see what bugs we find πŸ™‚

onyx hinge
#

:rubs hands together gleefully:

#

now I can do the testing I should have done before the PR was merged πŸ™ˆ πŸ™‰

slender iron
#

and then fix the bugs you find πŸ™‚

lone sandalBOT
manic glacierBOT
#

The set of commands that are handled in terminalio.Terminal() are insufficient for some editor software with an attached display.

In particular, the following commands are desired:

  • Line;ColumnH - move cursor to line, column
  • XX;YYm - set highlighting mode
  • M - scroll up one line
  • Line1;Line2r - scrolling the region between entry Line 1 and Line 2
  • 25h and 25l - cursor highlighting on or off

This additional set of commands will enable a text editor like [robert-hh/Micropython-...

manic glacierBOT
#

Beginning with b3b6a64ed7fb10ffb61bc1b71ba4083bca3ada30, USB no longer enumerates when using Simmel, based on the nRF52833. Reverting that commit fixes USB.

After doing a mass_erase of the internal flash and loading the SD and bootloader, I load firmware.uf2 via USB. The device resets itself, attempts enumeration, and a short time later triggers an assert:

(gdb) c
Continuing.
nrf52.cpu: external reset detected
nrf52.cpu: external reset detected

Program received signal S...
manic glacierBOT
#

That's a very good question. This is on a Windows machine.

It's difficult to move the board between machines, because the power cables are a little fragile. However, I also see errors when I plug it into a Raspberry Pi:

[539218.392350] usb 1-1.4: new full-speed USB device number 5 using dwc_otg
[539218.526172] usb 1-1.4: New USB device found, idVendor=1209, idProduct=c051, bcdDevice= 1.00
[539218.526187] usb 1-1.4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[5392...
lucid solar
#

Does anyone know if there is a way to determine if you're inside the REPL, a script or waiting for "press any key to enter repl"?

manic glacierBOT
#

Do you have an nRF52840 board you can try with the same CircuitPython commit? It would have 6.1.1, unless you went to some effort to upgrade the build. I guess you could try rolling the '833 SD back to 6.1.1, since it appeared to work. I agree that I don't see why that should make a difference.

I successfully tried with a Feather nRF52840 on Windows too, because the CPB has only a 32MHz crystal. The Feather has both 32kHz and 32MHz, which is more typical.

lone axle
#

@lucid solar it looks like accessing __name__ from inside of code.py or another file will return the name of the file. But in the REPL accessing __name__ will raise a NameError

lucid solar
#

@lone axle Thanks, but not quite what I was needing, I want to know this inside of C.

lone axle
#

Ah, I imagine that functionality is backed by C code somewhere, perhaps you could get access to the same info at that layer. I'm not sure how to do that though.

lucid solar
#

Thanks anyway

onyx hinge
#

@lucid solar when at "press any key", the GC heap is deinitialized so MP_STATE_MEM(gc_pool_start) is 0

lucid solar
#

ok, that's probably good enough for what I want. Thanks @onyx hinge

onyx hinge
#

not sure how to tell repl from code.py

lucid solar
#

I have to figure out if I need that...

onyx hinge
#

but you could add code in main.c:run_repl() to set a global and check it

ionic elk
#

@indigo wedge @slender iron I'm trying to help out with the pin claiming issues in the i.MX port but I'm kind of confused by the GPIO bank system. What's the relationship between the actual GPIO banks (GPIO1, GPIO2, etc) and the pad names? GPIO, GPIO_EMC, GPIO_AD, GPIO_SD... I can't find anything in the datasheet or reference manual that explains what the labels actually mean

indigo wedge
#

good question, i don't think there is much relation there, i think they reuse HW blocks from their CPUs and it's some legacy stuff

ionic elk
#

Hmmm gross. I dunno why they use that labelling when it seems like they have perfectly good GPIO blocks right inside

indigo wedge
#

yea it just adds to the confusion

#

their defines are also a bit off IOMUXC_GPIO_AD_01_GPIOMUX_IO15 vs IOMUXC_GPIO_SD_13_GPIO2_IO13

orchid basinBOT
slender iron
#

@ionic elk did you find the mapping between pin and gpio?

idle owl
slender iron
#

@idle owl I thought so but I don't think I've actually tried it

idle owl
#

Ok I'll dig a little deeper then. Thanks.

manic glacierBOT
#

This PR allows the SPI line to be defined as SCK and either MOSI or MISO, removing the requirement for both. It also adds SPI index reservation to the module, meaning that additional SPIs cannot be defined which "poach" the original peripheral, changing its settings and potentially sending erroneous signals over previously configured pins.

Tested on the EVK 1010 and I think it's fine? I don't have a good unidirectional SPI device other than my SSD1306 screen, and I can't get that to work...

ionic elk
#

@slender iron wasn't really a specific issue, more a documentation confusion. Sounds like the answer is "they're using legacy names that don't make sense" which is what it is

slender iron
#

I think the pin naming might be power domain

ionic elk
#

Hmm, I'll look into that

slender iron
#

Β―_(ツ)_/Β―

ionic elk
#

I was asking because I'm looking at implementing pin claiming so I just have to pick some way of sorting GPIO banks

#

But the internal ones are probably fine

slender iron
#

does the gpio handle muxing?

ionic elk
#

I'll have to read about it

#

I might be wrong

slender iron
#

take a look at IOMUXC in the reference manual

ionic elk
#

I'll do that. Real quick can I ask for your help on a git rebase thing? I screwed up the base of my last PR

slender iron
#

totally

ionic elk
#

I made my branch off another branch I was working on instead of master (which I could have SWORN I specifically checked out to not do but hey) and now I need to get these commits onto master

#

but all the rebase tutorials only talk about moving a base forward in history, not backward, so I'm afraid of messing up

slender iron
#

git rebase -i will give you a list of what commits to move over

ionic elk
#

My confusion is what constitutes moving over? I'm in my branch, do I need to make a new one?

#

Basically I'm trying to remove two commits from the start of my branch

#

that are from another branch

slender iron
#

yup, you can edit the list of what to do with -i

#

so you can just delete the first two commits

#

it lists back to the common commit between your current branch and your target I think

ionic elk
#

I'm just getting a rebase noop?

slender iron
#

what command are you running?

lucid solar
#

git rebase -i HEAD~4

#

try that

#

then assuming it opens in vi/nano...just delete the lines that are the commits you want to delete...then save...

#

@slender iron I've got a very weird issue, when in the REPL, it's reading lots and lots of \b (0x08) and I have no idea why

slender iron
#

from the uart?

lucid solar
#

yeah

slender iron
#

what is 0x08 in ascii?

lucid solar
#

\b (backspace)

slender iron
#

is the stlink sending it?

ionic elk
#

@lucid solar that did the trick! Thanks, I'm using that forever now

lucid solar
#

@ionic elk when I learnt it about 2 weeks ago...mind blown!

slender iron
#

@ionic elk do you understand why it worked?

ionic elk
#

Yeah it makes sense to just manually move back by X commits

lucid solar
#

I knew about rebase interactive...just didn't know about deleting commits

ionic elk
#

can't you just use drop? That's what I just did

lucid solar
#

@slender iron I'll get out my logic analyzer...

#

@ionic elk yeah, I forgot about that...

slender iron
#

to move back four commits you can just check out the older commit and make a new branch

ionic elk
#

true but my concern with making new branches is they can't fix already-submitted PRs

slender iron
#

they can be used in a new pr though

#

and if you are fixing something commited you'll want to start with the latest version of master

ionic elk
#

Right, I'd have to close the PR and open a new one. I've done that with git stuff that's gone really wrong but rebasing out a couple commits was all that was needed for this one

slender iron
#

to change an existing PR you can change the branch completely and force push it

#

beware that it makes existing comments hard to find though because they are associated with commits

lucid solar
#

@slender iron weird...the analyzer says it's 0xC9

slender iron
#

does seem like the repl should handle backspace

lucid solar
#

But I shouldn't really be sending it

slender iron
#

are you doing tab completion? maybe the internal autocomplete is trying to use it

manic glacierBOT
#

This PR adds DisplayIO support to the F7 and H7 STM32 families. Should enable some fairly impressive screen use given the large RAM sizes and speeds of these chipsets.

Includes some minor changes to remove DisplayIO's strict dependency on Pulsio. Before, DisplayIO required PulseIO to be implemented as empty stubs but with the CIRCUITPY_PULSIO macro still turned on, which was confusing from a documentation perspective and not especially necessary since it could smoothly default to DigitalI...

lucid solar
#

I'm not doing anything...I don't type anything...

slender iron
#

hrm

#

what is 0xc9?

lucid solar
#

Hmm...I was reading the TX not RX I think...that explains one part of it...

ionic elk
#

@slender iron I think github has some intermediary comment saving. I force push quite a lot, as does @lucid solar, and it preserves previous PR comments despite the history changing. The Zephyr folks actually require all PRs to be a single commit.

slender iron
#

I see the comments in the overview but not in the file diff

lucid solar
#

@ionic elk I always clean my commits....but they don't require a single commit...just clean ones. My last PR had 4 commits for 4 parts of the thing

slender iron
#

my preference is to rebase until making a PR and then merge from then on

ionic elk
#

makes sense

manic glacierBOT
lucid solar
#

@slender iron Something really weird was happening...so I've upgraded stlink on that board and it's working again...not tested the \b thing yet though.

#

It's not sending the \b over the UART itself.

manic glacierBOT
#

I don't think it should be a build flag because then building would be required to change.

I think adding something to boot.py is ok.

However, I don't think it's really necessary. One can show an empty group on the display both in boot.py and code.py very early to minimize when the terminal appears. I don't like the idea of a hard disable because it's helpful to have it appear on crashes.

@k0d I think the debug console is fine at build time because I assume folks are already building...

#

Commands are handled here: https://github.com/adafruit/circuitpython/blob/master/shared-module/terminalio/Terminal.c#L48

I'm pessimistic that we'll have space in the small builds for the extra commands. An alternative would be to implement a second VT100 terminal class in Python that can be loaded as needed.

I only added what was required for the REPL in terminalio.Terminal.

manic glacierBOT
manic glacierBOT
simple pulsar
lucid solar
#

@slender iron the \b is because the HAL_UART_Receive is exiting with HAL_BUSY...it must be some default value or something weird...

#

@slender iron are you streaming in ~2 hours

slender iron
#

@lucid solar yup streaming at the normal time

lucid solar
#

@slender iron will you do esp32 stuff? it could be good for me to switch my brain off from uart for a bit πŸ˜‰ I've made a lot of progress, the only thing to fix is why it's reporting it's busy when it shouldn't be.

slender iron
#

Yup! Went through your changes yesterday and will talk through them today

#

Then going to do pin info

lucid solar
#

ok, cool. The biggest thing I learnt is that some linker files were missing, which I think caused the linker to crash. Just to sumerize πŸ˜‰

slender iron
#

ooooooh! the other way to get it to not crash was to remove gc-sections

#

I should try adding it back

lucid solar
#

Yes...gc-sections stopped it crashing, because it didn't reach as far as it couldn't find the right linker files...

#

Can't explain it right...but gc-sections is good to have enabled

slender iron
#

kk

lucid solar
#

@ionic elk do you know why, after I receive one character with HAL_UART_Receive(&huart, &data, 1, 500) the next time it's called I get HAL_BUSY returned?

lucid solar
#

@slender iron IT WORKS! I can enter the REPL, exit it, reload the script...it all works!!

crimson ferry
#

@simple pulsar I use os.uname().machine quite a bit to adapt to whatever hardware the code is running on. Have you figured out a way to auto-ID SPI devices? I was using input pins but that was very limiting, so now using a manually-edited file to itemize SPI displays, etc.

idle owl
tidal kiln
#

@idle owl i think that's a one liner

manic glacierBOT
idle owl
#

@tidal kiln Do you want to pick it up?

tidal kiln
#

sure. got the stuff right here. i can check and PR real quick.

idle owl
#

@tidal kiln Perfect thank you!

gilded cradle
#

Sorry @idle owl, just saw this. Thanks @tidal kiln.

tidal kiln
#

no worries

idle owl
#

@gilded cradle No worries! Carter's got it

gilded cradle
#

πŸ™‚

tidal kiln
#

@idle owl do you know why the examples are named the way they are? noticing the one named pygamer has nothing to do with pygame - looks like it uses displayio

idle owl
#

@tidal kiln No idea. Feel free to rename as needed. Do a quick search for guides, though they throw an error when code links are broken.

timber mango
#

@slender iron Are you deep diving today?? πŸ˜‰

slender iron
#

@timber mango just started!

tidal kiln
#

@idle owl meh. punting. i have question. responded in issue thread.

idle owl
#

@tidal kiln Ok.

tidal kiln
#

@idle owl and figured out the filename - it's "pygamer" as in the PyGamer, not the Python pygame module πŸ€¦β€β™‚οΈ

idle owl
#

Fair enough πŸ˜„

tidal kiln
idle owl
#

@tidal kiln Bonus.

#

@tidal kiln Checks failed. It's good to merge once it passes.

tidal kiln
#

@idle owl done. i'd say release and close issue.

idle owl
#

Alright thanks.

#

@tidal kiln Done. Thanks so much.

simple pulsar
#

@crimson ferry No, nothing clever I'm afraid, I was just after a basic way to distinguish between CLUE and CPB+Gizmo. I'm currently just checking machine and if I don't find Circuit Playground assuming it's a CLUE.

#

@crimson ferry In my particular case it's reasonable to assume the Gizmo is present if it's a CPB.

timber mango
#

@simple pulsar Does CLUE show up for the CLUE board?

simple pulsar
#

@timber mango Yep, ```>>> import os

os.uname()
(sysname='nrf52', nodename='nrf52', release='5.2.0', version='5.2.0 on 2020-04-09', machine='Adafruit CLUE nRF52840 Express with nRF52840')

crimson ferry
#

As far as I've seen, those .machine strings are descriptive enough to uniquely identify each variant

#

(suspect that's by design)

timber mango
#

@gilded cradle I ordered the displays I need to start working on multi-display support for the HT16K33 based displays. Three each of the 14-Segment and 7-Segment displays. πŸ™‚

#

This is going to be a very interesting project, which will probably touch several sections of the library.

#

I will also be able to add animation support for the 7-Segment displays. πŸ™‚

marble hornet
#

animation on 7-segment?

timber mango
#

animation on 7-segment?
@marble hornet Yes! If you happen to have any of the HT16K33 14-Segment alphanumeric displays Adafruit sells, you could run the animation script I wrote. It allows one to do simple to medium difficult animations on those displays.

marble hornet
#

what kind of animation? like fading ? unfortunately i don't have any 7-segment displays

queen mason
#

Hello people

#

I'm new to hardware programming and I have some questions about Circuitpython/Micropython

#

I recently got some boards to start fiddling and learning, including an Esp32

#

I have been having fun with it using an ultrasonic sensor, I'm using micropython

#

but I am a bit confused with something. As far as I know circuitpython is a version of micropython for Adafruit boards

#

if my esp32 is not from Adafruit, can I use circuitpython?

solar whale
#

@queen mason CircuitPython does not support the ESP32 because it does not have native USB. There is work in progress to support the ESP32-s2

queen mason
#

@solar whale oh ok, thanks!

tulip sleet
#

@slender iron I rewrote .packet_size and related code, and discovered that ... at least first write (and maybe more of the early writes) when doing ble_midi_simpletest.py is/are not actually happening. PacketBuffer.write() used to just return quietly if the conn_handle was INVALID. Now I have it return an error value and shared-bindings raises and error, and it got raised. So the write is happening before intercepting the events that contain the conn_handle.

I'm thinking that maybe PacketBuffer should have a routine that lets you pass in the current connection for it to remember. That would make this easier.

slender iron
#

hrm, interesting

tulip sleet
#

it might just be a race: the client hasn't gotten around to setting the CCCD yet or writing that empty packet

slender iron
#

right

#

will have to think about it Β―_(ツ)_/Β―

tulip sleet
#

could have midi.start(connection) as something required before you start writing. Anyway, can wait until monday if you'd like; I just saw you were still on

manic glacierBOT
#

I have an 833 DK, but I don't see why it could run on 840 but 833. @xobs could you try to flash our stock bootloader on your 833 (best to be DK) with SD 6.1.1 to see if that would works. Since we don't enable SD, it wouldn't be an issue for testing USB with it.

Also it is helpful if you could provide bus capture along with tinyusb log as well by changing CFG_TUSB_DEBUG to 2 and retarget using tu_printf. It is a bit manual now.

@dhalbert do we have any printf debug log via RTT SW...

manic glacierBOT
manic glacierBOT
simple pulsar
#

@crimson ferry I don't know what it's doing but I just ran some code that uses displayio and a gizmo and it runs ok without the gizmo. The only difference is a ~5 second pause somewhere in the initialisation. After that all the code seems to run without any ill effect to my surprise! I'd imagine some of the shapes are doing pointless drawing, just about to see if I can detect the absence.

simple pulsar
#

@crimson ferry I may be wrong about pause, that may just be my application. Possible and probably the gizmo library is just firing off signals "hoping" the gizmo is there.

manic glacierBOT
vast kettle
#

I have been playing a bit with a 2.9" eink screen that uses the IL0373 driver (specifically the GDEW029T5) and it seems to work pretty ok with only minor changes to the examples (swap_rams=True and black_bits_inverted=True), but there is a black border all the way around the active pixels, and it's pretty thick on the 2.9" screen.

#

When I look closer on the smaller 2.13" tri-color (as on the e-ink featherwing) I also see a black border, but it a bit thinner and kind of hidden behind the edges of the screen, so not as noticeable.

#

After a bit of digging, I have found the VBD bits in the CDI command and changing the last byte in the start sequence from x37 to xf7 makes the border white (the light background color the display)

manic glacierBOT
crimson ferry
#

@simple pulsar Yeah, if I'm reading the docs right, that range of st7789 displays don't even have a MISO connection, so they're write-only

manic glacierBOT
low sentinel
#

Hi friends! I'm trying to get this pull request green and the hallowing_m0_express build is failing on GitHub.

253888 bytes used, -192 bytes free in flash firmware space out of 253696 bytes (247.75kB).

is what github says. When I build it locally to try and repro I see

251748 bytes used, 1948 bytes free in flash firmware space out of 253696 bytes (247.75kB).

I don't think I added 1948 bytes of flash demand in this pull request & I'm not entirely sure how to get to the bottom of this. Any ideas?

manic glacierBOT
#
k0d

I'd like to investigate the possibility of using device trees, I've copied in some code from the Zephyr project to test with. So far it's working to read in the flash-size of nucleo_f746zg into mpconfigboard.h.

This is very much not complete, I'd just like some feedback.

@hierophect @tannewt @ladyada @dhalbert @jepler

simple pulsar
#

@crimson ferry BTW, i think you need to power cycle to get rid of the library screen code once its active that will be holding loads of the pins in use even if there's no attached Gizmo. It lasts even when code.py has been interrupted, presumably to keep the screen alive for showing the serial console.

crimson ferry
#

@simple pulsar That's a useful find. I'll look into whether the backlight could be used on standalone displays. Yes, from what I understand, even imports can't be un-imported. I usually do conditional import and setup based on hardware config, but some cases are tough if you have to initialize to detect... at least the runtime code can be skipped, and device objects can possibly be manually de-inited.

#

Looks like there's a resistor-transistor arrangement on the standalone IPS display Backlight pin that may give a useful level for a presence test. I'll wire one up and see.

manic glacierBOT
onyx hinge
#

@low sentinel Without any extra flags, you get an English build of CircuitPython. The CI builds all languages. The first failing language was korean (language code ko): "Build hallowing_m0_express for ko took 14.96s and failed"

#

the CI's build of english had 1948 bytes left just like you saw locally

low sentinel
#

Gotcha. So I guess I'm curious how I bloated the Korean build that much πŸ˜…

manic glacierBOT
#

Thanks for letting me know. I'll work something else out.

On Sat, May 2, 2020, 13:04 Mark Olsson notifications@github.com wrote:

The error in the building isn't down to your code, it's something to do
with the Korean font. I don't know much about that, but I just wanting to
let you know it wasn't your code.

β€”
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<https://github.com/adafruit/circuitpython/pull/284...

onyx hinge
#

Other languages just take up more space in flash

low sentinel
#
You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.

Who did this? You need lots of socially-distant hugs. Thank you! (I wrote a bug and this lovely thing rescued me gracefully)

indigo wedge
manic glacierBOT
#

I can't reproduce this on demand but I just noticed I got a MemoryError after making minimal changes to a progam and copying code.py over an old version to re-deploy it to an Adafruit CLUE running 5.2.0. I only had the TFT LCD screen active and it mentioned 12000 bytes. The code actually has a forced GC in the main loop which has been there for some time. I added a debug print of the mem_free() to see if I'd accidentally got close to running out of memory and I'm nowhere near it, ov...

manic glacierBOT
manic glacierBOT
manic glacierBOT
#

supervisor_flash_init() erroneously attempts to send CMD_READ_STATUS2 for devices with only a single status byte.

For my case with the MX25L51245G flash memory chip wired for QSPI and QSPI enabled in mpconfigboard.h, the boot up process hangs in supervisor_flash_init() at the point where the CMD_READ_STATUS2 command is issued because the command is not supported by the device and the subsequent check in the enclosing while loop is always true.

I corrected this for my case by simply not ...

ivory yew
#

Hmm if you do spi.write and then a spi.readinto is it normal to see what you wrote in the response buffer?

#

like i'm seeing bytearray(b'*Hello World'), and * is what I'm sending to spi.write and Hello World is what the device is sending back.

#

hrm if I toggle the CS pin between writing and reading it works as expected

slender iron
#
You are in safe mode: something unanticipated happened.
CircuitPython core code crashed hard. Whoops!
Crash into the HardFault_Handler.

Who did this? You need lots of socially-distant hugs. Thank you! (I wrote a bug and this lovely thing rescued me gracefully)
@low sentinel That is exactly why we have it. πŸ˜„

manic glacierBOT
low sentinel
#

Hey @slender iron thanks for the note on Github! :-)
I'm doing just that today, and while I'm at it I'm trying to put together a non-TileGrid binding for vector shapes.

I got full vector polygons working last night 😬. I was using displayio_vector as the module name; shapes felt squatty and it clashed in my mind with displayio.Shape. Any module naming input you have before the PR (whenever I get it ready) would be welcome!

slender iron
#

@low sentinel no problem! it's something I'd love to see included. We generally add io to the end of our modules so they aren't too generic.

#

we can brainstorm naming ideas πŸ™‚

low sentinel
#

shapesio, vectorio, display_shapes, ...
Lots of ways to skin it. I don't know if I have all the seds figured out to rename in place but I'll try πŸ˜…

slender iron
#

I usually just do it manually

#

I kind of like vectorio

low sentinel
#

It lets me think of factorio every time I say it.
K, I like it. I'll make it vectorio. Thanks!

onyx hinge
#

Me too (factorio)

low sentinel
#
>>> import vectorio
>>> help(vectorio)
object <module 'vectorio'> is of type module
  __name__ -- vectorio
  Polygon -- <class 'Polygon'>
  Rectangle -- <class 'Rectangle'>
  VectorShape -- <class 'VectorShape'>

looking reasonable. Time to exercise that Safe Mode...

manic glacierBOT
#

This is the output I get from RTT:

00> Adafruit CircuitPython 5.3.0-128-ge3c6d0f-dirty on 2020-05-04; PCA10100 nRF52833 Dongle with nRF52833
00> USBD init
00> 
00> CDC init
00> MSC init
00> MIDI init
00> code.py output:
00> USBD Bus Reset
00> Hello World!
00> USBD Bus Reset
00> USBD Setup Received 80 06 00 01 00 00 40 00 
00> 
00>   Get Descriptor Device
00> 
00>   Queue EP 80 with 18 bytes
00> USBD Xfer Complete on EP 80 with 18 bytes
00>   Queue EP 00 with zlp Status...
ivory yew
#

ah so weird, I'm seeing that behavior with SPIDevice as well

#
    with spi as io:
        io.write(bytearray([42]))

    with spi as io:
        spi_result = bytearray(13)
        io.readinto(spi_result)
        print(spi_result)
        # Prints bytearray(b'*Hello World!')
        # the '*' is the 42 sent above, which shouldn't be in the read buffer?

Is that .. normal?

tulip sleet
#

@ivory yew what device is it?

ivory yew
#

I'm running the circuitpython code on a Metro M4

#

it's talking to a barebones SAMD21 board running custom firmware.

#

The firmware on that device just waits for a SPI command that equal 42 and responds with "Hello World"

#
void spi_respond() {
    struct io_descriptor *io;
    spi_s_sync_get_io_descriptor(&SPI_0, &io);
    
    int32_t recv_count;
    do {
        recv_count = io_read(io, spi_in_buf, 1);
    } while (recv_count == 0);
    
    if(spi_in_buf[0] == 42) {
        io_write(io, example_SPI_0, 13);
    }
}
tulip sleet
#

i think it may have to do with how the SPI peripheral works; looking...

#

so you are transmitting the last byte you read on the SAMD21 side

ivory yew
#

interesting

#

so how do i avoid that?

#

(also where did you find this?)

tulip sleet
#

in the SAMD51 datasheet

ivory yew
#

but it applies to the SAMD21 as well?

tulip sleet
#

yes, their peripherals are very similar

#

the exact same paragraph is 27.6.2.4 in the SAMD21 datasheet

#

i think you may not be ending the transaction or something. Did you take that code from an existing example? Maybe look at the Arduino SPI libraries for both sides

ivory yew
#

the Atmel example for SPI slave literally just had reading, not writing.

#

gonna do some more research

#

thanks, it helps just to know this isn't "normal" behavior.

tulip sleet
#

it's common to do a write_readinto, where you send a command and then start getting back data at the same time

ivory yew
#

I was looking at the ESP32SPI library for the CircuitPython side.

#

they send the command, then use a function to way for the "start response" byte then use readinto

#

which I think makes more sense here, as the device might not be ready to respond immediately.

tulip sleet
#

response in the thread is not so clear

#

i think you're late on the write

#

that last one is the clearest

raven canopy
#

@tulip sleet have you seen any complaints about BOOT drive issues on RPis/Linux? i've been fighting this for two weeks now, and the closest i can get is USB/FS errors; just not sure at what level since it just immediately locks up and logging isn't captured. new (to me) Grand Central is on a 1.x bootloader and doesn't have issues. Metro M4 was on 3.9, now 3.6, and immediately locks up. I'm walking back bootloader versions in hopes to find a diff...

ivory yew
#

interesting

#

"When transmitting several characters in one SPI transaction, the data has to be written into DATA register with at least three SCK clock cycles left in the current character transmission. If this criteria is not met, the previously received character will be transmitted."

tulip sleet
#

With SPI, as with so many other things in life, it's much harder being a slave than a master. from the last link

ivory yew
#

lol

#

okay but this makes sense now, I think. Like, this is fine, yeah?

tulip sleet
#

i have not had to write an SPI slave driver yet, but I thought that ASF4 might provide an abstraction for you

ivory yew
#

the code I sent above is the abstraction

#

with the io_read/io_write stuff

tulip sleet
#

i've written code at that level, but only on the master side

#

sigh

#

@raven canopy @tidal kiln and I have both seen this, but we've been seeing it for months, well before the newer bootloaders. I used to get random Linux hangs, but then I installed kdump and it's really crashes. I even opened an issue: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1871143

#

I thought it was past the bootloader, in the TinyUSB in CircuitPython, but I think @tidal kiln said he saw it on Arduino too. It's quite frustrating to press reset on a board and have the host crash. It seems to be timing-related.

#

i've done a lot of websearching on this and haven't come up with similar reports

#

except maybe from years ago

#

i think it's some kind of storage-management issue in the driver, based on the backtraces from the crashes

raven canopy
#

that second dmesg is similar from what i've seen. i haven't seen any of it on my laptop (Ubuntu 18.04), so i was leaning toward it being related to the RPi's dwc_otg USB driver. nice (relative) to see it happening on ehci as well. i've been to narrow in my launchpad searches, since i haven't come across that report. i've been digging down the udev route... πŸ˜„

Seeing it plenty on the RPi with both 19.10 & 20.04.

tulip sleet
#

i have a very vanilla Dell Optiplex about 8 years old. I think it's happening more often, but I don't know whether to attribute it to more recent Linux kernels or more recent TinyUSB commits

#

I was running 18.04, now running 20.04. I upgraded to 20.04 early in the hopes it might have been fixed in the newer kernel series

#

@tidal kiln has an older HP machine

ivory yew
#

@tulip sleet thanks for your help, I think I understand this now, and I can make it work as-is. πŸ™‚

tulip sleet
#

I haven't seen it on my laptop either. But if it's ehci, it would be the same driver, though maybe that doesn't mean much if it's hw-specific in the driver

#

@ivory yew great! you probably understand it better than me already

raven canopy
#

yeah, it could definitely be hub/driver specific...