#circuitpython-dev

1 messages ยท Page 180 of 1

tidal kiln
#

@modest atlas something like this?

NUMBERS = (23, 42, 3.14)
count = 0

while True:
    if buttonA.value:
        time.sleep(.2)
        count += 1
        count = count if count<len(NUMBERS) else 0
    elif buttonB.value:
        time.sleep(.2)
        count -= 1
        count = count if count>0 else len(NUMBERS)-1
    print(NUMBERS[count])
solar whale
#

๐Ÿ‘‹

raven canopy
#

Yep. Back to work for me... Laters.

prime flower
#

you might want to do button instead of switch for the variable

idle owl
#

We chose switch so it's not confusing when using the CPX.

#

It's technically a switch.

prime flower
#

ah ok, had me looking for the switch import from cpx board

idle owl
#

@prime flower Yeah this one was discussed with Limor before finalisation. We went with generalising it as much as possible

prime flower
#

np - was just strange to me for a few secs, but the avg user isnt going to go hunting for a switch import (shrug)

idle owl
#

But I did notice an errant "button", so I fixed that.

modest atlas
#

@tidal kiln thats it ```import time
import board
from digitalio import DigitalInOut, Direction, Pull

buttonA = DigitalInOut(board.BUTTON_A)
buttonA.direction = Direction.INPUT
buttonA.pull = Pull.DOWN

buttonB = DigitalInOut(board.BUTTON_B)
buttonB.direction = Direction.INPUT
buttonB.pull = Pull.DOWN

NUMBERS = (0,1, 2, 3)
count = 0
print(count)
while True:
if buttonA.value:
time.sleep(.2)
count += 1
count = count if count<len(NUMBERS) else 0
print(NUMBERS[count])
elif buttonB.value:
time.sleep(.2)
count -= 1
count = count if count>0 else len(NUMBERS)-1
print(NUMBERS[count])
```

prime flower
idle owl
#

Nice!!

raven canopy
#

@bronze geyser I peeked at your sleep repo real quick on my phone. I'm not sure that setting the NVIC PRIMASK to the pin is going to work. You need to set the EIC external interrupts to the pin, so that the INTFLAG is generated. I'll fork the repo and submit a PR with some rough code.

manic glacierBOT
#

I checked the sizes without and with this change:

master:
   text	   data	    bss	    dec	    hex	filename
 208680	   1196	 174168	 384044	  5dc2c	build-pca10056-s140/firmware.elf

i2c branch:
   text	   data	    bss	    dec	    hex	filename
 210360	   1196	 174220	 385776	  5e2f0	build-pca10056-s140/firmware.elf

So yeah, the change does increase the flash usage by 1.64K and we have to keep that in mind. On the bright side, I noticed that a few flags that can lower the size ...

bronze geyser
#

@raven canopy THANK YOU. re: PRIMASK .... when I do a __get_PRIMASK() a 0 (clear) is returned, so this makes me think (as I think Dan mentioned) interrupts are enabled to go to the CPU...then it is on to the EIC. When I look at the SAMD21 datasheet....The SAMD21 datasheet (section 20.6.2.1) says the steps to do this are:
The EIC must be initialized in the following order:

  1. Enable CLK_EIC_APB
  2. If edge detection or filtering is required, GCLK_EIC must be enabled
  3. Write the EIC configuration registers (EVCTRL, WAKEUP, CONFIGy)
  4. Enable the EIC
#

(and fully realizing I am clueless - I apologize) this makes me : 1) not worry bout enabling CLK_EIC_APB cuz table 15-1 tells me it's enabled (mind you - somewhere else in the doc i seem to remember something about telling to leave a clock on...?) i'm not using filter and - i don't think i'm detecting an edge when all I am doing is detecting a logical HIGH... SO what i think i'm not doing right is writing to the EIC config registers. I'm trying to figure what to write in these registers....

stuck elbow
#

was there a meeting today?

#

is there a recording?

modest atlas
#

@stuck elbow yes, yes

solar whale
#

@stuck elbow yes and It was recorded.

stuck elbow
#

sorry I couldn't make it, I have a competing meeting every second week

solar whale
#

Scott will try to put out 3.0 RC1 this week

#

fixes to one-wire and ESP8266

stuck elbow
#

oh, I'd better hurry if I want the improvements to _stage to make it then

timber mango
#

https://github.com/wa1tnr/m0_sleep

My m0 sleep respository is now on github.

Still haven't coded the sleep part yet. ;) Just the pushbutton switch interrupt (which will wake the MCU).

stuck elbow
#

nice, I will need that if I ever make that clock

timber mango
#

It already works (goes to sleep as evinced by the pilot light going on on the USB battery) but the code has to be introduced through successive small patches to the framework. ;)

#

It also shuts down USB and I don't know how to recover from that gracefully.

bronze geyser
#

@timber mango = i like the calls to pips(). I keep thinking of Gladys Knight....re: sleeping and USB...it has been my experience that i can't use USB when using sleep mode.

stuck elbow
#

I will be happy to just do a restart right after wakeup

#

or, come to think of it, just never sleep when usb is connected -- because I have plenty of power then

timber mango
#

Hi HD I'm pretty sure I know why the USB goes to sleep. I think I can sleep it without shutting down USB (but where's the power savings there?)

stuck elbow
#

the question is, can you disable it for sleep and re-enable afterwards

timber mango
#

Right.

#
 $ cat -n pm.h | egrep SLEEP | tail -5 | sed 3q
    88  #define PM_SLEEP_IDLE_CPU           (PM_SLEEP_IDLE_CPU_Val         << PM_SLEEP_IDLE_Pos)
    89  #define PM_SLEEP_IDLE_AHB           (PM_SLEEP_IDLE_AHB_Val         << PM_SLEEP_IDLE_Pos)
    90  #define PM_SLEEP_IDLE_APB           (PM_SLEEP_IDLE_APB_Val         << PM_SLEEP_IDLE_Pos)
#

I'm using code relating to the APB clock domain now.

#
 $ cat -n trial_aa.ino | egrep APB
    98      87  #define   PM_SLEEP_IDLE_APB_Val           0x2ul
    99              // < \brief (PM_SLEEP) The CPU, AHB and APB clock domains are stopped
   101   $ cat -n pm.h | egrep PM_SLEEP_IDLE_APB | filtered
   102      90  #define PM_SLEEP_IDLE_APB  (PM_SLEEP_IDLE_APB_Val  << PM_SLEEP_IDLE_Pos)
   111      PM->SLEEP.reg |= PM_SLEEP_IDLE_APB;
#

(those double line numbers are comments that have their own private line numbers .. hehe)

#

This is the part I haven't integrated, still thinking it over:

110     SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; // system.h#L380
111     PM->SLEEP.reg |= PM_SLEEP_IDLE_APB;
manic glacierBOT
tidal kiln
#

โฌ† @tulip sleet onewire fix looks good!

tulip sleet
#

great, glad you had at least one more device to test!

slender iron
wraith tiger
#

I forgot to pop by before the meeting to say I was going to miss it. I'll be traveling this week to and from a funeral. I installed a couple of linux-on-android apps on a chromebook to try to do a little more hacking on uflash (and maybe more) while in the air and at the airport.

timber mango
#

:: hat off ::

manic glacierBOT
tidal kiln
#

anybody got an ADS1115 for testing?

manic glacierBOT
#

The documentation for ustruct.unpack_from(fmt, data, offset=0) shows the offset argument as being optional, with a default value: http://docs.micropython.org/en/latest/pyboard/library/ustruct.html?highlight=unpack_from#ustruct.unpack_from. This is the same as in CPython. But you can't name the arg:

This code in adafruit_register/i2c_struct_array.py throws TypeError: function does not take keyword arguments:

https://github.com/adafruit/Adafruit_CircuitPython_Register/blob/f91a08d7fab...

tidal kiln
manic glacierBOT
timber mango
#

@bronze geyser my github now has code that puts the machine to sleep. ๐Ÿ’ค

raven canopy
#

coincidence. i was just about to push my proposed changes.

#

sadly, it will be untested since i'm not sure how it is being included into the firmware build. ๐Ÿ˜„

#

oh wait...i just saw that the .py is importing the C code. I guess i could test it.

idle owl
#

Oooh.... almost most typed into the wrong window just now. There is no reason to inform anyone here of my hunger status, but I nearly did. ๐Ÿ˜„

ruby lake
#

I like food ๐Ÿ˜‰

raven canopy
#

@idle owl ๐Ÿ˜† that is why i end up with the occasional vagrant ssh in here. it's like getting a song stuck in your head for me though, so i have to hit send.

tidal kiln
#

are nested context managers allowed?

raven canopy
#

as long as they're not on the same object, i wouldn't see why not. now, pythonic? ๐Ÿคท

tidal kiln
#

same object. probably means i'm just coding wrong...

raven canopy
#

yeah, i can't see how that would work. but, i'm no whiz-kid, so i would wait for a second opinion. ๐Ÿ˜„

tidal kiln
#

i tried shoe horning something inside an existing context manager. wasn't happy. just need to step back and refactor what's going on...

raven canopy
manic glacierBOT
scarlet fjord
#

is it safe to rename the USB device that shows up on my PC? And/or is there any way to rename the Feather M0 device in device manager?
Just curious. Thinking about branding/etc ๐Ÿ˜›

ruby lake
#

hooray, I have m4 featherz

scarlet fjord
#

jealous ๐Ÿ˜ฎ
whatcha gonna make? ๐Ÿ˜„

cunning crypt
#

Synths, of course.

#

And not the Fallout kind.

ruby lake
#

@scarlet fjord Module playground v2

#

v1 was a 10HP module,

#

v2 will be somewhat wider

scarlet fjord
#

oooooooooh

inland maple
#

like the signature image on the panel ๐Ÿ‘

red dock
#

Hi

#

Really new to this. New to python, new to circuit python, used to do java, C#, etc. Question, I'm trying to install CircuitPython Build Tools. How do I do this?

tulip sleet
red dock
#

I'm trying to make a py and mpy

#

*into a

raven canopy
red dock
#

@raven canopy this makes me think I'm making some small mental error

raven canopy
#

how so?

red dock
#

I have installed circuitpython and am writing code for my trinket MO

#

so now I have this library for the TSL2561 Lux Sensor that comes with a .py library

#

I want to make this a .mpy before I put it on my trinket because the storage space is small

raven canopy
#

ahhh..ok. if you download the bundle, they are already converted to .mpy. what version of circuitpython are you running?

raven canopy
#

nvm. i forgot that both 2.x and 3.x are built for each release...and thanks @tidal kiln for the link! (beat me to it)

red dock
#

so I got 2.3.1

raven canopy
#

@red dock note: you won't be able to fit the entire bundle on the Trinket. just drag over the applicable library/folder.

red dock
#

but the Lux Sensor Library isn't part of the bundle

tidal kiln
raven canopy
red dock
#

right, that's the driver library, so I want to convert that adafruit_tsl2561.py file to a .mpy before I put it on my trinket

tidal kiln
#

download this:

#

it will have .mpy version of tsl2561 in it

red dock
#

@tidal kiln @raven canopy Ok, wow, so the mpy was in the bundle the whole time, just didn't see it.

raven canopy
#

they're slippery little suckers. ๐Ÿ˜†

red dock
#

So, now, part two is

tidal kiln
#

it's a big bundle, and growing...

red dock
#

I still need to convert a py to an mpy because I've actually begun editing the original driver

#

so I saw the mpy-cross-2.2.0 in that link you sent

tidal kiln
#

yep. get whichever version for your os.

red dock
#

right, so I installed it

#

silly question, how do I use it?

tidal kiln
#

which one did you download?

red dock
#

windows

tidal kiln
#

in general, go to command line and type:

mpy-cross-2.2.0-windows foo.py
#

but you may need to setup paths for it to run from any locations

red dock
#

where foo is my file name

tidal kiln
#

and then replace foo.py with what.. yes

red dock
#

bing again!

#

@tidal kiln Ok, I'm missing something

#

is mpy-cross-2.2.0-windows a command?

tidal kiln
#

should be, you may need cd to the directory where it's located to run it

red dock
#

OSError: 2 (no such directory) is the most promising thing I've generated

#

Got it!!!!!!!!!!!!!!!!!!!!!!! @tidal kiln @raven canopy

#

The file you're compiling has to be in the same directory as your mpy-cross.exe

#

And you can change the exe filename to just mpy-cross and save yourself the headache of typing in 2.2.0

#

@tidal kiln @raven canopy
Thank you both so much!!!!!!!!! You can't imagine how long I was looking for that simple solution, but to give you a hint, I have like 40 tabs open, and I installed CookieCutter. I should have asked for help earlier, but I guess you don't learn to ask the fishermen till you're starving at sea.

raven canopy
#

@slender iron I'm going ahead and working the open PR for the MCP230xx library. Its been open since May, and its easy, so... Interestingly enough, the lib imports digitalio, busdevice, and micropython.const, but the automock wasn't set and it passed Travis. Should I go ahead and set the automock?

#

@red dock you're welcome. we all learn how we learn; don't discount your drive to understand on your own (i'm the same way).

raven canopy
#

@slender iron @idle owl also researching automation for the CoC updates for the libraries. looking at git patch/am, and thinking adabot (or a sister) can run it since she already knows how to run through each lib.

manic glacierBOT
#

Otherwise, couldn't we create an abstraction layer so that both nrf and atsamd ports could use the same stack? That would make it easier to add new ports in the future and would remove duplicated code. I also worked a bit with the USB middleware in STM32 so maybe I could be of some help.

Hi @arturo182 ... the goal here using tinyusb is actually to get away from vendor specific USB stacks so that we can use ONE liberally licensed and vendor-neutral stack across various MCU targets and per...

timber mango
indigo wedge
plucky flint
#

NFR is the chipset used in the BBC micro:bit.

#

....and Calliope and Sino:bit et al

stuck elbow
#

micro:bit is nrf51, this is nrf52 though

#

more powerful

#

runs CircuitPython :)

tidal kiln
#

didn't someone here make an adapter for feather wings to metro?

solar whale
#

@pastel panther made one -- looking for the link

tidal kiln
#

@solar whale thanks. share it in #general-tech. take a look - ATMakers just posted something similar. ๐Ÿ˜€

idle owl
#

@solar whale Did you find it? I also have the link.

#

@raven canopy Nice!

tulip sleet
solar whale
idle owl
#

Ok keen

solar whale
#

I have a spare "kit" for this if anyone needs one.

tidal kiln
#

@tulip sleet is there a trinket m0 build with onewire fix?

ruby lake
#

tries to read the samd51 docs.

tidal kiln
tulip sleet
#

i don't understand the sorting algorithm on that page, if there is one at all

tidal kiln
#

@tulip sleet is that specific build needed, or is it also in all the newer ones as well?

prime flower
#

lil' blinka + io leek

tulip sleet
#

@tidal kiln it's the latest 3.x build. master hasn't had those changes merged in yet. so a newer build than that date might be master. I found the commit by going to github, choosing the 3.x branch, and looking at the top commit in the list of commits

tidal kiln
tulip sleet
#

that's exactly the symptom! scott hopes to make a 3.0.0-rc.1 this week, which will incorporate the fix

long trail
#

That build works for the DS18B20. Thanks gentlemen.

tidal kiln
#

@long trail excellent! thanks for the update.

#

ok, next question - does adafruit_register support 16 bit registers?

fading solstice
tidal kiln
#

ah, so use i2c_struct instead of i2c_bits

tulip sleet
#

One thing I realized lately is that if I have a clone of Adafruit_CircuitPython_Bundle, I can search through all the existing libraries very easily to find examples of various things, which libraries do or don't do x, etc. Pretty handy.

fading solstice
#

yup

#

@blissful thicket I would like to help with the library conversion for Adafruit_Blinka. Is there a person other than tannewt that i should work with? Pick a library, coordinate conversion, etc

bronze geyser
#

@raven canopy Thank you for the PR w/ EIC stuff. I'm in process resolving compiler errors. One is mymodule.c:30:34: error: invalid type argument of '->' (have 'int') gpio_set_pin_function(&PIN_PA19->pin, GPIO_PIN_FUNCTION_A); . I was able to resolve mcu_pin_obj_t by including #include "shared-bindings/microcontroller/Pin.h however this got me looking at mcu_pin_obj_t ```typedef struct {
mp_obj_base_t base;
qstr name;
uint8_t pin;
bool has_extint:1;
uint8_t extint_channel:7;
bool has_touch:1;
uint8_t touch_y_line:7; // 0 - 15. Assumed to be Y channel.
uint8_t adc_input[NUM_ADC_PER_PIN];
pin_timer_t timer[NUM_TIMERS_PER_PIN];
pin_sercom_t sercom[NUM_SERCOMS_PER_PIN];
} mcu_pin_obj_t;

#

hmm..crap...sorry...i was grabbing the wrong Pin.h....

#

the one i was grabbing was for the microcontroller python module.

raven canopy
#

@bronze geyser hmm. the uint8 vs uint32 shouldn't be the issue. We don't have over 256 pins. It could be header related, but it may also be pointer related. I'm heading home in a few and can look.

bronze geyser
#

@raven canopy (as always Thank you.). There are several compiler issues. I think for you they are obvious and easy. For me at my skill level they take much more time...which is ok.

#

@raven canopy there is also history within the circuitpython build that i don't have. This of course is ok too, but blinds me to whatever context exists.

tulip sleet
#

@bronze geyser There are a lot of different representations of pins. Sometimes it's just a pin number, sometimes it's a 32-bit pin mask plus a "port" (A, B, or C), corresponding to PAxx, PBxx, PCxx (PCxx show up in the 100-pin pkgs and up). There are 32 pins per port. In general, the hal routines call the hpl routines which call the hri routines, if you want to wade through ASF4

bronze geyser
#

@tulip sleet Thank you Dan. At my knowledge level, it is as if I am Alice falling down the rabbit hole when it comes to pins. I hear what you are saying. I just need a bit of time to look at/absorb. My "knee jerk" to ASF4 reminds me of when King Saul gave David a suit of armor to wear when fighting Goliath. David was uncomfortable and stuck to his trusty sling. It just seems like ASF4 is focused on working "well" in Windows, not Mac. But these are my biases.

slender iron
#

@fading solstice I think you are stuck with me ๐Ÿ˜›

fading solstice
#

@slender iron just looking to spread the load off you

slender iron
#

Thanks! Want to add a pypi check to adabot so we know what has been done?

#

@tulip sleet have all the reviews you need for crickit?

idle owl
#

@tulip sleet if you have pip3 installed, and then you create a venv, does the venv have pip3 installed because it was already installed globally?

tulip sleet
#

@slender iron I am about to submit a PR for 3.x to update the frozen libraries. That's the last thing. Had to make pypi deploy happy. Just checking it now.

fading solstice
#

@slender iron Do you want me to start that?

tulip sleet
#

@idle owl - hmm I think so, but I'm not sure

idle owl
#

ok.

slender iron
#

@tulip sleet ok awesome

#

@fading solstice yes please

tulip sleet
#

how long does it take to show up in pypi ? I pushed a 2.0.1 and I think it's fine,

slender iron
#

not long

tulip sleet
#

but only 1.0.2 is visible right now

fading solstice
#

@slender iron will do

slender iron
#

did travis say iti worked?

#

@fading solstice thanks!

tulip sleet
#

ah, pypi has the latest version now, so all ok!

#

took about 5 mins

#

motor library is not yet pypi-ified, so I left it out of dependencies (like you did)

#

@slender iron RTD examples look squashed on Chrome but not firefox. Weird, but probably not our problem:

idle owl
#

That explains why I wasn't seeing what you were saying when you mentioned that before

tulip sleet
#

were you looking at chrome on MacOS? Maybe it's a linux chrome thing

idle owl
#

No I wasn't looking at chrome at all.

#

I was looking at Firefox.

#

link me, I'll check chrome

idle owl
#

Chrome ^^

tulip sleet
#

so maybe some chrome font thing only on linux. I haven't checked windows

idle owl
#

Oh and apparently if you're on Ubuntu, install pip, create a venv, pip will be there, but it won't be the most recent version. So you have to --upgrade inside the venv.

tulip sleet
#

on ubuntu, use pip3, because pip use python2.7

idle owl
#

Right I know. I guess I meant that.

tulip sleet
#

which ubuntu version?

idle owl
#

Not sure. And also, if you create the venv specifically with python3, does pip == pip3 inside the venv?

#

(A friend of mine checked for me, that's how I know. So I don't know what version he's running.)

tulip sleet
#

inside the venv, do cat \which pip`` and look at the first line

#

oh, if you don't have it, let me try it. how did you create the venv and I'll do exactly the same thign

idle owl
#

python3.5 -m venv foo

tulip sleet
#

ok, on ubuntu 18.04, there is no python3.5 by default. I'll use 3.6

idle owl
#

Ok

#

Should work the same with python3 -m venv foo too I guess.

tulip sleet
#

ok, inside the venv, pip is pip3:

(foo) halbert@salmonx:~$ cat `which pip`
#!/home/halbert/foo/bin/python3.6

# -*- coding: utf-8 -*-
import re
import sys

from pip import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
(foo) halbert@salmonx:~$ 
#

the #! line gives it away

idle owl
#

yah ok

tulip sleet
#

but without the venv, it's:

halbert@salmonx:~$ more /usr/bin/pip
#!/usr/bin/python
# GENERATED BY DEBIAN

import sys
...
idle owl
#

Right.

#

It defaults to being pip3 in the venv because it was created with Python3

tulip sleet
#
halbert@salmonx:~$ python --version
Python 2.7.15rc1
idle owl
#

I assume?

tidal kiln
#

@dan Halbert#1614 surprised you didnt pipe that into more ๐Ÿ˜€

tulip sleet
#

of course:

halbert@salmonx:~$ source foo/bin/activate
(foo) halbert@salmonx:~$ python --version
Python 3.6.5
#

i used more the first time, but after that I knew the file was really short, so I could type one less character ๐Ÿ˜ƒ ๐Ÿ˜ƒ

idle owl
#

๐Ÿ˜„

tulip sleet
#

but now that I have explained it, i have typed many more characters

idle owl
#

Does anyone have the latest Mu installed on Windows?

tulip sleet
#

tnx!

slender iron
#

looking

manic glacierBOT
tulip sleet
#

great! close to rc.1?

opaque patrol
#

Yay, my feather m4 is here

idle owl
#

Question from elsewhere: do we have access to F_CPU in CircuitPython?

lofty topaz
#

@opaque patrol Me too. Just got home from school and the Adafruit order was waiting for me at the door. Got my CricKit as well. It's a beautiful day. ๐Ÿ˜ƒ

slender iron
#

@tulip sleet I think we can release it today. I'll do it after getting the heap PR to you

tulip sleet
idle owl
#

Huh. Good work finding that out. At least we know.

manic glacierBOT
raven canopy
#

@bronze geyser I think I bumbled the pin references. Try changing all of the instances of &PIN_PA19 to &pin_PA19.

tulip sleet
#

@slender iron PR looks great! It's failing on nrf builds, though

rigid path
#

Getting frustrated here... I am playing with an M0 Adalogger Feather. I run it iwith Arduino to test and I can read/write to the SD card just fine. I am looking for some sample circuitpython code to learn more about using the board. Everything I find is for the Adalogger featherwing not the feather. Anyone know where I can find some sample code to learn from?

tulip sleet
#

@rigid path The Adalogger Feather does not have an extra SPI flash chip, so it has a very small CIRCUITPY (64kB), same as Feather M0 Basic, Trinket M0, and Gemma M0. It may be a squeeze to get the libraries you need onto the board. It also doesn't use the UF2 bootloader, so you need to use bossac to load CircuitPython. You load a .bin instead of a .uf2. https://learn.adafruit.com/welcome-to-circuitpython/non-uf2-installation

raven canopy
solar whale
rigid path
#

@tulip sleet - I understand the limitations. I have the circuitpython base loaded just fine. I use it with a Ultimate GPS Featherwing just fine and I want to send the data to the sd card on the logger.

tulip sleet
#

there are a couple of extra pin defns for the on-board SD card: board.SD_CS, and board.SD_CD.

bronze geyser
#

@raven canopy pin_PA19.pin seems right... Note in hal_gpio.h the first param passed in is a const uint8_t ...ONE THING THOUGH...seems to me gpio_set_pin_function(const uint32_t pin ..... should be using const uint8_t pin like everyone else?

tulip sleet
#

@rigid path so if you just use the SD card library as sommersoft suggests and change a few pin choices I think you should be OK.

rigid path
#

OK, I will keep playing. Thanks.

raven canopy
#

@bronze geyser function arguments are received as constants so that the function can't change it (if that is desired). i think it would be extraneous to cast it to a constant, but I could be wrong. also, and this may be the difference that i don't understand, each pin is declared as extern const mcu_pin_obj_t pin_Pxxx. clear as mud? ๐Ÿ˜„

manic glacierBOT
bronze geyser
#

@raven canopy thank you. Right now it is not clear to me. This is because I lack the knowledge. I'll keep struggling - um - i mean trying...

raven canopy
#

my C knowledge is what i would call "barely intermediate", so i hesitate to offer advice on "here is how C works". almost every day brings a "ohhh...that's why" for me in C land.

idle owl
#

@slender iron M4 doesn't have cap touch right?

bronze geyser
#

@raven canopy I'm laughing my butt off because I want to stay at a python level. but then, there's junk i want to do...so down rabbit holes..

slender iron
#

its not supported

idle owl
#

Ok. Going through the essentials guide is why I ask.

raven canopy
#

@bronze geyser and you're doing great, from my perspective. ARM, C, ASF, and CircuitPython are not the easiest things to understand on many levels. a very large web. but, that's what makes this project so great; its modularity makes so much possible.

idle owl
#

Oh so touchio isn't even available. Ok

tulip sleet
#

@slender iron we're going out to eat with my in-laws. I approved the PR now; you can merge when Travis is happy.

slender iron
#

kk have a good dinner

manic glacierBOT
raven canopy
#

MCP230xx is getting some love. ๐Ÿ˜†

idle owl
#

I'm guessing that's set to go once Travis builds? Want me to review?

slender iron
#

@indigo wedge keeping me honest

#

@idle owl please do

prime flower
#

whoo

manic glacierBOT
idle owl
#

merging ninja

#

I was keeping an eye on it even ๐Ÿ˜„

manic glacierBOT
#
[adafruit/circuitpython] New tag created: 3\.0\.0\-rc\.1
slender iron
#

๐Ÿ˜ƒ

bronze geyser
#

@raven canopy i updated mymodule.c ... added missing include files (i think i got the right ones)....changed pin name to either PIN_PA19 (in the case of gpio_set_pin_function or pin_PA19.<variable value>, e.g.: pin_PA19.extint_channel (in the case of functions like turn_on_cpu_interrupt ...compiles just peachy. Unfortunately, code.py doesn't wake up from __WFI()... so I Think i'm calling the functions now correctly...but perhaps there is a challenge with the EIC workflow...i will need to understand that piece of your modifications tomorrow. wanted to ask if the changes i did make make sense to you? https://github.com/BitKnitting/wakey_circuitpython/blob/master/src/mymodule.c thank you.

manic glacierBOT
raven canopy
#

@bronze geyser they make sense, yes. the -> vs . is a "pointer vs variable" thing...i think. C pointers, and left vs right value usage still baffle me a little. on gpio_set_pin_function i would try pin_PA19.pin. note: if you wish to contribute this to CircuitPython (I hope you do), you'll need to set the function up to receive a pin argument from the Python side, and then work with a pointer approach (which is how i transposed most of my suggestions anyway).

also, it may be running into the issue that the oscillator for CLK_EIC_APB being turned off, even though the datasheet says it will remain on. i didn't include setting the ONDEMAND/RUNSTDBY registers since the datasheet made assurances that it would remain on; the sheet isn't always accurate. ๐Ÿ˜„

idle owl
#

Hmm. I loaded the CP storage code onto the M4, reset it, now the DotStar is solid blue, and the red LED is flashing which is in code.py. And CIRCUITPY won't mount.

manic glacierBOT
idle owl
#

It's not in /dev/tty.* either.

idle owl
#

Do we have erasers for the ItsyBitsy M4?

bronze geyser
#

@raven canopy you did this: // Set the PMUX pin funciton to "EIC" gpio_set_pin_function(PIN_PA19, GPIO_PIN_FUNCTION_A); how did you know GPIO_PIN_FUNCTION_A sets PMUX to "EIC"?

manic glacierBOT
idle owl
#

@tulip sleet Is there a flash eraser for the Itsy M4?

tulip sleet
#

i haven't built one. not sure why you're stuck

idle owl
#

Because I kinda broke one. With code from the essentials guide.

tulip sleet
#

can you get to the repl at all?

idle owl
#

Nope.

tulip sleet
idle owl
#

It's possible. There's also a boot.py in play.

tulip sleet
#

i'll try to make an eraser, back in a little bit

idle owl
#

Ok.

#

Thank you ๐Ÿ˜Š

tulip sleet
idle owl
#

@tulip sleet Ok trying it now

#

Pulsing green happiness.

#

And it mounted

tulip sleet
#

or just fix up those files, no need to erase

idle owl
#

so I can simply delete the offending files or edit them and keep going back and forth. ๐Ÿ˜†

tulip sleet
#

yah!

idle owl
#

Because I need to figure out why it didn't work.

#

Not entirely sure what about that made it hang at startup, but...

tulip sleet
#

the cpx will boot into safe mode if you hold down one or both buttons, right? We were talking about how to do the same thing on boards without extra buttons. Not sure how to indicate to the board to do that. we could check pins to be high or low, but they might be hardwired that way for other reasons.

idle owl
#

I have never tried that. I had no idea that was a thing.

tulip sleet
#

scott put it in, maybe it should be documented in a cpx guide ๐Ÿ˜ƒ

idle owl
#

Could ground something to force it, but that limits using that pin grounded for actual purposes, right?

#

Ok the code works correctly now.

tulip sleet
#

right, but it just occurs to me that we could check the SWCLK/SWDIO pins, which are never used for anything except debugging. Like maybe if they were both high or something. I should see whether the chip will start up normally in that case.

idle owl
#

Oh nice.

#

Thank you, Dan!

#

Weird, my Feather M4s came with 4 sets of headers.

tulip sleet
#

same here, I was thinking of telling Limor. Just a bagging mistake

idle owl
#

Confused me into thinking they were Itsys and that I had no idea where the Feathers were.

#

Since Itsys come with 3. And the board was hiding behind the print on the bag.

tulip sleet
#

I bought a bunch of metalized anti-static bags from Digi-Key because I can't reuse the new bags

idle owl
#

Good idea. Not sure what my plan is here with all this stuff without bags now.

tulip sleet
#

so now I have big bags with two metros or many itsy's, etc in one bag

idle owl
#

We have HDD sized ones, but that's overkill for tiny boards.

#

thinking back to all the pink bags I tossed because I had so many ๐Ÿ˜„

tulip sleet
idle owl
#

Says the link is bad.

manic glacierBOT
tulip sleet
#

getting labels that stick hasn't been easy, though. I am using paint pens some of the time

manic glacierBOT
idle owl
#

Ah.

#

(Found them and got lost looking at them)

#

I explain Digi-Key as if you went to a supermarket that not only carried everything you could possibly need, they carry literally thousands different versions of it. So you want pickles? 7649 choices. Bread? 4380.

manic glacierBOT
idle owl
#

I started keeping the pink ones but it was too late. We keep too much around here anyway so that's why I started tossing them in the first place. Guess this is one thing I should have given a pass.

#

How many of these boards are static susceptible anyway?

#

I zapped a couple like a lightning wizard a few times during the winter. Caused my monitor to flicker, boards rebooted into safe mode... it was pretty spectacular. I colored in the Adafruit on one of them because I thought I'd messed it up. Nope. Seemed fine.

tulip sleet
#

i kept them in the original bags in the black shipping boxes, but I didn't have enough bags after that. they are all static susceptible if it's strong enough. There is a lot of discussion about the pink-style bags. They don't protect against zapping from say, shuffling on the carpet and then zapping through the bag. They do protect from the bags shuffling around and creating their own charges. The metalized ones are much more protective. I spent too long trying to decide what to buy.

idle owl
#

๐Ÿ˜„ Nah I'd have put in all the research too. I was searching for the plastic ones just now. Seems I'll abandon that search.

tulip sleet
#

the pink (or blue) ones are hard to find. you need a specialty place. The better ones are cheap enough

idle owl
#

Because come fall and winter, I'm apparently a static wizard. I grounded the rail on my keyboard tray so I could ground myself, and it still somehow went through the electrical system and caused the monitor reboot, board ejection, safe mode, all of it.

tulip sleet
#

for some reason we don't have a big static problem, not sure why, even though it's carpeted everywhere

inland maple
#

i think it's usually a dry air situation

tulip sleet
idle owl
#

Could have gotten another humidifier. Never got around to it.

inland maple
#

but I think to be a wizard you would have to control your powers ๐Ÿค”

idle owl
#

Sorcerer then?

#

ยฏ_(ใƒ„)_/ยฏ

tulip sleet
#

we have forced hot water heating, not forced hot air

idle owl
#

Ah ok

raven canopy
#

i have a grip of old digikey/mouser bags that i've kept. cause ya never know when you'll need 150 of them. right? ๐Ÿ˜„

#

@bronze geyser the functions are listed in the datasheet in the IO Multiplexing & Considerations section (para 7, pg 33)

#

@bronze geyser also, do you have debugging capabilities, with a JLink?
EDIT: i suggested sending me a compiled version, but that won't work with my setup (.elf file needs the other object files; that's a large upload)

manic glacierBOT
#

Sometimes bad code in boot.py or code.py can leave the board in a stuck state with no access to CIRCUITPY or the REPL.

Some ways to get out of this state:

  1. Erase SPI flash: we have some .uf2's that do this. Have to build separately for many different boards, and not sure about QSPI support.
  2. Load a special CircuitPython .uf2 that never runs boot.py or code.py. Again, need to build these, but perhaps friendlier to use, and allows repair of the bad files.
  3. Could we detect tr...
manic glacierBOT
solar whale
#

@slender iron @tulip sleet Congratations on RC1.Ill be offine few a few days.. Will try to break it this weekend ;-)

tulip sleet
#

I needed another nightlight for some houseguests so took a Gemma M0, I wrote this into code.py

while True:
    pass
#

and plugged it into a 5V adapter.

pastel panther
#

and...

#

it BURST INTO FLAMES

tulip sleet
#

no, it just stopped blinking ๐Ÿ˜ƒ

pastel panther
#

sounds about right.

meager fog
plucky flint
manic glacierBOT
#

It will only show up msc, only read by now, added the write mode later. At least it runs, it may break other nrf52 board though, will clean it up & organize later. Only pca10056 got tested for now, and you need to use the v1.0 the pdk won't work since the pre-production silicion is full of usb hw bug.

manic glacierBOT
tulip sleet
#

@meager fog tnx for suggestion re #2938. i was avoiding plastic boxes that weren't antistatic for storing boards, but maybe I'm being too cautious?

manic glacierBOT
#

I started reading last night, and got my bearings with pyexec_nnn_repl. Started to debug this morning, but I can't seem to reproduce this. Tried a current build (local between alpha.6 and rc.0), as well as alpha.2 and alpha.3 (both before this issue was created).

Write a file with an infinite loop but no input calls.

I was assuming this is refers to a code.py/main.py, and simply put in:

while True:
    pass

Is that what you meant to reproduce, or do you mean writing _...

tulip sleet
#

@slender iron et al just tried update toolchain gcc-arm-none-eabi-7-2018-q2-update, which updates gcc from 7.2.1 to 7.3.1. It came out only last week. The spurious lto-type-mismatch warnings are gone -- I'm glad that fix got into gcc7. Gemma M0 firmware with 7.2.1 compiler has 356 bytes free. With newer 7.3.1 compiler, has 460 bytes free.

Ubuntu users: this update is not in the ppa yet: https://launchpad.net/~team-gcc-arm-embedded/+archive/ubuntu/ppa

gcc8 is out but there is no official toolchain build for it.

indigo wedge
#

Living life on the bleeding edge.

tulip sleet
#

we did well updating from gcc6 to gcc7. i expect this update will not give much trouble. gcc8 may be another story.

indigo wedge
#

why is that, any breakage in that one?

bronze geyser
#

@raven canopy first, thank you for your help. i went through another round of waking up via external interrupt... https://github.com/BitKnitting/wakey_circuitpython/blob/master/src/mymodule.c hmmm...i think i've got the steps right. what i'm a tad "not there" on is setting up the GCLK (first for the oscillator, then clock for EIC...)...i have code that i took from RTC_Zero.cpp (Arduino lib). But sadly, still not working. I did put the .uf2 file here: https://github.com/BitKnitting/wakey_circuitpython/tree/master/firmware

tulip sleet
#

@indigo wedge - no, it's just a big leap. I imagine the ARM folks are working on it, but they probably have to fix some things. But their releases seem to be pretty good

indigo wedge
#

Cool, keep us updated ๐Ÿ˜ƒ

manic glacierBOT
#

Op, so the feather nrf52840 will come with an external flash ? I thought we will only use 256/512KB internal flash. @ladyada could you tell me the flash part number, I will try to see if I could find it locally, and hook it up to pca10056 to test with.

raven canopy
#

@bronze geyser turn_on_external_interrupt_controller handles turning on the GCLK: https://github.com/adafruit/samd-peripherals/blob/master/samd/samd21/external_interrupts.c#L33 The configuration for the clocks are all done in asf4_conf/samd21/hpl_gclk_config.h. instead of relying on turn_on_external_interrupt_controller, you could hand-roll it in your code and set the control bits before enabling the PM/EIC (let me read the sheet to see if the config is "enable-protected"; that drives whether it has to be configed before it is enabled or not).

And again, with the NVIC_xxIRQ, i don't think using a pin ("PIN_PA19") has the result you're wanting. These are the only IRQns available that I know of (for the SAMD21G18, at least): https://github.com/adafruit/asf4/blob/master/samd21/include/samd21g18a.h#L91 @tulip sleet, is that correct?

manic glacierBOT
#

nrf52832 does not have usb at all, it has its own internal flash but accessing via command (via serial) which is not user friendly. I think the main nrf52 board featuring CP should be nrf52840, and we don't have to support all the nrf52840 like the dongle, only the upcoming feather 52840 and pca10056 would be good enough.

tulip sleet
#

@bronze geyser @raven canopy Take a look at the user of external interrupts in ports/atmel-samd/rotaryio/IncrementalEncoder.c, which calls an API wrapper Scott wrote in ports/atmel-samd/peripherals/samd/external_interrupts.c

raven canopy
#

@tulip sleet yeah, i had grabbed most of the needed ones from there (but, from pulsein...its my goto ๐Ÿ˜„)

manic glacierBOT
#

:man_facepalming: you're right with the nRF52832, not sure what I was thinking. As for the nRF52840, I'm a bit unsure, I got a few PCA10059s the other day and wanted to add them as a board to CP because I think they are are good candidate to get started with CP on nRF, they are only $11 on Mouser and they can be plugged directly into the PC, which means you could just plug, start Mu and have BLE in CP running in minutes.

bronze geyser
#

@raven canopy = oh right, thank you. NVIC_EnableIRQ(EIC_IRQn); // enable RTC interrupt NVIC_SetPriority(EIC_IRQn, 0x00);

raven canopy
#

@bronze geyser right. however, its extraneous to put the NVIC_EnableIRQ, since turn_on_cpu_interrupt already calls it.

bronze geyser
#

@raven canopy ...okidok. Thank you (yet again)

raven canopy
#

no worries. i'm about to upload a version (easier than PRing) that should enable the RUNSTDBY (it also doesn't include your RTC_Zero stuff; i don't think it is helping since it largely just sets up a different GCLKGEN [2] before setting the EIC to GCLKGEN0)

raven canopy
bronze geyser
#

@raven canopy thank you...however the build i have doesn't include hri/hri_glck_d21.h ...

raven canopy
#

hmmm. its in ASF4...

bronze geyser
#

@raven canopy ach. yah. sorry.

raven canopy
#

it may already be included somewhere else. i see hri calls elsewhere that don't include the header.

manic glacierBOT
#

yes, there's good reason to support both internal flash and QSPI. lets start with internal flash since it will always work no matter what board design. we can then update later to qspi :)
by the way the chip we use is Gigadevice GD25Q16CTIGR
we use it for SAMD boards, so we already have code for supporting various QSPI chips and their control commands - you don't have to write that part :)

bronze geyser
#

@raven canopy . Hmm..not working. I'm going to yoga then I will bumble a bit some more. i appreciate your help. thank yoiu.

marble hornet
#

I have an eagle cad question?

stuck elbow
#

shoot

marble hornet
#

i recently updated to 9.10 and whenever i save a file eagle creates .job and .pro files next to my project files. there are tens of them clogging up my project file. it is aggravating. do you know what this is

#

i have run auto router a couple of time. (not for actual routing, just to see variations for inspiration)

fading solstice
#

@slender iron I will be chencking for existence of setup.py in every library. what should i be validating inside setup.py

fading solstice
#

@slender iron Are you looking for a list of libraries that match the conversion requirements? is there a way that i can check if a libary can be actually install via pypi?

slender iron
#

they should all be adafruit-circuitpython-<something>

manic glacierBOT
manic glacierBOT
#

@tannewt at 52c0fc421b241ae581b9c69f45cfd5bd50289ed6 we switched to building (3.0 and newer) on travis with a specific sdk build. However, I didn't update documentation to mention anything about this. I'm not sure what to write that will best help user-developers. Hopefully, CP doesn't fall that far behind the tip of esp-open-sdk (there have been no commits there since the release I made on 2016-06-10), in which case the existing documentation is perfectly adequate. I'm fine if you want t...

indigo wedge
#

@solar whale Found why the SDcard doesn't work on the feather, working on a fix ๐Ÿ˜ƒ

fading solstice
#

@slender iron I now understand enough about pypi compaitble libraries to tell you which ones are available for down load from pypi. I can also tell you which ones have some sort of pypi work done, but have not made it yet. I can also can you which libraries need more work to be pypi compatiable. What you like to see when you run adabot?

idle owl
#

@fading solstice He's likely out for the day but he'll be back tomorrow.

idle owl
tulip sleet
#

@idle owl looks good! Why A1/A2 change for PWMOut on piezo?

idle owl
#

You mean between the M4 and M0 boards?

tulip sleet
#

yeah, is there a single Ax pin you can use for both?

idle owl
#

I feel like that was Limor suggestion. Maybe there's not with Trinket and Gemma involved or something. I'm not sure. I have which pins have PWM in the guide, hold on, checking.

#

Looks like Gemma is the culprit there.

#

Because the at least the Feather and Itsy don't have it on A1, Gemma doesn't have an A3.

#

And the M4s don't have it on A2.

#

So it was fine until we added the M4. We had a common pin with the M0s alone.

#

So that would be why. It was an easy place to split it, along M0/M4 line. Also M4s don't have it on A3 either.

tulip sleet
#

๐Ÿ™ƒ that's weird; I was hoping just the Gemma was the odd board out, because "all but Gemma is easier"

idle owl
#

Yeah, it would be. But there really isn't an easy way to do it.

#

This guide is full of "For this board, comment this out, for this other one comment this other thing" etc

tulip sleet
#

and there are no Dx pins on CPX, so they can't be used. OK, that's fine.

idle owl
#

There should be now....

tulip sleet
#

I like the cleanup in get _unique_pins().

idle owl
#

I added them anyway, I thought it was merged, but wasn't backadded to 2.x

tulip sleet
#

yeah, but they're not labeled on the board, so it's already confusing

idle owl
#

Ah yes. ok.

#

They're at least in board for the CPX now.

tulip sleet
#

merged!

idle owl
#

Thank you!

#

And thank Roy for the cleanup in get_unique_pins(). I had help with that one. He saved me HOURS of staring at it wondering why it was failing. I didn't put together that SPI, I2C and UART in board weren't pins.

#

Not sure I ever would have figured it out without help.

#

Next I wait for the code in the guide to update, and then do it all again with the Feather M4. Wasn't thinking enough to do them in tandem. ๐Ÿ˜„

tulip sleet
#

being a solo practitioner is fortunately not necessary

idle owl
#

Truth.

tulip sleet
#

is there a draft feather m4 guide yet?

idle owl
#

Not that I'm aware of.

#

But it's at least worth getting it integrated with the Essentials guide. I can't do the Fritzings yet though. Limor's going to get the parts in when she can, Feather and Itsy M4 aren't in there yet.

#

But I figured update the code now. Fritzings can come later.

tulip sleet
#

i have stayed out of the loop on this, are there any hanging issues? (I guess not.)

idle owl
#

Nope, it was ready but I fixed up the last issue late on Friday so Scott didn't merge it immediately.

tulip sleet
#

bingo

idle owl
#

Beautiful, thank you.

#

That is rather satisfying.

tulip sleet
#

it's been a long time

idle owl
#

It was a lot of work ๐Ÿ˜ƒ

#

I'm going to wait until I talk to Scott to change it in #code-of-conduct. I assume we'll delete what's there and send this one, but I want to be certain.

indigo wedge
#

The esp port of CP is somewhat maintained, right? Does it have the machine and pyb modules or is it CPfied?

tulip sleet
#

esp32 or esp8266?

indigo wedge
#

I see there's only the port for esp8266

#

but i'm unsure about the status cause i've been only using nrf

tulip sleet
#

it's a "regular" port, gets somewhat less love than the atmel-samd port, but it has all the standard CPy IO modules, etc.

#

people use it regularly

indigo wedge
#

but does it also still have the machine modules, cause i see that's what the webthing uses

#

guess I'll just have to try and see tomorrow

tulip sleet
#

i'll doublecheck right now

indigo wedge
#

hmm, it looks like the only supported board is feather_huzzah ?

tulip sleet
#

no pyb, yes machine, but we don't test the machine-based I/O classes.

#

yes, we only have ESP8266 on Feather and on a breakout board. It can be run on the breakout board, though not sure whether the pins line up, etc.

indigo wedge
#

ok, I'll look into it, would be neat to develop a webthing in python on the esp

tulip sleet
#

jerryn and some other folks have used it a lot, so you will find support here easily

indigo wedge
#

cool, thanks ๐Ÿ˜ƒ

meager fog
#

just put a bunch more feather m4's in stock

idle owl
#

nice ๐Ÿ˜ƒ

indigo wedge
#

Am I doing something wrong or are these boards not good enough for this lib?

Adafruit CircuitPython 3.0.0-rc.1 on 2018-07-03; Adafruit CircuitPlayground Express with samd21g18
>>> import adafruit_thermal_printer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_thermal_printer/__init__.py", line 1, in <module>
MemoryError: memory allocation failed, allocating 718 bytes
Adafruit CircuitPython 3.0.0-rc.0-52-g321daa352-dirty on 2018-07-04; Bluefruit nRF52 Feather with NRF52832
>>> import adafruit_thermal_printer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "adafruit_thermal_printer/__init__.py", line 1, in <module>
MemoryError: memory allocation failed, allocating 464 bytes
#

@raven canopy any ideas?

raven canopy
#

raw .py is 25KB. .mpy is 10KB...

#

also imports time and micropython.const, but those shouldn't be too big. are you importing thermal printer first? might be a large heap block thing... @indigo wedge

solar whale
#

@indigo wedge FYI I routinely run CP in both the esp8266 huzzah feather and breakout board using the same default build.

manic glacierBOT
manic glacierBOT
#

ah thanks, I will try to look up its datasheet. Here is how I wil try to implement nrf52840 will power up and detect the present of qspi, if it is then msc will expose that, otherwise, expose the internal flash.

Note: the vid/pid may/may not be different internal & external flash (just to conform the OS), I am not sure about the serial, but the volume ID may need to be different as well. We will see.

manic glacierBOT
#

@arturo182 usb cdc replace jlink for Serial REPL with 1745e20391a23bf65ff17a0515b803e97fa6970e . I also saw I did a really bad job implementing the uart driver for nrf52 back then. Are you working on nrfx uart driver like those with spi or i2c ? If not, I will try to do it as well, I think we will slowly remove those in hal/hal_*** since it is micropython specific hal layer right ?

manic glacierBOT
#

lets do what we did for samd21, its much easier for you! ๐Ÿ˜
https://github.com/adafruit/circuitpython/tree/master/ports/atmel-samd/boards
we define in the board file whether the variant has flash ornot...see the subfolders above!

for example, trinket m0 is internal flash, but itsybitsy m0 express has external flash

we can make new variants for every kind of board, if the spi flash fails it should not continue and try to use internal flash...i think it will be extra work for a rare case...

manic glacierBOT
manic glacierBOT
#

@ladyada yeah, mcu should only try to detect external flash if it is enabled with macro. Though, it is still useful if we support both since user can just hot plugged or wire extra QSPI Wing without to re-flash cp. The flash size on nrf52 is too big, that we could just fit everything in :D . I should focus on the basic to get it running first though.

BTW I think we should move here to discuss more :)
https://github.com/adafruit/circuitpython/issues/956#issuecomment-402610195

indigo wedge
#

it sounds tempting, since those chips are around $1

manic glacierBOT
manic glacierBOT
stiff mural
#

Is there a Windows driver for ItsyBitsy M4? It seems that current Adafruit driver installer is pre-M4.

stuck elbow
#

what do you mean?

stiff mural
#

I can't open serial port on Windows 7.

#

And I have unknown device "CircuitPython CDC control" in Device Manager.

stuck elbow
#

that .inf file is a text file, you could look inside and adapt it

stiff mural
#

What .inf file do you mean? I can't see any on device.

manic glacierBOT
stiff mural
#

OK, I used a driver for a Metro M4 express, which was in last bundle and that works. But nevertheless ItsyBitsy M4 should be added there as well.

manic glacierBOT
manic glacierBOT
#

Since CPy is <256KB on the M0 boards, we just split the 1MB of the SAMD51J20 in half when we started development, since we had so much room. But I don't think we ever intended to ship sAMD51 boards that didn't have SPI flash. At some point we may make very tiny SAMD51 boards (eg. Gemma or Trinket size) without SPI flash, but the added cost of SPI flash is very low, and it doesn't take much board real estate, so this is not necessarily likely.

For nrf, the SoftDevice is a big addition above...

bronze geyser
#

it is exciting to hear about CP on rasp pi. ? is there away to integrate in the flask and peewee libraries? or is the conceptual model the rasp pi w/ cp is not for combining sensor/motor/etc. stuff w/ db, web stuff?

inland maple
#

actually I think for boards that can handle it, the idea is to bring the power of sensor/motor/etc to anything that python can normally do, including db/web stuff/display/networking

raven canopy
#

The way I've understood the Adafruit_Blinka project, it is so you can use CircuitPython code and libraries on a RPi without changing any code.

#

Basically a wrapper library. My supposition is that the short term goal is for use with the upcoming RPi Crickit.

timber birch
#

have a issue with my circuit python and crickit, when ever i copy over the cpx file i get a new window with no space, this occurs no matter how many times i reset my cricit python

raven canopy
#

@timber birch which board are you using with the Crickit?

timber birch
#

circuit python express

stuck elbow
#

you mean circuit playground express

timber birch
#

yes sorry

raven canopy
#

Oof. Just saw you said CPX. Sorry. Which version of the firmware?

timber birch
#

how do i determine that?

raven canopy
#

The files downloaded from the release page have the version in the filename. Or, you can see it in the REPL or boot_out.txt.

timber birch
#

3.0.0-rc.0-9-gbf9981e8d-dirty

raven canopy
#

So you're building your own?

timber birch
#

sorry?

#

when ever i pop that file on the cpx it gives me a new drive with less space. if i reset the cpx only get index current and info

raven canopy
#

The CPX Crickit firmware has the Crickit libraries "frozen" into it, so it takes up more space than the normal firmware. When you see "index, current, and info", is the drive named "PLAYBOOT" (or at least something "BOOT"; I forget the name on CPX)? That would indicate you're in the bootloader mode of the board.

timber birch
#

@raven canopy ok, so when i drop the 4k crickit file it reloads the cpx and list 98k free of 1.97 meg so i cannot put any wav files onto the cpx. so I am not sure how anyone can do anything extra with the cpx like play a basic wav file

#

@raven canopy i cannot see anything in my windows explorer that would take up 1 meg of space on my cpx

raven canopy
#

Do you have anything else saved on the board? Library bundle, perhaps? I'm pretty sure there should be space, since Adafruit has done a few Crickit projects that have wav files.

timber birch
#

no, even when i select everything and delete it it still only shows 98k left

#

there is a hidden system folder but it only shows 2k

raven canopy
timber birch
#

@raven canopy thanks, ill give it a try

#

@raven canopy as soon as i did it refreshed and showed the crickit-cpx-2018-07-04.uf2 and the boot_out.txt and not the new file

#

ok sorry tried deleted old files first and redropped still shows only .98k free

raven canopy
#

Hmm. I'm at work, so I can't verify/troubleshoot anything further at the moment. Someone may pop in and be able to help. If not, I can try some things after work.

timber birch
#

ok great thanks for all your help @raven canopy

#

ok found the solution, removed cpx from cricik and followed directions on formatting cpx on the following link

manic glacierBOT
bronze geyser
#

@raven canopy - so i stepped back and wrote up everything i think needs to happen before putting the m0 in standby mode...the thing is, i'm still not able to get out of standby mode....the reason i morphed the code a tad is based on the comments I made here: https://github.com/BitKnitting/wakey_circuitpython/wiki/Lower-Power-to-the-m0 am i missing something (OK, other than a brain)? Thank you.

astral vessel
#

I couldn't find a circuitpython library that would handle MQTT via an esp module connected to a trinket m0 via uart, so I've been writing one. The esp is running the AT firmware and the tricket sends it commands via uart to create a TCP connection and then active wifi bridge mode at which point an MQTT connection is established with adafruit.io. It still needs a good bit of work, but I'm excited that I just got a basic proof of concept working for two-way communication.

https://photos.app.goo.gl/QBREFyNS4EMJWKD79

manic glacierBOT
slender iron
#

@indigo wedge I'd suggest using a samd for usb with esp

#

@fading solstice knowing if its on pypi is the most important

manic glacierBOT
#

Ah thanks, yeah, that Arduino repo is I am referring to. Indeed, it is not really good well written in oop sense. The gap, gatt central is all considered singleton and most of the code is written with an spining head of mine lol. Though it does some basic work for user convenience. I am not so sure how it could be linked and used with cp either. If it is too troublesome, we may need to redo it for cp.

meager fog
#

@timber birch did you figure it out?

#

really odd your CPX had no space!

manic glacierBOT
#

That is definitely something I was planning to look into after I was done with the nrfx driver stuff (soon). I wanted to refactor the existing ble driver and work on expanding it and making it more accessible. I know @tannewt was saying that we would like to not create a new API for BLE but instead take inspiration/copy an existing one so users can easily take their BLE code for CP and run it on a RPi or similar. I know the bluepy API that the current driver is trying to emulate (although it'...

timber birch
#

@meager fog I did, I ran the format your cpx the t/s guide

manic glacierBOT
timber birch
#

@@meager fog just having issues with running running the code. I can use your examples but when I used the new make it move guide it doesn't work

meager fog
#

whats the error you get?

#

we're like in the very middle of updating the guides ๐Ÿ˜ƒ

timber birch
#

Nothing moves

#

I am doing the make servos move now in python but it doesn't go, I press the buttons and nothing happens, I even copy the code directly

#

No error messages nothing happens, not even in repel don't even see any print messages either ie button a pressed

meager fog
#

hmm

#

are you using Mu?

timber birch
#

Yes

meager fog
#

can y ou paste whats in the serial console?

timber birch
#

Nothing shows up

meager fog
#

like a screenshot

#

what happens if you hit control C or control D?

timber birch
#

Oh don't konw

#

Sorry just stepped away from my computer, going to pick up my car.

#

Just in phone discord at the moment

manic glacierBOT
timber birch
#

@meager fog I'll try when I get back

meager fog
#

@timber birch np! just ping when u return

timber birch
#

Will do

prime flower
astral vessel
#

@prime flower That code is meant to run ON an esp, mine runs on a trinket and communicates with the esp over UART. In my setup there is zero circuitpython code running on the esp

prime flower
#

Ah!, ok

astral vessel
#

If you know of any code doing what I'm doing I'd definitely like to take a look

timber birch
meager fog
#

ooh can you take a pic of your crickit?

#

with the CPX

#

on it

timber birch
#

working

#

@meager fog also this is a first run Crickit if it makes a difference

meager fog
#

is the Crickit ON?

timber birch
#

yes

meager fog
#

a tiny hard to tell the switch

#

also check the screws are on tight

timber birch
#

@meager fog ok thanks there a screw loose ,

meager fog
#

im gonna add a troubleshooting page

#

this has come up!

timber birch
#

@meager fog thanks for the help.

meager fog
#

workin' now?

timber birch
#

it is

meager fog
#

yay! ok let me know if you bump into anything else

timber birch
#

sure thanks

raven canopy
#

@timber birch glad it's working now. thanks for the assist @meager fog!!

dreamy orbit
#

anyone on that help me with a MO express featherboard and dc motor/stepper controller featherwing?

timber birch
#

ok new issue. I am running the "Use a Standard Servo Now" and when you use button b a second time it does not revert back to 0(zero) and then if you hit button A it tries to move 180 again

dreamy orbit
#

i have not programmed before...

idle owl
manic glacierBOT
raven canopy
#

@timber birch over the last week or so, there has been some discussion and testing on servo limits and interaction. can't recall if "the fix is in" on it, though.

#

@slender iron i still can't replicate characters spilling over in REPL. however, i have managed to get the board to lock up when sending 120 characters ("asdf" repeated in succession 30 times). further debug required... ๐Ÿ˜„

#

also, i've tried this in both PuTTY and Mu, with Metro M4 and a Trinket.

slender iron
#

@raven canopy huh. we can close for now then

raven canopy
#

k. were you getting the error on a specific board?

slender iron
#

no error, just weird behavior. not sure what board

raven canopy
#

yeah, error was not the word i meant to use. ๐Ÿ˜‰

dreamy orbit
#

@idle owl i have look through it but still trying to figure out how to do it....will need to use SPDT toggle switch to set which direction to spin using digital input and a potentiometer on a analog input for adjusting the speed of the spin.

idle owl
#

Ok. Feel free to ask any questions as you go in this channel or in #help-with-projects. Someone will be able to help you along your way.

dreamy orbit
#

and will have to write a code.py from scratch?

idle owl
#

You can try to modify one of the examples, but if you're doing something that isn't covered in the example, then yes you'll likely have to write something from scratch.

manic glacierBOT
cunning crypt
#

256MB of memory. You could do... a lot.

umbral dagger
#

It's flash, not RAM. Maybe if you wanted to execute an ML 'net.

#

I.e. storing the 'net in flash

cunning crypt
#

Oh, yeah

umbral dagger
#

Unsure about interfacing it.

#

No reason CP couldn;t be made to use it.

cunning crypt
#

Most of the pins are not even used. It looks like it's the same WinBond style interface as all the other ones

umbral dagger
#

That I can see at a glance.

cunning crypt
#

Just... more memory means more circuitry, means larger package, which means more pins.

raven canopy
#

SAMD51 Datasheet QSPI Features:

Serial Memory Mode:
โ€“ 32-bit Address mode (default is 24-bit address) to support Serial Flash memories larger than 128 Mbit
umbral dagger
#

Yeah

#

it's space for the memory array

raven canopy
#

RAM would still bottleneck it though, right?

umbral dagger
#

You'd have to drive the IO ;lines for read/write, and control the other control signals.

#

If you didn't need full speed access, you could essentially bitbang it.

cunning crypt
#

I'm pretty sure you wouldn't need full speed access if you're putting a filesystem THAT large on a microcontroller

raven canopy
#

more importantly, what would you name it? nnn_M4_Haxpresso? nnn_M4_Super_Duper_Extra_Express?

cunning crypt
#

nnn_M4_WHY

#

This is definitely one of the Jurassic Park thought experiments though: Seeing if you can, not worrying about whether you should.

#

Oh, wow. There's a 128MB one, that's... significantly smaller in physical size

#

@raven canopy Your response above says the M4 has to be special configured for >128MBit flash, right? So a 128MBit one should be compatible with a M0? Now that I've gone through the absurd sizes, I want to get realistic on design ideas.

raven canopy
#

@cunning crypt well, that was QSPI specific, so M0 gets no love on that front. ๐Ÿ˜ฆ

cunning crypt
#

I want to design a DigiBadge that's CircuitPython powered. Plug in, be able to put images right on the drive. And I want to be able to have reasonable amounts of images plus CP code

#

@raven canopy M0 doesn't use QSPI, just "Standard" SPI Flash, right?

raven canopy
#

yessir. to my knowledge at least. (QSPI isn't listed in the sheet)

cunning crypt
#

Looks like that's how it's wired

#

According to the schematic

timber birch
#

@raven canopy thanks, if you get a chance can you see if you can get the servo demo in make it move to work repeatedly (press a then b then a then b , which should be 180,0 180, 0 180, 0) on the last 180 it fails, I even reduced the degree to 165 from 180 still no change, it servo starts stuttering on the second button b press. I am Running a SG51r servo

manic glacierBOT
#

I've been languishing on dialing in the accuracy on this for a few weeks now. Figured I'd put up this spreadsheet in the event someone can see a pattern/calibration vector that I don't. The SAMD21 performs quite accurately, but the SAMD51 has some issues that I can't quite work out or pin down. Because of this, and because I think it is a good idea from a user standpoint anyway, I will be adding a calibration property. Just have to figure what "calibrated" is. :smile:

Notes:

  • When captur...
raven canopy
#

@timber birch i can probably do that. i have a feather crickit, not a CPX one, but that shouldn't cause any differences. gotta get some food first though. tummy is unhappy.

cunning crypt
#

Since I'm curious, @slender iron do you know (Or know where to find) what the max size for usable SPI Flash on a M0/SAMD21 is?

slender iron
#

@cunning crypt I don't know of a limit

cunning crypt
#

Well then. I guess I'm going to have to figure it out

#

Or, more accurately, figure out what the largest one I can get is, and see if I can get it to work

raven canopy
#

awaits evil laugh gif

timber birch
#

@raven canopy food is very good

umbral dagger
#

I have food en route

cunning crypt
#

I just consumed food

slender iron
#

@raven canopy did you ever try my suggestion of counting with the TC?

timber birch
#

PS I also borrowed from @twin mica and @fast wharf project I did earlier

#

Thanks all for the help!!!

manic glacierBOT
manic glacierBOT
raven canopy
#

@timber birch nice work! did you still want/need me to verify the servo stuff? actually, I will anyway; good to know if we need to address it further.

#

@slender iron yes, i tried COUNT for a couple weeks. for some unknown reason, the unsigned subtraction of the current value from the last value (to determine time elapsed) would never get past MP_OBJ_NEW_SMALL_INT and always returned 1 (the OR'd value).

meager fog
#

@timber birch awesome demo! ๐Ÿ˜ƒ

slender iron
#

hrm is the code somewhere?

raven canopy
#

i still have the COUNT version; just tabled it and went back to the PPW version since it worked. well, except for the current M4 problem. ๐Ÿ˜„

#

i'll create another branch for it on my fork.

slender iron
#

kk

timber birch
#

Thanks

meager fog
#

@cunning crypt you can use a microSD card to add up to 32GB of space. that's the cheapest and esaiest way!

#

@timber birch did you still have that bug

#

or did you figure it out

#

from above ^^

cunning crypt
#

@meager fog Well, yes. I'm looking into absurdity for the sake of looking into absurdity

#

Because I can, more than because I should.

meager fog
#

there's not hardware interface for parallel flash, so it wouldnt be super fast - but you could do it if you had enough pins

#

but its a lot of pins!

timber birch
#

@@meager fog , last I checked I could get the button example to work, first a, b button press worked, but the second time, on the servo stuttered, wouldnt reset to zero

cunning crypt
#

So I shouldn't pin my hopes and dreams on it?

raven canopy
#

depends on the pins available? ๐Ÿ˜„

meager fog
#

@timber birch makecode or python?

raven canopy
timber birch
#

@meager fog python i

meager fog
#

lemme tr

#

can you hang out for a minute

#

wrapping up a giude

timber birch
#

Sure

raven canopy
#

@slender iron also, it's not fully buildable in that state since i haven't updated since peripherals/samd was broken out.

slender iron
#

np. just wanna look it over

raven canopy
#

as do i... ๐Ÿ˜†

umbral dagger
#

@cunning crypt You could drive it with a 23017

cunning crypt
#

@umbral dagger True, but I always want to be as little of a programemer as I can manage. So something that I can do like you did - Just drop it in, change some values, build a new version - and have it work fairly easily is ideal

raven canopy
#

@slender iron hold on...forgot to commit

#

๐Ÿคฆ

umbral dagger
#

@cunning crypt Yeah, but that was just using a bigger SPI flash ship. And the Trink hack was just adding a SPI flash chip. The challenge there was figuring out the SERCOM stuff to get a second SPI interface out to some pins.

raven canopy
#

@slender iron updated...

cunning crypt
#

All I really want is a bigger SPI flash chip. Not even QSPI, since I'll likely be using the SAMD21 initially.

umbral dagger
#

On Express boards with a SOIC flash chip, you can just replace it with a bigger one, and fiddle the board spec files.

cunning crypt
#

The plan is to more-or-less copy an Express board, add my own stuff, and then fiddle the board spec files.

umbral dagger
#

I have no idea how big SPI flash gets.

cunning crypt
#

I've seen 128MB

umbral dagger
#

Oooohhhhh!

cunning crypt
meager fog
#

@cunning crypt i know for sure theres 32MB SPI flash thats only a few $

#

and you can definitely get it working

#

@timber birch ok back

#

i made a troubleshooting page

cunning crypt
#

Oooooh. That'd be fantastic for people to put lots of images on

#

The one I linked is 128MB and... huh, only $3.89 - I'll have to poke into that one, too.

meager fog
#

yah for sure

#

at some point it does get cheaper to go with microSD

slender iron
#

@raven canopy where do you set the top? should it be cpten?

scarlet fjord
#

I was having a look at the tutorial for reading from the SPI flash using arduino; is it possible to read from the flash with circuitpython?
for instance, if i have a few files each containing different versions of the same array, and i want to only have one array in memory at once but i want to be able to swap between the arrays, id have to read from the flash somehow, right?
<- very newb ๐Ÿ˜…

cunning crypt
#

@scarlet fjord It's absolutely possible, and a lot easier from what I recall.

timber birch
#

@meager fog I'll try updating the firmware

meager fog
#

@scarlet fjord yah ive got a guide about that

cunning crypt
#

With CP, the thumb drive you see when putting stuff on it? That's the same thing CP sees

raven canopy
#

@slender iron i was under the impression that on COUNT, TOP == MAX. When not doing the subtraction, and just watching the freq, it lined up with that impression (wrapped at 65535)

cunning crypt
#

Which is why I'm so interested in putting CP on my DigiBadges

scarlet fjord
#

๐Ÿ˜ฎ

timber birch
#

@meager fog I'm going to have to put this on hold since we are getting a big thunderstorm here and I don't want to corrupt my Crickit.

meager fog
#

ok im gonna try it anyways

#

maybe i typod'

timber birch
#

I'll definitely go through the t/s guide and five it awirl

slender iron
#

@raven canopy I think thats default

scarlet fjord
#

very interesting, thanks!
whats the latency like when reading from flash?

meager fog
#

not sure :/

#

maybe a few millis?

#

depends how much you're reading , if its buffered/cache

scarlet fjord
#

alright, thanks
i might make a few tests this weekend before my Feather M4 E shows up and use the currenttime thingamawhatsit to do some latency benchmarks ๐Ÿ˜›

meager fog
#

kool have fun ๐Ÿ˜ƒ

#

@timber birch hmm it seems to work fine for me

#

you're doign this right?

#
from adafruit_circuitplayground.express import cpx
from adafruit_crickit import crickit

# Create one servo on seesaw servo port #1
servo = crickit.servo_1

while True:
    if cpx.button_a:
        print("Button A pressed!")
        servo.angle = 180      # about 180 degrees

    if cpx.button_b:
        print("Button B pressed!")
        servo.angle = 0        # about 0 degrees
timber birch
#

@meager fog thanks again for all the support today,

meager fog
#

that could definitely be a problem

#

ok try again l8r!

timber birch
#

Huh was missing the pic, yeah I was copying that right to Mu and was having the issue but I will check again tomorrow

ruby atlas
#

Man, where did my free time go?

raven canopy
#

The free-time bandits are on the loose... ๐Ÿ‘บ

ruby atlas
#

they really are.

#

I will have to pack a box full of adafruit stuff for my summer vacation the last 2 weeks of July.

raven canopy
#

i was thinking about that earlier too. i'll be out for a week+ at the end of the month. but...no laptop. though i have been window shopping for a few months. โŒจ

ruby atlas
#

I bought myself a 2015 rMBP 15" (used) on Friday. I gave up on the newer ones after the 13" I got to keep after the last job keyboard gave up twice in 2 weeks, and it was also painfully slow.

#

There's tons of good used laptop choices that are still fast available.

#

This thing is faster than the 2017/2018 model fastest 15" rMBP by a few points.

raven canopy
#

I've settled on a Dell Inspiron 7000, 13". I like the "new" 14"..but 1 USBA and 1 USBC port. that's it...

ruby atlas
#

I don't really want to manage Linux on the desktop so I use a Mac. Spent too long doing that in the 90s and early 2000s.

#

Plus Mac = Adobe and Microsoft tools native.

#

Don't have to boot a Windows VM to run 'em.

raven canopy
#

yeah, that was kind of why I "left" linux back then too. but, it has gotten better. i plan on dual booting the lappie. eventually may go back to dual booting the desktop too. ๐Ÿคท

umbral dagger
#

I run an iMac for media & fusion360. Everythinbg else is on a custom built Ubuntu workstation.

#

I moved to that (from just the iMac) over a year ago. Best computing decision I've made in a long time.

#

I moved from Linux to OSX in 2005.

#

Though dabbled with some debian/raspbian over the years.

#

I got my Unix start with SunOS (BSD) back in the late 80s.

inland maple
#

I have a macbook air that i use for casual stuff, and work supplied a macbook pro that i use when i need to actually get work done

#

and a RPi 3 for playing with python

raven canopy
#

the Pi/Raspbian was my "re-introduction" to linux. took some time getting used to CLI again. ๐Ÿ˜„

umbral dagger
#

That's what I liked about OSX: you could mostly pretend it was a "real" Unix. Most of my time was spent in Emacs or Terminal.

#

But every now & then the airbags would go off and get in my way.

inland maple
#

i've been pretty happy with os x, but i keep my windows desktop around

umbral dagger
#

I'm totally windows free.

#

I've been tempted at times for gaming, but I just limit myself to what'll run on MacOS and my DS.

inland maple
#

if i had to go to a single computer I would totally ditch windows but going to a single computer is an absurd idea to me now

#

though i seriously considered ditching them when they force updated me to windows 10

umbral dagger
#

This is a problem with having discord open on two computers.. I'm in #general-chat on the other one...

manic glacierBOT
manic glacierBOT
manic glacierBOT
manic glacierBOT
mental marsh
#

Hi, how do i get an itsybitsy M4 express to talk and control a sound fx 16mb board? Also which pins do i need to connect for circuitpython to address the triggers on the fx board?

stuck elbow
#

you can use any of the gpio pins in place of the buttons for the triggers

#

you can also control it over UART

#

then you only need the tx and rx pins

manic glacierBOT
#

My english fails me too from time to time and it's the only language I
speak. You are way ahead of me. :-)

On Thu, Jul 5, 2018 at 10:36 PM arturo182 notifications@github.com wrote:

Noooo, my English has failed me ๐Ÿ˜ญ

โ€”
You are receiving this because your review was requested.

Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/pull/991#issuecomment-402931000,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAD...

idle owl
#

Ok so I have this code that produces a tone and sends it to an audio jack. But it is painfully loud. How do I control volume without having some kind of in-line thing built into the headphones or speakers? ```python
import time
import audioio
import board
import array
import math
import digitalio

Generate one period of sine wav.

length = 8000 // 440
sine_wave = array.array("H", [0] * length)
for i in range(length):
sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * (2 ** 15) + 2 ** 15)

dac = audioio.AudioOut(board.A0)
sine_wave = audioio.RawSample(sine_wave)
dac.play(sine_wave, loop=True)
time.sleep(1)
dac.stop()

#

I tried playing with some of the sine_wave math and, at least with what I did, it didn't work.

#

Oh wait I forgot there was one more place I was going to look.

main meteor
#

The output of math.sin goes from -1 to 1, then it's multiplied (volume) by 2^15, then added to 2^15 to center the values.

idle owl
#

Right, yeah. I'm remembering this now. I wrote up another lib that uses it, that's what I was going to check.

main meteor
#

So you could define a volume factor from 0 to 1, then

#

sine_wave[i] = int(math.sin(math.pi * 2 * i / 18) * factor * (2 ** 15) + 2 ** 15)

#

Or just replace (the first) (2 ** 15) with a smaller number.

idle owl
#

That's what I did in the lib apparently.

#

Even at 0.1 it's still loud enough I don't want to have headphones on when I play it back. I can hear it from 2 feet away from my headphones.

#

But it did work. It's quieter.

main meteor
#

Volume is also non-linear, so 1/10 the voltage will sound about half as loud.

#

Or more accurately, hearing is non-linear, plus power is the square of voltage (ish), so it's really non-linear.

idle owl
#

Fair enough. 0.01 is reasonable. But the click as it initiates is louder than the tone now. I have some ideas about that though. Thank you for your help @main meteor ๐Ÿ˜ƒ

#

Idea failed. Bleh.

main meteor
#

That's annoying. My guesses were "change the midline level as well" (if your speaker doesn't mind a DC bias) and "ramp up to the midline".

#

sine_wave[i] = int((1 + math.sin(math.pi * 2 * i / 18)) * factor * (2 ** 15))

#

Instead of scaling and adding, I rearranged the math slightly to add 1 first, then scale. That way, the midline changes along with the scale.

#

Adding a ramp is a little more effort, but not a lot.

idle owl
#

Ooh nice!

#

Glad I gave up on trying to adapt the functions from my lib to try that line of code. The click isn't as obnoxious anymore.

timber birch
main meteor
#

That looks more like a button/timing problem than a servo problem to me.

timber birch
#

@main meteor that was from the make it move example that i copied directly from the web and that is what i get.

#

@main meteor but the make code and other crickit examples work fine

main meteor
#

I believe you, I just don't wildly like that code (I fought a similar problem with a Micro:bit driving some servos recently).

timber birch
#

@main meteor yeah i just picked up coding again recently (besides some html) and hardware like this is new to me

idle owl
#

It could be an issue with the code. That's not out of the question.

main meteor
#

Testing my guess is easy enough: add import time to the top, and a time.sleep(1) after each time you set the servo angle.

bronze geyser
#

Checking on an assumption. i am using an itsy bitsy m0 express. the boards/itsybitsy_m0_express/pins.c maps D12 (which I assume is the pin marked 12 on the itsy bitsy) to PIN_PA19: { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_PA19) }, is this a correct assumption? thank you.

timber birch
#

@idle owl i thought so too, but it is right from the web site, and @meager fog posted the code last night for me too and that's what i got

idle owl
#

@bronze geyser You are correct.

bronze geyser
#

@idle owl i very much thank you.

manic glacierBOT
idle owl
#

@timber birch Simply because it's on the website doesn't mean it's perfect. However, if that was posted from Ladyada last night, that means she probably tested it first, so that limits that theory. It's still possible that it's a code issue though.

#

I know you already did a bunch of troubleshooting so I don't want to ask you to do a laundry list of things you've already done.

manic glacierBOT
bronze geyser
#

@idle owl then #if defined(PIN_PA19) && !defined(IGNORE_PIN_PA19) PIN(PA19, EXTINT_CHANNEL(3), NO_ADC, NO_TOUCH, SERCOM(1, 3), SERCOM(3, 3), TC(3, 1), TCC(0, 3)); #endif from peripherals/camd/samd21/pins.c says the EXTINT channel is 3, yes?

timber birch
idle owl
#

@bronze geyser That's how I would read it yes, but that one is further outside my understanding.

timber birch
#

that is the code that i ran last night

bronze geyser
#

@idle owl thank you.

main meteor
#

It could be power supply noise or sag issue as well.

idle owl
#

Ok. Did you try putting a time.sleep(1) in it now as a test?

timber birch
#

let me try

idle owl
#

There's a lot of variables in play here, is part of the issue. So many things that could be causing this ๐Ÿ˜„

timber birch
#

thats what i am learning with the learning new hardware

idle owl
#

It's very new. That's a huge variable ๐Ÿ˜ƒ

timber birch
#

Yaaaa that worked @idle owl whew\

bronze geyser
#

@slender iron is my thinking correct? an external interrupt (say on pin_PA19) are only level-detection. AND asynchronous interrupts don't need a GCLK_EIC?

idle owl
#

@main meteor Good call on the time.sleep. @timber birch That's great!

timber birch
#

Love this Discord group, where you can get fast help with your project from experts

idle owl
#

So try tightening up the time.sleep(seconds) so it works for you. You can go as little as 0.01 seconds in there. Any lower than that and it's not really doing anything less than that, we don't have that kind of timing supported.

timber birch
#

its awesome, i didnt think of this and when it worked for everyone else, and you are new you doubt yourself

bronze geyser
#

@merry turretMitchell - i doubt myself when i'm new, middle, or old...

idle owl
#

@timber birch We're all new to something ๐Ÿ˜ƒ

timber birch
#

@bronze geyser ive been doing computer troubleshooting for 30 years and i still have impostors syndrome

main meteor
#

My guess as to what is happening is that the loop is tearing around at high speed, each time checking to see if the button is pressed and when it is it's setting the angle. So the angle gets set repeatedly, very fast, which under the hood is writing a bunch of stuff to PWM and timer registers. I think all that activity is causing the PWM to restart, sending weird pulses to the servo.

timber birch
#

@main meteor that would make sense especially with the repel output

slender iron
#

@bronze geyser I think its configurable

main meteor
#

I'm thinking a better way to write it is to have a variable that remembers the last button pressed, and only changes the servo angle when it gets updated. It's a little harder to read, but should be very responsive and not need any artificial delays.

main meteor
#

While I have a CPX, I don't have the matching Crickit (I have the Feather one), so I can't really try it myself.

manic glacierBOT
bronze geyser
#

@slender iron yah I get that the GCLK is configurable. The challenge in my (lack of) understanding is if i plop the m0 into standby mode, does the EIC need a GCLK? I've been adviced an external interrupt (say 3.3V coming in on D12/PA19) can wake up the m0 from standby without the GCLK_EIC configured to be running in standby mode.

timber birch
#

just and update @main meteor @idle owl if i put a time.sleep(0.1) or a time.sleep(0.5) I still get a extra button pressed in there (i pushed a and it went from 0 to 180 back to 0 again ) this is just an FYI since it does what I wanted and it would fit any example so far. In the future I may try again with different parts

main meteor
#

If you feel like trying untested code, I took a crack at it:

#
from adafruit_circuitplayground.express import cpx
from adafruit_crickit import crickit

# create a servo instance on servo port 1
servo = crickit.servo_1

lastangle = 0
newangle  = 0

while True:
    if cpx.button_a:
        print("Button A pressed!")
        newangle = 180 # about 180 degrees
    
    if cpx.button_b:
        print("Button B pressed!")
        newangle = 0   # about 0 degrees
        
    if newangle != lastangle:
        servo.angle = newangle
        lastangle   = newangle
slender iron
#

@bronze geyser the datasheet says in some modes its not needed

timber birch
#

@main meteor i gave it a wirl but it didn't work for mine, beyond 2 presses

main meteor
#

Ah, well. I wonder what I got wrong.

idle owl
#

@timber birch Yeah the buttons need what's called debouncing. Or a basic state machine. Otherwise they spam the results of the button press.

timber birch
#

i see, and @main meteor the repel shows the presses but no action

#

ok thanks everyone for the help, whew this fun

main meteor
#

You could add print("setting servo to %d" % newangle) in the last if statement

manic glacierBOT
slender iron
#

@tulip sleet does nrf usb work for you?

tulip sleet
#

@slender iron do you mean the CDC USB? It doesn't work on Linux. This is some kind of semi-known problem. It seems to work OK on other OS's.

slender iron
#

I don't see it on mac either

tulip sleet
#

i am talking about via the debug jlink USB port

slender iron
#

ah. I thought native was going

tulip sleet
#

it wasn't quite done a week or so ago - I haven't followed closely enough on this to know. I am a little lost about what's working where

#

i thought that wasn't working yet

slender iron
#

kk

meager fog
#

@timber birch that is really weird, i actually think your servo might be bad

#

just cause, you shouldnt need to debounce ...?

#

i can add a delay to the code tho

#

lemme know what worked best for you

slender iron
#

@tulip sleet my guess is that tinyusb is out of date

timber birch
#

@meager fog I was thinking (after the fact) that I might have a bad servo. But the wait code worked, which is good since I can testt this and other things out

#

@meager fog you ahbe built a great tele of helpful people with a very supportive community thanks so much

tulip sleet
#

@slender iron I am neck deep in Windows drivers at the moment. Hope to come back to the beach in a little while.

meager fog
#

where'd you put the delay, at the end of the loop?

#

yay thanks dan ๐Ÿ˜ƒ you're part of that community too!

timber birch
#

I put the delay after each button press

slender iron
#

@tulip sleet np. we're leaving for the weekend soon

timber birch
meager fog
#

ok can you try this code?

timber birch
#

@meager fog i tried the updated code and still got the error

meager fog
#

really!

#

wow

#

wait, error or stuttering?

timber birch
#

sorry the stutter

meager fog
#

very odd

#

i wonder if your buttons are 'sticky'?

#

ok no biggie, will do what you did

timber birch
#

yeah i think it might be a servo issue

#

@meager fog

meager fog
#

it is but still, servos are low cost and have weirdnesses ๐Ÿ˜„

timber birch
#

@meager fog while True:
if cpx.button_a:
print("Button A pressed!")
servo.angle = 180 # about 180 degrees
time.sleep(1)

#

for both buttons

meager fog
#

what brand/product is that servo?

timber birch
#

Tower pro SG51r

#

micro servo

meager fog
#

is it from adafruit or 'online somewhere'?

timber birch
#

they sell your parts

meager fog
#

kk

#

very odd, will see if others have the same issue

timber birch
#

I have reused this for many projects, so maybe it is running down

tulip sleet
#

if you try it horizontal instead of vertical, does it work better (or if you remove the cardboard)

timber birch
#

@tulip sleet I have done it without cardboard and changed the postion of the servo horn if thats what you mean,

tulip sleet
#

yes, I just mean with less of a load on the servo shaft

timber birch
#

@tulip sleet just tried again, with no card board and then no servo horn, and it still stutters

tulip sleet
#

also try a narrower range of motion, like 20-160 instead of 0-180 and see if it's hitting the end stops or something

timber birch
#

@tulip sleet ok done, i used the 20-160 same issue

#

sorry 20-150

tulip sleet
#

sorry i came in late: is that the only servo you have to test right now?

timber birch
#

yes currently,

#

Over all I got my project to work using a simple servo movement repeat for my hello world with my makey robot,

#

i was trying to get the other code to work with the cpx button press, and @idle owl gave the time.sleep(1) suggestion that got the button presses to work.

#

I'll try to get this to work with another servo at a later date, but i am going on holidays next week

#

Thanks again for all the help, I am doing this as a hobby for now but want to help others with this. I might be volunteering at a local robotics club and wanted to show this off there

meager fog
#

yah! we designed crickit for robot club

manic glacierBOT
meager fog
#

some thing less expensive than mindstorms, and can get started fast!

timber birch
#

and Robots are just cool, I have this one, a cody, and Mbot , a littlebits R2D2 and a keye studio mini tank robot

meager fog
#

and of couse, has audio n neopixel support ๐Ÿ˜ƒ

#

great for creative robots

timber birch
#

the r2d2 and the crickit were the easiest to do

#

I thought I was going crazy with the keyestudio Arduino big learning curve and support forums didn't help

#

@meager fog you and your community put together great documentation and I built @split ocean bumper bot from the live stream his make code minute is great

meager fog
#

those low cost 'amazon' robot kits are really awful .... the documentation is really bad, and it takes a long time to get anything going. and then you only have a rover bot after 6 hrs

timber birch
#

yes thats why I jumped at getting the crickit when it went live, even though i didnt know what id do with it

meager fog
#

๐Ÿ˜ƒ great! keep posting up stuff you come up with, and let us know how the workshop goes

#

we'll have more crickits in stock soon, sold out fast and waitin' for parts!

timber birch
#

will do, i cant wait for the microbit one as well and the Raspberry pi. The school board here is just getting into the Microbit

split ocean
#

yay, glad you built a bumper bot @timber birch !

meager fog
#

@timber birch yep will get microbit out soon, we're still fighting a bit with makecode on that, its an older version of makecode and some things gotta be adjusted :/

#

(of the CPX version)

rigid path
#

Just received my M4 Express feather. Do I treat it just like an M0 when loading circuiypython and coding?

meager fog
#

fj, yep! it already has 3.0 on it

#

but you may want to get the latest and greatest

rigid path
#

@meager fog - Thank you. PS, I am really excited about the circuitpython/Raspberry Pi news, this is awesome.

meager fog
#

yay!

#

its happening if slowly!

main meteor
#

I bought one of the micro:bit robot kits, the instructions are all for MakeCode but I'm doing it in Micropython with Mu.

idle owl
#

@meager fog Ok so the wave file is also painfully loud. I added in a potentiometer. Seemed more fun than a resistor. I'll leave the tone_volume code in there, but use the pot for both examples for volume as well.

manic glacierBOT
#

Started sheet-reading since this is an interesting proposition. I like 4 the most as well, since it reduces user effort.

But perhaps we could detect SWDIO being pulled high or low (as opposed to just floating). But we have to be careful not to interfere with debugger access.

Since SWDIO is on the PORT, could easily establish it as an EXTINT prior to boot.py/code.py loading. To guard against debugger interference, seems that wrapping it in a conditional checking for `DSU->STATUSB.D...

ruby lake
#

hunts for pcbs

mental marsh
#

@stuck elbow i need to control the sound board with an itsybitsy m4, i dont know which pins to connect to the sound board.. ill read the guide again see if i missed that part.

ruby lake
#

Time for evil experiments with te feather m4

manic glacierBOT
meager fog
#

@ruby lake more feather m4 in stock

#

get em while they're hot from the oven ๐Ÿ˜ƒ

cunning crypt
#

At this rate, I think @ruby lake might end up with enough feathers to make a pillow.