#circuitpython-dev
1 messages ยท Page 214 of 1
shows the changing clock polarity
teh first LSM CS is "normal" for the default SPI setting - but not for the LSM -- the second is flagged as bad by the salea , but it actually works for the LSM
That's some good sleuthing.
here I switched the SALEA to match the LSM , but I note that the CS is going low before the clock polarity switches for the first LSM transaction.
@main meteor this has been a puzzling adventure -- I think it is starting to make some sense.
@idle owl @raven canopy and all involved. It really is nice having the examples now part of the "Bundle" One stop shopping! It makes it so much easier to go grab the example. Thank you for implementing that!
@solar whale i wonder if it's something with spidev? it doesn't actually change SCK until output is run?
sounds suspicious ...
everything higher level seems in order
SPIDevice notionally configures the port before the CS is set:
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice/blob/master/adafruit_bus_device/spi_device.py#L82
on the Feather, maybe that takes effect right away - so SCK is changed before the next line that sets CS
but on the Pi, spidev isn't doing that....maybe?
it just buffers the config changes until a write
so SCK doesn't actually change here:
https://github.com/adafruit/Adafruit_Blinka/blob/master/src/adafruit_blinka/microcontroller/generic_linux/spi.py#L45
@tidal kiln interesting -- that would explain why it works on the M4 and not on RPi. Not sure if the root cause it the handling of SCK or CS but they are not independent!
I have to go AFK for awhile back later -- Thanks for digging into this. I learned a lot today ๐
didn't happen to scope the feather test?
no - I will try it later or tomorrow. It' will be good to compare.
awesome. ok. thanks for all the help also. later.
Fixed a SCSI bug like that. The controller would put the data out, assert strobe, take the data away, and wait for ack.
Worked with some targets but not with others. Switching the last two steps fixed it.
@slender iron I have to remove the shared.py with shared.I2C_BUS from the Adafruit_CircuitPython_FeatherWing library to get Sphinx to build to put it on PyPI. Otherwise it fails hard. For some reason it's unable to figure out board.SCL and board.SDA. I'm letting you know because I know that was something you wrote into it. I initialised it separately in each file instead and Sphinx builds without errors (which means something changed because last time api.rst wouldn't populate, so this is good).
Pin/board-definitions and documentation to support the SparkFun Pro nRF52840 Mini .
Tested with make BOARD=sparkfun_nrf52840_mini in the ports/nrf directory.
We're working on building up some documentation here.
@idle owl did you try adding a board automock?
no, but I thought we were trying to avoid any automocks. I'll try it.
that seemed to get it past that part. But now it' failing on No module named 'machine' .. there isn't anything referencing machine...
blinka may
autodoc: failed to import module 'adafruit_featherwing.motor_featherwing'; the following exception was raised:
No module named 'machine'```
we should switch from a shared I2C to using board.I2C
blinka uses machine if it thinks its on micropython
No need to add the internal nRF names here. They are available through microcontroller.pin automatically. This table should just include names to match a board's silkscreen and other common designations (like SDA and SCL). Limiting whats in here makes dir(BOARD) easier to understand.
I mean does board.I2C work on Pi etc. Because the plan is for this code to work on Pi as well.
Do you want I2C and SPI default buses here too?
I don't know if it does yet. it'd be good to add though
oi, I automocked machine and now it's failing hard. autodoc: failed to import module 'adafruit_featherwing.motor_featherwing'; the following exception was raised: Traceback (most recent call last): File "/Users/kattni/repos/venvpypi/lib/python3.6/site-packages/sphinx/ext/autodoc/importer.py", line 152, in import_module __import__(modname) File "/Users/kattni/repos/Adafruit_CircuitPython_FeatherWing/adafruit_featherwing/motor_featherwing.py", line 36, in <module> from adafruit_featherwing import shared File "/Users/kattni/repos/Adafruit_CircuitPython_FeatherWing/adafruit_featherwing/shared.py", line 35, in <module> I2C_BUS = busio.I2C(board.SCL, board.SDA) File "/Users/kattni/repos/venvpypi/lib/python3.6/site-packages/busio.py", line 15, in __init__ self.init(scl, sda, frequency) File "/Users/kattni/repos/venvpypi/lib/python3.6/site-packages/busio.py", line 23, in init from microcontroller.pin import i2cPorts File "/Users/kattni/repos/venvpypi/lib/python3.6/site-packages/microcontroller/__init__.py", line 36, in <module> raise NotImplementedError("Platform not supported:", platform) NotImplementedError: ('Platform not supported:', 'darwin')
not sure why none of this failed when there was no shared.py
with shared.py ReadTheDocs is actually trying to create an I2C bus. try automocking busio
Well done, you. But I thought we were avoiding automocks?
in general yes
@tidal kiln here is how it looks on the feathe_m4 - CS goes low after SCK change
but the shared.py is causing ReadTheDocs to do more than it usually does
(It usually just imports a module)
ok
@solar whale as somewhat expected - SCK is high already when CS is set, right?
yes
starting to add up...maybe
i'm sort of heading down a rabbit hole....
https://github.com/doceme/py-spidev/blob/master/spidev_module.c#L864
https://www.kernel.org/doc/Documentation/spi/spidev
seems like if we could find some way to kick it so the settings happen before CS, then we'd be good
@solar whale thanks for adding those to the issue thread
Sweet. More than happy to delete some stuff in here!
@solar whale i think i'm done for now. will see what ladyada comes up with. one other thing to mention, not the case here, but some sensors support both polarities of SCK, and they auto detect which one by the state of SCK when CS is asserted. so for those style sensors, this would be an even bigger issue.
yeah and some like the stmpe610 just seem t o pick one !
but it's well documented in the datasheet, right? ๐
https://forums.adafruit.com/viewtopic.php?f=60&t=144303 if someone wants to help with binary counting
Ok, I had actually fixed the -sXXX suffix issue. At the same time Nordic changed how to download the soft device files. So, I made the script handle failures better and fixed up the SD downloading. We can actually redistribute the newer ones so I just added them directly to the repo.
Thanks @tannewt!
Revised pins.c to only define pins that are available to the user. And reorganized the file a bit.
(Oof...great timing with Nordic's re-organizing. I haven't been able to test from scratch with their updates yet.)
@slender iron I'm back to testing adabot-on-travis and the bundle update. for now, i'm setting git config user.name/user.email in the yaml. would you rather these be env vars, and set them in python?
Travis log:
$ pip install -r requirements.txt
$ git config --global user.name "sommersoft"
$ git config --global user.email "sommersoft@gmail.com"
$ mkdir -p bin/adabot
The command "mkdir -p bin/adabot" exited with 0.
Updating Bundle...
$ python -m adabot.circuitpython_bundle
sommersoft
sommersoft@gmail.com
# in python:
# if "TRAVIS" in os.environ:
# git_url = "https://" +
# os.environ["ADABOT_GITHUB_"] +
# "@github.com/adafruit/"
# print(git.remote("-v"))
adafruit https://[secure]@github.com/adafruit/Adafruit_CircuitPython_Bundle.git (fetch)
adafruit https://[secure]@github.com/adafruit/Adafruit_CircuitPython_Bundle.git (push)
About to run a full one...trying to mitigate any actual updates (push --dry-run, no release)
๐ ๐ (i think...)
@raven canopy yay! (I think...)
@slender iron what happened to tools/build_adafruit_bins.sh -- now I see a .py -- how iis it used?
@solar whale i suspect its the same as before, just with python. i briefly peeked at the PR earlier, but would check the new .travis.yml for any clues.
That was too easy ๐
hehe. just an alias away, i'm sure. if aliases are a thing one is inclined to used. oxymoronically, my laziness forces me to type everything out or just endlessly scroll my bash history. ๐
but doesn't work
Traceback (most recent call last):
File "build_adafruit_bins.py", line 2, in <module>
from sh import rm
ModuleNotFoundError: No module named 'sh'
pip install sh
Traceback (most recent call last):
File "build_adafruit_bins.py", line 2, in <module>
from sh import rm
ModuleNotFoundError: No module named 'sh'
@raven canopy I have magical bash history that I can start typing something and up arrow and it goes to the last thing that starts with what I started typing....
sigh -- it was so easy before today ...
yw! (i didn't do much, you did all the keystrokes!) ๐
the keybaord may not recover ๐
and...i'm out. Fantastic Beasts await! ๐
have a great evening ya'll!
@raven canopy Have a good one!
hmm -- I still get lots of build failures for many boards -- it seems to keep running and is OK for most of the boards I want but something is not right.. @slender iron or @tulip sleet when yo uhave a chance can you explain how to run tools/build_adafruit_bins.py now -- there must be some new steps
may be OK now -- the boards taht don't build appear to be special cases -- I just had not seen then in the past.
and the nrf pca10056 and pca10059 do not geneate .uf2 files
ah - but if I do make BOARD=pca10059 -- i do get a .uf2
@raven canopy good work! It may be easier to use the github api instead of git locally
@solar whale are you running it from the tools directory?
yes
hrm
also it tries to build seveal boards taht fails
ah ok. I don't think those are built on travis
I must have messed up the flash definition
just not used to seeig the erros -- it keeps going and build the rest
has tehre been a chang ein the bluetooth driver downloads -- looks like only 2.0.1 iss downloaded - ther others are in the repo now, correct?
it now builds based on listing the board directories versus and hand coded list
correct
OK -- I think I'm back on track -- still puzled aboyt nrf .uf2 -- I get tehm if I do a manual make BOARD=pca10059
is it stating an error for them?
not taht I noticed -- will scrool back and look
What bootloader do the nrf boards need for CP? It's there a uf2 Port?
ya, there is a uf2 bootloader
can-t go back that far -- too many errors from failed builds ๐ฆ
I'm building locally now
ok -- pca10059 is fairly early
TRAVIS_BOARDS="feather_nrf52832" python3 build_adafruit_bins.py
you can do that to only build one board
ok -- will try it for pca10059
-rw-r--r-- 1 jerryneedell jerryneedell 243064 Nov 30 20:14 ../bin/pca10059/adafruit-circuitpython-pca10059-pt_BR-20181130-57b61a9.bin
-rw-r--r-- 1 jerryneedell jerryneedell 243672 Nov 30 20:14 ../bin/pca10059/adafruit-circuitpython-pca10059-it_IT-20181130-57b61a9.bin
-rw-r--r-- 1 jerryneedell jerryneedell 244120 Nov 30 20:14 ../bin/pca10059/adafruit-circuitpython-pca10059-fr-20181130-57b61a9.bin
-rw-r--r-- 1 jerryneedell jerryneedell 243544 Nov 30 20:14 ../bin/pca10059/adafruit-circuitpython-pca10059-fil-20181130-57b61a9.bin
-rw-r--r-- 1 jerryneedell jerryneedell 243048 Nov 30 20:14 ../bin/pca10059/adafruit-circuitpython-pca10059-es-20181130-57b61a9.bin
-rw-r--r-- 1 jerryneedell jerryneedell 242888 Nov 30 20:14 ../bin/pca10059/adafruit-circuitpython-pca10059-de_DE-20181130-57b61a9.bin
but it said it made them -- just did not copy them
Build pca10059 for en_US took 0.77s and succeeded
make: Entering directory '/home/jerryneedell/projects/adafruit_github/circuitpython_master/ports/nrf'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
Create firmware.uf2
../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-pca10059/firmware.uf2" build-pca10059/firmware.hex
Converting to uf2, output size: 477696, start address: 0x26000
Wrote 477696 bytes to build-pca10059/firmware.uf2.
make: Leaving directory '/home/jerryneedell/projects/adafruit_github/circuitpython_master/ports/nrf'
Build pca10059 for pt_BR took 1.48s and succeeded
make: Entering directory '/home/jerryneedell/projects/adafruit_github/circuitpython_master/ports/nrf'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
LINK build-pca10059/firmware.elf
text data bss dec hex filename
237848 1368 15364 254580 3e274 build-pca10059/firmware.elf
arm-none-eabi-objcopy -O binary build-pca10059/firmware.elf build-pca10059/firmware.bin
arm-none-eabi-objcopy -O ihex build-pca10059/firmware.elf build-pca10059/firmware.hex
Create firmware.uf2
../../tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "build-pca10059/firmware.uf2" build-pca10059/firmware.hex
Converting to uf2, output size: 478720, start address: 0x26000
Wrote 478720 bytes to build-pca10059/firmware.uf2.
make: Leaving directory '/home/jerryneedell/projects/adafruit_github/circuitpython_master/ports/nrf'
@solar whale looks like it worked
not for me -- it made .uf2 but did not cpy to /bin
ah
its because you are special and have the uf2 bootloader on it
there is a mapping in build_board_info.py at the top
that tells it what extensions to copy over
in tools as well
ah -- thanks
ok -- now taht I know how to do it , I'm good. I thought most users used .uf2 f fo pca10059 and pca10056 -- will it be the default for the feather_nrf52840
looks like I missed it in that list ๐
and for feather_nrf52832 -- I always do a local make BOARD=... dfu-gen-dfu-flash so I don't pay attention to what is in /bin
some day it will all be52840s and no one will care ๐
๐
It looks like Sparkfun has become a CircuitPython fan ๐ nice to see
yes -- just ordered one -- so many boards -- so litlle time --
the particle.io pards are fun -- so far I've just played with their tools -- can't get my xenon to join the mesh network, but it appears to be a known issue on Xfinity routers(1) waitiing for fix.
ah interesting
trying to add a xenon to go with my argon now
kinda surprised they don't to anything over usb
though it did enumerate in CDC mode briefly
these arrived now..
getting libgpiod running on these' sysfs is dead! long live libgpiod! https://blog.adafruit.com/2018/11/26/sysfs-is-dead-long-live-libgpiod-libgpiod-for-linux-circuitpython/
libre.computer boards, we'll see how this goes
@river quest my desk right now
yah, it's a linux party here
ain't no party like a linux party
@torn grail Have you double checked your wiring? What does busio.I2C.scan() show?
yeah, I did. I had the 3v3 and GND swapped.
@slender iron fennec spotted!
Working MUCH better now. LOL
๐
Sometimes you check, double check, and triple check your wiring, and it is STILL wrong. I think its time for beer,
my watch says beer thirty, better hurry up
Instructions for flashing CircuitPython to particle mesh devices (e.g. Argon): https://people.eecs.berkeley.edu/~boser/courses/49_sp_2019/P0_particle.html.
@neon dragon awesome. I'm adding board defines for all three now
They are identical, not? Until we flash micropython to the ESP32 on the Argon.
Beware: I think the green flash chip on that diagram is incorrect. My board description has the correct one (I hope). Not sure if there are other errors in that schematic, better work from the Eagle docs.
its not the MX25L1606?
have you thought about trying to leave the bootloader in tact?
ah, I see you have MX25L3233F in your repo
gonna go grab dinner. will be on later
I need to look closer at your repo. the added classes are interesting!
I'm not 100% sure about the flash chip. A while back they made an announcement that they switched from 2MB to 4MB flash chips. For the ESP32 they show the 4MB part, but the 2MB for the nRF. Moreover their memory map adds up to 4MB. So I expect 4MB is correct. It works but I have not tried to copy 4MB. No, I have not tried to keep the particle bootloader (supposedly its dfu, but flashing just "bricked" the device). Your bootloader is very slick, I don't need another.
Ok, so I think at this point I'm beating my head against a wall and I need some help.
@neon dragon glad you like our bootloader!
I'm not sure if this is the place to post this, but here goes.
I'm trying to hijack some of the fonts from the Adafruit-GFX-Library, like this one: https://github.com/adafruit/Adafruit-GFX-Library/blob/master/Fonts/FreeMono12pt7b.h
I'm just not understanding the encoding at all. For the 5x7 font it was easy, each line was a separate character, but with these other fonts I can't figure out how to interpret a character.
For the 5x7 font, it's pretty clear it's the following where each column is a 0xAA hexadecimal number from the table, and then each line of hex numbers is a character.
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e
a b c d e
please ask in #help-with-projects. this isn't circuitpython related
@main meteor did you start swd on circuitpython yet?
@slender iron I was thinking of possibly doing something like that as well, furthest I've gotten is forking daplink
with no changes
do you think it could be done through circuitpython rather than C?
ya, I don't think its time sensitive. it'll just be slow
that's interesting
this is the meat and potatoes https://github.com/sajattack/DAPLink/blob/31cfc86ff3b5a6b27a37d2e9f6cca106fe629f4f/source/daplink/cmsis-dap/SW_DP.c#L100
I guess digitalio that plus whatever openocd needs?
idk how openocd targets work really
Anybody want to help me port this code from the Adafruit-GFX-Library to CircuitPy? If I can get this part, then I can basically port all the fonts with a little more work. From: https://github.com/adafruit/Adafruit-GFX-Library/blob/master/Adafruit_GFX.cpp
// Character is assumed previously filtered by write() to eliminate
// newlines, returns, non-printable characters, etc. Calling
// drawChar() directly with 'bad' characters of font may cause mayhem!
c -= (uint8_t)pgm_read_byte(&gfxFont->first);
GFXglyph *glyph = &(((GFXglyph *)pgm_read_pointer(&gfxFont->glyph))[c]);
uint8_t *bitmap = (uint8_t *)pgm_read_pointer(&gfxFont->bitmap);
uint16_t bo = pgm_read_word(&glyph->bitmapOffset);
uint8_t w = pgm_read_byte(&glyph->width),
h = pgm_read_byte(&glyph->height);
int8_t xo = pgm_read_byte(&glyph->xOffset),
yo = pgm_read_byte(&glyph->yOffset);
uint8_t xx, yy, bits = 0, bit = 0;
int16_t xo16 = 0, yo16 = 0;
if(size > 1) {
xo16 = xo;
yo16 = yo;
}
// Todo: Add character clipping here....
startWrite();
for(yy=0; yy<h; yy++) {
for(xx=0; xx<w; xx++) {
if(!(bit++ & 7)) {
bits = pgm_read_byte(&bitmap[bo++]);
}
if(bits & 0x80) {
if(size == 1) {
writePixel(x+xo+xx, y+yo+yy, color);
} else {
writeFillRect(x+(xo16+xx)*size, y+(yo16+yy)*size,
size, size, color);
}
}
bits <<= 1;
}
}
endWrite();
surround your code with
```
code here
```
so it looks cleaner
how do you do a 3 cycle delay in circuitpython?
@slender iron use the api for which part?
@raven canopy use it for editing the file and committing
hmm...that is a big refactor, no?
to clarify (which i may have not done well enough to start), i'm battling this fail from the cron jobs:
delay_cycles isn't exposed and I imagine even if it was it would have additional overhead
@exotic pumice you could probably use time.monotonic() and microcontroller.cpu.frequency to math your way there. monotonic is based on SysTick.
won't be super precise...but close enough i imagine.
@raven canopy ya, big refactor. I wasn't thinking about the submodule stuff it does
hehe. zactly. i was just about to pull up the api docs to see if that is even possible. ๐
Does the SR04 need 5v to work right with circuit python?
I get errors raised with test code every time. I've tried on a couple of feather boards.
@velvet badger looking at the guide, it shows it working with >1K ohm on the Echo pin. guide also notes that it is more accurate with 5V.
@raven canopy, I'm printing time.monotonic, and it looks like millisecond precision
yep. i think a monotonic_us was recently added, actually.
perhaps I need to pull
>>> dir(time)
['__name__', 'monotonic', 'sleep', 'struct_time', 'localtime', 'mktime', 'time']
>>> dir(time.monotonic)
[]
>>> dir(time.time)
[]
>>>
this is 3.1.1
Thanks @raven canopy
@velvet badger yw!
@exotic pumice ahh. it was actually monotonic_ns, and yeah i think its only in master (4.x)
@exotic pumice SysTick is configed (SAMD at least) to roll over each millisecond. my understanding is that one full rotation of SysTick is a "cycle". i may be wrong though; happens plenty. :D
https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/tick.c
so, "delay 3 cycles" would be time.sleep(0.003) or microcontroller.delay_us(3000). yes?
no, a cycle would be 1/5MHz or 200ns
would a hardware timer be a better idea and do I have access to those through circuitpython?
timers aren't available. i think there is an issue to bring them to the python side...
nope. that was for making it easier on the C side. ๐ฆ
@exotic pumice if you need absolutely nothing happening during your wait, i think microcontroller.delay_us(1) is the shortest you'll get. time.sleep() will allow the VM to run if you need interrupts/periphs.
hmm
I'll see what I can do but it sounds like I might have to go back into C or Rust
the crux of the python side. fine scale timing just doesn't pan out as easily..
with delay_us(), looks int only. time.sleep() will take the float, but checks the procession of us...so i would say no.
@slender iron using the api might be possible. but i imagine i personally would break sooo many things. ๐
https://developer.github.com/v3/git/#git-data
I'll have to see what the lower bound of speed is for SWD. DAPLink uses 2 or 5MHz, but possibly it is lower than that
according to the samd21 datasheet the clock for swd can be as low as 1KHz
so that's promising
@raven canopy ya, I think you are on the right track
hmm. this will require much reading, in a circular fashion. always wanted to really, really dive into git's underworkings. ๐
oh wow. its 1:30? i sat down like 5 minutes ago...at 11:30. ๐
what do you mean to do a build? that is the output of a build
ok, well it was complaining they're not there but I guess that's not the real problem
do I have to build_board_info before I build_adafruit_bins? I'm just following the travis output on what to do
it looked like it was just
clone, submodule update, then build_adafruit_bins
oh and mpy-cross
is it my gcc version?
[paul@P50-Arch atmel-samd]$ make BOARD=feather_m0_express -j4
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
QSTR not updated
../../lib/tinyusb/src/class/msc/msc_device.c: In function 'proc_builtin_scsi':
../../lib/tinyusb/src/class/msc/msc_device.c:268:7: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation]
strncpy((char*) inquiry_rsp.vendor_id , CFG_TUD_MSC_VENDOR , sizeof(inquiry_rsp.vendor_id));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../lib/tinyusb/src/class/msc/msc_device.c:269:7: error: 'strncpy' output truncated before terminating nul copying 16 bytes from a string of the same length [-Werror=stringop-truncation]
strncpy((char*) inquiry_rsp.product_id , CFG_TUD_MSC_PRODUCT , sizeof(inquiry_rsp.product_id));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [../../py/mkrules.mk:55: build-feather_m0_express/lib/tinyusb/src/class/msc/msc_device.o] Error 1
make: *** Waiting for unfinished jobs....
[paul@P50-Arch atmel-samd]$ gcc --version
gcc (GCC) 8.2.1 20180831
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
yeah that was it
should I PR to add -Wno-stringop-truncation or do you want to fix the warning?
I have no idea what language this is in now but it's not english
I like to fix the warnings. we're not on gcc 8 yet though
don't you use arch as well?
ok
I develop on mac day-to-day
how do I set the langauge?
TRANSLATION=
no but you might be able to use a SPI to
I'm not sure of the protocol details but if its just clocked bytes thats where I would start
good idea
thanks ๐ hopefully it works
oh, I think it might be parallel though
ah ya
is the data line open drain?
thats more like i2c
ยฏ_(ใ)_/ยฏ
start with bitbanging and you can always swap other transmission code later
how do I bitbang synchronized to a clock and output that clock at the same time?
I guess just bang up and down the clock before I do anything that would take a clock cycle?
that doesn't really make sense either
right, you set the clock pin intermixed with setting the data pin
time.monotonic_ns seems like it's just time_monotonic * 1 000 000
or maybe that's print speed?
no, because I'm doing the timing independently of the prints actually
import time
import microcontroller
start_time = time.monotonic_ns()
microcontroller.delay_us(1)
end_time = time.monotonic_ns()
print(end_time-start_time)
ok, so I need a logic analyzer to figure out if I'm doing anything faster than 1kHz
that sparkfun one looked decent
for the price
and there's some on aliexpress too
aren't you a student @exotic pumice ?
ya, I just looked and its more than I expected
I'm used to student software pricing ๐
goodnight!
night
๐ค
this is what I have so far
https://paste.pound-python.org/show/ZkvRFh5JAs3UDbN4nc3y/
can't get a valid id out of the debug register yet, oh well
if someone can sanity check that tomorrow, that'd be great
@slender iron thank you for your reply. The MCU is running in an isolated area in a low voltage mode. (1.9V I think). When we designed the board we were not aware of circuitpython and therefore we were happy with plain UART communication as it was easy to isolate. However since we know about circuitpython now I would love to try it out.
So any pointers at what do do to get it working with just UART (if it is possible at all) are highly appreciated
@slender iron I didn't know I was working on SWD on CircuitPython!
Welcome to the team, madbodger! ๐
@main meteor it's never too late to start ๐
I guess swd needs a common ground, eh?
I really need my swd breakout to get here lol. I'm trying to hold the wires on the cpx and it was doable with 2 but harder with 3
do you think the feather probing itself would be able to get an ID out?
I have no idea what I'm doing lol
@slender iron suggestions?
do you have a soldering iron available? you could solder the wires down
I'm getting one for christmas
I've been using my college's up to now
it would be nice if I hadn't killed my blue pill, it has 0.1" swd headers
hey @slender iron did you get a chance to see my response to your suggestions on the adxl34x PR?
no I've been ignoring my github emails. will look now
thx
I have a feeling it should be able to ask itself for an ID, because swd can work while other things are running, so there is probably something wrong with my code
Hi All, coming back to CPY after a break - I used V2 on my ATSAMD21E18 Keypad, and I'm looking to make a Bluetooth/USB version using an nRF52840 module. I've picked up couple of PCA10059 Dongles to experiment with, and was wondering if there is a guide on the steps needing to be taken to use Alpha4 on the Dongle.
yo dawg, I heard you like swd, so we put a debug port on your debug port so you can swd your swd code
lol
huh. i didn't realize CP supported namedtuples. i thought i checked sometime ago and it wasn't in there.
neat
Sigue fallando un trabajo de Travis, los demรกs estan verdes, revise el log y aparece este error en todas las traducciones, supongo que es el causante de que no pase el trabajo que falta.

@tannewt does the error on the image above is causing the last Travis job to fail?
@jovial pine I don't know of one. I used a JLink to load a new bootloader on one.
@tannewt Thanks. I'll dig out my J-Link in the morning. Did you just solder wires to the board or mount a header?
Not sure if this is the correct channel but I think the https://learn.adafruit.com/adafruit-crickit-creative-robotic-interactive-construction-kit/programming-options#crickit-hat-for-raspberry-pi-14-6 should include the instruction "pip3 install adafruit-circuitpython-crickit"
I didn't see that instruction in the Installing Circuitpython on a pi either. Just took a guess and stuff started to work ๐
Then I am guessing just follow the feather wing code?
@jovial pine I can't recall. I do have extra headers for this purpose
Unfortunately, pulseio is not available on the Trinket M0, Gemma M0, and other non-Express boards (boards without external SPI flash chips) due to lack of space. Check out the "Support Matrix" here: https://circuitpython.readthedocs.io/en/3.x/shared-bindings/index.html#module-support-matrix.
I think I bricked my Metro Express M4. Downloaded an UF2 from maker.makecode.com. It had circuit python on it originally and i didn't upgrade the bootloader. Anyone had experience reviving an M4?
Ah I found this - https://forums.adafruit.com/viewtopic.php?f=57&t=142170&p=707151#p707151
dan, i thought we added it in 3 after we made space? its audio that didnt make itin?
@ladyada is right! I'm sorry. pulseio is present in version 3.x. I assume you're running 2.x or earlier. Update to 3.1.1 and you'll be fine! Note that you also need to update the libraries in the lib directory to 3.x versions. For directions, see:
https://learn.adafruit.com/welcome-to-circuitpython/installing-circuitpython
https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries
Temporarily rename main.py or code.py to something else, like mainx.py while you a...
all good! lots has changed ๐
Can I use the CircuitPython libraries without installing anything else??? Like, I don't want to install the bootloader or build it or anything, I just want to use the libraries on this board I have that runs Ubuntu 16.04
Hello there! First time here, I hope the first of many! Can I use the adafruit-circuitpython-feather_huzzah-3.1.1.bin on the HUZZAH ESP8266, I mean, the non Feather Huzzah ESP8266? Thank you!
@native palm you would need to install blinka and there would need to be support in blinka for the board you are using:
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/overview
blinka is the software interface between CP libraries and specific linux targets
@tidal kiln I see. How hard is it to write support for a board that hasn't been made already?
i don't think we have a guide that covers the specifics. but this might be a good starting point:
https://github.com/adafruit/Adafruit_Blinka/blob/master/src/board.py
@radiant cypress It should work but the pins in board might be wrong
I'll try it @slender iron, thank you!
@radiant cypress I have used it on the Huzzah breakouts with no issues. Good luck.
Home Run! Thank you so much. I am impressed by this little board.
What's the best way to "bridge" the USB on an nRF52840 to the UART? Application: esptool to flash micropython to the esp32 on particle Argon boards.
@neon dragon I'm not sure, but I suspect it'll be to create another serial port in the USB profile, and then just echo bytes back and forth. I've been messing with something similar in https://nick.zoic.org/art/micropython-webusb/
By making the serial appear as a separate serial port on the same device, you can still use all the usual serial UART based tools.
I see this is a bit of work. Perhaps I just try to port limited esptool functionality to CircuitPython and run this on the nRF52840.
What are you trying to do? Run MicroPython on the '32 or CircuitPython on the nRF or both?
or either ๐
On another note, I'm not sure that the https://www.nordicsemi.com/eng/nordic/download_resource/$ETC URLs used by the NRF port to download the bluetooth stack still work ... download_ble_stack.sh is failing for me ...
Nick: particle released a board that has an nRF52840 as the main processor and an ESP32 attached over UART for wifi. I want to reflash the ESP32 with micropython. The nRF runs CircuitPython. The ESP32 is not directly accessible, only via the nRF. Hence I cannot run esptool in the usual way.
BTW: getting the ESP32 into bootloader mode works fine. But it's in SPI_FAST_FLASH_BOOT. Anybody knows what that means?
I am using CircuitPython on a Raspberry Pi (3B+, I believe) and the adafruit_74hc595.ShiftRegister74HC595 library trying to control a bunch of power outlets (for Christmas lights and in place of light switches). It appears the library can only handle a single 74HC595 chip. I currently have 2 chips and planned to add more. Do I just need to use the SPI directly or does anyone know if the library can support more than a single chip?
@C47D he intentado obtener los รบltimos cambios a mรญ repositorio a ver si eso lo soluciona, he visto que hay algunos conmuta que se han hecho arreglando cosas referentes a Bluetooth.
Por casualidad has probado los cambios? Hay alguna manera de compilar el cรณdigo con el lenguaje y verlo directamente en la placa?
Esperemos que eso lo solucione.
@tannewt I did try getting latest changes done on the main repository (adafruit one) since I saw some fixes regarding BLE. Hope it helps ๐ .
R...
@night vale That library was very recently created, we did not test it with multiple chips. I don't know what would need to happen with it to support multiple chips. So if accessing the SPI directly works, I would suggest going that route.
Wuju!!! ๐ It did pass.
@idle owl Thank you for the quick response. When I hooked up the second chip, it appears it is simply ignoring the output past the 7 pins, so whatever the last value loaded into the first 74HC595 gets passed on to the second 74HC595. I will use the SPI directly. Thanks!
@night vale Feel free to file an issue on the 74HC595 GitHub repo requesting support for multiple chips, if it's something you'd like to see. If it turns out it's not possible, we will have at least looked into it. https://github.com/adafruit/Adafruit_CircuitPython_74HC595
@neon dragon yep, I know of the board ... SPI_FAST_FLASH_BOOT is the normal boot mode I think, it should be DOWNLOAD_BOOT for bootloader use https://github.com/espressif/esptool/wiki/ESP32-Boot-Mode-Selection#boot-mode-message
I think you're right in that you could get away with having CircuitPython on the nRF CPU act as a relay to the ESP32 UART ... it'd have to be a "load through" kind of mode to use the usual tools though
@yeyeto2788 Estoy por comprar una tarjeta de Adafruit para poder correr Circuitpython en ella :D, quiero la que trae el chip BLE pero no se como este el tema de importaciones, la รบltima vez que intentรฉ importar una tarjeta con BLE me pidieron mucha info para aduanas.
Aqui @tannewt explica como compilar Circuitpython o puedes obtener el binario una vez que se mergeo tu PR.
@crude fossil make sure and get the latest commit. nordic changed their site and I fixed the script
@granite crow I was just looking at that!
Then PR #1 were merged and Travis is happy now, i would like to know if it's a known problem (the one on the screen capture)
@slender iron oh cool you've done that already? Ah, so you have, I was a couple of revisions back from master still
yup, saw it a few days ago
I really wish vendors would just put sensibly named files in a bucket and leave them alone ๐
@granite crow is that PR ready to merge?
@crude fossil totally. at least the new ones are licensed so you can redistribute them
@slender iron Travis is green but i would like you to take a look because there are some strings from the py directory and i don't know if those were meant to be translated.
yup they can be
the only things we shouldn't translate are words that are also used in the code
@slender iron oh ok, so merging the PR 1 seems to solve the problems we had, is that the right thing to do? i don't want to break CP :D.
@slender iron hey by the way the nrfjprog download has similarly moved.
@granite crow I'm not sure why its called #1 but it looks right. travis passing means you haven't broken CP. Even if you do, we can always fix it
@crude fossil ah, I don't use it. Please update it if you can
@granite crow do you want to approve and merge?
@slender iron i will take a quick look at the Spanish strings, if it's all right i will approve, sabas already check it and was waiting for Travis to become green.
ok thanks! it looks good to me
ok, i will check it later today, got to go, thanks for all the help!
hi is there a way to check which SERCOM I've used on a circuitpython board?
I feel like my USB and UART are talking over each other
@yeyeto2788 Preguntรฉ en Discord y todo perfecto, me parece que falta la aprovaciรณn de @sabas1080 para poder mergear a master!!!
As per discussion here: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/issues/94
We need to add another status LED error code to the current set for the incompatible mpy error. We agreed on pulsing blue for when this error is encountered.
@slender iron @main meteor if you're not too busy could you look at this code and see if anything jumps out at you?
https://paste.pound-python.org/show/ctKyALivQ4ALms5djCmU/
the original is here https://github.com/ARMmbed/DAPLink/blob/bac4a3c1fe851ae33c46d87fbb25fcef8c5bb492/source/daplink/cmsis-dap/SW_DP.c#L99
Ok thanks
I was out for the day. Looks pretty much like the C version to me. Not sure if the timing is critical, but if so, might need to tweak some things.
@C47D @yeyeto2788 yo puedo enviar a cada uno una de mis tarjetas que soportan circuitpython unas bast pro mini, usb stick o meow meow si gustan de regalo ;)
I don't think timing is critical. It looks like it can range from like 5MHz to 1 or 10KHz
that's based on daplink using 2-5MHz and atmel datasheet saying the timing for a low and high swd pulse can be as long as 5000000ns (not sure the exact number of zeros but I checked earlier)
I think we're at like 500KHz?
don't have a logic analyzer to check though
oh this is a thing https://github.com/adafruit/Adafruit_DAP
any compelling reason to not just use that?
is there an mqtt module for circuitpython?
@scenic timber not as far as I can see
me either thats why I am asking ๐
arrrggg does anyone know if circuitpython can handle a UART baudrate of 115200?
I'd like to port some holiday LED projects from arduino to circuitpython/seasaw
they use mqtt to get the commands as to which animations to run.
I have started working on finishing this off.
@scenic timber (in case you didn't know) there's mqtt support on the master micropython repo. might give you a starting point
Start to translate circuitpython to Bahasa Indonesia #1098
In Progress, reaching line 236 so far
thank you @slender iron I found another workaround. Is there a good explanation somewhere on why some pins can only be RX or TX? I can't seem to find any mention in the SAMD datasheet
I think it's to do with SERCOM pad layout
yup, look at the pinmux table and cross reference it with the pad settings for the UART sercom mode
@slender iron were you aware of Adafruit_DAP?
no
@lime trellis thanks Iโll check it out!
I don't see much reason to port it, do you?
@slender iron can you point me towards the UART sercom pad settings?
@lime trellis SERCOM5/PAD[1]
@exotic pumice yeah but where does it say that SERCOM5/PAD[1] can only be TX or RX?
the UART section of the datasheet probably
I've combed through it, and their app-note. but I must be blind
I was hoping it was something I could set when configuring SERCOM5 somewhere
if not, I can try to pull up some docs from a library I've used
@marble hornet I believe it's only on hard resets
@lime trellis look in the CTRL register of the UART sectin
@lime trellis I have a list of the pinouts here https://atsamd-rs.github.io/atsamd/atsamd21g18a/atsamd21_hal/sercom/enum.UART5Pinout.html
API documentation for the Rust UART5Pinout enum in crate atsamd21_hal.
๐ I'll look right now
thank you !
wow, if this is it then it's pretty obscured!
so if I read this right.... TX can NEVER be on a PAD[1]??
I think it's only pad 0 and pad 2
@tulip sleet when I was asking about uart was a way to represent strings packed into bytes mentioned?
looking it up...
are you talking about like str.encode('utf-8')?
takes a string and returns a bytearray
yeah, but that's not present in the smaller non-express builds
ah bummer
BUT, the workaround is:
bytes(some_string, 'ascii')
and in fact the second arg to bytes() is ignored (just like the arg to encode() is ignored. It's a MicroPython thing (or "deficiency"), or something.
@marble hornet ^^
thank you
I guess you don't want too many encodings taking up space on a micrcontroller
i keep forgetting this workaround; took me a while to find it again.
this is also interesting: https://github.com/adafruit/circuitpython/pull/518#issuecomment-358167675
@sabas1080 Gracias por la oferta, estarรญa perfecto!
@sabas1080 eso serial genial!
<@&356864093652516868> Here is the notes doc for the meeting tomorrow: https://docs.google.com/document/d/1LsFNPxpDJvRZUeDlDT1jTg03OPOsaMKd5-iwDMwcRj0/edit?usp=sharing
I think we're all set. Thanks @yeyeto2788 for the PR and @sabas1080 and @C47D for the review.
@tannewt, It was a pleasure! I hope with this we can get more people involve on programming. If any other help is needed do not hesitate on contacting me.
@sabas1080, @C47D thank you very much for all the help.
someone want to help a beginner? https://forums.adafruit.com/viewtopic.php?f=60&t=144423
Hi! Thank you for this! I'm excited to see another translation. We should merge this before you translate all the strings. I'll merge it once Travis passes. The current error is listed here: https://travis-ci.org/adafruit/circuitpython/jobs/462636827#L1079 Let me know if you need help getting it going. Thanks!
it's just this right?
import random
sounds = ["jingle.wav", "good.wav", "bad.wav"]
cpx.play_file(random.choice(sounds))
a list is a sequence right?
@slender iron
ya, thats what I was thinking
ok cool
that doesn't check for touch though
oh, right
but that can be left "for the reader" ๐
done
thanks @exotic pumice !
np
@yeyeto2788 I hope so too! Thanks again.
I can't remember where the 6mhz limit comes from but it doesn't seem good to allow frequencies that drop the voltage. We could do FrequencyOut using a GCLK but I'd prefer to have PWMOut drop duty cycle resolution in order to create a fast PWM frequency.
It's an interesting idea! Do you have a specific example in mind? I've only done a little Arduino so don't exactly know what the API would be.
One of the biggest challenges we have with using other C libraries (including vendor libs) is that they all assume static allocation of resources. CircuitPython is the opposite because we don't know what will actually be used by user code. I imagine existing Arduino code will have this issue too.
@turbinenreiter FYI, the commit hash in the version string always starts with -g so @nickzoic tried it with f6c73b35f.
@nickzoic Any more info on this?
Hi,
Is there any further documentation on using the bleio as a peripheral? I can start the advertising but there is no further documentation on how to handle a connection, such as setting the connection handler and various event types, etc..
I am trying to build a very simple example following the one in ubluepy_temp, simply reporting the CPU temperature.
SoC I am using is the nRF52840.
BR/
Ed
Giving this talk 'Getting started with CircuiPython' at pydata london tomorrow - any comments appreciated https://github.com/robmarkcole/HASS-circuitpython-air-quality-sensor-node/blob/master/images/PyData flash talk 4-12-2018.pdf
I cannot access the link. Returns 404
I would use fewer font faces and sizes...
@slender iron would you know where I need to change code / config to use UART instead of USB on the samd21?
The bleio API that's included now is incomplete, and is undergoing a revision and expansion. Watch for a release relatively soon that has more (and changed) functionality.
@yeyeto2788 @C47D pรฉsenme su direcciรณn a s[arroba]electronicccats[punto]com por favor y diganme que tarjeta quiere esta semana llega la nueva Bast
hey, can one talk over spi in boot.py? i'm trying to send somehting to the screen but it isnt working
thanks, is there a way to check if the device just turned on? not reloaded , reset?
I don't know
okay๐ thank you
@tulip sleet could you please, if you're free, give me some help "parsing ๐ " the nvm files? i can't find where the name of the module actually defined.
hi, here is where the nvm name is defined: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/nvm/__init__.c#L52. the MP_QSTR_nvm gets converted to something else completely during the qstr generation phase of a build.
it's kind of hacky. there are substitutions made for certain strings that turn into certain characters
Hi, are there plans to suport the Bluefruit nRF52 board in Circuitpython?
yes, that's the 52832 board, but we are also coming out with 52840 boards
to me, on 3.x, it isn't in string form ? so the name MP_QSTR_nvm is turned into the name?
Yes, there's a preprocessing pass that looks for MP_QSTR_<something>, and builds a table of qstrs (compile-time shared string definitions).
see py/makeqstrdefs.py and py/makeqstrdata.py
so if i wanted to change it would i would just replace nvm right?
@tulip sleet Sounds great, i'm seeing the Bluefruit with the Mynewt bootloader, can i go back and forth between Mynewt and Circuitpython (using just a SWD programmer i guess)?
@marble hornet right
@granite crow in theory yes -- the newer boards will have a uf2 bootloader like other CircuitPython boards and that will be a lot easier to load. I'm not sure what you might smash if you overwrite stuff on the Mynewt board. I don't remember whether we have firmware images to reload (probably we do).
@tulip sleet Thanks, i guess i will wait for the 52840 boards.
hmmm not working, gonna try again
do i need to tell cp to include it if i renamed the folder?
rather i made a duplicate and renamed it svm,
have to head to class, cu. have a great day all
So with Circuit Python how do I access Serial1 on a board? do I just read/write to the RX/TX pins of the board? or is there something else?
not sure what you mean by Serial1
Fixes the remaining items in #1128:
- Breaking Change:
busio.UARTconstructortimeoutparameter is now in seconds instead of msecs UART.readinto(buf)now does not allow an optional length parameterUART.readinto(buf, len)UART.write(...)no longer allows strings to be written. The bytes written must bebytesorbytearrayor anarray.array.
The fixes are to make UART more compatible with PySerial, so that PySerial can substitute for UART on Linux platforms.
@charred blaze you would do something like serial1 = busio.UART(board.TX, board.RX) and then write to the UART object. Of course you don't have to call it serial1
Ahhhhh ok! thank you danh!!
apologies @stuck elbow i guess I meant UART with the RX/TX pins.
SImple fix. Spotted this when I was looking for some examples of handling typed args.
yay thanks - i can test soon i hope
@charred blaze ah, I see, like on the arduino leonardo
Im not sure. never used a leonardo.
@marble hornet @stuck elbow SPI should work from boot.py. Only usb isn't up yet.
@timber mango you'll need to make a supervisor/serial.c in ports/atmel-samd/ that implements the supervisor/serial.h API and change the Makefile to use it instead.
@cedar beacon slides look awesome!
๐
What would cause an issue like this from the REPL?
code.py output:
Traceback (most recent call last):
File "code.py", line 26, in <module>
File "neopixel.py", line 91, in init
ValueError: Pin PA18 in use
you tried to create a new I/O object on pins already in use. Post your code if you'd like
give me one sec dan. I dont wanna paste the whole thing even though its only 32 lines. Lemme get a link to it on my github. its super basic right now because im still learning Circuit Python
you can post a file with the "+" button over on the left if you don't want to do it inline
but github too np
ah true. I'll do that isntead
I forget about that sometimes
I took the imports from Noe's lightsaber build. I am working on a similar project
the neopixel.NeoPixel creations are inside the while True loop, so they happen over and over. Move the btns = and strip = out before the while True loop
and the other stuff is in the loop too, which probably only needs to happen once. so move that out. For now, just do
while True:
pass
and put all the stuff in the loop before the loop
this is like in init() vs loop() in Arduino
s/init/setup/
tnx ๐
ahhh ok.
<@&356864093652516868> Reminder about today's meeting in ~46 minutes. Everyone is welcome to attend! Here is today's notes doc if you'd like to add your hug reports or status updates before the meeting. Thanks! https://docs.google.com/document/d/1LsFNPxpDJvRZUeDlDT1jTg03OPOsaMKd5-iwDMwcRj0/edit#
@idle owl thanks! I was just about to scroll back for the link! ๐
How does one join? id just like to listen in maybe
@charred blaze we do the meeting here in discord. Just need to join the CircuitPython voice channel. If you'll just be listening, simply note that you're lurking (text here, or voice).
tried this PR with a GPS breakout on a Metro_M4_express -- works OK.
Also tried on feather_m4_express -- communicating to BLE UART friend -- OK
It is important to update the timeout in existing code ;-)
So now the repl is telling me that
blade.fill((255, 0, 0)) is invalid syntax for the neopixel library on CP
whats before that?
This is the 3 lines above that:
- blade = neopixel.NeoPixel(LED_PIN, NUM_PIXELS, brightness=1, auto_write=False)
- while True
ignore the #) before the text, just marking the lines
the while True is missing a :
derp...
may be just a few minutes late. still wrapping up our internal meeting
๐
๐
Actually can I say a thank you, Scott?
@charred blaze Of course!
general hug to everybody on the project ๐
Dang. network is being wonky. But yes thats what I said
hiya here just for aminute in text
@meager fog Let us know hug reports and status updates and we'll read them off
mega hug report to @raven canopy for the adabot updates, they're so helpful!
@tidal kiln for picking up so many small issues & fixes
Wonky audio, so will type today. General group hug to the entire team and community. Special hug to Ladyada for her early MIDI and musical synth guide work. Still relevant!
im doing a lot of embedded linux ports for blinka so you can run circuitpython code/drivers on various SBC's - all are welcome to add support for their boards
Hiiiii LadyAda!
hii
- @kattni, @carter, @tannewt, and @ladyada for the various reviews and merges
- @sajattack, @jerryn, @danh, @carter, and some I've probably missed for Discord and forum support
- Everyone continuing translation work; such an awesome thing to see
- The groupiest of group hugs!
Every time I hear someone say your name Scott I think they are talking to me. my name is also Scott
Apparently Im getting hug reports. I dont know what im doing here pretend there is fire all around me
one update for weekly chat, the awesome-circuitpython list was updated...
I can make noise. does that count for anything? Asking for a friend.
awesome-circuitpython is a curated list of awesome CircuitPython guides, videos, libraries, frameworks, software and resources. Lots of updates, the latest include: added newsletter archive list, added the latest boards that run CircuitPython from Adafruit, Sparkfun, and Digi-Key python section, added video newsletter podcast playlists, added the Adafruit Hallowing m0 express in hardware, added the CircuitPython libraries in code, added CircuitPython in MicroSolutions Digital Magazine, The Amp Hour #383 in news, and added CircuitPython Development Workshop in books. Did we miss anything? Make the awesome list more awesome by adding to it! - awesome-circuitpython @
https://github.com/adafruit/awesome-circuitpython
I'll pass
Working on PCB designs this past week, not so much with CircuitPython. Besides shrinking the size of the lunchbox synth daughterboard, Iโve been playing around with PCB art and backlighting with SMD LEDs designed for reverse-mounting. Itโs more difficult and mysterious than I thought it would be.
Next week will be focused on two CircuitPython NeoTrellis projects (and one โclassicโ Trellis, too), a musique concrete instrument, and wrapping up some project enclosures.
Yes hi hello, that was me
Last Week:
- Adabot:
- Added an Arduino library script for comparing release tag to library properties
- Finished up ability to run CircuitPython library validators "a la carte"
- Hopefully fixed bundle updates for running Adabot on Travis
- FRAM: Finished up SPI version
This Week:
- Update FRAM Learn Guides with CircuitPython usage
- Add "haz commits, needs release" to Adabot Arduino
gotta run for a day_job meeting. Thanks everyone! Have a great day. ๐
IN THE W33DS
- how to test blinka PRs locally
- how to approve NOT on behalf of CP librarians
ty
Thanks!
@fathom lava https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/CircuitPython_Essentials
Question, On the 28nov18 Ask and Engineer, LadyAda mentioned that there was a new tutorial/course on using Circuit Python on the CPX. Can anyone point me to a link for it?
Thanks
@dense pike I'll find it now. I think it was in the newsletter
@dense pike I think this is the blog post: https://medium.com/@gallaugher/a-coding-engineering-experience-for-business-undergraduates-834a49f102ba
it has a link to the youtube playlist too
its in tomorrow's newsletter ๐
@slender iron Asume, thanks
back @tidal kiln to test blinka locally, pull, then set PYTHONPATH to include the folder
rather that pip3 installing
@meager fog thanks. @gusty kiln also suggested a venv approach which sounded cool and will hopefully write up ๐
Welcome Shawn ๐
It seems to me that reverse mounted LEDs would be straightforward (you may have thought so too), so now I'm curious as to what difficulties you ran into.
Yes that will then probably also be an issue for Arduino.
What I would have in mind is being able to extend CircuitPython with your own compiled modules that are based on the Arduino API, so there would be a need for a translation layer that takes calls to the Arduino API (digitalWrite, analogRead, Serial.write etc.) and translates that to either the CircuitPython API or let it access the hardware peripherals directly if that can work out without making a horrible mess.
I know too little ...
So now my repl is giving me this for an error.
Traceback (most recent call last):
File "code.py", line 29, in <module>
File "neopixel.py", line 227, in show
ReloadException:
soft reboot
This is what my line 29 is.
blade.show()
and this is my line 28
blade.fill((0, 0, 255))
blade is a neopixel strip
I think ReloadException just means the board rebooted or something. I'd like to know more as well.
so it's just saying it rebooted while that line was running, not that there's anything wrong with that line
hmmm ok
did you maybe save the code and it triggered an auto-reload?
or depending on your editor it could even autosave
yeah it seems that it auto-reloads after I hit save. and Im using MU
yeah that's probably all it was then
ah
a late hug report to @tulip sleet : Thank you for being so kind and willing to help!
yw!
Now I gotta figure out why my led signal isn't getting sent to my strip of leds. I have them attached to the neopixel pins on the prop maker wing
This was done last week. My stream recording is on diode.zone and YouTube.
@kattni Please post yours too.
@charred blaze I'm not sure why that would be. Neopixels are pretty finicky. One note though, you don't need that loop, the LEDs will stay on when you set them once.
@tidal kiln Thank you
@tidal kiln Were there no screenshots to begin with?
REPL screenshots
@exotic pumice I figured as much. I was originally trying to make it alternate colors for the moment to get them working
I see
@idle owl there were....let me guess...
@tidal kiln ๐
no worries. will do. actually want to set one up to check one of those issues posted in the soon to be deprecated repo
Sounds good, thanks you for both!
@tidal kiln Can you do the release on ADS1x15? You'll know better what to put in the release notes, noting that it breaks the API.
yep
Thank you!
@ladyada feel free to follow up after the merge with any other feedback.
@dhalbert Please double check this for me.
@jimblom Want me to finish the polish on this and merge?
I agree with @tannewt. At higher frequencies, just make the duty cycle the coarsest necessary to preserve a 50% duty cycle (if not 0 or 100%).
That'll work. Thanks!
Trying to come up with a name for a lib. I'm pulling the Motor FeatherWing helper code out into its own library because it works on the Motor Pi Hat (and presumably the shield though that's to be tested soon). Adafruit_CircuitPython_MotorAddOn ? "add-on" was mentioned as a general name for shields/hats/wings. I don't know if I like it though. MotorKit? MotorHelper? I'm trying to picture what the import will look like and I want it to make sense. Add-on might be growing on me.
@idle owl MotorBoard?
hmm
MotorBoard seems OK, marketing may not like it though
Motor Mover!!!
MotorFHS? (Feather Hat Shield)
@tidal kiln needs a B for Bonnet. ๐
oh wait, it's a wing
oh...and a W
M Wing (like he X Wing) but M is for motor
MotorParty
I still like my idea the Motor Mover!!!! (You gotta keep the exclamation points in there too)
MotorWiSH (Wing Shield Hat)
You forgot the silent B, for bonnet, like Sommersoft said
it's a non printing unicode character
Ahhh ok
What about WooooooooSH instead of WiSH? With the oooooo being the circles your motors will spin???
MotorV8R
So I'm not sure there's a motor bonnet kit anyway. I don't know ๐
It can't be wing specific, it already is and we're moving away from that. I love MotorParty but I don't think that explains much. MotorWiSH is pretty great.
MotorChimera
haha
There isn't a motor bonnet. But there's also no guarantee there won't eventually be.
harrumph.
indeed. surprised there isn't one already. there is a servo one.
Yep
motor one would basically just be that + h bridges
and since it all fits on a wing, not a space issue
MotorBWiSH? Preempt it? ๐
AddOn isn't much less general than Board.
Kit isn't in all of the descriptions, only the shield and hat descriptions
EasyMotor?
SimpleMotor?
Go the other direction and highlight it's ease of use instead of what it's for?... bleh
Now I want to have an excuse to say "bwish" though.
Helper is .. not good.
Motor1A39 (all 3 PID's added up and converted to hex)
LOL
Well played
MotorStepper?
Those are the two properties contained within.
well there's 6 but it's motor1,2,3,4 and stepper1,2
Makes it seem like maybe it's for steppers though, not also for dc motors
DCMotorStepper?
Eh.
MotorStepper is ok, in that context should be obvious it's two things
Think so?
"stepper motor" means one thing, but by flipping them, seems ok
that was my thought but then I second guessed it.
if it were truly only for steppers, you would either say "Stepper" or "StepperMotor"
"Mighty Motor Mover" ???
Points for creativity ๐
Woooo!
More points for alliteration
If you fits, you sits.
Hang on.... I have a better response to that one. just gotta find it
Ok, one more but then we're done or it should move to #general-chat
Here you go Kattni. and YES, thats me inside there.
ok, back to circuit python topics lol
Hello everyone! I've been trying to get the SleepyDog library to work on an Adafruit feather M0 basic. The micro seems to draw far too much power in deepSleep mode(0.75mA at 3.3V external supply). I raised an issue in the repo and would love any suggestions for what I could try to reduce the power consumption. Thanks in advance!
Why when I name a python section of code anything other than "Code.py" It will not execute?
@sacred edge There are a few filenames that run automatically. CircuitPython looks for code.py. If you name it something else, it doesn't look for it, that's why it doesn't execute.
@sacred edge Here's more info on the topic: https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code#naming-your-program-file-6-30
Yes, when you're ready to run your code.py file, copy it to CIRCUITPY and it will run automatically.
Unless you have an error, in which case, begin troubleshooting ๐
Thanks!!.. Wow.. This is getting interesting knowing the little bits and pieces to writing and running the code..
You're welcome! The more you get into it, the more you learn ๐
okee dokee, here's the feather-compatible MCCI in one spot - https://blog.adafruit.com/2018/12/03/feather-compatible-fpgas-tmmmcci-mcci-lorawan-iot-tinyfpga-latticesemi-risc_v/
whoops, that was meant for #general-tech
Just watching CircuitPython Weekly now. Thank you'se for the thank yous. I'm happy to help support the community that supports me.
BTW, I got my Jewel Up and running just fine.. Neat little board..
@tidal kiln, I want to chime in on the "approve on behalf of yourself" you can add a ๐ emoji react with this button in github
@exotic pumice from today's meeting question?
yeah
thanks. yep. i use that too.
I think it's a nice way to approve without fully committing
or allow multiple people to approve
someone is asking me hard questions... "does the CPX have an rtos thing?"
is there a simplistic scheduler?
verifying...
- timeout is now in seconds (correct) - i will note if you set the timeout to a long time the board seems to 'hang' - you cant ^C out, and wont reset on save. seems bricked but isnt. maybe worth fixin?
@tannewt suggested throwing an exception for a timeout >=1000 to catch old that was still thinking in msecs.
i think anything more than 100, a 2 minute timeout is massive. but still...its really 'hangin' is it normal to not be able to interrupt ?
There's a call to the VM soft interrupt handler in the busy wait loop, but I think we may have to check for the interrupt in the loop too. This logic hasn't changed, but now it's more obvious it's painful. I'll take a look.
bug found: uart.readinto(buffer) does not obey the timeout, it will hang until all the data is read. it should time out and return the # of bytes?
UART.in_waiting works fine, but i am noticing now our UART input buffer is only 64 bytes? thats really little on the M4 - can we bump it to 256 at least?
uart.reset_input_buffer() working all good
ok thats my testing!
I think these are all existing bugs. We're just testing better. Did .readinto() used to time out, in your experience?
i dont think i did... i agree these are likely older bugs - i can open up new issues if ya like!
Changes made. There are bugs discovered in existing UART timeout logic that will be addressed in a new issue.
A KeyboardInterrupt during a UART timeout will not interrupt the timeout. This bug has been present since 2.x or before.
The UART code does call MICROPY_VM_HOOK_LOOP but doesn't check for a KeyboardInterrupt.
The I2CSlave code has some examples of checking for an interrupt using mp_hal_is_interrupted(). There may be other places we should think about including that check.
OK, having a look into this now ... progress will be at https://github.com/nickzoic/micropython/tree/nickzoic/circuitpython-nrf-touchin-1048
Nordic API ref: https://github.com/NordicPlayground/nrf52-capsense-example
Hmmm, request from @ptorrone was:
please use the "Single-pin capacitive sensor support" - no external resistor is required then!
... but in https://devzone.nordicsemi.com/tutorials/b/design-examples/posts/capacitive-touch-on-the-nrf52-series there's the following update:
Important updates:
Due to erratum 84 (COMP: ISOURCE not functional), capacitive sensing using the relaxation oscillator method is not usable in a real product with the nRF52832, as it will only work reliably...
seems unclear, whats the SAADC method?
That's the version with the resistors, using another pin to charge the pads and then the saadc to measure the rate at which it discharges
The comp method may be okay if we're clever about self-calibration, I'll try it out ...
@sabas1080 he intentado enviarte el correo pero me dice que el dominio no pudo ser encontrado al enviar el correo. :cry:
@slender iron thank you
@yeyeto2788 le sobra una c despuรฉs del arroba, es electroniccats
The current CircuitPython "calibration" on SAMD21 is pretty simple: when the TouchIn object is created, we assume that it's not being touched. Touch threshold is that value + 100. But TouchIn.raw_value is available for people who want or need it, and the threshold can also be adjusted.
If the nRF errata are saying that the readings are really erratic, yeah, that could be a significant issue.
Can i use this https://www.datasheets360.com/pdf/-9101609953768848923 with feather m4 express? I have power, ground, CS, SCK, MO, MI all connected but dont know how to do anything with it
datasheet time! seems possible, just need to work through the details in the datasheet. have you done anything like this before?
never...
i would like to learn though
i find useful chips in all kinds of discarded/antiquated devices
are you familiar with SPI in a general sense - the basic idea of how it works, what CS does, etc?
no, i think you have to pull cs down to do stuff?
should i add pins for hold and write protect pin?
in general yes, and you can see some traces in the datasheet. but SPI is a general communication thing, not specific to this chip. so i'd first do some reading on SPI.
i read this already https://learn.adafruit.com/circuitpython-basics-i2c-and-spi/spi-devices
that's a little too high level, only covering the software aspects
but it links to ye 'ole wikipedia
so that level of reading
this was my first failed attempt
import board
import digitalio
import busio
from adafruit_bus_device.spi_device import SPIDevice
import time
cs = digitalio.DigitalInOut(board.A5)
cs.direction = digitalio.Direction.OUTPUT
cs.value = True
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
device = SPIDevice(spi, cs, baudrate=5000000, polarity=0, phase=0)
time.sleep(4)
while True:
with device:
cs.value = False
result = bytearray(256)
spi.readinto(result)
cs.value = True
break
nvm that was like 3 or 4th... lol
yep. backup and read about SPI - how it's working under the hood.
i think it will be difficult and frustrating to try to just do it by iterating on software
reading the wiki now
you'll want to really understand what CS/SCK/MOSI/MISO do
read the wiki, the datasheet, and also maybe an existing CP driver for a SPI device
for the mode, the chip im using can do 0 or 3, but the wiki doesnt really tell what "Clock edge
(CKE/NCPHA) " is
it looks like it's just the terminology for clock and phase for a specific microcontroller
so, typical datasheet fun, you've already found that good bit of info - "Both SPI bus mode 0 and 3 are supported"
the next question is how the chip gets set to one or the other....hopefully it's in the datasheet somewhere...maybe inferred from the diagrams....buried in a footer note....google for errata...??? etc.
however it works, just use mode 0
and what the datasheet is calling "Standard SPI"
datasheet references the HOLD# and WP# pins alot i think i need to wire that to like board.A4 and board.A3?
currently board.A5 is my cs
@upbeat plover the interaction with that chip looks a lot like the FRAM chip I just dealt with. HOLD and WP aren't required, from what I can see.
i was looking at the "block diagram" it looks like nothing can be done without the "write control logic"
im very new to this so im probably mistaken
wow, might take a bit to look through that
it will, but you've got good info to go on
a combination of general info like the wiki page to understand SPI + the specifics in the datasheet to understand your device + examples like above for helpful reference
yeah thanks for info guys
@prime flower I see you're working on TinyLoRa
@idle owl yep! implementing a bunch of cater's changes
Right on.
cleaning it up and then I was going to ping you re: linting issues,
absolutely, thank you
yep
Yeap, that's the encoding
ty
@tidal kiln Let me know if/when you'd like help deprecating the ADS1x15 Python library. I was pinged to assist.
you wanna just do it?
I've got plenty on my plate. More importantly, it may be a process worth knowing how to do as the plan is to deprecate as many as possible.
ok. maybe later today then.
Whenever works for you is fine, I was going through my list and helping you with that was on it so I pinged.
okie dokie. i'm wading through the forums swamp for a bit. will try and ping you later.
I have to leave for the evening around 1800EST. If we don't get to it today, that's ok.
@idle owl alright, lib. is at a good point to sort out the issues.
@tidal kiln thanks for such a comprehensive review
@prime flower np. i think it was mainly a lot of "make it more pythonic" suggestions.
@prime flower Ok.
Everything is happy with an __init__.py file in the packages directory, correct?
@idle owl yeah (just tested), it removes the no-name-in-module error
@prime flower Out of curiosity, what version of Pylint are you running locally?
2.1.1
that's too bad - i thought it would be happier in 2.1.1
We were postulating that it might be resolved in Pylint 2.x
And still trying to figure out why there are other libs that work fine without an init.py file.
I feel like it's not worth blocking this for us to try to figure this out.
someone like me needs to sit down and figure this out once and for all. https://github.com/adafruit/Adafruit_CircuitPython_Bundle/issues/77 is a good place to discuss this.
Indeed ๐
but i'm not going to do that now
@prime flower Please include the __init__.py file, but include a comment/docstring that explains why it's necessary since we are putting in an effort to move away from it and I'd rather not have someone else come along and go through this whole thing again when we've already done it.
We'll deal with figuring out what is different about your lib another time.
Since it doesn't seem like anything should be ๐
Incl. the docstring inside the __init__.py explaining it?
Yes please
Doesn't have to be super long, but explain that without it pylint fails with the following errors, we should revisit this when we can look into it or something like that
what is the lint error that requires init.py?
no-name-in-module
pylint doesn't seem to realize it's a package
what is the context of the error? is it linting an example
https://stackoverflow.com/questions/48024049/pylint-raises-error-if-directory-doesnt-contain-init-py-file especially see last answer
According to pydocs (3.7.1), packages still require an __init__.py to treat directories as a package. https://docs.python.org/3/tutorial/modules.html#packages
Hey guys, question for ya.
I'm playing some WAV files when my Circuit Playground is tapped. But it's occasionally throwing a memory allocation error.
Do I need to some how... free the old objects or close the previous file... ? before playing a new WAV file? Each file can play at least once... but occasionally, when the played file changes, it's crashing.
@raven canopy ah, that makes sense. if you have subdirectories then you need an init.py
@finite coral how are you playing the file?
@slender iron
audio = audioio.AudioOut(board.A0)
wave = 0
def play_file_two(filename):
global wave
global currentlyLoadedFilename
print("Playing sound: " + filename)
# the requested filename is different from the previous one,
# so open the file and play
if currentlyLoadedFilename != filename:
wave_file = open(filename, "rb")
wave = audioio.WaveFile(wave_file)
currentlyLoadedFilename = filename
audio.play(wave)
# the requested filename is the same as the last one,
# so don't reload the WAV file if it is already open
else:
audio.play(wave)
I kinda hacked apart some of the sample code.
Detecting a tap calls this function. But only if the audio isn't currently playing.
@idle owl with travis passing, OK to merge into master? Git's site alerts me that squash and merge is not enabled for this repository
we don't do squashes any more, so merge is fine
about no squash? we stopped doing squashes more than a year ago (starting on the circuitpython repo). If it's still enabled on some repos that's left over
maybe still enabled on some of the arduino libs ive worked on.. ๐คท
We haven't disabled it for Arduino. It's a CircuitPython specific thing
@prime flower Do you want me to merge it?
that'd be great, thank you
we decided it wasn't worth it for commit "cleanliness". the commits show a good history of the dev process; we don't really need to hide the intermediate steps.
We strive for transparency and it can be a great learning experience for others.
@prime flower Done.
Thanks!
Hi everyone, I'm new to CircuitPython, and I had a question about the libraries. I'm using the INA219 library, and noticed that the chip has more features than are implemented in the library (power register, etc). Were these not implemented intentionally to save space? Or has no one gotten around to it? (If the latter, I hope to help out by implementing those)
@slender iron
Hmm... welp, I didn't find the problem, but I think I found a solution.
Before playing a new WAV file, I call audio.deinit(), immediately followed by gc.collect() to free up some memory manually. ยฏ_(ใ)_/ยฏ
@vague folio I'm betting it's that no one has gotten around to it.
@vague folio the CircuitPython library usually takes its lead from the earlier Arduino library -- not sure what was done in this case.
@idle owl Ok, good to know. So just to double check, if I were to update the library to implement all the features of the chip, that would be ok? (I will be needing help to navigate the github process, but that's another topic)
@tulip sleet Also good to know. I also can update the arduino/c library, as I'm going to be using that as well. Does that work?
@vague folio That would be great! We have design guidelines and so on to follow. And as for Git and GitHub, I wrote a guide on that process, so you can check that out as a place to start. https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/overview
@finite coral I'm glad you sorted it out
@idle owl Thanks for the link. If you don't mind, could I reach out to you directly if I have any questions with that?
(I apologize to those other users starting with Katt*. Turns out I should check my mentions before hitting enter.)
Absolutely. But there are also many people here who can answer questions too. ๐
If I'm around, I'm happy to help
ok cool, will do
@slender iron We have a number of libraries that have packages that do not require an __init__.py file. That's why we were looking into it. We'll deal with it when we have more time to look into what the deal is.
@idle owl created a branch for pypi, going to submit a PR, can I tag you for reviewing?
@prime flower Yes please
@idle owl ya, seems like its inconsistent when its needed and we should just add them
There was discussion that concluded we shouldn't use them.
ยฏ_(ใ)_/ยฏ
There's already an issue open for it. We'll sort it when we get to it.
i'm confused by the pointer to the 3.7.1 doc that says they're needed, cause Python 3 started making them optional. I need to sort all this out.
@tulip sleet I was confused as well, especially since your aforementioned statement of "3.x optional".
the optional thing comes from this: https://www.python.org/dev/peps/pep-0420/
and it seems having init.py leads to more predictable behavior
lmao
@idle owl This initial release would be v1.0.0, correct?
(not sure if the travis config would be ok with pre-release versions for verifying)
@prime flower Sure. Or if you feel like it's not entirely done yet, or you know there are more features to be added you can start at 0.x.0. Version numbers are free, so you can choose what you think makes the most sense.
@prime flower in case you haven't read yet:
https://semver.org/
i don't think it answers the question of what the initial number should be, but does explain what the 3 digits are for
thanks for the link, I just wasn't sure if travis would release differently if I didn't do a 1.0.0
No, it doesn't care, it simply wants a release.
@prime flower Travis failed on auth info for PyPI deployment.
just saw that...I manually typed in the password too after it prompted me
Any tips for improving NeoPixel animation speeds?
When I change the value of all 10 NeoPixels on the CircuitPlayground express, it takes about 250ms.
This is with my neopixel.NeoPixel() initializer with auto_write set to False.
Conversly, only setting a single NeoPixel is pretty darn fast.
ok thanks for your comments!
@dhalbert so do you mean to change the behavior of the timer initialization >6MHz to create a 50% duty-cycle?
i don't know if the voltage drop comes from my meassurement mistakes/ my osiliscope or eventually from some not 50% dutycycle?!
anyone an idea how i can test this more?
or do you think it is just good leaving 6MHz max, adding the 'magic number' fix and a comment (similar to what i have done currently)?
@prime flower What I've been doing when something like this happens is deleting the release, deleting the tag, and starting fresh.
@prime flower There's a process to do this though.
oh jeez that @ came in right as I was doing a release
Heh ok. That's fine.
Please include this entire section in every release, @prime flower: ```To use in CircuitPython, download the .mpy file and copy it to the lib folder on the CIRCUITPY drive. Or, simply install the Adafruit CircuitPython bundle.
To use in CPython, pip install adafruit-circuitpython-<libname>.
Read the docs for info on how to use it.```
Also apparently you didn't update the libname part. I pasted that out of the initial release.
yeah, I saw that
added the entire section to my notes on this
didnt deploy again...invalid option "--api_key="
I looked at it, it passed....
the tagged build?
shows failed on my other tab...weird
Travis can be weird with updating to a new build sometimes.
ok, great. Just exported my notes on the process to dropbox. thanks for the help
busio.UARTreads could not be interrupted by ctrl-C. Fixes #1374.- pin claiming logic on nrf
busio.UARTwas wrong. - Feather nRF52840 Express named UART pins
board.TXDand.RXDby mistake. Changed to.TXand.RXfor consistency with other Adafruit boards.
@prime flower At some point we need to figure out why you can't encrypt the password successfully or you'll always need someone to fix it, or need someone else to do the entire process. Right now isn't great, but we should probably keep it on our radar.
I agree, I'd like to know why it isn't encrypting either..
are the instructions for building the bundle still valid? I can't seem to find build-bundle.py in the current repo
I don't run that. I do the submodule add only. I commit, push, and then verify in the PR that I've only updated .gitmodules and added module at point <hash>.
I didn't even know about that step.
@s-light what is the spec'd bandwidth of your oscilloscope? (Or, what model is it?) If you are looking at the waveforms and they look more like sine waves than square waves (of some width), then the limited bandwidth of the scope may be giving incorrect peak-to-peak results.
As the frequency increases, the duty cycle granularity will increase. At some point only 0, 50%, and 100% will be possible. 6 MHz may or may not have been an exact calculation: it may have just been "that's a good uppe...
@tulip sleet want to wait for a ladyada review before merging your UART PR?
@slender iron I did test it. You can go ahead and merge and that will give a good build for her to test more thoroughly. thanks!
kk
@prime flower Congratulations on the TinyLoRa release!! Woo Hoo! I just ran a quick test on my RaspBerry Pi -- wroked fine with one samll detail. the ttn_*.py files are not "installed" by pip3 -- should they have been? -- I had to copy them to the local folder. No big deal, but just a surprise.
sorry -- they are installed but my system did not find them -- may be something on my end --
@solar whale They should have been...was the encryption file included as well?
might be an issue with the setup.py not sourcing them?
yes - they are there --trying to figure out why python could not find them.. It worked fine when I copied just them into my folder --
have you treid it on a RPi?
not yet
OK -- It may be my problem -- I'll keep looking -- Nice job!!
thanks. it;s probably that line of setup, though. i cant think of anywhere else where those files would be imported.