#circuitpython-dev

1 messages ยท Page 178 of 1

tulip sleet
#

hmm, i can't force a build, not my project, or something

idle owl
#

hmm

tidal kiln
idle owl
#

@tidal kiln Done, I'm leaving it for sommersoft to take a look at as well.

tulip sleet
#

@idle owl I think rtd is churning the themes, not something we can fix for now

idle owl
#

@tulip sleet Ok good to know.

tidal kiln
#

@idle owl thanks!

haughty bobcat
#

Just got my Gemma M0 up and running

#

so much better than arduino so far

#

but Arduino does have more libraries

idle owl
#

That it does. It's also got a decade on us. ๐Ÿ˜ƒ

#

I'm glad you're liking it!

tidal kiln
#

print("yay!")

haughty bobcat
#

so is there a place where all the pinouts are listed or am I missing something?

#

so far I only know pin 13 is red led

#

I found a guide

tulip sleet
#

Are you looking at the Learn Guide? [we crossed]

haughty bobcat
#

well I went to the github listed above so I think I'm good on guides

#

fingers crossed that adabox 008 has circuitpython and a crickit

tidal kiln
haughty bobcat
#

yes!

tidal kiln
#

the other little trick is to do this in REPL:

import board
dir(board)
haughty bobcat
#

Ok thanks!

#

So is Arduino on its way out?

#

Personally I haven't heard any new things about Arduino for a while

stuck elbow
#

oh, they have a lot of new stuff

#

but everybody are still using UNOs

haughty bobcat
#

I have a metro

#

but that metro m0 looks delightful

stuck elbow
#

plus, all the boards you can program with circuitpython can also be programmed with arduino

haughty bobcat
#

yeah it's a win win

tidal kiln
#

think of it as more programming options, not one thing replacing another

haughty bobcat
#

so is adafruit just going to start making everything circuitpython since the chipsets support both?

manic glacierBOT
#

I just tried the test case in the previous post on an M4 (without sleep) and the number of iteration varies quite a lot:

Adafruit CircuitPython 3.0.0-rc.0-25-gd7d132d5a-dirty on 2018-06-26; Adafruit Metro M4 Express with samd51j19
>>>
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
time: (2000, 1, 1, 0, 0, 39) monotonic:0.244003 iterations:403
time: (2000, 1, 1, 0, 0, 40) monotonic:1.003006 iterations:548
time: (20...
stuck elbow
#

@haughty bobcat you still can do more with Arduino โ€” it gives you more resources on the same hardware

#

so there will be both

scarlet fjord
#

this is probably more of a general Python question, but is there any way for me to have an array of variables where some of those variables are a single thing and some are themselves an array of variables?

cunning crypt
#

@scarlet fjord Yes, absolutely!

scarlet fjord
#

or a better way would be to have everything as an array of arrays, but then have the single-thing ones be just an array of one?

cunning crypt
#

Say you have variable [X, Y, Z]

#

With python, variables can be freely changed.

#

So you can do something like X = 10

#

X is now an int.

#

Well, more accurately

#

Var[X, Y, Z]

#

Var[0] = 10 would make X an int

scarlet fjord
#

oh ok, so something like this then, should work?

cunning crypt
#

Var[0] = [0, 10, 5] would make X a list

scarlet fjord
#
kbd_p1 = [Keycode.A, Keycode.S, Keycode.F]
kbd_p2 = Keycode.B
kbd_p3 = Keycode.C
kbd_p4 = Keycode.D

kbdkeys = [kbd_p1, kbd_p2, kbd_p3, kbd_p4]```
cunning crypt
#

Yep, that should work.

scarlet fjord
#

ok cool

cunning crypt
#

But, you'd have to re-update kbdkeys

#

Which could be useful in some cases, IE to see if it has changed.

scarlet fjord
#

what do you mean update it?

cunning crypt
#

Oh, right. Sorry.

#

If you changed kbd_p1, it wouldn't automatically update inside kbdkeys

tulip sleet
#

Keyboard.press() will take multiple arguments. So if you make them all lists or tuples, you can do this:

kbdkeys = ( (Keycode.SHIFT, Keycode.A), (Keycode.B,), (Keycode.CTRL, Keycode.D))
...
kbd.press(*kbdkeys[i])
scarlet fjord
#

im assuming then;

Traceback (most recent call last):
  File "main.py", line 48, in <module>
  File "adafruit_hid/keyboard.py", line 116, in release
  File "adafruit_hid/keyboard.py", line 156, in _remove_keycode_from_report
  File "adafruit_hid/keycode.py", line 305, in modifier_bit
TypeError: unsupported types for __le__: 'int', 'list'``` 
I'm assuming im not doing what Dan just said i should do ๐Ÿ˜›
tulip sleet
#

two new concepts there: * in arg list, and (1,) for a tuple with one element

scarlet fjord
#

(whats a tuple) ๐Ÿ˜…

tulip sleet
#

a tuple is a list that can't be modified

#

once it's created

stuck elbow
#

it's a math term generalizing the idea of pair, triple, quadruple, etc.

#

quadruple = 4-tuple

scarlet fjord
#

i see

cunning crypt
#

Deshipu and Dan know a lot more than I, and it's dinner time for me anyawy.

scarlet fjord
#

thanks for your help! ๐Ÿ‘

stuck elbow
#

most of the time you can use tuples and lists exchangeably

#

the exception is for dict keys, where you can't use mutable objects, so you can only use tuples

scarlet fjord
#

hmm ok

#

so

kbd.press(*kbdkeys[i])

is looking for whatever '*' is? in an array called kbdkeys, for the array item at index [i]?

stuck elbow
#

the asterisk in this place is a little tricky to explain

#

it lets you pass a list (or tuple) as parameters to a function as if you separated them with commas

#

for instance, instead of f(1, 2) you can have x = (1, 2) and then f(*x)

scarlet fjord
#

i see, ok

stuck elbow
#

you can also use two asterisks to pass a dict as keyword arguments, for example x = {'a': 1, 'b': 2} and then f(**x) gives you f(a=1, b=2)

#

don't worry if you don't understand now

#

you will get there

scarlet fjord
#

haha yeah i wasnt expecting to understand any of this right away ๐Ÿ˜…
theres just so much that i didnt expect to need to understand to get this to work ๐Ÿ˜›

#

the issue im having is this:

#

so

kbd_p1 = [Keycode.A, Keycode.S, Keycode.F]
kbd_p2 = Keycode.B
kbd_p3 = Keycode.C
kbd_p4 = Keycode.D

kbdkeys = [kbd_p1, kbd_p2, kbd_p3, kbd_p4]
keypress = kbdkeys[keyindex]

kbd.press(*keypress)```
#

gives an error:
TypeError: can't convert list to int

stuck elbow
#

which line?

scarlet fjord
#

File "main.py", line 49, in <module>

stuck elbow
#

which of those lines is the 49?

scarlet fjord
#

which in my code is a print str...

#

waiduminnit

#

yup, lol... changed the do thing but didnt change the print thing ๐Ÿ˜…

stuck elbow
#

it's always good to look at the line to which the error points, Python is a bit better than C in guessing where the error is

#

though of course it's not always perfect

scarlet fjord
#
 print("Pressed #%d" % *keypress)``` 
`SyntaxError: invalid syntax`? 
im assuming im not allowed to just do what i just did ๐Ÿ˜›
stuck elbow
#

yeah, you can only use * this way in a function call

scarlet fjord
#

fair

#

i commented those lines out for now

stuck elbow
#

this one is a bit tricky

#

because you can't use [] on an int

scarlet fjord
#

fair

#
   kbd.release(*keypress)```
`  File "main.py", line 48, in <module>
TypeError: 'int' object is not iterable`
stuck elbow
#

I suppose you could change the %d to %r

scarlet fjord
#

oooh is that like a type thing, so %d would be int, so i can change that to str or something?

stuck elbow
#

if you look carefully at Dan's example, he used 1-element tuples

#

yes, %s is string, %f is float, and %r gives you the "representation" of the object

scarlet fjord
#

ah

stuck elbow
#

which is basically what REPL displays

#

try kbd_p2 = [Keycode.B] etc.

scarlet fjord
#

oh, of course...

#

woohoo! thanks a bunch ๐Ÿ˜

#

@stuck elbow and @tulip sleet thank you both for your infinite wisdom and patience ๐Ÿ˜›

tulip sleet
#

np

fading solstice
#

@tulip sleet when building circuitpython 3, should i be using branch master or 3.x

tulip sleet
#

depends on what you're testing. master is now for nRF board development, but we are merging from 3.x to master. either is probably fine. if you're trying to pretend to be a regular user, use 3.x.

tidal kiln
#

@slender iron TLDR: something's up with busio.OneWire
deets follow...

#
Adafruit CircuitPython 2.3.1 on 2018-05-07; Adafruit Itsy Bitsy M0 Express with samd21g18
>>> import board, busio
>>> ow = busio.OneWire(board.D7)
>>> ow.write_bit(1)
#
Adafruit CircuitPython 3.0.0-rc.0 on 2018-06-18; Adafruit ItsyBitsy M0 Express with samd21g18
>>> import board, busio
>>> ow = busio.OneWire(board.D7)
>>> ow.write_bit(1)
#

and there can be additional confusion due to the fact that D5 is a special pin on the Itsy (the example should be updated to use something else)

#

@tulip sleet โฌ† FYI

stuck elbow
#

that is a looooong bit

tulip sleet
#

could you make an issue?

#

tnx

tidal kiln
#

sure thing

manic glacierBOT
strange pumice
idle owl
#

@strange pumice I would have thought so, but maybe not. I'm at a meeting. I'll take a look when I get home. Worst case, I'll upload the first version.

manic glacierBOT
raven canopy
#

just scanned over some of Adafruit_Blinka. very nice!! "Blinka, for all the things!" ๐Ÿ˜„

slender iron
#

@strange pumice I don't think so. I usually have github put in a bogus README temporarily. need me to?

raven canopy
#

haha. i just looked at that too, and was about to suggest the same thing (a bogus file). fork is definitely disabled since it is empty.

strange pumice
#

@slender iron if you don't mind placing a bogus file in there for me that would be great.

slender iron
#

kk

strange pumice
#

thanks...tryign now.

slender iron
#

๐Ÿ˜ƒ

idle owl
#

Back.

manic glacierBOT
#

I think it is beyond OneWire. I ran this test for DigitalInOut, since that is all that shared-modules/bitbangio/OneWire is doing:

Adafruit CircuitPython 3.0.0-alpha.1-737-gd1b3c3c-dirty on 2018-06-22; Metro M4 Express with samd51j19
>>> import board, digitalio
>>> d = digitalio.DigitalInOut(board.D11)
>>> d.switch_to_output(True, digitalio.DriveMode.PUSH_PULL)
>>> d.switch_to_input()
>>>

Same flatline result:
![digitalinou_switch_to_input_failure](https://user-images.g...

raven canopy
#

Front. Side-to-side. (yes, i did a desk dance while i said that out loud) ๐Ÿ•บ

idle owl
#

As well you should have!

manic glacierBOT
raven canopy
#

@tulip sleet so drive strength is probably a red herring? i trust that you and Scott are light years ahead of me on pin handling... ๐Ÿ˜„

#

and no errata or other datasheet goodness that points to DRVSTR.

manic glacierBOT
#

@sommersoft How did you decide to do digitalio.DriveMode.PUSH_PULL give no args to switch_to_input()?

shared-module/bitbangio/OneWire.c` does this:

void shared_module_bitbangio_onewire_write_bit(bitbangio_onewire_obj_t* self,
        bool bit) {
    common_hal_mcu_disable_interrupts();
    common_hal_digitalio_digitalinout_switch_to_output(&self->pin, false, DRIVE_MODE_OPEN_DRAIN);
    common_hal_mcu_delay_us(bit? 6 : 60);
    common_hal_digitalio_digitalinout_switch_to_inp...
tulip sleet
#

@raven canopy we could easily be wrong, it's just that the DRVSTR change was made a long time ago, and a similar change was also made in 2.x.

#

i am going to try a onewire device in old and newer 3.0's

manic glacierBOT
#

My initial test with OPEN_DRAIN didn't pull the pin high, since I'm using the pin directly. If I were using a OW device, the slave would be pulling it high; at least that is my understanding. So, I forced it with PUSH_PULL.

The no arg switch_to_input is because it defaults to PULL_NONE anyway.

I was really just trying to force the behavior of switching between modes, and being able to capture it with the Saleae.

tulip sleet
#

@raven canopy I don't want to discourage you at all from trying to debug this. I was just trying to understand why you did what you did. I think an interesting test would be to duplicate the OPEN_DRAIN and PULL_NONE settings, and re-test with an external pullup, since that's how the devices work. There may well be a port setting issue.

raven canopy
#

I was thinking of using Atmel Studio to verify that the pin config registers were changing accordingly. but, that was under my assumption that my test was "valid". i can keep poking at it. abstract testing is largely an experience base; my base is shallow. ๐Ÿ˜„

tulip sleet
#

I am testing with a DS18B20 temp sensor. I went all the way back to 3.0.0-alpha.2, and it doesn't work there either. Also verified 2.3.1 works. I am just scanning the OneWire bus for the device.

solar whale
#

watchhing tihis discussion made me think that the DHT is "like a one-wire" so I tried a DHT22 and it does work with master. Just FYI - probabbly of no help.

tulip sleet
#

@solar whale I looked, because that was intriguing. The DHT library uses pulseio, not bitbang, so it's not exercising the same paths.

#

@raven canopy I did comment out the DRVSTR setting, and it still doesn't work. But the way setting the pin value works is kinda different in 2.3.1 vs 3.0.0. Diff screenshot attached. The gpio_... routines in ASF4 actually do more than the register operations in 2.3.1. Worth looking at carefully. I also wonder if there's something wrong with the microsecond timer for some reason.

ruby atlas
#

@sharp rain were you using CP2.x or 3.x?

#

(I'm getting memory errors on my branch of CP3, trying master)

#

(Feather M0 express)

#

Huh, build error. make: *** No rule to make target `peripherals/samd/clocks.c', needed by `build-feather_m0_express/genhdr/qstr.i.last'. Stop. on newest master

#

Trying a fresh checkout

#

ah oops, git submodule update --init --recursive : forgot the --init

#

also fails on master 3.x

manic glacierBOT
#

I spent time on this and have OneWire working, if a bit erratically, with a DS18B20 temp sensor. Two issues:

  1. common_hal_digitalinout_set_pull() worked differently in 2.x vs. 3.0. In 2.x it always sets the port direction to input. In 3.0 it just set the pull-up/down/none bits, without forcing the direction to input. common_hal_digitalio_digitalinout_switch_to_input() was depending on the direction change, because it wasn't doing it itself explicitly. (Thanks to @sommersoft for lookin...
tulip sleet
#

I'll continue on this OneWire thing in the morning.

sweet wedge
#

Hello ... I'm new around here. Just began using CircuitPython last weekend. Would anyone know why the method described to install Mu with the plotter doesn't seem to work for me? Tried on both of my Macs following the steps described here: https://learn.adafruit.com/welcome-to-circuitpython?view=all#installing-mu-editor I've been using Mu just fine, wanted to try the plotter so I installed Homebrew, entered the next commands described. Each appeared to run successfully, but when I type Mu in Terminal ... "Command not found"

New to CircuitPython? This is the place to start.

manic glacierBOT
manic glacierBOT
#

just push the update, pca10056 will behave like feather52840 from now. I.e it needs bootloader + sd and can upload via dfu-flash.

I also update the flash (with jlink) target to update bootloader setting (mark app as valid and disable CRC checksum) so that we could flash circuitpython with jlink.

The dfu-related target is also moved from board.mk to common's Makefile since several files uses them now (details here https://github.com/adafruit/circuitpython/blob/nrf52840_usbboot/ports/nrf...

manic glacierBOT
#

I know this is on a different branch, so not really a problem, but for now I'm using the pca10056 board files for my own board and I don't want to use the bootloader on it just yet, so I think once we merge we should revert to not force the users to have a bootloader on non-feathers. I think we could maybe make it configurable with make flags like we do with softdevice, so when we build we could just specify make BOOTLOADER=0 or BOOTLOADER=1, we could do that with the feathers too, just f...

tulip sleet
#

@sweet wedge Did you type "mu" or "Mu" to run?

In any case, there is now a real installer for the Mac, available here: https://codewith.mu/ -- click the Download button. We'll be revising the Mu installation instructions imminently to reflect this rather than the complicated procedues described in the guide.

solar whale
#

@sweet wedge when imu is installed via the new MacOs installer, it isntalls to "Applications" as mu-editor and can be started by double clicking on the mu-editor icon -- it does not install a command line script to start it.

#

you can start if rom the command line by entering /Applications/mu-editor.app/Contents/MacOS/mu-editor

#

or even simple open -a mu-editor

tulip sleet
#

@solar whale thanks for elaborating

solar whale
#

I thought I'd finanlly give it a try myself!

sharp rain
#

@ruby atlas Its CP2.x but I'm using fairly basic python so I would be surprised if the code is not compatible.

ruby atlas
#

Compatible. Just out of memory.

timber mango
#

Any chance we can do something about very long usernames?
It's extremely annoying to me.
Not everybody is 25 years old.

stuck elbow
#

what do you mean?

timber mango
#

well your name is 7 letters and in lowercase.

#

right? Mine's 3 letters. 'adafuit' is 8 letters but one of them is an 'i' which takes up less room here (we use proportional fonts)

stuck elbow
#

I think I follow so far

timber mango
#

MYNAMEISJOEKAVEMAN is a bit larger than those examples.

stuck elbow
#

that is true, what of that?

timber mango
#

Well it's distracting and it serves no purpose here. It doesn't facilitate communication; it obstructs it.

stuck elbow
#

you lost me there

timber mango
#

MYNAMEISJOEKAVEMAN suppose I say

#

MYNAMEISJOEKAVEMAN lots of things that have no real value

#

MYNAMEISJOEKAVEMAN but in each utterance

stuck elbow
#

there is tab completion, so it doesn't really matter

timber mango
#

MYNAMEISJOEKAVEMAN I state that my name is joe kaveman

#

MYNAMEISJOEKAVEMAN in all caps.

#

I believe I've just illustrated the problem.

stuck elbow
#

let me change to my real name

#

is this better now?

timber mango
#

That's your real name though.

#

It looks like a real name and the eye forgives the length because it has a natural aesthetic quality about it.

#

(I think it's excessive practice for every single utterance, but it's your name and it's nice to see it once in a while).

#

Dido Florian Cloud de Bounevialle O'Malley Armstrong

is a real person's name, too.

#

But she uses 'Dido'. ;)

#

I'm back quiet (and afk).

manic glacierBOT
#

Ah, The bootloader is placed at the end of the flash, the application address is the same in both cases. However, the bootloader did perform a checksum to decide if the application (circuitpython) is valid. This memwr will set it to 0 ( disable crc ). So yes, you could simply make flash it now, I use it as well, to just speed up the testing here :D

https://github.com/adafruit/circuitpython/blob/nrf52840_usbboot/ports/nrf/Makefile#L259

![image](https://user-images.githubusercontent.com/...

sweet wedge
#

@tulip sleet @solar whale Thank you both. I ran the new installer you linked to Dan, and I'm in-business including the plotter. With the old method, I had tried typing mu and when it didn't work, tried Mu ... no luck either way. Anyway thanks again!

tulip sleet
#

@slender iron I'm out for a couple of hours. Working on fixing OneWire. It's really mostly a fix to DigitalInOut.c, but the timing is still flaky sometimes because calling tick_delay(small numbers of microseconds) is not always accurate. Using some NOP loops but need to tune it.

slender iron
#

@tulip sleet k. it could be related to the monotonic issues notro reported

tulip sleet
#

i don't know if those issues are cause or effect. I think the time it takes to go through tick_delay varies depending on whether it's on a ms boundary or not and maybe other stuff.

#

onewire turns off interrupts but needs to do delays of like 6us, which is not always accurate, it appears. I get CRC errors from the DS18B20 on and off. Didn't see these on 2.3.1.

#

i think we can't use pulseio because it has to be an open-drain output, which is simulated by switching back and forth to an input

stuck elbow
#

I hate time-based protocols

ruby lake
#

time-division multiplex forever ๐Ÿ˜‰

manic glacierBOT
teal bear
#

"OUT OF STOCK" ๐Ÿ˜ฎ any guess to how soon they will be shipping again?

raven canopy
#

Usually that is answered in terms of "few weeks". Depends on what "they" you are referring to. At any rate, best suggestion is to use the "Notify" button; it's usually the best and quickest indicator. @teal bear

timber mango
#

If it's a good selling new item you have to watch it manually. ;)

teal bear
#

thanks - isn't this the CPX channel? (that's the they I was hoping to buy

timber mango
#

I've been burned several times by thinking 'Notify' was going to give me a good shot at a newly introduced item.

#

CarlFK there are no channels that are board specific. ;)

teal bear
#

what else does circuitpyuthon run on?

timber mango
#

Every SAMD21 board (M0 is usually in the name).

#

Feather M0 Express. Metro M0 Express. Gemma M0. Trinket M0. ..

timber mango
#

The ones without 'Express' in the name usually don't have a 2MB SPI flashROM on them, and so even when they run CircuitPython, there are restrictions on how large a library can be stored on the target board at any one time.

#

The 'Express' ones all have 2MB SPI flashROM and can hold the entire populated /lib folder.

teal bear
#

neat - thanks

#

i the cpx was more expensive I might look at the smaller ones .. but for $25 it's hard to justify going cheaper

timber mango
#

The form factor is an important aspect of the CPX as well as the wide variety of sensors.

teal bear
#

I show them to people that want to learn Python and they keep trying to buy mine

timber mango
#

Haha yeah have a few spares to sell!

teal bear
#

so today I decided to to finely do that... and Bzzz

timber mango
#

What happened?

raven canopy
idle owl
#

@tulip sleet Do you want me to wait for Scott to review this or merge it?

tulip sleet
#

@idle owl thanks, it was fine you did

solar whale
#

@tulip sleet did you run into any issues with servos getting very hot with the extended min/max pulse limits?

tulip sleet
#

@solar whale, i didn't really test that, I was just looking at the angle. I think the 550-2400 is a compromise, some are wider

#

have you seen that?

solar whale
#

OK - I did some playing when I first got my CRIKIT and one servo go vry hot when I pushed the limits out. Not an exhaustive test. I did not repeat the test ๐Ÿ˜‰

#

not sure if it was the limit or something else I did. It kept working.

#

I'll try to reproduce it int the next few days. more systematically.

tulip sleet
#

I went to the Tower Pro website and they don't actually seem to give the specs for pulse width! I am giong to ask CGrover

#

he added one extra to some info the library

solar whale
#

I had the same issue about needing more range.

tulip sleet
#

I think if you go too far and hit the stops it wil get hot

#

so just back off a little

#

1000-2000 is clearly too low

solar whale
#

right -- can you ht the stops with those limits?

#

agreed!

tulip sleet
#

I think it is just shy of the stops. I just tested the micro servo and the continuous servo

solar whale
#

I don't recall how far I went. sorry.

tulip sleet
#

that's ok, I think it's trial and error.

solar whale
#

it seems to be a bit empirical!

tulip sleet
#

there may be sample variation as well

#

I did a bunch of googling and came up with very little, which I don't really understand. I thought the RC world would be all over this issue

solar whale
#

just something to watch out for

tulip sleet
#

ya, I'll ping @errant grail now - he's offline. @errant grail, how did you come up with the pulse limits for the servo you put in a PR to the motor library, and do you know in general where this stuff is documented and explained?

solar whale
#

thanks - I was surprised how hot it got, but it recovered nicely when I stopped!

tulip sleet
solar whale
#

I'm not objecting to the change. Just curious if others have seen issues. Again, I need to do more systematic testing.

#

what will 3.7 break ๐Ÿ˜‰

#

Its going to take me a day to clear enough space on the workbench to test servos again! I'm buried in radios....

errant grail
#

@tulip sleet The values I provided were for just the Tower SG92R servo. Those values were determined experimentally using a batch of three servos recently purchased from the Adafruit store. I subtracted 5% from the empirically-measured range to determine new recommended values. I searched far and wide for specifications or guidance on those specific servos, but found nothing. A suggestion would be to provide an obvious note in the examples that the values can vary from batch to batch and that driving the servo to the min or max physical positions can cause permanent damage.

tulip sleet
#

Sounds like a good idea. We can add that. A guide is underway as well. Thanks! Yes, the whole thing seems to be poorly documented. Maybe in RC applications one rarely goes to the limits?

errant grail
#

My dad was an avid RC enthusiast and rarely pushed the limits of servos. Having trim and gain always handy on the controller helps, too. Wish the hobby servos were smarter about that -- mechanically and electrically.

#

( Sorry about the delay in my response. I missed S&T and AskEng, too. ๐Ÿ˜ฆ )

tulip sleet
#

no problem - I was just making a new motor library release and noticed you gave some servo data and thought maybe you had insider knowledge.

solar whale
#

Thanks @tulip sleet and @errant grail - glad I'm not only one finding it hard to get clear guidance for the servo limits

errant grail
#

I'm wondering if the servo universe will change now that Tower is out of the picture. I wonder who (in China) really makes the Tower servos...

tulip sleet
#

what do you mean?

#

they say their servos are counterfeited a lot

errant grail
#

Tower/Hobbico selective product lines were sold to Horizon Hobbies, I believe. Many of the parts I use are out of stock on the current Tower site.

solar whale
#

Bed time here - good night all! -- I will try to set up some servo testing tomorrow.

tulip sleet
errant grail
#

@tulip sleet That's good news. Have been ordering Tower servos from Tower Hobbies for so long I thought they were the same. ๐Ÿ˜œ

tulip sleet
#

out of my bailiwick

#

good night!

umbral dagger
#

I'm seeing some odd behaviour that I haven't found an explaination for. ItsyBitsyM0 Express. Double reset goes into bootloader mode fine. Drop the uf2 onto it (CP3rc0). ITSYBOOT unmounts, but CIRCUITPY never mounts. Reset does get it to mount either. The dotstar indicates that it's in the CP runtime (solid green). Thoughts?

#

I can load an arduino sketch with no problem.

errant grail
#

Just did the same with the ItsyM0x this morning and didn't encounter any issues. FYI

umbral dagger
#

Yeah, I've been using them since they came out.

manic glacierBOT
manic glacierBOT
tulip sleet
#

@umbral dagger which OS and version? Try changing ports and rebooting, especially for Linux and Mac. If that doesnt' work, try beta.1 and see if it's different, and 2.3.1 if necessary? Post an issue if it seems consistent. Thanks.

umbral dagger
#

Latest Ubuntu. I lost bootloader mode at one point, but a reboot fixed that. Changing from a hub to a frontpanel USB port doesnโ€™t bring back CIRCUITPY.

stuck elbow
#

@umbral dagger can you do os.listdir() from the repl?

#

@umbral dagger the circuitpy disk won't mount if the filesystem is corrupt

#

or otherwise inaccessible

umbral dagger
#

I donโ€™t get a REPL. No presence at all.

#

My next step is to reformat in C I guess.

stuck elbow
#

does the dmesg say anything about failed usb devices?

#

tried a different usb cable?

tulip sleet
#

did you try on an another computer? did you reload the .uf2?

umbral dagger
#

Itโ€™s a cable Iโ€™ve been using successfully before this.

tulip sleet
#

make sure it's the right .uf2 for the board

umbral dagger
#

reload the uf2, yes.

#

it is

solar whale
#

@umbral dagger - just my experience -- on my Ubuntu system -- the CIRCUITPY drive often shows up in the file manager but does not auto mount. Clicking on the drive icon mounts it and I can copy file to it -although drag/drop often does not work in the file manager.

stuck elbow
#

for me it often mounts, but the directory is read-only, I have to do chmod +w .

fading solstice
#

@umbral dagger i built circuitpython on my ubuntu machine from source and had the same problem as you. i was thinking i did not have my machine tools installed correctly. are you also building circutpython from source?

solar whale
#

nevermind - if you are not getting REPL, its a different issue. I can always get to REPL

tulip sleet
#

solid green is unusual, usually it's pulsing green

umbral dagger
#

@fading solstice No, using the release uf2

solar whale
tulip sleet
#

yes, "steady GREEN: code.py (or code.txt, main.py, or main.txt) is running"

#

what was in the main.py? anything unusual?

#

"adafruit-circuitpython-itsybitsy_m0_express-3.0.0-rc.0.uf2", right?

solar whale
#

@umbral dagger when you connect it does /dev/ttyACM0 or any /dev/ttyACMx appear ? just wondering if when you connect to REPL, soes it connect but not respnd (possibly running code) or does it fail to connect at all.

umbral dagger
#

@tulip sleet yes

#

The board was fresh from the factory, so whatever demo code was preloaded.

#

@solar whale ttyACM0 shows up, screen connects but thereโ€™s nothing responding. Unplug and screen exits. (ttyACM0 goes away)

tulip sleet
#

so ctrl-C more than once does nothing

solar whale
#

sounds like it is booting and running.

tulip sleet
#

it was probably loaded with 2.3.1, so the lib directory is 2.x .mpy's. Can you load 2.3.1?

solar whale
#

is there an itsybity_m0 eraser

tulip sleet
#

no

#

if 2.3.1 can be loaded, then try getting to repl there, and easy to erase fs from repl

#

i could build one, just haven't

solar whale
#

let me check - I may have built one...

tulip sleet
#

but @umbral dagger try 2.3.1 first

#

i imagine lots of things going on we can't see ๐Ÿ˜ƒ

solar whale
#

I do have a .uf2 that will create a new FS - built in April --- I can post it if useful.

umbral dagger
#

@tulip sleet Will do

scarlet fjord
#

hello it me again with another question ๐Ÿ˜…
following this tutorial for more GPIO on my Feather M0 Express:
https://learn.adafruit.com/using-mcp23008-mcp23017-with-circuitpython/software
it makes mention of the I2C addresses:
Either class initializer can also be passed an optional address keyword to override the I2C address
but it doesnt say how to use those address keywords.
i have two MCP23017 chips, one at 0x20 and one at 0x24, but i dont see how to tell CircuitPython that?

How to wire up and use the MCP230xx I2C I/O extender with CircuitPython!

tulip sleet
#

mcp = adafruit_mcp230xx.MCP23017(i2c, address=0x24)

scarlet fjord
#

does the library have any way of inverting the pin value?

#

cause the MCP23017 can be set up as pullup inputs, which would give False if the switch is pressed, and that is confusing to me ๐Ÿ˜…

#

unless im dumb and it can also be configured as pull-down?

tulip sleet
#

looks like there are only pull-ups. I know it's confusing, but kinda typical to use pull-ups instead of pull-downs, so I'm afraid you'll have to live with it. you could write a helper function in Python to invert the value if you don't want to do if not blah.value

#

I added an example of using address= to the guide.

ruby lake
#

"active low"

umbral dagger
#

@tulip sleet 2.3.1 works fine

#

3.0rc0 works fine on a different ItsyBitsyM0Express board

solar whale
#

in 2.3.1 you can erase the FS import storage storage.erase_filesystem() then reload 3.0 -- but @tulip sleet may have had other things to check first.

tulip sleet
#

@umbral dagger if there is a main.py/code.py you could rename it in 2.3.1 and see if 3.0.0rc0 starts, or just erase the filesystem in 2.3.1 and see how 3.0.0rc0 works

umbral dagger
#

@solar whale That did it. It now seems fine in 3.0

#

I'm so bleeding edge.... never occurred to me to go "back" to 2.3.1

#

interesting...

solar whale
#

was the othe IitsyBityM0 you tried also "fresh" that is did it have the same 2.3.1 based main.py and libs on it?

umbral dagger
#

It would have initially, but I've been working with it for a while. This "new" one was from the saem order. It's been built into a project (i.e. I wanted a headerless one) so I grabbed a fresh one from the drawer.

solar whale
#

As Dan said, probaly 3.0 did not like trying to run the .mpys from the 2.3.1 lib. Still a bit surpriing there was no way to "break" out in the REPL.

tulip sleet
#

i have no idea what the demo main.py was that caused it to not work

solar whale
#

it loads a lot of modules and checks a lot of pins!

tulip sleet
#

it should fail really early on the imports

#

out for 1.5 hours or so

scarlet fjord
#

is there any way to ask the adafruit feather what sort of devices are connected to it over i2c, and specifically what addresses those devices have?

#

nvm, taking the picture helped, that darned resistor there was plugged in to the wrong thing

stuck elbow
#

@scarlet fjord you can do i2c.scan()

#

@scarlet fjord you have to do i2c.try_lock() before that, though

fading solstice
#

@tulip sleet I am trying to build metro m4 circuitpython from github source. it build (with a warning), but emits a uf2. when i copy the uf2 to my metro m4, i get the exact same behavior as dastels. maybe my machine does not have the coreect setup. is there a doc i should be following to setup my machine. UBUNTU 16.04

scarlet fjord
#

oh cool, thanks for letting me know ๐Ÿ˜ƒ
ive figured that out now though, it was just that resistor not doing its job that caused them to not be detected ๐Ÿ˜…

#

hmm...
File "main.py", line 27, in <module> MemoryError: memory allocation failed, allocating 584 bytes
all im doing is this:

line: 17    pin00 = mcp1.get_pin(0)
line: 18    pin01 = mcp1.get_pin(1)
line: 19    pin02 = mcp1.get_pin(2)
line: 20    pin03 = mcp1.get_pin(3)
line: 21    pin04 = mcp1.get_pin(4)
line: 22    pin05 = mcp1.get_pin(5)
line: 23    pin06 = mcp1.get_pin(6)
line: 24    pin07 = mcp1.get_pin(7)
line: 25    pin08 = mcp1.get_pin(8)
line: 26    pin09 = mcp1.get_pin(9)
line: 27    pin10 = mcp1.get_pin(10)
line: 28    pin11 = mcp1.get_pin(11)
line: 29    pin12 = mcp1.get_pin(12)
line: 30    pin13 = mcp1.get_pin(13)
line: 31    pin14 = mcp1.get_pin(14)
line: 32    pin15 = mcp1.get_pin(15)

have i hit some memory limit im not aware of or something??

solar whale
#

@fading solstice if you reset the Metro M4 - what does the LED show ? if you type `ls /dev/ttyACM*' do you see anything?

stuck elbow
#

@scarlet fjord you ran out of memory, but that's strange if it's the only thing your program is doing

scarlet fjord
#

its not all im doing, but... im not doing much? i dont think...

fading solstice
#

the serial port does not connect on Ubuntu and does not connect to Window 10. the rgb led is solid green

#

the metroboot shows after double click

scarlet fjord
#

i did a thing and now it does this:
File "adafruit_hid/keycode.py", line 31, in <module> File "adafruit_hid/keycode.py", line 165, in Keycode MemoryError: memory allocation failed, allocating 584 bytes

fading solstice
#

circuitpy does not show

solar whale
#

does screen /dev/ttyACM0 connect

fading solstice
#

@solar whale no

stuck elbow
#

weird that it's always 584 bytes...

#

as if the error was happening in some interrupt

solar whale
#

does ls /dev/ttyACM* show anything -- may conenct as ACM1...

fading solstice
#

@tulip sleet @solar whale nothing connected. BTW last 3.0 release uf2 works.

#

I did the erase_filesystem trick. did not help

#

same on windows 10

solar whale
#

intereseting -- do you have a main.py or code. py on the baord?

fading solstice
#

no

solar whale
#

one thing to try is boot a working 3.0 version and erase the FS then reload RC0

fading solstice
#
 extern mp_obj_tuple_t common_hal_usb_hid_devices;
                       ^
common-hal/usb_hid/__init__.c:127:16: note: 'common_hal_usb_hid_devices' was previously declared here
 mp_obj_tuple_t common_hal_usb_hid_devices = {
                ^

solar whale
#

that is normal

fading solstice
#

ok thanks

scarlet fjord
#

@stuck elbow is there anything i can do? im at an impasse here, i have no idea how to progress

solar whale
#

its a known issue with -lto and the frozen modules

fading solstice
#

oh, anything to get around it?

solar whale
#

the solid green LED indicates the Metro is running somthing --- odd

#

It is just a warning -- not a problem

#

no need to do anything about it

fading solstice
#

if i was able to build a uf2, then either my machine is not setup correctly or the source i am build is incorrect

solar whale
#

are you building current master?

fading solstice
#

i tried master then i tried 3.x. same result from both

solar whale
#
git submodule foreach --recursive 'git fetch --tags'
scarlet fjord
#

i cut 39 lines of code (all variable assignments identical to above) and i got the number to go up ๐Ÿ™ƒ

  File "adafruit_hid/keycode.py", line 195, in Keycode
MemoryError: memory allocation failed, allocating 776 bytes```
solar whale
#

try running thos commands after you do git pull in master

fading solstice
#

i used git fetch adafruit; git pull adafruit. i am thinking i should try to clone the source instead

#

@solar whale i see your message now. i did the first, but not the second

solar whale
#

try the second -- won't hur t ๐Ÿ˜‰

fading solstice
#

if the second is important we should update doc

#

i will try it thanks

stuck elbow
#

@scarlet fjord I suppose you can save memory by using the mcp1.gpio() method directly, instead of creating all those pin objects

solar whale
#

@fading solstice see if it helps -- it may depend on the version of git running. It has been a recent change needing it for me. @tulip sleet is more familiar with the reason for it.

scarlet fjord
#

oh, how does that work? @stuck elbow

stuck elbow
#

are you reading or writing?

solar whale
#

@fading solstice jsut to be sure, you are using a "new" metro M4, not one of the older "revbs"

scarlet fjord
#

how much memory should i have access to? im really not doing all that much

#

im reading, i think
listening for switches

stuck elbow
#

oh, sorry, gpio is a property, not a method, so you simply read it, and it gives you a value where each bit corresponds to a state of pin

strange pumice
stuck elbow
#

so for example to check if the first pin is high, you would do if mcp1.gpio & 0x01:

#

for third it would be & 0x04 etc.

#

using powers of two

solar whale
#

@fading solstice if you load a working 3.0 into the board and at the repl tyrp import os os.listdir() what do you see?

stuck elbow
#

0x01, 0x02, 0x04, 0x08, 0x0f, 0x10, 0x20, 0x40, 0x80, 0xf0

fading solstice
#

@solar whale

#
>>> import os
>>> os.listdir()
['.fseventsd', '.metadata_never_index', '.Trashes', 'boot_out.txt']
scarlet fjord
#

what if i want to read the state of all 16 pins from 3 MCP23017 chips? surely id need to make an array of all the pins and read them in a for loop, instead of writing out a lot of if mcp1.gpio & 0x01?
whats different between mcp1.gpio() and mcp1.get_pin()?

stuck elbow
#

@scarlet fjord what do you plan to do with the values once you read them?

fading solstice
#

@solar whale the board is the Metro M4 Express BETA

solar whale
#

ok - that shpuld be fine.

scarlet fjord
#

im trying to make a keyboard, so i have a list of keys and a list of what those keys do, then a for loop that runs and checks each key to see if its pressed then passes on the keycodes that that key presses over USB as a HID if that key was pressed

fading solstice
#

@solar whale i rebuit with the extra git command. same result

stuck elbow
#

@scarlet fjord ok, so perhaps something like this will work:

solar whale
#

@fading solstice did you do make BOARD=metro_m4_express clean make BOARD=metro_m4_express that is make clean first

fading solstice
#

that is what i do all the time

stuck elbow
#
for mcp_id, pressed in enumerate([mcp1.gpio, mcp2.gpio, mcp3.gpio]):
    for bit in range(8):
        if pressed & 1 << bit:
            print("key %d of chip %d has been pressed" % (bit, mcp_id))
solar whale
#

running out of ideas -- hopefully Dan will have magic answer when he gets back.

stuck elbow
#

(you might need to negate it)

solar whale
#

does dmesg shown anything about the USB connection when if you run it after a RESET of the board

stuck elbow
#

1 << bit calculates the power of 2 corresponding to the bit

scarlet fjord
#

woah that looks fancy
idk what it does, but ima try it out? ๐Ÿ˜…

stuck elbow
#

@scarlet fjord you might need to enable the pullups with mcp1.gppu = 0xff first

#

aaaand I found a bug

#

this won't work

scarlet fjord
#

im assuming i have to set them as inputs too?

stuck elbow
#

they are inputs by default iirc

fading solstice
#

@solar whale the METROBOOT has a connection, but after the uf2 is coopied and after a single click reset, no connections are logged

solar whale
#

it is METROM4BOOT, correct?

fading solstice
#

sorry yes

solar whale
#

whew ๐Ÿ˜‰

fading solstice
#

@solar whale just to make sure i am doing the right thing. cd circuitpython; cd ports; cd atmel-samd; make clean BUILD=metro_m4_express; make BUILD=metro_m4_express

solar whale
#

looks correct (as long as you spell BUILD correct on the second make ๐Ÿ˜‰ -- then copy the build_metro_m4_express/firmware.uf2 to the METROM4BOOT

fading solstice
#

right

#

i am doing a clean clone from github with a build

solar whale
#

just for a test, I can post a .uf2 I have built and used.

fading solstice
#

sure

solar whale
fading solstice
#

@solar whale that worked.

solar whale
#

that is very odd -- it was from 2 days ago

#

I can do a ne pull and buld - but I can't test it if you want to try it.

fading solstice
#

yes i will

solar whale
#

building - just a sec

fading solstice
#

thx

solar whale
scarlet fjord
#

well its 2:30 am and i need sleep, but if anyone wants to have a dig through and figure out why im running in to memory issues when using the adafruit_hid.keycode library, that would be really cool...
Just @me and ill see it in the morning ๐Ÿ˜ฌ
(for context, the keycodes im defining in macros are arbitrary and random at the moment, i just wanted something there)

fading solstice
#

@solar whale yeah, that worked as well.

#

has to be something wrong with my environment

solar whale
#

weird - waht arm-none-eabi-gcc are you running -- I have 7.2.1

fading solstice
#

how to i tell

solar whale
#

arm-none-eabi-gcc -v

fading solstice
#

gcc version 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204] (GNU Tools for Arm Embedded Processors 7-2017-q4-major)

solar whale
#

same -- one other suggestion -- after you cloned did you build mpy -cross -- make -C mpy-cross

fading solstice
#

no, i thought that was automatic

#

cd ..

solar whale
#

not sure -- worth a try. If for some reason it is building 2.x versions ....

#

at top level make -C mpy-cross

idle owl
#

@tulip sleet @slender iron I'll be out for a couple of hours this morning/afternoon. Should be back before 2pm.

solar whale
#

then rebuild the .uf2

#

also jsut to be sure, git branch shows you on master, correct?

fading solstice
#

@solar whale master branch, rebuilt after building mpy-cross; still fails ๐Ÿ˜ฃ

solar whale
#

๐Ÿ˜ฆ sigh

fading solstice
#

do you have the same number of bytes as me?

#
4068 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).

Create metro_m4_express/firmware.bin
Create metro_m4_express/firmware.uf2
../../tools/uf2/utils/uf2conv.py -b 0x2000 -c -o metro_m4_express/firmware.uf2 metro_m4_express/firmware.bin
Converting to uf2, output size: 457216, start address: 0x2000
Wrote 457216 bytes to metro_m4_express/firmware.uf2.
solar whale
#
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
install -d build-metro_m4_express/genhdr
python3 tools/gen_usb_descriptor.py \
    --manufacturer "Adafruit Industries LLC"\
    --product "Metro M4 Express"\
    --vid 0x239A\
    --pid 0x8021\
    --output_c_file build-metro_m4_express/autogen_usb_descriptor.c\
    --output_h_file build-metro_m4_express/genhdr/autogen_usb_descriptor.h
Generating build-metro_m4_express/genhdr/mpversion.h
GEN build-metro_m4_express/genhdr/qstr.i.last
QSTR updated
GEN build-metro_m4_express/genhdr/qstrdefs.generated.h
../../shared-bindings/usb_hid/__init__.h:33:23: warning: size of 'common_hal_usb_hid_devices' differ from the size of original declaration [-Wlto-type-mismatch]
 extern mp_obj_tuple_t common_hal_usb_hid_devices;
                       ^
common-hal/usb_hid/__init__.c:127:16: note: 'common_hal_usb_hid_devices' was previously declared here
 mp_obj_tuple_t common_hal_usb_hid_devices = {
                ^

276476 bytes free in flash out of 499712 bytes ( 488.0 kb ).
49104 bytes free in ram for stack out of 196608 bytes ( 192.0 kb ).

Create build-metro_m4_express/firmware.bin
Create build-metro_m4_express/firmware.uf2
../../tools/uf2/utils/uf2conv.py -b 0x4000 -c -o build-metro_m4_express/firmware.uf2 build-metro_m4_express/firmware.bin
Converting to uf2, output size: 446976, start address: 0x4000
Wrote 446976 bytes to build-metro_m4_express/firmware.uf2.
fading solstice
#

should be same shouldn't it?

#

not even close

solar whale
#

not entirely sure

fading solstice
#
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
install -d metro_m4_express/genhdr
python3 tools/gen_usb_descriptor.py \
    --manufacturer "Adafruit Industries LLC"\
    --product "Metro M0 Express"\
    --vid 0x239A\
    --pid 0x8014\
    --output_c_file metro_m4_express/autogen_usb_descriptor.c\
    --output_h_file metro_m4_express/genhdr/autogen_usb_descriptor.h
Generating metro_m4_express/genhdr/mpversion.h
GEN metro_m4_express/genhdr/qstr.i.last
QSTR updated
GEN metro_m4_express/genhdr/qstrdefs.generated.h
../../shared-bindings/usb_hid/__init__.h:33:23: warning: size of 'common_hal_usb_hid_devices' differ from the size of original declaration [-Wlto-type-mismatch]
 extern mp_obj_tuple_t common_hal_usb_hid_devices;
                       ^
common-hal/usb_hid/__init__.c:127:16: note: 'common_hal_usb_hid_devices' was previously declared here
 mp_obj_tuple_t common_hal_usb_hid_devices = {
                ^

25168 bytes free in flash out of 253696 bytes ( 247.75 kb ).
4068 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).

Create metro_m4_express/firmware.bin
Create metro_m4_express/firmware.uf2
../../tools/uf2/utils/uf2conv.py -b 0x2000 -c -o metro_m4_express/firmware.uf2 metro_m4_express/firmware.bin
Converting to uf2, output size: 457216, start address: 0x2000
Wrote 457216 bytes to metro_m4_express/firmware.uf2.
#

@solar whale even the first part is different for example

#
    --output_h_file build-metro_m4_express/genhdr/autogen_usb_descriptor.h```
#

is different

solar whale
#

ooh - that is odd

#

the pid is differnent

fading solstice
#

in yours every file is prefaced with "build-"

#

how is the pid used

solar whale
#

I "think" it identifies the board configuration. -- may be mistaken.

#

if you type git diff master do you get any output

fading solstice
#

no output

#

the python3 command is generating the usb descriptor

#

i think we are getting somewhere byt i don;r know where

solar whale
#

do you see a folder name metro_m4_express as well as a build_metro_m4_express?

fading solstice
#

in atmel-samd? no

solar whale
#

good

fading solstice
#

just metro_m4_express

solar whale
#

oh - I have build_metro_m4_express -- that is odd

#

ahhh --- igot it

#

use make BOARD=metro_m4_express not BUILD

fading solstice
#

oMg

#

i am so sorry

#

i will try that

solar whale
#

the defaiultfor BOARD is metro_mo_express -- see Makefile

fading solstice
#

ok, that has to be it

stuck elbow
#

why is there a default?

fading solstice
#

thank s thanks.

solar whale
#

@stuck elbow good question

#

@fading solstice the build will go in build_metro_m4_express

#

you can (and were) renaming that via the BUILD parameter

#

@stuck elbow was taht just a typo you are fixing in the MCP230xx -- looks good to me - do you want me to reviewi it

#

I can't test it

#

@stuck elbow never-mind - it's done!

#

@fading solstice is it working OK now?

fading solstice
#

@solar whale you are the best. i was blind and you have allowed to see. it works!

solar whale
#

Excellent! I was really puzzled -- I was going to suggest standing on your left foot next ๐Ÿ˜‰

fading solstice
#

i might suggest a change to the makefile that requires a BOARD

solar whale
#

seems reasonable -- with so many boards, it's not clear a default is helpful

tulip sleet
#

@fading solstice PR's gratefully accepted

manic glacierBOT
#

Hmm, strange, I just tested with master and I was able to mount without any errors. You said 3.x still works, so I guess it's not your sdcard or the board you use for it.

I think the error comes from here https://github.com/adafruit/circuitpython/blob/master/shared-module/storage/__init__.c#L39 which would mean that the vfs = ... call fails and return None, could you verify by printing vfs before you call mount?

tidal kiln
manic glacierBOT
#

@hathach Hmm, I thought this bootloader was meant to work like the CPX where you normally get a MSC for dropping .py files and then when you reset with double press/similar you get uf2 drive, but I flashed the bootloader and I always get the uf2 drive, I even tried to put P0.11 and P0.12 low/high to simulate buttons not being pressed. Am I doing something wrong or is this not implemented yet?

tulip sleet
#

@tidal kiln I think it may just work fine, since uf2 bootloaders work on trinket and gemma. only issue is if the pin mappings are different on Feather M0 Basic vs Feather M0 Express. I'll look.

meager fog
#

@tulip sleet replied

tulip sleet
#

@tidal kiln pin mappings are almost the same. no NeoPixel on Feather basic, so that wouldn't work and the USB PID would be wrong, but not a big deal to change.

meager fog
#

we're putting in some feather m4's today!

#

i know nobody here wants em

#

just throws all the feather m4's in the trash

#

scatters them to the wind

#

j/k! lots for everyone!

#

they are being QA'd now ๐Ÿ˜„

errant grail
#

Time to spend some $$!

#

... and just in time. I'm giving a CPy talk at our local makerspace tonight. They'll be excited to hear that it's real!

slender iron
#

just got my odroid-go ๐Ÿ˜ƒ

errant grail
#

Had a late-night idea a few days ago for a CPy-based musical instrument. They just published the learning guide for it today. Woo hoo! https://learn.adafruit.com/blues-playground blinka ๐Ÿฅ ๐ŸŽต

Do you feel like singin' the blues but don't have time for music lessons? No problem! You and your buddies can jam the blues on a Circuit Playground Express without a rehearsal!

meager fog
#

@errant grail nice work, this was a cool guide!

errant grail
#

Thanks! I had a lot of fun making it and playing it!

solar whale
#

@errant grail Amazing. Nice guide.

idle owl
slender iron
#

@idle owl I'll take a peek

main meteor
#

I've been looking forward to a Feather M4. I managed to snatch an ItsyBitsy M4 before they were all gone again (I'm aiming to build a CRT art project out of it, using the 2 DACs for X and Y signals). I can't help wondering if there will be a Trinket M4, or is that just silly.

tidal kiln
main meteor
#

Oooo, I hadn't! That's cool! I wonder what the mighty M4 can do with that. I should grab some clip leads and play with it (I don't have the ItsyBitsy M4 in my hot little hand yet, but I have a Metro M4).

meager fog
#

we've got some more itsy m4s in stock

#

trinket m4 is a bit unlikely for now since the chip is bga

#

and i think itsy does a good job

#

of 'small powerul'

#

@ruby lake ping pong

#

we'll get more in stock shortly but this is the first bath

#

ch

errant grail
#

I used the trinket on quite a few projects where the number of GPIO pins was perfect. Kept things really small. Designed some Trinket-compatible doublers and other PCB interfaces based on the form/factor/pinout. Sad to hear that it may not make it to the next generation, but I'm slowly overcoming that and moving on... ๐Ÿ˜‰

meager fog
#

well ya never know - its just not a high priority is all ๐Ÿ˜ƒ

main meteor
#

I just realized the AdaFruit Discord icons don't include a feather!

errant grail
meager fog
#

wow

#

thats pretty epic ๐Ÿ˜„

#

maybe i should make a trinket m4 ๐Ÿ˜„

errant grail
#

Trinket OCD

ruby lake
#

@meager fog Just ordered a couple ๐Ÿ˜‰

meager fog
#

@ruby lake i should have labeled the D+ D- pads "FOR OLDCROW USAGE ONLY" ๐Ÿ˜„

ruby lake
#

"crow's feathers"

meager fog
#

but i think this design should satisfy your synthneeds - we put as many i2s pins as we could fit ๐Ÿ˜ƒ

slender iron
#

@river quest we need a feather emoji

meager fog
#

we have a feather logo

idle owl
#

Oh yeah, the drifting feather.

ruby lake
#

I will work out the next board for it, will be a bit wider

stuck elbow
#

@errant grail I will be making a trinket ocarina next month

#

for the hackaday prize

errant grail
#

@stuck elbow Very cool. With a pressure sensor?

stuck elbow
#

yup

#

and a straw

#

and touch pads

errant grail
#

... with a touch pad array for note bends.

#

Your ocarina project sounds interesting. I'll be watching for details...

stuck elbow
#

I was thinking about BMP280

#

in fact, I should probably start designing the PCB if I want it to arrive next month

#

do we have usb midi support for circuitpython?

errant grail
#

That sensor should work nicely. The harmonica design needs 10 independent sensors, though.

meager fog
#

we're making more feather m4s - sign up if you missed out

errant grail
#

I've played around with MIDI on CPy a lot. There's nothing native, but CPy is pretty capable. The versions on M4 will be fantastic.

opaque patrol
#

How long did it take, I was 15 minutes after the email and already gone

meager fog
#

yeah sorry they went fast

#

but really we've got more coming

errant grail
#

bummer. I put two in my cart when they were available, was adding other items and the M4s were dropped.

meager fog
#

n000

errant grail
#

I'll be patient.

opaque patrol
#

That happened to me yesterday with the Metro M4

ruby lake
#

gotta move fast

errant grail
#

High demand is a good thing.

main meteor
#

Get your enamal pins fast, too.

opaque patrol
#

(And the arcade feather ๐Ÿ˜ƒ )

stuck elbow
#

@errant grail I was thinking about just doing pwm, or maybe a bit nicer DAC output, but with midi, I could actually skip the speaker and make it a usb midi device

#

saves me a pin

ruby lake
#

I see a ping from ladyada and I don't even look here, I just go see if they are in stock on the site ๐Ÿ˜‰

meager fog
#

lollll

errant grail
#

@stuck elbow You can get some nicely natural sounds out of dedicated MIDI voice modules or add-ins that include the ability to respond to expression as well.

meager fog
#

thaz rite!

stuck elbow
#

@errant grail but I have no idea about midi, so unless there is something ready, I think I will go for the built-in speaker

errant grail
#

That's simpler and more portable, too.

ruby lake
#

n-voice key assigner in cp runs on the m0, m4 will be quick

stuck elbow
#

yeah, with a coin cell

manic glacierBOT
#

@arturo182 ah, yes, nice catch, the bootloader address is written to ucir for its detection.

Ah yes, the bootloader only expose uf2 drive, you need to flash the circuitpython afterwards, by copy uf2 created by uf2 target
https://github.com/adafruit/circuitpython/blob/nrf52840_usbboot/ports/nrf/Makefile#L314

After complete, bootloader will reset and circuitpython will run, you should see REPL via jlink cdc (since native usb cdc is still work in progress). To display msc while in cir...

errant grail
#

@stuck elbow Have you consider using the wind noise from a microphone? Do you need variable pressure sensing for volume or expression?

stuck elbow
#

I do

#

woodwind instruments are tricky

errant grail
#

Indeed.

stuck elbow
#

to be honest I have no idea how it will all work in the end

#

it's an experiment

#

I actually even have that sensor in my drawer

errant grail
#

Haven't played with a breath controller (yet). @ruby lake have you?

manic glacierBOT
ruby lake
#

@meager fog my only remaining experiment will be how to do time division multiplex without a direct hook into a hardware timer. I might be able to use time.monotonic to do a polled loop test, if I can get it to 1ms or better, we win

#

@errant grail I have, I have yamaha breath controllers from the olden days

#

they are not EWI, but rather the mouthpiece used with various Yamaha digital synthesizers

idle owl
#

@slender iron Great catches, thanks for looking at the driver.

stuck elbow
#

I have never tried any electronic woodwind instruments

#

I can't even imagine how it feels like

slender iron
#

@idle owl np

stuck elbow
#

but I would very much like a woodwind instrument that I can practice with headphones, because my gf hates me when I practice

slender iron
#

@ruby lake what do you need to do?

ruby lake
#

@slender iron Ideally, I'd like to start a timer and bind it to a callback that sets my channel output states. That is not a cp thing, at least not yet, so I will have to try grabbing a time.monotonic value and waiting for a certain interval of ticks before running through an iteration of the output channel update.

#

It should work fine, it is just that I have to be better than 1ms of total time taken or I risk missing a midi byte

slender iron
#

can you explain what you want to happen without saying how?

#

I don't know what the output channel is supposed to do

ruby lake
#

ok, say you have 2 lists, the input list and the output list

#

every interval (say 500 microseconds for now) a bit of code pulls an item from the input list and moves it to the output list.

#

the input list is populated based on how the midi keys are assigned. The output list is always written in a linear order. The lists have a certain number of entries (voices), say 8.

slender iron
#

hrm

ruby lake
#

The time matters because the output hardware is a series of sample/hold circuits and their output voltages can droop if left unrefreshed for too long

#

feather-> dual -> mux -> S/Hs

slender iron
#

what protocol is the output? midi (aka uart)?

ruby lake
#

er dac not dual

#

analog voltages. Multiplexed from a single dac channel into eight channels

#

I will experiment

slender iron
#

k, sounds like something we could do in C land but still uncertain exactly what it is

ruby lake
#

well, when I get to my home office I will link my C version

slender iron
#

k, perfect

plucky flint
#

@ruby lake o/ I sent you an email earlier today... ๐Ÿ˜ƒ Thanks for submitting something.

ruby lake
#

@plucky flint yep, got it. Will write a proper response when I get to the home office

manic glacierBOT
#

Ah I see, so it's the CP app that creates and exposes the MSC for the py files, not the bootloader, good to know. As for the USB stack, couldn't we use the one that ships with the nRF SDK? I have used it before to do composite HID and CDC in another project, it's pretty nice to use. Otherwise, couldn't we create an abstraction layer so that both nrf and atsamd ports could use the same stack? That would make it easier to add new ports in the future and would remove duplicated code. I also work...

rigid path
#

CircuitPython upgrade question: I am currently running CP 2.3.1 on my Feathers and I am looking at testing the version 3 of CP. Do I need to upgrade the uf2/bin files on the individual boards or just the folders/files in the lib folder, or everything? Thanks.

plucky flint
#

@ruby lake +1

idle owl
#

@rigid path Everything. You'll need to install a new uf2 for each board, and you'll need the 3.x version of the library files you're using in your /lib folder.

#

@plucky flint Hey!

plucky flint
#

o/ @idle owl

#

how's things?

idle owl
#

Pretty good! How about you?

#

I'm finishing up a guide to using Git and GitHub to contribute to CircuitPython or any open source project. It's massive. I'm super excited about it.

manic glacierBOT
plucky flint
#

Busy: getting Mu 1.0 ready (beta.17 next week), also some behind the scenes work on CodeGrades which you'll hear about very soon. ๐Ÿ˜‰

idle owl
#

Excellent!

plucky flint
#

Oooh... that's a really useful resource. Using GitHub can be v.intimidating.

#

Happy to proof read / test etc... if you need extra eyes... just assign me on GH (@plucky flint)

idle owl
#

It came out of us adding Travis to the Learn guide code repo, and forcing people to do PRs instead of pushing directly, but we get this question a lot "what's a good workflow?" And we usually say "whatever works best for you... here's a few ideas" which isn't all that helpful.

#

That would be great, but none of it's on GitHub. It's all in the Learn system. I can email you a preview link though.

plucky flint
#

oooh yes please!

idle owl
#

I have your email, I just checked

#

๐Ÿ˜ƒ

plucky flint
#

I know millions (* may be a slight exaggeration) of teachers in the UK who'd find a guide like yours really useful.

#

Happy to help! ๐Ÿ˜ƒ

idle owl
#

Sent. With caveats included ๐Ÿ˜„

manic glacierBOT
#

For usb stack, currently we are using my own usb stack called tinyusb in the bootloader, it got both cdc + msc working already as we see.

https://github.com/hathach/tinyusb

It is not perfect, but work with other chip such as lpc families from NXP as well ( though some update code is needed).

My issue is with the circuitpython rather than usb stack. It is a bit comprehensive for my brain, and hard to debug ( I will try to create an segger studio to deal with it later on). Yeah, I did the i...

plucky flint
#

gotit!

idle owl
#

Did the link work? I feel like they don't always work

#

Oh you know what, hold on. I don't think it will work yet

fading solstice
#

@idle owl also would like to review it, if you want a reviewer that is

idle owl
#

I need to publish the pages

#

I'm going through them and doing it now

plucky flint
#

@idle owl hmmm... I only see the first page..

#

ahhh, just read ^^^

idle owl
#

Ok refresh

plucky flint
#

That worked! ๐Ÿ˜ƒ Thanks...

fading solstice
#

@slender iron do I need to do anything else to get my FTC fix included in next build of circuitpython 3.0

solar whale
#

@tulip sleet my servos don't like 550 -2400 heard snap on a sg-5010 and it does a funny travel at the extreme -- the sg92r vibrates at 2400 seems to work. still testing

slender iron
#

@fading solstice the submodule commit reference needs to be updated

#

in your circuitpython copy you can change into the directory and git pull

#

then back out and you should see a diff you can commit and PR

rigid path
#

@idle owl Thanks for the info.

solar whale
#

@tulip sleet its the 2400 that is problematic

tulip sleet
#

what's a safer value?

solar whale
#

2350 seems ok

#

still experimenting

tulip sleet
#

@meager fog @solar whale testing servo limits here

solar whale
#

stiil verifying which extreme is the problem

#

its 600

#

happier at 650

tulip sleet
#

do you have more than one sample of each servo?

solar whale
#

I have 2 of each

tulip sleet
#

I'll try them later. I did try the extremes manually in the REPL and they seemed to be slightly under the extremes of travel (I tried 500 and 2450, which went a little further), but that was mine. Tried mostly micro servo

solar whale
#

I need to take some time to set this up for systematic testing... but 600 - 2400 caused bad behavior and heating of the sg-5010 -- the sg52 just made some noise - so far.

#

I think the microservos are more forgiving

stuck elbow
#

are those analog or digital?

#

in analog servos, the frequency of the pwm signal determines the power (and thus heating)

tulip sleet
#

they are just the regular servos from the adafruit store. we're using 50hz.

stuck elbow
#

so if you feed more than the standard 50Hz, you can overheat them

#

(I actually use that to power them with lower voltage than they are made for)

tulip sleet
#

I think @solar whale is seeing overheating at the extremes of travel, when the pulse width is too short or too long and they hit the stop. Does that make sense?

stuck elbow
#

ah, yes, they really are not made to go beyond 90ยฐ travel normally

#

so around 1000-2000

#

they have large margins, but they are inconsitent

#

you have to tune them per servo

solar whale
#

still not making +/- 90

stuck elbow
#

no, +/-45ยฐ

solar whale
#

trying for full 180 degree swing

stuck elbow
#

90ยฐ total

solar whale
#

ah - they do that at 1000-2000

stuck elbow
#

that's the only standardized thing

#

everything extra is a hack

tulip sleet
#

1000-2000 was the original default, but that is a lot less than 180deg, more like 140. The Tower Pro ones seem more like 550 or 600 to 2300 or 2400 now. Limor said to change the defaults to 550-2400. They seem poorly spec'd: the datasheet (such as it is) doesn't say

stuck elbow
#

@tulip sleet it really varies per individual servo

solar whale
#

I wonder if the limits should stay safe at 1000 - 2000 and let the user play beyond if they want to.

slender iron
#

There is enough clock instability in the M0 that the actual output value can be significantly different

#

I added a calibration example that allows you to compensate for it

tulip sleet
#

The motor library assumed 1000-2000 would get you 180 degrees of rotation, but you're saying we should set that to 90 instead

#

hmm... I should look at the arduino libraries too

#

@slender iron I fixed OneWire by adding some delay routines that do not use tick_delay(). They are just busy-wait NOP loops. The OneWire read/write routines turn off all interrupts, and then call common_hal_mcu_delay_us(). But that's a bad idea, I believe, because then the SysTick handler doesn't get called. If tick_delay() is called for a delay that will cross a SysTick reset, the timing is thrown off. Couple of ideas:

#
  1. Add and call these busy-wait loops (they are calibrated based on M0 48MHz and M4 120 MHz, with cache on) instead.
#
  1. Make some interrupt enable/disable routines that don't disable SysTick interrupt. RIght now it is prio 1, same as USB. I did make it prio 0, to see if USB was messing things up. we could disable interrupts below prio 0 for critical sections that need to call delay routines.
#

I wonder if this is causing other timing issues, like notro's clock drift issues.

slender iron
#

2 sounds better to me

tulip sleet
#

yeah. I like it better also. Time must march on no matter what.

#

I did check calibration of tick_delay() for small us values, checking systick values before and after calling it (compensating for systick reset if necessary). It is actually quite good. 6us does really seem to be 6us most of the time. Occasionally 6, 10,15, or 100us was 1us more. Checked on both M0 and M4

solar whale
#

I wan to update every thing to latest crikit build - I'm a few days old... occasionally getting an I/0 error (#5)

tulip sleet
#

and following posts

solar whale
#

also need to retest SD card on nrf52...

tulip sleet
#

it has the 550-2400 default range and everything else is very new

solar whale
#

@tulip sleet tahnks for servo link - interesting

#

thanks for uf2 as well -

tulip sleet
#

in later post: http://forum.arduino.cc/index.php?topic=48773.msg348809#msg348809 : "Keep in mind that R/C servos were developed for the model industry. They typically use adjustable mechanical linkages from the servo horns (or wheels) to the thing they are actuating, here is a link explaining: http://www.powertorque.co.za/epf/pdf/servoset.pdf . That way they can adapt the servo a given servo rotation to the range of mechanical motion they need. There was never a need for all servos to move the exact same number of degrees per usec. "

solar whale
#

is the limit the only change from master for the cpx-crikit build?

tulip sleet
#

master has new nrf-related code

solar whale
#

feather m4s are back in stock!

tulip sleet
#

allowing '/' mounted on '/' is the last change to 3.x

solar whale
#

right -- got all that - I was just wondering what was differnt in your build

stuck elbow
#

@tulip sleet yeah, I know those, the thing is, even individual servos will have different ranges -- I suspect that's because of variations of components used

tulip sleet
#

if R/C timing circuits, then component variation would account for a lot. I don't even know what' inside: I haven't seen a schematic for the insides. I thought there are some active components

stuck elbow
#

@tulip sleet there is a generator of the base frequency, changed with the pot, and a comparator with the input, and the difference drives the motor

tulip sleet
#

was NE544 before M51660

stuck elbow
#

that's why giving higher frequency signal gives more power

tulip sleet
#

thanks for all this explanation - it's almost folkloric. people just use them without really knowing

stuck elbow
#

yeah

#

to be honest, I have never seen a schematic myself, and even if I saw one now, I wouldn't understand it

#

of course digital servos just have a microcontroller in them

#

usually a PIC

tulip sleet
#

but I am thinking that there were servos way before IC's, so there was a simpler analog circuit. There were RC airplanes way before IC's.

stuck elbow
#

sure

#

well, the first RC vehicle was built by Tesla himself

#

it was a boat

manic glacierBOT
#

hmm ```
Adafruit CircuitPython 3.0.0-rc.0-27-g91427b0 on 2018-06-28; Bluefruit nRF52 Feather with NRF52832

import adafruit_sdcard
import busio
import digitalio
import board
import storage
import sys
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(board.D27)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
vfs
<VfsFat>
storage.mount(vfs, "/sd")
Traceback (most recent c...

indigo wedge
#

@slender iron Any suggestions who I should also add to review to offload you from the mountain of my PRs? ๐Ÿ˜‰

manic glacierBOT
slender iron
#

@indigo wedge I mean to look today. just got distracted

tulip sleet
#

I am supposed to be doing nRF stuff as well but am finishing up some other stuff.

#

so i haven't gotten very far in the self-education needed

indigo wedge
#

No, of course you have every right to get distracted, I just don't want to put too many patches on just you.

slender iron
#

I can take a look now. ladyada has wandered off ๐Ÿ˜ƒ

indigo wedge
#

I tried to make the PRs smaller this time around so they are easier to review one by one

manic glacierBOT
slender iron
#

np, I'm not the most thorough reviewer. we can always fix bugs after @solar whale finds them ๐Ÿ˜ƒ

indigo wedge
#

๐Ÿ˜„

solar whale
#

@slender iron I'll be happy to do tome testing of the Blnka stuff on Raspberry pi. any caveats or special docs I should look for?

slender iron
#

@solar whale @meager fog would know better than I. I'm just packaging it

solar whale
#

ah -- I just saw a lot of stuff going into it. looks intriguing!

manic glacierBOT
indigo wedge
#

I actually do wonder a but about Adafruit's process, at work we have a Jenkins slave that has real HW connected to it so we run tests for each PR. Don't think this can be done with Travis. So I what I'm wondering is, for example with the coming 3.0 release, what is the testing process, someone sits with all the boards and runs python scripts with different modules, or is there some automated process, or no process? ๐Ÿ˜„

stuck elbow
slender iron
#

@solar whale Yup! She wants to get rpi crickit going

solar whale
#

cool!

stuck elbow
#

but that looks like the same block diagrams :/

slender iron
#

@indigo wedge I've spent time on Rosie which gets webhooks from Travis and runs basic stuff on the boards

#

but its super flaky

#

we mostly rely on our testing and our community's testing

manic glacierBOT
solar whale
#

move fast and break things

slender iron
#

and then fix them ๐Ÿ˜ƒ

tulip sleet
indigo wedge
#

thanks Dan

slender iron
#

@indigo wedge yup thats it. not related to jenkins at all though. it only knows how to load code through uf2 atm

indigo wedge
#

yeah, I'm just using Jenkins as a example of CI system, anything that can execute scripts and take commands remotely would do

slender iron
#

yup yup

#

I'd like to clang-format everything too

#

I like {} for all if statements

manic glacierBOT
solar whale
#

@indigo wedge Does your build have all the new stuff - being merged in now in it -- could that impact SDCard. I can retry after the dust settles.

manic glacierBOT
indigo wedge
#

No, I tested on what was master as I wrote the comment, which I think was same commit as you used.

solar whale
#

oh well

stuck elbow
#

@tulip sleet ok, looks like pre-IC the servos just looked at the energy of the PWM signal, not at the pulse width

indigo wedge
#

But I'll test on the feather52832 tomorrow, closing shop for today ๐Ÿ˜„

solar whale
#

No rush - thanks and good night!

indigo wedge
#

@slender iron ๐Ÿš“ Do you know how fast you've been merging, sir?

slender iron
#

๐Ÿ˜ƒ

idle owl
#

Scott's a merging ninja

stuck elbow
#

@indigo wedge is that a Heisenberg joke?

manic glacierBOT
indigo wedge
#

Nope, just a police pull over joke

stuck elbow
#

right and he answers "no, but I know where I am"

slender iron
#

gave you a comment on the latest ๐Ÿ˜ƒ

idle owl
#

@fading solstice Unless you're actively going through the guide, I'm going to submit it. If you're looking at it, I'll wait for your review.

manic glacierBOT
#

Actually, I don't think it's that much of an overhead, as the config structs are not that large, they only have the fields that are really needed and I'm not sure if we can trust the peripherals to always be in a known state, so probably best to init the bare minimum always. The benfit of using the drivers instead of the hal is that (in addition to being easier to use), they also have fixes/workarounds for known silicon bugs and and general error handling that we don't have to think about.

indigo wedge
#

Oh no I realized I wrote a "Well, actually" response ๐Ÿคฆ

slender iron
#

heh

indigo wedge
#

I think we will have to come back to the BLE API discussion again, but not today, have a nice TIME_OF_DAY everyone!

slender iron
#

thanks @indigo wedge !

idle owl
#

later @indigo wedge!

solar whale
#

@tulip sleet is there a new release for the seesaw on the crikit that I should load? I'm still getting I/O errors.

manic glacierBOT
#

You should measure it. :-)

I looked at the data sheet and there isn't a reset register like the SAMD peripherals have. So it makes sense to set everything.

In general I like this library and using it. I'm just giving you a heads up about our similar experiences with ASF3. Error checking is good but can add overhead if we know a given state but the compiler doesn't recognize. We have plenty of space now so starting with this is fine.

tulip sleet
#

@solar whale no new seesaw release. how are you producing io errors?

#

I never have seen any

solar whale
#

moving the servo --

tulip sleet
#

intermittent or you have a consistent example?

solar whale
#

the green light on the CRICKIT goes out and I get an Error 5

tulip sleet
#

what kind of 5v power are you supplying to crickit

solar whale
#

very intermittent

#

wall wart 2A -- from Adafruit

tulip sleet
#

so maybe you are drawing too much power with your testing and activating the electronic fuse

fading solstice
#

@idle owl no reviewing at this time.

idle owl
#

@fading solstice Ok np.

tulip sleet
#

or otherwise causign the power to sag and crickit board to reset

solar whale
#

even happend at 1000 - 2000 limits

tulip sleet
#

so you are just running the servo for minutes at 1000-2000?

solar whale
#

I can switch to batteries.

tulip sleet
#

many servos or just one

solar whale
#

but should it need taht much current?

#

just one

tulip sleet
#

only if you were hitting the limits maybe

solar whale
#

I'll keep trying an put in an issue if I can make it reproducible. with 1000 2000 I would not have expected it. I also have a 4A supply - not sure I want to give it too much!

tulip sleet
solar whale
#

ok -- I'll poke at it a bit more first. Thanks

#

oh yeah - there was a new release 3 days ago. I'll check the commit

main meteor
#

The analog out page says "Express boards like the Circuit Playground Express, Metro M0 Express, ItsyBitsy M0 Express, Metro 4 Express, or Feather M0 Express have more code space and can perform audio playback capabilities via the DAC. Gemma M0 and Trinket M0 cannot!" I know the Gemma and Trinket use the E18 version of the chip and the Metro uses the G18, but I thought that was a package difference, not RAM. Then again, the Metro also has the SPI flash chip, maybe that's the reason?

tulip sleet
#

@main meteor it's the flash chip. we don't have room on the small boards for the code, because the 256kB of internal flash on those boards is also used for CIRCUITPY (a 64kB filesystem). On the express boards, we can use the entire 256kB of flash for code.

#

only 192kB for code on the non-Express boards

main meteor
#

I'm still intrigued by the SAMD51's built-in microSD card support. There's room on the Metro for a microSD socket. That would give Circuitpython a ton of room!

#

I'd be tempted to make my own board and try it (and write the microSD support for Circuitpython), but I'm not set up to solder BGA chips!

tulip sleet
#

we don't use BGA chips ourselves

main meteor
#

Whoops, when I asked about an M4 Trinket, LadyAda said it would be tricky because it's BGA.

tulip sleet
#

you can just use regular SPI to talk to the uSD card

#

that's what we do now

#

because only BGA will fit on the narrow width of the trinket. no 32-pin SAMD51

main meteor
#

Ah, that's the thinking! I had it, um, not backwards, but sort of sideways. Now I understand!

tulip sleet
#

np, yeah we don't do BGA for anything because it's tricky to manufacture and get good yields

main meteor
#

I was integrating a resource-hungry peripheral and an ordinary ATmega328 wasn't even close to managing it. The SAMD51 didn't even break a sweat.

solar whale
#

@tulip sleet I think I am losing it -- whne I command the servo on pin 17 - I am movin servo 4 -- pin 14 povew servo 1 - isn't that backwards?

main meteor
#

I wondered about that: BGA requires a lot of process support, and while I know there's a bunch of very cool gear in use at AdaFruit, I didn't know if BGA was practical there yet.

tulip sleet
#

i'm not sure of the manufacturing issues, but also rework is hard. We have a high yield, though, right now

#

@solar whale that's the numbering I have in the Crickit library. They were numbered in reverse for a while. Are you looking at a guide?

solar whale
#

ah - yes

tulip sleet
#

SERVO1 14, SERVO2 15 ,etc

solar whale
#

It was reverse before -- whew!

#

changed when I loaded your UF2

tulip sleet
#

so SERVO1 corresponds to Servo 1 on the board?

solar whale
#

guide says OK that was fun but you want MORE servos right? You can control up to four! The servos are on the seesaw pins 17, 16, 15, 14 in that order after demo using 17 for servo 1

tulip sleet
#

so what worked for you? is 17 terminals 4 or 1 for you

solar whale
#

now it is terminals 4 -- was 1 before.

tulip sleet
#

so the guide is wrong, right?

solar whale
#

is SERVO1 defined somewhare?

tulip sleet
#
from adafruit_crickit.crickit import crickit
from adafruit_crickit.terminals import *

servo1 = crickit.servo(SERVO1)
servo1.angle = 30
#

that's how the new library works

solar whale
#

ah - I am using Seesaw

tulip sleet
#

the library hides all that boilerplate. It is doing the same thing, but hiding the I2C and seesaw devices (though you need seesaw if you are using the digital I/O pins)

tulip sleet
#

crickit.seesaw is the seesaw object

#

yes, the library is brand new and not in the guide yet

solar whale
#

right but teh guide does not use crikit version --- that clarifies things!

tulip sleet
solar whale
#

thanks!

tulip sleet
#

you can still do it the previous way, this way is just a lot less typing

solar whale
#

ok - I'll clean things up before generating any issues....hard to keep up!

tulip sleet
#

hardly anyone has used the library yet - Mike B added as an alternative example in one guide so far

solar whale
#

I also need to check my path to make sure which version of the libs is getting used but on this system I deleted seesaw from the /lib folder

#

on CPX's I usually remove all the libs that are "built-in"

#

to avoid confusion

tulip sleet
#

@solar whale when you said the servo pin mapping reversed, do you mean you were using 17 for SERVO1 (as labeled on the board) before my new CPy .uf2?

solar whale
#

yes

tulip sleet
#

did you update the seesaw .uf2?

#

x

solar whale
#

last week I did

#

not today

tulip sleet
#

but not today, ok

solar whale
#

Am I not the only one confused? was there a consious effort to revers the ordering?

tulip sleet
#

i am really confused. I just tried with the seesaw library (not my library) and 17 is servo4, so how did that work for you before, with 17 as servo1

#

can we get in voice chat for a minute

solar whale
#

I get teh same now with your UF2 using seesaw library

#

sure

raven canopy
#

just listening for possible future support

solar whale
#

Happy to share my confusion today...

#

off for a few hours --brain is tired ๐Ÿ› 

meager fog
#

more feather m4s in the coming days

#

we sold out fast!

#

oh wait we ahve 22 left

#

GET EM WHILE WE GOT EM

idle owl
#

๐Ÿ˜„

ruby lake
#

omg featherzz

tulip sleet
#

@solar whale ok, turns it that the seesaw library really does do pin mapping, in an obscure way. I am fixing it: 17,16,15,14 is correct. I accidentally changed the mapping and "fixed" it. WIll change it back.

ruby lake
#

sad we lost Harlan Ellison today. I have a vivid memory of him guest lecturing in my spring 1985 university English course

solar whale
#

@tulip sleet are you sure it should be changed back. 14-17 makes a lot of sense. It does not matter to me.

tulip sleet
#

@solar whale the correct numbering is 17-14. I made an accidental change in the seesaw library which made me think it was reversed, so I reversed it in the crickit library as well. Just went over this with Limor

#

I'll have a new .uf2 for you in a few minutes after I test it

solar whale
#

No rush and no objections. Thanks.

#

I wonโ€™t be doing anything for an hour or so.

tulip sleet
#

@solar whale

Adafruit CircuitPython 3.0.0-rc.0-7-g6908eed7e-dirty on 2018-06-28; Adafruit CircuitPlayground Express with Crickit libraries with samd21g18
>>> from adafruit_crickit.crickit import crickit
>>> from adafruit_crickit.terminals import *
>>> SERVO1
17
>>> servo1 = crickit.servo(SERVO1)
>>> servo1.angle = 70
>>> servo1.angle = 0
>>> # works!
tulip sleet
#

@slender iron disabling interrupts below a certain prio level is implemented only on M4, not M0+ ๐Ÿ˜  , so looks like I need busy-wait loops at least for M0. Also since no true open-drain outputs, can't use pulseio for OneWire.

slender iron
#

how did it work before?

tulip sleet
#

because in 2.3.1 i think the common_hal_mcu_delay_us() impl didn't use systick interrupts, so it busy-waited itself and was not subject to interruption. Disabling interrupts and then doing a delay is not done anywhere except in onewire.

slender iron
#

ah, because it uses asf?

tulip sleet
#

no, it's the tick_delay impl; just checking that

#

common_hal_mcu_delay_us() eventually calls delay_cycles(), which actually just uses SysTick as if no one else is using it (which I think is true on 2.x?)

#

did you start using SysTick for timekeeping in 3.0?

#

no, I see we had systick interrupts even in 2.x. But delay_cycles just overrode that and used systick for its own devious purposes.

#

it would just load it and count down (the delay was broken up into 10us chunks)

#

i know the busy-wait loops work - i tested that already, so i'll go back to that

#

main issue is that calibration assumed a fixed cpu freq, I can probably calculate that anyway without losing too much time. tick_delay does such a calculation and it still has ok accuracy even for small times like 6us

solar whale
#

@tulip sleet Sorry, I'm not going to be able to do any more servo testing tonight. I'll set up some systematic testing tomorrow to check the range and see if the I/O errors are reproducible. Thanks for the help today.

tulip sleet
#

Thanks!! np, we can always revise the ranges. I really appreciate your looking at this more thoroughly than I did.

slender iron
#

@tulip sleet yup, systick switch was with 3.x

tulip sleet
#

how did time.monotonic keep time in 2.x?

#

ok, I see you were using TC5. So you gained a timer by using systick.

slender iron
#

and saved a timer peripheral

mental marsh
#

Hi everyone, can an itsybitsy M4 Express with CircuitPython drive a servo and sound fx board and neopixels or leds?

manic glacierBOT
#

OneWire didn't work at all, just sending one long pulse. common_hal_digitalio_digitalinout_switch_to_input() was buggy, actually failing to change the port direction. Fixed, and cleaned up DigitalInOut.c a bit, using hri_ calls to save a bit of time in certain cases, and avoiding some redundant operations.

After that fix, OneWire was sort of working, but acting erratically, sometimes getting a CRC error. This problem was not present in 2.x. OneWire does bit-banging with precise time ...

ruby atlas
#

@tulip sleet you mentioned doing a cpu frequency calculation. would it be better to store that in board details, or compute something akin to the linux bogomips at cpy startup?

tulip sleet
#

I don't actually calculate the frequency. I just call common_hal_mcu_processor_get_frequency(), which right now returns a constant (it could look it up in the clock details, but not really necessary now).

ruby atlas
#

ah okay, using an abstraction like that is ideal anyhow ๐Ÿ˜ƒ

#

i missed some context by not looking at code

#

once my next order arrives i'll have 3 m4 boards ๐Ÿ˜ƒ

tulip sleet
#

more to test with ๐Ÿ˜ƒ

ruby atlas
#

yep! and eventually make things with ๐Ÿ˜ƒ

#

but even temporary making of things rocks.

scarlet fjord
#

what does this mean?

  File "main.py", line 22, in <module>
  File "adafruit_hid/keyboard.py", line 74, in __init__
  File "adafruit_hid/keyboard.py", line 123, in release_all
OSError: USB Busy
#

line 22 in main.py just does this:

kbd = Keyboard()
#

and i wasnt having this issue yesterday

#

i unplugged it and plugged it back in and idk if this is better or worse:

  File "main.py", line 35, in <module>
  File "adafruit_hid/keyboard.py", line 100, in press
  File "adafruit_hid/keyboard.py", line 135, in _add_keycode_to_report
  File "adafruit_hid/keycode.py", line 305, in modifier_bit
TypeError: unsupported types for __le__: 'int', 'list'

line 35 in main.py is:

kbd.press(Keycode.A)
scarlet fjord
#

whelp, its fixed now, idk how tho

#

i think im just running out of ram tbh

#

i need me a feather m4 express, but theyre already out of stock ๐Ÿ˜ญ

#

my M0 has 32kb of ram and the M4 has 192kb!
i needs it

indigo wedge
stuck elbow
#

@scarlet fjord I was looking at your code

#

@scarlet fjord I think it will use less ram if you don't use so many global variables, but instead put the values in a list directly

#

so instead of doing a1 = 1 a2=2 a3=3 and as = [a1, a2, a3] simply do as = [1, 2, 3] if that makes sense

scarlet fjord
#

that would make a lot more sense yes o:

#

can i still do that if a1 = [1, 2, 3] and a2 = [1, 2, 3]?
like, is there a way to nest arrays inside arrays in that way?

stuck elbow
#

like a = [1, [2, 3]]?

scarlet fjord
#

yeah, does that work..?

stuck elbow
#

yes

scarlet fjord
#

cool ๐Ÿ˜ฎ

stuck elbow
scarlet fjord
#

oh wow, thanks!
ill give it a shot

#

wow, i see what you mean about too many variables ๐Ÿ˜…
you made it look so clean

#

it errors out though:

  File "main.py", line 1, in <module>
  File "mcpsetup.py", line 7, in <module>
  File "adafruit_mcp230xx.py", line 266, in __init__
  File "adafruit_bus_device/i2c_device.py", line 62, in __init__
AttributeError: 'tuple' object has no attribute 'try_lock'
stuck elbow
#

you are passing a tuple instead of a i2c object

#

sorry, I added the commas with search-and-replace

#

three extra commas, in fact

scarlet fjord
#

ah i see them

#

ooh ooh there were a few more issues, but the compiler told me about them and i fixed them and guess what โ—

#

it works ๐Ÿ˜„

stuck elbow
#

awesome

scarlet fjord
#

thanks a bunch ๐Ÿ’–

stuck elbow
#

I'm glad I could be of assistance

manic glacierBOT
tidal kiln
#

@mental marsh it can. doing them all at once may take a little effort though.

mental marsh
#

@tidal kiln thanks

mental marsh
#

Thank you so much!!

tidal kiln
#

np. good luck. don't try to do it all at once. work up to it piece by piece.