#circuitpython-dev
1 messages ยท Page 195 of 1
so it won't actually decode the file
So... copying the bmp folder over successfully loads a BMP file (yay)
But displayio is not in the build
I can't setup the build env on this machine so I might be done for the night ๐
So, the latest build (en_US-20180910-9ace50a) doesn't seem to have this displayio in it. I'm OK with waiting on this, but is there a way to kick off a Travis build?
Is the inline assembler available in circuit python port?
@high oracle nope. too advanced for what we're going for
Thanks @slender iron
np
Per @tannewt and @ATMakersBill's Discord Chat, loading multiple image files will be needed by many scenarios.
Right now, loadimage() allocates the pallete and bitmap objects for each file load. At best this means that the user will need to delete the bitmap object (which scales with widthXheight) before loading the next image. That will cause memory fragmentation depending on Python's memory management.
Scott is looking at reading directly from files to the Display's screenbuffer, ...
FYI I did get one image loaded ๐
Yes, the datasheet is not clear about this, but it controls how the pixels are written by the memory write commands, not how they are sent to the display. At least that's what I figured out with my experiments, I might remember it wrong, it was a year ago.
Actually, that wasn't PTLAR. PTLAR is for only using a part of the display (for example, when the rest is covered by the bezel).
Hello,
I'm using a Trinket M0 with CircuitPython to run a virtual mouse and it works great.
But is there a way to not mount the Trinket as a USB storage device? (presumably a different bootloader?)
Use case: I'm happy with my CircuitPython code and I don't anticipate changing it and I want to use my device as strictly a plug-n-play and not have it do anything besides the virtual mouse functions.
of course it's not out of the question that I would eventually want to change my code so I'm guessing I can just reload the normal boot loader, test with the mass storage device as normal and then switch back.
@high sluice I'm not sure if there is a flag to not mount CIRCUITPY on the bootloader: https://github.com/adafruit/uf2-samdx1
thanks for the link. ๐
@CBMalloch how is the light beam being interfaced to the microcontroller? We may be able to add a C helper for it.
It's highly unlikely we'll ever allow for predictable timing in Python execution. There are too many critical things happening around the VM to do it.
@dhalbert Increasing works for me. Its possible this is the error when the parse stack runs out of space since it's not actively running python code.
@high sluice I don't think you want a new bootloader. That only controls the *BOOT drive. I think you want this: https://github.com/adafruit/circuitpython/issues/1015
A couple of forum posts recently have asked if HID or MSC could be disabled for security or device interference reasons. We need some kind of dynamic USB descriptors to do this. https://forums.adaf...
This would be helpful in some of our projects as well. One way I could see this working is to check for the presence (or absence) of a file or config option in the BOOT filesystem. So, when CP's UF2 is loaded, it checks for that file (maybe a config file?) and checked which USB descriptors to present.
This would make it possible to enter the bootloader mode, tell it to not share the mass storage device or the HID (or the Serial port?) and restart. If you ever wanted to change that, just...
After an evening of thinking about it, I think this is the only way to do the "load any image" approach.... and it really needs to be memory aware (like only having a single scan-line buffer and everything else static).
The idea I had was to control the descriptors from boot.py which runs before usb enumeration.
Where does that live? On the BOOT drive or on the CIRCUITPY drive? How does a user edit it?
@slender iron yes, that seems to be what I want.
are there any numbers on how long a pin toggle takes in cp? Say something like somepin.value = True; somepin.value = False; somepin.value = True --how long does the pin actually stay false/low in milliseconds or microseconds
I can measure it later of course
on an m0, I figure the m4 will be faster because m4
@ruby lake I'm afraid this can change from version to version and from device to device
if you need to toggle pins fast, use the pulseio module
or busio
@timber mango it is not time-critical for me, I am just curious
I know the duration is fine for latching a regiter
~register
in the Mu 1.0.0 enviroment I am using Circuit Playground express. and Crtl-d nor Crtl-c are working after I save the program
In my (limited) experience, something (possibly out of memory) has made your app go south. If you reset does it come back?
@arctic heron If i shut down Mu and restart it works for 1 time
Sounds like something in there is hanging. I'd start by commenting out some and trying to narrow down what is killing it. Or, you could try REPL to execute some of the statements individually
And lots of print of course ๐
66a7e45 PWMOut was not claming channels on shared TCCs - dhalbert
Fixes #1106.
@deshipu - you may want to test this. I did try a test case similar to yours. The code was allocating the same TCC channel to multiple pins. This means that you may run out of timers earlier previously, because we were allocating the same TCC and channel to multiple pins by accident.
f289863 bump gcc-arm-embedded to 7-2018q2 to save flash... - dhalbert
Some builds didn't fit any more by a tiny amount, so I bumped the compiler up to the version I was already using anyway.
Didn't mean to do a PR from adafruit/circuitpython. I had to reclone and recloned from adafruit/ instead of dhalbert/
So... my trinket's Dotstar just suddenly switched from RGB to GBR? Is that like a thing?
Actually it's BGR... I'm quite confused. This was just working
This is bizarre - This code comes up RED # Used if we do HID output, see below
One pixel connected internally!
dot = dotstar.DotStar(APA102_MOSI, APA102_SCK, 1, brightness=0.8)
RED = (255, 0, 0)
YELLOW = (255, 150, 0)
ORANGE = (255, 40, 0)
GREEN = (0, 255, 0)
TEAL = (0, 255, 120)
CYAN = (0, 255, 255)
BLUE = (0, 0, 255)
PURPLE = (180, 0, 255)
MAGENTA = (255, 0, 20)
WHITE = (255, 255, 255)
dot.fill(BLUE)
dot.show()
while True:
time.sleep(1)
I honestly think I have a bum Trinket M0
This is the direction I was leaning in my "investigation" as well. In that since an existing TCC set at the desired frequency was looked for and used, any subsequent changes to it applied to all latched pins. I had stopped short of digging into the channel aspects before doing some domestics. Nice work @dhalbert!
Ok, I found the problem... it's a problem with the examples in the Learning System. https://learn.adafruit.com/mini-pinball-table-with-gemma-m0/code-the-gemma-m0-with-circuitpython
MOSI and SCK are reversed in the example - which leads the DotStar to go nuts
Where do I enter issues for the examples?
@tough flax since those code examples are not hosted on GitHub, i would use the Feedback? Corrections? link on the left side of the guide.
I created an issue https://github.com/adafruit/Adafruit_Learning_System_Guides/issues/327
I figure there's a project or the learning system guides, so that is where it should live
@slender iron working the meeting notes. i made these requested changes a while back, but forgot to ping you for a re-review and/or merge: https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/pull/1
The thing is I'm really not sure I copied that code... I think it might have been on the Trinket when I opened it. - I wish I had copied the code as it was
Has anyone recorded (and played) audio with a CPX?
e.g. produced a .wav or equivalent file. I'm getting some weird results
CIRCUITPY just like code.py. You can edit it the same way but it won't be rerun automatically. Instead, one needs to eject the drive and then reset the board (using the button or unplugging).
I understand how that would be helpful for the HID descriptors, etc. But shouldn't the Mass Storage descriptor be controllable by something not on that drive?
@umbral dagger hey hey im checkin your guide
would it be possible to get a gif of your or a friend wearing them and tiling your head?
@meager fog Sure thing
@meager fog Where are you thinking of putting it?
@meager fog I replaced the one at the top of the overview page. Let me know if that's good or you want it as the thumbnail instead/as well.
usb_write() was only using 8 bits to represent buffer length. If buffer was larger, length would be wrong.
Fixes #1181, and might fix some other mysterious USB output bugs.
- Cherry-pick 02b3f62 UART timeout zero fix from
masterto3.x. - Add
UART.in_waiting-- characters in buffer waiting to be read (duplicating PySerial API) - Add
UART.reset_input_buffer()-- clear input buffer, discarding unread characters (PySerial API) - Remove unused fields in
UARTobject. - Clear
board.{UART,SPI,I2C}singletons on soft reset. Previously a ctrl-D wouldn't clear these objects, and trying to create them again and use them would cause a crash. - Clean up `#if...
awesome. do you want me to test with hardware tonite?
@slender iron hmm sphinx in travis is now 1.8.0, was 1.7.7, and the docs build is failing. will investigate. Might just force the version if necessary
on it ๐ can merge anyway
nrf is failing for the other build
yeah, I forgot there were nrf builds in 3.x; i did do esp8266
have to add one routine
yup yup, no problem
Also, renamed Sprite's palette to pixel_shader so it can be
anything that produces colors based on values (including color values).
Added a ColorConverter that converts RGB888 (found in bitmaps) to
RGB565 for the display.
Fixes #1182
@tidal kiln HT16K33 merged. I'll leave the LSM9x PR reviews/merges for @idle owl, so that she can update the learn guides at the same time.
@raven canopy saw that. thanks! one more HT16K33 PR coming in about a minute. ๐
๐ ๐
@tidal kiln i don't have a segment to test...i'm assuming you did though?
yep
yah. it's been slow today.
Hello all
I have a quick question; hopefully this is the right place... I'm using Mu Editor on Raspberry Pi to control my Circuit Playground Express... I don't see a Plotter button on my Mu Editor, is it because I'm using the Raspberry Pi or what? I have Mu Editor 1.0.0-1~rpt1 (if this helps)
@raven canopy thanks!
is there a function in circuit python for the cpx for it to detect a sudden stop in acceleration?
Thank you all for you help this week!
Well, I got my answer, it's def due to PyQtChart not on Raspberry Pi, sigh, that's a bit sad
@charred lake bummer. but that's what i'd figure also.
@acoustic pollen there's shake detect that might work
@cater Yeah, I did some research reading through github after some frustration. Hopefully PyQtChart can be added in the future to Raspberry Pi. Perhaps there's a workaround, I shall try to find one.
My Feather M4 just arrived. I'm always a little shocked at how small these things are. ๐
Nice! Always exciting to get a new toy
hah, well THAT will do it. My MIDICV shield thinks SPI is in "arduino position" on the headers.
this being a metro m0
Initialize self->needs_refresh in common_hal_displayio_group_construct() ?
(or are you depending on it starting as zero?)
@tidal kiln HAHA! I got the Plotter (on Mu Editor) to work on Raspberry Pi!!! Yeeehaaaawwww - After hours and hours of research.
@charred lake nice! was there an issue in the mu repo for that? you should post how you solved it.
@tidal kiln I can't take full credit for it, but I can help facilitate where to find the solution (and what NOT to do). It has nothing to do with the mu repo though; it's just that Raspberry Pi doesn't have PyQtChart nor any packages of it for an easy install. So you have to install a few dev packages and manually compile/build a few others to get it to work.
You also have to make sure you build SIP 4.18.1 and not any other version (doesn't work with any newer versions)
That's a small price to pay, I'm so happy Plotter is now working on my Raspberry Pi!
ok, so the question becomes, can I use digital pins D11 and D13 as MOSI and SCK and have circuitpython form a hardware SPI port on them?
(on the Metro M0 Express)
@ruby lake looking at the mux real quick...
@ruby lake they both have SERCOM available, so you should be fine.
@raven canopy yeah it runs a but better now using the D11/D13 SPI ๐
~bit
there are still a couple glitches but I'll sort those out
It is still work in progress but current code works with 8 MB MX25R6435F on pca10056. The read speed is ok, but the write is painfully slow (will improve later). I would like to have as many review/suggestion as possible.
- added
flash_apidirectory and move all the flash there - flash_api.c implement generic read/write blocks API with page caching along with python glueing.
- flash_api use flash_hal_erase/read/program which are implemented by internal or qspi flash.
- flash hal will...
the awful write speed really need some improvement !!

im also using the nrf52832 with the STMPE610 . i can read the ID but im getting no data from the registers.
anyone had this problem?
Are you using the latest version of the stmpe610 library - the default baud rate was changed to 1MHz. Can you post and example of the code you are using?
i think im using the last version , yes the baud is 1M
here is the example of the init:
void _SMTPE610_init(void)
{
uint8_t d ;
ts_hardware_init();
writeRegister8(SYS_CTRL1, SYS_CTRL1_RESET); // 0x03 / 0x02
for ( d=0; d<65; d++)
{
readRegister8(d);
}
writeRegister8(SYS_CTRL2, 0x00); // Enable TSC and ADC Blocks
writeRegister8(TSC_CTRL, 0x04); // X, Y mode
writeRegister8(TSC_CTRL, 0x05); // Enable Device, No tracking index,...
ah - you are using the Arduino IDE -- My experience has been with the CircuitPython Library. I have used it on an nrf52832 with CircuitPython.
Ah - sorry --- Still , the discussion above was with respect to the CircuitPython implementation.
I really am not sure what your code is doing and what you mean by
i can read the ID but im getting no data from the registers.
does readregister8(d) -- display the value?
yes im getting some values . but its the initialization
Are you using the SPI or I2C interface? The SPI can be tricky since it can sometime use either clock edge when it initializes. the the cod in the Arduino Library detects this and switches modes:
see https://github.com/adafruit/Adafruit_STMPE610/blob/master/Adafruit_STMPE610.cpp
I'm not sure if that is related to your problem or not. - You may want to post your questions to that repository to see if anyone has any suggestions.
Howdy, I'm Drew Fustini, the maintainer of Adafruit_BBIO and @meager fog suggested I look at getting CircuitPython drivers to work on the BeagleBone, similar to the work that has been done for Raspberry Pi.
Added a to-do list to initial comment. UART.in_waiting and UART.reset_input_buffer() implemented by #1186.
Adds some features requested in #1128.
using SPI. im controlling the SS so data is control. since im getting the correct data (ID and VER) i guess that the SPI is correct. am i wrong?
Agreed, If you can read the ID then it is not clear why you can't read other registers. I'm not sure what else to suggest.
I suggest posting this in the Adafruit Forums https://forums.adafruit.com/viewforum.php?f=19
From what you have posted, it is still not completely clear to me what is not working. Can you post an example of the code that is not working?
@fierce girder Great! Have at it and let us know how we can help.
Thanks!
@slender iron I have prepared release notes and a blog post for 3.0.2 and will await Limor's final testing. Also will merge 3.x changes into master when it's cooked.
sounds good @tulip sleet !
@ruby lake for D11/D12/D13 yes i think i put them purposefully on a SPI sercom
@fierce girder hiii
im here!
welcome @fierce girder !
thanks for comin' by
i have to get my BBB going
im a bit under the weathe today, but i dont expect bumpy codin'
wanna start by forkin blinka?
Write speed isn't critical to using CircuitPython. Yes, it'd be nice if it was faster but let's ignore it for now and focus on getting all of the APIs going.
I suggest filing a separate issue for it for the full 4.0.0 release milestone and moving onto other tasks for now.
Sorry to hear you aren't feeling well.
Do you mean fork this repo?
https://github.com/adafruit/circuitpython
nope
this one ๐
@meager fog Yeah it works much better now ๐
yeah i also put an i2c sercom on a4/a5
mabye thats the m4 metro tho
m0 i stuck to zero compat
drew, is there a quickstart for upgrading to latest
like 'sudo apt-get upgrade'?
@meager fog I would recommend grabbing latest image from http://beagleboard.org/latest-images
Debian 9.5 2018-08-30 4GB SD IoT
Earlier this we made the change to handling device tree overlays in the bootloader
np ok will burn this to a 4GB card and stick into tf slot
This simplified many ways in which users interact with the pin modes and peripherals
ok cool
Yes, I usually run from microSD, instead of eMMC, as I'm always updating to our weekly bb.org snapshot images
Yes, forked https://github.com/pdp7/Adafruit_Blinka
gr8
now git clone that to your BBB
im behind ya cause im still burning this SD
is there an easy way to set up samba for editng on desktop
(i know how to do it on pi, but maybe BBB has something more elegant)
I'm not too familiar... I've always just edited in vim via ssh
@meager fog you will need to update the bootloader on the eMMC
https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
Can you boot the BeagleBone from eMMC while you waiting for the flashing SD card?
Run this /opt/scripts/tools/developers/update_bootloader.sh
The reason is that the SoC ROM bootloader looks at eMMC first. If you have a pre 2018 uboot on your eMMC, then it will cause uboot overlays not to work
Despite the fact that a new image is on the microSD card
The alternative is once booted from the new SD card, you could run dd to erase the bootloader partition on the eMMC. The SoC ROM bootloader will then skip the eMMC uboot and go directly to microSD uboot and uboot overlays will work OK.
Fyi, when running from SD, this erases the eMMC's version of u-boot:
sudo dd if=/dev/zero of=/dev/mmcblk1 bs=1M count=10
ok well its been a while so ill just do whacha recommend
Are you 100% sure, on selecting [am335x_evm] (y/n)? y
-----------------------------
log: dd if=/tmp/tmp.HcSbEPex7d/dl/MLO-am335x_evm-v2018.09-r2 of=/dev/mmcblk0 seek=1 bs=128k
0+1 records in
0+1 records out
90932 bytes (91 kB) copied, 0.00391849 s, 23.2 MB/s
log: dd if=/tmp/tmp.HcSbEPex7d/dl/u-boot-am335x_evm-v2018.09-r2.img of=/dev/mmcblk0 seek=1 bs=384k
1+1 records in
1+1 records out
447372 bytes (447 kB) copied, 0.0182809 s, 24.5 MB/s
-----------------------------
Bootloader Updated
Bootloader Recovery Complete
ok done reboot with uSD in slot?
@tannewt phew, I am trying to increase usb msc buffer size to 8KB but it doesn't help as well. probably need to dive deeper into the flash datasheet timing etc ... I will try to wrap it up now.
What would be the best way to discuss a proposal to add write_timeout to UART? An issue?
@meager fog yes reboot with uSD
After reboot, run:
/opt/scripts/tools/version.sh
@arctic heron yes please! we have a 'uart 4.0' issue
thats a good place ๐
drew - waitin for usb enumeration...
Alright. How to implement it is straightforward enough (follow pySerial, mostly), but how to make it not break current implementations who are thinking the write_timeout will be the same as the read timeout is the trick. I'll try to write something up with a proposal
paul, thanks - we did just add two new UART elements
in_waiting (inbuffer size) and reset_input() (clear input buffer)
if you wanna try em!
Yah, I say that. in_waiting makes sharing code with pySerial a lot easier, and allows non-0 timeouts on read, which can alleviate the problem of no seperate timeout for write
@fierce girder hmm i see a COM port but connecting no longer gives me login
@arctic heron Pick a ...2dd9407... build from here: https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin
@meager fog do you have an FTDI Cable handy?
yah
@arctic heron branch is 3.x
@meager fog pins https://elinux.org/Beagleboard:BeagleBone_Black_Serial
ok i need a pinmap now
If it is a problem with eMMC, then holding down the USER BOOT push button will force the SoC ROM bootloader to look only at uSD
If it is problem with uSD, then the serial console should provide some hints
oh wait theres an ftdi slot
ok hold on
no errors i can see
debian@beaglebone:~$ uname -a
Linux beaglebone 4.14.67-ti-r73 #1 SMP PREEMPT Thu Aug 30 00:08:52 UTC 2018 armv
๐คท
but im logged in so whoc ares
Please run After reboot, run:
/opt/scripts/tools/version.sh
oh hold on
i started installing samba
yah im on ether
root@beaglebone:/home/debian# /opt/scripts/tools/version.sh
git:/opt/scripts/:[73593ebe3b7d3cc381eeb502d45ccb33a6ec5e78]
eeprom:[A335BNLT00C01618BBBK17E0]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-08-30]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.67-ti-r73]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20180803.0-0rcnee0~stretch+20180804]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.2-git20180829.0-0rcnee0~stretch+20180830]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.099695] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.111742] gpio-of-helper ocp:cape-universal: ready
END
@tulip sleet you ok reviewing #1188?
I am reviewing some of it but if you could look at the QSPI-specifc stuff given your experience that would be great.
looks like most of it was copied over
yeah, so maybe just qspi_flash.c, which is the actual impl
@fierce girder ok made a new 'bone' account, set up samba
im ready (finally) to code!
oh wait we gotta setup python3
@tulip sleet I take it back. its not copied ๐ฆ
does anyone know if there has been any effort to do something like FadeCandy/FastLED style dithering and/or general led animation helpers for CP?
@pastel panther in C or in Python?
In C presumably
https://github.com/adafruit/circuitpython/pull/943 (pixelbuf) is ongoing but not done
python would be a good starting point but I imagine it would cap out fairly fast
that's at a lower level, but functionality could be added there
Cool I thought that might be a good foundation
Ok thanks
er instead of /home/pi put whatever
so that you at least get this
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import digitalio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/bone/Adafruit_Blinka/src/digitalio.py", line 10, in <module>
from adafruit_blinka.agnostic import board_id
File "/home/bone/Adafruit_Blinka/src/adafruit_blinka/agnostic/__init__.py", line 23, in <module>
from Adafruit_GPIO import Platform
ImportError: No module named 'Adafruit_GPIO'
when you try to import digitalio
Should be possible to install Adafruit GPIO from pip
Though I usually install from the repo since I'm doing development
Just an oversight. I've added it to displayio_group_construct. Thanks!
@hathach We'd like to make this implementation be as similar as possible to the atmel-samd QSPI and external flash implementation, so that we can factor out the common code as much as possible and only implement the lowest level routines in a chip-specific way. For instance, that code has parameterized chip support, and it already has caching logic. Did you try copying that impl? This impl is more different than we thought it would be.
drew, now you can run https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/digital-i-o#blinky-time-3-16
and see it breaks
I think its ok. You can change files through the REPL or use the REPL to reboot to safe mode which skips all user code.
A common technique for the similar problem of flipping read-only for the file system is to read an external line connected to a switch to determine whether to do it or not on boot.
ok heres code to detect BBB
@fierce girder lets add LEDs first
and any user buttons
whats the user led/button pin names
pins arent indicated by number right, just by string name>?
@fierce girder you around still?
ok well ping me when you're back
Got disconnected. Back
The pins names are normally refered to by header and pin number
Such as P8 or P9 header, and pins 1-46
@dhalbert many of the spi std command for flash is handled by nrfx qspi driver. Since nrf52840 has enough memory (4K) to cache the whole page. I just refactor both caching for internal + external flash giving it to only basic hal erase, read, program. At anywhere you could use block API flash_read_blocks/flash_write_blocks instead of internal/external_flash_write_blocks. The flash_ will use either internal or external depending on the config. Those can be changed to function pointer for conc...
@meager fog for example, P9_12 is by default set to GPIO mode
What actually happens though, is there a mapping to the gpio pin number in Linux GPIO subsystem
ok cool
im back too! with ๐ต!
ok for now we'll use PX_XX notation
raspi has 'bcm names' which are the underlying gpio #'s
ok so almost ready for first tests, what method should we use for GPIO togglin
like what python library/binding is best
in python plz ๐
Has the mapping to GPIO from the perspective of Linux
Yes, Adafruit_BBIO.GPIO uses those mappings
For example
import Adafruit_BBIO.GPIO as GPIO GPIO.setup("P9_12", GPIO.OUT) GPIO.output("P9_12", GPIO.HIGH)
invalid permz
do i have to be root? is there a way to add me to the group for gpio access
No, with newer kernels, udev works
ok hit me with the udev
Talking about Beagle Boards, I need to get around to repairing mine, I fried it ๐
You run that as a standalone program and what was the output?
ValueError: Set gpio direction failed, missing file or invalid permissions.
Can you try running with sudo to determine that it is in fact permission
ok
so debian@beaglebone:~$ strace -e file -f python gpio.py 2>&1 | grep /gpio/
access("/sys/class/gpio/gpio60", R_OK|W_OK|X_OK) = -1 ENOENT (No such file or directory)
open("/sys/class/gpio/export", O_WRONLY) = 3
open("/sys/class/gpio/gpio60/direction", O_WRONLY) = 3
open("/sys/class/gpio/gpio60/value", O_WRONLY) = 3
open("/sys/class/gpio/gpio60/value", O_WRONLY) = 3
open("/sys/class/gpio/unexport", O_WRONLY) = 3
nope nothin comes up
do you have this?
debian@beaglebone:~$ ls -ltar /sys/class/gpio/export
-rw-rw---- 1 root gpio 4096 Sep 10 04:21 /sys/class/gpio/export
yah
debian@beaglebone:~$ id debian
uid=1000(debian) gid=1000(debian) groups=1000(debian),4(adm),15(kmem),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),100(users),101(systemd-journal),108(i2c),111(bluetooth),112(netdev),115(cloud9ide),999(gpio),998(pwm),997(eqep),996(admin),995(spi),994(tisdk),993(weston-launch),992(xenomai)
so that is in group gpio
im user bone
so that is why the debian user is able to do it
ah... did you create a new accout?
I shoulda brought my BBB to work so I could play along ๐
it helps me find problems, like this one
totally
so new user accounts would probably want to be in the same groups
that is not what other people do
i have to be in the soul of someone who does not follow the default path
sure
gr8 added to guide instructions
thanks
I doubt it is hard for you to get into the soul of someone who does not follow the default path.
it is practice
thats how you write good docs
very zen
you have to be the fool that makes things foolproof ๐
@fierce girder much progress, ok are there any gpio connected to LEDs i can toggle
I find for experienced devs understanding the default path is often harder.
other important groups
debian@beaglebone:~$ ls -latr /sys/class/pwm/pwmchip0/export
-rw-rw---- 1 root pwm 4096 Jan 1 2000 /sys/class/pwm/pwmchip0/export
debian@beaglebone:~$ ls -latr /dev/i2c* |head -1
crw-rw---- 1 root i2c 89, 0 Sep 10 04:21 /dev/i2c-0
debian@beaglebone:~$ ls -latr /dev/spidev* |head -1
crw-rw---- 1 root spi 153, 0 Sep 10 04:21 /dev/spidev1.1
ok will do those too!
gpio, pwm, i2c, spi
gr8 added to my list
oh, hi Drew!
GPIO.output("USR%d" % i, GPIO.HIGH)
lovely!
hold on
ill give you test code momentarililily
oh interesting
i cannot set those pins to be inputs?
are they hardcoded somehow?
the USR LED pin?
yah
File "gpio.py", line 4, in <module>
GPIO.setup("USR1", GPIO.IN)
ValueError: Set gpio mode failed, missing file or invalid permissions.
well a USR LED is a hardware circuit
iz a gpio ๐
not on P8/P9
it is controlled with GPIO.setup() and GPIO.output()
but it is a not on the P8/P9 header
there is no way for it to be an import
USR0-3 are LEDs on the beaglebone
it is special case https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/event_gpio.c#L199
so nice to use since built-in to the hardware
but not useful as a true GPIO pin
P9_12 is a good pin to wire up an LED or a button
P9_12 and P9_15 are good to use for examples since default pin mode is GPIO
technically USR0-3 could be abstracted as LEDs
Linux kernel uses LED subsystem for them /sys/class/leds/
i think i will have to add it later
versus
versus the GPIO subsystem (/sys/class/gpio)
but it should check what is the default state required
ok ill skip the USR LEDs
good edge case tho
yes
didnt bump into this one with raspi
can come back to it... Adafruit_BBIO is based on the sematics of RPi.GPIO which is not great (I think the original author [Ben?] would admit to that... it was a just a quick project back in 2012 ๐
the proper abstration for USR0-3 is as LEDs
this is how the Linux kernel treats them
but in the world of Adafruit_BBIO / RPi.GPIO, there was no abstraction for LED
we dont hae to use BBIO
i want to use libgpiod in the long run
since the way gpio is done in linux is a crime
yes, for GPIO, Adafruit_BBIO will need to move to the new character device, and the python bindings for libgpiod make sense to use
although Adafruit_BBIO is a collection of modules beyond just GPIO
The biggest issue potentially with Adafruit_BBIO is basically just a C extensions
is that an acceptable dependency for CircuitPython?
yeah i mean as long as we can pip it
i dont care
we use rpi_ws281x for neopixel support on raspi
and thats really terrible C code
Ultimately, I think Adafruit_BBIO.GPIO should transition to libgpiod bindings. But there is other functionality in Adafruit_BBIO. ADC and PWM being the most important modules after GPIO.
drew - review &ill merge https://github.com/adafruit/Adafruit_Blinka/pull/36/files
will do
i just invited u to the repo
thanks
htne you can fastforward your fork
and try it
then we have to add the GPIO pin name bindings
but thats ez, just a lot on BBB
i2c and spi should just work once we get the names in
nope
thats the code
test
this is the test code
but it wont work until i do the merge
and i cant assign you as s reviewer until you accept the invite
Ok thanks
let me know when you accept it
There is additional logic in the atmel-samd port that isn't in this one because it wasn't started from a copy. For example, the SPI flash chip is detected rather than hard coded. Ideally this logic would be shared but for now it can be copied if that's easier.
Ideally you'd only need to replace the implementations [here](https://github.com/adafruit/circuitpython/blob/master/ports/...
@tannewt ah yeah, I am adding support device lookup table with JEDEC manufacturer and device ID. Instead of using 3 bytes response from 0x9F for manufacture id, memory type and capacity, can we use only 2 bytes response from 0x90 command (manufacture id, device id) ?
@gentle bronze why do it differently than the samd port?
all but the mcu specific stuff
@fierce girder np leme know when you've accepted invite
accepted
nrf got hardware qspi, it doesn't need to do at spi command except for a few for initialization.
I ended up with something 80% like internal_flash
so I just refactor them to have common flash caching for both internal & qspi flash
@fierce girder ok review it & approve if you agree ๐
@gentle bronze I'd rather have one implementation than two even if that means you need to use a lower level nrf api
I don't think you'd need to though
You mean the internal/external _flash_read/write API ?
I would seperate them without issues
@gentle bronze I expected you to copy internal_flash.*, flash_api.* and external_flash into the nrf port, delete the samd specific parts and replace it with nrf. that way we can factor out the common parts later to share between the ports
I would rename the file and exported API, though, the implementation for nrf is much simpler than samd port in this case, we don't really need to have many stub. When refactoring out, we still only reply on API
I realize I was never explicit about that though
yeah, if there is share binding, I would follow that
I'd rather have one more complicated API thats shared than two different APIs even if one is simpler
I want to get to the point where its like shared-bindings but it isn't yet
please make it to share binding, I will know what to follow.
For now, can you copy the files I listed over and not change function definitions? That will make it easier to refactor later
I will keep the following block API
void external_flash_flush(void);
bool external_flash_read_block(uint8_t *dest, uint32_t block);
bool external_flash_write_block(const uint8_t *src, uint32_t block);
void internal_flash_flush(void);
bool internal_flash_read_block(uint8_t *dest, uint32_t block);
bool internal_flash_write_block(const uint8_t *src, uint32_t block);
thats way higher than it needs to be though
lower than that is port specific already
I'm thinking spi_flash_command, spi_flash_read_command etc
https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/external_flash/spi_flash_api.h should be enough
I see a couple minor things that do need to be factored out of external_flash.c
and
@meager fog the hello blinky test works. I have reviewed and approved
but the rest should work
@slender iron I could implement then spi_flash_api.h since it is an abstraction, it would be easy enough.
ok cool!
the external_flash.c is not needed
yes it is
it can be done in much simpler way in nrf port
@fierce girder awesome. ok next up
can you assist in adding all the GPIO?
and testin' em
meanwhile i can look at i2c
@meager fog sure, I will take a look at that
@tannew when you move it to shared, I will change to adapt it. Since many in the external_flash.c already implmented by nrfx driver
@gentle bronze is the point that the actual peripheral is more capable, or is it that the nrfx library is higher level?
the hw prph
@tulip sleet you configure register, it will do the whole read / write data with wren and all the spi level
do you think the slow write is due to the periph or the library or not sure?
it handles all of the write enable stuff
@tulip sleet the write speed may need to enabled high performance mode or something, it is probably flash device specific config. I did benchtest CP on CPX, the write speed is also around 3x kbps
@violet stone ping!
@meager fog pong!
yay
you just need a cute puppy icon
ok grab yer htu21d
and a metro m4
or other m4 board
1 sec
puppy!,!
@tulip sleet @slender iron the nrfx hw prph already done lots of spi cmd level for us. I think we shouldn't implement the lower level spi command based on it, then go one turn around with software !!
SPI command can be useful for generic configuring such as read JEDEC ID etc ..
@slender iron @gentle bronze do you think we might go the other way with spi flash: modify existing atmel-samd Api to be closer to nrf periph, and then implement as necessary in sw for atmel-samd and use nrfx direct for nrf
I have to solder some headers on the HTU21d
kk i wait!
@tulip sleet I have no ideas, didn't work with atmel chip much.
maybe we are missing a slightly higher level api in the current samd impl
@tulip sleet I'm fine reorganizing it later but for now I want it all copied and edited. I don't want them to be different
I think we only need to keep the API clean and clear for all ports.
well i mean that if currently there are say two calls necessary in the atmel api that the nrf can (or must) do in one, then forcing the nrf to do something it shouldn't (or can't?) is weird
it can always ignore incoming commands if it wants
if it wants to manage write enable you can return early from spi_flash_command
that's broken out in atmel, then just skip that for now, but should be commented that we should refactor
and the write-enable calls are no-ops in nrf?
they can be if we want to let the peripheral manage it
later we can reorganize it if we want. but its used for normal spi as well
i don't have a detailed enough picture to have a strong opinion right now. @gentle bronze maybe sleep on this - you are up too late as it is
good night @gentle bronze !
good night!
I don't want to stir up a discussion that has almost certainly beat to death (but before I looked), is there anywhere you would consider a good discussion on a plan -- or plan not to -- merge with micropython?
anywhere -> discussion forum, etc
I just want to read, not have the discussion
we don't have any immediate or medium term plans
and I don't know of where we've discussed it
the projects have different goals
only want to say, nrf hw is currnetly doing higher level API than software in samd port. We should have a higher level software API for both, rather than forcing nrf to follow lower level API
@gentle bronze ultimately yes, i think that's the right solution. with some sleep maybe this will become clearer
I regularly talk with damien and offer to help upstream anything he is interested in merging
@violet stone soldered?
๐ค
@meager fog Just wiring it up
k are you using a metro?
the itsybitsy m4 I just ordered
ok rad, update to latest 3.0 release too!
@meager fog Dragged the .uf2 onto the drive, and reset, but file's still there and boot_out.txt still says 3.0.0-beta.0?
hmm
you dragged onto the ITSYBOOT right?
also check the terminal output for sure
i like Mu because it autodetects the com port
@meager fog K, updated
Download mu as well, though I'm pretty much wedded for life to Atom at this point ๐
i'm hard core hours-a-day pycharm user, still find mu pretty useful. Often use pyCharm with a deployment target which copies to the CPX (etc) and then use MU to tweak and debug
@arctic heron Cool, just firing it up now to have a look
@violet stone ok hav eyou done circuitpython essentials?
Looking through it now
maybe just digitalio and https://learn.adafruit.com/circuitpython-essentials/circuitpython-i2c for now
@meager fog The output should show up in the REPL window post save, right? Not seeing anything.
did you click in repl first?
odd, i see repl carets
if you type in there does it echo?
Sees the sensor
_ pats self on back_
yup
ok try following it lemme knwo if you have q
the guide is good to read when you have time
๐
but the checklist will get you going
once you have the cookiecut and commit
look at the si7021 library
its nearly the same
K ... easy sensor so shouldn't be too complicated
hardest part is getting structure and travis going
Cool, I'll poke at it a bit and ping if my brain explodes
@slender iron hi imma test out the hallowing tft bitmap display code
๐
is latest s3 the latest build?
should be
@slender iron ok got it loaded, next up - is your example sketch with the auto-shuffle somehwere
i found the rtd example
great!
Issue : https://github.com/adafruit/circuitpython/issues/1149
I choose VOLTAGE_MONITOR like the Feather M4 Express, over BATTERY like the Hallowing.
VOLTAGE_MONITOR is longer look less ambiguous to me (for me the BATTERY pin could be the pin where I connect a battery, not the pin to monitor it) but I did not change the hallowing to avoid breaking anything.
I only tested on my Feather M0 Express.
I didn't change the pins of boards I didn't found in the learning system guides.
@fierce girder ok when do you want to have the remaining GPIO added by?
I'm taking care of some Open Hardware Summit badge issues right now, but I will fill in the rest of the GPIO pins this evening. thanks
In all of these, please move this line so it's just under the D_ name of the pin (usually D9), instead of somewhere else (e.g., see D1/TX) example.
It's called BATTERY (inconsistently) on the Hallowing because the board is labeled "BAT".
@fierce girder kk i can test/review once you have a PR!
then we'll do SPI/I2C and others
@slender iron the common_hal_..._configure_... routines don't throw ValueError with a msg when they get a param that won't work. Instead they just return false, and the shared-binding routines throw MP_EIO, which is kinda uninformative. Whaddaya think about throwing more informative msgs? E.g. nrf doesn't support 16-bit SPI, and only supports >8MHz spi on one instance. I could report useful msgs in that case.
not sure if there was a strong reason just to return false vs throw
So my Trinket M0 when I first plug it in the RGB turns green, then orange, then white
but if I use the reset button it turns green and stays green
It went solid green, solid orange, solid white
I think maybe I had a conflicting code.py
one was code - copy.py
@tulip sleet ideally common_hal impls would be micropython free so an error code would be better
we have lots of mp_raise's in common_hal, but mostly in the constructors
ok still doing it, green for about 5 seconds, orange, off, white
ya, thats why I said ideally ๐
not sure why ideally though - i mean, common-hal is for pyhton impl, so not sure the motivation
@rustic nymph what version of CircuitPython are you using?
ideally shared-bindings would handle all of the python stuff. having raises in common-hal makes it harder to use it in the vm
er, outside the vm
that i understand, yes, ok, I'll think about error codes in this case
@rustic nymph does it run fine after pressing reset?
yes
put a time.sleep(1) before kbd=Keyboard()
can you not see the error over serial?
they could, theoretically, but it only happens on power-up not on reset, so hard to connect to repl immediately on pwoer up
still does it with that sleep
I changed it to sleep(15) and its still doing it in the timeframe in the video
is there an ir sensor on the back? I don't see antyhing conencted
which sensor?
I use 4 to power it
OOH
hold on
don't use 4 to power it, use the 3v pin. it's not ready fast enough when you power it via 4. Also, the pin may not provide enough current
then you don't need sleep
you could put a sleep after turning on pin4, but better to power it from 3V
I have this and it still goes white immediately - https://pastebin.com/RVPLbgGF
and the light on the IR receiver never lights up from usb plug in - white
you'd have to put a sleep after powerPin.value = True, and you don't need any of the others. But like I said, use the 3V pin in preference
why after the pin going true?
because you aren't supply any power to the IR sensor until you bring pin D4 high, so it isn't even on, and it probably takes a bit of time to turn on. when you press reset it's already been on so it may recover faster (e.g. if there's a cap on the IR sensor board)
sleep of 5 didnt work
on line 36?
if you go into the repl and type ctrl-C and then type ctrl-D, does it work?
Mu says it cant connect to device on that com port when its white
so press reset and then connect, and then be in the repl
that works
you mean you send stuff to the IR sensor and you get output?
yes
then I'm not sure - what OS?
windows 10
the video of orange and white is hard to interpret. It's green, then orange, then white. Could you describe the sequence with gaps more explicitly? Does it get stuck on white?
i rewired it to use the 3v pin and it still does it
... (good on power) I don't immediately see anything wrong. Maybe comment out the keyboard stuff and just do print's, and see if it still hangs. Possible it's an HID problem.
nope
could you pastebin the code now?
take out the extraneous sleeps, line 2, 33
you still have layout.write() not commented out line 60, 63, etc.
i think you could get rid of the pulses.clear() and pulses.resume(). I don't see those used in examples.
hm, channel outputs still glitchy, I figure I have something broken in the assigner code
if usb power, you might see 5v on sig pin, no? That's not good for the input pin
line 63 is not commented out
@ruby lake what are you working on?
still nothing on fresh plugin
@pastel panther 4-channel MIDICV, it has worked for years (decades?) using C, and assembly fir the Z8 stuff
@ruby lake are you reviving an old project or upgrading it?
@pastel panther Making a CP version
nice; using your module playground board?
@rustic nymph sorry, I'm at a loss now. If you disconnect the SIG line to 3, does it still fail? Trying to figure out if it's code or the sensor.
@tulip sleet I deleted everything in code.py, on fresh plugin the light pulses green a few times then goes white, on reset it stays pulsing green
eventually, doing tests on my Arduino shield first, since I had that laying around
@tulip sleet ive disconnect the sensor entirely at this point
when I make the module playground v2 I will use an 8-channel DAC directly, and get rid of the tdm mux and s/h amps
@rustic nymph and it still fails on power-up? OK that's very helpful.
post the latest version of the code and I'll try it here on another board
@tulip sleet I deleted everything in lib folder, cleared code.py entirely, and it pulses green twice then white on fresh boot
@ruby lake Nice; have you thought about building in an m4 instead of using a feather? I wouldn't mind giving one a go if you're interested.
I might do that at some point
the contents are - .fseventsd (empty), lib (empty), .metadata_never_index, .Trashes, boot_out.txt, code.py
there is code.py but its empty
ok default main.py goes white almost immediately
from there
fresh boot = green, orange, off, white
reset = green
now notepad++ says the file or directory \main.py is corrupt and unreadable
oh, you are using notepad++, that's not a good choice unless you're ejecting after each write. It's doesn't write the file out fully each time
get into the repl, do
import storage
storage.erase_filesystem()
what other editors do you have?
Ill use Mu now
yes, that's safer
ok I did that through Mu
with no main.py it should pulse green when plugged in
if you were making all those edits in Notepad++, you may not have been testing what you thought you were testing. esp pressing reset a lot
windows thinks it knows what's on the drive, but it doesn't write out stuff for 10's of seconds, so what it thinks and what's really on the drive are not the same
see https://learn.adafruit.com/welcome-to-circuitpython/creating-and-editing-code#1-use-an-editor-that-writes-out-the-file-completely-when-you-save-it-6-13 and the paragraphs before that link
so it did pulse after doing the storage.erase
I rebuilt the original file using Mu and saved it, now doing the green, orange, white thing again
with sensor not connected?
correct
ok, drop that file here and I'll try it on my trinket
Ok did storage erase again, pulsing green light
fresh plugin, pulses green a few times then white
with empty filesysteM?
are you running any monitoring programs like AIDA64?
no
what's in boot_out.txt?
Adafruit CircuitPython 3.0.1 on 2018-08-21; Adafruit Trinket M0 with samd21e18
is this on a hub or straight to computer?
straight
when you say "white" you mean pure white, not greenish?
well id saying it has a pink tint?
ok, do you have a micro-USB phone charger or something you can try powering it with, or another non Windows computer?
tried a different cable
did storage.erase_filesystem
pulses green a few times then white again
don't write a main.py, just trying plugging into a power supply or another computer. Shouldn't go white, should pulse green indefinitely. If it goes white on a power supply, I'd say it's a hardware issue
you might try measuring the 3v pin to see if it's 3.3v, but if it is, then something is fried in a weird way
I think its dead
I created a main.py with the while: True pass
did ctrl-c, ctrl-d with no issue
I removed power, plugged it back it and now main.py is {
after erase_filesystem() see if it pulses green indefintely, without a main.py. That means it's waiting in the repl
No it was going to white
ok, that's bad news if empty filesystem and going to white. that should never happen. i'd say just try a power supply to rule out computer, but it doesn't sound good
Thanks for your help Dan, I gotta get to bed here
I have an itsy bitsy I'll try the code on
tested with trellis m4 rev B (purple)
Anyone know how to copy and instance of a custom class in cp? I know it works for lists. I tried .copy() . _ _ _copy _ _ _() .deepcopy() and a bunch of googling. ANY help welcome. thanks either way.
?
@tulip sleet much better. Breadboard compatible! Comes up at 3.3v - running open drain bilnky. Life is good ๐
Yes - nrf52840 "Dongle" - AKA pca10059
ah
nice board for $10 https://www.nordicsemi.com/eng/Products/nRF52840-Dongle
Ultra Low Power Wireless Technology Solutions from Nordic Semiconductor
wow that is really cheap ! (to untrained price ears)
makes it easy to justify getting a few to play with ๐ Still that is the same price as a Raspberry Pi Zero W -- Still amazes me...
apple watches and wear os watches. Whole devices in packages smaller than a wall AC-DC brick !!!!!!! it's so amazing
from banging rocks to ...
Looks good! Only q is would you like to to add the trellis board to .travis.yml and tools/build_adafruit_bins.sh ?
I've decided my hardware is flaky, the 3.3v logic signals can't quite play nice with the 5v mux chip
@tulip sleet the pwm fix didn't get in?
it did! supposed to!
thanks
you scared me ๐
@timber mango i forgot to put it in the release notes. I'll add. I think I wrote it and it got deleted during editng.
@timber mango all updated
any thoughts on the object copying question ?
@marble hornet regular Python has copy.copy and copy.deep_copy. MPy/CPy don't. But in general it's not necessarily obvious whether for any particular attribute in an object you want to copy it or just refer to it. So you may as well just write a .copy method for the class in question.
may i ask how one would do that,? just return the class calling itself with saved inputs for init?
it depends a lot on whether the __init__() method sets all the attributes you want, or whether you want to copy some attributes that are computed or added later.
thanks!
like here's a simple example:
class C:
def __init__(self, x):
self.x = x
self.y = x+2
def set_list(self, l):
self.l = l
def copy(self):
cpy = C(self.x)
cpy.l = self.l.copy()
so the init method sets x and y. Later you can set self.l. When copying, you make a copy of the list so it's not shared (so the two objects can change their own copies independently. But if .l were a tuple, then it's immutable, so you wouldn't need to copy it., etc.
I created a simple virtual die on the micro:bit with MicroPython: https://youtu.be/RsWxPQvKYMw
A demo of a simple program I wrote in MicroPython that turns a BBC Micro:bit into a virtual die. Press either the A or B button on the Micro:bit and it will ...
Adafruit Crickit still out of stock :(
Crickit for Circuit Playground Express
That's pretty cool @wraith tiger
Woo thanks for 3.0.2 @tulip sleet and all contributors!
@meager fog fyi - I have been validating the open hardware summit badges I recently received but will get back to the BeagleBone support in CircuitPython once I know the badges don't need rework ๐ I should be able to get a PR created for all GPIO pins by tomorrow
thanks
good luck!
Man I love CircuitPython!
@charred lake yay! that's the idea. ๐
@raven canopy haha! You guys are epic! ๐
you folks did boocoo work on it. ;)
Simple USB in Atmel Start was plenty for me, and that's a dirt basic implementation (with an example project to work from).
Very clear to me that the ringbuffer in usb.c is in my future. ;)
@timber mango I commend you sir!
Hello, does anyone have a sort of anti-rebound routine for a switch?
while button.value == 1:
the press of a button generates so many hits that passes by my routine
@velvet oasis button debouncing is usually done with delays. the "blocking" method would be to use time.sleep(n) to halt all further execution so that no additional reads are taken. n can usually be around 0.01; adjust as you see fit. example at the top of this learn guide: https://learn.adafruit.com/circuitpython-essentials/circuitpython-digital-in-out
the non-blocking way involves delaying by comparing elapsing time. like so:
import time
interval = 1000
last_execution = time.monotonic()
current_time = last_execution
while True:
current_time = time.monotonic()
if (current_time - interval >= last_execution):
# do that stuff we want to do
last_execution = time.monotonic()
We are hacking with CircuitPlaygrounds and Edublocks at PyCon UK
Niiiiiiiiiiiiiiiiice!
So individual pixels can be read and written.
bitmap[0,0] = 1
I tried to enable high performance bit but couldn't get it written any faster. It is probably default mode already. Note: nrf52 SCK clock speed is only up to 32 Mhz.

I post an issue on Nordic devzone to see if there is anyone got more lucky than us.
https://devzone.nordicsemi.com/f/nordic-q-a/38570/write-speed-with-mx25r6435f-on-nrf52840dk
hey so im having a bit of trouble with my neopixels
ive hand-soldered some on to a board of mine and im not sure if ive managed to kill the chips or if my code doesnt work. This is what I'm doing:
import board
import neopixel
pixpin = board.D5
numpix = 4
strip = neopixel.NeoPixel(pixpin, numpix, brightness=0.3, auto_write=False)
while True:
strip.fill((255, 0, 0))
and I'm getting nothing on my board.
This is my board:
have i broken something, or am i just doing it wrong?
Can anyone help me find the implementation of the input() method in CP? Actually any advice about how to trace a python function down to the implementation in C would be great.
Anyone else having trouble with jlc PCB and not dimensions or milling layers ?
Found it - thanks anyway
@scarlet fjord set auto_write to True
@scarlet fjord It's always possible but unless there is some visible damage or you saw them burst into flames or something, I would say a soldering or wiring issue is more likely.
Do you have another known good neopixel device you can test your code with?
i do not ๐
i have some spare chips though so i might try soldering some wires to it and see whats going on tomorrow if you dont think ive managed to kill them ๐
I mean, where there is a will, there is a way to break them but I've only ever killed one by reworking it too many times and manhandling it in the process
Discovered while working on Lib/test/test_shutil.py
Adafruit CircuitPython patchbase-7-g216f0f952-dirty on 2018-09-15; Adafruit Metro M4 Express with samd51j19
>>> import os
>>> os.mkdir('/tmp')
>>> os.mkdir('/tmp/foo')
>>> os.listdir('/tmp')
['foo']
>>> os.rename('/tmp/foo', '/tmp/foo/bar')
>>> os.listdir('/tmp')
[]
>>> os.listdir('/tmp/foo')
Traceback (most recent call last):
File "<stdin>", ...
I've now been through all the tests that test unittest itself (except mock).
unittest.expectedFailure is adding a property on the function and this is working using the function name as dictionary key.
The other use case is functions marked with unittest.skip. Skip itself raises an exception so that is working. But if all functions in a class is marked skipped, unittest also skips calling setUp, so this functionality is lost. This is no big deal, since the only real loss i...
i cant flash my adafruit adalogger M0, it exits bootloader mode instantly, then flashes red
ill try throwing something on it with arduino
cant find its port
@upbeat plover does the red led pulse if you double-click?
once then, turns off and the red flashes every sec
weird, did you load Blink?
the pulsing is a "breathing" look
gotta eat lunch - back in a little while
ive flashed before... it seems broken right now
it auto exits bootloader after 1 sec
it pulse on, then off, then on, then goes to a red flash
will i need to j-tag it or something to fix it?
I have added a second optional parameter to input() that acts like a timeout.
When input("PROMPT>", 10) is called with a timeout parameter, it will return in that number of milliseconds if there is no data available on the USB serial connection.
This is not a true async serial read, it's just a workaround to let allow other tasks to occur while waiting for serial input to start. Once a keystroke is read, the method drops into readline processing allowing for command history e...
I created a workaround for this and am sharing it via this pull request
https://github.com/adafruit/circuitpython/pull/1193
Not sure it's the right solution, but it does solve our issues.
(FYI First PR here, please be gentle)
The addition of in_waiting has made non-blocking timed reads much easier; however, I think it would be very valuable to have the write_timeout separate from timeout, as is the case in pySerial. It is very common to want to wait on writes but not on reads, so separate timeouts are handy. Also useful is out_waiting, in this case so you can implement your own buffering.
I've been trying to do a bunch of asynio type stuff with the UART and those two (along with my 0 timeout fix) would be a ver...
Is there a planned date to merge 3.x forward to master?
I see from the Travis build that this fails on some ports that don't have usb_bytes_available().
If there is a desire to go forward, I can add checks for particular architectures or features that work. For our (short-term) needs the M0 will work for us (which doesn't imply anything for accepting the PR of course - we can build from our fork)
You can take example from the Arduboy game format:
https://community.arduboy.com/t/arduboy-game-format-guide-arduboy-files/2784
It is a zip file ending in .arduboy which contains a precompiled binary and some metadata:
- game.hex
- info.json
- screenshot00.png
- banner.png
For CircuitPython, this could be as simple as shipping a .uf2 file with one or more games inside it. The advantage of this solution instead of shipping Python files, is that you can evolve the gaming API along ...
By the way, this is also how Smalltalk/Squeak works and the images still work more than 20 years later: https://squeak.js.org/run/#url=https://freudenbergs.de/bert/squeakjs&files=[Squeak1.13u.image,Squeak1.13u.changes,SqueakV1.sources]&swapButtons=true
@slender iron Is it possible to beta-test the DMA display rendering? Is the code available on GitHub?
My long term goal is to bring MicroBlocks (http://microblocks.fun) to game consoles. I tried with @stuck elbow's uGame but I got stuck because the rendering to the ST7735 was too slow
@arctic heron I will merge 3.x to master on Tuesday or earlier.
๐
@upbeat plover A very early batch of Feathers was shipped with unprotected bootloaders. Depending on its age, yours might be from that batch. You do need a j-link (https://www.adafruit.com/product/3571 is cheapest) or openocd https://learn.adafruit.com/programming-microcontrollers-using-openocd-on-raspberry-pi to re-program
@tulip sleet @upbeat plover is on an adalogger M0. Were they also shipped with an unprotected bootloader like the M4? They used to be shipped with the Arduino bootloader and you could use bossac to load the UF2 bootloader. Sorry if I came into this late.
@solar whale @upbeat plover this was an issue with early M0s from late 2015, when they were first introduced.
I had some of these that I set fuses on.
Ah. Thanks for clarifying.
np - it is a little worrying that the bootloader would be damaged, because it takes some setup to write the flash. There may be some kind of latent bug (same for the M4 issue)
My girls are ready to turn this wooden house into a creepy holloween house with sound, motion detecting, and more. Using CircuitPython on Circuit Playground Express+Raspberry Pi (with my help and supervision of course).
Stay tuned!
@charred lake sounds awesome! I look forward to seeing it in action
hello! super new to this discord, and really excited to keep learning ๐
anyone here know how to calculate fourier transforms with circuit python on cpx? I see there's arduino code for it here but i'm wondering if there's a library for circuit python as well? https://learn.adafruit.com/circuit-playground-sound-controlled-robot/using-the-microphone
Appreciate any help, thank you so much!
@runic spindle I don't know, sorry
thank you anyway @pastel panther !
There is apparently an audio in call
https://circuitpython.readthedocs.io/en/latest/shared-bindings/audiobusio/PDMIn.html
and the normal CPX library, but it doesn't look like it has mic support yet:
https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/first-things-first
I have an old version so I could be wrong about the mic support of the cpx lib
hmm so i'll have to attach a separate mic i guess
good thing i have one lying around ๐
worst case its a small project so i can just transition everything to arduino
Sorry if I wasn't clear; the first link was a way of accessing the mic
ohh interesting
I'm just not sure if it's integrated into the CPX helper library yet. You should be able to use PDMin directly
The arduino/C library for the circuit python has the FFT support built in but I don't know if it's available in the Circuit Python version yet
ah i see so if i really wanted to i could do the FFT calculation myself in CircuitPython using PDMin
?
might just transition to Arduino ahahaha. this is all super helpful though thank you for your help!!
no problem, glad to help
i made a bongo cat robot plush and i just want to make it bongo when it hears a low pitch sound ahahaha https://twitter.com/chardane/status/1041219760367665153
I love #BongoCat so much I made it a robot plush ahahaha!! ๐๐
First time playing around with @adafruit crickit! ๐ค Thank you @StrayRogue for bringing Bongo Cat into the world ๐๐ผ๐๐ผ๐๐
#12monthsofmakes September โ https://t.co/qWx8ui9uZo
470
magnitude works using RMS but i thought that detecting low tones with FFT would be much cooler hahaha
@runic spindle FFT has been discussed here before. IIRC, it would need to reside on the C side; the Python side is not fast enough to be all that useable. MicroPython has a FFT, but requires an FPU-capable MCU (M0 doesn't have FPU). Arduino is probably your best bet...
very cool, thank you for that info!
you can search this channel for the history. may be some relevant links/discussion...
I don't want to add this as is because it breaks compatibility with CPython because input only takes in a prompt. https://docs.python.org/3/library/functions.html#input
You could add this as a custom function in a custom module. It gets it closer to the second usb serial api that would be good in the long term. Let me know if you want help with that.
I get it - I have no problem with that
i think we're slowly going to try and add all pyserial supported functions, but ya some are more useful than others :)
@runic spindle soooo cuuute 
@davidperrenoud Thanks for the tips! I like the idea of packaging in a zip.
I don't really want to use uf2 to ship games though because its more complicated than editing files on a CIRCUITPY drive. Ideally we'd have the fast iteration loop with game files just like code.py.
@lethal bear all my work is going into the master branch. Its not very optimized yet though
<@&356864093652516868> Join us tomorrow at 11am Pacific/2 pm in the voice channel for the one year anniversary of the CircuitPython weekly meeting! ๐
๐ For a flash back check out the first recording here: https://youtu.be/OX825aegraw
Join here for the chat all week: http://adafru.it/discord ----------------------------------------- Visit the Adafruit shop online - http://www.adafruit.com ...
parteeeeeeee ๐
@slender iron Are you using parallel, MIPI or SPI interface? I only see mention of SPI in displayio
Fixes #1008 as well (and maybe also via other PRs).
These are not incredibly vital but would be nice for consistency with atmel port.
Breaks out task from #526.
Broke out remaining tasks into individual issues and closed in favor of them. (e.g. #1194).
git stuff above is just issue bookkeeping getting the nrf52 task tracking up to date
@indigo wedge of the remaining nrf52 tasks https://github.com/adafruit/circuitpython/labels/nrf52 are there some that you particularly want to do yourself? @gentle bronze and I would plan to do what's remaining by default. @gentle bronze is also working on nrf52 Arduino support.
@tulip sleet there is still lots of nrf52 issues. Please assign me to issue that you feel must have for the feahther launch to implement. Since Arduino nrf52840 basic aren't runnable yet, I would like to make it at least usable for the user. Since many would expect to use it with Arduino as well.
I've been really busy recently so can't contribute much right now, I have a mostly complete ble code rewrite waiting for a rebase and push but not much more than that.
@indigo wedge yeah, ble is the most fun part of nrf52 port, that would be great
@indigo wedge that's fine - you are a volunteer and your contributions have been very helpful! The BLE stuff, especially (from my point of view) the API we want to present, is certainly where your expertise is very valuable.
i have it 95% done, just need time for that 5%
we have lots more to do -- it is not a blocker ๐
I'm pondering making a CP nRF52840 badge for this year's CCC so might spend more time on it soon ๐
@indigo wedge I saw the new rocket badge yesterday
oh? do you have a link?
says blinkenrocket.com on the box
I got a kit, the new one is 2x smaller, with the 20mm matrix
don't think i ever heard of this
you program it from the browser from your phone or computer with an audio jack
This is also how GP Blocks and MicroBlocks works:
- .gpp file (a zip file)
- objects.gpod
- thumbnail.png
- ancestor
- hash
- topHash
- modules/
- 6b3f57d31cf79cb743a589a0f3862f09493fe246ab02a8b9bf44132136f14f38
The code, sounds and images are all saved in the .gpod file which I assume stands for GP Object Database. You could also save the code as separate .gp files, but then you lose some of the advantages of...
took them 2 years to perfect that technique
nice, I've been looking into that as a way to sync with the phone
@indigo wedge if you decide to do that badge, I would be very interested to get involved
I've been tweeting about it, not sure if you saw it, current idea is to have the badge be also a optional smartwatch with eink
audio firmware update has been used in synth gear for a few years
Olivier Gillet (Mutable Instruments) does all his code open-source, for example https://github.com/pichenettes/avr-audio-bootloader
@indigo wedge I toyed with that idea a bit for the pycon.uk badge, I even did some research with the cheap e-inks, I figured out how to drive them fast
https://hackaday.io/project/100853-circuitpython-badge/log/139310-the-look-up-table-holds-the-secret
I also did some brainstorming with the watch design, if you are interested:
https://hackaday.io/project/100853-circuitpython-badge/log/142479-the-shape
Very interesting, I will look at this later after work, thanks
For the shape I already have the one I used and verified last year, it's quite comfortable
PyCon UK badge? Did i miss this for this year? @stuck elbow
@fluid helm there should have been a lightning talk for it
I couldn't come, so I'm not sure if it actually happened
that's the plan, and we wanted to recruit some people this year to help with it
but it's all very fuzzy still
by the way, I have some ideas about how to cut the cost in half if we need that
qemu
Hi all, I'm trying to understand what tests are being executed after each Circuitpython promotion. Rosie executes the tests on board of tests/basics and tests/circuitpython, and travis executes everything else under test/ for Unix port, is this correct? and qemu tests are gone?
I think uheap can be removed instead. I don't know anyone who uses it.
@covert oxide I think we turned them off
@lethal bear fourwire spi for now but I'm trying to design it so its easy to swap in a different bus protocol
thank you @slender iron , as for the other tests, is my understanding correct? Rosie executes the tests on board of tests/basics and tests/circuitpython for all ports, and Travis executes everything else under test/ for Unix port? sorry, I'm not very experienced understanding how this works.
ya, I think so
I think the maker faire was a success, I always had at least 3 kids standing by my table and playing the games
@indigo wedge The last 5% takes 80% of the time...
wasn't it 20%?
i think it's generally asymptotic
Thanks!!
Hehe. Sure..
<@&356864093652516868> Meeting starting shortly. Anyone else, feel free to join in as well!
@tulip sleet after i get (https://www.adafruit.com/product/3571) debugger is there a very simple tut i can follow, one that doenst require building anything in python?
for reprogramming my adalogger m0?
Won't be able to make it this evening as flying to San Francisco tomorrow, have a good meeting all!
@fluid helm Have a good one!
Hooray!
๐ฐ 1 YEAR!!!
just lurking, (and restarting PC and it decided to do updates ๐ฆ )
yay origin stories ๐
yay @idle owl!