#circuitpython-dev

1 messages ยท Page 170 of 1

solar whale
#

it's set to 400KHz here - but I'm not sure that is the whole story.

tidal kiln
#

at least setting 10k produces 10k

solar whale
#

I guess that is encouraging - I don't see it being changed in the bno055 driver either.

tidal kiln
#

50k is more like 35k

#

100k is more like 55k

idle owl
#

@raven canopy Review away!

tidal kiln
#

400k is more like 105k (setting it explicitly)

solar whale
#

@tidal kiln i dont think i paid much attention.

#

it was 400k with busio on an M0!

tidal kiln
#

just opened my old trace. M0+BNO055. it's ~333k

#

same for M0+TCS34725

#

ESP8266+TCS34725 is more like ~100k though ๐Ÿค”

solar whale
#

hmm -- maybe bitbang just can't keep up.

tidal kiln
#

but it works with the TCS34725, even though the freq is suspect

solar whale
#

most devices are not too fussy about the freq, I dont think.

tidal kiln
#

yah. guess the bno055 isn't one of those.

#

are you set up to where you can test and see if you get same suspect freq?

solar whale
#

tcs34725 has no minimum - up to 400K -- like te ccs811 I just think the bno055 is a pain

tidal kiln
#

with whatever sensor

solar whale
#

it'll take a few minutes

tidal kiln
#

if you're willing to. please do. if you see same thing i'll update the info in the issues.

#

if it's real, guess it points to something else going on under the hood to be looked into

solar whale
#

just finishing a phone call with Comcast ๐Ÿ˜‰ hopefully done son

tidal kiln
#

no worries. when ever you can. you can just ping me.

solar whale
#

@tidal kiln with default on a apds9960 -- I am seeing ~100K out and the responses are at ~75K looks like clock stretching does work ๐Ÿ˜‰

tidal kiln
#

but you're seeing 100k instead of 400k?

solar whale
#

works great!

tidal kiln
#

yah. but why 100kHz clock? that's not expected. right?

solar whale
#

not really sure what bitbang can do

#

just a sec

#

there is a delay between high/low in bitback and I thin it default sto 5 microsec - so 100K will be the max rate

#

checking code

#

but taht is just the delay, takes time to execute teh code.

#

not sure waht to expect for the max rate

tidal kiln
#

me neither. thanks for checking.

solar whale
#

May need to get some thoughts from Radomir

raven canopy
#

since i love jumping into the middle of things... we're talking bitbang specific to esp8266? or port agnostic?

tidal kiln
#

for now. just esp8266.

solar whale
#

Should be agnostic though.

raven canopy
#

k. runs to esp8266/common-hal/

solar whale
#

Real code is at top level shared-module and shared-bindings

#

I'll see what it looks like with bitbang on an M0 -- will take a few minuts to switch

weary spindle
#

@tulip sleet thanks for the quick look and your suggestions and advice on the SAMD21J18 issue. I made changes and that appears to have fixed those build errors.
the extra paren needed to be moved to the end of that block, and i changed the TC(7,0,0) to TC(7,0) for PB22,PB00 and did a similar thing for PB23 TC(7,1)
now i can continue on .... your help is much appreciated.

solar whale
#

@tidal kiln not having any luck getting this sensor to work wot bitbang on the M0

#

with busio it runs fine at 400K

tidal kiln
#

what does the bitbang clock at on the M0?

solar whale
#

same code - not sure where the clock comes from.

#

ha - mcp9808 on M0 with deafult at 400K runsa at about 50Khz!

#

busio is at 400KHz

raven canopy
#

is looking at microsecond accuracy on esp

#

not ready to suggest using an ets_timer function yet, but would like to rule out that os_delay_us isn't just a "close enough".

solar whale
#

but in the bitbagio code it sprinkles lost of 1 micros second delays in the sequence

spare storm
#

With CP, is there a way to detach a servo to save battery, then quickly attach it again only when it's needed?

solar whale
#

@raven canopy I'm not sure there isa "timing" problem . it may be slower thatn expected, but it should still work.

tidal kiln
#

@spare storm you would need additional hardware, to actually cut power to the servo. but CP could then be used to control that hardware. what are you currently working with?

spare storm
#

Circuit Playground Express with a CRICKIT

raven canopy
#

well, if 400kHz is expected, and measured results are below that, then i would think it's a timing issue since bitbangio is using delay(self->us_delay) as it's time keeper. unless i'm reading that wrong. which is TOTALLY possible. ๐Ÿ˜„

solar whale
#

And I see the asme thing on mcp9808 taht read is slower tahtn write, and that may not be clock stretching aferall just the way bitbang works.

#

yes, but teh master drives the clock at any freq it wants - it may not be 400Hkz, but that is jut the upper limit for Fast I2C

#

I may be totally minsundersting how it works so I'll defer to you "hardware guys"

raven canopy
#

looks for the hardware guys ๐Ÿ˜„

solar whale
#

some sensors work fine -- others seem to be more finicky

#

anyone who can spell schematic is a hardware guy ๐Ÿ˜‰

raven canopy
#

my understanding was that bitbangio influences the timing since its not a hardware I2C scenario. basically, it tricks the master into thinking "yes...i am exactly like you". and has to keep up the ruse.

solar whale
#

maybe so - I suppose some devices may just be more forgiving than others.

raven canopy
#

yeah. all depends on the allowed variance for ACKs and NACKs. now, i want a SNACK. ๐Ÿ˜‹

solar whale
#

ANd I need to get to bed! wish I could have helped more -- maybe new ideas tomorrow.

tidal kiln
#

@solar whale later. thanks for helping.

raven canopy
#

night @solar whale. and never doubt your helpfullness!

solar whale
#

Thanks! Goodnight!

idle owl
#

ok... wt...

#

Wired up some dotstars and they are not playing nice. ๐Ÿ˜ฌ

raven canopy
#

๐Ÿ”จ

#

you can borrow mine... ๐Ÿ˜„

ruby atlas
#

@idle owl uhoh, something i'm going to run into?

idle owl
#

๐Ÿ˜„ Probably

#

But here's the frustrating thing. I have these panels wired up to a raspberry pi and they work great. I just connected them to a feather and they're not working.

#

Why.

#

I just connected another set to the Feather: works fine

#

So....

#

@ruby atlas The ones I had you get are the ones I just made work with no effort ๐Ÿ˜ƒ

#

You don't have to solder up that strip, comes presoldered. It's nice.

ruby atlas
#

Ahh... Nice!

#

Ugh, that's so weird re that one set especially since it works with the rPI.

idle owl
#

Yeah I'm confused.

#

running off of external power, I didn't even wire power up to the feather, wouldn't have given enough

ruby atlas
#

grounding issue?

#

are you sharing ground between external power and the feather?

raven canopy
#

hehe. i was debating a "check grounds" comment. ๐Ÿ˜„

idle owl
#

I mean it's the same ground line, but it's not the same location

#

if that makes sense

#

the DotStars are powered from the center of the strips.

#

and the Feather is on one end.

ruby atlas
#

yep. (i always pull my multimeter out anyhow and ensure i get the nice beeeeeep on the continuity test saying the grounds are connected)

idle owl
#

We apparently don't know how to use our multimeter to do that ๐Ÿ˜„

#

or we need a new one. evidently.

ruby atlas
#

hmm, most have a diode test mode that doubles as continuity.

idle owl
#

it sends a signal, because I can get some to light up, inconsistently, but it doesn't ever like to accept the (0, 0, 0) to shut them the hell off.

#

is blinded over here

ruby atlas
#

cover them with sheets of paper?

#

๐Ÿ˜ƒ

#

man i should totally get a newer meter. all the newer ones are smaller and prettier.

raven canopy
#

i wouldn't imagine the resistance on the rail length would be enough to cause an issue. grabs meter because he caused his own curiosity

ruby atlas
#

(mine's like 20 years old)

idle owl
#

ok I just used a jumper wire to attach the ground on the power directly to the feather instead of the groundwire I have soldered on

raven canopy
#

yep. exactly zero ohms.. ๐Ÿ˜„

idle owl
#

Still not working right

#

so um

ruby atlas
#

Scope time?

idle owl
#

DotStars are SPI right?

ruby atlas
#

so claims the adafruit site!

idle owl
#

now I'm wondering if I simply wired it wrong.

#

SCK and MOSI right?

#

I mean I wrote a guide that says that, but now I don't trust my own work since I'm the one who wrote it.....

ruby atlas
#

Could you have a dud feather? do other strips work on it?

raven canopy
#

Master Out Slave In. you are correct.

idle owl
#

Other strips work fine.

ruby atlas
#

Gremlins.

raven canopy
#

did you have SCK and MOSI crossed, perhaps?

idle owl
#

I'm going to have a fit if there's something going on with these strips. They're carefully wired into panels for my tabletop lightbox.

#

@raven canopy A different strip worked fine

#

backwards on the strips maybe? seems unlikely... but I'll try jumper wires.

#

no nothing happens if I swap them.

#

sigh

#

I just grabbed another piece of the same strip. And it works fine.

ruby atlas
#

.. uhoh.

#

is that strip dead?

#

(or just mostly dead)

idle owl
#

Or not.

ruby atlas
#

maybe miracle max can revive it

idle owl
#

So I grabbed a different white strip.

#

Presoldered.

#

And it flickers weirdly.

#

At least it responds when I change the levels though.

#

sigh. I have no idea.

#

I thought the white strips acted the same as the coloured ones, just three LEDs you control the levels for. Maybe they don't.

ruby atlas
#

hmmm... the RGBW ones?

idle owl
#

No, there aren't RGBW Dotstars.

#

There's all white ones.

#

Still 3 LEDs in them like RGB, except each is white.

#

Same temperature.

#

But they're acting weird. And that's two presoldered short strips acting strange.

#

I wonder if the white ones are different.

ruby atlas
raven canopy
#

from the cool white product page:

The manufacturer of the APA102C smart LED used in this strip used to be GRB order, and has changed in 2015 to have BRG color order.

from the RGB product page:

The manufacturer of the APA102C smart LED used in this strip used to be DOTSTAR_GRB order, and has changed in 2015 to have DOTSTAR_BRG color order and then in 2017 to DOTSTAR_BGR 
ruby atlas
#

and Note: Strips come with 4 solder points per segment, but the arrangement may vary depending on the supplier, so please check when soldering/powering!

#

I guess that's something else i'll have to keep in mind!

raven canopy
#

alright. this is my last build-n-test for the night. gotta catch up on Westworld! ๐Ÿ˜„

idle owl
#

Yeah I keep verifying by reading the order on the strip.

#

And I don't care which order they're in, they're all white ๐Ÿ˜„

#

They flicker when simply sitting here.

#

I Don't know.

raven canopy
#

are you using a level shifter? (i know...duh question)

idle owl
#

No...... I didn't think SPI needed it.

raven canopy
#
DotStars are 5V devices. While you might get them to respond to 3.3V signals, this is not a guaranteed thing and should not be counted on. For low-voltage microcontrollers and systems such as Raspberry Pi, a logic level shifter (e.g. 74AHCT125) is recommended for both the data and clock pins.
idle owl
#

ugh. I was going to use Itsy (has it built in) but I wanted to use the Joy Featherwing.

#

GLERGH.

raven canopy
#

sowwy. ๐Ÿ˜ฆ

idle owl
#

ok. Nah, don't be that at all. At least you figured out what it might be.

raven canopy
#

odd though that your RPi was working at 3.3, but not the feather.

idle owl
#

Yeah for sure.

ruby atlas
#

depends what the true voltage is!

#

maybe the pi is 3.4v and the feather is 3.25v

#

and the tolerances on each strip will vary

idle owl
#

I'll try it on an itsy tomorrow. If it works, I guess I'm figuring out how to wire a featherwing to an ItsyBitsy ๐Ÿ˜„

raven canopy
#

true. just measured my feather's 3v pin. 3.30, spot on. but, i've seen the GPIO pins at around 3.2x before.

ruby atlas
idle owl
#

Yeah but I wanted the project to be super compact.

raven canopy
#

also, the rise and fall of the SPI activity is definitely a factor. the ramp might never get to 3.3...

idle owl
#

I have them around from the last project that started on a different board and ended on an ItsyBitsy for this exact bloody reason

#

Except was NeoPixel.

#

Problem is that the VHi pin on Itsy isn't HW SPI.

#

Don't think anyway. Why would it be.

#

But it has a level shifter built in and would at least tell me if that's why these won't work.

raven canopy
#

and you'll need two pins, right?

idle owl
#

Just won't be as fast to respond. Which I guess doesn't matter since it's not like I'm looking for sick animations.

#

Oh crap.

#

Yes.

#

And there's only one with the shifter in it.

#

ugh.

raven canopy
#

bridged itsys? hehe.

idle owl
#

comes out to the same size as the featherwing in the end right?

#

๐Ÿ˜ข

#

bleh.

#

I guess I'll try them on Itsy with data on the 5V logic pin at least

#

see if that's enough.

ruby atlas
#

hmm, i hope i have some level shifters in my giant box of parts

raven canopy
#

it could be. ๐Ÿคท

idle owl
#

I have no problem running RGB strips without this, @ruby atlas

#

This is a new issue.

#

Maybe the tolerances are different, I don't know.

#

Ok I need to bail an hour ago.

#

Goodnight!

raven canopy
#

later @idle owl ! i'm off to. build complained of something...and i just don't wanna. ๐Ÿ˜„ ๐Ÿ’ค

ruby atlas
#

I have some 8 channel level shifters. and i also need to sleep.

raven canopy
#

๐Ÿ‘‹ ๐Ÿ’ค

ruby atlas
#

okay ๐Ÿ‘‹ after this 3d print job!

raven canopy
#

hehe

ruby atlas
#

another iteration of my super compact gemma case

manic glacierBOT
#
  1. Refactor how longint is chosen: set longint choice in mpconfigboard.mk, and propagate it to .h automatically. This is a a little simpler and more orthogonal.
  2. Create a circuit_playground_crickit BOARD with adafruit_seesaw and adafruit_motor frozen in, and with framebuf turned off. HID was removed from the frozen module list to make space.

The CPX Crickit build is very close to running out of space (96 bytes left!), with longints turned on and the frozen modules above includ...

manic glacierBOT
solar whale
#

@tidal kiln @raven canopy looking agin at https://github.com/adafruit/circuitpython/blob/master/shared-module/bitbangio/I2C.c specifically at the write_byte and read_byte functions, it looks like each call delay and release (which contains a delay) so if dlay is set to 1 micirsecond as it is for the default case, then there is at least a 2 microsecond delay but that should still allow speeds approaching 400KHz. If the connected devis is holding SCL Low then the scl_release will wait for it. Otherwise, it is not clear to me why the bitbang frequency should be so slow. @stuck elbow Do you have any idea when when the I2C frequency is set to 400Khz, the apparent actaul frequency (seen on the logic analyzer) is more like 100Khz?

raven canopy
#

@solar whale that is why I was looking into os_delay_us/microsecond accuracy. While it should be 1us delay each time, it could end up being 4 or 5 based on the esp and/or the VM loop.

solar whale
#

@raven canopy imakes sense -- would you exepct it to behave differently on a SAMD21? My one test had it even worse.

raven canopy
#

I wonder if we could somehow get a timestamp out to debug it, using the clock's tick...

#

@solar whale theoretically, yes, any inaccuracies would be possible on all ports. On the SAMD delay is using the SysTick counter.

solar whale
#

I'll try to do some more measurements this evening . Just want to make sure the results are consistent. they seem to be. the tests @tidal kiln and I ran seem to agree.

raven canopy
#

I wish we had a way to debug the esp...

tidal kiln
#

yep. and then the next question is why the bno055 is so picky about all this, while other sensors just keep on truckin

raven canopy
#

Beyond print, obviously.

solar whale
#

I can get my dremmel tool out again ๐Ÿ˜‰

#

@tidal kiln - It was interesting that the adps9960 worked on ESP , but not with bitbang on M0 - works fine with HW I2C on M0

#

but my mcp9808 temp sensor works everywhere....

raven canopy
#

I love Bosch datasheets. But sometimes all the detail can hide what you're looking for. ๐Ÿ˜„

nocturne wren
#

Resurfacing from PyCon conference... Thank you @tulip sleet @idle owl @slender iron for all of the open spaces and sprints to introduce and inspire folks to try CircuitPython with the special edition PyCon Gemma. On behalf of the Python Software Foundation, thank you @meager fog and @heady dove for supporting education, Python, and all the Blinka things โ™ฅ

raven canopy
#

@solar whale @tidal kiln BNO055 datasheet, table 4-8, shows a minimum of 1.3us for SDA start pulse (tBUFF) and SCL low (tLOW; ACK signal I assume). If the delay(self->us_delay) is [accurately] operating at 1us, which is any frequency above 250kHz since self->us_delay = 500000 / frequency, that may explain the "pickyness". Would have to compare the other devices mentioned though to verify that theory further.

tidal kiln
#

@raven canopy thanks. yah. i was looking at that last night but brain was done for the day. :(
but also - i couldn't get things to work even with a freq of 10k.

raven canopy
#

Well, darn. There's always UART...which I just discovered in the sheet. Haha

tidal kiln
#

yep, that's the recommended way to use it with a rpi. (rpi has a clock stretch bug in hardware)

raven canopy
#

Seems simple enough. Remove the pull-ups and ground address select.

stuck elbow
#

esp8266 doesn't have an uart, though

#

the one it does have is taken

raven canopy
#

True. Good point.

spare storm
#

Which is the better way to initialize a seesaw Crickit signal IO pin as an input triggered by an RF receiver? ss.pin_mode(RF0, ss.INPUT) or RF0 = DigitalInOut(ss, 11)

#

Also, is the way you monitor that pin for a signal (HIGH) different depending on which approach you used to define that input?

#

I ask because the examples I see for input through the signal IO each seem to do this a different way and I don't know why. ๐Ÿ˜ƒ Thanks!

slender iron
#

@spare storm I'd recommend using the DigitalInOut object since it will be interchangeable with other digital in out objects

#

I'm back in Seattle btw if you ever want to meet up in person

spare storm
#

Thanks @slender iron, and that would be great, you can meet Tom and Crow once I get them to work with the crickit! ๐Ÿ˜„

slender iron
#

๐Ÿ˜„ I'm in ballard. Are you close?

spare storm
#

Very, we're in Queen Anne

slender iron
#

awesome!

tidal kiln
#

tom and croooooow?

spare storm
#

Yes, Tom and Crow, I made the bots actual robots. ๐Ÿ˜„

#

Just working on converting them from Arduino to Crickit

manic glacierBOT
rigid path
#

I think I now the answer here, but I just want to get an opinion on this. My end game is to work with the Feather family of boards using Python, (both micro- and circuit-.) I am in the process of learning Python 3, but would it worth my time and effort to learn the Arduino IDE /language as well? Is there a list of what boards I will not be able to use if I only go the Python route only? Is it a matter of support for certain chip sets?

slender iron
#

@tulip sleet @idle owl when you do library releases can you include the full release notes? It may be the first thing people find about a driver. ```<change description>

To use in CircuitPython, download the .mpy file and copy it to the lib folder on the CIRCUITPY drive. Or, simply install the Adafruit CircuitPython bundle.

Read the docs for info on how to use it.```

#

@rigid path I'd stick with Python until you can't do something with it. At some point you'll need the speed of arduino/C and you can switch then

manic glacierBOT
rigid path
#

@slender iron thanks for the input. Am I safe using any of the M0 boards with Python ? Should I be good using any of the other wings?

tulip sleet
#

@slender iron tried to get changes in before your review. ๐Ÿ˜ƒ Also will do on the full release notes things.

slender iron
#

@rigid path We tend to have CircuitPython support for all of the M0 boards but not necessarily all of the peripherals. Again, I wouldn't worry about it until you run into something that isn't supported

#

@tulip sleet np, a second PR is fine

rigid path
#

@slender iron Thank you.

manic glacierBOT
wide wharf
#

Hello, I'm programming an esp32 for a school project, and i'm trying to use an SD card adapter to save files on the sd card. I have searched for some examples and came to the conclusion that almost all of the examples use the modules adafruit_sdcard and busio. Now I've got the adafruit_sdcard module working, my only problem now is with the busio module. I keep getting the ImportError no module named 'busio'. I have the adafruit_bus_device folder in my python lib and on my esp32, and still get the same error. I hope anyone can help me with this problem ๐Ÿ˜Š

slender iron
#

@wide wharf On the ESP32 you must be using MicroPython which doesn't have busio because its a CircuitPython API.

manic glacierBOT
wide wharf
#

@slender iron Ah that makes sense thanks ๐Ÿ˜ƒ

slender iron
#

so look for a MicroPython sdcard tutorial. (I think it has it built in)

wide wharf
#

Will do thanks again

slender iron
#

np!

manic glacierBOT
spare storm
#

Hmm, which is better?

#

SB0 = DigitalInOut(ss, 2)
SB0.switch_to_output()

#

or

#

SB1 = DigitalInOut(ss, 3)
SB1.direction = Direction.OUTPUT

slender iron
#

@spare storm both are good. the first form allows you to change other things at the same time if you like (like the value)

spare storm
#

Good to know, the SB triggers when it goes low so I might set the val to high here.

#

Thanks!

idle owl
#

@slender iron Yep, good call on the releases. Will do.

ruby atlas
#

Wow Metro M4 almost out, CRIKIT going fast.

idle owl
#

@slender iron For the Learn repo, should I be adding your requested ignore rules into the .pylintrc file as well? Or is that what Craig is doing when he says he's adding them? I wasn't sure if he was editing that as well as the files.

#

@ruby atlas @raven canopy It looks like putting data on the 5V logic pin on ItsyBitsy and clock on another arbitrary pin was enough to get the DotStars to start responding correctly.

#

They're definitely slower, you can see them write along the strip as though I had programmed them to light up one at a time with a really short delay. But for my purposes, it should be fine.

timber mango
#

Hey @ruby atlas ya just done me a solid. Would have not spotted the Crickit in the wild.
I got mine, jack. tnx --nis

slender iron
#

@idle owl my intention was that it'd be done per file

idle owl
#

@slender iron Excellent.

manic glacierBOT
ruby atlas
#

oh, yay, cpx in the search box now matches circuit playground express products

manic glacierBOT
umbral dagger
#

@ruby atlas Hmmm... putting a Crikit on a MetroM4... That would be fun. Iโ€™m totally hacking a 6-pin connector on one.

manic glacierBOT
tulip sleet
#

@idle owl or @slender iron should each and every library .py file have __version__ and __repo__? Just checking. Fixing up seesaw lib.

raven canopy
#

@tulip sleet unsolicited: pretty sure, yes. it's in the cookiecutter, and is used by sphinx for RTD (iirc).

tulip sleet
#

k - thanks!

raven canopy
#

@tulip sleet i just reread your question, and i think i missed an important distinction you made.

#

"every single .py" being that distinction.

tulip sleet
#

my example is that in Adafruit_CircuitPython_Motor, adafruit_motor/*.py all have __version__ and __repo__ (except for __init__.py

raven canopy
#

i'm perusing the lib right now, and i think that the only ones that absolutely need it are any of them that are listed in docs/api.rst.

#

so, seesaw.py will need it (doesn't have it on current master), but the rest should be fine without it.

tulip sleet
#

is that just because api.rst is incomplete on seesaw?

manic glacierBOT
tulip sleet
#

there are a few helper .py files

raven canopy
#

could be, yeah. so if you're adding them to the api.rst, then __version__ at a minimum is probably a good idea. since the version of each sub-module can be updated independently.

tulip sleet
#

I'll remove them from the helpers. The __repo__ strings are kind of long and it would save space not to have them everywhere.

raven canopy
#

sorry. i should've just let Scott or Kattni answer. ๐Ÿ˜„

tulip sleet
#

np - I rarely write libraries and am unfamiliar with the conventions

slender iron
#

@tulip sleet we need both

#

its there as a mechanic for auto-updating libraries

tulip sleet
#

tnx, so I put the two constants in all files in seesaw except for some internal .py's that are imported to provide to some constants.

raven canopy
#

ahh. so it's used by adabot, not sphinx?

slender iron
#

they should be in all of them because we don't group .pys by "package"

#

we shouldn't assume all .pys are together

tulip sleet
#

so every .py except __init__.py should have them?

#

even .py's that will never be documented?

slender iron
#

how does documentation play into it? If they'll end up on the filesystem and may need to be updated they should have it

tulip sleet
#

how come the empty __init__.pys don't

slender iron
#

we don't actually need them

#

we should just remove them

#

for a while the builder needed them to identify packages but we've removed that constraint to match python3 which doesn't need them

tulip sleet
#

I think that's a Python 2.7'ism

#

ok, I just need to undo the last commit I made to my seesaw PR. Thanks!

slender iron
#

np

raven canopy
#

again, sorry for confusing you @tulip sleet!

slender iron
#

(sorry for the late response. I was climbing)

raven canopy
#

as a note: there is at least one __init__.py that contains code. i'll try and find it...

#

Thermal Printer is the one I was thinking about. its __init__.py contains a class for importing the module based on thermal printer versions.

#

Want me to put an issue on the bundle repo to remove/rework init.pys?

slender iron
#

@raven canopy issue would be great. we can leave that __init__.py and just add the version and repo url

#

I thought adabot check that they were included in all of the files but it must not ๐Ÿ˜ƒ

manic glacierBOT
raven canopy
#

i'll get the issue up a little bit later. dinner/hangout time.

slender iron
#

np

manic glacierBOT
#

I'm reluctant to call them unsupported. To me that means you shouldn't use them, or that we wouldn't fix bugs in them. If you want to say that they may change in the future, that seems more like what you want to imply. But we couldn't write a lot of useful code without struct, array, sys, os, etc. in our libraries and use them in Learn Guides, so maybe something milder than "unsupported".

prime flower
#

@raven canopy done going thru the building cp guide (yay), wanna chat (whenever you're free)?

hushed prawn
#

Hello, I just got a circuit playground express and am having a blast so far! Does anyone know if there is a way to import the CircuitPython libraries into VS Code so it doesn't give me errors when writing code? I tried searching the web and discord and haven't had much luck so far

manic glacierBOT
gaunt breach
#

@hushed prawn I have the same wish for PyCharm and importing CircuitPython libraries. As of yet, there is not ๐Ÿ˜ฆ thats because the libraries are actually compiled, and not directly python. So VS Code & PyCharm have nothing to import that they can parse.

hushed prawn
#

@gaunt breach That would probably explain the trouble, and how they got those libraries so small then! Thanks for the quick and informative reply ๐Ÿ˜ƒ

tulip sleet
#

pylint has some list of imports you can ignore; does PyCharm have something similar?

gaunt breach
#

@hushed prawn in my infinite free time (sarcasm) I hope to compile the c doscstrings into Python stub code so pycharm, vs code, all ide's can do proper autocomplete and importing of those compiled libraries ๐Ÿ˜โœจ

hushed prawn
#

@tulip sleet Thanks for the tip. I don't understand a lot of the code in the zip file you mentioned, but its commented well enough for me to bumble around a figure stuff out.

#

@gaunt breach That sounds like a very exhaustive task. I'm a bit new to coding and microcontrollers so that is all a bit above my skill level, but if I can help test or do something else let me know how I can contribute. I'm sure other people would be happy to line up and help too ๐Ÿ˜„

idle owl
#

@raven canopy I'm home if you're available

tulip sleet
#

@hushed prawn yw. That code is for reference. The libraries are compiled to .mpy files to save memory and time when they're imported on the board. In a number cases the libraries are too large to be compiled on board. So don't use the library .py files on the board; use the .mpy library bundle (see https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries)

raven canopy
#

i am. currently chatting with @prime flower on his review suggestions. ๐Ÿ˜„

idle owl
#

Ok keen let me know when you're free. I'm not sure how late I'm going to make it tonight, but I say that and then I'm up for ages.

raven canopy
#

yep. same here...every night.

solar whale
#

There was a forum post https://forums.adafruit.com/viewtopic.php?f=8&t=135989&p=674098#p674098 regarding a problem with the RFM69 Circuitpython driver that I think is similar to a problem I found in the RFM9X driver and fixed, but have not had time to update the RFM69. I opened an issue https://github.com/adafruit/Adafruit_CircuitPython_RFM69/issues/6 but I won't have time to fix this until I get back from my vaction after the first of June. I'll be happy to fix it then, but if anyone has RFM69 radios and wants to get it updated sooner, please feel free!

prime flower
#

oh whoop, looks like I'm volunteering at the eastern long island makerfaire next month to share a table and talk about circuitpython/makecode (hopefully stir up some involvement and get people excited). sharing a table with a young inventor and his robot(s)!

#

@solar whale I'll be able to test fixes after work next week if you want? (dont have radios with me a.t.m, but I can grab them then)

solar whale
#

@prime flower Thanks, I hate to just throw changes in there and not spend time thorough;y testing them. Unfortunaltely, I leave Thursday and won't be back until June 2. There were several small other issues I found as I dug into the RFM9x driver and I think it may take some time to check the RFM69 driver thoroughly.

prime flower
#

that's more than ok, enjoy your vacation

solar whale
#

thanks - I will ๐Ÿ˜‰ I certainly don't mind if anyone else wants to take it on, but if I am going to update it, I'd like to take the time to test it as well!

slender iron
#

does the build dance

solar whale
#

@tidal kiln @raven canopy Sorry, not going to have time to test bitbangio speeds. Hopefully will have more time tomorrow evening.

raven canopy
#

all good @solar whale! you got vacation to focus on!

timber mango
#

vacate: the latin word for 'cow' is 'vacca' so 'vacate' meant 'go .. and take your cows with you.'

spare storm
#

I've been looking through all the examples on github for crickit and CP but I don't see anything where multiple servos are used independently. How do you name each servo so you can control them independently?

stuck elbow
#

@spare storm what's the problem exactly?

#

@spare storm you just assign them to variables

spare storm
#

So, here's what I tried:

#

pwm1 = PWMOut(ss, 17)
pwm2 = PWMOut(ss, 16)
pwm1.frequency = 50
pwm2.frequency = 50
ms1 = servo.Servo(pwm1, min_pulse=700, max_pulse=2200)
hs1 = servo.Servo(pwm2, min_pulse=750, max_pulse=2200)
ms1.angle = MC
hs1.angle = HC

stuck elbow
#

should work

spare storm
#

Doesn't though, not sure why.

stuck elbow
#

what happens instead?

spare storm
#

Nothing

stuck elbow
#

do you get any error messages?

spare storm
#

Not seeing any

stuck elbow
#

you have the REPL open?

spare storm
#

Yep

stuck elbow
#

if the servos are already in those positions, they won't move

#

do they hold their position?

spare storm
#

No, I can move them, and when I do they don't go back on reset.

stuck elbow
#

how are you powering them?

spare storm
#

From the crickit servo pins.

stuck elbow
#

and how do you power crickit?

spare storm
#

4 x1.2v AA

stuck elbow
#

that sounds good

spare storm
#

Should be, yes. When I code per one of the examples where both servos move at once, it works. so doesn't seem like hw.

stuck elbow
#

so you only have problems when you have two separate pwms?

spare storm
#

It seems to be a problem with the code.

stuck elbow
spare storm
#

Yes, that works, but it doesn't allow me to control the servos independently. (i.e. one servo moves my bot's mouth, another moves it's head. They should move independently).

stuck elbow
#

it does

#

you can set each of the servos in the array to a different value

#

just replace the for loop with your commands for individual servos

#

servos[0].angle = 3 etc.

spare storm
#

So, servos[0] is the first one in the array and servos[1] is the second?

stuck elbow
#

yes

#

but what you pasted should work too

#

so I suspect there is either a bug in crickt, or something wrong somewhere in the rest of your code

spare storm
#

I'm sure there are problems all over my code. ๐Ÿ˜„ I'll give putting them in an array a shot though. Thanks!

stuck elbow
#

first and foremost make sure your code actually runs and doesn't throw an exception

#

to see the exceptions, open the REPL console

spare storm
#

Ah... looks like the crickit might be underpowered for one of my servos. My SG90 works now, but my MG92B isn't. I'll try powering that one independently and see what happens.

stuck elbow
#

.oO( next CRICKT should have build-in power monitoring )

spare storm
#

I figured it out, my board was shorting on something. Thanks for the help!

manic glacierBOT
stuck elbow
#

is it possible that SysTick_Handler is only getting called when REPL is active?

stuck elbow
#

nevermind, I think I figured it out

manic glacierBOT
fading solstice
#

Problem with new Metro M4. Metro M4 board with a DS1307 RTC board and using the 5v pin to power the RTC. Also SCL/SDA connected to RTC. Problem we when connecting USB: Metro does not connect to PC; power light is green, neopixel is black, tx off, rx off. To fix the problem, i need to remove the 5V wire to the RTC. Once Metro is connected to PC, I can reconnect the 5V wire. I think I should be able to unplug the USB cord and plug it back in without unhooking 5v wire.

tulip sleet
#

@stuck elbow is your PR all set now for review? Just want to make sure you don't have other changes in the works.

timber mango
#

Hi, do the M0 or better yet the M4 boards have some kind of low-power state when using with CircuitPython?

tulip sleet
#

@timber mango we have not implemented any kind of sleep state yet. The boards have the capability but we haven't taken advantage yet.

#

do you need to keep state across low-power sleeps?

timber mango
#

@tulip sleet Probably yes. How hard do you reckon would it be to add sleep state support?

tulip sleet
#

not incredibly hard, but the boards are not necessarily set up for really-low power sleep, because of the quiescent draw of the power LEDs, regulator, etc. what's the scenario?

timber mango
#

@fading solstice translation from the verbal domain to the one that schematic diagrams inhabit isn't trivial for me.

manic glacierBOT
timber mango
#

@tulip sleet Well I want to use an M4 board to control some stuff at my house and it would be nice if it went to sleep when all the peripherals are off until I need something again.
(Turning off all lights at my house would make the board go to low-power state until I need to turn them back on etc. I might be able to use the timers for that but it would be annoying if I for example needed to turn the lights in the living room back on in 3 in the morning.)

fading solstice
#

@timber mango to boil it down. having the 5v wire connected to the RTC board somehow interferes with Metro M4 USB connection.

timber mango
#

Or in another project at our company we use about 350 Trinket M0s inside one huge installation and it would be really swell if we were able to save at least a few mW...

solar whale
#

@fading solstice just a thought - if you power the RTC via 5V then its I2C lines will also be at 5V and that is not correct for the Metro M4 unless you are level shifting them. I doubt that is related your problem, but something to keep in mind.

stuck elbow
#

@tulip sleet it's ready

#

@tulip sleet by the way, I'm working around a funny phenomenon there

fading solstice
#

@solar whale actually i think that may be the real problem. removing the SCL and SDA wire allow the Metro M4 USB to work correctly. So i will add level shifting to the SCL/SDA signals.

solar whale
#

good luck! from the DS1307 product page The DS1307 is simple and inexpensive but not a high precision device. It may lose or gain up to 2 seconds a day. For a high-precision, temperature compensated alternative, please check out the DS3231 precision RTC. If you do not need a DS1307, or you need a 3.3V-power/logic capable RTC please check out our affordable PCF8523 RTC breakout

fading solstice
#

noted

tulip sleet
#

@timber mango low-power mode is not on our short-term list, but feel free to file an issue. The power consumption is on the order of a few 10's of ma's or less. I have a not-too-accurate USB power meter here and it says 0.01A right now, and that's as low as it goes.

#

@stuck elbow systick issues?

stuck elbow
#

@tulip sleet no, there is something funny going on when MP_OBJ_FROM_PTR(gamepad_singleton) is called from an imported code, as opposed to the REPL

#

I think it might be returning NULL or something like that

tulip sleet
#

is gamepad_singleton in flash or is it created dynamically?

stuck elbow
#

it's created dynamically

#

or maybe it's making a copy?

#

is that possible?

tulip sleet
#

MP_OBJ_FROM_PTR is just a cast

timber mango
#

@tulip sleet "on the order of a few 10's of ma's or less" are you talking about Trinket M0 boards or about the Metro M4 boards?

tulip sleet
#

i'm measuring the metro m4

#

I have a USB cable with a cut power wire for current measurement but it's not handy at the moment.

timber mango
#

Haha 5 mA for Fibonacci .. nice data point to memorize.

#

If the Charger Doctor says the lowest non-zero number it can, I think that's meant to indicate 10 mA.

#

I should probably build a make-do Charger Doctor with at least one extra digit of resolution.

#

(I'm a lot more interested in the high end of the current-measuring range of that device!)

#

Well thanks for the data. While it's probably useless to conserve power while using only one device even saving 10mA per M0 board would save us 17.5W total. That's a pretty nice saving IMHO.

solar whale
#

@fading solstice Forgive me if I'm telling you things you already know, but level shifting I2C lines may be tricky. I have used this https://www.adafruit.com/product/757. Not sure what you are planning.

tulip sleet
#

@timber mango I just measured the M4 running CPy and doing nothing in particular: it's about 30ma. A Gemma M0 (v similar to trinket) is 12-13 ma

timber mango
#

@tulip sleet oh, so the whole thing is probably not very worth it ๐Ÿ™‚

tulip sleet
#

it would be swamped by anything like multiple NeoPixels, etc.

#

also tells me the Charger Doctor is not accurate at low current values

timber mango
#

Yeah I get 20 mA with my M4 and the Charger Doctor, with the Pin 40 NPX glowing the dullest cyan possible and a 0.5 Hz pulsing magenta NPX on an external 8x strip.

#

I'm not setup to measure current with my good meter - I'd have to cut and strip wires and such to do so. ;)

tulip sleet
timber mango
#

Nice! That'll go onto the wish list for sure. Thanks!

tulip sleet
fading solstice
#

@solar whale more information is better than less. thanks for caring. my project is to take a word clock that i made using feather m0. i started with CircuitPython but realize i could not do want I wanted with the M0 (not enough memory). I converted to arduino C and got it working. Now that I have the Metro M4, I was wondering if I can rewrite the whole thing in CircuitPython (once again). For testing purposes, i decide to use a DS1307, which I just happened to have in my parts box. The actual word clock uses the PCF8523 RTC. I will temporarily use the level shift in my test breadboard.

timber mango
#

I've just connected one Trinket M0 onto my trusty bench power supply and it says 0.01A for the board when idling. ๐Ÿ™‚ No idea how accurate that reading is tho.

#

I've used that chip with Silabs C8051F330D (which is 3.3v but 5v tolerant on all pins, iirc) without a level shifter.

#

I'm a lot more concerned about when it says 0.15A r9k. ;)
... And I'm back quiet.

#

That reminds me of that one time when I found out that the outer cage of my bench power supply has the same voltage as the output pins by touching Arduino Nano to the cage.
The results were spectacular to say at least. ๐Ÿ˜Ž

onyx hinge
#

sorry if this was already covered, but datasheet says DS1307 logic "1" input is 2.2v min. so you should be able to operate it with a 3.3v mcu as long as the pull-ups are to the 3.3v rail. DS1307's vcc would still be +5V.

#

(the DS1307 breakout from adafruit doesn't seem to facilitate this, unfortunately)

fading solstice
#

@onyx hinge Once the Metro M4 USB is connected to PC, the DS1307 RTC works as expected. It is when i disconnect then reconnect the USB that the Metro M4 acts funny. I found that before I reconnect the USB plug if I remove the SDA/SCL wires, the Metro M4 works as expected.

onyx hinge
#

OK, I see.

timber mango
#

harmless: 1N4148 inline with +5V to the RTC module. May knock it down enough to influence this issue.

#

also check for redundant pullups on the two i2c lines SDA SCL.
2.2 k ohms is correct for i2c pullups. Maybe 2.7 but less than 3.0.
... I'm really back quiet now.

fading solstice
#

@timber mango thanks

humble mural
#

Good morning, can you control a NeoPixelโ€™s brightness other than when the object is created. Arduino allows a strip.setBrightnes() function. Is there a CP equivalent? Thanks in advance

rigid path
#

I am moving from using the Arduino IDE to Circuit Python using Mu. Mu is installed and working fine. Is there a master file/library I need to install or do I need to go on a board by board basis? For what it might be worth, I am using an M0 Adalogger Feather with Ultimate GPS and 128x32 OLED Wings on a tripler board. I also have a 2.4" TFT Wing I will be playing with as my learning boards.

solar whale
#

@rigid path The M0 Adalloger is a "non-Express" board since it does not have an added SPI Flash device. It has a very small File system for storing libraries, so you will have to just load what you need for your application. You can use the SDCard to hold more code and libraries -- see this guide for information https://learn.adafruit.com/micropython-hardware-sd-cards?view=all#code-storage-on-sd-card Also you will likely run into memory allocation problems if you try to us the SDCard and a display and the GPS. Try adding things one at a time to see if/when you run into problems. Good luck and come back here with questions.

Learn how to use a microSD card to store code & data with CircuitPython and MicroPython!

opaque patrol
#

@humble mural You assign directly to the brightness variable instead of using a setter function. For example... pixels = neopixel.NeoPixel(board.NEOPIXEL, 10) pixels.brightness = 0.5

humble mural
#

@opaque patrol thank you, we know that brightness can be defined when the object is created but we would like to change it afterwards. For example โ€œfor i in range (0,10) strip.setBrightness(i)โ€ or strip.write(R,G,B, Brightness) where we can loop brightness.

solar whale
#

@rigid path at a minimum, you will need the adafruit_bus_device and adafruit_sdcard libraries installed on your feather M0 adalogger if you want to access the SD Card. if you wan to access the GPS - you will need adafruit_gps .

opaque patrol
#

@humble mural You can set the brightness variable at any time. The value is a range from 0.0 (off) to 1.0 (full brightness). Your example in CP would look like for i in range(10): strip.brightness = i / 10 strip.fill((R, G, B)) # sets the entire strip strip.show() # Only needed if auto-write is set to false

#

@humble mural I am not aware of any functions that set color and brightness together, but you could write one yourself very easily...

#

@humble mural I should also mention that you want a delay in the loop, this would run so fast you wouldn't see the transitions

rigid path
#

Thanks for the help all, I think I messed up, again. I'm getting an error message about the file or directory being corrupt when I try to transfer the circuitpython Lib files to the M0 Express Feather. Any suggestions?

solar whale
#

@rigid path can you post the error message?

rigid path
#

The M0 is appearing as FEATHERBOOT in my drive list. and has 3 files in it. current.uf2, index.htnl, and info_uf2

solar whale
#

@rigid path That is the bootloader -- try pressing RESET to see if it relaod Ciricuitpython and gives you CIRCUITPY -

#

Of not, yu have somehow lost Circuitpython and need to reflash it to the Feather M0 -- dont cpy a lib folder to FEATHERBOOT!

#

Did you ever see a CIRCUITPY drive?

tough flax
#

Is there a feather that is CP compatible (USB & all) and has WiFi built-in?
I am using the M0 WiFi and really need to migrate to CP from Arduino so that folks can make small modifications easily (WiFi passwords, etc.)

solar whale
#

@tough flax the on;y wifi support in CP is for the ESP8266 but it does not support the USB file system

tough flax
#

Bummer

solar whale
#

someday...

humble mural
#

@opaque patrol thanks Iโ€™ll play with that.

prime flower
#

@tough flax none yet, but possibly providing the folks with easy-to-modify files/instructions would be the way to go in arduino. moving consts to the top, etc. alternatively (I dont have much experience with it) the arduino web editor might be a solution too.

tough flax
#

No, getting the IDE setup & having them install the board files & even finding the COM port's the problem

stuck elbow
#

for the esp8266 you would need at least ampy installed

#

and find the com port

rigid path
#

@solar whale - nope, never saw the circuitpy drive in my list.

solar whale
#

@rigid path did you flash a Circuitpython image to the board? if so, how? what image?

#

How did you get the UF2 Bootloader onto your Feather M0 Adalogger?

slender iron
#

@tough flax its on our radar for after BLE with the nrf52

tough flax
#

Ok

rigid path
#

@solar whale - I got it. I reflashed it and it is working fine. Thanks for the assist.

solar whale
#

whew! glad it is working -- just curios - how did you install the UF2 bootloader on the Adalogger? Did it come with it?

rigid path
#

@solar whale haven't done the adalogger yet, still playing with the M0 Express.

solar whale
#

Ah -- sorry - I misunderstood - I was thinking you were using the adalogger -- that makes a lot more sense to me !

#

so forget all I said about the small file system ! You may still have memory problems when you try to do everything at once, though.

slender iron
#

its needed for the cpy changes

tulip sleet
#

@slender iron sure

rigid path
#

@solar whale Does the M0 Adalogger Feather have a bootloader to load circuit python? Does it run Circuitpython? Do I need an SD card loaded to use it? Sorry for all the questions. ๐Ÿ˜ƒ

wraith tiger
#

Playing with some simple demos to show at my local makerspace. This loops but I only showed one iteration.

timber mango
#

I've carried the discussion to #general-tech about @fading solstice 's i2c clock chip hardware (on the notion the M4 isn't of particular interest to the solution of his issue).

solar whale
rigid path
#

@solar whale Thank you.

solar whale
manic glacierBOT
#

After thinking about the implementation of this for several days and talking with @tannewt, I've decided that board.I2C giving you a singleton busio.I2C(board.SCL, board.SDA) does make good sense. But it's true that it's not what we're used to if we've been using busio.I2C for everything up to now. It's a habit we can change, with some effort. It also means that a lot of the example code in the Guides can be rewritten in a simpler way when 2.x is no longer supported.

I will add some ...

timber mango
#

denouement: consensus is to cut the traces to the pullups on his RTC breakout board in order to use external pullups to 3.3v (they are hardwired on the breakout to 5v). Or obliterate the pullups, if cutting the traces is not the chosen method to remove them.

#

Or, migrate to a 3.3v breakout such as PCF8523.

slender iron
tulip sleet
#

not yet. did you look back and see the brief exchange between @stuck elbow and me?

slender iron
#

I skimmed

tulip sleet
#

6:43am and 6:51am your time. didn't finish the MP_OBJ_PTR discussion, really

slender iron
#

k, I'm gonna let you do the review ๐Ÿ˜ƒ no rush to get it into beta.0

manic glacierBOT
stuck elbow
#

those should really be separate pull requests, but Github decided to put the two commits together

idle owl
#

Silly GitHub.

manic glacierBOT
stuck elbow
#

so I decided to not fight it and leave it that way

#

I can make it separate branches if that would be better, though

idle owl
#

Yay touchio!!

slender iron
#

release notes are written, just waiting to get #866 in

idle owl
#

exciting!

slender iron
#

๐ŸŽ‰ blinka

manic glacierBOT
slender iron
#

thanks for the review @tulip sleet ! tagged locally and doing one final test build while I eat lunch

tulip sleet
#

@slender iron there's still my RTD changes to include in #863. Still waiting for travis on that. I think it should succeed on this build. Finally got my local sphinx build to work properly.

idle owl
#

Oh right, sphinx!

#

@slender iron what is the Sphinx local build command? The one I had from before didn't work, I assume due to directory structure shifts. I managed to get it to build but it made folders in weird places that I had to then delete.

tulip sleet
#

I do

sphinx-build circuitpython ~/docgoeshere
#

this is after

pip3 install --user sphinx
pip3 install --user recommonmark
idle owl
#

I already have the environment installed

#

I was hung up by the actual sphinx-build command

tulip sleet
#

travis has been kinda flaky today. I had to restart at least 4 or 5 subjobs.

#

build finally succeeded

idle owl
#

@tulip sleet Thanks, I was able to build it. I had sphinx-build -Eb html ./html or something like that.

#

Not sure what the -Eb was.

tulip sleet
#

it does html by default

idle owl
#

That command doesn't work, says it can't find conf.py because that's in docs now.

manic glacierBOT
tulip sleet
#

sphinx -E don't use a saved environment, always read all files. That is useful.

#

-b is the type of builder (e.g. html)

idle owl
#

ohhhhh

#

so sphinx -E docs ~/repos/sphinx-docs-build would be good

tulip sleet
#

usually I cd to the circuitpython directory and and do sphinx-build . ~/foo (actually)

idle owl
#

I'm building from libs as well

tulip sleet
#

I don't start in the docs directory I start at the top, which maybe is wrong

idle owl
#

I start in the top level dir as well

tulip sleet
#

sphinx-build <inputdir> <outputdir>

idle owl
#

then it grabs from the docs folder

#

Right

#

Ok

tulip sleet
#

@stuck elbow any thoughts on your MP_OBJ_PTR issue?

manic glacierBOT
tulip sleet
#

@stuck elbow did you just make the pointer volatile while debugging?

#

never mind - just saw latest commit

stuck elbow
#

yeah, I was trying to figure out why there is no change in the value

#

from the ticks

tulip sleet
#

will approve when travis completes

stuck elbow
#

so, the issue is this, in short:
I was doing return MP_OBJ_FROM_PTR(gamepad_singleton); in make_new and then gamepad_obj_t *self = MP_OBJ_TO_PTR(self_in); and accessed/modified self->pressed โ€” that worked in CP 2.x and in CP 3.x in REPL, but not in imported code

#

when I changed to use gamepad_singleton->pressed directly, it started to work

tulip sleet
#

that is odd, i don't understand that. I looked carefully at how gamepad_singleton gets set and reset, and it looks ok to me (e.g. when gamepad_init() is called).

stuck elbow
#

when it didn't work, it would just always return 0 as the value of self->pressed

#

yeah, that's why I suspected volatile

#

since self->pressed is getting set in tick, which is in an interrupt

#

I have volatile on a struct field, but I'm not sure you can actually do that

slender iron
#

@tulip sleet we don't need the docs PR in the tag since docs get updated immediately

tulip sleet
#

@stuck elbow obj.h just has #define MP_OBJ_FROM_PTR(p) ((mp_obj_t)p)

#

@slender iron np

manic glacierBOT
stuck elbow
#

@tulip sleet whether it worked or not depended where the GamePad object was created โ€” in the imported code or in REPL. Even if I made a function that created GamePad in the imported code, but called it from REPL, it would work.

#

but it wouldn't work if the same function was called in the imported code

#

I really don't understand that, but since that change makes it work, I'm happy it works...

#

ah, another factoid

#

if I created GamePad in the imported code, but later re-created it from REPL, it would also work

tulip sleet
#

me neither, it's like it was using the wrong offset for ->pressed, but that code is compiled - shouldn't be affected by REPL or not ?!

stuck elbow
#

even though the singleton isn't getting re-allocated

#

in both cases the pins would get properly initialized as inputs with a pullup

tulip sleet
#

is it declared like the other singletons in various places? did you look at the other fields in the object with gdb or something to see if the object got smashed in some way?

stuck elbow
#

I didn't get out gdb yet, I'm going to do it for the SPI crash bug, though

#

that's the last thing left to make ugame work...

tulip sleet
#

it will be interesting to see what you find out. Anyway, I'll accept this PR since it fixes other issues in the meantime.

stuck elbow
#

I'm afraid I might never find out

tulip sleet
#

there is always a reason. it's not cosmic rays. and the symptom you're seeing might not actually reflect what the real reason is

stuck elbow
#

that's the thing, C is way too magical for me

tulip sleet
#

๐Ÿ˜ƒ

stuck elbow
#

I'm one of those new kids who were raised with garbage collection

tulip sleet
#

i thought you wrote C in your day job

stuck elbow
#

no, Python

#

last time I wrote any C was at the university

#

before I started with microcontrollers, that is

tulip sleet
#

it keeps coming and going for me BCPL, then C, then more C, then Smalltalk, then another obscure OO language, then C++, then Python, then Java, and now back to C

stuck elbow
#

then Rust ;-)

tulip sleet
#

maybe so! it might be a few years but maybe one day CPy will be in Rust

stuck elbow
#

by the way, a friend recently let me know about a cool language that runs on the samd21, has much smaller vm than circuitpython and could be good for education

#

it's called "GP" and it's a block-based language, a descendant from Scratch

tulip sleet
#

will take a look!

stuck elbow
#

he got it to run on ยตGame yesterday

tulip sleet
#

I know John Maloney from way back.

stuck elbow
#

I figured you would know some of those, as this descends from Alan Kay's work

manic glacierBOT
slender iron
#

ESP build fails for me

#

needed to submodule init

stuck elbow
#

phew

slender iron
#

๐Ÿ˜ƒ

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 3\.0\.0\-beta\.0
stuck elbow
#

yay, we have the first beta!

idle owl
#

Yah!!

tulip sleet
#

YAY

idle owl
#

๐ŸŽ‰

manic glacierBOT
stuck elbow
#

do we have the openocd config file for metro_m4_express somewhere?

#

ah, it's not needed with jlink, sorry

slender iron
#

waiting for the binaries to build then will post release notes

stuck elbow
#

ok, it says "0x000278c8 in stage_render.lto_priv ()" โ€” that means it's my library, not spi in general

#

most likely

#

0x00021854 in HardFault_Handler ()

#

or maybe not...

slender iron
#

whats the full backtrace @stuck elbow ?

stuck elbow
#

how do I get it?

slender iron
#

turning off lto can help make it understandable

#

in gdb type backtrace

#

or bt for short

stuck elbow
#
(gdb) backtrace
#0  0x00021854 in HardFault_Handler ()
#1  <signal handler called>
#2  0x0001cdb0 in common_hal_digitalio_digitalinout_get_value ()
#3  0x00021ade in SysTick_Handler ()
#4  <signal handler called>
#5  0x000279c2 in stage_render.lto_priv ()
#6  0x00000080 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
#

gamepad!

slender iron
#

so its something in the tick handling

stuck elbow
#

the gamepad scanning of the pins

slender iron
#

right, so it may be an invalid object leading to invalid memory access or something

rigid path
#

Can anyone suggest an editor that runs on Chrome to edit/load circuit python to run on M0 feathers?

stuck elbow
#

@rigid path something like Atom?

slender iron
#

@rigid path do you mean chromebook?

rigid path
#

sorry, yes, on a chromebook.

slender iron
#

I use beagleterm to connect to the serial port

#

blanking on the text editor name, lemme open my chromebook

tulip sleet
slender iron
#

@rigid path I have Caret

stuck elbow
#

@slender iron is it possible that common_hal_digitalio_digitalinout_get_value is not safe to be called from the systick?

wraith tiger
#

Supposedly an upcoming version of chromeOS will have linux app support.

stuck elbow
#

@wraith tiger isn't it linux anyways?

wraith tiger
#

Under the hood, yes.

#

But you can't run linux apps out of the box.

#

Tjey are adding wayland to chromesOS as I understand it.

idle owl
#

@slender iron Craig was adding the pylint disable rules you suggested into our .pylintrc command, if you didn't catch that. So either I misunderstood your intentions or they did.

tulip sleet
#

@stuck elbow it looks pretty safe - it just does some pretty low level peripheral register operations. I'm thinking your singleton is smashed in some way. do print *gamepad_singleton in gdb

slender iron
#

@stuck elbow I think it'll be ok. my guess is that the object passed in is invalid

rigid path
#

@slender iron , @grizzled oar - Thanks for the advice. I will check it out.

slender iron
#

@idle owl that wasn't my intention but I wasn't super clear either

idle owl
#

@slender iron Ok I can respond to the PR

#

If you like

slender iron
#

yes please

#

I'm trying to ignore email until tomorrow to focus

idle owl
#

No problem, I wanted to check before doing it so we weren't both responding with the same thing

stuck elbow
#
(gdb) print *(gamepad_object_t)gamepad_singleton
No symbol table is loaded.  Use the "file" command.
(gdb) file firmware.elf
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from firmware.elf...(no debugging symbols found)...done.
#

do I need an option to compile with the debug symbols?

tulip sleet
#

yes make BOARD=... DEBUG=1

stuck elbow
#

thanks, sorry for stupid questions

tulip sleet
#

not stupid! gdb is a hard-to-learn skill

stuck elbow
#

Hmm, I just pulled master, and...

freetouch/samd21_ptc_component.h:31:10: fatal error: Arduino.h: No such file or directory
 #include <Arduino.h>
tulip sleet
#

git submodule update

stuck elbow
#

ah, right

tulip sleet
#

git is harder than gdb

stuck elbow
#

I guess I'm fortunate we are not using postfix

tulip sleet
#

hahaha ๐Ÿ˜ƒ

stuck elbow
#
(gdb) print *gamepad_singleton
$1 = {base = {type = 0x354f4 <mp_type_bytes>}, pins = {0xfa, 0x4, 
    0x20001510 <heap+4464>, 0x20001550 <heap+4528>, 0x20001560 <heap+4544>, 
    0x20001570 <heap+4560>, 0x0, 0x0}, last = 0 '\000', pressed = 0 '\000', 
  pulls = 63 '?'}
tulip sleet
#

@stuck elbow are you mixing pin objects and pin numbers by accident somewhere?

stuck elbow
#

not that I can tell

slender iron
#

@stuck elbow all your pin values should be on the heap

#

the first two aren't

stuck elbow
#

yeah

#

looks like a buffer overrun in stage after all

slender iron
#

if its consistent you can use a watchpoint to see when that memory address is changed

stuck elbow
#

the only time I assign to pins is by digitalio_digitalinout_obj_t *pin = MP_OBJ_TO_PTR(pins[i]);

#

and then gamepad_singleton->pins[i] = pin;

slender iron
#

yup, sounds like an overrun

stuck elbow
#

splendid

#

thank you very much for help, I would never find it

slender iron
#

np, happy to get you going with gdb

#

the more the merrier

tulip sleet
#

set a breakpoint right after the singleton creation and see what the values are if you want to see the unsmashed object

solar whale
#

WooHoo - Congratulations on 3.0 Beta!!

stuck elbow
#
(gdb) print *gamepad_singleton
$2 = {base = {type = 0x3cb78 <gamepad_type>}, pins = {0x20001520 <heap+4480>, 
    0x20001530 <heap+4496>, 0x20001540 <heap+4512>, 0x20001550 <heap+4528>, 
    0x20001560 <heap+4544>, 0x20001570 <heap+4560>, 0x0, 0x0}, 
  last = 0 '\000', pressed = 0 '\000', pulls = 63 '?'}
#

ok, so now I will just go through my code with a comb

#

there is really only one place where I write to memory

tulip sleet
#

comparing with smashed version:

$1 = {base = {type = 0x354f4 <mp_type_bytes>}, pins = {0xfa, 0x4, 
    0x20001510 <heap+4464>, 0x20001550 <heap+4528>, 0x20001560 <heap+4544>, 
    0x20001570 <heap+4560>, 0x0, 0x0}, last = 0 '\000', pressed = 0 '\000', 
  pulls = 63 '?'}
#

the type field got smashed too, though it seems to be a "reasonable" type (a bytes object)

stuck elbow
#

yeah, coincidence

tulip sleet
#

at one time you changed it from 8-bit to 16-bit, right?

stuck elbow
#

no, I think I wrote it as 16-bit from the start

tulip sleet
#

ok, it was the dimensions that went from 8 to 16,.

stuck elbow
#

I had one more 16-bit buffer there that I changed to 8

#

the palette

tulip sleet
#

anyway, you can set a watchpoint on some location in the gamepad_singleton. When its value changes, gdb will break, and you can look at the backtrace there to see what's smashing it.

#

as Scott suggested

stuck elbow
#

yeah, reading on it

tulip sleet
#

a watchpoint watches a memory location for a change

stuck elbow
#
Hardware watchpoint 2: gamepad_singleton->pins[0]

Old value = (digitalio_digitalinout_obj_t *) 0x20001520 <heap+4480>
New value = (digitalio_digitalinout_obj_t *) 0x0
0x00020ee6 in memset (s=s@entry=0x20001580 <heap+4576>, c=c@entry=0, 
    n=n@entry=16) at ../../lib/libc/string0.c:88
88            for (size_t i = n >> 2; i > 0; i--) {
#

libc...

#
(gdb) backtrace 
#0  0x00020ee6 in memset (s=s@entry=0x20001580 <heap+4576>, c=c@entry=0, 
    n=n@entry=16) at ../../lib/libc/string0.c:88
#1  0x0000514e in gc_alloc (n_bytes=n_bytes@entry=16, 
    has_finaliser=has_finaliser@entry=false, long_lived=<optimized out>)
    at ../../py/gc.c:555
#2  0x00004a0c in m_malloc (num_bytes=num_bytes@entry=16, 
    long_lived=long_lived@entry=false) at ../../py/malloc.c:78
#3  0x000136a8 in mp_obj_new_str_from_vstr (type=0x354f4 <mp_type_bytes>, 
    vstr=vstr@entry=0x2002f750) at ../../py/objstr.c:2014
#4  0x0002c816 in struct_pack (n_args=3, args=0x200014cc <heap+4396>)
    at ../../shared-bindings/struct/__init__.c:84
#5  0x00010e72 in fun_builtin_var_call (self_in=0x3ce7c <struct_pack_obj>, 
    n_args=3, n_kw=0, args=0x200014cc <heap+4396>) at ../../py/objfun.c:127
#6  0x000186e8 in mp_execute_bytecode (
    code_state=code_state@entry=0x200014b0 <heap+4368>, 
    inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:1014
#7  0x00010eec in fun_bc_call (self_in=0x2001fe70 <heap+129744>, n_args=5, 
    n_kw=100073, args=0x20001478 <heap+4312>) at ../../py/objfun.c:267
#8  0x000186e8 in mp_execute_bytecode (
    code_state=code_state@entry=0x20001460 <heap+4288>, 
    inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:1014
#9  0x00010eec in fun_bc_call (self_in=0x2001f470 <heap+127184>, n_args=1, 
    n_kw=100073, args=0x2002f9a0) at ../../py/objfun.c:267
#10 0x000186e8 in mp_execute_bytecode (code_state=code_state@entry=0x2002f988, 
    inject_exc=<optimized out>, inject_exc@entry=0x0) at ../../py/vm.c:1014
#11 0x00010eec in fun_bc_call (self_in=0x20001050 <heap+3248>, n_args=0, 
    n_kw=53625, args=0x0) at ../../py/objfun.c:267
#12 0x0000d178 in mp_parse_compile_execute (
#

so it overflows when creating a new string for struct_pack

slender iron
#

how is gamepad_singleton allocated?

#

do you reset it when the vm resets?

stuck elbow
#
    if (!gamepad_singleton) {
        gamepad_singleton = m_new_obj(gamepad_obj_t);
        gamepad_singleton->base.type = &gamepad_type;
    }
slender iron
#

what happens when things are reset?

#

because the heap will no longer know its already used after a reload

stuck elbow
#

yes, I call this in reset:

void gamepad_reset(void) {
    gamepad_singleton = NULL;
}
slender iron
#

hrm

stuck elbow
#

also, it worked in 2.x...

#

which of course means nothing, I might have been lucky

tulip sleet
#

i looked through that logic and it looked ok, similar to other singletons

slender iron
#

it needs to be in root pointers

tulip sleet
#

it looks like it might have been gc'd prematurely

slender iron
#

exactly

tulip sleet
#

RIGHT. the other things are statically allocated and not subject to gc

slender iron
stuck elbow
#

how do I add it to the root pointers?

slender iron
#

then its MP_STATE_VM(gamepad_singleton) = NULL etc

#

lol, didn't realize pirkey was launching today

tulip sleet
#

"one more thing"

slender iron
#

๐Ÿ˜„

tulip sleet
#

@stuck elbow we don't have many single objects we allocate dynamically. Some are just single instances fixed in RAM because they're not that big. Yours is 39 bytes, so good to allocate dynamically, but not too many examples of doing that.

stuck elbow
#

that also explains why it worked from REPL

#

_ kept a pointer to it

tulip sleet
#

not sure of that, but maybe gc wasn't invoked during the repl session, or the luck of the draw in terms of reuse

stuck elbow
#

but shouldn't it still be kept in memory when there is a python variable pointing to it?

tulip sleet
#

oh, the init returns the singleton?

stuck elbow
#

yes

tulip sleet
#

ok, yes, then, I see

stuck elbow
#

return MP_OBJ_FROM_PTR(gamepad_singleton);

tulip sleet
#

didn't your code in a file also assign it to a variable?

stuck elbow
#

yes

#

global one

#

module-level, that is

slender iron
#

theres a small chance it'll get gced between creation and storage

#

the global dictionary may trigger an alloc and the alloc can trigger a collect

stuck elbow
#

I think I copied that code from the framebuf module

slender iron
#

it could be the long lived stuff

#

it'll update the dictionary entry but not the internal pointer if it decides to move it

stuck elbow
#

and that would also explain the REPL discrepancy, I suppose

#

when does it move it?

#

at gc time?

slender iron
#

is it in an import?

#

at the end of an import it'll recurse through the names and move the objects

stuck elbow
#

yeah, it is

slender iron
#

yup, that would do it

stuck elbow
#

ok, that gives me an idea on how to avoid it -- put it as a class attribute

#

also, explains why I was getting all 0s โ€” there was a copy of it

slender iron
#

yup, sorry for breaking it

stuck elbow
#

well, it really improves memory fragmentation

#

I'm just thinking about how to work around it

slender iron
#

could add a root pointer check to the move code so they get updated too

stuck elbow
#

I suppose not returning the singleton from the make_new would solve it?

#

I mean, have the python object separate from the singleton

slender iron
#

it'll move any memory on the heap

stuck elbow
#

can I allocate it on the C heap?

slender iron
#

there isn't one

#

atleast that we use

#

everything in C is static

stuck elbow
#

I could make the gamepad singleton static, but move the pins to a python tuple allocated when it's initialized

#

would it get updated properly when it's moved then?

#

I guess not

slender iron
#

it won't recurse into memory off the heap

stuck elbow
#

I need to sleep on it

#

by the way, framebuffer would have the same problems

slender iron
#

good to know

stuck elbow
#

hmm, no, it wouldn't

#

sorry

#

because there is no pointer in C for it

slender iron
#

right, that was my assumption at the start

stuck elbow
#

that singleton pointer I need in the systick breaks everything

#

sorry, not thinking clearly

#

I will get back to it tomorrow

#

thanks a lot for help with this

slender iron
#

np, we'll sort it out

#

sleep well

ruby atlas
#

Ooh beta0!

slender iron
#

๐Ÿ˜„

ruby atlas
#

man i have a lot of chat to catch up on.

slender iron
#

we move fast here ๐Ÿ˜ƒ

manic glacierBOT
#

This is due to the gamepad object being moved to the end of the heap after import finishes, but the internal pointer, used by the systick function, not being updated. Sooner or later something gets allocated there and gives crazy pin numbers to the systick function.
One workaround is to make the gamepad object a class attribute, not a global, but we need a more general solution.

idle owl
#

Move fast and break things โ„ข

raven canopy
#

I was the last to quote it I think, so i refrained. ๐Ÿ˜„

stuck elbow
#

@slender iron just thought about something -- can I allocate that GamePad object as a long-lived object from the beginning? So that it's not moved?

slender iron
#

yeah, that would work. you should add it to root pointers so it sticks around even when deleted from the global dictionaries

ruby atlas
#

Hey, is it possible to have compiled code in a loadable module?

slender iron
#

nope. damien has been wanting to add it though

ruby atlas
#

that would help us so much with image sizes.

#

also let people distribute their own (fast) addons ๐Ÿ˜ƒ

#

@slender iron speaking of space, one of the things I started to do but abandoned because of the complexity of getting it right was not defining or referencing pin_XXX globals - which would lead to code not referencing pins during builds that aren't present on hardware. not sure if i'm explaining myself well.

slender iron
#

microcontroller tries to refer to them all anyway

#

ah, you mean do it automatically?

ruby atlas
#

I think it would be a lot more work to not define PIN_PB28 constants when the pins aren't present, hence the IGNORE approach... But both not defining pin_PA10 and PIN_PA10 on hardware without the pins could lead to more correct code - rather than the IGNORE_PIN_PA10 approach.

slender iron
#

right

reef seal
#

But I'm not sure how to run the unit test when it's not in the same folder. I had been using the command python -m unittest discover -p *_test.py

slender iron
#

I don't know either

reef seal
#
$ python -m unittest discover test/nonblocking_timer_test.py
Traceback (most recent call last):
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/__main__.py", line 18, in <module>
    main(module=None)
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/main.py", line 118, in parseArgs
    self._do_discovery(argv[2:])
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/main.py", line 229, in _do_discovery
    self.test = loader.discover(self.start, self.pattern, self.top)
  File "/Users/michaelschneider/.pyenv/versions/3.6.5/lib/python3.6/unittest/loader.py", line 338, in discover
    raise ImportError('Start directory is not importable: %r' % start_dir)
ImportError: Start directory is not importable: 'test/nonblocking_timer_test.py'
slender iron
#

hrm, maybe test is a reserved word? try renaming it

reef seal
#

Hmm nope same

hearty stratus
#

Heya

#

just got a trinket M0 today for a tiny project (love my itsy)

#

but the storage seems to be too small to load on the adafruit_ssd1306

#

and bus_device, register modules

slender iron
#

@reef seal sorry, I'm out of ideas

#

@hearty stratus did you remove the windows 7 driver?

hearty stratus
#

yeah

#

actually everything

reef seal
#

@slender iron OK when I made a package now it seems to be happy

#

I think I've followed everything that was in the guide to creating a community library/package

slender iron
#

@hearty stratus are you using mpy files?

hearty stratus
#

yeah

slender iron
#

hrm, I'm out of ideas then

hearty stratus
#

i think macOS is copying over the ._ files

#

removing those

#

man, was really hoping to have OLED and BMP280 libs on here but that doesn't seem possible

#

okay.. got it down to 20k remaining with the OLED libs

#

at least that's something

manic glacierBOT
reef seal
#

@hearty stratus I recommend rsync to copy files instead of cp:

rsync --recursive --verbose --update CIRCUITPY/*.mpy    /Volumes/CIRCUITPY/
rsync --recursive --verbose --update CIRCUITPY/lib/     /Volumes/CIRCUITPY/lib
ruby atlas
#

I know I can go look myself, but do we have anything in CircuitPython doing DMA to SPI?
(Not sure there's enough free RAM to even think about doing that on M0 for Neopixels or Dotstars)

reef seal
#

@slender iron what's next for getting nonblocking timer into a community package? Do I make a pull request?

raven canopy
#

@reef seal can't remember. is the timer setup as a library/module, or part of the circuitpython core?

rigid path
#

Need a little advice lease. I am using an M0 Express Feather to drive an Ultimate GPS and OLED featherwing. They all are plugged into a tripler board. I can make the demo scripts run on their own, but I can't figure out how to combine the two and push the gps output I usually get in the REPL to the OLED. Any hints?

raven canopy
#

@rigid path it's usually just a matter of transposing each particular section from one of the scripts into the other one. to use Arduino as an example, the programs on that platform are laid out in this fashion:

Step 1: include header files needed
Step 2: initialize global objects and settings
Step 3: initial setup (void setup {})
Step 4: loop the program (void loop{})

Most CircuitPython programs follow the same suit. So, pick the shorter of the two demo scripts, and start transferring the chunks to their respective places in the other demo script.

reef seal
#

@raven canopy Its going to be a library

raven canopy
#

k. give me a sec.

rigid path
#

@raven canopy Thamnks for the advice. I will keep playing.

raven canopy
#

@rigid path yw. if you need some "finer point" assistance, let us know. I was trying to start at the big "theory" level first. ๐Ÿ˜„

slender iron
#

@ruby atlas busio.SPI uses DMA under the hood

reef seal
#

@raven canopy yes that's what I was working from. I think it's pretty much done afaik.

raven canopy
#

ahh. ok. sorry to retrace steps... ๐Ÿ˜„

ruby atlas
#

@slender iron awesome, though I'm not going to go near DMA-to-neopixels./dotstars quite yet.

solar whale
#

Sheesh. Reading this evenings chat makes me realize how much I have yet to learn about how Circutpython works โ€œunder the hoodโ€ .

#

Also seems like a great time to be out of it for a week to let it โ€œsettleโ€ ๐Ÿ˜‰

spare storm
#

So, RF1 = DigitalInOut(ss, 11) should work like ss.pin_mode(RF1, ss.INPUT) to initialize a seesaw input named RF1, right?

#

Yet, RF1 = DigitalInOut(ss, 11) gets a positional argument error because it only expects (11), not (ss, 11). How do I tell it that pin 11 is over seesaw?

rigid path
#

Is there a circuitpython library for the 2.4" tft featherwing?

raven canopy
rigid path
#

@raven canopy Thank you

raven canopy
#

@spare storm DigitalInOut uses its own object type. I don't know of any "passthrough" ability, to utilize second-order objects.

spare storm
#

So, ss.pin_mode it is then?

raven canopy
#

With my knowledge, yep. I haven't had any SeeSaw experience yet...someday.

spare storm
#

Ok, I'll try that approach out then. Thanks @raven canopy!

raven canopy
#

@spare storm hold on a second. perusing the seesaw repo, i see that it has it's own digitalio implementation...

#

@spare storm when you tried before, did you use import digitalio or import adafruit_seesaw.digitalio?

spare storm
#

I used import digitalio

#

I'll try the other one.

raven canopy
#

we should write up an example for using that...

#

oh man, which reminds me. i need to put up an issue on the bundle, that i forgot about last night...

spare storm
#

REPL tells me DigitalInOut is not defined

raven canopy
#

I think it's just DigitalIO with that library.

spare storm
#

Can't import name Direction

raven canopy
#

ok. issue filed. @spare storm let me write up what I think will work with that library...

spare storm
#

Cool, I'll try making it work with the other approach until that's in. Thanks!

raven canopy
#

oh sorry. concurrent thoughts. issue was unrelated...

spare storm
#

Oh, not a problem at all!

raven canopy
#

@spare storm

# omitting i2c, etc
import adafruit_seesaw.seesaw
import adafruit_seesaw.digitalio

ss = adafruit_seesaw.Seesaw(i2c)
dio = adafruit_seesaw.DigitalIO(ss, 11) # defaults to INPUT, no PULL

# set the pin to output, push_pull; args are default and optional
dio.switch_to_output(value=False, drive_mode=digitalio.DriveMode.PUSH_PULL)

# set it back to input, pull up
dio.switch_to_input(pull=digitalio.Pull.UP)
#

direction, drive_mode, pull and value are also available standalone.

spare storm
#

so, if I have multiple input pins, I'll need to have dio0 = adafrui.... dio1= etc...

raven canopy
#

yep.

spare storm
#

Cool, I'll give it a shot. Thanks a bunch!

raven canopy
#

you're welcome. and thank you for giving me a reason to read up on it. ๐Ÿ˜„

spare storm
#

'module' object has no attribute 'DigitalIO' for line RF0 = adafruit_seesaw.DigitalIO(ss, 11)

raven canopy
#

hmm. when did you last update the bundle. DigitalIO is only like 16 days old. ๐Ÿ˜„ (should've mentioned that earler)

spare storm
#

Adafruit CircuitPython 3.0.0-alpha.6-91-g54293397c-dirty on 2018-05-15

#

5/18 is when I grabbed it.

raven canopy
#

or...are you using a CPX & Crikit?

spare storm
#

Yes, I have the 20180518 bundle. Yes, I'm using a CPX+Crickit

raven canopy
#

ok. then yeah, make sure you're on the latest firmware release. seesaw is frozen, and i think there was a hiccup with updating the frozen modules.

spare storm
#

Ok, I'll try 3.0.0 and go from there. Thanks!

raven canopy
#

k. i'm going into some "relaxation time" and then off to bed.

spare storm
#

Have a good one, and thanks again!

hearty stratus
#

im a bit confused. I have an OLED wired up to the Trinket M0 (which doesn't have text rendering libs)

#

the only ones i can find are MicroPython

#

using this guide

#

is there a guide for text rendering with CircuitPython with a non-express board likeTrinket M0?

stuck elbow
#

it should work the same

#

it works on anything that has a "pixel" method

hearty stratus
#

it gave me an OSError

#

i'll definitely use your font tho. smaller the better!

stuck elbow
#

can you paste the full error you got?

solar whale
#

@slender iron @tulip sleet FYI built/executed 3.0.0 beta (+ whatever is in current master this morning) on several boards - metro_m4_express,metro_m0_express,,trinket_m0,gemma_m0,feather_m0_supersized,esp8266,feather52,CPX -- no issues encountered running my usual test programs.

solar whale
#

@tidal kiln @raven canopy just for fun, I ran an I2C test with an mcp9808 temperature sensor on a feathere M0 express with busio and bitbangio -- according to my Salea Logic Analyzer the busio clock rate was ~350KHz while the bitbang rate was ~56KHz ! Both wer run with deafult settings for the I2C bus.

#

@stuck elbow does the very slow rate for bitbangio make sense to you?

stuck elbow
#

well, it is bit-banged

#

it's expected that it is slow when it's done in software

solar whale
#

so its just code execution time

stuck elbow
#

that's large part of it

#

also, I suspect nobody cares for exact timings

solar whale
#

ok and esp8266 run faster tahtn a feather m0 because the code runs faster. we see about twice the rate on ep8266

#

also is it true that the master can use any clock rate and even vary the clock rate and the slaves should not care?

stuck elbow
#

yes

#

that applies to all protocols with a clock line, like I2C and SPI

#

it's a big advantage over UART or 1wire

#

or neopixels

solar whale
#

OK - so I guess nothing unexpected is going on. Still puzzling why some sensors work great (mcp9808) but others are not happy with bitbang (apds9960, bno055)

stuck elbow
#

yeah, I have no more ideas

solar whale
#

No problem - you've provided your fair share ๐Ÿ˜‰ Thanks for clarifying a few misconceptions I had.

#

@tidal kiln @raven canopy given these tests and @stuck elbow comments, I think we should follow up on some of the specifiic timing issues for specific sensors that @raven canopy raised a few days ago. Perhaps it is that some sensors are placing constraints on the timing that bitbang just isn't or can't meet. I'll be happy to pursue this further in a week or so when I get back. For now, I think bitbangio is working for "well behaved" sensors. Keep me posted if you uncover any new information.

manic glacierBOT
#

The first batch of Metro M4's didn't have protected bootloaders. A number of people had their bootloaders damaged by some stray writes. We protected against this in the next batch by turning on BOOTPROT. But it would be good to know what bad code was writing to the bootloader block.

Here is a damaged bootloader, courtesy @jerryneedell:

UF2 Bootloader v2.0.0-adafruit.4 SFHWRO
Model: Metro M4 Express
Board-ID: SAMD51J19A-Metro-v0

[m4flash.bin.zip](https://github.com/adafruit/c...

timber mango
manic glacierBOT
manic glacierBOT
manic glacierBOT
ruby atlas
#

the pirkey is a nifty device. looks like the IGNORE_* foo helped?

manic glacierBOT
tidal kiln
#

@solar whale agree. i just tested the bno055 with a M0 but using bitbangio instead of busio. it fails the same way as the esp8266 does. i'll add this trace to the issue in the repo for ref.

tidal kiln
#

@solar whale can't remember in all this testing - have we successfully tested a sensor that does do clock stretching with bitbangio? something other than the BNO055 obviously.

solar whale
#

@tidal kiln Iโ€™m not really sure. I canโ€™t claim to have captured a clear case of it.

rigid path
#

Looking for some sample circuitpython code for the OLED featherwing. I would like to be able to clear the display and be able to change text displayed with a push of the 3 buttons. I good tutorial would be bery helpgul. Any suggestions?

manic glacierBOT
#

I've managed to get a backtrace for this. Its fixed by #849 and #848. Please use 3.0.0-beta.0.

(gdb) bt
#0  0x00020702 in HardFault_Handler () at asf/sam0/utils/cmsis/samd21/source/gcc/startup_samd21.c:285
#1  <signal handler called>
#2  0x00021910 in validate.lto_priv.645 (obj=obj@entry=0x20007dac, fs=fs@entry=0x20007d18) at ../lib/oofatfs/ff.c:3075
#3  0x000224b4 in f_write (fp=0x20007dac, buff=buff@entry=0x20007dac, btw=btw@entry=1, bw=bw@entry=0x20007d58) at ../lib/oofatfs/ff....
manic glacierBOT
manic glacierBOT
tidal kiln
manic glacierBOT
#

I worked on this, trying a couple of different ways. It was a maze of #ifdef's because I have to remove a bunch of static routines in shared-bindings/{I2C.c,UART.c}: otherwise I get "defined but not used" errors. And, ultimately, you can't even call the stub constructors (which would raise NotImplementedError) anyway, because there are no reasonable pins available to use. So I'm kind of inclined to leave it the way it was.

rigid path
#

@tidal kiln This will work, thanks.

tidal kiln
#

np. if you run into any issues, just let us know

slender iron
#

@tulip sleet when you get a chance can we voice chat in the circuitpython channel about dynamic heap allocation?

rigid path
#

Just want to double check this and save a number of questions down the line... I am setting up a pair of M0 Feather packet radios. I need to use Bossa to load cp to them? correct? Also, will cp run on the 32u4 chipset?

slender iron
#

yes, the radio feathers have the old bootloader that needs bossa. and no, it will not run on 32u4

tulip sleet
#

@slender iron i'm on

idle owl
#

@tulip sleet @slender iron Care if I listen in?

tulip sleet
#

please do

idle owl
#

@rigid path No it doesn't run on 32u4.

#

Oh I see that was already answered.

rigid path
#

@slender iron thenk you. Do I use the m0_rfm69-2.3.1.bin or m0_rfm9x-2.3.1.bin file?

idle owl
#

@rigid path Which board are you using?

#

Specifically. I think it includes the necessary version in the name if you look at exactly what you ordered.

rigid path
#

@idle owl - M0 Feasther packet radio and an m0 feather adalogger.

idle owl
#

I think you need to use RFM69 then. This is based on really basic searching though. I googled "M0 Feather packet radio" and every result has RFM69 in it.

#

Do you have the part ID from your order?

#

We could be certain if we had that.

stuck elbow
#

if the rfm69 is a separate wing, then you flash the firmware for you base board