#circuitpython-dev
1 messages ยท Page 170 of 1
at least setting 10k produces 10k
I guess that is encouraging - I don't see it being changed in the bno055 driver either.
@raven canopy Review away!
400k is more like 105k (setting it explicitly)
just opened my old trace. M0+BNO055. it's ~333k
same for M0+TCS34725
ESP8266+TCS34725 is more like ~100k though ๐ค
hmm -- maybe bitbang just can't keep up.
but it works with the TCS34725, even though the freq is suspect
most devices are not too fussy about the freq, I dont think.
yah. guess the bno055 isn't one of those.
are you set up to where you can test and see if you get same suspect freq?
tcs34725 has no minimum - up to 400K -- like te ccs811 I just think the bno055 is a pain
with whatever sensor
it'll take a few minutes
if you're willing to. please do. if you see same thing i'll update the info in the issues.
if it's real, guess it points to something else going on under the hood to be looked into
just finishing a phone call with Comcast ๐ hopefully done son
no worries. when ever you can. you can just ping me.
@tidal kiln with default on a apds9960 -- I am seeing ~100K out and the responses are at ~75K looks like clock stretching does work ๐
but you're seeing 100k instead of 400k?
yah. but why 100kHz clock? that's not expected. right?
not really sure what bitbang can do
just a sec
there is a delay between high/low in bitback and I thin it default sto 5 microsec - so 100K will be the max rate
checking code
we the delay is 5 microsec at 100KHZ but should be 1 microsec at 400Khz, https://github.com/adafruit/circuitpython/blob/master/shared-module/bitbangio/I2C.c#L153
but taht is just the delay, takes time to execute teh code.
not sure waht to expect for the max rate
me neither. thanks for checking.
May need to get some thoughts from Radomir
since i love jumping into the middle of things... we're talking bitbang specific to esp8266? or port agnostic?
for now. just esp8266.
Should be agnostic though.
k. runs to esp8266/common-hal/
Real code is at top level shared-module and shared-bindings
I'll see what it looks like with bitbang on an M0 -- will take a few minuts to switch
@tulip sleet thanks for the quick look and your suggestions and advice on the SAMD21J18 issue. I made changes and that appears to have fixed those build errors.
the extra paren needed to be moved to the end of that block, and i changed the TC(7,0,0) to TC(7,0) for PB22,PB00 and did a similar thing for PB23 TC(7,1)
now i can continue on .... your help is much appreciated.
@tidal kiln not having any luck getting this sensor to work wot bitbang on the M0
with busio it runs fine at 400K
what does the bitbang clock at on the M0?
same code - not sure where the clock comes from.
ha - mcp9808 on M0 with deafult at 400K runsa at about 50Khz!
busio is at 400KHz
is looking at microsecond accuracy on esp
not ready to suggest using an ets_timer function yet, but would like to rule out that os_delay_us isn't just a "close enough".
but in the bitbagio code it sprinkles lost of 1 micros second delays in the sequence
With CP, is there a way to detach a servo to save battery, then quickly attach it again only when it's needed?
@raven canopy I'm not sure there isa "timing" problem . it may be slower thatn expected, but it should still work.
@spare storm you would need additional hardware, to actually cut power to the servo. but CP could then be used to control that hardware. what are you currently working with?
Circuit Playground Express with a CRICKIT
well, if 400kHz is expected, and measured results are below that, then i would think it's a timing issue since bitbangio is using delay(self->us_delay) as it's time keeper. unless i'm reading that wrong. which is TOTALLY possible. ๐
And I see the asme thing on mcp9808 taht read is slower tahtn write, and that may not be clock stretching aferall just the way bitbang works.
yes, but teh master drives the clock at any freq it wants - it may not be 400Hkz, but that is jut the upper limit for Fast I2C
I may be totally minsundersting how it works so I'll defer to you "hardware guys"
looks for the hardware guys ๐
some sensors work fine -- others seem to be more finicky
anyone who can spell schematic is a hardware guy ๐
my understanding was that bitbangio influences the timing since its not a hardware I2C scenario. basically, it tricks the master into thinking "yes...i am exactly like you". and has to keep up the ruse.
maybe so - I suppose some devices may just be more forgiving than others.
yeah. all depends on the allowed variance for ACKs and NACKs. now, i want a SNACK. ๐
ANd I need to get to bed! wish I could have helped more -- maybe new ideas tomorrow.
@solar whale later. thanks for helping.
night @solar whale. and never doubt your helpfullness!
Thanks! Goodnight!
@idle owl uhoh, something i'm going to run into?
๐ Probably
But here's the frustrating thing. I have these panels wired up to a raspberry pi and they work great. I just connected them to a feather and they're not working.
Why.
I just connected another set to the Feather: works fine
So....
@ruby atlas The ones I had you get are the ones I just made work with no effort ๐
You don't have to solder up that strip, comes presoldered. It's nice.
Ahh... Nice!
Ugh, that's so weird re that one set especially since it works with the rPI.
Yeah I'm confused.
running off of external power, I didn't even wire power up to the feather, wouldn't have given enough
hehe. i was debating a "check grounds" comment. ๐
I mean it's the same ground line, but it's not the same location
if that makes sense
the DotStars are powered from the center of the strips.
and the Feather is on one end.
yep. (i always pull my multimeter out anyhow and ensure i get the nice beeeeeep on the continuity test saying the grounds are connected)
We apparently don't know how to use our multimeter to do that ๐
or we need a new one. evidently.
hmm, most have a diode test mode that doubles as continuity.
it sends a signal, because I can get some to light up, inconsistently, but it doesn't ever like to accept the (0, 0, 0) to shut them the hell off.
is blinded over here
cover them with sheets of paper?
๐
man i should totally get a newer meter. all the newer ones are smaller and prettier.
i wouldn't imagine the resistance on the rail length would be enough to cause an issue. grabs meter because he caused his own curiosity
(mine's like 20 years old)
ok I just used a jumper wire to attach the ground on the power directly to the feather instead of the groundwire I have soldered on
yep. exactly zero ohms.. ๐
Scope time?
DotStars are SPI right?
so claims the adafruit site!
now I'm wondering if I simply wired it wrong.
SCK and MOSI right?
I mean I wrote a guide that says that, but now I don't trust my own work since I'm the one who wrote it.....
Could you have a dud feather? do other strips work on it?
Master Out Slave In. you are correct.
Other strips work fine.
Gremlins.
did you have SCK and MOSI crossed, perhaps?
I'm going to have a fit if there's something going on with these strips. They're carefully wired into panels for my tabletop lightbox.
@raven canopy A different strip worked fine
backwards on the strips maybe? seems unlikely... but I'll try jumper wires.
no nothing happens if I swap them.
sigh
I just grabbed another piece of the same strip. And it works fine.
Or not.
maybe miracle max can revive it
So I grabbed a different white strip.
Presoldered.
And it flickers weirdly.
At least it responds when I change the levels though.
sigh. I have no idea.
I thought the white strips acted the same as the coloured ones, just three LEDs you control the levels for. Maybe they don't.
hmmm... the RGBW ones?
No, there aren't RGBW Dotstars.
There's all white ones.
Still 3 LEDs in them like RGB, except each is white.
Same temperature.
But they're acting weird. And that's two presoldered short strips acting strange.
I wonder if the white ones are different.
https://www.adafruit.com/product/2437 still links to the APA102C datasheet.
Move over NeoPixels, there's a new LED strip in town! These fancy new DotStar LED strips are a great upgrade for people who have loved and used NeoPixel strips for a few years but want ...
from the cool white product page:
The manufacturer of the APA102C smart LED used in this strip used to be GRB order, and has changed in 2015 to have BRG color order.
from the RGB product page:
The manufacturer of the APA102C smart LED used in this strip used to be DOTSTAR_GRB order, and has changed in 2015 to have DOTSTAR_BRG color order and then in 2017 to DOTSTAR_BGR
and Note: Strips come with 4 solder points per segment, but the arrangement may vary depending on the supplier, so please check when soldering/powering!
I guess that's something else i'll have to keep in mind!
alright. this is my last build-n-test for the night. gotta catch up on Westworld! ๐
Yeah I keep verifying by reading the order on the strip.
And I don't care which order they're in, they're all white ๐
They flicker when simply sitting here.
I Don't know.
are you using a level shifter? (i know...duh question)
No...... I didn't think SPI needed it.
DotStars are 5V devices. While you might get them to respond to 3.3V signals, this is not a guaranteed thing and should not be counted on. For low-voltage microcontrollers and systems such as Raspberry Pi, a logic level shifter (e.g. 74AHCT125) is recommended for both the data and clock pins.
ugh. I was going to use Itsy (has it built in) but I wanted to use the Joy Featherwing.
GLERGH.
sowwy. ๐ฆ
ok. Nah, don't be that at all. At least you figured out what it might be.
odd though that your RPi was working at 3.3, but not the feather.
Yeah for sure.
depends what the true voltage is!
maybe the pi is 3.4v and the feather is 3.25v
and the tolerances on each strip will vary
I'll try it on an itsy tomorrow. If it works, I guess I'm figuring out how to wire a featherwing to an ItsyBitsy ๐
true. just measured my feather's 3v pin. 3.30, spot on. but, i've seen the GPIO pins at around 3.2x before.
don't have these around? https://www.adafruit.com/product/1787
Yeah but I wanted the project to be super compact.
also, the rise and fall of the SPI activity is definitely a factor. the ramp might never get to 3.3...
I have them around from the last project that started on a different board and ended on an ItsyBitsy for this exact bloody reason
Except was NeoPixel.
Problem is that the VHi pin on Itsy isn't HW SPI.
Don't think anyway. Why would it be.
But it has a level shifter built in and would at least tell me if that's why these won't work.
and you'll need two pins, right?
Just won't be as fast to respond. Which I guess doesn't matter since it's not like I'm looking for sick animations.
Oh crap.
Yes.
And there's only one with the shifter in it.
ugh.
bridged itsys? hehe.
comes out to the same size as the featherwing in the end right?
๐ข
bleh.
I guess I'll try them on Itsy with data on the 5V logic pin at least
see if that's enough.
hmm, i hope i have some level shifters in my giant box of parts
it could be. ๐คท
I have no problem running RGB strips without this, @ruby atlas
This is a new issue.
Maybe the tolerances are different, I don't know.
Ok I need to bail an hour ago.
Goodnight!
later @idle owl ! i'm off to. build complained of something...and i just don't wanna. ๐ ๐ค
I have some 8 channel level shifters. and i also need to sleep.
๐ ๐ค
okay ๐ after this 3d print job!
hehe
another iteration of my super compact gemma case
[adafruit/circuitpython] Pull request opened: #859 refactor longint settings; make crickit cpx build
- Refactor how longint is chosen: set longint choice in mpconfigboard.mk, and propagate it to .h automatically. This is a a little simpler and more orthogonal.
- Create a
circuit_playground_crickitBOARDwithadafruit_seesawandadafruit_motorfrozen in, and withframebufturned off. HID was removed from the frozen module list to make space.
The CPX Crickit build is very close to running out of space (96 bytes left!), with longints turned on and the frozen modules above includ...
Typo here, LONGONG -> LONGLONG
Thank you. LONGLONG takes more flash than MPZ, so I was just putting it in for completeness.
@tidal kiln @raven canopy looking agin at https://github.com/adafruit/circuitpython/blob/master/shared-module/bitbangio/I2C.c specifically at the write_byte and read_byte functions, it looks like each call delay and release (which contains a delay) so if dlay is set to 1 micirsecond as it is for the default case, then there is at least a 2 microsecond delay but that should still allow speeds approaching 400KHz. If the connected devis is holding SCL Low then the scl_release will wait for it. Otherwise, it is not clear to me why the bitbang frequency should be so slow. @stuck elbow Do you have any idea when when the I2C frequency is set to 400Khz, the apparent actaul frequency (seen on the logic analyzer) is more like 100Khz?
@solar whale that is why I was looking into os_delay_us/microsecond accuracy. While it should be 1us delay each time, it could end up being 4 or 5 based on the esp and/or the VM loop.
@raven canopy imakes sense -- would you exepct it to behave differently on a SAMD21? My one test had it even worse.
I wonder if we could somehow get a timestamp out to debug it, using the clock's tick...
@solar whale theoretically, yes, any inaccuracies would be possible on all ports. On the SAMD delay is using the SysTick counter.
I'll try to do some more measurements this evening . Just want to make sure the results are consistent. they seem to be. the tests @tidal kiln and I ran seem to agree.
I wish we had a way to debug the esp...
yep. and then the next question is why the bno055 is so picky about all this, while other sensors just keep on truckin
Beyond print, obviously.
I can get my dremmel tool out again ๐
@tidal kiln - It was interesting that the adps9960 worked on ESP , but not with bitbang on M0 - works fine with HW I2C on M0
but my mcp9808 temp sensor works everywhere....
I love Bosch datasheets. But sometimes all the detail can hide what you're looking for. ๐
Resurfacing from PyCon conference... Thank you @tulip sleet @idle owl @slender iron for all of the open spaces and sprints to introduce and inspire folks to try CircuitPython with the special edition PyCon Gemma. On behalf of the Python Software Foundation, thank you @meager fog and @heady dove for supporting education, Python, and all the Blinka things โฅ
@solar whale @tidal kiln BNO055 datasheet, table 4-8, shows a minimum of 1.3us for SDA start pulse (tBUFF) and SCL low (tLOW; ACK signal I assume). If the delay(self->us_delay) is [accurately] operating at 1us, which is any frequency above 250kHz since self->us_delay = 500000 / frequency, that may explain the "pickyness". Would have to compare the other devices mentioned though to verify that theory further.
@raven canopy thanks. yah. i was looking at that last night but brain was done for the day. :(
but also - i couldn't get things to work even with a freq of 10k.
Well, darn. There's always UART...which I just discovered in the sheet. Haha
yep, that's the recommended way to use it with a rpi. (rpi has a clock stretch bug in hardware)
Seems simple enough. Remove the pull-ups and ground address select.
True. Good point.
Which is the better way to initialize a seesaw Crickit signal IO pin as an input triggered by an RF receiver? ss.pin_mode(RF0, ss.INPUT) or RF0 = DigitalInOut(ss, 11)
Also, is the way you monitor that pin for a signal (HIGH) different depending on which approach you used to define that input?
I ask because the examples I see for input through the signal IO each seem to do this a different way and I don't know why. ๐ Thanks!
@spare storm I'd recommend using the DigitalInOut object since it will be interchangeable with other digital in out objects
I'm back in Seattle btw if you ever want to meet up in person
Thanks @slender iron, and that would be great, you can meet Tom and Crow once I get them to work with the crickit! ๐
๐ I'm in ballard. Are you close?
Very, we're in Queen Anne
awesome!
tom and croooooow?
Yes, Tom and Crow, I made the bots actual robots. ๐
Just working on converting them from Arduino to Crickit
I think I now the answer here, but I just want to get an opinion on this. My end game is to work with the Feather family of boards using Python, (both micro- and circuit-.) I am in the process of learning Python 3, but would it worth my time and effort to learn the Arduino IDE /language as well? Is there a list of what boards I will not be able to use if I only go the Python route only? Is it a matter of support for certain chip sets?
@tulip sleet @idle owl when you do library releases can you include the full release notes? It may be the first thing people find about a driver. ```<change description>
To use in CircuitPython, download the .mpy file and copy it to the lib folder on the CIRCUITPY drive. Or, simply install the Adafruit CircuitPython bundle.
Read the docs for info on how to use it.```
@rigid path I'd stick with Python until you can't do something with it. At some point you'll need the speed of arduino/C and you can switch then
- Per @ladyada, turn off longint support to make more room
- Update frozen libs to latest versions.
@slender iron thanks for the input. Am I safe using any of the M0 boards with Python ? Should I be good using any of the other wings?
@slender iron tried to get changes in before your review. ๐ Also will do on the full release notes things.
@rigid path We tend to have CircuitPython support for all of the M0 boards but not necessarily all of the peripherals. Again, I wouldn't worry about it until you run into something that isn't supported
@tulip sleet np, a second PR is fine
@slender iron Thank you.
@margaret I think the simplest thing is to not support precise_time on non-express builds where long ints aren't supported.
This macro can test for it:
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_NONE
Thanks @jerryneedell ! New repo is here: https://github.com/adafruit/Adafruit_CircuitPython_TMP007
Please propose a PR and let me know if you need me to run cookiecutter.
In the past I have run cookie cutter locally then uploaded the files in the PR - Is that ok or is there a better way?
Hello, I'm programming an esp32 for a school project, and i'm trying to use an SD card adapter to save files on the sd card. I have searched for some examples and came to the conclusion that almost all of the examples use the modules adafruit_sdcard and busio. Now I've got the adafruit_sdcard module working, my only problem now is with the busio module. I keep getting the ImportError no module named 'busio'. I have the adafruit_bus_device folder in my python lib and on my esp32, and still get the same error. I hope anyone can help me with this problem ๐
@wide wharf On the ESP32 you must be using MicroPython which doesn't have busio because its a CircuitPython API.
@slender iron Ah that makes sense thanks ๐
so look for a MicroPython sdcard tutorial. (I think it has it built in)
Will do thanks again
np!
@mikepschneider I'd recommend moving the test file into a test directory. We may need to exempt a test directory from the build here like we do for examples.
Hmm, which is better?
SB0 = DigitalInOut(ss, 2)
SB0.switch_to_output()
or
SB1 = DigitalInOut(ss, 3)
SB1.direction = Direction.OUTPUT
@spare storm both are good. the first form allows you to change other things at the same time if you like (like the value)
Good to know, the SB triggers when it goes low so I might set the val to high here.
Thanks!
@slender iron Yep, good call on the releases. Will do.
Wow Metro M4 almost out, CRIKIT going fast.
@slender iron For the Learn repo, should I be adding your requested ignore rules into the .pylintrc file as well? Or is that what Craig is doing when he says he's adding them? I wasn't sure if he was editing that as well as the files.
@ruby atlas @raven canopy It looks like putting data on the 5V logic pin on ItsyBitsy and clock on another arbitrary pin was enough to get the DotStars to start responding correctly.
They're definitely slower, you can see them write along the strip as though I had programmed them to light up one at a time with a really short delay. But for my purposes, it should be fine.
Hey @ruby atlas ya just done me a solid. Would have not spotted the Crickit in the wild.
I got mine, jack. tnx --nis
@idle owl my intention was that it'd be done per file
@slender iron Excellent.
We're not going to block 3.0 on this. We'll add support once https://github.com/adafruit/Adafruit_FreeTouch supports it.
oh, yay, cpx in the search box now matches circuit playground express products
Could you please provide step by step instructions on how I could reproduce this? You say you are using paste mode but also provide a code.py. Which one is running when the crash happens?
M4 will come later once its supported by FreeTouch.
Fixes #670
hold off on a review. I'm still testing this
@ruby atlas Hmmm... putting a Crikit on a MetroM4... That would be fun. Iโm totally hacking a 6-pin connector on one.
[adafruit/circuitpython] New comment on issue #328: Document more differences between various builds
framebuf and other modules outside of shared-bindings aren't listed because they aren't supported. Ideally, only shared-bindings modules are supported because that structure ensures they are documented well too.
@kattni Mind doing this soon so we can close this issue?
[adafruit/circuitpython] New comment on issue #328: Document more differences between various builds
@dhalbert Mind doing this soon so we can close this issue? Thanks!
Ok, please take a look @dhalbert
@jerryneedell Is this done now?
The clock stretching timeout is in so I think the intent is complete. We may want to start a new issue for ongoing problems with bitbangio. @carternuson issue is not resolved but it may not be related to clock stretching.
@idle owl or @slender iron should each and every library .py file have __version__ and __repo__? Just checking. Fixing up seesaw lib.
@tulip sleet unsolicited: pretty sure, yes. it's in the cookiecutter, and is used by sphinx for RTD (iirc).
k - thanks!
@tulip sleet i just reread your question, and i think i missed an important distinction you made.
"every single .py" being that distinction.
my example is that in Adafruit_CircuitPython_Motor, adafruit_motor/*.py all have __version__ and __repo__ (except for __init__.py
i'm perusing the lib right now, and i think that the only ones that absolutely need it are any of them that are listed in docs/api.rst.
so, seesaw.py will need it (doesn't have it on current master), but the rest should be fine without it.
is that just because api.rst is incomplete on seesaw?
Let's close it for now. We can re-open if it starts looking like clock stretching actually is the issue.
there are a few helper .py files
could be, yeah. so if you're adding them to the api.rst, then __version__ at a minimum is probably a good idea. since the version of each sub-module can be updated independently.
I'll remove them from the helpers. The __repo__ strings are kind of long and it would save space not to have them everywhere.
sorry. i should've just let Scott or Kattni answer. ๐
np - I rarely write libraries and am unfamiliar with the conventions
tnx, so I put the two constants in all files in seesaw except for some internal .py's that are imported to provide to some constants.
ahh. so it's used by adabot, not sphinx?
they should be in all of them because we don't group .pys by "package"
we shouldn't assume all .pys are together
so every .py except __init__.py should have them?
even .py's that will never be documented?
783ffe6 Update CONTRIBUTING.md to include new learn gui... - tannewt
e274a02 Merge pull request #862 from tannewt/contributi... - tannewt
how does documentation play into it? If they'll end up on the filesystem and may need to be updated they should have it
how come the empty __init__.pys don't
we don't actually need them
we should just remove them
for a while the builder needed them to identify packages but we've removed that constraint to match python3 which doesn't need them
I think that's a Python 2.7'ism
ok, I just need to undo the last commit I made to my seesaw PR. Thanks!
np
again, sorry for confusing you @tulip sleet!
(sorry for the late response. I was climbing)
as a note: there is at least one __init__.py that contains code. i'll try and find it...
Thermal Printer is the one I was thinking about. its __init__.py contains a class for importing the module based on thermal printer versions.
Want me to put an issue on the bundle repo to remove/rework init.pys?
@raven canopy issue would be great. we can leave that __init__.py and just add the version and repo url
I thought adabot check that they were included in all of the files but it must not ๐
This is meant to address the documentation shortcomings in #328. There's more work that could be done on the documentation, but I'm trying to bring it somewhat more up to date.
More work needs to be done after renaming more builtin modules to drop the "u" prefix.
i'll get the issue up a little bit later. dinner/hangout time.
np
We'll have express stuff in M4 non-express right? Should we target 256kb binary size for them? I think thats what I have setup now.
I'd prefer to have these docs inline rather than in files separate from the implementation. Until then I'd like to call them unsupported because its hard to keep them up to date.
Lets not call gc supported until we move the extensions out of here.
Right, didn't think of M4-non-Express.
I'm reluctant to call them unsupported. To me that means you shouldn't use them, or that we wouldn't fix bugs in them. If you want to say that they may change in the future, that seems more like what you want to imply. But we couldn't write a lot of useful code without struct, array, sys, os, etc. in our libraries and use them in Learn Guides, so maybe something milder than "unsupported".
"The functionality of gc may change in the future to more closely match that of CPython."
@raven canopy done going thru the building cp guide (yay), wanna chat (whenever you're free)?
Hello, I just got a circuit playground express and am having a blast so far! Does anyone know if there is a way to import the CircuitPython libraries into VS Code so it doesn't give me errors when writing code? I tried searching the web and discord and haven't had much luck so far
I didn't restore the word "unsupported", but I added some stronger caveats about using the MicroPython-derived libraries. See if this matches your intent.
@hushed prawn I have the same wish for PyCharm and importing CircuitPython libraries. As of yet, there is not ๐ฆ thats because the libraries are actually compiled, and not directly python. So VS Code & PyCharm have nothing to import that they can parse.
@gaunt breach That would probably explain the trouble, and how they got those libraries so small then! Thanks for the quick and informative reply ๐
pylint has some list of imports you can ignore; does PyCharm have something similar?
The builtin libraries are in C, so those have no definitions you can import. But you can get a .zip of the current library sources in the bundle release: https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest. See the "...bundle-py" zip file. (as opposed to the .mpy zip files)
@hushed prawn in my infinite free time (sarcasm) I hope to compile the c doscstrings into Python stub code so pycharm, vs code, all ide's can do proper autocomplete and importing of those compiled libraries ๐โจ
@tulip sleet Thanks for the tip. I don't understand a lot of the code in the zip file you mentioned, but its commented well enough for me to bumble around a figure stuff out.
@gaunt breach That sounds like a very exhaustive task. I'm a bit new to coding and microcontrollers so that is all a bit above my skill level, but if I can help test or do something else let me know how I can contribute. I'm sure other people would be happy to line up and help too ๐
@raven canopy I'm home if you're available
@hushed prawn yw. That code is for reference. The libraries are compiled to .mpy files to save memory and time when they're imported on the board. In a number cases the libraries are too large to be compiled on board. So don't use the library .py files on the board; use the .mpy library bundle (see https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries)
i am. currently chatting with @prime flower on his review suggestions. ๐
Ok keen let me know when you're free. I'm not sure how late I'm going to make it tonight, but I say that and then I'm up for ages.
yep. same here...every night.
There was a forum post https://forums.adafruit.com/viewtopic.php?f=8&t=135989&p=674098#p674098 regarding a problem with the RFM69 Circuitpython driver that I think is similar to a problem I found in the RFM9X driver and fixed, but have not had time to update the RFM69. I opened an issue https://github.com/adafruit/Adafruit_CircuitPython_RFM69/issues/6 but I won't have time to fix this until I get back from my vaction after the first of June. I'll be happy to fix it then, but if anyone has RFM69 radios and wants to get it updated sooner, please feel free!
GitHub
When the frequency is passed in to init it is incorrectly stored as
self.frequency
https://github.com/adafruit/Adafruit_CircuitPython_RFM69/blob/master/adafruit_rfm69.py#L343
but the actual "s...
oh whoop, looks like I'm volunteering at the eastern long island makerfaire next month to share a table and talk about circuitpython/makecode (hopefully stir up some involvement and get people excited). sharing a table with a young inventor and his robot(s)!
@solar whale I'll be able to test fixes after work next week if you want? (dont have radios with me a.t.m, but I can grab them then)
@prime flower Thanks, I hate to just throw changes in there and not spend time thorough;y testing them. Unfortunaltely, I leave Thursday and won't be back until June 2. There were several small other issues I found as I dug into the RFM9x driver and I think it may take some time to check the RFM69 driver thoroughly.
that's more than ok, enjoy your vacation
thanks - I will ๐ I certainly don't mind if anyone else wants to take it on, but if I am going to update it, I'd like to take the time to test it as well!
does the build dance
@tidal kiln @raven canopy Sorry, not going to have time to test bitbangio speeds. Hopefully will have more time tomorrow evening.
all good @solar whale! you got vacation to focus on!
vacate: the latin word for 'cow' is 'vacca' so 'vacate' meant 'go .. and take your cows with you.'
I've been looking through all the examples on github for crickit and CP but I don't see anything where multiple servos are used independently. How do you name each servo so you can control them independently?
@spare storm what's the problem exactly?
@spare storm you just assign them to variables
So, here's what I tried:
pwm1 = PWMOut(ss, 17)
pwm2 = PWMOut(ss, 16)
pwm1.frequency = 50
pwm2.frequency = 50
ms1 = servo.Servo(pwm1, min_pulse=700, max_pulse=2200)
hs1 = servo.Servo(pwm2, min_pulse=750, max_pulse=2200)
ms1.angle = MC
hs1.angle = HC
should work
Doesn't though, not sure why.
what happens instead?
Nothing
do you get any error messages?
Not seeing any
you have the REPL open?
Yep
if the servos are already in those positions, they won't move
do they hold their position?
No, I can move them, and when I do they don't go back on reset.
how are you powering them?
From the crickit servo pins.
and how do you power crickit?
4 x1.2v AA
that sounds good
Should be, yes. When I code per one of the examples where both servos move at once, it works. so doesn't seem like hw.
so you only have problems when you have two separate pwms?
It seems to be a problem with the code.
there is an example here that suggests it should work: https://learn.adafruit.com/adafruit-crickit-creative-robotic-interactive-construction-kit/circuitpython-servos#more-servos
Yes, that works, but it doesn't allow me to control the servos independently. (i.e. one servo moves my bot's mouth, another moves it's head. They should move independently).
it does
you can set each of the servos in the array to a different value
just replace the for loop with your commands for individual servos
servos[0].angle = 3 etc.
So, servos[0] is the first one in the array and servos[1] is the second?
yes
but what you pasted should work too
so I suspect there is either a bug in crickt, or something wrong somewhere in the rest of your code
I'm sure there are problems all over my code. ๐ I'll give putting them in an array a shot though. Thanks!
first and foremost make sure your code actually runs and doesn't throw an exception
to see the exceptions, open the REPL console
Ah... looks like the crickit might be underpowered for one of my servos. My SG90 works now, but my MG92B isn't. I'll try powering that one independently and see what happens.
.oO( next CRICKT should have build-in power monitoring )
I figured it out, my board was shorting on something. Thanks for the help!
Don't check the pin's pull direction on every tick, instead cache it
at the beginning. Also avoid a "can't get pull of output pin" error
when one of the pins passed is in output mode.
is it possible that SysTick_Handler is only getting called when REPL is active?
nevermind, I think I figured it out
I've managed to reproduce it on Adafruit Feather M0 Bluefruit LE too.
Steps to take:
- Flash
adafruit-circuitpython-feather_m0_basic-2.3.1.binwithbossac - eject
CIRCUITPYTHONand unplug USB - plug-in USB
- connect to REPL
- enter paste mode (CTRL-E)
- start typing (123 is enough to crash the board)
When I get home I'll check if the same happens on Metro M0 express.
Problem with new Metro M4. Metro M4 board with a DS1307 RTC board and using the 5v pin to power the RTC. Also SCL/SDA connected to RTC. Problem we when connecting USB: Metro does not connect to PC; power light is green, neopixel is black, tx off, rx off. To fix the problem, i need to remove the 5V wire to the RTC. Once Metro is connected to PC, I can reconnect the 5V wire. I think I should be able to unplug the USB cord and plug it back in without unhooking 5v wire.
@stuck elbow is your PR all set now for review? Just want to make sure you don't have other changes in the works.
Hi, do the M0 or better yet the M4 boards have some kind of low-power state when using with CircuitPython?
@timber mango we have not implemented any kind of sleep state yet. The boards have the capability but we haven't taken advantage yet.
do you need to keep state across low-power sleeps?
@tulip sleet Probably yes. How hard do you reckon would it be to add sleep state support?
not incredibly hard, but the boards are not necessarily set up for really-low power sleep, because of the quiescent draw of the power LEDs, regulator, etc. what's the scenario?
we have some parts that are external timers that can be used to shut down the board completely and power it up later: https://www.adafruit.com/product/3435 https://www.adafruit.com/product/3573
@fading solstice translation from the verbal domain to the one that schematic diagrams inhabit isn't trivial for me.
Woot! Tested on CPX and it's fine. Non-Express builds are failing due to too little flash. For now, could you uncomment ## CFLAGS += -finline-limit=50 in the Makefile? You can set it to 60 instead of 50 -- that works.
@tulip sleet Well I want to use an M4 board to control some stuff at my house and it would be nice if it went to sleep when all the peripherals are off until I need something again.
(Turning off all lights at my house would make the board go to low-power state until I need to turn them back on etc. I might be able to use the timers for that but it would be annoying if I for example needed to turn the lights in the living room back on in 3 in the morning.)
@timber mango to boil it down. having the 5v wire connected to the RTC board somehow interferes with Metro M4 USB connection.
Or in another project at our company we use about 350 Trinket M0s inside one huge installation and it would be really swell if we were able to save at least a few mW...
@fading solstice just a thought - if you power the RTC via 5V then its I2C lines will also be at 5V and that is not correct for the Metro M4 unless you are level shifting them. I doubt that is related your problem, but something to keep in mind.
@tulip sleet it's ready
@tulip sleet by the way, I'm working around a funny phenomenon there
@solar whale actually i think that may be the real problem. removing the SCL and SDA wire allow the Metro M4 USB to work correctly. So i will add level shifting to the SCL/SDA signals.
good luck! from the DS1307 product page The DS1307 is simple and inexpensive but not a high precision device. It may lose or gain up to 2 seconds a day. For a high-precision, temperature compensated alternative, please check out the DS3231 precision RTC. If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC please check out our affordable PCF8523 RTC breakout
noted
@timber mango low-power mode is not on our short-term list, but feel free to file an issue. The power consumption is on the order of a few 10's of ma's or less. I have a not-too-accurate USB power meter here and it says 0.01A right now, and that's as low as it goes.
@stuck elbow systick issues?
@tulip sleet no, there is something funny going on when MP_OBJ_FROM_PTR(gamepad_singleton) is called from an imported code, as opposed to the REPL
I think it might be returning NULL or something like that
is gamepad_singleton in flash or is it created dynamically?
MP_OBJ_FROM_PTR is just a cast
@tulip sleet "on the order of a few 10's of ma's or less" are you talking about Trinket M0 boards or about the Metro M4 boards?
i'm measuring the metro m4
from the m4 datasheet:
m0:
I have a USB cable with a cut power wire for current measurement but it's not handy at the moment.
Haha 5 mA for Fibonacci .. nice data point to memorize.
If the Charger Doctor says the lowest non-zero number it can, I think that's meant to indicate 10 mA.
I should probably build a make-do Charger Doctor with at least one extra digit of resolution.
(I'm a lot more interested in the high end of the current-measuring range of that device!)
Well thanks for the data. While it's probably useless to conserve power while using only one device even saving 10mA per M0 board would save us 17.5W total. That's a pretty nice saving IMHO.
@fading solstice Forgive me if I'm telling you things you already know, but level shifting I2C lines may be tricky. I have used this https://www.adafruit.com/product/757. Not sure what you are planning.
@timber mango I just measured the M4 running CPy and doing nothing in particular: it's about 30ma. A Gemma M0 (v similar to trinket) is 12-13 ma
@tulip sleet oh, so the whole thing is probably not very worth it ๐
it would be swamped by anything like multiple NeoPixels, etc.
also tells me the Charger Doctor is not accurate at low current values
Yeah I get 20 mA with my M4 and the Charger Doctor, with the Pin 40 NPX glowing the dullest cyan possible and a 0.5 Hz pulsing magenta NPX on an external 8x strip.
I'm not setup to measure current with my good meter - I'd have to cut and strip wires and such to do so. ;)
this thing would be convenient, finally came back into stock: https://www.adafruit.com/product/1456
Nice! That'll go onto the wish list for sure. Thanks!
also https://www.adafruit.com/?q=ina219 breakouts
@solar whale more information is better than less. thanks for caring. my project is to take a word clock that i made using feather m0. i started with CircuitPython but realize i could not do want I wanted with the M0 (not enough memory). I converted to arduino C and got it working. Now that I have the Metro M4, I was wondering if I can rewrite the whole thing in CircuitPython (once again). For testing purposes, i decide to use a DS1307, which I just happened to have in my parts box. The actual word clock uses the PCF8523 RTC. I will temporarily use the level shift in my test breadboard.
I've just connected one Trinket M0 onto my trusty bench power supply and it says 0.01A for the board when idling. ๐ No idea how accurate that reading is tho.
I've used that chip with Silabs C8051F330D (which is 3.3v but 5v tolerant on all pins, iirc) without a level shifter.
I'm a lot more concerned about when it says 0.15A r9k. ;)
... And I'm back quiet.
That reminds me of that one time when I found out that the outer cage of my bench power supply has the same voltage as the output pins by touching Arduino Nano to the cage.
The results were spectacular to say at least. ๐
sorry if this was already covered, but datasheet says DS1307 logic "1" input is 2.2v min. so you should be able to operate it with a 3.3v mcu as long as the pull-ups are to the 3.3v rail. DS1307's vcc would still be +5V.
(the DS1307 breakout from adafruit doesn't seem to facilitate this, unfortunately)
@onyx hinge Once the Metro M4 USB is connected to PC, the DS1307 RTC works as expected. It is when i disconnect then reconnect the USB that the Metro M4 acts funny. I found that before I reconnect the USB plug if I remove the SDA/SCL wires, the Metro M4 works as expected.
OK, I see.
harmless: 1N4148 inline with +5V to the RTC module. May knock it down enough to influence this issue.
also check for redundant pullups on the two i2c lines SDA SCL.
2.2 k ohms is correct for i2c pullups. Maybe 2.7 but less than 3.0.
... I'm really back quiet now.
@timber mango thanks
Good morning, can you control a NeoPixelโs brightness other than when the object is created. Arduino allows a strip.setBrightnes() function. Is there a CP equivalent? Thanks in advance
I am moving from using the Arduino IDE to Circuit Python using Mu. Mu is installed and working fine. Is there a master file/library I need to install or do I need to go on a board by board basis? For what it might be worth, I am using an M0 Adalogger Feather with Ultimate GPS and 128x32 OLED Wings on a tripler board. I also have a 2.4" TFT Wing I will be playing with as my learning boards.
@rigid path The M0 Adalloger is a "non-Express" board since it does not have an added SPI Flash device. It has a very small File system for storing libraries, so you will have to just load what you need for your application. You can use the SDCard to hold more code and libraries -- see this guide for information https://learn.adafruit.com/micropython-hardware-sd-cards?view=all#code-storage-on-sd-card Also you will likely run into memory allocation problems if you try to us the SDCard and a display and the GPS. Try adding things one at a time to see if/when you run into problems. Good luck and come back here with questions.
@humble mural You assign directly to the brightness variable instead of using a setter function. For example... pixels = neopixel.NeoPixel(board.NEOPIXEL, 10) pixels.brightness = 0.5
@opaque patrol thank you, we know that brightness can be defined when the object is created but we would like to change it afterwards. For example โfor i in range (0,10) strip.setBrightness(i)โ or strip.write(R,G,B, Brightness) where we can loop brightness.
@rigid path at a minimum, you will need the adafruit_bus_device and adafruit_sdcard libraries installed on your feather M0 adalogger if you want to access the SD Card. if you wan to access the GPS - you will need adafruit_gps .
@humble mural You can set the brightness variable at any time. The value is a range from 0.0 (off) to 1.0 (full brightness). Your example in CP would look like for i in range(10): strip.brightness = i / 10 strip.fill((R, G, B)) # sets the entire strip strip.show() # Only needed if auto-write is set to false
@humble mural I am not aware of any functions that set color and brightness together, but you could write one yourself very easily...
@humble mural I should also mention that you want a delay in the loop, this would run so fast you wouldn't see the transitions
Thanks for the help all, I think I messed up, again. I'm getting an error message about the file or directory being corrupt when I try to transfer the circuitpython Lib files to the M0 Express Feather. Any suggestions?
@rigid path can you post the error message?
Error code popup
The M0 is appearing as FEATHERBOOT in my drive list. and has 3 files in it. current.uf2, index.htnl, and info_uf2
@rigid path That is the bootloader -- try pressing RESET to see if it relaod Ciricuitpython and gives you CIRCUITPY -
Of not, yu have somehow lost Circuitpython and need to reflash it to the Feather M0 -- dont cpy a lib folder to FEATHERBOOT!
Did you ever see a CIRCUITPY drive?
Is there a feather that is CP compatible (USB & all) and has WiFi built-in?
I am using the M0 WiFi and really need to migrate to CP from Arduino so that folks can make small modifications easily (WiFi passwords, etc.)
@tough flax the on;y wifi support in CP is for the ESP8266 but it does not support the USB file system
Bummer
someday...
@opaque patrol thanks Iโll play with that.
@tough flax none yet, but possibly providing the folks with easy-to-modify files/instructions would be the way to go in arduino. moving consts to the top, etc. alternatively (I dont have much experience with it) the arduino web editor might be a solution too.
No, getting the IDE setup & having them install the board files & even finding the COM port's the problem
@solar whale - nope, never saw the circuitpy drive in my list.
@rigid path did you flash a Circuitpython image to the board? if so, how? what image?
How did you get the UF2 Bootloader onto your Feather M0 Adalogger?
@tough flax its on our radar for after BLE with the nrf52
Ok
@solar whale - I got it. I reflashed it and it is working fine. Thanks for the assist.
whew! glad it is working -- just curios - how did you install the UF2 bootloader on the Adalogger? Did it come with it?
@solar whale haven't done the adalogger yet, still playing with the M0 Express.
Ah -- sorry - I misunderstood - I was thinking you were using the adalogger -- that makes a lot more sense to me !
so forget all I said about the small file system ! You may still have memory problems when you try to do everything at once, though.
@tulip sleet Can you review this as well: https://github.com/adafruit/Adafruit_FreeTouch/pull/5 ?
its needed for the cpy changes
@slender iron sure
@solar whale Does the M0 Adalogger Feather have a bootloader to load circuit python? Does it run Circuitpython? Do I need an SD card loaded to use it? Sorry for all the questions. ๐
Playing with some simple demos to show at my local makerspace. This loops but I only showed one iteration.
I've carried the discussion to #general-tech about @fading solstice 's i2c clock chip hardware (on the notion the M4 isn't of particular interest to the solution of his issue).
@rigid path the M0 Adallogger falls into the non-UF2 category. Instructions for loading CP onto it via BOSSA are here https://learn.adafruit.com/welcome-to-circuitpython?view=all#flashing-with-bossac-for-non-express-feather-m0-s-and-arduino-zero -- as far as teh SDCard, you can use it, but it is not required.
@solar whale Thank you.
use of the SDCard is covered in this guide https://learn.adafruit.com/micropython-hardware-sd-cards?view=all#code-storage-on-sd-card
After thinking about the implementation of this for several days and talking with @tannewt, I've decided that board.I2C giving you a singleton busio.I2C(board.SCL, board.SDA) does make good sense. But it's true that it's not what we're used to if we've been using busio.I2C for everything up to now. It's a habit we can change, with some effort. It also means that a lot of the example code in the Guides can be rewritten in a simpler way when 2.x is no longer supported.
I will add some ...
denouement: consensus is to cut the traces to the pullups on his RTC breakout board in order to use external pullups to 3.3v (they are hardwired on the breakout to 5v). Or obliterate the pullups, if cutting the traces is not the chosen method to remove them.
Or, migrate to a 3.3v breakout such as PCF8523.
@tulip sleet have you started reviewing https://github.com/adafruit/circuitpython/pull/864 ?
not yet. did you look back and see the brief exchange between @stuck elbow and me?
I skimmed
6:43am and 6:51am your time. didn't finish the MP_OBJ_PTR discussion, really
k, I'm gonna let you do the review ๐ no rush to get it into beta.0
those should really be separate pull requests, but Github decided to put the two commits together
Silly GitHub.
so I decided to not fight it and leave it that way
I can make it separate branches if that would be better, though
Yay touchio!!
@tannewt Yep I'll get it on my list.
Also, use mp_raise... in preference to nlr_raise....
@sommersoft Does this sound familiar to you?
release notes are written, just waiting to get #866 in
exciting!
๐ 
+1 for this. I'd like to use the Adafruit Feather M0 WiFi w/ATWINC1500 to publish sensor readings via MQTT.
I'd say it's slightly misleading on the M0 WiFi product page to link to a bunch of Circuit Python tutorials when support for the feather's wifi capability doesn't exist.
No, it doesn't. I know there are about 6 special pins, but 12 doesn't ring a bell as being one. 0,2,5,6,15, and 16 are the ones I remember off the top of my head. But, I can peek at it a little later.
Initial thought is that there are default settings that could be tweaked in SPI...
I'd really like to investigate why this is the case after 3.0.0 is done. Do have an example handy that could be used? Thanks.
thanks for the review @tulip sleet ! tagged locally and doing one final test build while I eat lunch
@slender iron there's still my RTD changes to include in #863. Still waiting for travis on that. I think it should succeed on this build. Finally got my local sphinx build to work properly.
Oh right, sphinx!
@slender iron what is the Sphinx local build command? The one I had from before didn't work, I assume due to directory structure shifts. I managed to get it to build but it made folders in weird places that I had to then delete.
I do
sphinx-build circuitpython ~/docgoeshere
this is after
pip3 install --user sphinx
pip3 install --user recommonmark
I already have the environment installed
I was hung up by the actual sphinx-build command
travis has been kinda flaky today. I had to restart at least 4 or 5 subjobs.
@slender iron https://github.com/adafruit/circuitpython/pull/863 is ready to merge.
build finally succeeded
@tulip sleet Thanks, I was able to build it. I had sphinx-build -Eb html ./html or something like that.
Not sure what the -Eb was.
it does html by default
That command doesn't work, says it can't find conf.py because that's in docs now.
Thanks. I also added an error when more than 8 buttons are passed โ before it would be a memory overflow.
sphinx -E don't use a saved environment, always read all files. That is useful.
-b is the type of builder (e.g. html)
usually I cd to the circuitpython directory and and do sphinx-build . ~/foo (actually)
I'm building from libs as well
I don't start in the docs directory I start at the top, which maybe is wrong
I start in the top level dir as well
sphinx-build <inputdir> <outputdir>
@stuck elbow any thoughts on your MP_OBJ_PTR issue?
OK! added a note to the product page
Please note that we do not have CircuitPython support for the WINC1500 modules (it won't fit in the ATSAMD21 chip, not enough room!)
@stuck elbow did you just make the pointer volatile while debugging?
never mind - just saw latest commit
will approve when travis completes
so, the issue is this, in short:
I was doing return MP_OBJ_FROM_PTR(gamepad_singleton); in make_new and then gamepad_obj_t *self = MP_OBJ_TO_PTR(self_in); and accessed/modified self->pressed โ that worked in CP 2.x and in CP 3.x in REPL, but not in imported code
when I changed to use gamepad_singleton->pressed directly, it started to work
that is odd, i don't understand that. I looked carefully at how gamepad_singleton gets set and reset, and it looks ok to me (e.g. when gamepad_init() is called).
when it didn't work, it would just always return 0 as the value of self->pressed
yeah, that's why I suspected volatile
since self->pressed is getting set in tick, which is in an interrupt
I have volatile on a struct field, but I'm not sure you can actually do that
@tulip sleet we don't need the docs PR in the tag since docs get updated immediately
@stuck elbow obj.h just has #define MP_OBJ_FROM_PTR(p) ((mp_obj_t)p)
@slender iron np
@tulip sleet whether it worked or not depended where the GamePad object was created โ in the imported code or in REPL. Even if I made a function that created GamePad in the imported code, but called it from REPL, it would work.
but it wouldn't work if the same function was called in the imported code
I really don't understand that, but since that change makes it work, I'm happy it works...
ah, another factoid
if I created GamePad in the imported code, but later re-created it from REPL, it would also work
me neither, it's like it was using the wrong offset for ->pressed, but that code is compiled - shouldn't be affected by REPL or not ?!
even though the singleton isn't getting re-allocated
in both cases the pins would get properly initialized as inputs with a pullup
is it declared like the other singletons in various places? did you look at the other fields in the object with gdb or something to see if the object got smashed in some way?
I didn't get out gdb yet, I'm going to do it for the SPI crash bug, though
that's the last thing left to make ugame work...
it will be interesting to see what you find out. Anyway, I'll accept this PR since it fixes other issues in the meantime.
I'm afraid I might never find out
there is always a reason. it's not cosmic rays. and the symptom you're seeing might not actually reflect what the real reason is
that's the thing, C is way too magical for me
๐
I'm one of those new kids who were raised with garbage collection
i thought you wrote C in your day job
no, Python
last time I wrote any C was at the university
before I started with microcontrollers, that is
it keeps coming and going for me BCPL, then C, then more C, then Smalltalk, then another obscure OO language, then C++, then Python, then Java, and now back to C
then Rust ;-)
maybe so! it might be a few years but maybe one day CPy will be in Rust
by the way, a friend recently let me know about a cool language that runs on the samd21, has much smaller vm than circuitpython and could be good for education
it's called "GP" and it's a block-based language, a descendant from Scratch
will take a look!
MicroBlocks is a dynamic, blocks-based language that runs right inside microcontrollers
he got it to run on ยตGame yesterday
I know John Maloney from way back.
I figured you would know some of those, as this descends from Alan Kay's work
Thank you for the detailed instructions! I was able to reproduce it with 2.3.1. Now to find the bug. :-)
phew
๐
yay, we have the first beta!
Yah!!
YAY
๐
52d05bb Cache pullup state in gamepad - deshipu
edf2935 Make gamepad.get_pressed work when gamepad was ... - deshipu
240678e Avoid uninitialized gamepad on exception - deshipu
f17a235 Raise an error if more than 8 buttons passed to... - deshipu
42e36a8 Remove volatile from the gamepad struct - deshipu
do we have the openocd config file for metro_m4_express somewhere?
ah, it's not needed with jlink, sorry
waiting for the binaries to build then will post release notes
ok, it says "0x000278c8 in stage_render.lto_priv ()" โ that means it's my library, not spi in general
most likely
0x00021854 in HardFault_Handler ()
or maybe not...
whats the full backtrace @stuck elbow ?
how do I get it?
turning off lto can help make it understandable
in gdb type backtrace
or bt for short
(gdb) backtrace
#0 0x00021854 in HardFault_Handler ()
#1 <signal handler called>
#2 0x0001cdb0 in common_hal_digitalio_digitalinout_get_value ()
#3 0x00021ade in SysTick_Handler ()
#4 <signal handler called>
#5 0x000279c2 in stage_render.lto_priv ()
#6 0x00000080 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
gamepad!
so its something in the tick handling
the gamepad scanning of the pins
right, so it may be an invalid object leading to invalid memory access or something
Can anyone suggest an editor that runs on Chrome to edit/load circuit python to run on M0 feathers?
@rigid path something like Atom?
@rigid path do you mean chromebook?
sorry, yes, on a chromebook.
I use beagleterm to connect to the serial port
blanking on the text editor name, lemme open my chromebook
@rigid path I have Caret
@slender iron is it possible that common_hal_digitalio_digitalinout_get_value is not safe to be called from the systick?
Supposedly an upcoming version of chromeOS will have linux app support.
@wraith tiger isn't it linux anyways?
Under the hood, yes.
But you can't run linux apps out of the box.
Tjey are adding wayland to chromesOS as I understand it.
@slender iron Craig was adding the pylint disable rules you suggested into our .pylintrc command, if you didn't catch that. So either I misunderstood your intentions or they did.
@stuck elbow it looks pretty safe - it just does some pretty low level peripheral register operations. I'm thinking your singleton is smashed in some way. do print *gamepad_singleton in gdb
@stuck elbow I think it'll be ok. my guess is that the object passed in is invalid
@slender iron , @grizzled oar - Thanks for the advice. I will check it out.
@idle owl that wasn't my intention but I wasn't super clear either
No problem, I wanted to check before doing it so we weren't both responding with the same thing
(gdb) print *(gamepad_object_t)gamepad_singleton
No symbol table is loaded. Use the "file" command.
(gdb) file firmware.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from firmware.elf...(no debugging symbols found)...done.
do I need an option to compile with the debug symbols?
yes make BOARD=... DEBUG=1
thanks, sorry for stupid questions
not stupid! gdb is a hard-to-learn skill
Hmm, I just pulled master, and...
freetouch/samd21_ptc_component.h:31:10: fatal error: Arduino.h: No such file or directory
#include <Arduino.h>
git submodule update
ah, right
git is harder than gdb
I guess I'm fortunate we are not using postfix
hahaha ๐
(gdb) print *gamepad_singleton
$1 = {base = {type = 0x354f4 <mp_type_bytes>}, pins = {0xfa, 0x4,
0x20001510 <heap+4464>, 0x20001550 <heap+4528>, 0x20001560 <heap+4544>,
0x20001570 <heap+4560>, 0x0, 0x0}, last = 0 '\000', pressed = 0 '\000',
pulls = 63 '?'}
@stuck elbow are you mixing pin objects and pin numbers by accident somewhere?
not that I can tell
if its consistent you can use a watchpoint to see when that memory address is changed
the only time I assign to pins is by digitalio_digitalinout_obj_t *pin = MP_OBJ_TO_PTR(pins[i]);
and then gamepad_singleton->pins[i] = pin;
yup, sounds like an overrun
set a breakpoint right after the singleton creation and see what the values are if you want to see the unsmashed object
WooHoo - Congratulations on 3.0 Beta!!
(gdb) print *gamepad_singleton
$2 = {base = {type = 0x3cb78 <gamepad_type>}, pins = {0x20001520 <heap+4480>,
0x20001530 <heap+4496>, 0x20001540 <heap+4512>, 0x20001550 <heap+4528>,
0x20001560 <heap+4544>, 0x20001570 <heap+4560>, 0x0, 0x0},
last = 0 '\000', pressed = 0 '\000', pulls = 63 '?'}
ok, so now I will just go through my code with a comb
there is really only one place where I write to memory
comparing with smashed version:
$1 = {base = {type = 0x354f4 <mp_type_bytes>}, pins = {0xfa, 0x4,
0x20001510 <heap+4464>, 0x20001550 <heap+4528>, 0x20001560 <heap+4544>,
0x20001570 <heap+4560>, 0x0, 0x0}, last = 0 '\000', pressed = 0 '\000',
pulls = 63 '?'}
the type field got smashed too, though it seems to be a "reasonable" type (a bytes object)
yeah, coincidence
there is only one place where I write to memory, and that's https://github.com/adafruit/circuitpython/blob/master/shared-module/_stage/__init__.c#L51
and that is writing to a buffer that I pass from python: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/_stage/__init__.c#L85-L86
at one time you changed it from 8-bit to 16-bit, right?
no, I think I wrote it as 16-bit from the start
ok, it was the dimensions that went from 8 to 16,.
anyway, you can set a watchpoint on some location in the gamepad_singleton. When its value changes, gdb will break, and you can look at the backtrace there to see what's smashing it.
as Scott suggested
yeah, reading on it
a watchpoint watches a memory location for a change
Hardware watchpoint 2: gamepad_singleton->pins[0]
Old value = (digitalio_digitalinout_obj_t *) 0x20001520 <heap+4480>
New value = (digitalio_digitalinout_obj_t *) 0x0
0x00020ee6 in memset (s=s@entry=0x20001580 <heap+4576>, c=c@entry=0,
n=n@entry=16) at ../../lib/libc/string0.c:88
88 for (size_t i = n >> 2; i > 0; i--) {
libc...
(gdb) backtrace
#0 0x00020ee6 in memset (s=s@entry=0x20001580 <heap+4576>, c=c@entry=0,
n=n@entry=16) at ../../lib/libc/string0.c:88
#1 0x0000514e in gc_alloc (n_bytes=n_bytes@entry=16,
has_finaliser=has_finaliser@entry=false, long_lived=<optimized out>)
at ../../py/gc.c:555
#2 0x00004a0c in m_malloc (num_bytes=num_bytes@entry=16,
long_lived=long_lived@entry=false) at ../../py/malloc.c:78
#3 0x000136a8 in mp_obj_new_str_from_vstr (type=0x354f4 <mp_type_bytes>,
vstr=vstr@entry=0x2002f750) at ../../py/objstr.c:2014
#4 0x0002c816 in struct_pack (n_args=3, args=0x200014cc <heap+4396>)
at ../../shared-bindings/struct/__init__.c:84
#5 0x00010e72 in fun_builtin_var_call (self_in=0x3ce7c <struct_pack_obj>,
n_args=3, n_kw=0, args=0x200014cc <heap+4396>) at ../../py/objfun.c:127
#6 0x000186e8 in mp_execute_bytecode (
code_state=code_state@entry=0x200014b0 <heap+4368>,
inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:1014
#7 0x00010eec in fun_bc_call (self_in=0x2001fe70 <heap+129744>, n_args=5,
n_kw=100073, args=0x20001478 <heap+4312>) at ../../py/objfun.c:267
#8 0x000186e8 in mp_execute_bytecode (
code_state=code_state@entry=0x20001460 <heap+4288>,
inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:1014
#9 0x00010eec in fun_bc_call (self_in=0x2001f470 <heap+127184>, n_args=1,
n_kw=100073, args=0x2002f9a0) at ../../py/objfun.c:267
#10 0x000186e8 in mp_execute_bytecode (code_state=code_state@entry=0x2002f988,
inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:1014
#11 0x00010eec in fun_bc_call (self_in=0x20001050 <heap+3248>, n_args=0,
n_kw=53625, args=0x0) at ../../py/objfun.c:267
#12 0x0000d178 in mp_parse_compile_execute (
so it overflows when creating a new string for struct_pack
if (!gamepad_singleton) {
gamepad_singleton = m_new_obj(gamepad_obj_t);
gamepad_singleton->base.type = &gamepad_type;
}
what happens when things are reset?
because the heap will no longer know its already used after a reload
yes, I call this in reset:
void gamepad_reset(void) {
gamepad_singleton = NULL;
}
hrm
i looked through that logic and it looked ok, similar to other singletons
it needs to be in root pointers
it looks like it might have been gc'd prematurely
exactly
RIGHT. the other things are statically allocated and not subject to gc
how do I add it to the root pointers?
then its MP_STATE_VM(gamepad_singleton) = NULL etc
lol, didn't realize pirkey was launching today
"one more thing"
๐
@stuck elbow we don't have many single objects we allocate dynamically. Some are just single instances fixed in RAM because they're not that big. Yours is 39 bytes, so good to allocate dynamically, but not too many examples of doing that.
not sure of that, but maybe gc wasn't invoked during the repl session, or the luck of the draw in terms of reuse
but shouldn't it still be kept in memory when there is a python variable pointing to it?
oh, the init returns the singleton?
yes
ok, yes, then, I see
return MP_OBJ_FROM_PTR(gamepad_singleton);
didn't your code in a file also assign it to a variable?
theres a small chance it'll get gced between creation and storage
the global dictionary may trigger an alloc and the alloc can trigger a collect
I think I copied that code from the framebuf module
it could be the long lived stuff
it'll update the dictionary entry but not the internal pointer if it decides to move it
and that would also explain the REPL discrepancy, I suppose
when does it move it?
at gc time?
is it in an import?
at the end of an import it'll recurse through the names and move the objects
yeah, it is
yup, that would do it
ok, that gives me an idea on how to avoid it -- put it as a class attribute
also, explains why I was getting all 0s โ there was a copy of it
yup, sorry for breaking it
well, it really improves memory fragmentation
I'm just thinking about how to work around it
could add a root pointer check to the move code so they get updated too
I suppose not returning the singleton from the make_new would solve it?
I mean, have the python object separate from the singleton
it'll move any memory on the heap
can I allocate it on the C heap?
I could make the gamepad singleton static, but move the pins to a python tuple allocated when it's initialized
would it get updated properly when it's moved then?
I guess not
it won't recurse into memory off the heap
good to know
right, that was my assumption at the start
that singleton pointer I need in the systick breaks everything
sorry, not thinking clearly
I will get back to it tomorrow
thanks a lot for help with this
Ooh beta0!
๐
man i have a lot of chat to catch up on.
we move fast here ๐
Pretty confident I found it.
common_hal_busio_spi_configure Lines 109 and 121 both call hspi.c/spi_init_gpio().
spi_init_gpio() uses all 4 SPI pins (12-15) as a default. There is no conditional check...
So, we can either update hspi.c, or re-create the config steps in common-hal which is what t...
This is due to the gamepad object being moved to the end of the heap after import finishes, but the internal pointer, used by the systick function, not being updated. Sooner or later something gets allocated there and gives crazy pin numbers to the systick function.
One workaround is to make the gamepad object a class attribute, not a global, but we need a more general solution.
Move fast and break things โข
I was the last to quote it I think, so i refrained. ๐
I think that also appropriate flags need to be set in https://github.com/adafruit/circuitpython/blob/master/ports/esp8266/hspi.c#L187
Actually scratch that, as long as the user calls only reads or only writes, they only enable the correct pins.
Good catch. I think it's worth it to explore handling the possibilities... ?
@slender iron just thought about something -- can I allocate that GamePad object as a long-lived object from the beginning? So that it's not moved?
yeah, that would work. you should add it to root pointers so it sticks around even when deleted from the global dictionaries
Hey, is it possible to have compiled code in a loadable module?
nope. damien has been wanting to add it though
that would help us so much with image sizes.
also let people distribute their own (fast) addons ๐
@slender iron speaking of space, one of the things I started to do but abandoned because of the complexity of getting it right was not defining or referencing pin_XXX globals - which would lead to code not referencing pins during builds that aren't present on hardware. not sure if i'm explaining myself well.
microcontroller tries to refer to them all anyway
ah, you mean do it automatically?
yeah, so eg in https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/common-hal/audiobusio/PDMIn.c#L84 if pins were referenced that are #define IGNORE_PIN_PA08 for example, it would fail to build.
I think it would be a lot more work to not define PIN_PB28 constants when the pins aren't present, hence the IGNORE approach... But both not defining pin_PA10 and PIN_PA10 on hardware without the pins could lead to more correct code - rather than the IGNORE_PIN_PA10 approach.
right
hi @slender iron I'm trying to fix up this unit test into a separate test dir .
https://github.com/adafruit/circuitpython/issues/644
But I'm not sure how to run the unit test when it's not in the same folder. I had been using the command python -m unittest discover -p *_test.py
I don't know either
$ python -m unittest discover test/nonblocking_timer_test.py
Traceback (most recent call last):
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/__main__.py", line 18, in <module>
main(module=None)
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/main.py", line 118, in parseArgs
self._do_discovery(argv[2:])
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/main.py", line 229, in _do_discovery
self.test = loader.discover(self.start, self.pattern, self.top)
File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/loader.py", line 338, in discover
raise ImportError('Start directory is not importable: %r' % start_dir)
ImportError: Start directory is not importable: 'test/nonblocking_timer_test.py'
hrm, maybe test is a reserved word? try renaming it
Hmm nope same
Heya
just got a trinket M0 today for a tiny project (love my itsy)
but the storage seems to be too small to load on the adafruit_ssd1306
and bus_device, register modules
@reef seal sorry, I'm out of ideas
@hearty stratus did you remove the windows 7 driver?
@slender iron OK when I made a package now it seems to be happy
I think I've followed everything that was in the guide to creating a community library/package
@hearty stratus are you using mpy files?
yeah
hrm, I'm out of ideas then
i think macOS is copying over the ._ files
removing those
man, was really hoping to have OLED and BMP280 libs on here but that doesn't seem possible
okay.. got it down to 20k remaining with the OLED libs
at least that's something
@tannewt I have many more changes to a pirkey build, including freezing modules and trimming functionality to make the frozen modules fit, so hold off on this. I'll add more commits after testing.
@hearty stratus I recommend rsync to copy files instead of cp:
rsync --recursive --verbose --update CIRCUITPY/*.mpy /Volumes/CIRCUITPY/
rsync --recursive --verbose --update CIRCUITPY/lib/ /Volumes/CIRCUITPY/lib
I know I can go look myself, but do we have anything in CircuitPython doing DMA to SPI?
(Not sure there's enough free RAM to even think about doing that on M0 for Neopixels or Dotstars)
@slender iron what's next for getting nonblocking timer into a community package? Do I make a pull request?
@reef seal can't remember. is the timer setup as a library/module, or part of the circuitpython core?
Need a little advice lease. I am using an M0 Express Feather to drive an Ultimate GPS and OLED featherwing. They all are plugged into a tripler board. I can make the demo scripts run on their own, but I can't figure out how to combine the two and push the gps output I usually get in the REPL to the OLED. Any hints?
@rigid path it's usually just a matter of transposing each particular section from one of the scripts into the other one. to use Arduino as an example, the programs on that platform are laid out in this fashion:
Step 1: include header files needed
Step 2: initialize global objects and settings
Step 3: initial setup (void setup {})
Step 4: loop the program (void loop{})
Most CircuitPython programs follow the same suit. So, pick the shorter of the two demo scripts, and start transferring the chunks to their respective places in the other demo script.
@raven canopy Its going to be a library
k. give me a sec.
@raven canopy Thamnks for the advice. I will keep playing.
@reef seal here is the guide for including a library for the community bundle. I would start with this "cookiecutter" section to get your library setup in the standard format. https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/creating-a-library#cookie-cutter
I would hold off on forking either bundle repo and submitting a PR until @slender iron, @tulip sleet, or @idle owl respond if they'll want it in the Community bundle or the Adafruit bundle.
@rigid path yw. if you need some "finer point" assistance, let us know. I was trying to start at the big "theory" level first. ๐
@ruby atlas busio.SPI uses DMA under the hood
@raven canopy yes that's what I was working from. I think it's pretty much done afaik.
ahh. ok. sorry to retrace steps... ๐
@slender iron awesome, though I'm not going to go near DMA-to-neopixels./dotstars quite yet.
Sheesh. Reading this evenings chat makes me realize how much I have yet to learn about how Circutpython works โunder the hoodโ .
Also seems like a great time to be out of it for a week to let it โsettleโ ๐
So, RF1 = DigitalInOut(ss, 11) should work like ss.pin_mode(RF1, ss.INPUT) to initialize a seesaw input named RF1, right?
Yet, RF1 = DigitalInOut(ss, 11) gets a positional argument error because it only expects (11), not (ss, 11). How do I tell it that pin 11 is over seesaw?
Is there a circuitpython library for the 2.4" tft featherwing?
@rigid path the RGB_Display library is the one you want. https://circuitpython.readthedocs.io/projects/rgb_display/en/latest/
@raven canopy Thank you
@spare storm DigitalInOut uses its own object type. I don't know of any "passthrough" ability, to utilize second-order objects.
So, ss.pin_mode it is then?
With my knowledge, yep. I haven't had any SeeSaw experience yet...someday.
Ok, I'll try that approach out then. Thanks @raven canopy!
@spare storm hold on a second. perusing the seesaw repo, i see that it has it's own digitalio implementation...
@spare storm when you tried before, did you use import digitalio or import adafruit_seesaw.digitalio?
yeah, try the adafruit_seesaw.digitalio. it has the ss object in its parameters. https://github.com/adafruit/Adafruit_CircuitPython_seesaw/blob/master/adafruit_seesaw/digitalio.py
we should write up an example for using that...
oh man, which reminds me. i need to put up an issue on the bundle, that i forgot about last night...
REPL tells me DigitalInOut is not defined
I think it's just DigitalIO with that library.
Can't import name Direction
ok. issue filed. @spare storm let me write up what I think will work with that library...
Cool, I'll try making it work with the other approach until that's in. Thanks!
oh sorry. concurrent thoughts. issue was unrelated...
Oh, not a problem at all!
@spare storm
# omitting i2c, etc
import adafruit_seesaw.seesaw
import adafruit_seesaw.digitalio
ss = adafruit_seesaw.Seesaw(i2c)
dio = adafruit_seesaw.DigitalIO(ss, 11) # defaults to INPUT, no PULL
# set the pin to output, push_pull; args are default and optional
dio.switch_to_output(value=False, drive_mode=digitalio.DriveMode.PUSH_PULL)
# set it back to input, pull up
dio.switch_to_input(pull=digitalio.Pull.UP)
direction, drive_mode, pull and value are also available standalone.
so, if I have multiple input pins, I'll need to have dio0 = adafrui.... dio1= etc...
yep.
Cool, I'll give it a shot. Thanks a bunch!
you're welcome. and thank you for giving me a reason to read up on it. ๐
'module' object has no attribute 'DigitalIO' for line RF0 = adafruit_seesaw.DigitalIO(ss, 11)
hmm. when did you last update the bundle. DigitalIO is only like 16 days old. ๐ (should've mentioned that earler)
Adafruit CircuitPython 3.0.0-alpha.6-91-g54293397c-dirty on 2018-05-15
5/18 is when I grabbed it.
have you downloaded the library bundle? https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases
or...are you using a CPX & Crikit?
Yes, I have the 20180518 bundle. Yes, I'm using a CPX+Crickit
ok. then yeah, make sure you're on the latest firmware release. seesaw is frozen, and i think there was a hiccup with updating the frozen modules.
Ok, I'll try 3.0.0 and go from there. Thanks!
k. i'm going into some "relaxation time" and then off to bed.
Have a good one, and thanks again!
im a bit confused. I have an OLED wired up to the Trinket M0 (which doesn't have text rendering libs)
the only ones i can find are MicroPython
using this guide
is there a guide for text rendering with CircuitPython with a non-express board likeTrinket M0?
it should work the same
you can try my tiny font: https://bitbucket.org/thesheep/font454/src/default/
it works on anything that has a "pixel" method
can you paste the full error you got?
@slender iron @tulip sleet FYI built/executed 3.0.0 beta (+ whatever is in current master this morning) on several boards - metro_m4_express,metro_m0_express,,trinket_m0,gemma_m0,feather_m0_supersized,esp8266,feather52,CPX -- no issues encountered running my usual test programs.
@tidal kiln @raven canopy just for fun, I ran an I2C test with an mcp9808 temperature sensor on a feathere M0 express with busio and bitbangio -- according to my Salea Logic Analyzer the busio clock rate was ~350KHz while the bitbang rate was ~56KHz ! Both wer run with deafult settings for the I2C bus.
@stuck elbow does the very slow rate for bitbangio make sense to you?
so its just code execution time
ok and esp8266 run faster tahtn a feather m0 because the code runs faster. we see about twice the rate on ep8266
also is it true that the master can use any clock rate and even vary the clock rate and the slaves should not care?
yes
that applies to all protocols with a clock line, like I2C and SPI
it's a big advantage over UART or 1wire
or neopixels
OK - so I guess nothing unexpected is going on. Still puzzling why some sensors work great (mcp9808) but others are not happy with bitbang (apds9960, bno055)
yeah, I have no more ideas
No problem - you've provided your fair share ๐ Thanks for clarifying a few misconceptions I had.
@tidal kiln @raven canopy given these tests and @stuck elbow comments, I think we should follow up on some of the specifiic timing issues for specific sensors that @raven canopy raised a few days ago. Perhaps it is that some sensors are placing constraints on the timing that bitbang just isn't or can't meet. I'll be happy to pursue this further in a week or so when I get back. For now, I think bitbangio is working for "well behaved" sensors. Keep me posted if you uncover any new information.
[adafruit/circuitpython] Issue opened: #869 Investigate M4 bootloader overwriting when not protected
The first batch of Metro M4's didn't have protected bootloaders. A number of people had their bootloaders damaged by some stray writes. We protected against this in the next batch by turning on BOOTPROT. But it would be good to know what bad code was writing to the bootloader block.
Here is a damaged bootloader, courtesy @jerryneedell:
UF2 Bootloader v2.0.0-adafruit.4 SFHWRO
Model: Metro M4 Express
Board-ID: SAMD51J19A-Metro-v0
[m4flash.bin.zip](https://github.com/adafruit/c...
https://github.com/wa1tnr/Adafruit_CircuitPython_seesaw/tree/master/examples
For @raven canopy wrt @spare storm_
This is still assigning to the global instead of the root pointer. Remove the line above to break the compile and then replace this with something like:
MP_STATE_VM(rtc_time_source) = time_source;
@sommersoft common-hal please. Thank you!
I don't quite get what you are saying here. Sorry, can you be more explicit?
The pointer is not being saved to the root pointer location. You need to use MP_STATE_VM(gamepad_singleton) = instead of gamepad_singleton =.
You won't need the declaration above so I suggest removing it first. After its removed, the compile will be broken and adding the MP_STATE_VM portion will fix it.
Minor note: lines 148-149 in shared-bindings/gamepad/GamePad.c have a redundant declaration (not definition:
STATIC mp_obj_t gamepad_make_new(const mp_obj_type_t *type, size_t n_args,
size_t n_kw, const mp_obj_t *args);
Since mp_obj_t gamepad_make_new is already defined earlier in the file, you should be able to remove that declaration.
- Update frozen modules (esp. DotStar without
import math) - Freeze HID, IRRemote, DotStar for pirkey
- remove unneeded modules from pirkey build
- remove
mathfrom pirkey build because it's too big.
about 5kB still available.mathis big.
the pirkey is a nifty device. looks like the IGNORE_* foo helped?
@ash0x1b Could you try to reproduce with 3.0.0-beta.0? I think this might be fixed by the boot.txt fix.
https://github.com/adafruit/circuitpython/releases/tag/3.0.0-beta.0
Lets not remove these. I don't want modules besides board to have different members. Either add them back or have the constructors all raise an error with a friendly error message (versus NameError).
@solar whale agree. i just tested the bno055 with a M0 but using bitbangio instead of busio. it fails the same way as the esp8266 does. i'll add this trace to the issue in the repo for ref.
@solar whale can't remember in all this testing - have we successfully tested a sensor that does do clock stretching with bitbangio? something other than the BNO055 obviously.
@tidal kiln Iโm not really sure. I canโt claim to have captured a clear case of it.
Looking for some sample circuitpython code for the OLED featherwing. I would like to be able to clear the display and be able to change text displayed with a push of the 3 buttons. I good tutorial would be bery helpgul. Any suggestions?
I've managed to get a backtrace for this. Its fixed by #849 and #848. Please use 3.0.0-beta.0.
(gdb) bt
#0 0x00020702 in HardFault_Handler () at asf/sam0/utils/cmsis/samd21/source/gcc/startup_samd21.c:285
#1 <signal handler called>
#2 0x00021910 in validate.lto_priv.645 (obj=obj@entry=0x20007dac, fs=fs@entry=0x20007d18) at ../lib/oofatfs/ff.c:3075
#3 0x000224b4 in f_write (fp=0x20007dac, buff=buff@entry=0x20007dac, btw=btw@entry=1, bw=bw@entry=0x20007d58) at ../lib/oofatfs/ff....
But then I need to use MP_STATE_VM(gamepad_singleton) everywhere?
You can have local pointers to make code more concise but you should set it once here and read it elsewhere.
@rigid path and for reading the buttons: https://learn.adafruit.com/circuitpython-essentials/circuitpython-digital-in-out
i'm not currently finding a good example that shows using both at the same time with the OLED featherwing
This could be:
if (!MP_STATE_VM(gamepad_singleton)) {
gamepad_obj_t* gamepad_singleton = m_new_obj(gamepad_obj_t);
gamepad_singleton->base.type = &gamepad_type;
gamepad_singleton = gc_make_long_lived(gamepad_singleton);
MP_STATE_VM(gamepad_singleton) = gamepad_singleton;
}
I worked on this, trying a couple of different ways. It was a maze of #ifdef's because I have to remove a bunch of static routines in shared-bindings/{I2C.c,UART.c}: otherwise I get "defined but not used" errors. And, ultimately, you can't even call the stub constructors (which would raise NotImplementedError) anyway, because there are no reasonable pins available to use. So I'm kind of inclined to leave it the way it was.
btw, waiting for Limor to test actual functionality
@tidal kiln This will work, thanks.
np. if you run into any issues, just let us know
@tulip sleet when you get a chance can we voice chat in the circuitpython channel about dynamic heap allocation?
Just want to double check this and save a number of questions down the line... I am setting up a pair of M0 Feather packet radios. I need to use Bossa to load cp to them? correct? Also, will cp run on the 32u4 chipset?
yes, the radio feathers have the old bootloader that needs bossa. and no, it will not run on 32u4
@slender iron i'm on
@tulip sleet @slender iron Care if I listen in?
please do
@slender iron thenk you. Do I use the m0_rfm69-2.3.1.bin or m0_rfm9x-2.3.1.bin file?
@rigid path Which board are you using?
Specifically. I think it includes the necessary version in the name if you look at exactly what you ordered.
@idle owl - M0 Feasther packet radio and an m0 feather adalogger.
I think you need to use RFM69 then. This is based on really basic searching though. I googled "M0 Feather packet radio" and every result has RFM69 in it.
Do you have the part ID from your order?
We could be certain if we had that.
if the rfm69 is a separate wing, then you flash the firmware for you base board