#circuitpython-dev
1 messages Β· Page 244 of 1
thank you for the message too.. i had the " WHO?? ME??" feeling.. now i will listen quiet again π
You're welcome! Thank you for joining us!
Good luck! So confusing..
Change SPI port index because SPI0 is /dev/spidev1.x and SPI1 is /dev/spidev2.x on both:
the current recommended BeagleBoard.org Debian image: Debian 9.5 (Stretch) from 2018-10-07
the newest Debia...
SPI now working on PocketBeagle and regression fixed on BeagleBone Black
Tested OK with BME280 sensor and SSD1306 OLED.
Once @timber mango verifies my results, I think we can close issue #100 and declare PocketBeagle supported
https://github.com/adafruit/Adafruit_Blinka/issues/100
at some point we could use displayio with EPD
ya, I want to support them in a 4.x release
@jwcooper i think i did this the correct way, if i did not lemme know, i'll fix and then continue to make a few other odds and ends pages we'll link to later...
@gilded cradle if you want, you can re-use the graphics from https://ugame.readthedocs.io/en/latest/tutorial.html
@gilded cradle for the tutorial
Thanks @timber mango. Guide was going to basically show how to take the TFT featherwings and use displayio with them, so I'll take a look at that.
ah, that is more like "how to animate things" thing
Still good stuff
Has anyone found a library that convert C/C++ to python? I found one but itβs not supported by pip
So I cloned it and I still had some problems with sublibraries
Last Week:
- adabot
- Built a script for updating library information on circuitpython.org's future Libraries page. JSONifies a list of new/updated libraries, as well as open issues. The only piece left depends on the answer to how to auto-update (commit vs PR); then deploy.
This Week:
- PDMIn: continue tweaking the sinc filter
- adabot: start mocking up some concepts for GitHub API v4 implementation.
?showtimes
3D Hangouts - 11am ET Wednesdays
Show & Tell (YT only) - 7:30pm ET Wednesdays
Ask an Engineer - 8pm ET Wednesdays
Desk of Ladyada - Random hacker times
John Park's Workshop - 4pm EST Thursdays
anyone know when the shows are π€£
Thanks everyone
CP is like herding cats π
any project with people is herding cats
If anyone could answer this question on stack overflow it would be greatly appreciated
I love mu btw it's really nice software debugging tool
@steel swallow
>>> a >>= 2
>>> a
30```
here is the code in cpp
crc >>= 1;
I am not sure how to express that symbol and I have found python has all the other bitwise operators except these two
so is the same in Python minus the ;
it doesn't go through the debugger
the program that see's if you have spacing, typos and stuff it is catching it
Ahh, pylint. It's not a debugger but a syntax checker
yea the syntax checker sorry for using hte wrong vernacular
You must have a typo. It works fine in my Mu
Is it possible to do HID over bluetooth with in circuitpython with the feather nRF52840
1st) there is no elif in Pyhton
Sorry, yes elif was correct but all tutorials I read said not to use it....
Do you really want to combine a test and a modification on the same line ?
I get confused looking at stuff online from 2.76 code examples and 3.7 I make mistakes by using codes from the wrong version
I think what is not allowed if to combine the modification and the test on the same line
this is compiling now I hope it works I don't really understand what I am doing I am just trying to refactor
class crc16(object):
crc = ''
data = ''
i = ''
def testdata(crc, data):
i = ''
for i in range(0, 8):
if crc and 1:
crc = crc >> 1 ^ 0xA001
else:
crc >> 1
return crc
all of the class compiles now but I don't know if it will work because I simplified it from C++ so much
Looks like you are translating C++ to Python word by word, which is going to fail
variable declared at the Class level are automatically class variable (ie static in C++)
they are not members
here is the cpp
static inline uint16_t _crc16_update(uint16_t crc, uint8_t data) attribute((always_inline, unused));
static inline uint16_t _crc16_update(uint16_t crc, uint8_t data)
{
unsigned int i;
crc ^= data;
for (i = 0; i < 8; ++i) {
if (crc & 1) {
crc = (crc >> 1) ^ 0xA001;
} else {
crc = (crc >> 1);
}
}
return crc;
}
so I need to call them all classes then
python autodetects the number and classifies it if I remember correctly from the class I took
So it isn't a class in C++. Why making a class in Python though ?
there is a declaration of the file name at the beginning of the cpp
#ifndef UTIL_CRC16_H
#define UTIL_CRC16_H
#include <stdint.h>
#define is what defines a class (???) I never studied cpp
#define defines a preprocessor macro which is often used to define a constant
Here is my python translation:
crc ^= data
for i in range(0, 8):
if crc & 1 != 0:
crc = (crc >> 1) ^ 0xA001
else:
crc = (crc >> 1)
return crc```
Not tested, comes with no warranty
so I should use that uint16_t ?
that is a number type for 16 bit number for radio frequency I am pretty sure
uint16_t is typially used in C/C++ to define a unisgned interger of 16 bits length
there is no types in Python
python will just auto-detect the number right?
yes
that's why I left it out
I will try your other statements though thanks for the tips!
just updated the code as I forgot to remove the unit16_t in the parameters
ok sounds good I will use
That looks good to me. Do you want to merge this now, or wait until the full text is in?
thanks! @jwcooper deploy away! i'll do a another PR later for the text and graphics.
If I understand correctly, we could do _blinka/board_name.md. Boards won't co-exist between /downloads and /blinka?
There won't be a files.json connection, right? Where do we link to on the download page for files, etc?
If I understand correctly, we could do _blinka/board_name.md. Boards won't co-exist between /downloads and /blinka?
correct!
There won't be a files.json connection, right? Where do we link to on the download page for files, etc?
correct!
@modest atlas not yet with circuitpython
@slender iron more to look forward to!
yup!
You all are killing it
π
does Mu have PyPortal support?
it should I think
@jwcooper no files.json. We'll either want to link to Blinka: https://github.com/adafruit/Adafruit_Blinka or individual loading instructions because blinka may have unique deps per board.
It is weird that order matters but most people don't have the issue. It'd be a lot of effort to switch them around as needed. So, I don't think it's worth the effort now.
f8e5e2d Start on nRF nvm.ByteArray adafruit/circuitpyth... - nickzoic
492431a nvm.ByteArray reads & writes but no sensible er... - nickzoic
592bd01 switch CIRCUITPY_NVM on! - nickzoic
8e7fee2 Working flash pages for nvm.ByteArray adafruit/... - nickzoic
cd69db7 Add a peripherals/nrf/nvm.c to wrap flash page ... - nickzoic
apparently the war requiem is merge music π
Feel free to comment on why you need this and I'll reopen. I'll close for now.
@C47D I think you need to run make translate to get the new translation string into the .pot and .po files.
I'm picking this up now to get it to fit.
Working on some edublocks information pages.
Should I have themed headers for each platform (example in top image)
Or have them all the same (example in bottom image)
@stuck elbow what do you think about splitting gamepadshift into a separate module so we can only enable it on boards that use it?
Signed-off-by: Tavish Naruka tavishnaruka@gmail.com
This should allow for reading and writing values to multiple pins at once.
A shift register can then implement this same API too.
Once this is added we can cleanup GamePad back into one class.
With a TCP server listening, I get a valid connection from the ethernet wing, but when I try to send or receive data I always get an input/output error when entering the commands via REPL.
When using the same sequence in code.py the feather M4 just hangs and doesnΒ΄t react to ctrl-C.
I connected both modules by piggybacking them via headers without additional wires.
itΒ΄s not a problem of USB supply, behaves the same with external power supply.
from REPL other commands like .connected, ....
Do you have your own VID for USB?
Nope, I missed that. What do you suggest I put there?
Thanks @tannewt, i will try that later today, i thought it was the error: too many arguments to function 'translate' causing the Travis errors.
Very cool! I have one question but looks good otherwise. Have you tested battery life at all? We haven't done any optimization of CircuitPython yet for it.
Haven't looked at any optimizations yet, but got the display working. I was playing with CircuitPython for the first time today, I'll take a look at it later.

Oh, yup. That is an issue too. The paren needs to be before the MP_QSTR. You likely need to use the _varg variant of the raise too.
Ok, no problem. We'll give you a set of Adafruit PID numbers. So please use 0x003b for the bootloader, 0x803b for arduino and 0x803c for CircuitPython (on the next line.) The VID can remain 0x239A. Thanks for trying CircuitPython!
thank you @tannewt! I'll update the PRs.
Just to follow up on my earlier post, I think my issue is related to my WiFi access point. I tried to replicate my issues on a second pyportal, and was having difficulty accessing the password protected WiFi. Both pyportals ran fine on a guest (unsecured) WiFi network. My original pyportal, which would crash faithfully within 24 hours of starting, has been running for several days now without issue.
I'm loading a 50x50 pixel color bitmap using displayio.OnDiskBitmap().
test_bitmap.zip
A black horizontal line is appearing at the top of the image which should be all white.

Here's my code:
import board
import displayio
from st7735r import ST7735R
import time
spi = board.SPI()
cs = board....
Hang on, not sure this is right.
The changes in fdaff00c move the NVM space to the end of the FATFS space:
#define NVM_START_ADDR ((uint32_t)__fatfs_flash_start_addr + \
(uint32_t)__fatfs_flash_length - CIRCUITPY_INTERNAL_NVM_SIZE)
and I think this has undone that and moved it back to where I initially had it, incorrectly, at the end of flash where it overlaps the "Bootloader Settings" segment defined in boards/adafruit_nrf52840_s140_v6.ld
This can brick the board if y...
OK so yeah. I've checked out 18908c2 and that's in the correct place and subscripts seem fine to me: what problem did you have @dhalbert ?
@tannewt we probably should revert this ... writing into that bootloader config segment can leave the board unbootable (needing a new bootloader flashed, anyway)
254d0a5 Revert "nrf nvm: touchups to nickzoic PR #1768" - tannewt
Reverts adafruit/circuitpython#1779
@crude fossil sent you a revert PR
@fluid helm i'd vote themed. the subtle variation can help with confirmation to the user that they're in the platform they expect. bonus if they match the platform's "official colors".
@nickzoic When I did subscripting I got range errors. The self->len value was not being set and was coming in as zero. See this commit: 864910559bc712deed112e072f61fd482adea1a6
I think you are right about the NVM_START_ADDR, but it had appeared to me that was leftover from the old PR. I'm sorry about that.
On Tue, 16 Apr 2019, at 12:49, Dan Halbert wrote:
@nickzoic https://github.com/nickzoic When I did subscripting I got range errors. The
self->lenvalue was not being set and was coming in as zero. See this commit: 8649105
Which board was this on?
Tested on Feather nRF52840.
@crude fossil could I ping you here for discussion?
Here's what happened when I built 18908c2, pulling from your repo and checking out that branch:
halbert@salmonx:~/repos/nickzoic/micropython/ports/nrf$ git log -1
commit 18908c21f7998b13493fe75d0020bd9ad1bd1b60 (HEAD, origin/circuitpython-nickzoic-1042-nrf-nvm-bytearray-2)
Author: Nick Moore <nick@zoic.org>
Date: Tue Apr 9 12:53:11 2019 +1000
Fixups for adafruit/circuitpython#1042
halbert@salmonx:~/repos/nickzoic/micropython/ports/nrf$ repl
Auto-reload is on. Sim...
I'm in discord if you want to chat there. Maybe there were some uncommitted files in your repo??
Oh super weird
Adafruit CircuitPython 4.0.0-beta.6-65-g18908c21f on 2019-04-16; Adafruit Feather nRF52840 Express with nRF52840
>>> from microcontroller import nvm
>>> len(nvm)
4096
>>> nvm[0:5] = b"hello"
>>> nvm[5:10] = b"world"
>>> nvm[0:10]
bytearray(b'helloworld')
>>> nvm[0:4096] = b'abcd' * 1024
>>> nvm[:] == b'abcd' * 1024
True
>>> nvm[3]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: ByteArray index out of range
>>> nvm[3:4]
...
@gilded cradle heya for the guide on the OLEDs we should update em as well
to let people know to go to the Image lib
Ok. Is it just for the 1351 at the moment?
Is there one for the ImageReader that will need to be updated when that PR gets merged?
its kinda silly as is
thats the only page
you deleted that example
so now it should be "hey go here"
Gotcha
I can make a new fritzing diagram
Or were you thinking updating the photo?
i think you can crop the photo
or just make it clear the wiring doesn't match it, its just for demo
but swap in a fritzing
they're clearer than wiring photos anyhow
Ok. I updated the ImageReader PR. Did you want to review it?
When I click the Edit This Page link, it just takes me back to a page of my guides. I don't think I have permission to edit it.
Sorry for the noise, I'm working on a Windows machine so I haven't all the tools to run make translate, I will try to set a VM later this week.
@gilded cradle ok ill give u perms
Thanks!
added
Ok, that worked
im a little confused by the PR
the examples are already tehre, so why make a new one?
i think confusing if we hvae 3 examples
maybe combine into one ssd1351 example
get rid of the 96x128 and 128x128
(they can select size)
Ok, I can do that real quick
Ok, pushed. I can just point to the SSD1351 ImageReader Example in the guide
yep!
Should we update the BMP section to be more about the image reader?
yeah you can copy the ili9341 page and adapt
Ok, that'll work
Ok, perfect. Thanks
Hi all, my CPX users keep unplugging CPXs running CircuityPython (and not properly unmounting) which often boots it in safe mode.
Anyone have any tips to stop this?
I was thinknig some udev rules, but I can't seem to get them to work. I assume because it is a multi-class device?
Maybe even disabling safemode if that's possible?
Thanks
@sturdy furnace Im not really qualified by ANY means but what is CPX? (sorry this feels like a dumb question)
@gilded cradle ok once travis passes go ahead n merge
I don't have merge perms on that library for some reason
@sturdy furnace it happens if they dont eject properly π
(on some OSes)
not on mac and linux as much
@spark hill the CPX is the CiruitPlayground Express π
@gilded cradle permed!
Thanks
@sturdy furnace Ah gotcha thank you for the clarification
@meager fog Yeh, It's a good feature for beginners to not break it. But do you know if udev rules can get it to ejecy nicely on an unexpected unplug?
@meager fog, Should I unpublish that particular guide page while I redo it?
@gilded cradle nah nobody is lookin
Ok, thanks
@sturdy furnace oof - not really. but why are they unplugging?
@sturdy furnace eject is a host initiated action. the slave can't initiate it, and since the firmware is in a constant loop that is what introduces FS corruption. at least, that's my understanding of it...
@meager fog honestly, poor mechanical connections, and mistreatment of hardware π¦
well thats what safe mode is for π
they can click the reset button
maybe makecode is a better one for your students?
its a lot more durable
(no filesys)
Hey Scott,
I'll have a play around with it and let you know if I have any success. Like you said - it is just easier to say to people: "initialize SERVO3 before SERVO1" for our board.
I'll PR all the board config stuff a bit later - once I know it is very stable (it's looking that way at the moment).
If your interested in checking out the board, the info is on Crowd Supply. We hope to launch this week.
@raven canopy yeh, I was assuming that it wasn't circuitpython's problem (hence the scary udev rules).
@meager fog oh that's good to know. Unfortunately, it's a python course so ideally I would use CircuitPython.
I'll give some more things a try. But it might just be as simple as better USB connection!
raiden i think if they have a good microUSB cable, maybe long flexible ones
that should solve it
but if they get safe mode its no biggie
just unplug/replug
try to get an editor that writes the files out completely - we like atom or Mu
Alright, thanks for the advice! I'll see how it goes π I'm hoping to show them that not only is Python super extensible, but hardware is fun and not scary or frustrating! We'll see how that goes π
OK so this is yet another crack at #1042, rebased onto master yet again.
With many thanks to @dhalbert for his help finding & fixing problems.
I've tested on Feather nRF52840 and since it touches shared-bindings a bit also on the Metro M4 Express.
Adafruit CircuitPython 4.0.0-beta.7-36-g9c42a7227 on 2019-04-16; Adafruit Feather nRF52840 Express with nRF52840
>>> from microcontroller import nvm
>>> nvm[0:5] = b"hello"
>>> nvm[5:13] = b", world!"
>>> nvm[0:13]
bytearray(b'hello...
@C47D No worries! I can fix it for you if that is easiest. I just wanted to give you a shot at it.
OK, I'm having a look at this since you're not the only one having problems!
(See also: https://github.com/adafruit/circuitpython/issues/703#issuecomment-462819747 , #1500 )
I suspect something like a timing error or race condition.
I wonder if it would even make sense to completely separate this and call this from the system tick.
@slender iron sounds good
This pull request is for merging updates to the main branch.
Main updates PID and pinout.
@meager fog what's tripwire?
a game
Oh wait. SMH I was talking about that with someone else don't know why that didn't ring a bell. lol
I've dropped the main code on my fork (finally! Took me a while to get round to it). Need to populate the README, document the code and write some examples, but the code for the library is available.
Done. Everything is split now. Please take another look. Thanks!
Thanks for the link! I'd suggest PRing early for testing. (Then we can add it to circuitpython.org too.) You can always tweak it later.
We usually provide a library that does the init so that in practice most folks don't need to worry about the init order.
nit: I think we can replace everything between lines 41 to 44 with:
if (!MP_OBJ_IS_TYPE(MP_OBJ_FROM_PTR(singleton), &gamepad_type)) {
return;
}
I wonder why you brought back last as part of the gamepad object, instead of keeping is a static variable here?
If you keep gamepad->last in the object, you have to initialize it here to 0.
@meager fog you mean jumper wire?
@ITACAInnovation I've merged the latest changes from adafruit/master for you. Please start your changes from the latest commit to reduce merge conflicts. We have a git and GitHub guide here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
@untold arch you will need this pull request for the buttons: https://github.com/adafruit/circuitpython/pull/1778
and come to think now, I need to change the imports in ugame.py, now that GamePadShift is split to a separate module
I guess I will fix it when it gets merged
so please wait a bit with this
I really dislike static state within a function because it is not object oriented and not obviously global state. Having it on the object is the common style within CircuitPython.
hi @slender iron π just found out about this discord. I was trying to run some BLE applications for Papyr, which were built using Zephyr, with the correct offset. Most basic samples which I ran seem to be working fine, but the BLE sample I tried wouldn't work. I haven't investigated much, but could this be because interrupts aren't working correctly / softdevice not forwarding them to app?
welcome @cerulean pawn !
I've never used zephyr so I don't think I can be much help
@tulip sleet has been doing more of the BLE in circuitpython support too
@cerulean pawn nice to meet ya!
okay, I'll probably spend some time trying to make some BLE app which doesn't use softdevice to work, cause that would be really useful I think
hi @spark hill nice to meet you too!
kk, cool!
π
Ok, updated @deshipu. Thanks for the quick review!
I'm testing it now.
Do you think you could also sync the circuitpython-stage repo so that it now imports GamePadShift from gamepadshift and not from gamepad?
@stuck elbow I swapped data and clock into shift too
busio.I2C and busio.SPI take clock first
I can pull ugame then for you
by the way, a hint for the translations conflicts
pick the old date in the first conflict, otherwise you will need to resolve that conflict for every single commit
or is there a way I can push a rebased patch now?
so it's clock, data, latch now, correct?
ya
you want to push to the branch? I think you should be able to. just make sure to pull down my changes first
there are quite some conflict in the locale dir
would save you some work
compiling now, as soon as I verify it works, I will push it
github isn't showing the conflict
hrm, lemme try
I think you are not calling gamepadshift_tick from the system tick
is that a separate repo?
ah, could be
in any case, circuitpython-stage is updated and should work with the new code
@stuck elbow ok, checked on my pybadge and works once I called tick
pushed the stage update too
awesome, I think we are ready
waits for travis
@ITACAInnovation I've merged the latest changes from adafruit/master for you. Please start your changes from the latest commit to reduce merge conflicts. We have a git and GitHub guide here: https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
Thanks
it should be renamed to godot
Please leave it open. I'll merge it into circuitpython once travis is happy with it.
@cerulean pawn we are thinking about zephyr in the long run, but it would require a substantial rework. Its chip peripheral support is not as complete as what we have now for the SAMD and nRF.
@tulip sleet hi! yeah, it's not as complete. However right now I'm trying to run an app built with it which does BLE, I think it should be a smallish fix somewhere to support interrupt forwarding.
@stuck elbow I'm off to do errands. I think the PR is set once travis is ok. I had to merge in adafruit/master for some reason but it should be happy now
cheers
@cerulean pawn - I'm confused: are you running CircuitPython apps, or is this a binary zephyr build you're trying to run on some board of ours?
@tulip sleet a binary built with zephyr, but along with the UF2 bootloader. I guess I'm in the wrong channel, sorry for the confusion
ok, now I understand. Is the app coming up at all, and just the BLE part not working?
@tulip sleet I was trying it yesterday, it would run up till the app tried to start adertising, it would print on the console and everything.
The bootloader is not enabling the SD or anything, so I'm not sure what you mean about interrupt forwarding. At what offset are you loading the binary?
0x26000
that should be fine. actually, I wonder if the bootloader is indeed maybe enabling the SD, so it can do OTA, etc.
but I would think it's not leaving it enabled
it is doing sd_softdevice_vector_table_base_set(CODE_REGION_1_START) before jumping to the app at least
I'll spend some time on it later, forgot my debugger at work
which should mean interrupts go to the right place, maybe it's some other problem
ok, swing back to us later -- could also post an issue in https://github.com/adafruit/Adafruit_nRF52_Bootloader if you think the bootloader is intefering somehow.
will do, thanks @tulip sleet
df89156 Start on nRF nvm.ByteArray adafruit/circuitpyth... - nickzoic
933500c nvm.ByteArray reads & writes but no sensible er... - nickzoic
531cf7e switch CIRCUITPY_NVM on! - nickzoic
d0e5af3 Working flash pages for nvm.ByteArray adafruit/... - nickzoic
fd83cf2 Add a peripherals/nrf/nvm.c to wrap flash page ... - nickzoic
Finished the Circuitpython edublocks page! The theming works really well, thanks @raven canopy for the suggestion of colour themes https://gifyu.com/image/3XOw
Question: Based on a fairly comprehensive perusal of the source, there does not appear to be any support in the current version for audio in; am I missing something?
First PR on changing the 4-H CPX content
@olive mortar there is not bulk AnalogIn; there is PDMIn, for reading data from PDM microphones. Until the M4 boards, reading bulk audio was impractical due to the small size of RAM.
@tulip sleet mind doing a final review on https://github.com/adafruit/circuitpython/pull/1778
@olive mortar https://github.com/adafruit/circuitpython/issues/487
@slender iron sure, is @timber mango done with his testing?
@tulip sleet @olive mortar Is there anyway to read a short burst of audio in from signal A0?
@simple pulsar not yet, that's pretty much the point of https://github.com/adafruit/circuitpython/issues/487
@tulip sleet , @slender iron - Cool; thanks for the confirmation. I'll likely have whack at adding that, and support for USB audio I/O as well.
that would be epic! I'd love to see usb audio support in tinyusb (which circuitpython uses)
@tannewt sorry if I answer with so much delay.
I use this feature from upstream to isolate the repository of my features from the upstream one. I find the possibility of not having to apply patches, forks or creating branchs to manage my native modules very useful.
Yeah, I figured on hacking tinyusb; it was a bit unpleasant to find that the blurb for audioio ("provides audio input and output") was, um, optimistic.
@tulip sleet you ok merging the USER_C_MODULES stuff?
I guess so, like I say, it will ease merging those files from upstream.
Not a problem; just a surprise.
thanks for the help @olive mortar. ping me if you have any questions
@deshipu - It looks here that the DigitalInOut objects are made to be inputs with PULL_UP if they are currently outputs. Also if they are already inputs with PULL_NONE, they will be made to be PULL_UP. But if they are inputs with PULL_DOWN, they won't be changed. Is that your goal?
In shared-bindings/gamepad/GamePad.c, the provided doc says they are always pulled up. Could you change the doc to match the impl (unless I am misunderstanding)?
//| The ``b1``-``b8`` parameters are ...
This issue is resolved. The init ordering is just a weird detail.
This would be super cool but I think it's pretty niche.
I agree with @deshipu. No extra error message is needed here for now.
@idle owl where did you get the green mit license badge?
shields.io apparently. At least that's what comes up in my history when I search Firefox for it.
kk, I need to swap the url to get it from there directly. refering to the github image url breaks when building off github
I don't remember if I used green or bright green, but I have the URLs
the filename has brightgreen in it
π
- Fixes PDF generation on RTD
- Adds links to circuitpython.org for boards instead a big list.
- Adds branding guidelines
You say "both" but you list three options.
Could you put these in preferred order? Also, it does recognize code.txt.txt, though I'm not sure you want to say that.
Say that it runs main.py/code.py on auto-reload.
do we want to mention we do not support interrupts? (micropython does).
This is the preference order of main right now. I'll board our suggested names.
Removed the list and added a link instead.
hey @slender iron if a do this on the repl:
import board
i2c = board.I2C()
i2c.try_lock()
i2c.scan()
then try CTRL-D to load a code.py that uses board.I2C() is it expected to work? I'm getting a hard fault
You can use Atom with Python right?
the processor or the IDE? Yes to the IDE, probably not for the processor
or rather no CP for the processor: π
You might also give Visual Studio Code a try if you're not attached to atom
are you asking from the perspective of editing circuitpython code (main.py, etc) that is on a board? or just in general? i use Atom for in general python. for editing code on a board, see this: 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-7-13
Honestly probably general. I heard @meager fog mention something about Atom or Mu for tripwire or something else. So I just wanted to make sure I wasn't trippin'
yep. its a fine editor. doesn't have a built-in REPL, like PyCharm, that i know of. i just use the terminal...
Ok cool! Thanks!
i have been meaning to try VSCode. everyone seems to love it...
Yeah, it's great. It's lightweight and easy UI. What's nice is that you can save it as .cpp or C files C# etc. The best part is that you can use it for a ton of different languages.
It's like the Roseta Stone of IDEs π
hehe. Atom is agnostic as well. I also use it with C, when working [fumbling] on core code.
@pastel panther ya, it should work. please file an issue for it
(bonus points for a backtrace if you break on reset_into_safe_mode)
kk
@raven canopy Cool. Hehe
I was testing some i2c address code and needed to scan the bus on the REPL, then tried to re-start the code and was sent into safe mode.
import time
import board
import busio
import adafruit_veml7700
i2c = board.I2C()
veml7700 = adafruit_veml7700.VEML7700(i2c)
while True:
print("Ambient light:", veml7700.light)
time.sleep(0.1)
To reproduce, have the above code.py saved on the device, start a REPL and do the following:
import board
i2c...
FWIW the particular driver using the i2c object doesn't matter, this was just the example I had handy.
I updated the title to reflect further testing; if the code.py uses
i2c = busio.I2C(board.SCL, board.SDA)
instead of i2c = board.I2C(), there will be no issue. Additionally, the try_lock in the REPL isn't needed, just the i2c = board.I2C()
Is the first part of this sentence kind of a dupe of the sentence at line 13?
@gilded cradle around now fyi
Hi @meager fog
I got the guide updated last night and was working on the small RA8875 display. It's a little trickier than the others, but I got an idea that I think will work well.
I can switch over to the SSD1331 though.
either way
i haven't heard any horrified screams over SSD1351 so i think we can move onto SSD1331 π
Lol, yeah
This one is a little tricky in the sense that it's all commands and no data.
@meager fog when I finish the case where should I put the .step?
thingiverse
Hi @meager fog, the SSD1331 driver is almost converted, but in the setAddrWindow, since the graphics data is counted as data, it needs a startWrite just before that at the end of the function. Otherwise I got all of them removed. Any suggestions on that one?
lemme look
kk
ok yeah leave it but you can convert the other items to sendCommands
Ok, looks like it passed travis. I already had an existing PR, but I updated it.
However, before merging, I can test on some of the other boards...
Looks like it's not working on the ESP8266 and most likely because it doesn't appear to have been updated to use it.
Doesn't run
I think it needs a similar treatment like the 1351 got when it's updated to pass SPI
However, I think I'm going to call it an early night tonight and continue on it tomorrow.
I don't think it'll take that long for me to get it working
Have a good night @meager fog, I'm going to go π€
Yeah, later
@tidal kiln amazing guide! i didnt know we could plot data π
π thanks. hack-plot (c)
yep. that'll be cool.
nice @rhthomas when you're ready please submit a PR :)
I'm not sure how to add commits to this pull request, now that @tannewt added his. I can fix it in a separate PR?
Not exhaustive but I've tried and so far failed to reproduce this (on 4.0.0 beta 7):
- variable length text in a
ValueErrorexception after a few random seconds - same exception as in ticket by using a tuple for list index at line 199
One other thing that's struck me is the code I was running was USB MIDI related so could other traffic over USB to the CPX have some triggering effect here?
Acutally I just re-ran one of my examples from comments on 4.0.0 beta 7 and it did it on the second raise on REPL:
>>> raise AttributeError("abcdefghij" * 12)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghijabcdefghij
>>> raise AttributeError("abcdefghij" * 12)
Traceback (most recent call last):
File "<stdin>", line 1, in <m...
On another CPX I got 3 failures out of 20 when cutting and pasting that exception and manually hit enter on the AttributeError technique (PuTTY on Windows).
@tidal kiln Nice job on the Tide chart for the PyPortal -- works great!
Getting started with the badge case! π 
Maybe we can add this defines (or something similar) into the mpconfigboard.h file:
#define CIRCUITPY_RGB_STATUS
#define CIRCUITPY_RGB_STATUS_R (&pin_PA17)
#define CIRCUITPY_RGB_STATUS_G (&pin_PA16)
#define CIRCUITPY_RGB_STATUS_B (&pin_PA19)
And then drive CIRCUITPY_RGB_STATUS_R, CIRCUITPY_RGB_STATUS_G, CIRCUITPY_RGB_STATUS_B with the PWMOut signals, but what frequency should we use?
6ff4e0e Add GamePadShift for handling shift-register-ba... - deshipu
a792593 Read one bit per system clock tick in GamePadShift - deshipu
b485e45 Go back to simple bit-banging in GamePadShift, ... - deshipu
3469b1e Add debouncing to GamePadShift - deshipu
7e89bee Optimize the size of code for gamepad - deshipu
@idle owl is this a mount hole?
that's for the light sensor
there is an up-side-down LED soldered on the other side
you want to leave that hole exposed
@sommersoft Here is the latest version of the libraries.json file. The PR is nearly ready to go, just have a couple more things to add in.
@kattni, @sommersoft Is the repo level issues section automated? If so, I believe we'd need that in the libraries.json file as well.
@solar whale thanks! and thanks for trying it out. glad it worked π
I've been looking for a circuitpython library for the NRF24l01 and had no luck yet. Yet I was wondering if there was a library for it or would I have to use arduino.
Hey all, I'm new to the discord but I wanted to share a project I did with the Pyportal and a raspberry pi! I wanted a tweet display similar to the quote book project but I had no easy way to access the Twitter API from the Pyportal so I setup a raspberry pi with python-twitter to get new tweets every 5 minutes, post them to a web server page, also hosted on the Pi, in order to update the json file with a bunch of tweets. The Pyportal then gets individual tweets on a page that selects a random tweet from the array and puts it up on the page. From that point it's just like the quote book with different text positioning and a different background.
I'm working on a full build write up now so I'll share it when I'm done.
@unkempt quest resembles my https://github.com/mikerenfro/iot-office-door-sign , in terms of the software components.
@jwcooper Yes, it will need to be there. I was unclear with my expectation so @sommersoft didn't know the entirety of what I wanted for the contributions page. We discussed it last night and he's sorting how he wants to do it since it now resembles the current adabot script more closely. Sommersoft can explain better what his plans are now.
Sounds good, thank you @kattni!
@scarlet maple yeah it does! That's an awesome project!!
Still need to debug why some web requests don't return correctly. But when it's in use, don't have a convenient way to monitor serial on it (just has power and Wifi normally).
Same with mine. Its sitting next to my TV just plugged into a power strip.
@scarlet maple I know this is more of a question for the circuit python help channel but it seems like you would know the answer, if I wanted to get data from say 3 different sites, then have the Pyportal scroll throught the sources every minute or so, how would I accomplish this? Basically, how can I have multiple "data_sources"
50,000? That is what we use for backlights. It's good to have it higher than audio range.
@unkempt quest I just abuse the wget method for that. Grab data, write to file, parse file. I think there might be options to just return the raw text without a file, too.
Oh! That sounds much easier than I was thinking about
@stuck elbow you can add to the pull request by pushing to the branch for it. you just have to make sure you pull down the latest commits from github first
@slender iron yeah, but the help on how to pull from a pull request assumes you have merging power, there is no link to that available on the page when you don't
so there is no way for me to pull it
Thanks for the info deshipu!
@stuck elbow it's just a branch in your repo
ah, so you basically pushed those commits to my fork?
yup!
makes sense now, thanks
np, I know it's weird
I would assume you don't have the rights
@unkempt quest sweet - great build!
@stuck elbow I think that was the case until the introduction of the "maintainers can edit" check box on PRs
@tidal kiln heya small fix for your thermocouple code
you dont setResolution so you dont actually get a better resolution output - default is always 10, but you can get 12 on M0 and M4
yep. guess i was just going with most basic example.
thought about having that in but maybe commented out?
want me to update it? would need to check the volts math.
@meager fog do I need a samd09 for seesaw or will it also work on samd11?
I guess I can just use one of the seesaw wings for development
roger
@C47D Looking now. Thanks!
@shy elm it looks like someone is working on it!:
https://github.com/adafruit/circuitpython/issues/1234
there's one for micropython here from the original repo https://github.com/micropython/micropython/blob/master/drivers/nrf24l01/nrf24l01.py There's also a RadioHead driver here http...
@meager fog looks like i already generalized the volts math, so it's just a matter of adding
analogReadResolution(ADC_RESOLUTION);
to setup().
want me to PR that change real quick?
When does the py badge realease?
Ok, I've rebased the changes. I updated PDMIn to use the same new message and also guessed at the appropriate translation for all of the languages.
Logical answer sajattack lol
@spark hill keep an eye on this channel though, limor usually posts here when the first batch of a new board is out
I'm not going to block 4.0 on this because most boards use external flash. Moving it to 4.x
Ok cool. Thanks!
Thanks for the follow up @trimmkm.
I'm going to close this because it is hard to reproduce. If someone comes up with a quicker way to reproduce please post a new issue.
Hiya everyone! Here's the case render. Almost done! π 
I chamfered the edges to give it a slight polygonal look.
I think we could leave this unlisted until we build up the content.
The "download instructions" button links to whatever is set in the front matter on the board.
Two new required fields for blinka:
download_instructions: "https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi"
blinka: true
Screenshots:
circuitpython.org/blinka:
:
self.size=size
self.buffer = array.array('d')
for i in range(size):
self.buffer.append(0.0)
self.pos = 0
def addValue(self,val):
self.buffer[self.pos] = val
self.pos = (self.pos + 1) % self.size
def average(self):
return (sum(self.buffer) / self.size)
@tough flax You might try exponentially-weighted sample averaging. I use a line likecvi[mux] += (pot[mux].value - cvi[mux]) >> 2
when I read a series of input pots
So, given real values instead of integers, you're adjusting the average by 1/4 the difference between the new value and the average?
avgVal += (newVal - avgVal)/4
and the 4 is arbitrary?
If you get the same value for 4 readings, you'll stabilize... you can make that 10/20/2?
That's certainly faster if you're using the value every reading. The RollingAverage class lets you store the data and only use it when you need it, but has the storage cost (no biggie) and the cost of summing (same division... if you want to use integers, you could use the same trick on the RollingAverage)
What board is this on? Does it crash if you don't have a driver at all?
Ok, I think this is because we weren't resetting the shared busses after the repl is run. This could also be why folks have more trouble if they test from the repl rather than code.py directly.
that is reload after something wrote something to the disk
Thanks a lot @tannewt, it seems all good now!
Thank you for the bug report! I've reproduced it and am hunting it now.
Ok, i will try to fill a PR before the weekend, i only have a Feather nRF52840 so i will need your help to test it. @tannewt, @dhalbert Do you agree with the symbol names proposed?
// file: mpconfigboard.h
#define CIRCUITPY_RGB_STATUS // Defined in boards with RGB status LED
#define CIRCUITPY_RGB_STATUS_R (&pin_PA17) // Red LED of the status LED
#define CIRCUITPY_RGB_STATUS_G (&pin_PA16) // Gree LED of the status LED
#define CIRCUITPY_RGB_STATUS_B (&pin_PA19) // Blue LED of the...
Classic off by one error when subtracting y from height. PR incoming.
Before we were skipping reset of the standard busses after boot and
repl which could lead to a crash in a subsequent VM run.
Fixes #1806
It resulted in the first row of pixels being pulled for out of bounds.
Fixes #1801
@stuck elbow duty_cycle =255 turns off the backlight
oops
and del _INIT_SEQUENCE will free up some ram
it won't
128 bytes, tested
@stuck elbow maybe should file issue cause del saves 128 bytes
tested just now with current repo
I like my RAM freeeeee =}
Is it a good idea to have, in development, code that evals from api call?
@stuck elbow why not? it's brought into memory with the import
@slender iron it's part of the bytecode, no?
no, I think it'd be referenced from the module dictionary
so del will delete it from the dictionary
@tough flax Sorry, afternoon commute delay response. π In my case I am reading/using the read values every iteration.
ya, and where they are defined matters as well
I initially saw it on my itsybitsy m4 but then reproduced it on a metro m4 to get the backtrace
@stuck elbow i think the buttons still need work?
jumper.py runs forward while jumping and shooting
@jwcooper,
Here's a current iteration (i reordered it a little): https://github.com/sommersoft/circuitpython-org/blob/new_lib_json/_data/libraries.json
I can push it to your PR if you'd like. Well, once I remember how to do it. :smile:
@tidal kiln is that crash you found still happening?
try it with the latest, you may have been hitting the shared bus issue
cool. i'll grab that and see what happens.
thanks!
thusly?
Adafruit CircuitPython 5b94b77 on 2019-04-17; Adafruit PyPortal with samd51j20
>>>
Looks like the latest is 00379dbb7ec779663247f4ff886710594a8e629a
but travis is still catching up
It turns out this is Display.auto_brightness fighting with manual .brightness setting. The PWM stuff is fine. .auto_brightness was changing the brightness out from under the manual setting. There is some bug: the brightness should not be adjustable if .auto_brightness is True.
Or possibly set .auto_brightness to false if brightness is set manually.
@makermelissa That sounds like a good idea: we'll discuss.
Ah! That makes sense. Good find @dhalbert
thanks @tidal kiln
hey @slender iron I was adding the RTD page for my new library and followed these instructions:
https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs
however once I finished and was going to add it to the bundle I noticed that the URL was different, so I think I did something wrong? I ended up with https://adafruit-circuitpython-lps35hw.readthedocs.io/en/latest/ instead of https://circuitpython.readthedocs.io/projects/lps35hw/en/latest/
we'll need to add it as a subproject to the main circuitpython one
what is your rtd name?
siddacious
added you as a maintainer
ok, thanks
@tannewt the pyportal, pybadge, and the hallowing all start with auto_brightness True. The doc in Display.c says
The brightness of the display as a float. 0.0 is off and 1.0 is full brightness. When
auto_brightnessis True this value will change automatically and setting it will have no effect. To control the brightness, auto_brightness must be false.
The above isn't actually true: there's no check for .auto_brightness when setting .brightness. I like @makermelissa 's suggestio...
@slender iron got it working, thanks!
Just need to merge this to test. I used to have a private circuitpython RTD build but Google found it and confused people.
Oops. :-)
Ya, they should be auto_brightness = True by default so that you can see what is on the display. Maybe it's worth having it as (yet another) kwarg to Display so it doesn't flash on init. The light sensor isn't actually used yet. (All three do have one.)
auto_brightness is meant to hand off brightness between user code and the VM. We can't use just brightness because we may want to read back the auto value before transitioning to manual control.
:smile: OK, I'll make a PR in the morning to reconcile all this, and update the doc.
This is work in progress, i'm getting familiar with the Circuitpython code base so let me know if i'm doing something wrong.
The readthedocs builds have been failing for some time, and we didn't really notice.
https://readthedocs.org/projects/circuitpython/builds/
The latest failure is:
ModuleNotFoundError: No module named 'sphinxcontrib.rsvgconverter'
but if you go back a bit, there's an error about a png file that's not really PNG (?).
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) [1{/var/lib/texmf/fo
nts/map/pdftex/updmap/pdftex.map}] [2] [1] [2] [1] [2]libpng error: Not a PNG file
...
Sorry, I was waiting for travis and then got distracted by moderation.
@slender iron I did #1813 completely simultaneously with #1811 being merged π Did you already fix the .png issue in your previous PR?
I've been working on fixing this. By "back a bit" I believe you mean an older build. It was happening because the png was hosted on github and loading it from github returned an html page.
@tulip sleet yes if it was in a previous build
It worked! I just refreshed the rtd page!
ok, clearly I need to π€
https://docs.electronut.in/papyr/circuitpython/ now drawing things with circuitpython on Papyr!
@cerulean pawn nice board
thanks @lofty nova
I experience a hard crash when I use stage module with circuitPython 4 beta 7 recompiled with CIRCUITPY_STAGE = 1 option.
I tried the demo example (ball) and the jumper game. Each time, the game launches and crashes after few minutes.
The crash occurs on a itsybitsy M4 and a metro M4 as well. The display used is adafruit 1.8" Color TFT LCD display with MicroSD Card Breakout - ST7735R (product 358).
Can you please attach the exact code you are running?
The zip file contains all the flash memory and the firmware used for itsybitsy M4 as well
Crashes with master too when the library files are not frozen.
I experienced also a freeze with stage library frozen.
Posted first run of CP controlled Deer Deterrent Device to #show-and-tell ... still much to be done, but off to a good start π
now all the deer that used to watch it will stop
Can you change your grid definition to:
background = stage.Grid(bank,10,8)
And try again? It seems it only happens with a large grid.
Same thing. I experienced a crash with grid(10,8) and ugame and stage frozen
Mine still has yet to crash, but maybe I'm just lucky β it does seem to be random. I will try to figure out how to connect a debugger to the itsybitsy.
Hmm, actually, it didn't crash into safe mode, but the serial comms are frozen...
Same here. I am not in safe mode anymore since I froze the stage and ugame modules
do we have a guide on debugging CP without Atmel Studio?
This is weird, all I get in GDB is:
(gdb) c
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0002f700 in run_background_tasks.part ()
(gdb) bt
#0 0x0002f700 in run_background_tasks.part ()
#1 0x00005116 in main ()
Can you compile with DEBUG=1 so you get line numbers and symbols?
@tulip sleet can you lend me a hand with gdb?
@tulip sleet so I have the debug build crashed with gdb connected, what should I do now?
an by crashed I mean that the LED is pulsing
but the program seems to be running still
so it sounds like a hard crash, and you've already lost the stack
hmm ??
what does the backtrace show?
(gdb) target extended-remote :2331
Remote debugging using :2331
0x0000058c in ?? ()
(gdb) load
Loading section .text, size 0x3b858 lma 0x4000
Loading section .ARM.exidx, size 0x8 lma 0x3f858
Loading section .data, size 0x2e4 lma 0x3f860
Start address 0x4000, load size 244548
Transfer rate: 14048 KB/sec, 13586 bytes/write.
(gdb) monitor reset
Resetting target
(gdb) c
Continuing.
this is what gdb is at
should I ^C it?
so, set a breakpoint at HardFault_Handler and restart it. That should catch a hard crash. If that doesn't work you can set a breakpoint at nlr_jump, which will catch Python exceptions
when you did mon reset and c, you restarted CircuitPython
I interrupted it, and now I got:
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000511a in run_code_py (safe_mode=<optimized out>) at ../../main.c:257
257 if (reload_requested) {
(gdb) tb
Temporary breakpoint 1 at 0x511a: file ../../main.c, line 257.
(gdb)
ok, I spoke too soon above. You did a load, mon reset, and c, and that started it for the first time. so when it crashes or hangs, if it doesn't come back to the gdb prompt, then ^C, and let's look at the stack
what is the symptom when it stops working properly?
to restart, you don't need to do a load again (maybe that's obvious), just mon reset and c
restarted it with a breakpoint on that handler
well, the symptom is that the led is pulsing yellow, the repl is getting disconnected, and when you re-connect it, you get the info about the safe mode
and hard fault
the backtrace from the hardfault breakpoint should give you helpful info, unless the stack has been smashed
we'll see
I really hope this is that last bug we've been trying to find
but it may be something in stage as well
you have the absolute latest master, right? Scott fixed a re-initialization problem last night
yes
the i2c stuff? I don't think that's related
now it crashed usb on my computer...
aaaahhh π¦
Breakpoint 2, HardFault_Handler () at supervisor/port.c:289
289 {
(gdb) bt
#0 HardFault_Handler () at supervisor/port.c:289
#1 <signal handler called>
Backtrace stopped: Cannot access memory at address 0x2002fbf8
(gdb)
do you use exceptions extensively in the code? If not, set a breakpoint at nlr_jump, and you can see if it throws a Python exception that you're not expecting.
ok, in a moment, need to reboot
if you stay in gdb too long, then you'll lose the repl connection, but you can reconnect
how do you mean it crashed usb?
my keyboard and mouse stopped working
but it's a laptop, so the internal keyboard and touchpad still worked
is it ubuntu?
18.04?
honestly, I haven't seen that before. I've been hanging up a particular port when trying to the debug the SMART errors on the BOOT drive, but I haven't broken USB completely
yeah, actually mint 19 tara, but same thing
I blame the kvm, it's a bit funky
it's the only one that lets me use a mech keyboard
oh π
(gdb) breakpoint HardFault_Handler
Undefined command: "breakpoint". Try "help".
(gdb) break HardFault_Handler
Breakpoint 1 at 0x31508: file supervisor/port.c, line 289.
(gdb) break nlr_jump
Breakpoint 2 at 0x1a89c: file ../../py/nlrthumb.c, line 92.
(gdb) c
Continuing.
Breakpoint 2, nlr_jump (val=0x2000133c <mp_state_ctx+40>)
at ../../py/nlrthumb.c:92
92 NORETURN void nlr_jump(void *val) {
(gdb) c
Continuing.
Breakpoint 2, nlr_jump (val=0x2000133c <mp_state_ctx+40>)
at ../../py/nlrthumb.c:92
92 NORETURN void nlr_jump(void *val) {
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0xdeadbeee in ?? ()
(gdb) bt
#0 0xdeadbeee in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
now I can't connect to it
gdb is being difficult
(gdb) monitor reset
Resetting target
(gdb) break HardFault_Handler
Breakpoint 1 at 0x31508: file supervisor/port.c, line 289.
(gdb) break nlr_jump
Breakpoint 2 at 0x1a89c: file ../../py/nlrthumb.c, line 92.
(gdb) c
Continuing.
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000058c in ?? ()
(gdb) bt
#0 0x0000058c in ?? ()
#1 0xfffffffe in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
ok, I think I finally have something useful
Breakpoint 1, HardFault_Handler () at supervisor/port.c:289
289 {
(gdb) bt
#0 HardFault_Handler () at supervisor/port.c:289
#1 <signal handler called>
#2 0x20006f90 in ?? ()
#3 0x0001561a in common_hal_busio_spi_write.part.1 (self=<optimized out>,
data=<optimized out>, len=<optimized out>) at common-hal/busio/SPI.c:320
#4 0x2000133c in mp_state_ctx ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
After a few tries, I managed to get this traceback:
Breakpoint 1, HardFault_Handler () at supervisor/port.c:289
289 {
(gdb) bt
#0 HardFault_Handler () at supervisor/port.c:289
#1 <signal handler called>
#2 0x20006f90 in ?? ()
#3 0x0001561a in common_hal_busio_spi_write.part.1 (self=<optimized out>,
data=<optimized out>, len=<optimized out>) at common-hal/busio/SPI.c:320
#4 0x2000133c in mp_state_ctx ()
Backtrace stopped: previous frame identical to this frame (corrupt...
that line is status = spi_io->write(spi_io, data, len);
looking at the code, that only gets called when transferring less than 16 bytes
so it must be one of the commands
If you remove the flto flag for debug in the makefile, gdb will show the param values in the trace..
ok, trying that
And if they're pointers, you can print the dereferenced values with print.
#0 HardFault_Handler () at supervisor/port.c:296
#1 <signal handler called>
#2 0x20006fa0 in ?? ()
#3 0x0002c94e in common_hal_busio_spi_write (self=<optimized out>,
data=0x2000181e <displays+94> "*+,", len=1) at common-hal/busio/SPI.c:320
#4 0x200012b8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
looks like sending one of the commands
sorry, I had to go out
Good idea, removed the sort by download option.
could it be that it is crashing because displayio is trying to write to spi while stage is already doing that?
the spi writes are synchronous (or should be)
how would I figure out which member is <displays+94>?
yes
and with flto disabled
that gives me the whole struct
$5 = {{fourwire_bus = {base = {type = 0x47a44 <displayio_fourwire_type>},
bus = 0x20002920, inline_bus = {base = {type = 0x0}, spi_desc = {dev = {
prvt = 0x0, char_size = 0 '\000', dummy_byte = 0}, io = {
write = 0x0, read = 0x0}, flags = 0}, has_lock = false,
clock_pin = 0 '\000', MOSI_pin = 0 '\000', MISO_pin = 0 '\000'},
command = {base = {type = 0x0}, pin = 0x44e30 <pin_PB09>, output = true,
open_drain = false}, chip_select = {base = {type = 0x0},
pin = 0x44e20 <pin_PB08>, output = true, open_drain = false}, reset = {
base = {type = 0x0}, pin = 0x44c90 <pin_PA04>, output = true,
open_drain = false}, frequency = 24000000, polarity = 0 '\000',
phase = 0 '\000'}, parallel_bus = {base = {
type = 0x47a44 <displayio_fourwire_type>}, bus = 0x20002920 "p0",
command = {base = {type = 0x0}, pin = 0x0, output = false,
open_drain = false}, chip_select = {base = {type = 0x0}, pin = 0x0,
output = false, open_drain = false}, reset = {base = {type = 0x0},
pin = 0x0, output = 48, open_drain = 78}, write = {base = {
type = 0x1}, pin = 0x0, output = 32, open_drain = 78}, read = {
base = {type = 0x1}, pin = 0x0, output = 144, open_drain = 76},
data0_pin = 1 '\001', write_group = 0x16e3600, write_mask = 0}},
display = {base = {type = 0x479b0 <displayio_display_type>},
bus = 0x200017c0 <displays>, width = 160, height = 128, color_depth = 16,
set_column_command = 42 '*', set_row_command = 43 '+',
write_ram_command = 44 ',',
current_group = 0x2000014c <circuitpython_splash>, refresh = false,
last_refresh = 172161, colstart = 0, rowstart = 0,
...
you can find out the addresses by print &displays[0] [1], etc
it's probably set_column_command anyways, because it's first
then print &displays[0].set_column_command, etc.
but let's look at SPI.c:320
we got a faul there (not INSIDE the spi_io->write). so maybe the spi_io value is bad
print spi_io
actually
fr 3
print spi_io
to get to that stack frame
(gdb) print &(displays[0].display.set_column_command)
$14 = (uint8_t *) 0x2000181e <displays+94> "*+,"
(gdb) fr 3
#3 0x0002c94e in common_hal_busio_spi_write (self=<optimized out>,
data=0x2000181e <displays+94> "*+,", len=1) at common-hal/busio/SPI.c:320
320 status = spi_io->write(spi_io, data, len);
(gdb) print spi_io
$15 = (struct io_descriptor *) 0x1
that's a bad address
so print *self and print self->spi_desc
the spi_m_sync_get_io_descriptor() on line 319 may have failed, and we didn't check the return value
(gdb) print *self
value has been optimized out
(gdb) print self->spi_desc
value has been optimized out
get_io_descriptor can't fail
int32_t spi_m_sync_get_io_descriptor(struct spi_m_sync_descriptor *const spi, struct io_descriptor **io)
{
ASSERT(spi && io);
*io = &spi->io;
return 0;
}
you may want to rebuild this with -O0, but it will probably not fit then
also -fno-inline
actually -Og is good: it disables optimizations that interfere with debuggin
ok, I thought this was on a ugame or something
its itsybitsy m4
are you having fun yet?
there are gui front ends to gdb, but I'm not sure how well they work with remote debugging. I've never used them extensively.
@stuck elbow the buttons for feather_m4_minitft_featherwing dont seem right, looks like it is working but returns initegers, not bool list
out for a brief errand
@upbeat plover it's supposed to return integers, I just forgot to negate them
I will fix that later
of course now it's not crashing :/
oooooooh
that's some serious rounding
@tidal kiln - I thought I saw a brief blip from lady ada the other day about your displayio guide. Can't find it now. Did you post a link?
still in works
Ok. Thanks!
got a specific question about displayio though?
@stuck elbow I'm awake and can help debug now
@tidal kiln are you still seeing that crash?
No, just interested in how it all stacks up.
@slender iron haven't gotten back to it yet. context switch is currently in forums. maybe later today.
I have everything working how I want it to at this point, but I deeper understanding of how all the pieces interact might generate some ideas on other things to try.
Though, I'll be hard pressed beat that nifty bouncing ball demo I saw on Show and Tell last night.
[bitmap + palette] -> [tilegrid] -> [group] -> [display]
ok, thanks @tidal kiln
tilegrid is probably the most interesting one to figure out
Right. Also - the naming seems to have ties to old school graphics/gaming terms, and I don't have experience with that stuff. The terminology doesn't necessarily create meaning contextually for me.
@old smelt I recommend watching this: https://media.ccc.de/v/33c3-8029-the_ultimate_game_boy_talk
@slender iron - thanks for the recommendation. I'll check it out.
It's a really good talk... Such a deep dive on the GB
1 hour?! Whoa... Do I get credit for this? π
The game-wing is very nice.
it goes by fast - the pace is full on tech
Sounds good.
@slender iron OK.. I'm sucked into that talk now
The intro paragraph references the Commodore 64. I remember playing Microsoft Flight Simulator on my buddy's C64 back in the day. We'd type in the load command and then go shoot hoops for about 25 minutes while the game loaded. Good memories.
compiled with -Og and -fnoinline
k, I'll take a look at it and see if I can't find it
@tulip sleet how's the backlight fix coming?
I suspect the memory corruption is still there, just falls in a different place
ya
@slender iron it's done, just needs testing; just eating lunch
@siddacious Would you mind testing the latest master with your Windows box?
@C47D I would define CIRCUITPY_RGB_STATUS in the rgb_status file itself based on the other three. That way it is only dependent on the actual pins.
Fixes #1796.
auto_brightness was interfering with setting brightness manually. Changed the semantics per @makermelissa's suggestion to disable auto_brightness if brightness is set.
Should we also disable manual brightness when auto-brightness is enabled?
How about having just one attribute brightness, and setting it to None for automatic adjustment?
@deshipu With one field you wouldn't be able to read back the auto state. Even in auto the brightness should return the current value so that the manual adjustment can take the current state into account.
@slender iron so, without the optimization flags, it still hangs, but doesn't go into the fault handler. The usb disk still works, but the code and the serial don't.
where is it hanging? sounds like a mismatched lock/unlock
not really a hang, internals seem to be still churning
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
filesystem_background () at ../../supervisor/shared/filesystem.c:44
44 if (filesystem_flush_requested) {
(gdb) c
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
run_background_tasks () at background.c:69
69 filesystem_background();
(gdb) c
Continuing.
^C
Program received signal SIGTRAP, Trace/breakpoint trap.
0x0002651a in audio_dma_background () at audio_dma.c:320
320 if (dma == NULL) {
depending on where I interrupt it
if you have an itsybitsy m4 handy, you can try it yourself, all the files are attached to https://github.com/adafruit/circuitpython/issues/1814
you don't actually need the display and buttons connected
it probably repos on a metro just fine too
I can do that. There's no way to disable it right away if you use board.DISPLAY, but you can always disable it as soon as your program starts.
it's stuck waiting for displayio_display_begin_transaction(display)
hmm, could it be stage conflicting with displayio?
@stuck elbow i tried to make the ball.py more universal, can you review and try it out, i think it can be optimized further by not calling (ugame.display.width), (ugame.display.height) so much
trying to write to display at the same time?
@upbeat plover I want to keep that tutorial simple
that shouldn't be an issue if the locking is correct
displayio_display_begin_transaction does the locking, no?
it delegates to fourwire to do it
this is where I call displayio
all the calls appear matched up well
on technique I like is to set break points on the lock and unlock calls
and then:
$ command 1
> bt
> c
> end```
that way it'll print the backtrace and then continue
you also want $ set pagination off
- that is from memory so it might be slightly wrong
wheee!
a new error after I did that
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00023f7c in tud_task () at ../../lib/tinyusb/src/device/usbd.c:307
307 TU_ASSERT(drv_id < USBD_CLASS_DRIVER_COUNT,);
also, my usb is busted again, rebooting
I recommend a usb data line switch to save your usb bus
you can probably hit the error without having usb connected
@slender iron re the auto_brightness kwd constructor arg. You can always set it immediately. Are you just trying to avoid a flash? Do we have any displays with auto brightness that aren't built in?
@timber mango does it help to power-cycle the KVM switch?
ya, trying to avoid a flash
any display with a pwm pin init will have auto brightness
you can't leave it up to user code because it's not running during the terminal
but the board.c files don't call the constructor; they call the common_hal routine
initial brightness would be ok. having it set could imply manual brightness
i don't understand about pwm having auto brightness. I thought auto brightness was only with an ambient light sensor. Otherwise, brightness would be full on by default.
maybe you mean something else by auto-brightness
a display breakout doesn't have a light sensor, e.g. 1.44 TFT, but it does have PWM backlight pin
i thought auto-brightness was only for native C displays (since the board knows the light sensor pin, etc.)
@tannewt Done in #1812, we should continue the convo over there?
@tulip sleet right now auto means full brightness
Watching that gameboy talk makes be waht to hack some games.
for cases without a light sensor it'll have to be a binary on/off choice
@umbral dagger you should! hopefully circuitpython in the gameboy will become more available over the next few months
(you could assemble one now yourself though)
@umbral dagger stage now works with https://learn.adafruit.com/makecode-arcade-with-samd51-m4/itsybitsy-m4-express
I watch a video on register maniulation in assembly and you mention makecode ? π
Although that seem compelling
@umbral dagger no, you use the same hardware setup, you use circuitpython in place of makercode
Ah
but you can use pretty much any display and buttons, really
@stuck elbow corrupting the spi object's memory could explain the infinite wait on the lock
that was what we saw initially: spi_io was 0x1; it should have been a pointer to a block of function pointers
TODO list based on the code in rgb_status_led, let me know if there's something else to add or something to remove.
- [ ] Keep track of
current_status_color. - [ ] Include code in
reset_status_led. - [ ] Include code in
new_status_color - [ ] Include code in
temp_status_color - [ ] Include code in
clear_temp_status - [ ] Include code in
color_brighness - [ ] Include code in
set_rgb_status_brightness - [ ] Include code in
prep_rgb_status_animation - [ ] Include code ...
@slender iron true
I hate memory corruption bugs, you can't really debug them without time-travelling debugger
You can set a watchpoint!
it triggers when a memory location changes. supported in hardware on the SAMD chips
a watch on the lock member wouldn't help much
no, on spi_io
now it corrupts the lock
@tannewt still present with current master. Normal speed insertion shows a "USB Device not recognized" error and shows up in the device manager as "Unknown USB Device (Device Descriptor Request Failed)"
go back to the previous build maybe, since spi_io should not change much (the value passed in as the arg)
If you plug it in fast, it doesn't happen?
thanks
@slender iron I think for all the possible cases we need both brightness and autobrightness kw args. Could encode one as the other, but that's messy.
works for me
I still have an uneasy feeling that it might be _stage that is corrupting it, but the only place where it writes to memory is this line https://github.com/adafruit/circuitpython/blob/master/shared-module/_stage/__init__.c#L51 and the index computation looks solid to me
@timber mango congrats on learning a debugger first written in 1986
I'm thinking it might be something that is not long-lived but should be, or there's a missing root pointer
@tulip sleet I've seen worse
@stuck elbow it can happen when treating a pointer as the wrong type too
I'm casting between uint16_t and uint8_t there, but I'm adjusting the lengths everywhere for it
Well of course now it works/doesn't happen at any speed! I tested a good 5-8 times before making the previous comment but now it's behaving itself.
@stuck elbow I'm thinking more like the wrong mp_obj
Can you try it with a different cable, especially one that might be of different manufacture? I had a flaky cable once that disconnected when tilted.
Scratch that, it got busted again. Now it's about 50/50 working or not plugging in as fast as I can which is still about "normal"
@dhalbert I've tried with two different cables both in good condition from reputable sources and that worked with other boards just fine. They're both 2 meters, is it worth testing with a shorter cable?
No, that's fine. But are you plugging/unplugging on the board end or the host end? If the board end, try the host end, since it's conceivable it's a problem with the board connector in that case.
Perhaps too obvious, but have you checked the upgrade to beta 7 was applied ok? E.g. look at REPL output or boot_out?
@slender iron ok, scheduler just fired and context switching to CP. looks like there's yet another update on S3? want me to work with 70dd616?
ya, whatever the latest one is @tidal kiln
ok. thanks.
thank you!
Ok, I think I figured it out. The SPI object was getting cleaned up because the never_free didn't correctly mark it's first block during a collect. PR coming soon.
The previous implementation managed to keep all but the head
pointer of the list.
Fixes #1814
@debrouxl @TheKitty What boards have you tried this with? Beta 7 on a CPX worked for me. 70dd6167c07c5d72ae9b803aa25ccb8f1905ec35 on a Metro M4 worked as well.
What models are the computers? (I'm Windows Version 10.0.17134 Build 17134 on a Ryzen 5.)
@debrouxl Where does the "This device cannot start (code 10)". message appear?
@slender iron i just tested 70dd616 on a Metro M4. works aok for me on win10.
quick pointer in the code to where boot.py is loaded and managed?
run_boot_py in main.c?
yep...was just about to point there. https://github.com/adafruit/circuitpython/blob/master/main.c#L292
called at line 422
etags to the rescue
@tannewt "This device cannot start (code 10)" is probably in the device manager of windows
@debrouxl @TheKitty @siddacious
I'm trying to track this down, so I thought I'd ask if you if you could give an inventory of the software installed on your machine. These utilities list installed software, drivers, and security software, respectively. They'll produce a simple HTML report (look under View), or save a list as a text file (select all the items and then choose File->Save.
If you're willing to run these and post the results here, I'd be grateful. If you want to prune the list...
Another thing that would be helpful is a USB trace. This requires either some hardware (Beagle, usually), or else setting up Wireshark and USBPCap to capture the USB events. If you are familiar with this or have such a device, let us know.
@siddacious Are you seeing the same errors as above, or is #1749 different? For instance, if you try before and after the commit @debrouxl has noted, do you see success on a build before that commit? I can make some test builds for you if it would save y...
@siddacious do you have another feather m0 express to test with, just in case the current board has some defect. I once bend a usb port when plugging cable to hard :D
@dhalbert I have seen the "things disappear after flashing" behavior previously with a different board but that wasn't what I've been seeing with my feather m0. I believe it was with my metro m4 when I flashed it with beta 7 to get a backtrace for the i2c issue I reported.
I have the above reports but they're too large to inline here. I can give them to you on discord.
I will try before and after the commit mentioned. I don't have a beagle but I suppose I could get one if you thought it...
@dhalbert was looking through the reports and found this which you had previously mentioned
==================================================
Driver Name : HpSAMD
Display Name :
Description :
Startup Type : Manual
Driver Type : Kernel
Error Control : Normal
Group : SCSI Miniport
Filename : C:\WINDOWS\system32\drivers\HpSAMD.sys
Driver File Type : System Driver
File Created Time : 9/15/2018 12:28:17 AM
File Modified Tim...
5b0c1c8 : fails
5478610: : fails
It's very possible that I'm not seeing the same thing as @debrouxl
@hathach I don't have another feather m0 currently but I'm going to grab one in my next order
@siddacious Thanks for all the info. Don't spend time on the Wireshark stuff for now. Let's see what the new Feather M0 shows.
You can zip up all the reports in the reports and then include the .zip file here.
@dhalbert I had already done a capture by the time I saw your comment, so I included captures of a failure and success in the above zip.
@critor 's tests used a M0-class TI-Python Adapter platform, which was featured several times on the Adafruit blog, against Windows 10 1803 17134.706. AFAWCT, unsurprisingly, the TI-Python Adapter and various M0-based platforms have excellent compatibility: several Adafruit platforms and the Arduino Zero can run TI's firmware verbatim, and the TI-Python Adapter can run at least my improved build of CircuitPython featuring more math functions.
critor is familiar with USBPcap, he's used it mul...
@tannewt In light of other, possibly sporadic USB with boards running CircuitPython (#1749 #1782) issues perhaps this is worth digging into more? Can you ask a few of the usual suspects to cut and paste that raise line into REPL 15 times carefully to see if they can reproduce this ideally on Windows? They need to check each time visually that output has popped out in full before pasting the next one in.
@debrouxl I just want to understand clearly what's failing. Tell me if this is correct: You have seen this problem with regular (not just custom) CircuitPython builds at commit 9d43a25 and later. When a board (including several Adafruit boards) is running a CircuitPython build at or later than that commit, then it does not enumerate on your Windows 10 machine.
- Is the above correct.
- Does it have to be running a particular
boot.pyandmain.py/code.py, or is it just the build itsel...
@TheKitty Does the problem happen if you do not use the hub? Does it happen with beta.7, with and without the hub?
This was completed and merged. New files can be added to _blinka/
@sommersoft At first glance, this looks great. I can copy it over to my fork and integrate the new components that were added.
@slender iron had at least one hardfault with 70dd616 while playing around with displayio stuff last night. i've soldered on a SWD connector so i can try and capture a stack trace for you. currently trying to get all that sw setup and working.
@slender iron got async DMA spi working on Β΅Game, you were right, there is barely any speedup
@slender iron but I untangled the shared_dma_transfer into shared_dma_transfer_start and shared_dma_transfer_wait in peripherals, maybe we want to keep that?
Hi, I'm working to try to get the particle RGB Status LEDs working, I just noticed that particle boards have already defined symbols for those pins, MICROPY_HW_RGB_LED_RED for the red one, etc, I was thinking on defining symbols like CIRCUITPY_RGB_STATUS_R for the same purpose, should I use MICROPY_HW_RGB_LED_RED for all bords as it's already defined?
@granite crow yes, you can use the existing names for those pins. Take a look at some existing boards for guidance
@tulip sleet hi, from what I found only Particle boards have those symbols defined, so I think I will stick with those symbols, MakerDiary and Nordic Dongle boards don't have any reference to it's RGB LEDs. This is in reference of issue 1382
@siddacious HpSAMD.sys is included in all Windows installs. The SAMD is Storage Array Media Driver, unrelated to SAMD chips (which you probably know already). Did I mention that??
@granite crow since the dongle (pca10059) has one plain red LED, we were using that. Feel free to #define new names to help use the RGB led, with names that match other such cases.
@dhalbert OK I just saw "Smart Array" and SAS and though it might be related to the SMART issues you noticed earlier this week.
@tidal kiln were you making your own fourwire bus? I fixed a bug around that
@slender iron no pyportal
@stuck elbow it's definitely worth getting in (maybe once 4.0 is done). It'll matter more when the pixel computation is fast
@tidal kiln hrm, k please file an issue on it
@granite crow I'm ok if you want to rename. Either name is good
@river quest yup! look nice. definitely the right pocket color scheme
@slender iron right now I have a hack in there because I couldn't find a way of making the wait function idempotent -- that is, to do nothing if no transfer is happening
I can make a pull request with the hacky code I have, and we can take it from there
@debrouxl @TheKitty What boards have you tried this with?
For me, only Trinket M0.
What models are the computers? (I'm Windows Version 10.0.17134 Build 17134 on a Ryzen 5.)
Confirmed the issue on two Asus laptops running Windows 10 family build 17134.
@stuck elbow sounds good. I'm out this weekend so I'll look next week.
happy holidays
cool article from digikey https://www.digikey.com/en/articles/techzone/2019/mar/the-basics-of-circuitpython-for-rapid-microcontroller-based-prototyping-and-development
Adafruitβs CircuitPython brings the increasingly popular Python programming language to inexpensive, embedded microcontroller dev boards.
My first usb breakout/passthrough/sniffer board is complete.
Here Iβm analyzing the serial data from my dmm to the serial-to-usb adapter and the usb data from the adapter to the computer.
@critor Could you post the .uf2 you are using, if it is not a CircuitPython build? Are you building off the latest master? You can zip it up and attach it here.
What CPU chip is used in the Asus laptops: is it an AMD, or Intel?
there is no mechanism for accessing the card via the USB port on the device. That is, there's no passthrough from USB to the card filesystem
Hello dhalbert,
What would need to be done to enable this functionality? It seems like the plumbing is already there since it works with spi flash chips already.
I have some projects that need to be enclosed in project boxes, yet the sd card will be full of sounds and config files that need to be edited from time to time. It would be great to ...
CIRCUITPY is a single filesystem volume. The SD card is another storage volume, and so isn't visible inside CIRCUITPY.
It is conceivable we could do this, but we'd have to think about it. One issue is whether the SD card volume would be readonly. To use it safely while the program is running, it would need to be mounted readonly to the CircuitPython code, in case you were editing it over USB at the same time.
We can reopen this as a long-term feature. I'll discuss it with the other core...
I'm not building the firmware myself, I've just been testing binaries provided by @debrouxl on my Trinket M0. So I'll let him clarify.
Today's tests show that he can't reproduce the problem with pristine master (sorry, I should have checked earlier). However, he can reproduce at will with small changes in the USB ares on top of current adafruit/circuitpython master HEAD, which I've pushed at https://github.com/debrouxl/circuitpython/tree/trinketm0_usb_comm_broken_after_tinyusb_change .
It's just a matter of disabling and not building USB HID + USB MIDI support, and poof, USB communication capability between @critor 's compu...
@debrouxl You have to remove the HID and MIDI devices from the USB descriptor as well. I did that: here's a diff from the branch you linked to above. My changes are the two ####### to comment out those devices.
diff --git a/tools/gen_usb_descriptor.py b/tools/gen_usb_descriptor.py
index 10bbf5066..ae824b207 100644
--- a/tools/gen_usb_descriptor.py
+++ b/tools/gen_usb_descriptor.py
@@ -276,14 +276,14 @@ descriptor_list.extend(cdc_interfaces)
descriptor_list.extend(msc_interfaces)...
@tulip sleet I realize it's "when it's ready", but I wonder if you have any tentative release plans?
I think that bug with copying a file while spi is running was just the same gc-related bug that was just fixed
@tannewt Ok, I will keep the symbols as I have them until now, there are some functions I haven't implemented so far, idk if you can take a look at the PR next week when you have some free time.
The build is failing with invalid option "--api_key="
Thanks
I'll probably need one set up for Adafruit_CircuitPython_ST7789 soon too.
@tulip sleet Happy to hear that there may be a RC soon. π Will nrf52840 boards remain "beta" or will they be considered "stable" with an upcoming release? π
I've been using multiple boards recently plugged into the same host and I've left a zero byte file on each to mark them so I can ensure from REPL I'm using the correct board when it's important. I noticed on this particular CPX (running 4.0.0 beta 7) that there are loads of bogus 8.3 filenames composed purely of NUL characters. Is this minor file system corruption or a os.listdir bug? Windows file explorer and old skool DOS emulated dir show everything normal.
Press any key to...
Note: 128 entries in total coming back from os.listdir().
It certainly looks like the filesystem is corrupted. I'm not sure it has to do with your marker files, except that perhaps the file metadata was not written completely before the board was reset. If you could copy everything back and reformat the filesystem, that would probably help.
>>> import storage
>>> storage.erase_filesystem()
That was my first thought but I then wondered if this could be an obscure listdir bug? This probably gets limited used, I've only used it a hand full of times.
Is there an fsck equivalent library call to independently check the health of the file system? Actually
there's the crappy old DOS remant, chkdsk and that does show problems:
C:\Users>chkdsk e:
The type of the file system is FAT.
Volume Serial Number is xxxx-xxxx
Windows is verifying files and folders...
Wind...
@nocturne hatch The nRF boards will also be not beta. There are more BLE features to add, but the the current build is stable.
Great! π Does that mean there will be more features added to the BLE library, once the 4.0.0 release is finished? π
π
