#circuitpython-dev
1 messages Β· Page 120 of 1
and you can double reset into bootloader on that one?
mhmmm
yeah, sorry then, i'd guess something's up with the wiring on the green perf board
the bootloader is protected, it's pretty hard to accidentally mess it up with just code
or something was shorted for a moment and one of the shottky leds burned
@tidal kiln I think it wasn't protected in some early ones
shottky diodes
huh.... i think one of the traces on the bottom is messed up
@stuck elbow early m0's?
early uf2 bootloaders
now the update_bootloader.uf2 sets the protect bit back, but it didn't
oops
ok, that's probably it, you must had a short of some kind, and something burned and now it's shorting the whole thing
RIP
dang
I wonder why the green led shines
i'm not following. what's the last photo?
a desoldered trinket m0 with a burned trace
if i connect the usb pin to either the 3v or bat pin the green light comes on. if i connect the usb to 3v pin though the dotstar comes on as well as a solid white but it is not recognised by the computer. plus plugging into either 3v or bat pins makes it get really hot really fast
@tidal kiln yes, that was the one on the perf board
"if i connect the usb pin to either the 3v or bat pin the green light comes on"
what do you mean by usb pin ?
One of the pins on the trinket is a usb pin, its the voltage directly coming from the usb
huh. so i used the voltmeter to check the voltage
usb pin (usb voltage) to gnd- 4.9 volts
bat pin to gnd - 0 volts (because its not being powered an alternate power source)
3v pin to gnd - 0 volts
diode on usb π¦ @stuck elbow called it
or the trace
I checked the backup trinket m0 and there is voltage on the bat pin/gnd.
let me look at the schematic
The trace on the bat pin also looks messed up too
no way that green led could be shining with any part of the power broken
huh
why not?
because it's on the 3.3V side of the LDO
so pretty much same place as the MCU
if it got power, mcu got power too
"if i connect the usb pin to either the 3v or bat pin the green light comes on"
@charred blaze connect usb to bat and measure voltage on 3v
oh, right, so either D2 or the trace to it
yep
applying usb to 3v basically direct injected 5v to the other side of the LDO
lit the LED and probably blue smoked the mcu
so the voltage reg works
yup
I have a whole strip of those MBR120 shottky diodes
nice
i think its the trace. theres actually 2 of them that are messed up
the pinouts page says i can apply 3-6v to the bat pin: https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino/pinouts
it's when you applied usb to 3v
yeah, that's before the regulator
ah
see schematic. usb and bat are before votlage reg. 3v is after.
and 3v goes straight to the mcu
don't worry, we all started at some point
hopefully you won't burn more expensive things π
no worries. good #sparky story. π
i mean, ive been playing with some of these things for a year now. but I slowly learn some of it as I go.
I love how the schematics are available for almost everything, it helps you debugging a lot
Hahaha i burned up a Flora a year ago. couldnt figure out what the heck happened other than i went to plug it in and a part of it got red hot (literally) and puffed blue smoke at me
and also, I can prototype with modules, and when it's ready, move it all on my own pcb by copying those schematics
by the way, spent whole day adding text layer support to this:
So basically make sure the 3v pin isnt connected to the usb pin or the bat pin
make sure the usb/bat pin is not connected to any other pin
ok. can those 2 be connected at all?
because all other pins are 3.3V and, usb is 5V and bat can be anyting
you can connect it to things that have a separate pin for power, such as hobby servos or motor drivers
or neopixels, I think
ok
I made sure to double check all of my connections on my perfboard on last time before soldering the new trinket in place
if you have a mac, make sure to not place the board on the metal case
I've seen people do that
Nope, im a windows guy :3
I think some surfaces are metal too
ALL THE IO!!!!!!!!!!
yep all io are used!
Sweet!
kinda a replacement for pro trinket
ooooohhhhhhhh
step up from trinket, but not as chunky as a feather
Good place to be.
I love it
Awesome!!
not exactly circuit python related i guess i cant use FastLED on my trinket m0 programmed with arduino (for now). something about the FastLED code isnt like by the compiler
huh. yeah i just recently updated.
its giving me something about an "invalid pin specified"
Ohhhhhhh I got it now @meager fog . I had the version of fastLED from their git. I didnt have the version of it you guys modified
oops was in another window
yah we did submit a PR
so it should have been merged to theirs :/
I found a quirk with CPX. I have one I purchased in at the end of June, and a friend has one she got in the end of September. I'm teaching her with MakeCode and they don't communicate consistently via IR. We thought it was the code, but I have a second one I got in the middle of September, and they communicates perfectly. I don't know if there's anything to be done about it, but it seems like something worth noting somewhere in the event that anyone is using two boards purchased that far apart.
@meager fog ahhhh. well it hasnt yet. but hey! i got it working for now!! now i gotta get a second trinket m0 so i can work on circuit python for it. Since I had a sparky moment with it.
yay nice
@idle owl the only difference is the xmitter LED may have changed. the receiver
is the same for sure
the makecode IR stuff isnt super tested :/
I noticed the hardware looked a little different
IR is not great for communication. that's why remotes 'spam' the transmission
Right
we do test IR rx/tx in manufacture. so it works, just maybe not as noise-free
hmm. Yeah it worked once or twice, which is what made me think it was a code issue. It was a last minute idea to try the newer board.
(we only use it for like, IR remotes n stuff, which are very simple)
So sending color suggestions is getting more complicated
I wanted to include simple IR communication in the CPX API eventually. Might not be so simple. π
yah
i do too! π its just a very gruesome protocol. BTLE is nice because it manages retransmissions for ya
also people have a lot of lighting that gets in the way
flickery dimmed LEDs and flourescents
I try to think in terms of using it for teaching, and what would be super awesome to learn as a beginner. And if you're paired with someone, being able to send a simple string to your partner's board seemed like it fit the bill of awesome.
Yeah! I had to tell Carter what stray light looked like in the remoteIR code you had us test. He thought at first it wasn't working right.
hmm i think your best bet is to try and transmit like a maybe 4 bytes max per messgea?
and put in CRC
and just spam the tx
@meager fog you know about https://1bitsquared.com/collections/embedded-hardware/products/1bitsy ?
This is the 1Bitsy STM32F415RGT6 breadboard friendly, JTAG/SWD enabled development board. Β Now in stock! Β Features: STM32F415RGT6 192kB RAM 1MB Flash I2C, UA(S)ART, SDIO, Timers, ADC, DAC, SPI, I2S, USB FS, USB HS Hardware accelerated AES encryption User controllable LED User controllable Button Fits on a bread board for easy prototyping Exposed JTAG and SWD debugging/programming interfaces Β If you don't have a Black Magic Probe V2.1 JTAG/SWD programmer and debugger. We recommend getting one, it's a great complementary tool. Black Magic Probe V2.1Β makes debugging and insight into the software you will be developing for your 1Bitsy very easy
And you could maybe put a line in the code that once they have a first contact then it kinda sinks them up. if you are automating it that is
that way you arent always open to new signals, only when you need to be
@meager fog The other idea was to bake it in to only send a specific message, like MakeCode sending a signal to change the NeoPixels. I don't know how many bytes it actually is to control the NeoPixels though. I know they're 3-4 per LED, but I imagine it's more complicated than that in actually sending the code to change them.
I don't know much about coding for IR though. So I'll be learning that as I go with this one.
Thats how my past year has been since picking up arduinos/hobby electronics in general
@idle owl instead of trying to have full control of neopixels over ir, could make it where the 4 bytes (or similar small packet) just indicates a desired mode
@charred blaze Nice! My first Adafruit order was at the end of June. I knew about them before that but hadn't ever ordered for myself. Mostly ordered Raspberry Pi related stuff, and the Circuit Playground Express.
I agree with @tidal kiln do kinda like code words sorta thing.
@tidal kiln So you write code for both of them, waiting to hear mode info, and waiting to execute mode.
I like it
so like, Sender could send something simple like "blue" and they would all change to blue. or you could even do it in RGB where 120255030 would translate to setting the color to R-120 G-255 B-030 on the Receiver
@stuck elbow yep! we'll carry the 1bitsy swd as soon as they are available
I just thought the name and the shape are very similar, are you not afraid of them being confused?
@idle owl main idea is to just reduce the amount of info you need to tx (full control might required too much)
@tidal kiln Right. And agreed.
nope - all hardware is similarly shaped π
trinket and cpx are kinda special π
Dang, if i hadnt messed up my other trinket m0 i could've used it to make some leds for my Mavic Pro and controlled them with circuit python
@charred blaze what happened to it?
(scroll up)
lol Cater.
3.3V connected to 5V basically
@charred blaze thought you said you had a backup?
I do! but one was going to be for personal learning and the other for a simple project for a buddy.
lol woops - did it go poof?
no it didnt! it just stopped working. And Cater and Deshipu deduced that was what happened. Though when i desoldered it and went to pop it off 2 of the traces got pulled off because apparently the solder pads on the bottom werent fully desoldered.
ahh it happens!
oh well! wonder if fastLED would be ok on a regular trinket. Im not doing anything too fancy.
maybe not. i need 4 pins total so one of those would have to share with pin 3/4 as either output to the leds or as input for a button
I replicated the code that ships with the Circuit Playground Express in Circuit Python.
nice!
People keep asking for the demo it ships with. It ships with MakeCode. But it seems like posting this somewhere might be a good idea. Need to find out where though.
@idle owl the cpx guide, cp section
@tidal kiln lol I was just typing something close to that.
Your idea is better. I was about to say write up a quick guide on it.
I finished the post on my Trinket/CircuitPython humidity monitor: https://daveastels.com/2017/11/04/humidity-monitor/
@umbral dagger Nice!
@idle owl Thanks. For the next batch Iβll try it without trimming the edges... maybe I can just have solder wick through the holes. Itβd be a lot faster to do the build and Iβm contemplating trying to sell them ... next summer (here in Canada).
Maybe using a toggle clamp to hold the Trinket/breakout firmly in place while soldering.
Yes, it perfect for this. Makes the code simple AND makes, the whole thing very low power.
Yeah something would be needed. Trying to get it to wick through without it moving would be a challenge.
Yeah, a clamp would give me two hands to work with. I could go with a fully custom board, but There would still be through-hole components.
It was a fun project to go from need to final solution.
As mentioned, I need a 3D printer now to really complete it.
Yeah!
We have a humidity sensor setup in the basement, with four zones. We're tracking the data remotely though, so they're running off of Pi0W's.
I think it is the same humidity sensor you used.
Neat project idea. I should make something like that to scream and shout if my mandolin case is too dry.
@meager grove The whole thing could be packaged in a well ventallated shell.
@meager grove You'd also need to be able to hear it, so something based on e.g. esp8266 that can post to IFTTT or such might be a better approach.
The one thing It's missing is a low battery indication. I have to give that some thought (or just recharge them regularly.
@umbral dagger Diode of voltage reducig to 3.3 tops. Run that to analog in. You'll be able to detect when the battery is just about deadn but it's only one component
Or the ever-useful voltage divider to read full battery status
@cunning crypt I just need a "recharge now!" alarm.
was testing a feather m0 basic on adafruit-circuitpython-feather_m0_basic-20171104-5ff6417 and bumped into this odd issue while testing pin toggling.
on some pins, reading the value does not return the right value?
e.g this code does not toggle:
led = digitalio.DigitalInOut(board.MOSI)
led.direction = digitalio.Direction.OUTPUT
while True:
led.value = not led.value
time.sleep(0.1)
but this works:
led = digitalio.DigitalInOut(board.MOSI)
led.direction...
Beginning to test the next generation of the autonomous string car racer using the Trinket M0 and CircuitPython. Initial tests are working perfectly! The plan is to make it pin compatible with the existing controller board. Using CP simplified the code significantly -- and no more IDE! The previous gen car (Trinket 5v-based) is shown on the right.
@errant grail That's great!
@umbral dagger wow thats great!
you too @errant grail
(i am taking a little break from routing boards π
... Thanks @idle owl. I have 6 of these "in the field." Upgrading to CP simplifies support tremendously!
@errant grail For sure!
yay thats the point of circuitpyhon so im glad π
funny story circuitpython is borne from about 10 yrs ago
i used to go to burningman and do projects there and haul my pickit around
I'm a happy camper. Was itching to do this ever since watching you working on the prototype, @meager fog .
and thought "omg i cannot deal with how hard it is to tweak firmware in the field. this sux. i hope i come up with something better in 10 years" π
@meager fog The original physical prototype (hand wired on prototyping board) and one PCB based unit are βdeployedβ and running nicely.
@meager fog Nailed it.
Yeah, this will help with the makerspace classes, too.
@idle owl : here's a discussion of the autonomous version in the learning guide I wrote.
Oh! I've seen this guide before! I recognise the photo. Thanks for the link!
@umbral dagger s'ok for us to blog your project?
@meager fog Looking at it one way a SAMD21 is way overkill for this. Previously I would have used an Arduino ProMini. But for not significantly more $ I can work in Python instead of C, and dropping files onto the usb drive instead of AVRdude. I really need to write a post about the qualitative difference working in CP provides.
@meager fog Of course. Feel free. Any feedback on improving it would always be gratefully received.
yah its definitely a "distruptive" tech - its not more powerful, its much less complex which is not usually what engineers go for. we like to compare it to how people-who-normally-would-have-run-a-nfs-server experience dropbox
its like "oh dropbox just...works. its not as complex but...thats ok!"
@errant grail That's so cool! Makes a lot of sense.
you saw i designed a trinket m0 express for u right? π
@meager fog haha
Oh, hey, hi @meager fog ! I was off configuring my OctoCam kit and didn't see you come in. π
@meager fog Yes! The express version will be great for the more advanced models.
hihi! im taking a short break from routing a few complex older designs
@meager fog I think I mentioned that I was uninterested in Python until I discovered CP.The language is good, but itβs the CP/MP experience thatβs the real win.
yah yah - i think m4 will be a huge upgrade. the m0 is underpowered, but its all we had
i think at the m4 python level its usable for 'real projects'
Yes, but the M0 was a huge leap forward over the 32u4...
true, but as a py board it feels like a step back, like an attiny. m4 will make it 'feel' more like a > m328 board
Good point
I like the move M0->M4, leapfrogging the M3 core. Hardware floating point will be a significant upgrade.
M3 is older than M0, ironically π
The M4 will be perfect for upgrading a couple of data analysis and music synth projects.
M3 came first but is now quite old, which is why you dont see new M3 chips
Yup. We did some cool things with M3 based chips at SteelSeries.
STM and Freescale mainly.
It was at a fairly good price/performance point... especially as it starting getting older.
I think the M4 will be an excellent platform. With the M0 I couldn't get my robotics to work since there wasn't enough memory left over after loading the packages I needed....
you can try mp3 decoding right now on the M4 in arduino https://github.com/adafruit/Adafruit_MP3
ironically, its fixed point. but does use the DSP commands in the M4
nice -- that opens up some multitrack possibilities for feeding the synth from my DAW.
yah at some point we will look at porting the PJRC audio lib to the samd51
it will be 'fun' and 'enjoyable'
<sarcasem></sarcasm>? π
Of course not. π
(it will not be fun and enjoyable)
(it is a lot of very low level stuff to make it fast)
I can think of a few of the CircuitPython core team who would probably like the very low level programming.
okay, thanks @meager fog ! I'm going afk for a bit to redesign a couple of projects. π
See ya!
Ya... that audio lib does actually sound fun & enjoyable π
Truly a sound idea
I've been playing around with the IR stuff for Circuit Python and got it working to control an Apple TV tonight. Did a quick stream if anyone is interested. Big thanks to everyone working on Circuit Python, I really love working with it π https://www.youtube.com/watch?v=mm82UZDHuSU
Demoing what I've done so far with the Apple TV IR Remote project and hopefully some pairing of the remote with an Apple TV.
Ok, humidity monitor distraction done for now. Time to get back to M4/CP3. First step is to catch up on the state of SPI/I2C support. I want to hook an AMG8833 and the 8x8 dotstar board to it and do some neural net stuff.
@candid sun That's fantastic!
@idle owl thank you!
I should get one of those 8x8 dotstar boards and a trinket M0 and make a Conway's Game of Life miniature desk widget
I could have it do both random starts and stable and metastable starts
@glacial bronze get a led matrix backpack
The CP/MP simple debugger is making some progress... mostly in terms of my understanding of the VM. Code to follow.
I'll be happy to submit a PR to enable frambuf - Should I submit PRs both the 2.x and 3.0 branches?
@jerryneedell Since it's already turned on in the atmel-samd express builds, sounds fine, assuming it fits. Do you have a way to test it for esp8266?
yes - I will test it with an ssd1306 on an esp8266 before submitting the PR. Likely tonight or tomorrow.
I have built it under both master and 2.x branches - no problem with she or import framebuf. Just need to hook up the oled display to verify operation.
@meager fog I have a meetup Wed night, but I'll think about ducking out early to make an appearance on Show & Tell.
OK, this is getting real... Running MP in GDB. This place looks familiar π
Hello Everyone! ampy is giving me grief. windows 7 running python 2.7 esp8266
File "c:\python27\lib\site-packages\ampy\pyboard.py", line 143, in __init__
raise PyboardError('failed to access ' + device)
ampy.pyboard.PyboardError: failed to access COM5
RE: ampy it works if I disconnect the terminal (TeraTerm or Putty)
Ah, that makes sense.
So , to be completely direct. I want to determine the workflow (methods and steps) for debugging micropython. If anyone has or knows a resource for THAT. I would happily follow their lead.
enable framebuf for ESP8266 in mpconfigport.h
@hollow tartan what are you trying to debug? ampy uses the serial connection so you can't use both at once
@slender iron So, I have discovered. I am getting myself ready to attack the problem you asked me to work on. "ignored arguments"
submitted PR for 2.x - Do you want one for master - I need to rebuild the .mpy files for master since the format is different. IS it useful to do that at this time. I was surprised that 3.0 even builds for esp8266, but it looks OK - I assume it is really the 2.x code. Let me know if you want me to test the .mpy builds and if you want a PR to master.
awesome! sounds like you are close!
i want to read from a sensor every 15 secs forever. So circuitpython/Huzzah I have a while True: ....the challenge is when i run w/ ampy - just hangs there. If I remove the while True: code, rest works fine...any ideas why while True: hangs ...does there have to be a break? hmm.
@bronze geyser ampy tries to ctrl-c the main.py but its possible there aren't enough ctrc-c for it to get to the repl
ampy run -n is an option ?
thanks i think @slender iron...i apologize i don't understand what ampy is doing ...you're saying it's running the while loop before repl? Wow...i am clueless.
ampy uses the serial connection and if your main is already running it tries to stop it just like you would
I thought that was your while loop. are you using ampy run instead?
yah. ampy run.
what do you do on a Huzzah? (stay away from using it π )
yeah, I don't use it much
ampy hangs because it waits for the program to finish
I think @hollow tartan was right
oh...that's unfortunate....
-n will tell ampy not to wait for it to finish
i use -n ... it exits, but then the stuff i'm printing doesn't print. Real quick...so i assume nothing is running?
ampy says run "Run a script and print its output" ...oh, yah...right when in doubt blink (so not Dr. Whoish)
its tricky with a while loop
I'd suggest removing the loop for testing and using ampy run
long term ampy put the file so it runs even when not connected
@slender iron ... oh yah...contextually that makes sense. Test lines of code = ampy .... endlessly read the sensor data = load on boot and either blink LED or send messages to know what state firmware is in. Thank you.
@slender iron Am I to assume that ampy is the only tool available to use in testing micropython. I did see a statement the there are others. Is it the only tool you think I will need?
@hollow tartan for the esp8266 yes
@slender iron while you're at it...how about radiopython to complement circuitpython? Then us folks connecting to whatever won't feel marginalized π
we
er, we'll do radios at some point. just gotta pick our priorities
@hollow tartan for the issue I pointed you to, do a simple test script that triggers the bug that you can run with ampy
then, when you change the circuitpython code you can confirm its behavior is fixed
@slender iron Hey, that should be helpful. How do you want to share it with me?
share what with you?
whoa,, micro or circuit python? the test script I am not sure what to write in the script.
Oh sorry misread
I figured you could write the test script π I think the issue has enough detail in it for it
Ok I will try.
π
but my focus will be running it from ampy or from repl? I have loaded a test.py to the file space on micropython. I am also , by the way, reading a short book about Vagrant.
whichever way works best for you is fine
the problem is in micropython , circuit python, or both?
circuitpython only
got it,, thanks.
I am ready to release all the library changes. Should I wait or start 12 pull requests? Since these changes are incompatible with 2.x of circuitpython . I assume we have a way to build/maintain library bundle 2.x and library bundle 3.0 separately.
Can we try: except it for now? That way it could be used on any version.
FYI just in case you need to know: http://stackoverflow.com/questions/14016761/python-turn-list-values-into-string
works in micropython π
why? because >>> os.listdir() # returns a list! Can I assume that ```b = country[0].encode("ascii")
here is a possible way to detect a missing method:
def _read_register(self, register, length):
self._buffer[0] = register & 0xFF
with self._i2c as i2c:
i2c.write(self._buffer, start=0, end=1)
try:
i2c.readinto(self._buffer, start=0, end=length)
except AttributeError:
i2c.read_into(self._buffer, start=0, end=length)
return self._buffer
@hollow tartan encode doesn't exist for all builds, but you can use str(b'abc', 'ascii') for now. See https://github.com/adafruit/circuitpython/issues/384. There is also an issue filed about os.listdir() returning bytes instead of strings sometimes: https://github.com/adafruit/circuitpython/issues/249
So I'm so close to being done with this except for the part where it's totally broken. When I take one of the generated double extension file names and run it (blinky in this case) with pyexec_file(double_extension_filename, exec_result); I see my led blink but I loose the CDC serial in /dev/tty* and CIRCUITPY doesn't show up. I assume it's running the blinky that I had previously uploaded and tested with master (5ff6) successfully since I don't have MSC to upload a new file with.
I'm ...
enable inclusion of framebuf in mpconfigport.h for esp8266
submitted PR for master as well - I was able to generate the necessary .mpy's to test this in the master branch build using an ssd1306 OLED display.
@tulip sleet Thanks for that. I just tested on my Circuit Python and got a good result. Adafruit CircuitPython 2.0.0 on 2017-09-12; ESP module with ESP8266
I've been staring at https://github.com/adafruit/circuitpython/blob/2.x/atmel-samd/common-hal/digitalio/DigitalInOut.c and I am wondering if switch_to_output() is not called then how is self->open_drain initialized? If it is not initialized, then will it behave differently for some pins?
If you just set the direction as in the example, I don't think switch_to_output() is ever called.
common_hal_digitalio_digitalinout_switch_to_output() is called here: https://github.com/adafruit/circuitpython/blob/2.x/shared-bindings/digitalio/DigitalInOut.c#L202, in the layer above. When you set the .direction property it calls either common_hal_digitalio_digitalinout_switch_to_input() or common_hal_digitalio_digitalinout_switch_to_output().
@slender iron just a progress report: The I2C freq calculations in ASF4 are wrong, and there appears to be a SAMD51 hardware bug: you must set both the SERCOM's BAUD and BAUDLOW to get the right-shape waveform. On the D21 if BAUDLOW is zero BAUD is used to set the length of both for the low and high parts of the SCL clock pulse. The D51 is documented to do that, but it actually doesn't. The baudrate calculations in the hpl_sercom_config.h know this, but the ASF4 I2C library does not. Also, it seems to calculate the wrong value as well (bad algebra or something).
good night
@tulip sleet Nice mike drop.
good work @tulip sleet! The errata sheet is always handy though its still missing things: http://ww1.microchip.com/downloads/en/DeviceDoc/80000748B.pdf
<@&356864093652516868> Normal time for the CircuitPython weekly tomorrow (Monday) everyone in #circuitpython-dev and the CircuitPython voice channel. Thats 2pm ET and 11am PT. For those outside the US double check the time because we just switched daylight savings this weekend.
Hi, everyone. I just compiled .bin code for esp8266 that includes SSD1306 OLED support! https://www.youtube.com/watch?v=OOIO3oiC3lM&t=62
Live stream to http://twitch.tv/adafruit showing how to use SSD1306 OLED display with MicroPython on the ESP8266. Use MicroPython to control tiny little OLED...
Gotta wait weeks to get my OLED parts though.
It was so fast and easy since vagrant is installed and working. Wowzers!
Is your branch based on 5ff6 as well? I'd be happy to take a look tomorrow.
I found the bug; I had not noticed that the two calls to maybe_run had different arguments and treated them as the same. I simplified how it works and addressed that oversight in doing so. Now I'm just trying to remember how to pointer.
I would rather put something like:
self.i2c_read_into = getattr(i2c, "readinto", getattr(i2c, "read_into"))
somewhere at the beginning (in the __init__), so that we don't have to check every time.
Morning... now PyCon UK is over I'll try to be more active on here... except that I won't be able to make this evening's chat because I'm giving a talk about MicroPython here in London. π cc/ @slender iron
@tulip sleet think of it as "alternative" algebra π Nice work!
I like that idea @deshipu . Thanks.
class LIS3DH_I2C(LIS3DH):
def __init__(self, i2c, address=0x18):
import adafruit_bus_device.i2c_device as i2c_device
self._i2c = i2c_device.I2CDevice(i2c, address)
# handle name change of method readinto; backward compatible
self._i2c_readinto = getattr(self._i2c, "readinto", getattr(self._i2c, "read_into", None))
self._buffer = bytearray(6)
super().__init__()
def _read_register(sel...
I would drop that None from there β it should never get to that part, but when it does, and AttributeError is the right exception to throw.
@plucky flint good to aee you here!
@stuck elbow π
I mean "see". Tablet on-screen keyboard, sorry.
@slender iron my diagnosis last night about the I2C BAUD and BAUDLOW issues may be wrong. It seems to have to do with the clock values being wrong. I'll contact you.
@deshipu Python 3.5 evaluates both getattr() functions, so when we finally remove the redundant read_into method, the None ensures that the getattr(i2c,"read_into") does not throw an Attribute exception. Maybe we need to add
self.i2c_readinto = getattr(i2c,"readinto",getattr(ic2,"read_into",None))
if both readinto and read_into are not present, then throw exception
if self.i2c_readinto == None: raise AttributeError
your thoughts?
Argh, you are right, I'm sorry, I didn't thought it through. In that case maybe:
try:
self.i2c_readinto = i2c.read_into
except AttributeError:
self.i2c_readinto = i2c.readinto
would be clearer.
yep. in ~2. currently 9:17am local.
@slender iron has there been any recent activity on this?
https://github.com/adafruit/circuitpython/issues/296
asking because:
https://forums.adafruit.com/viewtopic.php?f=19&t=114536#p629139
@tulip sleet ready when you are
@idle owl does your cpx lib have a way to change lis3dh range?
@tidal kiln No. We chose one to use. I think it would be trivial to add if you think there's a need for it.
was/is there a desire to keep the cpx lib as simple as possible? any reasons for not adding it?
OMG I just had the most strange thought. What if adafruit started promising to give away 1 m4 metro to educational projects around the world just like rPi folks are supposed to have been doing.
@tidal kiln I doubt it. I think EinsteinUnicorn is back in school
feel free to ping the issue and offer to take it up
@hollow tartan we're kinda doing that already with the trinket, gemma and circuitplayground givewaways with orders
@slender iron k. thanks.
I am aware of the adafruit big order free products incentives. I like that.
@slender iron HA Ha. Here is another idea: AdaFruit could offer an trade-in program: Send in a rPi and get a Metro for half price. LOL.
Hey folks. Looks you all are having loads of "fun" with the new hardware. π
Wish I could be more active here, but life, man...you know.
Still working on adafruit.io and MQTT. I also just got a INA219 DC current sensing module that I want to get working with my ESP board as well. I found a few things for micropython. Is there anything for that in CP yet?
Maybe, I should get a Sparky Pin. The 3 OLEDs I ordered for my esp8266 have I2C interfaces for which bit banging will be needed on GPIO pins. I could have and should have ordered SPI interface OLEDs.
LOL
π
@floral dagger not seeing an entry for it (INA219):
https://github.com/adafruit/circuitpython/issues/269
awesome, thanks @tidal kiln Figured I'd double check before doing too much with it.
@tidal kiln There is a desire to keep it simple. However, if it will work like I think it will, we can have it set to a default that doesn't have to be set unless you want to change it. I don't think it'll alter the simplicity much.
@idle owl What is the strategy in the Educational arena for keeping the students from earning their Sparky badges with the Adafruit boards?
@idle owl do you think the desire to keep it simple is strong enough that you want to minimize the amount of functions you add?
@hollow tartan the bit-banged i2c on the esp8266 is as fast as standard i2c
I mean, 100kHz is not hard to reach on a 80MHz mcu π
That's good. The refresh rate on the OLEDs is about 80 ms which is only 12.5 Hz. Did you know that they can have "8 bit high SCAN line artifacts" if updated too quickly using u8g2lib driver? LOL
@floral dagger it should be rather easy to write a driver for that
@glacial schooner if you send 128x64 pixels, you still get about 50Hz in theory
thanks @stuck elbow I may give that a try then.
@hollow tartan sorry, that was meant to you
never actually wrote a driver before π
@floral dagger we can help
@tidal kiln I think it depends what it looks like once it's added. If it's just a matter of an optional parameter in the current function, I think it would be fine. If it means adding more than that, then maybe not. Memory is also a significant concern, though I'm not sure it'll affect that.
@floral dagger I think @bronze geyser was doing current sensing from a ESP8266. It was a different chip though I believe
oh, good to know @slender iron thanks
@hollow tartan I think a huge part of avoiding Sparky is in the design and function of the Circuit Playground Express, as you can do quite a lot without soldering or having the option to cross wires that would smoke something.
@floral dagger seen scott's guide? (on writing lib)
@stuck elbow I'd imagine it's a lot like most other things. I usually learn about 800 ways that it DOESN'T work, before accidentally stumbling backwards into one that does. π
@hollow tartan Past that, I think we all earn Sparky badges while learning. It's part of the process in and out of an education-specific environment.
@tidal kiln The one on learn.adafruit.com?
@idle owl thanks for you thoughts. I gotta go eat a little bite. see you all at 1 pm CT
@hollow tartan You're welcome. See you in a bit!
@floral dagger yes, that's pretty much how it works for all of us
@floral dagger yes: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/overview
the trick is to be more patient than the computer is
is round supported in cp? i'm getting this:
>>> round(3.14)
0
2.1
mine was 2.0
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> round(2.1)
0
maybe that math functions removal took the round() too
@tidal kiln I get the same thing as you with the same version.
@stuck elbow that truncs, want round
int(3.14 + 0.5) maybe? π
@tidal kiln that looks like a bug! Could you file an issue?
@tulip sleet sure. in cp repo, right?
yes, tnx
@tidal kiln Absolutely!
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> round(3)
3
>>> round(3.0)
0
>>> round(3.8)
0
related to a more general question - how to convert float to int in cp? i was trying to use:
int(round(3.14))
that should work
The CircuitPython weekly chat is in about 5 minutes, right?
yup!
I'm actually home for one of these things
π
@cunning crypt Hah! You're one of us now!
One of us!
@stuck elbow works, but wondering if that's the accepted way?
that's the obvious way, and python is usually all about the obvious ways
none for me
Discord does not enjoy my mic having its own self mute...
@cunning crypt I find it eventually gets over it. I mute my mic, not Discord.
ditto ... Group Hug!
HRs to @slender iron and @solar whale for testing the metrowing, RC2 coming soon!. Also thanks to @umbral dagger for helping me with some C questions. Also thanks to @meager fog, @tulip sleet and @tannwet for encouraging me to work on my first CP commit.
π π° π
hmm @meager fog "stole" my extremly obvious QSPI upgrade idea π
just got an INA219 breakout, and want to start working on my first Circuit Python library for it. I will probably have loads of silly questions for you all.
Silly questions are the best questions.
awesome!
@cunning crypt can you switch the mike off?
@stuck elbow My mic's muted.
It's not Andon's.
FYI I found a really good Python book on O'Reilly Safari: Python Crash Course By: Eric Matthes Publisher: No Starch Press Pub. Date: November 20, 2015 Print ISBN-13: 978-1-59327-603-4 Pages in Print Edition: 560
@cunning crypt it doesn't show you muted
@stuck elbow Physical mute button.
@stuck elbow It won't if you physically mute your mic, and don't click mute in Discord.
There.
thanks!
My mic is also physically muted, Discord is not.
I'm typing on a cherry mx keyboard, and you're not hearing endless clicking π
clicky clicky
@idle owl I was thinking the echo might be coming from the client, not necessarily thourgh the physical microphone
can't hear audio either :/
@timber lion It doesn't show you as in the audio channel... Oh, wait, there you are
yeah it's kinda coming and going
@stuck elbow hang up and reconnect
@tidal kiln thanks, that helped
@stuck elbow it's a "feature", i have to do same
This book seems to offer explanations to get me prepped (as I am new to Python) to help out with Circuit Python. Would someone care to thumbs up this book or point out a superior one or other resource? Python Crash Course By: Eric Matthes Publisher: No Starch Press Pub. Date: November 20, 2015 Print ISBN-13: 978-1-59327-603-4 Pages in Print Edition: 560 π
thanks
I should have a PR tonight to support double file extensions. I donβt have it working quite how I would like but I think itβs good enough to be useful. Iβm slowly relearn everything Iβve forgotten in the last 10+ years since Iβve touched any C code which ends up being just about everything useful :)
If anyone has good C for programmers books let me know
As far as I can tell CDC and MSC are working fine in master. My most recent issues were self-imposed code issues that have since been fixed.
Lastly I just finished hand soldering headers to my JD-T1800 TFT so hopefully I can test with it soon. Pro tip: probably just buy the breakout? Also theyβre delicate so donβt solder on it upside down and crack your screen π¦
check out the hitchhiker's guide to python: http://docs.python-guide.org/en/latest/intro/learning/
great list of resources there
there are nice video courses free online you might check out
also has some book recs
zed shaw's C book is my current favorite
I just got my copy of the "Programming with MicroPython" by @plucky flint
any other updates besides what you hipchatted me?
but yeah nothing new from hipchat, working on guide updates to have circuitpython code
yes
tuesday is fine
yeah tuesday is good
Don't think Tuesday will be any different than Monday for me - Probably will be working
back to the salt mine for me. Enjoy the rest of your day! π
@pastel panther Have a good one
@stuck elbow issue for that: https://github.com/adafruit/circuitpython/issues/335
Need to coordinate across main.c, Makefile, and mpconfigport.h. Could add more stuff to mpconfigboard.h and/or mpconfigboard.mk. A single change should control the feature properly everywhere.
Moti...
@tulip sleet awesome, thank you!
have a good one everyone

@timber lion Are you using Comcast? Looks like there's a big bunch of issues with them: http://outage.report/xfinity
drivers aren't working without busio first though
yep i totally am @cunning crypt ahhh that must be my problem
it's written in the .travis.yml file
read the comments there
I've been having some intermittent issues today as well. Ran across a tweet with that link a few minutes ago.
@tulip sleet @granite oak check the comments in the .travis.yml files
let me know if they don't show enough details
it explains you need to add the GITHUB_TOKEN
yeah it's a separate config to add GITHUB_TOKEN unfortunately
it's state travis stores separately by design
because it has to be secure, you can't store the token in the repo
anyone with that token has your full control to github
@tidal kiln I always check to make sure it's not mine we're hearing π
nope unfortunately not, travis needs each repo to have an individual .travis.yml
that was my cat - beating down my door...
it could first step clone a yaml but it can't produce release artifacts without an explicit list
the list of release artifacts to attach has to be in the repo's .travis.yml unfortunately
the outputs
the "adafruit_vs1053.mpy" etc in it
its ability to attach to releases is limited to just whats' in the travis yml
i broke the script out as much as i could otherwise, it actually does download a shell script
for building the zips
yep
one for single files and one for multiples
the multiple builds a zip, excludes init.py from mpy generation (old bug)
etc
no unfortunately not it has to have an explicit list of release artifacts
it could maybe replace the 2-3 commands
but there isnt much to the files
yep :/
@timber lion I do have free access to Zed Shaw's books and Videos. thank you for pointing them out!
I said to Tony: "Tony, please be more careful on those trails. okay?"
oh nice, yeah i like his stuff a lot.. it's opinionated but in a good way IMHO
his python books are good too
oh wow yeah safety is actually #1, i haven't had any trouble yet but am always on the lookout π
Is there a meaning for the different charcters? I know Sparky is for the blue smoke, but the others?
@stuck elbow not really meaning, like blue smoke, but they all have their own personalities.
@slender iron this is what needs some eyes on: https://github.com/adafruit/circuitpython/issues/312
also, let me know if that idea of creating a new branch wasn't a good one
@cunning crypt thanks for the xfinity link - I was having trouble for the past hour or so as well - perhaps that is why....
Yeah, it seems to be pretty widespread.
I was having issues with some sites earlier this morning, but it seems to be resolved for me
me too.
@hollow tartan @timber lion Ya, Zed is a bit of a jerk sometimes, but an awesome guy.
@idle owl i think this has been discussed, not sure where it stands - how to get a value from a single axis of the accelo? (using cpx)
this syntax works cpx.acceleration[2] to get Z for example. maybe good enough?
@idle owl also, what about analog in?
Since the update is in 2.x and pending for master, I thing this can be closed. It won't let me close it.
odd - FYI - you do have access to several functions in the math module. ```import math
math.floor()
math.ceil()
math.trunc()
round also fails the same in the master 3.0 build.
is this expected behavior? why 0 for third case?
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> import time
>>> t1=time.monotonic(); time.sleep(0.1); t2=time.monotonic(); print(t2-t1)
0.0976563
>>> t1=time.monotonic(); time.sleep(0.01); t2=time.monotonic(); print(t2-t1)
0.0078125
>>> t1=time.monotonic(); time.sleep(0.001); t2=time.monotonic(); print(t2-t1)
0.0
Looks like time.sleep() isn't ultra-precise, and 0.001 falls underneath that precision.
If I were to guess, at least.
@cunning crypt my guess also, esp. given the values for the other two
Yeah. 0.097whatever is pretty close to 0.01, but 0.0078ish is significantly less close to 0.01
@tidal kiln I'm assuming M4?
no. m0. good point. i'll edit and add banner for context.
yeah, but that shouldn't matter
>>> import time
>>> t1=time.monotonic(); time.sleep(0.1); t2=time.monotonic(); print(t2-t1)
0.098999
>>> t1=time.monotonic(); time.sleep(0.01); t2=time.monotonic(); print(t2-t1)
0.00900269
>>> t1=time.monotonic(); time.sleep(0.001); t2=time.monotonic(); print(t2-t1)
0.0```
Running the 0.01 sleep a few times, and it's often 0.0090332
Lowest is 0.00891113, highest is 0.0100098
Definitely looks like 0.001 is outside of its range
Or not. Just got 0.000976563
@idle owl or anyone w ideas on this, I've got a quick (I hope) question on a simplio module error
It hits 0.0 very often, but it does occasionally hit real numbers.
There is apparently a bug in https://github.com/adafruit/circuitpython/blob/master/lib/libm/nearbyintf.c in the builtin libm.
@split ocean go for it, ask away...
time.monotonic is not purely time based. It relies on clock cycles in some cases iirc, so can sometimes be ever so slightly off.
that's probably it, first time i've tried to crank things down this low
it returns a fractional representation of time passed, so it could also be in the math
thanks @tidal kiln I've got a pretty simple bit of code started and as soon as add importing of simpleio I'm getting a memory allocation error
also noting that not much has been implemented in the the cp time module:
http://circuitpython.readthedocs.io/en/2.x/shared-bindings/time/__init__.html
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "libraries/helpers/simpleio/simpleio.py", line 225, in <module>
MemoryError: memory allocation failed, allocating 136 bytes
here's the code:
I'm going to use servo, btw
I'm on CircuitPython 2.1 on a CPX w latest bundle
one thing right off - you can access the neopixels via the CPX library
line 15 coudl be cpx.pixels[i] = ((R, G, B))
@tidal kiln Re: accel, I think that syntax might be good enough. But it might be better to have something clearer. Analog in is not included, I hadn't thought about it until trying to write up examples using the CPX library for all the code in the Intro to CPX guide.
Hi all and <@&356864093652516868> here is the video from today's meeting https://youtu.be/VuDyCgx4ZRk . Next week will be on Tuesday instead of the normal MOnday because I'm travelling Monday. Thanks!
Join here for the chat all week: http://adafru.it/discord The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel for noti...
@split ocean Checking out your code now.
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> import time
>>> from adafruit_circuitplayground.express import cpx
>>> import neopixel
>>> import board
>>> import simpleio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'simpleio'
>>>
recreated, at least
oh wait.
Is simpleio not built in?
it's in bundle:
https://github.com/adafruit/Adafruit_CircuitPython_Bundle/tree/master/libraries/helpers
forgot i had a paired down set of stuff on my CPX
@split ocean did you just drag over all the bundle contents as is? or have you deleted and/or mpy-cross'd anything?
ok...that's the error droid i was looking for:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
main.py output:
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "libraries/helpers/simpleio/simpleio.py", line 225, in <module>
MemoryError: memory allocation failed, allocating 136 bytes
I dragged over the unzipped bundle lib directory without any changes
Does it help to mpy-cross it?
FWIW, simpleio worked when I ran just the servo code and nothing else as I was working on this
New toys, wew! Hope to have one of these puppies choochin' some CP before too long:
can get away with it in REPL:
Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit CircuitPlayground Express with samd21g18
>>> import time
>>> from adafruit_circuitplayground.express import cpx
>>> import neopixel
>>> import board
>>> import simpleio
>>>
@split ocean "just the servo code" probably had fewer imports?
yes, many fewer
I've tried uncommenting a lot of what looked like commented out code... I'm not having memory allocation issues. But I don't know if I've added all the code you're trying to run.
oh, of course, I'm eating up ram w cute ascii art ;)
Also, I have 2 micro servos, will one of them work to try to replicate your setup?
One is continuous, the other is not.
yes, I'm not doing anything proper w it yet in that code though
@tulip sleet get the clock going?
@idle owl so you deleted code comments from the gist?
I pasted the entire thing in, and uncommented what looked like code. I didn't delete anything.
was just getting to that. but for now, if you had the servo move to one position when the CPX is rotated CW 90 degrees and another when rotated CCW 90 degrees that would be a good test. Orientation of CPX is like a clock on a wall
@slender iron yeah, but the I2C is twice as fast on the SAMD51, despite the constants being the same. I should double-check gclk1 on both. For a requested 400 kHz clock, '21 is 350-ish, '51 is 735-ish
oh wait, maybe a typo
@idle owl i'm getting same memory error as @split ocean if i just paste as is and use the bundle as is. are you doing something different?
I only copied simpleio.mpy out of the library bundle into my lib folder. So all that's in there is adafruitcircuitplayground/ and simpleio.mpy
Let me copy the rest of the bundle in
@slender iron all better - I forgot to change the clock source in one place. Identical clocks on both now. Now to test a fancier device like the accelerometer
w00t!
maybe a pull request soon! can you do the asf4 pull I have on tap?
take two mpy-cross's and call me in the morning
@tulip sleet yup, will look now
Driver for the gesture sensor.
@tidal kiln If the bundle is there as-is, it means that lis3dh is included, and it's already frozen into the firmware for the CPX.
If I delete ONLY that from the bundle, it works fine.
You can't have it duplicated. It was frozen in because the acceleration module was too much to be run from the lib folder.
@idle owl the frozen one is last on sys.path. If there's one in lib it will take that one first
@tulip sleet So it seems!
hey. wasn't this discussed today? board specific bundles?
@split ocean You have to delete lis3dh from the bundle for it to work.
got it.
I pulled the master version as well. Thanks @jerryneedell !
It's been discussed previously as well π
is there a good decoder ring for what to remove from the full menu for each board? or is cpx the only outlier?
this is for an AdaBox 006 project guide -- is the current thinking that there won't be board specific bundles? in that case, I'll include a step where people remove that module.
I think it's the only outlier for included libs. The trinket and gemma issue is just space and only importing what you need vs. having a board "specific" bundle for them.
@split ocean I would include the step for now. We talked about doing board specific bundles but there are a number of reasons why it's still up in the air.
Yay!
np @split ocean , good job @idle owl
@slender iron thanks on asf4! lis3dh returns acceleration on CPX! That's a good exercise. I'll look at your clock fixes, merge that in, retest, and submit a PR.
π
The last option looks good! Also keep in mind that switching a driver to adafruit_bus_device.I2CDevice might be the easiest way going forwards.
@idle owl the CP classic just used arduino libs to do analog and digital io. so in that same style, maybe no need for anything in the CPX lib. just use core modules.
@tidal kiln Ok keen. I wasn't sure whether it was something worth looking into. In my mind, the CPX lib uses in some way everything built into the board and once you're past that, you're to a point that using core modules is easier to understand.
on that note, do we have a debounce built into the cpx.button_a check?
So the lib works with the board stand-alone and as you start adding external sensors an so on, you start using core modules.
@tidal kiln I can voice or video chat with you about the ADC in the next couple hours if you like.
@split ocean I don't know. I didn't write the button code, so I'm not as familiar with it. @slender iron do you remember?
it seems to work really well, but just want to make sure I show best practices in this
@split ocean it doesn't debounce. it just runs slowly. let me know if you see weirdness with it
cool. no weirdness thusfar ;)
k, then its ok as is π
@stuck elbow introduced gamepad with debouncing if you want to track button presses that happen between checks
Hi zencuke! Which documentation are you looking at? It should be updated.
I'd rather not include bins in the release list because its already long as is. However, they are always built and available here: https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/
@idle owl @slender iron on that topic of how much simplification is introduced w the adafruit_circuitplayground.express import cpx action:
do I still need to import DigitalInOut, Direction, Pull if I'm using cpx.button_a?
or is that implicit
Nope. Implicit.
@split ocean Yep, and brightness works. You can set it before your while loop or in it.
@slender iron another asf4 PR before the circuitpython PR
needs a rebase
@slender iron the CONTAINER_OF changes are redundant
got it. and you were saying earlier that simplio is still a separate module to import because it's not based on sensors that are physically on the cpx?
and just so you know, this x = int(xF) truncates
>>> print(int(3.99999) )
3
@tulip sleet merge it as you like I just approved
@split ocean Not exactly. It just hasn't been frozen into the firmware. The reason for including or not including something in the CPX lib is in design discussions, I was simply explaining how I think about the library. I feel like we could expand it to include the options available with the Educator's pack, which I believe includes a servo, but we haven't gotten to that point yet.
Cool.
@split ocean you probably want int(round(3.999)), but not right now:
https://github.com/adafruit/circuitpython/issues/410
As time passes, we'll definitely expand it to include new things as we find that there are new use cases for it. The more people use it, the more we learn what types of things people want to do with it.
@split ocean some of what @idle owl was saying may have been related to the discussion about analog in and how to use it with CPX
@tidal kiln Looping back to earlier, what was your reason for needing access to the lis3dh range?
so it could be changed for different applications
for example, wanted to crank it down to 2G for better accuracy
or up to 16G for something super shaky
@tidal kiln for the ads change I'd just suggest documenting ADC_Channel
@idle owl something like this: https://github.com/adafruit/Adafruit_CircuitPlayground/blob/master/Adafruit_Circuit_Playground.h#L120
and removing the stuff thats commented out because it moved
@slender iron want to talk?
I can if you like
I don't think it will be as simple as exposing the parameter. So I wanted to know whether it was a general thing or whether you'd come up with a specific use case.
Yeah we picked one of the range levels in the middle.
@slender iron need to set mic up....one sec...
same
- Added
asf4_conf/samd*/hpl_sercom_config.h - Adjusted clocks in
peripheral_clk_config.h. - Put some frozen libs back in CPX for testing.
- Implement common-hal I2C.
- Re-enable resetting SERCOMs in
port_init(), so SERCOM's get reset on soft reboot. - Add
samd*_peripherals.hin parallel withsamd*_pins.hfor common
functions and data. - Store SERCOM index in pins table for convenience.
- Canonicalize some
#includeguard names in various .h files.
Does CircuitPython have any sort of sleep functionality? IE, all-but-shutoff the M0?
Not at the moment.
@cunning crypt There's an issue started for it. https://github.com/adafruit/circuitpython/issues/119
Not surprised.
@cunning crypt I glanced at it a bit but it didn't seem easy
I'd love it if time.sleep() was smart enough to manage it
That'd be cool
@slender iron Send me the neopixel update.
Np
need a uf2 or bin?
building now @idle owl. you'll be the first to test
@slender iron Nice!
-Os compilation
@slender iron Woah! That's noticably faster!
Already had rainbow animation code and a neopixel strip wired up.
REPL working fine.
It's not mounting on reset though.
what do you mean by reset?
Update time. Here's the file running that's loaded/running: acc = 0 for i in range(10): acc = acc + i debugger() and here's a trace: MicroPython Debugger DD> acc acc 0 DD> i i 0 DD> :c :c CONTINUE MicroPython Debugger DD> acc acc 1 DD> i i 1 DD> :c :c CONTINUE MicroPython Debugger DD> :c :c CONTINUE MicroPython Debugger DD> i i 3 DD> acc acc 6 DD> :c :c CONTINUE MicroPython Debugger DD> :c :c CONTINUE MicroPython Debugger DD> i i 5 DD> acc acc 15 DD>
If I eject it, and either press reset or unplug it and plug it back in, it doesn't show up in Finder. It took 2 resets once to get it to show up, but after that it's not showing up again. I can get to it via serial, but it's not mounting circuitpy drive
@idle owl master does this too right?
It had stopped doing this I thought.
its based on the latest master
Ok this time it popped up. Hmm.
Now it's mounting consistently.
Except when Finder crashes, lol. Wondering if it's something odd on my end.
I can reboot, but this is what it was doing before the last USB fix. Finder just crashed again. I'll reboot.
a bug is totally possible
please file an issue with instructions to reproduce
I don't think resets on the USB side are handled well
Ok repro'd after reboot.
Ejecting and physically removing was working until it popped up as NO_NAME and my code stopped running. And apparently erased the board.
hrmmm, crazy!
Ooh. So it let me get to the bootloader and drag the firmware you sent me to it, rebooted it like it worked, and came back up as no_name.
Even with no_name mounted, I can at least temporarily get to and interact with the REPL
I was able to copy main.py and neopixel.py to no_name and have it run, at least while I'm connected via serial.
And I can import main.py inside the REPL and it runs.
ok, so the name of the disk just got corrupted
Don't split a statement with a #pragma. It breaks the compiled output. Fixes #410.
Hmm.
Also a file called _NEOPi~1.PY was on the cleared drive when it mounted again as no_name. Containing somewhat jibberish. That acted really weird when I tried to paste it in here, so I'll include the file if you want, but I don't want to crash anything with weird non-code..
yeah, I think the filename is stored in the same place as the disk name
So... jlink? And try to repro?
Because reflashing the firmware.uf2 isn't resolving the issue.
yeah, you need something to erase the file system flash for you
do you all know how to erase with jlink? I don't actually
No. I know how to reflash. I was going to reflash the bootloader, and then reload the uf2.
the bootloader isn't working?
It is. But that's the only way I know to clear everything would be to reflash the bootloader.
I guess I could try using the jlink and a .bin firmware
We have flash eraser files for the M0 boards, I don't know how they work or whether they'd work on the M4 though.
Those work through the bootloader.
I mean they're uf2 files, I assume that's how they work.
They're available on readthedocs page under troubleshooting for circuitpython
cause i don't know either. theres erase but that's just for on chip
I know but I don't know if they'd work on the M4 board. They're designed for the M0 boards.
afaik
all filesystems are on chip now
oh. then erase
How does that work
that will erase the bootloader if you've never updated via the self-updater uf2
then erase
the self-updater sets the protection bits
@slender iron I didn't because you said it made doing things with the jlink more difficult.
it does a little
it might be easier than reloading the bootloader though to do a chip erase
What is jlink?
@vague monolith https://www.adafruit.com/product/3571
@vague monolith or similar https://www.adafruit.com/product/1369
Well, I've always got the jlink to reload something if I break it, lol. So I'll do erase
@vague monolith a programmer for ARM core chips
@slender iron you can get around any protection bits using the jlink, correct?
yeah
Nice
its just one command you have to remember to run
command wise?
Yeah
connect -somethingspecific
Yep
connect
Oh. I thought I had to tell it things.... oh wait, it asks inside JLinkExe doesn't it
I had forgotten
you do, but this way you do so interactively
speed is 1000 right?
i've gotten away with 4000, so dunno
hmm ok
SWD
This looks like a hangover from spi. I doubt its needed.
The reliance of these new _init methods on arrays of _configuration structs is really annoying. Is the compiler smart enough to inline the values from the arrays or does it always take code space? I'd be tempted to init them ourselves to avoid the configuration structs and the need for the CONF values at all.
I don't think you need these three things. SPI.CTRLA.bit.SWRST is the same memory location as I2CM.CTRLA.bit.SWRST because SPI and I2CM are members of a union. Instead, I think you had "in use" errors because the reset takes time and the M4 is faster than the M0. You can wait on the state of SYNCBUSY.bit.SWRST. It'll be 0 when the reset is finished.
when you're back to the prompt, then do erase
loadbin foo.bin, 0
foo being the bootloader?
yep
@slender iron Other than the self-updater one, is the bootloader.bin I have from 24 October still the most up to date? Or should I just load the self-updater.
INFO_UF2.TXT:
UF2 Bootloader v1.23.0-14-g3db9182 SFHR
Model: Metro M4
Board-ID: SAMD21G19A-Metro-v0
^^ thats whats on my M4 fwiw
@slender iron i think i remember i did this:
chan0 = adc[0]
chan0.value
so that you could then show how one could pass chan0 to something else
and it would work the same as analogio
right, maybe use it in a loop after that instead with an analogio example commented out?
yeah. i can make a stab at something. and can always comment once pr is made.
sounds good!
gotta run. @idle owl , you set?
@tidal kiln Yeah looks like it! Thanks!
cool. you can do all the interactive stuff via command line to expedite if you want.
i've just been running in that interactive mode for now
Makes sense. I had forgotten it did that.
but now you're back to bootloader goodness and can move forward from there (without jlink)
Yep! Firmware loaded happily. Now I'm back to ejecting and reseting. π
aka back to breaking it again π
but can pwn and fix with jlink, so no worries.
Yep!
sure π I do wish you had usb logs to go with it
I'm super excited about this! It reminds me of this talk: https://www.youtube.com/watch?v=HyzD8pNlpwI
It looks good to me. The one thing I wonder is if its worth thinking about how it work if the display was QSPI instead of SPI because the SAMD51 has a QSPI peripheral. Would it be worth delegating the actual write back to Python to gain flexibility on where the frame is written to after its rendered?
Doesn't that require another piece of HW? Or am I hoping to get that from dmesg
dmesg error would help
I use a beagle to get it. If you have a linux box it could get close too
It's mostly not returning dmesg errors. Every so many times I get this: USB device 239A802114130002 - fConsecutiveResetCount = 1. SmartBattery: finished polling type 4 disk3s1: device/channel is not attached. disk3s1: device/channel is not attached. disk3s1: device/channel is not attached. disk3s1: media is not present. USB device 239A802114130002 - fConsecutiveResetCount = 2. disk3s1: media is not present. disk3s1: media is not present. disk3s1: media is not present. disk3s1: media is not present. disk3s1: media is not present. disk3s1: media is not present. disk3s1: media is not present. disk3s1: media is not present. USBMSC Identifier (non-unique): AF8C5FF815E47535020202D473C480FF 0x239a 0x8021 0x100, 1
There's a lot of other messages, but I guess I'm not entirely sure what all would be related.
I think the disk3s1 messages are ok
There aren't really any errors. I have an older linux laptop I can fire up.
wireshark can be used to capture usb on linux
I gotta go do a few chores before dinner with tony
thanks for the help and testing!
For sure!
@tannewt Feel free to correct me, but I've never seen a QSPI display ... it's normally only used for very high speed flash memory access, such as an MCU with external flash where you want to execute code directly off the SPI flash device. As such, for anything display related I don't think it's worth waiting or reworking anything around QSPI.
This works fine on 2.x, but is a problem on 3.0.
Tested partially on Feather M0 basic and Metro M0:
MOSI, A1, A2, A5, value is False even after set to True.
MISO, A0: works fine.
Then, while trying to use A3, I got a "Pin PB09" in use, even though I hadn't used A3 before. So this might be a pin mapping problem.
Thanks for the info! I didnβt look just thought there might be.
On Mon, Nov 6, 2017 at 5:49 PM Kevin Townsend notifications@github.com
wrote:
@tannewt https://github.com/tannewt Feel free to correct me, but I've
never seen a QSPI display ... it's normally only used for very high speed
flash memory access, such as an MCU with external flash where you want to
execute code directly off the SPI flash device. As such, for anything
display related I don't think it's worth waiting or ...
Union thing understood. I didn't read the register defns carefully enough.
The weird thing about the ENABLE and SWRST is that I got "pin in use" errors after a soft reboot when lines 183 and 184 were reversed. These errors were many seconds after the reboot: I was testing in the REPL. I'll test this again.
sercom_clock_init is new by me (it's in samd*1_periphals.c). I do need the clock lookup table (maybe not the SLOW), because the numbers are random.
I think we could get rid of the _i2cms configuration table in hp_sercom.c, but it means changing the semantics of the library somewhat. I was trying to make minimal code changes to ASF4 aside from fixing bugs, so that we could merge more easily later.
The compiler can't inline the values because they're looked up by an index computed...
I thought maybe SWRST was ENABLE-protected. It says it isn't.
Test failure was the the usual "lock_3" failure.
I will merge more 2.x fixes into master on a batch basis, unless you would like separate master PR's for each.
Here's my fix. It's the first C I've written in quite a long time so by all mean suggest any improvements that are warranted.
Batch basis is fine with me!
On Mon, Nov 6, 2017 at 6:39 PM Dan Halbert notifications@github.com wrote:
Merged #413 https://github.com/adafruit/circuitpython/pull/413.
β
You are receiving this because your review was requested.Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/pull/413#event-1328873287, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AADNqZD3XyAcMQJEmLF_NiG0SeLPlhbDks5sz8LHgaJpZM4QUHiF
...
This is a great talk, and GameBoy is certainly a very well engineered system β though they drove their LCD display directly, not with a luxurious chip that we have nowadays, so the timings had the be exactly right.
I haven't heard about quad-spi displays β I think at that point you would simply use a parallel 8-bit or 16-bit interface, that most such displays support. We might add support for that at some point, but it will have to be in the C module. I did try to make it just fill the buffe...
@tannewt I am not understanding your point about "switching a driver to". Every one of the libraries I will be changing already are using adafruit_bus_device.I2CDevice. What am i missing?
I fixed the unnecessary SERCOM reset and removed the unused routine. I have some ideas for getting rid of the configuration tables. But are you willing to defer that for a little while and take the current implementation so people can start testing with I2C devices? I'll come back to the configuration stuff when I start implementing the next part of busio.
Fixes #407 (get pin.value not correct for certain pins)
I mean no offense, guys, it's a great problem to have... but I think I need to set up an email strictly for GitHub
good afternoon everyone. I am running through the library example on learn. When I try to run this line:
cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
I get this error:
subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/adafruit/cookiecutter-adafruit-circuitpython.git']' returned non-zero exit status 128.
Anyone have any insights on what could be thecause?
@floral dagger can you run git clone https://github.com/adafruit/cookiecutter-adafruit-circuitpython.git from the command line? That's all the above is doing.
@tulip sleet yeah, that works without a hitch
Is that all I need to do, or does the cookiecutter command do more?
no, that's just the first part; it asks you a bunch of questions and then fills in some slots in the cookiecutter template. what os is this on, and how do you have git installed?
windows 10. I installed git from the command line, and I have the windows gui program installed too
I don't know if the script works on windows. If you just type git in a CMD window, does it do anything?
it may not be in your path
gotta leave for an appt - sorry
Yeah, git seems to work fine. It shows all the commands
consider using WSL (windows subsystem for Linux), which will let you do all this inside a real Linux env in Windows
I'd really prefer to not do that if possible. Any other options @tulip sleet ?
i've run into a use case issue with using _FOO = const(99)
since _FOO becomes hidden, it limits how you can break things up into multiple files
which is my use case:
base_class.py contains the base class and all the consts
some_class.py imports above and derives, but can't access the consts
@mrmcwethy yeah, I was confused thinking we were changing CircuitPython's methods.
I think that we should just switch the libraries over to readinto. Lets leave read_into in the I2CDevice class for a little while for any other libraries to catch up.
I want people to grab libraries out of the bundle instead of separately because we can then verify bundled libraries always work with each other.
How about adding a macro to do this initialization? That way it can add the empty string.
STRING_LIST("code.txt", "code.py", "main.py", "main.txt")
Implicit C int -> bool confuses my C++ and python brain. Mind making this filenames[i] != ""?
I agree, that would be easier to read.
9060df5 DigitalInOut: Use pin value % 32 to accomodate ... - dhalbert
I don't see a place for similar macros like supervisor/default/messages.h is for message strings. Should I put it in main.c or somewhere else?
Can you test against latest master again? 4140b3b9443c47b8eda05de60b312b7df65ff5e0 fixed a usb issue and may have fixed this.
the issue is that git is a special animal and returns non-zero exit status on success
because Linus said so
multiple flavors of success?
The text returned:
File "path\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec)
File "path\runpy.py", line 85, in _run_code exec(code, run_globals)
File "path\cookiecutter.exe\__main__.py", line 9, in <module>
File "path\core.py", line 722, in __call__ return self.main(*args, **kwargs)
File "path\core.py", line 697, in main rv = self.invoke(ctx)
File "path\core.py", line 895, in invoke return ctx.invoke(self.callback, **ctx.params)
File "path\core.py", line 535, in invoke return callback(*args, **kwargs)
File "path\cli.py", line 120, in main password=os.environ.get('COOKIECUTTER_REPO_PASSWORD')
File "path\main.py", line 63, in cookiecutter password=password
File "path\repository.py", line 103, in determine_repo_dir no_input=no_input,
File "path\vcs.py", line 99, in clone stderr=subprocess.STDOUT,
File "path\subprocess.py", line 336, in check_output **kwargs).stdout
File "path\subprocess.py", line 418, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/adafruit/cookiecutter-adafruit-circuitpython.git']' returned non-zero exit status 128.```
had to replace the actual path with "path" to get under the discord character limit
it looks like the git command completes as expected, but it fails in other places
(all files are present in the destination folder)
FYI, I test the cookiecutter using the git bash and got the same errors
just to sanity check, ran on linux, all ok:
~/test$ cookiecutter gh:adafruit/cookiecutter-adafruit-circuitpython
You've cloned /home/foo/.cookiecutters/cookiecutter-adafruit-circuitpython before. Is it okay to delete and re-clone it? [yes]: yes
library_name: test_library
depends_on_bus_device []: y
depends_on_register []: n
author: Foo Bar
company [Adafruit Industries]:
~/test$ cd test_library/
~/test/test_library$ ls
adafruit_test_library.py CODE_OF_CONDUCT.md LICENSE readthedocs.yml
api.rst conf.py README.rst requirements.txt
well - there you go - problem soved π
Is it possible to record some audio from the on board mic on the Circuit Playground express using circuit python? I'm having trouble getting the right API to record audio π
Fixed by #404. Thanks @deshipu
I was looking at the Circuit Playground Express tutorial. It is obviously not done. It is huge with lots of useful info but it looks like a lot of cut and paste was done. It needs some editing for things that need to be changed for inclusion in this specific tutorial. I try to give feedback when I notice things. It would work if the tutorial pointed to the bin files. It said "this is how to recover with a bin file" but no pointer to bin files. I went to the release area and no bin file.
I like that decision. I will act on it.
@glad hazel there is some rough microphone code here: https://github.com/adafruit/circuitpython/issues/156; we are working on better support
@tulip sleet Thank you! Do you think switching to C++ would work more reliably, or will this be enough for a simple record and playback?
@glad hazel You'll probably have to do some experimenting. As that issue discusses, there is some signal processing you may want to do on the result. Here is some more doc for CircuitPython: https://circuitpython.readthedocs.io/en/2.x/shared-bindings/audiobusio/PDMIn.html. And here is a tutorial for a similar mic with Arduino and Rpi info: https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/arduino-wiring-and-test. Also note that the CPX is supported by MakeCode, which has microphone support: https://learn.adafruit.com/adafruit-circuit-playground-express/makecode
anyone recovered from this w/o reinstalling circuitpython? ampy.pyboard.PyboardError: could not enter raw repl
I thought I could ctl-d or something...but so far not successful.
can you enter repl normally?
yah. I just (seems slowly) thought to go to a screen.
raw mode is ctrl+b iirc
Ok, well since I can't use cookiecutter in windows apparently. Is there another reference I can use?
This is off point for the issue but there was a bigger problem in the tutorial. I probably didn't need bossa. I tried to load circuitPython and the behavior didn't match the tutorial. Bright lights flashed, two popups appeared indicating that both CIRCUITPY and CPLAYBOOT had been improperly removed and CIRCUITPY was not on the desktop as promised.
It turns out that in spite of the weird behavior circuitPython was actually running. CIRCUITPY was mounted (according to 'df' and 'ls /Volumes/*...
@stuck elbow ok. I can get into raw then repl using screen.... but ampy can't get to raw repl?
your don't have your screen running at the same time, do you?
true, just making sure
do you have anything running there? any main.py?
or boot.py?
yes indeedy. i have main.py....i stupidly put a While True: so I assume this is choking access...
can you rename it with os.rename()?
ooh. clever. i will try this. thanks.
Pasting from the clipboard or middle-click (Linux) into the REPL in 3.0 only allows 128 characters. In 2.x, much larger blocks can be pasted (I couldn't get it to break).
@stuck elbow THANKS! Brilliant. I shoulda but didn't think of that! I appreciate and am grateful for your cleverness.
it's more like I just had all those problems before and someone told me the solution, but you are welcome
i dunno...in some ways i love bumbling into these kind of challenges because it makes me happy knowing there are very clever people all around us.
I just tried the uf2 boot process again and much of the weirdness is gone. I only got a single unmount warning popup for CPLAYBOOT. None for CIRCUITPY this time. Even better CIRCUITPY was on the desktop. And the finder sidebar CIRCUITPY worked. I was able to drag the uf2 file to it. If it had been doing this Saturday I wouldn't have been fiddling with bossa. I think I rebooted the Mac in there somewhere. OSX must have been in a bad state.
as long as they don't take too long to resolve β I just fixed a bug I was working 2 weeks on π¦
I'm glad you posted this - I had a cut/paste truncated recently on 3.0 and I was meaning to go back and explore it!
@tulip sleet Have you had the following problem builid cpxcleanmake?
Generating build-circuitplayground_express/genhdr/mpversion.h
GEN build-circuitplayground_express/genhdr/qstr.i.last
QSTR updated
GEN build-circuitplayground_express/genhdr/qstrdefs.generated.h
Traceback (most recent call last):
File "../../tools/mpy-tool.py", line 593, in <module>
main()
File "../../tools/mpy-tool.py", line 581, in main
raw_codes = [read_mpy(file) for file in args.files]
File "../../tools/mpy-tool.py", line 448, in read_mpy
raise Exception('incompatible .mpy version')
Exception: incompatible .mpy version
../../py/mkrules.mk:132: recipe for target 'build-circuitplayground_express/frozen_mpy.c' failed
make: *** [build-circuitplayground_express/frozen_mpy.c] Error 1
make: *** Deleting file 'build-circuitplayground_express/frozen_mpy.c'
make: *** Waiting for unfinished jobs....
@fading solstice you need to build mpy-cross explicitly. You're using a previously built version that's old. Just cd mpy-cross;make
ok
we should probably fix it so that it rebuilds automatically; there was a reason once upon a time...
yep, that worked!
@tulip sleet or @slender iron After building and loading CPS .uf2 onto a CPX board. the number of byte left on the drive is super low. 10K byte free. Do i need a new bootloader for CPX board?
@fading solstice do you mean in CIRCUITPY? That size is not affected by the size of the .uf2.
or do you mean the size left as reported by the build process
Yes the CIRCUITPY: drive has total byte of 47k and 10K left free. i thought the drive used to be bigger
For 3.0, we're not yet using the SPI flash chip on the CPX. We have to write the code to do that. So for now, the 256k flash is divided into 192k for the firmware and 64k for the filesystem. That's how it is on Gemma/Trinket M0, Feather M0 basic, etc.
(boards without SPI flash)
ok, thanks
@glad hazel Did you get sorted with your audio recording? I have a slightly modified version of the CircuitPython code that Dan linked from GitHub that works to record a few seconds of sound and play it back using the Circuit Playground Express. I don't know whether this would help or not - you may have already found a solution to your need.
I was punished for my impatience by a summons to jury duty.
@tulip sleet Is there any magic to be done to test i2c for M4? I built master and created new adafruit_bus_device and adafruit_register .mpys - so far i2c.scan() is not fiinding anthing. ```>>> import board
import digitalio
import busio
import time
i2c = busio.I2C(board.SCL, board.SDA)
i2c.scan()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: Function requires lock.
i2c.try_lock()
True
i2c.scan()
[]
this was on
Adafruit CircuitPython 3.0.0-alpha.0-1151-g9060df5 on 2017-11-07; Metro M4 Express with samd51j19
@solar whale no that's exactly how I tested. Let me try again with an M4. The default I2C freq is 400kHz, not 100 KHz. I was testing with an SHT31 humidity sensor and with the accelerometer on the CPX.
i did try both
I need to go off for a bit - be back in an hour or so - no rush - just though I't try some tests.
I don't have a BMP280 - should get one, since it's so popular. I have to leave in 5 mins also, back about 8:30pm
i will try once
>>> import busio
>>> i2c = busio.I2C(board.SCL, board.SDA)
>>> i2c.try_lock()
True
>>> i2c.scan()
[68]
>>>
68 ix 0x44, the SHT31
I don't have many other I2C devices except output-only ones like HTK1633, etc.
I hookedi up a mcp9008and it sees it!```>>> import board
import digitalio
import busio
import time
i2c = busio.I2C(board.SCL, board.SDA)
i2c.try_lock()
True
i2c.scan()
[24]
i'll test more devices - and check my wires!
Try i2c = busio.I2C(board.SCL, board.SDA, frequency=100000) if you think it might be too fast. I don't know what the BMP280 is spec'd for, but if it worked before on 2.x, it's probably OK.
ttyl
thanks - will do
Cool cool! I've added a bin link to the guide here: https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-detailed-install#flashing-with-bossac
What version of OSX are you on?
This makes it different from the bootloaders and Arduino.
This is part of the fix for #324.