#circuitpython-dev
1 messages Β· Page 324 of 1
yah, the next one: I said: This is the third alpha release of CircuitPython 6.0.0. It is relatively stable. The release is still alpha because some API changes and additions are not yet included. Upcoming in a future release but not yet included are ESP32-S2 Wifi support, and bleio HCI support for ESP32 co-processors.
are there any actual changes or just additions?
i don't think there are changes, but who knows π
kk, lets do the next one as beta
i agree, it will be close to feature-complete
we can always add features with minor versions
There were a number of problems. First, when allocation failed during _PM_begin, a crash would occur if you tried to _PM_free the object. Second, there were problems with how allocation errors were signaled that presented additional problems for recovery. (it was doing longjmps out of the protomatter code, and it erroneously disabled interrupts, both of which made post- or mid-crash behavior extremely hard to fathom until noticing those things)
This does not fix 'the other' problem, whic...
@slender iron Another yaml file would work.
kk, will have you review the change shortly
@slender iron Merged.
Thanks! I'll add that yaml to the few repos that have tests too
midi and imageload I think
Just a couple of questions. Thanks for looking into this!
Why does the framebuffer case above call mp_obj_new_bytearray? Isn't the idea that the framebuf to use is provided?
Thanks @tannewt @dhalbert
I just saw the release notes for Alpha 3 mention BLE with esp32 co-cpu, is nina getting new functionality or is this with a separate fw? Very exciting π
we are just turning on the BLE functionality and routing the UART to the right pins
it's just a minor rebuild of NINA. It's already in our fork
ah so wifi over spi and ble over hci uart?
yes, they can't be used simultaneously, as far as I know. But there's a complete new imple of _bleio that talks HCI, compatible with the old one
nice! is it the same uart that's used for programming?
cause if yes then my imx feather will have ble working π
ooo! Yes, the setup code is in https://github.com/adafruit/Adafruit_CircuitPython_BLE/pull/99. This is actually slightly out of date. I'll update the PR in a bit.
it's peripheral ONLY right now. it has been tested with Nordic UART, etc.
we wanted to get something working for projects. Then I'll work on central.
even just peripheral is amazing
tnx! also no bonding. The code started as the ArduinoBLE library, but I reworked it a lot. I got some useful include files for struct definitions from zephyr
right, their hci driver is quite mature
i was distressed to find out that HCI leaves ATT implementation to the host; I expected it to be part of the command set (as in the nrf SD)
i am really tired of searching the 3000-page BLE spec. Also, there seems to be no community of HCI developers that I could find to ask questions: it's maybe too small a cohort
I have a branch of the CP repo in my fork -- I pulled and merged the lates main - after 6.0.0-alpha3 release -- How do I get the branch build to reflect the new alpha.3 tag? it still shows alpha.2 -- If I just clone the main repo it builds as alpha.3.
git pull --tags, maybe
@thorny jay I talked to AndrΓ©s Sabas, the Electronic Cats owner, and he says that maybe some alternative shipping option can be arranged. If still interested, please email store@electroniccats.com
SPI SD card won't mount.
I tried SD card with:
adafruit-circuitpython-espressif_saola_1_wrover-en_US-20200827-fe73cfb.bin
adafruit-circuitpython-espressif_saola_1_wrover-en_US-6.0.0-alpha.3.bin
the code that is trying to mount the card:
https://github.com/emard/esp32ecp5/blob/master/circuitpython/sdmount.py#L1
output:
import sdmount
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sdmount.py", line 30, in <module>
File "adafruit_sdcard.py", line 11...
Thanks @silver tapir I think I will wait for some Feather Wing from Adafruit or use the Saola: https://www.adafruit.com/product/4693
I have enough gadget to keep me busy.
looks like git fetch upstream --tags did the trick
The CircuitPython 6 poster image is gorgeous:
I made a CircuitPython release and one aspect of the the build failed:
Website1
##[error]Process completed with exit code 1.
Run python3 build_board_info.py
Logged in as adafruit-blinka
Traceback (most recent call last):
File "build_board_info.py", line 310, in
generate_download_info()
File "build_board_info.py", line 243, in generate_download_info
support_matrix = shared_bindings_matrix.support_matrix_by_board(
File "../docs/shared_bindings_matrix.py", line 14...
@slender iron @ionic elk ugh all the ESP32-S2 builds failed in the alpha.3 release:
Run source $IDF_PATH/export.sh
Adding ESP-IDF tools to PATH...
Not using an unsupported version of tool cmake found in PATH: 3.17.0.
Using Python interpreter in /home/runner/work/circuitpython/circuitpython/.idf_tools/python_env/idf4.2_py3.8_env/bin/python
Checking if Python packages are up to date...
The following Python requirements are not satisfied:
gdbgui>=0.13.2.0
To install the missing packages, please run "/home/runner/work/circuitpython/circuitpython/ports/esp32s2/esp-idf/install.sh"
Diagnostic information:
IDF_PYTHON_ENV_PATH: /home/runner/work/circuitpython/circuitpython/.idf_tools/python_env/idf4.2_py3.8_env
Python interpreter used: /home/runner/work/circuitpython/circuitpython/.idf_tools/python_env/idf4.2_py3.8_env/bin/python
this is just a silly problem
@slender iron just a note that I think that I narrowed down Phil B's problem to rotation= with rgbmatrix and that I probably failed to deal with it for Framebuffer displays in general -- I may need to pick your brain monday or tuesday about what handling that looks like, in case a little more code inspection doesn't help
Since #3332 the stubs are used instead of shared-bindings to get the list of modules shown in the matrix. I THINK the fix for this is to move the stub-generating rules into create_website_pr.yml. However, I could use some guidance as to how to test a PR, since it only runs on a release-publish.
Ah ha. I see the issue. Picking a good limit is key (though, no matter what you pick, someone will have a use case for more :) ).
The change in https://github.com/adafruit/circuitpython/commit/7f744a2369a5036cadfa05575da1704f709c98bb#diff-eabdb5188465dac61c841030638d5cca puts a call to supervisor_ticks_ms64() inside scan_on_ble_evt(). My limited understand is that is called from a soft device related interrupt handler. supervisor_ticks_ms64() is disabling and re-enabling interrupts using non soft device functions. Is that ok within the interrupt handler? (I have no idea here, btw!)
supervisor_ticks_ms64()callscommon_hal_mcu_disable_interrupts(), which does use the sd-safe critical region routine sd_nvic_critical_region_enter()`.
@slender iron groups don't have the rotate/transpose/scale options, tilegrids do. is there a big ugly reason why groups can't?
Groups can scale I think
I need to:
- [ ] Add remaining pin names
- [ ] Change USB PID
This is a work in progress for the Gravitech Cucumber R board
Kaluga WROVER VID 0x239A PID 0x00C7 # bootloader
PID 0x80C7 # arduino
PID 0x80C8 # circuitpython
otherwise this is perfect!
@onyx hinge my brain couldn't handle it
@slender iron I know the feeling tbh.
This is a work-in-progress for the Gravitech Cucumber R ESP32-S2 board (https://www.gravitech.us/curesdebo.html). I cannot find a USB_VID for Gravitech and have left the Saola VID/PID as a temporary measure.
- [ ] Update the USB_VID / USB_PID
@gravitech-engineer please allocate a USB VID/PID for circuitpython
Hi!
It appears that we added linalg.norm sometime after the 5.3.1 release. It is not listed in the documentation page for 5.3.1: https://circuitpython.readthedocs.io/en/5.3.x/shared-bindings/ulab/__init__.html
At this time, it's necessary to use a prerelease, such as 6.0.0-alpha.3, to have this function available.
Please let us know if you try 6.0.0-alpha.3 and still run into this problem.
On the esp32-s2, what is envisioned for using both ota_0 and ota_1 ...actually doing a future OTA implementation for updating circuitpython?
@crimson ferry yes, I don't want to rule out OTA
Both Gravitech Cucumber R and Gravitech Cucumber M modules are booting with their respective versions. Both variants have 4MB flash, but Gravitech Cucumber M is without PSRAM.
Another even simpler test: SPI LOOPBACK, connect MISO-MOSI IO35-IO37
adafruit-circuitpython-espressif_saola_1_wrover-en_US-20200827-fe73cfb.bin passed this test
adafruit-circuitpython-espressif_saola_1_wrover-en_US-20200829-d858d04.bin
fails this test
https://github.com/emard/esp32ecp5/blob/master/circuitpython/spiloopback.py#L1
Is it OK to download alpha3 directly from Amazon S3? Or there is a problem and it should be avoided?
On Adafruit CLUE board and CircuitPython 5.3.1
I tried the following code on my CLUE board and works fine.
When Button A 'not' pressed, it returns True and when Button A is pressed, it returns False. This is okay.
`
import time
import board
from digitalio import DigitalInOut, Direction, Pull
button_a = DigitalInOut(board.BUTTON_A)
button_a.direction = Direction.INPUT
button_a.pull = Pull.UP
while True:
print (button_a.value)
time.sleep(0.1)
`
When I changed the...
I'd like to give CPY support to nanoESP32-S2 boards on behalf of MuseLab.
Would it be possible to receive a VID/PID for this purpose?
I didn't find any VID/PID in MuseLab documentation : https://github.com/wuxx/nanoESP32-S2
I'm an individual with no affiliation with Muselab.
Thanks!
This is to be expected. If you look at the schematic https://cdn-learn.adafruit.com/assets/assets/000/087/877/original/adafruit_products__CLUE_sch.png?1580423083 the buttons are connected on one side to Ground and the other side to the GPIO Pin. Pressing the button connects the Pin to Ground so it will read False.
When you us the Pull-Up/Down setting , you are setting the "default" state of the GPIO Pin when nothing is connected to it (when the Button is not pressed)
When you use a Pull-UP...
@thorny jay Yes, go ahead and download from S3. There were errors in the release process and circuitpython.org did not get updated
I'm working on doing the circuitpython.org update manually, but it's been tricky.
.. hard-coding ulab for now.
It also fixes a problem where board_name was unassigned when use_branded_name was False, which only happened at release-building time.
Trying to change this caused multiple problems in the release process.
Closes: #3345
That 42241 (0xa501) number is peculiar. It doesn't have many factors, 53 * 797. The last time I had a peculiar number it's highly likely it was related to dict additions for symbol table but I don't see how such a large quantity of whatever could suddently be needed.
I've left a small version of the essence of my game code running to see if it trips up on background BLE (someone owns a very promiscuouys Cycliq Fly12 bike light near me) and some occasional 5 player game testing.
I just experienced this on 5.3.0 on a CLUE with a busy application but the possible trigger was lots of output over an hour or so plus it died during a powershell dir -Recurse on the CIRCUITPY and that dir had a pause in it of maybe 10-15 seconds about 4/5th of the way through - the dir did complete after that.
visual benchmark of adafruit_sdcard vs sdioio vs sdcardio (from right to left)
I don't understand why the adafruit_sdcard one has the long pause between images, the three are running the same code. sdioio is plainly the fastest. sdioio is using stm32f405 feather, the other two are nrf52840 feathers.
@dhalbert In practical terms, I think I need either the new stack trace functionality you mentioned further up in the comments to help pinpoint what's doing the memory allocation or crash dump functionality to catch this. It's been very infrequent recently on 5 devices, but perhaps more frequency when I use 6 together but I can't predict which of the 6 it will occur on.
Have crash dumps been discussed for hard faults and optionally for MemoryError? Those could be enabled with something in ...
Because I don't have a Metro M4 Express AirLift... I wanted to replicate adafruit_matrixportal demo from John Park and @gilded cradle but on "Feather M4 Express" + "Adafruit RGB Matrix Featherwing Kit - For M0 and M4 Feathers" + "Feather Wing AirLift". After tweeking the code to use the RGB Matrix, then tweeking it to use the AirLift, I got the final error: "ValueError: D11 in use". It is not possible to do that... because some pin you need for the AirLift are also required for the RGB Matrix. I guess I need to wait for the ESP32S2 with build-in WiFi. π¦
You could rig it I think, but not with featherwings stacked or doubled pin-for-pin
This may seem like a silly question, but should the following expression: led.value = not led.value toggle the output true-to-false or false-to-true, no matter what?
I've used this before and never thought much about it, it just works, as I think it should, unless I'm missing something.
But, here's something curious. This code:import board from digitalio import DigitalInOut, Direction led = DigitalInOut(board.L) led.direction = Direction.OUTPUT led.value = True led.value led.value = False led.value led.value = not led.value led.value led.value = not led.value led.valueworks fine on PyPortal. But on ESP32S2 (alpha.3), it does not work as expected.
On PyPortal, setting to True or False always changes the LED correctly, and prints the boolean value correctly
but on ESP32S2, negating the value doesn't behave the same
>>> print(led.value)
False
>>> led.value
False
I realize reading an output is iffy, but to behave differently on different platforms is... unintuitive
It doesn't seem very kind to the user to have "led.value" of an output pin not reflect the current state of the pin.
you might also say:: should led.value = led.value ever be able to change the state of the pin
likely it has to do with the esp port being young, and if you don't care to dive in and simply fix it, you should file an issue.
I don't have the C chops to find and fix, so I'll file an issue. But I needed a sense check, this had me questioning the nature of my reality
*
* @warning If the pad is not configured for input (or input and output) the returned value is always 0.
*
* @param hw Peripheral GPIO hardware instance address.
* @param gpio_num GPIO number. If you want to get the logic level of e.g. pin GPIO16, gpio_num should be GPIO_NUM_16 (16);
*
* @return
* - 0 the GPIO input level is 0
* - 1 the GPIO input level is 1
``` the esp idf has defined the low level routine in an interesting way.
this makes the otherwise relatively sensible implementation in CircuitPython not work: return gpio_get_level(self->pin->number) == 1;
(I say relatively sensible because I'd have written ... != 0 or just return gpio_get_level() because I've been burned by code which returned an integral type and (inadvertently) returned values like 2, 4, 8, etc for "true". However the esp-idf docs seem to state that they promise to only return 0 or 1)
Is this a bug, or is it explicitly undefined behavior to read the value of an output?
PyPortal (alpha.3):
>>> led.value = True
>>> led.value
True
(the LED is ON)
Saola (alpha.3):
>>> led.value = True
>>> led.value
False
(the LED is ON)
Thanks, Jeff
or it might be possible to set the pin to mode GPIO_MODE_INPUT_OUTPUT / GPIO_MODE_INPUT_OUTPUT_OD and not GPIO_MODE_OUTPUT
"configured for input and output" is a new concept I think for CircuitPython
Sure, happy to be a check
If it's not intended to be able to read back the value previously set on an output pin, accessing the value property to read it should give an exception.
I think the problem arises because the esp-idf defines the return value of this routine in a surprising way, rather than returning the value currently driven onto the pin:
* @brief GPIO get input level
*
* @warning If the pad is not configured for input (or input and output) the returned value is always 0.
*
* @param hw P...
Manual update to 6.0.0-alpha.3, due to problems in automatic generation.
Download counts updated.
mpy-cross binaries, built for every merged PR and release, are now in https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/mpy-cross/
FWIW, input behaves the same on both. It's conceptually an easier case to make that it's an error since the value is controlled by an external source:
>>> pin = DigitalInOut(any_gpio)
>>> pin.direction = Direction.INPUT
>>> pin.value
False
>>> pin.value = True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: Cannot set value when direction is input.
@thorny jay, there's not enough free pins to use the RGB Feather and airlift feather at the same time. I considered adding support, but it just wasn't possible.
@gilded cradle You could do it, but not stacked or doubled, as long as you can sacrifice I2C? A0, A1, SCK, MOSI, MISO, SDA, SCL are available, and Airlift uses the (3) SPI pins + (3) other pins, CS BUSY and RST, for routine use.
Ah, that's true. I meant in a tripler.
@kevinjwalters and @tannewt, Iβm willing to pitch in on this issue. I read through the related issue and hereβs what I gather:
Need a way to call for an immediate (blocking?) screen refresh. I assume this would be an empty call display.refresh() or with target_frames_per_second=None.
I would suggest that this include an option to treat the whole screen as dirty and do a full redraw of all items. This could be an interim solution for structures that do not have dirty rectangle tr...
@thorny jay, there's not enough free pins to use the RGB Feather and airlift feather at the same time. I considered adding support, but it just wasn't possible.
@gilded cradle Yeah, I figured that out after making chirurgical change to your library for 30 minutes. I was confused as to why you made a library for only one combo of hardware where the "portal for matrix" concept would work for other... well, I figured the "hard" way that I was hitting a pin limit. However, I believe some modularity where you can give your rgbmatrix and your AirLift pin would be usefull to this library. As soon as an ESP32S2 is there, you could have wifi internally and drive an rgbmatrix (no support for that yet I guess, and likely another Feather Wing will be required as it is each time different.
@gilded cradle You could do it, but not stacked or doubled, as long as you can sacrifice I2C? A0, A1, SCK, MOSI, MISO, SDA, SCL are available, and Airlift uses the (3) SPI pins + (3) other pins, CS BUSY and RST, for routine use.
@crimson ferry Maybe with a Bring Your Own Matrix Feather Wing... it is already more or less my case since I drive a 64x64 matrix added the "E" address line. So this mean I need one more pin. And then maybe I will hit the contrain of having the pin in the same "register" so that it goes faster to toggle them simultaneously. As the end of the day, I will have a unique hardware setup and unique problem.
I added one more pin.
If the heap memory is not touched when the VM shuts down, then I think the following would work. It relies on being to able to use the stale data in the old heap.
- Copy the location of the string object that is the filename into a pointer variable at a fixed location
- Reload exception throws us back to somewhere in main.
- VM gets shut down. Loop back to restart VM
- Before heap is re-initialized (is it zeroed?), examine the string object pointed to. Allocate an array on the stack...
I just realized there is one more piece of the puzzle missing β after the code finishes running, it would be best if the device restarted again, with the default main.py this time, instead of dropping into the REPL. I wonder if this is too much to ask for an obscure use case, though.
@deshipu If each of the alternate programs did a supervisor.reload() with no args when it's done, that would just happen. Are you thinking that is an extra piece of code that the alternative programs wouldn't have?
Yes, ideally it would be the same kind of programs that you normally run as code.py β whatever the users have written or copied from examples. Requiring a reset at the end is a possible solution, but I'm sure it will often be missed and users will wonder why the device is not displaying the menu again after running their code.
[started to reply and then saw your edited reply]
It would be possible to set a flag that says to reload on exit, either via supervisor.reload() or some new function. But as I was going to mention, and you already did, most example programs already are infinite loops and have no exit mechanism, so they'd have to be modified anyway.
Also, you probably don't want to restart if there was an error, only if it was a normal end of the program. I might be overthinking this.
I have been doing some timing tests of SPI transactions
This is on a feather_m0_rfm69 (SAMD21) but there are similar delays on SAMD51 and STM32F504. The delays are shorter on the faster boards, but still seem long.
There seem to be very long delays between the SPI transactions.
This figure shows a write operation
The interesting thing is how long it takes before the writes actually happen
top 4 traces are MOSI/MISO/SCK/CS
trace 5 is D13 -- self.led in the code
trace 6 is D12 -- se...
A crash like the following occurs in the unix port:
Program received signal SIGSEGV, Segmentation fault.
0x00005555555a2d7a in mp_obj_module_set_globals (self_in=0x55555562c860 , globals=0x55555562c840 ) at ../../py/objmodule.c:145
145 self->globals = globals;
(gdb) up
#1 0x00005555555b2781 in mp_builtin___import__ (n_args=5, args=0x7fffffffdbb0) at ../../py/builtinimport.c:496
496 mp_obj_module_set_globals(outer_module_obj,
(gdb)
#2 0x00005555555940c9 in mp...
This line is wrong and should be deleted.
Weird. This line of preexisting code should probably also be deleted.
I upgraded from 5.3.0 to 5.3.1. I ran 11 games with 3 rounds per game on 6 devices, so that's 198 executions of the code in main loop where this has previously occurred and curiously it's always on the third and final transmission. All fault free but I'm not reading too much into that as this is such a rarely triggered bug.
I'm thinking that links to the mpy-cross downloads should be on circuitpython.org somewhere, though, maybe on the libraries page??
Changes: I made Adapter have a constructor that takes the uart, rts, and cts args. You can actually only call it once, before it complains "Too many adapters". To set _bleio.adapter, you call _bleio.set_adapter(). It can't be used as a settable property due to limitations in how module attributes are treated.
In an HCI build, the attribute is set back to None on each soft restart. In a non-HCI build (e.g. nRF), the attribute is always set and is read-only.
I fixed one % q presumably carried over from a machine translation.
We can find with CircuitPython code whether a pin is capable of PWM, I2C, UART, SPI, touchio. But is there some mechanism deeper than pins.c to designate whether pins can be analog? digital? input? output?
@crimson ferry same as with sercoms/timers β just try and catch the error
@stuck elbow My question is whether it's possible for code to detect? For example, a processor pin that is input-only... CP code lets me output to it to my heart's content, but nothing ever changes on the pin.
(don't get me started on MOSI-only SPI devices, and breakouts/libraries that don't return init status π
It should throw an error when you try to switch it to output
what's the mechanism?
if it doesn't, I would say it's a bug
it doesn't detect or throw exception in my current case
where in circuitpython core code is the encoding of pins being input-capable, output-capable, analog-capable, digital-capable?
I suppose it would need custom check for that on platforms that have such pins
it would have to be in port/board I would think
same for pullups/pulldowns
for analog there must be a place where it looks up the analog channel for the given pin, and throws an error when there is none
that sounds right for analog, but digital may just rely on info in a datasheet
it it's input-only, for example
generally I would think this is something defined in HAL
OK, I'll dig around there, thanks
I didn't notice until after it update on the site that I set the title was just the board ID.
Use it as a function or a property? Maybe like DigitalInOut.value
The sam4s has circuit python support, right? Iβm thinking about making my own feather with the sam4s since it has native USB and whatnot, I just wanted to make sure it was CP supported.
[adafruit/circuitpython] Pull request opened: #3358 actions: Clone the esp\-idf submodules ourselves
Builds of the esp32s2 targets frequently fail:
-- Found Git: /usr/bin/git (found version "2.28.0")
-- Initialising new submodule components/asio/asio...
warning: could not look up configuration 'remote.origin.url'. Assuming this repository is its own authoritative upstream.
Submodule 'components/asio/asio' (/home/runner/work/circuitpython/circuitpython/ports/espressif/asio.git) registered for path 'components/asio/asio'
fatal: repository '/home/runner/work/circuitpython/circuitpytho...
@crimson ferry there is a table of pin capabilities for each chip family: https://github.com/adafruit/samd-peripherals/blob/0f5f1522d09c8fa7d858edec484a994c21c59668/samd/samd21/pins.c
This is basically some of the info in the datasheet, transcribed for programmatic use
@ornate breach we have not supported the SAM4S. The SAMD51 is an M4 processor with more RAM
SAMD51 has more RAM
I believe the SAM4S is older
Probably so
Thanks, Dan, looks like it covers: interrupt, touch, ADC, sercom, timers. The thing that prompted this line of thinking was that on ESP32-S2, there are pins that are input-only, but I'm not sure if there's a way to programmatically enforce that.
I was just cruising through Digi-Key for M4 MCUs
Cooking up new ideas for feathers
SAM4S was introduced in 2011; SAMD51 introduced in 2017
@crimson ferry the format of that pin table varies between ports; it's somewhat different on STM, for example, so it would certainly be possible to add an "input only" flag
@onyx hinge I think there's a leftover debugging print statement from the endpoint checking:
Endpoint 0 - vs max_ep 8
Endpoint 0 - vs max_ep 8
Endpoint 0 - vs max_ep 8
...
[adafruit/circuitpython] New branch created: endpoint\-counting\-debug\-remove
[adafruit/circuitpython-org] Pull request opened: #535 Added board \- BLE\-SS Dev Board Multi Sensor
Hello.
I have added a new board.
Please review and merge.
@tulip sleet I was going to try the esp32spi with BLE -- I have the updated nina firmware installed on a metro_m4_airlift, but I am having trouble getting _bleio into my build. What do I have to do to enable it?
or should I try first on some other board?
oh -- nevermind -- I forgot to install PR 3310!
@tulip sleet FYI -- I tried running the ble_simpletest but get ```ress any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.3-48-gf5a5fc4c8 on 2020-08-31; Adafruit Metro M4 Airlift Lite with samd51j19
import ble_simpletest
scanning
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ble_simpletest.py", line 12, in <module>
File "adafruit_ble/init.py", line 267, in start_scan
NotImplementedError:
the first few steps go ok ```Adafruit CircuitPython 6.0.0-alpha.3-48-gf5a5fc4c8 on 2020-08-31; Adafruit Metro M4 Airlift Lite with samd51j19
from adafruit_ble import BLERadio
ble = BLERadio()```
@solar whale this PR only implements peripheral mode, so scanning is not working. You can try ble_uart_echo_test.py: that's peripheral mode
the idea was to get Bluefruit Connect up and running first
OK -- sorry -- will try that
I will make that clearer in the PR
also of interest, I tried building my own copy of the nina_FW and it did not work ( got a time out lookin for the HCI ) I used the one from your PR and it works OK
I'll look into that
After reading about the ability to turn off QSPI during sleep for the nRF52840 in 6.0.0 alpha 3 I tried emulating what @xiongyihui did in issue #3244 on my itsybitsy BLE (also nRF52840). However after building CircuitPython with the CIRCUITPY_ENABLE_MPY_NATIVE=1 flag to be able to use the @micropython.asm_thumb decorator and adding a few lines to xiongyihui's code to disable the DotStar LED the current drawn from battery (no USB connected) is still identical to what it was when using 6.0.0 al...
@tulip sleet Echo test worked great!
The NINA-FW change has not yet been PR'd. It's on this branch: https://github.com/adafruit/nina-fw/tree/BT_HCI
hmm -- it looks like that has been merged, but maybe I misread something --
hmm, you're right, that's odd. I'll bring it up with Limor.
thanks -- I'll try it again -- then I can open an issue on it.
that would be great; she built the version I posted in the Cpy PR long before the NINA pr
The adafruit_ble_adafruit library should work also, on the peripheral sdie, though it has been somewhat less tested.
OK -- I'll try to do some testing later today. Off to a good start! Thanks!
thanks for testing!
issue created https://github.com/adafruit/nina-fw/issues/26
Tested ble_uart_echo_test on a metro_m4_airlift_lite with the NINA HBI BT.bin firmware -- works!
Does dotstar.DotStar use SPI bus?
We need turn off other peripherals(USB, PWM and etc) using high frequency clock (HFCLK), and then go to sleep.
Yes, the dotstar library uses SPI if it can. Below is from https://github.com/adafruit/Adafruit_CircuitPython_DotStar/blob/master/adafruit_dotstar.py. The way around this would be to modify the code to force it to use bit-bang method it does when SPI is not avialable on the requested pins.
self._spi = None
try:
self._spi = busio.SPI(clock, MOSI=data)
while not self._spi.try_lock():
pass
self._spi.configure(...
This looks fine to me. I'm not sure what's wrong either, but it's worth doing for now.
im reviewing and will get to on tuesday :)
It didn't even occur to me to test current with the LED still on but I did and got this:
Doing nothing but importing time and going to sleep (LED still on) results in about 1.95 mA. Lower than before even though the LED is now on.
When using the code below setting the brightness for the first time using the DotStar object causes the current to jump from 1.95 to 2.85 mA even though the brightness of the LED doesn't change. I assume that increase is caused by the HFCLK turning on again (and...
<@&356864093652516868> Discord meeting in about 1 hour in the text and audio channels. If you have a chance to add your updates and your "lurking" status to the notes document, please do -- it's super helpful. https://docs.google.com/document/d/1fzARe32tu1diEPjFla3ipsz6jJehwYHlF7LYdjLaMYw/edit?usp=sharing
Reminder that if you plan to speak in the audio channel, you have to be a member of circuitpythonistas. We're happy to add you, let us know.
i have tried to create the hex file with
make BOARD=makerdiary_nrf52840_mdk_usb_dongle SD=s140 V=1 -j4 bin
like in the Readme.md described.
But I've got every time the error
make: *** No rule to make target 'hex'. Stop.
Can someone help me
Try without the "bin"
make BOARD=makerdiary_nrf52840_mdk_usb_dongle SD=s140 V=1 -j4
worked for me
Create build-makerdiary_nrf52840_mdk_usb_dongle-s140/firmware.bin
Create build-makerdiary_nrf52840_mdk_usb_dongle-s140/firmware.hex
Create build-makerdiary_nrf52840_mdk_usb_dongle-s140/firmware.uf2
python3 ../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-makerdiary_nrf52840_mdk_usb_dongle-s140/firmware.uf2" build-makerdiary_nrf52840_mdk_usb_dongle-s140/firmware.he...
GEN build-makerdiary_nrf52840_mdk_usb_dongle-s140/genhdr/mpversion.h PreProcess ld_defines.c make: arm-none-eabi-gcc: No such file or directory make: *** [../../py/mkrules.mk:63: build-makerdiary_nrf52840_mdk_usb_dongle-s140/ld_defines.pp] Error 127 make: *** Waiting for unfinished jobs....
for me not,
and its
make BOARD=makerdiary_nrf52840_mdk_usb_dongle SD=s140 V=1 -j4 hex
i have tried it with bin but both dosen't work.
I use manjaro and gcc 10.1.0
Just to be sure, did you try the command I gave above -- no "hex"and no "bin"
yeah i have tried your command im running it in ciruitpython/ports/nrf
Good afternoon all you wonderful folks! Happily (if a bit groggily) lurking today π β
The notes doc has been updated to reflect as such.
OK -- I don't have any better suggestions - sorry.
make: arm-none-eabi-gcc: No such file or directory is pretty suspicious. Can you run arm-none-eabi-gcc from the command line? Did you download the toolchain file and unpack it? See https://learn.adafruit.com/building-circuitpython
lurking
lurking today
Lurking today (noted in the document already), I will have to cut away early for another meeting.
thanks @lone axle I'll be happy to get back in my role of URL paster
The Duke of URL.
OK make me a vanity role, I'll take it
The Earl of Url
Sorry, I am also going to make it text-only.
got it, thanks
nop im installing it right now.
But is it possible to include that information in that Readme ?
https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/circuitpythonday2020.md circuitpythonday@adafruit.com
https://hackaday.com/2020/08/24/running-a-successful-hacker-camp-in-a-pandemic-bornhack-2020/ https://github.com/bornhack/badge2020 https://youtu.be/1t1gyQ_yyU8
You could say 2020 is The Year That Didnβt Happen, or perhaps even The Year That Everything Happened Online. All the international cons and camps have been cancelled, and weβve spent ouβ¦
GitHub
BornHack Badge 2020. Contribute to bornhack/badge2020 development by creating an account on GitHub.
In this presentation, we will take a look at this years badge and a bit about the decisions and troubles leading up to this point.
so, tiny book. a thread. Yeah I couldnβt help myself. I made another one. Itβs funny, Iβm simultaneously stoked about this object, and a little embarrassed at how far I had to wander from the original prompt in order to find my way back to the right idea (which isnβt quite th...
Likes
325
https://www.woolseyworkshop.com/2020/08/28/getting-started-with-circuitpython-on-compatible-microcontroller-boards/ https://twitter.com/JohnWWoolsey/status/1299444645441699843
Learn how to install and use the hardware centric CircuitPython language on a compatible microcontroller board.
Interested in getting @CircuitPython up and running on your compatible microcontroller board? Check out @WoolseyWorkshop's latest tutorial.
@adafruit #CircuitPython #electronics
Getting Started With CircuitPython On Compatible Microcontroller Boards https://t.co/SIZrCvsNmq
I wonder if we should split the overview into the three sections
with 52 boards, you can do the adafruit blinka board of the week .. all year
No problem π
@slender iron want me to drop that screenshot in the chat or is it full of secrets?
MAKE := #problematic
Awww.
as long as you scratch her head
π± . o O ( hug report to the big ones with thumbs who serve me food. it should be more often though. )
@slender iron only the top side connections are actually needed in that pinout?
no, you need both sides
if you want it pogo-able, do those need to be duplicated on the top with a little pad or something?
pinout explained here: https://debug-edge.io/
question about CircuitPython day -- do we/will we have a schedule of the adafruit broadcasts for the day?
draft is here: https://github.com/adafruit/circuitpython-weekly-newsletter/blob/gh-pages/circuitpythonday2020.md
Thanks Scott
np
I am learning circuit playground. I noticed that some example codes just do import board while others do board and call out circuit playground. Which is right?
belated hug report to scott for taking the next step in improving his development style
another belated hug report to @onyx hinge for taking a look at the RGB Matrix issues in circuitpython.
@dire spruce both are fine -- if you want to go beyond what is in the circuitplayground module, then you can do it by directly using board, etc.
if you're just starting you'll probably find the circuitplayground way easier
I wanted to use the neopixel library on a code that was already using neopixel_write... is there an easy way?
How do I know which boards are included in board library
@dire spruce we're happy to help you but can you please move your question to #help-with-circuitpython ?
Thatβs where I am right?
@dire spruce no, go up in the channel list, under "help with"
Oh thereβs a circuit python and a help with?
(this channel is usually for circuitpython developmen)
+t
Oh ok
Thanks!
I answered your question in the other channel
I played a lot with 64x64 RGB matrix this week, and it is only after a few days that I figured that my matrix has Blue and Green inverted (or maybe I made a mistake). Suddenly the image were much nicer. π
@solar whale I've been getting hangs with SPI lately (esp32s2), though it was working in the past (had ESP32SPI connected to an Airlift working fine in July) Need to re-test with alpha.3
limor said she will check out the firmware issue
wow. that's already coming up again.
You generally need permissions to add labels
Sometimes you can restructure the code so that the lock is held for a longer length of time. If you are polling, then make sure you do it outside of that loop.
if (hri_sercomspi_get_CTRLA_CPHA_bit(hw) == phase &&
hri_sercomspi_get_CTRLA_CPOL_bit(hw) == polarity &&
hri_sercomspi_read_CTRLB_CHSIZE_bf(hw) == ((uint32_t)bits - 8) &&
hri_sercomspi_read_BAUD_BAUD_bf(hw) == baud_reg_value) {
return true;
}
``` @slender iron is reading these registers back going to be "fast" or is it slower than RAM?
other thing of note is that samd_peripherals_spi_baudrate_to_baud_reg_value is called to get baud_reg_value and it uses floating point math
If it's less than 16 bytes it shouldn't look at background tasks
// Avoid using C stack when making Python function calls. C stack still
// may be used if there's no free heap.
#ifndef MICROPY_STACKLESS
#define MICROPY_STACKLESS (0)
#endif
// Never use C stack when making Python function calls. This may break
// testsuite as will subtly change which exception is thrown in case
// of too deep recursion and other similar cases.
#ifndef MICROPY_STACKLESS_STRICT
#define MICROPY_STACKLESS_STRICT (0)
#endif
Thanks for running the meeting, @idle owl !
Thanks!
Thanks
Thanks everyone!
π
Now that we are using PYSTACK, investigate whether turning on MICROPY_STACKLESS is a significant performance improvement.
From py/mpconfig.h:
// Avoid using C stack when making Python function calls. C stack still
// may be used if there's no free heap.
#ifndef MICROPY_STACKLESS
#define MICROPY_STACKLESS (0)
#endif
Suggested by Damien to Scott.
@idle owl If this is with a macbook pro, could it be the usb-c adapters themselves? I've had a few USB-C adapters not play nicely with external devices....
If you're a host of a zoom meeting, or the host gives you permission, you can record zoom meetings --- super handy feature. π
MacBook Pro, yes. One of the monitors here is USBC directly. The other one is DisplayPort to USBC. In my other location, both USB C directly.
Which one crashes it?
Both setups crash.
I mean which monitor? Either?
Oh, I can't unplug the USBC one here because my network and peripherals are plugged into a hub plugged into it.
Ah
But it doesn't crash if I remove the DP-USBC one
Hmm. I was thinking it could be the USB-C cable itself, first party vs third party? Or it could be the hub not playing nicely
This is the USBC cable that came with the monitor. Huge gauge. Powers the laptop as well as providing a hub through the monitor
The reason I'm diving down this rabbit hole is because I have some Microsoft-branded USB-C to USB-A adapters, and they simply do not play nicely -- but worse, they're inconsistent in how they fail.
This is USBC to USBC cable.
Ok, I usually use a displayport-usbc cable and had played with OBS a bit, but hadn't crashed. I just switched back to a DisplayPort to Mini DisplayPort since I could use a single hub.
Currently traveling, so using my laptop with an iPad as a sidecar.
Sidecar is such a nice feature.
I had forgotten about that. I also forget sometimes that I have an iPad.
Yes, I just updated my ipad since my old one was too old for that.
It's a great travel monitor
I run a 2nd gen ipad pro 12.9, and that's "new" enough for sidecar. It beats any USB monitor I've had hands-down -- and it beats Duet Display too.
Mine is just a lower-end 10.2" iPad.
Isn't it so nice though, older and lower-end hardware plays nicely
Yes
I used a luna display with my old ipad and old macbook, but it was a little harder to set up.
Anywho, I haven't tried OBS yet on my new laptop -- I'll give it a go with a few external monitors, see how it handles recording to disk with everything going at once.
If you plug one of the boards in now, what VID/PID does it show?
@lone axle you were working on a UI layout language right? https://forums.adafruit.com/viewtopic.php?f=60&t=168866
yep. They are looking for almost exactly what I have created if I understand their last message correctly. I'll post a link to it in that forum post.
yes
256kB flash (or 192kB with external flash, but we don't have any boards like that)
(you really want more than 32k though)
256kB on non-flash-chip boards is 192kB firmware + 64kB CIRCUITPY
thanks @lone axle
So this would meet bare minimum? https://www.digikey.com/product-detail/en/microchip-technology/PIC32MX564F128H-I-PT/PIC32MX564F128H-I-PT-ND/2601579
if I used SPI Flash
no, it's only 128kB internal flash. Also, we have never done PIC32
the different architecture will impact the code size of circuitpython stored in flash
we've spent a while looking for chips that meet the requirements
I'm not sure there are any "hidden" chips that look great
gotcha
(the imx rts are underutilized imo)
- M7
What about this? https://www.digikey.com/product-detail/en/microchip-technology/PIC32MX270F256D-I-PT/PIC32MX270F256D-I-PT-ND/4876287 256kB Flash and 64kB RAM
has USB OTG support too
Might be tough without the ARM core though...
hmm
non-arm is doable
main thing is having gcc support
there is a little assembly needed for the nlr mechanics too
what is the appeal with pic32?
mostly just trying to do something that's not been done quite yet
I like challenges. though to be fair, I have a number already haha
most challenges are software challenges
one challenge would be getting running on cortex-a
hmmm
I do see that there already is quite a big undertaking for RPi and other similar boards
you mean blinka?
yeah
oh I see
so you can plug in and edit away like any other board
that is a bit of a challenge huh
lots of low level software challenges when thinking about running right on the bare metal
I am working on some FPGA projects
like the ICE40 feather wing I talked about last week on show and tell π
it's a small step towards getting the biggest FPGA I can on a feather wing hehe π
π what are you doing on the software side?
right now mostly just trying to load a simple blink verilog file to it
after that, reworking one of the binary to header libraries for C to work with CP
basically need to turn a binary into an array to be spit out over SPI
have you looked at my systemonachip library?
I have not
I've done a bit of that for the machxo2. I have loading over i2c from cp working
I'm trying to create python classes that are both the driver and hardware def
@slender iron SPI works OK on esp32s2- saola-wroom -- with rfm9x featherwing.. Same code failed on wrover
sorry for double tag -- posted to wrong channel
kk, so it is a ram thing
π
GitHub
I have ported a small project for ECP5 JTAG programmer from micropython to circuitpython: https://github.com/emard/esp32ecp5/tree/master/circuitpython Last known good circuitpython that runs it cor...
very interesting, that might work for the ICE40 chips
@emard Can you confirm it works for you with psram disabled? I think we're trying to dma from memory that can't be used for DMA.
ya, my hope is that we can distribute bitstreams with the python lib so it's easy to load and then use
I'm not aware of i2c on the ICE5LP*K but I'm sure there are a few of the ICE40 Ultras that do have i2c programming
the same approach should work over spi
you may want to try and do an 8 bit bus over the featherwing
yeah, just a few minor tweaks
I'll play around with it in the coming weeks. I just got the new regulators to replace the ones I got which didn't provide the right voltage so that will be happening over this week
π
the next thing I'm hoping to do is create an i2c to wishbone harness for the xo2 to test peripherals on it
@solar whale mind answering https://forums.adafruit.com/viewtopic.php?f=60&t=168979 when you have time? thanks!
That would be interesting
ya, I think so. basically start with individual peripherals and then work up to self-contained socs
@slender iron where does displayio take care of the transposition and X/Y mirrors when actually sending pixels out to the device?
@onyx hinge https://github.com/adafruit/circuitpython/blob/main/shared-module/displayio/TileGrid.c#L313
its done on a tilegrid basis. the buffer it fills is in native display orientation and the bitmap is read by row as well
@catequalsgood try disabling the Dotstar in the board definition you are using. It will configure SPI if it's marked as a status LED for the board.
what about when the whole display is transposed, not a TileGrid?
it get propagated down into the tilegrids via the transform
@kevinjwalters and @tannewt, Iβm willing to pitch in on this issue. I read through the related issue and hereβs what I gather:
Thank you! I'm happy to give pointers on this.
Need a way to call for an immediate (blocking?) screen refresh. I assume this would be an empty call
display.refresh()or withtarget_frames_per_second=None.
Yup, blocking is good. I think we could change the API so that the default means now. It'll be good to have the target fps explicit otherwise.
...
@slender iron if my display is native 32x16, and the rotation is 90, should its core.area = {x1 = 0, y1 = 0, x2 = 16, y2 = 32 } transposing x and y?
yes, I thiiiiiink so
Here is the notes document for Wednesday 9 September 2020's CircuitPython Weekly meeting. It is being held on a DIFFERENT day, at the typical time of 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if youβll be attending the meeting - itβs super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and weβll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1Zeeb_ZJltPcESMhRtofP4_QGoLWagNtAPfoAeA2q8Ms/edit?usp=sharing
Their github doesn't look very active so I emailed their sales email from their website.
@wuxx Please provide a USB VID and PID for this board.
Also, you probably don't want to restart if there was an error, only if it was a normal end of the program. I might be overthinking this.
I don't think you are overcomplicating it. I think it is complicated.
Another aspect is what file should be run on reload. We don't know what file has been changed when the FS is written. My guess is that we want the currently running file reloaded (and therefore we need to preserve the filename past start up into the new heap.)
A related use to ...
We discussed this in today's weekly meeting: https://youtu.be/CqDPd4dVNaI?t=3530
The conclusion was that this is expected Python slowness setting up the transaction. The gap between 4 bytes transmitting is due to manually providing bytes to the peripheral rather than using DMA.
I think a property would be best. It would return the latest report received.
One question here plus one on the library. Should this take native pins only? Is it prepared for a DigitalInOut-like class?
Why copy this table? Seems better to use a macro to change its type and types inside it.
where is download for non-PSRAM circuitpython?
I have only WROVER-S2 with PSRAM and
circuitpython binary automatically enables it.
@emard try loading the WROOM version. It should work just fine and not use the PSRAM.
Essentially every single line in the table is different (e.g, MP_OBJ_FROM_PTR vs MP_ROM_PTR). Yes, I can create wrapper macros that switch between these. I'll do that
So, I might be misunderstanding, but are you suggesting that supervisor.reload('file_name') would permanently override code.py/main.py as the file for reload? Or, are you talking about behavior on the next reload after an error? Or, neither of those...
spi loopback works with
adafruit-circuitpython-espressif_saola_1_wroom-en_US-20200831-877a4f4.bin
which doesn't work with PSRAM version
but I can't test real thing ecp5.py because
out of memory at wroom circuitpython
One question here plus one on the library. Should this take native pins only? Is it prepared for a DigitalInOut-like class?
I am taking DigitalInOuts because the calling library already needs to use them to do the initial hard reset of the adapter. It's not prepared for a duck-type DigitalInOut class, but I think we can code for that internally when we need to. I could imagine that there's an internal software HCI adapter that has rts and cts signals that are not actual pins, so ...
This is wrong, it should says to use set_adapter().
Hardware mailboxes although relatively common arent available on all implementations. I'm guessing they could be emulated using filters and buffers. I'm definitely not an expert. Here is a short description on why they are nice,
https://forum.macchina.cc/t/canbus-mailboxes/710
They also have a lot of nice hardware and software for vehicle OBD2 / CAN exploration
@catequalsgood When LFCLK is off, the current of nRF52840 is a few uA. While, other parts of the board may have higher power consumption. As you see, a LED takes about 0.95 mA.
The hardware I used is the M60 keyboard. It is optimized for low power consumption. Other parts of it still needs around 50 uA.
Anyone know why help with circuit python is gone?
HiοΌnanoESP32-S2 has two USB portοΌone connect to CH340 which is usb to serial IC from WCHοΌ
the another USB is from ESP32-S2οΌthe USB VID & PID is define in your codeοΌWe hasn't register USB VID & PID currently.
I reupload the default firmware (from https://github.com/wuxx/nanoESP32-S2), and I got this VID/PID used for tiny USB Mass storage
VID: 0xCAFE
PID: 0x4003
Should I use this one ? I don't know how to check if this is a valid VID/PID.
Here is USBDeview screenshot

this vid/pid is the demo code from expressif, if just for test yourself, you can use it freely
I want to add this board to circuitpython, I follow @tannewt's instructions but I need a unique VID/PID to finish my pull request.
So I guess as cool as having CAFE β as VID is, it won't be OK for this purpose ?
ok.... if you or ciruitpython don't care about the USB vid/pid register things... just use it.
and the vid CAFE currently not belong to any company...
here is some reference:
How to obtain an USB VID/PID for your project
https://www.voti.nl/docs/usb-pid.html
The USB ID Repository
http://www.linux-usb.org/usb-ids.html
How to get a PID code
http://pid.codes/howto/
I wont to convert a unixtimestamp to localtime in circuit python.
This is the simple code:
unix_correction = 946684800 # correct to 01-01-2000
timezone = 7200
t=1598887049
def convertUnixTime(t,timezone):
dummy=time.localtime(t-unix_correction+timezone)
return "%4d-%02d-%02d %02d:%02d" % (dummy[0],dummy[1],dummy[2],dummy[3],dummy[4])
Running it I get the error message:
"timestamp out of range for platform time_t"
could not found a solution for this problem (it is wor...
Thanks for everyone's explanations and tips!
I removed the DotStar in the board definition (I think) by removing the following lines from mpconfigboard.h
#define MICROPY_HW_APA102_MOSI (&pin_P0_08)
#define MICROPY_HW_APA102_SCK (&pin_P1_09)
That dropped the current during sleep to 0.95 mA which is obviously way better than what I got when turning off the LED using adafruit_dotstar.Dotstar. Just out of curiosity I did also try physically removing the LED from one of my i...
If we still see problems about "asio" in the esp32s2 build we'll probably want to revert this. but if they magically disappear, yay.
I want to add usb_hid for a braille display.
In the hid_report_descriptors I have added my own report descriptor and I noticed that for the output reports I can't have a report count larger than 8 (0x08).
Is there a limitation for the report count?
Here is the output report I am talking about, there are also other output reports but this is the only one that exceeds 0x08.
# SET DOTS
0x09, 0x41, # 08|1 , Usage (vendor defined)
0x85, 0x...
When you say "I can't have a report count larger than 8 (0x08)", do you mean we are printing an error when you do that? Could you be more specific about the problem you're encountering?
Update display.refresh to force immediate redraw with display.refresh() or display.refresh(target_frames_per_second=None), even with auto_refresh=False.
This is to resolve: https://github.com/adafruit/circuitpython/issues/2696
This failed all the ESP32-S2 builds.
Am I the only one who finds openocd super frustrating to set up/use? It seems like there's so little documentation on how to find the right configuration files/settings for your application
I have not grown used to it either
but once I figure it out I put the settings in a script and forget about it
for my sam e54 which has to use openocd .. ```$ cat start-stub-same
#!/bin/sh
exec /home/jepler/.local/openocd/bin/openocd -f /home/jepler/.local/openocd/share/openocd/scripts/board/microchip_same54_xplained_pro.cfg -c "gdb_port 2331"
so if you figure out how to launch it for esp32s2 let me know
probably involves $HOME/.espressif/tools/openocd-esp32/v0.10.0-esp32-20200420/openocd-esp32/share/openocd/scripts/target/esp32s2.cfg
@tannewt I cracked the case so we don't need to have a discussion about how rotation is supposed to work. But maybe if you end up wanting to request changes we can take that to a chat and get it resolved quickly so this can be merged. I'm eager for this family of bugs to be fixed.
@onyx hinge yeah my biggest problem is simply that it loves to rely on these super specific files and whoever wrote their documentation just assumed that you would know what you need and where it is, magically?
yup. If you had the time and energy you could try contributing to their documentation but you never know how that will be received when you're starting as an outsider
Iβve not extensively tested yet, but have at least confirmed this resolves a huge and consistent problem with rotation that would previously cause a HardFault, or occasionally would run but graphics appeared in the wrong position on the matrix.
@ionic elk I used openocd once long ago to fix some fuses on Atmel boards, and found it quite frustrating. I was greatly relieved to be able to switch to the J-Link, which "just works".
@onyx hinge they aren't even on github, which gives me bad feelings about how receptive they would be to outside contribution
o_O
Honestly the whole project is kind of impenetrable, does anyone know who even runs it? Like, is it just some guy, or is it sponsored, or what?
@ionic elk Did you see there are mailing lists? http://openocd.org/discussion/mailing-lists/
I meant more along the lines of a wiki, or a readthedocs. Maybe it's the entitled millennial in me though lol. I've never really "gotten" mailing lists.
We have one for A2, and it seems so hard to follow conversations - I always figured there was some kind of special client I was missing that made them practical to use
Are there known issues with CLUE and the current CP main? I am not seeing the REPL displayed on the screen and the 'spirit level' demo does not work -- no errors, just no display.
works ok with CP 5.3.1
No REPL on display with 6.0.0-alpha3 and later -- REPL works OK in terminal
The display does show the blinka icon and the bootup messages
Confirmed same symptoms on a CLUE on my end as well.
6.0.0-alpha.2 is working correctly for me also.
Thanks for confirming ...
Mine is one of the "early" CLUEs that got listed in those first few listings at small QTYs. I know there was a warning on the page that hardware might still change, not sure if it did end up actually changing or not, and if so whether that change could affect this issue or not, but mine would be one of the earliest versions that were actually shipped out.
With 6.0.0-Alpha3 and later, on a CLUE I am not seeing the REPL displayed on the screen.
I also tried running the 'spirit level' demo does not display anything -- no errors, just no display.
works ok with CP 5.3.1
and
6.0.0.alpha2
The REPL is woking OK in the terminal session, just not echoing to the display.
@solar whale btw, does your clue present as CLUEBOOT, or F840BOOT when in the bootloader
I am helping some folks with a batch of CLUEs that are acting badly on MacOS. OK, thanks, I seem to have one CLUE that has FTHR840BOOT, for unknown reasons.
I have an older one as well
maybe it was my fault
IIRC the original batch were FTHR840BOOT
Mine is on MacOS now -- no issues with that.
I was testing the "bonsai buckaroo" and it was working fine, but then i tried one of the graphic demos (spirit level) and it would not display. That s when I noticed the display was not echoing the REPL at all. So everything except display code seems to be working OK.
I seem to have "new old stock" with FTH840BOOT
I found one that does FTH840bOOT as well
I have had CLUEs with the FTHR840BOOT
Have to walk dog now. Iβll try some other displays later and try to pin down when it broke
Thank you for this! Just a couple tweaks to make. Don't forget to update the function signature in the doc comment too.
{ MP_QSTR_target_frames_per_second, MP_ARG_OBJ | MP_ARG_KW_ONLY, {.u_obj = mp_const_none} },
if (args[ARG_target_frames_per_second].u_obj == mp_const_none) {
You can simplify this by setting it to mp_const_none by default. Please also update the documentation comment above. The type will be Optional[int] with the value None.
Ok, thanks for testing this! I've gotta decide how to fix it. We want bytearrays in PSRAM by default but need them in RAM when sending them to SPI.
@ladyada How do you want to handle this?
[adafruit/circuitpython] Pull request review submitted: #3344 Fix RGBMatrix, FrameBufferDisplay bugs
@tannewt I cracked the case so we don't need to have a discussion about how rotation is supposed to work. But maybe if you end up wanting to request changes we can take that to a chat and get it resolved quickly so this can be merged. I'm eager for this family of bugs to be fixed.
What was the issue? It's not clear to me why you changed what you did.
Why are you clearing the core state?
I'm trying to flash nRF52 Radio Soft Device to the usb dongle, but I got this error: `
2020-09-01 20:03:31,019 LIBUSB_ERROR_ACCESS: Unable to connect to trigger interface.
Traceback (most recent call last):
File "/home/yannes/.local/lib/python3.8/site-packages/serial/serialposix.py", line 265, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
PermissionError: [Errno 13] Permission denied: '/dev/ttyACM0'
During handling of the above exception, a...
Looks great! Thank you!
@catequalsgood Yup, that's what I was thinking to disable the dotstar status neopixel. I'm not sure what the lowest possible value is. @xiongyihui's work is the best indication of it. When I added the low power support, it was mainly to get the code base ready for it.
I think we'll want a separate function rather than putting it in reload. That way the code can set if for all reload causes, not just manual reload. Something closer to set_next_stack_limit: https://circuitpython.readthedocs.io/en/5.3.x/shared-bindings/supervisor/__init__.html#supervisor.set_next_stack_limit
Then we can have multiple kwargs for different reload reasons or separate functions. I imagine you want: reload, exception, safe mode and completion as reasons.
I don't know how most folks use refresh, but currently it can be used solely by setting the minimum_frames_per_second to a given value and the target_frames_per_second will default to 60.
I wrote this version to closely replicate the current version, so it would default to target_frames_per_second value of 60, and the only change is to accept the None value, or called with no parameters at all to trigger the immediate refresh.
Before making the change and updating the docs, I...
Hi, for board specific support please contact the manufacturer. Looks like MakerDiary has a support forum here: https://community.makerdiary.com/
@ciscorn Oddly some literal backspace characters appeared in some translations:
/home/weblate/data/vcs/circuitpython/main/locale/ja.po:2146: warning: internationalized messages should not contain the '\b' escape sequence
I have corrected the problem by deleting them.
The messages were
#: shared-bindings/displayio/Palette.c
msgid "color must be between 0x000000 and 0xffffff"
msgstr "θ²γ―0x000000γγ0xffffff^Hγ§γͺγγγ°γͺγγΎγγ"
and
#: py/runtime.c
#, c-format
msgid "ne...
OK to merge once CI finishes
PyPortal works normally with 6.0.0.alpha3
I need min buf size of 4K. If I can have 16K there's small performance gain
python maybe needs help to place bytearray in RAM instead of PSRAM.
buf=machine.ram(bytearray(512)) or similar... but that are just my random
thoughts, any fix is good thing :)
On 9/1/20, Scott Shawcroft notifications@github.com wrote:
Ok, thanks for testing this! I've gotta decide how to fix it. We want
bytearrays in PSRAM by default but need them in RAM when sending them to
SPI.--
You are receiving...
I made a commit to include the changes requested, including the update to the documentation..
It broke between these 2 builds from S3
last working build
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.2-432-gfe73cfb92 on 2020-08-27; Adafruit CLUE nRF52840 Express with nRF52840
>>>
>```
not working
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.2-434-g610002724 on 2020-08-27; Adafruit CLUE nRF52840 Express with nRF52840
To test the output report I am using a tool called SimpleHIDWrite. The error I get is from this tool but it's not a specific error, rather a generic one: "A device attached to the system is not functioning".. but if I get the report count down to 0x08 in the report descriptor and then test it with SimpleHIDWrite it works.
My thoughts were that maybe there is a maximum limitation for report counts which you can input in the hid_report_descriptors.py
this commit made some changes to code common to all ports - no idea why to would impact CLUE and not PyPortal though ... https://github.com/adafruit/circuitpython/commit/a15f948a406b498691bbc41645c95d99aa1cd458
Nothing in the other commits jumps out as a likely cause.
hmm weird -- now ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 6.0.0-alpha.2-432-gfe73cfb92 on 2020-08-27; Adafruit CLUE nRF52840 Express with nRF52840
@slender iron did you ever get any further with ESP32 debugging than the thread issues you were running into when you did your stream?
I'm getting the same "The current thread has terminated" and "Cannot kill process" stuff
Google is surprisingly useless at turning up anything for it
As best I can tell we don't have "thread awareness" but it's really not very clear on how to fix that: https://www.esp32.com/viewtopic.php?t=2755#p12946
Espressif ESP32 Official Forum
Repeated the search and now find that the last working version was
Adafruit CircuitPython 6.0.0-alpha.2-26-gb7e6bf959 on 2020-07-25; Adafruit CLUE nRF52840 Express with nRF52840
and first broken version was
Adafruit CircuitPython 6.0.0-alpha.2-43-g7ab5c520e on 2020-07-25; Adafruit CLUE nRF52840 Express with nRF52840
HOWEVER when I reloaded 6.0.0-alpha.2-43-g7ab5c520e worked for REPL, but not when I ran a program thatt used the display it did display but with odd behavior -- after ...
I think I landed on the answer, adding -Wl,--undefined=uxTopUsedPriority to LDFLAGS seems to have done it... whatever that means π
Reverting the changed in #3190 seems to fix it.
[Jerry-desktop-mini:circuitpython/ports/nrf] jerryneedell% git diff
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 3fef68e88..1fdf79958 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -89,13 +89,11 @@ ifeq ($(DEBUG), 1)
CFLAGS += -ggdb3
OPTIMIZATION_FLAGS = -Og
else
- OPTIMIZATION_FLAGS ?= -O2
- CFLAGS += -DNDEBUG -ggdb3
+ CFLAGS += -Os -DNDEBUG -ggdb3
CFLAGS += -flto -flto-partition=none
...
Yay! I can safely say I have a CLUE again....
This was "fixed" once before !? https://github.com/adafruit/circuitpython/pull/3249/files
oh that was closed without merging, because we thought https://github.com/adafruit/circuitpython/pull/3281 fixed it instead
@ionic elk nice! I never figured it out
@tulip sleet can you reply to this: https://forums.adafruit.com/viewtopic.php?f=60&t=168968
@slender iron yes, though not right away. will put it on my list
I incorporated these requested changes, and updated the documentation to reflect the new default value.
@onyx hinge when you have a chance, would you please add those notes to the clue issue?
@solar whale why doesn't discord do that automatically?
add that to the bot
I'm not sure how I did it but I just made a broken touchio.TouchIn(board.P0) . I had been using P0 for other things but I'm fairly certain I then did a a control-D and control-c in REPL to reset things. The value was always False. The threshold was 100. I power-cycled and it's working now and has a threshold of 161.
Could this be related to the this issue?
A similar fix was offered at #3249 but closed without merge because @dhalbert filed #3281 and @DavePutz reported that it fixed #3247.
Were any other nrf-with-display boards tested? This reminds me, I had trouble with the Sharp Memory Display corrupting random lines of the display with nrf52840 and not on other micros. I chalked it up to the particular device being a Particle Xenon rather than an Adafruit board and moved on with a different board (that happened to be non-nRF)
Issue #3296 is another case where compiling with -O2 optimization on the Clue broke something (in that case, BLE). @dhalbert has mentioned that these sorts of issues are most often due to a bug such as an uninitialized variable or something that should be volatile is not. I have spent a lot of time looking at #3296, and have traced it down to compiling ports/nrf/common-hal/busio/SPI.c with -O2 causing the BLE issue. But, I have not found anything in that source file that would seem to fit Da...
Weird my clue works with 600a3
@solar whale was there more to reproducing this problem than trying to show text on the lcd?
Does it continue to echo the REPL. Try loading a graphic program like the spirit level demo
It was clearly flaky. Not always consistent.
Running graphics hosed the REPL echo
I always saw the boot messages, just nothing beyond if I entered the REPL
Help with circuit python room is gone. Does anyone know why?
Hit the help category
If there are no new messages and itβs collapsed, it wonβt show the rooms.
Itβs there for me, I see your post.
Is the https://circuitpython.readthedocs.io/en/latest/shared-bindings/supervisor/index.html#supervisor.Runtime.serial_connected caveat still accurate for SAMD, and what is the cause of this limitation? What about other ports? I'm wanting to come up with a way to store exception info when not connected to serial, but if supervisor.runtime.serial_connected isn't a reliable indicator, then I want to avoid disable_concurrent_write_protection in storage.remount.
If there's no SD card, the only other thing I've come up with is using nvm with a simple wear-leveling algorithm.
Thanks for fixing it! I don't know why it happened.
Images automagically compressed by Calibre's image-actions β¨
Compression reduced images by 70.9%, saving 8.01 MB
| Filename | Before | After | Improvement |
|---|---|---|---|
assets/images/boards/large/aloriumtech_evo_m51.jpg |
63.21 KB | 56.43 KB | -10.7% |
assets/images/boards/large/blmbadge.jpg |
82.63 KB | 43.93 KB | -46.8% |
assets/images/boards/large/espressif_kaluga_1.jpg |
233.94 K... |
Images automagically compressed by Calibre's image-actions β¨
Compression reduced images by 1.3%, saving 274 bytes
| Filename | Before | After | Improvement |
|---|---|---|---|
assets/images/boards/small/raytac_mdbt50q-db-40.jpg |
20.62 KB | 20.35 KB | -1.3% |
<details>
<summary>Some images were already optimised</summary>
assets/images/blinka-computer.png- `assets/images/blinka-computer@2x...
This sounds like a good general approach. As I envision my current use case, I just need to reload with a specific file without affecting any of the defaults. Though, with more options, my use case might evolve.
After some thought, I think that just setting the file name for the next run would solve 90% of m case as well β the users always can reset the device to get back to the menu, and an "exit the game" option can be provided by the library, which would then do the correct thing.
Is there a (significant, single) dma portion? If so, an option to return while that is running would be useful?
I experimented with this a while ago, when displayio was just being created, and the gains were negligible.
@tannewt Here's the relevant commit message about the rotation fix:
The expectations of displayio.Display and frambufferio.FramebufferDisplay
are different when it comes to rotation.
In displayio.Display, if you call core_construct with a WxH = 64x32
and rotation=90, you get something that is 32 pixels wide and 64 pixels
tall in the LCD's coordinate system.
This is fine, as the existing definitions were written to work like this.
With framebuffer displays, however, the underly...
This line can probably be removed. In Arduino, either your program is starting fresh so the heap is zeroed OR you allocate storage with operator new which returns zero-filled storage. In CircuitPython, this storage could be filled with data left over from earlier. I wanted to eliminate the possibility that any bugs encountered were due to core containing something other than zeros when _PM_init is called.
@PaintYourDragon do you want to say whether it is OK to call _PM_init with core pointing to a memory region full of junk, and if it's not we can deal with that as a protomatter bug rather than a circuitpython bug?
This PR adds a camera module. It allows you to take a picture of different sizes.
It was tested on the Spresense board.
I realized that I can use USBlyzer together with SimpleHIDWrite (the application for which we do not have the source code).
So I get the following response in the USBlyzer when sending the set dots output report with report count larger than 8:
URB Control Transfer failed
Device Object 0000005b
Driver Object usbccgp
URB Function URB_FUNCTION_CONTROL_TRANSFER
URB Status USBD_STATUS_STALL_PID
Endpoint 0 Default Control
Request Set Report
Report Type Output
Report ID 1
Report Le...
@hathach Could this be a tinyusb issue?
@kamtom480 You can test the stub generation by doing make stubs in the top-level Makefile.
It could be.. I mean that's the first place I have searched after I discovered that it worked with a smaller or equal report count than 0x08 but I couldn't find anything related to any limitation of the report count or something that could go wrong if you input a bigger report count size.
if not necessary. Could just always set to false.
This is a .c file, but it has .h header guards.
Can remove the periods in all these messages to save space. Exception messages don't have periods in general.
Very nice! I am impressed by how clean the code is. Maybe that also says something about the ESP-IDF API being reasonable.
I don't know if you're asking what the exception should be, but in CPython, the socket exceptions are now all subclasses of OSError, so the exception seems fine.
Is this a TODO, or does nothing actually need to be done?
Move line 90 down to just before or after line 95, just for clarity. (I just like to see the base.type always set immediately after the m_new_obj().
I also tested Sharp Memory Display 400x240 in portrait/rotated mode and it works.
In case you were wondering, it seems you can change the default branch setting for yourself (in the case of repos you create, not repos you fork) at https://github.com/settings/repositories -- for an organization, it's at https://github.com/organizations/org-name/settings/repository-defaults
(so happy to switch it over for my github user!)
goes and changes my orgs
Ok I think the docs are now ready to go.
Do you reuse the buffer? Would it work if we moved the bytearray into RAM when first used for DMA?
[adafruit/circuitpython] Pull request review submitted: #3344 Fix RGBMatrix, FrameBufferDisplay bugs
This is fine as-is. You can merge if you like or update with my suggestions.
Ok, I think this is fine. I was confused because core meant display core to me. Renaming this to protomatter_core would be clearer.
Also, I'd expect rgbmatrix_rgbmatrix_obj_t to be defined in a shared-module header, not shared-bindings because it is implementation specific.
Compress common unicode bigrams by making code points in the range 0x80 - 0xbf (inclusive) represent them. Then, they can be greedily encoded and the substituted code points handled by the existing Huffman compression. Normally code points in the range 0x80-0xbf are not used in Unicode, so we stake our own claim. Using the more arguably correct "Private Use Area" (PUA) would mean that for scripts that only use code points under 256 we would use more memory for the "values" table.
bigram me...
[adafruit/circuitpython] Pull request review dismissed: #3344 Fix RGBMatrix, FrameBufferDisplay bugs
This is fine as-is. You can merge if you like or update with my suggestions.
@tannewt OK check out the just-added commit, should make no difference to behavior, it's strictly moving that structure definition and renaming the 'core' member to 'protomatter'. https://github.com/adafruit/circuitpython/pull/3344/commits/17a5a85528525352ec1821127fafec2acb239196
as tempting as it was to just merge and be done with it π
π
@slender iron thank you, good reviews really do help.
I don't always keep the big picture stuff in mind, and it's easy to miss things that will confound the next person working in or reviewing the code, like core.
I think the main question is whether this is going to be a Spresense-specific module, or whether the API is generic enough to use for other devices. I'd prefer the latter.
Given that, I would suggest not defining a fixed set of image sizes, but just the pass the width and height in to the Camera constructor, and have size be validated for the particular camera. We may want to support the same API with other cameras that support other sizes. Then the ImageSize class can be completely re...
Remove trailing comma here.
Thank you! Camera support is exciting and I agree with Dan. I'd like to see one API work for many cameras.
I'd like @PaintYourDragon to take a look as well because he's looked at the OV something something cameras too. The ESP32S2 Kaluga comes with an OV2640.
Two main questions I have are:
- How does initialization vary with different cameras?
- How does pixel collection vary? Is it different per-camera and per-port?
.name = MP_QSTR_Camera,
Move this down to SRC_BINDINGS_ENUMS and you won't need the empty common-hal file.
I'd prefer passing in a file-like object or a bytearray. This could then be:
//| with open("/sd/image.jpg","wb") as file:
//| cam.take_picture(file)"""
It could also be:
b = bytearray(width * height)
cam.take_picture(b)
What format will it produce? That seems missing in this API. I could see wanting a raw rgb565 to display on the screen for example.
Is it possible to change the image size on a per-picture basis?
@tannewt I don't think we know the know the size of the buffer in advance if the image is compressed, so we can't necessarily pass it in. We know the max size but that may be far larger than the compressed size.
I don't always keep the big picture stuff in mind, and it's easy to miss things that will confound the next person working in or reviewing the code, like
core.
@onyx hinge I'm on the opposite end. I think too big picture sometime and miss the details. My sinus headache helped with thecoreconfusion. π
If the low-level camera code could write directly to a stream (e.g. a file), then that would save having to allocate any RAM. But I don't know if that's possible.
@slender iron @tulip sleet the H7 series STM32 also comes with a built in camera module
oh my goodness, here's a Python idiom I didn't know about for substituting a value instead of a falsey value (usually None). E.g., Instead of:
if foo is None: # use default of 33 if foo is None
foo = 33
you can do:
foo = foo or 33
huh
because the or operator returns the operand, not just True or False
you have to being willing to give up strict None checking but often on writes if not foo: or similar anyway
you and can also do foo = foo if foo else 33
right, I was doing that, but this is shorter and is the same thing
of course if it's a kwarg then you should just set the default
i can't atcually, in this case, because the default is board.ESP_BUSY, which might not exist... or would that work anyway, because it doesn't get eval'd if the arg is supplied?
I should check that
nope, can't:
>>> import board
>>> def f(x=board.FOO):
... print(x)
...
...
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'FOO'
it'd fail on import I think
then it might fail on import anyway, oops, have to use getattr, maybe
no, that is OK:
>>> import board
>>> def f(x=None):
... x = x or board.FOO
...
>>>
it'll error when you call it
not if x is not None
correct
so this works nicely:
self._reset_io = digitalio.DigitalInOut(reset_pin or board.ESP_RESET)
I find that style perfectly good, lots of languages uses that kind of chaining. but it is a surprise the first 7 or 77 times you encounter it, depending how much you understand and/or (and whether you bring wrong comceptions of how and/or operate in other languages to the discussion)
(e.g., a || b in C is either false or true, it's not 'the value of a if it's truthy, otherwise the value of b')
I think this is now fixed on the system side, and we can close it.
this keeps getting stranger -- With the build i crated yesterday - reverting the optimization settings, the CLUE works normally as long as it is connected to the computer USB port. If I power it via a battery alone, the Display does not work. The program in code.py runs, but nothing is displayed. If I go back to CP 5.3.1 it works normally via battery.... It seems like something in the display is requiring the USB connection to be active...
I'm confused!
It's all 600 lines of my code so I can fit this to let it work
buffer is reused for performance (it is allocated only once)
but just give me some hint how should I use it now.
I can make during init a dummy DMA for the first time to
let buffer move into RAM or something similar, just fine
On 9/2/20, Scott Shawcroft notifications@github.com wrote:
Do you reuse the buffer? Would it work if we moved the bytearray into RAM
when first used for DMA?--
You are receiving this because...
I'm going to give something a try soon, once some parts come. The problems I have on Linux with USB and crashing/rebooting/unplugging CircuitPython boards are not as severe as some people here, but I've decided to try having a dedicated computer to plug the CircuitPython board I'm developing for into. I'll be attempting to use sshfs to access the device's CIRCUITPY and XYZBOOT files from my desktop, and probably running the serial terminal also in an ssh.
For the most part I don't have crashes on unplug, but the thing that's a real thorn in my side is that when I have gdb+jlink running and it is at a breakpoint for very long, my keyboard will stop being able to type until I unplug the debugged circuitpython board. So as long as the pi isn't super crashy in these circumstances, I will mind less if I have to reboot it multiple times per day than what I have to do now to recover from the confused USB due to debugger halt.
@onyx hinge for the gdb case get a usb cable that can disconnect the data lines
I can reproduce this as well. But, I don't think we can blame this one on
the -O2 optimization. I tried the
first build after that change went in (7ab5c52
https://adafruit-circuit-python.s3.amazonaws.com/bin/clue_nrf52840_express/en_US/adafruit-circuitpython-clue_nrf52840_express-en_US-20200725-7ab5c52.uf2)
and the display still works with the battery. I'll see if I can
narrow down which commit broke this functionality.
On Wed, Sep 2, 2020 at 2:42 PM jerryneedell notifications@github.com...
@slender iron I have those but I almost always want to see the serial output too so I'm trying to figure out how to split the baby on this one
@tulip sleet if you were going to tackle the "rgbmatrix as built in display", please let me know if you run into trouble. I think it should be doable, but I didn't do it.
I turn data off the moment gdb breaks
and if I'm using gdb I don't usually rely on serial usb
if only there were a way for debug prints to come not through usb. even better if it was a standard, like swd.
yeah same here .. and I'm not sure if pins are connected on the boards .. ?
they may not be
stm32f405 feather, the first I looked at, swo isn't connected at the debug header
Ya, I think either a buffer with an exception if its too short or a file-like is the best option.
JTDO is used as FLASH_SCK so if it's SWO that won't work
I don't think those are necessarily the same. what chip are you looking at?
SWO is connected on Metro M4
π
first I was talking about STM32F405 Feather, had just taken a quick look at the schematic from learn
so I guess it would be interesting if in a debug build of metro m4, stdout went on swo also?
ya
I need more stuff to do to avoid making progress on can, eh
Reusing it is definitely the way to go.
I don't think there is a way to currently get this to work. It requires some changes under the hood to move memory as needed. Hopefully it'll just work in the future with a copy cost on first DMA.
With a pushbutton input, is there an easy way to detect long press as opposed to short press?
we don't have a library. you can track the last time it was unpressed and then compare the duration when it is pressed
What I want to do is e.g. "if pressed for one second, do x and stop"
Unicode designates a number of ranges of code points as "private use areas". This is commonly abbreviated PUA. The initial implementation used the private use area starting at 0xe000. However, the current implementation uses a different region of code points, 0x80 through 0x9f, which are officially designated for other uses within Unicode but should never appear in source or translated strings in CircuitPython. (for instance, the unicode code point 0x9f indicates APPLICATION PROGRAM COMMA...
But not disrupt short press behavior.
how are you detecting the short press?
but1 = digitalio.DigitalInOut(board.A0)
while True:
if not but1.value:
keyboard.sendcode(Keycode.SHIFT, Keycode.P)
sleep(0.5)
so you can get a reference time with time.monotonic()
Sleep is to prevent multiple keypresses with a click.
right, on a long press would you want to send the keycode too?
So my question with time.monotonic() is how can I make it time out? I don't want to have to guess how long to hold the button.
Long press: different keycode
I want it to be like, press-release: send A, press-hold, timeout after time x and send B
you save the time the button was last not pressed and compare the current time to that when it is pressed
But that just evaluates on release, right?
it depends on how you implement it
I just couldn't figure out how to have it time out in the way I wanted.
I think the tricky thing is that you will need to detect a release
otherwise you can't tell a short press from waiting for a long press
I want it to be like: on press, start timing. On release do A. If no release after 1s, do B then stop.
hrm
something like: ```python
but1 = digitalio.DigitalInOut(board.A0)
last_pressed = but1.value
last_press = None
while True:
pressed = not but1.value
now = time.monotonic()
if not last_pressed and pressed: # press
last_press = now
elif last_pressed and not pressed: # release
if now - last_press > 1:
# long
else:
# short
keyboard.sendcode(Keycode.SHIFT, Keycode.P)
sleep(0.5)
last_pressed = pressed
Seems that the cause of this is PR #3244. The intent was to turn off QSPI
when USB was not connected.
Looks like this is interfering with the display on the Clue ??
On Wed, Sep 2, 2020 at 5:08 PM Dave Putz dwputz@gmail.com wrote:
I can reproduce this as well. But, I don't think we can blame this one on
the -O2 optimization. I tried the
first build after that change went in (7ab5c52
<https://adafruit-circuit-python.s3.amazonaws.com/bin/clue_nrf52840_express/en_US/adafruit-circuitpy...
@slender iron thanks. But this waits for unpress, right?
it does but you should be able to modify it
Okay, I have to study it. I am not very good at python.
np, this is good practice
Great news, we closed reception for speakers and talks for DΓa CircuitPython, we have a full agenda for the day.
https://diacircuitpython.org/schedule
One of the talks will be about designing new board for CircuitPython, and another on how to get UF2 to a new board. So we will have to add eng subtitles, as I'm sure you folks will love them.
@dhalbert it should be fine, the stack can have both input & output report up to 64 bytes. It is probably something with the hid descriptor.
Ok, let me know when I can pull compiled binary and test.
In the meantime I took WROVER-E with micropython and
tried my source with 256KB buffer which is required to hold
content of erase block of new FLASH chips and it works good,
and with some speedup as buffer is larger.
I don't know how they make this work, is old ESP32
better handling PSRAM DMA but I guess WROVER-E
with all loaded is not likely to have 256KB free in RAM.
On 9/3/20, Scott Shawcroft notifications@github.com wrote:
R...
Thanks for all comments. I wanted to make a module that can be used for other ports. My implementation was based on this: https://learn.adafruit.com/ttl-serial-camera/circuitpython-python-usage
About ImageSize, I wanted the user not to have to search and type correct and supported height and width by himself, but could use the predefined sizes. I thought that in the case of more devices supporting the camera, the list of available sizes will grow. Sizes that were not supported by the cam...
It i possible to change the image size on a per-picture basis. For example:
cam = camera.Camera(camera.ImageSize.IMAGE_SIZE_2048x1536)
cam.take_picture()
cam.size = camera.ImageSize.IMAGE_SIZE_1920x1080
cam.take_picture()
cam.size = camera.ImageSize.IMAGE_SIZE_1280x960
cam.take_picture()
For the rest, please see my comment below.
Seems like the problem was indeed caused by tinyusb.
In "lib/tinyusb/src/class/hid/hid_device.h" there is a:
#define CFG_TUD_HID_BUFSIZE 16
If you replace 16 with 64 it fixes the problem meaning I can set a report count over 0x08 in my descriptor.
e.g., I put content in ports/portname/makefile like
BOARD=boardname
DEBUG=1
include Makefile
so that when I make it picks up these flags automatically.
This change means that these files won't be picked up by git status or removed by git clean (unless -x is specified).
will the Makefile still be Downloaded when cloned and updated when it is modified?
The "Makefile" and the "makefile" are different files.
However, behavior on systems which don't distinguish between "Makefile" and "makefile", like windows, may be a reason to not accept this PR. I can't easily check those systems.
However, behavior on systems which don't distinguish between "Makefile" and "makefile", like windows, may be a reason to not accept this PR. I can't easily check those systems.
Both Windows and MacOS also have case-insensitive filesystems by default. I think those are showstoppers.
Alternatives:
- Add
-include makefile.local
to the Makefiles, and put makefile.local in .gitignore. See https://stackoverflow.com/questions/3910054/makefile-conditional-include.
...
Iβm starting to look into this issues. @tannewt, I will appreciate if you can confirm I am heading in the right direction:
shared_module\Group.c has a function called displayio_group_get_refresh_areas that seeks out the refresh areas of Vectorio, TileGrid or Group display elements. Also there is a corresponding function displayio_group_finish_refresh that Is called after a refresh is completed, that also has entries for the same three display structures.
I suspect that a n...
Congratulations to the MicroPython maintainers, who released v1.13 a couple of days ago: https://github.com/micropython/micropython/releases/tag/v1.13. MicroPython is looking towards a 2-month-or-so release cadence: https://github.com/micropython/micropython/issues/6397
This opens up the idea of us merging from upstream from a defined release.
Yay, and congratulations are sure to be in order
anyone have a neotrellis? https://forums.adafruit.com/posting.php?mode=reply&f=60&t=169064
Accounts
thanks
What is the expected output of this? @powersoft
I ran it on desktop python3.8 and it returned 1990-09-01 22:47. Is this the expected output?
The switch from 0x80 to 0xe000 here is at 64 but above in encode and decode is 32. Shouldn't they be the same? Could we do it at compile time here with a macro?
I have no idea why sleep impacts it.
Group shouldn't need to change because Shape acts similar to Bitmap. TileGrid manages it's refresh area. You can see one TODO about it here: https://github.com/adafruit/circuitpython/blob/main/shared-module/displayio/TileGrid.c#L502
You'll also want to do something similar to this: https://github.com/adafruit/circuitpython/blob/main/shared-module/displayio/TileGrid.c#L533
SCL and SDA pins were reversed for board.I2C().
Tested on a real board. Before this fix, got "Invalid pins" error.
I discovered this accidentally while trying to debug a NeoTrellis problem, and confusing a NeoTrellis M4 with a regular NeoTrellis. :smiley:
I like makefile.local because it's clearer. That said, I don't think CircuitPython builds on case-insensitive filesystems already. I had a mounted image on Mac that was case-sensitive to store it.
Thanks for all comments. I wanted to make a module that can be used for other ports. My implementation was based on this: https://learn.adafruit.com/ttl-serial-camera/circuitpython-python-usage
Great! I hadn't seen that library so that is a great place to start.
About
ImageSize, I wanted the user not to have to search and type correct and supported height and width by himself, but could use the predefined sizes. I thought that in the case of more devices supporting the camera, the...
in my experience everything except the esp32s2 will build on a case-incentive file system on a Mac. The espressif idf requires a cease insensitive file system.
I've made some additions to this port, including adding in support for F1/F0 style page-based filesystems, and fixing some issues with the clock and USB setup phases which also caused compilation errors. I'm now able to compile this for the STM32F103ZE, and I can confirm that it reaches main and at least activates TinyUSB. However, shortly after startup, I find that it crashes to the WWDG_IRQHandler, in a non-deterministic way (it happens in different places every reset cycle). I think th...
I think taking width and height as ints is best. We do it already for displays. Having an enum will make completion easier. However, I worry that we'd end up always having to expand the list of supported resolutions which cost code size for each variable name.
I agree. Either the resolutions supported could be documented elsewhere, or the camera API could return an optional list of resolutions. It may even be the case that some camera impls don't require fixed dimensions, so there is no l...
@pastel panther Bryan, thank you for posting your code for Adafruit_CircuitPython_ADXL34x and
Adafruit_CircuitPython_MPU6050 very very helpful!
@pastel panther ADXL34x tap, motion and freefall are solid examples. wondering if this could possibly be considered for the MPU6050 also, to be added
Heck, I didn't have a softdevice flashed. Nevermind! :)
care to elaborate ? i am having the same issue
Any news on the development of interrupts support for the CircuitPython? 8-)
there are some async/await small libraries to check out in the main discussion issue: https://github.com/adafruit/circuitpython/issues/1380. Are you looking for real interrupts, or async event processing?
@CatalinPopovici Could you file an issue on tinyusb? Thanks.
Ok, Dan. All is updated. Will test it next week. Just compiled it today.
Ignored the status instead. I think it'll only error when the socket itself is already closed. The IDF will clean up memory regardless.
We don't need to do anything by default but we will want something here when we support custom SSL certificates.
Ya, maybe but scannednetworks handles being called twice just fine.
@FoamyGuy and @tannewt I replicated your observation about the screen drawing related to time.sleep on an NRF52840 Itsy Bitsy.
Here is one hypothesis on why sometimes the drawing updates. In your example code, perhaps the Shape boundary gets updated to the 80 size before the screen refresh timing hits. So, even though there is no dirty rectangle tracking, if the display refresh cycle hits after the screen was drawn at 30 and then at 80, then it will only show the 80 size.
I fidd...
@tulip sleet Thanks. Iβll have a look. I am looking for anything that could work π
ah this is not a bug, but rather a usage/configuration. By default the hid bufsize is 16, which allow 1 byte for report id for composite hid, and 1 byte for report itself. TinyUSB is default to run in most common scenario with smallest footprint, so yeah you need to tweak its configuration to have more advanced features.
It may only be necessary to have a case sensitive file system to build the xtesna toolchainn locally -- that is the only place I see it mentioned here -- https://gitdemo.readthedocs.io/en/latest/macos-setup.html
It may only be necessary to have a case sensitive file system to build the xtesna toolchainn locally -- that is the only place I see it mentioned here --
https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/get-started/macos-setup-scratch.html
FYI -- I just did a fresh close of the CP repo to a default (case-insesntive) MacOS file system and I am able to build the esp32s2 files.. The only issue I aide was with the version of gdbgui installed -- has to revert it to 0.13.2.0 (that hs noting to do with the file systems)
Could this be related to falling off the end of the stack? I've got two functions in CircuitPython with huge arg lists so perhaps I'm using a lot and then it goes off into the CircuitPython C code plus whatever the nordic library code gets up to.
Is there a way in a CircuitPython to check the MP_MAX_STACK_USAGE_SENTINEL_BYTE are intact?
Does the 52840 have a basic MMU?
This code works in micropython because there is no inbuilt "unix epoch correction" there.
time_localtime calls timeutils_seconds_since_2000_to_struct_time compare this with circuitpython's timeutils timeutils_seconds_since_epoch_to_struct_time function which gets called during `localtime...
CircuitPython checks for stack overflow in Python code, and there's 1k of extra stack space to handle exceptions, etc. The Nordic SoftDevice uses pre-allocated RAM in general instead of allocating things on the stack. Usually a stack overflow causes some other terrible problem. I think it's more likely this is just a bug somewhere.
There is some simple memory protection, but given that the writeable heap and stack are adjacent, we'd have to insert a guard region and would lose that RAM.
I spotted a few comments some different versions of soft device's use of stack: https://github.com/bbcmicrobit/micropython/issues/429#issuecomment-291836976 and https://github.com/bbcmicrobit/micropython/issues/71#issuecomment-194816801 and https://github.com/micropython/micropython/issues/4744#issuecomment-489381961
We are allocating a 24kB stack on the nRF52480. The micro:bit nRF51822 and they are trying to get away with a much smaller stack.
The comments like
consumes up to 2K more on the stack when any deep interrupts fire.
started me pondering this but 24k sounds like a lot to chew through.
BTW, perhaps this is not a fair test but I ran this with 6 args on a CLUE with 5.3.1 and got RuntimeError: maximum recursion depth exceeded which is the sort of thing I was expecting. I doubled it up to 12 and got 50 prints per function and a trip to safe mode.
>>> def stack_test_longer_arg(a, b, c, d, e, f, g, h, i, j,...
huzzah! I just got a CAN packet out of my SAM E54 !
baud rate is not right
at least I think that's what Logic is telling me -- the dot/Γ should stay fixed with respect to the signal edges
@pastel panther I'm ready to chat when you are
@onyx hinge yup, lemme just do a quick audio check
@onyx hinge not sure what's up, I just did an audio check in discord itself and it was fine
Β―_(γ)_/Β―
odd
@onyx hinge can we use whereby?
sure, we'll just make sure to mention any "results" of the meeting in here to keep the community in the loop
@onyx hinge can you do a quick check and make sure I have voice permissions in Amelia
we used amelia last time didn't we? I'll see what I can figure out..
true... my phone was fine π€·
@onyx hinge nm, I can look into it later; whereby in one sec..
I am pretty sure you are supposed to be able to connect & speak, you may not have video permission though
but you had video last time so π€·
//| def __init__(self, id: int, data: Optional[bytes] = None, *, size: Optional[int] = None, rtr: bool = False):
//| """Construct a Message to send on a CAN bus
//|
//| :param int id: The numeric ID of the message
//| :param bytes data: The content of the message
//| :param int size: The amount of data requested, for an rtr
//| :param bool rtr: True if the message represents an rtr (Remote Transmission Request)
//|
//| In CAN, messages can have a size from 0 to 8 bytes.
//|
//| For a non-rtr message, specify `data`. For an rtr-message, specify either `data` (a dummy buffer of the requested size) or `size`.
//| """
We didn't really have any big revisions to the draft API. Action items: @pastel panther will start sketching out adafruit_can, which will contain the non-Core implementations of Message, Match, and other ancillary objects; and work on the receive implementation on the MCP canbus chip. I'm going to add the missing "extended address" flag to my implementation of Message, and continue working on the sending end on the SAM E microcontroller. We'll probably have our next conversation after 9/9 CircuitPython day. And hopefully iron out the tech issues that stopped us from meeting on the Amelia voice channel.
assuming it's technically possible it would also be nice if adafruit_can had a specification of the CAN low level API (_canio.CAN) as an interface or whatever they're called in Python typing terms... I think it's possible.
the goal would be for that to be the general reference for everything CAN except the specifics of the constructor of a particular HW interface
I do like send_report() since it is sending a stream of reports, not setting a value over and over. I don't think .report = next report is the right thing to do.
Then .report is a read-only property. But to distinguish the incoming (OUT) report from the outgoing (IN) report, I am suggesting calling it received_report. (The "OUT" vs "IN" designations are very confusing to the layperson, since they reflect the host's view.)
If you use a property, people will be encouraged to use it in multiple conditions, and will be surprised when its value changes in between them. A function call encourages you to assign the returned value to a variable and work with that variable.
Thanks for summarizing @onyx hinge
The Python code works based on the count of bigrams (up to 32 of them) but the C array gets 2 entries for each bigram, so 64 is correct. However, it is true that we could place macros such as BIGRAM_CODE_POINT_START, BIGRAM_CODE_POINT_END in compression.generated.h and use them instead.
In common_hal_busio_spi_never_reset() and common_hal_busio_spi_deinit() no check was being made to see if the values of self->MOSI_pin_number and self->MISO_pin_number were valid. Since, if those pins were unused they have a value of NO_PIN(0xff), the result was that values in memory past the never_reset_pins array were getting stepped on. In particular, the nrf_nvic_state.__cr_flag was being set to a non-zero value, which kept the ble IRQ from being enabled. This fix adds tests for NO_PIN be...
Excellent catch. I'm only not reviewing as "approved" so that we can talk about whether the check for 'no pin' could be moved down into the lower level routine (so that it's part of the API that it may be called with NO_PIN). This would mean that just 1 check would have to be added instead of 4, not to mention other sites that might be affected (unidirectional UART for instance) would automatically become fixed.
Looking at that possibility, I see that reset_pin_number() in common-hal/microcontroller/Pin.c already checks for NO_PIN, so we would only need to add that check to never_reset_pin_number(). If you think that is a better way to deal with the issue let me know and I'll make the necessary changes.
I am hoping @tannewt will have an opinion, but he's not working today.
Do we need to keep this commented out line?
I tested this on a CLUE and PyPortal using the code from the issue. This version does fix the problem on both devices with that code as it's written.
I noticed on the CLUE I could get back to non-refreshing state still by using lower values for the time.sleep(). I do think there is still something else going on there somehere.
The PyPortal seemed to handle it fine even at faster speeds that didn't work on the CLUE.
This is great extra functionality to be able to resize the Shape ...
Hello, I am trying to build a custom c module and having a little trouble figuring out where to reference the module. I am following the guide linked below. I pulled down the 4.0 src to try and match up with the guide better but it still does not match. Specifically, the mpconfigport.h file. Wanted to see if anyone has any pointers on resources. Thanks
EDIT: Looks like I need to go further back for the guide to be relevant. Any info on doing this for newer versions is much appreciated.
Looking at that possibility, I see that reset_pin_number() in common-hal/microcontroller/Pin.c already checks for NO_PIN, so we would only need to add that check to never_reset_pin_number(). If you think that is a better way to deal with the issue let me know and I'll make the necessary changes.
That looks like a good idea, but I'd also check to see if should be done on all the other ports.
Deleted unnecessary comment. Thanks for testing it and catching this leftover comment.
I have a mysterious behaviour that I can reproduce, but not really know how to troubleshoot for the moment. My code works fine with the USB connected to a computer, but it quickly fail when connected to a powerbank or charger. I removed all the print but it does not change anything. My code seems to freeze in less than a minute when not connected to a PC. And that with or without opening Mu. (This ressemble to one of the current issue where CLUE does not behave the same.) But here my hardware is a Feather nRF52 Sense. It does: (1) Connect in UART over BT (2) measure pressure with I2C (3) change LED color (4) control the BT hardware. Similar code without the BT did work well in both case. Right now it seems to be related to BT and to negotiation of the CDC/mass storage with the PC. I would be interested in any known issue on alpha3 or any possible side effect of beeing connected to a PC.
I can try with nightly build to see if it is better now, or if it was better before.
I can try to simplify the code and make it reproducable without additional hardware.
But right now, I don't really know where to start to troubleshoot this issue... because it occurs when I don't have access to the console to troubleshoot it. And of course it does not occurs when I have the console.
How would you debug such a thing?
@thorny jay is this on a CLUE? -- I ran into s similar problem and it is still in work to be fixed ... https://github.com/adafruit/circuitpython/issues/3367 If you can revert to CP 5.3.1 it should work.
In my case, the code actually runs, but there is just no display.
Sorry == now I see it is a Bluefruit sense. Not sure if it is related. Still, may be worth trying the earlier CP version just to check.
I found that it was OK at 6.0.0-alpha.2 so you might try that.
I read (or tried to read) your post before my coffee π -- It does look like you were aware of the previous issue and this is different but perhaps not unrelated....
AS far as debugging can you blink the D13 LED as an indicator of where in the code you are.?
@deshipu What do you mean, was this a bug on the linux side of things?
Yes, Ubuntu and derivatives would reset the sound level to zero when a new MIDI device was connected. CircuitPython devices happen to be MIDI devices.
I read (or tried to read) your post before my coffee π -- It does look like you were aware of the previous issue and this is different but perhaps not unrelated....
@solar whale I reverted to 5.3.1 and it seems to work for me. It is not clear yet what the problem is... alpha2 did not work for me. There is a little bit of math so some stuff could go wrong such as float to int conversion, or divided by zero, so I could make things more robust, without any guarantee that the problem is in my code.
While there's one bit that it wouldn't hurt for @hierophect to take a look at, I like this change. I looked and didn't find any more places calling reset_pin_number or never_reset_pin_number and didn't see any more to simplify.
@hierophect can you take a look at the stm parts of this PR please? (I suspect that the check of pin_port check is the stm equivalent of NO_PIN, except there's an entire 'no port')
I do not think that this stm port change is needed. The current code does not use NO_PIN . It is coded to use NULL. NULL is checked before each call to a function that would use it .
I believe there are issues with BLE in 6.0.0 and right now for two problems I encountered, I have things working with 5.3.1. One problem has been explained here 12H ago (something that stop working after less than a minute when not connected to a computer). And the other one has been discussed with @crimson ferry on #help-with-circuitpython just right now (ble.start_scan not exiting). I am reusing old code that I guess was developped in 5.x time, so it seems normal to work on 5.3.1. Maybe it need some adaptation for 6.0.0 ...
Maybe I need to rewrite from scratch based on simple_test demo code, just to make sure I am using the right/current pattern.
#2885 is another unexplained and unexpected MemoryError issue but very different in simplicity and it's reproducible every time.
This is weird, and I can't explain it...```import board
import busio
import digitalio
import adafruit_fram
this doesn't work
i2c = board.I2C
this works
i2c = busio.I2C(board.SCL, board.SDA)
wp = digitalio.DigitalInOut(board.D6)
fram = adafruit_fram.FRAM_I2C(i2c, wp_pin=wp)```
Traceback (most recent call last):
File "code.py", line 14, in <module>
File "adafruit_fram.py", line 225, in __init__
File "adafruit_bus_device/i2c_device.py", line 68, in __init__
File "adafruit_bus_device/i2c_device.py", line 170, in __probe_for_device
AttributeError: 'function' object has no attribute 'try_lock'```
Adafruit CircuitPython 6.0.0-alpha.3 on 2020-08-28; Adafruit Feather M4 Express with samd51j19
adafruit-circuitpython-bundle-6.x-mpy-20200904
You have to write: board.I2C() -- it is a function which returns the common I2C bus object. It is not an I2C bus itself.
this is somewhat of a technical limitation, the value of every item in a built in module has to be fixed at build time
i've done it a million times, but not this time
hehe ok I'll stop explaining it then
I wonder how atrophied the ability to build without softdevice support is. that would get 56 or 64kB extra heap available, right?
ooh it's slim enough to fit now. I haven't tested much of the functionality yet, or if it'll fit with sharp memory display framebuffer and the rest of my calculator program. ```Adafruit CircuitPython 6.0.0-alpha.3-92-g121975f8e-dirty on 2020-09-06; Particle Xenon with nRF52840
import udecimal
udecimal.Decimal("3.14159") * 2
Decimal('6.28318')
Decimal('0.3333333333333333333333333333')
Hi I used Adafruit STM32F405 Feather Express board.
When I read continually range from the VL53L0X sensor, then after while this error occurs:
Traceback (most recent call last):
File "code.py", line 54, in
File "/lib/adafruit_vl53l0x.py", line 600, in getRange
File "/lib/adafruit_vl53l0x.py", line 324, in _read_u8
File "/lib/adafruit_vl53l0x.py", line 323, in _read_u8
File "adafruit_bus_device/i2c_device.py", line 102, in write
OSError: [Errno 5] Input/output error
C...
>>> udecimal.Decimal("1") / 3
Decimal('0.3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333')
Decimal('2.302585092994045684017991455')
>>> Decimal(10).exp()
Decimal('22026.46579480671651695790065')
wow most of this even works properly π
bit_length and 3-arg pow() are needed for a reduced port I'm making of desktop Python's Decimal library. Enable them everywhere we want a FULL_BUILD.
Incidentally, it takes about 51kB to load my work in progress code on an nrf52840 based board:
>>> gc.collect(); gc.mem_free()
138912
>>> import udecimal
>>> gc.collect(); gc.mem_free()
87584
>>> 138912-87584
51328
@tannewt Iβm interested in working on this one.
There should be a way of tapping into the display redrawing code and the display elements get_pixel routines you determine which is opaque and take advantage of any x,y and mirror, rotation transform code that is already there. If you suggest an approach I will try to figure out how to make it work.
As for operation of this child_at(x,y) function, how should it deal with a child element that is a Group?
- If the child Group is at...
in addition to udecimal, I've also written trig functions atop it, based on the routines used in the unix bc calculator. https://gist.github.com/jepler/d6fd1133d926347192a1ff22d3995f0f -- the results agree with bc, except for rounding (bc rounds to zero, udecimal rounds to nearest) ```$ python3 -c 'from utrig import *; f="11.373"; print(atan(f), cos(f), sin(f), sep="\n")'
1.483094330462666230579325971
0.3685285931944669592773918397
-0.9296164133652692134932163577
only 1.5kB of mpy file, too
<@&356864093652516868> Just a reminder: the meeting is NOT happening tomorrow, it's moved to Wednesday at the same hour. Come celebrate CircuitPython Day with us on Wednesday 9/9!
Found this string from shared-bindings/_bleio/Adapter.c in weblate - Cannot create a new Adapter; use _bleio.adapter;.
Why the use of semi colon here?
Weblate complained when I added a translation without it.
@cobalt grail the trailing semicolon is a typo. The middle semicolon was just typical English punctuation
i can change either or both. I'm surprised weblat requires it
It complains if I don't match the trailing semicolon. π
it preserves punctuation of the original, I think
?serverinfo
@cobalt grail I'll fix it in some future PR, and remove the semicolon you had to add too :). Not worth doing a whole PR for a one character change right now π
Hi, I am sorry but do not want to read all comments on this issue. I study and work on real-time systems. Circuit python is for microcontrollers. They are not PCs - real PC-multitasking on a single CPU is not needed at all.
Everything that CircuitPython programmer needs is scheduler :) If three tasks (A, B, C) with two sections (example: AA) runs this way:
ABACBC or BBAACC is the same. If you need cooperation between tasks, you can use shared variables, queues, etc. and split tasks into...
@eLEcTRiCZiTy that is exactly what async/await does.
@deshipu Async&await is for PCs or Mobile phones when you do not need information on how asynchronous functions are executed in the background and only required is the result and smooth GUI response. A small delay or more significant overhead is easily overlooked and usually does not bother anyone. ...and!.. usually good async scheduler needs another thread or some level of cooperative multitasking. When the async&await mechanism is implemented using some sort of synchronous polling it is not...
Where is cpx build docs?
I have done it before, so somehow I figured it out, but I'd like to point others to something
do you mean building Circuit Python for the CPX?
Issue #3266. A change for to make sure that the SPI lock is free after a soft reboot.
@lone axle that would work as would expect all the build docs to be mostly consolidated. right now I am building for https://learn.adafruit.com/adafruit-stm32f405-feather-express
This is the guide I always refer to no matter what I am building for. https://learn.adafruit.com/building-circuitpython
yes that. thanks.
pip3 install huffman - isn't needed, it gets pulled in by https://github.com/adafruit/circuitpython/tree/main/tools huffman
Hi, I am sorry but do not want to read all comments on this issue.
Hi @eLEcTRiCZiTy, this issue has moved well past the theoretical and into practical territory. Please feel free to avail yourself of the concrete code listings in this issue and both the Circuitpython and upstream Micropython projects if you'd like to share insights from a position of context and understanding.
In any case, async/await is the Pythonic way to talk about cooperative multitasking. Its overhead is implementation dependent and could be anything, including zero.
How to actually schedule these tasks when you need soft realtime (hint: you often don't) is an orthogonal problem. Same for the tasks' side effects, same for the method(s) to wake up a task that's waiting for an external event (= interrupt).
Please don't conflate these issues.
I tried current binary but it still doesn't work,
seems SPI-RAM-DMA fixes are not yet there,
I have tried this:
adafruit-circuitpython-espressif_saola_1_wrover-en_US-20200906-a9779b9.bin
@smurfix Hi, you are right. It is my fault. The scheduler is different problem and it is actually separable from an asynchronous calling implementation. Scheduler must support asynchronous tasks or they can be executed in a specific periodic task.
Does circutpython work with spi on the esp32 s2 now?
I started preparing changes but I have a question. Is it possible to allocate aligned memory using CircuitPython? Something like memalign. The camera buffer for Spresense must be aligned.
Heap memory is allocated in BYTES_PER_BLOCK chunks. Right now BYTES_PER_BLOCK is 16, so that should probably satisfy your alignment requirements.
Does this mean that the allocations are guaranteed 16-byte aligned, though? Supervisor allocations are in 4 byte increments, and the base address of the heap is created via supervisor allocation.
Does this mean that the allocations are guaranteed 16-byte aligned, though? Supervisor allocations are in 4 byte increments, and the base address of the heap is created via supervisor allocation.
I see what you mean. @kamtom480, is 4-byte alignment is good enough? If not, I think it might be good to guarantee BYTES_PER_BLOCK alignment for the heap, for reasons like this.
Does circutpython work with spi on the esp32 s2 now?
@pine plover Not yet. Scott is planning to work on that during his live Deep Dive on Wednesday. At least not on th wrover module, maybe due to PSRAM support. https://discordapp.com/channels/327254708534116352/327298996332658690/752430434306228225
Cool thanks :)
huh. During a long debug-pause, information about the related USB device in /sys becomes unreadable. attempting to retrieve it hangs, but can be recovered with ctrl-c.
I wonder if it's related to the crashes I encounter during debugging on my desktop. root@raspberrypi:/sys/devices/platform/soc/20980000.usb/usb1/1-1/1-1.1# cat manufacturer
during that time, another USB device plugged into the same hub can't finish enumerating either
Now that you are mentioning it, I do recall a warning from Scott to unplug the USB when debugging on my Metro M4. Easy to do there since it has an alternate power source. ...
Hello! Long time listener, first time caller.
I'm looking to add support to CircuitPython for the NFC tag functionality of the nRF52 devices. I've been using the functionality for a short while now in a personal project so I feel like I've got a fairly good understanding of how to bring it over to CP, at least in the sense of type 2 tags. Before I started, I wanted to flesh out a few details and ask some questions so that I can contribute in the best way possible.
Before I get to my qu...
Yup, this is my workaround for unplugging the device under debugging
I do have to ask -- why do you have a monitor (hdmi) plugged in to it?
so it seems that the latest firmware update on my laptop fixed the crashing on disconnecting circuitpython devices
Nice! There is hope....
!!
I mean, it was random, and it hasn't happened since, but you never know...
I have been brave enough to try a few cycles in that past week, and survived ... what did you update - was it a new kernel or something specific to the laptop?
system firmware and thunderbolt controller
@solar whale just for the bring-up, I don't expect to continue needing it
Thanks - just curious -- I did not see a keyboard connected, so i was trying to figure out how it came into play...
I happen to have a Zero-4u mounted on a pi zero (non w) with a WiFi dongle. I may see if I can get it working on that.
I'll be interested to know how that goes -- on the 0W the onboard wifi is connected via an SDIO bus and survives USB getting confused, which is a plus
it let me actually inspect the state of the system at that time
hmmm -- good point ... I have both w and non-W's available to compare ... the potential project list just keeps on growing...
What does tio add rather than using using screen?
oo-- I see -- it reconnects --- cool!
Anyone successful flashing their ESP32-S2 Kaluga from macOS? I see /dev/tty.usbserial-1413300 and /dev/tty.usbserial-1413301 are present but when I use the PORT on the make command along with flash it cannot connect to either device. I've also tried the holding boot and reset, release reset sequence. I feel like I'm missing a step...
example of my make command: make BOARD=espressif_kaluga_1 PORT=/dev/tty.usbserial-141330 flash
interesting, cube roots are not exact in Decimal: ```>>> Decimal("1e3") ** (Decimal("1")/Decimal("3"))
Decimal('9.999999999999999999999999998')
but I guess 1/3 isn't exact either
Decimal("1e4") ** 1/Decimal("4") is exact
No issue with CP or my Kaluga. Bad cable. Cable now in trash...
For what it's worth, I have been unable to reproduce this issue on a Saola 1 Wroom devboard.
7205759403792796.0
>>> round(_)
7205759403792794
``` well that's a bit odd
(circuitpython unix port)
7205759403792794.0
>>> round(_)
7205759403792794
``` the error arises in the display of the FP value, not the rounded value (the second paste is from standard python3)
Wanted to add a quick comment - I was able to build a modified version of CPy for an ItsyBitsyM4! It took some time to get the build environment working... but I was ultimately able to display data on two 2.4 TFTs (ili9341). Thanks for this thread!!!!
I run two SPI relate library on Feather STM32F405 Express, the SPI bus look like incorrect.
more detail:
https://forums.adafruit.com/viewtopic.php?f=60&t=169223
https://github.com/2bndy5/CircuitPython_nRF24L01/issues/13
Spresense needs 32-byte alignment. Do you have any ideas on how to achieve this?
Does anyone remember that some samd processors were hanging when trying to retrieve the microcontroller temperature? I've encountered that on the sam e54 xplained board this weekend.
Should temp_sensor_stop() be called? It would probably reduce power consumption.
@slender iron if you're streaming the meeting tomorrow, does that mean you'll also take the timecodes?
@onyx hinge It was hanging when reading microcontroller.cpu.temperature: I fixed in https://github.com/adafruit/circuitpython/pull/3052.
The temperature reading was difficult to set up and the latest errata say it doesn't work:
ouch, okay
But I did get it to work, albeit with less accuracy than I might have liked.
It might be that inserting a delay like i did with voltage would help
on my sam e54 (sample of 1), it hangs in tip of main
does .voltage hang?
temp_sensor_read_celsius(&tsens_out);
temp_sensor_stop();
As Jeff mentioned, please add temp_sensor_stop so that this is a self-contained operation.
I should make double sure whether it was temperature or voltage. what actually hung was tab-completing microcontroller.cpu and I looked at it for a second in the debugger and then moved on
well, the fix is already in main, so it -should- be ok. I insert a 1msec delay after setting the voltage reference for .voltage. You could try someting similar for temperature.
this was really tricky: I had two SAMD51 boards with seemingly identical chips (same revision) except for the date code: one hung up and one didn't
>>> import microcontroller
>>> microcontroller.cpu.temperature
29.9796
>>> microcontroller.cpu.voltage
[hangs]```
ugh; maybe try lengthening the delay
Line 298 in Processor.c
if you lengthen it, fine to have it be longer for both SAMD51 and SAME54, since they're almost certainly the same chip internally
100ms delay didn't fix it
it may be a newer rev of the chip that has just broken it completely
the muxing of the TEMP sensors is a mess internally
2000ms + stopping in the debugger did
you could try some delays before/after the SUPC bit settings, but that's just guessing. Or try adding a delay between the double calls to adc_sync_read_channel(), though it's probably hanging on the first call.
well now I'm getting more puzzled. I put a delay of 1000 ms in the source, it reads the voltage back just fine, but .. there's nothing like a 1s pause
but i wouldn't spend a lot of time on this. I think if you return NaN or something like that, shared-bindings will raise NotImplementedError
i.e., it returns immediately. Shouldn't mp_hal_delay_ms(1000); be 1 second and very noticible by a human like me?
uh, yes π . So maybe something broke recently in the tick stuff??
OK, failure to load the new firmware
so i bet the 1ms fix is fine, and there's something else wrong. if you call time.sleep() does it sleep? Does that use mp_hal_delay_ms ?
or maybe never mind π
gdb with openocd is just a little bit different than gdb with jlink,and my fingers do the wrong things when I'm not watching them
also confusing things: if I decrease the delay it works ... until I read temperature (disturbing the mux?) and then read voltage again
3.32308
33.1896
[hangs]```
right, I think the temp code changes the reference voltage setting. If you just repeat, the reference is already set, and doesn't need time to settle or change
the delay was just an empirical fix: there's nothing in the datasheet that says you have to delay. There is no READY bit to check, unfortunately
i bought one of these boards too, so I could try this too, and you could go back to CAN. I just have to find it; it's somewhere within 5 feet of me but I'm not sure where.
I could also file an issue and move on
i agree
Except possibly with very long delays, microcontroller.cpu.voltage hangs on the SAM E54 Xplained board. Sometimes it will read after previously hanging and then being reset, but this testing procedure would reliably hang for me:
>>> import microcontroller; microcontroller.cpu.voltage; microcontroller.cpu.temperature; microcontroller.cpu.voltage; microcontroller.cpu.temperature;
3.32308
33.1896
[hangs]
Tested with a local branch somewhere a few commits after alpha.3, but t...
We could simply disable it, as this patch would do:
From: Jeff Epler <jepler@gmail.com>
Date: Tue, 8 Sep 2020 09:10:31 -0500
Subject: [PATCH] Straw proposal: disable microcontroller.cpu.voltage on all
SAM E54
---
ports/atmel-samd/common-hal/microcontroller/Processor.c | 8 +++++++-
ports/atmel-samd/mpconfigport.h | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff -...
@onyx hinge I found my board. btw, how come you are using openocd instead of just the swd connector on board with a J-Link? is the EDBG connector openocd?