#circuitpython-dev
1 messages Β· Page 119 of 1
Right?
@idle owl let's make sure all else is same. what cp version? what bootloader version (in case that matters)? anything else, like bundle details?
I used the neopixel.py that you guys linked yesterday (after trying the .mpy). CP: Adafruit CircuitPython 3.0.0-alpha.0-153-gb6587b3 on 2017-11-01; Metro M4 Express with samd51j19. Bootloader: UF2 Bootloader v1.23.0-14-g3db9182 SFHR
That's the CP build that Scott posted yesterday.
I built one myself as well, tried it, same issues. (Should have been the same build anyway, but it was worth trying)
k. that's all same for me.
Ok nice
@tulip sleet your log looks like msc is messing up too
endpoints 3 and 4 are mass storage
I think the msc problems are causing the cdc problems. If I turn off msc, it's ok.
ctrl-c gets me to repl. ctrl-d to soft reboot and back to blue neo. can repeat this many times. @idle owl is there something i should do to break it?
I made it my main.py, I ejected and reset the board, plugged it back in and it broke. What OS are you on and what USB type?
linux, 2.0
Because Windows USB2 would finally work. But MacOS USB3 and Windows USB3 refused.
USB2.0 played nice.
but then you had a 2.0 issue? (reading scroll back)
I have an old Thinkpad running Linux here somewhere. I should spin it up. No idea when I last did that, so there'll be a bunch to update there. I only have Pi0Ws, so no way I'm going to try to use RPi.
Yeah that was a first. Took resetting a few times, then it was fine.
hmm. i ejected / reconnected. got blue neo. dmesg all looks good. a serial term was created and i can attach via screen. but i can't ctrl-c to stop main.py.
i think this is something known?
I thought so yes, I also thought it had been addressed. I still run into it intermittently though.
But with this issue, if it connected via serial, I could interact with it.
hmmm. yeah. it's not happy now.
It just didn't stay connected for very long, regardless of whether it was running main.py or in the REPL
you had a time.sleep() in your blinky?
could be the no delay infinite loop
Um... no I don't actually. I had it in blinky, yes
But I took it out of the combined code because the rainbow animation slowed blinky down considerably.
time.sleep is commented out.
So there's no delay in the combined code.
yah, post that code
meanwhile....folder showed up, tried to delete main.py. didn't work. got this in dmesg:
[1288442.325489] FAT-fs (sdb): unable to read boot sector to mark fs as dirty
anybody try it without -flto as a compilation option?
When I was running it, I had a NeoPixel RGB strip plugged into D12, the ground above D13, and the 5V on the opposite side.
@slender iron I don't know what you're referring to.
If that question was aimed at me anyway.
-flto is an option we turn on for non-debug builds
did you do DEBUG=1 when you built it yourself?
I did yes.
But I'm currently running the build you posted yesterday.
Both my debug build and the one you posted had the same issue.
getting various message about the fs not being happy
[1288813.162825] sd 6:0:0:0: [sdb] Asking for cache data failed
[1288813.162832] sd 6:0:0:0: [sdb] Assuming drive cache: write through
but still getting a blue led each time
thats normal
it does mount a CIRCUITPY folder on reset, but it's not responsive
still can't ctril-c the repl
So.... The take away from this is I should definitely file an issue?
Ah. Even better.
its definitely not you π
Excellent! π
@slender iron jump in if you want me try something specific
I think we're having varied success due to our different hardware
so...@idle owl , how do i recover?
@tidal kiln I plugged it into a USB2 port on my Windows machine, CIRCUITPY came up, I renamed the main.py to something else through Explorer, and it was fine.
That's the only way I recovered from it.
I don't have Linux up to test if it would also have come up there for renaming.
plugged into a 2nd linux box. took several seconds for CIRCUITPY to show up. when it did, it's unresponsive.
That's what I was worried would happen. I could get to the bootloader fine, but reflashing CP did nothing to change the behavior. If it hadn't worked on Windows, I think my only option was to reflash the bootloader completely to erase it.
@tidal kiln I find that if I click CIRCUITPY in the Nautilus (or other file manager) window, things wake up sometimes. Or at least CIRCUITPY shows up in /media/<user>/CIRCUITPY
But it looks like there'll be a new version of CP here in a minute, so maybe wait and try to flash that?
I don't think the usb clock recovery is being set up on the 51
@tulip sleet yep. been trying that in the gui file manager. no luck. haven't tried via cli yet.
ohhhh. part of the crystal-less operation?
yup
Same for me.
maybe on 21 too?? or my probs are different? Similar symptoms. All my work has been on 21
may be the same
could try. doesn't need to be a metro, right? just an m0
I think then you start thinking about watchpoints, tracing, single stepping, and the like. And that will need far more invasive changes. Certainly doable, but might not be in line with a simple, educational environment.
My goal is to be able to drop in a debugger() or breakpoint() (Smalltalk used halt() ) function call and let you poke around the local environment, possibly peek into different frames on the stack. I'd also like to support passing an boolean expression to debugger() (or ...
hmmm. can i bossac -e this thing?
@idle owl are you using the UF2 bootloader?
@slender iron Yes
@tidal kiln you can build it for non-metro-M0
@tulip sleet build bossac?
@tidal kiln I don't see why need a new bossac for non-m4
do you mean you need to build it? You can swipe it out of arduino tree
what were you asking about building?
your 6:06pm msg: I thought you were asking if you could test 3.0 on non-metro.
ok - i was out of the loop on that! was associating it with the conv scott and I were having
ha! maybe i was out of loop also.
βΏ β» π
I remember how I tested the clocks! pwm
@tulip sleet Have a tasty one!
bye @tulip sleet
I fixed the clocks for realz last time when could hear the difference in a buzzer
You know it's legit when there's a z involved.
π
@slender iron Let me know when you have a build to test since I have a consistent way to break it.
you are optimistic on the timeline
Fair enough. I never know when you're going to make tiny tweaks that need testing along the way.
Wait, is 3.0 done?
yeah, I was hoping it was like that but I'm gonna get a timer going to pwm out
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
yah agree- i was just thinking to the far future :) for now breakpoints are enough!
loading new bins when the cpu is 32khz is sllloooooowwww
For sure
well, jlink can't halt the cpu
Hmm. I haven't run into that in a while. Though I haven't tried since we got the last bootloader going.
does going into bootloader require a data usb connection?
Doesn't for me...
I have it plugged in only to a wall plug and it went into the bootloader.
red neopixel?
Yeah because the bootloader doesn't have a USB connection. Turns green when it is connected to computer.
No. Should I try that?
no. that's what i'm trying though.
Ok
trying to recover π°
seemed to matter.
couldn't double reset into bootloader with jlink connected
Oh... yeah, no... Jlink hates doubletap reset apparently. I forgot about that.
But did you try it connected but unplugged from USB?
Ooh!
sorry, felt like the only way to get rid of your blue neopixel program of pwn-age was to nuke from orbit.
I'm pretty sure you're right.
I was certain that was the next step for me too, but I didn't want to nuke it until Scott said he didn't need it tested anymore.
and i'm back.
Yay!
can probably recreate all this though.
i'm back to where i was and all i did was run your program from here
so allthelights.py doesn't create the issue?
Nope.
I'll probably explicitly NOT support using def in the debug repl. Expressions, yes. Assignment to in-scope variables, yes with a warning that it might mess things up. I'd like to support looking at variables in prior stack frames. I'm not sure how that would look yet... but that's not for a while. The next step is just to get local variable (and parameter) references working.
Didn't for me anyway. Once I had to reset a couple of times to get it to mount, but that was it. And I kept removing it and plugging it back in to be sure. Both with 9V power connected and without it.
maybe the additional math and what not prevent it from totally locking up
pixel.show() doesn't do much but call neopixel_write(), which is low-level
Which isn't needed anyway because it defaults to auto_write or whatever it's called
Commented both out and it still works.
Yes.
the other one is essentially calling neopixel_write() as fast as possible, forever
So I took out pixels.show and the while loop, and it hasn't locked up, but it's also not running. Pixel is pulsing green.
Adding pixels.show back didn't make it work.
So I guess it needs the loop?
which program?
The single neopixel one. np0.py renamed to main.py
About to save it again with the loop
shouldn't need loop
hmmm. just tested in repl.
without loop
Adafruit CircuitPython 3.0.0-alpha.0-153-gb6587b3 on 2017-11-01; Metro M4 Express with samd51j19
>>> import neopixel
>>> import board
>>> pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)
>>> pixels[0] = (0,0,50)
>>>
get blue neopixel
I got it back up, changed the file to not have the loop, it mounts fine, but it's not running.
try repl?
add it after the first set of ticks
@idle owl or @tidal kiln do you have saleae or oscilloscope?
both
k what format do you need to flash a test build?
I don't know, I don't think so. There might be one here that I don't know about though.
Would re-enabling stopping of main and keeping the context be a simple interim fix in 3.0 or earler? It's handy to debug your main.py by Ctrl-C and looking at variable values.
we'll see what carter gets first
you'd probably know if you had a scope, the saleae is a tiny little black brick that can easily be overlooked
Agreed about knowing if we had a scope.
@slender iron i've been using jlink and .bin for bootloader, the uf2 after that
i'll use same, easier for something like that
yup
what is that file?
can just drag it over?
like with the cp uf2's
ah. ok. getting my nomenclature in order.
bootloader = bootloader
firmware = whatever after that (ex: circuitpython)
We do not have a saleae.
(edit) oh. you said not. sorry.
get it going?
still setting up....
kk
oh yeah, gray is gnd.
Wow. No wonder we don't have one sitting around. Looked up pricing, heh. OH... I just realised why it seemed familiar. My friend brought one home from work a few times.
how'd you measure the small variance?
did same, not finding any variance here
what version of logic sw are you using?
i just installed latest (1.2.14) on this machine recently
was using something some years older prior
My first thought it that where you stop it would be random. Even in a simple loop where you stop would impact what you expect values to be.
they really buried stuff in the interface, i can't even figure out how to change the sample settings
I'll update mine
or not
oh. there it is. really? it's the weird scroll bar like button next to start.
ok. was at 16 MS/s. good enough for these frequencies.
π now I wanna check my M0
@idle owl yeah, the current line up of saleae look spendy π’ didn't realize they had gotten so $$. pretty sure my logic 8 was around $100 when i got it several years ago.
@tidal kiln That makes sense.
it maxes out at 24 MS/s, but never had an issue with that.
pretty sure i've used more than 4 channels a few times though
First glance, logic 8 is 219$ now. Logic 4 is 109. Oi. Pretty big difference from yours.
yeah, that's an evil price point on that logic 8
i think i have a slightly older version of this: https://www.adafruit.com/product/378
Yeah that's the first thing that came up when I searched for it.
I was thinking about getting a pro....
need the speed?
yeah, thinking so
ok so the M0 clock looks ok
it was ~235k until I turned on USB and then it was ~240khz
@slender iron i did find a few 238.8 kHz pulses
is there any kind of analyzer that will provide the range of freq in the sample?
not that I know of. saleae is scriptable though
there kind of is:
https://support.saleae.com/hc/en-us/community/posts/200126809-Frequency-deviation-
my second m4 is 239.8khz
does pulse width, not freq
I see average frequency
I'll take what I can get
my sample has 2us - 2.125us
I'm looking for something like the m0 where its 235 on average
ok, this works
my first m4 that occasionally has trouble is 239.3 on average
whats your frequency average carter?
my avg freq is 240
what're you using for sample rate and duration?
100MS/s and 1 second
100? π’
yeah, the pro is 500
i'll set mine to 24 at least....
it shouldn't matter if its detecting edges anyway right?
is usb plugged in?
mines 239.5 with usb
want me to test some other way?
nah, I don't think yours is set up to try and adjust to the usb clock
I need to call it. my brain is done. my code is here: https://github.com/tannewt/circuitpython/tree/check_usb_clocks
k. later.
thanks for the help!
@slender iron Great work!
np. ping me when you want to continue, if you need testers.
Same if it's not Saleae stuff.
thanks!
@tidal kiln Thanks for testing my death code.
ha. np. thanks for writing it.
@slender iron yes. recreated the issue. (didn't see the question previously)
unplugging USB and plugging it back in seems to be key
when main.py (containing code of death) is first dragged over, get blue neopixel, REPL continues to behave, all seems normal, etc.
unplug / replug USB, get blue neopixel, and unhappy everything from there on out.
and now i get to jlink this thing again...
Oh no.... lol
iz good practice π
Valid π
see. quicker the second time. already done.
Nice!
I think the reason it works in the REPL without the loop is that it's sending the one piece of information and the NeoPixel isn't changing. Without the loop in the main.py, it turns blue for the duration of running the entire main.py once, so it flashes blue really fast, and then goes to happy pulsing green.
The program deinits the pin, but the REPL doesn't until it's reset.
Or something like that. I don't know that my terminology is correct.
But the concept is correct. I tested it with a finite for loop. It turns blue for the duration of the loop.
i think you are correct
i tested it by adding a time.sleep(1) as the last line
1 second of blue, then pulsing green
@river quest yassss
@river quest Ahh so cool!!
And thank you @river quest!
from we are told so far from hackaday and MAKE, the ads are doing better then ads usually do
don't worry, we'll be doing reports too
Excellent!
Naturally π€
-AND- sharing the results... HERE
It's so exciting!
Super pumped!
awesome! (sorry got distracted by the combo square)
@slender iron tried check_usb_clocks on my M0: 239.8 kHz plugged into USB; 234.8, then 234.7 a few times unplugged
so it looks like it is locked to USB
this does NOT seem to create issue:
import neopixel
import board
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixels[0] = (0, 0, 50)
pixels.show()
while True:
pass
It's not causing any issues for me either.
However, at a request, placing the pixels[0] = (0, 0, 50) inside the while loop with the pass, does cause the same issues.
I have it much easier getting it back than you do, @tidal kiln
try changing to this line:
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
but with pixels[] = still in loop, and .show() outside
get issue?
It's not blue. Let me disconnect it though to see what I get.
yah, neopixel color shouldn't update anymore, expected
And it required physical removal to eject it, and on plugging it back in, it's not mounting.
import neopixel
import board
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1, auto_write=False)
pixels[0] = (0, 0, 50)
pixels.show()
while True:
pixels[0] = (0, 0, 50)
that's what i meant (short enough code to just show)
Pasting as is.
should get blue with that
Yep, I got blue. Disconnecting.
Again wouldn't fully eject until I physically reset it. And it's not mounting following reset.
Renamed, reconnected successfully.
later!
@slender iron you previously mentioned that the bootloader you gave me would require some manual intervention to get the jlink to work. I have my jlink now so do you have details for me or somewhere where I could look to find them?
@slender iron I got everything to compile, and I2C.scan() detected a device at the right address (woo hoo!). I'll quit while I'm ahead and test some more in the morning.
@tulip sleet Nice work!
tnx - still amazed
@tulip sleet when you have a chance, try the clock thing on your m4
@slender iron Sorry if I'm a bit out of the loop but is master borked?
its got usb gremlins
give it a shot and let me know how well it works for you
it should build ok
if it's fresh as of an hour ago, my CIRCUITPY shows up but doesn't like being asked questions
Wait, it's live again.
yup sounds about right
unplugging and pluggin in again reproduces it
if you have an oscilloscope or saleae you can check D7 for the clock frequency
the REPL works though
I've got my saleae plugged into D7 on my metro m0; should I be seeing something?
or should I load that uf2 you posted earlier on my M4?
ah right, its not in master
if I'm reading my saleae right it's 239.8khz
on m0 with usb connected?
ah, right around what mine is
but you have mass storage issues still?
theres gotta be some other bug
Does that signal have something to do with the USB clock?
This build (the uf2 you posted previously) does not have mass storage (msc?) issues
that one doesn't have the neopixel support right?
Not sure, I didn't check the context of the post all that much. I can test it if you want
the repl should tell you
The neopixel is going green yellow blueblueblue
import neopixel doesn't work. Does that mean anything?
but the neopixel on board changes colors?
yea
hmm weird
Or it was before I went into the repl
it should be white in repl
Off white but yes
resetting goes to the color cycling I mentioned
Looks like it's complaining of no busio, probably from when I was trying to see if SPI worked
ah neopixel is the library
neopixel_write should work
ok, I gotta stop working. thanks for the help @pastel panther !
@slender iron go play some PUBG! neopixel_write works as expected
Workaround str(binary_data, 'ascii') works. Thanks!
As for disabling in the larger build... I'm in favor of that when reasonable workarounds exist (as in this case). The fewer behavior differences between different circuitpython builds the better; though I could just as easily argue the other way with regards to being compatible with Micropython on larger microcontrollers.
@tulip sleet Grr. I had to create a new account on Windows (long story) and I'm trying to re-build my toolchain. What was the PPA for the arm embedded toolchain again? I can't seem to find it in my notes....
the arm gcc one? https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa
Yes, the embedded ARM gcc toolchain....
@tulip sleet @slender iron I tried the new 2.x build and the I2C Drivers are working but I am still having trouble with the SPI rgb_display driver. ```Adafruit CircuitPython 2.1.0-5-gc066e4d on 2017-11-03; Hacked Feather M0 Express with 8Mbyte SPI flash with samd21g18
import tft_test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tft_test.py", line 25, in <module>
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 93, in fill
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 82, in fill_rectangle
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 54, in _block
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 131, in _write
File "libraries/drivers/rgb-display/adafruit_rgb_display/rgb.py", line 131, in _write
ValueError: Buffer must be at least length 1
I think I know what the issue is
the last line of "fill_rectangle" should have an if rest: there on it
because sometimes rest is 0, if the size of the rectangle divides evenly into size of the buffer
@solar whale @stuck elbow I only allow a buffer or slice of zero length for I2C writes, not for SPI writes. It seems like a zero length SPI write should do absolutely nothing or complain (right now it complains). We might go with what the Arduino SPI library does.
Is there a use case for zero-length SPI writes (I guess it might toggle CS)
the problem is caused byt this line ( line 82 of rgb.py self._block(x, y, x + w - 1, y + h - 1, b'')
it is not a problem for other SPI devices - I can mount an SDCARD just fine.
@stuck elbow I'm trying your fix now
@solar whale @stuck elbow I think there are two cases, the if rest and also the line 82 above.
In the Arduino SPI library, there is transfer(buf, length). If length is zero nothing actually happens.
just adding the if rest: causes the board to just hang - even control c won't work ??? Have to reset to get it back....
perhaps I did this wrong def fill_rectangle(self, x, y, width, height, color): """Draw a filled rectangle.""" x = min(self.width - 1, max(0, x)) y = min(self.height - 1, max(0, y)) w = min(self.width - x, max(1, width)) h = min(self.height - y, max(1, height)) self._block(x, y, x + w - 1, y + h - 1, b'') chunks, rest = divmod(w * h, 512) pixel = self._encode_pixel(color) if chunks: data = pixel * 512 for count in range(chunks): self._write(None, data) if rest: self._write(None, pixel * rest)
Hmmmm. Any thoughts on what I've done wrong? python3 tools/gen_usb_descriptor.py
--manufacturer "Adafruit Industries LLC"
--product "Metro M4 Express"
--vid 0x239A
--pid 0x8021
build-metro_m4_express/autogen_usb_descriptor.c
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'
Makefile:363: recipe for target 'build-metro_m4_express/autogen_usb_descriptor.c' failed
make: *** [build-metro_m4_express/autogen_usb_descriptor.c] Error 1
@drowsy geyser do git submodule update --init --recursive. There are new and updated submodules
Hmmm. I did. Will re-run. Thanks!
the plain directory usb-descriptor was replaced by a submodule reference. You might need to remove the directory and re-run the git submodule update.
@tulip sleet I agree that moving that check inside the library call would simplify user code
@tulip sleet Huh. I removed tools/usb_descriptor, did a git pull and a git submodule update --init --recursive, then make , and I get the same error....
@tulip sleet @stuck elbow hmm - it is this line that is hanging the board now - with the if rest: from adafruit_rgb_display import color565
are you sure?
As discovered by @jerryneedell and @deshipu, https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display expects to be able to pass zero-length SPI buffers (and have nothing happen). Perhaps we should just handle this edge case and do nothing. The Arduino SPI library will take a zero-length buffer and do absolutely nothing.
Forbidding zero-length SPI reads may still make sense. As noted above, zero-length I2C reads exercise a bug, and don't have a use case, I think.
@drowsy geyser Are you working in a clone of adafruit/circuitpython, or a fork? What's the top commit in git log? Which directory are you building in and what's the make command you're giving?
Clone, (commit log next), building in "ports/atmel-samd", and "make BOARD=metro_m4_express DEBUG=1"
Merge: e267b2c c90a2d9
Author: Dan Halbert halbert@halwitz.org
Date: Thu Nov 2 17:56:34 2017 -0400
Merge pull request #403 from tannewt/fix_swclk51
atmel-samd: Fix SAMD51 SWCLK reset so we can connect the JLink
@stuck elbow yes - just entering from adafruit_rgb_display import color565 causes the board to hang - -- perhaps I have another problem - let me try a different board.
@drowsy geyser could you do ls -a in adafruit/circuitpython/tools/usb_descriptor ?
and do git status in that directory
Yup!
prm@vortex2:/mnt/c/Users/Phil/src/Python/CircuitPython/circuitpython$ ls -a tools/usb_descriptor
. adafruit_usb_descriptor CODE_OF_CONDUCT.md .git LICENSE readthedocs.yml .travis.yml
.. api.rst conf.py .gitignore README.rst requirements.txt
prm@vortex2:/mnt/c/Users/Phil/src/Python/CircuitPython/circuitpython$ cd !$
cd tools/usb_descriptor
prm@vortex2:/mnt/c/Users/Phil/src/Python/CircuitPython/circuitpython/tools/usb_descriptor$ git status
HEAD detached at a043411
nothing to commit, working directory clean
prm@vortex2:/mnt/c/Users/Phil/src/Python/CircuitPython/circuitpython/tools/usb_descriptor$
python3 --version result?
3.5.2
those are all the same as me, and it's working for me (on Ubuntu, not WSL). But I don't think WSL is likely to be the issue.
Ok, thank you, Dan! I'll keep noodling on it. It's almost time for me to go to work, though. I'll try to work on this some more over lunch. π
@stuck elbow @tulip sleet OK - teh hang problem is resolved - must have corrupted the file - now it imports OK but I still get teh error on line 82 - is tehre somethig other than b'' the woudl work. I'm not sure what it is doing.
@drowsy geyser atmel-samd/tools/gen_usb_decriptor.py does this
# path hacking
sys.path.append("../../tools/usb_descriptor")
to find circuitpython/tools/usb_descriptor
that appears not to be working, not sure why
@tulip sleet Ahhh, here's a clue.... prm@vortex2:/mnt/c/Users/Phil/src/Python/CircuitPython/circuitpython/ports/atmel-samd$ make BOARD=metro_m4_express DEBUG=1 V=2 python ../../py/makeversionhdr.py build-metro_m4_express/genhdr/mpversion.h make: python: Command not found ../../py/py.mk:272: recipe for target 'build-metro_m4_express/genhdr/mpversion.h' failed make: *** [build-metro_m4_express/genhdr/mpversion.h] Error 127
@drowsy geyser ! which python
Yep, that gives me nothing. My python install is broken in the new account. I'll go fix that.
@solar whale at line 54, add if data: before that, to skip the self._write() if the buffer is empty
Doh! Working now (after reinstalling python). Sorry to burn your time....
@drowsy geyser that's fine! divide and conquer
Aye!
@solar whale replace the b'' on that line with None
@tulip sleet well - witht hat , it does not crash, but it does not draw anything either π
@stuck elbow if you use None, then it will execute lines 51-53 in rgb.py; not sure that's what you want ?
@stuck elbow that results in ```>>> import tft_m0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tft_m0.py", line 32, in <module>
File "rgb.py", line 94, in fill
File "rgb.py", line 82, in fill_rectangle
File "rgb.py", line 53, in _block
File "rgb.py", line 141, in _read
File "rgb.py", line 140, in _read
AttributeError: 'SPI' object has no attribute 'read'
This morning's build (Adafruit CircuitPython 3.0.0-alpha.0-1143-ge7d6df7-dirty on 2017-11-03; Metro M4 Express with samd51j19) exhibits the same behavior, but I have some additional details.
- Flashing the new firmware results in a solid white Neopixel and a REPL that won't exit.
- There is no D:\CIRCUITPY (I'm on Windows) when the board is in that state.
- Pressing reset once gives me a pulsating green NeoPixel and a working REPL.
- Once I've done the above, the REPL works as expected ...
I'm off for a bit for grocery shopping, etc.
@tulip sleet Have fun!
@solar whale why would an spi object lack the "read" method? is that the m4? maybe it's not implemented yet?
this is an M0
how did you create the spi object?
@tulip sleet you are right, that's wrong, I didn't look
let me fix that file myself
I am not changing busio interface at this time. There already is a readinto method hidden in there as a primitive I2C operation.
@stuck elbow here is the code I am trying to run ```
import time
import busio
import digitalio
from board import *
from adafruit_rgb_display import color565
import adafruit_rgb_display.ili9341 as ili9341
Configuratoin for CS and DC pins (these are FeatherWing defaults on ESP8266):
CS_PIN = D9
DC_PIN = D10
Config for display baudrate (default is 32mhz, about as fast as the ESP supports):
#BAUDRATE = 1000000
Setup SPI bus using hardware SPI:
spi = busio.SPI(clock=SCK, MOSI=MOSI, MISO=MISO)
Create the ILI9341 display:
#display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(CS_PIN),
dc=digitalio.DigitalInOut(DC_PIN), baudrate=BAUDRATE)
display = ili9341.ILI9341(spi, cs=digitalio.DigitalInOut(CS_PIN),dc=digitalio.DigitalInOut(DC_PIN))
Main loop:
while True:
# Clear the display
display.fill(0)
# Draw a red pixel in the center.
display.pixel(120, 160, color565(255, 0, 0))
# Pause 2 seconds.
time.sleep(2)
# Clear the screen blue.
display.fill(color565(0,0,255))
# Pause 2 seconds.
time.sleep(2)
ah, I see, there is no "read" anymore, there is only "readinto"
that's a separate issue, thanks for finding it
@solar whale I made a pull request for the first issue here: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/pull/7
Here's the second fix: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/pull/8
@stuck elbow tahsnks - I'll give that a try - will takke a little while - 'm trying to swap baords as well.
seems like nobody used that library seriously before π
@stuck elbow not surprised - not much memory left but it wasa test case I have been using.
we could use a smaller buffer of fill
it uses 1024 bytes now, we could use 512 β the size of the DMA buffer
any reduction would help
ok, then one more pull: https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display/pull/9
Looks like my Circuit Playground Express will be delivered today. Will probably be a while before I can really get started on the examples I want to, but it brings me a step closer
Hehe, my j-link should arrive today too, and my gf is leaving for a week tomorrow π
I guess my sleep schedule will completely annihilate itself.
@stuck elbow did you withdraw the first pull request?
I did, I'm making a pull request for 2.x that will allow empty reads/writes
ok
This is mostly for convenience, so that user code doesn't
need to add additional checks.
question regarding github and circuitpython build. when is a tag assigned to project and who assigns it? I noticed that if a project does not have a tag, changes are not included in a release.
usually you create a tag when you make the release
it's like a bookmark, so that you know what code is released in a particular version
so you means me does it. or like dan or scott does it.
no idea who does the releases, I think it's documented on the readthedocs somewhere
I guess I'm wrong, can't find it
@tulip sleet @slender iron can you clarify?
@stuck elbow thanks - I'll test it out once it gets merged and committed.
I tried implementing the changes locally, but clearly messed it up... easier to wait.
@stuck elbow I tried my local implentation , but the change to in rgb.py to _read results in```>>> import tft_m0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tft_m0.py", line 32, in <module>
File "rgb.py", line 94, in fill
File "rgb.py", line 82, in fill_rectangle
File "rgb.py", line 53, in _block
File "rgb.py", line 135, in _read
MemoryError: memory allocation failed, allocating 230400 bytes
data = bytearray(count)
self.dc.value = 0
with self.spi_device as spi:
if command is not None:
spi.write(bytearray([command]))
if count:
spi.readinto(data)
return data
@wanton heart that advice I gave you about replacing b'' with None was wrong
and yes, if you try to read too much, you won't have enough memory to hold it
can't be helped
So i have the j-link now, and I tried loading the bootloader into the metro m4:
~$ arm-none-eabi-gdb /home/sheep/dev/circuitpython/uf2-samd/build/metro_m4/update-bootloader.elf
GNU gdb (GNU Tools for ARM Embedded Processors 6-2017-q2-update) 7.12.1.20170417-git
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/sheep/dev/circuitpython/uf2-samd/build/metro_m4/update-bootloader.elf...done.
(gdb) target remote localhost:2331
Remote debugging using localhost:2331
0xfffffffe in ?? ()
(gdb) monitor reset
Resetting target
(gdb) load
Loading section .text, size 0x4a1c lma 0x4000
Loading section .relocate, size 0x4 lma 0x8a1c
Start address 0x4000, load size 18976
Transfer rate: 71 KB/sec, 6325 bytes/write.
(gdb) compare-sections
Section .text, range 0x4000 -- 0x8a1c: MIS-MATCHED!
Section .relocate, range 0x8a1c -- 0x8a20: MIS-MATCHED!
warning: One or more sections of the target image does not match
the loaded file
It seems the load command does nothing. What am I doing wrong?
I started the gdb server with JLinkGDBServer -device Cortex-M4 -speed auto -if SWD
not sure if that's correct?
should I specify SAMD51something?
@fading solstice @stuck elbow A release on github requires a tag (I think you may know this already). When you create a release there, it asks for an existing tag or a new tag name. Random commits don't get a tag or force a release -- it has to be done by hand. @slender iron and I don't keep track necessarily of all the library changes, but whoever accepts the pull request should probably make a new release.
You can create a tag locally in git and push it up, but you have to do git push --tags or else it doesn't show up.
@meager fog has asked if we can do that automatically on a commit, as part of the .travis.yml script. It's possible to have travis do stuff in github.
that kinda defeats the purpose of a release though
unless we want continuous delivery π
@stuck elbow - implented your PRs locally and it all works great!! - thank you!
I did not test bitbangio
ahh, specifying the device as ATSAMD51G18 made it work
I'm misremembering: now I remember she wanted the .mpy to be generated and commited automatically. We might have talked about releases too, but I don't remember if that's true. We could auto-generate a new release if there's a new tag. But I don't think this is going to happen soon.
@stuck elbow isn't it ATSAMD51J18 ? for the M4
it is the m4
metroM4
yes
I thik it is J18 not G18
ok
J19
J/G = pin count, 18/19 = flash size
I used my My Opti-Visor π http://www.doneganoptical.com/products/optivisor http://www.doneganoptical.com/wp-content/uploads/OptiVISOR.jpg
does it have ar things in it?
got the bootload in \o/
bootloader
now, that's out of the way, I'm going to go back to my work, and will continue this in the evening
thank you for help everyone
@stuck elbow thansk for all your help!
Correct the doc at line 251. Maybe say: "If the buffer or slice is of zero length, nothing will happen." or some better phrasing.
Correct the doc at line 210. Maybe say: "If the buffer or slice is of zero length, nothing will happen." or some better phrasing.
Docs updated, sorry, I missed that.
@stuck elbow can you do bitbangio/I2C.c too?
I'm trying to put the latest uf2 bootloader on my M4's. I have the original factory bootloader on it. JLinkExe cannot halt the CPU. Tried unplugging and resetting a few times. Any suggestions?
done
@tulip sleet I don't have a fix but I can confirm that I had the same issue the other day of not being able to halt, but I'm using the self-updating firmware that @slender iron gave me last week
@tulip sleet that happened to me. unplugging jlink, double resetting, then plugging in jlink worked for me
should get red neopixel for bootloader
@stuck elbow could you copy the extra doc lines re buffer size from busio/I2C.c to bitbangio/I2C.c ? (I'm having trouble adding review comments on some lines.) Tnx
@tidal kiln you mean unplugging the ribbon cable, or the Jlink USB to host?
i just removed the jlink from the usb port on the host computer
left all the ribbon cable hooked up
@tulip sleet done
@tidal kiln Worked, thanks! Had to do it in exact order.
yay. glad it worked.
@formal plover that's awesome, they even don't have the problem with the neck!
@stuck elbow Nope, they look great!
what's the 0x0C about?
@tidal kiln they number the stickers
ah
@pastel panther you'll need to manually update circuitpython. the self updater is just something to update the bootloader
guess not always, got several without
@slender iron does the UF2 bootloader know the size of flash? I have one of the orig Metro M4's with a J20 instead of a J19 and want to update the bootloader on it.
@slender iron I know, I was just telling Dan that I didn't have the factory bootloader
@tulip sleet I'm not sure
k I'll look
@slender iron Is the USB fix from your fork going to make it into master? I'm currently testing my filename extension hackery against your repo
there isn't a fix in there. its mostly just outputting the clocks
hmmm. but then why does it work when master doesn't?
thats a good question
time to compare them
thanks @pastel panther !
@slender iron that's really interesting - want to push that to master?
couldn't hurt
@tulip sleet wanna just try it on your end?
@slender iron ok, only one style, in the ones i could find at least
@tidal kiln yup I think they number the hexagons. I have a bunch on my smd binder
@slender iron k, will do. Do you still want me to test clock speed on my M4? Did you see from last night my M0 seems OK (goes to 239.8 when plugged in)?
nah, I don't think its as important as I think
the others could've come from a table-o-stickers at a conference or something
@slender iron I love/hate that. I have a horrible pokemon fever when it comes to things like that. MUST ORDER MORE BOARDS
π
@tulip sleet I was gonna go back to the m0 today and try it through a usb2 hub too
Why do this? It seems to me that you'll just hide bugs this way because there is no use I know of for zero length SPI reads and writes.
There are libraries that already assume they can read and write no bytes (e.g., https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display). The Arduino SPI and I2C libraries allow empty buffers: they just don't do anything. I think is kind of like allowing file.write(b'') in Python, the Posix routine write(fd, buf, len) allowing len to be zero, etc.
The exception was an empty read in I2C. That in fact doesn't seem to have a use case, and doesn't really fit with the protocol.
Ok, sounds good!
On Fri, Nov 3, 2017 at 10:06 AM Dan Halbert notifications@github.com
wrote:
There are libraries that already assume they can read and write no bytes
(e.g., https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display).
The Arduino SPI and I2C libraries allow empty buffers: they just don't do
anything. I think is kind of like allowing file.write(b'') in Python, the
Posix routine write(fd, buf, len) allowing len to be zero, etc.The exception was an empty re...
@slender iron I tried more precise usb_busy here: https://github.com/adafruit/circuitpython/compare/master...tannewt:check_usb_clocks#diff-ada3fa665a140a9ffcfb3f5134e8f620R287. Still seeing 30-second resets, can't get into REPL, etc. Doesn't mean it's not a good idea, but it didn't fix issues on Linux.
I am testing I2C in the REPL with MSC turned off for now.
kk, I'll look soon. I did see a hardfault on the m0 yesterday that could be the issue π
@deshipu This is very interesting. Let's wait for the stage library to be ready, since you may want more changes here in the process of finishing that.
lol
looks like clang might be able to detect it
I see they're fans of the "por que no los dos?" school of programming
@slender iron What's the rule of thumb for UF2 devices? Is it all M0s or is it all "designed for Circuit Python" boards?
yeah, everything new
cool cool. Just soldered the headers onto a M0 Adalogger. So that's a no go then lol
it only has bossac
I actually have a use case for the empty I2C read. The PCF8574 expander will switch the pin mode (input/output) on I2C reads/writes, so you can do an empty read just to switch a pin to input without actually reading its value.
I just realized this is impossible, because the slave will send at least one byte anyways, before you can NACK it.
That was my intention, I just wanted to put the code out there as soon as it's ready.
@tulip sleet @slender iron I won't say this went smoothy, but wow! ```
Adafruit CircuitPython 3.0.0-alpha.0-1143-ge7d6df7 on 2017-11-03; PCA10056 with NRF52840
help('modules')
main math sys ustruct
array micropython test utime
builtins os time
gc pyb ucollections
machine random uos
Plus any modules on the filesystem
now if I can just remember how I got here?
That's always the hard part
@slender iron I did not change anything - just built the version in ports/nrf -- one step at at time.... I can blink the leds!!!
Gah. I didn't know about CircuitPython during my last order, so I had to place another order...
@meager grove If you're anything like me, you'll slowly gather an army of CP minions
Yeah, might ordered a few M0 boards of different flavors.
π
There are some tasty treats coming down the pike so prepare your bank account ;P Not that they're going to be all that expensive
Always. I need to make a project board so I can make sure that I am working through my backlog.
Did you get a Circuit Playground Express (CPX)?
I did. "For my girlfriend"
nice. You know, my wife never seems to use the arcade machine "we" got for our wedding. Oh well ;P
My friend once made a refrigerator door alarm and our freezer door has a tendency to not shut all the way.
So I am going to introduce her to Python with the Circuit Playground Express and recreate the project.
Nice
are you going to use the temp sensor or the light sensor ? Or the IR sensor? or the....
you've got options. There is a lot to love in that little board
Yeah, I like that it has so many things. It should be a lot of fun to play with.
Am I reading correctly that the Huzzah will run CP?
the 8266? Yes I believe so
Ooh, bonus. I bought one thinking I'd use it with Arduino!
releases are here: https://github.com/adafruit/circuitpython/releases
Ok, I need the brown truck to arrive.
Before too long, 2 day shipping will seem like an eternity
Seriously, I remember when I would go to a store if I needed something now.
If their was an Adafruit-like store in my neighboorhood, I would be living in a box outside of it.
Same
I don't know where I'd plug my Hakko though...
Wire a dynamo on an excercise bike and 'hire' children to pedal it for candy
Candy in, electrons out. Easy peasy
@meager grove How did you learn about Circuit Python?
One of the recent videos, very exciting.
I am looking for ways to get people started hacking fast for workshops/classes. Seems perfect.
@meager grove one thing to point out is the difference between the boards that have the UF2 bootloader and the ones that don't
The UF2 bootloader is the drag and drop code/files feature
That is cool. That is only the Trinket M0 for CP and the Circuit Playground Express at this point, right?
The boards that don't you have to use a tool called Ampy to mess around with files and whatnot. Not incredibly difficult, I just wanted to make you aware
The first version of the Stage library is now available at: https://github.com/pewpew-game/circuitpython-stage
Circuit Playground Express, metro M0 Express, Feather M0 Express, Trinket M0 and Gemma M0.
Oh. So many options. Nice. For teaching, that is the way I will go. For my own stuff, I'm much more flexible.
You will probably see us mentioning a metro M4 as well. That's not out yet but some of us are lucky enough to be testing it right now.
@meager grove yes, tons of options. Lots of fun
I love the idea of using a Circuit Playground Express to expose people to making stuff.
Yeah, it's awesome.
Running away. Thanks for the info! I can't wait to play with my new toys. π
hmmm.... ImportError: No module named 'adafruit_usb_descriptor' in the latest master
my submodules are up to date
Hm.. I got the same error and updating my submodules helped after I removed some directory it was complaing about because the submodule wanted to overwrite it
I will make a fresh checkout
@stuck elbow see my debugging of same issue with Hukuzanatua in this room starting 9:18am Eastern time. The tools/usb_descriptor was a regular directory and is now a submodule, and I had to fix that manually.
That was not his problem, though (he did not have a /usr/bin/python)
hmm, I don't have such a directory at all...
ok, git submodule init fixed it
That's my goto fix whenever it's complaining about a missing file
I wonder if you can't make git update make sure submodules are in sync
thanks
git submodule update --init --recursive is the do-everything
protip: git lets you alias commands so you can pull and update submodules with a pull:
https://stackoverflow.com/questions/4611512/is-there-a-way-to-make-git-pull-automatically-update-submodules
Adafruit CircuitPython 3.0.0-alpha.0-1143-ge7d6df7f7 on 2017-11-03; Metro M4 Express with samd51j19
\o/
now you get to have the MSC and CDC problems, esp if on Linux
I got my circuit python port of an Arduino library (for the ATM90e26 energy monitor chip) working...here's my write up in case anyone is interested. https://bitknitting.wordpress.com/2017/10/31/using-circuit-python-on-the-feather-huzzah/
@bronze geyser neat!
Thank you for your help. Particularly @slender iron
@slender iron I think he's cooking
kk
@slender iron you around?
π
just remember something in that tsl library i wanted to ask you about
kk
returning None instead of 0:
https://github.com/adafruit/Adafruit_CircuitPython_TSL2561/blob/master/adafruit_tsl2561.py#L139
it was originally 0, then i changed to None, guess i can see going either way
what are you trying to convey with that value?
something equivalent to a NaN, or an error, since it means something is wrong and there is essentially no value
perhaps throwing an exception would be better then
yeah. i think i thought of that too.
which is kind of another question, how liberally should we be throwing exceptions?
concern being how that would look to a user
I think it generally makes sense to throw exceptions whenever there is an error
that lets you not write all those if value is None: checks later on, just catch the exception in one place
another reason for exceptions is that if you return something like NaN, the program will keep on running and encounter a weird error later on β and it will be difficult to tell where that NaN came from
I think exceptions with good explanations are much better than returning None
whereas if you have an exception, you see the traceback that tells you exactly where
yep. i agree with all this.
i think the current python libs for tsl return 0
so i started with that, but then realized it should be something to actually indicate an issue
so i just switch to None
but meant to then ask (which is where i'm at now)
one of the cases is for sensor saturation
so with an exception, you'd have someone write a simple little loop on tsl.lux, get some happy values, move their lamp real close, and BAM! a wall of exception text
Generally my philosophy is to accept a wll defined range of inputs and if something unexpected happens with those inputs, raise. Exceptions are there to handle exceptional cases. If your reasonable input reasonably produces nothing, you don't need to return anything.
I apologize if that's not directly relevant to this case
Question about i2c stuff. So do you always have to write to an i2c address then read off of it? Or can you just read values?
yeah, they can always handle the exception in their loop if they want
@formal plover you need to give it an address
who's they?
the user who wrote the loop
the very beginner level programmer?
@slender iron I know you need an address, but an address to both read AND write?
you always need a device address
totally agree with exceptions, just thinking of target audience, should we be tasking them with exception handling?
I would say not immediately, but that can be avoided by being clear that only specific inputs will work.
its better than wondering why a number isn't changing
Exceptions are at least currently the best way to say "this went wrong because of X" which is important so they can fix the issue. Perhaps someone should eventually write a "my first stack trace" guide
This explicit zero length xfer leads to a second CSW packet. If
another read was started between the two CSWs then the host gets
confused and resets the device.
On reads, the CSW is automatically sent when we reply with the
total length. Writes must do it manually so they can wait for the
disk to flush the data.
@slender iron want me to close this? https://github.com/adafruit/circuitpython/issues/314
yes please
done
thank you!
np. thanks for helping me through the process.
no problem!
i thought pr's were from a specific commit point (not sure why). TIL that they are just from a branch. :the_more_you_know_emoji:
yup yup
alright. time for another 30 mins of this: https://www.youtube.com/watch?v=hM4I58TA72g
Speaker: Eric Holscher This tutorial will cover how to write documentation using RST, Sphinx, and publish it on Read the Docs. It will walk users through the...
ooooh I should watch that
should time travel and attend
video has some tech issues, but still has good content
but hey, that's mr. readthedocs teaching
Oh it includes sphinx and it's not 3 hours long? π
I prefer to watch online
what do you got against time travel?
nothing. then I could get teleportation too
@bronze geyser Congrats on your CP port!!!
@tulip sleet did you try that pull yet?
@slender iron you free for noob help?
for abit longer
trying to do the readthedocs tie to github
starting from scratch and not using cookiecutter
made a repo, used sphinx-quickstart to populate it
pushed it up
went to readthedocs and did the manual import (per your guide)
that good so far?
oh, and added the readthedocs service to repo on github
so the issue is with readthedocs
it initially pulled over the stuff from github and did a build
but it says there is no webhook and no additional commits trigger anything
did you refresh?
yep
can you see it listed in github integrations?
on readthedocs?
M3 metro owners who like arduino can try out our new MP3 decoding library https://github.com/adafruit/Adafruit_MP3
on github
er, Metro M4 not m3
@slender iron By George, you fixed it!!
yep. github shows the service.
w00t
That was a lot of staring at USB traces, I bet
it wasn't super bad once I realized it was sending the same response twice
I have no trouble getting into the REPL either. This is great!
ooooh perfect!
@tulip sleet @slender iron anything for me to try with my metro m4 on cpy
@meager fog that is also great! How big is it? Thinking of adding it to M4 CPy?
yah its for arduino and hopefully soon python, its 32KB of flash and at least 32KB ram
right now arduino uses 100kb of ram because we're doing a ton of buffering. basically just got it working
@meager fog I think I got rid of some usb gremlins
is busio commited or is that still in progress?
@meager fog scott just made a really significant fix to USB
yayy
I just got busio.I2C to scan for devices last night. I was going to test further but was stuck due to usb -- however that's fixed now and I can go back to testing.
If I2C sees devices that means it is working to a significant extent.
all good i will wiat for y'alls command
just found a msc bug for m4 too I think
Woo, I finally have a Circuit Python Express. Today has been a good day. I can hear out of my ear again (mostly... stupid ear infections), went and saw Thor after work, and come home to a CPX waiting for me.
@slender iron what's your workflow been for making changes in asf4? Should I replace the submodule with a fork of it, or just move patches over?? tnx
I have this server muted but sometimes I still get random notifs you guys send.
gotta run. spontaneous date night!
have a great time!
thanks!
@main pine Muting doesn't inherently remove notifications for "everyone" or "here" or if some chance someone tags you directly.
@main pine did you turn stuff off by right-clicking on the adafruit server icon and choosing notifiaction settings?
You can go into the server settings and/or channel settings and change the "Frequency" to "Nothing"
@slender iron (for later) I found the submodules workflow tutorial I needed : https://git-scm.com/book/en/v2/Git-Tools-Submodules
@idle owl - yes! you can pull master. Also see above that Scott has another msc bug he's working on for m4. But I don't know what that is
Excellent! Thanks!
Ooh I just made it mad with the submodule update.
@tulip sleet What did I do wrong? 1553 kattni@robocrepe:atmel-samd [55m master *%= 5ff641772]$ git submodule update --init --recursive Submodule 'tools/usb_descriptor' (https://github.com/adafruit/usb_descriptor.git) registered for path '../../tools/usb_descriptor' fatal: destination path '/Users/kattni/repos/circuitpython/tools/usb_descriptor' already exists and is not an empty directory. fatal: clone of 'https://github.com/adafruit/usb_descriptor.git' into submodule path '/Users/kattni/repos/circuitpython/tools/usb_descriptor' failed Failed to clone 'tools/usb_descriptor'. Retry scheduled fatal: destination path '/Users/kattni/repos/circuitpython/tools/usb_descriptor' already exists and is not an empty directory. fatal: clone of 'https://github.com/adafruit/usb_descriptor.git' into submodule path '/Users/kattni/repos/circuitpython/tools/usb_descriptor' failed Failed to clone 'tools/usb_descriptor' a second time, aborting
@idle owl rm -rf circuitpython/tools/usb_descriptor and try again
the plain directory was replaced with a submodule
Yes! Thank you!
did it work?
Yep!
At least it looked like it did, lol.
Cloning into '/Users/kattni/repos/circuitpython/tools/usb_descriptor'...
Submodule path '../../lib/axtls': checked out 'dac9176cac58cc5e49669a9a4d404a6f6dd7cc10'
Submodule path 'asf4': checked out '1e0e419f197661baa40ce35bc712ce14f0d4a714'
Submodule path '../../tools/usb_descriptor': checked out 'a04341153b41b4728f9b42a77cbd51c495362287'```
Yeah, it's usually only one line I think, but it says checked out like it does normally
I somehow managed to horridly mangle my fork. My knowledge of Git was insufficient so I chose the nuclear option.
@cunning crypt That's a totally valid option. I've done the same before.
It looked like the folder layout changed between when I forked mine, but the updates weren't updating it.
So... Nuke it from orbit. It's the only way to be sure
...Hmm, strange.
Oh, right, I hadn't deleted my local files.
Hah! The Code of Death no longer bricks the board! @slender iron Great job!
DotStar is NOT compatible with Neopixel libraries, correct?
@cunning crypt - right. different signaling protocol. DotStar is SPI. NeoPixel protocol is its own thing.
but we try to make the libraries have same/similar API's
Yep, but! Writing a Neopixel example will have (slightly) different stuff than writing DotStar examples
@cunning crypt Congrats on the new CPX btw!
I'm going to do fun things with it eventually, I know it
But for now, it'll do some more mundane things. Like make examples.
Or, as with many things I do, stand on the backs of giants and simply transcribe and do some annotations and updates as needed.
Hmm, as the Circuit Playground has most examples covered, I think I'll just take the "Easy" method, and create a text file with pointers.
We try to. Did you look at the CPX API doc on ReadTheDocs? It's limited if you're an experienced programmer, but we included examples for everything in the API. Typically there was more in depth code written to test the API, but the examples are all meant to be simple.
Those are the examples I'm going for - The super simple beginner stuff
Also, me, an experienced coder? That's an amusing joke.
Fair enough... You ask excellent questions then. π
Actually, experienced is probably the most accurate term. I'm not exactly proficient.
I've learned how to ask the right questions.
It's an important skill to have.
Knowing what and how to ask is a more important skill than having the answers.
Many people I know think of me as some IT Genius. I'm not. I just know how to find the answers, and/or know people who DO know the problem.
Sometimes that's the better skill to have, I've found.
@cunning crypt there's also this in case you haven't seen: https://learn.adafruit.com/adafruit-circuit-playground-express
That's what's up on one of my other monitors right now!
that's pretty much the uber guide for cpx
running circuitpython is just one of its tricks
I need to get in a PR for the CPX API library translations of all of the included examples from that guide. I have them all written.
Yep, and reinventing the wheel is a terrible idea for basic examples. So I'm just going to point to those for the stuff that doesn't need new examples written
@tidal kiln Did you see? The Code of Death isn't a brick sentence anymore. It's working fine with the update.
Oi.
Makes sense. Seemed like one I would lose, so I wasn't sure which path to take. Both cookiecutter and not seemed like losing propositions to me.
get latest from s3 bucket?
OK, that is cool. If you set the brightness to 0.004 on the CPX's NeoPixels and have it display "White" you can EASILY see the individual color LEDs
I'm also completely lost on starting to write a driver in the first place, so I think that adds to not feeling great about starting with Sphinx from scratch.
looks like i modded and overwrote my code of death, if i remember, it's this?
import neopixel
import board
pixels = neopixel.NeoPixel(board.NEOPIXEL, 1)
while True:
pixels[0] = (0, 0, 50)
pixels.show()
Well, there's that. In case anyone is curious, the minimum brightness you can get the Circuit Python CPX Neopixels to show at is 0.0039215703
Yeah that looks right. I forgot to add pixels.show() back to it, but I'm pretty sure it bricked either way before.
and i'm rockin Adafruit CircuitPython 3.0.0-alpha.0-191-g5ff6417 that's latest?
Mmm... this is what mine says: Adafruit CircuitPython 3.0.0-alpha.0-1145-g5ff641772-dirty on 2017-11-03; Metro M4 Express with samd51j19
Oh wait, that's the same. I just read the end of mine.
Yes. You're on the latest.
Since I don't have one to check - M4 Express board has LED on D13, right?
Yes.
indeed. no more bricky mcbrick brick.
although it might be a while before i totally lose my fear of a blue neopixel
Someone want to humor me and make sure my "Universal" CircuitPython Blink example works on the M4?
It's just your standard Blink, except it checks what board it's on and applies the correct pin.
Which is D13 on everything except the ESP8266
same here.
Yay!
I love it when stuff works, even simple stuff.
Especially stuff on things that are experimental
wonder if it was ever considered to have a board.RED_LED or some such?
Hmm. No idea. It's part of the CPX API but that's not the same or useful for anything other than the CPX. When using the API.
Documentation says use bossac for recovery but that requires a .bin file. The .bin should be part of the release even if .uf2 is the primary. I assume the intent is to still support bossac.
Humidity monitor status: Prototype boards and parts have all arrived. First board populated. Code tweaked. Trinket updated to CP2.1. Code loaded. It seems to work. Battery is charging, then Iβll see the power management stuff working. Tomorrow Iβll install it, take pictures, and finish a blog post.
@umbral dagger Nice!
Super thin board, no headers to mount the trinket and power breakout.
Did you have to cut into the Trinket?
Looks good. Well done!
Thatβs before the piezo thingy and header for the Si7021 breakout were added. Iβm not using the neopixel in the final design.
Iβll need a 3d printer to completely finish the project.
How will it work in the end?
I dig the DIY castillations
@idle owl Read the blog post π
Wait is this all new, or have you blogged about it previously?
New.
So I should have said βRead the blog post once I write itβ π
Which Iβm planning to do tomorrow.
@tulip sleet Thanks for jumping in on the forums. I totally missed that they'd already tried the flash eraser. Just edited my post.
i'm hoping to use mqtt w/ circuit python... is the paho library available?
paho?
it's the mqtt library i use on the raspberry pi...doesn't matter...just want to know if i can send mqtt messages from circuit python...if that's available.
on th esp8266?
there is https://github.com/micropython/micropython-lib/tree/master/umqtt.simple but I'm not sure if it will run on circuitpython
may be worth a try
@bronze geyser Iβm using the Paho C client in my smarthome system (with custom Chicken Scheme integration). As @stuck elbow said, itβs worth a try. You might have to do a custom CP build to incorporate in, though.
thanks @umbral dagger and @stuck elbow...i'm in process trying the umqtt.simple lib that's part of micropython.
@bronze geyser Iβm interested in hearing how that goes.
@umbral dagger = will let you know. Thank you.
noob here, I have some 'defs' defined in a file called test.py which I save to CPX with the goal of testing the functions in the REPL. From the REPL I import test without a problem but can not see my functions, has to be something simple.........................
@pulsar bloom could just be how you are trying to access the functions. see this example:
def foo():
print("hello world")
in REPL:
>>> import test
>>> test.foo()
hello world
>>>
you can also use dir() to see what's there:
>>> dir(test)
['foo', '__name__', '__file__']
note that foo shows up
That is what I am trying but not working, will try that simple case when home.
ok. if it doesn't work for you, post an example of exactly how you are trying it.
Another problem is I can not ctrl-C a running program and have it's variables and functions stay in scope. I have done one project in micropython and it seems like I could do that.
yep. that works in micropython. it's being discussed for circuitpython:
https://github.com/adafruit/circuitpython/issues/298
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?
yeah, circuitpython doesn't allow that, apparently it was confusing to user
you have to import main to get access to all that
Thanks all problem solved, is test.foo() not just foo()
yay!
Unless 'from test import *', problems doing this?
you lose the namespace and can possibly shadow / overwrite things, so just need to be aware of that
@stuck elbow your comment makes sense now, thanks
ex, add a second file test2.py:
def foo():
print("the second foo")
in REPL:
>>> from test import foo
>>> foo()
hello world
>>> from test2 import foo
>>> foo()
the second foo
>>>
compare to this:
>>> import test
>>> import test2
>>> test.foo()
hello world
>>> test2.foo()
the second foo
>>>
Got it, keeping track of namespaces could turn into a debuging nightmare. My use case is developing simple functions and then trying them in the REPL.
in that case you could probably use the from test import ... syntax
there's also this option:
>>> from test import foo as someothername
>>> someothername()
hello world
>>>
Yeap
and to really shortcut things:
>>> from test import *
>>> foo()
hello world
>>>
Hey @slender iron im getting into circuit python a bit now and i managed to mess up the main.py on my trinket m0. I found the thread about fixing the file system and the uf2 flash erase file (https://github.com/adafruit/Adafruit_SPIFlash/tree/master/examples/flash_erase_express) which one of these do you think would be better for the trinket m0?
I pressed the reset button on my trinket too soon after saving the file to the pydrive
Progress is being made
edge illuminated direction indicator?
Yeap, does not photograpy well if you zoom in you can see the pointer, 8 cardinal directions.
Next to decode gray code on weather vane
@charred blaze only express boards have spi flash, so that won't work for trinket m0. what exactly is your trinket doing?
Ah dang. Gimme just a sec to explain. I switched to my phone.
@charred blaze you can also just flash arduino and then circuitpython again
Ahhh ok!! That works
π
can you try what @slender iron just suggested?
That's what I'm gonna do. As soon as I'm done eating
@charred blaze for ref: https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino/circuitpython
Yeah I've been looking through that. Maybe I just didn't catch it
it doesn't explicitly mention running an arduino sketch first as a way to clean up (erase) the flash
Not a bad idea though
and all that does is run bossac under the hood with a -e option
Ahhh
well, and uploads your sketch, etc.
having someone run an arduino sketch is just the easiest way to get this done
just run a blink or whatever, after that you should be able to use the directions in that guide
Huh. I had it working. but now something else is wrong and i have no clue. circuit python isnt running at all and it doesnt show up on my desktop either, nor does it show up in the arduino ide. if i double tap the reset button nothing happens. using my multimeter to check connections for some reason when i connect it with usb i get the ding when touching the usb and gnd pins. but if i power it using the bat pin i get the ding when checking the bat and gnd pin but not the usb and gnd pin. and there are no stray connections
But when i have the trinket powered off there is no ding from the multimeter when checking any of those connections
@charred blaze you can't even get back into bootloader mode?
not at the moment no. But I had it working and then this happened
it sounds like you have hardware attached to the trinket?
detach everything. plug trinket in to computer via usb. double reset.
you get nothing?
only thing attached right now is a tiny strip of neopixels. and there are no crossed connections. and i still get nothing
can you post a photo of your setup?
Ignore the second micro usb port on it.
thats not wired up as a usb port. its being used as a connector for something else.
is the trinket soldered into that green board?
yes
what is the green board?
just a perfboard
can you post photo of other side?
excuse my solder job. first time using a perfboard like this one.
And ive checked that there are no connections from any power and the gnd
@umbral dagger I'm able to send mqtt messages from a Huzzah running Circuit Python....my write up: https://bitknitting.wordpress.com/2017/11/04/using-mqtt-on-circuit-python/ in case anyone is interested.
hmmm. there could be some other short or something. hard to tell.
plug the trinket into usb and post a photo of the top showing the led status
even after you press the reset twice?
yup
does it even appear as usb device to your computer?
the double reset is pretty quick. sometimes you can miss it by being just a little too slow.
I'd say either it's broken, or the bootloader is broken
maybe
at this point, i'd expect a hardware issue before a broken bootloader
do you have a second trinket?
thankfully yes. and its working just fine
with same usb cable, etc?