#circuitpython-dev

1 messages ยท Page 118 of 1

sturdy furnace
#

In reference to issue #388:
I tried a buffer size of 2963 and it breaks the same way, whereas a buffer of 1503 is fine?

Also any buffer size not divisible by 32 produces a warning:
length mismatch 1504 1503
(the buffer still fills)

slender iron
#

@sturdy furnace please add that to the issue. its great investigation that will get lost on the chat unless someone is actively fixing it

#

I marked it for the next 2.x release

#

@hollow tartan how are things with you? I didn't talk with you in the meeting

manic glacierBOT
slender iron
#

thanks @sturdy furnace !

hollow tartan
#

@slender iron Not real good. This adventure I have set out on is having a rough start.

slender iron
#

yeah, dev on windows is particularly challenging

hollow tartan
#

I am going to get my big win 8 laptop up and running again. I hope that will be the answer I am looking for.

slender iron
#

is it newer and faster?

manic glacierBOT
hollow tartan
#

it is an HP Envy . the biggest and best a few years ago.

sturdy furnace
#

@slender iron no worries! feel free to ping me for any work you're doing on the mic

slender iron
#

@sturdy furnace thanks!

#

@hollow tartan is it not working now?

hollow tartan
#

I did try to install using the latest releases on my Lenovo Yoga and that was a failure too.

#

no it is not working now. very perplexing for me.

slender iron
#

@hollow tartan if the older laptop is a spare then it might be worth trying to put ubuntu on it

hollow tartan
#

The security certifications in the 3rd step would not be accepted at Hashicorp.

#

you mean a full linux installation of ubuntu.

slender iron
#

I don't know what that means

#

yeah, if you don't have anything on the laptop you need

hollow tartan
#

yeah that would be worth a try.

slender iron
#

that would bring you more in line with the mac/linux workflow

hollow tartan
#

ok, I will mark that down as a possible next step.

#

you folks seem to be pretty happy with the M4 progress.

slender iron
#

good job on persisting through this! I know its not fun

slender iron
#

ok, dinner time for me. night all!

tidal kiln
#

toodles!

lofty topaz
#

๐Ÿ˜ƒ

tulip sleet
#

@lofty topaz well, we could put it in the library bundle ๐Ÿ˜‰

lofty topaz
#

@tulip sleet You'd have to ask Mr. Guido van Rossum about that. ๐Ÿ˜

#

I think he would approve.

formal plover
#

@lofty topaz if you want to know how much space that takes up after import, you can do
import gc gc.mem_free()

#

Just for kicks

lofty topaz
#

@formal plover Heck no, space don't mean nuttin' to me anymore. But it looks like the ASCII alone is a couple hundred bytes. I was just pointing something out. It seems many Python books talk about "The Zen of Python" so if a newbie were to try it and got the CPX error, it might be confusing. That's all.

formal plover
#

@lofty topaz ah gotcha.

lofty topaz
#

@formal plover I'm a "Grumpy Old Man" so I gotta play the role. Some people call it "nit-pickin". I say, yup! ๐Ÿ˜ƒ

hollow tartan
#

@timber lion Hi. I am trying very hard to compile a micropython .bin for nodemcu esp8266.

#

I would be interested in your view point. It seems to me that on Windows the versions of the components that make up the linux VM are hyper critical and specific guidance is not being provided. Would you be able to rectify that situation? Please. I am seeking specific version guidance to get a working VM on a Windows platform.

#

cc @slender iron

hollow tartan
stuck elbow
#

ugh, l293

#

those are drivers for 40V motors

#

ah, no sorry, wrong chip, those are 7V

solar whale
#

@chilly trail If I read the information correctly, the problem you are having with building micropython is due to having some "sharing" option enabled betewwn the Ubuntu VM and Windows? Is that some special configuration or one of the default settings? Does it build OK if you disable it? For my setup, as decribed in the guide, there is one shared folder "/vagrant" that allows me to easily copy my .bin file from the VM to my host file system. Nothing else is shared. Sorry you are still ahveing problems

umbral dagger
stuck elbow
#

I use that

#

but I didn't do anything yet, apart from connecting it

#

you can also use any of the cheap "blue pill" stm32 boards with the black magic probe firmware

#

then you can have your programmer for $2 ๐Ÿ˜ƒ

tidal kiln
#

@lofty topaz CP also doesn't support antigravity. (at least not yet)

stuck elbow
#

I think that such easter eggs are cute when you have a lot of spare resources, but in this case, perhaps the cost is too much

#

of course having them as a separate library would be great

#

but then the surprise is kinda spoiled

lofty topaz
#

@stuck elbow Which is why the comment about space in the image. It don't matter to me.

#

@tidal kiln Quick question. Doesn't the accelerometer work for MakeCode?

stuck elbow
#

which accelerometer?

lofty topaz
#

the CPX accelerometer.

stuck elbow
lofty topaz
#

@stuck elbow Right, but I don't think the code for CircuitPython has been ported yet. Which may be why @tidal kiln made his comment.

stuck elbow
#

ah, no, antigravity is a joke module in python

#

and easter egg

lofty topaz
#

Seriously?

stuck elbow
#

when you import it, it links to an xkcd comic strip

#

try it

lofty topaz
#

I did not know that.

#

Wow, do I have egg on my face or what?

stuck elbow
#

there is a number of those

#

there is "import this", there is "import antigravity", the micropython on the microbit has "import love" and there is also "from __future__ import braces"

lofty topaz
#

I know about "this" but not the others, especially the "antigravity" one. Here I'm try to get my CPX to measure distance by rolling it across the table and it will work with MakeCode but not with CircuitPython.

stuck elbow
#

interesting, what's the error?

lofty topaz
#

So the antigravity comment threw me off.

lofty topaz
#

There's no error because there's no driver for the accel on the CPX for CircuitPython at this time. At least as far as I can tell.

tidal kiln
lofty topaz
#

@tidal kiln Well shiver me timbers, I looked, I coded, I compiled. Veni, vidi, vici :)

from adafruit_circuitplayground.express import cpx
while True:
x, y, z = cpx.acceleration
print(x, y, z)

It works perfectly. Thanks a bunch.

tidal kiln
#

np. thank @idle owl. her work.

lofty topaz
#

hmmm, wonder why I was told it hadn't been ported yet. Oh well, Thanks @idle owl

tidal kiln
#

you're in cutting edge terrain. this is all being actively developed.

stuck elbow
#

@slender iron I wonder what would be the best way of keeping an out-of-tree C module for CircuitPython

manic glacierBOT
slender iron
#

@stuck elbow ideally it'd be in-tree right?

stuck elbow
#

I'm not sure it's generally useful

#

it's that sprite/tile engine of mine, I needed to rewrite parts of it in C for speed

slender iron
#

I don't think it needs to be to be in the tree. it just needs to be clearly documented when its available

stuck elbow
#

it only works with rgb spi displays

slender iron
#

I'm open to having specialized modules in the circuitpython repo

stuck elbow
#

guess we could just disable it by default

slender iron
#

exactly

#

as long as its documented well when its available and goes through the PR process I'm not worried about it

stuck elbow
#

this one doesn't need anything like that ticks() callback

#

yeah, I need to clean it up and document it, of course

slender iron
#

is it structured with the shared-bindings/common-hal split?

stuck elbow
#

that will take a while

#

weeeeelllll

#

right now everything is in shared-bindings ๐Ÿ˜ƒ

slender iron
#

does it use the common hal libraries itself? or is it atmel specific?

stuck elbow
#

it uses the spi write function

slender iron
#

๐Ÿ˜ƒ I'd want that changed

stuck elbow
#

yeah, of course

#

it comes together with a python module that implements the higher-level bits

#

so I was thinking about calling that C module the same as the python one, but with _ in front

meager fog
stuck elbow
#

is that a trinket m4?

slender iron
#

@stuck elbow sounds perfect! I'm open to getting it checked in. sounds like it just needs to be cleaned up a bit

formal plover
#

@meager fog ah! Leeks!!!

stuck elbow
#

yeah, right now it's just a MVP

formal plover
#

@meager fog so excited!

meager fog
#

~leeks~

formal plover
#

๐Ÿ˜น

#

I'm going to need a trinket museum

stuck elbow
#

graveyard

#

just a field of usb plugs sticking out, and you can plug them as headstones

formal plover
#

@stuck elbow Haha!

manic glacierBOT
#

@mrmcwethy looks like readinto is already used in CPython: https://docs.python.org/3/search.html?q=readinto Thanks for taking this on!

I think i2c is read_into because it was originally readfrom_into and then I changed how the address was managed.

As @deshipu and @ladyada point out, please start out by leaving read_into with a warning that its deprecated. Then, if you like, go through and update drivers. We can remove it once they are all fixed.

tidal kiln
#

@formal plover got any mini b versions?

manic glacierBOT
umbral dagger
#

@meager fog Trinket M0 with the 512Kbyte SPI flash, yes?

stuck elbow
#

I can't see a flash chip footprint there

formal plover
#

@tidal kiln that I don't.

stuck elbow
#

ooh, next to the "USB" label, a really tiny chip?

tidal kiln
#

@stuck elbow to left of USB

stuck elbow
#

oh no, now I will again have the urge to use trinkets for everyting

#

just as I convinced myself they are too small

meager fog
#

@umbral dagger yah a 2x3 USON flash

#

almost done routing

#

then proto

manic glacierBOT
stuck elbow
#

the trinket m0 is just too cute

formal plover
#

I just can't believe I can establish a serial connection and mess around in the repl with something so small

tidal kiln
formal plover
#

@tidal kiln craziness

tidal kiln
#

@formal plover will trade one on left for admission to museum ๐Ÿ˜‹

formal plover
#

๐Ÿ˜…

slender iron
stuck elbow
#

I didn't do anything...

manic glacierBOT
slender iron
#

@stuck elbow you asked them if they wanted to contribute, offered help and merged it in when they did. thats perfect

stuck elbow
#

oh, I see, I though that's obvious

slender iron
#

๐Ÿ˜ƒ I'm glad you think that. some folks do it themselves rather than encouraging someone else to help

hollow tartan
stuck elbow
#

I'm too lazy for that

slender iron
#

@meager fog I'm off for a run

#

@stuck elbow works for me ๐Ÿ˜ƒ

hollow tartan
#

@solar whale I am seeking specific version guidance to get a working VM on a Windows platform. I take it that your view is that the "default settings" build a functioning VM on Windows 7 and/or 8?

solar whale
#

@hollow tartan I have no experience with Windows (since windows 3..1 ๐Ÿ˜‰ All I can say is that following the guide works to build a micropython .bin for the esp8266 in a vagrant VM installed on my MacOS system.

hollow tartan
#

@solar whale Thank You.

solar whale
#

@hollow tartan Does the build fail on your windows system when you follow the guide instructions?

#

@hollow tartan I am curious if you are finding that the VM behaves differently uner Windows than under MacOS.

manic glacierBOT
#

Turning on MICROPY_CPYTHON_COMPAT costs 792 bytes. Right now we have 3912 bytes free in the Gemma build (for example). But we are looking to add framebuf, and we don't know the storage budget needed for 3.0 yet.

@gpshead: is str(some_bytes, 'ascii') ok for you as a workaround?

(Note that str(b'abc') returns "b'abc'": you need the second argument to get 'abc'. However, the value of the second argument is actually ignored right now: no decoding is done.)

stuck elbow
#

gen_usb_descriptor.py: error: argument output_file: can't open 'build-metro_m4_express/autogen_usb_descriptor.c': [Errno 2] No such file or directory: 'build-metro_m4_express/autogen_usb_descriptor.c <-- so I need to run something first?

#

ah, I have to create build-metro_m4_express directory

manic glacierBOT
idle owl
#

Does git diff only work with untracked files?

tulip sleet
#

git diff will diff files that have not yet been "added". Use git diff --cached for added files. To see diffs of files already committed, there are complicated syntaxes. gitk (install it if you don't have it), is a nice GUI tool that will show you changes at each commit.

idle owl
#

Ah bugger. Ok. Should have waited a minute more. I have to do another commit/push. It didn't include the final changes.

#

Thanks ๐Ÿ˜ƒ

tulip sleet
#

If it's your private repo that you're pushing to, you can do git commit --amend to redo the most recent commit, and then do git push -f to do a force push (only safe if no one has pulled from that push).

idle owl
#

I doubt they have, it was literally a minute ago onto my fork.

tulip sleet
#

So an amend is easy and basically exactly what you want (amend a previous commit that was a little wrong).

idle owl
#

Ok, so add it like normal, then do git commit --amend ?

tulip sleet
#

exactly. You can include the add in the commit (git commit -a), but that's like git add --all, so only do that if you know what's going to be added (e.g., do a git status before that)

#

it's just a shortcut

idle owl
#

@tulip sleet Nice! I did git commit --amend and then the push -f and it worked perfectly. Thank you!

umbral dagger
#

@meager fog re the trinket.. nice!

#

@tidal kiln I started back into hardware/firmware hacking with the original trinket (and some neopixel rings). It's a great platform for simple projects. Even moreso using CP instead of C. And yet you have I2C on the pins so you can do non-trivial things.

cunning crypt
#

@umbral dagger Are you going to find a way to supersize the Trinket M0 Express, too?

umbral dagger
#

@cunning crypt Not with that flash chip package. Connections are all under the chip. No leads.

#

@cunning crypt Maybe if I had a rework station.

cunning crypt
#

I'm sure you can do it somehow.

#

As they say, life, ah, finds a way

#

For some reason I thought you had one

umbral dagger
#

@cunning crypt Though maybe the question is: when do I put out the $ for a rework station? ๐Ÿ˜ƒ I need a better/real workbench, though.

cunning crypt
#

@umbral dagger Mee too.

#

Mine's a wobbly old table that's shoved into a corner so it won't wobble

umbral dagger
#

Mine's a half-height bookcase with an old Warhammer/Citadel modeling/painting station with a sheet of heat resistant soldering mat on it.

slender iron
#

@tulip sleet how is busio coming?

tulip sleet
#

@slender iron I am working on i2c first because it's "easier" (sync, not dma), and to familiarize myself with ASF4. After that SPI should be straightforward. The API is ๐Ÿ˜ Weird mix of high-level and low-level. I have to make up some data structures for values that aren't in tables, e.g. (SERCOMx_GCLK_ID_CORE, where x is 0-5, because I need to look them up dynamically, and their values are arbitrary (not sequential, for instance). Clock API is completely different on 21 v 51, as you know.

slender iron
#

yup yup, sounds good!

tulip sleet
#

I am finishing up _construct and the rest should be easier

slender iron
#

yeah totally

#

I was thinking it'd be good to finish the 3.0 beta milestone before circling back on 2.x

tulip sleet
#

I'm not working on 2.x except to comment on bugs. I carved a pumpkin and make some Adafruit blinky things to put in the window and in the pumpkin. Totally hacked up Arc Reactor to simplifiy and eliminate blue colors. Strandtest dotstar strip in the window.

slender iron
#

awesome!

#

did you post pics?

tulip sleet
#

it's not dark yet; maybe I will. these are not profound projects, but I feel a professional obligation ๐Ÿ˜

#

one arduno and one cpx

#

cpx is CPy

idle owl
#

@tulip sleet Profound or not, it's still fun and awesome

slender iron
#

๐Ÿ˜ƒ

#

I was gonna look at neopixel this afternoon

tulip sleet
#

did @timber lion finish the asm timing thing? I though he might have

slender iron
#

i don't believe so. @timber lion ?

tulip sleet
#

@idle owl we don't get much kid traffic on our street, even though it's quiet. There's a nearby street that goes all out, so the kids mostly go over there

idle owl
#

@tulip sleet I'd do it for me anyway ๐Ÿ˜„

tulip sleet
#

i have to stop eating the candy

idle owl
#

We didn't get a chance this year. The last few weeks have been crazy.

#

@tulip sleet I kept it in a drawer this year, so we kept forgetting it was even there. It worked! Haven't really touched it!

tulip sleet
#

my wife put it in a bowl already; i was good before that

#

@slender iron I think in another day or two or less I will have something to test

manic glacierBOT
slender iron
#

sounds great @tulip sleet I'll start picking off other things

tulip sleet
#

it will suddenly be done; I will be surprised

slender iron
#

๐Ÿ˜ƒ

solar whale
#

Still no power so no Circuit Python playing and not many trick or treaters braving our dark driveway!

idle owl
#

@solar whale I grew up with a really long driveway, we had trick or treaters literally once. My mum had just made chocolate chip cookies and cider, so she invited them in (they had been driven up by their parents) and the whole family got cookies and cider.

umbral dagger
#

We're deep in an apartment building with very few kids so nothign special halloweeny happenign here. Including no buckets of candy (I'm looking at you, @tulip sleet ). We did, however, drop by BulkBarn this afternoon & I got a large bag full of soft licorice... my downfall). Suzanne said I have a problem. I replied that it's only a problem if I don't have any on hand.

tulip sleet
idle owl
#

@tulip sleet That's great ๐Ÿ˜ƒ

tulip sleet
#

a screaming cauldon would have been nice - maybe next year!

idle owl
#

Hey it's more than we did this year. I just turned on the porch light.

tulip sleet
#

there's a real estate agent who lives in the neighborhood. he gave everyone pumpkins. last year was pies

idle owl
#

Excellent use of pumpkin.

slender iron
#

looks great @tulip sleet !

tulip sleet
#

just one set of kids so far; the father was at a distance but kept looking back at the show

cunning crypt
#

I saw this one earlier today on Twitter. Not a screaming cauldron, but still

slender iron
#

I found a bug in the non-debug build

#

fix incoming

cunning crypt
#

The de-bug build has been de-bugged, obviously that's why it's in the non-debug build.

idle owl
#

@slender iron You posted another bootloader last night, I think. Do I just load it with the jlink like I did the others or is there something specific about it? I was unclear on that and the questions asked by others at the time weren't enough to clarify.

slender iron
#

I believe I posted a self-updater. it will work with jlink but I don't recommend using it if you have the uf2 bootloader with working neopixel already

idle owl
#

I do. Ok, good to know.

slender iron
#

the self-updater will enable boot protection

idle owl
#

I don't know what that means.

slender iron
#

it prevents code for accidentally erasing the bootloader but also makes it harder to load the bootloader directly with the jlink

idle owl
#

Ah, thank you

stuck elbow
idle owl
#

@stuck elbow I was just about to suggest bringing the question here. But you figured it out.

solar whale
#

@slender iron just to clarify. I f we use the self-updating Bootloader the we also have to follow the instructions on the github site about how to reset the NVN to update via JLink either with gdb or a tool like ozone.

slender iron
#

@stuck elbow did you sort it out?

stuck elbow
#

well

#

(gdb) set ((Nvmctrl *)0x41004000UL)->CTRLB.reg = (0xA5 << 8) | 0x1a
Cannot access memory at address 0x41004004

slender iron
#

that shouldn't be needed if you are using an existing bootloader

#

thats only needed to unlock the boot protection

stuck elbow
#

loading doesn't seem to do anything

#
(gdb) load ~/dev/circuitpython/uf2-samd/build/metro_m4/update-bootloader.elf 
Loading section .text, size 0x4a1c lma 0x4000
Loading section .relocate, size 0x4 lma 0x8a1c
Start address 0x4000, load size 18976
Transfer rate: 48 KB/sec, 903 bytes/write.
(gdb) compare-sections 
Section .text, range 0x4000 -- 0x8a1c: MIS-MATCHED!
Section .relocate, range 0x8a1c -- 0x8a20: MIS-MATCHED!
warning: One or more sections of the target image does not match
the loaded file
manic glacierBOT
slender iron
#

@stuck elbow have you tried with bossac? I don't have a black magic probe to test with

stuck elbow
#

I have not, where do I get it from?

#

I need some new version, right?

#

I'm trying with stlinkv2 and openocd directly now, but getting:

> program /home/sheep/dev/circuitpython/uf2-samd/build/metro_m4/bootloader.bin verify reset
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
embedded:startup.tcl:476: Error: 
in procedure 'program' 
in procedure 'reset' called at file "embedded:startup.tcl", line 500
in procedure 'ocd_bouncer' 
in procedure 'ocd_process_reset' 
in procedure 'ocd_process_reset_inner' called at file "embedded:startup.tcl", line 248
in procedure 'at91samd.cpu' called at file "embedded:startup.tcl", line 331
in procedure 'ocd_bouncer' 
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 532
at file "embedded:startup.tcl", line 476

** Programming Started **
auto erase enabled
Couldn't find part corresponding to DID 60060005
auto_probe failed
embedded:startup.tcl:476: Error: ** Programming Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 532
at file "embedded:startup.tcl", line 476
slender iron
#

doesn't look like anyone has uploaded a linux version

stuck elbow
#

but bossa requires me to see a serial device, right?

#

No device found on /dev/ttyACM0

slender iron
#

yeah, did you double click to get into the bootloader?

#

(sorry I'm slow. I'm neopixeling)

stuck elbow
#

double-clicking reset doesn't make any usb device appear

slender iron
#

hmm, does the red led fade?

stuck elbow
#

there is only green led shining

slender iron
#

the neopixel is green?

stuck elbow
#

it's off

slender iron
#

ah ok, thats power then I think

#

sounds like your bootloader is unhappy

stuck elbow
#

I probably broke it with openocd

slender iron
#

yeah perhaps

#

can you read the boot protection bits?

stuck elbow
#

how would I do that?

slender iron
#

its similar to the set command earlier

#

can you print that address?

stuck elbow
#

please don't assume I know how to use gdb ๐Ÿ˜ƒ

#
(gdb) print ((Nvmctrl  *)0x41004000UL)->CTRLB.reg
No symbol table is loaded.  Use the "file" command.
slender iron
#

kk, p/x *0x41004000

stuck elbow
#
(gdb) x *0x41004000
0x4:    0xffffffff
#
(gdb) p/x *0x41004000
$1 = 0x4
slender iron
#

ok so that worked

stuck elbow
#

doesn't help much without a config file for openocd for m4

#

I wonder what that "Couldn't find part corresponding to DID 60060005" means

#

when I try to program the bootloader with openocd

slender iron
#

yeah, thats true

#

I can't help you with one since I'm using jlink

stuck elbow
#

I have two jlink clones, neither works

#

google searches suggest that we are the only people in the world using those chips

slender iron
#

yeah, its early

stuck elbow
#

I suppose openocd simply doesn't have the support yet

slender iron
#

yup

#

gotta go get pizza dough going. will check afterwards

stuck elbow
#

thanks for the help

stuck elbow
#

OK, so the black magic probe only supports writing flash to some of chips, because the commands for that are different for every chip

#

it does support samd21, but not 51 yet

#

I suppose it's similar with openocd

idle owl
#

Even the jlink doesn't support every chip.

stuck elbow
#

I need to bother Piotr to add support for it ๐Ÿ˜ƒ

idle owl
#

What is a use case for time.monotonic? I commented it out of some sample code I'm using, and there doesn't appear to be any change in functionality. And the description in RTD makes it seem superfluous.

#

Does importing specific things from libraries (i.e. from time import sleep instead of import time) save on memory?

floral dagger
#

@idle owl For ESP boards at least, it is the only way to access timing functions (i.e. millis()). I think I remember @slender iron saying something about that being the case in the rest of MP as well, but not sure if I have that exactly right though.

idle owl
#

@floral dagger Ah ok. So time.sleep doesn't play nice with the ESP boards?

floral dagger
#

it basically returns millis

#

no, sleep and all that works, but millis doesn't

idle owl
#

The description says monotonic returns an increasing value from an unknown reference point. It's the "unknown reference point" part that made me wonder.

floral dagger
#

It's ben a while sense I researched it, but I think it varies a bit from board to board. What it basically does is takes a reference point, and uses the clock cycles to return a sort of millisecond equivelant of elapsed time from that point

idle owl
#

Ok that's what it looked like it did, but I couldn't figure out from what point it was choosing to start.

#

And the research indicated I wasn't going to find it ๐Ÿ˜„

floral dagger
#

Like I said, it's been a while so I could be misremembering this, but different chips use a different point, but regardless, the end result will be the same.

idle owl
#

Ah ok

hollow tartan
#

@solar whale I am sorry but I cannot say anything about the VM under MacOS. Other than I am glad that it works.

tulip sleet
#

@idle owl re monotonic - it's not guaranteed from where it starts, but the differences are useful to time intervals, and the monotonic is helpful. In CPy, it starts from 0 at power-up. But that's an implementation detail. On something like a PC, it could be wall-clock time.

idle owl
#

Ok that makes a lot more sense. Time intervals.

#

So just printing it isn't terribly useful, but comparing it to previous points is.

tulip sleet
#

righto

#

@idle owl >Does importing specific things from libraries (i.e. from time import sleep instead of import time) save on memory?

#

... doing an experiment taking longer than I thought

#
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> import gc,micropython
>>> gc.collect();micropython.mem_info()
stack: 512 out of 5956
GC: total: 19968, used: 304, free: 19664
 No. of 1-blocks: 3, 2-blocks: 3, max blk sz: 4, max free sz: 1214
>>> import board
>>> gc.collect();micropython.mem_info()
stack: 512 out of 5956
GC: total: 19968, used: 368, free: 19600
 No. of 1-blocks: 4, 2-blocks: 3, max blk sz: 4, max free sz: 1205
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> import gc,micropython
>>> gc.collect();micropython.mem_info()
stack: 512 out of 5956
GC: total: 19968, used: 304, free: 19664
 No. of 1-blocks: 3, 2-blocks: 3, max blk sz: 4, max free sz: 1214
>>> from board import *
>>> gc.collect();micropython.mem_info()
stack: 512 out of 5956
GC: total: 19968, used: 736, free: 19232
 No. of 1-blocks: 3, 2-blocks: 3, max blk sz: 24, max free sz: 1171
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> 
>>> import gc,micropython
>>> gc.collect();micropython.mem_info()
stack: 512 out of 5956
GC: total: 19968, used: 304, free: 19664
 No. of 1-blocks: 3, 2-blocks: 3, max blk sz: 4, max free sz: 1214
>>> from board import A1
>>> gc.collect();micropython.mem_info()
stack: 512 out of 5956
GC: total: 19968, used: 384, free: 19584
 No. of 1-blocks: 3, 2-blocks: 4, max blk sz: 4, max free sz: 1205
#

look at the used: number in each case.

idle owl
#

So does import board not actually import anything until it's called, and from board import * imports it all regardless?

tulip sleet
#

I think that what might be happening is that import board uses the existing dictionary in board. from board import * adds all the names to the top-level dict to make the names visible there (so it increases a lot). from board import A1 adds just one name to the top-level dictionary.

idle owl
#

And that's why the last one is still bigger.

#

Though not as big as *

tulip sleet
#

it's not that import board delays, it's just that it doesn't have to make any new entries

idle owl
#

Ah ok

tulip sleet
#

import board adds board to the top-level dictionary, but not board.A1, etc.

idle owl
#

Thank you so much! That's super interesting

tulip sleet
#

but board.A1 is slower than A1, because it has to do two lookups. But not much to worry about

idle owl
#

I see

tulip sleet
idle owl
#

I was trying to figure out how to maximise available memory for a buffer, and this came up as a question.

tulip sleet
#

yeah -just don't import things you don't need (e.g. not from x import *)

idle owl
#

Yeah, noted. That was significant.

tulip sleet
#

ok, sleep time!

idle owl
#

Goodnight!

tulip sleet
#

gn

river quest
#

(and everyone else)

#

let it show with circuitpython

#

yay

solar whale
#

@hollow tartan Iโ€™m just trying to understand what problem you are having. Does the micro python build still fail for you?

slender iron
#

looks awesome @river quest !

glacial bronze
#

For the record: I said last week I wanted to start contributing example projects for CircuitPython. I'm gonna have to put that on hold; my "home community" on the web got blasted by a hacker and I've been putting my spare time into the rebuilding effort. But I still intend to contribute once that's settled a bit!

slender iron
#

oh no @glacial bronze ! I hope the recovery goes well

glacial bronze
#

The SSH keys on the automatic backup changed in 2014 and nobody noticed ๐Ÿ˜

#

Which is why it's an effort rather than a single shell command!

slender iron
#

eesh

manic glacierBOT
timber lion
stiff mural
#

Hi, where I can find source code for framebuf module which is used in SAMD CircuitPython? I tried to use OLED screen with ESP CP and as framebuf is not included in this version of CP I used this module: https://github.com/adafruit/micropython-adafruit-framebuf/blob/master/framebuf.py The problem is that in this version of module text method is not implemented, while in SAMD version it is.

stiff mural
#

OK, so I found that it is made on purpose due to the memory limitations on some boards, but is it the case also for ESP8266, i.e. Feather HUZZAH?

solar whale
#

@stiff mural It appears taht the "internal " implmentation of framebuf is not enabled for the ESP8266 build. You can write text via bitmapfont - see the guide https://learn.adafruit.com/micropython-displays-drawing-text/software?view=all It is written for micropythoin but if I racall correctly the bitmapfont implmentation works on circuitpython as well. I can't verify this now since I don't have power at my home - hopefully later today!

How to write text on any MicroPython display.

stiff mural
#

@solar whale Thank you for the response. Still I would like to know if that framebuf from SAMD CP can't be used with ESP8266. The problem is that I can't find it in source files.

solar whale
#

@stiff mural If oyu build your own circuit python binary you can enable including the complete framebuf as a "builtin" module by setting #define MICROPY_PY_FRAMEBUF (1) that is change the current 0 to a 1. That is how it is implmented for the SAMD "express" boards. Othere than that, there is no python module that implements the full framebuf functionality. If it is not built in to the executalbe circuitpython image, then only the limited framebuf.py iis available at this time.

stiff mural
#

OK, that makes sense. But I just checked and in MicroPython port for ESP8266 it is set to (1), so included.. I will try to look on GitHub why and when that was changed for CircuitPython port.

solar whale
#

@stiff mural That is my recollection as well - perhaps @tulip sleet or @slender iron can comment on why/when it was removed from the default CP build.

#

@stiff mural from github - it looks like it was removed to make spce on March 10 , 2017.

manic glacierBOT
stiff mural
#

@solar whale Can't find that commit. At what file are you looking? I checked /ports/ESP8266/mpconfigport.h and there is no such change, at least not in History.

stiff mural
#

@solar whale Right, thank you.

solar whale
#

you are welcome

tulip sleet
#

@stiff mural @solar whale I turned it on and it didn't seem to overflow flash. Feel free to submit an issue to turn it back on. ladyada is interested in doing some work on framebuf in the future to clean it up, choose a better font, etc. so it may be a moving target

manic glacierBOT
solar whale
#

@chilly trail I was finally able to come up with a Windows 10 machine and I installed Virtual Box, Vagrant 2.0.0 and Git - then followed the guide instructions. After some confusion with the corrct path sttings, I was finally able to build the micropython .bin file in the VM. I did have to check and fix the $PATH setting in my .profile to make sure its started with /home/vagrant/esp-open-sdk/xtensa-lx106-elf/bin - once I did this I was able to make axtls and make to create the .bin. The intiial setting for the $PATH were not correct. I'm not sure ifit was because I did something out of order or not but once I fixed the $PATH it all worked fine.

#

@chilly trail one other thing to note is that after modifying the .profile - I exited the vagrant VM and restarted vagrant ssh

solar whale
#

@hollow tartan This is the corrected .profile on my system ```# ~/.profile: executed by the command interpreter for login shells.

This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login

exists.

see /usr/share/doc/bash/examples/startup-files for examples.

the files are located in the bash-doc package.

the default umask is set in /etc/profile; for setting the umask

for ssh logins, install and configure the libpam-umask package.

#umask 022

if running bash

if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi

set PATH so it includes user's private bin if it exists

if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
PATH=/home/vagrant/esp-open-sdk/xtensa-lx106-elf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

manic glacierBOT
manic glacierBOT
manic glacierBOT
tidal kiln
#

@slender iron done

bronze geyser
#

I am running circuitpython on a Huzzah. I want to use the spi_device library. The instructions for "install" state: Copy the unzipped adafruit_bus_device to the lib directory on the CIRCUITPY or MICROPYTHON drive. okidok....pardon my lack of knowledge...WHAT CIRCUITPY drive on the Huzzah? And Do I just copy the .mpy there?

formal plover
#

@bronze geyser what instructions are you reading?

#

Those sound like instructions for something that has the UF2 bootloader

bronze geyser
formal plover
#

You'll need to use Ampy to make a lib directory and to put that library in that directory/folder

bronze geyser
#

ooh. That makes some sense. I'll give it a twirl. Thank you.

slender iron
#

@bronze geyser yup, just copy it using ampy

formal plover
#

@bronze geyser you're welcome!

bronze geyser
#

I am grateful for your very quick help. Thank you.

#

...I also appreciate that you didn't rub my face in the fact I should have figured this out for myself :-). Wow. Kinder, gentler people. Thank you.

slender iron
#

no worries!

formal plover
#

@bronze geyser ๐Ÿ˜บ

#

Rule #1 here. Be awesome to everyone.

lofty topaz
#

@formal plover I'll drink to that! ๐Ÿธ hicup.... ><>

idle owl
#

@bronze geyser We all miss things! I put Scott through an hour and a half of troubleshooting because I forgot to plug in my LED strip. Then I spent another 45 minutes with it because I forgot to plug the other end of the adapter in the wall.

tidal kiln
#

wait, i thought it was be excellent. i've been doing it wrong.

idle owl
#

Not knowing to use ampy isn't even all that obvious if you've never done it before.

#

@tidal kiln Come on, get with the program here.

lofty topaz
#

@idle owl FundeMENTALS will get you every time. ๐Ÿ˜ƒ

formal plover
#

@tidal kiln hahaha you are correct. Excellent *

bronze geyser
#

thanks @idle owl ... I grew up when the dinosaurs used to tell me almost daily RTFM...

#

of course, then they all died because they wouldn't stop smoking cigarettes. They seemed to have taken their manuals with them.

formal plover
#

@bronze geyser Haha we do throw around RTFM once in a while. But it's more like when someone asks a question and there's a good guide for what they are asking

#

And we're nice about it

bronze geyser
#

yah - you're the generation of "just google it..." kinda the same thing...

idle owl
#

Even Googling means you have to have the correct terms to begin with. So teamwork helps there too.

bronze geyser
#

of course, now i'll probably be able to say "Alexa, get that dang python library to work on my huzzah"

formal plover
#

@bronze geyser let us know if you run into any problems with the library, we'd be happy to help

manic glacierBOT
lofty topaz
#

@bronze geyser Well, 5 years ago roughly, I asked my son what micro he used in at UofI. He told me to Google Arduino but to be carefull because it's a very deep rabbit hole. I googled it and have been in the hole ever since. I love google. Best site ever.

solar whale
#

Yay - Power is back on! I can resume playing with CIrcuitpython tonight!

idle owl
#

@solar whale Nice!

pastel panther
#

wew

idle owl
#

Ahh! I have a NeoPixel on my M4!

pastel panther
#

@idle owl awesome!

#

Like making it do stuff from the REPL?

idle owl
#

Not yet, I just loaded the newest build of CP.

pastel panther
#

Hm. I thought it was working? Maybe I'm not very observant

idle owl
#

I'm not sure, I meant I hadn't gotten that far yet, not that it wasn't working.

pastel panther
#

You just got your M4 working? I thought I was the last to get mine going

idle owl
#

I've had it working for a while. The NeoPixel update to CircuitPython was recent, I hadn't loaded that version yet. The NeoPixel update to the bootloader was a while ago. That's not what I was referring to.

#

I'm pretty sure I'm explaining badly here.

pastel panther
#

Either way: yay!

#

I'm staring intently at the m0 trinket board trying to imagine how I would fit a m4 on there

slender iron
#

@idle owl I have a bugfix for neopixel incoming

idle owl
#

That's good because I was having problems. ๐Ÿ˜„

slender iron
#

did it freeze up on you?

idle owl
#

Kind of. It's not mounting right and I had to reset it. I don't know if it's related though, could be something I'm doing.

slender iron
#

kk, let me do a PR for this fix

tidal kiln
#

@pastel panther 5mm (M0 21E) vs 7mm (M4 51G) square....might be possible?

pastel panther
#

There are some caps that would probably have to move and some vias but there is a bit of space where the adafruit flower is

#

Of course that would be too easy so I was thinking about wedging in one of those teeny tiny SPI flash chips ladyada found. That is questionable

slender iron
#

so the gap between colors in rainbow cycle drops from ~70ms on the M0 to ~26ms on the M4

idle owl
#

@slender iron That's fantastic!

tidal kiln
#

@pastel panther maybe use the trinket pro form factor?

pastel panther
#

@tidal kiln I was thinking that would be a good way to expose more of the hardware, but the primo CP trinket dream is too good to not try

slender iron
#

oops found another bug

#

thats what show and tell demos are good for, finding bugs

formal plover
#

@slender iron ๐Ÿ˜น

#

Guess I don't have to ask if you're going to be on show and tell tonight

stuck elbow
#

goodbye to my sleep schedule, sigh

manic glacierBOT
formal plover
#

Questions on the project help channel from @tough flax:
"Hi folks... I know there's Cap Touch support for the Trinket M0 - do the same libraries work on the Feather M0 (Bluefruit LE in my case)? If so, how do you configure the pins?"
<@&356864093652516868> anyone know?

stuck elbow
#

Yes, feather m0 also has touch support.

#

Just import touchio

manic glacierBOT
stuck elbow
manic glacierBOT
manic glacierBOT
slender iron
#

I guess today is bug fix day

manic glacierBOT
hollow tartan
#

@slender iron @timber lion @solar whale Hello guys

#

set PATH so it includes user's private bin if it exists

if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
PATH=/home/vagrant/xtensa-esp32-elf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin
:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

vagrant@vagrant-ubuntu-trusty-64:~$ cat $PATH
cat: /home/vagrant/esp-open-sdk/xtensa-lx106-elf/bin:/home/vagrant/xtensa-esp32-
elf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:
/usr/local/games: No such file or directory```
manic glacierBOT
hollow tartan
#

@slender iron @timber lion @solar whale Hello guys My $PATH seems servicable. I did complete a good micropython.bin generation today. Great Success. I did submit a correction/comment on Learn.Adafruit on the guide to compile. I included my specifc versions of the recommended resources (VB, Vagrant, & Git). Also two essential changes to the scripts provided. One: on first use only: " vagrant up --provider=virtualbox" . Two: make -C mpy-cross cd ~/micropython/esp8266 make axtls must be changed to make -C mpy-cross cd ~/micropython/ports/esp8266 make axtls

manic glacierBOT
hollow tartan
#

@tulip sleet that sounds like a good project after finish the job @slender iron has me on.

slender iron
#

great job @hollow tartan !

manic glacierBOT
formal plover
#

@hollow tartan I thought you were working on building micropython, not CircuitPython. That's what that issue is for.

#

Something they are working on for the CircuitPython 3.0 release.

slender iron
#

@tulip sleet __asm volatile doesn't work for me

manic glacierBOT
#

This module is a part of the "stage" library, which is a tile and sprite engine for games using SPI-based RGB displays. The library is part of the ยตGame project (https://hackaday.io/project/27629-game), and contains optimized low-level code for rendering the data and sending it to the display as fast as possible. It's not enabled by default in any ports, even though in general it could be useful outside the ยตGame.

tidal kiln
#

in case you haven't seen

tulip sleet
#

@slender iron you mean the asm it doesn't compile or it's not effective?

slender iron
#

it doesn't fix the bug @tulip sleet

#

I went with the macro instead

fading solstice
#

@slender iron regarding changing i2c read_into -> readinto. You mentioned initially adding readinto and making read_into method display some kind of warning. (deprecated). I assume this is a print() statment in the init method. what were you thinking?

slender iron
#

@fading solstice I was thinking a note in the docs

#

lol, micropython 1.9.3 bumped the mpy version number again

manic glacierBOT
slender iron
tulip sleet
#

@slender iron that's weird because I had the opposite problem with the stack checking routines (or at least I thought I did). But the proof is in the testing.

slender iron
#

it is a different use

#

this was calling a finalizer from the garbage collection that was failing

tulip sleet
#

k, I believe you! In the other routine I needed to make sure it had a stack frame so I could get the address of a lcoal

slender iron
#

๐Ÿ˜ƒ

#

I don't know exactly what the nlr methods needs

manic glacierBOT
slender iron
#

@tulip sleet can you send me the usb pid master list?

manic glacierBOT
manic glacierBOT
slender iron
#

@stuck elbow that link makes me think we should always use kwargs to begin with

manic glacierBOT
stuck elbow
#

@slender iron not necessarily, the labels don't have to be in the source, they can be in the programming environment โ€” so the editor can add them

slender iron
#

right, but then you require a specific editor

stuck elbow
#

@slender iron especially since we are pretty thin on memory

#

well, you recommend a specific programming environment for learning

slender iron
#

true

#

you should send it to @plucky flint

stuck elbow
#

I think that @plucky flint 's Mu works for that quite well

slender iron
#

๐Ÿ˜ƒ

stuck elbow
manic glacierBOT
tidal kiln
#

what library bundle should we use for testing m4? the 'main' one?

slender iron
#

yeah, let me know if you see funny behavior

#

they aren't actually exactly compatible

tidal kiln
#

so the uf2 you just linked + the latest bundle release = OK?

slender iron
#

try it ๐Ÿ˜ƒ

tidal kiln
#

maybe that's it. did you put that in manually? delete .mpy, add .py?

slender iron
#

yeah just copied it out of my repo

#

my local repo

tidal kiln
#

here's what i get just using the bundle:

Adafruit CircuitPython 3.0.0-alpha.0-153-gb6587b3 on 2017-11-01; Metro M4 Express with samd51j19
>>> import board
>>> import neopixel
>>> pixels = neopixel.NeoPixel(board.D8, 4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "libraries/drivers/neopixel/neopixel.py", line 79, in __init__
TypeError: 'bool' object is not iterable
idle owl
#

Yeah!!

#

That's what I got! I thought it was me!

tidal kiln
#

i've got 4 breadboard neopixels tied to d8

idle owl
#

Oh do we need to attach something external? I was trying to control the onboard one.

tidal kiln
#

shouldn't matter. i just wanted to exercise more than one

slender iron
#

@tidal kiln are you using mpy?

tidal kiln
#

yes. hang on. trying .py next...

slender iron
#

that may be the mpy thing

tidal kiln
#

guess so:

Adafruit CircuitPython 3.0.0-alpha.0-153-gb6587b3 on 2017-11-01; Metro M4 Express with samd51j19
>>> import board
>>> import neopixel
>>> pixels = neopixel.NeoPixel(board.D8, 4)
>>> 
slender iron
#

k good to know

idle owl
#

I should have said something. I thought I had forgotten how to do NeoPixel code. lol

slender iron
#

they change the mpy format before bumping the version number

tidal kiln
#

what's the mpy thing? its build isn't correct for latest python build?

#

answer before question. nvmd...

slender iron
#

right, they changed the meaning of some the bytecode numbers

tidal kiln
#

"some"? so some .mpy might work?

stuck elbow
#

we will need separate .mpy packages for every version

#

I wish they were like .mp0, .mp1 etc.

slender iron
#

right, only the unary ops

tidal kiln
#

that makes it fun

stuck elbow
#

also, didn't they had code in there that checked the .mpy version and threw an error?

slender iron
stuck elbow
#

I think I remember they added it at some point

slender iron
#

@stuck elbow yes but they didn't do the version bump when they changed it

#
  • changed the bytecode
stuck elbow
#

WHAT?

slender iron
#

yup

tidal kiln
#

what?

stuck elbow
#

cries a little

slender iron
#

yeah....

stuck elbow
#

I forgot that micropython has the "we will fix it before the release" development model, and not the continuous integration/delivery one

#

then again, if they made a couple of changes before the release, they don't need to bump it several times

slender iron
#

yeah..... numbers are free though

stuck elbow
#

up to 31 bits, anyways

slender iron
#

they just bumped to 3 so I think they have time

tidal kiln
#

so sounds like a somewhat temporary issue, will be ok when version bump happens, then version check will work?

slender iron
#

yeah, I opened the issue because we coudl actually revert the bytecode change instead

#

that makes us more different from micropython though ๐Ÿ˜•

stuck elbow
#

can we put it back when they bump the mpy version?

slender iron
#

yeah we could. we just have to be more aware of the changes they are making

stuck elbow
#

or we could bump the version now

slender iron
#

right

tidal kiln
#

in other news:

>>> pixels[0] = 0xff0000
>>> pixels[1] = 0x00ff00
>>> pixels[2] = 0x0000ff
>>> pixels[3] = 0xffbad2
#

i've got a red, green, blue, and hello kitty pink neopixel

slender iron
#

nice!

stuck elbow
#

bad2

#

badยฒ

tidal kiln
#

and just to give a kudos to how easy you're making this....first time i've tried neopixel on cp

#

import. use. magic.

slender iron
#

๐Ÿ˜ƒ

tidal kiln
#

@idle owl don't worry. i almost didn't raise my hand either.

idle owl
#

I have a blue NeoPixel!!!!

stuck elbow
#

oops, wrong blue ๐Ÿ˜ƒ

idle owl
#

Now it won't mount.

stuck elbow
#

sorry, I cursed it

idle owl
#

Bootloader mounts. I reflashed it. Still not mounting CIRCUITPY.

stuck elbow
#

anything in the console?

slender iron
#

@idle owl does your stored code work still?

idle owl
#

Yes to both

slender iron
#

I had a mass storage issue and my neopixel animation was still working

idle owl
#

My NeoPixel is still blue

#

And there's at least something USB related in dmesg

slender iron
#

ooooh post it please

#

I think there are still gremlins in the usb

#

I tried to replicate it but couldn't after I saw it

idle owl
#
USB device 239A802114110002 - BOT reset completed with kUSBHostReturnPipeStalled.
USB device 239A802114110002 - fConsecutiveResetCount = 1.
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - fConsecutiveResetCount = 1.
SmartBattery: finished polling type 4
USB device 239A802114130002 - will be reset!
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - fConsecutiveResetCount = 2.
USB device 239A802114130002 - BOT reset completed with kUSBHostReturnPipeStalled.
USB device 239A802114130002 - fConsecutiveResetCount = 1.
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - BOT reset completed with kUSBHostReturnPipeStalled.
USB device 239A802114130002 - fConsecutiveResetCount = 1.
USBMSC Identifier (non-unique): 0x239a 0x13 0x4201
Report bytes: input:64 output:64 feature:1Collections : 2Buttons     : input:0 output:0 feature:0Values      : input:1 output:1 feature:1Element value capacity 3348Report count: 1Report ID: 0 input:512 output:512 feature:8com_driver_GxxxDriver::probe(IOHIDInterface)
com_driver_GxxxDriver::probe fails
disk2: media is not present.
disk2: media is not present.
disk2: media is not present.
disk2: media is not present.
msdosfs_fat_uninit_vol: error 6 from msdosfs_fat_cache_flush
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
IO80211Interface::updateReport _peerManager is missing
SmartBattery: finished polling type 4
USB device 239A802114130002 - BOT reset completed with kUSBHostReturnPipeStalled.
USB device 239A802114130002 - fConsecutiveResetCount = 1.
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1```
#

There's more before that too.

slender iron
#

kUSBHostReturnPipeStalled seems suspect

#

@idle owl if you can figure out how to reproduce that it'd be awesome. I doubt its easy to though

idle owl
#

I've reflashed it and reset it multiple times and keep getting this.

tidal kiln
#

how'd you get there though? just set on board neopixel to blue?

idle owl
#

Ah yeah. Yes, apparently.

slender iron
#

@idle owl ah interesting

#

did you do a full power reset?

idle owl
#

Nope, will try. I keep forgetting I have a power adapter now.

tidal kiln
slender iron
#

๐Ÿ˜ƒ

idle owl
#

Full power reset still nothing. And it was in main.py

slender iron
#

hrm

#

mass storage fails but serial doesn't?

idle owl
#

Nope I can't connect via serial either since it stopped mounting

slender iron
#

hrm

#

weird

#

but the pixel gets set to blue again/

idle owl
#
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - fConsecutiveResetCount = 2.
USB device 239A802114130002 - fConsecutiveResetCount = 1.
USB device 239A802114130002 - will be reset!
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - fConsecutiveResetCount = 2.
SmartBattery: finished polling type 4
USB device 239A802114130002 - fConsecutiveResetCount = 1.
USB device 239A802114130002 - will be reset!
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - fConsecutiveResetCount = 2.
SmartBattery: finished polling type 4
USB device 239A802114130002 - fConsecutiveResetCount = 1.
USB device 239A802114130002 - fConsecutiveResetCount = 2.
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
USB device 239A802114130002 - BOT reset completed with kUSBHostReturnPipeStalled.
USB device 239A802114130002 - fConsecutiveResetCount = 1.
SmartBattery: finished polling type 4
USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1```
#

Yep.

#

Flashes a little at first like it's doing a status check, and ends blue.

#

I picked blue because it was a color that the status checks didn't give.

slender iron
#

yup, thats a good idea

tidal kiln
#
import board
import neopixel

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)
pixel[0] = (0, 0, 255)
#

simple as that?

idle owl
#

Yep.

#

Except I think I used pixels.fill because it wasn't working. I just realised it's because I tried to do it to pixel 1, not 0.

tidal kiln
#

and it let you?

idle owl
#

Yeah.

tidal kiln
idle owl
#

1 didn't turn it blue, I'm not sure if it threw an error.

tidal kiln
#

should that be n-1?

idle owl
#

I thought I was formatting it wrong, so I did fill instead.

tidal kiln
#

nvmd. >= works.

idle owl
#

And now serial works.

pastel panther
#

wew!

idle owl
#

And now I'm getting the cyan status flashing telling me my code is wrong.

tidal kiln
#
>>> pixels[5] = 0xffffff
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/lib/neopixel.py", line 143, in __setitem__
  File "/lib/neopixel.py", line 103, in _set_item
IndexError: 
#

didn't let me get away with it

idle owl
#

Hmm. The serial connection keeps dropping. So it's not really working. But the code finally failed, I am getting the flashing status.

#

Reflash - runs the code successfully, turns the NeoPixel blue.

tidal kiln
#

curious why you didn't get the index error though?

#

oh well. show time.

idle owl
#

Yep, we'll get back to it ๐Ÿ˜ƒ

sturdy furnace
#

Hey all! I'm teaching an intro to python/coding course at my university and we really to use circuitpython with the CPX (hardware is fun!)

Unfortunately the students will all have their own laptops, and essentially every operating system possible...

So how compatible is circuitpython across every OS?

slender iron
#

@sturdy furnace Windows 7 is the trickiest and needs our latest drivers. Everything else works driver free I believe.

stuck elbow
#

this is really the main reason I'm focusing on circuitpython for workshops, and not micropython or anything else

#

you just plug it in and see the files

slender iron
#

๐Ÿ˜ƒ

stuck elbow
#

previously I made several workshops with the esp8266 boards, but there is always one person with the newest mac that has broken drivers, or something like that

#

and you spend half the workshop getting it to work

sturdy furnace
#

exactly, it's such a good learning tool.
Any recomendations on environment for this? Is their a way to give them a debugger, and a REPL without using puTTy?

slender iron
#

how soon are you running it @sturdy furnace ?

sturdy furnace
#

it starts in march next year

stuck elbow
#

no debugger, but there is a nice editor for beginners with autocompletion called Mu

sturdy furnace
#

(so plenty of time)

stuck elbow
#

it has repl built-in too

slender iron
#

cool cool, mu is our recommendation

sturdy furnace
#

oo thanks, I'll give it a try.
We are thinking of getting everyone to use visual studio code for the whole course.
I was going to test integration with that.

idle owl
#

So.... I just made a new build and I'm still having the same issues - although frankly that's probably a more reasonable outcome since the build Scott posted shouldn't be any different.

#

I went back to the build Scott posted. Regardless, I'm consistently getting the same thing in dmesg. I'll wait to reload the bootloader in case this is worth further investigation.

#

I was getting ready to hook up a NeoPixel strip too. When I tried to save the updated code, it acted like it had already disconnected, but I'm wondering if main.py is stuck somewhere in the middle of the updated code, and that's why it's failing. I don't think that would explain the dmesg output though, but I don't know enough about what goes into dmesg to know whether failed code would impact it. - Edit: It does. Updated info @ 11pm.

formal plover
#

@idle owl got everything plugged in? Lolololol ๐Ÿ˜น

idle owl
#

Always worth asking!

pastel panther
#

blue-tac: for when you're too cheap/lazy to buy a vice

umbral dagger
#

Well.... my initial attempt at some debugger code compiles & links....

pastel panther
#

ya?

umbral dagger
#

calling debugger() drops me into my debug repl from which I can continue ๐Ÿ˜ƒ

pastel panther
#

ya!

#

are you using scotts learn guide?

umbral dagger
#

it also responds to :c that returns to continue execution, and :b which for now prints "BACKTRACE"

#

exciting

pastel panther
#

oh wait, you're writing your own code?

umbral dagger
#

@pastel panther I'm working on adding some debugging capabilities to MP/CP

#

@pastel panther my test file is: ```
def foo(x):
print("start")
y = 2
debugger()
print("done")

foo(1)

pastel panther
#

@umbral dagger That's awsome!

idle owl
#

@umbral dagger Nice!

pastel panther
#

THIS SENTENCE WAS A TRAVESTY. IT HAS BEEN REDACTED FOR YOUR SAFETY.

#

I just got my jlink today so I'm eager to get debuggin'

idle owl
#

@pastel panther Excellent!

umbral dagger
#

@pastel panther This will all be from within MP/CP. You put breakpoints in your python code by calling debugger(). You run your code and when debugger() is called you get dropped into a repl (much like the top level repl with some extra meta-commands. but you're in the context of where debugger() was called. Access to any local variables, the stack, etc.

#

@pastel panther I'm just playing in a fork at the moment.

pastel panther
#

goes repo hunting

#

no commits in four days?!

#

taps foot impatiently

umbral dagger
#

@pastel panther I haven't done much for the last few days. I picked it up tonight

#

@pastel panther With the above python file: ```>:./micropython debug-test.py
start
MicroPython Debugger
DD> :c
CONTINUE
done

:

#

@pastel panther Not much yet, but the first step.

idle owl
#

Oh. I just got something new in dmesg. saved

pastel panther
#

@umbral dagger Are you working from some knowledge of how debuggers work or are you doing it de novo?

#

@idle owl do you have an issue for the stuff you're seeing?

idle owl
#

Not yet. I'm not convinced that it's not just something I'm doing, so I hadn't reported anything yet.

#

Also, the drive shows up on Windows, but only on USB2.0. I renamed main.py to something else, and now it shows up on Mac as well. (Which is USB3.0)

pastel panther
#

Does USB 3.0 work on windows?

idle owl
#

Yup.

pastel panther
#

but you had to remove main.py for it to show up?

idle owl
#

Yep.

pastel panther
#

That sounds issue-worthy

idle owl
#

Need to repro it.

umbral dagger
#

@pastel panther This is not my first rodeo ๐Ÿ˜ƒ

pastel panther
#

@umbral dagger Nice. I once worked at a place that made a binary static analysis tool that was pretty cool. Not exactly the same thing but cool none the less

umbral dagger
#

@pastel panther This will be pretty basic, nothing fancy like a proper Smalltalk or Lisp debugger. Just stick your head in & look around, maybe change some variables.

pastel panther
#

@umbral dagger cool

umbral dagger
#

@pastel panther Maybe more later, but no more tham needed, and with minimal (or zero) effect on size or performance.

pastel panther
#

@umbral dagger awesome

idle owl
#

Ok. So only the NeoPixel code I have causes the issue. Going back to a blinky-only main.py doesn't cause the issues. Neopixel code as main.py consistently does the USB2.0 vs 3.0 thing, causes the same dmesg output and same issues with the serial REPL. But the NeoPixel code works, I can import a different filename in the REPL and I get my blue pixel.

pastel panther
#

strange

idle owl
#

I'll deal with it tomorrow.

pastel panther
#

nice, I just cut the battery voltage diode on my feather m0 in half

#

Who needs reverse voltage protection anyways?

cunning crypt
#

@pastel panther How did you manage that?

pastel panther
#

@cunning crypt I was cutting a header off to replace it with a different type. Or rather to replace it so it matched the one on the other side even though it was perfectly functional. Cause you know, electrons care what your headers look like. ๐Ÿ˜ถ

cunning crypt
#

Well, now in addition to replacing the header, you have to replace the diode!

pastel panther
#

I like to think of it as an excuse to by myself a hot air rework station

cunning crypt
#

Is it an M0 Express? @umbral dagger did a thing on replacing the Flash chip with a bigger one, since you seem to need to replace everything.

pastel panther
#

shoves the other m0 perfectly functional dev boards under the keyboard

cunning crypt
#

Yeah, but getting a hot air rework station would be great

pastel panther
#

Ya, I've got some flash chips on order for that mod

#

I'm also shoehorning a SWD header on while I'm at it

umbral dagger
#

@pastel panther an SMD iron tip, some solderwick, and a pair of fine tweezers.

#

For a diode you can probably get away without the wick, but it might be nice to clean it up before replacing.

#

I've pretty much faced the einevitable move to solder paste/stencils and an oven. Putting that off as long as I can.

pastel panther
#

@umbral dagger I'm 110% sure I can only possibly fix this with a hot air station. Yup, I clearly must have a hot air station. No way to do it otherwise. Nope.

umbral dagger
#

@pastel panther I see the logic in that.

#

My next big acquisition is a 3d printer. I'm waiting on a referrable from work that will take care of that, and maybe get me a better workspace while I'm at it.

pastel panther
#

Be carefule about that workspace. Electronics projects are like a gas: They expand to fill all available space

cunning crypt
#

@pastel panther No lie

umbral dagger
#

I know. I've been doign this off & on for a long time.

pastel panther
#

So you have less space left than the rest of us!

umbral dagger
#

It keeps growing

#

My goal is a 24" x 74" bench surface.

pastel panther
#

Nice. Mine is about that size with an extra tier for monitors and stuff. A friend gave me his old music desk so it even has built in rack rails, not that I need them for much.

slender iron
#

@umbral dagger thatโ€™s amazing! Please post a link to the repo on the issue @meager fog filed

manic glacierBOT
tulip sleet
#

@slender iron having very odd problems with latest master (b6587b3b6). I am loading the identical firmware build on two identical metro M0's. On one, neopixel turns very bright when plugged in, but only sometimes, other one it doesn't happen. Can sometimes get into repl on one or the other, but maybe require resetting system-udevd. Still see 30-second reset in syslog. I'm wondering if there's a wandering clock or something like that. Is clock locked to USB as in 2.x?

#

i need to go to sleep, but will try to be more systematic in the morning. Didn't see anything terrible in gdb on one when I was connected.

umbral dagger
#

The repl works, but I don't have the context right yet, so you can't "see" local vars.: ```>:./micropython debug-test.py
start
MicroPython Debugger
DD> print("Hello, world")
Hello, world
DD> :c
CONTINUE
done

:

#

Reminder, the file being executed is : ```def foo(x):
print("start")
y = 2
debugger()
print("done")

foo(1)

cunning crypt
#

So if anyone here wants some extra money, I've put some bounties on CP code I wish to exist. Because obviously the best solution is to throw money at my problems. But in limited quantities, because I still have bills to pay.

slender iron
#

@tulip sleet its possible its wandering. I thought I'd looked at it and it was ok. I don't think I'm handling usb callback failures well. In particular, see if you get a NAK or STALL on an endpoint.

pastel panther
#

@slender iron those ice40 boards are sweet

slender iron
#

yeah I was thinking I need to make a digikey order

pastel panther
#

Do you have a part number for the USB jack? I found what I thought was the right one but it's subtly different

slender iron
#

yup, let me look

#

no promises its right

#

usb should be though

pastel panther
#

Are you doing FPLA/CPLD work on your mac?

slender iron
#

not sure what you mean

pastel panther
#

Isn't the ICE40 a CPLD? I was asking if you're developing for it on your mac

#

I was under the impression most toolchains for working with FPGAs and similar didn't generally support macs

slender iron
#

ah, I only know of it as an FPGA

#

icetools works on mac I believe. I put some effort into adding ice40up5k support to them and someone else has done some more work on it

pastel panther
#

That's pretty cool

#

Having a bot automate status checks/reports is pretty clever

slender iron
#

yeah, edunham is awesome

hollow tartan
#

Hello. Would someone please explain to me why I ended up with a .elf instead of a . bin?

#
   text    data     bss     dec     hex filename
 573820    1076   64352  639248   9c110 build/firmware.elf
Create build/firmware-combined.bin
esptool.py v1.2
('flash    ', 35456)
('padding  ', 1408)
('irom0text', 539476)
('total    ', 576340)
('md5      ', '736dd22c74c29ca10eb5742df6d341c4')```
pastel panther
#

you didn't get both?

hollow tartan
#

I am checking . probably a stupid question because I need to sleep...

slender iron
#

@hollow tartan you should get both

#

(looks like it worked to me!)

pastel panther
#

oh yea, it's right there

hollow tartan
#

yep they are in the build directory! ```-rw-rw-r-- 1 vagrant vagrant 576356 Nov 1 20:12 firmware-combined.bin
-rwxrwxr-x 1 vagrant vagrant 894828 Nov 1 20:12 firmware.elf

slender iron
#

great! good work @hollow tartan

hollow tartan
#

Which cannot be seen from Windows; unless the last step to move it into the shared vagrant file. ๐Ÿ˜ƒ

slender iron
#

I'm headed to bed now but will be around tomrorow

pastel panther
#

ta ta

manic glacierBOT
#
  • For the MBR in that link 0x0..0x3000 = 12KB (???)
    <img width="546" alt="screen shot 2017-11-02 at 08 49 37" src="https://user-images.githubusercontent.com/181073/32315042-ce61b7e2-bfaa-11e7-8968-bcc05f58ec67.png">
  • The bootloader also supports OTA updates via BLE, which is why it's so large
  • I will probably combine the two file systems internally yes (nRF52832 variants without USB), and simply hide the config files, but I always need to be sure that we have 'n' bytes free for storing t...
stuck elbow
#

@cunning crypt I don't know if that helps, but reading BMP files is super-easy

manic glacierBOT
#

There is conflicting information about the sizes in the documentation. :(

I've listed below what seems to be the right/final settings for:

  • S132 v2.0.1 (current feather52 boards)
  • S132 v5.0.0 (future work and nRF52840)

S132 v2.0.1 with OTA DFU Bootloader

  • CircuitPython Core: 228KB
  • User Filesystem: 96KB
  • Private Config Data: 28KB (which may get combined for 96+28=124KB total)
/*
    GNU linker script for NRF52 w/ s132 2.0.1 SoftDevice

    MEM...
drowsy geyser
#

Morning, AdaCrew! I haven't built firmware since last weekend and the volume of stuff has been ... high. Is Master stable right now (i.e., should I go ahead and build firmware for the M4)?

#

Answer: yes, Master seems to be stable. I have a REPL and (quite bright) NeoPixel. One thing I notice, though, is that I can't exit the REPL with a control-D. It just does a soft reboot and immediately re-enters the REPL (which is probably why I have a solid white NeoPixel instead of a pulsating green one).

#

Now off to shower and work!

tulip sleet
#

@drowsy geyser thanks for the testing! Could you mention what board this is and OS this is on? We're having trouble with Linux (at least). Also could you write up an issue about ctlrl-D and the REPL? Tnx!

hearty thistle
#

I recently purchased the Feather Bluefruit LE and got Circuit Python installed, but someone on the forums mentioned that Bluetooth doesn't work under CP. Is there are approximate roadmap to this feature working? Or should I flip it back to running Arduino code?

drowsy geyser
#

@tulip sleet Sure! This is the Metro M4 Express and the host computer is Windows 10. I use the Windows 10 Unix environment to build the firmware, but then bossac to flash it. I'll write up an issue in a couple of minutes. Thanks!

tulip sleet
#

@hearty thistle we have started work on porting CircuitPython to the nrf52 chips, which have native Bluetooth. The Feather Bluefruit LE could be supported, but someone would need to spec and write a library. We're not working on that particular thing right now. There's an RPi Bluefruit Python library that could be a starting point

#

@drowsy geyser that's helpful, since it says the USB stuff is working OK on Windows

drowsy geyser
#

@tulip sleet Glad it's helpful! I had no problems mounting, remounting, or flashing the board. The only thing different was Windows asked me if I wanted to trust the connected device. I hadn't seen that before, and I'm unsure if it's device-related or an artifact of the Creator release updates.

tulip sleet
#

@drowsy geyser I have a couple of Windows machines running Insider builds: I will try that

hearty thistle
#

@tulip sleet Thanks. I'll take a look at the nrf52 ones. As you work on the code, would it be posted on the Adafruit/CP Github page?

#

Also, does the Feather 32u4 Bluefruit LE run CP and have BT support?

tulip sleet
#

@hearty thistle No 32u4 (or any AVR) boards run CPy - not nearly enough RAM or flash. The nrf port will show up in adafruit/circuitpython, branch master, as it develops (initial stuff is there already - merging nrf MicroPython code into our tree)

hearty thistle
#

Cool. Thanks. Will keep an eye out for it

tulip sleet
#

sure! will be great to have some testers. If you browse, you'll also see an nrf52 branch, but that's out of date

manic glacierBOT
#

I did a git pull and submodule update this morning (2017-11-02) and flashed the firmware to the Metro M4 Express. Afterwards, I got a solid white NeoPixel. When I connected to the REPL I got a prompt with no banner. The REPL works, though. When I hit control-D to exit the REPL it did a soft reboot and immediately re-entered the REPL. This happens repeatedly with control-D, regardless of whether or not I execute any Python in the REPL (not that I think it's likely that would change the behavi...

drowsy geyser
#

@tulip sleet My work machine is running the latest Microsoft internal build. I'll go home in a couple hours after I get some work done and get the M4 and try it the REPL on my work machine.

#

BTW, I created the issue on GitHub. I tried to capture all the relevant behaviors and the system configuration.

tidal kiln
#

This branch is 1 commit ahead, 2 commits behind adafruit:master.

#

So I'm one step forward, two steps back?

solar whale
#

progress is not always forward ๐Ÿ˜‰

sick creek
#

sometimes you need to take some step back

manic glacierBOT
lofty topaz
#

Heads Up people. Remember, in the old days, double file extensions were used for malicious intent. Anyone remember VBScripts? In my view, I would simply have the system ignore double extended files. I see no reason for them. IMHO.

#

I only say this because it reminded me of what George Santayana once said, "Those who forget the past are doomed to repeat it".

tulip sleet
#

@slender iron The saved Atmel START .json files now no longer load as a saved project. โ˜น

Downloading downloaded-zip/samd21.zip ...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>400 Bad Request</title>
<h1>Bad Request</h1>
<p>Could not populate ConfigContent from /opt/packs/Atmel/USB/0.0.1/templates/config/usbd_composite_config.h.jinja2 for config/usbd_config.h with configuration: Could not find element with ID &quot;usb_composite_iserialnum&quot; in wizard &quot;&quot;</p>

I needed to add some devices to get additional config constants...

slender iron
#

lovely, can you load it on the web?

tulip sleet
#

no, I get a less informative message that's equivalent: "
Failed loading project
Loading file did not complete successfully"

#

it's not obvious from the updated release notes that there was an incompatible change. "What's New" link in the upper right hand corner of START page just says they added more devices

#

I think I am going to take just 5 minutes and look at Dean's Arduino core (and the older D21 core).

slender iron
#

yeah, asf4 sucks

#

I'm looking at their interrupt enable/disbale code now

#

it looks ok actually

tulip sleet
#

there are parts that are fine, parts that are just missing, and parts that assume you want to set up everything via #define's.

slender iron
#

yup yup

tulip sleet
#

I have the I2C code written, just trying to get it to compile. WIll see if I can make it work before I get more annoyed.

slender iron
#

I'd be happy to look it over if you need another set of eyes

tulip sleet
#

my code is fine -- it's the library .c's that don't have all the config info, about baud rate. I had to add asf4_config/ sercom config file, and it doesn't have enough devices. I think I will just define what I need or hack it up. We set the baud rate at runtime anyway.

time for lunch anway - just heated up some soup

slender iron
#

๐Ÿ‘ I'll take a look at updating asf

tulip sleet
#

don't spend too much time on it now - I think I need to short-circuit the configs. One problem may be that it will check that you can't overload the sercom's: they have to be divvied up among SPI, I2C, and USART, even though we potentially want to use anything anywhere

slender iron
#

that ok. I'm curious if they've had usb changes

#

lol, atmel start uses jinja

#

Could not populate ConfigContent from /opt/packs/Atmel/USB/0.0.1/templates/config/usbd_composite_config.h.jinja2 for config/usbd_config.h with configuration: Could not find element with ID &quot;usb_composite_iserialnum&quot; in wizard &quot;&quot;

tulip sleet
#

so you think they use jinja templates for the source code?(!)

slender iron
#

yeah

#

and the json we pass in must be the data passed to jinja

tulip sleet
#

oy, I think. I did think you could recover your config just by staring at the json.

slender iron
#

that what I'm doing ๐Ÿ˜ƒ

#

comparing it to something I just generated

#

I'm particularly interested because the json usb config changed

#

still version 0.0.1 though ๐Ÿ™„

bronze geyser
#

I'm having a challenge porting an Arduino SPI library to Circuit Python. SPI bytes are zipping to and fro, but i'm not seeing the identical sniff i see when I run the Arduino code. I document my challenge here: https://docs.google.com/document/d/1ICpaAfVQYYZULmi_ZxxGqk52SWFuQYYkc8R1Ldr73gY/edit?usp=sharing

#

i'm looking for any insight and fully realize that is asking a lot...so don't expect any...

slender iron
#

@bronze geyser what logic analyzer are you using?

bronze geyser
#

the one i always misspell - salaeaeaeae

#

or is it saleae

#

eieio

slender iron
#

yup yup, thats what I use too ๐Ÿ˜ƒ

#

could you post the logicdata files so I can look in Logic?

bronze geyser
#

i'll make some runs. i didn't capture these. This is because I am so close to being clueless. Just a few minutes..

slender iron
#

I've got time to help now if you do

bronze geyser
#

can i attach a file here or should i put it on a file share?

#

(oh and THANK YOU)

slender iron
#

try putting it here. there is a file size limit you may hit though

bronze geyser
slender iron
#

and this same exact hardware works arduino code?

bronze geyser
#

I have to Huzzahs (for convenience). So that is different. It is the same ATM90e26 Featherwing.

#

(where two == to)

slender iron
#

hrm

bronze geyser
#

i'm new to python. Perhaps it is in how i am handling the write and readinto?

slender iron
#

I looked at the code and it looks ok to me

bronze geyser
#

ok.. thank you.

slender iron
#

the arduino capture seems weirder to me

#

because enable drops before the clock line

#

it looks like the phase is different

bronze geyser
#

hmm...Arduino -> mode 2 -> polarity = 1, phase = 0 ...this is why i modified spi_device ...

slender iron
#

the arduino capture looks like its capturing on the rising edge

bronze geyser
#

ok. thank you. i need to brush up on phase/polarity as well as how it looks within the logic analyzer. Thank you for pointing me in this direction (i hope...)

#

i need to double/triple check...

#

it confuses me that the MOSI looks ok...

slender iron
#

thats arduino

#

see how the MOSI line is shifted half a cycle to the left?

bronze geyser
#

yes. however what is weird to me are the arrows on the sclk. for me, on both the arrow points down. for you on the arduino the arrow points up.

slender iron
#

I changed it ๐Ÿ˜ƒ

bronze geyser
#

why? i don't understand.

#

oh wait...to play around w/ the phase/polarity...

slender iron
#

I changed the SPI analyzer's phase

pastel panther
#

@lofty topaz The case that you mentioned (presumably things like seekret_info.xlsx.exe) is sufficiently different than the scenario we're talking about supporting that the security risk minimal to non-existant. Good on ya' though for thinking about security; not enough people developing software do so.

manic glacierBOT
bronze geyser
#

OK... i changed the phase=1 w/in spi_device and the results are looking much better....in fact, they might be right but i need to check a few things. THANK YOU. Yippee!

cunning crypt
#

@stuck elbow It's been.... many hours now, but Bitmaps are something that's crossed my mind. However, JPEG images are typically smaller, and if the end goal is to have everything running off of a SPI flash chip (VS an X-GB SD card), then filesize will be much more important. Even if I take a page from @umbral dagger and supersize the flash chip

bronze geyser
#

@slender iron THANK you very much.

slender iron
#

@bronze geyser no problem! I'm happy to help

slender iron
#

@tulip sleet got it updating

#

new CMSIS files

tulip sleet
#

that's not I/O stuff, though, those came from ARM, I think.

slender iron
#

yeah, I'm still looking through it

tulip sleet
#

I'm understanding better my compilation problems. The sercom baud register values are calculated via #define's, but it's generating warnings that appear to be just wrong. I may simplify the asf4_conf files, because to get a complete set of values I have to generate them separately (download a project with 6 I2C's, then 6 SPI's, etc. But the actual settings are very small: there's just a lot of boilerplate in the config files. It would be easier to see if all the comment noise were removed.

slender iron
#

thats kinda crazy its #define based. can you replace the code instead?

tidal kiln
#

but the comments are there to help you ๐Ÿ˜œ

slender iron
#

@tulip sleet I just updated asf4 master. do I do a merge into master_bugfixes now?

tulip sleet
#

yes, and then from master_bugfixes into circuitpython. sorry for the tedium. The idea was there might be other ports than circuitpython.

slender iron
#

k, no problem

#

want me to PR it?

tulip sleet
#

not worth it unless you have to fix merge conflicts. but lemme know about any interesting changes

#

@tidal kiln (and @slender iron): sample declaration from the deptpartment of redundancy department:

/**
 * \def CONF_CPU_FREQUENCY
 * \brief CPU's Clock frequency
 */
#ifndef CONF_CPU_FREQUENCY
#define CONF_CPU_FREQUENCY 1000000

I reduced that to:
#define CONF_CPU_FREQUENCY 1000000

lofty topaz
#

@tulip sleet @slender iron Wizards at work. Sorry, just kibitzin' again. You guy's rock. โœŒ

tidal kiln
#

omg. but what if it's already defined??!

#

actually guess that could happen, like something else wants to set it first

tulip sleet
#

@slender iron there is a routine that calculates the baud rate register values -- it just depends on some other define values. That routine takes three args, including the sercom clock rate. The clock rate passed in is ignored (!) and fetched from the defaults instead. The defaults are calculated in the config files.

#

@tidal kiln yeah but we're not going to do that ๐Ÿ˜

stuck elbow
#

@cunning crypt that is true, on the other hand, JPEGs require a very complex algorithm and a lot of memory to decode, while you can practically pipe the bmp file directly into the display with very little processing

cunning crypt
#

@stuck elbow That is correct! I have, however, come across an Arduino JPEG decoder library that runs very well on the ESP8266

#

It'll likely work on the M0, but I haven't tried.

stuck elbow
#

@cunning crypt there is another possibility โ€” since you are going to have a converter program anyways, you could store the image in exactly the same pixel format as the display needs, and simply gzip it โ€” circuitpython/micropython already have gzip library built-in

pastel panther
#

@stuck elbow @cunning crypt you'd probably want a util for converting from jpeg/png/bitmap/whatever

cunning crypt
#

@stuck elbow The goal is, ideally, NOT to have a converter at all. Hence JPEG. That way users can just drag their files into the appropriate folder on the CircuitPYthon device and it'll be able to pull and display as needed

pastel panther
#

@cunning crypt I mean, if you want to get tricky you might be able to transcode it as it comes in? Maybe?

#

sounds like a PITA

cunning crypt
#

@pastel panther I, personally, am pretty poor with coding especially when it comes to things like this. That's why I'm throwing money at the problems (See: http://phoenixborntech.com/bounties )

#

My current designs use an ATMega328, or the experimental failure design used an ESP8266. They pull images off of an SD card and display them onto a wearable badge.

#

I want to make it as user friendly as possible, so I want to get everything working with CircuitPython. Since CP shows up as a mini flash drive, being able to drag images onto the drive is super and lets me get rid of the SD card.

pastel panther
#

You could always just wait until @stuck elbow inevitably releases a CP game engine

cunning crypt
#

You're not wrong

#

I'm sure there'd be something in there I could, ah, co-opt

lofty topaz
manic glacierBOT
tulip sleet
#

@slender iron I agree. Change is OK, since it's a major version bump.

slender iron
#

cool cool

#

I've got a PR in the works to update asf and micropython

tidal kiln
#

is analogio in cp3.0?
(3.0.0-alpha.0-153-gb6587b3)

slender iron
#

no

tidal kiln
#

thanks. guess that's why i can't import it.

slender iron
#

๐Ÿ˜‰

stuck elbow
#

@cunning crypt though I'm lazy, so I'm using BMP in my engine ๐Ÿ˜ƒ

timber lion
#

if you make a PPM in GIMP and save it as a binary it can read it

#

but you probably don't have memory to store it, so it has a concept of visiting the pixels

stuck elbow
#

ppm is wasteful

timber lion
#

as you visit them you draw on the display

#

doesn't matter if it's on SD card

#

and it's easier to parse

#

it's like 20 lines of code ๐Ÿ˜ƒ

#

anyways take a look at main.py to see how i use it

#

every time it draws a frame it's just reloading the image ๐Ÿ˜ƒ like i said it can't load them in memory so it just reads them and draws pixel by pixel

#

can get about 3-4 FPS like that

#

so not fast but good enough for simple sprite animations

idle owl
#

So I narrowed down all the issues I was having yesterday with the M4 to a specific code snippet being the only code in main .py. I have no idea why, it doesn't make any sense to me. I included all the code in another main.py with other code, and it doesn't cause any problems.

slender iron
#

@idle owl do tell! I was just gonna start looking after I eat lunch

idle owl
#

Oi. I think I need to reboot. Atom crashed a bit ago, hadn't reopened it. Tried to open a file from the M4, crashed finder, and if I go to /Volumes/ and try ls, it hangs. Whee!! Be back in a sec.

slender iron
#

yup, bad usb can do that

idle owl
#

It was fine once I figured it out yesterday though. Connected and reconnected repeatedly. I now unplugged it and Finder came back up. Either way, rebooting.

slender iron
#

k I'll be around

manic glacierBOT
slender iron
#

I โค closing issues

idle owl
#

Not even plugged in and I had to manually shut it down. Wouldn't reboot on it's own. ๐Ÿ˜„

timber lion
#

also @cunning crypt I see the bounty you mention for drawing shapes and text, have you seen these guides and libraries? https://learn.adafruit.com/micropython-displays-drawing-shapes and https://learn.adafruit.com/micropython-displays-drawing-text they both work with circuitpython and give you a GFX-like library for shape drawing and text rendering without framebuf module

How to draw basic shapes on pixel-based displays with MicroPython!

How to write text on any MicroPython display.

#

just be warned it's slow.. it's all pure python so you don't get much speed for shape drawing

#

but works well for UI etc

cunning crypt
#

Well, for the speed and shapes I'm not terribly worried about speed.

timber lion
#

yeah for speed you'll want to use the framebuf modle and its built-in C functions for sure

#

but that needs a m0 express of some sort, the basic m0 builds can't fit it in right now

#

or you could look at making a custom build that strips out stuff you don't need and adds it.. gets trickier though

idle owl
#

I had to reset it once to get it to mount to Finder. But it's working now.

slender iron
#

@idle owl so it all works?

idle owl
#

Ok, so yesterday I wrote up a main.py to turn the onboard NeoPixel blue. It started having issues connecting. It would allow me to connect via serial and sometimes get to the REPL, but it would drop that connection after a fairly short amount of time. My Mac is using USB3.0. So I plugged it into Windows USB3.0, it showed up as "removable drive" but wouldn't let me do anything with it. Connect it to USB2.0 on the Windows machine, popped up immediately. So I renamed main.py to something else, and it showed up immediately on USB3.0 on both Windows and Mac. 100% reproducible as of last night. I went back to blinky-only main.py and had no problems connecting. I included the exact code from the main.py that was causing issues with the blinky-code, and no issues.

#

So... the same code is included with other code an doesn't cause problems. But alone, caused all of the above problems.

#

I can try it again. Windows is up on a different machine, so I don't have to take any time to switch it back and forth.

slender iron
#

hrm

idle owl
#

Oh and I was getting consistent errors in dmesg when it was having issues connecting.

slender iron
#

hmm

idle owl
#

So the current main.py includes bliinky, onboard blue NeoPixel and a rainbow animation on a NeoPixel strip. And other than the issue I had a few minutes ago which sorted itself (and may have been Atom related anyway), I haven't had any issues with the current code.

slender iron
#

hrm

idle owl
#

๐Ÿ˜„

slender iron
#

I'm distracted by the jlink connection issue

idle owl
#

Oh and also it could get to the bootloader through all of that, but reflashing CP, both the build you posted (which is what I went back to) and one I built did not resolve the connection issue with the specific main.py. Every so often after the serial connecction would drop, it would either stay at the white status NeoPixel or it would go to where it flashes yellow and cyan to tell you that you have an error in the code. But most of the time, the code continued to run - I had a blue NeoPixel most of the time.

#

I can file an issue. I'm never convinced that it isn't something I'm doing, so I hesitate to file issues until I get a second opinion.

#

I'll want to see if I can repro it again though.

slender iron
#

its definitely an issue

tulip sleet
#

just fyi, as an experiment (on Linux), this morning I turned off the msc descriptors in the .py descriptor generator, so I just had a repl. Then I did not have any issues connectingto the repl, 30-second resets, etc.

idle owl
#

I tried putting the code into an entirely new file as well in case the file got corrupted, that did not resolve it either.

slender iron
#

@tulip sleet could you give me a beagle trace with the issue?

tulip sleet
#

sure - right now I'm putting everything back together after incorporating the latest changes. But i'll do it on the tip of master, not my i2c code branch

idle owl
#

Ooh fun. Now it's not showing up on Windows USB2.

#

(I am actually having fun ๐Ÿ˜„ )

tidal kiln
#

@idle owl can you post the main.py that causes the issue? i'll try and recreate.

idle owl
#

@tidal kiln You sure you want to? lol. I can't get it to show up anywhere now. Also, I made the mistake of not copying it locally and realised 2 seconds after I hit reset that I should have. If/when I get to it, I'll grab it and post it.

tidal kiln
#

yeah. sure. can always recover via j-link.

slender iron
#

ok, my drive failed the first time here

tulip sleet
slender iron
#

perfect! Thanks

tulip sleet
#

on an M0 (not M4), I loaded the latest 3.0 master, turned on tracing, then plugged the USB plug in

slender iron
#

k, will look after I look at this msc thing

idle owl
#

Hah! Got it back!

pastel panther
#

insert 'Stella got her Groove Back' reference here

stuck elbow
#

@idle owl what you describe sounds like the neopixel code is not letting the circuitpython code do some usb stuff, but the blinky code does, and so if you mix the two, it still gets time to do some maintenance stuff โ€” at least it looks like that to me

idle owl
#

@stuck elbow Could be. I was thinking something like that, but I don't know enough about USB3 vs USB2 to explain why it works on one and not the other.

stuck elbow
#

I'm guessing here too

idle owl
#

@tidal kiln I rename this to main.py and it'll let me get to the REPL and interact with it at least once more before I eject and reset it, then the problems start.

#

Also tell me if my code is wrong. That's what I thought was the problem to begin with, except that it works. I get my blue light.

stuck elbow
#

I would add a sleep in the loop

tidal kiln
#

don't need loop, and i think default is true for auto update, so maybe don't need show

stuck elbow
#

or just drop the loop completely, you don't have to keep setting the pixel to blue

tidal kiln
#

but i wouldn't call those things "wrong"

idle owl
#

That's what I had at first, but it wasn't working (that wasn't why) and I added it when I was trying to make it work, and never removed it because it worked. (My issue before was pixels[1])