#circuitpython-dev
1 messages ยท Page 125 of 1
That's so great!!
lol, even tried figuring out some of the chinese writing
My very own little future Lady Ada
It's true!
I'm going to go watch some star trek discovery. Have a great night!!
@solar atlas You too!
the Google Translate app for Android and iOS will do augmented reality translation
WayGo also works
so she can just point a phone or tablet at the manual
also Word Lens
Seriously? @glacial bronze ? lol, we'll have to try that tomorrow. She loves all thing oriental and anime, she'll love getting to read chinese
It probably won't work as well for manga and it definitely won't replace subtitles on anime, but for a technical manual it should get you up to 50% of the way to understanding :v
O man that would open her up to a whole new world of anime!!
Even still, thats awesome. She is really proud of here meter.
As well she should be!
@tawny creek you'll need a jlink or hacked arduino zero to load the bootloader initially
@slender iron ooh, what is a hacked arduino zero ๐ฎ
you hot air the M0 chip off and then use the swd connector for a chip of your own
only works with atmel studio though I believe. maybe openocd
that'll work for non-commercial use just fine
yeah its just for my own amusement xD
@slender iron you were right btw. I removed the other pwm setup and called _chip_init() directly and it worked at near full speed
Only 46.3MHz though. The delays are almost right but not quite 129ms on a 125ms delay
yeah, is it connected to usb data with USBCRM on?
I don't think so? it's connected but I haven't done anything specifically to set it up
@slender iron ooh and just connect the pins? ๐ฎ easy
@pastel panther not having it on would accoutn for the difference
@tawny creek it is pretty easy ๐
@slender iron It looks like I have the USBCRM bit set but I haven't configured a USB device so that's probably not going to work. Would it help to reference the DFLL from the external crystal?
the external crystal would work too
Presumably there is a way to get a stable clock without USB
its stable, its just not exact
some of our boards don't have external crystals so I always start with crystalless
right
I suppose being off by 4% osm
blah
hmm.. I wonder how off it is on longer delays
linear I assume
you could always hand tune it ๐
there is actually code in circuitpython that remembers calibration done on usb so its consistent with off usb
good night @pastel panther
night @slender iron
trinket m0, circuitpython 2.1.0 via uf2, trying to write to the file system and only getting OSError: 28 (ENOSPC.) Temperature-logger tutorial fails the same way. Am I missing something, or is this not yet working on the trinket?
@timber mango My only thought is that the files are too large. Trinket and other non-Express boards have very little in way of available space.
Now that the clock freq is fixed, i compared the behavior of Metro M0 2.x against Metro M4 3.x. They seem to have the same behavior with respect to the neopixel. Now the question is what should the neopixel behavior be?
- solid green when running
- solid white when in REPL
- Green-Yellow-Blue-Blue-etc when Press any key to enter the REPL. Use CTRL-D to reload.
Yeah, I used the storage.remount bit from https://learn.adafruit.com/cpu-temperature-logging-with-circuit-python?view=all (can tell because it changes the error from MP_EROFS (30) to MP_ENOSPC (28))
And as for space: when the USB side is writable, I've got plenty of room for small python files; I'm actually trying to write one character and failing: ```>>> open("count", "wb").write("3")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: 28
(using "w" vs "wb" vs "a" doesn't change anything.)
(and as this is new in circuit python 2.0, it would be good to know if it works for anyone else, or if the circuitpython test suite actually gets run on trinket hardware - tests/io/open_append.py and tests/io/open_plus.py would demonstrate this working, if they're actually getting run)
@timber mango @tulip sleet replied to you gitter post that he was unable to reproduce this on a Trinket. If you are using 2.0 you may want to try updating to 2.1 but also try clearing the FS as he suggested. I can try this later to day when I get home from work.
What OS are you using for you host computer?
Thanks, hadn't checked gitter this morning. It was a fresh-from-amazon 1.0 unit, uf2'ed directly to 2.1, with an unzip of trinket_m0_2.0.0.zip to get the new mpy files (since there isn't a 2.1 of those? and they're just libraries anyway.) But I didn't know about erase, will try that tonight.
Host OS is Debian Stretch (9.2)
there is a new library bundle to go with the 2.1 release https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases
For this issue, I don't think you are accessing any library modules anyway.
Hmm, that's very different from the other bundle (which I got from the http://adafru.it/mpy-update ... hmm, looking there today, that goes to the same link you just posted... Ah, got it from https://github.com/adafruit/circuitpython/releases/tag/2.1.0 "smaller bundle for trinket m0")
no special bundle for trinket, just extract what you need.
the link you posted is the circuitpython image itself
Now I see the link to the trinket_m0 files - they were the ones distributed with 2.0 so fi you want too update them, you can replace the individual files with the ones in the full 2.1 /lib folder. But, as noted, tht is not relevant to your current problem.
there was achange in the .mpy file forma between 2..0 and 2.1 so you neeed to update them together - if there is a mismatch, you will get an error saying so.
@mrmcwethy when it gets to the "Press any key.." line it should fade green in and out if no error occurred while running main.
Yup, I'm aware the status neopixels are turned off and just haven't gotten to it. Mind taking a look? It should be as simple as uncommenting things in mpconfigport.h IIRC.
sure
What I am seeing is with no main.py file then after a hard reset, the neopixel shows solid White (which means board is in the REPL) and indeed the board is placed in the REPL. This is what the Metro M0 2.x and the Metro M4 3.x boards do.
The only odd thing is when you rename the main.py to mainX.py (you have to wait quite awhile) This is where the multiple flashing occurs. If you open the serial terminal there was a KeyboardInterrupt at line 61, then a couple of auto-reboot messages, ...
@solar whale there wasn't an mpy version change between 2.0 and 2.1. We'll only do it on major version numbers, 1.x, 2.x, 3.x etc.
oops - thanks - sorry for the mis-information
I updated the Metro M0 Express and Feather M0 Express board to enable Neopixel status light.
I was able to test the Metro M0 board and it works just like the M4 version. I "fried" my Feather M0 board recently, so I was unable to test that one. It builds fine though.
@slender iron got time for an audio chat re DMA and ASF4? I'm trying to convert shared_dma.c and have some questions about my overall approach
yup!
It's looking like scan is the only thing that a "middle" driver would need to provide. Everything else can live in the OneWireDevice class. Is it worth writing a separate module just for scan? The busio I2C provides a scan:
http://circuitpython.readthedocs.io/en/latest/shared-bindings/busio/I2C.html#busio.I2C.scan
If busio OneWire did this, then usage for Case 2 and 3 could be like:
>>> import board, busio
>>> import adafruit_ds18x20
>>> ow = busio.OneWire(board.D2)
>>> ds18 ...
Wouldn't it also hold the 1-wire address class?
@slender iron You guys still talking ASF4?
now we're talkign clocks
Care if I listen in?
you can chat with us of course
(lerkin)
10 bojillion
Probably, but I'm now questioning how necessary that is also. Could just keep it as simple as passing the 64bit bytearray around. Even though the bytearray is composed of [CRC][SERIAL NUMBER][FAMILY CODE], you end up using the entire 64bits as an address when communicating on the bus.
interesting behavior when printing byte arrays:
>>> bytearray([0x01,0x02,0x03,0x1f,0xff])
bytearray(b'\x01\x02\x03\x1f\xff')
>>> bytearray([0x48,0x45,0x4c,0x4c,0x4f])
bytearray(b'HELLO')
makes it confusing when the values are mixed printable / non-printable:
>>> bytearray([0x28,0x02,0x5c,0x1f,0xff])
bytearray(b'(\x02\\\x1f\xff')
@timber mango just ran this on my trinket M0 with write enabled: ```>>> f=open('junk.txt','w')
f.write("3")
1
f.close()
f=open('junk.txt','r')
f.read()
'3'
f.close()
git.add(".") == git add .
git.commit(message=message) git commit --message=<message>
Updating https://github.com/adafruit/Adafruit_CircuitPython_DS3231 to 2.0.1
from 1.0.0:
> changed read_into to readinto
> Add demo example based on PCF8523 guide.
> Switch to build from circuitpython 2.x branch mpy-cross
Ok, ustack is listed in the "Modules" list on ReadTheDocs. gc is not included on that list. That was the point they're making. They're asking if there's a better list somewhere with all the modules included in CircuitPython. Is there another list somewhere? I'm unaware of anything else.
@tulip sleet Turns out the rest of the question is about ustack and you just answered that for me. The rest of their post is information for anyone else looking into memory allocation.
And then the next question is, should I update the list of included Modules to not include ustack and to include gc or is there a reason that the list is as it is?
https://circuitpython.readthedocs.io/en/2.x/shared-bindings/index.html "Modules" is the list being referred to.
that module list (the "Support Matrix") is meant to be modules that are new in CPy. Some are renamed from what was in MPy (e.g., uos -> os) . gc is from MPy and we didn't change it (e.g., like sys). ustack should be in that list. Maybe we should have a more comprehensive list. ... In general the RtD docs are kind of a mess, and we have to decide how to present consistent complete documents of CircuitPython without constantly talking about its differences from MicroPython.
Ah yeah ok.
Yeah at some point, you guys have created something beyond that. I agree that we need to figure out how to document it consistently.
Or we have created, I guess... ๐
I was trying to explain it to someone last night and discussing how yes, it's technically a fork of MPy, but it's gone beyond that.
There's an issue for it: https://github.com/adafruit/circuitpython/pull/244. Some work was done but it's kind of stalled.
Initially this library assumed the display is rotated by 90 degrees, so
the x and y were swapped. I'm now handling the display rotation in the
driver, with the hardware display settings, so the library should use
a sane order of x and y. This way it will work with any display
orientation.
@slender iron @tulip sleet just pulled 2.x and built feather_m0_express - REPL works, but the SPI Flash is not recognized? Should I file an issue?
there was a change to this in the last commit
the change looks innocuous: it removes a redundant or'ing of a bit constant
hmmm - I'll create the issue - see if anyon else can confirm/deny it.
i have to go out for a bit but will test later
I just did a pull for the latest 2.x repository. My build for a feather_m0_express executes REPL, but does not recognize the SPI flash.
ok - thanks - I don't need a new bootlloader or something like that do I?
nevermind - my mistake - thsi sis a supersized m0 express....
yah, just tested while tying my shoes. ok here
sorry about that
rosie just finished and its ok too
np
never mind - my bad - I forgot that I was using a supersized m0_express - sorry for the false alarm
e0eae5c Enable the Neopixel status light on Metro M0 Ex... - mrmcwethy
Sorry for the late reply on this. Would you mind adding these into the driver repo instead? https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH/tree/master/examples
It'd be ok to remove the examples from this repo that are out of date. Thanks!
@dhalbert do you want to leave this open or reopen when its been polished up more?
@mrmcwethy we should go pulsing green. If we go straight to REPL then we'll turn off the autoreload.
@slender iron should the 2 recent changed to the feather_m0_express also get applied to feather_m0_supersized?
yup, probably
though they were on master and I don't think supersized has been merged into master yet
itsybitsy is also 2.x only now
I think the first one was on 2.x, but probably has no impact. no need to add the status lights now if it is only on master
Updating https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15 to 0.1.0 from e731810:
fix .travis.yml
add .travis.yml and .gitignore; I2C.read_into -> readinto
Updating https://github...
I didn't try to but I did fix up the pull request references
Nice
looks like I accidentally commited it to the adabot repo earlier....
adabot is now sentient and writing her own code: https://github.com/adafruit/adabot/commits/master ๐
I tried re-checking for the filesystem after waiting two seconds, but I can still mess things up by bobbling plugging in the battery. So let's close this for now, since it doesn't seem to be an improvement.
@slender iron double HOOT
@tulip sleet Thanks for the help with gc and so on. The forum poster is happy with the responses.
@tannewt Just to clarify: change circuitpython do that it does not do an auto-reload when there is no main.py? We should be seeing a blinking Green neopixel.
No, auto-reload should be enabled and the led fading green in and out.
cmon adafruit, don't make a circuit playground express make a bright flash and loud bling on powerup! I thought I blew it up lol
lol
hm, these links show "not found" when going for the latest drivers/firmwares
The latest CircuitPython releases are here: https://github.com/adafruit/circuitpython/releases
What OS are you on?
Ok, yeah you'll need the drivers. https://learn.adafruit.com/adafruit-circuit-playground-express/adafruit2-windows-driver-installation
right, I did all that. I've done it before too for M0 stuff.
Ah ok
its just that link with the adafruit-circuitpython-circuitplayground-*.uf2 didn't work, but I found what I was after
Hmm ok. Yeah. Good catch, thank you.
np
@idle owl I'm working on contributors for the release notes
@slender iron Nice. How's it going?
making progress. I can't count people from issues unless a commit refers to it
I won't do that immediately anyway
Makes sense on both counts
it'd be cool though
Agreed. In the meantime we could start trying to get people to reference issues in commits if it's something based on an issue. Not sure whether that's a losing proposition.
It shouldn't be too hard to do. I would be surprised if you couldn't make github enforce it, but then again I doubt Scott and Dan want to make an issue for every commit
It's a soft rule at work but it does make it much easier to get context while digging through old code
That's handy.
That was my reaction the first time I used it after doing C derived languages
I've really only ever programmed in Python.
It's a good language to know. I don't know the numbers but I wouldn't be surprised if it's the most used language of it's class
Ruby is popular in some circles but Python is used all over. It's expecially common in the sciences
how do you "react" with blinka?
If you mouse over a line a smiley shows up
You can pick on from there
I think you can also type :blinka:

Not to do a reaction. That sends a message.
right
Snack to the rescue!
I am looking at the issues....Maybe we can create a checklist of items to test for this one? https://github.com/adafruit/circuitpython/issues/270
@opaque patrol Hmm. I think the idea is to keep it simpler than a checklist. You have a project that works, if you load the newest version of CircuitPython onto your board and then run your project, you're testing for us. In the context of a good first issue, anyway.
๐ค
@slender iron does adafruit have a kicad library? learning how to use it atm and want to plop on a samd21e but cant find a good source
I may have made one but @meager fog uses eagle
you can now import eagle files into kicad so you might be able to export one that way
ooh do i have to use the latest version? using 4.07
the nightly
can somebody sanity check these bundles for me? https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20171121
Yeah
I built them manually using my refactored build tools
The bundle with today's date is all .py files
i know
Ok
thats the intention but it needs a better name
Excellent
would adafruit-circuitpython-bundle-py-20171121.zip make more sense?
yeah
kk
They all look good to me. Anything specific to look for?
lol. No I didn't. Let me load it on a board.
I'm not sure what I have, I was about to look
Well for one, the M4 works with the 3.0 beta neopixel.mpy which it didn't work with a .mpy before. So there's that.
thats good ๐
@solar whale @tulip sleet (from last night) Thanks, using erase_m0.uf2 cleared up the entire problem.
@idle owl we're going to start releasing py files because they'll fit on the m4 and we'll actually be automatically filling in version numbers in them soon
Hmm. 2.x worked with one demo but not another. Looks like the Express class isn't playing nice with any of my examples.
@slender iron That's awesome
did it give an mpy error? thats my major concern
Yes.
otherwise its probably an express lib bug
Incompatible .mpy error.
Yeah I was able to do a light sensor demo successfully which uses simpleio and some other built in libraries. But anything I have that uses the express class with cpx is failing.
Same CP version yes.
hrm
The 2.x bundle refers to 2.1.0 as well right? Not specifically the 2.x branch?
yeah, it should work on all 2.x releases
Ok, wanted to make sure I hadn't missed something there.
ValueError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.
Specifically failing on from adafruit_circuitplayground.express import cpx
I'll grab another demo that uses something else not built in to check it too. The HID keyboard should work
adafruit_hid fails as well.
on 2.x with the 2.x bundle?
Yes
The only thing I have for 3.x is NeoPixels, but that worked.
My current code.py which does a rainbow animation on a stick and a ring runs successfully with neopixel.mpy
does this work?
hrm ok
Sanity check: Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
2.x
I'm trying here
I wanted to make sure I hadn't upgraded the wrong board or something at some point.
Welp, I was trying to test it for you and I think I ran into something other people had been talking about, the "No space left on device" errors. Did I hear that there is a util to erase the flash ?
ok, its that I mpy'ed init
@pastel panther Likely, which board?
m4 with master
Yeah, hold on let me grab it.
@pastel panther https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/uf2_flash_erasers
erase_m4.uf2
@pastel panther Make sure the board went into boot-loader mode when you hit the button twice...I found the timing has to be good or it doesn't go into boot-loader mode
and you get the "no space on device message"
hah, cute. A uf2 that just writes zeros
that must be for the M0 (haha) get it
if you look at it before copying, the only things that show up in uf2 mode are 524288 Dec 31 1979 CURRENT.UF2* 104 Dec 31 1979 INDEX.HTM* 81 Dec 31 1979 INFO_UF2.TXT*
@idle owl I'm supposed to load it like a normal CP update, right? I must be doing something wrong as it's just copying over and not wanting to leave bootloader mode
@pastel panther You have to load CP back onto it once you erase it.
ok.
So you drag the eraser, it pops back to the bootloader and then you drag CP again.
Ah, did it erase itself (the flash cleaner?)
riiiiight
ah, there it goes, thanks
Np
Hmm, still getting out of space issues.
๐
I don't think I used the eraser right as my main.txt.txt from testing double file extensions is still there. Let me try again
Sounded like you did, though. Hmm.
after copying it over: then trying to copy the new CP firmware:
CURRENT.UF2 INDEX.HTM INFO_UF2.TXT erase_m4.uf2 firmware.uf2```
the eraser won't clear external flash
also make sure you have the newest bootloader
@pastel panther The m4_erase.uf2 only works with an updated bootloader. The m4 bootloader you have probably handles only half of flash.
You know, it said that and I ignored it
Let me post an updated bootloader
night
@slender iron Great work! Goodnight!
This will update the m4 bootloader to one that handles the entire 512k of flash.
@tulip sleet I believe scott gave me a semi-special bootloader that I loaded with bossac because I didn't have a jlink at the time, if that is of consequence
then you should be able to use m4_erase.uf2, and not see erase_m4.uf2 when you drag it on
you don't need it anymore, becauase you have a .uf2 bootloader, don't you?
that was before we had a proper uf2 bootloader for the m4
I'm not sure what I have anymore honestly
this one is fine! I'm using it with and without a jlink
I can just load the above with the normal copy to metrm4boot method?
yup!
it will return to METROM4BOOT after loading. Then look in UF2_INFO.TXT and you should see v1.23.1-adafruit.1
then you need to reload CPy
but try the erase_m4.uf2 before reloading cpy
UF2 Bootloader v1.23.0-14-g3db9182 SFHR
Model: Metro M4
Board-ID: SAMD21G19A-Metro-v0```
not precisely the same?
hmm, hold on. I will try.
it is staying in bootloader mode and hording uf2s:
~/dev/micro/circuitpython/ports/atmel-samd$ ls /Volumes/METROM4BOOT/
CURRENT.UF2 INFO_UF2.TXT firmware.uf2
INDEX.HTM erase_m4.uf2 update-bootloader-metro_m4-v1.23.1-adafruit.1.uf2
try double-clicking and starting fresh
still seems like the older version: UF2 Bootloader v1.23.0-14-g3db9182 SFHR
I'll trying copying it over again
it takes a while to write. It will blink like a blinky for several seconds. Don't press reset until METROM4BOOT reappears
ah, there it goes
i just copied the same one onto one of my M4 boards and it worked
Do you have
Model: Metro M4
Board-ID: SAMD51J19A-Metro-v0```
in INFO_UF2.txt?
Great! OK, I'll post the same for everyone else.
@idle owl did you end up loading a bespoke bundle from Scott or from the auto-release he posted earlier?
My 3.0 beta bundle is from the auto-release.
ok cool
I think he just posted the 2.x bundle that he posted to me anyway, so I'm pretty sure all of them are up now.
<@&356864093652516868> Please update your M4 boards to this bootloader. The old bootloader would only write the first 256k of flash. Procedure:
- doubleclick to get METROM4BOOT.
- Drag this or copy this onto the METROM4BOOT drive.
- WAIT about 12 seconds. You will see about 10 blinks or so of the LED, and then it will start pulsing, and you'll see METROM4BOOT. Don't press reset or unplug before that.
- Open INFO_UF2.TXT. You should see:
UF2 Bootloader v1.23.1-adafruit.1 SFHR
Model: Metro M4
Board-ID: SAMD51J19A-Metro-v0
If this does not work for you please let me know.
You need this need bootloader to use the erase_m4.uf2, which erases all of flash, when you need to reset your CIRCUITPY filesystem.
<@&356864093652516868> for above instructions
I evidently already have it. That's handy.
<@&356864093652516868> Here's erase_m4.uf2, which is just 512k of zeros (minus 16k for the bootloader).
The whole bundle should fit in CIRCUITPY/lib, right? It's only 308K
~/dev/micro/circuitpython/ports/atmel-samd$ cp -r ~/Downloads/lib\ 5/ /Volumes/CIRCUITPY/lib
cp: /Users/bsiepert/Downloads/lib 5//adafruit_max7219/bcddigits.mpy: could not copy extended attributes to /Volumes/CIRCUITPY/lib/adafruit_max7219/bcddigits.mpy: No space left on device
cp: /Users/bsiepert/Downloads/lib 5//adafruit_max7219/matrices.mpy: could not copy extended attributes to /Volumes/CIRCUITPY/lib/adafruit_max7219/matrices.mpy: No space left on device
``` etc, etc, etc.
And this is after updating the bootloader, loading erase_m4.uf2, and re-loading master
This doesn't seem quite right:
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk2s1 239Ki 239Ki 0Bi 100% 512 0 100% /Volumes/CIRCUITPY
on the m4 right now, the SPI flash isn't used, so the 512k flash is divided up, and CIRCUITPY is only about 240k.
That explains a lot
sorry! we're working on getting the SPI flash working
No problem, I had thought that the SPI flash was working but then confused because I know you're still working on busio and SPI
This makes more sense
I don't need the bundle just yet, I was just trying to test for Scott
i2c is working though, right?
yep, i2c and spi are working. I've tested with several devices. But the SPI flash impl uses DMA SPI, which hasn't been ported over yet
Cool. I'll be interested to check the commits for that. I'm finally wrapping my head around the clocks and timers, and I figure SPI is a good next candidate
I will test spi and i2c some more when I get back home
right now I only have one display with me
@slender iron @tulip sleet ran a few tests with new bundles on 2.x (i2c device,rgb_display) and 3.x (i2c devices, neopixels) - no issues. Thanks!
I am able to improve the soft reboot case (renaming a file) by "zeroing" out a stack variable right after a declaration. I don't know if there is a compiler option to zero stack allocations, but after writing code to zero, the Blinking Green is now working.
main.c start_mp()
pyexec_result_t result;
result.return_code = 0;
result.exception_type = NULL;
result.exception_line = 0;
Have you had this problem in other circumstances?
Hey @tulip sleet this morning my M4 doesn't mount a CIRCUITPY when plugged in. It worked just fine last night though and I don't think I've changed anything since then
the bootloader seems fine
no CDC either
Should I just re-load CP or poke it some other way to diagnose what happened?
@tulip sleet As far as I can remember I left my lappy connected to it via screen when I went to bed
@slender iron Any thoughts?
maybe restart your computer?
I turned it off then turned it back on again and it still doesn't show up
@pastel panther do you see METROM4BOOT if you double-click?
@tulip sleet yes
did you reboot with it unplugged?
No jlink just a single micro usb
does another CPy board show up? Do you have a 2.1 board like a Feather or a Trinket M0?
my feather has 2.x on it I think
just trying to narrow it down to board vs comptuer
Yup, seems to work just fine
well, you could try reloading CPY 3.0 onto the M4 board. It's weird to me that you can't even get to the REPL.
I know you erased it yesterday with erase_m4.uf2, but did you reload CPy after that?
Yea. I was testing the daily bundle with 3.0 from master last night and left if overnight after I got a stale mpy error
@tulip sleet I can reload 3.0 but I'm happy to run any other test beforehand if you want. It is strange though.
checking current.uf2 now..
do you have a jlink? if so, you could hook it up and ctrl-c it and see where it's running
why don't you pull current.uf2 off and drop it here, and I can try it on one of my boards?
yes, though if you didn't compile debug, there won't be as much info. then mon reset and continue, and then interrupt it with ctrl-c and do a backtrace
I loaded it on my m4 and it works. I can get in via the repl and I see CIRCUITPY with some junk Mac files (._lib, etc.)
the commit id is e0eae5c, which is not one I recognize. Did you do a local commit of something?
what's the top entry in git log?
Author: mrmcwethy <mrmcwethy@yahoo.com>
Date: Tue Nov 21 11:56:27 2017 -0700
Enable the Neopixel status light on Metro M0 Express and Feather M0 Express boards
never mind - I'm working on a dev branch and I'm one commit behind.
so if you unplug it and plug it back in, you see no /dev/tty.usbmodem411, and no CIRCUITPY?
I'm a gdb newb; previously I had started it by specifying a .elf though I don't have one in this circumstance. How should I start it? I have the gdb server running
target extended-remote :2331
I have an alias in .gdbinit for that
target extended-remote :2331
end
no mass storage and no cdc
try a different USB port?
let me finish this jlink poking and I'll try another
another thing to try: when you plug it in, monitor the OS X syslog: tail -f /var/log/system.log (I think - I don't use a mac regularly; going from a stackoverflow post)
no debug flag so this is only so useful:
#0 0x000225e8 in ?? ()
#1 <signal handler called>
#2 0x0000cad4 in ?? ()
#3 0x00018b90 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
do mon reset and continue (c)
hmmmm:
USBF: 2030.745 The IOUSBFamily was not able to enumerate a device.
USBF: 2031.300 The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 1 of Hub at 0x14000000)
<SEVERAL REPEATS>
USBF: 2039. 34 The IOUSBFamily was not able to enumerate a device.
USBF: 2039.587 The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 1 of Hub at 0x14000000)
USBF: 2039.587 The IOUSBFamily gave up enumerating a USB device after 10 retries. (Port 1 of Hub at 0x14000000)
USBF: 2039.587 The IOUSBFamily was not able to enumerate a device.
then a ctrl-c?
is that the different port?
never mind about gdb; I think this is a Mac issue
ok
did you plug the feather into that port?
into the first port, yes
you have to disconnect or power off the jlink to get it to act normal again, since it kind of takes over resetting, etc.
This popped up on syslog right after plugging it into the new port:
Nov 22 10:38:04 bsieper-lm kernel[0]: USBF: 2606. 35 The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 2 of Hub at 0x14000000)
Nov 22 10:38:05 bsieper-lm kernel[0]: USBF: 2606.336 The IOUSBFamily was not able to enumerate a device.
Nov 22 10:38:05 bsieper-lm kernel[0]: USBF: 2606.891 The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 2 of Hub at 0x14000000)
Nov 22 10:38:05 bsieper-lm kernel[0]: USBF: 2607.192 The IOUSBFamily was not able to enumerate a device.
Nov 22 10:38:06 bsieper-lm com.apple.xpc.launchd[1] (org.apache.httpd[1616]): Service exited with abnormal code: 1
Nov 22 10:38:06 bsieper-lm com.apple.xpc.launchd[1] (org.apache.httpd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 22 10:38:06 bsieper-lm kernel[0]: USBF: 2607.747 The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 2 of Hub at 0x14000000)
<REPEATS>
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF: 2614.623 The IOUSBFamily was not able to enumerate a device.
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF: 2615.178 The IOUSBFamily is having trouble enumerating a USB device that has been plugged in. It will keep retrying. (Port 2 of Hub at 0x14000000)
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF: 2615.178 The IOUSBFamily gave up enumerating a USB device after 10 retries. (Port 2 of Hub at 0x14000000)
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF: 2615.178 The IOUSBFamily was not able to enumerate a device.
That was after disconnecting the jlink and moving to a new port
try loading CPy on it again - but I think MacOS may have decided there's something wrong with the device IDs. Do you have a Windows box or some other computer you can plug it into before reloading CPy?
I can boot into windows. It will take a minute
brb
ok, back again
Do you want me to do anything before I try it?
With my changes above, I am seeing a difference in behavior from Ubuntu 16.04 and Windows 10. On Windows 10 if no main.py exists, you get the blinking Green neopixel. On Unbuntu, you get the solid White (which means in REPL). There is some code that checks the serial port for any available. On Ubuntu, this code I believe is return true, while on Windows 10 I believe its false. I think we have a work status light on Windows 10.
I need to get a debugging system going to go further. I...
" USB device not recognized: The last device you connected malfunctioned something something windows don't recognise it"
windows 7 or 10?
10
do you have a native win10 box in the house. it's still the same usb hardware
I'm going to venture a guess that the m4 is the "Unknown USB Device (Device Descriptor Request Failed)"
No, this is my only computer
Ah, right
Actually I have an old macbook air that might boot
(if it's charged)
It's pretty old though
do you see any entries in Ports or Disk Drives in Device Manager? What happens when you double-click: do you see the ...BOOT drive? Do you have a USB hub you can interpose?
yes, I see the boot drive, no I don't have a hub here
waaaait, my old monitor has one
it's like the usb descriptor is messed up in the flash, but that's weird, because it works for me when I load what you read out of flash
ok, just go back to Mac and try reloading circuitpython
hmmm could be a usb timing problem. because the uf2 bootloader sets up its own clocks, not necessarily the same as circuitpython
So I'm on my phone now because Windows needed some alone time
Ok, should I recompile with debug, just in case?
@tulip sleet I don't know if there is a reason why, but I just compared the current.uf2 to the one I built yesterday and they're substantially different in size
that's because current.uf2 is all of flash, not just circuitpython; it includes what's in the CIRCUITPY filesystem. When I loaded your strange_current.uf2, I also got what was in your filesystem
don't bother to compile with debug yet, just reload what you built yesterday
and see if it works
nope, I copied it over as usual to METROM4BOOT and it's the same as before I copied it over; no mass storage and no serial
load erase_m4.uf2, then reload the cpy .uf2 (you still have your files saved in strange_current.uf2)
so erase and load the CURRENT.uf2 I previously pulled off?
no, the firmware.uf2 you built last night
ok
No dice captain. I loaded the erase uf2, waited for it to stop blinking and go back to a pulse, verified that METROM4BOOT showed up, then copied over the build from last night. Same result
Hmm.
It seems well and truely borked.
@pastel panther I read through the conversation, but to verify, it's not recognising the device at all? Or does System Information see it but it isn't mounting?
yay?
Nah it's not completely borked. You've got a j-link.
@idle owl When not in BOOT mode, there appears to be a USB descriptor error that keeps it from being mounted. Both windows and mac see it but can't mount it properly
Ok. And the bootloader mounts properly?
yup
The next thing I would do is use the j-link to reflash a .bin of the bootloader. You shouldn't have to reflash the bootloader at this point, but that's what I did last time mine got really messed up. I did it using the j-link. Dan might say otherwise at this point, since they updated things since the last time I had to do that. And we'd need to find you a current .bin of the bootloader before you could do it anyway.
I would say there's nothing wrong with the bootloader.
Yeah I agree, I'm simply saying what I'd do next anyway. It shouldn't be the problem, but it might fix it. Again, this is just me coming from what I've done, not some overall understanding of the situation.
I am trying to break out of a for loop and I am getting a syntax error. Is this not implemented or is it a bug?
the wife has awaken. I must quest for the exctract of the coffee bean to maintain it's good cheer
@pastel panther I found flashing the bootloader wouldn't work unless bootloader.bin was in the actual j-link directory (/Applications/SEGGER/JLink###/), and even then I still had to specify the entire path for the command. After using JLinkExe to connect to the board, I used loadbin /path/to/bootloader.bin,0 Other people have not had issues with loading bins not in the same directory.
@opaque patrol I'm not sure I understand what you mean
if not coffee:
panic()
def rainbow(wait):
for j in range(255):
for i in range(len(pixels)):
idx = int ((i * 256 / len(pixels)) + j*10)
pixels[i] = wheel(idx & 255)
pixels.show()
if get_input() not 0:
break
time.sleep(wait)
"""
I am trying to check if buttonA or buttonB is pressed
Oh, hmm. Literally break, I understand now. I'm not sure. I've never used it.
@pastel panther if you could try it on the old laptop...
@opaque patrol It's three backticks on either side of code that makes it a code block. The one in the upper left corner of your keyboard. codeblock
@pastel panther Reset PRAM. (Old Genius trick that fixes the most random of things, and does absolutely nothing at the same time.)
@opaque patrol the problem is the if statment before the break if get_input() != 0
not not 0 not not not not not
!FALSE is funny because its true
OK, feel free to queue suggestions and I'll try them when I get back if I have time before picking up the nieces
you might have meant is not 0, but you're doing a numeric comparison, so != 0 is more canonical
I thought is not was my Pythonic... Or is that only for things other than numbers?
@pastel panther - i did change some clock rates recently. Try git checkout a9f75a71c5 which will get you to a previous point in time. Rebuild and reload that firmware.uf2 and see if you see CDC and CIRCUITPY. When done you can revert to the tip of master by git checkout master.
@idle owl is checks whether two objects are the same object. For integers, yes, they can be same, but are not necessarily for long integers. Example in regular python:
Python 3.5.2 (default, Sep 14 2017, 22:51:06)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 3 is 3
True
>>> 333333333333333333333333333333333333333333333333333 is 333333333333333333333333333333333333333333333333333
True
>>> 333333333333333333333333333333333333333333333333333 is 333333333333333333333333333333333333333333333333332+1
False
>>> 333333333333333333333333333333333333333333333333333 == 333333333333333333333333333333333333333333333333332+1
True
most of the time the only time you want to use "is" and "is not" is when comparing to "None"
unless you are doing something really advanced
@tulip sleet Ohhh nice ok. Thank you
I had a friend who said that two objects are is equals if you put a penny on the railroad track and have one in your pocket and when a train squishes the penny on the track the one in your pocket is also squished. (He was actually talking about LISP eq vs equals, but same concept).
quantum entanglement
I think in cpython is simply compares the memory addresses of the object
in circuitpython it must be a bit more complicated, since not all objects actually exist in memory
(None, small ints, etc.)
if not get_input() == 0:
Quick question: I'm a verbose annotator and have lots of notes in my CPy code. When using the Trinket M0, it seems to throw somewhat random syntax errors at me when the code reaches around 130 lines. If I delete some of the annotation (sometimes just a few characters), it works fine. Is this to be expected or should CPy be telling me that I have a memory allocation error?
more pythonic than !=
@errant grail this is due to delayed writes. Are you on Windows or Linux? What happens is that the metadata describing your file size is not written out for tens of seconds.
Ah. Windows, CPy 2.1.
So, after you write the file, do an "Eject" or safe remove. That will force the rest of the data out. The Mu editor does this automatically but I haven't gotten it to work yet on Windows.
@tidal kiln I don't know, both are fine, depending on the context
Thanks. I'm using Atom -- installing Mu is too complicated for me at this point.
I was thinking of writing a plugin for Atom that is trigger when a write happens, and it flushes the write. It would not be hard: there's already a plugin to execute a command on an event (like a file write). But I have to assemble the different pieces.
@tulip sleet That would certainly be helpful for a CPy neophyte like me. I need a dev tool that's as simple to use as CPy is to code. Thanks again for your help.
@tulip sleet Given how many people start with Atom, that would be amazing.
Modifying the editor seems like a move towards a customized IDE -- something that is counter to what I'm trying to achieve with CPy. Need to have a way to edit the code in the field without special editors.
@CGrover#2710 You'd install a package, that's it. It's really simple. I did it when I first started with Python to have some color coding and tab completion available to me.
@idle owl Yes, pretty simple. I'll have to think about how to support the projects I've given to family members that I can only support remotely. The Arduino IDE was very problemmatic in that regard. The beauty of CPy is that they only need to use a text editor and treat the system as a thumb drive. I should be able to modify the procedure so that they do a clean eject before restarting. We'll make it work!
@CGrover#2710 It's true! And you can get around it by safely removing each time. Dan's just trying to come up with a way to avoid the extra step. But the extra step can be done in the field with no changes!
@idle owl Indeed. And I would be excited about something like Dan's idea!
some command line tools to eject or "safe remove": http://www.uwe-sieber.de/drivetools_e.html
I already found these before
someone wrote a gui too but I had some trouble with it: https://www.raymond.cc/blog/usb-disk-ejector-is-a-free-alternative-to-usb-safely-remove/
@tulip sleet Appreciate the links and the safe remove keyword; should help me on the initial dev end. My family "clients" will only have the default Windows tools available to them -- I'll simply have to deal with that procedurally.
@tulip sleet Thanks again for clearing up the memory allocation issue. Puts me back on the right path!
Hah! Fixed something I was certain I needed help with.
I had help with the code, and it took entirely readable code and made it super compact and efficient, so troubleshooting it for me suddenly got really difficult. But I figured out where the problem was in the end.
@tulip sleet @slender iron Why is the digital setup for the pads on the CPX being called by the analog name (ie. A7 vs D1)?
@idle owl I think it was to emphasize that all the pins had analog capability (as opposed to on the original CPlayground)
I'm guessing a bit, but I thought I heard something like that. If you look at the 32u4 CP, it has a rather random assortment of pin numbers, which are more for Arduino compatibility and convention than anything else. I think Limor wanted to step away from that.
Is there a reason why the digital pins for the pads aren't included in dir(board) then?
It was odd using A7 to change the digital pin state. It sort of follows that it's what's printed on the board, but it doesn't follow if you're using the pinout to determine which digital pin to use.
I see it does make the pinout explanation a lot cleaner than the original Circuit Playground.
There are some further tips on debugging via GDB here, even though this particular page is aimed at a different platform (Apache Mynewt running on the nRF52): https://learn.adafruit.com/adafruit-nrf52-pro-feather/gdb-debugging ... but the commands are identical across devices. Just as a FYI!
@idle owl I'd expect them to show in dir(board)
The only digital pins that show in dir(board) are associated with buttons, switch, LED etc
hrm
its defined here: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/boards/circuitplayground_express/pins.c
I don't really like the D# or A# style anyway
its all inherited from arduino
@mrmcwethy I believe the white pixel on Ubuntu is because of ModemManager trying to talk with it. I disabled ModemManager on my Rosie box.
@slender iron What would it look like if it wasn't arduino style?
Hmm
So is the fact that the digital pins don't show up in dir(board) something we need to look into?
What do N and P refer to?
number or pad
ah
they aren't defined in pins.c, thats why they are missing
Oh I read your earlier comment as they were defined. That was my confusion.
pins.c wasn't clear to me, so looking at it didn't help with that, heh
its essentially a python dictionary
Oh ok
board names on the left, pin objects on the right
Ohhh.... ok. I see it now.
So since it's named A7 in pins.c, it works for digital or analog because it's a reference to PB08 which does whatever it's supposed to do based on the type of code?
right, A7 is just a name
So we could go in there and add all the digital pin names if we wanted to?
Oh I didn't think about that. I assumed we'd use the fancy pinout from the guide.
It's weirdly numbered though.
i see, yes, there are "random" mappings (A6 = D0, A5 = D2, etc.)
Yeah.
we could list those, but not sure how it helps, since there's nothing except the guide that says A5=D2
Arduino, yes, CPy, maybe not
Hmph.
Can we consider renaming them for CP then?
Blergh. It starts getting confusing again, but it's kind of confusing as it is.
What's on the board is concrete reality: no tables to consult
Yeah. And I've advocated for exactly that before. But it gets confusing because it's been impressed upon me that A refers to analog, so then using the A7 pin to do digitallio seemed wrong. And I'm not sure I would have figured it out. I had help.
I think I knew just enough to confuse myself. Not enough to figure it out, and not so little that I just assumed use the name on the board.
even on the arduino, A0-A5 can be used for digital. They just can also be used for analog. So it's not really inconsistent
I've never used Arduino ๐
you are the new generation
no dial phones, no flip phones, no CRT's, no arduino (Ok that may an exaggeration)
A bit! lol...
@tannewt Yes, I remove ModemManager and now the board is consistant with Window 10. If there is no main.py, the board show a slow blinking Green neopixel. I am going to release my changes and hope to close this issue.
heh, @idle owl calls me young (I started on a 286 and BBSs (had to worry about long distance and hogging the phone line))
286s and BBSs were quite an advancement๐
Hooray for small changes. Ended up deleting a branch and starting over.
@drowsy geyser How's the rover coming?
@idle owl Ok. Kind of stuck getting the CCS811 and FONA808 to work. The wiring looks good, but... no communications. On the other hand, I got the Azure-side data pipeline configured (yay!), the GitHub repo set up, and shared storage in my OneDrive for Business tenant and shared OneNote set up for the dev team. I'll probably take a break from fighting with the hardware and work on the documentation some tonight.
@drowsy geyser Good job with the data stuff! Totally understandable. A break can often help. I'm staring at failing code. And I keep trying to convince myself to take a break. But then I'm sure I'll find it if I read through it one more time....
Yeah, I'm going to take a break. I'll go read something. Or maybe listen to Andy Wier's new book and build another camera system (number three of four).
All good ideas. The camera systems sounded really neat, I remember you explaining what went into them.
I designed the distributed command protocol this morning. The master computer will be able to use LIDAR data to identify close-by objects, then request the camera array "look at" them and return identifications and rectangles. This will let the hazard avoidance system identify objects in the environment, decide whether they need to be "avoided," and navigate accordingly.
So amazing.
It'll have a surprising amount of AI in it....
And i am just fooling around wih a flashing neopixel. Just doesn't compare.
But ... I couldn't do what y'all are doing with the M4, @fading solstice !
@drowsy geyser thanks, but you are amzing. @idle owl I was wondering if you want to try a fix to the issue you reported.
@idle owl I was wondering if you want to try a fix to the issue you reported.
blinky lights
Yeah, looks like the error flashing when there's something wrong with main.py... that's what I meant
yes, can i send you .uf2 file
Yep definitely!
what board, metro m4?
Yep
metro m4 .uf2 for status light fix
what os is the board being connected? WIndows, Mac, Linux
That is one os i haven't try it on.
Nice!
Let me run the eraser on it and reflash the firmware clean. That was the other thing that was returning flashing.
Yeah for sure!
Works after the eraser too! Nice job!
Pulsing green across the board. Readding main.py to rename one more time.
Pulsing green!
All the ways I got it to flash before are pulsing green now.
Sounds good. let me know if you see any strange behavior
Will do
I can put in a review on it
Perfect. Now you are amazing!
As are you! No more flashing!
Not sure I've ever gotten the pulsing green on the M4, now that I think about it.
Blinky-blinky. I doubt you saw ever. Now i must go to bed
Have a good night and a lovely holiday!
BTW @idle owl What Time zone are you in?
Eastern
Well, enjoy your holiday as well.
@slender iron @tulip sleet is there an easy fix for this? Just did git pull and would like to use the nrf updates. ```$ git submodule update --init --recursive
Submodule 'lib/nrfutil' (git@github.com:adafruit/nRF52_nrfutil.git) registered for path 'lib/nrfutil'
Cloning into 'lib/nrfutil'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:adafruit/nRF52_nrfutil.git' into submodule path 'lib/nrfutil' failed
@slender iron @tulip sleet found workaround change git@github.com:adafruit/nRF52_nrfutil.git to https://github.com/adafruit/nRF52_nrfutil.git in .gitmodules
after gitt pull for latest master
git submodule update --init --recursive fails for lib/nrfutil due to a permissions error:
$ git submodule update --init --recursive
Submodule 'lib/nrfutil' (git@github.com:adafruit/nRF52_nrfutil.git) registered for path 'lib/nrfutil'
Cloning into 'lib/nrfutil'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@git...
Fixed in circuitpython/master
attempting to build:
make BOARD=feather52 V=1 SD=s132
results in:
FREEZE freeze
Creating build-feather52-s132/frozen_mpy.c
CC build-feather52-s132/frozen_mpy.c
CC ../../main.c
../../main.c: In function 'nlr_jump_fail':
../../main.c:343:5: error: implicit declaration of function 'HardFault_Handler' [-Werror=implicit-function-declaration]
HardFault_Handler();
^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../../py/mkrules.mk:53: recipe for target 'build...
M4 status LED flashing with no main.py present #447 fixed a problem like the original issue. When you don't have a code.py file, the board should display a slow blinking Green light. Note the on Linux, I had to remove the ModemManger because that service was sending data to the board. So on Linux, you may be getting sent to the REPL instead. With my fix, the REPL should handle ctrl-D as expected.
The issue on Windows sound like a different problem.
Please retest with latest code.
I tried just disabling the warning above but things deteriorate...
results in:
Creating build-feather52-s132/frozen_mpy.c
CC build-feather52-s132/frozen_mpy.c
CC ../../main.c
CC supervisor/port.c
In file included from supervisor/port.c:26:0:
../../supervisor/port.h:44:8: error: unknown type name 'uint32_t'
extern uint32_t _ezero;
^~~~~~~~
../../supervisor/port.h:47:8: error: unknown type name 'uint32_t'
extern uint32_t _estack;
^~~~~~~~
../../s...
This should be permanent. All submodules should always be https://github.com/...
Some file should be doing #include <stdint.h> but isn't.
if I clone the repository from https://github.com/microbuilder/circuitpython then the build succeeds.
Perhaps somehting got missed in the commit to adafruit/circuitpython
@microbuilder pushed to adafruit/circuitpython instead of his own repo by mistake. He'll revert this and then resubmit as a PR including the fix.
ce75a21 Revert "Supervisor REPL support for ports/nrf/b... - microbuilder
The last commit was just reverted, sorry for the trouble.
I'll switch to https instead of git@ for the PR. Didn't realize this would cause a permissions error, thanks for the heads up.
Thanks - No problem - I have cloned your repo and it is working - looking forward to having it here as well.
FYI I changed master's settings to only allow @dhalbert and I to push directly to it. Please ping us if cleanup is needed in the future.
@tulip sleet @idle owl Regarding my earlier question about delayed file writes using Atom on a Windows machine: I found an easy workflow fix. I edit and save the source in a directory on the windows machine, copy it to the already mounted Trinket M0, delete the main.py file and rename the new file to main.py. No need to dismount the drive or restart the PuTTY session.
A benefit is better version control, as well. Just have to resist live editing of the main.py file on the Trinket. ๐
Now on to trying to package the helper modules into a library...
@CGrover#2710 It also means if the Trinket becomes corrupted, you won't lose any of your work. But live editing is tough to resist. ๐
@idle owl Yeah, that was my downfall in this instance. I used to manage configuration/change control for a corporation so I should know better!
@timber lion Just saw the new CP guide blog post - thanks - One question - the IR guide does not appear to have any CP code examples. ?? Is it the wrong link?
On ubuntu 16.04 while trying to get gbd debugging installed, i have lost something for build circuitpython.
Building metrom0 or metrom4. I think i need an update to the gcc compiler.
Looks like you have an older version of gcc installed.
That is arm-none-eabi-gcc. Should be version 6.3.1 or something close. You prbably ended up with 4.9.3 when you instaleed gdb and it does not support -lto.
@fading solstice you can get the latest version of arm-none-eabi toolset as described here http://marksolters.com/programming/2016/06/22/arm-toolchain-16-04.html or download it from here https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads
Download the GNU Embedded Toolchain for ARM, an open source suite of tools for C, C++ and Assembly programming for ARM Cortex-M and Cortex-R families.
@solar whale Thanks. i will try that
@solar whale oh weird thanks for noticing, yeah it was still marked draft for some reason. check the guide now though it should have the page visible to all: https://learn.adafruit.com/ir-sensor/circuitpython
@solar whale wanted to let you know i using gdb and set my first break.๐ค
is there a link to the beta version of Metro Express Explorers Guide on Learn.Adafruit.com?
I am getting 404 error, Page not found for https://learn.adafruit.com/experimenters-guide-for-metro-express from the Git page: https://github.com/adafruit/METROX-Examples-and-Project-Sketches
@fading solstice Did upgrading gcc take care of the problem?
Any christmas light project out there that uses circuitpython?
If not... my tree is gonna look like @timber lion's arc reactor ๐
@timber lion Thanks for the updated link - looks great - I'll try to work through it this weekend. The link does work now. Thanks!
@hollow tartan I only see this one - but the CP and Makecode links don't appear to be live yet. https://learn.adafruit.com/experimenters-guide-for-metro/using-metro-pov-17?view=all
@solar whale It's fine. I will follow the arduino guide and substitute CP programs as needed.
@silver tapir why not make your own? A CP board and a neopixel strand makes for a quick and easy light project
Or, find a container with some diffusion and put a CPX in it to make a tree topper
@pastel panther I'm on it. Last few years I had a couple of strands on the tree but with an arduino.
I probably used the arduino for something else, so I'm rebuilding it with an M0
@slender iron how modular Circuitpython is?
Its pretty modular. some of the work I've done is to actually share more between different ports, which is per-microcontroller
hey @slender iron, I'm starting to look at SERCOMs. Is busio/SPI.c the best reference? That and the datasheet?
@pastel panther yeah, any of the classes that match with SERCOM functionality
I am working thru the examples in the https://learn.adafruit.com/experimenters-guide-for-metro using the Circuit Python programs and NOT the arduino .ino programs. Anyway, Geany lets me drop in a main.py and I reset the Metro X and it runs if there are no errors. TeraTerm does not always let me back in. I just now had to: 1. Close TeraTerm, 2. Eject the "Removeable Disk" F: and 3. restart the TeraTerm. Yes, I am using Win7. Does Win10 make life easier? I guess what I am asking for is a pointer to the recommended Windows steps/procedures that AdaFruit recommends/endorses for classroom use. CP 2.0 is good to go right? no developmental beta problems with it, right?
@slender iron, any idea why the datasheet doesn't show a SWO for the 48 pin SAMD51G chips?
Is Brent Rubell a member here? He and Lady Ada are the authors of https://learn.adafruit.com/experimenters-guide-for-metro.
brent is back at school but is around occasionally. @prime flower
@pastel panther its probably not broken out. its not required to load code
@slender iron on saturday i could get a new laptop so i can get leap with the dev work so modularity in Circuitpython is a plus
I havent able to flash my Pi's SD-cards lately as my laptop what only have sd-card reader lost regonize sd-card short period of time
pulseio digitalio board time
__name__ simpleio
>>> from simpleio import Servo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name Servo```
is Servo available in CP 2.1?
How do I reach it?
simpleio.mpy is in /lib already
HW = Metro Express M0
@hollow tartan did you load it before that? it looks like it might be half loaded. try loading the newest simpleio mpy, safely ejecting and then resetting the board
Could be. Okay.. thanks. Right now I am learning about Python Lists: append, remove, etc.
Funny, I can't get SPI to work on feather m0 at 24MHz, even though it runs on trinket m0 just fine. I wonder if it's because different pins have different max speed, or if trinket's mcu is actually better? Or maybe because the feather has an external oscillator?
Just a friendly reminder: ```>>> import this
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
@stuck elbow Would it be helpful to look at https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/using-spi-flash ?
@hollow tartan that's the other spi peripheral, though
โถ what about: Re: Feather M0 - SPI issues
by ProfSparkles on Wed Nov 22, 2017 3:54 pm
Ok so turns out it wasn't related to SPI at all and it was just that the IC needed a reset before it would work with the Feather, which seems to be needed on ARM platforms in general but wasn't added to the library yet. If you have the same issue have a look at the github issue that I opened https://github.com/miguelbalboa/rfid/issues/347
I'm just gettting OSError 5 when I try to set SPI clock speed to 24000000 โ looking at the code, that happens when the loop that looks for the correct clock division runs out of possibilities.
so, logically, the ranges are different between Trinket M0 and Feather M0 Express, and I'm wondering what makes them different: the use of different SPI peripheral on the chip (it would make sense to use the fastest one for the SPI Flash on the M0 Express), the external oscillator (Trinket M0 doesn't have one and uses an internal one), or differences between the versions of the microcontroller (I think that would be unlikely, though). I can probably find the answer in the datasheet, but I thought I would ask here just in case someone knew from the top of their heads.
@stuck elbow Always worth checking before diving into a datasheet.
@stuck elbow have you looked at this part of the code - it returns 0 which raises error if baad rate out of range. https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/common-hal/busio/SPI.c#L42
If I need to debug code on a CPX, what options do I have besides print statements and such? pdb isn't available.
@idle owl I think you can ctrl+c the code (or otherwise break it), import main and get access to all the local variables there
in MicroPython it was easier, you didn't have to import it
hmm ok.
@stuck elbow sorry - reread your post - looks like that was what you were already referring to.
@solar whale no need to be sorry, I really appreciate you looking too, extra eyes always help
So I actually have no idea how to debug.
I was able to import code though (I was using code.py)
@idle owl debug circuitpython code?
@tidal kiln Yeah.
Yeah
or I'm confusing people here, which happens to me all the time, so sorry if I do
try what @stuck elbow suggested. didn't know that worked with cp. (i'm going to try it also)
No, you're right
I was able to import code but I have no idea where to go from there. It's not that it didn't work, it's that I don't know what to do with it.
@stuck elbow The "you're right" was for you. That's who is writing it.
this doesnt exist in python i think but its an interesting idea - can we pop out from the main.py code to REPL but still have access to that context?
@stuck elbow Ya, working on it. I have a fork with the initial stuff (conditional breakpoints & access/manipulation of globals): https://github.com/dastels/circuitpython
I got distracted (and will be partly for a while) by the sino:bit
This is getting over my head quite quickly.
@stuck elbow I don't see anything in the code that distinguishes a Trinket_M0 from Feather_M0_Express and it looks like 250K is the highest you can go, Is that correct?
@stuck elbow @tidal kiln @idle owl I'm working on capturing the context where breakpoint() was called, so that you have repl access to locals/params from there.
I think I understand what that means.
breakpoint() is the failure point? And then it gives you access to what is failing?
you could hit ctrl-c, get a repl, and then start manually interacting with stuff
breakpoint() drops you into the repl with some extra stuff for debugging.
or add that breakpoint() to your code to do same thing as crtl-c
and if you pass a boolean to breakpoint it only does that when the boolean is true
neat
You can also pass in a string that gets printed when the repl starts, so you know which breakpoint was triggered (if you have more than one)
Like I said, it works fine with globals now. That was the easy part ๐
@stuck elbow i can't get it to currently work. how are you doing it?
@idle owl are you asking in general? or have you run into a trouble shooting issue where simple print stuff isn't working?
The issue is in the library, so print statements won't work.
a library you're working on?
Yeah, it's the code we were working on the other day
you can still add them if you want. trick is to remember to remove them.
@pulsar bloom seems like you can't do that after an exception
I've tried using them in the library before and they don't end up printing anything I thought...
I'll try again.
@stuck elbow as i understand it, it works in microptyhon but currently not in circuitpython (see issue link for discussion)
@idle owl yeah, that's weird. in general, print should print.
Ok it worked that time. But there's very few self references in this one, I wonder if it doesn't print as much if there's a lot of selfs.
I don't think this is helping me figure out the problem though.
can you provide more info? you're working on shake detect?
Yeah. I wrote it to expose shake_threshold as a variable, and I gave it a default value (I just tested though, that's not the problem, taking away the default still doesn't work). The code works fine if I don't change the variable so python while True: if cpx.shake: print("Shake!") works fine.
If I try to change the variable, so python while True: if cpx.shake(shake_threshold=25): print("Shake!") it fails with "type error NoneType object not callable".
Now, I figured out that means that I'm trying to call a variable as a function or a function as a variable, I don't know which. But that means I apparently don't know how to write it so there's an exposed variable (Which I've done on other members of the API, so I don't get why there's the issue here). I tried doing it so it's a required variable, so there's no default, and I get a whole new set of errors.
It looks like it should work to someone who knows better than me, so that's why I was trying to head into debugging to figure out exactly where it's failing.
At their suggestion.
Buuuuut.... I don't know how to debug, lol. So that was a quickly failed proposition.
post your code section where you define shake
def shake(self, shake_threshold=30):
avg_count = 10
avg_delay = 0.01
shake_accel = (0, 0, 0)
for i in range(avg_count):
shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
time.sleep(avg_delay)
avg = tuple(value / avg_count for value in shake_accel)
total_accel = math.sqrt(sum(map(lambda x: x * x, avg)))
if total_accel > shake_threshold:
return True
no decorator?
It works ok if I use it outside of the class, so just at the top of code.py
It's there, I didn't include it
@property
that's probably it
No, I mean it's in the file, I didn't paste it
@stuck elbow just curious - are you able to set the SPI baudrate to 24000000 on any of the M0 boards? I'm just wondering if I am reading the code correctly. It looks like the esp8266 can handle that , but I don't see how the SAMD21 code would allow it.
no, i mean adding the decorator doesn't let you pass in the parameter like that (i think)
the decorator makes it such that cpx.shake is like a variable
Without @property it's constantly detecting "Shake!"...
and you're trying to call it like it's a function
Unless I specify a threshold.
without decorator you'd have to change the calling code as well
while True:
if cpx.shake():
print("Shake!")
Can it be in the API without the decorator? I guess I thought it was required because it's on everything else.
Good call on parens.
one approach might be to make all the shake detect related "knobs" be class members, and then just access them directly
instead of passing them in as parameters
Could it be written into a separate class in the same file, and then called in express? There's one other thing in the API that is like that
def shake(self):
shake_accel = (0, 0, 0)
for i in range(self._avg_count):
shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
time.sleep(self._avg_delay)
avg = tuple(value / self._avg_count for value in shake_accel)
total_accel = math.sqrt(sum(map(lambda x: x * x, avg)))
if total_accel > self._shake_threshold:
return True
yeah, it could be in another class, for example, maybe it should be in the lis3dh class
I just meant writing it into a little separate thing in express.py, not doing any crazytown changes to something else...
the changes would be adding capability though, like just adding code.
and what if if someone uses the lis3dh breakout with a trinket and wants to do shake detect?
Ok valid.
It occurs to me that I think I'm afraid to leave the express class because it's all I know, and driver files look terrifying.
driver files like this one?
https://github.com/adafruit/Adafruit_CircuitPython_LIS3DH/blob/master/adafruit_lis3dh/lis3dh.py
Yes.
No idea where something like what I wrote would go in that. In the API it's obvious. Take working code, turn it into a def, sort it into the API. I'm guessing it's similar in lis3dh but it's not obvious to me.
that driver also has a base class and then derived classes for i2c / spi - you understand that part? (OOP stuff)
I'm not sure if I do. Are you referring to the multiple classes written into it, one of which has i2c in the name?
yep. and note the class definition looks like this:
class LIS3DH_I2C(LIS3DH):
which is python's way of doing inheritance
LIS3DH is a base class for LIS3DH_I2C
LIS3DH_I2C derives from LIS3DH
various ways of saying it
or you could pass the buck and post an issue in the lis3dh repo to add shake detection
But that means waiting until that's done to get it onto the CPX.
And then get the frozen modules updated. Testing is going to be rough, it fails memory allocation really quickly with this one not frozen.
mpy-ing work?
But it'll take a local .mpy before the frozen module, so that's easy enough. Even with .mpy, it can fail.
It was doing it earlier every so often before I realised I had imported the entire bundle for testing.
Remembered rather.
sounds like that'll work then, if you want to test your mod's to lis3dh
Yeah it'll at least use it instead of the built in module, but memory allocation errors still happen every so often even with using an mpy
oof
@idle owl I have noticed memory allocation issues when trying to use the cpx class with a long code file. I think part of the problem could be that cpx is setting up everything in the init function. I wonder if this could be improved by only initializing sensors and such that we plan to use?
@opaque patrol Are you referring to the cpx API?
@idle owl The Express class (in express.py)
Yeah ok. The plan is to freeze the API as well, at which point it won't have the same impact on memory. We haven't gotten there yet as there's still a few things we want to add to it.
We've tried to keep what we can out of init. I've had trouble getting some things to work if they're not in init, but that could be th limitations of my knowledge.
@opaque patrol The other thing that affects it is what you're using. The accelerometer uses a lot more memory than pretty much anything else. So I think you could have some pretty lengthy code that used the buttons repeatedly and you'd have to work to run out of memory. Add in significant use of acceleration and you'll eat through memory pretty fast. I'm assuming based on my experience though.
There are definitely ways to improve memory usage, but I think the best solution is for us to get the class frozen. I think it might be something we could do sooner rather than later, even if we still have changes to make. Is it an problem you're running into that's causing you issues?
@idle owl Right, but if I am not planning to use the acceleration in my code, then perhaps don't initialize it?
Yeah, I understand. I'll keep that in mind. When we wrote this, we didn't have a lot of testers, so how we write it going forward will be affected by real-world usage. You're exactly who we need to help shape it.
@idle owl I don't know if you can overload the init function. One idea I had was maybe add a dict to the init parameters that defaults to all true and then you could pass in a key: value for anything you don't want initialized. Then you would have to check this before each item is initialized...
I only partially understand how that would work, but I'm making a note of it so I can figure it out and see whether it's something that might help.
The point of the CPX API is to be simple, a place to start when you're new to CircuitPython and even to Python and programming in general. There are some suggested changes that didn't fit with that idea and we chose to not include them because they moved outside this idea. But, like I said, all of this changes as people start using it. We want it to be the best for everyone using it and it will evolve as that happens.
@opaque patrol are you wanting to kind of ala carte the CPX circuitpython support to only what you're using?
So thank you for your ideas ๐ I'm really excited about how all of this is going to change
I think you could just add **kwargs, but I get the point that CPX is meant to be simple first.
@tidal kiln The shake code is "working" but the math is really different when using it from lis33dh
I tried changing the range because this made the most sense as the culprit but, while the code runs, I'm not convinced range is changing anything.
The sitting still math is correct, comes out to ~9.8. But shaking it has a really limited range now. I thought at first it wasn't working at all until I printed "total_accel" from the library. It wasn't hitting >30 was the issue.
@opaque patrol Both of those ideas will default to working as it does right now, correct? And if you wanted to change it, you'd specifically be passing in something?
@idle owl maybe the accelerometer is in a lower range/higher accuracy mode?
@stuck elbow That was my thought and I thought I had the code right for changing it, but it doesn't seem to affect it. So I'm thinking my code is wrong.
@idle owl Yes, but I don't know how much benefit it would add
@opaque patrol That can be figured out. ๐ I wanted to make sure I even had a solid initial understanding of what you'd suggested.
@idle owl paste your code block being used in lis3dh
def shake(self, shake_threshold=20, avg_delay=0.01, avg_count=10):
shake_accel = (0, 0, 0)
for i in range(avg_count):
shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
time.sleep(avg_delay)
avg = tuple(value / avg_count for value in shake_accel)
total_accel = math.sqrt(sum(map(lambda x: x * x, avg)))
print(total_accel)
if total_accel > shake_threshold:
return True```
I changed the threshold default so it would work.
decorator?
No
It was weird in the other one with a decorator, so I didn't include it.
That's the entire codeblock.
might want to add an explicit False return
what kind of values do you get from the print?
Ok yeah, I removed it in the other one after it acted like it didn't need it. Thanks for catching that.
@idle owl Are you going to have it play a bell ringing sound when shake returns true?
@opaque patrol Only if you wanted it to..? It'll basically be an input...
@tidal kiln Base value of ~9.8 if the board isn't moving, then up to about 25 max if I shake it really hard.
@tidal kiln The original code was much higher. Which gave more of a range to alter sensitivity. Plus I really want to know why it's different now.
-0.0766281 -0.0766281 9.69345
9.72512
-0.19157 -0.038314 9.69345
11.2341
6.32182 17.9693 19.4635
21.8341
Shake
-19.5018 19.5402 -19.5402
20.7342
Shake
19.5018 19.5402 19.5402
24.7792
Shake
-7.04978 19.5402 -9.5402
8.93377
0.0 0.421454 10.613
9.72855```
That's also printing x,y,z
maybe what @stuck elbow said
i don't see an explicit setting in the lis3dh code:
import lis3dh
import time
import busio
import board
i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
lis3dh.range = lis3dh.RANGE_16_G
lis3dh = lis3dh.LIS3DH_I2C(i2c, address=0x19)
while True:
x, y, z = lis3dh.acceleration
print(x, y, z)
time.sleep(0.5)
if lis3dh.shake():
print("Shake")
like you do in cpx:
https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/blob/master/adafruit_circuitplayground/express.py#L67
check datasheet for default range
it might be 2g = 2*9.8 = 19.6 m/s^2
maybe it has a little headroom to let you see 25
but then it rails out beyond that
Hmm
8g = 8 * 9.8 = 78.4
or just try setting it explicitly as a quick check:
lis3dh.range = adafruit_lis3dh.RANGE_8_G
I thought I had set it explicitly. Going to try again.
Also not seeing it in the data sheet.
At 2_G I get the same numbers.
oh, set it after you instatiate it
Slightly less. So 21 is max-ish
lis3dh = lis3dh.LIS3DH_I2C(i2c, address=0x19)
lis3dh.range = lis3dh.RANGE_16_G
It didn't seem right to me. How do I do that?
Oh...
it doesn't run that way.
Let me try it again
Yeah I moved it because of this: AttributeError: 'LIS3DH_I2C' object has no attribute 'RANGE_2_G'
oh. hold.
It works in the CPX code which is weird. The difference is I have it in / on the CPX, instead of in /adafruit_lis3dh/
accelo = lis3dh.LIS3DH_I2C(i2c, address=0x19)
accelo.range = lis3dh.RANGE_16_G
although, how does that import work? adafruit_li3dh vs. lis3dh?
It's just whether it's in the lib folder or not
that brings in the non-frozen module?
which is the one your modifying
It checks locally before checking frozen evidently
Local in root, there's only express in the lib folder
I can't edit the frozen one that I know of.
But it's using mine. Shake works happily now and is giving me numbers that make sense with 8G which is what the default is on the CPX.
Seems the default is 2G... based on the numbers anyway. I didn't find it in the datasheet.
Ahhhh!!! I modified a driver!
np. and gotta run now. good luck.
Ok thank you so much! Have a good one, @tidal kiln
oh. 2Gs per axis. so if you got 2Gs on two orthogonal axes, then total acccel would be greater than 2.
because math
Hey Guys, so I have forked the repo and got a travis account ... I am still looking into this rosie ci ... I made my first commit to a new branch to fix an Adalogger issue I need solved and travis built everything passed all the tests ... problem ... should have read into rosie a bit more l'm thinking ... so where did my build .bin file go? my guess is travis didn't keep it ... any ideas?
You figured it out as I was about to suggest it. Welcome, @worn birch!
@idle owl Thanks
The two who I know can answer that question have been in and out for the holiday, but will for sure be back Monday. I'm not sure how much anyone else has worked with it. I haven't worked with Travis much at all yet except for what's built into GitHub so I won't be much help.
No worries, I'll look into rosie as from what I have seen in the scripts she is kinda important
So shake works in lis3dh and works in express with the new addition to the driver! No idea if I did it right. But it lets me pass the parameters through into cpx as well.
I had to revert the read_into>readinto change to get it to work for testing on 2.1.0. I'm assuming this is handled in specific bundle creation, and I'm just lacking on understanding how that works.
If anyone has a LIS3DH breakout and would like to test the driver, let me know.
@worn birch travis uploads the bin files directly to rosie
@slender iron yea, I am figuring that out ... I now have ubuntu running in a vm, I have a AWS account, I am currently at the point of setting up the .rosie.yml ... not too sure what to do about the github webhook ... I assume I need to create this manually on the repo ... but possibly the .travis.yml does it for me ... not cause then how do I get the secret? lol
why are you trying to get rosie going?
it needs to run on a local machine because there is real hardware connected to it
I want to build a .bin from from changes to test it on my board
lol ... right ... yea
I should have asked that same question. I could have helped! Oops.
what OS are you making changes on?
ubuntu vm will be easier
yup yup, there is an install command in the .travis.yml thats useful to install arm-gcc
I assume I can use those too ... then use BOSSA to load to the board
once thats installed you just need to make in the ports/atmel-samd directory
darn ... new that had to be somewhere
its not complete because it assume you have arm-gcc installed already
I wonder if bash for windows would work
lines 33 and 37 will install gcc
thanks ... worki g on it now
๐
So if I have made a change and run it through travis and he gave the thumbs up, is that that all that is needed for a pull request or do you need me to do more?
If there's more to be done, you'll be notified when the PR is looked into. It works like a code review, if there's something about it that needs to be changed, they'll let you know what they want. Might not be dealt with until Monday though.
@worn birch It sounds like you've done everything right throught the pull request step. Next step is review.
ok ... I'll do my own build and make sure its working as I updated the pins on a board that were missing ... kinda integral to be able to use some functions ... so I'll give it a test ... about to make the bin now
Nice! Good plan.
lol .. yea got an error in the make ...
Traceback (most recent call last):
File "tools/gen_usb_descriptor.py", line 9, in <module>
from adafruit_usb_descriptor import cdc, standard, util
ImportError: No module named 'adafruit_usb_descriptor'
Hmm... That's not one I've run into