#circuitpython-dev
1 messages Β· Page 264 of 1
@slender iron what do you mean video description
that'll be the youtube link
the bit that goes in the description when uploading the video
Oh, I put something about the "Notes doc is available here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2019/2019-09-23.md" ... I thought that's all we add?
(also that's valid for the current notes doc)
yup, just wondering if you had it
oh. Using the phrase "description" confused me. π
I tend to do most of whats at the top of the notes and swap in the notes link
ah fair enough. I'll start doing that.
Notes doc is available here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2019/2019-09-23.md
Join here for the chat all week: http://adafru.it/discord
The weekly happens normally at 2pm ET/11am PT on Mondays. Check the #circuitpython channel...
Got it thanks
youtube is 95%
@slender iron how confusing they just call it the F4 discovery. I was wondering how there could not be a F405/407 discovery
There's a process that surfaces new PRs for review, right? I can only tag from a couple of prior contributors, which is probably not optimal.
most folks get emailed for every pr
@tulip sleet do you want to chat ble?
or are you about wrapped up for the day?
@idle owl youtube is done: https://youtu.be/DWySqjttJng
Notes doc is available here: https://github.com/adafruit/adafruit-circuitpython-weekly-meeting/blob/master/2019/2019-09-23.md Join here for the chat all week...
@slender iron I have time
@slender iron Yep got it, thank you.
@idle owl want in on ble talk?
Yah
kk
I'm going to try in the browser so my client doesn't freeze up
@slender iron what kinds of things cause stack hardfaults?
Hopefully folks (@pastel panther ) found the links to Tilting Arpeggios. If not: https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/70
@pearl notch I did, thanks π
Any code improvement suggestions are most welcome.
@ionic elk I'm not sure what a stack hardfault is
@pastel panther we're still chatting. wanna join?
ya, why aren't you doing it in a public channel?
video
yup, on it
Iβve noticed that on the CPX the higher frequencies sound much louder than the lower ones. Would there be any interest in a library enhancement to equalize those levels? (Or perhaps itβs been discussed.)
writebytes2
Hi, @gilded cradle I have bee trying to use a Raspberry Pi 4 to drive a 1.54in square E Paper display. I get the following error. Do you have any idea whats up?
'''Creating display
Traceback (most recent call last):
File "epdexample.py", line 33, in <module>
rst_pin=rst, busy_pin=busy)
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_epd/ssd1608.py", line 76, in init
sramcs_pin, rst_pin, busy_pin)
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_epd/epd.py", line 79, in init
self.sram = mcp_sram.Adafruit_MCP_SRAM(sramcs_pin, spi)
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_epd/mcp_sram.py", line 68, in init
spidev.write(self._buf, end=2) # pylint: disable=no-member
File "/home/pi/.local/lib/python3.7/site-packages/busio.py", line 163, in write
return self._spi.write(buf, start, end)
File "/home/pi/.local/lib/python3.7/site-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 57, in write
self._spi.writebytes2(buf[start:end])
AttributeError: 'SpiDev' object has no attribute 'writebytes2'
@pearl notch I thought that was more about perceived loudness with higher frequency sine waves; not that they are actually louder.
@raven canopy I carefully chose the word βsoundβ above, but not carefully enough. π I did indeed mean βperceived to beβ.
Hehe. Yeah, I chose poorly too. I didn't mean to sound that combative/dismissive. π
I took it in the friendly spirit
Iβm thinking of a linear or curved function, or perhaps a graphic equalizer with bands.
Is there a tidy filter to normalize it? i haven't dealt with behind the scenes normalization
So much vocabulary here I donβt know. Tidy? Today I learned βcircupβ.
Has anyone successfully tried using ESP32SPI on an open Wi-Fi AP (ssid only; no password)? I can only get RunTime Error: Unknown error 0x00 in adafruit_esp32spi.py in connect_AP(), which in this case indicates WL_IDLE_STATUS. All the code seems to be in place to do it, but something isn't happening.
Tidy, as in "neat and/or small".
Heh heh. By filter I assume you mean a function that takes a frequency and returns an adjustment volume.
@fading solstice make sure you are running spidev 3.4 or later.
@gilded cradle I know I am not. I think its 3.3 OS says the spidev requement is satisfied via adadruit_blinka (3.3). And I tried pip3 uninstalling spidev and couldn't
Can you run pip3 install ββupgrade spidev?
@pearl notch yep. I picked up that term from my slight forays into DSP.
i will try that
Cool
@gilded cradle That command got me the version 3.4. Thanks
π
@crimson ferry I haven't tried that, but given some time, I think I could setup a test environment for that...maybe this weekend
@sly falcon Thanks, I'm just a little baffled, each layer seems to have the pieces for ssid-only, but I can't get it to connect. (was trying to help another user in the help channel, but this wasn't as easy as I thought)
That's weird. I mean....I can definitely think of good use cases (guest/captive portal networks), but I bet it's not a common use for CP devices...so maybe that's why it's never been tested or validated
/shrug
@crimson ferry btw, all this work I have talked about helping out with, assumes the local electrical utility doesn't shut off power in my area...which they've threatened to do this week to prevent wildfires like we had in 2017 (I live in Santa Rosa, California)
so...yeah
good times
@sly falcon Wow, good luck with that. At your convenience just chime in on that new issue.
The main thing I had on the back burner for open wi-fi was a facility on a roaming device to log data locally, and upload whenever it found an open wi-fi to connect to.
@sly falcon LOL n/m the open wi-fi thing... it works, operator error o_O
@crimson ferry Thanks - I appreciate that!
@crimson ferry heh...no worries....brain fuzzes happen...glad you got it working! π
Hello from Japan! Akihabara was fun but overwhelming.
is that a deep-fried donut?
@onyx hinge last time I was in Akihabara was 1988. Pretty amazing then. Have a great time!
@nimble narwhal This appears to fix the issue. We can now measure both 3v3 and 5v0 without overflowing. Not sure if it is a 'good fix' but it is a fix nonetheless. SAMD51G19.
def get_voltage(pin):
return 1.0 * pin.value / 65535 * 3.25 * 2
@prime flower Ive been playing with an ATECC608 and the Circuitpython lib you created. It all works, but it is not clear to me how to actually put it into use. I thinkI'm just missing something.... Can you provide a brief explanation of what we can do with this breakout?
Glad it's working - the utility is to lock private keys (TTN Network IDs, priv/pub rsa keypairs, as an example) into the chip so it can authenticate against a server without someone being able to extract the private key from your project @solar whale
Currently, you can use it for offloading cryptographic functions or math, such as random number generation (can generate large arrays of random numbers incredibly fast), SHA-256 hashing and AES-128 signing
@solar whale The future goal is to get CircuitPython's ESP32SPI socket working with certificate files so we can authenticate with Amazon AWS IoT or Azure without setup headache or re-authentication. I'm also looking at re-tooling a few libraries (like TinyLoRa and RSA) to utilize an optional ATECC module.
@meager fog @slender iron my F405 work is starting to descend into clock arcanery related to tusb (differences between the Pyboard and F407 discovery, basically). Would you like me to press on, or change gears back to SPI support?
@ionic elk push everything to a branch, link me to it and start spi. Iβll take a look in a couple hours and ping you when I do. Gotta run first
@prime flower thanks!
@solar whale np - the JWT/JWS generation is where I think I'll start (Google Cloud uses this to auth.) adding this optional hardware acceleration since it doesn't req. certificates.
Sounds good -- I'll be happy to try it when you are ready for testers.
awesome - thanks! If you spot any libraries out there which would benefit from the breakout- plz tag me and I'll look into it
@onyx hinge awesome!
@onyx hinge eat lots of trainstation food π
@ionic elk @slender iron what he said - i did notice that ST is pretty flexible on what crystals people use to drive their boards, which makes for fun clock setup. π
@tidal kiln lemme know if/when you are looking at the ft232h guide
i wrote some fun example code you can use π
@meager fog @slender iron nevermind I licked it. Was a PLL miscalculation related to higher value oscillator. Had to go back and double check my numbers. Sneaky, was masquerading as as a flash problem by crashing only in my flash functions π
CLOCKS INDEEDY
yay! nice work! getting the clocks happy is a big hurdle
also @meager fog Skunk from Scul says hi
Ok, so it'll be a 12MHz?
Note that's different from the F407 discovery, which is just a regular ole 8MHz
@meager fog So do you actually have a feather prototype yet? I don't have a good idea of your turnover speed
Cool, this should work with it then. Let me rig up a board def for it and I'll include it in the PR
Do you have a pyboard?
Well, actually, how are you programming these?
Oh ok I should try that. The pyboard is annoying because it shares the LED pins with SWD, so if you use the LEDs you can shut off your debugger.
it is very bleh
π¦
i ran out of USB C connectors otherwise id send you a feather
im getting more soon
I might actually have some? But I guess probably not the right layout
Anyway also if you could ping Mike about that tutorial too now that it's early in the week
I'll get some bins together for the pyboard/feather for you to try
@ladyada a bin for you (Pyboard V1.1)
firmware.bin.zip
Why three SDAs? Need to finish this?
A few minor comments and questions but nothing major. Good job sorting out the clock stuff.
I don't think we use these two variables. We manage the heap dynamically.
Are these four board specific?
@ionic elk ill be back from my meetin' in an hr or so
will look then
@ionic elk can you send over any deets/docs about what you have for the guide you wrote already
so we can split it up logically π
Oh yes, I was going to ask about this. The VID and PID won't be correct either, and I forgot to check them before wiping the firmware. What should I put down for that?
Looks like a typo, thanks for pointing that out.
These were, but they actually not even used here. It's an early-work shortcut that needs to get cleaned up with a number of other things; my plan was to put through a general "board support cleanup" PR after this and SPI, since there's a number of makefile/settings/package management things that also need pruning or relocating.
I've deleted them for now.
I'll delete these and add it to the list of general cleanup tasks for the future.
@gentle bronze how are you currently managing HS vs FS on the F405? Since they have different numbers of endpoints.
@meager fog I'll need some VIDs/PIDs for the Feather as well
@gilded cradle Do you mind approving this? It's a simple fix. https://github.com/adafruit/Adafruit_CircuitPython_Thermistor/pull/9
Sure, I'll take a look
Thanks! Limor stepped away and I'm trying to finish this set of issues.
No problem
Beautiful, thank you!
I think this is the last of the libs that didn't work with circup
Awesome
Releasing them all now.
Sounds good. π
@plucky flint I think I released the last of the libs that don't work with circup. If you're still having issues with any after they are released in the bundle today or tomorrow, please let me know. Thanks!
I'm not really sure how they work I - is it a company identifier or an individually licensed thing?
So, for all of circuitpython generally?
er not sure what you mean
So I already have IDs for the STM32 discovery boards that you gave me
basically for eachboard you need unique vid/pid for bootloader, arduino code, circuitpython code
Should I just use those?
yeah we shouldnt reuse ST's because we have our own drivers
we get 65535 - theres plenty
lol
Ok, well, I need some for the Feather F405 (is that the right name?) and then I'm not sure where to look for what I should use for the pyboard
@ionic elk ya ask me and ill assign em
PID 0x8059 # arduino
PID 0x805A # circuitpython
PID 0x805B # arduino
PID 0x805C # circuitpython```
you need one for the '411 too right?
If you haven't given me one already. I don't know if you can check that in your system
The discoveries both have different IDs, but I don't recall if one of them was a placeholder from the CubeMX code... D:
PID 0x805D # arduino
PID 0x805E # circuitpython```
evrey time you make a new build, ask for a new VID/PID
A new build as in a new bin? Or a new board?
@ionic elk a new board definition
e.g. "F411 discovery" thats a board definition
each board definition needs a unique VID/PID
dont recycle them or use the vendor VID/PID
@ionic elk ok reviewing your bluepill guide here's the scoop
we dont stock or support the bluepill, so as is, if you publish this as is, you'll become the number one source for about 400k people asking for bluepill support
which i dont think you want π
so we have to adapt or adjust what you wrote so that it does not become your full time job
lets start with a guide on how to use STM32cubeprogrammer + BOOT0 to install bin/hex files
by STM32cubeprogrammer do you mean both the STM32Cube program and Stlink programmer/debugger?
Happy to reduce scope I can definitely see how that'd be an issue
Though for the record I'd certainly be down to do more post-beginner stuff at some point.
But for the guide itself, of an approximate list of topics, say STM32 hardware, STM32Cube exports, HAL introduction, Bootloader programming, STLink programming, GDB servers, and GDB debugging, what would you see remaining?
just bootloader programming to start?
@ionic elk i thinkliterally like "you have a bin or hex...and a board. how do you get it on?"
and use the built in DFU bootloader
@ionic elk we already have a gdb guide here: https://learn.adafruit.com/debugging-the-samd21-with-gdb
@ionic elk ok tested all digialio and analog on the feather f405 - works good!
will do i2c next
@meager fog Ok, that's fine. Let me know if you'd like me to do the DFU bootloader guide but I'll put the old guide back on the shelf.
moving onto SPI now
I saw the tests work within https://github.com/adafruit/Adafruit_IO_Python/tree/master/tests however when attempting to include the cpython unittest module there were a number of compatibility issues. Is there any work on adding the unittest module into the codebase at some point?
digitalio, analogin, i2c all tested succesfully on feather f405
@ionic elk ok scott's gonna do reviews in the mornin so we'll keep that PR open, please move forward on SPI
StringCar M0 Express is alive and running CircuitPython using a Trinket M0 build! Still need to define the flash parameters, but we'll call this a victory!
PWM blinky!
yay π
@ionic elk it is rather simple, and set of macro is examined to set the right number of endpoint and fifo size for each variant https://github.com/hathach/tinyusb/blob/master/src/portable/st/synopsys/dcd_synopsys.c#L48
@idle owl stonking stuff and thank you! I'll be doing some testing today, so I'll let you know if I see any issues. π
@idle owl ok... just been checking and all Adafruit maintained modules have valid / correct version information. Hurrah. However... there's a single module (this one... https://github.com/mrmcwethy/Adafruit_CircuitPython_APDS9960) that's not Adafruit maintained but still included in the bundle -- it doesn't have the hoped for version information and so I see the following output after updating to yesterday's auto-build of the bundle:
$ circup list
Found device at /media/ntoll/CIRCUITPY, running CircuitPython 4.1.0.
The following modules are out of date or probably need an update.
Module Version Latest
------------------ -------- --------
adafruit_apds9960 unknown unknown
Happy to be guided by you WRT what to do with this. Thanks!
Am I able to get a new adafruit repo for a MPU9250 CircuitPython driver? I want to contribute this to the official sources.
https://github.com/robotics-masters/RoboticsMasters_CircuitPython_MPU9250
Does anyone have any ideas on this one? I haven't changed anything. it seems that there is an issue in either i2c_bits.py or i2c_device.py.
I don't think it is the higher up libraries.
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most recent call last):
File "code.py", line 10, in <module>
File "/lib/adafruit_ina219.py", line 164, in __init__
File "/lib/adafruit_ina219.py", line 309, in set_calibration_32V_2A
File "/lib/adafruit_register/i2c_bits.py", line 88, in __set__
File "/lib/adafruit_register/i2c_bits.py", line 74, in __set__
File "adafruit_bus_device/i2c_device.py", line 147, in write_then_readinto
TypeError: extra keyword arguments given
FYI Line 10: ina219 = INA219(i2c_bus, 0x41)
@craggy galleon I reported that here maybe a week and a half ago. The adafruit_bus_device module compiled into CircuitPython seems to be out of date and the calling signature of i2c.write_then_readinto() has changed.
Can it be fixed? Do you have an issue number to quote?
I didn't open an issue on it. I guess I should have. You can work around it by saving a copy of i2c_device, either .py or .mpy, one not in adafruit_bus_device.
I have another library that works using i2c_device. The INA219 is using I2CDevice. So I guess these classes have different signatures like you pointed out.
The version that's in the driver bundle worked ok for me.
Not every I2C device driver uses write_then_readinto(), so maybe that accounts for the difference.
I guess so...
Are you using the most recent version of adafruit_bus_device,adafruit_register and the sensor libraries from the latest bundle?
adafruit_register was updated in August with a change for this.
I have no idea, it is whatever is compiled into CPY 5.0.0 master branch.
For the adafruit register library, I downloaded it directly from github master.
when?
CircuitPython build: last week (Friday), Adafruit Register: 3 hours ago and dumped into lib/ folder.
Adafruit CircuitPython 5.0.0-alpha.4-8-gbd4282a-dirty on 2019-09-17; Robo HAT MM1 with samd51g19
hmm -- ok -- then please file an issue. can you post the code you are getting the erros from and I'll try to reproduce it.
Sure thing!
There seems that there is an issue in either i2c_bits.py or i2c_device.py. When I run the INA219 CircuitPython example, it errors out. The correct address has been entered as I tried with an incorrect address and I get a different error.
I downloaded the latest version of adafruit_register and put it in the lib/ folder on my CIRCUITPY drive.
REPL Output
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Traceback (most rec...
@solar whale - as above.
OK -- soldering the header on my ina219 and I'll give it a try in few minutes.
Cool! Thanks! I'll standby
hmmm -- works for me ```Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-alpha.4-72-g7f1bc48a8 on 2019-09-20; Adafruit Grand Central M4 Express with samd51p20
import ina219_simpletest
ina219 test
Config register:
bus_voltage_range: 0x1
gain: 0x3
bus_adc_resolution: 0x3
shunt_adc_resolution: 0x3
mode: 0x7
PSU Voltage: 0.868 V
Shunt Voltage: -0.000030 V
Load Voltage: 0.868 V
Current: -0.000300 A
first suggestion is make sure you don't have multiple copies of adafruit_register/ installed. (like both .py and .mpy) versions.
also checking when the changes were merged in to CP ...
It was changed in CP lat in August as well https://github.com/adafruit/circuitpython/pull/2012/files
Ok - I'll have to have a play tomorrow - it's 11:49 PM now.
Good night -- and good luck π
@meager fog when do you figure you'll have some extra F405 feathers to send? Unfortunately, none of my boards have SPI or QSPI flash except the F412, and the Micron N25Q128A13EF840E doesn't have an entry on devices.h.
@craggy galleon I can't say if Adafruit will want it in the Adafruit bundle (they don't stock/sell the MPU9250 except for in the M5Stack that I can see), but you could also target putting it in the Community Bundle. https://github.com/adafruit/CircuitPython_Community_Bundle
@raven canopy that was more the line I was thinking. I don't want it in the Bundle π π thanks for the link. I'll check it out.
@solar whale thanks for the fix within ESP32SPI - teamwork! β
I do wonder why it takes a long amount of time for WiFiNINA to obtain a valid NTP, or what the exact execution time is. We could handle it more gracefully if I knew a range and could add a bit of padding.
It is puzzling and the time varies from a few seconds to > 15 seconds. It also seems to be related to the situation I see a lot where my first attempt to connect to my SSID fails. That is also when it takes 15 seconds to get the valid time.
just had one that needed 4 retries
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 5.0.0-alpha.4-72-g7f1bc48a8 on 2019-09-20; Adafruit Grand Central M4 Express with samd51p20
>>>
>>> import ntp_simpletest
Connecting to AP...
could not connect to AP, retrying: ('No such ssid', b'Needell Airport')
Failed to obtain time, retrying in 5 seconds...
Failed to obtain time, retrying in 5 seconds...
Failed to obtain time, retrying in 5 seconds...
Failed to obtain time, retrying in 5 seconds...
Seconds since Jan 1, 1970: 1569424132 seconds
struct_time(tm_year=2019, tm_mon=9, tm_mday=25, tm_hour=15, tm_min=8, tm_sec=52, tm_wday=2, tm_yday=268, tm_isdst=-1)
It is currently 9/25/2019 at 15:8:52 UTC
>>>
I don't have enough experience with the ESP-IDF to debug it :\
unrelated but this might be worth adding to nina-fw since it handles certificates... https://github.com/espressif/arduino-esp32/tree/master/libraries/WiFiClientSecure
I keep trying to find time to look into it more, but it keeps slipping by....
Arduino didn't add it in their fork of WiFiNINA, but it might be worth it to timebox myself and try adding it in, if not only for the setCACert functions.
hiya please move this issue to
https://github.com/adafruit/Adafruit_CircuitPython_INA219
since it is not a core circuitpython issue but a library issue! thanx :)
@slender iron I have Damien's LittleFS PR compiling but am now trying to figure out how to call it neatly from bonding code. When you're around would like to talk to you about extmod/vfs* and whether it's now is the time to refactor that into shared-*/. There is no clean interface to an arbitrary filesystem now except through the python interface. If you look at, say, main.c, we are calling oofatfs routines directly.
lotta technical debt here
Hacktoberfest is coming!!!!
π https://hacktoberfest.digitalocean.com/ π
@tulip sleet I'd be happy to see a shared-bindings for the filesystem stuff
some of it should probably land in supervisor too
eatin cereal now but can chat later if you like
@plucky flint I think maybe the wrong one is in the bundle. Because we forked it and have been maintaining it. I'll look into it.
@idle owl thank you..! π
@plucky flint How did you find the info as to which repo it was pulling from? If I click on it through the Bundle repo, it goes to the Adafruit version.
There's no version info in the Adafruit version either though, so regardless we need to fix it.
Hmm... OK. So circup just downloads the bundle (which isn't a rate limited download). GitHub has rate limiting (which we quickly run into) if I were to try to ping each repos for the latest version number. Aaaaannnnd, on top of that, the version number isn't added until Adabot does its work. π
Does that make sense..? The order of the "recipe" is 1. Check if there's a new bundle compared to what circup currently has cached locally, 1a If there's a newer version, download that. 2. Check the cached version of the bundle for version numbers. 3. Do whatever the next step is given the command issued by the user.
If I were to ping GitHub API for individual repos version details I have two problems. 1. This call is rate limited and quickly breaks. 2. The version information isn't there anyway because Adabot adds it. π
It makes sense but I think my question wasn't clear enough. Where did you get the URL you sent me in the message earlier that indicated that the bundle contained a library that wasn't an Adafruit lib?
Aha... sorry. It's the end of the day here and I'm sleepy. π I just did a search on GitHub and this was the only Python repository with that name associated with it. So it's a best guess on my part.
safe to ignore my searching IYSWIM if you have a canonical location.
Then the issue is that we missed updating that lib, and it's not an issue with a non-Adafruit lib in the bundle.
Fixing that lib right now.
Aha... stonking stuff. We got there in the end. π
π Indeed we did.
Hurrah!
Once that module is updated in the bundle, then circup should just workβ’ π
Excellent!
Computers are awesome (when they work).
Hopefully I beat the bundle release today.
Good stuff.
Question about the bundle... I presume the daily release only kicks in if there's been an update..?
(to a module in the bundle)
Cool... I assumed that was the case.
@slender iron sure ping me when you're free
OK... it's my youngest son's birthday and I need to step away for cake, candles and family singing shenanigans. Catch you later....
Also, someone asked yesterday in the meeting about my approach to testing. I'll write something up on my blog.
...and post a link here.
ciao ciao
ciao!
@prime flower @solar whale so I did a bit more poking at the Espressif IDF and it looks like we might be able to make the NINA firmware a bit more...robust...when it comes to NTP, but it sure looks like they just set it up and then wait for the ESP32 to get the date/time info https://github.com/espressif/esp-idf/blob/v3.3/examples/protocols/sntp/main/sntp_example_main.c
@sly falcon Yeah, I'm curious what the execution time of that is, since it doesn't come in until after ~15sec from the initial call
@solar whale word...I need to look at a few things this week for @crimson ferry, but I'll see what I can do to get that example code running and see what I can see
@sly falcon no rush from me! I also hope to fine time to poke/prod it myself
ok, cool
oh god....sorry, @solar whale and @prime flower got my replies swapped there
I'd suggest that I need more coffee, but I'm not sure that's a good thing lol
π no problem. Foe me, the priority is that dog needs a walk πΆ back later
haha....see ya!
@tulip sleet just got to my desk
@meager fog sure I don't mean it in a pressure-y way more just thinking about when I'll be working on it.
If things go ok with SPI but I don't have boards for Flash I'll probably go back and do a bunch of board related cleanup stuff while I wait for SPI/QSPI test boards.
@tulip sleet My CPB isn't showing up in the Bluefruit Connect app. Tried it with two different piece of code that look pretty much the same. I have no idea how to troubleshoot this. Any suggestions?
Ok, oi. Started as a me-issue, needed the libs. Now I'm getting ImportError: no module named 'bleio'.
wait... need the prerelease of BLE.
@tulip sleet Nevermind, apparently I did know how to troubleshoot it, I simply forgot. It's sorted.
@gilded cradle One more if you have a moment: https://github.com/adafruit/Adafruit_CircuitPython_APDS9960/pull/14
Yeah, I'll take a look
@tulip sleet I could still use eyes on the code to make sure it has everything it needs and nothing it doesn't, since I modified your fancy example. My simple example doesn't work anymore with the new API evidently.
@gilded cradle Thank you!
yw
@idle owl i was talking with Scott about filesystem stuff. I can still look at at the code. I have to go food shopping in a few minutes.
This looks fine and is canonical. Scott is thinking about how to change this all up but that's not done yet. This is it for now.
Thanks. Yah I know it'll change.
Β―_(γ)_/Β―
I'll submit a PR with it to the BLE repo.
The three while loops and the isinstance checking is how it always works
@ionic elk ok i have a feather f405 for u
Please place a new order on Adafruit.com. For shipping, please choose the FASTEST SHIPPING!
During Step 4 of checkout, select the payment option βPURCHASE ORDER.β And then, from the options that appear, select βREPLACEMENT ORDER.β
For the Step 5 Replacement Authorization Number, please use: RMA FORPHIL
While a note about payment for purchase orders will appear, no payment is required. This replacement order is free of charge. Remember to choose PURCHASE ORDER > REPLACEMENT ORDER as the payment option and we'll send this out right away!
email me and pt with the order number after you place it
@ionic elk grab other spi devices like a display (https://www.adafruit.com/product/661) and https://www.adafruit.com/product/2651 to test with. Also https://www.adafruit.com/product/1212 to solder flash chips onto for testing
Bosch has stepped up their game with their new BMP280 sensor, an environmental sensor with temperature, barometric pressure that is the next generation upgrade to the BMP085/BMP180/BMP183. ...
https://www.digikey.com/product-detail/en/pomona-electronics/5250/501-1311-ND/745102 will be my goto for connecting to flash chips for debugging
I would like this feature as well. I have not-very-much experience in this type of development, but am happy to open a pull request if I can get a little guidance on where to start.
I am currently doing the following to drive three displays, but would like to add a fourth. I get a 'too many busses' error if I just allocate four more pins.
displayio.release_displays()
for d in range(3):
cs_pin = 13 - (d * 3)
rs_pin = 13 - (d * 3) - 1
dc_pin = 13 - (d * 3) - 2
spi = board.SPI()
tft_cs = getattr(board, "D" + str(cs_pin))
tft_rs = getattr(board, "D" + str(rs_pin))
tft_dc = getattr(board, "D" + str(dc_pin))
display_bus =...
@gilded cradle FYI if I search for "circup" in Learn, your guide is nowhere to be found. It brings up all the CircuitPython guides instead which I'm curious as to how that's happening. Anyway, point is, you might want to email Learn dev about it so people can find the guide more easily.
Ok, let me look. I might need to add some keywords or something.
@tannewt should displays on different busses work? I had an issue a few weeks ago with one SPI and one I2C display. I don't recall the exact error but I can create an issue for it
@idle owl, it's down a couple rows when you search. I have it in the title, tagline, description, link. I'm not sure what else to add.
@gilded cradle Hmm wasn't even on the first page for me.
Oh I missed it.
No you're right.
Yah not sure why it's not coming up higher. Algorithm must take other things into account.
Yeah, maybe I should have started the title with CircUp or something
I feel like it should regardless. Otherwise the product guides that all start with "Adafruit" wouldn't search as well.
Yeah, there's room for improvement
@plucky flint Looks like I beat the bundle release. So CircUp should be good to go!
@sly falcon a good start -- I downloaded ESP-IDF 3.3 and built the current adafruit nina_fw -- I just accepted all the default config changes. It builds and runs. Now to look at what all those changes were ... Note: still getting NTP timeouts at startup.
@ionic elk hiya checkin on the order thingy
@solar whale nice! I was kinda thinking it would compile nicely against 3.3...glad to hear that it did.
I'm helping @crimson ferry with some stuff, and my plan is, as part of that work, to submit a PR to get the Adafruit fork of NINA built against 3.3 going forward...so update the docs to reflect that, etc.
@sly falcon I haven't dug into it... any cool new features in 3.3 jump out at you that we might want to expose later?
heh...I haven't gotten that far. I was looking into newer versions of the IDF for the NTP issue Jerry is working on, and discovered that they've released a few new 3.x versions since I last updated the docs
IMHO, the biggest thing 3.3 has going for it, is it's a LTS (Long Term Support) release with support until March of 2022
sure, if particularly cool features come out in the 4.x version they're working on, we can look into that....but the NINA firmware seems to be particularly persnickety to update, so my thought is that we don't want to rev it more often than we really have to
or, as an alternative, we have a version that Adafruit can use on shipping hardware, and then another version/branch/thingy that folks who are willing to dive in and get their hands dirty can mess with for advanced features
The docs for v3.3 of the IDF are here https://docs.espressif.com/projects/esp-idf/en/v3.3/
in case anyone wants to read up
and the release notes https://github.com/espressif/esp-idf/releases/tag/v3.3
Cool, thanks for all that. I'll dig in. It does make sense to minimize the general Adafruit NINA updates.
@sly falcon One thing I was taking a look at today was moving WiFiClientSecure from the arduino-esp32 library to wifi-nina so we can use certificates
Not sure what you've done regarding the IDF, but I'm not sure entirely where to go regarding implementing that since arduino already implemented the WiFiClient within WiFiNINA, possibly we can pull the SSL library and functions?
@prime flower oh man....thinking about what you just said is breaking my brain...heh.....thinking about this while trying to do my day job hurts sometimes π
@sly falcon WiFiSSLCLient seems like it exposes some certificate functionality https://github.com/adafruit/nina-fw/blob/master/arduino/libraries/WiFi/src/WiFiSSLClient.h#L62
got it. So the stuff I'm planning on doing re: the IDF, is simply documentation updates and then I was going to post a binary for folks here like Jerry and anecdata to use if they want
From Jerry's message earlier, it sounds like simply compiling against v3.3 of the IDF "just works"....no code changes required
so, in theory, the SSL stuff you wanna do, shouldn't conflict with what I was going to do
did I answer your question? I'm not convinced I did
It shouldnt conflict.
ok, cool
Updating to v3.3 would be great, though.
There's actually a wifi provisioning service v3.3 adds, too, but CircuitPython handles provisioning pretty well rn
okie
I've never asked, but it would be interesting at some point to know what would cause Adafruit to start shipping the newer NINA binaries with the WPA2 Enterprise support and the work you're doing
but I think we can save that for another day
I would think moving to v3.3 of the IDF would help
but maybe there's other reasons Limor is hesitant
Β―_(γ)_/Β―
is there a way to get around this mpy-cross hiccup?
https://travis-ci.org/caternuson/Adafruit_CircuitPython_RGB_Display/builds/589650383#L654
it's not liking this bit of code:
https://github.com/caternuson/Adafruit_CircuitPython_RGB_Display/blob/ladyada_image/adafruit_rgb_display/rgb.py#L49
@tidal kiln maybe try:
if platform.python_implementation() == "CPython":
though that "can't assign to expression" is a weird SyntaxError for that line... π€
it's not liking the use of const() in the try
works if i just change to simple assignment
but doesn't complain about line 45. hooray. π
only other shot-in-the-dark: put the math in a set of parens?
const((320*240)), to explain myself better.
even this throws the error
try:
_BUFFER_SIZE = const(1)
except ImportError:
_BUFFER_SIZE = const(2)
hrm. odd. that seems like a mpy-cross bug...
yah. and you're right. the line number reported was off.
nothing is jumping out in the micropython issues.
const() is a hack and should only be used at the beginning of the file, in global scope, without conditionals
was wondering if it was something like that
so really no way to conditionally do this and still use const?
because the way it is implemented, it does search and replace while parsing
you can't have conditionals, because at the time const is being replaced, no code has been run yet
TIL. thanks for the clarification @stuck elbow. would something like this work?
# If we're on CPython, we have more memory, so get a big ol chunk!
is_cpython = False
try:
import platform
if "CPython" in platform.python_implementation():
is_cpython = True
except ImportError:
pass
if is_cpython:
_BUFFER_SIZE = const(320*240) # blit the whole thing at once
else:
_BUFFER_SIZE = const(256)
no
imagine you are doing the const() substitution yourself
just replacing every instance of that variable with a number
what number will you use?
you can only use const() when the value is known before the program runs
otherwise it wouldn't be a constant anymore, would it?
ok. so will just revert to a regular variable.
is that really a huge hit? for just one parameter?
cool. thanks @stuck elbow
@sly falcon Where does the 1.3.1 binary live now? The Ent stuff was merged, but the NINA repository doesn't seem to have a place for the binary, only instructions for creating it. I wonder if it's worth an issue or PR, or at least a pointer to a place where the various versions are kept so people can pick what they need.
Good point about not having a lot of refreshes, Adafruit probably wants to ship something reasonably consistent. And it's a whole different process (than UF2 or code/libs) for newer users to upgrade their NINA FW.
@crimson ferry I'm not sure the 1.3.1 binary made it to the Learn guide, but I have a copy on GitHub https://gist.github.com/docmollo/c88fa7655b0d6a2e26c92a9ecb97e781
Cool, thanks. It seems important that the complete history of released binaries is available in some official place, especially as we envision several changes over time.
Does CircuitPython's time module support strptime?
@crimson ferry I'm down with that. Maybe we can get an official Adafruit person to help us out with a place to keep those?
I know @meager fog added my first binary I released with WPA2 Enterprise.....let me check Learn to see if that's still there
yup...still there: https://learn.adafruit.com/adding-a-wifi-co-processor-to-circuitpython-esp8266-esp32/firmware-files#esp32-only-spi-firmware-3-2
So it's buried in Learn assets. Even that is OK (but not ideal) as long as there is a listing of available binaries for download.
agreed
there are several firmware release things that are done via Learn guides
maybe we could ask about a corner of circuitpython.org for the files
Β―_(γ)_/Β―
That's not a bad idea. Or if not that, GitHub.
but on that note, I'm heading home....I'll be back in a bit
right on
@meager fog sorry I missed your message - wasn't feeling well and went offline for the afternoon. I'll put everything in first thing tomorrow.
@ionic elk all good - just mkaing sure we didnt miss it!
@sly falcon @solar whale @prime flower I could be misinterpreting, but the Arduino guide on WiFi.getTime() says "Get the time in seconds since January 1st, 1970. The time is retrieved from the WiFi module which periodically fetches the NTP time from an NTP server." ...reads like it doesn't actually do an ntp on-demand. I'm looking through the code now to see if I can figure it out. May explain the startup delay.
This was for WINC1500: https://github.com/arduino-libraries/WiFi101/issues/125, but I wonder if it's implemented the same on ESP32. My round-trip response times for esp.get_time() are usually 6-10ms, which tells me I'm not likely to be going out to the internet for those calls (my pings are in the tens of ms). Tempting to roll my own ntp over udp.
Addendum: yup, Arduino ESP8266s on the same network running artisinally hand-crafted ntp over udp are getting ntp round-trip durations in the low 10s of ms, like ping as expected.
This should put libraries.json in the correct folder on S3, avoiding the access denied error.
Haha.. I'm watching "Better Than Us" (a Russian version of the "what is wemade sentient androids" trope) and there's a closeup of code on a screen and it's Python.
Someone needs to update this for python http://www.hackertyper.com
@crimson ferry So you're correct - if you look in the NINA code, you'll see all it does is call time: https://github.com/adafruit/nina-fw/blob/master/arduino/libraries/WiFi/src/WiFi.cpp#L508
ugh
The fancy stuff is happening in the background....check out what happens when we init WiFi: https://github.com/adafruit/nina-fw/blob/master/arduino/libraries/WiFi/src/WiFi.cpp#L568
and depending on ESP to get ntp on some interval
Also, in that first link (line 508) is the reason why @solar whale was getting zero if requesting the time was done immediately after the wifi connection came up
The sntp_* functions in the init section are part of the Espressif IDF: https://github.com/espressif/esp-lwip/blob/3ed39f27981e7738c0a454f9e83b8e5164b7078b/src/apps/sntp/sntp.c
Fork of lwIP (https://savannah.nongnu.org/projects/lwip/) with ESP-IDF specific patches - espressif/esp-lwip
hasn't been fetched yet by ESP
Basically, what the NINA firmware is doing is providing a highly abstracted set of functions and there's really a lot going on behind the curtain
yeah, and I know it's only milliseconds, but I like to be in control of as many of the sources of error as possible
heh
when I first started working on the NINA firmware a few months back to add the WPA2 Enterprise functionality, I hadn't had any prior experience with the NINA stuff or the IDF.....it's all really cool stuff....
At some level, it's black box though, right? All of the IDF is an API?
The ESP32 side of things works pretty well....personally, I think we just need to add a bit more behind the scenes stuff on the ESP32SPI CP library to take into account the ESP32 might not be ready for us yet
'0' basically indicates that?
well...yes, it provides an API and a ton of libraries that do the heavy lifting
and, I think (haven't spent time digging into this yet), some FreeRTOS stuff, too, that's running on the ESP#2
yup - the zero means the SNTP library hasn't gotten time from a NTP server yet
what I did find, is that the NINA firmware hard-codes the NTP servers to use: https://github.com/adafruit/nina-fw/blob/master/arduino/libraries/WiFi/src/WiFi.cpp#L578
it does use 3.....and it's not using country/location specific hosts in the NTP Pool Project...so my first take, is that those three servers are fine
yeah, especially since there are no fractional seconds being returned π
but it's something to keep in mind for the future...maybe we want to extend the NINA firmware to allow those to be set manually if so desired
That would be a natural thing to do.
heh
udp/ntp gives fractional seconds, so my Arduino clocks are always right and matching to the second π
iirc DNS to *.pool.ntp.org does some geography optimization --> yeah "Looking up pool.ntp.org (or 0.pool.ntp.org, 1.pool.ntp.org, etc) will usually return IP addresses for servers in or close to your country. For most users this will give the best results."
hah! beat me to that!
ok....I'm gonna go relax for a bit before bed... hope you have a good rest of your day/night, @crimson ferry
thx (night), have a good one
I just noticed some of the neopixel products imply they won't work with the blooming selection of circuitpython products (not usable by interpreting microcontrollers), I suspect that is revisable
https://www.adafruit.com/product/1138
@idle owl it works! Hurrah. Thank you. π
First draft of Circup docs is now up on ReadTheDocs here: https://circup.readthedocs.io/en/latest/ all feedback, constructive criticism and suggestions most welcome..! π
(This IS a first draft, PR's also most welcome)
@smoky zenith I don't think that waring excludes CircuitPython since the Neopixel driver is part of the C "core". I may be wrong on this, @tulip sleet or @slender iron can you comment on this?
evolution
Still getting the same write_then_readinto problem as last night. I just updated the issue. https://github.com/adafruit/Adafruit_CircuitPython_INA219/issues/12
Includes fixes to the Robo HAT MM1 board. Fixes:
- SPI interface (changed pins)
- GPS interface (changed pins)
- RPi Serial interface (swapped pins)
- removed frozen bus device library (see issue 12
16K of flash free in English, let's see if all languages build now :)
I really probably should have picked this up by now from the weekly meetings but does the monster eyeball bonnet thingy work with Circuitpython?
Also @meager fog parts ordered whenever you're online again. Just need the F405 added to the order - wasn't sure if there was something I was supposed to link for that to be done automatically, or if it was just the email to you? If I should add something else just let me know.
@slender iron what kinds of flash chips should I grab off digikey?
@ionic elk eyecode is in arduino only
@ionic elk here are the instructions for when you order and you need something added
Please place a new order on Adafruit.com. For shipping, please choose the FASTEST SHIPPING!
During Step 4 of checkout, select the payment option βPURCHASE ORDER.β And then, from the options that appear, select βREPLACEMENT ORDER.β
For the Step 5 Replacement Authorization Number, please use: RMA FORPHIL
While a note about payment for purchase orders will appear, no payment is required. This replacement order is free of charge. Remember to choose PURCHASE ORDER > REPLACEMENT ORDER as the payment option and we'll send this out right away!
Then email pt and myself with the order number
the feather was sent out
@ionic elk were you planning on hand-wiring SPI flash with an 8-SOIC breakout?
@meager fog that's what I was suggesting for testing
get 5 pcs of each memory size - note the smaller-capacitty chips come in 0.15" or 0.2" widths. once you get to 4/8/16 they may only be available in fat 0.2"
and a couple https://www.adafruit.com/product/1212
@tidal kiln when u have a moment we can chat about SPI
ok. go for it.
so i didnt get any complaints about SPI packet length on windows, so could be a pyusb thing on linux (which is OK)
a limit of 16kb per packet?
if so, please add the chunkin' within Blinka
because rgbdisplay should be agnostic - it sends out a buffer, underlying protocol says how thats done
it seems hardwired in pyftdi:
https://github.com/eblot/pyftdi/blob/master/pyftdi/spi.py#L259
@meager fog I have a bunch of the SOIC boards already and also got some more as @slender iron suggested, so I should be good for breakouts. I'll grab the GDs and the clip now.
@tidal kiln odd cause 135x240x2 > 16KB
@tidal kiln still...thats fine, just 'slice' the bytearray in Blinka if its > 16KB
yep. doing that now and seems to work.
so there are two things - setting _BUFFER_SIZE
and also that pyftdi limit
so no need to limit _BUFFER_SIZE because of pyftdi
just need to chunk-ify the write
@tidal kiln yeah ideally we should not have to know its an FTDI
it should be transparant
@tidal kiln yeah put it in blinka
libraries shouldnt have different behavior based on the hardware used
gotcha. workin on that now.
yep. it works.
refresh speed reasonable?
haven't really tested that yet
hit this spi write issue, so started working that
have only done a single screen write so far
@3ach What version are you using? I'm actually very surprised three worked. I think I've knocked it down to 1 in 5.x. All display objects and their busses are statically allocated so they can live outside the vm. The limit is controlled by CIRCUITPY_DISPLAY_LIMIT.
I'm unsure if that's how I want it to keep working because the terminal can only show on one screen at a time now. If we stick with that, then ...
@tidal kiln cute π
@tidal kiln on linux you may be able to run the fbcp demo. very slow but functional π
@ionic elk yay i was going to do more testing of libraries but ran out of disk space, is there a reason we picked 32KB for the internal flash? these chips are fairly chonky, could maybe fit 128KB?
@meager fog The STM32 has wonky flash sectors: 4 segments of 16KB, 1 of 64kb, and then a bunch that are 128kb. Not only that, but the first segment of 16KB HAS to have the interrupt table in it, so that's out.
we dont put it at the end of flash?
So we only get 48KB left without using the 64KB sector, which is hard to buffer when writing. On the 405, I could use the CCRAM as a buffer section to get better flash utilization.
whats the last sector?
Last sector?
we separate out a sector for file storage yes?
and we hve to erase the whole thing at once?
Yes so here's what we have: Sector 0(16KBx1) stores ISR vector/startup code. Sectors 1-3 (16KBx3) are the fat filesystem. Sector 4 (64KB) and sectors 5-7 (128KBx3) are used for code.
All sectors must be bulk erased
So if you don't want to wipe them, you need to copy them to RAM, which is hard when the size of the sector IS the size of your RAM, or half of it D:
Micropython saves a little extra flash by forcing the ff object into sector 0 alongside the ISR vector but that doesn't really free up any extra filesystem space.
which MCU is this?
The real savings are when you use the 64KB of CCRAM on the F405 to buffer the filesystem. Or, on the F412, we could allow the 64KB sector to be used since we've got 256KB of RAM
This is all the STM32 MCUs
@cerulean pawn they all share the same flash organization, just different quantities of it. If we go up to high end ones like the F469 we would get some more sectors of 16KB after the 128K ones.
for some reason I remember that F407 etc had 512byte sectors which could be erased one by one
I'll have to look into that maybe it's something special
Foundation-line specific feature or some such. But Micropython doesn't make use of it so I'm not optimistic
(I might be wrong, I haven't been doing anything with ST chips for some time)
@ionic elk how does micropython handle this?
im weirded out by it π
128KB is basically all the RAM
It is, yes! Big pain
Only difference between my approach and micropython is that I don't use the 64KB section in the filesystem because that's half the ram on most starter line chips.
They use the three 16KB, and then the 64KB
But on the 405 they buffer the 64KB in CCRAM
and is CCRAM not workin?
I don't know what they do for starter line chips that don't have CCRAm
or just havent gotten to CCRAM hacking
It's there I just haven't written it yet yes π
lol ok
ok well long term we may have to do that if we want to support a wide range of boars
but for now - you'll get SPI going fast i think
Because it's only the F405, F407 and other foundation lines that have it
the F411 and F412 don't have it
so we'll just use our tried-n-true SPI Flash tekniq
truetrue
sure.
Also @meager fog I just want to check, you're seeing 32KB even though I've got 48K set out for it... that's natural for a FAT filesystem, right? I assumed it's using 16KB for some internal purpose
I see the same thing to be clear, just never questioned it. Figured it was organizational use.
Or should we be seeing the full 48K? Something I need to fix?
@ionic elk hmm thats odd, no idea whats up with the missing 16kb
could ask scott or dan when they're around
lemme plug in my feather
Also, @meager fog is there any example code for the ssd1306 that uses SPI?
there is
I'm setting up a control for my SPI tests on the FeatherM4E but I can't find anything,
it's all I2c
use
and then
people rarely use SPI for these displays
if you have a BMx280
or similar sensor, those are our 'gold standard' for test because they do both read and write
whereas SSD1306 is write-only
Oh there it is
Yeah I just missed it when I was browsing through
BMx280? is that a display?
oh yes ok I see
available with both i2c/spi interfacs
so a good test board
I actually may have just gotten one of those on Scott's suggestion
could be!
I could also probably test it with some of my epaper
though we don't have libraries written for that so I'd have to spin my onw
thats also write-only
What is PIL? from PIL import Image, ImageDraw, ImageFont
python imaging library
I'm getting this error ImportError: no module named 'PIL'
its CPython
Something I need to include that's not on the lib page?
hiya please do the following
take this example
and replace the i2c part with the spi initializationf rom this chunk https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/blob/master/examples/ssd1306_pillow_demo.py#L24
#oled_cs = digitalio.DigitalInOut(board.D5)
#oled_dc = digitalio.DigitalInOut(board.D6)
#oled = adafruit_ssd1306.SSD1306_SPI(WIDTH, HEIGHT, spi, oled_dc, oled_reset, oled_cs)
thats the only test you should be running
I was just hoping to get this image one going, was wondering why it wasn't importing successfully
ok, np
@gilded cradle please update your pillow examples with this text
Ok
@solar whale @smoky zenith I believe you are referring to this in the product description: Our detailed NeoPixel Uberguide has everything you need to use NeoPixels in any shape and size. Including ready-to-go library & example code for the Arduino UNO/Duemilanove/Diecimila, Flora/Micro/Leonardo, Trinket/Gemma, Arduino Due & Arduino Mega/ADK (all versions). That was written years ago and could be revised.
@meager fog btw, I did get NameError: name 'FileNotFoundError' is not defined when I didn't have the .bin in the directory, rather than the text error as written. Is that a setup issue or something I should note somewhere?
@tulip sleet I think he was referting to but it will not work with the Basic Stamp, NETduino, any other interpreted/virtual machine microprocessor
and assuming that ruled out CircuitPython
@solar whale ok thanks, will see about revising these in the long run
BTW -- that was from https://www.adafruit.com/product/1138?length=1
@raven canopy , we were talking about perceived loudness vs. actual loudness. According to Audacity, in my experiment, the magnitude of the higher frequency notes is greater.
CPX higher is louder
@ionic elk which example gave you the error with the missing bin file?
we could run circuitpython on this, right? https://wiki.pine64.org/index.php/PineTime
@tulip sleet Can you glance at another code.py for me to let me know if it's correct for now?
sure
@tulip sleet
Still think we should have built map_range into CircuitPython somehow, it's the most used thing out of simpleio and it's annoying to have to use simpleio only for that purpose.
code looks good. I would just copy the map_range def into the sample code; it's so simple
is it? looked long to me. I'll look again.
Thanks for checking my code
def map_range(x, in_min, in_max, out_min, out_max):
"""
Maps a number from one range to another.
Note: This implementation handles values < in_min differently than arduino's map function does.
:return: Returns value mapped to new range
:rtype: float
"""
in_range = in_max - in_min
in_delta = x - in_min
if in_range != 0:
mapped = in_delta / in_range
elif in_delta != 0:
mapped = in_delta
else:
mapped = .5
mapped *= out_max - out_min
mapped += out_min
if out_min <= out_max:
return max(min(mapped, out_max), out_min)
return min(max(mapped, out_max), out_min)```
Not super long I guess, but not short either.
there is a simpler one you just used the other day in some other code; this is more robust but mostly unnecessary
looking...
hmm
def map_range(x, in_min, in_max, out_min, out_max):
mapped = (x-in_min) * (out_max - out_min) / (in_max-in_min) + out_min
if out_min <= out_max:
return max(min(mapped, out_max), out_min)
return min(max(mapped, out_max), out_min)
but even simpler that doesn't bother to do the if check, will find that one too
def scale(value):
"""Scale an value from 0-65535 (AnalogIn range) to 0-255 (RGB range)"""
return int(value / 65535 * 255)
oi oh right. Yeah.
do something like that, since you are mapping a 0-based value
That I am. That's perfect.
so just change the max values, or parameterize that function
I think the max analog value is accurate?
I'm never sure what the max value is for light sensor. It's an analogin thing so I assume that high.
@stuck elbow re pine64, if/when they switch to '840 from '832, yes
@idle owl are there two return statements in a row in that code you pasted about 10 mins ago?
@pearl notch that's just some kidn of pasting problem. It's OK in the originaL: https://github.com/adafruit/Adafruit_CircuitPython_SimpleIO/blob/master/simpleio.py#L264
Ah, good
@idle owl this example seems to indicate it could go up to 65535 (rounded down to 62000 to make the neopixels scale properly): https://learn.adafruit.com/adafruit-circuit-playground-express/playground-light-sensor
it will scale to a floating value, but that should be fine
Yah it was a choppy plot as an integer
I thought it was needed for color (since has to be 0-255 as an int)
so I removed the int()
yeah, not a color so no prob
Ok, thank you for taking a look. I'll PR the code to the BLE repo.
@tulip sleet that would be the most pythonic watch out there :)
After seeing the new iPad os works with CP I tried to connect a Serpente to my Nokia (running Pie) Type-C to Type-C and it gets recognized as a keyboard and a USB drive, it claims I need to format it to make it usable, I do that but then it just says the same thing. No file manager or text editor wants to recognize the external drive. So close π
Hereβs my video of the Tilting Arpeggios project I introduced on Mondayβs weekly call. https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground/pull/70
@idle owl, if you like it, we might add it to the libraryβs advanced examples.
@pearl notch It sounded great on the call! It's in my email and on my list, but I won't be able to get to it until Monday or Tuesday. If Tuesday rolls around and you still haven't heard from me, please ping me again as that's the latest I intend to get to it.
No rush at all! Iβm amazed at how much work you manage to get done. π
@solar whale I'm in the process of writing an Upgrading ESP32 Firmware (nina-fw), I've highlighted upgrading from stock to 1.3.0 which incls. @sly falcon 's ENT changes.
Iβll be happy to try to follow it when itβs ready.
@prime flower cool beans! I'm happy to test out, too
@prime flower did you see the chatter that @crimson ferry and I had about someplace to keep community and Adafruit maintained NINA fw images/binaries?
anyone know how to connect a USC-B IPad with IOS 13 to a CP device?
@meager fog oof yeah wow the stm32 flash filesystem SUCKS for libraries.
I'm trying to just get the baseline on there for an OLED and it's just not having it
I think I need to dig deeper on how micropython handles things, it can't be this bad for their MCU-flash only boards.
yeah i was tryin' to tell ya
please use the BMPx80
it will be a better / easier experience!
Yeah I'll switch to it as soon as it arrives
for now you can use your scope or logic analyzer to look at SPI data
Is there any point in doing flash SPI before regular devices? I have an IS25LQ from another person in A2
no
do plain SPI first
you can send incrementing digits and watch CS/SCLK/MOSI
then tie MISO to MOSI for echo test
once busio is working, you can then add flash SPI
How about programming an arduino to be an SPI slave?
@ionic elk im giving you really good advice from decades of doing this sorta thing, please take it π
@meager fog Ok sorry! I didn't mean to sound like I was blowing you off, I'll definitely take a logic analyzer to it first as you suggested. I was just thinking about more tests I could run, but I can just stick to the data.
all good! im trying to save you from a lot of frustration π
SPI is not very complex, no need to complicate it
I appreciate the value of not shotgun programming π
yep!
Also @gilded cradle it was this sketch right here https://github.com/adafruit/Adafruit_CircuitPython_SSD1306/blob/master/examples/ssd1306_framebuftest.py
Ok, thanks
running on Feather M4ex
(runs just fine with the file included and pretty much fine without it, just that the error is wrong)
Ah, I get it. I think I remember seeing something similar and it might just need a slight tweak such as using the correct Error that is returned.
Hello there, someone on #help-with-circuitpython pointed me to a conversation here on 9/4 between @idle owl and @tulip sleet in relation to touchio on the SAMD51 based boards. I'm wondering if anyone has any other insight on this as I'm trying to use a Hallowing M4 and touchio but getting an error "No pulldown on pin; 1Mohm recommended". The conversation noted that "On Cortex-M4 chipsets (SAMD51, nRF52840), touchio does not use the built-in touch controller. It uses a 1MOhm resistor as a pulldown to detect capacitive touch" and I think I see the fixes in place in CircuitPython to make that happen but maybe I'm missing something. Trying to get a halloween project in place for my son for this weekend (very early party) and need help getting one of your old M0 projects running on the M4.
@broken vale https://github.com/makermelissa/Adafruit_Learning_System_Guides/blob/master/Hallowing_Jump_Sound/jump-sound.py
Awesome, I was looking all over for any new M4 code that might answer it but you give me exactly what I needed. Mario will live. Thanks @meager fog
π
@meager fog Sorry for spamming the topic a bit but I just wanted to let you know that my son (8) and daughter (6) were hanging over my shoulder as you were helping us and also just so happened to playing with their Ruby and Gus stuffed toys (we just got them today with some other items we needed). They were really impressed when I told them them that you were the same person in the YouTube videos and thought it was awesome that you were helping us out. Just wanted to share.
@solar whale May have to wait for a USB-C camera adapter. I always assumed there was some logic in those things, and that seems to pan out: I tried lightning to USB-A male to USB OTG and no dice.
@crimson ferry thanks! I tried that as well. Just wanted to make sure I was not overlooking something.
@sly falcon I completely forgot I'm gone Sat-Sun. Sorry about that! But I think we can work reasonably independently. I have Discord app on my phone, just that I'll be afk. So this will be 1.3.2 if I read the files right. The 0x50+ range of command codes is unused other than pin mode, digital write and analog write, so I assume we'll tack on digital read and analog read? I'll mirror whatever you do.
@sly falcon I did not re: somewhere to keep ninafw images/binaries
@crimson ferry yeah, I think we can do this asynchronously....and yeah, the 0x50 range sounds like a likely place to put this. I'll take a peek at things Saturday and confirm with you. Hope you have a good time and weekend!
@prime flower no worries....I'll bring it up again in the future when I've got more time. Hope you have a good weekend!
@crimson ferry Hopefully this will do the trick on the IPad https://www.apple.com/shop/product/MJ1M2AM/A/usb-c-to-usb-adapter
The USB-C to USB Adapter lets you connect your iOS devices and USB-C or Thunderbolt 3 (USB-C) enabled Mac. Buy now a apple.com
It would be interesting to compare signals into and out of those camera adapters to see what logic, if any, is happening inside,
The USB-C-> USB cable works fine on my iPad -- I forgot I had one π³
Nice! Interesting too... I wonder why (some) other USB data+power cable combinations don't work.
@solar whale Is it a single USB-C male to USB micro cable into a CP device?
no the adaptor has a female USB-A so I haveanothe USB-A to USB micro
now -- how do I get to REPL from the iPad??
copy / edit / paste worked well
I hope some editors start to support mounted drives natively
@ionic elk are ya coding today
@tidal kiln Q when yr around
yep
i want to archive
because its old and krusty
can you check the issues/PRs
is there anything that is also broken similarly in
ok. basic issue/PR clean up pre-archive? move / create new if needed in CP repo, etc?
yah
i saw you recently did some fixes in the cpy version
i just killed off the old python ssd1306
so im getting close π
sure. can take a look. want me to ping you for archive? or just go for it after issue/PR clean up?
@tidal kiln ping me after you check the issue/PR
and ask me if you have any Q's
like how to handle a wierd case
ok
@tidal kiln after that, LSM303 https://github.com/adafruit/Adafruit_Python_LSM303 (no rush, just making anote of it)
π
@slender iron got some q's re refactoring vfs stuff. I could write it up here or could talk.
@meager fog hi my computer exploded a bit this morning but I'm over it now. I probably won't have the PR in by tonight but I'll be working over the weekend on it.
I got the feather and everything too, and got A2's Saleae up and running
So I should be in a good spot
@meager fog by the way, I noticed that the SWD header is the SMD kind - would it be possible to pop a cable breakout, box header, and cable into a personal order I made this morning?
@ionic elk nope only ones with RMA can be added
we stock those items in the store
place a new order
ok
@meager fog i don't think there are any necessary carry overs from either the MAX or LSM repos, all issues/PRs made moot by CP version of libs
the only thing might be to add an issue in MAX repo to add fancier temp calc as an enhancement
@tidal kiln ok can move the issue over or make a new one
wanna close these together
π
sure. no issue to move. it'd be a new one, if you want.
the current lib just return register value:
https://github.com/adafruit/Adafruit_CircuitPython_MAX31855/blob/master/adafruit_max31855.py#L84
the older one looks like it did some kind of piecewise 9th order poly fit thing using thermocouple and cold-junction voltages
returning the register value may be good enough?
@tidal kiln weird lemme look
?
@slender iron is there a particular reason why SPI transfer functions in the common hal only return true or false, compared to I2C ones which return an error value?
yep. that.
@ionic elk spi is a 'nontransactional' protocol
you dont know if someone's ont he other side
so you can't tel anything other than whether data transmitted or not
i2c has ways of knowing if the client was there to get the message
@tidal kiln yeah lets port it over, looks nice
Ah ok, that makes sense
@meager fog ok - i'll create an issue in the CP lib for it
fixes some things in it
maybe we should add that capability before we close this library
cause it seems to be pretty useful
@tidal kiln you could use FT232 to help ya write it on your computer π
π
@tidal kiln ok i owe you the mac/win setup page yeah?
yes please
with ft232? or those repos?
@ionic elk I think it's just to provide better error messages for i2c. feel free to swap spi if errors need better responses
@tulip sleet just saw this after getting back from lunch
can chat if you still want to
I mean, I2C isn't really passing very sophisticated errors either.
It's literally success or EIO
Β―_(γ)_/Β―
Versus true or false on SPI
So I mean your call, sounds like either just a style question or maybe a push for more interesting error variety for I2C, which would be a small project
just leave it as is
what do you mean?
I didn't even see it required on the feather
Traceback (most recent call last):
File "code.py", line 7, in <module>
File "adafruit_bmp280.py", line 30, in <module>
ImportError: no module named 'math'
ah
CIRCUITPY_MATH
Oh, it's another sneaky module with no common_hal component
I thought it was a library thing, sorry
Should we try and sort out all the modules with no common_hal aspect, and not include them in MINIMAL_BUILD?
rephrase that - not exclude them via min build, since there's no reason to if they're not chip dependent.
ya, you can take a quick pass over it if you like
When doing dir() on a built-in, the getter is called. This is usually ok but causes issues when the property throws an exception. This was found when diring a _bleio.Characteristic.
Stack trace:
#4 0x0003785c in mp_call_function_n_kw (fun_in=0xa6188 <bleio_characteristic_get_value_obj>, n_args=1, n_kw=0, args=0x2003f8cc)
at ../../py/runtime.c:624
#5 0x000382b2 in mp_convert_member_lookup (self=0x2001cdb0, type=0xa621c <bleio_characteristic_type>,
member=0xa6198 <blei...
@ionic elk hiya st q when you're around
@slender iron & @meager fog: I think I'm going to preface the SPI PR with a separate one where I'm going to attempt some flash fixes. Something seems very off about the flash as is.
Oh yeah shoot
is the STM32f413 a close relative of the '412?
this person sent us a board with a '413, never heard of it
It is decently close as in it's the next level up on the starter line. It has a LOT of UART lines, like 10
@ionic elk similar enough HAL i hope
we'll let them know that its likely supported in a few months
It'd be near identical yeah. It just implements basically every single peripheral there is on the starter line
Will do
And everything reports itself as 2x as big as it should be
I think there may be something that I missed, under the impression that if things failed they would fail completely.
Might be as simple as the HAL bit writing
But I'll need to dig in a little bit.
On the upside I think that SPI is basically working, it's just hard to test because I can't even fit the BMP80 library on the flash
But the lines look good
@ionic elk oki yeah thats odd
do you need guideance from dan or scott?
@ionic elk of cousre, if SPI works, we can use the SPI flash chip
then thats our storage, we dont have to worry about the internal flash as much (altho, long term, it does need to be fixed#
@slender iron now i am back from dinner. vfs refactoring q has evolved a bit but would still like your input
kk, will head back to my desk. was downstairs while cleaners clean
same thing here sometimes
k, ready
@tidal kiln ok will add the windows ft232h instructions now
coolio. thanks!
@tidal kiln findin buggggz
@raven canopy if ya around wanna review my pr
im doing hardware tests
i can take a peek. i haz no EPDs to test though. π¦
its a stylistic PR - im testing with the EPDs now
or rather, no functional changing of logic
almost started saying "shouldn't this use busdevice"; then catches the PR title π
merged!
nice, @meager fog ! I think that fixed the 2C wing issue (https://github.com/adafruit/circuitpython/issues/2137)... text updates now, even down to seconds_per_frame=2 π [gone this w/e, but will test more when back]
? huh that is odd but could be
I running latest everything else on there, so... ?
dunno - im on CPython π
No, you're right, that's not even the right lib. I'm doing displayio. This is going to bug me.
Was wondering if there are detailed instructions available for everything that needs to be done/installed to get bluetooth working properly on the circuit playground bluefruit? I've been trying everything I find on the forum to get it working but haven't been successful. I'm really new at this so I need step by step instructions if there are any available.
Basically I need to know:
What needs to be installed on Raspbian to support bluefruit and how to install?
What needs to be installed on the circuit playground and how to install?
I completed all of the instructions from the link below but when I try to test I'm getting an error.
Link: https://github.com/adafruit/Adafruit_Python_BluefruitLE
Error:
pi@raspberrypi:~ $ sudo python uart_service.py
python: can't open file 'uart_service.py': [Errno 2] No such file or directory
I'm really stuck and would appreciate any help that can be offered. Thanks
Partially addresses item 2 of #2021.
-
Will now properly process modules that are included based on a different module's inclusion (
audiocore,audiomixer, ...).- It also handles multiple/conditional dependencies. Currently,
audiocoreis included if eitheraudioiooraudiopwmiois included, based on anifeq. Hopefully this implementation is future-proof enough.
- It also handles multiple/conditional dependencies. Currently,
-
Added processing of
CIRCUITPY_MINIMAL_BUILDandCIRCUITPY_DEFAULT_BUILD.
@gaunt zinc for the Circuitplyground bluefruit, you have to use the latest version of Circuitpython and the "alpha" release of the BLE library that is not in the regular "bundle" see the notes here https://learn.adafruit.com/adafruit-circuit-playground-bluefruit/circuitpython -- for the raspian side, I can't help much - I did not even know about that Adafruit_Python_Python Library -I'm trying to check it out now myself. For a first connection to the CircuitPLayground Bluefruit, if you have an iPhone or Android Phone, you can use the Bluefruit_LE_Connect app to communicate with it.
@gaunt zinc FYI -- I am not getting very far with the Adafruit_Python_BluefruitE library - I am seeing many of the already report issues. I usually use the IOS or Android app to communicate with my Bluefruit devices. I'm trying to learn more about the Adafruit_Python_BluefruitE Library but just wanted to update you.
@ionic elk just checkin' are you working today
Yep I was actually just going to pose a question here about micropython
lol ok ya can ask π
I notice that many of the peripheral support files have two versions. for instance, there is flash.c, but then also flashbdev.c. They provide essentially the same outcomes, but with a different API. And it appears that flashbdev.c is more recent. A similar spibdev.c exists in contrast to spi.c
I understand that this kind of redundancy isn't uncommon in micropython but I'm wondering if one of these modules is outright obsolete, or is otherwise not a good reference in some way
All of this is alongside the official ST documentation of course but the MP people often pick up on things that ST skims or actively omits, so I feel it's a good secondary reference
@meager fog hey, i'm here for a little bit. saw the FT232H duplex patch. how'd you run into that?
@tidal kiln eink displays
you need to send and receive data at the same time
which is not common for most SPI devices
usually you send or receive
works now - doing some eink hacking
cool. i think i just left it alone since the docs seemed to indicate it wasn't actually supported:
https://eblot.github.io/pyftdi/api/spi.html#pyftdi.spi.SpiPort.exchange
but maybe the docs need updating.
and it works OK to just set it true for all cases?
@tidal kiln it...seems to work?
its only for exchange, which you only use in that one function
without it, it was transmitting 2 bytes not 1 π
Interesting to read along because was just working on a bit level implementation of spi. I know there's no formal standard but was under the impression that duplex was baked in. E.g. the wikipedia sample code even does it.
@tidal kiln i did some of the windows setup code but need to try to find/make some clean-room win10 install
ha. yah. took me a bit to do same - getting a clean room linux setup for doing guide screen caps.
Quick page to @slender iron and @stuck elbow on the micropython flash topic if you happen to be online this weekend.
Since they were helpful on the i2c.c equivalent a few days ago
if not I'll probably have it figured out by monday anyhow
@ionic elk having spent 99% of my time understanding our structure, micropython diff always trips me up. the original commit message is the best i can point to explain it:
stm32: Factor out flash and SPI block-device code to separate files.
Prior to this patch, storage.c was a combination of code that handled
either internal flash or external SPI flash and exposed one of them as a
block device for the local storage. It was also exposed to the USB MSC.
This patch splits out the flash and SPI code to separate files, which each
provide a general block-device interface (at the C level). Then storage.c
just picks one of them to use as the local storage medium. The aim of this
factoring is to allow to add new block devices in the future and allow for
easier configurability.
bleh. i was probably also stuck thinking in terms of I2C's write_then_read. SPI wants it to be simul.
@meager fog cool. thanks for finding that. glad it worked too. any other bugs?
yeah. the commit message was helpful, to a point. π
i tried to climb through the #include chain. brain decided, "no.".
It's included, so presumably it's not just vestigial? Maybe?
Β―_(γ)_/Β―
Ok I figured it out. flashbdev is an IRQ/cache handler on top of flash.c.
Thanks for the tips @raven canopy
They just looked similar because of their defines but flasbdev isn't actually implementing the HAL for writes.
np. (though this is another in many situations where i question if i actually helped) π
you did! if I hadn't seen the connection to storage.c it would have been much more confusing.
also good to know that all the SPI flash storage is in spibdev.
@meager fog or @raven canopy do you know what my restrictions are in terms of IRQ use for port level work? I recall there are limits on what's allowed.
NEVERMIND another micropython red herring, there's no IRQs. I should give myself more time to avoid asking stupid questions, sorry.
@ionic elk no worries. i think its somewhat relative. for instance, i know that the SAMD port forces specific IRQ priorities. trying to find it...
A hugely helpful thing for this process, actually, would be if somebody could print me off the first 256 bytes of the filesystem on an NRF or SAMD board.
I don't have a debugger that can interface with SAMDs, sadly, and I don't have any NRF boards
oh man. i have the tools, but working through the how would take me a while. i've never really spent time at the dump 0x level.
Yeah I'm still puzzling through it but I'm wondering if a very high priority IRQ will be needed for flash to be fast enough when dealing with ST's monster 16K sector sizes
not as easy as x/256s 0x0000000 in gdb?
i could def give it a shot. lunch time, but i can give it a go after if noone comes along with it..
No pressure I'm kind of venting stream of consciousness over here, don't want to impose
haha. no worries. my plate is mostly clean as I've cleared most of my todo list for this week. been gearing up for a partition expansion on the laptop most of the morning. (why i continue dual boot this laptop makes little sense. dell warranty & support is expired...)
@tidal kiln none so far - this is really fun π
@ionic elk rant all ya want - no dumb questions or comments - this stuff is super hard!
I'm probably going to get an old tower into A2 this week and make the beefiest Linux machine I have ever used.
And then mostly use it for stuff I could run on a raspberry pi
I'm noticing that when reading addresses out of my flash, they seem suspiciously empty for a drive that's complaining about being full...
@ionic elk :/ could start with a stub function that just writes to a block, then use plain gcc not in cicuitpy to read/write from it
see whatcha get
i remember on avr8, there was a lot of confusion because a 'word' when writing is 16bits, but when reading, i think it was 8 bits
addressing was done by word, so you had to count your 2's π
I just dumped the entirety of my flash memory to a file. I'm confident that I don't have data corruption, since it works, and when looking at the file the blocks of file data don't seem to have any weird "spacing", but there are massive empty gaps between each chunk of data.
What's the root cause of "RuntimeError: SDA or SCL needs a pull up"
And, yes, the breakout has pullups.
I'm guessing it does a quick check at initialization to see if those two pins read high.
Refining: why does it think it needs pullups when they are already there? I've seen this happen occasionally for no visible reason.
I've seen a few people have issues with it, so it might be worth investigating.
Ok, I've got more data on the flash, maybe someone can help me recognize what this is. I've got three issues:
- the flash is slow. best I can tell, this is just not having a cache and not writing in bigger chunks. Should be fixed but not that big a deal.
- the flash is reporting itself as a full sector smaller than it is: 32K out of 48K allocated for it. Weird, proving hard to track down, but also not the biggest deal.
the flash is massively and erratically overestimating the amount of space needed for certain files.Nevermind it's just my mac putting literally 10K+ of cruft into the drive THANKS APPLE GOOD JOB π π
@ionic elk that was much easier than i expected...
@raven canopy Thanks!
@ionic elk Some info here: https://superuser.com/questions/89556/how-to-disable-creating-spotlight-v100-and-trash-folders-on-external-drive summary: you can't really prevent it :/ except the .DS_store files
I can prevent it by switching to linux π
yep. i can grab an nRF one too (PCA10056 dev board is all i have handy and setup)
also. flash on the SAMD51x19 is 512k, if you want a larger look.
@raven canopy that shouldn't be necessary. the SAMD one should be sufficient for debugging the drive size issue, and beyond that, my biggest issue was dumbest one - that every time you add a .mpy or .py file, Apple adds a 4K invisible cruft friend.
That's great, thanks.
Feel like a huge idiot, though. At least I made some progress on a new caching system.
hehe. i have them feels on the daily.
@raven canopy yes that's the way to go, but unfortunately you'd have to do it every time when plugging in a new board. On that page I linked they also list a command to prevent .DS_store creation on any external drive, so that's something.
hmm can you guys still see my posts? bot just yelled at me - I guess all forms of waste are off the table?
even mac generated ones
Yes
@timber mango yeah, that's the downside. but, also why boards ship with the . files on the flash drive. no way around it for getting a new board running though. π
@ionic elk yeah, @digital shore runs a tight ship.
though, yours was a rather benign one.
I thought so too, figured dog park descriptors would be ok, but I guess not
micropython snakes it way inside your USB port ... https://hackaday.io/project/167005-femu-an-esp32-wi-fibluetooth-board-in-tomu-form
Cool! It kinda looks like an m4 with an esp but that's the serial chip eh
bit odd to have an esp in a usb port seeing as it has no usb
@exotic pumice new ESP32 variant will have usb
yeah I know
@exotic pumice I can't explain that
Isn't that what the FTDI chip provides (USB - UART bridge)?
@crimson ferry FYI - this cable also works with the iPad Pro (USB-C) -- nothing else needed https://www.adafruit.com/product/3879
This PR adds SPI support to the STM32 F4 series, starting with the STM32F412 for testing purposes.
Seeking feedback in particular on clock settings. Boards like the F412 are configured by default with a peripheral bus clock of ~100MHz, and the max clock divisor for SPI speeds is 256, capping the minimum speed for SPI at 390kHz. Many libraries assume speeds much, much lower than this, such as the BMP280 sensor, which by default uses 10kHz. While it's easy to simply set the baud higher (the ...

