#circuitpython-dev
1 messages · Page 227 of 1
Ok
Ok in your docs/api.rst file you need to change adafruit_ra8875 to adafruit_ra8875.ra8875 and include a second .. automodule block with adafruit_ra8875.registers. I think that should fix the Sphinx issue.
Thanks, I'll try again now
@idle owl looks like it finally passed. Is there anything else I need to do?
Thanks for all your help
Thanks for writing that! And great job working through Travis!
You're welcome and I had a lot of fun doing it.
Do you mind if I DM you?
No, go ahead.
@stuck elbow Ah - right; so treating FrameBuf.buf as the "data" for the _block write?
@idle owl do you remember how the frozen-mpy.c missing argument problem was fixed?
Only other reference to it was that there was no mpy-cross... so you had to make -C mpy-cross...I'm not sure that's your issue
I'm not sure then, no.
yay makefile debugging time.
looks like the makefile uses a subshell using find to look for the *.mpy files. But those don't get generated again if you didn't already build mpy-cross before first building.
purging the build-* directory fixes that.
Good to know.
even just removing the frozen_mpy dir of the failed target works.
Quick question here because I'm being lazy and haven't looked yet: Where would I find something for loading an image onto a display (Specifically, ST7735R if relevant)?
@exotic pumice I don't see a way to load, say, a .bmp image via that library
(It's the one I'm currently using)
with _pixelbuf, circuitplayground_express_crickit, without changing the frozen libs:
25868 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).```
and without
```4232 bytes free in flash out of 253440 bytes ( 247.5 kb ).
25876 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).
ok
That said, I wouldn't be surprised if I was blind and just missed it entirely
@ruby atlas do you normally run make clean BOARD=<board>; make BOARD=<board>? clean deletes the previous build directory. adds a little time, but cuts down on those mpy and qstr errors.
I don't see it either
but you could always parse the bmp yourself and use the pixel function
@raven canopy no, because I generally don't need to 😃 it was just because of the mpy-cross missing that I had a bad env.
might have to wait for displayio otherwise
@exotic pumice That is correct, but I don't particularly feel like reinventing the wheel if it's already been done.
Displayio? What's this?
we should really have ports/atmel-samd build ../../mpy-cross/mpy-cross
Is that the equivalent of the arduino Adafruit GFX Library?
it's the next-gen lcd module for circuitpython
@cunning crypt i was going to suggest ImageLoad, but it looks like it only works with displayio. though someone may have gotten it to work with the framebuf... https://github.com/adafruit/Adafruit_CircuitPython_ImageLoad
@exotic pumice @raven canopy oooooh.
So.... when will displayio be around? Is it intended for CP4.0?
I think so
OK, cool. I'm working with 4.0 on this project since it's a future thing anyway.
Can I get an "experimental" version?
Looks like the metro M4 doesn't include it by base (Surprise surprise, since it doesn't have a tft by default)
Scott is heads down on it right now. I think the releases only have it for HalloWing. buuut...scroll up. he posted up some uf2's last night iirc.
i remember at least one for Feather M4
No worries, by "future thing" it's.... months away at the earliest.
I can set it aside and work on other things for the time being. Of which I have numerous
do you have a Feather M4? if so, put the below into the search bar...
from: tannewt#4653 in: circuitpython feather
@slender iron master's build is broken from the last merge. And as I merged from master I'm now broken to in pixelbuf. Don't suppose you have pending fixes? https://travis-ci.com/adafruit/circuitpython/builds
@raven canopy Only M4 board I have is the Metro. I was just curious.
@ruby atlas I'll look on monday. don't worry about it now
I checked my failed items and it seems they line up with the master build. Phew.
I think we can merge _pixelbuf and then move onto the next phase of that (figuring out how to introduce and name https://github.com/rhooper/CircuitPython_Pixel_Driver)
Easter egg in the examples 😃
@ruby atlas do you have the link to the "create and share a library" guide?
I think this is a bit more complicated than that - it's eventually a neopixel.py and adafruit_dotstar.py replacement.
well, dotstar is an external library... 😆
since they'll start using _pixelbuf instead.
at least, i think it is. isn't it?
But yes, I know about the guide. There's a gating problem; we need _pixelbuf in circuitpython before the library becomes useful.
otherwise it's just bloat.
understood. backs away. there is a master plan. 🙇
does it replace neopixel_write as well?
no, it uses it.
ok, just curious
_pixelbuf is a layer to accelerate rgb(w) pixel (strips)
@raven canopy Hokay so let's test some cookiecutter!
🍪 ✂ 🎆
I got me a big chocolate chip cookie here! I am ready.
shutting down core stuff...
Alright, so I have your zip. Run cookiecutter from within that folder to test the new version?
yep
(I really do have a delicious cookie here.)
I don't think that worked.
What command should I have used?
I used the one in my bash history, maybe that's the issue.
cookiecutter /path/to/template.zip
😆 I have your branches
hehe. or that...
you have to supply a target i think. github or local
Yeah my bash history has a github one
maybe cookiecutter gh:sommersoft/cookiecutter-adafruit-circuitpython/tree/pypi_time?
Could not be found.
spinning up the laptop, so i can test things before suggestion
pointing to the zip may be the easiest. ~/test: cookiecutter /kattnis/awesome/mbp/test-cookie.zip
Can't be the zip, has to be the unzipped folder!
then cookie needs to update their docs... "Works with Zip files"
yeah, i'm getting invalid repository. maybe the zip itself.
No, I got a directory with files in it
it worked
but I got an error?
Too big for here I think, hold on, gisting.
Ok... So I did what I thought made sense and I see some problems with the output. Including no .travis.yml I just noticed. Which may have been part of that error
I'm liking this though!
no travis, since it bailed out. let me run mine again, and see if i can adjust the zip.
Ok!
those are some interesting fails though...
did you run it from the zip?
No it wouldn't let me, I unzipped it and made the folder the target
k
zip gave me this: cookiecutter cookiecutter-test.zip A valid repository for "cookiecutter-test.zip" could not be found in the following locations: /var/folders/gn/8nj05bcd65v347j_shy4m57r0000gn/T/tmp07trdlck/{{ cookiecutter.library_name }}
yeah, that's what i was getting.
cookiecutter cookiecutter-test/ worked after a fashion
ohhh! got a new trick, that i scrolled past. cookiecutter https://github.com/sommersoft/cookiecutter-adafruit-circuitpython --checkout pypi_time
Here's a thing: I unzipped it, then rezipped it and it's letting me use the new zip...
🤣
ran it from the branch. got the same error! i missed something in my transcription...
Yah same error from zip.
Ok
@raven canopy Hurry! I'm running out of cookie over here. 🤣
I should get a cookie
🏃 found another syntax snafu...
No worries 😄
k. try the one from my branch
No fail bail!
woohoo. i've got some formatting to test with those two fixes.
Ok do you want the issues I found?
shonuff!
Alright, the requirements are put into setup.py as a single string: install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice', 'adafruit-circuitpython-pca9685adafruit-circuitpython-lis3dh' ],
requirements.txt shows them together on the same line: adafruit-circuitpython-pca9685adafruit-circuitpython-lis3dh
changed and inserted some translations and fixed typos.
Do the quotes here matter? - provider: releases api_key: "$GITHUB_TOKEN" file_glob: true file: "$TRAVIS_BUILD_DIR/bundles/*" That's in a .travis.yml that was reconfigured using travis encrypt.
You don't have the quotes in the one we did for cookiecutter
i can add them. not sure why encrypt does, but standard.
Encrypt doesn't but it's in what we paste in there...
So that may entirely be on Scott including them in the first one he did and we've done it ever since unnecessarily?
Also, the .travis.yml has different whitespace than the way it looks after encrypt is done with it. Does that matter?
the file one may be necessary. since its an env var + stuff.
ok, then we should probably include it on both
yep. re-whitespace: i found that travis (YAML?) prefers 2-space indents...
Also, in setup.py: url='https://github.com/adafruit/Adafruit_CircuitPython_Testrepo', <-- Did not maintain TestRepo with the camelcase.
Hmm, I wonder why travis encrypt removes those indents?
well, with the - sections, the indents only matter for sub-thingies. like on.
as far as i know.
Ok
yeah, i have the URL doing capitalize incase the "user" doesn't cap. might need to think about/research that one.
i might be able to catch a if not capitalized type state.
especially now that i know how to access Python in Jinja.
Nice!
that little {% do extension is handy!
Languages that include do crack me up.
hmm. requirements list is joined with \n. does your editor recognize that as a line break?
When travis is running through the PyPI part it gets to fuzzy do ruby or whatever that line is and it entertains me.
I'm looking at three different editors here and all of them have squashed things
Two rather
🤔
and i know that Windows is the only odd-person-out when it comes to line endings.
PyCharm is looking at setup.py, not requirements.txt. sorry.
I was going to say we should include the adafruit-circuitpython- prefix on the requirements, but there's requirements that are neither, like pyserial so while the majority of them fall into the first category, we'll make people type them out. They'd have to for requirements.txt anyway.
did you separate them with commas when you ran cookiecutter?
Oh sure, have instructions ready ALREADY...
keywords worked without commas btw.
keywords='test repo testing testrepo',
they're a single string in setup.py
LOL I almost used the ones you used in the example 😆
I used PCA9685 tho
yeah, i only wordwrap that one. the keywords i referenced didn't have commas, so i didn't even think about having them entered with commas. its also not handling commas in there if they're supplied...so.
We need to give more explicit instructions for "description" with an example. Because otherwise that one will not be great.
Ok so let me try it the way you suggested
lol. in the instructions for keyword, i copy and pasted the strucs for requirements. it says use comma separated. 🤦
both wrong?
one! more! time!
i promise people, we're professionals. (i'm not really)
(I am :sad_trombone:)
gonna celebrate! (the punk is now firmly in my head, while other music plays)
yay! so, keywords entry: you want comma separated or spaces?
Spaces is fine. Unless you think it's confusing. That's how it's done in setup.py so that's how I did it by default, but no one else is going to have that default but me since... i do the setup.pys.
spaces it is. updating readme.
Right on
So let's get the URL fixed, was that the only other thing I pointed out? Scrolls up
quotes in .travis.yml
yep. just did that. what sort of example do you want for description?
Looking
crap that one is long.
How about this. "Write a sentence describing the purpose of this library. i.e. 'A CircuitPython driver for the ADXL34x family of accelerometers.'" or something like that, basically include an example description
I was going to use MotorKit, but it's kind of long
actually
Let's use that one, it doesn't matter in the README.
'CircuitPython helper library for DC & Stepper Motor FeatherWing, Shield, and Pi Hat kits.'
It's thorough, that's why I like it as an example. Doesn't have to be that long tho, in fact that had to be broken into two lines.
So maybe it's a bad example.
thoughts?
Looks good there in the README. Rereunning now
url still the same
oh we didn't update the other issues 😄
other? there's more!?
hehe. jus messin. i did do travis though.
hm... doesn't show up in that run
there are things afoot. cause it does for me. 🤷
Jinja has a lower test. so, i can only make URL capitalized if it's all lower case. thoughts?
basically:
{% if lower(cookiecutter.library_description) %}
{{ cookiecutter.library_description | lower }}
{% endif %}
Maybe explicit instructions to type it exactly correctly
well, and URL isn't the only place its force cap'd, i think. let me look.
yep. in the README too, for the Travis badge URL.
hmm
the problem was it wasn't doing it properly I thought
It was on Limor's checklist
maybe she wasn't capitalising it when she ran cookiecutter then?
We could specify that it needs to be exactly what the URL will be?
wait no it was capitalising the lib name at the top of the lib file
that we fixed I think. It's supposed to be lowercase like the .py file there.
If we specify that you have to enter it correctly, will it show up correctly in the URLs?
sorry, had to refill water + things. if we specify, and it is entered that way, then yes we could drop the force cap. but...then it may still need changing. all depends on how the final repo is named.
I guess we weren't generating setup.py until the repo was complete typically. but the README we did. so...
I guess it is what it is, if it changes, then we alter the files.
😄
Alright, I think it's solid. Let's wait until tomorrow to do the PR so it doesn't get merged without me being aware of it, and that way I can update the guide to match the README. I think I'm done for tonight.
wait
I'm getting WAY ahead of myself.
I have to test whether travis works with that .yml
and the test repo.
But I'm not catching the updates you pushed apparently...
Not sure what's up there.
you're answering y to the "do you want to download a new version"?
😄 Nice commit message. OK, meh. Alright. We'll figure it out tomorrow.
And then I'll get it to a point where travis passes and we'll see if it works, and then we see if it'll deploy to PyPI with this setup.
i'm trying to get on @tidal kiln's level. i have far to go...
He's on point. We all have to step up our game to get there.
Well, this was good! I'm looking forward to this working. I imagine tomorrow it will not 🤣
Travis is so fickle. We'll see
such an optimist... but, yeah. Travis. 🔥
Also I ate a big cookie while testing cookiecutter. I call that a win.
That's two wins today.... we got a foot of snow dumped on us, and the neighbor took a snowblower to my sidewalk without me asking. Total win.
Since legally we're supposed to keep it clear apparently.... I'm not used to this type of thing, I did not grow up in a neighborhood.
I grew up where you plow if you want access to things, not so the mail person can get to the slot in your door.
yeah, when i dealt with snow, the HOA said we were supposed to clear sidewalks. negative. though, we would tag-team our driveways.
I think it's still snowing so I'm hoping this awesomeness will happen one more time if needed. Otherwise, leverage the kid across the street 😆
Anyway, I am heading out for the night. Goodnight!
viel spass!
@gilded cradle I'm going to add you to the CircuitPython Helpers role as well - you won't show up purple because the punners role is higher, but you'll get tagged when we send out the reminders about the meetings, or if there's some important CircuitPython related news.
Ok, thanks
welcome to the gang @gilded cradle!! and thanks for the lib! i'll toss in a review if it sits for a while. display stuff is not my forte...
Thanks @raven canopy
@raven canopy couldn't figure out how to set up that windows app to investigate the USB since it doesn't show up in the devices panel anymore (idk why)
Pressing and holding the Reset key + Pluggin the device in sets the LED1 and LED2 indicators blinking and I am able to discover and connect via Adafruit Bluefruit app.
Is it possible to install CircuitPython firmware this way?
@tawny creek hmm. i don't know if the nRF work has gotten to OTA yet. or if its even planned. the analyzer should at least pick up the IRQ requests, but...windows. 😄
Trying to use the serial console via Mu on a Grand Central, but Mu says it's not connected. I see the port as /dev/tty.usbmodem1421 and can get the REPL if I connect to it with screen. Not sure why Mu can't find it.
Updating Mu seems to have fixed that.
@main meteor I think mu has to be updated to add new boards when they are introduced https://github.com/mu-editor/mu/blob/master/mu/modes/adafruit.py#L56
Hello, javascripter here, new to circuit python. How in the world do you force the HID keyboard to only send 1 character when a toggle is thrown. I'm having to use this but these sleep times reek havoc on the switch logic...
while True:
if apu.value:
while apu.value:
pass
kbd.send(Keycode.A)
time.sleep(2.0)
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)
apu is auxilary power unit, it starts the F/A-18 , basically I'm building a cockpit with real world switches and letting the CPX handle the translation to the simulator
is the code formatted like you posted, or like this:
while True:
if apu.value:
while apu.value:
pass
kbd.send(Keycode.A)
time.sleep(2.0)
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)
if everything below the pass is indented to be inside the while loop, it will continually send the keycode.
well, continually while the apu's value is true...
ah ha... that makes sense... let me try it out...
@tough pier i assume it's a momentary switch? so, if you're wanting to simulate holding the button down until the APU is started, i would send the keycode first, then block with the while: pass afterwards.
No, it is not a momentary and that's the problem. I need it to work like the real one, i.e. it is a toggle to ground that when on sends to ground and sends 1 keycode A and the when the switch is turned off (ground released) it sends a CTRL ALT A
ahh. then, is it toggle ON -> APU start -> toggle OFF? or does it remain on for longer lengths of time?
It (and many other switches in this cockpit) stay on for extended periods of time and that is the other issue I'm running into ...
in javascript we have case statements to track many items, is there anything like that in CP?
because I'm having to track 10 switched
yeah, then you'll need state machines. i think we discussed that earlier this week? if apu.value is not last_apu.
sadly, no switch/case in Python. its if or else. 😆
can you point me to some docs or a bit of sample code how you might tackle it?
let me see if i can dig something up...
hey @tough pier did you get the wiring sorted?
@pastel panther indeed!
sweet
@tough pier this one is kind of deep, but Dave did a state machine example for CircuitPython: https://learn.adafruit.com/circuitpython-101-state-machines/overview
excellent I'll look into it
the basic premise is that you keep track of the last state that was acted upon, and proceed based on that.
with 10 switches to track, wrapping their state into a class may help readability a lot.
Yeah, I'd so something like have a boolean value for "have I sent APU start", and check it before sending, something like ```python
sent_apu_start = False
while True:
if apu.value:
if not sent_apu_start:
sent_apu_start = True
kbd.send(Keycode.A)
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)```
@tough pier another example: https://learn.adafruit.com/hacking-ikea-lamps-with-circuit-playground-express/rotation-state
Then clear sent_apu_start when the switch is flipped back
@raven canopy the second example looks a little easier to follow... lol
@main meteor that is a basic state machine then?
Yeah, it's sort of a minimal state machine with two states ("have I sent this yet?" and "I have sent this").
so with 10 switches that all can be in any one of two states (one switch has 3 states) I will need a state variable for each switch yes?
If you want all of them to act that way, and if none of them interact with each other, yes.
In that sort of case, it might make sense to write a "switch" class to handle each one that accepts an input pin and character to send, and just have instances of the class for each switch. That would avoid duplicating a lot of code.
One of my favorite illustrations of a simple state machine, for a heater. It has three states ("off", "low", and "high"), and two buttons ("LO" and "HI"). Pushing the "LO" button when it's off sets it to low. Pushing the "LO" button when it's already on "low" turns it off, etc.
@main meteor so I took your code (and modified it a bit to make sense to me) and so far so good. So I would then need to create and apuOff and set that up under an else statement???
apuOn = False
while True:
if apu.value:
if not apuOn:
apuOn = True
kbd.send(Keycode.A)
kbd.release_all()
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)
no, you'll only need one state variable per switch. then, just set it accordingly:
apuOn = False
while True:
if apu.value:
if not apuOn:
apuOn = True
kbd.send(Keycode.A)
kbd.release_all()
cpx.pixels.brightness = 0.05
cpx.pixels[5] = (0, 200, 0)
else:
if apuOn:
apuOn = False
kbd.send(Keycode.CTRL_A)
kbd.release_all()
# pixel stuff
you could also use a dictionary:
states = {"apu": True, "ailerons": False}
while True:
if apu.value:
if not states["apu"]:
states["apu"] = True
then there's set() or using a class. Python...so many ways! 😄
once you get more than a few state variables/objects organizing them in something like a dict or class becomes much easier than keeping track of a bunch of individual variables
in. deed.
in['deed']
@raven canopy Using your code example I have the apu working as designed! thanks! now I'm going to try the dictionary method and then try it on the 3 state engine crank switch (3 states are off Right and Left)
woohoo! love it when stuff works!
I misread that at first and thought you meant the magneto switch, but that should have 4 positions (off, left, right, both). 😃
me too
Then again I'm not sure an F/A-18 has magnetos.
@main meteor no sir, it definitely does not...
code working with dictionary! trying engine crank now!
with the 3 states I'm going to make crankOff a true statement and then watch for crankRight and CrankLeft would I do that with if else else?
if:
elif: # else if
else: # anything not above
@raven canopy thanks
You could also use one crank variable, and set it to a string:
states = {"crank": "off"}
if states["crank"] == "off":
elif states["crank"] == "right":
the off state of engine crank has no keystroke becasue it doesn't do anything, so do I just leave the kbd stuff off that part?
If it requires no execution, I would only check the "not off" states. So, if right and elif left.
Alright. I'm for for few hours. Glad the sim is on the right track for ya!
@raven canopy Thanks so much!
Hi, I'm trying to retrieve data from an RSS feed for a weather display I'm building. I tried using espatcontrol_webclient.py and just replacing the url but get the following error:
ESP AT GET URL https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866
Resetting ESP module
Checking connection...
Retrieving URL...Failed to get data, retrying
No OK response to AT+CIPDOMAIN="weather-broker-cdn.api.bbci.co.uk"
Checking connection...
Retrieving URL...Traceback (most recent call last):
File "code.py", line 46, in <module>
File "code.py", line 36, in <module>
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 168, in get
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 154, in request
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 127, in request
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_socket.py", line 53, in readline
ValueError: need more than 1 values to unpack
I've tried to figure this out myself but its a little above my limited skills! Can anyone help?
you can try turning on debug
and you must have RTS pin connected for most data transfer
I'll look into that ,thanks!
@meager fog was it the rst pin you mentioned? its connected to pin 5 on my M4express
debug immediately before the error is:
---> AT+CIPSTART="SSL","2.20.163.107",443,10
<--- b'CONNECT\r\n\r\nOK\r\n'
---> AT+CIPSTATUS
<--- b'STATUS:3\r\n+CIPSTATUS:0,"SSL","2.20.163.107",443,15489,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 44 bytes\r\n\r\nSEND OK\r\n'
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 41 bytes\r\n\r\nSEND OK\r\n'
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 36 bytes\r\n\r\nSEND OK\r\n'
---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b' \r\nRecv 2 bytes\r\n\r\nSEND OK\r\n'
@bleak tiger you should have RESET and RTS -- I just tried your example on my metro_m4 and ESP32 and it works, on min e RESET is D5, RTS is D6
oh, cool I'll try that thanks!
sorry RTS is D9, but teh webclient does not use it since it runs at 9600 baud
ok, just to clarrify I'm using an esp8266 huzzah breakout. can't find mention of the rts pin
its is GPIO13 on the breakout -- and if you look at some of the other examples you will see it using D9 on the metro_m4 as rtspin.
thanks again @solar whale I'll take a look at those
is you code using 9600 for the run_baudrate
yes
it should work evne without RTS -- does for me - it's good to add, but may not be the problem.
can you post your code -- just to make sure something else is not changed -- i only changed the URL line.
sure
import time
import board
import busio
from digitalio import DigitalInOut
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_espatcontrol import adafruit_espatcontrol_requests as requests
Get wifi details and more from a settings.py file
try:
from settings import settings
except ImportError:
print("WiFi settings are kept in settings.py, please add them there!")
raise
uart = busio.UART(board.TX, board.RX, timeout=0.1)
resetpin = DigitalInOut(board.D5)
URL = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866"
print("ESP AT GET URL", URL)
esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, run_baudrate=9600,
reset_pin=resetpin, debug=True)
print("Resetting ESP module")
esp.hard_reset()
requests.set_interface(esp)
while True:
try:
print("Checking connection...")
while not esp.is_connected:
print("Connecting...")
esp.connect(settings)
# great, lets get the data
print("Retrieving URL...", end='')
r = requests.get(URL)
print("Status:", r.status_code)
print("Content type:", r.headers['content-type'])
print("Content size:", r.headers['content-length'])
print("Encoding:", r.encoding)
print("Text:", r.text)
time.sleep(60)
except (RuntimeError, adafruit_espatcontrol.OKError) as e:
print("Failed to get data, retrying\n", e)
continue
put trhee backtick before and after it to format it
sorry, didn't realise
`import time
import board
import busio
from digitalio import DigitalInOut
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_espatcontrol import adafruit_espatcontrol_requests as requests
Get wifi details and more from a settings.py file
try:
from settings import settings
except ImportError:
print("WiFi settings are kept in settings.py, please add them there!")
raise
uart = busio.UART(board.TX, board.RX, timeout=0.1)
resetpin = DigitalInOut(board.D5)
URL = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866"
print("ESP AT GET URL", URL)
esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, run_baudrate=9600,
reset_pin=resetpin, debug=True)
print("Resetting ESP module")
esp.hard_reset()
requests.set_interface(esp)
while True:
try:
print("Checking connection...")
while not esp.is_connected:
print("Connecting...")
esp.connect(settings)
# great, lets get the data
print("Retrieving URL...", end='')
r = requests.get(URL)
print("Status:", r.status_code)
print("Content type:", r.headers['content-type'])
print("Content size:", r.headers['content-length'])
print("Encoding:", r.encoding)
print("Text:", r.text)
time.sleep(60)
except (RuntimeError, adafruit_espatcontrol.OKError) as e:
print("Failed to get data, retrying\n", e)
continue
`
ah sorry three backticks, I'll get the hang of this eventually!
import board
import busio
from digitalio import DigitalInOut
from adafruit_espatcontrol import adafruit_espatcontrol
from adafruit_espatcontrol import adafruit_espatcontrol_requests as requests
# Get wifi details and more from a settings.py file
try:
from settings import settings
except ImportError:
print("WiFi settings are kept in settings.py, please add them there!")
raise
uart = busio.UART(board.TX, board.RX, timeout=0.1)
resetpin = DigitalInOut(board.D5)
URL = "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/6690866"
print("ESP AT GET URL", URL)
esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, run_baudrate=9600,
reset_pin=resetpin, debug=True)
print("Resetting ESP module")
esp.hard_reset()
requests.set_interface(esp)
while True:
try:
print("Checking connection...")
while not esp.is_connected:
print("Connecting...")
esp.connect(settings)
# great, lets get the data
print("Retrieving URL...", end='')
r = requests.get(URL)
print("Status:", r.status_code)
print("Content type:", r.headers['content-type'])
print("Content size:", r.headers['content-length'])
print("Encoding:", r.encoding)
print("Text:", r.text)
time.sleep(60)
except (RuntimeError, adafruit_espatcontrol.OKError) as e:
print("Failed to get data, retrying\n", e)
continue
yay!
the code is OK -- same as I am running -- I'll try it on an esp8266 -- will take a few minutes to swap - you can try adding the RTS add rtspin = DigitalInOut(board.D9)
and change ```
esp = adafruit_espatcontrol.ESP_ATcontrol(uart, 115200, reset_pin=resetpin,
run_baudrate = 9600 rts_pin=rtspin, debug=True)
I'll try that.
OK -- I reproduced it on my ESP8266 -- Adding RTS now
just tried it, still getting error:
<--- b'STATUS:3\r\n+CIPSTATUS:0,"SSL","2.20.163.107",443,5494,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b' '
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b' '
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b' '
---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b' '
Traceback (most recent call last):
File "code.py", line 46, in <module>
File "code.py", line 36, in <module>
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 168, in get
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 154, in request
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_requests.py", line 127, in request
File "/lib/adafruit_espatcontrol/adafruit_espatcontrol_socket.py", line 53, in readline
ValueError: need more than 1 values to unpack```
yes, me too -- looking into it.
thanks
@meager fog could this be an issue with the ESP8266 SSL support?
yes -- @bleak tiger change the https to http in the URL
it worked! thanks @solar whale !
Great -- there may be some issue with SSL on the ESP8266 -- I'm not to familiar with it -- will try to learn more - the ESP32 handles it better.
@bleak tiger with the RTS pin connected you can raise the baudrate -- I ran it a 480600
@solar whale yeah esp8266 doesnt have ssl
OK -- bur some https URLS work and others don't ...
I've used it to post to aio using https URL
depends on what ciphers the given https server accepts
esp8266 only supports some, relatively weak, ciphers
@stuck elbow OK -- good to know -- hard to prediict!
I guess I need to look more cloely at the responses when it fails ...
would be nice to be able to see the actual error
working on it ...
ther failure is casued by an empy line being seen from the ESP8266 that does not occur with the ESP32. still inivestigating.
@stuck elbow @meager fog so the difference I see is that the ESP32 CIPSTATUS report TCP even when https is used but the ESP8266 reports SSL -- when the request is sent to the ESP8266 it does not send a response and there is en empty response after a timeout. The ESP32 responds with valid data as in the HTTP request.... ESP32 note TCP ins STATSU even though HTTPS requestes - note port 443 ```---> AT+CIPSTATUS
<--- b'STATUS:3\r\n+CIPSTATUS:0,"TCP","104.121.87.114",443,62119,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b''
Receiving: 2920
ESP8266 note SSL in CIPSTATUS and empty line at end note port 443
---> AT+CIPSTATUS
<--- b'STATUS:3\r\n+CIPSTATUS:0,"SSL","104.121.87.114",443,44683,0\r\n\r\nOK\r\n'
---> AT+CIPSEND=44
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=41
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=36
<--- b'\r\nOK\r\n'
<--- b''
---> AT+CIPSEND=2
<--- b'\r\nOK\r\n'
<--- b''
b''
but according to the documentation -- only TCP or UDP are expected to be in that field? SSL is not a valid type
heey guys
I have been really wanting to try python or microcontrollers but I don't know where to start and I have lots of question
is anyone willing to help ?
@kind herald Go ahead and post questions -- also are you using CircuitPython or micropython and on what board(s)
I saw both of those. but is there a difference ? I didn't start yet I know to code python and love to play with microcontrollers so I thought doing both would be awesome. What board do you recommend for starting out ? @solar whale
I have a real fondness for the Circuit Playground Express for getting started with CircuitPython. It has a bunch of nice built-in peripherals you can use without having to wire anything else up.
it really depends on 1) how experienced with microcontrollers you are, 2) what you want to achieve
@solar whale may be - ive really be focusing on ESP32 because 8266 has such bad SSL - very flakey :/
and the AT commands are not well documented -
might actually be easier to 'backport' the SPI code to ESP8266 from ESP32
@meager fog agreed! about flakey SSL! I was jsut trying to understand whay it was failing.
what's the difference between circuitpython and micropython ?
and I think the ESP32 supports both of them correct me if i'm wrong
@kind herald circuitpython does not run on an esp32 😉
big difference!
no - only micropython for the ESP32
not necessarily - it works on some sparfun SAMD51 boards and many nrf52840 baords (particle, adafruit, nordic)
@kind herald There's some good overview here: https://circuitpython.readthedocs.io/en/latest/
It was supported on the esp8266 but has been dropped going forward
@solar whale as of 4.0 alpha 3, correct?
correct
thaaanks for the link @magic wing !
yes it it very hard to support the ESP's well, we found better success with hving them as a subprocessor
and if you look at other companies, others are doing the same...
ESP for wireless only - SSL and socket management - not for peripherlas
ah, dang it
@meager fog I'm sorry to hear that, is that in general or just from a CP perspective?
in general
the ESP series are wonderfully inexpensive, and painful to use - if you aren't doing exactly what they are good for - its hard to know what went wrong
<laughs> of course, the automated satellite tracker I'm building just switched from a 2560 Mega to a Huzzah precisely because the ESP8266 wifi support is so much better
and the documentation is not as solid as other chips - there's little app support. the low cost is part of the deal
the wifi part of the ESP works great...its everything else 😃
that's what I love about them they are cheap xD
thats why its a good co-processor
so we can't expect anymore
well, this project is using the Arduino IDE not CP so as long as someone else writes the server code, i can use it (and thankfully the guy who designed the project wrote the code)
someone has to support them, tho - who will do that?
Hey guys! First time here. Looking for help with reinitializing a digital pin for a neopixel strip connected to a pi. Here's what I've tried:
>>> import board
>>> import neopixel
>>> neo = neopixel.NeoPixel(board.D18, 2)
>>> neo[0] = (255, 0, 0) # turns the first pixel red
>>> neo.deinit()
>>> neo = neopixel.NeoPixel(board.D18, 2)
>>> neo[0] = (255, 0, 0) # turns the first pixel red # Nothing happens :(
light, that isnt supported probably. keep the object around!
Ah ok. Thought I may be doing something wrong. Thanks!
so after a quick reading (I will have more time tomorrow to look into this) CP is just MP but with added features so generally better and the way to go ?
@meager fog this is what I picked a bit over two years ago as my first electronics project. Was also my first intro to Adafruit. It's been a long learning curve, but I'm basically left with just buttoning it up in a permanent enclosure (which I'm going to try to finish tonight) and showing it off on Show and Tell
http://clearskyinstitute.com/ham/AST/
The switchover to the ESP8266 was a last minute curve ball, but it's actually simplified a lot for me
yay come by S&T next week!
um okayy thanks for the help guys
@kind herald good luck and come back any time
@kind herald CircuitPython is a much better option for getting started, yes. 😃
@solar whale I surely will ! just saw a video about the community reaching 10000 people on discord. Now I know why
@idle owl Alright ! I have a better idea now thanks 😄
@meager fog wait are you the one from the videos ! 😮
that's just a hologram
@meager fog never seen an admin, a youtuber, a maker and still this close to his community ! I'm sorry still new to this world of adafruit. Thaanks anyway
hey @meager fog for the OnDiskBitmap height&width properties, you meant for them to be exposed like odb.height etc.? I was slightly confused when I saw that OnDiskBitmap's get_pixel was only used via Bitmap
yeah height/width
right, ok.
so you could center it in the screen
right; will do
- Add
'x'format character tostructformat strings. This designates a padding byte that is0when packing and is skipped when unpacking. - Follow CPython's lead on checking buffer length.
struct.unpack()requires the buffer size to match exactly the size required by the format string.struct.unpack_from()requires the buffer size to be at least the size required by the format string (the buffer could be longer). struct.unpack_from(fmt, data, offset=0)now allows offset as a k...
i like this idea - i could use it a lot in libraries! 'x' as well as strictness
i like this idea - i could use it a lot in libraries! 'x' as well as strictness
I was doing a lot of
_, foo, bar, _ = struct.unpack(...)
and got tired of that. It's in regular Python, so we may as well have it. Didn't take a lot to add.
@pastel panther you around
@tough pier I am
@pastel panther so Everything is going superbly. I have 4 of 8ish switches working. No interference, no time lags, etc. The only one I'm not sure how to handle is the engine crank switch, which is a two pole, 3 position toggle. Center is off and does nothing. Right takes A4 to ground and Left takes A3 to ground. Here's the complete code. Could you just look it over to make sure you see nothing weird and then tell me how I should do the 3 postion logic.
import time
import board
import digitalio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
from adafruit_circuitplayground.express import cpx
kbd = Keyboard()
apu = digitalio.DigitalInOut(board.A1)
apu.direction = digitalio.Direction.INPUT
apu.pull = digitalio.Pull.DOWN
seat = digitalio.DigitalInOut(board.A5)
seat.direction = digitalio.Direction.INPUT
seat.pull = digitalio.Pull.UP
eject = digitalio.DigitalInOut(board.A2)
eject.direction = digitalio.Direction.INPUT
eject.pull = digitalio.Pull.UP
repair = digitalio.DigitalInOut(board.A6)
repair.direction = digitalio.Direction.INPUT
repair.pull = digitalio.Pull.UP
crankRight = digitalio.DigitalInOut(board.A4)
crankRight.direction = digitalio.Direction.INPUT
crankRight.pull = digitalio.Pull.UP
crankLeft = digitalio.DigitalInOut(board.A3)
crankLeft.direction = digitalio.Direction.INPUT
crankLeft.pull = digitalio.Pull.UP
apuOn = False
seatArmed = False
ejectionTriggered = False
crankRight = False
crankLeft = False
cpx.pixels.brightness = 0.05
while True:
if apu.value:
if not apuOn:
apuOn = True
kbd.send(Keycode.A)
kbd.release_all()
cpx.pixels[5] = (0, 200, 0)
else:
if apuOn:
apuOn = False
kbd.send(Keycode.CONTROL, Keycode.SHIFT, Keycode.A)
kbd.release_all()
cpx.pixels[5] = (0, 0, 0)
if seat.value:
if not seatArmed:
seatArmed = True
kbd.send(Keycode.CONTROL, Keycode.SHIFT, Keycode.T)
kbd.release_all()
cpx.pixels[9] = (0, 0, 0)
else:
if seatArmed:
seatArmed = False
kbd.send(Keycode.T)
kbd.release_all()
cpx.pixels[9] = (200, 0, 0)
if eject.value:
if not ejectionTriggered:
ejectionTriggered = True
kbd.release_all()
cpx.pixels[8] = (0, 0, 0)
else:
if ejectionTriggered:
ejectionTriggered = False
kbd.send(Keycode.E)
kbd.release_all()
cpx.pixels[8] = (200, 0, 0)
if repair.value:
cpx.pixels[0] = (0, 0, 0)
else:
kbd.send(Keycode.R)
kbd.release_all()
cpx.pixels[0] = (200, 0, 0)
time.sleep(0.5)
cpx.pixels[0] = (0, 200, 0)
time.sleep(0.5)
@tough pier give me a few minutes to try and wrap something up and I'll take a look
@tough pier I think you would treat the two sides of the crank switch like two different switches
They're mutually exclusive so you don't have to worry about all the different states they could be in since mechanically if one is on the other must be off
now that I think of it you probably want to know which switch just turned off, so when one of the two is off, you'll want to check if the other is off. If the other is off as well you'll check the "previous" state of both to figure out which one is changing from on to off
I was guessing you could use one variable, but it wouldn't be a boolean.
ya, that makes sense
@dhalbert Build is green now.
@main meteor although that is probably the correct way, I think because it is like what I have already done, I will probably implement it like @pastel panther said
They're both valid approaches. The individual variable approach lets you use pretty similar logic for the new situation, which makes sense.
@main meteor I didn't mean correct, I think I meant that your way would be more terse and have less overlapping code
Understood. Like most programming, there are a few ways to do it. For my projects, personal preference is often more important than engineering optimization.
yea, I get a little too caught up in trying to make perfect code, and waste a lot of time when I should just go with what I know better, even if it takes a few more lines
I've done that sometimes too.
I'm scrathing my head over this:
>>> import busio
>>> import board
>>> air_uart = busio.UART(board.D6, board.D5, baudrate=9600)
>>> esp_uart = busio.UART(board.D13, board.D10, timeout=0.5)
>>> gps_uart = busio.UART(board.TX, board.RX, baudrate=9600, timeout=3.000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid pins
If I just do the final UART call with TX & RX it's fine
well that's strange; does it behave differently without timeout vs. without baudrate?
What if you swap the order?
It looks like baudrate and timeout are optional arguments (keyword arguments).
do you think that would somehow affect the pins being passed to the constructor?
So board.RX and board.TX work fine, but only if the optional arguments are not specified?
This works fine: ```>>> import busio
import board
import gps
gps_uart = busio.UART(board.TX, board.RX, baudrate=9600, timeout=3.000)
On the Feather M4 Express TX/RX correspond to : ```>>> board.TX
microcontroller.pin.D1
board.RX
microcontroller.pin.D0
So there shouldn't be a conflict.
My guess is that is has to do with which sercoms are being allocated. THe first two uarts might use up the available sercoms for TX and RX. There are at most two sercoms available for each pair of pins.
Travis is :) finally. I always forget to do a make translate after a merge.
I added height and width to OnDiskBitmap as per #1460
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha.5-168-gd2a7cd6c5-dirty on 2019-01-20; Adafruit Trellis M4 Express with samd51g19
>>> from displayio import OnDiskBitmap
>>> f = open("1x20orange.bmp", "rb")
>>> odb = OnDiskBitmap(f)
>>> odb.height
20
>>> odb.width
1
>>>
<@&356864093652516868> Reminder the meeting is on Tuesday this week (24 hours later than normal)!
hi! i'm still trying to decide whether to use circuitpython or arduino for my circuit playground express project. i'd like to use python but i didn't find a usable fft implementation yet. the most interesting one i found uses asm_thumb, which doesn't work on the cpe.
i would also like to know if there is support for dma with neopixel matrices in circuitpython?
not that I know of but I could be wrong
looks like I'm not the only one burning the midnight oil tonight
pixelbuf may be?
but roy said that's just using neopixel_write so maybe not
okay, thanks. i'll try to ask again during daytime (in us)
I think I got the clock blues again
@hallow rapids neopixels require precise timing; right now they are bit-banged. A DMA implementation ends up using a lot of RAM, more than one bit per output bit. This is true both in Arduino and CircuitPython.
DotStars are more flexible because they use an external clock and can use a conventional SPI interface.
There's a hw assist to neopixels and other RGB LED's that's in development right now named pixelbuf.
If you have an API idea for an FFT module that would be implemented in C, let us know (say, open an issue). It could operate on an array.array of some data type.
If you want to do this NOW, Arduino might be the better choice.
@tulip sleet thank you, that helps for my current decision
Hi
I managed to extend my trellis M4 board with 2 neotrellis (seesaw)
I get the simpletest for multitrellis module working : https://arofarn.info/fichiers/neotrellis_m4_ext.MP4
@timber mango very nice!
the code is here : https://github.com/arofarn/Adafruit_CircuitPython_NeoTrellis/tree/extended
the main issue is that the 3V regulator on the trellisM4 is to small for so many neopixel
I pointed other staff to your project
thank you 😃
nice work!
the VDD on the edge of the trellis M4 is 5V (Vin) ? or 3V like the I2C (JST port) ?
it seems I won't get power failure when I will solder the 2 neotrellis to the trellisM4 (instead of I2C port with 3V)
800 ⭐
@umbral dagger hellooo - are you still hackin' on hackspace?
@meager fog nope.. Working on the evnironment sensor
@meager fog gps + bme280 + particulate sensor + eps8266 + feather M4 Express
@umbral dagger sounds cute, whats it for?
oh is that this? https://3.basecamp.com/3732686/buckets/8266173/todos/1500011009
ok im not sure it will work - but you can try! no SSL supported
did you get it connecting?
Seems glitchy.. but I have one of the older 8266 boards. Going to try with a new one.
@meager fog esp8266 and adafruitIO seem ok with SSL
he's using an ESP8266
Using the restful API
Bad copy/paste introduced a bad bug into struct.pack_into(), making it require an exact-length buffer, which it does not.
restful over requests?
sorry typo
yes
yes -- it post OK -- just some SSL sites don't work
Got 3 uarts running (esp, gps, articulate sensor). That was fun
I2C for the bme280
was it just an ordering issue or did you use other pins?
@slender iron are you still running adabot on a local cron? i think we're in a "dueling banjo" situation. the bundle releases for the last few days are ping-ponging the FeatherWing release between 0.9.4 and 1.0.0. looking at the Travis cron history, it's committing an update to 1.0.0, but can't create the release since the tag name is already created. i'm not even sure how we "fix" it. 😄 🏓
@raven canopy I think you could just make a 1.0.1 (after the twin adabots fixed)
as scott says, there
s a large supply of numbers available
i thought about that. just not sure it would course correct, with the associated twin adabots as you mentioned. 😄
@tulip sleet other pins. I hacked the code at https://learn.adafruit.com/circuitpython-essentials/circuitpython-uart-serial#wheres-my-uart-14-14 to give me valid combinations assuming I wanted to use TX and RX.
I.e. start with TX/RX and find other valid pin combination without deiniting each time.
@umbral dagger ok after this we could use that bitbangio library - its not as exciting but will let us do more on raspi 😃
The shared SPI should be available through board.SPI() now on Hallowing.
@slender iron re: Dean's mixer voice gain PR, what still needs to be done? I haven't tested it yet but it looks like most of the pieces are there
I don't remember....
No meeting today? (I don't see the google doc link).
Oh, google calendar saying it's a US holiday. I guess that's why. That's too bad, I managed to clear my 2pm today and moved it all to tomorrow.
@ruby atlas We made the decision in the meeting last week, and included it in the notes. However, it appears we did not ping CircuitPython Helpers until last night. Usually we post it the day we make the decision and pin the message. We evidently failed to do that this week. Apologies.
That's okay, I didn't even know today's a holiday there because most of my US customers are still working.
Slack has actually been busier than usual for several.
Was there a meeting today or is it tomorrow at the regular time?
Tomorrow at the regular time
Thanks
You're welcome
Hi, I'm getting the following error when trying to run my adafruit charlieplexed matrix with the simpletest example code:
Traceback (most recent call last):
File "code.py", line 20, in <module>
File "code.py", line 10, in <module>
File "adafruit_is31fl3731.py", line 95, in __init__
File "adafruit_is31fl3731.py", line 144, in _init
File "adafruit_is31fl3731.py", line 141, in _mode
File "adafruit_is31fl3731.py", line 133, in _register
File "adafruit_is31fl3731.py", line 128, in _bank
File "adafruit_is31fl3731.py", line 122, in _i2c_write_reg
File "adafruit_is31fl3731.py", line 120, in _i2c_write_reg
OSError: [Errno 5] Input/output error```
can anyone help?
running on as M4express feather, circuitpython 4.x
@tidal kiln hihi
i have a printer guts
can u take a quik snap of the pluggin
so i dont get it wrong
i don't have...but there's one in forum i can link...let me find...
@meager fog this is what apparently worked:
https://forums.adafruit.com/download/file.php?id=61143
thankx, thought so
@bleak tiger is it actually the matrix? not the wing?
yes its the 16x9 matrix
I think I adjusted the code to suit:
import busio
import adafruit_is31fl3731
with busio.I2C(board.SCL, board.SDA) as i2c:
# initialize display using Feather CharlieWing LED 15 x 7
#display = adafruit_is31fl3731.CharlieWing(i2c)
# uncomment next line if you are using Adafruit 16x9 Charlieplexed PWM LED Matrix
display = adafruit_is31fl3731.Matrix(i2c)
# draw a box on the display
# first draw the top and bottom edges
for x in range(display.width):
display.pixel(x, 0, 50)
display.pixel(x, display.height - 1, 50)
# now draw the left and right edges
for y in range(display.height):
display.pixel(0, y, 50)
display.pixel(display.width - 1, y, 50)```
oops sorry, paste mistake!
you can edit it
got it
give me a sec. i'm gonna hook this up and test real quick...
thanks!
worked for me.
you didn't get the pull up error, so it seems like your I2C wires are at least connected
how are you wired up?
what about GND and power?
aah think I spotted the problem, wired up to vbat but no battery connected during test
I'll just check
yup working now
thanks @tidal kiln , rookie error on my part!
no worries. glad its working.
@tidal kiln one silly Q, i cant get the test page to print
i am shorting J1 while powering?
hmmm. yah. and that'd be like holding button while powering.
and then print begins when you release?
i don't have the guts. so going by forum results. it worked there.
a little unclear - in one case DTR was grounded, for the other - doesn't look like they did
yeah doesnt seem to
hmm. this one:
https://forums.adafruit.com/viewtopic.php?f=19&t=141802
not seeing anything different or special
Hey all - not sure if this is the right place to ask this question, but did I see somewhere that one of the new Particle boards will run CircuitPython?
they can run circuitpython, but it replaces the stock firmware
so you lose the particle mesh functionality
I get the following error when I try to build for metro_m4_express. I'm using OSX and have been following these instructions: https://learn.adafruit.com/building-circuitpython/build-circuitpython
`~/circuitpython/ports/atmel-samd$ make BOARD=metro_m4_express V=1
GEN build-metro_m4_express/genhdr/mpversion.h
GEN build-metro_m4_express/genhdr/qstr.i.last
xargs: arm-none-eabi-gcc: No such file or directory
make: *** [build-metro_m4_express/genhdr/qstr.i.last] Error 127
make: *** Deletin...
@exotic pumice - ok, thanks! I'll stick with the Feather m4 for now, then...
This sounds like you don't have gcc-arm-embedded installed. Unfortunately as described in https://learn.adafruit.com/building-circuitpython, the cask was removed from brew so it will need to be installed manually from https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads. It appears that the 7-2018-q2 one is the correct one.
@tidal kiln heya its a sekret - check out https://discordapp.com/channels/327254708534116352/537054717575168000
plz try going there - i gave u perms
dons 'intrigued' mask. resists urge to click 😆
sommer, its for arduino library maintainers - if you plan on doing any arduino library codin' we can add ya 😃
quietly backs away lol
not sure i have the cycles rn to get back into the arduino world...
@meager fog there. i think. but not seeing any activity?
@meager fog Could you tell me a little about the state of Ampy? I get that the native USB lets Circuit python iterate a whole lot faster, but Ampy seems to get a lot of love even from the microphython side of things.
hiya
yep! we are no longer supporting ESP8266 on circuitpython, and so will not be maintaining ampy - its still there, and it works for many uses, but we aren't maintaining it anymore because we are not using it
if you'd like to develop it, please fork from github
if you'd like to take over maintenance, we can transfer the repo to you! 😃
- Put back string UUID parsing and printingfor
bleio.UUID. No longer assume that there areadafruit_blePython wrapper classes for most classes inbleio. - Make
CharacteristicBufferbe a standardstreamclass, so that it mimicsbusio.UART, etc. However, it only provides read functionality - Protect the ring buffer in
CharacteristicBufferwith a mutex. - Refactor
ringbuf.hto include some operations that were added for nRF UART. - Fix a minor doc error in
busio.UART.
...
<@&356864093652516868> Here is my draft for the circuitpython 2019 aggregate post. I've got a couple more sections later to do later tonight but want to make sure you have time to look it over before our meeting tomorrow. Thanks! https://docs.google.com/document/d/1_HpiYQOVxrBMd8HSn_vvjpl629M23tu8lsxh9bMHY98/edit?usp=sharing
@slender iron not sure if it matters but @TJ Peden == @TangoJuliett
Thanks for your help. I downloaded and installed the gcc-arm stuff using these instructions (https://gnu-mcu-eclipse.github.io/toolchain/arm/install/), but I'm getting the same error.
I installed "arm-none-eabi-gcc" in /opt/gnu-mcu-eclipse. Should it be somewhere else?
@mpeters2 That is for use with the Eclipse; it is unfortunate that it shows up as a top Google result. For command line usage, just download 7-2018-q2- MacOS build https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads. Unpack it into some directory (doesn't have to be in /opt on any place where root is required to instsall it) and make sure that the executables are on your PATH.
<@&356864093652516868> Ok, I've filled out the last couple sections. Please take a look before tomorrow's meeting.
my clocks are running quite strangely
my DFLL is 6MHz and my DPLL0 is 8MHz
instead of 48 and 120
we need a generic #developers channel or something so I don't feel guilty about posting in here about non-circuitpython stuff
oh some of the dpll0 pulses are 12mhz, that's closer
makes no difference if I use osculp32k or xosc32k
you guys said DFLL is supposed to be 48MHz at reset right? No configuration required
xosc32k is actually 32K-ish
but if I try to divide it I get nonsense
I think atmel's using new math
The full 'New Math' song by Tom Lehrer animated by myself for a school project. I created it in Flash CS4 and ran it through After Effects to convert it. I'm...
confirmed new math
ok, so the explanation of divsel was just plain wrong
it's 2*(n+1) not 2^(n+1)
the video is fun to watch, though!
yeah the video is great, atmel datasheets, not so much
Hey there!
I'm a fellow pythonista, ususally found hacking over at - https://github.com/pycampers
I saw ampy doesnt have a maintainer now, so i though it would be great if I could help in make this great project better for everyone. And of course, solving that issues that it currently has.
I wouldnt say that i have a perfect knowledge of ampy's internals. Although, I have contributed to ampy in the past, and would love to continue doing it.
(Assuming you guys haven't already transferred the ownership to someone else)
Also, I don't currently have the variety of devices ampy supports, but i'm ready to buy them as long as my pocket allows it.
On the NeoTrellis M4 there is a 4 pin JST hacking port with pins labelled: GND, 3V, SDA, SDL In CP I use
import board
import busio
i2c = busio.I2C(board.SCL, board.SDA)
but if I want to use UART, which pins become TX and RX or can they be user assigned?
Then I use?
uart = busio.UART(board.TX, board.RX, baudrate=9600)
Next, how do I send any button presses out over the UART?
@sinful sand experimenting:
Adafruit CircuitPython 4.0.0-alpha.5-126-gc5e1f0b6a-dirty on 2019-01-11; Adafruit Trellis M4 Express with samd51g19
>>> import board,busio
>>> u = busio.UART(board.SCL, board.SDA)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Invalid pins
>>> u = busio.UART(board.SDA, board.SCL)
>>>
So you can re-use the JST SDA and SCL pins (in that order) for UART. As for sending button data, it's up to you how you want to encode the button data as bytes and then write it out with UART.write. You could send it as 4 bytes (32 buttons), or use some other encoding scheme.
@danh thank you. Sorry if I'm slow on the uptake but to be clear: SDA is TX and SCL is RX?
@sinful sand https://learn.adafruit.com/classic-midi-synth-control-with-trellis-m4 has details
@sinful sand yes, the order of arguments is that, and you can also give the names explicitly:
u = busio.UART(tx=board.SDA, rx=board.SCL)
@meager fog @tulip sleet thanks both I will keep trying to get my head around it
I have a basic question about the libraries from https://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/tag/20190121
I downloaded the adafruit-circuitpython-bundle-py-20190121.zip to take a look at some libraries
I found out that in for example the adafruit_bme280.py library has the line "from micropython import const" in it
Is this a circuitpython library as well ?
@wooden lichen yes - It is a CircuitPython Library - it won't work for micropython. -- many of them import that same module.
actually, I'm not sure if the lib can be used on micropython -- clearly, the examples cannot.
This one looks like it can be used with both, it even tries to import ustruct if importing struct fails
I see that some other libraries use 'from adafruit_bus_device.i2c_device import I2CDevice'
What is circuitpython only I believe
@wooden lichen Others may know more, but I am not aware of any effort to maintain micropython compatibility in the circuitpython libraries.
@wooden lichen adafruit_bus_device is written for CircuitPython's APIs. You could probably write a compatible class for MicroPython though
@slender iron sorry - I have a "day job" conflict today so I'll be "lurking with one ear" for the meeting today. Group hug, Nothing special to report.
@solar whale Thanks for letting us know!
thanks @solar whale!
<@&356864093652516868> notes doc for the meeting is here: https://docs.google.com/document/d/1AxPCVA2SOpjv4BvEjyy3dRLiWKsgB6tGgUDVxvy8R0A/edit?usp=sharing
CircuitPython Weekly January 22, 2019 Hug Reports @jerryn - lurking @tannewt Status Updates @jerryn - lurking @tannewt In the weeds Overall CircuitPython 2019 post: https://docs.google.com/document/d/1_HpiYQOVxrBMd8HSn_vvjpl629M23tu8lsxh9bMHY98/edit?usp=sharing
Ok great, i'll look into it! @slender iron
@wise crest Sounds great! We'd be happy to transfer the repo to you.
I'll try to lurk today... I've been spending the last week with hardware or C mostly.
@idle owl thanks! Here is the organization name - pycampers
@wise crest Alright thanks! It is possible we can also add you as a maintainer on the PyPI project. Or you can handle deploying to PyPI on your own. We need to do a couple of things before we can transfer the repo, so we'll do that this week and get it ready to go!
@idle owl Here is my pypi handle - https://pypi.org/user/devxpy/
Got it. Great!
<@&356864093652516868> This week's CircuitPython Weekly starts in about 30 minutes!
i haz a meetin'
no real news this week
hugz to kattni who has been pickin' up a lot of guide and github stuff!
Howdy ya'll, lurking here today. 😃
thanks @meager fog will read it off
<@&356864093652516868> starting in a minute
lurking...
lurking...
Technically, Travis did the work. 😄. Hmm. It uses \n.. need a \r?
I may have to bounce out for a few. #day_job
I'm out today, but I'll be working on porting CircuitPython to the SparkFun SAMD21 Dev Board (Arduino footprint) this week. Hugs to all!
awesome! know about a lumidrive board setup too?
lurking myself
you betcha. :)
@gilded cradle are you lurking?
thanks @idle owl.
No
Ok
@gusty kiln happy trails 👋
voice is having trouble, just a sec
very proper latin, i'm sure.
I think I'm good
Latin..sure. 😆
in the weeds: non-SPI display support
Gotta drop off. Be back in a few I hope..
yeah propmaker guide! i've been reverse engineering forum support from the schematic. will be nice to be able to point to a guide now.
@tulip sleet I've read your notes off
Will be just listening. About to start driving
kk
i think it's a solid post, @slender iron
👍
weedsy topic?: python code to read from perferals and add objects to a "message que"
I'm particularly thinking about the error handling for displays like the i2c oled, neopixel displays, and other displays with weird interfaces
Is this all monospace?
yes
Oh 👌
The current circuitpython master (9e8d182fe14c05b3e7c6a74e35987ec293310c7a) does not build for esp8266. The build fails with:
../../py/objfun.c: In function 'fun_asm_call':
../../py/objfun.c:549:5: error: passing argument 2 of 'mp_arg_check_num' makes pointer from integer without a cast [-Werror]
mp_arg_check_num(n_args, n_kw, self->n_args, self->n_args, false);
^
In file included from ../../py/objfun.c:33:0:
../../py/runtime.h:80:6: note: expected 'struct mp_map_t *' ...
I have a hardware accelerated rounded rectangle function for the RA8875. I was thinking a GUI library that you could pass these drawing functions to.
they all use the same commands, because that's a MIPI standard
@gilded cradle that's how I set up my gui, just pass methods.
Oh perfect
Thanks everyone!
Thanks ya'll!
Thanks everyone
The documentation doesn't exist yet but I can get you up and running with my code if you wanna chat after
Sure
We've stopped supporting the ESP8266 in 4.0.0. That's why it's not building any longer.
that'd definitely save a couple pings a week at least.
Ahahaha
We've dropped support due to ESP8266 not having native USB. We have written a library to support an ESP's (ESP8266 and ESP32) as a co-processor:
https://github.com/adafruit/Adafruit_CircuitPython_ESP_ATcontrol
and will be adding better support in the future (including hardware in this configuration).
Also see https://github.com/adafruit/Adafruit_CircuitPython_miniesptool
@idle owl I was 1 click away from adding a "I Love Lamp" image to that PR...
likewise here, changes are live without need for an application restart (which sometimes does happen)
Maybe have a Development Group then and move CP to that?
@ladyada Maybe we'll have the Makefile print a deprecation warning. We haven't removed the Makefiles or source trees for other boards that we never supported - they just live on, which makes it easier to do merges from upstream.
@ladyada or do something like that ^^^^
@gilded cradle I'm have computer troubles rn, restarting. Sorry
Ok @marble hornet
@slender iron yolo
@gilded cradle here is the repo: https://github.com/TG-Techie/TG-US changes need to be made to the io_screen, pin_port, and the sys_config depending on your hardware setup
like buttons and such
io_screen is for the display
Ok, I'll look it over
@vernal fern if problems arise, i;d suggest turning buttons off and using the keyboard
For the record, this was my first thought: https://asciinema.org/a/dy4PQaNl1PQiQt09iNrJeGbCy
@slender iron alpha 5 doesn't have displayio yet, i'll need to build?
yup, you'll want the latest from s3
I was thinking I'd do beta.0 today after reviewing PRs
make translateimgrofybeepboopbop from a @tulip sleet commit. lol
Right?
These might be worth moving outside the port at some point.
7a33e58 Put back native C UUID string parsing and print... - dhalbert
28cfd8a CharacteristicBuffer: make it be a stream class... - dhalbert
62df7ab Improve struct compatibility with CPython - dhalbert
e170e03 Merge remote-tracking branch 'adafruit/master' ... - dhalbert
6aa9f69 make translateimgrofybeepboopbop - dhalbert
😃
4.0.0-alpha.5-497-g738e8f0 i;m still not getting displayio on the m4
hrmmm
yay ! it imported!
@idle owl any plan to update this to show button usage?
https://learn.adafruit.com/adafruit-16x2-character-lcd-plus-keypad-for-raspberry-pi/python-usage
i've pointed people to repo example, but i think the learn page gets more focus
Don't think it was on the list, but it should probably be updated
y'all still ok if I use this channel for SAMD51 initialization questions?
cool. don't think it's super urgent, since there's the example, but when/if you can...thanks!
@exotic pumice The idea is more basic questions will be handled in the #help-with-circuitpython channel, and dev discussion can happen here.
@solar whale ya, its an off by one error I haven't hunted down
ok good -- just wanted to make sure you knew.
@exotic pumice nope, when I'm debugging clocks I usually have a TC setup to pwm at 500 hz so I can verify the clock speed
@solar whale yup, I'm aware. @solar basin was going to hunt for it I think
great -- I hope to have some time to do more testing of displayio and bleio tomorrow
I'm actually putting the gclk out on GCLK/IO because my timers don't initialize properly
nor do my sercoms
@solar whale awesome! I'm thinking I'll release beta.0 today so you can test that and we can do beta.1 with fixes
woohoo!
I just merged translations with git checkout --theirs locale/ make translate I think that's the easiest way
Should the error messages from files in the py folder also be translated?
Yes, they could be in peripherals/, with port-dependent implementations (since these depend on nrf).
@wise crest heya i think we need to do the transfer together
since there's multiple admin permissions
I think I'm gonna try futzing with dfllval.coarse and dfllval.fine
or should I switch to closed loop mode?
@wise crest so lemme know where you want to xfer it to - i can also make you an admin on that repo, maybe then you can xfer it
ok i think i fiugred out how to do it, i xfered to myself and then to you
so when you accept it then its yours
you'll need to redo the pypi deployment stuff cause it was tied to our account
i can add you as a maintainer on pypi
Where does this come from? I took the latest version.
Same here.
Where does this come from? I took the latest version.
and here. and so on.
Where does this come from? I took the latest version.
@exotic pumice Closed loop mode is broken - check the errata (there's a lot of surprising or even horrifying stuff in the SAMD51 errata).
One thing you could do is check the clock register settings in CircuitPython and compare them to your settings.
yeah I have that tab open and I remember you mentioning it before
We use the svd package to make it easy to look at register values.
our entire register access model is based on the svd
autogenerated code from the svd
some of the svd is a little wrong too
i mean in gdb; there's a python thing that reads the svd and lets you dump register values
oh yeah, scott showed me that
I already have the svd open so it's easy enough for me to just read it manually and then x/xw the address
you guys said the dfll requires no configuration right?
@meager fog , thank you so much!
@wise crest Thank you!
@tulip sleet, it should just be 48MHz on boot?
The line numbers are automatically updated when someone runs make translate on the repo. You don't need to update them yourself.
@exotic pumice I think you still have to turn it on
you're reading our clock code, right?
yeah I've read it
also we do set it to lock to USB, not sure if it really is or not
since closed loop mode is broken
I think I had that chunk of code and I commented out and there was no difference
unsafe {
oscctrl.dfllctrla.write(|w| w.bits(0));
oscctrl.dfllmul.write(|w| {
w.cstep().bits(1);
w.fstep().bits(1);
w.mul().bits(0)
});
}
while oscctrl.dfllsync.read().dfllmul().bit_is_set() {}
while oscctrl.dfllsync.read().dfllctrlb().bit_is_set() {}
oscctrl.dfllctrla.modify(|_, w| w.enable().set_bit());
while oscctrl.dfllsync.read().enable().bit_is_set() {}
oscctrl.dfllctrlb.write(|w| {
w.ccdis().set_bit();
w.usbcrm().set_bit();
w.waitlock().set_bit()
});
while oscctrl.status.read().dfllrdy().bit_is_clear() {}
@wise crest congrats and best of luck 😃
thank you @wise crest !
And what does this means to the wrong linenumbers, if you commit/accept my changes?
Will the translation still work?
It looks like I'm missing clearing dfllctrlb, I wonder if that'll make a difference
i'm going to dump the CPy settings, getting set up for that
A year ago, I was only a mouse click away from buying 28 Huzzah for my class.
Luckily I waited and bought the first six nrf52840 Express now. ;)
But sad for all esp owners, thats sure. I'm happy that you gave those boards a second chance.
The manufacturers of Octopus boards work around the corner. They are already experimenting with circuitpython.
Yes they will. The translation mapping is based on msgid and will be ignored if the translation is marked fuzzy.
Don't forget, you can still use Huzzahs with MicroPython! it works really well and MicroPython is doing an excellent job supporting the ESP8266 and ESP32 :)
@exotic pumice are you sure the GCLK you're sending the DFLL to is not dividing it?
btw, from hpl_gclk_config.h in CPy, a description of our clockc setup?
// Circuit Python SAMD51 clock tree:
// DFLL48M (with USBCRM on to sync with external USB ref) -> GCLK1, GCLK5
// GCLK1 (48MHz) -> 48 MHz peripherals
// GCLK5 (48 MHz divided down to 2 MHz) -> DPLL0, DAC peripherals
// DPLL0 (multiplied up to 120 MHz) -> GCLK0, GCLK4 (output for monitoring)
divider in gclk, not just dfll?
yeah
let _gclk2 = clocks
.configure_gclk_divider_and_source(GCLK2, 1, DFLL, false)
.unwrap();
configure_gclk_divider_and_source is a wrapper around
fn set_gclk_divider_and_source(
&mut self,
gclk: ClockGenId,
divider: u16,
src: ClockSource,
improve_duty_cycle: bool,
) {
self.gclk.genctrl[gclk.bits() as usize].write(|w| unsafe {
w.src().bits(src.bits());
w.div().bits(divider);
// divide directly by divider, rather than 2*(n+1)
w.divsel().clear_bit();
//w.divsel().set_bit();
w.idc().bit(improve_duty_cycle);
w.genen().set_bit();
w.oe().set_bit()
});
self.wait_for_sync();
}
(gdb) svd/x OSCCTRL
Registers in OSCCTRL:
EVCTRL: 0x00 Event Control
INTENCLR: 0x00000000 Interrupt Enable Clear
INTENSET: 0x00000000 Interrupt Enable Set
INTFLAG: 0x00010100 Interrupt Flag Status and Clear
STATUS: 0x00010100 Status
XOSCCTRL0: 0x00000080 External Multipurpose Crystal Oscillator Control
XOSCCTRL1: 0x00000080 External Multipurpose Crystal Oscillator Control
DFLLCTRLA: 0x-7E DFLL48M Control A
DFLLCTRLB: 0x00 DFLL48M Control B
DFLLVAL: 0x0000747B DFLL48M Value
DFLLMUL: 0x00000000 DFLL48M Multiplier
DFLLSYNC: 0x00 DFLL48M Synchronization
DPLLCTRLA0: 0x02 DPLL Control A
DPLLCTRLA1: 0x-80 DPLL Control A
DPLLRATIO0: 0x0000003B DPLL Ratio Control
DPLLRATIO1: 0x00000000 DPLL Ratio Control
DPLLCTRLB0: 0x00000000 DPLL Control B
DPLLCTRLB1: 0x00000020 DPLL Control B
DPLLSYNCBUSY0: 0x00000000 DPLL Synchronization Busy
DPLLSYNCBUSY1: 0x00000000 DPLL Synchronization Busy
DPLLSTATUS0: 0x00000003 DPLL Status
DPLLSTATUS1: 0x00000000 DPLL Status
what do the ones with dashes mean?
(gdb) svd/x GCLK
Registers in GCLK:
CTRLA: 0x00 Control
SYNCBUSY: 0x00000000 Synchronization Busy
GENCTRL0: 0x00010907 Generic Clock Generator Control
GENCTRL1: 0x00010906 Generic Clock Generator Control
GENCTRL2: 0x00000000 Generic Clock Generator Control
GENCTRL3: 0x00000000 Generic Clock Generator Control
GENCTRL4: 0x00010907 Generic Clock Generator Control
GENCTRL5: 0x00180906 Generic Clock Generator Control
GENCTRL6: 0x00000000 Generic Clock Generator Control
GENCTRL7: 0x00000000 Generic Clock Generator Control
GENCTRL8: 0x00000000 Generic Clock Generator Control
GENCTRL9: 0x00000000 Generic Clock Generator Control
GENCTRL10: 0x00000000 Generic Clock Generator Control
GENCTRL11: 0x00000000 Generic Clock Generator Control
PCHCTRL0: 0x00000000 Peripheral Clock Control
PCHCTRL1: 0x00000045 Peripheral Clock Control
PCHCTRL2: 0x00000000 Peripheral Clock Control
PCHCTRL3: 0x00000000 Peripheral Clock Control
PCHCTRL4: 0x00000000 Peripheral Clock Control
PCHCTRL5: 0x00000000 Peripheral Clock Control
PCHCTRL6: 0x00000000 Peripheral Clock Control
PCHCTRL7: 0x00000000 Peripheral Clock Control
PCHCTRL8: 0x00000000 Peripheral Clock Control
PCHCTRL9: 0x00000000 Peripheral Clock Control
PCHCTRL10: 0x00000041 Peripheral Clock Control
PCHCTRL11: 0x00000000 Peripheral Clock Control
rest are zeros
i think the dashes are don't-care bits
??
anyway, I'd do a dump of yours and compare
(gdb) x/64xw 0x40001000
0x40001000: 0x00000000 0x00000000 0x00000000 0x00010100
0x40001010: 0x00010100 0x00000080 0x00000080 0x00000002
0x40001020: 0x00000098 0x00008c80 0x04010000 0x00000000
0x40001030: 0x00000002 0x0000003b 0x00000800 0x00000000
0x40001040: 0x00000003 0x00000080 0x00000000 0x00000020
0x40001050: 0x00000000 0x00000000 0x00000000 0x00000000
0x40001060: 0x00000000 0x00000000 0x00000000 0x00000000
0x40001070: 0x00000000 0x00000000 0x00000000 0x00000000
0x40001080: 0x00000000 0x00000000 0x00000000 0x00000000
0x40001090: 0x00000000 0x00000000 0x00000000 0x00000000
0x400010a0: 0x00000000 0x00000000 0x00000000 0x00000000
0x400010b0: 0x00000000 0x00000000 0x00000000 0x00000000
0x400010c0: 0x00000000 0x00000000 0x00000000 0x00000000
0x400010d0: 0x00000000 0x00000000 0x00000000 0x00000000
0x400010e0: 0x00000000 0x00000000 0x00000000 0x00000000
0x400010f0: 0x00000000 0x00000000 0x00000000 0x00000000
if you have a bin starting at 16k or a .uf2 I can load it if you're not set up for the above
I have a bin yes
does it start at 0x4000?
yes
it puts the clock onto d13
mostly because I saw d13 was an option and thought it was funny, and also because when I was having trouble with uart I was using gclk2, and that's where it's gclk/io happened to be
oh, actually, the bin doesn't start at 0x4000, you flash it there with -o in bossac
the elf starts at 0x4000
is that what you meant?
actually an elf would be easier, hard to load a .bin in gdb with j-link (or at least I don't know how
kk
my setup is kinda weird, my elf loader doesn't work properly in gdb/openocd, so I flash with bossac and debug with gdb
clock_out loaded:
gdb) svd/x OSCCTRL
Registers in OSCCTRL:
EVCTRL: 0x00 Event Control
INTENCLR: 0x00000000 Interrupt Enable Clear
INTENSET: 0x00000000 Interrupt Enable Set
INTFLAG: 0x00010100 Interrupt Flag Status and Clear
STATUS: 0x00010100 Status
XOSCCTRL0: 0x00000080 External Multipurpose Crystal Oscillator Control
XOSCCTRL1: 0x00000080 External Multipurpose Crystal Oscillator Control
DFLLCTRLA: 0x02 DFLL48M Control A
DFLLCTRLB: 0x-68 DFLL48M Control B
DFLLVAL: 0x0000747B DFLL48M Value
DFLLMUL: 0x04010000 DFLL48M Multiplier
DFLLSYNC: 0x00 DFLL48M Synchronization
DPLLCTRLA0: 0x02 DPLL Control A
DPLLCTRLA1: 0x-80 DPLL Control A
DPLLRATIO0: 0x0000003B DPLL Ratio Control
DPLLRATIO1: 0x00000000 DPLL Ratio Control
DPLLCTRLB0: 0x00000800 DPLL Control B
DPLLCTRLB1: 0x00000020 DPLL Control B
DPLLSYNCBUSY0: 0x00000000 DPLL Synchronization Busy
DPLLSYNCBUSY1: 0x00000000 DPLL Synchronization Busy
DPLLSTATUS0: 0x00000003 DPLL Status
DPLLSTATUS1: 0x00000000 DPLL Status
(gdb) svd/x GCLK
Registers in GCLK:
CTRLA: 0x00 Control
SYNCBUSY: 0x00000000 Synchronization Busy
GENCTRL0: 0x00000307 Generic Clock Generator Control
GENCTRL1: 0x00010905 Generic Clock Generator Control
GENCTRL2: 0x00010906 Generic Clock Generator Control
GENCTRL3: 0x00000000 Generic Clock Generator Control
GENCTRL4: 0x00000000 Generic Clock Generator Control
GENCTRL5: 0x00180106 Generic Clock Generator Control
GENCTRL6: 0x00000000 Generic Clock Generator Control
GENCTRL7: 0x00000000 Generic Clock Generator Control
GENCTRL8: 0x00000000 Generic Clock Generator Control
GENCTRL9: 0x00000000 Generic Clock Generator Control
GENCTRL10: 0x00000000 Generic Clock Generator Control
GENCTRL11: 0x00000000 Generic Clock Generator Control
PCHCTRL0: 0x00000000 Peripheral Clock Control
PCHCTRL1: 0x00000045 Peripheral Clock Control
PCHCTRL2: 0x00000000 Peripheral Clock Control
PCHCTRL3: 0x00000000 Peripheral Clock Control
thanks
I'll put the salae on D13 just to check
@marble hornet do you have a link for your board? adding it to the release notes
oh, why is my dfllmul set?
my code says
oscctrl.dfllmul.write(|w| {
w.cstep().bits(1);
w.fstep().bits(1);
w.mul().bits(0)
});
I am getting like 1.25MHz and 1.562 MHz alternately
🤷 the secret is in the bits, I hope the compare helps
maybe you need to clear the reg completely first?
here's our diff
[paul@P50-Arch tmp]$ diff diff1.txt diff2.txt
1c1
< (gdb) svd/x OSCCTRL
---
> gdb) svd/x OSCCTRL
10,11c10,11
< DFLLCTRLA: 0x-7E DFLL48M Control A
< DFLLCTRLB: 0x00 DFLL48M Control B
---
> DFLLCTRLA: 0x02 DFLL48M Control A
> DFLLCTRLB: 0x-68 DFLL48M Control B
13c13
< DFLLMUL: 0x00000000 DFLL48M Multiplier
---
> DFLLMUL: 0x04010000 DFLL48M Multiplier
19c19
< DPLLCTRLB0: 0x00000000 DPLL Control B
---
> DPLLCTRLB0: 0x00000800 DPLL Control B
Yea, I know. One student is still working with these Chips. He builds an RFid door lock for a workshop room and implements it with Micropython and ampy. He told me last week that he got quite familiar with the linux shell. That made me so proud XD
clear all of oscctrl you think?
hold on, I will get an expanded dump
yours
(gdb) svd/x OSCCTRL DFLLCTRLA
Fields in OSCCTRL DFLLCTRLA:
ENABLE: 0x1 DFLL Enable
RUNSTDBY: 0x0 Run in Standby
ONDEMAND: 0x0 On Demand Control
(gdb) svd/x OSCCTRL DFLLCTRLB
Fields in OSCCTRL DFLLCTRLB:
MODE: 0x0 Operating Mode Selection
STABLE: 0x0 Stable DFLL Frequency
LLAW: 0x0 Lose Lock After Wake
USBCRM: 0x1 USB Clock Recovery Mode
CCDIS: 0x1 Chill Cycle Disable
QLDIS: 0x0 Quick Lock Disable
BPLCKC: 0x0 Bypass Coarse Lock
WAITLOCK: 0x1 Wait Lock
(gdb) svd/x OSCCTRL DFLLMUL
Fields in OSCCTRL DFLLMUL:
MUL: 0x0000 DFLL Multiply Factor
FSTEP: 0x01 Fine Maximum Step
CSTEP: 0x01 Coarse Maximum Step
(gdb) svd/x OSCCTRL DPLLCTRLB0
Fields in OSCCTRL DPLLCTRLB0:
FILTER: 0x0 Proportional Integral Filter Selection
WUF: 0x0 Wake Up Fast
REFCLK: GCLK Dedicated GCLK clock reference - Reference Clock Selection
LTIME: DEFAULT No time-out. Automatic lock - Lock Time
LBYPASS: 0x1 Lock Bypass
DCOFILTER: 0x0 Sigma-Delta DCO Filter Selection
DCOEN: 0x0 DCO Filter Enable
DIV: 0x000 Clock Divider
oh, so dfllmul.mul is 0, but the other parts of the register are set
CircuitPython:
(gdb) svd/x OSCCTRL DFLLCTRLA
Fields in OSCCTRL DFLLCTRLA:
ENABLE: 0x1 DFLL Enable
RUNSTDBY: 0x0 Run in Standby
ONDEMAND: 0x1 On Demand Control
(gdb) svd/x OSCCTRL DFLLCTRLB
Fields in OSCCTRL DFLLCTRLB:
MODE: 0x0 Operating Mode Selection
STABLE: 0x0 Stable DFLL Frequency
LLAW: 0x0 Lose Lock After Wake
USBCRM: 0x0 USB Clock Recovery Mode
CCDIS: 0x0 Chill Cycle Disable
QLDIS: 0x0 Quick Lock Disable
BPLCKC: 0x0 Bypass Coarse Lock
WAITLOCK: 0x0 Wait Lock
(gdb) svd/x OSCCTRL DFLLMUL
Fields in OSCCTRL DFLLMUL:
MUL: 0x0000 DFLL Multiply Factor
FSTEP: 0x00 Fine Maximum Step
CSTEP: 0x00 Coarse Maximum Step
(gdb) svd/x OSCCTRL DPLLCTRLB0
Fields in OSCCTRL DPLLCTRLB0:
FILTER: 0x0 Proportional Integral Filter Selection
WUF: 0x0 Wake Up Fast
REFCLK: GCLK Dedicated GCLK clock reference - Reference Clock Selection
LTIME: DEFAULT No time-out. Automatic lock - Lock Time
LBYPASS: 0x0 Lock Bypass
DCOFILTER: 0x0 Sigma-Delta DCO Filter Selection
DCOEN: 0x0 DCO Filter Enable
DIV: 0x000 Clock Divider
so you're not doing usbcrm after all
our FSTEP and CSTEP are zero
yeah
maybe we gave up on that due to no closed loop mode
i have to go eat - maybe look at the datasheet a bit more too
thanks, have a good one
@exotic pumice Our clock setup is here: it's not what's in the asf4_config files (any more)
I think it's running too fast for my 24MHz logic analyzer now
that or it's not running at all
ok it seems to not be running
setting the ondemand bit breaks dfllrdy, but I've divided my dfll by 12 and am getting 3.429-4MHz 😄
thank you @tulip sleet
huge hug report
yw! clocks are the hardest thing
yeah...quite confusing. multiply this, then prescale this, but only after that...
my dpll0 divided by 12 is 8-12MHz o.0
it's a really nasty looking signal
and it wasn't enough to fix uart but one step closer
When doing make -j4 BOARD=metro_m4_express DEBUG=1, I get this fatal warning:
../../drivers/wiznet5k/internet/dhcp/dhcp.c: In function 'parseDHCPMSG':
../../drivers/wiznet5k/internet/dhcp/dhcp.c:670:9: error: 'type' may be used uninitialized in this function [-Werror=maybe-uninitialized]
return type;
^~~~
cc1: all warnings being treated as errors
../../py/mkrules.mk:55: recipe for target 'build-metro_m4_express/drivers/wiznet5k/internet/dhcp/dhcp.o' failed
Doesn'...
hmm, my 200ms delay is still 91ms
I thought the clocks would've resolved that one at least
@slender iron I'm not sure they're exactly in the same class but your comment in the RA8875 PR about drawing commands reminded me of this:
https://github.com/adafruit/circuitpython/issues/657
A discord user requested a driver/library for the Nextion display(s). Upon quick glance, seems to use UART for communication. Main site: https://nextion.itead.cc/ Arduino GitHub: https://github.com...
that said they do look fairly different as they seem to use UART for communication
@pastel panther interesting! I think the idea is similar
@slender iron is UARTServer instead of UARTService OK by you? (See github emails for my replies.) If so I'll push a commit to the PR
@tulip sleet fine with me
can you test with the latest commit in master. I'll release as beta.0 tomorrow morning
did release notes already
Great! Sure thing. I'd like to do a show&tell demo too.