#circuitpython-dev

1 messages ยท Page 122 of 1

umbral dagger
#

The trinket has a SAMD21E18, the feather has a G18, etc.

#

The letter indicates the amount of peripherals & IO. The number indicates memory.

cunning crypt
#

Ahh, ok

fluid hound
umbral dagger
#

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.

cunning crypt
#

Oh yeah.

tawny creek
#

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

solar whale
#

@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.

tulip sleet
#

@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.

solar whale
#

@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.

tulip sleet
#

@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

solar whale
#

@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 ....

tulip sleet
#

@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

solar whale
#

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.

tulip sleet
#

did you test this on M0 or just M4

solar whale
#

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 -

tulip sleet
#

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?

solar whale
#

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.

tulip sleet
#

that's helpful. I will try to replicate that at some point since it sounds easy. And this is with the latest build?

solar whale
#

yes - pulled yesterday for master -- 2.x may be a few days old

tulip sleet
#

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

solar whale
#

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!

tulip sleet
#

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

solar whale
#

OK - I'll replicate it and enter an issue later today. Thanks!

tulip sleet
#

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

solar whale
#

Thaks for doing that - I pulled it this morning and built all 3 bundles without error.

tulip sleet
#

great

solar whale
#

I was worried by Tony's warning that the new updates were going to break 3.0 I2c , but have had no problems yet

tulip sleet
#

As long as there's a consistent set of libraries, there's no problem. I think Tony was worried about piecemeal updates.

solar whale
#

Ah - that makes sense - I was curious what the concern was. It can get messy - that is why I keep rebuilding the whole bundle.

tulip sleet
#

tnx - I am off for breakfast

solar whale
#

@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

manic glacierBOT
#

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...

...

meager grove
#

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.

stuck elbow
#

@meager grove I really love the trinket m0

meager grove
#

@stuck elbow the size! It is so small!

stuck elbow
#

it's not the size that matters

meager grove
#

well, yes and no. ๐Ÿ˜ƒ size-to-power-to-speed of dev ratio is high

stuck elbow
#

it also takes very little power

meager grove
#

I know I want like a million of them.

full halo
#

Ok, ridiculously stupid question incoming

#

What would you use circuit python for, why would I want to use it over the regular arduino IDE.

meager grove
#

So, I can answer for me personnally.

#

I find python to be faster for me to write, and easier for me to teach

full halo
#

That is a good answer

meager grove
#

But I like the flexibility of having both.

full halo
#

Which I suppose is an advantage of the trinket

stuck elbow
#

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

full halo
#

Oh right, another stupid question then, if not the arduino IDE, what else do you program it with?

stuck elbow
#

you can even put the slides and whatever other materials directly on it, so they don't need network

meager grove
#

vim :/

full halo
#

really?

stuck elbow
#

vim here too

full halo
#

wow.

meager grove
#

Atom

full halo
#

huh

#

well TIL

#

thanks for the responses.

meager grove
#

Glad to chat!

umbral dagger
#

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)```

stuck elbow
#

very nice!

umbral dagger
#

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.

stuck elbow
#

I wonder how hard it would be to make the debugger appear on a failed assert

umbral dagger
#

And maybe a string along with it that will get output on entry to the debugger.

#

explain

#

"failed asset"

stuck elbow
#

python has an "assert" statement

umbral dagger
#

ah.. "assert" ... I misread

stuck elbow
#

that evaluates an expression and throws AssertionError if it evaluates to False

umbral dagger
#

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

stuck elbow
#

no idea, in cpython all assert statements are removed (generate no bytecode) when you run with -o

umbral dagger
#

Gotta run out for bit... keep throwing ideas at me, though.

stuck elbow
#

another (perhaps stupid) idea would be to have a context manager that enables the debugging, so you could do with debug: ...

umbral dagger
#

My hesitation with that is its structural impact on the code. Removing it is more that just removing a line.

tawny creek
#

trying to upgrade my feather m0 and using the bossac tool, reports "File operation exceeds flash size"

tulip sleet
#

@tawny creek could you show the command line?

tawny creek
#

`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

tulip sleet
#

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

tawny creek
#

AHhh

#

thanks @tulip sleet ๐Ÿ˜„ did not even look at the filetype X)

tulip sleet
#

yw!

idle owl
#

Code works on a friend's CPX too. So I really have no clue why it's not working on my second one.

solar whale
#

@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.

idle owl
#

@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.

solar whale
#

OK - I assume you are using 2.x on it - I'll update mine and check on the purchase dates.

idle owl
#

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.

solar whale
#

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.

idle owl
#

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.

solar whale
#

OK - nice to have it updated to latest build and bundle! I'll check with you tomorrow.

idle owl
#

Thanks much!

pastel panther
#

hour 12 of messing with ASF4: I can blink an led but I can't do simple pwm ๐Ÿ˜ญ

idle owl
#

That's pretty quick progress! (I'm serious.)

#

ASF4 has been a beast to deal with it seems.

pastel panther
#

I've tried at least 6 different atmel provided examples and none of them work except for the blinkies.

idle owl
#

Oi

pastel panther
#

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.

idle owl
#

I don't know either. I don't know Arduino

umbral dagger
#

protip: when you have multiple CP forks make sure you're editing, building, and deploying the same/right one ๐Ÿ˜ฆ

idle owl
#

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.

pastel panther
#

@umbral dagger good call

umbral dagger
#

35 years and that kind of thing still happens now & then.

idle owl
#

Doesn't matter how long, this type of thing happens again eventually.

manic glacierBOT
umbral dagger
#

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.

pastel panther
#

I can't read that without thinking of Doug from Up

#

breakpoint makes more sense to me

umbral dagger
#

Maybe take inspiration from Smalltalk and use halt

#

Though I lean toward breakpoint

cunning crypt
#

Breakpoint would fit better with Python I think

pastel panther
#

it seems like a fairly universally understood term

umbral dagger
#

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)```

umbral dagger
#

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> 
marsh harbor
#

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)```
pastel panther
#

It sounds like it may be skipping a number?

marsh harbor
#

That is correct. For example it'll display 1, 2, 3 <pause> 5, 6, <pause> 8

umbral dagger
#

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

marsh harbor
#

nope. Went 1,2 pause, 4, 5, 6 pause 8

umbral dagger
#

add a small delay maybe 0.1 between the show calls

marsh harbor
#

nope. still skipping

#

the skips are a bit random

umbral dagger
#

same pattern every time?

marsh harbor
#

nope

umbral dagger
#

Recheck all your connections...

#

seemingly random yet repeating problems can sometimes be a bad/flaky connection

marsh harbor
#

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.

umbral dagger
#

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?

marsh harbor
#

Strangely enough the same skips

umbral dagger
#

try 1.57

#

Just trying to rule out timing intersecting with something

marsh harbor
#

1.57 also results in skipping 2/7/10

pastel panther
#

What if you make it display 2/7/2/7/2/7?

marsh harbor
#

hmm, sanity check telling it to display a static number...

#

1212 works. 1210 displays as 1209

#

1111 displays as 1110

#

2222 displays as 2221

pastel panther
#

That smells like a pattern

marsh harbor
#

very much so

pastel panther
#

@timber lion Any sage words of advice?

umbral dagger
#

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

marsh harbor
#

would casting to int for the values work?

umbral dagger
#

I see the same behaviour on a trinket m0

#
>>> "{:f}".format(1212)
'1212.000012'
>>> "{:f}".format(1210)
'1209.999918'
#

rounding....

marsh harbor
#

as part of my troubleshooting I updated to circuitpython 2.1.0

#

yeah, rounding bug definitely sounds right

umbral dagger
#

Reasonable.. this trinket was sitting the the drawer since I got it

#
'1209.999918'
idle owl
#

Round was broken in some way in 2.1.0. I don't know if the issue was resolved or not.

marsh harbor
#

It was not.

umbral dagger
#

@idle owl I get the same behaviour in 3.0 on an M4

marsh harbor
#

I am still experiencing the issue on 2.1.0 on the trinket m0

idle owl
#

@umbral dagger I'm wondering when it was broken on 2.1.0 they took that into the 3.0 master build

umbral dagger
#

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.

marsh harbor
#

its going to count days and months until makerfaire. So yes, ints are fine

umbral dagger
#

line 155 of adafruit_ht16k33/segments.py

#

or better, add an int method at submit a PR

marsh harbor
#

I would love to, but that may have to wait until I reach a real computer.

umbral dagger
#

It'd pretty much be a copy of hex but using {:d} to format.

marsh harbor
#

grr, chromebooks

#

great for 90% of what I need to do out and about

#

not so great for that last 10%

umbral dagger
#

is that lib installed as mpy files or py?

#

if it's py you can just edit on the trinket

marsh harbor
#

mpy

umbral dagger
#

๐Ÿ˜ฆ

#

Well, the problem is solved for you... the solution just has to be implmented ๐Ÿ˜ƒ

marsh harbor
#

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

umbral dagger
#

You are most welcome.

marsh harbor
#

I figure a countdown clock would be a good first project for circuitpython. Simple rtc and 7 segment interface. Time to do additional research

pastel panther
#

Sounds about right. My first CP thing was getting a RG led matrix from a dumpster dive working

marsh harbor
#

The local hackerspace gets crazy in the three weeks leading up to makerfaire. This is to encourage people to start sooner

pastel panther
#

good idea

umbral dagger
#

@marsh harbor Be sure to bring to to Show&Tell once it's done.

marsh harbor
#

raises an eyebrow

#

The one at my local hackerspace, @umbral dagger or is there another that I don't know about

idle owl
#

The Adafruit Show and Tell every Wednesday! ๐Ÿ˜ƒ

marsh harbor
#

adds it to the calendar

umbral dagger
#

Sorry.. I was distracted by an idea for another project.

#

Wed 7:30 Eastern

errant grail
#

?showtimes

digital shoreBOT
#

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

tulip sleet
#

@pastel panther Arduino, even our SAMD51 version, does not use ASF4.

pastel panther
#

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?

sacred blade
#

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.

pastel panther
#

Yea, there is an outstanding issue to add pulseio support for the 3.0 milestone

tulip sleet
#

@pastel panther @sacred blade right, enabling code that is not ported will just try to compile the older ASF3-based code.

pastel panther
#

@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

tulip sleet
#

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)

pastel panther
#

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

tulip sleet
#

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

pastel panther
#

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?

tulip sleet
#

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)

pastel panther
#

right

vague monolith
#

Could be written a little better for newer people

tawny creek
#

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?)

vague monolith
#

@tawny creek Any example code?

pastel panther
#

@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?

vague monolith
#

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.

pastel panther
#

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

timber lion
#

@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 ๐Ÿ˜ƒ

pastel panther
vague monolith
#

@pastel panther Yes, I was just reading through that.

opaque patrol
#

does ampy work with circuit python?

idle owl
#

@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?

opaque patrol
#

@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

idle owl
#

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. ๐Ÿ˜ƒ

opaque patrol
#

I haven't tried it yet, I am just modifying the code.py file directly using vs code

idle owl
#

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.

pastel panther
#

@opaque patrol have you tried the REPL yet?

opaque patrol
#

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)

manic glacierBOT
pastel panther
#

Did you try CRL+C ing the running script after you've attached to the serial port with putty?

opaque patrol
#

yes, the only irritation was that if the code.py had an infinite loop, it is impossible to get the repl

idle owl
#

It shouldn't be.

opaque patrol
#

so if I hit CTRL-C it breaks and then immediately runs the code.py

idle owl
#

What version of CircuitPython are you running?

opaque patrol
#

2.1.0

idle owl
#

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.

opaque patrol
#

Maybe I don't have the steps right, because I just tried it and it worked correctly...

idle owl
#

That's good!

#

I've run into it being finnicky sometimes.

pastel panther
#

The REPL is super useful for prototyping stuff

opaque patrol
#

I got it to reproduce again, looks like it might have to do with updating neopixels when I hit CTRL-C

idle owl
#

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.

pastel panther
#

I'd err on the side of filing as long as you've made an effort to rule out the derp factor

opaque patrol
#

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

tawny creek
vague monolith
#

@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.

pastel panther
#

@opaque patrol if you look back for @timber lion 's last post he mentions that there is a bug with floats

opaque patrol
#

yeah, I saw that

vague monolith
#

@tawny creek You'd probably want to just monitor the release of the button and then send a key when that /event/ occurs.

tawny creek
#

@vague monolith yep, but i'd still have to 'quickly release' a key

#

not sure how this works though

vague monolith
#

@tawny creek So you want it to only send one button press each time it's pushed?

tawny creek
#

yeah same as a usb joystick

timber lion
#

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.

vague monolith
#

@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.

tawny creek
pastel panther
#

@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

tawny creek
#

@pastel panther would like to see some examples if there are any

pastel panther
#

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

tawny creek
#

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..

pastel panther
#

That's not real code

tawny creek
#

yeah ty pseudo code ๐Ÿ˜„

pastel panther
#

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

tawny creek
#

yeah, going to look into bridging those pins on the featherwing and see how those affect it's behaviour

pastel panther
#

I would hold off on using interrupts until you've figured out your general logic

#

having ISRs interact with your main loop is nontrivial

tawny creek
#

shall,, ty ty

#

really fun weekend project

pastel panther
#

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

vague monolith
#

Wasn't there a hid for mouse?

pastel panther
#

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

#

gotta bounce. ttyl folks ๐Ÿ‘‹

tawny creek
#

using it for gaming emulation so not sure how it would work

#

gnight @pastel panther ty again ๐Ÿ˜ƒ

glad hazel
#

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?

idle owl
#

I have been working with that code, so I might be able to. What board are you using?

glad hazel
#

Awesome! Circuit Playground Express

idle owl
#

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?

glad hazel
#

Yup, I messed around with it a bit, but now I've reverted back to whats in the post

idle owl
#

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.

glad hazel
#

hmmm, I'm not even getting the taps. It just makes a click sound like some switch is turning on then off

idle owl
#

Hmm.

#

What version of CircuitPython are you running?

#

I don't think it should matter, but it's worth checking

glad hazel
#

The one from the Adafruit tutorial so I think it's 2.1.0

idle owl
#

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.

glad hazel
#

alright, I'm down

idle owl
#

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

glad hazel
#

Hmm, I'm not getting anything from the LEDs

idle owl
#

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?

glad hazel
#

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

idle owl
#

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.

glad hazel
#

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

idle owl
#

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.

glad hazel
#

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 :/

idle owl
#

It's good you've got a backup. But hopefully things get sorted quickly!

solar whale
#

@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.

solar whale
#

@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

manic glacierBOT
tulip sleet
#

@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

manic glacierBOT
marble hornet
#

does anyone know how to compile the uf2 bootloader using unix ?

solar whale
#

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

marble hornet
#

@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?

solar whale
#

@marble hornet yes - clone it then cd uf2-samd21 git submodule update --init --recursive before building

marble hornet
#

@solar whale ill try that. thanks so much for the help!! if i have more questions do you mind if i ask?

solar whale
#

sure go ahead

glad hazel
#

@tulip sleet Thanks for the simple test code. My CPX is pumping out all zeros, do you think this means the mic is defective?

solar whale
#

@marble hornet I just tried a simple download of the repo and it fails to find necessary tools. clone and update as above.

marble hornet
#

@solar whale I am atempting to clone repo now, never done this before.

solar whale
#

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

marble hornet
#

@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?

solar whale
#

@marble hornet ah - yes - you will need that installed. just a sec - I'll find the guide for that.

tulip sleet
#

@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.

solar whale
#

@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')

marble hornet
#

the most recent one seems to be from late june this year,

#

??

tulip sleet
#

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

marble hornet
#

should i cone it to .git?

tulip sleet
#

@solar whale re mic's there may be diffs in sensitivity, but I have two CPX's where one mic is returning all zeros.

solar whale
#

@marble hornet the install of the arm-non-eabi tool chain will do just that -- nothin to clone. then try building the uf2 again

marble hornet
#

@tulip sleet @solar whale thanks!! ill try that now

tulip sleet
#

@solar whale forum post re mic's here

#

tested on 2.1.0

solar whale
#

@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

marble hornet
#

im trying the sudo add-apt.... and im getting an error saying: command not found

solar whale
#

add-apt-repository is all together correct?

#
/usr/bin/add-apt-repository
tulip sleet
#

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

solar whale
#

@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.

marble hornet
#

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.

solar whale
#

@marble hornet great! good luck with it. What linux distro are you using ?

tulip sleet
#

@marble hornet what version of ubuntu or debian are you using?

marble hornet
#

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

tulip sleet
#

oh yeah, you need to use brew, cask kind of stuff. I'm not that familiar with what to do

solar whale
#

@marble hornet I think you will find it best to install "homebrew" on your mac

tulip sleet
#

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

solar whale
marble hornet
#

installing...

solar whale
marble hornet
#

@solar whale if unable to get homebrew to work ill try that

solar whale
#

I have used both but eventaully moved to a linux box.

marble hornet
#

@solar whale what os are you running ?

solar whale
#

on linus I use Ubuntu 16.04 - On MAc - just upgraded to High Sierra 10.13.1

tulip sleet
#

@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

marble hornet
#

are you running ubuntu in a boc on osx? if so does it take up alot of storage?

tulip sleet
solar whale
#

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

marble hornet
#

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?

solar whale
#

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.

marble hornet
#

iels ? is this a flashable file. using a edbg or jlink? it looks to me like the file is a .uf2 file

solar whale
#

it was a typo - my fingers are much faster than my brain ๐Ÿ˜‰

#

the m0 "express" boards have a 2Mbyte SPI flash installed.

marble hornet
#

oh else so if i: make BOARD=metro_m0_express

solar whale
tulip sleet
#

@marble hornet the builds will build a .elf, a .bin, and a .uf2

solar whale
#

and it is just BOARD=metro_m0

#

if/when you build circuitpython ---- BOARD=metro_m0_express --- just to keep it interesting ๐Ÿ˜‰

tulip sleet
#

@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

marble hornet
#

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!!!!!!!

solar whale
#

@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!

marble hornet
#

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

solar whale
#

FYI - The trinket or gemma builds do not have flash chips nor do all the feather_m0 boards

marble hornet
#

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))

#

error 1?

solar whale
#

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

marble hornet
#

im building using the mirosoft repo i told it to make BOARD=zero

#

ill google node

#

could i flash the .bin file as is ?

solar whale
#

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

marble hornet
#

i have both the adafruit and microsoft. so far i have built microsoft zero, trinket, and generic

solar whale
#

What is the link to the mocrosoft repo? Are you getting that error for all of them?

marble hornet
#

i dont mind using adafruit

solar whale
#

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 ....

marble hornet
#

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

solar whale
#

Compare the Makefiles - - the Adafruit version uses python for the final step - the MS version uses node

marble hornet
#

okay, maybe the adafruit file has the circuit python "prog" already on/in it

solar whale
#

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

marble hornet
solar whale
#

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

marble hornet
#

im not sure, who should it be reported to?

tulip sleet
solar whale
#

@tulip sleet thanks!

marble hornet
#

@tulip sleet thanks

tulip sleet
#

it was a while ago - i'll discuss with Scott when he returns

marble hornet
#

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'

solar whale
marble hornet
#

think this could run on a samd09?

#

w/ flash +

solar whale
#

to put code in a box use three "backtics" under the ~ -- before and aftter code

marble hornet
#

@solar whale thanks!

#

i looked it but...

bronze geyser
#

should adafruit-circuitpython-feather_m0_basic-2.1.0.bin work on a Feather M0 LoRa?

solar whale
#

@bronze geyser It should run CP fine, but it wont support the radio - It will act like an M0_basic

marble hornet
#

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

pastel panther
#

@marble hornet I think a SAMD11 might be a better fit

#

since it has USB as well.

bronze geyser
#

@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!]

pastel panther
#

I think memory will probably be an issue though

marble hornet
#

the update-bootloader.uf2 cant be burned can it, only as an updater right? @solar whale @pastel panther

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

marble hornet
#

@pastel panther thats what @solar whale and @tulip sleet have been graciously helping me with. ive built a bin (microsoft varient)

pastel panther
#

excellent

marble hornet
#

but am curious if that is what needs to be burned, burnt?

#

as is

pastel panther
#

Dan or Chris would know better than me

marble hornet
#

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

solar whale
#

@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!

marble hornet
#

@solar whale thank you so much, your help has been invaluble

pastel panther
#

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?

marble hornet
#

yes

pastel panther
#

CP libraries aren't processor specific so yes

marble hornet
#

awesome, i think ill try to make CP board before trying that

pastel panther
#

Do you have one to test with? So you're not trying to debug your program and the board at the same time?

marble hornet
#

does anyone have a pre error copy of the uf2-samd21 repo?

pastel panther
#

No but you can checkout a prior commit

marble hornet
#

im jsut trying to make the board run circuit python, the aplication specifics will come later.

pastel panther
#

I would start with a known good board like a feather m0 express and modify from there

marble hornet
#

thanks @pastel panther ill check out how to do that

#

the commit thing

pastel panther
#

git checkout <sha-hash-of-commit>

#

do you have a clone of the repo yet?

marble hornet
#

yes

tulip sleet
#

@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

pastel panther
#

bbiab

marble hornet
#

bbiab?

#

for a custom built board

marble hornet
#

or reburn a bricked feather ?

opaque patrol
#

@marble hornet Are you still trying to compile on your Mac?

marble hornet
#

yes @opaque patrol

opaque patrol
#

@marble hornet What directory are you running the make command from? The source ( circuitpython ) or somewhere else?

marble hornet
#

is there a difference from the msc of adafruit vs Microsoft

opaque patrol
#

@marble hornet just a second, I haven't tried to build this one yet

marble hornet
#

@opaque patrol what have you built any pre-built or prior commits lying around ?

opaque patrol
#

@marble hornet For a particular board or just the samd21 chip in general?

marble hornet
#

the samd21

#

sorry samd21g

#

is what i meant

opaque patrol
#

@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

idle owl
#

@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.

solar whale
#

Just about to try

idle owl
#

@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.

solar whale
#

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')

idle owl
#

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.

solar whale
#

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.

idle owl
#

Seriously?

solar whale
#

nope - running for hours

idle owl
#

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

solar whale
#

no

idle owl
#

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?

solar whale
#

likel;y - built yesterday from 2.x branch

idle owl
#

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.

solar whale
#

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 ๐Ÿ˜‰

idle owl
#

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.

solar whale
#

same link - just do git checkout 2.x after cloning - it defaults to master

idle owl
#

Literally "2.x"?

solar whale
#

yup!

idle owl
#

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?

solar whale
#

cd mpy-cross

#

make

idle owl
#

I mean for the firmware

solar whale
#

or at top dir make -C mpy-croaa

idle owl
#

because it's not the same as we've been doing for the M4 and that's the only one I know

solar whale
#
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

idle owl
#

Ok

solar whale
#

but if you cloned a new repo you should redo mpy-cross since master uses 3.0

idle owl
#

Do you mean circuitplayground_express?

solar whale
#

yes ๐Ÿ˜Š

idle owl
#

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

solar whale
#

do what I mean, not what I type ๐Ÿ˜‰

idle owl
#

Ohhhhhhh I have to do mpy-cross first, I get it now.

solar whale
#

yes - or it will build incompatible .mpys

#

for the "frozen" modules

idle owl
#

brb

solar whale
#

@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..

pastel panther
#

@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

opaque patrol
#

Are there any examples or libraries for the IR tx/rx on circuit playground express?

idle owl
#

@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.

pastel panther
#

(@idle owl is our resident CPX guru)

idle owl
#

@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

pastel panther
#

I have the same build number

solar whale
#

same here ```Adafruit CircuitPython 2.1.0-13-gd183b66 on 2017-11-11; Adafruit CircuitPlayground Express with samd21g18

idle owl
#

Ok.

solar whale
#

how did you print out your build number

idle owl
#

From the REPL

pastel panther
#

strange, yours is slightly longer than ours, with the e6 at the end

idle owl
#

I think I have some local git magic in .bashrc that makes my hash longer.

pastel panther
#

ah

solar whale
#

that was what I was wondering too

idle owl
#

I get all 0s from Dan's code.

solar whale
#

๐Ÿ˜ฆ on a working board ?

idle owl
#

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.

solar whale
#

does your demo proram - with the meter work on this board?

idle owl
#

No. This is the one it doesn't work on.

solar whale
#

OK so you and DAn both have boards that return 0's mine both return good values.

idle owl
#

Ok

#

I tried changing the frequency too, didn't help.

solar whale
#

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

opaque patrol
#

fwiw, mine returned all 0's as well

idle owl
#

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.

solar whale
#

very puzzling

idle owl
#

Entirely.

manic glacierBOT
idle owl
#

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.

solar whale
#

@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.

idle owl
#

@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

manic glacierBOT
umbral dagger
#

@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.

pastel panther
#

I wish poutine was more common here

vague monolith
#

argh memory allocation failure

idle owl
#

@vague monolith What with?

vague monolith
#

messing with lists in repl

idle owl
#

Ah

vague monolith
#

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.

idle owl
#

Oh nice

#

Is the version of the API you have a .mpy?

vague monolith
#

From the bundle the adafruit_circuitplayground.express

idle owl
#

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. ๐Ÿ˜„

vague monolith
#

I'll have to troubleshoot more in a bit. It's wierd different size allocation errors etc...

idle owl
#

Hmm. Let me know how it goes.

vague monolith
#

1024 is the maximum length of a list

umbral dagger
#

@pastel panther This is the first place I've lived where it is.

tulip sleet
#

@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.

idle owl
#

@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.

tulip sleet
#

does my printing code work on the "bad" board?

idle owl
#

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.

tulip sleet
#

could you point to your recording code again? I don't know how far back to look

idle owl
#

Yeah I'll just post it again.

manic glacierBOT
idle owl
#

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.

tulip sleet
#

that's using a much larger buffer (16k), as opposed to the buf I had which was 160.

idle owl
#

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.

tulip sleet
#

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

idle owl
#

It plays back taps.

tulip sleet
#

the taps may be very strong signals

idle owl
#

Still zeros with a bigger buffer.

tulip sleet
#

try a buffer of 1000

idle owl
#

same

tulip sleet
#

are you yellling at it when you're running?

idle owl
#

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.

tulip sleet
#

frequency=16000? (any misspelling will not be caught, that's a known bug about keyword args)

idle owl
#

Frequency 32000. I had it upped from earlier. No misspellings on reading back through it.

#

16k doesn't do anything else either.

tulip sleet
#

i'll give up for tonight; that's odd but I have 9am dentist appt

idle owl
#

Thank you for looking into it at all ๐Ÿ˜„

tulip sleet
#

good night

idle owl
#

Goodnight!

#

I'm headed out as well.

glad hazel
#

@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

manic glacierBOT
manic glacierBOT
vague monolith
#

@idle owl your recording code works here on my circuitplayground express.

opaque patrol
#

your recordingcode crashed my cpx to safemode

#

do I need to get the latest build? I am running 2.1.0

vague monolith
#

@opaque patrol Works for me on 2.1.0

opaque patrol
#

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

manic glacierBOT
#

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.

idle owl
#

@glad hazel That's great!

#

@vague monolith @opaque patrol Thank you for testing it! Always appreciated.

pastel panther
#

@tulip sleet how feasible would it be to get CP running in 4k of RAM?

#

@tulip sleet presuming you removed unused code

tulip sleet
#

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

pastel panther
#

hah, ok

#

samd21 it is I guess

tulip sleet
#

we're miserably tight with 32k of RAM right now

pastel panther
#

I figured it was a stretch

tulip sleet
#

bbc micro bit has 16k, and they removed a lot of stuff and pull various tricks

pastel panther
#

@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

tulip sleet
#

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?

pastel panther
#

'21

#

with an eye towards the 11 eventually

tulip sleet
#

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

pastel panther
#

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

tidal kiln
#

(with CP 2.1 and whatever, not an M4 / CP 3.x thing)

tulip sleet
#

@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?

tidal kiln
#

no. the real work is to refactor that repo per an issue scott posted.

#

figured i'd start by testing the existing code

tulip sleet
#

I will breadboard it and get back to you

tidal kiln
#

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:
tulip sleet
#

@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.

tidal kiln
#

same for me except using a trinket

#

let me try feather to see if it matters

tulip sleet
#

I'm using Feather M0 Express

tidal kiln
#

๐Ÿ˜ฆ 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)

tulip sleet
#

I am semi-color-blind so I always measure my resistors

tidal kiln
#

(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

tulip sleet
#

you're welcome; glad mine is ok, so I know it will work later!

bronze geyser
#

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?

idle owl
#

I don't think so, no. They haven't started into interrupts yet. If I understand what you're asking.

bronze geyser
idle owl
#

@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.

bronze geyser
#

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.

opaque patrol
#

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.

tidal kiln
#

@opaque patrol so did you find another example of it having been done?

tawny creek
#

looooove using circuitpython in this setup. I can edit and debug the code on the goo

#
  • using a usb keyboard not seen
slender iron
#

<@&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.

tawny creek
#

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

slender iron
#

awesome @tawny creek !

#

you were asking about gamepad support right? its on my radar for 3.x

tawny creek
#

yes please ><

slender iron
#

could you file an issue for 3.x? I don't think core support would be too hard

tawny creek
#

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 ๐Ÿ˜„

slender iron
#

๐Ÿ˜ƒ thats the goal for all of our boards

tawny creek
#

sure thing

slender iron
#

thanks!

#

k bedtime for me. I'm on east coast time

#

talk with you all tomorrow!

manic glacierBOT
stuck elbow
#

@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

bronze geyser
manic glacierBOT
#

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.

#

(@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...

manic glacierBOT
#

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).
...

manic glacierBOT
#

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...

manic glacierBOT
#

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...

manic glacierBOT
#

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:
![saleae](https://user-images.githubusercontent.com/8755041/32795709-6bffbd58-c921-11e7-8ef4-9dbb9aa79ec1.png)
#

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:

  1. limited pins on the main controller board;
  2. finding off-the-shelf device-specific i2c driver boards that can be
    configured to a very large bus address range;
  3. 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...

opaque patrol
#

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

idle owl
#

@opaque patrol Nicely done! Great idea!

#

CPX is perfect for that game.

opaque patrol
#

It seems to really push the memory limit, I tried adding more features, but kept getting memory allocation errors.

idle owl
#

We're pushing the memory limits pretty hard. That's not surprising.

tidal kiln
#

If youโ€™ve been looking to share your Adafruit projects with the community as a whole, wowee, do we have exciting news for you! Share any of your completed Circuit Playground projects this Augโ€ฆ

#

@opaque patrol was the arduino version blog post something on adafruit?

opaque patrol
slender iron
#

@opaque patrol maybe @tidal kiln would like to integrate your code into that guide

tidal kiln
#

i love seeing all the different approaches to implementing this adabot

#

how is it echoing if you can't hear me?

slender iron
#

thats a good question

timber lion
#

oh weirdi can't hear carter either

#

and wow chat is lagging as i type

#

let me restart

tidal kiln
#

browser fun

timber lion
#

not an app fan, i don't like notifications on desktop

#

hrm weird well it stil works, just chat is slow ๐Ÿ˜ƒ

tidal kiln
#

^ that

tulip sleet
#

having trouble with my mic setup

opaque patrol
#

Is anyone allowed in the recorded session?

slender iron
#

yup!

#

please join

idle owl
#

@opaque patrol Do you have a mic or do you plan to only listen in?

#

Excellent!

tidal kiln
#

no. go ahead.

#

Dan H for helping with toolchain setup so I can build CP and sanity checking DS18B20

#

(temp sensor)

#

yes

solar whale
#

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.

hollow tartan
#

awesome !!! More Hardware is always good. ๐Ÿ˜ƒ

slender iron
tidal kiln
#

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.

stuck elbow
#

Nothing to report, on vacation for 2 weeks

solar whale
#

Testing I2C - no issues - playing with nrf52 - confusing but fun ๐Ÿ˜‰

#

yes 3x

manic glacierBOT
tulip sleet
#

@prisma pilot could you mute your mic for now?

tidal kiln
#

post issue for ADS1x15 and i'll fix

#

nvmd. looks like dan already did.

solar whale
#

I never saw zeros - just increased sensitivty

#

@idle owl have you tried playing a .wav file

#

nevermind - that does not test mic....

hollow tartan
#

is there some aspect of the HW that is delicate?

#

the mic

slender iron
#

yeah, the mic is actually mechanical and could actually break

hollow tartan
#

to physical (mecha or electrical) or logical abuses

tulip sleet
#

i don't think it's all that fragile. But if dirt or water got in the mic hole, it could hurt it.

hollow tartan
#

logical would actually be voltage parameters

fading solstice
#

@slender iron have a process question. when does a tag assigned to a file version. who asigned the tag?

hollow tartan
#

@slender iron maybe you could share a few photos of your wedding costume(s) on some external channel - facebook?

tidal kiln
#

is this something that breaks after cookiecutter?

#

but your guide covers what should be done?

timber lion
#

'.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.'

hollow tartan
#

thank you, bye

slender iron
river quest
#

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 blinka

tawny creek
#

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?

slender iron
#

@tawny creek what do you mean?

tawny creek
#

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..

sacred blade
#

@tawny creek you're already using the serial port ? Seems the easyest way to exchnage data between feather and pi

tawny creek
#

yes XD pyserial!

#

sorry neeever done this before

slender iron
#

@tawny creek using serial to talk with circuitpython is doable

tawny creek
#

yeeh

#

imma try it now ๐Ÿ˜„

sacred blade
#

@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 ?

slender iron
#

not that I can think of from python

#

I believe there is an issue about it because python doesn't actually have a way

tawny creek
#

YAY! โค it works ๐Ÿ˜„

slender iron
#

yay!

tawny creek
#

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

slender iron
#

๐Ÿ˜ƒ

tawny creek
#

its really convenient to be able to nano /dev/ttyUSB0/code.py

slender iron
#

I bet!

tawny creek
#

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?

slender iron
#

detect what?

tawny creek
#

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

slender iron
#

blinking usually indicates an error

#

it may be a start up error

tawny creek
#

maybe it cant behave as a hid device whilst the pi is still booting up

#

but good to know!

slender iron
#

yeah perhaps

tawny creek
#

not fussed about having to hit the reset switch

slender iron
#

the blinking does indicate the line number of the error

tawny creek
#

really?

slender iron
#

you could try sleeping for some number of seconds at the start

tawny creek
#

the different colours?

slender iron
#

yeah, dan wrote it up somewhere...

#

yup

tawny creek
#

cool!

#

ahhah

#

yeah i think the sleep at the start is a good idea

slender iron
#

@tulip sleet where did you document the error code flashes?

tidal kiln
#

so...updated a library via a pr. is there a need to tag it also? for the bundle?

slender iron
#

yeah, once its pulled it needs to be released before the bundle picks it up

tidal kiln
#

is that for me to do? or whomever accepted the pr? or doesn't matter, just someone do it?

slender iron
#

you could do it ๐Ÿ˜ƒ I usually do releases before I do a new bundle release

tidal kiln
#

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?

slender iron
#

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

tidal kiln
#

so the release of the bundle is kind of dynamic? it might change due to a change (release) in one of the submodules?

slender iron
#

I'm not sure what you mean

#

the bundle is design to include released code only

tidal kiln
#

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?

tawny creek
#

@slender iron sleep workaround works! ๐Ÿ˜„ and yeah its just the feather gets going so much faster than the pi can xD

slender iron
#

@tidal kiln new releases get pulled in when the bundle update script is run

#

perfect @tawny creek

vague monolith
#

is help documentation missing from the repl due to space or some other reason?

slender iron
#

what sort of help documentation?

vague monolith
#

like help(module)

#

docstring display etc...

slender iron
#

ah, with all the methods?

vague monolith
#

yes

slender iron
#

yeah, its a space thing

vague monolith
#

k

slender iron
#

we could look into it for the m4

vague monolith
#

Didn't think it would be that much space, but I haven't really put much thought into your constraints.

slender iron
#

trinket is out of flash completely ๐Ÿ˜ƒ

vague monolith
#

that adafruit_hid relies on

#

Red text?

slender iron
#

wasn't successfully sent

vague monolith
#

Where can I find the actual python for usb_hid?

slender iron
#

there isn't any

#

its a C module

vague monolith
#

Nice

slender iron
#

@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.

tulip sleet
#

@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.

slender iron
#

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!

tulip sleet
#

I'm cleaning up a little bit. some changes are in asf4

slender iron
#

k

tulip sleet
slender iron
#

thank you!

tulip sleet
slender iron
#

๐Ÿ‘

tulip sleet
#

@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()

slender iron
#

yeah, I see what you did

#

I wish there was something more like asf3

tulip sleet
#

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

slender iron
#

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

tulip sleet
#

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).

slender iron
tulip sleet
#

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

slender iron
#

@tulip sleet yeah, I'm struggling because there are some settings I may want to change dynamically

#

some of them have separate setters though

tulip sleet
#

I do a lot of hri setting as necessary (see spi_configure)

slender iron
#

I really want kwargs from python for this

tulip sleet
#

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

hollow tartan
#

#cascade Why not bypass the feather and connect T sensor to rPi directly?

slender iron
#

@tulip sleet I'm just grumpy with ASF4

tulip sleet
#

@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

slender iron
#

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

tulip sleet
#

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

slender iron
#

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

tulip sleet
#

When I enable the XOSC32K even without feeding it into the DFLL, the board stops working completely. don't understand that

slender iron
#

are you trying to clock the core with it?

tulip sleet
#

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

slender iron
#

the 21 didn't?

tulip sleet
#

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.

slender iron
#

hrm

#

thats wise

tulip sleet
#

start with something more stable that I can compare with 2.x mor easily

slender iron
#

yup yup

tulip sleet
#

and everybody else is loving their M4

#

so I figured I would try the other brand

#

i'll go back to the clock stuff later but it works for now!