#circuitpython-dev
1 messages ยท Page 122 of 1
Ahh, ok
Has anyone been successful at getting an I2C 16x4 LCD working with circuitpython on a Trinket M0? It looks like the library exists for pyboard, but needs porting to circuit python: https://docs.micropython.org/en/latest/pyboard/library/pyb.LCD.html
The Metro M4 so far has a J19 which has 512K flash & 192K ram, the J20 has 1M and 256K ram.
In comparison, the Xplained board I have has a P20 on it, which is a significantly larger chip with way more IO (including ethernet)
@cunning crypt CP really shines for simple applications: a few dozen lines of CP on a trinket and you can VERY quickly do some simple, but cool and useful stuff.
Oh yeah.
Finally getting to building a circuit python based HID for a hyperpixel retropie build
Is it possible to have a circuitpython hid joystick/controller vs. keyboard
@tulip sleet I just wanted to confirm that he UART not been implented in busio 3.0 yet? I saw the new gps driver so I thought I'd give it a whirl - I first tried it on my M4 but became suspicious when I realized TX/RX are not defined ๐ but more so when it could not find busio.UART. I moved it to my metro_M0 under 2.1 and it works fine. I just wanted to verify that it is not expectd to work on 3.0. If it is, I'll be happy do do some more experimenting with it.
@solar whale that's right - I am working on SPI right now, and will do UART next. That's why busio.SPI doesn't exist yet. I just got delivery of some breakouts that use SPI so I can test. I don't have any UART breakouts but I could probably just test with a USB-serial converter.
@tulip sleet Thanks for confirming. THat sounds like the best order of things to me as well. No pressure from me. You have gotten so much farther so much faster than I ever imagined! let me know if there is anything I can do to help. Always happy for alpha/beta testing.
@solar whale no problem. the issue is not so much implementing it but trying to figure out how to do it cleanly in ASF4 and how much I should modify the base ASF4 code. ASF4 tries to do a lot of setup at compile time by assuming you're not going to change pin assignments, settings, etc. There is some API to make those changes but it has a zillion #define's for each device to set them up in advance. This is oppsite from what we're trying to do, which is have a lot of dynamic pin/device stuff.
mostly I am taking Scott's original code and just substituting api calls
@tulip sleet I ran into one intersting thing. I tried connecting the GPS to D0/D1 on teh M4 (RX/TX on the Metro M0) but I did manage to get them reversed. Normally that does not cuase much problem other thatn it not working. On the M4 with 3.0 it caused the USB serial connection to freeze and eventaully disconnect. Not sure if that would be expected or if it is useful informations for you. Since they are not even defined as TX/RX, I'm not sure it really matter how they were connectd, but more likely that it was just not happy getting inputs on them at all without the being properly configured.
ASF4 sounds like such a pleasnt environment ....
@solar whale that is very odd, because there's nothing compiled in that should even be paying attention to those pins. I will make a mental note to check that
It was odd - I would be able to access REPL for "awhile" since I get fixes every 15 sec, I assume it was the next fix that killed it, but I did not confirm.
did you test this on M0 or just M4
That may not be at aall relevant. I don't recall if the unit transmits more often than on it s own. When I swapped the pins, it ddi not crash any more, and I wa able to try to tet it. Just something to watch out for.
I tried 3.0 on M4 -- 2.x on M0 -
but if there was no busio.UART then it was just connected (backwards) and you were poking around in the REPL to try to talk to it?
right - I tried exectuing the simple.py script via REPL. First try told me no board.RX do I tried D0/D1 then it said no busio.UART so I gave up. with the pins "swapped" I could not get REPL to run long enough to execute the test.
that's helpful. I will try to replicate that at some point since it sounds easy. And this is with the latest build?
yes - pulled yesterday for master -- 2.x may be a few days old
sounds like I could replicate with a usb-serial converter that I just cat into continuously and then connect it to the wrong pins
I don't have a GPS breakout
I would think so. I can do some testing on it later today as well. USB serial will give better control. BTW. GPS is set for 9600 baud .
Did not mean to put more on your plate!
we need all these on the plate!! if you can write it up as an issue that would be great. these are the kinds of things limor finds as well. she is doing something more interesting than trying one thing once
OK - I'll replicate it and enter an issue later today. Thanks!
btw I fixed the missing release in the bundle again. we need to go through the libraries systematcailly. some aren't set up properly for travis integration
Thaks for doing that - I pulled it this morning and built all 3 bundles without error.
great
I was worried by Tony's warning that the new updates were going to break 3.0 I2c , but have had no problems yet
As long as there's a consistent set of libraries, there's no problem. I think Tony was worried about piecemeal updates.
Ah - that makes sense - I was curious what the concern was. It can get messy - that is why I keep rebuilding the whole bundle.
tnx - I am off for breakfast
@tulip sleet Of course, I cannot reproduce the problem now ๐ฆ I'll keep poking at it and see If I can. If not, I'll assume it was something silly on my end and hold off on entering an issue. I'll open one if I can replicate it.
@tulip sleet ah - I can replicate it, but more testing needed - lots of potential cuauses in play ... the plot thickens
This is more of a curiosity... I hope it makes sense.
Basic synopsis is that swapping the pins on a serial connection to an M4 running CP 3.0 causes the USB port to freeze and disconnect. Note that there is no UART support in CP3.0 at this time.
The full story:
I was trying out the new GPS library. It works fine in my Metro-M0 with CP 2.x. I mistakenly tried it on the Metro-M4 with CP 3.0 and of course found out that busio.UART is not yet implemented in 3.0 so not much to test...
...
If you hear a strange popping sound, it is just my mind being blown as I play with my new Trinket M0 and Circuit Playground Express.
@meager grove I really love the trinket m0
@stuck elbow the size! It is so small!
it's not the size that matters
well, yes and no. ๐ size-to-power-to-speed of dev ratio is high
it also takes very little power
I know I want like a million of them.
Ok, ridiculously stupid question incoming
What would you use circuit python for, why would I want to use it over the regular arduino IDE.
So, I can answer for me personnally.
I find python to be faster for me to write, and easier for me to teach
That is a good answer
But I like the flexibility of having both.
Which I suppose is an advantage of the trinket
it's also excellent for workshops, because you don't have to spend the first half an hour helping people to install the Arduino IDE
Oh right, another stupid question then, if not the arduino IDE, what else do you program it with?
you can even put the slides and whatever other materials directly on it, so they don't need network
vim :/
really?
vim here too
wow.
Atom
Glad to chat!
Running on the MetroM4: ```
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Type :?<return> for commands
DEBUG> led.value
False
DEBUG> led.value = True
DEBUG> led.value
True
DEBUG> :c
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Type :?<return> for commands
DEBUG>
Code running is: ```
import digitalio
import board
import time
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
while True:
print("hi there")
led.value = True
time.sleep(0.25)
led.value = False
debugger()
time.sleep(1.0)```
very nice!
More: ```
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Type :?<return> for commands
DEBUG> i
0
DEBUG> :c
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Type :?<return> for commands
DEBUG> i
10
DEBUG>
Code now: ```
import digitalio
import board
import time
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
i = 0
while True:
print("hi there")
led.value = True
time.sleep(0.25)
led.value = False
if (i%10 == 0):
debugger()
i = i + 1
time.sleep(1.0)```
My next step is to support an option boolean argument to debugger for a conditional breakpoint.
I wonder how hard it would be to make the debugger appear on a failed assert
And maybe a string along with it that will get output on entry to the debugger.
explain
"failed asset"
python has an "assert" statement
ah.. "assert" ... I misread
that evaluates an expression and throws AssertionError if it evaluates to False
Yes, that would be good
would that be on all assert fialure always, or would it be enabled/disabled explicitly?
debug_on_failure(true)
I can see wanting to wrap a section of code with enabling that
no idea, in cpython all assert statements are removed (generate no bytecode) when you run with -o
Gotta run out for bit... keep throwing ideas at me, though.
another (perhaps stupid) idea would be to have a context manager that enables the debugging, so you could do with debug: ...
My hesitation with that is its structural impact on the code. Removing it is more that just removing a line.
trying to upgrade my feather m0 and using the bossac tool, reports "File operation exceeds flash size"
@tawny creek could you show the command line?
`Vigor:Bossac teejay$ ./bossac -e -w -v -R -p cu.usbmodem1421 /Users/cascade/Downloads/adafruit-circuitpython-feather_m0_express-2.1.0.uf2
Erase flash
Done in 0.700 seconds
File operation exceeds flash size`
drive mounts as "FEATHERBOOT" with files from 1969
don't use bossac to load a .uf2. That's for loading .bin's. Just doubleclick and copy the .uf2 to the FEATHERBOOT drive (/media/<whatever>/FEATHERBOOT). Or drag it in a file manager window
.uf2 is a special format that's read by the UF2 bootloader
yw!
Code works on a friend's CPX too. So I really have no clue why it's not working on my second one.
@idle owl If you want another test, I'll be happy to give it a try tomorrow - I have to head out soon. Let me know.
@solar whale Yeah ping me when you're around tomorrow, another test would be great. I am at a total loss. I'll want to know when you purchased yours along with whether the code works.
OK - I assume you are using 2.x on it - I'll update mine and check on the purchase dates.
Yeah it's running 2.1.0. I just installed it, but I'm going to do a flash erase first and try again, just to see.
I'll be using lasted 2_x branch, but it will be usefule to know if that matters! I can revert to 2.1.0 if necessary.
Flash erase did not resolve it for me.
Oh, I hadn't thought to build a newer version.
Yeah don't revert it yet, I'd like to know if it works on yours first.
OK - nice to have it updated to latest build and bundle! I'll check with you tomorrow.
Thanks much!
hour 12 of messing with ASF4: I can blink an led but I can't do simple pwm ๐ญ
That's pretty quick progress! (I'm serious.)
ASF4 has been a beast to deal with it seems.
I've tried at least 6 different atmel provided examples and none of them work except for the blinkies.
Oi
I've heard at least one person on avrfreaks saying that the factory examples don't work out of the box but I'm having trouble finding any other examples. I'm about ready to search the CP and Arduino code for insights
Though I'm not sure the arduino code uses ASF4.
I don't know either. I don't know Arduino
protip: when you have multiple CP forks make sure you're editing, building, and deploying the same/right one ๐ฆ
Oh yeah........ I know that one. I have 3 plugged in right now and I have messed that up multiple times. Doesn't help that Atom can't handle 2 files of the same name from different boards.
@umbral dagger good call
35 years and that kind of thing still happens now & then.
Doesn't matter how long, this type of thing happens again eventually.
Convert one and add another accelerometer example for circuit python.
Progress: ```import digitalio
import board
import time
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
i = 0
while True:
print("hi there")
led.value = True
time.sleep(0.25)
led.value = False
debugger(when=(i%10 == 0))
i = i + 1
time.sleep(1.0)```
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Type :?<return> for commands
DEBUG> i
10
DEBUG> :c
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Type :?<return> for commands
DEBUG> i
20
DEBUG>
And labelled breakpoints: ```import digitalio
import board
import time
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
i = 0
while True:
print("hi there")
led.value = True
time.sleep(0.25)
led.value = False
debugger(when=(i%10 == 0), msg="Test")
i = i + 1
time.sleep(1.0)```
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
hi there
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Breakpoint: Test
Type :?<return> for commands
DEBUG>
What do you all think about the functionname debugger?
I'm thinking that breakpoint might be better.
I can't read that without thinking of Doug from Up
breakpoint makes more sense to me
Maybe take inspiration from Smalltalk and use halt
Though I lean toward breakpoint
Breakpoint would fit better with Python I think
it seems like a fairly universally understood term
Ya: ```import digitalio
import board
import time
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
i = 0
while True:
print("hi there")
led.value = True
time.sleep(0.25)
led.value = False
breakpoint(when=(i%10 == 0), msg="Test")
i = i + 1
time.sleep(1.0)```
If anyone would like to play around with it: https://github.com/dastels/circuitpython
Note that you can only inspect the global environment for now.
You can also modify the global environment: ```import time
i = 0
def foo(n):
print(n)
breakpoint(when=(n%10 == 0), msg="n mod 10")
while True:
foo(i)
i = i + 1
time.sleep(0.5)
2
3
4
5
6
7
8
9
10
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Breakpoint: n mod 10
Type :?<return> for commands
DEBUG> i=5
DEBUG> :c
6
7
8
9
10
Adafruit CircuitPython Debugger 3.0.0-alpha.0-1170-g9888fc9ca-dirty on 2017-11-11; Metro M4 Express with samd51j19
Breakpoint: n mod 10
Type :?<return> for commands
DEBUG>
Experimenting with my first circuitpython device/code. its a trinket m0 connected to a 1.2" 7 segment with backpack. If I tell it to display.number(nnnn) it displays properly. I have a loop set up that while true, the number increases by one then sleeps for one second. The number on the display then mostly works. However sometimes it increments by 2 instead of by 1. When it does this it takes extra long, almost two seconds.
import time
import busio as io
i2c = io.I2C(board.SCL, board.SDA)
import adafruit_ht16k33.segments
display = adafruit_ht16k33.segments.Seg7x4(i2c)
number = 1000
while True:
display.number(number)
number = number + 1
display.show()
time.sleep(1)```
It sounds like it may be skipping a number?
That is correct. For example it'll display 1, 2, 3 <pause> 5, 6, <pause> 8
Sounds like the show isn't working sometimes.
I'd add a second call to show right after the one you have... see what that does
nope. Went 1,2 pause, 4, 5, 6 pause 8
add a small delay maybe 0.1 between the show calls
same pattern every time?
nope
Recheck all your connections...
seemingly random yet repeating problems can sometimes be a bad/flaky connection
hmm, seems to skip 2/7/10 more frequently than other numbers
correction: if I run it repeatedly with the same code it will skip the identical numbers.
OK, I'd expect a connection problem to be more random
What happens if you sleep for 2 instead of 1 in your code you pasted above?
Strangely enough the same skips
1.57 also results in skipping 2/7/10
What if you make it display 2/7/2/7/2/7?
hmm, sanity check telling it to display a static number...
1212 works. 1210 displays as 1209
1111 displays as 1110
2222 displays as 2221
That smells like a pattern
very much so
@timber lion Any sage words of advice?
Got it
'1212.000012'
DEBUG> "{:f}".format(1210)
'1209.999918'
DEBUG>
It's the formatter in Seg14x4
It's working in floating point and doing it poorly.
That's on the M4.... let me grab a trinket
would casting to int for the values work?
I see the same behaviour on a trinket m0
>>> "{:f}".format(1212)
'1212.000012'
>>> "{:f}".format(1210)
'1209.999918'
rounding....
as part of my troubleshooting I updated to circuitpython 2.1.0
yeah, rounding bug definitely sounds right
Round was broken in some way in 2.1.0. I don't know if the issue was resolved or not.
It was not.
@idle owl I get the same behaviour in 3.0 on an M4
I am still experiencing the issue on 2.1.0 on the trinket m0
@umbral dagger I'm wondering when it was broken on 2.1.0 they took that into the 3.0 master build
On the bright side: ```>>> "{:f}".format(int(1210))
'1209.999918'
"{:d}".format(int(1210))
'1210'
So if you just need to display ints, you can hack the library to format as ints rather than floats.
its going to count days and months until makerfaire. So yes, ints are fine
line 155 of adafruit_ht16k33/segments.py
or better, add an int method at submit a PR
I would love to, but that may have to wait until I reach a real computer.
It'd pretty much be a copy of hex but using {:d} to format.
grr, chromebooks
great for 90% of what I need to do out and about
not so great for that last 10%
is that lib installed as mpy files or py?
if it's py you can just edit on the trinket
mpy
๐ฆ
Well, the problem is solved for you... the solution just has to be implmented ๐
I don't mind building code and making a pull request, I just don't have a suitable IDE on this computer
TYVM for the assistance
You are most welcome.
I figure a countdown clock would be a good first project for circuitpython. Simple rtc and 7 segment interface. Time to do additional research
Sounds about right. My first CP thing was getting a RG led matrix from a dumpster dive working
The local hackerspace gets crazy in the three weeks leading up to makerfaire. This is to encourage people to start sooner
good idea
@marsh harbor Be sure to bring to to Show&Tell once it's done.
raises an eyebrow
The one at my local hackerspace, @umbral dagger or is there another that I don't know about
The Adafruit Show and Tell every Wednesday! ๐
adds it to the calendar
?showtimes
3D Hangouts - 11am ET Wednesdays
Show & Tell (YT only) - 7:30pm ET Wednesdays
Ask an Engineer - 8pm ET Wednesdays
Desk of Ladyada - Random hacker times
John Park's Workshop - 4pm EST Thursdays
Desk of Tony D - Evenings PST Fridays
@pastel panther Arduino, even our SAMD51 version, does not use ASF4.
that's what I was thinking
And there is no PWM support in CP 3.0 yet right? I see the ASF4 libs but I didn't see anything using them yet
That would be in pulseio?
I've tried to enable pulseio on CP 3.0, but had compilaton errors in common-hal/pulseio/PWMOut.h. It seems that it's not fully migrated to ASF4.
Yea, there is an outstanding issue to add pulseio support for the 3.0 milestone
@pastel panther @sacred blade right, enabling code that is not ported will just try to compile the older ASF3-based code.
@tulip sleet I don't suppose you would know why I can't get any of the SMART generated ASF4 PWM code to work? As far as I can tell eveything is fine but there is no sign of life
can you get a blinky to work? SMART has bugs, and has to be carefully configured (the default clock setup is very slow, for instance)
Yea blinky works but nothing any more complicated. I'm thinking that it works because it doesn't involve the pin mux but that's just a theory
Yea I managed to get the clock up to 48mhz by running the 32khz through the DFLL
we don't use the generated pinmux stuff ourselves because we have to configure all that dynamically
well, we change the initial config values when we assign pins
Makes sense
@tulip sleet based on your earlier comment, the pulseio in master won't work because it's relying on ASF3 code that isn't there anymore? like tc_init and tcc_get_config_defaults?
right - the API is completely different. The non-working code is from 2.x, and is commented out in the Makefile
So for I2C I took the ASF3 and changed all the calls (and had to do more than that, since it's not 1-to-1 in terms of how the API works)
right
Who wrote this example code? https://circuitpython.readthedocs.io/en/2.x/shared-bindings/gamepad/GamePad.html
Could be written a little better for newer people
Hi guys :), im using a feather m0 express and a joy bonnet feather - got the HID example working with it but everytime i press a button it repeats the same character eg. AAAA vs. A ..
The joystick also doesnt work as smoothly, is it because im using a keyboard layout? (using key left/right/up/down vs an HID joystick with analog support?)
@tawny creek Any example code?
@vague monolith I believe the GamePad stuff was written by @stuck elbow
If you have suggestions for an improvement by all means submit a PR
Was there a specific improvement you'd like to see?
When I get some time, I'll create one.
@pastel panther I would avoid use the operators and comparisons. Just to make it more easily readable.
One thing to note is that the docs on readthedocs are more of a developer reference than a guide for beginners. It shouldn't be intentionally hard to understand but it needs to be verbose enough to give experienced developers the info they want
@pastel panther @marsh harbor yeah rounding isn't perfect with the 30 bit floats in micropython, see: https://github.com/micropython/micropython/issues/2616 in general you might want to use ints and convert to strings then display on the 7seg display. that gives you total control over how to convert the value. also if you're building a clock like that increments every second you probably don't want to sleep for exactly 1 second since there's overhead for stuff like garbage collection, etc. and why you see delays sometimes. better to delay for 0.5 seconds and have it display time.monotonic() % 60 or something similar
pull requests for better docs are always appreciated ๐
@vague monolith The docs you pointed out are generated from this file: https://github.com/adafruit/circuitpython/blob/master/shared-bindings/gamepad/GamePad.c
@pastel panther Yes, I was just reading through that.
does ampy work with circuit python?
@opaque patrol Yes, in fact I think it's needed on the ESP8266 boards.
@opaque patrol I haven't loaded anything on the ESP8266 I have, so I don't know the process, but I'm fairly certain that it's needed to load files after loading CircuitPython onto the board.
Are you having issues with it or wondering if it would work?
@idle owl Okay, I finally got a circuit playground express and am playing around with it seeing what all I can do with circuit python
Nice! I have never tried ampy on mine. I assume if it works on the ESP boards, it'll work on the Express boards.
That was the first board I worked with. ๐
That's definitely the easiest way to do it, and a deliberate part of the design. Ease of use. ๐ But there's always more that can be done.
That's why code.txt will work as well, lowers the barrier for entry for those who have never worked with a code editor of any kind.
@opaque patrol have you tried the REPL yet?
yes, I used putty so I can see the output
the only thing that was different for me was that it shows up as USB Serial Device in the device manager (Windows 10)
I submitted a pull request for one converted example and added a new one in the process. Glad to do more if you would like.
Did you try CRL+C ing the running script after you've attached to the serial port with putty?
yes, the only irritation was that if the code.py had an infinite loop, it is impossible to get the repl
It shouldn't be.
What version of CircuitPython are you running?
2.1.0
Hmm.
Even with an infinite loop, it should pause and show you this: Press any key to enter the REPL. Use CTRL-D to reload.
Maybe I don't have the steps right, because I just tried it and it worked correctly...
The REPL is super useful for prototyping stuff
I got it to reproduce again, looks like it might have to do with updating neopixels when I hit CTRL-C
Hmm. I still don't think it should do that. But I'm never sure when something happening is me, by design, or worth filing an issue.
I'd err on the side of filing as long as you've made an effort to rule out the derp factor
I figured it out, if I hit CTRL-D while the code.py is running and then hit CTRL-C it goes right back into running the code
there is some funny stuff with the float addition also
inc = 0.0
for i in range(10):
... inc += 0.1
... print (inc)
...
...
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.799999
0.899999
0.999999
@vague monolith using this tutorial https://learn.adafruit.com/adafruit-gemma-m0/circuitpython-hid-keyboard
@tawny creek So each time through the loop the key gets sent again. So if the button is held longer than the loop time, you'll get those repeating characters.
@opaque patrol if you look back for @timber lion 's last post he mentions that there is a bug with floats
yeah, I saw that
@tawny creek You'd probably want to just monitor the release of the button and then send a key when that /event/ occurs.
@vague monolith yep, but i'd still have to 'quickly release' a key
not sure how this works though
@tawny creek So you want it to only send one button press each time it's pushed?
yeah same as a usb joystick
yeah @opaque patrol actually that code you show isn't really a bug with floats but how they work, computers can't actually represent all numbers, like 1/3 is impossible to store (it goes forever). what you're seeing is normal error for floating point representation and it amplifies over time with addition like you have. check out the links mentioned here: https://stackoverflow.com/questions/7690507/why-are-there-mistakes-in-calculations-of-floats-and-doubles some really good background on how numbers are stored and the errors you might encounter
in general when you deal with floats you never expect equality
like 0.1 == 0.1
you always compare with a 'fudge factor' to account for the error
(0.1 - 0.1) <= 0.001 etc.
@tawny creek what if you check if the button is pushed and if it is you send the keycode. Then you need to check if it's still pushed and do nothing or check other inputs.
@vague monolith thanks! going to look at this example and see if this works: https://learn.adafruit.com/mini-pinball-table-with-gemma-m0/code-the-gemma-m0-with-circuitpython
@vague monolith @tawny creek You might want to have a simple state machine that tracks the current and previous state of the button. so when the previous state was low and now it's high, you know they just pressed the button. the vice versa for letting the button go
@pastel panther would like to see some examples if there are any
something like ```
prev_butt = low
curr_butt = high
while(True):
curr_butt = getButt()
if (curr_butt == high && prev_butt == low):
send_key()
else if (curr_butt == low && prev_butt = high):
butt_released()
prev_butt = curr_butt
still unsure about how the 2-axis joystick on the joy featherwing can be mapped as a joystick too -- instead of mapping it to up/bottom/left etc..
That's not real code
yeah ty pseudo code ๐
just a psudocode description
You might have to reverse the logic depending on if your button is low or high when pressed
It might be easier to figure out the logic of when to do stuff separate from what you're going to do
yeah, going to look into bridging those pins on the featherwing and see how those affect it's behaviour
I would hold off on using interrupts until you've figured out your general logic
having ISRs interact with your main loop is nontrivial
as for getting the joystick to act like a usb joystick, I think there is a separate USB HID setup for joysticks that I don't know if CP supports
Wasn't there a hid for mouse?
yea, I was just looking at that
I think it's different than how a joystick would show up but you might be able to use it for the same effect, depending on what you want to control and what it accepts
@tawny creek you can search for 'mouse' on this page:https://github.com/adafruit/Adafruit_CircuitPython_HID/blob/master/README.rst
gotta bounce. ttyl folks ๐
using it for gaming emulation so not sure how it would work
gnight @pastel panther ty again ๐
So I was testing out the code from this https://github.com/adafruit/circuitpython/issues/156 and I'm not getting any sound resembling what it should be picking up. For the part where it's printing out what's in the buffer from record, it just shows zeroes. Can anybody help me out here?
I have been working with that code, so I might be able to. What board are you using?
Awesome! Circuit Playground Express
Nice! Ok, the first thing I did was take a lot out of the code to try to get it down to what I thought would work. Are you using exactly what Scott had in his test code in the issue post?
Yup, I messed around with it a bit, but now I've reverted back to whats in the post
Alright. I'm going to post what I have. I'm pretty sure I didn't delete anything, I think I left everything in and commented it out instead.
So, the thing I did to make sure it was working was tap the board with my fingernail while it was recording, and I get a series of taps back.
I've tried talking to it and it doesn't really seem to play back anything audible.
Or understandable anyway. But the taps are obvious when it plays back.
hmmm, I'm not even getting the taps. It just makes a click sound like some switch is turning on then off
Hmm.
What version of CircuitPython are you running?
I don't think it should matter, but it's worth checking
The one from the Adafruit tutorial so I think it's 2.1.0
I have two boards that seem to act differently than each other (they were purchased quite a while apart) and this code works on both of them (not all code does, heh).
Blergh ok
Was worth a try, heh
Let's see.
Ok I want you to try something else for me.
alright, I'm down
This is a sound meter. Load it, tap the board on the table or yell at it and the pixels should light up starting at the top and going around based on sound level.
For the record though, this is the code that doesn't work on the other board for no apparent reason. It works on a friend's CPX, so hopefully it works on yours.
Oh. And if you open the REPL, it should give you a length mismatch every so often
In the live serial connection printout
That's a bug. But it does show if the code is running successfully.
What I'm hoping is that this will determine if maybe the sound sensor isn't working right. Maybe anyway
Hmm, I'm not getting anything from the LEDs
The problem is, I get no lights on my second board, so it doesn't necessarily mean the sensor isn't working. Grr.
However, the recording code works on my second board.
When did you get your CPX?
Like a month or so ago
I tried printing out the first value in the sound buffer and its always zero
which it shouldn't be because my friend is blasting the Eagles right now
lol, nice. Ok, I'm thinking it might be worth posting to the forums. It could be an actual defect. They've also got dedicated support people who might have another way to test it. And either way if it's a problem with the sensor, they're the ones who can decide what to do. Post everything that you tried and let them know how it went.
Other than those two pieces of code, I haven't done any more with the sound sensor. So I don't have any more ideas to offer. That it was printing out all zeros seems a likely culprit though.
Thanks for all the HELP! I will take right to the forums. I've been getting those zeroes for a couple of days but thought I'd see if I was just crazy
I know the feeling! I'm glad I could help! Sorry we didn't have a better outcome. But at least you know it what it might be now.
For this project I can use my computer as a backup so this is a bummer but not the end. We just won't be able to make it a stand alone thing until I get the parts that work :/
It's good you've got a backup. But hopefully things get sorted quickly!
@idle owl I downloaded the second file you posted last night and ran it on two CPX boards. Both seem to be responsive - on one the "baseline" is 1 red pixel, pixel 2 blinking bule/red. On the other, the baseline is all pixesl off but if I blow on them then both respond simlarly. It's a little hard to figure out what they are sensitive too. Blowing on them gives the best response. Claps and whistles have some response, but it it varies. is that the expected behavior? I have not seen any messages inthe REPL for either. I'll post the purchase dates in a minute
@idle owl one purchase 5/19/2017, the other 6/2/2017 - you can see some different markings - not sure which one came in which order. Not eh one on the righ appears to be a bit more "sensitive" that is it stars off with the first 2 pixels illuminated.
@idle owl all tests run on latest build 2.x build and newly built 2.0 Bundle ```Adafruit CircuitPython 2.1.0-13-gd183b66 on 2017-11-11; Adafruit CircuitPlayground Express with samd21g18
@Andon-A are you still working on this issue?
@glad hazel I have reproduced your problem. One CPX has a working microphone, the other returns all zeros. Simple test program:
import board
import time
frequency_hz = 8000
mic = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA, frequency=frequency_hz)
while True:
# Sample audio for a bit.
volume_sample = bytearray(160)
mic.record(volume_sample, len(volume_sample))
print(volume_sample)
time.sleep(1)
I'll make inquiries
@mrmcwethy Yes, I just haven't had a lot of spare time to actually build it and put it on the adalogger to make sure I didn't screw up.
does anyone know how to compile the uf2 bootloader using unix ?
@marble hornet assuming you have cloned https://github.com/adafruit/uf2-samd21 then to build the bootloader enter
make BOARD=metro_m4 or whatever board you want - see the boards subdirectory for the available boards.
the result will be in the build subdirectory in a folder with the board name
@solar whale thank you so much, I will give it a shot! will it make a diference if i downloaded the repo as opposed to cloning it?
@marble hornet yes - clone it then cd uf2-samd21 git submodule update --init --recursive before building
@solar whale ill try that. thanks so much for the help!! if i have more questions do you mind if i ask?
sure go ahead
@tulip sleet Thanks for the simple test code. My CPX is pumping out all zeros, do you think this means the mic is defective?
@marble hornet I just tried a simple download of the repo and it fails to find necessary tools. clone and update as above.
@solar whale I am atempting to clone repo now, never done this before.
git clone https://github.com/adafruit/uf2-samd21.git just click on the clone or download button then copy the clone url and add git clone before it.
it will create uf2-samd21 folder - cd into it then do the update
@solar whale have cloned and updated it and then navigated back to it, however just like when trying to build it with the downloaded version it isn't finidng the arm-none-eabi-gcc tool chain when "make BOARD=metro_m4" was entered. I have tried to install this before with out results. any suggestions? should it have already been downloaded?
@marble hornet ah - yes - you will need that installed. just a sec - I'll find the guide for that.
@glad hazel I don't know what's up. I have two CPX's I just picked off my desk. One works, the other gives all zeros like yours. The markings on the back are different, and the tiny codes on the microphone are different (though that may just be a date code). I'm inquiring about what might be the problem.
@tulip sleet can @marble hornet jsust use sudo apt-get install gdb-arm-none-eabi or is it necessary to get a later version ?
@tulip sleet tried you mic code on my two CPX's bytearray(b'\x80\x7f\x80\x80\x7f\x7f\x80\x80\x80\x7f\x7f\x80\x80\x7f\x7f\x7f\x80\x80\x80\x7f\x80\x7f\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7f\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7f\x80\x80\x7f\x80\x7f\x80\x7f\x7f\x80\x7f\x7f\x80\x80\x80\x80\x80\x80\x7f\x80\x80\x7f\x80\x7f\x80\x80\x80\x80\x7f\x80\x7f\x80\x80\x7f\x80\x80\x80\x80\x80\x80\x7f\x80\x80\x80\x80\x80\x80\x7f\x7f\x7f\x80\x80\x80\x80\x80\x80\x80\x80\x7f\x7f\x7f\x7f\x7f\x80\x80\x7f\x80\x80\x80\x7f\x80~}}~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~') ```bytearray(b'~~}}}||||{{{{zzzyyyyyyyxxxxwwwwwwwwwvvvvvvvuvvuuuuuuuuuuuttutttttttttttttttttttttttttttttstttttsttttsttsststttttsttttttttttttttttttttttttttttttttttttttttttttutt')
Use a ppa:
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt update
sudo apt install gcc-arm-embedded python build-essential
git clone https://github.com/adafruit/circuitpython.git
cd circuitpython/
git submodule update --init --recursive
cd ports/atmel-samd/
make clean BOARD=metro_m4_express ; make BOARD=metro_m4_express # or whichever you want
that will keep you up to date with the latest
should i cone it to .git?
@solar whale re mic's there may be diffs in sensitivity, but I have two CPX's where one mic is returning all zeros.
@marble hornet the install of the arm-non-eabi tool chain will do just that -- nothin to clone. then try building the uf2 again
@tulip sleet @solar whale thanks!! ill try that now
@tulip sleet interesting - I posted a few notes to @idle owl earlier today regarding some tests I ran on my boards and include pictures of the back sides. Some differences in marking and exposed test points. Clearly one of mine has a more sensitive mic, but both function.
I wa also using latest 2.x build
im trying the sudo add-apt.... and im getting an error saying: command not found
sudo apt-get install software-properties-common try that but I think it may be included elsewhere as well
that should install add-apt-repository
@marble hornet may I ask what board you are working with and are you trying t get Circuit Python loaded on it? Just curious what your are trying to do.
apt-get is cusing a not found error. @solar whale I am trying this for two reasons. One to learn and explore (becasue I find it fun and informative) and additionally I want to make my own curcuit python/ samd21 board becasue of form factor and for the challenge of it. at first im just going to load it onto a arduino zero/ feather m0 as a proof of concept.
@marble hornet great! good luck with it. What linux distro are you using ?
@marble hornet what version of ubuntu or debian are you using?
im using a macbook running osx 10.11.6 (15G31)
might that be the problem?
i have rpi zero that i could use, if that works
oh yeah, you need to use brew, cask kind of stuff. I'm not that familiar with what to do
@marble hornet I think you will find it best to install "homebrew" on your mac
you coudl use the rpi but it would be slow - you could also install an ubuntu vm on your mac if you have enough memory ^^ what jerry said
installing...
install complete, ill try running: sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
@marble hornet another otion is to install an Ubuntu Virtual machine via Vagrant https://github.com/adafruit/atmel-samd-micropython-vagrant
@solar whale if unable to get homebrew to work ill try that
I have used both but eventaully moved to a linux box.
@solar whale what os are you running ?
on linus I use Ubuntu 16.04 - On MAc - just upgraded to High Sierra 10.13.1
@marble hornet the apt-add-repository is just for debian-based linux systems (e.g, Ubuntu). The ppa is for Debian/Ubuntu - there'd be something else for homebrew
are you running ubuntu in a boc on osx? if so does it take up alot of storage?
@marble hornet this may be helpful: https://github.com/ARMmbed/homebrew-formulae
I have used the VM on my MAc, but I don't use it any more - I have linux running on a separte machine now - the Vagran Virtual Machine on Mac OS takes up about 3 GBbytes - you also have to install Virtual Box and Vagrant.
I set up brew ahwile ago and have not used it much - that is why I am having trouble recalling all the steps - Thanks @tulip sleet
brew should work well once you get it set up.
I do recall getting a bit confused with which version of python I was getting! expecially when using python3
Thank you so mcuh @solar whale and @tulip sleet i can't express how helpful this is ๐ the ar-gcc-none-eabi in installing now
will the metro_m4 build a samd21 compatible circuit python ? or a samd51?
m4 is samd51 -- the m0 is samd21
each of the m0 builds is a bit different - there are variants of the samd21 chip and variant of what else is on the boads (e.g. spi flash)
In CircuitPython the the 2.x branch is the stable release for the M0 boards. 3.0 is stil "beta" and does support the M4 - but not all modules have been implemented yet.
iels ? is this a flashable file. using a edbg or jlink? it looks to me like the file is a .uf2 file
it was a typo - my fingers are much faster than my brain ๐
the m0 "express" boards have a 2Mbyte SPI flash installed.
oh else so if i: make BOARD=metro_m0_express
you may want to browse the Adafruit site to see the different M0 boards https://www.adafruit.com/?q=m0
at this point you are only building the bootloader, not Circuitpython - that BOARD refers to https://learn.adafruit.com/adafruit-metro-m0-express-designed-for-circuitpython
@marble hornet the builds will build a .elf, a .bin, and a .uf2
and it is just BOARD=metro_m0
if/when you build circuitpython ---- BOARD=metro_m0_express --- just to keep it interesting ๐
@marble hornet oops, I am talking about circuitpython, and you are talking about the uf2 bootloader. the uf2 builds a bootloader.bin and also an update-bootloader.uf2, which will run and replace the bootloader. And there's an arduino .ino that gets built that you can load via arduino to update the bootlaoder
THANK YOU SO MUCH @tulip sleet and @solar whale i think im going to building the uf2 file from microsoft and drag the curcuit python.uf2 file onto that, if it works. in addition to build the Makefile w/ BOARD=metro_m0 . now i just need to figure out how to locate the files. MUCH THANKS!!!!!!!
@marble hornet I'm not quite sure I follow your plan, but since you are building your own board, perhaps none of the versions in uf2-samd21 are quite right for you - what is there should build fine as is. Good luck!
if i understand uf2 correctly it is a bootloader that 'runs' a file. i believe that the circuit python boards run a circuit python file. i am using a samd21 with the same storage and mem of the feather m0 ust w/out the flash chip so we'll see
FYI - The trinket or gemma builds do not have flash chips nor do all the feather_m0 boards
okay, ill try those, i might just add a flash chip later down the line (it seems to be the best option(obvi since thats what lady ada and co did))
last questiuon, do you know what this means?
error 1?
hmmm - no - but the zero is usually the default board build if none specified.
what command resulted in that error?
Oh - I see - somthing is trying to run node
im building using the mirosoft repo i told it to make BOARD=zero
ill google node
could i flash the .bin file as is ?
I have not had any experience with the MS repo - just eh Adafruit one and I don't think node is used for it - still checking.
@marble hornet waht repo are you using
i have both the adafruit and microsoft. so far i have built microsoft zero, trinket, and generic
What is the link to the mocrosoft repo? Are you getting that error for all of them?
Ok - sorry - I got confused. When I run make BOARD=metro_m0 , the make file stops after building the bin/elf/uf2 files and does not try the "node" stuff.
not sure what all that is for ....
me neither, as long as i have a burnable file and node doesn't kill my compy. in fine with it (for now)
thank you so much @solar whale
Compare the Makefiles - - the Adafruit version uses python for the final step - the MS version uses node
okay, maybe the adafruit file has the circuit python "prog" already on/in it
but still not sure what actually gets run with the make -- need to dig into the Makefiles. tha final step I see is where it builds the .uf2 and node is not needed for that.
ah - the MS version also uses node for that step!
node is used to run javascript and is a hugely complex beast in my opinion!
MS version $(SELF_EXECUTABLE): $(SELF_OBJECTS) $(CC) -L$(BUILD_PATH) $(LDFLAGS) \ -T./scripts/samd21j18a_self.ld \ -Wl,-Map,$(BUILD_PATH)/update-$(NAME).map -o $(BUILD_PATH)/update-$(NAME).elf $(SELF_OBJECTS) arm-none-eabi-objcopy -O binary $(BUILD_PATH)/update-$(NAME).elf $(BUILD_PATH)/update-$(NAME).bin node scripts/bin2uf2.js $(BUILD_PATH)/update-$(NAME).bin $@ adafruit version```$(SELF_EXECUTABLE): $(SELF_OBJECTS)
$(CC) -L$(BUILD_PATH) $(LDFLAGS)
-T$(SELF_LINKER_SCRIPT)
-Wl,-Map,$(BUILD_PATH)/update-$(NAME).map -o $(BUILD_PATH)/update-$(NAME).elf $(SELF_OBJECTS)
arm-none-eabi-objcopy -O binary $(BUILD_PATH)/update-$(NAME).elf $(BUILD_PATH)/update-$(NAME).bin
python lib/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $(BUILD_PATH)/update-$(NAME).bin
@solar whale how do you do the code in a box ? so im trying to build the adafruit trinket board but it is saying :
hmm - I get the same - looks like an issue with the repo - do you want to report it as an issue or would you like me to?
hmmm - same for gemma_m0 and feather_m0
im not sure, who should it be reported to?
I already reported this as an issue. The code was patched to support the m4 but was not finished. https://github.com/adafruit/uf2-samd21/issues/1
Right now only metro_m0 and metro_m4 have board.mk. The other builds are broken.
@tulip sleet thanks!
@tulip sleet thanks
it was a while ago - i'll discuss with Scott when he returns
could we modify the microsoft one with '''$(SELF_EXECUTABLE): $(SELF_OBJECTS)
$(CC) -L$(BUILD_PATH) $(LDFLAGS)
-T$(SELF_LINKER_SCRIPT)
-Wl,-Map,$(BUILD_PATH)/update-$(NAME).map -o $(BUILD_PATH)/update-$(NAME).elf $(SELF_OBJECTS)
arm-none-eabi-objcopy -O binary $(BUILD_PATH)/update-$(NAME).elf $(BUILD_PATH)/update-$(NAME).bin
python lib/uf2/utils/uf2conv.py -b $(BOOTLOADER_SIZE) -c -o $@ $(BUILD_PATH)/update-$(NAME).bin'''
how do you do the code in a box thing ????
and then copying the altered makefile from MS to The ADA repo
'''test'''
'test'
FYI - sevaral of the .uf2 prebuild bootladers are available for download at the end of this guide https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/uf2-bootloader-details?view=all#uf2-bootloader-details
to put code in a box use three "backtics" under the ~ -- before and aftter code
should adafruit-circuitpython-feather_m0_basic-2.1.0.bin work on a Feather M0 LoRa?
@bronze geyser It should run CP fine, but it wont support the radio - It will act like an M0_basic
in no expert but it should. the only difference between teh feather m0 and feather m0 LORA is that the lora module is connected. so yes
@solar whale Thanks. Yah about the radio. I'll figure out how to get it working with CP...after all...how hard can it be ๐ [don't answer that!]
I think memory will probably be an issue though
the update-bootloader.uf2 cant be burned can it, only as an updater right? @solar whale @pastel panther
it needs to be loaded by a uf2 bootloader which itself needs to be loaded by bossac if there isn't one already
or by jlink
@pastel panther thats what @solar whale and @tulip sleet have been graciously helping me with. ive built a bin (microsoft varient)
excellent
Dan or Chris would know better than me
thanks @pastel panther
could one in theory load a library on a gemma or trinket that could use the pins that arent broken out? like the feather express one or metro...
excluding the non delcared/present pins on the atsamd21e
@marble hornet You are venturing well beyond my expertise - glad @pastel panther is on to help. I need to head out for a bit. Good luck!
@solar whale thank you so much, your help has been invaluble
In theory yes, as long as it didn't expect there to be hardware that didn't exist.
Assuming you're talking about CP libraries?
yes
CP libraries aren't processor specific so yes
awesome, i think ill try to make CP board before trying that
Do you have one to test with? So you're not trying to debug your program and the board at the same time?
does anyone have a pre error copy of the uf2-samd21 repo?
No but you can checkout a prior commit
im jsut trying to make the board run circuit python, the aplication specifics will come later.
I would start with a known good board like a feather m0 express and modify from there
yes
@solar whale going out but see the forum post re the microphone for a fix
@solar whale might try higher freq and see if sensitivity improves
bbiab
bbiab?
could on use this to burn one of the bin files? https://learn.adafruit.com/programming-an-m0-using-an-arduino/overview
for a custom built board
or reburn a bricked feather ?
@marble hornet Are you still trying to compile on your Mac?
yes @opaque patrol
@marble hornet What directory are you running the make command from? The source ( circuitpython ) or somewhere else?
@marble hornet just a second, I haven't tried to build this one yet
@opaque patrol what have you built any pre-built or prior commits lying around ?
@marble hornet For a particular board or just the samd21 chip in general?
@marble hornet I was able to build 'something' by changing the Makefile to use node scripts/bin2uf2.js instead of python lib/uf2/utils/uf2conv.py
I don't see that file and don't know if it is supposed to be generated, I got an 'update-bootloader.uf2' file but don't know if that will work
@tulip sleet @solar whale Changing the frequency to 16k did not resolve the issue on my second CPX board. I looked at the forum responses as well.
Just about to try
@solar whale Oh ok. My two boards have different markings, silkscreen, IR transmitter, mic sensor. I know you were noticing differences in yours. Ladyada confirmed the different IR transmitter, but I hadn't tried anything with the mic so I had no reason other than they look different to know that they're different sensors.
But that could just be a manufacturing difference, and could still be the same product, so I don't know.
on the less sensitve board 8K s/s ```bytearray(b'\x80\x80\x7f\x80\x7f\x7f\x80\x80\x7f\x80\x80\x7f\x80\x80\x80\x80\x80\x7f\x7f\x80\x80\x80\x80\x7f\x7f\x7f\x80\x80\x80\x7f\x80\x80\x7f\x80\x80\x80\x80\x80\x7f\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x7f\x7f\x80\x80\x80\x80\x80\x80\x80\x7f\x80\x80\x80\x80\x80\x7f\x7f\x80\x80\x7f\x80\x7f\x7f\x80\x7f\x7f\x7f\x7f\x7f\x80\x80\x80\x80\x7f\x80\x80\x80\x7f\x80\x80\x80\x80\x7f\x80\x7f\x7f\x80\x80\x7f\x80\x80\x80\x80\x80\x80\x7f\x80\x80\x80\x80\x7f\x80\x80\x80\x80\x80}~}~}}}~')\x7f
16K ```bytearray(b'\x80\x80\x80\x7f\x80\x80\x7f\x7f\x7f\x7f\x80\x80~~~~~\x7f~\x7f\x7f\x7f\x80\x80\x7f\x7f\x80\x80\x80\x80\x80\x80\x80\x81\x81\x81\x81\x81\x82\x81\x81\x82\x82\x82\x82\x82\x82\x82\x82\x83\x83\x83\x83\x83\x83\x83\x83\x83\x84\x83\x83\x84\x84\x84\x84\x84\x84\x84\x84\x84\x84\x85\x84\x84\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x85\x86\x86\x85\x85\x86\x86\x85\x85\x86\x85\x86\x86\x86\x86\x86\x86\x86\x86\x86\x86\x86\x86\x87\x87\x86\x86\x86\x86\x86\x87\x86\x87\x87\x87\x87\x86\x86\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x87\x88\x87\x87\x87\x87\x87\x87\x87\x87\x88')
I didn't try Dan's test code. I didn't bother because the mic recording code I have works on the board that's not playing nice.
I can give it a try though.
That's why I'm so perplexed here is that other code using the sound sensor works fine, even with 8000 frequency.
So I don't think my issue is a mic sensitivity issue.
32k ```bytearray(b'\xa9\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xab\xaa\xab\xaa\xab\xab\xaa\xaa\xab\xab\xab\xab\xab\xab\xab\xab\xab\xab\xac\xab\xac\xab\xac\xab\xac\xab\xab\xac\xab\xab\xac\xab\xac\xac\xab\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xac\xad\xac\xac\xac\xac\xac\xac\xac\xad\xac\xad\xac\xad\xac\xac\xad\xac\xad\xad\xac\xad\xad\xad\xad\xad\xac\xad\xad\xad\xad\xac\xad\xad\xad\xad\xad\xad\xac\xad\xac\xac\xad\xad\xad\xad\xad\xad\xad\xad\xac\xad\xad\xad\xad\xad\xac\xad\xad\xad\xad\xad\xad\xac\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xad\xac\xac\xad\xad\xad\xad\xad\xac\xac\xad\xad\xac\xac\xad\xad\xac')
and I have never seen your error messages.
Seriously?
nope - running for hours
You never got this: length mismatch 64 160 length mismatch 32 160 length mismatch 0 160 length mismatch 0 160 length mismatch 128 160 length mismatch 128 160 length mismatch 0 160
no
Ok now I'm really confused.
Even Tony D's code that I pulled this from originally was giving that error and I get it consistently from both of my boards.
Wait...
You have a newer version of CircuitPython installed?
likel;y - built yesterday from 2.x branch
Ok. I'm fairly sure that's why. I think the bit that throws the error might have changed. I need to make a new build. I haven't ever built 2.x
That's good though. Because there was no way around that error.
just do git checkout 2.x then git submodule update --init --recursive
it wil be in atmel_samd not int ports/atmel_samd - you may want to clone a new repo for this
it can get confusing going between branches since thaty file layout is different - I have a circuitpython_master clone and a circuitpython_2x clone
when you clone you can appen a ne subdir name and it will create the clone there
git clone https://github.com/adafruit/circuitpython.git circuitpyhton_2x for example
you also need to remake mpy_cross for 2.x since it is not compatible with 3.0
nothin is easy ๐
I'm definitely going to clone a new repo. I've been building all the M4 stuff so at least I have done that process a few times. What's the exact link for the 2x build? Is it the one from your second git clone example? The 3.0 stuff is easier because it's just the most recent set of it.
same link - just do git checkout 2.x after cloning - it defaults to master
Literally "2.x"?
yup!
Hah! Ok.. Thank you! ๐
I thought my mpycross was for 2.1.0 - the one I have built into my system. I'm not sure I ever built it for 3.0
Wait, what's the make command?
I mean for the firmware
or at top dir make -C mpy-croaa
because it's not the same as we've been doing for the M4 and that's the only one I know
make BOARD=circuitpython_express clean
make BOARD=circuitpython_express
the only diff is that from the top dir it is in atmel_samd not ports/atmel_samd
Ok
but if you cloned a new repo you should redo mpy-cross since master uses 3.0
Do you mean circuitplayground_express?
yes ๐
Ok good! No, it's totally fine, the first one didn't work. I'd rather that be the issue than finding out it's something weird on my end
do what I mean, not what I type ๐
Ohhhhhhh I have to do mpy-cross first, I get it now.
brb
@tulip sleet increasing the frequncy increases the values of the samples. I need to look further to find out what that means. But none of mine are starting at zero....
@tulip sleet @idle owl setting frequency to 32000 on my "less sensitive" board in Kattni's code does make it respond like the other board set to 8000..
@marble hornet sorry bbiab means Be Back In A Bit. What you showed would probably work for flashing a bare chip but it's more automated than you would need for development. You should get one of these:
https://www.adafruit.com/product/3571
In addition to loading binaries it will allow you to debug your programs which can be useful if a bit complicated
Are there any examples or libraries for the IR tx/rx on circuit playground express?
@opaque patrol There's a basic library that allowed it to read incoming remote signals and print the results out, but it's not specific to CPX, it's a CircuitPython library.
Alternatively you can communicate between two CPXs over IR using MakeCode, if you are looking to try it.
I think the IR stuff is relatively new for CircuitPython. It's on my list to put into the CPX API, but I haven't gotten to it yet.
(@idle owl is our resident CPX guru)
@solar whale I put the new firmware on my second board, the code still doesn't work right. And after waiting a bit, I'm still getting langth mismatch. Did I make the firmware correctly? Adafruit CircuitPython 2.1.0-13-gd183b66e5
I have the same build number
same here ```Adafruit CircuitPython 2.1.0-13-gd183b66 on 2017-11-11; Adafruit CircuitPlayground Express with samd21g18
Ok.
how did you print out your build number
From the REPL
strange, yours is slightly longer than ours, with the e6 at the end
I think I have some local git magic in .bashrc that makes my hash longer.
ah
that was what I was wondering too
I get all 0s from Dan's code.
๐ฆ on a working board ?
Yeah. I have code that records a sample and plays it back through the onboard speaker, and while it can't pick up anything intelligible from voice, if I tap the board with my fingernail during the recording period, it plays back the taps. So the mic works. The LEDs work. I can even get the LEDs to work by adding a pixels.fill((0, 30, 0)) into the soundmeter code.
does your demo proram - with the meter work on this board?
No. This is the one it doesn't work on.
OK so you and DAn both have boards that return 0's mine both return good values.
Yeah - I thin 0 is too far to help ๐ AS I noted, going to 32000 on my quiet board makes it work like the other one at 8000
with your code
fwiw, mine returned all 0's as well
This would make a lot more sense if it didn't play back anything in my recording code.
@solar whale I had tried changing the frequency in my other code before testing Dan's code. So before I knew it was giving all 0s. Upping the frequency to 16000 on the board I have that my code does work on makes it way too sensitive.
very puzzling
Entirely.
This pull request adds the nrfutil python code to the feather52/tools folder for easy installation. Instructions on properly installing nrfutil have been added to: ports/nrf/boards/feather52/README.md.
The SD download script has also been updated to download the S132 v5.0.0 SoftDevice header files.
Oi. Dropped the serial connection and in the process crashed my editor so hard it looks like I'm going to have to reboot to bring it back up.
Meanwhile the M4 has been running for days. lol.
@idle owl thanks for the meter demo - it's been fun to have it running most of the day - lots of blinking lights. Good luck with the mic.
@solar whale Thanks, I'm glad you like it ๐ Plan is to write it into the API as the sound sensor code, but if it's this inconsistent, we either need to figure out why, or not include it. Thanks for the luck, I evidently need it
We've had to make some changes to it, and it's likely quite static, but if you would prefer this in the /libs folder as a sub-module that's fine for me and I'll respin the PR accordingly, making a new nrfutil repo under the adafruit account.
@stuck elbow the more I think about your debugging context idea, the more I like it.
Heading home now to eat poutine and do more work on the debugger.
I wish poutine was more common here
argh memory allocation failure
@vague monolith What with?
messing with lists in repl
Ah
list generation. Playing with the playground express API and generating a list of tones. I was trying to make a cool siren sound. A loop going up and then down in tones.
From the bundle the adafruit_circuitplayground.express
Ok, I figured I'd check. If you were using the .py version you'd run into memory allocation failures all over the place.
Do you have the rest of the bundle loaded on there too?
Not sure it'll help, but sometimes clearing stuff you don't need off of there can help. And I may be telling you things you already know anyway. ๐
I'll have to troubleshoot more in a bit. It's wierd different size allocation errors etc...
Hmm. Let me know how it goes.
1024 is the maximum length of a list
Closing to resubmit at a later date.
OK by me, or did you have some changes?
I'm actually going to merge some other updates in to the PR, so it's easier to just make a new PR early this week. Thanks for the review, though, and you're right the /libs is the right place for this since it's a 3rd party codebase anyway.
@pastel panther This is the first place I've lived where it is.
@idle owl @solar whale @glad hazel I looked at the datasheet for the mic, which says it should be clocked at 1MHz minimum, as @meager fog mentioned in the forum. I also looked at the PDMin code. The code is doing 64x oversampling, so that's not the raw sampling frequency. But if we set the frequency to 8kHz, the mic is getting clocked at 512kHz (8*64), which is half of the minimum, and the mic is not spec'd at that clock rate. 16k is 1.024Mhz, just above the minimum. You could try 32k or 44.1k or 48kHz, even. When you say the mic is too sensitive, perhaps it's just finally up to spec. @idle owl, I don't know what's up with your bad mic. You might try an even higher freq. Or maybe it really is just broken.
@tulip sleet I have no idea either. I tried it at higher frequencies and it still didn't work with the sound meter code. But like I said, what's really throwing me is that the other code I wrote up, that makes a short recording and plays it back, works. My sound meter code seems to work on everyone else's CPX except for @glad hazel's, but I don't know if they tried changing the frequency in the code yet. I just tried it on my second board with the altered frequencies you suggested and it doesn't seem to make a difference - it still doesn't work.
does my printing code work on the "bad" board?
16k works quite well on the first board, but I had to change the code that determines when it starts to light up the LEDs or it's constantly flashing. Not a problem as it's in there as a variable called input_floor.
All zeros with your code.
could you point to your recording code again? I don't know how far back to look
In the asf4 repo, the master branch is as downloaded, master-bugfixes is clearly bugs, and then circuitpython is branched from that, with enhancements. Maybe that's a little excessive, but having at least "as-downloaded" and "my-changes" branches makes for easy merge updating.
It doesn't have the altered frequency in it though. Since the library defaults to 8000.
Let me try it with the increased frequency and see if it still works.
Or if it errors. Hmm.
Oh I see why.
that's using a much larger buffer (16k), as opposed to the buf I had which was 160.
I know. It's how the sample code worked to have enough space to make a recording.
It works less well with the increased frequency on the "bad" board.
Oh wait. One more thing to change.
Works the same. I had to up the speaker frequency to 16k as well.
The only thing that plays back in a way that's obvious is tapping the board with my fingernail during the recording time.
The mic datasheet says it takes up to 10 milliseconds for the mic to wake up when it's clocked. at 16kHz, that's 160 samples, the size of my buffer. Try increasing my print buffer to 320 or more
It plays back taps.
the taps may be very strong signals
Still zeros with a bigger buffer.
try a buffer of 1000
same
are you yellling at it when you're running?
Did now. Didn't make a difference.
Also tried 1024 since it was giving a length mismatch of 1024 1000. No difference there either except that there's no length mismatch.
frequency=16000? (any misspelling will not be caught, that's a known bug about keyword args)
Frequency 32000. I had it upped from earlier. No misspellings on reading back through it.
16k doesn't do anything else either.
i'll give up for tonight; that's odd but I have 9am dentist appt
Thank you for looking into it at all ๐
sure, i like debugging; @solar whale @idle owl datasheet for mic is here: https://www.digikey.com/product-detail/en/knowles/SPK0415HM4H-B-7/423-1210-1-ND/4376282 I think it's that one; I looked at the Eagle parts list
good night
@idle owl @tulip sleet Thanks so much for the help. I just tried out the sound meter with the higher frequency and it worked. Now I have to figure out how to record more than half a second of audio
I had issues with this as well, not sure what's up but I'll get a new one generated and uploaded.
Here's a file that you can replace with as a temp workaround.
Thank you! The new zip file works for me.
@idle owl your recording code works here on my circuitplayground express.
your recordingcode crashed my cpx to safemode
do I need to get the latest build? I am running 2.1.0
@opaque patrol Works for me on 2.1.0
I worked after I rebooted the circuit playground...I was playing with tones before I tried this so it was most likely something in memory
One of the useful features of the Feather (and it's ilk) is that it can be used as one of many I2C slaves. It would be cool if the i2c drivers covered that case.
Thankyou for all the excellent, and hard work you have put into supporting CP.
@glad hazel That's great!
@vague monolith @opaque patrol Thank you for testing it! Always appreciated.
@tulip sleet how feasible would it be to get CP running in 4k of RAM?
@tulip sleet presuming you removed unused code
not at all, basically (sorry). you need RAM for heap and for stack. each Python stack frame is about 256 bytes. Right now we allocate 12k for stack, and realistically, you need at least 8k when running the compiler
we're miserably tight with 32k of RAM right now
I figured it was a stretch
bbc micro bit has 16k, and they removed a lot of stuff and pull various tricks
@tulip sleet When you're doing ASF4 work like for the busio work you've been doing are you working from START examples, the ASF4 docs or something else? I'm still trying to get basic PWM code going and I'm having trouble even getting an idea of where I'm going wrong. I don't know if it's the clocks, the portmux, the timers or an angry pix strike
the docs are very thin; mostly I read the code: hal, hpl, and hri. I did generate simple I2C and SPI examples with start and then read the code in those. But a lot of the setup is in the *config.h files. are you doing this for '21 or '51?
I had a lot of trouble with the clock setup GUI. I couldn't get the DFLL to not have error indications. Scott generated a comprehensive set of files from START covering all the devices. But then we've been editing the (config.h files by hand to tweak things, rather than going back to START to try to get things right.
And we don't care about the PINMUX stuff because we allocate the pins at runtime.
you might consider using ASF3; it's a lot more mature
I was going to initially but I'd rather put in the time to learn ASF4 if it's what CP is using, and also because ASF3 is more clunky and possibly not supported much anymore. I'm sure I can figure it out eventually. I'll probably use the CP code and the START code as a reference
anyone got a DS18B20 and can see if they can get this to work?
https://github.com/adafruit/Adafruit_CircuitPython_OneWire
(with CP 2.1 and whatever, not an M4 / CP 3.x thing)
@tidal kiln I do have one (I just bought a bunch of different sensors with different protocols for testing 3.0 protocol impls). I can try. Does it not work for you?
no. the real work is to refactor that repo per an issue scott posted.
figured i'd start by testing the existing code
i get an empty return here:
https://github.com/adafruit/Adafruit_CircuitPython_OneWire/blob/master/main.py#L15
I will breadboard it and get back to you
awesome. thanks a mil.
sample output:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Resetting, found anything? True
Found the following 1-Wire devices:
Found the following DS18x20 devices
--------------
Found the following DS18x20 devices
--------------
Found the following DS18x20 devices
--------------
Found the following DS18x20 devices
--------------
Found the following DS18x20 devices
--------------
Traceback (most recent call last):
File "main.py", line 26, in <module>
KeyboardInterrupt:
@tidal kiln works for me; I'm using a Feather M0 so I changed the pin to D5. with the flat side of sensor toward me, left-to-right: ground, signal, VDD (3.3V). 4.7k pullup between signal and VDD.
I'm using Feather M0 Express
๐ฆ same
ooo. got a second sensor. let's try that...
resistor = yellow, violet, red, gold. that checks....
DALLAS 18B20 on silk (so it's not a random transistor i accidentally grabbed)
I am semi-color-blind so I always measure my resistors
(same here, just trying to sound cool)
second sensor works!
both fresh from the bag, forgot i had ordered 2 at same time (glad i did)
thanks for sanity checking
works back on trinket as well
so just a bum sensor, i guess
you're welcome; glad mine is ok, so I know it will work later!
i'd like to do what I do in the Arduino IDE in CircuitPython: attachInterrupt(interruptNumber, isr2, RISING); ...is there an example I can look at?
I don't think so, no. They haven't started into interrupts yet. If I understand what you're asking.
hmm...i figured there was a way based on: http://circuitpython.readthedocs.io/en/2.x/docs/reference/isr_rules.html?highlight=isr i'm not that smart so i wanted to see if i could get jump started with an example...
@bronze geyser You sell yourself short, you're incredibly smart. It is definitely possible. It's that no one has done anything with it yet to have examples.
thanks (as always) @idle owl ... and yes, i am short...just not incredibly short. i took pilates for a long time because i thought i could stretch to get taller. My teacher insisted i could become a circus clown. i declined however because the makeup requirement and bad hair day is just too much...but i diverge.
Well, as a programming exercise I thought I would create the game Simon on the circuit playground express using Circuit Python,
It wasn't until I was done that I thought to look and see if it had been done before,
I would be happy to write an article still, just let me know.
@opaque patrol so did you find another example of it having been done?
looooove using circuitpython in this setup. I can edit and debug the code on the goo
- using a usb keyboard not seen
<@&356864093652516868> Thanks all for being awesome while I was away. We're still on for our meeting here and in the voice channel tomorrow (Tuesday) at 11am PT / 2pm ET.
also would like to say that the LED light on the feather is super useful. It helped me determine the pogo pins on the usb hub on the pi were misbehaving
awesome @tawny creek !
you were asking about gamepad support right? its on my radar for 3.x
yes please ><
could you file an issue for 3.x? I don't think core support would be too hard
im planning to add more buttons and such (see empty stands on right) plus some shoulder buttons and that joy featherwing is really nice ๐
im glad cp has it in the default bundle ๐
๐ thats the goal for all of our boards
sure thing
Hi folks! I'm currently using a feather m0 and a joy featherwing as a HID Keyboard device for a RetroPie build and would love to have HID Gamepad support for 3.0 :)
Would love to help test this as well.
@bronze geyser that documentation is from micropython, circuitppython doesn't have timers and interrupts yet, partially because of the reasons described there, and partially because it's really an advanced feature
@stuck elbow... thanks. Perhaps mention should be taken out of circuitpython Read the docs? http://circuitpython.readthedocs.io/en/2.x/docs/reference/isr_rules.html?highlight=isr ....perhaps i am easily confused. i keep thinking circuit python is absorbs micropython and adds to it. The bummer though is i don't know how i'd do an rfm95 library without ISR support... it is a sad, sad day indeed...
Yup, I realized I missed this but figured it'd get fixed when we start including it again in the build.
I'm going to mark this long term. We'll have to figure out a sane API for it. We're trying to avoid requiring knowledge of concurrency which could make acting as an I2C slave a bit challenging.
I don't think this is an issue. We cannot guarantee timings from Python, especially short ones like this, because the VM is slow and work (like USB) happens between VM steps. This truncation is a combination of both sleep being short and monotonic's millisecond resolution. There is no way its actually taking no time.
Please reopen if there is a reason you need this fine timing.
065a319 Update info about erasing CIRCUITPY to include ... - dhalbert
(@caternuson and I had a chat in #circuitpython about this last week).
We could, though, at least round to the nearest millisecond. The problem is the truncation: 0.001 as a CPy float is slightly less than 0.001 in decimal, and gets truncated to 0 milliseconds. time.sleep(0.001) will not sleep at all; time.sleep(0.001000001) will sleep for 1 millisecond. And time.sleep(0.1) will sleep for 99 milliseconds, when it could more accurately sleep for 100.
The code comes from MicroPyth...
I'm not convinced we can provide millisecond accurate sleeps anyway because
of interrupts and other background work like mass storage. Rounding isn't
important when we can't measure it accurately enough anyways.
We could introduce a precisetime module for more accurate sleeps but I'm
not sure we need it.
On Tue, Nov 14, 2017 at 8:16 AM Dan Halbert notifications@github.com
wrote:
(@caternuson https://github.com/caternuson and I had a chat in
#circuitpython about this last week).
...
From my point of view this isn't an issue due to a need for precise / accurate timing, like for bit banging some protocol. It's more of getting an unexpected behavior due to the truncation. For example, consider this very simple averaging of some sensor reading:
avg = 0
for i in range(20):
avg += sensor.noisy_analog_reading
time.sleep(0.001)
avg /= 20
I'd expect that to average over ~20ms, but instead it will be much less since the time.sleep() is effectively 0...
I don't think time.sleep(0.001) will be effectively 0. Have you tried
measuring it with a saleae and setting a pin? That may be more reliable
than monotonic.
On Tue, Nov 14, 2017 at 8:59 AM Carter Nelson notifications@github.com
wrote:
From my point of view this isn't an issue due to a need for precise /
accurate timing, like for bit banging some protocol. It's more of getting
an unexpected behavior due to the truncation. For example, consider this
very simple averaging of some se...
Tester func:
def toggler(t, n):
t1 = time.monotonic()
for i in range(n):
pin.value = True
time.sleep(t)
pin.value = False
time.sleep(t)
t2 = time.monotonic()
return (t1,t2,t2-t1)
Result from REPL:
>>> toggler(0,20)
(624.991, 625.001, 0.0100098)
```python
Result from saleae:

A few days ago, I was sure that I needed I2C Slave on a trinket M0.
Then I discovered the current state of ASF4, and the on going migration of CP to it, and decided that I could do without...
I was thinking of a very simple API : expose a bytearray as a small memory device thu I2C.
The master could read/write bytes on it, and CP would provide (soft) callbacks to know when something was read or written.
This way, there is no python code when the timing is critical. Simple cases could...
Hi Antonin,
I'm sure that would have been just fine for my needs.
I was trying to overcome three problems:
- limited pins on the main controller board;
- finding off-the-shelf device-specific i2c driver boards that can be
configured to a very large bus address range; - lower cost.
For an app that needs to drive dozens, if not hundreds of simple
asynchronous devices, your solution sounds ideal. There are plenty of
work-arounds for specific cases, but your solution could be...
@caternuson Try it with toggler(0.00101, 20) and I think that will show the difference.
The line mentioned above (https://github.com/adafruit/circuitpython/blob/master/shared-bindings/time/__init__.c#L76) is:
common_hal_time_delay_ms(1000 * seconds);
seconds is a float. If it's slightly less than 0.001 decimal, then the result of the multiplication will be <1. common_hal_time_delay_ms() takes a uint32_t. The implied cast will truncate 0.999... to 0.
>>> toggler(0.00101,20)
(3361.62, 3361.66, 0.0410156)

I created a Simon game for the circuit playground express using Circuit Python....It wasn't until I finished that looked to see if it had been done before and saw a blog post using Adruino code. I would be willing to do a blog post if you want and would like to contribute more. The file is on github...https://github.com/BravoDelta151/CircuitPython_Simon
It seems to really push the memory limit, I tried adding more features, but kept getting memory allocation errors.
We're pushing the memory limits pretty hard. That's not surprising.
@opaque patrol neat. that seems like something worth posting in #adafruitextracredit
and more info: https://blog.adafruit.com/2017/08/01/looking-for-a-fun-way-to-share-your-circuit-playground-projects-check-out-adafruitextracredit-circuitplayground/
@opaque patrol was the arduino version blog post something on adafruit?
@opaque patrol maybe @tidal kiln would like to integrate your code into that guide
@opaque patrol @slender iron yep. circuit python update to that guide is in works. here's my take:
https://github.com/caternuson/CircuitPython-Demos/blob/master/simple_simon.py
i love seeing all the different approaches to implementing this 
how is it echoing if you can't hear me?
thats a good question
oh weirdi can't hear carter either
and wow chat is lagging as i type
let me restart
browser fun
not an app fan, i don't like notifications on desktop
hrm weird well it stil works, just chat is slow ๐
^ that
having trouble with my mic setup
Is anyone allowed in the recorded session?
no. go ahead.
Dan H for helping with toolchain setup so I can build CP and sanity checking DS18B20
(temp sensor)
yes
Hug report to Dan and Kattni for the effort on the CPX microphone. Also to microbuilder for the updates to the nrf52 support for the feather52 board.
awesome !!! More Hardware is always good. ๐
ADS1X15 (ADC) lib is "done" and in bundle. Starting to look at refactoring for OneWireDevice. Also have a TCS34725 (RGB color sensor) on way and will probably do driver for that next.
Nothing to report, on vacation for 2 weeks
@prisma pilot could you mute your mic for now?
post issue for ADS1x15 and i'll fix
nvmd. looks like dan already did.
looks like i need to fix TSL though:
https://github.com/adafruit/Adafruit_CircuitPython_TSL2561/blob/master/adafruit_tsl2561.py#L174
I never saw zeros - just increased sensitivty
@idle owl have you tried playing a .wav file
nevermind - that does not test mic....
yeah, the mic is actually mechanical and could actually break
to physical (mecha or electrical) or logical abuses
i don't think it's all that fragile. But if dirt or water got in the mic hole, it could hurt it.
logical would actually be voltage parameters
@slender iron have a process question. when does a tag assigned to a file version. who asigned the tag?
@slender iron maybe you could share a few photos of your wedding costume(s) on some external channel - facebook?
is this something that breaks after cookiecutter?
but your guide covers what should be done?
check this out: https://learn.adafruit.com/porting-an-arduino-library-to-circuitpython-vl6180x-distance-sensor/template
'.travis.yml - This is a configuration for the Travis-CI build system to automatically generate .mpy files for code stored on Adafruit's GitHub account. Open this file and carefully read the comments to see how to setup Travis CI (specifically setup steps you need to follow on Travis' website to enter your Github access token). Setting up Travis-CI is optional and this file can be ignored if you don't want automatic .mpy generation for Github releases.'
thank you, bye
@hollow tartan I can post some in #general-chat when I see some
hi hi @fading trench here come some LEEKS only for discord adafruit community in #circuitpython-dev
we are sampling made in usa temporary BLINKA tattoos 
sending this over to #general-tech now too
using a feather m0 express with cp: could i interface with the board with a python script even if its also currently running as a hid keyboard?
@tawny creek what do you mean?
if i connected say a temperature sensor to the feather and want to utilise that data on a pi running a python script --
i dont have any gpios available so im trying to figure out a way to utilise the feather's usb connection for other things, i also have lots of space left on the m0 for other buttons so if i could have a physical shutdown button routed through here idk..
@tawny creek you're already using the serial port ? Seems the easyest way to exchnage data between feather and pi
@tawny creek using serial to talk with circuitpython is doable
@slender iron On this subject, is there a way to specify a timeout when reading from the usb vcp ? Or test for the number of bytes in the buffer to avoid blocking on read ?
@slender iron On this subject, is there a way to specify a timeout when reading from the usb vcp ? Or test for the number of bytes in the buffer to avoid blocking on read ?
not that I can think of from python
I believe there is an issue about it because python doesn't actually have a way
YAY! โค it works ๐
yay!
thankyuforthesupport
i'm glad im working with the hyperpixel display now
all the limitations of not having any GPIO's for anything really forces you to think around it, and circuitpython is a sweet deal
๐
its really convenient to be able to nano /dev/ttyUSB0/code.py
I bet!
when i keep the feather connected and turn on the pi, i have to hit the reset button before it stops blinking ~ is there a way for it to automatically detect this?
detect what?
i guess my question is, if i turn on the pi with a feather m0 connected (the same usb hid device) -- the rgb light blinks around, what does this blinking mean? and when I hit reset this blinking stops and the usb keyboard is detected
the blinking light turns solid green after
maybe it cant behave as a hid device whilst the pi is still booting up
but good to know!
yeah perhaps
not fussed about having to hit the reset switch
the blinking does indicate the line number of the error
really?
you could try sleeping for some number of seconds at the start
the different colours?
@tulip sleet where did you document the error code flashes?
so...updated a library via a pr. is there a need to tag it also? for the bundle?
yeah, once its pulled it needs to be released before the bundle picks it up
is that for me to do? or whomever accepted the pr? or doesn't matter, just someone do it?
you could do it ๐ I usually do releases before I do a new bundle release
oh. like you'll cruise through all the submodules and tag a new release for each? to make sure the latest for all of them gets pulled in for the bundle?
yeah, I try to do that
the bundle readme has a command that can indicate which repo has commits that aren't in a release
so the release of the bundle is kind of dynamic? it might change due to a change (release) in one of the submodules?
bundle 2.1 = current releases of all the submodules?
the latest release looks like it points to specific tags
so if i do a release / update of the library - does it get rolled in automatically, or later when you actually do a bundle release?
@slender iron sleep workaround works! ๐ and yeah its just the feather gets going so much faster than the pi can xD
@tidal kiln new releases get pulled in when the bundle update script is run
perfect @tawny creek
is help documentation missing from the repl due to space or some other reason?
what sort of help documentation?
ah, with all the methods?
yes
yeah, its a space thing
k
we could look into it for the m4
Didn't think it would be that much space, but I haven't really put much thought into your constraints.
trinket is out of flash completely ๐
wasn't successfully sent
Where can I find the actual python for usb_hid?
there isn't any
its a C module
Nice
@tulip sleet do you have a link to your prototypical register settings? The ADC has the same pattern and its driving a spike in my head. I think my issue is that its not at all clear where the settings come from.
@slender iron the settings come from two main places: asf4_conf/peripheral_clk_config.h and hpl_sercom_config.h. For ADC maybe there's another file that's not in asf4_conf/ yet?
I can commit my WIP so you can take a look.
yeah, I realize they come from there. I don't like that they don't just come from where init is called
that'd be good!
I'm cleaning up a little bit. some changes are in asf4
k
@slender iron btw error flashes are documented here: https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/m0-boards-faq?view=all#faq-8 (mirrored page)
thank you!
that link doesn't work right; use this: https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython/m0-boards-faq#faq-8
๐
@slender iron see branch prototypical_sercoms in adafruit/asf4 (compare against circuitpython branch) and 3.0_spi in dhalbert/circuitpython. Basically I added a few #defines to asf4_conf/hpl_sercom_config.h, and then I use those defines in hpl/hpl_sercom.c.
critical difference is call to _get_sercom_index()
i can see why they did it this way, since using the gcc preprocessor to set up the registers saves code size and time at runtime, but it's very hard to follow
yeah, I was thinking there might be a way to generate a sane init that takes in register values and has ifs internally to check against default state
then the compiler can optimize the default state settings out
the default settings are only a few dozen bytes, and they copy them wholesale into the right register slots. so it's very compact. The advantage for me was that I don't have to understand each and every specialized setting -- the defaults are OK (but who knows, maybe they are buggy).
<@&356864093652516868> here is the recording of the meeting from today: https://youtu.be/1c8-Cs3bmiw Next week will be on Monday as usual.
Join here for the chat all week: http://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel for noti...
I'm not sure you want to reinvent asf4 in a python script. I think maybe using the arduino library might be good in the long run, but the samd51 part is not that mature yet
@tulip sleet yeah, I'm struggling because there are some settings I may want to change dynamically
some of them have separate setters though
I do a lot of hri setting as necessary (see spi_configure)
I really want kwargs from python for this
the setters are tiny and inlined or inlinable and will compile into just a few machine instructions each, so I don't mind calling them
#cascade Why not bypass the feather and connect T sensor to rPi directly?
@tulip sleet I'm just grumpy with ASF4
@slender iron i empathize, and got pretty wound up about it myself! I spent two days struggling with this, and did it two other ways before I got to where I am now. Now I find that the SPI and I2C hal libraries are not all that parallel. For instance, for SPI they didn't actually bother to code up an actual baud-rate computation. The naming isn't even that parallel.
I also got all confused with the clock setting, and had to break out the oscilloscope. The saleae doesn't sample at a high-enough frequency to see what's really going on if I direct the 48Mhz clock to a pin. There's a lot of clock jitter. As an experiment I tried to lock the clock to the XOSC23K, but couldn't get that to work at all, and I don't know why. The settings are spread across the files, as you said.
also the START clock GUI doesn't really work right, it seems
you could grab the timer code I had to output a clock / 240
saleae can measure that
yeah, I don't really understand the value of asf4 for spi, i2c and adc. its just three layers over registers
that's an idea. but it seems like there's a couple of MHz jitter on the 48MHz clock when it's not locked down, unless I'm seeing an artifact
yeah, I bet there is
I don't think its set up right on the m4
on m0 it should be steady when connected to usb data
When I enable the XOSC32K even without feeding it into the DFLL, the board stops working completely. don't understand that
are you trying to clock the core with it?
the core is from the dfll, as you set it up. It's running without another clock as input. the samd51 and the samd21 are different: one is open loop and one is closed loop (can't remember which way), without specifying a clockgen as input. But they are both jittery. If I enable the external osc, but still don't set it to feed a clockgen, board doesn't run
the '21 '51 diff may jsut be a typo
i didn't see it get locked when I had usb plugged in
the 21 didn't?
no - i fed the 48Mhz to a pin as you did, and it was plugged in, but was still jittery
i have been debuggin on the '21 first, not the '51.
start with something more stable that I can compare with 2.x mor easily
yup yup