Just reading along, wanted to mention: reason why not all of the RAM on the F405 is the same, is that it has a DSP-like Harvard architecture instead of a traditional Von Neumann.
#circuitpython-dev
1 messages ยท Page 278 of 1
not yet but it ought to work with internal storage (unless it has a SPI flash on it?)
"not too much" I like it
I didn't get it working flashing any bootloader onto it. It has a serial flash installed but I would prefer it working qith the internal storage.
@hierophect no problems at all, I am not in hurry If not for fixing the urgent bug with feather stm32f405. Regarding the submodule, I am not so sure why even a fresh clone didn't work hmmmm. Please try to follow Scott suggestion https://github.com/hathach/tinyusb/issues/242 to see if that works. Scott is git master :)
@hierophect no problems at all, It is Christmas time :)
no problems at all, thanks for the PR
New board coming soon, runs CircuitPython (of course!)
youtube url if that does not render to play here .. https://youtu.be/uNDqkglM8_Y
Special edition of top secret! Introducing Clue!
We broadcast the weekly ASK an ENGINEER video show and this is the segment on items or concept products that may/might/could be introduced into the Adafruit store in the future (or not)! It's not out yet, so please don't ask q...
Hi Folks - Any update on the Bonding issues with BLE HID? I have projects that are kind of stuck and we're about to go with an Bluefruit Friend + an M4 board. I'd much rather spend the same money on NRF52840 Feathers & be done with it.
@tough flax no updates yet, and folks are out for the holidays
Ok... my day job is dead over the holidays so I have some time starting Thursday...
I could probably do this in Arduino & at least not change the hardware
I know @tulip sleet was very close
Thanks for the update though... missed you in NYC last week
import busio
import digitalio
import time
b = busio.SPI(board.SCK, MOSI=board.MOSI)
stb = digitalio.DigitalInOut(board.D5)
stb.switch_to_output(True)
d = bytearray(4)
d[0] = d[1] = d[2] = d[3] = 0xff
print ("trylock")
b.try_lock()
print ("write")
b.write(d)
print ("strobe")
stb.value = False
stb.value = True
print ("done")
while True:
time.sleep(1)
``` looks like this is approximately what I last wrote to code.py, earlier I had seen it was dying after the s.write call. Wonder why.
nrfx_spim_xfer (p_instance=0x200044a0 <spim_peripherals>, p_xfer_desc=0x2003fd28, flags=0)
at nrfx/drivers/src/nrfx_spim.c:581
581 while (!nrf_spim_event_check(p_spim, NRF_SPIM_EVENT_END)){}
(gdb) where
#0 nrfx_spim_xfer (p_instance=0x200044a0 <spim_peripherals>, p_xfer_desc=0x2003fd28, flags=0)
at nrfx/drivers/src/nrfx_spim.c:581
#1 0x00055d6e in common_hal_busio_spi_write (self=self@entry=0x20008680, data=0x200086d0 "\377\377\377\377",
len=<optimized out>) at common-hal/busio/SPI.c:249
I put my "1D Wave Simulation" for circuitpython & neopixel in a gist: https://gist.github.com/jepler/d1e5623931b285c7d23cb511a9a9de09
it's mesmerizing, and there are a bunch of numbers you can try changing and see what they do ๐
(never did make any headway on my spi crash ๐ฆ )
I ran the following code:
import board
import busio
import digitalio
import time
b = busio.SPI(board.SCK, MOSI=board.MOSI)
stb = digitalio.DigitalInOut(board.D5)
stb.switch_to_output(True)
d = bytearray(4)
d[0] = d[1] = d[2] = d[3] = 0xff
b.try_lock()
b.write(d)
and it hangs during write. The last few frames of the traceback are:
Program received signal SIGTRAP, Trace/breakpoint trap.
nrfx_spim_xfer (p_instance=0x200044a0 , p_xfer_desc=0x2003fd28, flags=0)
...
hm that read a little snippy. wording hastily revised ๐
'night and merry xmas. ho ho ho.
Which board and version is this, and have you tried an earlier version? It did used to work :). This may be due to upgrading nrfx.
So it turns out if you try to instantiate a UART on a 4mb ESP32 micropython build it just gives a guru meditation error.
And crashes and reboots
I looked over the nrfx 2.0 changes and the changes made to CircuitPython for the update, and I don't see anything obvious, so more debugging is in order.
Turns out it was my wiring. I was using an experimental board and it's simply not right; in effect, I had hooked SCK to GND. For better or for worse, this makes nrfx_spim_xfer hang forever(!) I initially dismissed the wiring a possible cause, because "obviously" the functioning of the code couldn't depend on the input value on SCK or MOSI.
!! Yes, I just tried this, and it worked for me on an unconnected Feather '840. That's pretty odd.
@tough flax I am writing code, but it's not done. Bonding is my first priority right now
Happy Hanukkah @merry turretb. Let me know (after tonight) if I can help test.
@tough flax HID should work with just pairing. You just have to pair each time (and maybe forget the device in between0; the only thing bonding is adding is not having to re-pair.
fix race condition with setup packet + scsi status response
adafruit/Adafruit_TinyUSB_Arduino#37
Also use the new dcd_edpt0_status_complete() to prepare for next setup packet, and SET_ADDRESS request
https://github.com/hathach/tinyusb/blob/master/src/portable/microchip/samd51/dcd_samd51.c#L151
composed of
https://github.com/hathach/tinyusb/pull/243
https://github.com/hathach/tinyusb/pull/244
https://github.com/hathach/tinyusb/pull/245
I tried this directly from https://github.com/hathach/circuitpython/tree/samd-improve-usb. On a cold restart (plugging in USB cable), there are severe delays. CIRCUITPY mounts, but it takes a very long time (see the 11 second gaps):
Dec 25 13:09:22 salmonx kernel: [517406.491287] usb 3-1: new full-speed USB device number 56 using xhci_hcd
Dec 25 13:09:22 salmonx kernel: [517406.654664] usb 3-1: New USB device found, idVendor=239a, idProduct=8026
Dec 25 13:09:22 salmonx kernel: [5174...
See comments re delays on cold restart.
What is the current state of this?
I would love to do some animations with a 120px Neopixel strip but the refresh rate is abysmal with the default library :/
I could only find the api doc but not really sure on how this is supposed to be used, does it tie into the standard neopixel library?
ok updated guide/product plz check
ok start with the UF2 bootloader, you can probably look at the Trinket M0 or Feather M0 Basic for inspiration :)
[adafruit/circuitpython] New branch created: badge\-develop
Building the ports/atmel-samd/pybadge_airlift firmware (as of the morning of 12/25/2019) and then loading it onto a PyBadge (I don't see a hardware rev designation) causes the board to stop working. By that, I mean CIRCUITPY doesn't reappear as a mass storage device the display doesn't initialize (it stays dark with no backlight). The bootloader, however, works, so I can load the ports/atmel-samd/pybadge firmware (built at the same time) to restore functionality.
Let me know if you need an...
its a totally different board, so its not expected to work. what were you expecting to happen?
Ahhhh, ok. I put an AirLift FeatherWing on it and it timed out trying to find the FeatherWing. I thought it was SPI contention, since I thought the display and the Airlift were both SPI devices, and so I figured the pybadge_airlift was the supported configuration. I'll go back to trying the PyBadge + AirLift FeatherWing combination.
@ladyada Oh for heaven's sake. I just tried the esp32_simpletest.py code and it works fine. I'm not sure where I went wrong before, but it seems good.
Is there already effort underway to bring the Bluefruit Playground app to Android?
Thanks for testing this out Dan, I will double check it :)
@lone axle not that I know of
Hi, Is there a sample code where multiple rotary encoders have been interfaced to a board running CP?
Need it for a project
The voltage monitor pin is on PA03 but it is not defined in the pins.c file for the feather_stm32f405_express board.
it is referenced in the Guide https://learn.adafruit.com/adafruit-stm32f405-feather-express/power-management#measuring-battery-4-8
I'll try to test this and create a PR if it works OK.
fixes #2430 -- tested on feather_stm32f405_express
@slender iron Santa brought me a Circuit Playground Bluefruit, and I've got a knack for making things with Android. I think I'm going to have a go at starting a version of Bluefruit Playground for Android.
The issue is caused by race issues when receiving SETUP packet, that cause the setup sometime get lost. The issue exists, but got worse with latest changes (that make timing is just right for the issue).
@tannewt @dhalbert I recently made several improvements for samd51 then mostly copy over to samd21. I am tired of copying, so I take this chance to unify them into single dcd_samd.c file as well. SAMD51 split the interrupt source into multiple IRQ, there is a bit of overhead when putti...
@lone axle that would be amazing! Let me know if you have any questions about the BLE service API
CP 5.0.0 Beta 2 on an Evo M51 proto. Lots of work left to do, but this is an encouraging hurdle to clear on the CP side!
that's a big chip
anybody remembers how to access arbitrary memory locations in CP?
@stuck elbow is is builtins.memoryview?
or uctypes, but I can't seem to find it https://circuitpython.readthedocs.io/en/latest/docs/library/uctypes.html
no, memoryview is a way to slice and dice bytearrays
ctypes is for calling C functions on Unix
yeah, I seem to remember talking with tannewt about making a library that gives you access to the bootloader config, and I think he said you could do that in pure python
but I may be remembering wrong
Is uctypes.bytearray_at(addr, size) in CP? That would work. Edit: oh sorry, already mentioned.
it's only in the Unix port
not on the microcontrollers
thanks for looking, I guess I was wrong
Can I do something like pms_uart = busio.UART(board.D13, board.D12, baudrate=9600, timeout=10)? Software UART's fine, if I don't have to write one
I know Arduino has SERCOMs
Hrm, I seem to have caused a feather nrf to not boot circuitpython. the bootloader gladly starts up, but when booting 5.0.0b2 (or my own branch build) it flashes the nepixel red once then clears it. Not sure how to check what it's doing from jlink/gdb too see what's going wrong.
@twilit geyser sure, it should work, as long as you pick pins that support uart
@ruby atlas there was a learn guide on debugging
@ruby atlas this is for samd, but should be similar: https://learn.adafruit.com/debugging-the-samd21-with-gdb
@stuck elbow i'll guess i'll start by double checking if i even hit the circuitpython code by stepping every instruction.
you can display the call stack to see where you are
#0 0x00027000 in cpu_get_regs_and_sp ()```
that doesn't look very promising
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 57005]
0x000f9f9a in ?? ()
(gdb) bt
#0 0x000f9f9a in ?? ()
#1 <signal handler called>
#2 0x00000000 in ?? ()
#3 0x00000adc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)```
ya
memory corruption?
or maybe flash corruption?
I meant something is overwriting the stack
oh, yeah, i agree.
or the stack isn't from circuitpython - "start" isn't stopping.
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Temporary breakpoint 1 at 0x438e0: file ../../main.c, line 406.
Starting program: /Users/rhooper/Devel/cp/circuitpython/ports/nrf/build-feather_nrf52840_express/firmware.elf```
time to re-build, re-flash, and re-try.
good luck
@old smelt I'm excited about Evo M51, even though I don't have a use for it in mind...
Thanks @onyx hinge! It's fun to see things start coming together.
Hrm, had to (re-)flash the bootloader then flash 5.0.0 beta 2. (Now re-flashing my build)
While the MAC is still changing every power cycle, calling ifconfig appears to correctly set the IP address now (v4.1.2):
# set up networking
spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
eth = wiznet.WIZNET5K(spi, board.D10, board.D11)
eth.ifconfig(('10.2.1.220', '255.255.255.0', '10.2.1.1', '10.2.1.1'))
I didn't need to explicitly disable DHCP, and the correct IP shows up in eth.ifconfig() calls after a few seconds.
Revisited this over the break using v4.1.2, and with a few tweaks to my code (and a fixed IP address), things seem more stable with the Feather M4/Ethernet Wing setup:
[09:38:29] ssube@cerberus ~/code/ssube/prometheus-express (master@93aa0347) > time ./scripts/bench-curl.sh
...
Request: 9800 of 10000
Request: 9900 of 10000
Request: 10000 of 10000
real 6m47.389s
user 1m27.865s
sys 0m...
@slender iron in the Bluefruit Playground BLE services API do we need to do anything to "enable" the outputs? I think I've got the CPB connected to Android and I've found each of the services that it offers with the adaf... UUIDs. As a first test I'm attempting to read from the temperature service / characteristic (adaf0101-c332-42a8-93bd-25e905756cb8) but I am always getting back null data. Wondering if something else needs to be done before the first value can be read.
Hmm that could be my issue perhaps. I didn't do any sort of manual pairing process like I would for headphones or a speaker. But I am connected enough from the Android code to list out the services and characteristics. Maybe I need to be paired more explicitly to use them
it doesn't look like it needs it
there is a measurement period characteristic that might need to be set
I did try setting characteristic (adaf0001-c332-42a8-93bd-25e905756cb8) to 0 then wait 500ms and attempt temperature read, got null that way as well
hrm, @gentle bronze would know
(he may be asleep though because it's getting late for him)
ah, 0 is update when change, maybe I should try 1 or something more specific
thank you for that link, I found the iOS code but hadn't come across the CPB side yet.
value in is period in ms, 0 is update on changes, -1 is disabled ๐
Measurement Period: 0001
{ int32: period }
Read + Write
period = 1 to 2^31-1: Milliseconds between measurements
period = -1: Stop measuring
period = 0: Update the measurement whenever it changes, as often as possible
@gentle bronze what is the default value?
for temp it is 1000 (ms)
I tried setting to 0 and 1, in both cases I get success result from android setValue() function call, and afterward I can successfully read the int that I wrote from the 0001 period characteristic. But still getting null when I attempt to read value from 0101 temperature characteristic 500ms later.
it is the arduino implementation default, not the specs default though
did you enable the cccd of the 0101 characteristic
Hmm, to be honest, I'm not sure what that means so I'm guessing not
I am a bit new to BLE, reading into CCCD a bit now. Tis probably part of my problem. Thank you
write value 0x0001 to cccd to enable the notification on a char, CPB will start a timer for sampling temp
@solar whale Did you ever figure out the "behind the scenes" issue with the ESP-IDF's NTP call?
@gentle bronze shouldn't a read work even if notifications aren't active?
I did find a descriptor on the 0101 temperature characteristic it's uuid is "00002902-0000-1000-8000-00805f9b34fb" which I think is the one for cccd. Tried writing the Android API constant BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE as well as a byte array constant like: {0x0001, 0x0000}. Both indicate success true on the gatt.writeDescriptor() function call but still always getting null when I attempt to read the temperature characteristic.
<@&356864093652516868> Today is the last day to add your hug reports and status updates to the Notes Only Edition of the CircuitPython Weekly! Please try to have your notes in by 4pm Eastern. If you need more time, let me know directly and I'll do what I can to work around it. The next time we'll be meeting in Discord is 6 January 2019 at 11amPT/2pmET. Hope you're all having a wonderful holiday! https://docs.google.com/document/d/1qcUDQqpMWpGJG-k72A39dbQ3a86JXMlnighWci6pS20/edit
@lone axle that sounds like the right approach
does android have an api for setting the cccd itself? nrf does
I didn't find anything mentioning cccd in the API, I was able to find it with this getDescriptors() function on the BluetoothGattCharacteristic instance for the 0101 characteristic.
iterating through those I found the one with uuid "00002902-0000-1000-8000-00805f9b34fb" and then attempted to set the value and write it with BluetoothGatt.writeDescriptor() https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#writeDescriptor(android.bluetooth.BluetoothGattDescriptor)
I wonder if I should be attempting to listen for the notifications instead of attempting to read it once more manually
That portion of the code looks like this atm:
Log.d(TAG, "descriptor: " + desc.getUuid());
desc.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
boolean descWriteResult = gatt.writeDescriptor(desc);
Log.d(TAG, "descriptor val : " + desc.getValue());
Log.d(TAG, "descriptor write result : " + descWriteResult);
Where desc is the BluetoothGattDescriptor instance with uuid 00002902-0000-1000-8000-00805f9b34fb and gatt is the BluetoothGatt object with the open connection
Hmm, earlier hathach mentioned the default period value for temperature characteristic is 1000. I attempted to read that value before writing as well and I am getting null value when I read that as well
maybe I have a larger issue that is causing all of the reads to fail. I will tinker with it some more. Thank you though I think you guys got me pointed in the right direction
Yeah, I think I am not reading the value properly. i think I need to be using this function: https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#readCharacteristic(android.bluetooth.BluetoothGattCharacteristic) instead of getValue() on the characteristic object. and it's async so need to set up the callback
I managed to get -Infinity instead of null reading the temp so, getting closer I think.
Hmm, is there a better spot to set a breakpoint than softdevice_assert_handler to catch why I'm ending up in the hardfault handler?
66 STATIC void softdevice_assert_handler(uint32_t id, uint32_t pc, uint32_t info) {
(gdb) bt
#0 softdevice_assert_handler (id=1, pc=87328, info=0) at common-hal/_bleio/Adapter.c:66
#1 0x00024a44 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)```
Interesting. I'll xheck it out.
On Sat, 28 Dec 2019, at 03:13, Sean Sube wrote:
Revisited this over the break using v4.1.2, and with a few tweaks to my code (and a fixed IP address https://github.com/adafruit/circuitpython/issues/2274#issuecomment-569294120), things seem more stable with the Feather M4/Ethernet Wing setup:
[09:38:29] ssube@cerberus ~/code/ssube/prometheus-express (master@93aa0347) > time ./scripts/bench-curl.sh
...
Request: 9800 of 10000
Request: 9900 of 10000
Request...
I notice there's no documentation of the stm32f4 port on circuitpython.readthedocs.io. Is this by design, or is there something I can help configure?
@slender iron @gentle bronze I've managed to get successfull reads
Thanks you both for the help. I'm able to subscribe to notifications on the buttons now and get good results back that represent the states. Didn't get the temperature working yet, but I think I should be able to figure out the rest of them.
I got temperature working as well now. I was getting -Infinity due to differences in the float formats I think. Wrapping with a different byte order like this is allowing me to get usable values out of the temperature notification:
float tempVal = ByteBuffer.wrap(characteristic.getValue()).order(ByteOrder.LITTLE_ENDIAN).getFloat();
@lone axle nice job!
@drowsy geyser we probably need to add something to the docs directory for it
disable only turns off ENABLE but doesn't set the init tracking that
nrfx uses. uninit hangs if ENABLE is off and is called because it
waits forever for TX to stop.
@lone axle glad that you work it out. @slender iron yeah with cccd disabled, the active read will return the most recent sample
I think there will be similar issues with writing to the services. I'm having a go at the tone service now, but probably will call it a night soon.
SPI and I2C do it a different way, like this, in the constructor. They do disable in deinit(), and in the constructor, they try to do do an nrfx init(), and only if that fails do they do the uninit(). I can't remember exactly why, but this was a better choice. Is UARTE different for some reason? Maybe it should follow the pattern in SPI and I2C.
nrfx_err_t err = nrfx_spim_init(&self->spim_peripheral->spim, &config, NULL, NULL);
// A soft reset doesn't uninit the driver ...
Hooray! The tone playing is working now.
@slender iron Ok. I haven't read the "how to generate the docs" docs yet, but I just wanted to offer.
I have the Feather STM32F405 Express board. I built firmware for it on Christmas. I have an LPS3x bord connected via QT. If I just print data, everything is fine. If I try to push the data to AdafruitIO, though, I get an error "AttributeError: 'str' object has no attribute 'encode'. When I run
adafruit/Adafruit_CircuitPython_AdafruitIO/examples/mqtt/adafruit_io_simpletest.py it throws the same error and backtrace. Here's the backtrace, code to follow down below.
Press any key to ente...
I think this is related to this setting https://github.com/adafruit/circuitpython/blob/master/ports/stm32f4/mpconfigport.mk#L16
encode needs MICROPY_CPYTHON_COMPAT but that is only include in the CIRCUITPY_FULL_BUILD
I'll try setting this to CIRCUITPY_FULL_BUILD
I tried to do a ring buffer, but it's a bit out of my depth. For now I just made a simple 1-item buffer for a single-byte report, but I updated the Python API to be what was suggested. We can change the underlying implementation later on.
Thank you for working it, Jerry! Let me know when you'd like me to test and verify, and I'll do a pull/sync/update and build the new firmware.
I was able to create a workaround by editing adafruit_minimqtt.py tp replace all the .encode calls to use bytes(string,"UTF-8") or equvalent fro the calls:
here are the diffs:
jerryneedell@Ubuntu-Macmini:~/projects/stm32f405/airlift$ diff adafruit_minimqtt.py ~/projects/adafruit_github/Adafruit_CircuitPython_MiniMQTT/
121c121
< if self.password is not None and len(bytes(password,"utf-8")) > MQTT_TOPIC_LENGTH_LIMIT:
---
> if self.password is not None and len(pa...
false hope -- this workaround does not work for the originally posted issue
fails with ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 2.0.0-6036-g7387f6092 on 2019-12-28; Feather STM32F405 Express with STM32F405RG
import minimqtt_demo
Connected to Adafruit IO! Listening for DemoFeed changes...
Subscribed to jerryn/feeds/DemoFeed with QOS level 0
Publishing a new message every 10 seconds...
Publishing 38 to DemoFeed.
Traceback (most recent...
ok -- fixed the workaround so let me know if you want me to create a PR to adafruit_minimqtt for this.
Got the light sensor, accelerometer, and neopixels working successfully this morning. I think I've got everything from the iOS app now. Time to build out a more generalized component to control everything and then build out the GUI.
Is there any video that goes more in depth on each module within the iOS Bluefruit App than this one: https://www.youtube.com/watch?v=pThUwgZF6p0 ? I will try to match the iOS interface as best as possible but I don't have a iDevice to play with the app so I'll have to work from a video for now.
Preview of "Bluefruit Playground" ... working on the best way to record the iPhone screen and the wireless Circuit Playground Bluefruit (Nordic nRF52840). Using Wirecast for now...
#bluetooth #iphone #ble
Visit the Adafruit shop online - http://www.adafruit.com
-----------...
@lone axle email me and I'll connect you with stuff. my email is scott@adafruit.com
Done.
boy there's nothing like starting a "full" keyboard implementation to make you appreciate how much is baked into easyavr / qmk! a bit bogged down in just how to handle "layers" at the moment.
@jerryneedell CIRCUITPY_FULL_BUILD is a setting directed at the features in py/circuitpy_mpconfig.mk, and was created for new boards such as the STM32 that do not include all features yet. It should probably get revisited to either update existing ports to use it (CXD does not, for instance) or remove it in favor of manually disabling everything that isn't used per port.
Could you try manually adding the MICROPY_CPYTHON_COMPAT setting to mpconfigport.mk, or moving it from full to minimal ...
When attempting to run the sample circuitplayground_button_a.py code that came with the CircuitPython 5 bundle (adafruit-circuitpython-bundle-5.x-mpy-20191228). Code crashes at imports due to
no module named 'adafruit_lis3dh'
This is with adding the adafruit_circuitplayground to the lib folder on the CircuitPlayground Bluefruit.
From online searching it implies their is an error with the CircuitPython build or the Ada library. If you think this is user error please let m...
@hierophect I made this change
jerryneedell@Ubuntu-Macmini:~/circuitpython_jerryn/ports/stm32f4$ git diff
diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h
index 932d4f855..ff6b7f4ad 100644
--- a/py/circuitpy_mpconfig.h
+++ b/py/circuitpy_mpconfig.h
@@ -182,7 +182,7 @@ typedef long mp_off_t;
// Remove some lesser-used functionality to make small builds fit.
#define MICROPY_BUILTIN_METHOD_CHECK_SELF_ARG (CIRCUITPY_FULL_BUILD)
-#define MICROPY_CPYTHON_COMPAT ...
@onyx hinge have you seen kmk? circuitpython keyboard software inspired by qmk
@slender iron ooh I'll look
they have a separate discord here too: https://discord.gg/vQ6UjT
The Circuit Playground Bluefruit doesn't have the library modules for the on-board sensors "frozen" in, unlike the CPX. See https://learn.adafruit.com/adafruit-circuit-playground-bluefruit/circuit-playground-bluefruit-circuitpython-libraries for information about adding those libraries.
@jerryneedell as you seem to have determined yourself, I don't believe there is any particular standard on length that silicon vendors like ST or Microchip follow when setting the unique ID for a chip.
In any case, thanks for determining that setting needs changing! Let me regroup on Monday and I'll issue a PR fix for it. Might end up revamping that whole section as noted earlier.
In any case, thanks for determining that setting needs changing! Let me regroup on Monday and I'll issue a PR fix for it. Might end up revamping that whole section as noted earlier.
Glad to help - I learned a lot from this.
@slender iron is there any way at the moment to edit the contents of a bitmap for displayIO directly?
@ionic elk bitmaps support assignment of pixels via []
Sweet. So I can perform a transform pixel by pixel?
can I turn an OnDiskBitmap into a regular bitmap?
no, because we assume OnDiskBitmap files won't fit in memory
gotcha
It seems very strange to choose the function monotonic_ns() when you cannot achieve nanosecond resolution. What is the point of using ns, rather than ms. monotonic_ns() gives the user the immediate impression that the function provides nanosecond resolution; what else could it mean? Why else does it exist?
A compounding issue is that the resolution restriction is not documented in the circuitpython docs, along with the unit that time.monotonic() yields.
@slender iron in that case, is it possible to make a regular bitmap out of an on disc bitmap? Since onDiskBitmap isn't subscriptable. nevermind found imageload
These functions also exist in "regular" Python: https://docs.python.org/3/library/time.html?highlight=monotonic_ns#time.monotonic. The documentation is similarly vague :slightly_smiling_face:. Please do open a new issue if you would like improved documentation. In practice, the resolution is not going to be nanoseconds, but it depends on the particular board.
Ah, thank you! I actually have never seen time.monotonic_ns() in Python3 before, so I assumed it was a CircuitPython specific function. I was just using it to benchmark a sampling rate, and realized the output was too chunky by about 3 orders of magnitude. Yes, I'll open an issue shortly about the documentation; as CircuitPython is geared more towards beginners, it seems important to equip them with details of function inputs and outputs.
In general, any module in CircuitPython whose name matches a CPython (regular Python) module has an API that is the same or a subset of the CPython API. This way people can write programs in CircuitPython and expect them to run on CPython if they use the standard CPython modules. This is unlike MicroPython, which feels free to alter the CPython API. In the past, MicroPython prefixed their modules with "u" (like ujson) to indicate they were not compatible with CPython, but they are moving aw...
I've used MicroPython quite a bit, which is probably why I was confused. Very unfortunate that they are moving away from that; It makes sense that a domain specific language (or branch) would provide different functionality and toolsets than one for general computing, but this comes with the requirement that nomenclature indicates the difference between the parent language and the domain specific language. As I'm just starting to look into CircuitPython, I find it an interesting middle ground...
It looks like lines 307 and 312 of py.mk use the alias PYTHON rather than PYTHON3 which is used later in the file (at 330 and 338). Evidently this breaks building mpy-cross if your system does not point python at the python3 . Changing the PYTHON references to PYTHON3 fixed it for me on a completely vanilla, brand-new WSL install of ubuntu 18.04
Where is this py.mk file you are referring to? I have not had any issue building mpy-cross on my Linux system with python and python3.
at the top level directory of the repostitory I use:
```make -C mpy-cross/``
@tulip sleet I am updating my fork of circuitpython for a badge i am working on. I seem to have a problem with I2C. I get an exception with "SDA or SCL needs a pull up". When i looked through the changes since my last pull i saw that you made a change effecting I2C https://github.com/adafruit/circuitpython/commit/85a648224fea027eb3635b7a3746cd6c12d738a6 . I am trying to understand what has changed. If i understand correctly the code now checks for presence of external pull up resistors. Could you please explain to me why this is necessary? aren't the built in pull up resistors enough?
@subtle sun busio.I2C does not use the internal pullups. It expects external pullups on the devices (e.g., on the breakout board). And there are not external pullups on the microcontroller board.
So the code checks that there is actually an I2C device connected, with proper pullups. This code is not new.
The internal pullups are quite weak (20kohms, if I remember right). The external pullups are typically 10k, and on a few devvices you need stronger pullups (typically 2.2k - 4.7k)
@tulip sleet I see that the code has existed on the samd port but this commit introduced it to the nrf port. It seems that the twim peripheral on the nrf which is used to implement busio.I2C does use the internal pullup. I see this issue when using I2C Addons (SAO) which don't always have pullups.
@tulip sleet if i understand correctly you are saying that not using an external pullup is bad practice. It may work but it is not guaranteed.
you are right, using the TWIM driver does turn on the pullups, which are 13kohms. However, this is not true on other boards.
...
yes, that's what I'm saying. We've seen some devices for which 10k pullups are insufficient. Our practice of adding pullups to all our I2C breakouts is from long ago (possibly partly due to how Arduino did I2C).
The reason we did the pullup checking is to fix this bug: https://github.com/adafruit/circuitpython/issues/2253
it's interesting that we got this bug even with the internal pullups, which are set here: https://github.com/adafruit/nrfx/blob/master/drivers/src/nrfx_twim.c#L73
in the case of #2253, there are two external pullups on the unpowered device. They are both connected to the +V for that device, but they are unpowered, so it's basically like a 20k resistor between SDA and SCL, and that causes the TWIM peripheral to hang.
Thanks for the explanation. I think i will build an adapter for last years badge with pullups and add pullups directly to the new badge. Hopefully that should solve this for me.
does the SAO "standard" have no pullups for I2C devices on the SAO add-on?
To the best of my knowledge this is not required.
The "S" in SAO does have relevance here, maybe ๐
iirc almost no addon actually uses the i2c
they just use the power pins
but from the design perspective, the pullups should be on the addon
when I first saw a board with SAO, and that it used an unkeyed 2x2 connector, I thought it was aptly named.
@stuck elbow thanks for your informed comment; I am pretty unfamiliar with them
@stuck elbow This is generally true. I am testing one that does and we are planning to make a bunch. @tulip sleet the new SAO use 2x3 and have a keyed version.
I made a spinny kirbo today
I've found that external I2C pullups are essential for reliably extending the length of the interconnecting cable. The I2C bus is designed to be mostly a current-based interconnect (from the host's perspective) to help with noise immunity, I believe.
Value of the i2c pullup depends on the bus capacitance & speed and requirement to standard conformance. Hardest part to control, or measure, is the capacitance. See e.g. http://www.ti.com/lit/an/slva689/slva689.pdf
Still lots to do, but it's coming along nicely. Tone generator is the first working module with an interface.
I have flashed this STM F405 feather numerous times.
here are my repeated steps:
install jumper wire between 3.3v and B0.
insert usb cable. yellow light flashes.
remove jumper wire.
program following STM32CubeProg steps and receive "File download complete alert"
what i get is the neopixel pulsing green, the yellow led still rapidly flashing, and no circuitpython drive coming up on my computer.
What version of CIrcuitPython are you using? There is a known issue with 5.0beta2 on the stm32f405. You will need to use the latest build from https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/feather_stm32f405_express/en_US/
With a file testme.py which consists of the single import statement:
import adafruit_circuitplayground.express
I get a maximum recursion depth error:
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-beta.0 on 2019-11-19; Adafruit CircuitPlayground Express with samd21g18
>>> import testme
Traceback (most recent call last):
File "", line 1, in
File "testme.py", line 1, in
File "adafruit_circuitplayground/express.py", line 699,...
So, TODO: Increase CPX stack size a bit more on 4.1.x and 5.x
Technical question: Is it possible to share the SPI bus between the (Q)SPI flash memory allocated as external memory and say an SD card connected to same SPI bus? Currently when trying I get a "pin in use" style error when trying to connect the SD card over the same SPI bus. And apologies if this is not the right place, I considered an issue on GitHub, but is this an issue? /Bjarke
I know tomorrow's meeting is text-only, and I seem to remember there will be the normal Show and Tell and AaE on Wednesday, but are there any special Adafruit events Tuesday or Wednesday that I missed? (I know Big Clive is doing a livestream, but that starts at 1300 Pacific...) You know what they say about New Year's - whatever you are doing will be plentiful for the rest of the year, so I figure hanging out with "electronics Internet friends" is a good thing to do.
@arctic hamlet I'm not sure I understand what you are trying to do. Have you modified the core Circuitpython code to do this or are you trying to do it in in python code? Can you provide an example of what you have tried?
@solar whale We have created our own port, with a mpconfigboard.mk containing:
LD_FILE = boards/samd21x18-bootloader-external-flash.ld
USB_VID = 0x04D8
USB_PID = 0xED5E
USB_PRODUCT = "XinaBox CW03"
USB_MANUFACTURER = "XinaBox"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
SPI_FLASH_FILESYSTEM = 1
EXTERNAL_FLASH_DEVICE_COUNT = 1
EXTERNAL_FLASH_DEVICES = GD25Q32C
@solar whale, that flash runs on the same SPI pins as my SD card, so when I used the SD card, it says one of the SPI pins are in use.
@solar whale, obviously the CS is different between the flash and the SD card...
@arctic hamlet ah -- ok -- then I will step back an let the core developers respond -- but it sounds like you are trying to create the allocate the SPI bus pins twice rather than share the SPI bus and just have distinct selects.
yes @solar whale, I think that is what I am doing, but since it happens two different places (one being when compiling the CircuitPython .uf2 (in C I assume) and one being inside the CircuitPython in ... Python), I don't know how to tell either in C or in Python to share/use shared pins.
I can see how that would be an issue! I thought possibly you were adding the SDCard interface into the core C code.
No, I am adding them as Frozen libs:
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice
FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD
And that works fine if I don't use external flash, such as if I do:
LD_FILE = boards/samd21x18-bootloader.ld
USB_VID = 0x04D8
USB_PID = 0xED5E
USB_PRODUCT = "XinaBox CW03 SD"
USB_MANUFACTURER = "XinaBox"
CHIP_VARIANT = SAMD21G18A
CHIP_FAMILY = samd21
INTERNAL_FLASH_FILESYSTEM = 1
OK -- so then do you configure the two SPI devices in your python code? Or is the External Flash done in the C code and you are trying to do the SD card in Python?
As I said, I should let one of the core developers try to help you.. I wish I could help more.
Thanks, @solar whale, so the SD card SPI device is configured in my python code, and the the external flash is done in the C code ... so the latter of your 2 questions. Thank you anyhow, I will await the core developers, when they got a minute. ๐
hi all! I'll continue to be "out" through thursday
bummed because winter static electricity seems to have taken out one of the touch pads on my pyruler ๐ข 
@onyx hinge I had a similar failure on a gemma_m0 -- I guess they "wear out"
my user reported feeling a static shock when she touched the pad which then never worked again...
it always reads the same high value now
IIRC on mine, the pin also was not useable as output any more
I've always been SURPRISED not to kill a pin with static discharge yet, since getting back into electronics with circuitpython. Used to be a very common failure mode, it seems like.
I may experiment and see if I can cover the exposed pads with a clear lacquer, which should not affect cap touch but (my gut tells me anyway) should mitigate ESD
May be a long day -- waiting for the snow to change to ice and take out the power lines.....
the snow is scheduled for noon here : warning for 25-35 cm (8-12") in 24h or so...
I'm in NH -- started snow last night but may change to freezing rain -- Much worse in the western part of the state. We may be spared on the seacoast... up to .5inchs of ice expected in some areas -- poor trees....
only 5 inches of snow predicted -- no concern there!
@idle owl is there another "notes-only" meeting today -- or just resume normal meetings next Monday?
@solar whale just next Monday
@solar whale Hanscom AFB is alreay operating on reduced staff. Mid-MA/Boston and North are supposed be bear the brunt of it. I hope you and yours are ok. When I lived in Delaware I was looking into one of those 10KW Koeler(?) LPG generators, because hurricanes. I didn't mind the storms, it was the days-long power outages.... I imagine you're in the same boat.
Back at $day_job, it's super slow, so I'm catching up on podcasts. Python Bytes Episode #161 (18 Dec) has a segment featuring CircuitPython. Love it how the world's are converging!!!
https://pythonbytes.fm/episodes/show/161/sloppy-python-can-mean-fast-answers
Segment starts at 18:45
Python Bytes podcast delivers headlines directly to your earbuds.
@solar whale Here in the Pugent Sound area they (1) don't like road salt because it gets into the water supplies, and salmon. (2) don't get enough snow to invest in road-clearing equipment. On those occasions when it does snow, given all the hills, it can be a dicey proposition. Last February we got 10 inches and the greater Seattle area basically shut down.
Hanscom was likely on skeleton already. Tis the season... ๐
Make no sense to say this is experimental and will change in 4.0.0 when we are already above 4.0.0.
This should be removed, or updated to say it will not be in x.0.0
@drowsy geyser We are lucky in that we live on the same block as the schools so we tend to get power restored quickly! We have a wood stove for heat and our gas stove and water all work without power so it's really not too bad for us when it goes out. My daughter live in Seattle and we hear the tales of the impact of snow on the area. Having learned to drive here, she is amused by the panic that ensues when it snows ๐
@solar whale Oh yeah. I grew up in Indiana (much snow/ice/cold) and then lived for a long time in Delaware, where we'd get Nor'Easters four or five times a year that down by the coast we'd get 35+ inches each time. I've driven to work in Jeep with snow sheeting back over the hood because it was deeper than the Jeep was tall. Then everyone here freaks at anything more than a heavy frost. It's fairly amusing.
Adds the MICROPY_CPYTHON_COMPAT flag to the STM32 port, which does not currently use the FULL_BUILD setting. Resolves #2433.
I think this might be a good opportunity to discuss the build settings in py/circuitpy_mpconfig.mk, since they're getting a little bloated. Right now we have:
- CIRCUITPY_FULL_BUILD (everything on the list)
- CIRCUITPY_SMALL_BUILD (just turns off full build only items)
- CIRCUITPY_DEFAULT_BUILD (everything not in full build
- CIRCUITPY_MINIMAL_BUILD (turns ...
I agree the BUILD flags should be tuned up (I was thinking of ALWAYS, MINIMAL, 192kB, 256kB, FULL). Worth opening an issue, but not urgent.
Two more module interfaces are working with their basic functionality:
https://youtu.be/33CtigJeMX4
Tested on Metro M4, Metro M0, CPB, and F405 Feather. All show CIRCUITPY promptly after both cold and powered restarts. Thanks!
<@&356864093652516868> Reminder, no meeting today! Next recorded meeting is 6 January 2020. Looking forward to seeing you all in the new year!
hi hi @lone axle that is neat! may i add it to the newsletter we do each week?
@rhooper hi - what are ya currently blocking on for this PR - we can get some help to wrap up this PR.
@river quest You can for sure. Thank you ๐
thanks!
hiya we're still hacking away at the PR - please help test when its released!
@arctic hamlet I don't think we have a way to concurrently do QSPI and user SPI
you may be able to run the SPI flash over SPI with the board.SPI object that the user code can access too
@ionic elk wasn't having much success sharing SPI between flash and display on meowbit though so it might need more work
I haven't been able to test it much. I was planning on making an issue as soon as I wrap some other Meowbit issues. But it might just be Displayio that'd have that issue.
I suppose dma makes this really tricky
@ladyada
From the top of my head, these are the remaining tasks:
- [ ] Free up time somehow!
- [ ] Sort out making it so native method calls can call python subclass overrides (specifically so the native
.fill()can call.show()on the python subclass). This is needed forauto_writeto work properly with the native.fill(). We could skip native .fill() for now. - [ ] Finish writing pypixelbuf so that implementations without pixelbuf work
- [ ] Test and merge the neopixel c...
I was successful in accessing the board.SPI part, but since it blew up USB right after I figured it was likely DisplayIO calls on reset conflicting with required MSC activity
@rhooper would it be ok for other folks to implement/test some of these TODOs?
good catch :) thanks fnord!
@ladyada absolutely fine with me. the more people that know the changes the better!
all iโd ask is that work be coordinated so i donโt spend time doing something someone else is working on.
sure, they'll post here in this thread
As suggested in #347, this adds a board counter for the downloads. Tested on my system locally with Jekyll. If it all looks good, I'll add the same to the Blinka page.
With the other PR in place now, this fixes #347. Tested with Jekyll on my system locally.
Gladly! Lemme know when there is something to test.
Just like we did for the downloads page, but with features oriented more towards SBCs.
stats post is up! https://blog.adafruit.com/2019/12/30/some-circuitpython-stats-for-2019-circuitpython/
Another one down:
https://youtu.be/9K8-3KdXKhg
I've never done 3D rendering before but going to try to figure it out for the accelerometer next.
Preview of the latest "Python for microcontrollersโ newsletter! Last one for 2019! Featuring community projects, sneak peeks of hardware, and more! SIGN UP! โPython for microcontrollersโ newsletter! https://www.adafruitdaily.com
Preview of the latest "Python for microcontrollersโ newsletter! Last one for 2019! Featuring community projects, sneak peeks of hardware, and more! SIGN UP! โPython for microcontrollersโ newsletter! https://www.adafruitdaily.com
#circuitpython #python #micropython
I have been running into an issue where the hard-fault handler gets triggered on the Feather nRF52840. Unfortunately, the board starts flashing yellow and isn't visible on USB when this happens: neither as a serial port, nor as a drive. Pressing reset is required.
I tried disabling the bluetooth code.
I tried 5.0.0b2
I tried master
I tried new-pixelbuf-api without bluetooth code.
I tried not using pixelbuf at all (just neopixel).
I tired without USB connected.
The same code on...
Did you set a breakpoint on HardFault_Handler?
Even on a fresh board, it faulted.
I did, it didn't trigger. Interrupting execution showed it in the NORDIC_SOFT_DEVICE_ASSERT safe mode. I set a breakpoint on softdevice_assert_handler. See below.
(gdb) break HardFault_Handler
Breakpoint 1 at 0x43b16: file supervisor/port.c, line 168.
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /Users/rhooper/Devel/circuitpython/ports/nrf/build-feather_nrf52840_ex...
One reason this can happen is if the softdevice detects that it has missed a BLE timing window. This is often due to something else taking too long with interrupts off. I did search for this pc value, but no one has reported that.
It could be that neopixel_write is taking too long somehow. Could you try this specifying DotStars instead? You don't have to actually connect anything, just try the same code.
That would make sense - neopixel_write is called the majority of the execution time in that particular code. Is there some way to make sure BLE timing windows are not missed? The dotstar test is ongoing. I'll post if it ever crashes to the NORDIC_SOFT_DEVICE_ASSERT.
Is there a better way to handle NORDIC_SOFT_DEVICE_ASSERT?
Is there a better way to handle NORDIC_SOFT_DEVICE_ASSERT?
It should never happen. It means something bad has happened that it can't recover from.
Looks like an issue with our board definitions prevented the user from accessing external flash, I've fixed this in the latest release (1.7.4) and am able to get a proper JEDEC ID from the flash chip using the SdFat_circuitpython example. However, it seems like we are unable to mount the filesystem
Still need to add the text outputs, and I think there is still something slightly wonky with the angle of the 3d model. But I'm excited to have gotten the 3D rendering and accelerometer working this much:
https://youtu.be/2Bi-BNPjark
The rotation pivot point was at the bottom of the board instead of the center I think, that is what was making it a bit wonky still.
Was there a circuitpython weekly meeting and when is the recording going up on youtube?
okay thanks and HAPPY NEW YEAR to everyone
Working pretty well now:
https://youtu.be/9kwz6_pGGwg
I've run into this same problem, slow animations. I'd also be happy to test this once its released.
@lone axle very nice ...
cpx powered reading lights for the kid's bunk beds.
touch pads control colour, buttons adjust brightness, switch turns off the LEDs.
Not much at the default brightness (0.04)
Nice!
https://automatetheboringstuff.com/2e/ a friend pointed me at this, though a lot of it will not apply to circuitpython.. always room for more python learning material
automate is a pretty good series.
our friends over at Python Discord have a good curated list of resources, in case you'd like it: https://pythondiscord.com/pages/resources
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
@raven canopy Ooooh, Python Discord? How does one get an invitation to that server?
@drowsy geyser link from the website: https://discord.gg/python
Thanks, @raven canopy !
yw!
started my CircuitPython in 2020 entry. already feels like the longest first draft in history. ๐คฃ
Messege: Crash into the HardFault_Handler
You are running in safe mode which means something unanticipated happened.
Looks like our core CircuitPython code crashed hard. Whoops!
Please file an issue at https://github.com/adafruit/circuitpython/issues
with the contents of your CIRCUITPY drive and this message:
Crash into the HardFault_Handler.
Which board and which version of CircuitPython is this?
Trinket M0
adafruit-circuitpython-trinket_m0-en_US-4.1.0
@deshipu Note that it is now a lot easier to adjust the size of the internal filesystem, the size of the nvm area, etc.
using the I2c drivers (adafruit_bus_device) from
adafruit-circuitpython-bundle-4.x-mpy-20191123
except:
# Handle IO exception by waiting it out
time.sleep(0.010)
#print("Exception")
What exception are you getting above, on which line? Could you remove the handler temporarily so we can see the backtrace? Also, have you tried updating to 5.0.0-beta.2 and also updating the librariies? It seems like the FX29 may be pathological in some way.
@deshipu Note that it is now a lot easier to adjust the size of the internal filesystem, the size of the nvm area, etc.
Oh, really? Is there documentation on that?
It was part of https://github.com/adafruit/circuitpython/pull/2371. See https://github.com/adafruit/circuitpython/blob/32b82032a1af88314aa260665a4bfd8c4b7a6988/ports/atmel-samd/mpconfigport.h#L116-L135, for SAMD51. Note that changing the NVM size will move the filesystem, so the existing filesystem in internal flash will get trashed
@timber mango I edited the GitHub comment to add "So you can change these constants in your mpconfigboard.h"
@tulip sleet thanks! I'm not yet entirely sure if I want nvm or not
it could be useful for savegames, but I would need some way of managing saves from multiple games then
you could shrink the filesystem a bit and get back some native modules if you want them. nvm has to be at least one page long (8k) if it exists
heya @ionic elk if you have a minute, please take a look at this forum thread; the user is having an issue with i2c and an oled display
https://forums.adafruit.com/viewtopic.php?f=60&t=159872&p=789428#p789428
@tulip sleet yeah, it's a difficult decision, but I think it's mostly supposed to be for games, not for electronics, so it should be fine, I can still disable analogio if I need more space โ it saves a lot
The exception was:
'OSError: [Errno 5] EIO\r\n'
I do not have line info but I believe it occurs during an I2C read when the device is not ready [ device.readinto() ]
Unfortunately the crash occurs irregularly and almost randomly. I have the code running on multiple "systems" and at best (from debug point of view), a crash occurs after several hours, and at worst never. This one happened overnight.
I have not tried updating as of yet.
Is there a way to force an automatic restart...
hey @tulip sleet, can you take a look at this when you have a minute or two? User is having issues with SD cards:
https://forums.adafruit.com/posting.php?mode=reply&f=60&t=159785
wiring and board details are pending
Accounts
You can call microcontroller.reset() to do the equivalent of pressing the reset button.
Do you need 100Hz update? what happens if you lengthen the sleep() in the main loop. I see that the datasheet says it can take 3 msecs or 8.4msecs to get a reading (at "4 MHz" -- I'm not sure what clock frequency it's talking about there, because the max I2C freq is 400 kHz).
Also there is a typo in your test program:
FaultCount = FalutCount + 1
All of this does not excuse the crash, which should not happen, though there are some devices that really confuse the I2C peripheral on some chips.
Could you give us a part number or purchase link for the particular FX29 you are using? It may be worth ordering one and trying it out.
Thanks for catching the Fault with my Fault Counter :)
I do need the 100Hz Update. This should be achievable - I tested without the delay and was getting continuous updates at a much higher rate without any errors.
And the FX29 documentation certainly leaves room for improvement. Here is the documentation for the I2C controller that is in it.
IDT_ZSC31015-Datasheet_DST_20161114.pdf
...
I assume you have I2C pullups somewhere? Are they 10K each, and are they located at the end of the FX29 wires (which seem longish?). Is there any special stressing going on with the load cell when it crashes, or is it just sitting quietly?
I am just asking all this to make sure we can duplicate your setup. Thanks.
We are using 4.7K pullups.
The wires we ended up with are shorter - we are deploying the 40mm length.
Crashes are uncorrelated with pressure, or changes in pressure. Usually the crash happens when there is a constant (low) pressure. My overnight failure happened on the bench, with no pressure at all.
I appreciate the questions, and the help.
In my code I plan to replace the time.sleep() statement with the microcontroller.reset() in the exception handler. Is there an easy way fo...
To cause an exception, you just raise it: raise OSError, for instance.
The exact part number you gave, FX29J0-040B-0100-L, does not seem to be stocked anywhere. The "J" says I2C without sleep, and no one stocks J models. https://te.com does not list that as a regular item either, though the datasheet implies you could order it (which I guess you did). See below.
So this looks harder to reproduce on our bench. We could get the I2C controller and try that. But do you have a J-Link and...
I believe the sensor is new - which is why we ended up ordering the parts digikey had in stock at the time rather than the ones we originally wanted.. And that means we got the K version (with sleep) rather than the J version (which we wanted).
I don't have the setup you describe - so remote debugging is not in the cards at this point. Sorry, but thanks for the offer.
So is the one you actually have in hand a FX29K0-something? DigiKey has none in stock, but Mouser has these, which are pretty similar (load range, cable length, and connector vary). I could get one of those: https://www.mouser.com/TE-Connectivity/Sensors/Force-Sensors-Load-Cells/_/N-deui5Z1yzvvqx?P=1z0s0dsZ1yzs6ii&Keyword=29k0&FS=True
The J vs K sleep difference might be significant and might be confusing the Atmel I2C driver.
@pastel panther @trim elm Thanks for the warm welcome to my "inbox" on this New Year!
@solar whale lol
This is the correct sensor. The "sleep" feature may indeed be the cause or part of the cause.
Unfortunately, the IDT controller referenced above is programmable only during manufacturing and not during operation - so sleep can not be disabled once a part is in your hands.
All of the sensors are mechanically identical
The load range is determined by a resistor so it should not affect communications
The cable length is short enough so that it should not be a factor
We are using the conn...
One more question: the ZSC31015 is a OneWire device, not I2C, so is there another microcontroller that's converting the OneWire to I2C? I would guess so. So whatever firmware is running in that microcontroller might be flaky. Have you talked to TE about this?
TE supplied me the ZSC document after a long quest to get info beyond what is found in the data sheet.
I don't hold much hope of getting more useful info beyond what I have..
And so, no. At least not yet.
I worked around the native .fill() method being unable to call .show() on subclasses using a helper function in _pixelbuf instead.
Dotstar and Neopixel changes appear to work, but I need some assistance gathering up examples to test compatibility.
https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel/pull/59
https://github.com/adafruit/Adafruit_CircuitPython_DotStar/pull/42
<@&356864093652516868> here is the CircuitPython 2020 post! I'm excited to hear from you all! https://blog.adafruit.com/2020/01/01/what-do-you-want-from-circuitpython-in-2020-circuitpython2020-circuitpython/
@slender iron Perhaps the "A post on the CircuitPython forum" could be a link to said forum?
@cunning crypt good idea. updated!
Oh, now this has completely de-railed what I was working on. Writing a blog post on my thoughts.
Here you go, @slender iron et al. http://blog.moyer.ai/2020/01/02/circuitpython-2020-thoughts/
Thanks @drowsy geyser !
No worries. I'll give it more thought and update the list as I go. ๐
https://blog.adafruit.com/tag/circuitpython2019/ in case you need inspiration or just to see what people were thinking a year ago
these are a lot more introspective than my first draft
hehe. most of mine at this point is "last year"... ๐
Pypixelbuf has had some testing done - seems to work - but needs the same kind of testing as the Dotstar and NeoPixel PR. It also needs putting in pypi so that the Dotstar and Neopixel builds can pass.
https://github.com/adafruit/Adafruit_CircuitPython_Pypixelbuf/pull/3
@raven canopy with my weekly reports, I find I seldom worked on what I said I would. How much less likely is it for a whole year?
lol. fair point. i've definitely had This Week: do x entries for multiple weeks.
@onyx hinge i do currently have an "overall goal" in my draft at this point, but i will be adding some SMART* goals. (* Specific, Measurable, Achievable, Realistic, Time-based)
hoping for any help with a problem initializing I2C on an ItsyBitsy M4 Express to control an Adafruit DRV2605L haptic motor controller - using the example code, I receive an "ValueError: SCL in use" error.
Running 4.1.2 with associated drivers
oops wrong link
does the "i2c scan" example have the same problem @obtuse pulsar ? https://learn.adafruit.com/circuitpython-essentials/circuitpython-i2c#find-your-sensor-15-10
@onyx hinge I will try that
@onyx hinge That does not error and returns I2C addresses found: ['0x5a']
Okay, that may mean it's something wrong with the other example. Can you send a link to that code?
I do have an itsy m4 if I can find it, but not the motor controller
@onyx hinge https://learn.adafruit.com/adafruit-drv2605-haptic-controller-breakout/python-circuitpython#
import busio
import adafruit_drv2605
i2c = busio.I2C(board.SCL, board.SDA)
drv = adafruit_drv2605.DRV2605(i2c)```
this code causes the error
I see.
I tried that code but because I don't have the board, I get this: ```Traceback (most recent call last):
File "code.py", line 5, in <module>
File "adafruit_drv2605.py", line 101, in init
File "adafruit_bus_device/i2c_device.py", line 78, in init
File "adafruit_bus_device/i2c_device.py", line 76, in init
ValueError: No I2C device at address: 5a
line 5 is the one which says drv=.
Can you paste your whole error, from "Traceback" to the end? And for that first line in code.py, verify whether it's the drv= or i2c= line
File "code.py", line 4, in <module>
ValueError: SCL in use```
The line causing the error is the i2c= line
newbie question, how do you properly paste code in the chat window to format properly?
Put three of the "backtick" character together: This character: ` at the start and the end
```
code
```
code
thank you
@obtuse pulsar what you are seeing is really strange. What happens if you move the "import adafruit_drv2605" line below the "i2c =" line? It seems like something unexpected is happening before "i2c =" and this may help figure out what it is.
import busio
i2c = busio.I2C(board.SCL, board.SDA)
import adafruit_drv2605
drv = adafruit_drv2605.DRV2605(i2c)```
produces
File "code.py", line 4, in <module>
File "/lib/adafruit_drv2605.py", line 10, in <module>
ValueError: SCL in use```
How did you put adafruit_drv2605 on your device? Can you erase adafruit_drv2605 from CIRCUITPY and copy it fresh from the bundle?
import busio
import adafruit_drv2605
i2c = busio.I2C(board.SCL, board.SDA)
drv = adafruit_drv2605.DRV2605(i2c)```
produces
```Traceback (most recent call last):
File "code.py", line 4, in <module>
ValueError: SCL in use```
(is it possible that you accidentally put some of your code in adafruit_drv2605?)
I will install a fresh library bundle
https://github.com/adafruit/Adafruit_CircuitPython_DRV2605/blob/master/adafruit_drv2605.py#L10 should be unable to cause that error
note: if using .mpy, none of the comments will be there. i'm suspecting that its line 101 in the raw file (it's the only one that makes sense.) ๐
but I still think it preserves the line numbering ??
when reporting errors in the backtrace
My error was with a .mpy file too, and it reported what I think is the true location in the .py file, line 101
hmm... TIL. nevermind me... ๐
@onyx hinge's point about the line numbering is well-taken. Either the file in lib/ has been changed by mistake or you have another adafruit_drv2605.py or .mpy in the top level directory (which gets searched before lib/)
I may try to reflash and start fresh with the OS and LIB bundles to make sure
you don't need to replace the whole bundle, just that .mpy file
i'm checking the file in today's bundle. @obtuse pulsar is that the version you are using?
12/28
make sure on Linux and Windows when copying to CIRCUITPY via Finder or Explrorer or command line that you eject the drive on windows or sync on Linux
will do
that ensures the file is completely copied
thanks for checking @raven canopy
Is there any effective difference between setting neopixels to a dark color like (0,0,1) vs. setting them to a bright color like (0,0,255) but also setting the brightness setting down to something low like 0.01?
@lone axle You can change the brightness dynamically
so for instance you could set brightness to 0.01, set all your pixels, and then ramp brightness from 0.01 to 1.0 in steps, without recalculating all your pixels
(of course, circuitpython is recalculating the pixels for you :))
I see. Thank you
@idle owl, to update the bundle to reflect a lib being renamed, is it as simple as replacing the old with the new in the .gitmodules, docs and wherever else the old one is used?
A refresh of the file system and libraries fixed the issue!@onyx hinge @raven canopy @tulip sleet
now onward with my haptic project! a haptic remote extension for visually impaired television "watchers"
@obtuse pulsar I'm glad to hear it. Sorry you ran into trouble in the first place!
that sounds like an interesting project, I hope you'll let us know more as it progresses.
If you haven't met @tough flax it sounds like you should.
indeed!
will do and thank you...great experience as a first timer with CircuitPython! I will reach out to @tough flax as I have a number of accessibility projects in mind
@obtuse pulsar You may be interested in this: https://github.com/dhalbert/ShortcutBox, which is what got me working on CircuitPython. I built it for a filmmaker with cerebral palsy who wanted to use keyboard shortcuts in Adobe Premiere using foot-operated buttons.
huh seems I toasted the neopixels on this pygamer. They were working, but now they don't light at all. including when I double-click into the bootloader.
on my other pygamer they light up when going to bootloader
I wonder what happened, I guess I was repeatedly picking up and putting down the board to press buttons, so it could be another static shock
๐
oh well, time to call it a night!
i think you need a wrist strap! humidity there must be low!
it is and I guess I do
would be interesting to Saleae it and see if you're getting signals to the first neopixel. you could skip over the first if it's the first that's fried.
Neopixels are coming along. Just need to make the pixel selectors and then the sequence animations:
https://youtu.be/qdRthujdr4I
@tulip sleet that occurred to me too
looks like the output of the mcu is damaged, no signal can be seen at the input of the first neopixel.
@onyx hinge Seems unlikely to be static shock, these boards are pretty tolerant.
not sure what else to blame. software shouldn't be able to do that either
Well if you scoped it and it's not sending a signal, then no, that's pretty likely to be hardware.
But I've zapped a Feather so hard that it hurt, made my display flicker, ejected everything I had connected to my laptop and put the board into safe mode. Still worked.
same here, but this week my luck changed
@idle owl happy to, link?
Pro tip: Your board will not mount CIRCUITPY or *BOOT if you have it plugged into a wall charger and not your computer. ๐คฆ
I ran into two charge-only cables recently. curse them.
you're welcome
Making a note of this forum issue (experiences internal displayio error on reset) to try and validate whether it's related: https://forums.adafruit.com/viewtopic.php?f=60&t=159872&p=789428#p789428
Ok, I'm properly back today for the rest of January! I've done my best to keep up/catch up on any STM32F4 bugs/happenings but if anyone sees something I don't appear to have responded to, please let me know so I can get on it! @pastel panther just made a note of that I2C displayio thing on the corresponding issue, I'll take a look ASAP
@ionic elk welcome back!
OK, that does it for today's random acts of github.
I did too. Was having errors flashing old Arduino boards with an FTDI Friend. The problems turned out to be 2 bad Arduinos, 1 bad FTDI Friend, 1 bad FTDI cable, and 2 charge-only USB cables (one mini, one micro). That was a long difficult slog.
Note to future self: when you can't connect or even find a port, check the USB listing for your serial chip: if it ain't there, you've got a bad chip and/or a bad cable/port, don't bother looking downstream until it at least enumerates as a USB peripheral.
@onyx hinge pulseio should work in the background. how slow are the pulses though? it caps out at 16bit microseconds
@drowsy geyser re your post: feature requests should be done as github issues
for the live stream what would you like to see? the in the weeds section tends to be the place we take questions now
the awesome page is the master cheat sheet: https://github.com/adafruit/awesome-circuitpython
could someone do a sanity check for me? I need to figure out the difference between these two blocks of code:
self->chan_handle.OCNPolarity = 0;
self->chan_handle.OCIdleState = 0;
self->chan_handle.OCNIdleState = 0;
self->chan_handle.OCMode = TIM_OCMODE_PWM1;
self->chan_handle.Pulse = 7000;
self->chan_handle.OCPolarity = TIM_OCPOLARITY_HIGH;
self->chan_handle.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&self->handle, &(self->chan_handle), self->channel) != HAL_OK)
{
mp_raise_ValueError(translate("Could not initialize channel"));
}
TIM_OC_InitTypeDef sConfigOC = {0};
sConfigOC.OCNPolarity = 0;
sConfigOC.OCIdleState = 0;
sConfigOC.OCNIdleState = 0;
sConfigOC.OCMode = TIM_OCMODE_PWM1;
sConfigOC.Pulse = 7000;
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
if (HAL_TIM_PWM_ConfigChannel(&self->handle, &sConfigOC, self->channel) != HAL_OK)
{
mp_raise_ValueError(translate("Could not initialize channel"));
}
On the STM32F401, only the second, with a locally declared config structure, will allow PWM to start. The first version works on every other STM32 we support.
are there fields that the first will leave uninitialized?
nope, every single field in the struct is initialized in both versions
I also tried a memset(&(self->chan_handle), 0, sizeof(TIM_OC_InitTypeDef)); in the first, didn't seem to do anything
hrm, what is the error code you get back when it fails?
No errors. the PWM just either works or it doesn't. Internal values are all as expected.
did you check the errata for the chip?
This works, which is wack:
self->chan_handle.OCNPolarity = 0;
self->chan_handle.OCIdleState = 0;
self->chan_handle.OCNIdleState = 0;
self->chan_handle.OCMode = TIM_OCMODE_PWM1;
self->chan_handle.Pulse = 7000;
self->chan_handle.OCPolarity = TIM_OCPOLARITY_HIGH;
self->chan_handle.OCFastMode = TIM_OCFAST_DISABLE;
TIM_OC_InitTypeDef sConfigOC = self->chan_handle;
if (HAL_TIM_PWM_ConfigChannel(&self->handle, &sConfigOC, self->channel) != HAL_OK)
{
mp_raise_ValueError(translate("Could not initialize channel"));
}
hrm, that is doing a copy
right. So the values of the chan_handle are fine... but passing it in is screwing up somehow
haven't dealt with data alignment in this context, what are you suggesting?
@pbricmont that is impressive! Any chance you have a debugger that can snag a backtrace from the hard crash?
@ionic elk print out the address of the two and see if they are aligned
I don't think that is it
I'd suggest using gdb to look at all of the registers of the timer after you call set
I'll give that a shot. I still don't totally get what could be going on with the alignment.
is that something I should keep researching here or are you confident that's not it
it doesn't seem like an issue
I'd skip to the register stuff
good link
very helpful
@slender iron thanks for the "in 2020" post notification, I've been writing my thoughts throughout the last month in prep for a post ๐
Speaking of 2020, here's my #circuitpython-dev2020 thoughts: https://blog.thea.codes/thoughts-on-circuitpython-2020/
๐
@slender iron just for the record addresses are 0x20007004 (&(self->chan_handle), bad) and 0x20017c58 (sConfigOC), good.
is now super intrigued on @ivory yew's library package management thoughts. ๐
This implementation is totally fine. Thanks for doing it! Just a couple suggestions but then it should be good to go.
How about changing this to read_report_into so that it doesn't do an allocation?
@slender iron interesting, I overlooked that it works that way. For wwvb you need to distinguish .2, .5, and .8 second pulses
can you do that by just sampling the pin?
@theodox Please create a PR with the fix. We'd love to merge it in. Let us know if you need help doing that. Thanks!
Any idea what is turning off interrupts? I thought the nRF neopixel code used a peripheral to do it and didn't mess with interrupts.
@slender iron I have determined that the problem is not specific to the F401, but actually to the DEBUG=1 flag of the makefile: IE, whether the cflags -ggdb, -fno-inline, and -fno-ipa-sra are enabled. When they are, the issue does not occur.
I had turned DEBUG off to compile at a smaller size to try and fit it into the remaining space allocated by the Meowbit custom bootloader
basically yeah. Fails only when I can't look at it lol
fuuuuun ๐
and it's at that exact spot: where &(self->chan_handle) is passed in
you can try with each of those flags off separately
When I looked at it with GDB, everything was the same ofc
I'll research the flags a bit. But at this point it's worth asking whether I should switch to something else, since I've at least diagnosed the problem and it's quarantined with DEBUG.
all of our release builds are optimized though
Oof gotcha. I'll dig deeper then
Probably good to get a nice hard answer here since I'm not sure if other STM32 hal components might be affected. I haven't tested super extensively with DEBUG off - it's enabled in all current builds.
we should definitely getting it going with opt
you can still read the peripheral registers so it'd be worth getting that workflow going
asm("bkpt") can break you where you want to too
ya, I believe so
ok, new learnings. i'm on it
๐ keep me posted on how it goes
what's the biggest benefit to optimized build? Speed or size?
Just noting that we can't increase internal filesystem size due to caching
size and speed due to the inlining
@slender iron I updated the post with your answers, but the one thing I wanted to clarify is the office hours idea. Here's what I replied: I was actually thinking more along the lines of a university professor or teaching assistant office hours, where any of the students can show up for detailed help or questions. "In the weeds" feels more like the Q&A at the end of Ask and Engineer. Also, since I didn't realize that was open to anyone, for non-CircuitPython-implementation questions, I'm pretty sure other community people won't know that. Discord is great, and people seem to ask in either #help-with-circuitpython or #circuitpython-dev, but I feel like people refrain from long threads in-channel. Office Hours would be a place to interact and teach in a more face-to-face way, if that makes any sense.
Check out this guide about adding new boards to CircuitPython: https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython
-ggdb should be the least capable of introducing behavioral differences, nothing of 'debugging info' makes it to a .bin / .uf2 file
@drowsy geyser for private discussions I'm going to start a calend.ly for scheduling mentorship time
for technical support/help I'd rather do it publicly
have you watched any of my streams I did
Totally understand. Thanks. Uh, no, didn't know you did those streams!
@slender iron background sampling means never having to worry how long foreground stuff takes. The AVR 8-bit MCU ones I've tinkered with just used a 100ms sampling interrupt but you may be right that I am just not framing the problem in the right way to fit with CP.
@drowsy geyser need a link to the recordings? I'd be happy to do more like them.
@slender iron Please! I'll binge them this afternoon. ๐
it would be nice to accurately know the time of the transition because one of them (would have to look up which) is synchronized to the start of the second
@onyx hinge to use PulseIn we could just switch to a 32-bit time value
Or add a prescaler?
honestly though if CP already could do one of the things I imagined, that's a good outcome too and I'm still happy it was something I posted about ๐ ๐
what the ---- ! my pygamer LEDs are working again, and I didn't change anything
@drowsy geyser https://www.youtube.com/watch?v=baa5ILZTRkQ https://www.youtube.com/watch?v=aWQzoxDyMvI https://www.youtube.com/watch?v=11B-3voAwdg
Live stream of @tannewt debugging memory issues in CircuitPython.
Visit the Adafruit shop online - http://www.adafruit.com
LIVE CHAT IS HERE! http://adafru.it/discord
Adafruit on Instagram: https://www.instagram.com/adafruit
Subsc...
Go behind the scenes and see how CircuitPython is released as @tannewt releases 4.0.0 Beta 4. Afterwards, have some Friday fun hacking on a GameBoy with CircuitPython.
Originally streamed on https://www.twitch.tv/tannewt/
Visit the Adafruit shop online - http://www.adafruit...
Scott (@tannewt) did a livestream on how-to review CircuitPython code on his Twitch channel: twitch.tv/tannewt
Scott's sponsored by Adafruit to work full-time on CircuitPython.
Visit the Adafruit shop online - http://www.adafruit.com
---------------------------------------...
@onyx hinge ๐ it's interesting to know what things people don't know about
Thanks, @slender iron !
its been so long since i opened the sheet. but wouldn't 32-bit time value consume two TCs? and aren't they specific groups, that might be complicated on a pin-mapped basis? loads the sheet, after asking the question.
Do we have a new issue for using the CCRAM? We could definitely use it and free up the normal ram for the circuitpython heap.
I want to start adding more information about memory locations to CircuitPython. The iMX RT line runs code off of flash so we'll want to start designating some code to sit in RAM. We may also be able to speed up execution by moving the stack and other common state to core coupled memory. (mp_state struct is one candidate.)
Note, the CCM memory is actually data-only (not on the instruction bus):

What do you want to see in CircuitPython in 2020? #circuitpython-dev2020
https://blog.adafruit.com/2020/01/01/what-do-you-want-from-circuitpython-in-2020-circuitpython2020-circuitpython/
hello.
I managed to build CP with CIRCUITPY_DISPLAY_LIMIT = 2 for the monster m4sk, and made the 2 displays working nicely. It would be a great idea to allow, at least for this board, multiple displays...
Not sure. https://github.com/adafruit/circuitpython/blob/master/ports/nrf/common-hal/neopixel_write/__init__.c#L229 might be if DMA isn't used - I'll check with a JLink later.
dan added it, some sort of optimization
`-fipa-sra
Perform interprocedural scalar replacement of aggregates, removal of unused parameters and replacement of parameters passed by reference by parameters passed by value.
Enabled at levels -O2, -O3 and -Os.`
Using the GNU Compiler Collection (GCC): Optimize Options
That is an excellent idea. However, I wonder how it will work when we store more than one report in the buffer? I was thinking we could then just hand the allocated string to use user and remove it from the buffer without copying then, but with this we will need to copy and free it.
@ionic elk Suppose you have a structure: struct pt { int x, y; }; as a local inside a function. If the complier turns it into two variables pt__x and pt__y, it might have new opportunities for optimization. For instance, if it then notices that pt__y was never ever assigned, or an assigned value never used, it can omit it. Like all optimizations, it's not intended to make a visible difference for "conforming code" but of course sometimes we all write code which ends up being interpreted differently than we expected the compiler to do..
anyway, that is my lay understanding of what "scalar replacement of aggregates" is ..
HMMMMM
BIG HMM
so, say, in a struct, where you've got a bunch of variables that are getting assigned to registers, it could decide that some of them don't matter, for some reason? Potentially?
Nevermind, I just realized that the string is added to the buffer in an interrupt, so the whole buffer would need to be pre-allocated anyways.
also I guess dan created no-ira-spa? my mistake was searching for the whole thing as opposed to just the ira-spa part
-fFOO usually enables an optimization, and -fno-FOO turns it off again.
so it's an implicit thing
Why is this needed? Does it apply to the whole file? I've done (void) var; instead. That is clearer about which parameter is unused.
I'd prefix this with pixelbuf_ for clarity.
Really really close. The show stuff looks fine except the name. Another questions about unused param but good otherwise.
Think we should raise a NotImplementedError?
@idle owl @ruby atlas I'm about to add a review to the Adafruit_CircuitPython_PyPixelBuf PR, please wait to merge
Should we add another error string, or is mp_raise_NotImplementedError(NULL) ok here?
This is leftover from the _subscr changes - removing these.
I think the I2C and SPI pattern is an artifact of the early code that didn't correctly reset the peripherals on soft reset. Want me to update the other two as well?
It looks like the I2C disable was added here: https://github.com/adafruit/circuitpython/pull/1277/files#diff-0fadf6b9ea8a38a03206d10c865959c3R59
@slender iron here is mine: http://dopieralski.pl/posts/2020-01-02-circuitpython/
thanks @stuck elbow
OK, that makes sense to me. The point is that nrfx_..._uninit() is now idempotent in our fork of nrfx. I guess I changed that but didn't go back and utilize the new capability. So yes, please fix the other busio impls. Thank you.
@slender iron is it OK if I wait on mine until Monday? I've got a Circuitpython buddy here in A2 who uses it full time and we were going to co-op on a post
@stuck elbow and @slender iron I strongly second a community keyboard design!!!! I've wanted one ever since the Hackster site published an article about it. I would be very much willing to help with requirements and programming (not good enough at PCB design yet.) Definitely would want per-key LED lighting with Cherry MX or Brown switches. BLE. USB interface for wired connections. LiPo battery. OLED status display, etc, etc.
But I could push him if earlier is better
@drowsy geyser there is KMK
Err? Not familiar with it. Off to Google.
@ionic elk no rush at all. We want to wrap up by the 13th
they have their own discord server
@drowsy geyser I am excited about keyboards too.
@drowsy geyser @obra from keyboard.io and I were discussing a CP dev keyboard
second hand-wire keyboard in progress, I think I'll be able to slot in the itsy nrf when it shows up on my doorstep ๐ ๐
personally I want some kind of screen and an FN+??? key to switch to the Python REPL on the built in screen and FN+??? to paste the last printed result in as though I typed it. that would be amazing.
so! many! things! to be excited about
That looks interesting, but it's a bit to Kerbal for me. I'd like all the components surface mounted, program directly in CircuitPython, not by adding on boards.
Hi folks
I can totally see that POV too. A product couldn't be hand-wired IMO. For me, it's the right choice, due to PCB fabrication costs vs my time being "free"
I'm not sure you can inject characters into the REPL at the moment
Coming in completely blind, so possibly totally wrong on context, but I've been loving JLCPCB's low-cost SMT service.
They've made me some fairly decent keyboard PCBs with surface mounted components quite cheaply and quickly in the past few months.
@stuck elbow not yet, micropython has some provision for it (webrepl) but it's not in CP at the moment
You'd have to hand-solder connectors
@onyx hinge I'm sure @indigo wedge will be working on it for his keyboard wing
@tall vigil I think I ordered the pcb for my Flouder keyboard from them too, was something like $12
also, this is repl-while-main.py which is again .. unusual
maybe interact.py can be ported from python to circuitpython
@onyx hinge I wouldn't be above having a separate chip for the keyboard handling, talking serial
even a stupid atmega would do, or attiny with a shift register
Some of our boards, we push the key scanning and last-mile LED driving off to an ATTiny88 so that the user's code doesn't mess with our keyscanning and led driving timing loops
Then we talk to that over i2c.
right, here serial would be probably more intuitive
For a hobbyist board, I might not bother. But for a product, it's super-useful.
I really need to deal with BLE HID. What's been scaring me off is having to deal with shipping lipo batteries
@slender iron I figured out the thing by the way. It was a dereferenced pointer from a totally different part of the code that was being cleverly disguised by the optimizer as a struct issue due to memory organization.
I'll get a PR in tomorrow
(This is an extreme example of what "full stack" now means in my world ๐
@tall vigil Can you package it so the user puts in their own batteries? Because that's way easier
Quite possibly. But it's -not- the common practice in the industry
And really, we've got plentry of product backlog ๐
Well the industry standard practice is to have a billion dollars
This
- fixes DMA hangs by taking an upstream update
- makes MP3File objects reusable, eliminating out of memory errors
- adds an "rms_level" property so we can animate some neopixels
so I try not to take too many tips from them ๐
It's more about customer perception than anything else
๐
Though there was a very cheap bluetooth keyboard on kickstarter recently that did...very well.
Did they deliver?
It's the third product by a funded company
They had a unique solution here. They did not make a big deal about it, but the way they want you to use it is to plug in a USB power brick.
(We did a kickstarter for our first product. It took us 3 years to deliver. I... have a lot of empathy)
I mean most of the time I find Kickstarter projects are a) doomed b) a tiny pretend shell company funded by a chinese OEM to field test a prototype or c) the rare well managed startup that really ought to be on crowdsupply instead
I love the folks at crowdsupply. The target demographic is very different than kickstarter.
yeah they're fun. But category b) was really my point - they make projects that are actually extremely expensive seem dangerously accessible. They aren't things you want to emulate
Interestingly, I'm seeing more and more tiny chinese companies try kickstarter, which is super fascinating.
in my experience they are rarely actually tiny
I've talked to a bunch of them behind the scenes.
I spend a bunch of time in SZ. I've visited some of 'em in person.
Really, there are all kinds of things going on
Well, I'm just speaking to my personal experience running a KS. YMMV
@tough flax we are super close to having BLE HID support. https://github.com/adafruit/Adafruit_CircuitPython_HID/pull/43 is the last piece
@slender iron is there other keyboard-related stuff I can be helpful about?
I don't think so, it's been pretty stable. The last challenging thing was getting BLE HID working with iOS but its been sorted out
Thanks @slender iron (and @tulip sleet) - I know you have all been working hard on it - just lots of things in our world that will be much easier w/o the Feather M0 BLE + Arduino code :-
๐
@slender iron @raven canopy should volume control go in audiomixer if it's being added? Per channel float, default 1.0?
@onyx hinge audiomixer has level per voice/channel.
Oh already? Yay!
yeah, that's what i was working on with finishing up DeanM's initial work. ๐
The site is called read the docs but apparently I don't
lol. i'm guilty of it everyday...
I am making great progress on the USBFilter project that lets me convert weird old USB protocols to standard ones (mainly USB). It "just works" and I'm thrilled with how easy it is to tweak the code in Python for our end-users.... However (there's always a However)....
I am running this on two Trinkets with the USB Host (Arduino) running on one and the other running CP talking over UART to it. And I keep running out of memory. I know I could use an M4 Itsy, but a) that's more cost and I want to make these very affordable and b) it's lots more pins for these kids to solder (more chances to screw up).
The biggest memory hog (I think) is the map that converts (x,y) coordinates to keystrokes. It's a 8x12 array of Keycode values. I switched it to be a tuple of tuples which got me to the point where I can have one grid in memory and it works. When I add a second (for the other side of the keyboard overlay), I get
MemoryError: memory allocation failed, allocating 1265 bytes
Can anyone think of a more efficient way to allocate these? Or perhaps a way to reload the whole program when the overlay changes? I REALLY don't want to redo this in Arduino (I know I can)... I like the kids being able to tweak this for their target users, and CP really works for that.
Thoughts?
I probably should have made an issue ๐
@tough flax Trinket M0? I also see https://circuitpython.readthedocs.io/en/4.x/shared-bindings/uheap/__init__.html and https://circuitpython.readthedocs.io/en/4.x/shared-bindings/ustack/__init__.html for estimating object size and stack size in CP.
I'm getting no joy on these in CP 5.x... were they removed?
Theย Adafruit Trinket M0 may be small, but do not be fooled by its size! Itโs a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip wit...
They were not removed...
What do you mean "no joy", @tough flax?
I can't call, import, or reference them from CP at the REPL
Oh, the shared bindings. I thought you meant CP overall, apologies. I think they're no longer u.
I tried with no u...
Fair enough. I'm not sure then.
Nope. Just did some searching. Have no Trinkets, just a Portal and a Gemma.
Wait...
They might not be implemented for Trinket because of the size.
Dan or Scott would know for sure.
I'm all for removing things for more space on the M0s... but it does make them less useful as a suggestion ';-)
Wouldn't think 96 (then 192) copies of an element would be that large, but depends on what they're made of. Is this tuple of tuples containing bytes, int32, etc.?
Is setting a breakpoint on __disable_irq the right way to catch what might be disabling interrupts?
It's containing constants from Keycode in the Adafruit_hid library. They are integers.
qwerty = ((Keycode.ESCAPE,Keycode.TAB,Keycode.GRAVE_ACCENT,Keycode.KEYPAD_NUMLOCK,Keycode.KEYPAD_NUMLOCK,Keycode.INSERT,Keycode.HOME,Keycode.END,Keycode.END,Keycode.PAGE_UP,Keycode.PAGE_DOWN,Keycode.DELETE),
(Keycode.F1,Keycode.F2,Keycode.F3,Keycode.F4,Keycode.F5,Keycode.F6,Keycode.F7,Keycode.F8,Keycode.F9,Keycode.F10,Keycode.F11,Keycode.F12),
(Keycode.ONE,Keycode.TWO,Keycode.THREE,Keycode.FOUR,Keycode.FIVE,Keycode.SIX,Keycode.SEVEN,Keycode.EIGHT,Keycode.NINE,Keycode.ZERO,Keycode.MINUS,Keycode.EQUALS),
(Keycode.Q,Keycode.W,Keycode.E,Keycode.R,Keycode.T,Keycode.Y,Keycode.U,Keycode.I,Keycode.O,Keycode.P,Keycode.BACKSPACE,Keycode.BACKSPACE),
(Keycode.A,Keycode.S,Keycode.D,Keycode.F,Keycode.G,Keycode.H,Keycode.J,Keycode.K,Keycode.L,MOUSE_NW,MOUSE_N,MOUSE_NE),
(Keycode.Z,Keycode.X,Keycode.C,Keycode.V,Keycode.B,Keycode.N,Keycode.M,Keycode.SEMICOLON,Keycode.QUOTE,MOUSE_W,MOUSE_CLICK,MOUSE_E),
(Keycode.CAPS_LOCK,Keycode.LEFT_SHIFT,Keycode.LEFT_SHIFT,Keycode.SPACEBAR,Keycode.SPACEBAR,Keycode.SPACEBAR,Keycode.COMMA,Keycode.PERIOD,Keycode.FORWARD_SLASH,MOUSE_SW,MOUSE_S,MOUSE_SE),
(Keycode.LEFT_CONTROL,Keycode.LEFT_ALT,Keycode.WINDOWS,Keycode.LEFT_ARROW,Keycode.RIGHT_ARROW,Keycode.UP_ARROW,Keycode.DOWN_ARROW,Keycode.ENTER,Keycode.ENTER,MOUSE_DBL_CLICK,MOUSE_RIGHT_CLICK,MOUSE_DRAG))
Is each int 32 bits, then?
They aren't declared that way - it'a all Python numbers in the HID code: https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/master/adafruit_hid/keycode.py
#pylint: disable-msg=invalid-name
A = 0x04
"""``a`` and ``A``"""
B = 0x05
"""``b`` and ``B``"""
C = 0x06
So 1 byte each. If that list/tuple/etc. were implemented as a linked list of some kind, then maybe that's 9 bytes per element (8 bits for the keycode, 32 bits for the forward and backward neighbor)? 864 bytes for each list/tuple, and the M0 has 32 KB RAM.
I don't think it's one byte each. I think by default Python stores everything as a larger number than that. So, probably 32 bits... maybe more. Maybe some arbitrary precision number with way more than 4 bytes. Then overhead for the tuple. I can't think of why they'd store an unmutable tuple as a linked list (you can't modify it).
The reason I asked this was to see if there was a more efficient way of doing these maps (I knew they weren't efficient... I just don't know how to do better in Python).
True. So might just be basically an array, but if the keycodes are stored as a 32-bit or greater, we're still in the roughly 1 KB range for each array.
yes
https://github.com/adafruit/circuitpython/issues/583 indicates ints and floats are both stored at about 32 bits each.
There is garbage collection (https://circuitpython.readthedocs.io/en/latest/docs/library/gc.html), but one would think any automatic GC would be enough.
If you have all "small" integers then a bytearray or array.array can store them in less memory
So, it seems the code to assign each value to an element of an array takes more memory than the declared nested tuples (does that sentence make sense?) So I need some approach that can be declared without adding all of the assignment code. Perhaps struct.pack() into a bytearray?
there's also the space used by the python code, it seems to me.
i.e., the space to actually store the processed form of "C = 0x6"
bytes might be even more compact than bytearray.
Right, originally I had a two dimensional list that I declare each element
qwerty[0][0] = Keycode.ESC
qwerty[0][1] = Keycode.F1
Etc...
That didn't even let me have one set of values. The nested tuples got me running (yay) but I can't change the overlays because I can't declare a second grid.
I am going to try using struct.pack() and see where that goes
BTW, does anyone know if Keycodes can be > 1byte?
no, USB keycodes fit within 1 byte
Ok, thanks
Nope! Even doing this I can't fit two grids in memory:
qwerty = (struct.pack('BBBBBBBBBBBB',Keycode.ESCAPE,Keycode.TAB,Keycode.GRAVE_ACCENT,Keycode.KEYPAD_NUMLOCK,Keycode.KEYPAD_NUMLOCK,Keycode.INSERT,Keycode.HOME,Keycode.END,Keycode.END,Keycode.PAGE_UP,Keycode.PAGE_DOWN,Keycode.DELETE),
struct.pack('BBBBBBBBBBBB',Keycode.F1,Keycode.F2,Keycode.F3,Keycode.F4,Keycode.F5,Keycode.F6,Keycode.F7,Keycode.F8,Keycode.F9,Keycode.F10,Keycode.F11,Keycode.F12),
struct.pack('BBBBBBBBBBBB',Keycode.ONE,Keycode.TWO,Keycode.THREE,Keycode.FOUR,Keycode.FIVE,Keycode.SIX,Keycode.SEVEN,Keycode.EIGHT,Keycode.NINE,Keycode.ZERO,Keycode.MINUS,Keycode.EQUALS),
struct.pack('BBBBBBBBBBBB',Keycode.Q,Keycode.W,Keycode.E,Keycode.R,Keycode.T,Keycode.Y,Keycode.U,Keycode.I,Keycode.O,Keycode.P,Keycode.BACKSPACE,Keycode.BACKSPACE),
struct.pack('BBBBBBBBBBBB',Keycode.A,Keycode.S,Keycode.D,Keycode.F,Keycode.G,Keycode.H,Keycode.J,Keycode.K,Keycode.L,0,0,0),
struct.pack('BBBBBBBBBBBB',Keycode.Z,Keycode.X,Keycode.C,Keycode.V,Keycode.B,Keycode.N,Keycode.M,Keycode.SEMICOLON,Keycode.QUOTE,0,0,0),
struct.pack('BBBBBBBBBBBB',Keycode.CAPS_LOCK,Keycode.LEFT_SHIFT,Keycode.LEFT_SHIFT,Keycode.SPACEBAR,Keycode.SPACEBAR,Keycode.SPACEBAR,Keycode.COMMA,Keycode.PERIOD,Keycode.FORWARD_SLASH,0,0,0),
struct.pack('BBBBBBBBBBBB',Keycode.LEFT_CONTROL,Keycode.LEFT_ALT,Keycode.WINDOWS,Keycode.LEFT_ARROW,Keycode.RIGHT_ARROW,Keycode.UP_ARROW,Keycode.DOWN_ARROW,Keycode.ENTER,Keycode.ENTER,0,0,0))
I think the code to make those calls is actually bigger than the declared tuples.
@tough flax You could store a precompiled version of the table in a file and just read the bytes in the file
Which brings me back to my original thought. Can I modify code.py to import a different file & restart the interpreter somehow? I know this would add writes to the Flash, but they don't change overlays too often
the table can be an array.array so it's packed as densely as possibl.e It could be bytes or halfwords.
In what language, Dan?
Python or C? I am good with Python, but C would be hard for folks to change
could be python, running on a larger computer
you could import the existing HID keycode file so people can use the same names
since all it does is define a bunch of integers
I do import the HID keycode file, but the order of the grid is how I look things up.
I think what you're saying is to make the two arrays (probably nested tuples) and then run mpy-cross on them
I mean in the generating script that runs on the larger computer, you would import the keycode file
The might make it small enough to import?
not nested tuples, because that will contain pointers. It would be most compact to store a one-dimensional bytes and index into it "manually", with
I'm good with one dimension
In this case, yes
So, I write a separate program (in Python) that just reads the two grids and writes them out as bytes in the right order to two files
overlay1.dat and overlay2.dat.
right
Then I read that in from my code.py?
And it becomes what, an object of type bytes?
a bytearray?
Can you index into those in Python?
right, you would allocate a bytestring that is the right length (you could find out the length of the .dat file and allocate it once).
a bytearray would be beter, right
Anyone have a link to what the CircuitPython Runtime Staus LED flashes mean on a Feather M0 Express?
Thank you @tulip sleet !
@unreal vault you'd be happier connecting via serial and seeing the printout though ๐
I know this is just the jaded old C programmer in me, but doesn't this seem nuts, @tulip sleet that you can't declare 100 bytes in code and have it take up roughly 100 bytes in memory?
the problem is the size of the initialization code, because it has to run at runtime. You could also do something like
a = bytes('\x03\x04\x55...') which would mostly be parsed at compile time
in a true compiled language, all the names would get resolved at compile time, but not in this interpreted language
What will mpy-cross do for me? Nothing?
it saves having to compile the .py at run-time when you do an import, but it is not going to do the initialization at compiile time, except for building literal strings, etc.
@tulip sleet thats the thing, nothing showing on serial when running example code. Just flashing. If I try simple example code at REPL it works. Working with sample code provided for CharlieWing
do you have Serial open in Mu? Try typing ctrl-c to interrupt the running program, then at the >>> prompt type ctrl-D
Mwuuuhahaaaa - mpy-cross on the file got me two ๐
right, it will save some memory, maybe that is all you need !
if you get a failure on the import it's becuase the on-board compiler ran out of memory
Nope! I can actually do 3!
this issue is why I have a bytes in https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/master/adafruit_hid/keyboard_layout_us.py#L53
it concatenates all the invidual bytes at compile time to make one string. But it is not going to do the lookups Keycode.WHATEVER at compiled time
(it would be nice, but that's not the language semantics)
AH! But I could copy that to a file, manipulate it into the right order (using your awesome comments) and then mpy-cross them
Probably get all 7 of the standard overlays in!
I didn't realize that example was relevant :), I just gave it as an example of a compile time bytes . Great!
So, for today (which is what matters today), I have my two standard overlays fitting using just mpy-cross
That means Intellikeys users who have the QWERTY and Web Access overlays can flip them over and have both work.
Over time, I can go through the yukky process of mapping all of the standard overlays into your bytes structure and them mpy-cross'ing them into a "overlays.mpy" file
This works
I mean, it sucks, and I wish I had M4s... but this works
Turns out I can get 6 copies of that array in by mpy-cross'ing the file!
That's plenty!
@tannewt Unfortunately, I don't have a debugger.
Is there any CircuitPython Learn Guides for adding new sensors to the CircuitPython eco-system?
E.g. SDS011 Pollution Sensor does not have any CircuitPython support atm but I am working on building a driver but have no guide or standards to stick to.
I've sort of just been making it up as I go - but then realising that it is hard to stick to any existing standards when using this method.
I'm happy to help write up a guide if that is what is needed. I have a pretty strong idea after playing around with all the low-level drivers for other existing sensors for the past year.
All I can say now is that the best method for adding support for a new sensor is to take a relatively new CPY driver repository and copy the core components then follow along adjusting as needed.
It just gets a bit tricky at times. If there was a guide it would be straight forward and all new device drivers would come out the same.
@craggy galleon take a look at https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library
@solar whale this is what I was looking for ๐
But I think it needs to go a bit further into how to structure the driver as well - like if you are using an I2C or SPI device. They are all very specifically set out in the other drivers.
I hope it helps -- and typically, I think people just use an existing driver as a starting point especially for the I2C/SPI implementation.
Any ideas on how to fix the "toJson is undefined" for cookiecutter?
I've tried both Python2 and Python3 just to see if that makes any difference.
I wonder if the guide needs to be updated since the switch to github actions from travis.... hopefully someone involved in that will be online later.
I'll wait patiently ๐ . I tried a few different versions of python just in case that was the issue. No luck.
Hi experts, just a quick, probably unnecessarily broad question, but:
I want to program my CPX from a linux laptop. Is this hard to set up?
Not at all. The CPX will mount as CIRCUITPY. Just copy files to it.
You can install mu on Linux as well
pip3 install mu-editor
See The section python instructions
Note that your user has to be a member of the dialout group
Haha, I don't even know what that means :D
Guess I have some reading up to do.
morning all
I wonder if anybody has ideas about how to work on https://github.com/adafruit/circuitpython/issues/2417 in which SD card activity in the background can lock up circuitpython until you use the reset button
switching to a non-Python implementation of SD card I/O might work, because it would likey be written so that background tasks can't occur while a foreground SD card read is ongoing.
Providing a "critical section" (e.g., as a decorator) that could block background task processing while it existed is another option, but it would be easy to misuse, again resulting in apparent lockups of the device
right now I have careful coding in JEplayer so that background I/O (mp3 playing, OnDIskBitmap reading) can never overlap with foreground SD I/O, but that feels easy to break
@onyx hinge i have to go out in a minute, but my basic thoughts are: SD access needs to be serialized. A simple lock for SD actiivity in pariticular might work, or a work queue might be better. At one time we thought about redoing the SD card library in C, because it was so buggy, but it's now in better shape, and it's not clear how it would fit in the M0 ports.
OK, "serialized" seems a lot like my "critical section decorator" idea, so maybe we're on the same wavelength. ttyl. I'll potentially bring this as an In The Weeds item Monday
if disk_read/disk_write blocked background tasks when calling into Python it might suffice, and not put any burden on Python code authors or provide a dangerous "block background tasks" decorator
hm running into safe mode resets with audiomixer, but I don't have my segger at the coffee shops. changing gears from trying to add volume to JEplayer via audiomixer to .. not sure what
@solar whale Thanks, I'm working on setting the laptop up now, just installed new harddisk, next up: Finding power supply and a big enough USB pen to install the linux system.
Do you have any suggestions? It's jungle for me, the only reason I want to go with linux is that I don't need to worry about purchasing and installing windows on this ancient X200.
@timber mango suggestions for linux? I think that mint and ubuntu are regarded as the two most beginner friendly incarnations these days. https://linuxmint.com/ https://ubuntu.com/
Ubuntu
Ubuntu is an open source software operating system that runs from the desktop, to the cloud, to all your internet connected things.
Thank you, @onyx hinge, I'll give them a go. I remember having used Ubuntu long ago, so I'll start with that. Cheers.
I saw a __disable_irq() during neopixel_write. Here's the traceback.
#0 common_hal_neopixel_write (digitalinout=digitalinout@entry=0x20008790, pixels=0x20009eb0 "\023", numBytes=960)
at common-hal/neopixel_write/__init__.c:229
#1 0x0005e79c in neopixel_write_neopixel_write_ (digitalinout_obj=0x20008790, buf=<optimized out>)
at ../../shared-bindings/neopixel_write/__init__.c:74
#2 0x000364c6 in fun_builtin_2_call (self_in=0x82e84 <neopixel_write_neopixel_write_obj>, n...
@tannewt I haven't gotten to making a new issue yet as I wasn't sure exactly what I would be making it for. Check out my posts earlier in the thread for some more CCRAM info - it's restricted enough that right now I can't think of a much better use for it than what Micropython uses it for, which is simply a large buffer for internal filesystem tasks (which is something I do want to implement this month). I'll link the appnote I attached earlier again:
https://www.st.com/content/ccc/resource/...
I'll fix the failing build soon, I don't think it'll change the substance of the PR.
Wow great substantive comment on my 2020 blog post! https://blog.adafruit.com/2020/01/02/jeffs-ideas-for-python-on-hardware-in-2020-time-timekeeping/#comment-355353
Hi All - I have a vague recollection of seeing usage guidelines for the CircuitPython/Blinka logos before. Do they exist? Can someone point me in the right direction?
@timber mango @onyx hinge I use Ubuntu (long term support 18.04.x, 20.04 arriving in April), but use it with the cinnamon desktop, which I find more compact than the Unity interface. After I install Ubuntu, I do apt install cinnamon-desktop-environment
@timber mango If you're looking for recommendations, I've been enjoying Debian 10 with the Mate desktop lately, from the same family as Ubuntu and Linux Mint which I've also used. (They're both Debian derivatives actually.) It seems solid and non-quirky, and also most similar to Raspian if that matters. For installation, the smallest USB stick you can buy should be enough. 4GB would work but I haven't seen those for sale for a while.
hi hi @old smelt
our art collection is here: https://www.dropbox.com/sh/l6tp9ym5nf8h5v9/AABGu_q2pcdUQdx1avr8Xvvda?dl=0 and the usage is here: https://www.dropbox.com/s/zvl0o4pr3lucfz3/license-readme.txt?dl=0 (in the collection as well, text file).
feel free to email me as well if needed, pt@adafruit.com with any questions on usage, etc.
Thanks Phil!
@onyx hinge if I'm understanding that comment correctly, and remembering how FrequencyIn ended up; that's essentially what happens. It sets up a reference timer as a counter, attaches pin interrupts to the reference to capture triggers, and tracks any overflows. The only issue to deal with when freewheeling the ISRs is smashing the other interrupts; mainy USB.
Working on updating a guide. There is a microphone on both the Circuit Playground Express and Bluefruit, however, the special sound features of the Circuit Playground Library are not supported on Express due to memory limitations. In the guide page, if you were going through it, would you want to know why it doesn't work on the Express? Or would you rather there simply be a warning saying it doesn't work on the Express, and not have an explanation and only discuss Bluefruit in the page content?
Based on that traceback, the nRF neopixel_write implementation is falling back to a busy-waiting NeoPixel write implementation:, which will mess up the BLE timing. That will happen if it can't get a PWM peripheral. So find_free_pwm() is returning NULL for some reason. Maybe the PWM peripheral is not reset properly and appears to still be in use even after it's freed after the neopixel write.
I think the correct thing to do instead is if we can't get a PWM peripheral, then check to se...
@onyx hinge I think you could start work on removing systick if you have cycles
that is preventing us from starting to sleep
inhibit_background_tasks isn't initialized to 0 anywhere except implicitly on hard startup. (Is all the data RAM initialized to 0?) I'm worried about it being non-zero after certain errors that might not hit the reinitialization of data RAM.
I wonder if this is going to cause significant possibly fatal hiccups in background tasks. It certainly might cause hiccups in display refresh, and we also expect to service USB at least every 1 msec.
@tulip sleet you around? want to sync on ble in 5?
yes, you mean video?
yup
sure, started a call
@timber mango You'l find most of the guides assume you are using Ubuntu so it's a good choice. I've had no problems with it.
im getting a "NotImplementedError: Board not supported GENERIC_LINUX_PC" error with the examples/veml7700_simpletest.py
@lusty crane -- is this with an MCP2221 on a linux system?
no, it's a I2C-Tiny-USB on linux
@solar whale sounds pretty perfect to me ๐
Thanks all others for your input too.
@lusty crane OK -- I know nothing about that ... sorry -- the only way I know to use the CP libraries on linux is with an FT232H or MCP2221 but I ran into that same error with the MCP2221
@tulip sleet Do you have any idea what is shipped on an ItsyBitsy nrf52840 -- can't make much sense of it
/dev/ttyACM0 is streaming BLE data , but no CIRCUITPY and nothin shows up on my iPhone to connect to.
I put CP on it ian it seems happy, just curious what it was running
@solar whale Arduino example.
@idle owl thanks -- pretty blinking lights
@idle owl @raven canopy did you see the questions from @craggy galleon at about 0604 EST above -- about using cookiecutter to set up a library -- are there some new steps not in the guide for using it now that travis is not used?
@solar whale I did. I'll take a peek a little later if noone jumps on it.
Hi, my proposal to present Circuit Python in the IoT track of Fosdem'20 has been accepted: https://fosdem.org/2020/schedule/event/iotcircuitpython/ and I will have 20 minutes (almost a lightening talk) to present how to do IoT with Circuit Python. The goal is to present a Bluefruit demo and an Airlift demo. I would have a few questions and a request to Adafruit... can I discuss this here? Or do I send an email somewhere?
@craggy galleon @solar whale i peeked real quick. cookiecutter uses Jinja2 as its templating parser, which uses {{ }} as an expression delimiter. this is causing the issue with the Actions workflows, which also have ${{ }} as an expression delimiter. there's one way around it that i know of right now. i'll do deeper dive on it and come up with something though.
Thanks @slender iron : (1) I am looking for a list of date related to the history of Circuit Python (and Micro Python) and I believe that Mister Ladyada has been collecting those. Could I have access to that? Is it published somewhere?
Like date of release (that I can find in the release page), some key dates, ...
That would be put in the slide deck, not that I hope to have much time to talk about this in the presentation.
(2) I have been working on a jargon list https://gist.github.com/dglaude/bc8043cdccef9e643eeaeb99f2e9fb97 that I would like to cross-check and enhance. It is basically the Adafruit "marketting" language or words used to talk about some technology: NeoPixel, Airlift, Bluefruit, Blinka, ...
i think this is where the problem is: https://github.com/adafruit/Adafruit_Blinka/blob/master/src/board.py
it doesn't have the GENERIC_LINUX_PC
That also would be to put in the slide deck, and some will be used in the presentation. The idea is to bootstrap user into Adafrult words, or better understand documentation.
could i modify the blinka to include the PC?
(3) I am looking for news and ETA about the LED baseball hat support. I have ordered one, that should arrive on time for my presentation and could use as a wow demo of BLE communication from CircuitPython and a device. I have no clue who was working on this.
(4) I was wondering if I could get Circuit Python giveway to distribute at Fosdem to the participant of the IoT track. Something like "stickers" with Blinka on it.
@half sedge https://github.com/adafruit/OTD
- email me and I'll pass it on: scott@adafruit.com
- I believe the person released a library for it. nothing is needed in the core
adafruit/OTD ? I was talking about key date in Circuit Python history. ๐
I would hope that would have circuitpython dates
release dates are easy to pull from github
and most other stuff ends up on the blog
Ok, I'll dig the date I believe are important. I started a cross reference of CP release and relate that to new hardware. Like 4.0 => displayio => PyPortal
@raven canopy Thanks for digging into it
@slender iron I may start SysTick work when I need small breaks from JEplayer but really getting heads down on it will come later on.
@slender iron I sended the email.
We sure can't guarantee that the I/O operation will take any bounded length of time, so I agree there's a chance of missing some ticks. But isn't that already the case, when the display background text needs to read from SD?
The main difference I can think of is, the total quantity of I/O in one background task is probably bounded, but a user could probably read larger amounts of data (say, 32kB if they work at it?) in the foreground, and that blocks background by much longer than reading...
how long does it take to read 32kB from SD?
about 0.7s, ouch
reading 1 block takes 7ms already ๐ฆ
On my pygamer with this sd card https://adafru.it/1294, reading 1 512-byte block takes about 7ms and scales linearly from there. It's no trouble at all to make a sd read take the majority of a second.
@onyx hinge can you see the baudrate?
I am not aware of setting a baudrate so it's at a default value
hrm, I wonder. you could use a logic analyzer to see why it takes so long
so you're surprised at 7ms / 512 bytes? I mean, I am a bit too
is the SPI bus the same one that's on regular I/O pins, making it easily scopable?
just CS i guess would be private
it's been a while since I've done it
it may not be broken out, next time you do an order you should pick up a breakout for sd
problem is that long wires can cause a lower speed
I am having trouble even spotting the SD socket on this schematic https://cdn-learn.adafruit.com/assets/assets/000/076/005/original/adafruit_products_PyGamer_Sch_p1.png?1558716704
I guess I can trust my working source code though ``` spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
cs = digitalio.DigitalInOut(board.SD_CS)
oh silly me
looks like it is broken out on the featherwing
baudrate=1320000 (default)
that is a weird number
so I'm getting roughly half that as an effective speed (512Byte/7ms ~= 585000bit/s)
I'll take a look at the pwm reset logic. It sounds similar to the issue I found with UART reset.
Is SD-less CP something we actually want to support? I assume BLE will be on most of the time.
oh even the sd-cs is broken out, that's convenient
We'll set it to 0 as long as it ends up in .bss. (the linker map can confirm this.)
okay here's how SCK looks, from a high level
f.seek(0); f.read(512). it takes some time to get going and then it does a big block
right, the big block could probably be faster but not the polling
during the tail it is 1.32MHz as expected
This looks good to me! Thank you for your incredible persistence. @dhalbert you will need to approve as well or at least dismiss your review.
when reading more blocks it's less of the slow "head" part and more of the fast "tail" part, note changed timescale
I was playing around in CircuitPython to work out the possible and best ways to detect if os.urandom is present. It turns out it's always present so I then started looking at the exceptions that it throws on platforms with no hardware, e.g. SAMD21 (M0) like the CPX. I noticed during that experimentation that even on a CPB where there is hardware support this fails for values above 64. Either that's a bug or it's a confusing use of the NotImplementedError exception?
Adafruit Circui...
that sort of happens at the fatfs layer
it looks if >512 (>1023?) bytes are being written AND they are sequential in block address, and issues a read for them all.
I have no need for lengths above 64 btw!
but maybe the python layer could track this across multiple requests too, and get some savings from sequentiality
@Marius-450 please make a PR to bump it to 2. I don't think we want more than that due to the RAM it takes but 2 makes sense for the m4sk.
@pbricmont Bummer. How many would you like to support in the end? What are you using them for?
64MHz doesn't work (errors). 32MHz doesn't work (doesn't error, but gets wrong data). Maybe the 13.2MHz was an empirical maximum.
os.listdir("/sd")
['000.BLP']
should have been 000.bmp
ยฏ_(ใ)_/ยฏ
close enough!
that number probably came from testing
16MHz happens to work on this one card
but clearly not a lot of headroom in SPI baudrate
what does any of this mean for #2446, if the concern is the amount of time foreground I/O can block a background task?
this is NOT blocking JEplayer, fwiw, it is a tangent because I coded around it..
Why allow changing the filename? Can't you avoid OOM by passing in a shared bytearray buffer into the constructor?
Yes, I could, but it would ultimately be more finicky. There are a BUNCH of separate memory allocations, and writing a mini-allocator to make them come out of a passed in block didn't seem like a good use of time.
- disk I/O buffer
- sample buffers
- main mp3 decoder object
- 7 internal pointers in mp3 decoder object
There should be plenty of data that we use in RAM that is only accessed by the CPU. The stack is almost that but we may need to move some DMA memory.
Buffering the internal flash filesystem isn't something I'd do in that space because DMA could be used to flush the cache out of RAM. With external flash it will be used for that.
Please open a placeholder issue and we can discuss related work there. Thanks!
We sure can't guarantee that the I/O operation will take any bounded length of time, so I agree there's a chance of missing some ticks. But isn't that already the case, when the display background text needs to read from SD?
Yes, but that is interruptible, I think, so that USB background tasks are not blocked during that time. Display refresh prevents itself from being called recursively. Blocking all background tasks is problematic. Blocking background tasks that do SD operations is w...
@drowsy geyser I got your friend request, but I needed to turn off PMs because I was starting to get too many. Did you have a question?
You don't need to allocate everything out of that block, you just need to allocate the things that are hard to reallocate.
I'm wary of this change because it breaks the mental model of one MP3File per file. It'd be more of a MP3Decoder at that point. That may be ok but I feel like there may be a way to make the allocations more reliable instead.
@gilded cradle I was just going to say I haven't forgotten the CPB+Gizmo issue. Try/Except can work around the problem, but I want to find out what's causing it, and why it happens for me but not you. I'm still working on it. ๐
And totally understand the "too many PMs" problem.
Sounds good. Just update the issue whenever you get a chance.
There are at least 5 allocations each bigger than 1kB, the biggest is over 8kB. What threshold would you consider for being "hard to allocate"?
Will do!
Is SD-less CP something we actually want to support? I assume BLE will be on most of the time.
If we can do a deep sleep with SD on, then it's OK to assume it's on. I think before you added the CircuitPython service, the SD was enabled only if _bleio was imported.
And it can still be disabled (Adapter.disable), so yes, I think we should still check whether the SD is enabled or not.
fwiw in arudino, where of course it is a compile-time decision whether to use MP3 or not, they found it was reasonable to just statically allocate 1 playback object rather than do the allocations dynamically.
:+1: Thank you for all this work!!
Ooh, I can run master now!
๐
got oshhw certification for pewpew m4! apparently it's the sixth device in ch
nice job @ruby atlas
Holy smokes. I just did a git pull and the number of diffs is huge....
@slender iron when you need non-py-object heap storage, you always use gc_alloc(), is that right? and do you ever bother to gc_free()?
I think m_malloc is a slightly higher level macro
I'm not sure I free but I definitely make sure the collect process will find the pointer
right, I have to make the beginning of my linked list a root pointer
i think I am going to be adding a bleio background task to do the deferred internal flash writes
kk
@slender iron ok sorry, a little more thinking on this. I was going to alloc in a BLE event handler, but if that triggers a gc, i wonder if we'll be in trouble. we have other cases where we add to a list or something in a BLE event handler (like during BLE discovery), and I was always worried about those. You probably encountered those in your refactoring. So I'm wondering if I should worry or not.