#circuitpython-dev

1 messages ยท Page 125 of 1

solar atlas
#

Lol, she was actually reading thru the sheet that came with her lil meter tonight while I was trying to figure this out.

idle owl
#

That's so great!!

solar atlas
#

lol, even tried figuring out some of the chinese writing

#

My very own little future Lady Ada

idle owl
#

It's true!

solar atlas
#

I'm going to go watch some star trek discovery. Have a great night!!

idle owl
#

@solar atlas You too!

glacial bronze
#

the Google Translate app for Android and iOS will do augmented reality translation

#

WayGo also works

#

so she can just point a phone or tablet at the manual

#

also Word Lens

solar atlas
#

Seriously? @glacial bronze ? lol, we'll have to try that tomorrow. She loves all thing oriental and anime, she'll love getting to read chinese

glacial bronze
#

It probably won't work as well for manga and it definitely won't replace subtitles on anime, but for a technical manual it should get you up to 50% of the way to understanding :v

solar atlas
#

O man that would open her up to a whole new world of anime!!

#

Even still, thats awesome. She is really proud of here meter.

idle owl
#

As well she should be!

slender iron
#

@tawny creek you'll need a jlink or hacked arduino zero to load the bootloader initially

tawny creek
#

@slender iron ooh, what is a hacked arduino zero ๐Ÿ˜ฎ

slender iron
#

you hot air the M0 chip off and then use the swd connector for a chip of your own

#

only works with atmel studio though I believe. maybe openocd

tawny creek
slender iron
#

that'll work for non-commercial use just fine

tawny creek
#

yeah its just for my own amusement xD

slender iron
#

then you are good ๐Ÿ˜ƒ

#

lots of folks here have the same

pastel panther
#

@slender iron you were right btw. I removed the other pwm setup and called _chip_init() directly and it worked at near full speed

slender iron
#

perfect @pastel panther !

#

glad I could help

pastel panther
#

Only 46.3MHz though. The delays are almost right but not quite 129ms on a 125ms delay

slender iron
#

yeah, is it connected to usb data with USBCRM on?

pastel panther
#

I don't think so? it's connected but I haven't done anything specifically to set it up

tawny creek
#

@slender iron ooh and just connect the pins? ๐Ÿ˜ฎ easy

slender iron
#

@pastel panther not having it on would accoutn for the difference

#

@tawny creek it is pretty easy ๐Ÿ˜ƒ

pastel panther
#

@slender iron It looks like I have the USBCRM bit set but I haven't configured a USB device so that's probably not going to work. Would it help to reference the DFLL from the external crystal?

slender iron
#

the external crystal would work too

pastel panther
#

Presumably there is a way to get a stable clock without USB

slender iron
#

its stable, its just not exact

#

some of our boards don't have external crystals so I always start with crystalless

pastel panther
#

right

#

I suppose being off by 4% osm

#

blah

#

hmm.. I wonder how off it is on longer delays

slender iron
#

linear I assume

#

you could always hand tune it ๐Ÿ˜ƒ

#

there is actually code in circuitpython that remembers calibration done on usb so its consistent with off usb

pastel panther
#

smart

#

yea, it's consistantly off by around 3.2%

slender iron
#

good night @pastel panther

pastel panther
#

night @slender iron

timber mango
#

trinket m0, circuitpython 2.1.0 via uf2, trying to write to the file system and only getting OSError: 28 (ENOSPC.) Temperature-logger tutorial fails the same way. Am I missing something, or is this not yet working on the trinket?

cunning crypt
#

@timber mango My only thought is that the files are too large. Trinket and other non-Express boards have very little in way of available space.

solar whale
#

@timber mango Did you modify boot.py to enable writing to the FS via CircuitPython?

manic glacierBOT
timber mango
#

And as for space: when the USB side is writable, I've got plenty of room for small python files; I'm actually trying to write one character and failing: ```>>> open("count", "wb").write("3")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: 28

#

(using "w" vs "wb" vs "a" doesn't change anything.)

timber mango
#

(and as this is new in circuit python 2.0, it would be good to know if it works for anyone else, or if the circuitpython test suite actually gets run on trinket hardware - tests/io/open_append.py and tests/io/open_plus.py would demonstrate this working, if they're actually getting run)

solar whale
#

@timber mango @tulip sleet replied to you gitter post that he was unable to reproduce this on a Trinket. If you are using 2.0 you may want to try updating to 2.1 but also try clearing the FS as he suggested. I can try this later to day when I get home from work.

#

What OS are you using for you host computer?

timber mango
#

Thanks, hadn't checked gitter this morning. It was a fresh-from-amazon 1.0 unit, uf2'ed directly to 2.1, with an unzip of trinket_m0_2.0.0.zip to get the new mpy files (since there isn't a 2.1 of those? and they're just libraries anyway.) But I didn't know about erase, will try that tonight.

#

Host OS is Debian Stretch (9.2)

solar whale
#

For this issue, I don't think you are accessing any library modules anyway.

timber mango
solar whale
#

no special bundle for trinket, just extract what you need.

#

the link you posted is the circuitpython image itself

#

Now I see the link to the trinket_m0 files - they were the ones distributed with 2.0 so fi you want too update them, you can replace the individual files with the ones in the full 2.1 /lib folder. But, as noted, tht is not relevant to your current problem.

#

there was achange in the .mpy file forma between 2..0 and 2.1 so you neeed to update them together - if there is a mismatch, you will get an error saying so.

manic glacierBOT
fading solstice
#

sure

manic glacierBOT
#

What I am seeing is with no main.py file then after a hard reset, the neopixel shows solid White (which means board is in the REPL) and indeed the board is placed in the REPL. This is what the Metro M0 2.x and the Metro M4 3.x boards do.

The only odd thing is when you rename the main.py to mainX.py (you have to wait quite awhile) This is where the multiple flashing occurs. If you open the serial terminal there was a KeyboardInterrupt at line 61, then a couple of auto-reboot messages, ...

slender iron
#

@solar whale there wasn't an mpy version change between 2.0 and 2.1. We'll only do it on major version numbers, 1.x, 2.x, 3.x etc.

solar whale
#

oops - thanks - sorry for the mis-information

manic glacierBOT
tulip sleet
#

@slender iron got time for an audio chat re DMA and ASF4? I'm trying to convert shared_dma.c and have some questions about my overall approach

slender iron
#

yup!

manic glacierBOT
#

It's looking like scan is the only thing that a "middle" driver would need to provide. Everything else can live in the OneWireDevice class. Is it worth writing a separate module just for scan? The busio I2C provides a scan:
http://circuitpython.readthedocs.io/en/latest/shared-bindings/busio/I2C.html#busio.I2C.scan
If busio OneWire did this, then usage for Case 2 and 3 could be like:

>>> import board, busio
>>> import adafruit_ds18x20
>>> ow = busio.OneWire(board.D2)
>>> ds18 ...
idle owl
#

@slender iron You guys still talking ASF4?

tulip sleet
#

now we're talkign clocks

idle owl
#

Care if I listen in?

slender iron
#

you can chat with us of course

pastel panther
#

(lerkin)

slender iron
#

MP34DT01-M

#

Aospow AS-M4030-2660D

pastel panther
#

10 bojillion

manic glacierBOT
tidal kiln
#

interesting behavior when printing byte arrays:

>>> bytearray([0x01,0x02,0x03,0x1f,0xff])
bytearray(b'\x01\x02\x03\x1f\xff')
>>> bytearray([0x48,0x45,0x4c,0x4c,0x4f])
bytearray(b'HELLO')
#

makes it confusing when the values are mixed printable / non-printable:

>>> bytearray([0x28,0x02,0x5c,0x1f,0xff])
bytearray(b'(\x02\\\x1f\xff')
solar whale
#

@timber mango just ran this on my trinket M0 with write enabled: ```>>> f=open('junk.txt','w')

f.write("3")
1
f.close()
f=open('junk.txt','r')
f.read()
'3'
f.close()

slender iron
#

git.add(".") == git add .

#

git.commit(message=message) git commit --message=<message>

#
    Updating https://github.com/adafruit/Adafruit_CircuitPython_DS3231 to 2.0.1
from 1.0.0:
      > changed read_into to readinto
      > Add demo example based on PCF8523 guide.
      > Switch to build from circuitpython 2.x branch mpy-cross
idle owl
#

Ok, ustack is listed in the "Modules" list on ReadTheDocs. gc is not included on that list. That was the point they're making. They're asking if there's a better list somewhere with all the modules included in CircuitPython. Is there another list somewhere? I'm unaware of anything else.

#

@tulip sleet Turns out the rest of the question is about ustack and you just answered that for me. The rest of their post is information for anyone else looking into memory allocation.

#

And then the next question is, should I update the list of included Modules to not include ustack and to include gc or is there a reason that the list is as it is?

tulip sleet
#

that module list (the "Support Matrix") is meant to be modules that are new in CPy. Some are renamed from what was in MPy (e.g., uos -> os) . gc is from MPy and we didn't change it (e.g., like sys). ustack should be in that list. Maybe we should have a more comprehensive list. ... In general the RtD docs are kind of a mess, and we have to decide how to present consistent complete documents of CircuitPython without constantly talking about its differences from MicroPython.

idle owl
#

Ah yeah ok.

#

Yeah at some point, you guys have created something beyond that. I agree that we need to figure out how to document it consistently.

#

Or we have created, I guess... ๐Ÿ˜„

#

I was trying to explain it to someone last night and discussing how yes, it's technically a fork of MPy, but it's gone beyond that.

tulip sleet
idle owl
#

Ok noted.

#

Yeah, thorough issue, too. Good to know.

manic glacierBOT
manic glacierBOT
solar whale
#

@slender iron @tulip sleet just pulled 2.x and built feather_m0_express - REPL works, but the SPI Flash is not recognized? Should I file an issue?

#

there was a change to this in the last commit

tulip sleet
#

the change looks innocuous: it removes a redundant or'ing of a bit constant

solar whale
#

hmmm - I'll create the issue - see if anyon else can confirm/deny it.

tulip sleet
#

i have to go out for a bit but will test later

manic glacierBOT
solar whale
#

ok - thanks - I don't need a new bootlloader or something like that do I?

#

nevermind - my mistake - thsi sis a supersized m0 express....

tulip sleet
#

yah, just tested while tying my shoes. ok here

solar whale
#

sorry about that

slender iron
#

rosie just finished and its ok too

tulip sleet
#

np

manic glacierBOT
solar whale
#

@slender iron should the 2 recent changed to the feather_m0_express also get applied to feather_m0_supersized?

slender iron
#

yup, probably

#

though they were on master and I don't think supersized has been merged into master yet

#

itsybitsy is also 2.x only now

solar whale
#

I think the first one was on 2.x, but probably has no impact. no need to add the status lights now if it is only on master

idle owl
#

Yah! And look how cute!

#

Oh you got authors into some of them!

slender iron
#

I didn't try to but I did fix up the pull request references

idle owl
#

Nice

slender iron
#

looks like I accidentally commited it to the adabot repo earlier....

manic glacierBOT
fading solstice
#

@slender iron double HOOT

idle owl
#

@tulip sleet Thanks for the help with gc and so on. The forum poster is happy with the responses.

manic glacierBOT
ruby lake
#

cmon adafruit, don't make a circuit playground express make a bright flash and loud bling on powerup! I thought I blew it up lol

slender iron
#

lol

ruby lake
#

hm, these links show "not found" when going for the latest drivers/firmwares

idle owl
#

What OS are you on?

ruby lake
#

yeah I backed out one item

#

win7 and a chrome browser

idle owl
ruby lake
#

right, I did all that. I've done it before too for M0 stuff.

idle owl
#

Ah ok

ruby lake
#

its just that link with the adafruit-circuitpython-circuitplayground-*.uf2 didn't work, but I found what I was after

idle owl
#

Ok good. That's good to know, thank you.

#

Where's the link you tried?

ruby lake
#

the driver and firmware isntall links

idle owl
#

Hmm ok. Yeah. Good catch, thank you.

ruby lake
#

np

slender iron
#

@idle owl I'm working on contributors for the release notes

idle owl
#

@slender iron Nice. How's it going?

slender iron
#

making progress. I can't count people from issues unless a commit refers to it

#

I won't do that immediately anyway

idle owl
#

Makes sense on both counts

slender iron
#

it'd be cool though

idle owl
#

Agreed. In the meantime we could start trying to get people to reference issues in commits if it's something based on an issue. Not sure whether that's a losing proposition.

slender iron
#

yeah, that'd be good

#

github can also auto-close issues from commits too

pastel panther
#

It shouldn't be too hard to do. I would be surprised if you couldn't make github enforce it, but then again I doubt Scott and Dan want to make an issue for every commit

idle owl
#

Oh nice.

#

I didn't know about the auto-closing from commits.

pastel panther
#

It's a soft rule at work but it does make it much easier to get context while digging through old code

idle owl
#

That's handy.

slender iron
#

I โค python

#

its so fast

#

to develop

pastel panther
#

That was my reaction the first time I used it after doing C derived languages

idle owl
#

I've really only ever programmed in Python.

pastel panther
#

It's a good language to know. I don't know the numbers but I wouldn't be surprised if it's the most used language of it's class

#

Ruby is popular in some circles but Python is used all over. It's expecially common in the sciences

opaque patrol
#

how do you "react" with blinka?

pastel panther
#

If you mouse over a line a smiley shows up

#

You can pick on from there

#

I think you can also type :blinka:

idle owl
#

Not to do a reaction. That sends a message.

pastel panther
#

right

slender iron
#

losing steam but I'm soooo cloooseee

#

will get a snack and power through

idle owl
#

Snack to the rescue!

opaque patrol
idle owl
#

@opaque patrol Hmm. I think the idea is to keep it simpler than a checklist. You have a project that works, if you load the newest version of CircuitPython onto your board and then run your project, you're testing for us. In the context of a good first issue, anyway.

slender iron
#

๐Ÿคž

tawny creek
#

@slender iron does adafruit have a kicad library? learning how to use it atm and want to plop on a samd21e but cant find a good source

slender iron
#

I may have made one but @meager fog uses eagle

#

you can now import eagle files into kicad so you might be able to export one that way

tawny creek
#

ooh do i have to use the latest version? using 4.07

slender iron
#

the nightly

idle owl
#

Yeah

slender iron
#

I built them manually using my refactored build tools

idle owl
#

The bundle with today's date is all .py files

slender iron
#

i know

idle owl
#

Ok

slender iron
#

thats the intention but it needs a better name

idle owl
#

Excellent

slender iron
#

would adafruit-circuitpython-bundle-py-20171121.zip make more sense?

idle owl
#

yeah

slender iron
#

kk

idle owl
#

They all look good to me. Anything specific to look for?

slender iron
#

done

#

nah, did you try it in a demo?

#

(I'm lazy)

idle owl
#

lol. No I didn't. Let me load it on a board.

slender iron
#

thanks, I don't have any demos handy myself

#

been doing git/github hacking all day

idle owl
#

I'm not sure what I have, I was about to look

#

Well for one, the M4 works with the 3.0 beta neopixel.mpy which it didn't work with a .mpy before. So there's that.

slender iron
#

thats good ๐Ÿ˜ƒ

timber mango
#

@solar whale @tulip sleet (from last night) Thanks, using erase_m0.uf2 cleared up the entire problem.

slender iron
#

@idle owl we're going to start releasing py files because they'll fit on the m4 and we'll actually be automatically filling in version numbers in them soon

idle owl
#

Hmm. 2.x worked with one demo but not another. Looks like the Express class isn't playing nice with any of my examples.

#

@slender iron That's awesome

slender iron
#

did it give an mpy error? thats my major concern

idle owl
#

Yes.

slender iron
#

otherwise its probably an express lib bug

idle owl
#

Incompatible .mpy error.

slender iron
#

with one demo but not another?

#

on the same circuitpython version?

idle owl
#

Yeah I was able to do a light sensor demo successfully which uses simpleio and some other built in libraries. But anything I have that uses the express class with cpx is failing.

#

Same CP version yes.

slender iron
#

hrm

idle owl
#

The 2.x bundle refers to 2.1.0 as well right? Not specifically the 2.x branch?

slender iron
#

yeah, it should work on all 2.x releases

idle owl
#

Ok, wanted to make sure I hadn't missed something there.

#

ValueError: Incompatible .mpy file. Please update all .mpy files. See http://adafru.it/mpy-update for more info.

#

Specifically failing on from adafruit_circuitplayground.express import cpx

slender iron
#

ugh ok

#

maybe I have the wrong mpy-cross for it

idle owl
#

I'll grab another demo that uses something else not built in to check it too. The HID keyboard should work

#

adafruit_hid fails as well.

slender iron
#

on 2.x with the 2.x bundle?

idle owl
#

Yes

slender iron
#

bummer

#

but 3.x worked?

idle owl
#

The only thing I have for 3.x is NeoPixels, but that worked.

slender iron
#

yeah, its mainly the import I'm worried about

idle owl
#

My current code.py which does a rainbow animation on a stick and a ring runs successfully with neopixel.mpy

slender iron
#

does this work?

idle owl
#

Checking

#

No doesn't appear to

slender iron
#

hrm ok

idle owl
#

Sanity check: Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18

#

2.x

slender iron
#

I'm trying here

idle owl
#

I wanted to make sure I hadn't upgraded the wrong board or something at some point.

pastel panther
#

Welp, I was trying to test it for you and I think I ran into something other people had been talking about, the "No space left on device" errors. Did I hear that there is a util to erase the flash ?

slender iron
#

ok, its that I mpy'ed init

idle owl
#

@pastel panther Likely, which board?

pastel panther
#

m4 with master

idle owl
#

Yeah, hold on let me grab it.

#

erase_m4.uf2

opaque patrol
#

@pastel panther Make sure the board went into boot-loader mode when you hit the button twice...I found the timing has to be good or it doesn't go into boot-loader mode

#

and you get the "no space on device message"

pastel panther
#

hah, cute. A uf2 that just writes zeros

opaque patrol
#

that must be for the M0 (haha) get it

timber mango
#

if you look at it before copying, the only things that show up in uf2 mode are 524288 Dec 31 1979 CURRENT.UF2* 104 Dec 31 1979 INDEX.HTM* 81 Dec 31 1979 INFO_UF2.TXT*

pastel panther
#

@idle owl I'm supposed to load it like a normal CP update, right? I must be doing something wrong as it's just copying over and not wanting to leave bootloader mode

idle owl
#

@pastel panther You have to load CP back onto it once you erase it.

pastel panther
#

ok.

idle owl
#

So you drag the eraser, it pops back to the bootloader and then you drag CP again.

pastel panther
#

Ah, did it erase itself (the flash cleaner?)

#

riiiiight

#

ah, there it goes, thanks

idle owl
#

Np

slender iron
#

this bundle work @idle owl ?

idle owl
#

Checking

#

express still doesn't work.

#

hid doesn't either.

slender iron
#

thats an old one...

#

too many bundles floating around

idle owl
#

hehe. Checking this one.

#

@slender iron Hey! It works! express is happy

slender iron
#

yay!

#

I updated the release too

pastel panther
#

Hmm, still getting out of space issues.

idle owl
#

Hello World!

#

lol! Sorry...

#

As you can see, hid also works.

slender iron
#

๐Ÿ˜ƒ

pastel panther
#

I don't think I used the eraser right as my main.txt.txt from testing double file extensions is still there. Let me try again

idle owl
#

Sounded like you did, though. Hmm.

pastel panther
#

after copying it over: then trying to copy the new CP firmware:

CURRENT.UF2  INDEX.HTM    INFO_UF2.TXT erase_m4.uf2 firmware.uf2```
slender iron
#

the eraser won't clear external flash

#

also make sure you have the newest bootloader

tulip sleet
#

@pastel panther The m4_erase.uf2 only works with an updated bootloader. The m4 bootloader you have probably handles only half of flash.

pastel panther
#

You know, it said that and I ignored it

tulip sleet
#

Let me post an updated bootloader

slender iron
#

ok, now that the release actually works I'm out

#

night all!

pastel panther
#

night

idle owl
#

@slender iron Great work! Goodnight!

tulip sleet
pastel panther
#

@tulip sleet I believe scott gave me a semi-special bootloader that I loaded with bossac because I didn't have a jlink at the time, if that is of consequence

tulip sleet
#

then you should be able to use m4_erase.uf2, and not see erase_m4.uf2 when you drag it on

#

you don't need it anymore, becauase you have a .uf2 bootloader, don't you?

#

that was before we had a proper uf2 bootloader for the m4

pastel panther
#

I'm not sure what I have anymore honestly

tulip sleet
#

this one is fine! I'm using it with and without a jlink

pastel panther
#

I can just load the above with the normal copy to metrm4boot method?

tulip sleet
#

yup!

#

it will return to METROM4BOOT after loading. Then look in UF2_INFO.TXT and you should see v1.23.1-adafruit.1

#

then you need to reload CPy

#

but try the erase_m4.uf2 before reloading cpy

pastel panther
#
UF2 Bootloader v1.23.0-14-g3db9182 SFHR
Model: Metro M4
Board-ID: SAMD21G19A-Metro-v0```
#

not precisely the same?

tulip sleet
#

hmm, hold on. I will try.

pastel panther
#

it is staying in bootloader mode and hording uf2s:

 ~/dev/micro/circuitpython/ports/atmel-samd$ ls /Volumes/METROM4BOOT/
CURRENT.UF2                                       INFO_UF2.TXT                                      firmware.uf2
INDEX.HTM                                         erase_m4.uf2                                      update-bootloader-metro_m4-v1.23.1-adafruit.1.uf2
tulip sleet
#

try double-clicking and starting fresh

pastel panther
#

still seems like the older version: UF2 Bootloader v1.23.0-14-g3db9182 SFHR

#

I'll trying copying it over again

tulip sleet
#

it takes a while to write. It will blink like a blinky for several seconds. Don't press reset until METROM4BOOT reappears

pastel panther
#

ah, there it goes

tulip sleet
#

i just copied the same one onto one of my M4 boards and it worked

#

Do you have

Model: Metro M4
Board-ID: SAMD51J19A-Metro-v0```
pastel panther
#

cool, got master back on

#

ya

tulip sleet
#

in INFO_UF2.txt?

pastel panther
#

yup

#
>>> print ("hewwwo woooood")
hewwwo woooood
>>>```
tulip sleet
#

Great! OK, I'll post the same for everyone else.

pastel panther
#

@idle owl did you end up loading a bespoke bundle from Scott or from the auto-release he posted earlier?

idle owl
#

My 3.0 beta bundle is from the auto-release.

pastel panther
#

ok cool

idle owl
#

I think he just posted the 2.x bundle that he posted to me anyway, so I'm pretty sure all of them are up now.

tulip sleet
#

<@&356864093652516868> Please update your M4 boards to this bootloader. The old bootloader would only write the first 256k of flash. Procedure:

  1. doubleclick to get METROM4BOOT.
  2. Drag this or copy this onto the METROM4BOOT drive.
  3. WAIT about 12 seconds. You will see about 10 blinks or so of the LED, and then it will start pulsing, and you'll see METROM4BOOT. Don't press reset or unplug before that.
  4. Open INFO_UF2.TXT. You should see:
UF2 Bootloader v1.23.1-adafruit.1 SFHR
Model: Metro M4
Board-ID: SAMD51J19A-Metro-v0

If this does not work for you please let me know.

You need this need bootloader to use the erase_m4.uf2, which erases all of flash, when you need to reset your CIRCUITPY filesystem.

idle owl
#

I evidently already have it. That's handy.

tulip sleet
#

<@&356864093652516868> Here's erase_m4.uf2, which is just 512k of zeros (minus 16k for the bootloader).

pastel panther
#

The whole bundle should fit in CIRCUITPY/lib, right? It's only 308K

#
 ~/dev/micro/circuitpython/ports/atmel-samd$ cp -r ~/Downloads/lib\ 5/ /Volumes/CIRCUITPY/lib
cp: /Users/bsiepert/Downloads/lib 5//adafruit_max7219/bcddigits.mpy: could not copy extended attributes to /Volumes/CIRCUITPY/lib/adafruit_max7219/bcddigits.mpy: No space left on device
cp: /Users/bsiepert/Downloads/lib 5//adafruit_max7219/matrices.mpy: could not copy extended attributes to /Volumes/CIRCUITPY/lib/adafruit_max7219/matrices.mpy: No space left on device
``` etc, etc, etc.
And this is after updating the bootloader, loading erase_m4.uf2, and re-loading master
#

This doesn't seem quite right:

Filesystem     Size   Used  Avail Capacity iused ifree %iused  Mounted on
/dev/disk2s1  239Ki  239Ki    0Bi   100%     512     0  100%   /Volumes/CIRCUITPY
tulip sleet
#

on the m4 right now, the SPI flash isn't used, so the 512k flash is divided up, and CIRCUITPY is only about 240k.

pastel panther
#

That explains a lot

tulip sleet
#

sorry! we're working on getting the SPI flash working

pastel panther
#

No problem, I had thought that the SPI flash was working but then confused because I know you're still working on busio and SPI

#

This makes more sense

#

I don't need the bundle just yet, I was just trying to test for Scott

#

i2c is working though, right?

tulip sleet
#

yep, i2c and spi are working. I've tested with several devices. But the SPI flash impl uses DMA SPI, which hasn't been ported over yet

pastel panther
#

Cool. I'll be interested to check the commits for that. I'm finally wrapping my head around the clocks and timers, and I figure SPI is a good next candidate

stuck elbow
#

I will test spi and i2c some more when I get back home

#

right now I only have one display with me

manic glacierBOT
solar whale
#

@slender iron @tulip sleet ran a few tests with new bundles on 2.x (i2c device,rgb_display) and 3.x (i2c devices, neopixels) - no issues. Thanks!

manic glacierBOT
#

I am able to improve the soft reboot case (renaming a file) by "zeroing" out a stack variable right after a declaration. I don't know if there is a compiler option to zero stack allocations, but after writing code to zero, the Blinking Green is now working.

main.c start_mp()

    pyexec_result_t result;
    result.return_code = 0;
    result.exception_type = NULL;
    result.exception_line = 0;

Have you had this problem in other circumstances?

pastel panther
#

Hey @tulip sleet this morning my M4 doesn't mount a CIRCUITPY when plugged in. It worked just fine last night though and I don't think I've changed anything since then

#

the bootloader seems fine

#

no CDC either

#

Should I just re-load CP or poke it some other way to diagnose what happened?

#

@tulip sleet As far as I can remember I left my lappy connected to it via screen when I went to bed

#

@slender iron Any thoughts?

slender iron
#

maybe restart your computer?

pastel panther
#

I turned it off then turned it back on again and it still doesn't show up

tulip sleet
#

@pastel panther do you see METROM4BOOT if you double-click?

pastel panther
#

@tulip sleet yes

tulip sleet
#

did you reboot with it unplugged?

pastel panther
#

Yes?

#

Should I try again without it plugged in?

tulip sleet
#

but you did already??

#

is there a jlink or anything connected?

pastel panther
#

No jlink just a single micro usb

tulip sleet
#

does another CPy board show up? Do you have a 2.1 board like a Feather or a Trinket M0?

pastel panther
#

my feather has 2.x on it I think

tulip sleet
#

just trying to narrow it down to board vs comptuer

pastel panther
#

Yup, seems to work just fine

tulip sleet
#

well, you could try reloading CPY 3.0 onto the M4 board. It's weird to me that you can't even get to the REPL.

#

I know you erased it yesterday with erase_m4.uf2, but did you reload CPy after that?

pastel panther
#

Yea. I was testing the daily bundle with 3.0 from master last night and left if overnight after I got a stale mpy error

#

@tulip sleet I can reload 3.0 but I'm happy to run any other test beforehand if you want. It is strange though.

#

checking current.uf2 now..

tulip sleet
#

do you have a jlink? if so, you could hook it up and ctrl-c it and see where it's running

#

why don't you pull current.uf2 off and drop it here, and I can try it on one of my boards?

pastel panther
#

I'll connect the jlink as well. Should I use gdb?

tulip sleet
#

yes, though if you didn't compile debug, there won't be as much info. then mon reset and continue, and then interrupt it with ctrl-c and do a backtrace

#

I loaded it on my m4 and it works. I can get in via the repl and I see CIRCUITPY with some junk Mac files (._lib, etc.)

#

the commit id is e0eae5c, which is not one I recognize. Did you do a local commit of something?

pastel panther
#

Not recently

#

I thought I had build from master last night

tulip sleet
#

what's the top entry in git log?

pastel panther
#
Author: mrmcwethy <mrmcwethy@yahoo.com>
Date:   Tue Nov 21 11:56:27 2017 -0700

    Enable the Neopixel status light on Metro M0 Express and Feather M0 Express boards
tulip sleet
#

never mind - I'm working on a dev branch and I'm one commit behind.

#

so if you unplug it and plug it back in, you see no /dev/tty.usbmodem411, and no CIRCUITPY?

pastel panther
#

I'm a gdb newb; previously I had started it by specifying a .elf though I don't have one in this circumstance. How should I start it? I have the gdb server running

tulip sleet
#

target extended-remote :2331

#

I have an alias in .gdbinit for that

#
    target extended-remote :2331
  end
pastel panther
#

no mass storage and no cdc

tulip sleet
#

try a different USB port?

pastel panther
#

let me finish this jlink poking and I'll try another

tulip sleet
#

another thing to try: when you plug it in, monitor the OS X syslog: tail -f /var/log/system.log (I think - I don't use a mac regularly; going from a stackoverflow post)

pastel panther
#

no debug flag so this is only so useful:

#0  0x000225e8 in ?? ()
#1  <signal handler called>
#2  0x0000cad4 in ?? ()
#3  0x00018b90 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
tulip sleet
#

do mon reset and continue (c)

pastel panther
#

hmmmm:

USBF:    2030.745    The IOUSBFamily was not able to enumerate a device.
USBF:    2031.300    The IOUSBFamily is having trouble enumerating a USB device that has been plugged in.  It will keep retrying.  (Port 1 of Hub at 0x14000000)
<SEVERAL REPEATS>
USBF:    2039. 34    The IOUSBFamily was not able to enumerate a device.
USBF:    2039.587    The IOUSBFamily is having trouble enumerating a USB device that has been plugged in.  It will keep retrying.  (Port 1 of Hub at 0x14000000)
USBF:    2039.587    The IOUSBFamily gave up enumerating a USB device after 10 retries.  (Port 1 of Hub at 0x14000000)
USBF:    2039.587    The IOUSBFamily was not able to enumerate a device.
#

then a ctrl-c?

tulip sleet
#

is that the different port?

pastel panther
#

No, same port

#

I'll try another

tulip sleet
#

never mind about gdb; I think this is a Mac issue

pastel panther
#

ok

tulip sleet
#

did you plug the feather into that port?

pastel panther
#

into the first port, yes

tulip sleet
#

you have to disconnect or power off the jlink to get it to act normal again, since it kind of takes over resetting, etc.

pastel panther
#

This popped up on syslog right after plugging it into the new port:

Nov 22 10:38:04 bsieper-lm kernel[0]: USBF:    2606. 35    The IOUSBFamily is having trouble enumerating a USB device that has been plugged in.  It will keep retrying.  (Port 2 of Hub at 0x14000000)
Nov 22 10:38:05 bsieper-lm kernel[0]: USBF:    2606.336    The IOUSBFamily was not able to enumerate a device.
Nov 22 10:38:05 bsieper-lm kernel[0]: USBF:    2606.891    The IOUSBFamily is having trouble enumerating a USB device that has been plugged in.  It will keep retrying.  (Port 2 of Hub at 0x14000000)
Nov 22 10:38:05 bsieper-lm kernel[0]: USBF:    2607.192    The IOUSBFamily was not able to enumerate a device.
Nov 22 10:38:06 bsieper-lm com.apple.xpc.launchd[1] (org.apache.httpd[1616]): Service exited with abnormal code: 1
Nov 22 10:38:06 bsieper-lm com.apple.xpc.launchd[1] (org.apache.httpd): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 22 10:38:06 bsieper-lm kernel[0]: USBF:    2607.747    The IOUSBFamily is having trouble enumerating a USB device that has been plugged in.  It will keep retrying.  (Port 2 of Hub at 0x14000000)
<REPEATS>
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF:    2614.623    The IOUSBFamily was not able to enumerate a device.
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF:    2615.178    The IOUSBFamily is having trouble enumerating a USB device that has been plugged in.  It will keep retrying.  (Port 2 of Hub at 0x14000000)
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF:    2615.178    The IOUSBFamily gave up enumerating a USB device after 10 retries.  (Port 2 of Hub at 0x14000000)
Nov 22 10:38:13 bsieper-lm kernel[0]: USBF:    2615.178    The IOUSBFamily was not able to enumerate a device.
#

That was after disconnecting the jlink and moving to a new port

tulip sleet
#

try loading CPy on it again - but I think MacOS may have decided there's something wrong with the device IDs. Do you have a Windows box or some other computer you can plug it into before reloading CPy?

pastel panther
#

I can boot into windows. It will take a minute

#

brb

#

ok, back again

#

Do you want me to do anything before I try it?

tulip sleet
#

no go ahead

#

well, open device manager

#

to see what apepars

manic glacierBOT
#

With my changes above, I am seeing a difference in behavior from Ubuntu 16.04 and Windows 10. On Windows 10 if no main.py exists, you get the blinking Green neopixel. On Unbuntu, you get the solid White (which means in REPL). There is some code that checks the serial port for any available. On Ubuntu, this code I believe is return true, while on Windows 10 I believe its false. I think we have a work status light on Windows 10.

I need to get a debugging system going to go further. I...

pastel panther
#

" USB device not recognized: The last device you connected malfunctioned something something windows don't recognise it"

tulip sleet
#

windows 7 or 10?

pastel panther
#

10

tulip sleet
#

do you have a native win10 box in the house. it's still the same usb hardware

pastel panther
#

I'm going to venture a guess that the m4 is the "Unknown USB Device (Device Descriptor Request Failed)"

#

No, this is my only computer

#

Ah, right

#

Actually I have an old macbook air that might boot

#

(if it's charged)

#

It's pretty old though

tulip sleet
#

do you see any entries in Ports or Disk Drives in Device Manager? What happens when you double-click: do you see the ...BOOT drive? Do you have a USB hub you can interpose?

pastel panther
#

yes, I see the boot drive, no I don't have a hub here

#

waaaait, my old monitor has one

tulip sleet
#

it's like the usb descriptor is messed up in the flash, but that's weird, because it works for me when I load what you read out of flash

pastel panther
#

rustle rustle

#

usb hub acquired, still the same error

#

I agree, that is strange

tulip sleet
#

ok, just go back to Mac and try reloading circuitpython

pastel panther
#

ok

#

just as soon as I can remember how to reboot windows 10

tulip sleet
#

hmmm could be a usb timing problem. because the uf2 bootloader sets up its own clocks, not necessarily the same as circuitpython

pastel panther
#

So I'm on my phone now because Windows needed some alone time

#

Ok, should I recompile with debug, just in case?

pastel panther
#

@tulip sleet I don't know if there is a reason why, but I just compared the current.uf2 to the one I built yesterday and they're substantially different in size

tulip sleet
#

that's because current.uf2 is all of flash, not just circuitpython; it includes what's in the CIRCUITPY filesystem. When I loaded your strange_current.uf2, I also got what was in your filesystem

pastel panther
#

ah

#

neeto

tulip sleet
#

don't bother to compile with debug yet, just reload what you built yesterday

#

and see if it works

pastel panther
#

nope, I copied it over as usual to METROM4BOOT and it's the same as before I copied it over; no mass storage and no serial

tulip sleet
#

load erase_m4.uf2, then reload the cpy .uf2 (you still have your files saved in strange_current.uf2)

pastel panther
#

so erase and load the CURRENT.uf2 I previously pulled off?

tulip sleet
#

no, the firmware.uf2 you built last night

pastel panther
#

ok

#

No dice captain. I loaded the erase uf2, waited for it to stop blinking and go back to a pulse, verified that METROM4BOOT showed up, then copied over the build from last night. Same result

idle owl
#

Hmm.

pastel panther
#

It seems well and truely borked.

idle owl
#

@pastel panther I read through the conversation, but to verify, it's not recognising the device at all? Or does System Information see it but it isn't mounting?

pastel panther
#

yay?

idle owl
#

Nah it's not completely borked. You've got a j-link.

pastel panther
#

@idle owl When not in BOOT mode, there appears to be a USB descriptor error that keeps it from being mounted. Both windows and mac see it but can't mount it properly

idle owl
#

Ok. And the bootloader mounts properly?

pastel panther
#

yup

idle owl
#

The next thing I would do is use the j-link to reflash a .bin of the bootloader. You shouldn't have to reflash the bootloader at this point, but that's what I did last time mine got really messed up. I did it using the j-link. Dan might say otherwise at this point, since they updated things since the last time I had to do that. And we'd need to find you a current .bin of the bootloader before you could do it anyway.

pastel panther
#

right

#

what gdb command do you use to flash?

tulip sleet
#

I would say there's nothing wrong with the bootloader.

idle owl
#

Yeah I agree, I'm simply saying what I'd do next anyway. It shouldn't be the problem, but it might fix it. Again, this is just me coming from what I've done, not some overall understanding of the situation.

opaque patrol
#

I am trying to break out of a for loop and I am getting a syntax error. Is this not implemented or is it a bug?

pastel panther
#

the wife has awaken. I must quest for the exctract of the coffee bean to maintain it's good cheer

idle owl
#

@pastel panther I found flashing the bootloader wouldn't work unless bootloader.bin was in the actual j-link directory (/Applications/SEGGER/JLink###/), and even then I still had to specify the entire path for the command. After using JLinkExe to connect to the board, I used loadbin /path/to/bootloader.bin,0 Other people have not had issues with loading bins not in the same directory.

#

@opaque patrol I'm not sure I understand what you mean

opaque patrol
#

if not coffee:

#

panic()

#

def rainbow(wait):
for j in range(255):
for i in range(len(pixels)):
idx = int ((i * 256 / len(pixels)) + j*10)
pixels[i] = wheel(idx & 255)
pixels.show()
if get_input() not 0:
break
time.sleep(wait)

#

"""

#

I am trying to check if buttonA or buttonB is pressed

idle owl
#

Oh, hmm. Literally break, I understand now. I'm not sure. I've never used it.

tulip sleet
#

@pastel panther if you could try it on the old laptop...

idle owl
#

@opaque patrol It's three backticks on either side of code that makes it a code block. The one in the upper left corner of your keyboard. codeblock

#

@pastel panther Reset PRAM. (Old Genius trick that fixes the most random of things, and does absolutely nothing at the same time.)

tulip sleet
#

@opaque patrol the problem is the if statment before the break if get_input() != 0

#

not not 0 not not not not not

opaque patrol
#

!FALSE is funny because its true

pastel panther
#

OK, feel free to queue suggestions and I'll try them when I get back if I have time before picking up the nieces

tulip sleet
#

you might have meant is not 0, but you're doing a numeric comparison, so != 0 is more canonical

idle owl
#

I thought is not was my Pythonic... Or is that only for things other than numbers?

tulip sleet
#

@pastel panther - i did change some clock rates recently. Try git checkout a9f75a71c5 which will get you to a previous point in time. Rebuild and reload that firmware.uf2 and see if you see CDC and CIRCUITPY. When done you can revert to the tip of master by git checkout master.

#

@idle owl is checks whether two objects are the same object. For integers, yes, they can be same, but are not necessarily for long integers. Example in regular python:

Python 3.5.2 (default, Sep 14 2017, 22:51:06) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 3 is 3
True
>>> 333333333333333333333333333333333333333333333333333 is 333333333333333333333333333333333333333333333333333
True
>>> 333333333333333333333333333333333333333333333333333 is 333333333333333333333333333333333333333333333333332+1
False
>>> 333333333333333333333333333333333333333333333333333 == 333333333333333333333333333333333333333333333333332+1
True
stuck elbow
#

most of the time the only time you want to use "is" and "is not" is when comparing to "None"

#

unless you are doing something really advanced

idle owl
#

@tulip sleet Ohhh nice ok. Thank you

tulip sleet
#

I had a friend who said that two objects are is equals if you put a penny on the railroad track and have one in your pocket and when a train squishes the penny on the track the one in your pocket is also squished. (He was actually talking about LISP eq vs equals, but same concept).

stuck elbow
#

quantum entanglement

#

I think in cpython is simply compares the memory addresses of the object

#

in circuitpython it must be a bit more complicated, since not all objects actually exist in memory

#

(None, small ints, etc.)

tidal kiln
#
if not get_input() == 0:
errant grail
#

Quick question: I'm a verbose annotator and have lots of notes in my CPy code. When using the Trinket M0, it seems to throw somewhat random syntax errors at me when the code reaches around 130 lines. If I delete some of the annotation (sometimes just a few characters), it works fine. Is this to be expected or should CPy be telling me that I have a memory allocation error?

tidal kiln
#

more pythonic than !=

tulip sleet
#

@errant grail this is due to delayed writes. Are you on Windows or Linux? What happens is that the metadata describing your file size is not written out for tens of seconds.

errant grail
#

Ah. Windows, CPy 2.1.

tulip sleet
#

So, after you write the file, do an "Eject" or safe remove. That will force the rest of the data out. The Mu editor does this automatically but I haven't gotten it to work yet on Windows.

stuck elbow
#

@tidal kiln I don't know, both are fine, depending on the context

errant grail
#

Thanks. I'm using Atom -- installing Mu is too complicated for me at this point.

tulip sleet
#

I was thinking of writing a plugin for Atom that is trigger when a write happens, and it flushes the write. It would not be hard: there's already a plugin to execute a command on an event (like a file write). But I have to assemble the different pieces.

errant grail
#

@tulip sleet That would certainly be helpful for a CPy neophyte like me. I need a dev tool that's as simple to use as CPy is to code. Thanks again for your help.

idle owl
#

@tulip sleet Given how many people start with Atom, that would be amazing.

errant grail
#

Modifying the editor seems like a move towards a customized IDE -- something that is counter to what I'm trying to achieve with CPy. Need to have a way to edit the code in the field without special editors.

idle owl
#

@CGrover#2710 You'd install a package, that's it. It's really simple. I did it when I first started with Python to have some color coding and tab completion available to me.

errant grail
#

@idle owl Yes, pretty simple. I'll have to think about how to support the projects I've given to family members that I can only support remotely. The Arduino IDE was very problemmatic in that regard. The beauty of CPy is that they only need to use a text editor and treat the system as a thumb drive. I should be able to modify the procedure so that they do a clean eject before restarting. We'll make it work!

idle owl
#

@CGrover#2710 It's true! And you can get around it by safely removing each time. Dan's just trying to come up with a way to avoid the extra step. But the extra step can be done in the field with no changes!

errant grail
#

@idle owl Indeed. And I would be excited about something like Dan's idea!

tulip sleet
#

I already found these before

errant grail
#

@tulip sleet Appreciate the links and the safe remove keyword; should help me on the initial dev end. My family "clients" will only have the default Windows tools available to them -- I'll simply have to deal with that procedurally.

errant grail
#

@tulip sleet Thanks again for clearing up the memory allocation issue. Puts me back on the right path!

idle owl
#

Hah! Fixed something I was certain I needed help with.

tulip sleet
#

@idle owl ๐Ÿ‘ like doing problem sets

#

well, more fun, I'm sure

idle owl
#

I had help with the code, and it took entirely readable code and made it super compact and efficient, so troubleshooting it for me suddenly got really difficult. But I figured out where the problem was in the end.

idle owl
#

@tulip sleet @slender iron Why is the digital setup for the pads on the CPX being called by the analog name (ie. A7 vs D1)?

tulip sleet
#

@idle owl I think it was to emphasize that all the pins had analog capability (as opposed to on the original CPlayground)

idle owl
#

Hmm.

#

Thanks, @tulip sleet

tulip sleet
#

I'm guessing a bit, but I thought I heard something like that. If you look at the 32u4 CP, it has a rather random assortment of pin numbers, which are more for Arduino compatibility and convention than anything else. I think Limor wanted to step away from that.

idle owl
#

Is there a reason why the digital pins for the pads aren't included in dir(board) then?

#

It was odd using A7 to change the digital pin state. It sort of follows that it's what's printed on the board, but it doesn't follow if you're using the pinout to determine which digital pin to use.

#

I see it does make the pinout explanation a lot cleaner than the original Circuit Playground.

manic glacierBOT
slender iron
#

@idle owl I'd expect them to show in dir(board)

idle owl
#

The only digital pins that show in dir(board) are associated with buttons, switch, LED etc

slender iron
#

hrm

#

I don't really like the D# or A# style anyway

#

its all inherited from arduino

manic glacierBOT
idle owl
#

@slender iron What would it look like if it wasn't arduino style?

slender iron
#

it gets a bit tricky because we can't do #4 in python

#

and 4 wouldn't work either

idle owl
#

Hmm

slender iron
#

so maybe just N4

#

or P4

idle owl
#

So is the fact that the digital pins don't show up in dir(board) something we need to look into?

#

What do N and P refer to?

slender iron
#

number or pad

idle owl
#

ah

slender iron
#

they aren't defined in pins.c, thats why they are missing

idle owl
#

Oh I read your earlier comment as they were defined. That was my confusion.

#

pins.c wasn't clear to me, so looking at it didn't help with that, heh

slender iron
#

its essentially a python dictionary

idle owl
#

Oh ok

slender iron
#

board names on the left, pin objects on the right

idle owl
#

Ohhh.... ok. I see it now.

#

So since it's named A7 in pins.c, it works for digital or analog because it's a reference to PB08 which does whatever it's supposed to do based on the type of code?

slender iron
#

right, A7 is just a name

idle owl
#

So we could go in there and add all the digital pin names if we wanted to?

tulip sleet
#

how would you want them to map?

#

A7 == D7, or some other?

idle owl
#

Oh I didn't think about that. I assumed we'd use the fancy pinout from the guide.

#

It's weirdly numbered though.

tulip sleet
#

i see, yes, there are "random" mappings (A6 = D0, A5 = D2, etc.)

idle owl
#

Yeah.

tulip sleet
#

we could list those, but not sure how it helps, since there's nothing except the guide that says A5=D2

#

Arduino, yes, CPy, maybe not

idle owl
#

Hmph.

#

Can we consider renaming them for CP then?

#

Blergh. It starts getting confusing again, but it's kind of confusing as it is.

tulip sleet
#

What's on the board is concrete reality: no tables to consult

idle owl
#

Yeah. And I've advocated for exactly that before. But it gets confusing because it's been impressed upon me that A refers to analog, so then using the A7 pin to do digitallio seemed wrong. And I'm not sure I would have figured it out. I had help.

#

I think I knew just enough to confuse myself. Not enough to figure it out, and not so little that I just assumed use the name on the board.

tulip sleet
#

even on the arduino, A0-A5 can be used for digital. They just can also be used for analog. So it's not really inconsistent

idle owl
#

I've never used Arduino ๐Ÿ˜„

tulip sleet
#

you are the new generation

#

no dial phones, no flip phones, no CRT's, no arduino (Ok that may an exaggeration)

idle owl
#

A bit! lol...

manic glacierBOT
stoic gazelle
#

heh, @idle owl calls me young (I started on a 286 and BBSs (had to worry about long distance and hogging the phone line))

solar whale
#

286s and BBSs were quite an advancement๐Ÿ˜‰

idle owl
#

Hooray for small changes. Ended up deleting a branch and starting over.

manic glacierBOT
idle owl
#

@drowsy geyser How's the rover coming?

drowsy geyser
#

@idle owl Ok. Kind of stuck getting the CCS811 and FONA808 to work. The wiring looks good, but... no communications. On the other hand, I got the Azure-side data pipeline configured (yay!), the GitHub repo set up, and shared storage in my OneDrive for Business tenant and shared OneNote set up for the dev team. I'll probably take a break from fighting with the hardware and work on the documentation some tonight.

idle owl
#

@drowsy geyser Good job with the data stuff! Totally understandable. A break can often help. I'm staring at failing code. And I keep trying to convince myself to take a break. But then I'm sure I'll find it if I read through it one more time....

drowsy geyser
#

Yeah, I'm going to take a break. I'll go read something. Or maybe listen to Andy Wier's new book and build another camera system (number three of four).

idle owl
#

All good ideas. The camera systems sounded really neat, I remember you explaining what went into them.

drowsy geyser
#

I designed the distributed command protocol this morning. The master computer will be able to use LIDAR data to identify close-by objects, then request the camera array "look at" them and return identifications and rectangles. This will let the hazard avoidance system identify objects in the environment, decide whether they need to be "avoided," and navigate accordingly.

idle owl
#

So amazing.

drowsy geyser
#

It'll have a surprising amount of AI in it....

fading solstice
#

And i am just fooling around wih a flashing neopixel. Just doesn't compare.

drowsy geyser
#

But ... I couldn't do what y'all are doing with the M4, @fading solstice !

fading solstice
#

@drowsy geyser thanks, but you are amzing. @idle owl I was wondering if you want to try a fix to the issue you reported.

#

@idle owl I was wondering if you want to try a fix to the issue you reported.

idle owl
#

@fading solstice Sure. The error code with no main.py present, right?

fading solstice
#

blinky lights

idle owl
#

Yeah, looks like the error flashing when there's something wrong with main.py... that's what I meant

fading solstice
#

yes, can i send you .uf2 file

idle owl
#

Yep definitely!

fading solstice
#

what board, metro m4?

idle owl
#

Yep

fading solstice
idle owl
#

Hey on renaming main.py I get a pulsing green! Nice!

fading solstice
#

what os is the board being connected? WIndows, Mac, Linux

idle owl
#

MacOS

#

Sierra

fading solstice
#

That is one os i haven't try it on.

idle owl
#

Nice!

#

Let me run the eraser on it and reflash the firmware clean. That was the other thing that was returning flashing.

fading solstice
#

ok

#

Thanks for doing this.

idle owl
#

Yeah for sure!

#

Works after the eraser too! Nice job!

#

Pulsing green across the board. Readding main.py to rename one more time.

#

Pulsing green!

#

All the ways I got it to flash before are pulsing green now.

fading solstice
#

Sounds good. let me know if you see any strange behavior

idle owl
#

Will do

fading solstice
#

i released that change

#

well, did a pull request actually

idle owl
#

I can put in a review on it

idle owl
#

Already there ๐Ÿ˜ƒ

#

Submitted and approved.

fading solstice
#

Perfect. Now you are amazing!

idle owl
#

As are you! No more flashing!

#

Not sure I've ever gotten the pulsing green on the M4, now that I think about it.

fading solstice
#

Blinky-blinky. I doubt you saw ever. Now i must go to bed

idle owl
#

Have a good night and a lovely holiday!

fading solstice
#

BTW @idle owl What Time zone are you in?

idle owl
#

Eastern

fading solstice
#

Well, enjoy your holiday as well.

idle owl
#

Thank you

#

Getting on time for me to call it anyway as well.

manic glacierBOT
solar whale
#

@slender iron @tulip sleet is there an easy fix for this? Just did git pull and would like to use the nrf updates. ```$ git submodule update --init --recursive
Submodule 'lib/nrfutil' (git@github.com:adafruit/nRF52_nrfutil.git) registered for path 'lib/nrfutil'
Cloning into 'lib/nrfutil'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:adafruit/nRF52_nrfutil.git' into submodule path 'lib/nrfutil' failed

#

@slender iron @tulip sleet found workaround change git@github.com:adafruit/nRF52_nrfutil.git to https://github.com/adafruit/nRF52_nrfutil.git in .gitmodules

manic glacierBOT
#

after gitt pull for latest master
git submodule update --init --recursive fails for lib/nrfutil due to a permissions error:

$ git submodule update --init --recursive 
Submodule 'lib/nrfutil' (git@github.com:adafruit/nRF52_nrfutil.git) registered for path 'lib/nrfutil'
Cloning into 'lib/nrfutil'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@git...
manic glacierBOT
#

attempting to build:
make BOARD=feather52 V=1 SD=s132
results in:

FREEZE freeze
Creating build-feather52-s132/frozen_mpy.c
CC build-feather52-s132/frozen_mpy.c
CC ../../main.c
../../main.c: In function 'nlr_jump_fail':
../../main.c:343:5: error: implicit declaration of function 'HardFault_Handler' [-Werror=implicit-function-declaration]
     HardFault_Handler();
     ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../../py/mkrules.mk:53: recipe for target 'build...
#

M4 status LED flashing with no main.py present #447 fixed a problem like the original issue. When you don't have a code.py file, the board should display a slow blinking Green light. Note the on Linux, I had to remove the ModemManger because that service was sending data to the board. So on Linux, you may be getting sent to the REPL instead. With my fix, the REPL should handle ctrl-D as expected.
The issue on Windows sound like a different problem.
Please retest with latest code.

#

I tried just disabling the warning above but things deteriorate...
results in:

Creating build-feather52-s132/frozen_mpy.c
CC build-feather52-s132/frozen_mpy.c
CC ../../main.c
CC supervisor/port.c
In file included from supervisor/port.c:26:0:
../../supervisor/port.h:44:8: error: unknown type name 'uint32_t'
 extern uint32_t _ezero;
        ^~~~~~~~
../../supervisor/port.h:47:8: error: unknown type name 'uint32_t'
 extern uint32_t _estack;
        ^~~~~~~~
../../s...
manic glacierBOT
manic glacierBOT
errant grail
#

@tulip sleet @idle owl Regarding my earlier question about delayed file writes using Atom on a Windows machine: I found an easy workflow fix. I edit and save the source in a directory on the windows machine, copy it to the already mounted Trinket M0, delete the main.py file and rename the new file to main.py. No need to dismount the drive or restart the PuTTY session.

#

A benefit is better version control, as well. Just have to resist live editing of the main.py file on the Trinket. ๐Ÿ˜‰

#

Now on to trying to package the helper modules into a library...

idle owl
#

@CGrover#2710 It also means if the Trinket becomes corrupted, you won't lose any of your work. But live editing is tough to resist. ๐Ÿ˜ƒ

errant grail
#

@idle owl Yeah, that was my downfall in this instance. I used to manage configuration/change control for a corporation so I should know better!

solar whale
#

@timber lion Just saw the new CP guide blog post - thanks - One question - the IR guide does not appear to have any CP code examples. ?? Is it the wrong link?

fading solstice
#

On ubuntu 16.04 while trying to get gbd debugging installed, i have lost something for build circuitpython.

#

Building metrom0 or metrom4. I think i need an update to the gcc compiler.

solar whale
#

Looks like you have an older version of gcc installed.

#

That is arm-none-eabi-gcc. Should be version 6.3.1 or something close. You prbably ended up with 4.9.3 when you instaleed gdb and it does not support -lto.

solar whale
fading solstice
#

@solar whale Thanks. i will try that

timber lion
fading solstice
#

@solar whale wanted to let you know i using gdb and set my first break.๐Ÿค“

hollow tartan
#

is there a link to the beta version of Metro Express Explorers Guide on Learn.Adafruit.com?

solar whale
#

@fading solstice Did upgrading gcc take care of the problem?

silver tapir
#

Any christmas light project out there that uses circuitpython?

#

If not... my tree is gonna look like @timber lion's arc reactor ๐Ÿ˜ƒ

solar whale
#

@timber lion Thanks for the updated link - looks great - I'll try to work through it this weekend. The link does work now. Thanks!

hollow tartan
#

@solar whale It's fine. I will follow the arduino guide and substitute CP programs as needed.

pastel panther
#

@silver tapir why not make your own? A CP board and a neopixel strand makes for a quick and easy light project

#

Or, find a container with some diffusion and put a CPX in it to make a tree topper

silver tapir
#

@pastel panther I'm on it. Last few years I had a couple of strands on the tree but with an arduino.

#

I probably used the arduino for something else, so I'm rebuilding it with an M0

sick creek
#

@slender iron how modular Circuitpython is?

slender iron
#

Its pretty modular. some of the work I've done is to actually share more between different ports, which is per-microcontroller

pastel panther
#

hey @slender iron, I'm starting to look at SERCOMs. Is busio/SPI.c the best reference? That and the datasheet?

slender iron
#

@pastel panther yeah, any of the classes that match with SERCOM functionality

hollow tartan
#

I am working thru the examples in the https://learn.adafruit.com/experimenters-guide-for-metro using the Circuit Python programs and NOT the arduino .ino programs. Anyway, Geany lets me drop in a main.py and I reset the Metro X and it runs if there are no errors. TeraTerm does not always let me back in. I just now had to: 1. Close TeraTerm, 2. Eject the "Removeable Disk" F: and 3. restart the TeraTerm. Yes, I am using Win7. Does Win10 make life easier? I guess what I am asking for is a pointer to the recommended Windows steps/procedures that AdaFruit recommends/endorses for classroom use. CP 2.0 is good to go right? no developmental beta problems with it, right?

Harness the power of the Adafruit Metro by making 18 Circuits!

pastel panther
#

@slender iron, any idea why the datasheet doesn't show a SWO for the 48 pin SAMD51G chips?

hollow tartan
slender iron
#

brent is back at school but is around occasionally. @prime flower

#

@pastel panther its probably not broken out. its not required to load code

manic glacierBOT
sick creek
#

@slender iron on saturday i could get a new laptop so i can get leap with the dev work so modularity in Circuitpython is a plus

#

I havent able to flash my Pi's SD-cards lately as my laptop what only have sd-card reader lost regonize sd-card short period of time

hollow tartan
#
pulseio         digitalio       board           time
__name__        simpleio
>>> from simpleio import Servo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name Servo```
#

is Servo available in CP 2.1?

#

How do I reach it?

#

simpleio.mpy is in /lib alreadyblinka

#

HW = Metro Express M0

slender iron
#

@hollow tartan did you load it before that? it looks like it might be half loaded. try loading the newest simpleio mpy, safely ejecting and then resetting the board

hollow tartan
#

Could be. Okay.. thanks. Right now I am learning about Python Lists: append, remove, etc.

stuck elbow
#

Funny, I can't get SPI to work on feather m0 at 24MHz, even though it runs on trinket m0 just fine. I wonder if it's because different pins have different max speed, or if trinket's mcu is actually better? Or maybe because the feather has an external oscillator?

hollow tartan
#

Just a friendly reminder: ```>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

stuck elbow
#

@hollow tartan that's the other spi peripheral, though

hollow tartan
#

โ–ถ what about: Re: Feather M0 - SPI issues

by ProfSparkles on Wed Nov 22, 2017 3:54 pm
Ok so turns out it wasn't related to SPI at all and it was just that the IC needed a reset before it would work with the Feather, which seems to be needed on ARM platforms in general but wasn't added to the library yet. If you have the same issue have a look at the github issue that I opened https://github.com/miguelbalboa/rfid/issues/347

stuck elbow
#

I'm just gettting OSError 5 when I try to set SPI clock speed to 24000000 โ€” looking at the code, that happens when the loop that looks for the correct clock division runs out of possibilities.

#

so, logically, the ranges are different between Trinket M0 and Feather M0 Express, and I'm wondering what makes them different: the use of different SPI peripheral on the chip (it would make sense to use the fastest one for the SPI Flash on the M0 Express), the external oscillator (Trinket M0 doesn't have one and uses an internal one), or differences between the versions of the microcontroller (I think that would be unlikely, though). I can probably find the answer in the datasheet, but I thought I would ask here just in case someone knew from the top of their heads.

idle owl
#

@stuck elbow Always worth checking before diving into a datasheet.

solar whale
idle owl
#

If I need to debug code on a CPX, what options do I have besides print statements and such? pdb isn't available.

stuck elbow
#

@idle owl I think you can ctrl+c the code (or otherwise break it), import main and get access to all the local variables there

#

in MicroPython it was easier, you didn't have to import it

idle owl
#

hmm ok.

solar whale
#

@stuck elbow sorry - reread your post - looks like that was what you were already referring to.

stuck elbow
#

@solar whale no need to be sorry, I really appreciate you looking too, extra eyes always help

idle owl
#

So I actually have no idea how to debug.

#

I was able to import code though (I was using code.py)

tidal kiln
#

@idle owl debug circuitpython code?

idle owl
#

@tidal kiln Yeah.

stuck elbow
#

@umbral dagger is working on a better debugger

#

I think

idle owl
#

Yeah

stuck elbow
#

or I'm confusing people here, which happens to me all the time, so sorry if I do

tidal kiln
#

try what @stuck elbow suggested. didn't know that worked with cp. (i'm going to try it also)

idle owl
#

No, you're right

#

I was able to import code but I have no idea where to go from there. It's not that it didn't work, it's that I don't know what to do with it.

#

@stuck elbow The "you're right" was for you. That's who is writing it.

tidal kiln
umbral dagger
#

I got distracted (and will be partly for a while) by the sino:bit

idle owl
#

This is getting over my head quite quickly.

solar whale
#

@stuck elbow I don't see anything in the code that distinguishes a Trinket_M0 from Feather_M0_Express and it looks like 250K is the highest you can go, Is that correct?

umbral dagger
#

@stuck elbow @tidal kiln @idle owl I'm working on capturing the context where breakpoint() was called, so that you have repl access to locals/params from there.

idle owl
#

I think I understand what that means.

#

breakpoint() is the failure point? And then it gives you access to what is failing?

tidal kiln
#

you could hit ctrl-c, get a repl, and then start manually interacting with stuff

umbral dagger
#

breakpoint() drops you into the repl with some extra stuff for debugging.

tidal kiln
#

or add that breakpoint() to your code to do same thing as crtl-c

umbral dagger
#

and if you pass a boolean to breakpoint it only does that when the boolean is true

tidal kiln
#

neat

umbral dagger
#

You can also pass in a string that gets printed when the repl starts, so you know which breakpoint was triggered (if you have more than one)

#

Like I said, it works fine with globals now. That was the easy part ๐Ÿ˜ƒ

tidal kiln
#

@stuck elbow i can't get it to currently work. how are you doing it?

#

@idle owl are you asking in general? or have you run into a trouble shooting issue where simple print stuff isn't working?

idle owl
#

The issue is in the library, so print statements won't work.

tidal kiln
#

a library you're working on?

idle owl
#

Yeah, it's the code we were working on the other day

tidal kiln
#

you can still add them if you want. trick is to remember to remove them.

stuck elbow
#

@pulsar bloom seems like you can't do that after an exception

idle owl
#

I've tried using them in the library before and they don't end up printing anything I thought...

#

I'll try again.

tidal kiln
#

@stuck elbow as i understand it, it works in microptyhon but currently not in circuitpython (see issue link for discussion)

#

@idle owl yeah, that's weird. in general, print should print.

idle owl
#

Ok it worked that time. But there's very few self references in this one, I wonder if it doesn't print as much if there's a lot of selfs.

#

I don't think this is helping me figure out the problem though.

tidal kiln
#

can you provide more info? you're working on shake detect?

idle owl
#

Yeah. I wrote it to expose shake_threshold as a variable, and I gave it a default value (I just tested though, that's not the problem, taking away the default still doesn't work). The code works fine if I don't change the variable so python while True: if cpx.shake: print("Shake!") works fine.

#

If I try to change the variable, so python while True: if cpx.shake(shake_threshold=25): print("Shake!") it fails with "type error NoneType object not callable".

Now, I figured out that means that I'm trying to call a variable as a function or a function as a variable, I don't know which. But that means I apparently don't know how to write it so there's an exposed variable (Which I've done on other members of the API, so I don't get why there's the issue here). I tried doing it so it's a required variable, so there's no default, and I get a whole new set of errors.

#

It looks like it should work to someone who knows better than me, so that's why I was trying to head into debugging to figure out exactly where it's failing.

#

At their suggestion.

#

Buuuuut.... I don't know how to debug, lol. So that was a quickly failed proposition.

tidal kiln
#

post your code section where you define shake

idle owl
#
    def shake(self, shake_threshold=30):
        avg_count = 10
        avg_delay = 0.01
        shake_accel = (0, 0, 0)
        for i in range(avg_count):
            shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
            time.sleep(avg_delay)
        avg = tuple(value / avg_count for value in shake_accel)
        total_accel = math.sqrt(sum(map(lambda x: x * x, avg)))
        if total_accel > shake_threshold:
            return True
tidal kiln
#

no decorator?

idle owl
#

It works ok if I use it outside of the class, so just at the top of code.py

#

It's there, I didn't include it

#

@property

tidal kiln
#

that's probably it

idle owl
#

No, I mean it's in the file, I didn't paste it

solar whale
#

@stuck elbow just curious - are you able to set the SPI baudrate to 24000000 on any of the M0 boards? I'm just wondering if I am reading the code correctly. It looks like the esp8266 can handle that , but I don't see how the SAMD21 code would allow it.

tidal kiln
#

no, i mean adding the decorator doesn't let you pass in the parameter like that (i think)

idle owl
#

Oh.

#

Hmm.

tidal kiln
#

the decorator makes it such that cpx.shake is like a variable

idle owl
#

Without @property it's constantly detecting "Shake!"...

tidal kiln
#

and you're trying to call it like it's a function

idle owl
#

Unless I specify a threshold.

tidal kiln
#

without decorator you'd have to change the calling code as well

#
while True:
   if cpx.shake():
        print("Shake!")
idle owl
#

Can it be in the API without the decorator? I guess I thought it was required because it's on everything else.

#

Good call on parens.

tidal kiln
#

one approach might be to make all the shake detect related "knobs" be class members, and then just access them directly

#

instead of passing them in as parameters

idle owl
#

Could it be written into a separate class in the same file, and then called in express? There's one other thing in the API that is like that

tidal kiln
#
    def shake(self):
        shake_accel = (0, 0, 0)
        for i in range(self._avg_count):
            shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
            time.sleep(self._avg_delay)
        avg = tuple(value / self._avg_count for value in shake_accel)
        total_accel = math.sqrt(sum(map(lambda x: x * x, avg)))
        if total_accel > self._shake_threshold:
            return True
#

yeah, it could be in another class, for example, maybe it should be in the lis3dh class

idle owl
#

I just meant writing it into a little separate thing in express.py, not doing any crazytown changes to something else...

tidal kiln
#

the changes would be adding capability though, like just adding code.

#

and what if if someone uses the lis3dh breakout with a trinket and wants to do shake detect?

idle owl
#

Ok valid.

#

It occurs to me that I think I'm afraid to leave the express class because it's all I know, and driver files look terrifying.

tidal kiln
idle owl
#

Yes.

#

No idea where something like what I wrote would go in that. In the API it's obvious. Take working code, turn it into a def, sort it into the API. I'm guessing it's similar in lis3dh but it's not obvious to me.

tidal kiln
#

that driver also has a base class and then derived classes for i2c / spi - you understand that part? (OOP stuff)

idle owl
#

I'm not sure if I do. Are you referring to the multiple classes written into it, one of which has i2c in the name?

tidal kiln
#

yep. and note the class definition looks like this:

class LIS3DH_I2C(LIS3DH):
idle owl
#

Yeah

#

Same for SPI I see

tidal kiln
#

which is python's way of doing inheritance

#

LIS3DH is a base class for LIS3DH_I2C

#

LIS3DH_I2C derives from LIS3DH

#

various ways of saying it

idle owl
#

Ok yah

#

So shake would go in the base class then?

tidal kiln
#

bingo

#

and the code could in general look basically like what you've already written

idle owl
#

ok

#

Forking.

tidal kiln
#

or you could pass the buck and post an issue in the lis3dh repo to add shake detection

idle owl
#

But that means waiting until that's done to get it onto the CPX.

tidal kiln
#

yup

#

don't want to wait? fork, mod, pr.

idle owl
#

And then get the frozen modules updated. Testing is going to be rough, it fails memory allocation really quickly with this one not frozen.

tidal kiln
#

oh yeah, the cpx build has some stuff frozen in, right?

#

to deal with that

idle owl
#

Yep

#

Including lis3dh

tidal kiln
#

mpy-ing work?

idle owl
#

But it'll take a local .mpy before the frozen module, so that's easy enough. Even with .mpy, it can fail.

#

It was doing it earlier every so often before I realised I had imported the entire bundle for testing.

#

Remembered rather.

tidal kiln
#

sounds like that'll work then, if you want to test your mod's to lis3dh

idle owl
#

Yeah it'll at least use it instead of the built in module, but memory allocation errors still happen every so often even with using an mpy

tidal kiln
#

oof

opaque patrol
#

@idle owl I have noticed memory allocation issues when trying to use the cpx class with a long code file. I think part of the problem could be that cpx is setting up everything in the init function. I wonder if this could be improved by only initializing sensors and such that we plan to use?

idle owl
#

@opaque patrol Are you referring to the cpx API?

opaque patrol
idle owl
#

Yeah ok. The plan is to freeze the API as well, at which point it won't have the same impact on memory. We haven't gotten there yet as there's still a few things we want to add to it.

#

We've tried to keep what we can out of init. I've had trouble getting some things to work if they're not in init, but that could be th limitations of my knowledge.

idle owl
#

@opaque patrol The other thing that affects it is what you're using. The accelerometer uses a lot more memory than pretty much anything else. So I think you could have some pretty lengthy code that used the buttons repeatedly and you'd have to work to run out of memory. Add in significant use of acceleration and you'll eat through memory pretty fast. I'm assuming based on my experience though.

#

There are definitely ways to improve memory usage, but I think the best solution is for us to get the class frozen. I think it might be something we could do sooner rather than later, even if we still have changes to make. Is it an problem you're running into that's causing you issues?

opaque patrol
#

@idle owl Right, but if I am not planning to use the acceleration in my code, then perhaps don't initialize it?

idle owl
#

Yeah, I understand. I'll keep that in mind. When we wrote this, we didn't have a lot of testers, so how we write it going forward will be affected by real-world usage. You're exactly who we need to help shape it.

opaque patrol
#

@idle owl I don't know if you can overload the init function. One idea I had was maybe add a dict to the init parameters that defaults to all true and then you could pass in a key: value for anything you don't want initialized. Then you would have to check this before each item is initialized...

idle owl
#

I only partially understand how that would work, but I'm making a note of it so I can figure it out and see whether it's something that might help.

#

The point of the CPX API is to be simple, a place to start when you're new to CircuitPython and even to Python and programming in general. There are some suggested changes that didn't fit with that idea and we chose to not include them because they moved outside this idea. But, like I said, all of this changes as people start using it. We want it to be the best for everyone using it and it will evolve as that happens.

tidal kiln
#

@opaque patrol are you wanting to kind of ala carte the CPX circuitpython support to only what you're using?

idle owl
#

So thank you for your ideas ๐Ÿ˜ƒ I'm really excited about how all of this is going to change

opaque patrol
#

I think you could just add **kwargs, but I get the point that CPX is meant to be simple first.

idle owl
#

@tidal kiln The shake code is "working" but the math is really different when using it from lis33dh

#

I tried changing the range because this made the most sense as the culprit but, while the code runs, I'm not convinced range is changing anything.

#

The sitting still math is correct, comes out to ~9.8. But shaking it has a really limited range now. I thought at first it wasn't working at all until I printed "total_accel" from the library. It wasn't hitting >30 was the issue.

#

@opaque patrol Both of those ideas will default to working as it does right now, correct? And if you wanted to change it, you'd specifically be passing in something?

stuck elbow
#

@idle owl maybe the accelerometer is in a lower range/higher accuracy mode?

idle owl
#

@stuck elbow That was my thought and I thought I had the code right for changing it, but it doesn't seem to affect it. So I'm thinking my code is wrong.

opaque patrol
#

@idle owl Yes, but I don't know how much benefit it would add

idle owl
#

@opaque patrol That can be figured out. ๐Ÿ˜ƒ I wanted to make sure I even had a solid initial understanding of what you'd suggested.

tidal kiln
#

@idle owl paste your code block being used in lis3dh

idle owl
#
    def shake(self, shake_threshold=20, avg_delay=0.01, avg_count=10):
        shake_accel = (0, 0, 0)
        for i in range(avg_count):
            shake_accel = tuple(map(sum, zip(shake_accel, self.acceleration)))
            time.sleep(avg_delay)
        avg = tuple(value / avg_count for value in shake_accel)
        total_accel = math.sqrt(sum(map(lambda x: x * x, avg)))
        print(total_accel)
        if total_accel > shake_threshold:
            return True```
#

I changed the threshold default so it would work.

tidal kiln
#

decorator?

idle owl
#

No

#

It was weird in the other one with a decorator, so I didn't include it.

#

That's the entire codeblock.

tidal kiln
#

might want to add an explicit False return

#

what kind of values do you get from the print?

idle owl
#

Ok yeah, I removed it in the other one after it acted like it didn't need it. Thanks for catching that.

opaque patrol
#

@idle owl Are you going to have it play a bell ringing sound when shake returns true?

idle owl
#

@opaque patrol Only if you wanted it to..? It'll basically be an input...

#

@tidal kiln Base value of ~9.8 if the board isn't moving, then up to about 25 max if I shake it really hard.

#

@tidal kiln The original code was much higher. Which gave more of a range to alter sensitivity. Plus I really want to know why it's different now.

#
-0.0766281 -0.0766281 9.69345
9.72512
-0.19157 -0.038314 9.69345
11.2341
6.32182 17.9693 19.4635
21.8341
Shake
-19.5018 19.5402 -19.5402
20.7342
Shake
19.5018 19.5402 19.5402
24.7792
Shake
-7.04978 19.5402 -9.5402
8.93377
0.0 0.421454 10.613
9.72855```
#

That's also printing x,y,z

tidal kiln
#

maybe what @stuck elbow said

#

i don't see an explicit setting in the lis3dh code:

idle owl
#
import lis3dh
import time
import busio
import board

i2c = busio.I2C(board.ACCELEROMETER_SCL, board.ACCELEROMETER_SDA)
lis3dh.range = lis3dh.RANGE_16_G
lis3dh = lis3dh.LIS3DH_I2C(i2c, address=0x19)


while True:
    x, y, z = lis3dh.acceleration
    print(x, y, z)
    time.sleep(0.5)
    if lis3dh.shake():
        print("Shake")
tidal kiln
idle owl
#

Is my code.

#

But I've changed it to the other options

#

and it doesn't seem to change

tidal kiln
#

check datasheet for default range

idle owl
#

Ohh ok

#

looking now

tidal kiln
#

it might be 2g = 2*9.8 = 19.6 m/s^2

#

maybe it has a little headroom to let you see 25

#

but then it rails out beyond that

idle owl
#

Hmm

tidal kiln
#

8g = 8 * 9.8 = 78.4

#

or just try setting it explicitly as a quick check:

lis3dh.range = adafruit_lis3dh.RANGE_8_G
idle owl
#

I thought I had set it explicitly. Going to try again.

#

Also not seeing it in the data sheet.

tidal kiln
#

oh wait. sorry. just now looking at your code.

#

you set 16g?

idle owl
#

At 2_G I get the same numbers.

tidal kiln
#

oh, set it after you instatiate it

idle owl
#

Slightly less. So 21 is max-ish

tidal kiln
#
lis3dh = lis3dh.LIS3DH_I2C(i2c, address=0x19)
lis3dh.range = lis3dh.RANGE_16_G
idle owl
#

It didn't seem right to me. How do I do that?

#

Oh...

#

it doesn't run that way.

#

Let me try it again

#

Yeah I moved it because of this: AttributeError: 'LIS3DH_I2C' object has no attribute 'RANGE_2_G'

tidal kiln
#

oh. hold.

idle owl
#

It works in the CPX code which is weird. The difference is I have it in / on the CPX, instead of in /adafruit_lis3dh/

tidal kiln
#

name shadowing

#

change your variable name

idle owl
#

ooh ok

#

Which one in the range thing changes then

tidal kiln
#
accelo = lis3dh.LIS3DH_I2C(i2c, address=0x19)
accelo.range = lis3dh.RANGE_16_G
idle owl
#

AH There it is!

#

And 2 gives me the low numbers, and 16 gives me much higher numbers.

tidal kiln
#

although, how does that import work? adafruit_li3dh vs. lis3dh?

idle owl
#

It's just whether it's in the lib folder or not

tidal kiln
#

that brings in the non-frozen module?

idle owl
#

If it's in root, yes

#

Or rather

#

if it's on the CPX anywhere, yes

tidal kiln
#

which is the one your modifying

idle owl
#

It checks locally before checking frozen evidently

#

Local in root, there's only express in the lib folder

#

I can't edit the frozen one that I know of.

#

But it's using mine. Shake works happily now and is giving me numbers that make sense with 8G which is what the default is on the CPX.

#

Seems the default is 2G... based on the numbers anyway. I didn't find it in the datasheet.

#

Ahhhh!!! I modified a driver!

tidal kiln
#

pg31. sec 8.11, CTRL_REG4, FS1-FS0, default value = 00

#

which is 2G

idle owl
#

Hey, ok yeah

#

Thank you ๐Ÿ˜„

tidal kiln
#

np. and gotta run now. good luck.

idle owl
#

Ok thank you so much! Have a good one, @tidal kiln

tidal kiln
#

oh. 2Gs per axis. so if you got 2Gs on two orthogonal axes, then total acccel would be greater than 2.

#

because math

worn birch
#

Hey Guys, so I have forked the repo and got a travis account ... I am still looking into this rosie ci ... I made my first commit to a new branch to fix an Adalogger issue I need solved and travis built everything passed all the tests ... problem ... should have read into rosie a bit more l'm thinking ... so where did my build .bin file go? my guess is travis didn't keep it ... any ideas?

idle owl
#

You figured it out as I was about to suggest it. Welcome, @worn birch!

worn birch
#

@idle owl Thanks

idle owl
#

The two who I know can answer that question have been in and out for the holiday, but will for sure be back Monday. I'm not sure how much anyone else has worked with it. I haven't worked with Travis much at all yet except for what's built into GitHub so I won't be much help.

worn birch
#

No worries, I'll look into rosie as from what I have seen in the scripts she is kinda important

idle owl
#

So shake works in lis3dh and works in express with the new addition to the driver! No idea if I did it right. But it lets me pass the parameters through into cpx as well.

idle owl
#

I had to revert the read_into>readinto change to get it to work for testing on 2.1.0. I'm assuming this is handled in specific bundle creation, and I'm just lacking on understanding how that works.

idle owl
#

If anyone has a LIS3DH breakout and would like to test the driver, let me know.

slender iron
#

@worn birch travis uploads the bin files directly to rosie

worn birch
#

@slender iron yea, I am figuring that out ... I now have ubuntu running in a vm, I have a AWS account, I am currently at the point of setting up the .rosie.yml ... not too sure what to do about the github webhook ... I assume I need to create this manually on the repo ... but possibly the .travis.yml does it for me ... not cause then how do I get the secret? lol

slender iron
#

why are you trying to get rosie going?

#

it needs to run on a local machine because there is real hardware connected to it

worn birch
#

I want to build a .bin from from changes to test it on my board

slender iron
#

ah, you don't need rosie for that

#

does your baord have a samd21?

worn birch
#

lol ... right ... yea

idle owl
#

I should have asked that same question. I could have helped! Oops.

slender iron
#

what OS are you making changes on?

worn birch
#

windows ... but i now have a ubuntu vm I could use lol

#

win10

slender iron
#

ubuntu vm will be easier

worn birch
#

yea I notices the build.sh files in the repo that travis runs

slender iron
#

yup yup, there is an install command in the .travis.yml thats useful to install arm-gcc

worn birch
#

I assume I can use those too ... then use BOSSA to load to the board

slender iron
#

once thats installed you just need to make in the ports/atmel-samd directory

worn birch
#

darn ... new that had to be somewhere

slender iron
#

its not complete because it assume you have arm-gcc installed already

worn birch
#

I wonder if bash for windows would work

slender iron
#

lines 33 and 37 will install gcc

worn birch
#

thanks ... worki g on it now

slender iron
#

๐Ÿ‘

worn birch
#

So if I have made a change and run it through travis and he gave the thumbs up, is that that all that is needed for a pull request or do you need me to do more?

idle owl
#

If there's more to be done, you'll be notified when the PR is looked into. It works like a code review, if there's something about it that needs to be changed, they'll let you know what they want. Might not be dealt with until Monday though.

#

@worn birch It sounds like you've done everything right throught the pull request step. Next step is review.

worn birch
#

ok ... I'll do my own build and make sure its working as I updated the pins on a board that were missing ... kinda integral to be able to use some functions ... so I'll give it a test ... about to make the bin now

idle owl
#

Nice! Good plan.

worn birch
#

lol .. yea got an error in the make ...
Traceback (most recent call last):
File "tools/gen_usb_descriptor.py", line 9, in <module>
from adafruit_usb_descriptor import cdc, standard, util
ImportError: No module named 'adafruit_usb_descriptor'

idle owl
#

Hmm... That's not one I've run into