#circuitpython-dev
1 messages Β· Page 272 of 1
tested functionality. seems very random!
@ionic elk ok i think we're ready to start implementing some more boards in stm32 land
you could start with the meowbit
I was thinking about that example of the preprocessor macro FOUR from earlier and I realized that FOUR*FOUR == EIGHT and EIGHT*EIGHT == SIXTEEN and I think so on
I chuckled
Oops - Yes I am aware and fully understand. I wanted to get this PR opened ASAP after the conference. I will RTFM the guide on how to add a new board and update this. Changing the title to make it clear it's not ready to merge.
@hierophect That STM Feather board is bad in some way. I have another board that works fine. Also the bad board is very difficult to get into DFU mode (though it gets into REPL just fine).
OK, tested good on a good board!
6cce2d6 Implement Neopixel write, add defaults to f405 - hierophect
e1579a1 Merge branch 'pin-commonhal-additions' into stm... - hierophect
8a58af3 Merge branch 'pin-commonhal-additions' into stm... - hierophect
5f290d0 Merge branch 'pin-commonhal-additions' into stm... - hierophect
ee1559b Merge branch 'pin-commonhal-additions' into stm... - hierophect
@solar whale hurrah... I'm "polishing", fixing, testing and documenting today. All feedback greatly appreciated..! π
@tulip sleet just a followup on entering dfu on stm32f405 -- It seems to be hit or miss - it is workin OK most of the time for me this morning, but ocassionally it failes - here is the dmesg output for a failed attempt followed by a successful attempt (Ubuntu 18.04)
[Tue Nov 19 05:09:45 2019] usb 3-2.3: new full-speed USB device number 81 using xhci_hcd
[Tue Nov 19 05:09:46 2019] usb 3-2.3: device descriptor read/64, error -32
[Tue Nov 19 05:09:46 2019] usb 3-2.3: device descriptor read/64, error -32
[Tue Nov 19 05:09:47 2019] usb 3-2.3: new full-speed USB device number 82 using xhci_hcd
[Tue Nov 19 05:09:47 2019] usb 3-2.3: device descriptor read/64, error -32
[Tue Nov 19 05:09:48 2019] usb 3-2.3: device descriptor read/64, error -32
[Tue Nov 19 05:09:48 2019] usb 3-2-port3: attempt power cycle
[Tue Nov 19 05:09:48 2019] usb 3-2.3: new full-speed USB device number 83 using xhci_hcd
[Tue Nov 19 05:09:48 2019] usb 3-2.3: Device not responding to setup address.
[Tue Nov 19 05:09:49 2019] usb 3-2.3: Device not responding to setup address.
[Tue Nov 19 05:09:49 2019] usb 3-2.3: device not accepting address 83, error -71
[Tue Nov 19 05:09:49 2019] usb 3-2.3: new full-speed USB device number 84 using xhci_hcd
[Tue Nov 19 05:09:49 2019] usb 3-2.3: Device not responding to setup address.
[Tue Nov 19 05:09:49 2019] usb 3-2.3: Device not responding to setup address.
[Tue Nov 19 05:09:50 2019] usb 3-2.3: device not accepting address 84, error -71
[Tue Nov 19 05:09:50 2019] usb 3-2-port3: unable to enumerate USB device
[Tue Nov 19 05:10:00 2019] usb 3-2.3: device descriptor read/64, error -32
[Tue Nov 19 05:10:00 2019] usb 3-2.3: device descriptor read/64, error -32
[Tue Nov 19 05:10:01 2019] usb 3-2.3: new full-speed USB device number 86 using xhci_hcd
[Tue Nov 19 05:10:01 2019] usb 3-2.3: New USB device found, idVendor=0483, idProduct=df11
[Tue Nov 19 05:10:01 2019] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Tue Nov 19 05:10:01 2019] usb 3-2.3: Product: STM32 BOOTLOADER
[Tue Nov 19 05:10:01 2019] usb 3-2.3: Manufacturer: STMicroelectronics
[Tue Nov 19 05:10:01 2019] usb 3-2.3: SerialNumber: 2059378C354D
last time I saw errors like this, it was faulty cable
@stuck elbow this is a 1.5M USB-C cable -- the 2M cable did not work well at all -- so it may be marginal at 1.5 M -- I'll try a shorter cable to see if it is more stable.
or it may be that these are low quality cables ... good point -- I have some better ones somewhere .... digging.
@tulip sleet I think @stuck elbow is on to something regarding USB cables. I tried several cables and some do seem better than others. However I still do see somthing like this sometimes but it seems to recover itself. I am using USB A to USB c cables. I don't have any USB-C ports on this computer. ```[Tue Nov 19 06:43:39 2019] usb 3-2.3: USB disconnect, device number 19
[Tue Nov 19 06:43:41 2019] usb 3-2-port3: Cannot enable. Maybe the USB cable is bad?
[Tue Nov 19 06:43:41 2019] usb 3-2.3: new full-speed USB device number 21 using xhci_hcd
[Tue Nov 19 06:43:41 2019] usb 3-2.3: New USB device found, idVendor=0483, idProduct=df11
[Tue Nov 19 06:43:41 2019] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Tue Nov 19 06:43:41 2019] usb 3-2.3: Product: STM32 BOOTLOADER
[Tue Nov 19 06:43:41 2019] usb 3-2.3: Manufacturer: STMicroelectronics
[Tue Nov 19 06:43:41 2019] usb 3-2.3: SerialNumber: 2059378C354D
[Tue Nov 19 06:44:03 2019] usb 3-2.3: USB disconnect, device number 21
[Tue Nov 19 06:44:04 2019] usb 3-2-port3: Cannot enable. Maybe the USB cable is bad?
[Tue Nov 19 06:44:05 2019] usb 3-2-port3: Cannot enable. Maybe the USB cable is bad?
[Tue Nov 19 06:44:05 2019] usb 3-2-port3: attempt power cycle
[Tue Nov 19 06:44:06 2019] usb 3-2.3: new full-speed USB device number 24 using xhci_hcd
[Tue Nov 19 06:44:06 2019] usb 3-2.3: New USB device found, idVendor=0483, idProduct=df11
[Tue Nov 19 06:44:06 2019] usb 3-2.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Tue Nov 19 06:44:06 2019] usb 3-2.3: Product: STM32 BOOTLOADER
[Tue Nov 19 06:44:06 2019] usb 3-2.3: Manufacturer: STMicroelectronics
[Tue Nov 19 06:44:06 2019] usb 3-2.3: SerialNumber: 2059378C354D
@meager fog already on it! I'm adding the Meowbit, the PybNano, and the blackpill-style board you sent me. Anything else you want to add on there that I should pick up?
carefully gaffer-tapes a Raspberry Pi to its USB-C cable to shove it off the edge of the balcony to get a GPS lock
now has to figure out how to remove the gaffer-tape
@meager fog did a few more BLE radio distance measurements -- highly variable - start losing it badly at about 5m.
@solar whale @timber mango I have one board that won't go into DFU at all. I am suspicious this is clocks problem, maybe having to do with factory calibration data getting damaged. That is just a hypothesis, only circumstantial evidence to suggests that. I also saw differences of DFU not coming up, based on different-length cables
i am going out soon but will be back in less than 2 hours
@tulip sleet thanks -- let me know if theree are things I can test.
@ionic elk are you using the RC clock or the 12MHz crystal for the Feather 405 base clock? It would be good to use the crystal clock. There is also a 32.768kHz clock on the board for RTC use
This may be part of the explanation of your slightly different timing values for neopixels, my board with a flaky neopixel, and also the DFU issues
but i need to look at other stuff too, such as what the DFU bootloader does for its clocks (presumably it uses an RC clock, since it doesn't know if there a crystals on board). I also wnat to see how factory calibration data is used for the RC clocks
@meager fog followup on BLE radio range -- now receiveing at nealy 10m -- much reduced rate, but receiving -- not at all clear what impacts the range -- lots of variablility.
@tulip sleet I'm using the external clock for sure! you can view all the clock settings and divisors in peripherals/stm32f4/stm32f405/clocks.c. Still need to figure out exactly how we want those clock settings set, however
i am worried the factory cal data has somehow gotten smashed, or is just not being used
so RCC_OSCILLATORTYPE_HSE is the 12MHz xtal?
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 12;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
HSE on, PLL on with source HSE, divisor M set to the #MHz, PLL it to 168MHz, Q sets USB to 48MHz
yes, trying to figure out why the bad board does USB in CIRCUITPY just fine, doesn't do neopixel clock well, and can barely do DFU (like 1 out of 20 times)
You could send it to me and I could take a look
myabe so; anyway I have to leave now but will be back ~11:30am
HAL_RCC_GetSysClockFreq() is useful
Actually, yeah, the first thing to do would be to toss HAL_RCC_GetSysClockFreq(), HAL_RCC_GetPCLK1Freq(), and HAL_RCC_GetPCLK2Freq() into port.c and see what they return.
They're calculated off what the HAL hands them, but you could directly compare them to clockspeeds on SPI or the timers and see how they compare
@ionic elk are you saying there is circuitpython for the meowbit now?
good morning!
what is the current status of the pygamer? It's been a while but I don't see anything that may looks like Arcada for exemple. is it abandoned?
@lethal abyss you can use Stage on it
or DisplayIO, if you need larger sprites/tiles and don't mind a small speed hit
Yes! but I'm surprised myself that there's not more activity around the fabulous potential of PyGamer (and not only with CircuitPython, but also with C++)
maybe it's just me, I thought there will be content specific to the pygamer, some easy to go framework, something I can use with kids to transition from arcade.makecode to python
Yes, it is very understandable, but the forum does not seem to reveal a particular request from the community either... it is a pity....
I imagine there could be a contest posted to some game-making community
Do you think there is enough libraries for making simple games with kids ?
I have this really long-term dream of making a generic adventure/jrpg framework for CircuitPython, something like the early RPGMaker
what could be the starting point of such a thing?
there is enough right now for making games, but it requires experience and knowledge about how games work, so not for kids
a parser for the tmx files, I suppose?
or a converter from tmx to some binary format that would be easier on the memory
is it the file format for tilemaps?
It is precisely the ideal pretext to develop learning guides around video game programming with PyGamer... but it would require volunteers for this... who have time... or who wish to take it
it's really annoying for me, because I would love to work on it, and I think I have some ideas about how to do it well, but there are also so many other things I could work on that seem more important
I totally understand your frustration!
I think that in the end what people want is free games and/or emulators to play the games they already know, and not writing new games
what if I start something, even very basic, let's say adapt an existing python parser to circuitpython. Will it help?
yes... that's the conclusion I came to as well (in another community)... and it's really a shame
or is it better to start fresh
I can't promise anything
I know you, I won't expect promise you can't fullfill
but I'm not afraid of not having enough knowledge if I know my time is useful to more than one
it would need to use displayio and not stage, by the way, because stage only has 16 tile kinds per layer
and you can't really do a proper map for an adventure game with that, unless you have a lot of layers
a pity, I knew a little bit Stage π but anyway
displayio is very similar, only more flexible
I strongly believe in both pygamer and 32blit, except I have a pygamer on my desk :)
I'll start tinkering around this idea, and I'll ask question on #help-with-circuitpython
I'm not holding my breath with 32blit, unless they hire a whole team of programmers
I don't see any difference with the pygamer
yeah, and pygamer is not a resounding success
I agree
at least I can now write my games for ludum dare or whatever and say "you can actually get a console it runs on, you don't have to build it yourself"
which is an improvement from the previous situation
in a way
let's say I'll get experience with pygamer, maybe 32blit, and I'll be ready for the mass produced pewpew M4 or whatever with screen π
Hi folks, I've just updated the radio module to avoid duplications of received messages. Would love feedback..!
@stuck elbow may I ask why you think it's easier to start with RPG? isn't a plateformer easier in its concepts for kids?
pewpew m4 is really just pygamer without the extra flash, accelerometer, analog joystick or rechargeable battery
@solar whale thank you for testing and for the feedback. Glad it works. π
@plucky flint would love to test, but it involves BT boards I don't have.
@lethal abyss an rpg is pretty much turn-based, nothing happens when you don't press anything, except for playing the animations, which makes it much easier than handling multiple moving objects and physics on top of that
@stuck elbow oooh, I get it
General question... I've spent time making sure the code is well documented, but autodoc complains because my library tries to import something that isn't in the Python path (i.e. the BLE modules). I assume this sort ofthing has been encountered before..? Suggestions for "best practice" to resolve most welcome. π
@plucky flint we usually just make stubs in the docs directory
@stuck elbow ack
I think that some of the stubs are automated, but not sure how that works
getting bored timing builds It looks like the new gcc build is a tiny bit faster than the 2018q2 we've been using, but it regresses on binary size too. measurements are complicated by the fact that I started by measuring the native toolchain on debian stretch, and only later started measuring the exact right toolchain on xenial in docker...
oh and the one board I ran pystone on saw a performance regression too
whaaaaat, the binary size is not consistent from run to run?
@timber mango we just had some off discord chat with @noble whale and we are wondering if you were thinking circuitpython TMX parser or external tool that build something more appropriate for pygamer?
grreeat, cpb is slower but trinket m0 is faster when changing compilers
OK, my inconclusive and incomplete results. Time to move on to something else, the case for moving to a new compiler is weak at best. OTOH there were no new problems encountered during the upgrade, so that is a big positive. https://docs.google.com/spreadsheets/d/10DX3tq3XJrXQu5x8h0nRsiWNATcOjbIXsCN1RznZ8WI/edit?usp=sharing
afk, will work on nrf i2s bugs next (tomorrow)
@plucky flint sphinx can also automock imports
@onyx hinge seems like its comparable enough to switch to as long as everything builds
@slender iron well that's another way to look at it
every combo I tested did build
if that's your reaction then I'll prepare a PR to switch; it'll mostly just touch the github build.yml
cool, thanks
I have a bias to want to be on the latest thing
@tulip sleet where are we at with the new release?
Just finished lunch. i have been preparing the release notes. I think we're pretty much ready to go. I just wanted to go over the remaining PR's to see if any should be brought in.
the release notes are done for the library; for CPy, I have to finish the changes list and the thank-you list
i think we can wait on gcc9, since it's not obvious it's an improvement.
ok, sounds good @tulip sleet let me know if you want me to look at anything. I'm getting through my email and the forum now
sure, I'm going to continue on the release notes. There are draft releases already saved
kk
welp, looks like it'll be time to revisit cross-compiling gcc-arm for the RPi (aarch64 style). Unless I build in the cloud and dl firmware. It was going to happen anyway. π
Cross-compiling can be a pain.
I'd rather merge this in and be ok with missing glyphs in the terminal. I was thinking we could later turn the terminal off for fonts that are too big to store (chinese). For Korean, we could probably just add the missing glyphs later.
Hi All! π For the past month or so I've been on and off thinking about and adding features to this PR for the WSGI web app library (https://github.com/adafruit/Adafruit_CircuitPython_WSGI/pull/2)
The idea of the library is to have a simple and lightweight 'flask' or 'Sinatra' like web application framework that can be used in conjunction with the server functionality of the ESP32SPI lib, so you can host a web app from CPy that can serve HTML content and respond to HTTP Requests.
I would appreciate any feedback on the PR π It's not meant to be complete, its simply a first pass at some core features like HTTP request routing and parsing requests into a defined input object.
@slender iron do you want to review the draft releases? CPy is 5.0.0-beta.0 pre-release; lib is 3.0.0, and it's NOT a pre-release. I just pushed a PR to add a warning if 3.0.0 is imported into CPy 4.x or earlier.
I can if you'd like
I did copy-edit them, so if you don't want to bother that's fine
I don't have any qualms
It'd be nice to have more resolution for displays but that isn't urgent enough to block this.
I am a little worried this will impact USB performance though because it will increase the time between receiving usb data and queueing up another. Could we have the usb interrupt also set a run_background flag in addition to the tick doing so?
I'm going to close this. Please reopen when the refactoring is complete. Thanks!
I'm closing this because the refactoring doesn't account for the difference in limit between the SAMD21 and the SAMD51. Please reopen if you add it. Thanks!
@slender iron q re mocking sys.implementation.version. Various libraries check for sys.implementation.version[0] >= 3. This happens to work with CPython, by accident. I need to check for >= 4. So I think I'll need to add a mock sys to bleio_mock.py? I'm not sure there's any other way to do it.
no, I think you should check that the implementation is circuitpython
sphinx will be CPython
I did the new boards from 4 in prep for a listing in 5.0.0 final. I can add notations of which are new in beta.0
ya, I figured
I think maybe none actually
it'd be good to save somewhere
there are some on hold
on hold?
we had PR's but they are still in process
ah ya, that's ok
ok, I'll stash this somewhere for now. Maybe StringCar is new since alpha.5; I'll double-check
@slender iron https://github.com/adafruit/Adafruit_CircuitPython_BLE/pull/34 is ok to review now
merged
You may be able to save space by creating an empty file for small boards instead of one with basic code.
@slender iron ok, release notes now has a list of new boards since alpha.5 and an adjacent list of new since 4.1.0, in line with breaking features since 4.1.0
thanks!
I think it's all ready. I will press the :button:
@onyx hinge oh nice! They were at least thinking of ARM servers.
bleh, still going in circles with the call stack for mp_obj_subscr => instance_subscr => mp_obj_subscr => pixelbuf_pixelbuf_subscr and trying to call back to a subclassed (python) show() method. My previous changes broke the test suite, so now I'm back to carefully examining the stack and object passed along the way.
Any tips on how to look at the value of a qstr in gdb?
@ruby atlas I think you can call the qstr to str function from gdb
I don't remember what it is though
qstr_str
I think you can just call it like p qstr_str(var)
(gdb) p qstr_str(type.name)
$16 = 0x20029ae0 "NeoPixel"
yep!
thanks for the hint, that set me in the right direction!
np π
oy, i crashed gdb π
Ouch, what do you use to debug that?
actually, it was just running away trying to extract an endless qstr.
(gdb) p qstr_str((*(*((mp_obj_type_t *)base)).base.type)) vs
$24 = 0x20029ae0 "NeoPixel"```
(yay casting)
Automated website update for release 5.0.0-beta.0 by Blinka.
New boards:
- winterbloom_sol
Congratulations on CP5 Beta.0 -- woohoo! 
Hi, is there a Circuit Python related presentation proposed for Fosdem'20 in Brussels on 1+2 February 2020?
Like @stuck elbow are you planning something?
Fosdem is more an MicroPython place, with a stand there at least the last two years...
well, I was sitting at that table for a few hours last time, showing my circuitpython stuff :P
Yeah, sure...
they are not picky
Damien is from Australia?
And you are from Switzerland?
Who was holding that stand?
Was that someone from McHobby a Belgian distributor?
@ionic elk hihi are you hacking today
@tannewt that seems a good idea. Suggestions on naming an API that would trigger the background tasks to run as soon as possible?
matek betaflight controllers use stm32f405
https://www.amazon.com/MATEKSYS-F405-STD-Flight-Controller-STM32F405/dp/B079CN4QX3
congrats all on CP Beta 0!!

Tested with:
import adafruit_ble
from adafruit_ble.advertising import Advertisement
radio = adafruit_ble.BLERadio()
a = Advertisement()
a.complete_name = "This is a really long name that can only fit in extended."
print("len", len(a.complete_name))
radio.start_advertising(a)
while True:
pass
extended=True must also be passed to start_scan.
For you @ntoll
Whatβs with all theses messages?
GitHub Actions I assume.
Something new?
Yeah fairly recent. Not so recent that they should only just now be showing up, but it's possible that they only post here for release builds, and this is the first release we've done since we had the whole thing set up? I'm not entirely certain there.
Ah. Not a problem. Just curious. Thanks.
This is so we can add a board to circuitpython.org that uses the PyBadge files.
@slender iron could you check the github bot about these success messages? I think I'm going to manually delete them for now
hmm. i don't see anything in the GitHub blog about expanding the webhook delivery. checking discord's api...
nope. nothing there. only thing i can't check is what payloads are selected to deliver on the repo settings.
These are not flooding #adafruit-github-feed
different webhook subscriptions, i imagine. π€·ββοΈ
so much success! can't wait to try 5.0 beta 0 later!
sorry for the flood folks. my guess is that discord added support for the check success webhook. we had github sending everything to it and now I've only selected certain events
strange that they didn't blog it, or put it in a changelog (that i could see).
probably will
@hierophect Could you check the baudrate calculation in busio.SPI? I was using an SPI clock to try to test the difference between the "bad" and "good" STM32 Feathers I have, and I got odd SPI clock rates on both:
| specified | as measured on Saelae |
|---|---|
| 160 MHz | 20.83 MHz |
| 40 MHz | 10.42 MHz |
| 16 MHz | 5.208 MHz |
| 15 MHz | 5.208 MHz |
| 8 MHz | 2.632 MHz |
| 1 MHz | 328 kHz |
| 100 kHz | 164 kHz |
Hi there!
- Removes Robo HAT MM1 boards
I had to do this one under a different account because I have so many forks of CircuitPython on the go at the moment π .
Thanks
@wallarug
@tannewt I'm not sure how to do that, any pointers will be appreciated :)
@jepler , @dhalbert please share review comments :)
Not 100% where to fix this one. Travis is failing to build the board that got removed.
If someone wants to point me in the right direction I'll get straight to it.
good morning. status: working on a PR to switch to gcc9
Good morning!
Hey hey π A request for feedback. I've added unit tests (via PyTest) to my AdafruitRadio work and would like feedback on my approach. TL;DR, it runs using your local Python 3 (I use a venv for that), take a look at the README for instructions for the minimal requirements you'll need and how to run the tests, check out the two files in the tests directory of the project (https://github.com/ntoll/adafruit_radio/). The magic happens in conftest.py where I mock away the unavailable CircuitPython modules, you can see how I put all this together in the test_adafruit_radio.py file (note the use of the Radio based fixture). I like that it's very very simple and, with some polish, could be done via simple configuration. In any case, this is a first stab, and I'd love feedback. Thank you..! β€οΈ

Note: I'm painfully aware that I don't have the full context of what folks need when writing modules for CircuitPython, when it comes to testing. I'm also painfully aware that (in a sense) I'm mocking away the CircuitPython universe in order to get the ease of testing on my development machine (without having to have a board). However, if the tests are like mine so far (i.e. they only exercise the code in my module) then it should be "OK" (note air quotes).
anyway... Mary (my wife) is just back and asking if I'd like to go for a coffee... how can I refuse. BBIAW to tidy things.
@plucky flint having any automated testing seems to go above and beyond what is generally done in circuitpython libraries. I think you get a chance to guide how the rest of us think about it, not the other way around.
hmm does mac xargs have "-x", which stops with an error if the xargs argument list is too long?
it should, it's in POSIX
I'm a bit out of the loop, what's the consensus on github actions? fairly good?
hm, no, -x doesn't do what I wanted
@exotic pumice seems like it's a mixed bag right now, I guess the expectation is it's getting better.
better than travis though?
If you want to do things that go beyond just ci I think it's probably much more powerful
@meager fog @tulip sleet back up and running today, sorry I had a dr appointment eat up my whole afternoon yesterday. Thought I would be able to go back to work after but couldn't.
@dhalbert Looks like everything is half of what it should be. I'll check it out. In terms of granularity, though, we aren't going to do much better - STM32 has a pretty limited divisor set for SPI. The actual values we're sorting from are:
bus clock
(168MHz / 2) => (PCLK2 = 84000000)
SPI values:
/2 42_000_000
/4 21_000_000
/8 10_500_000
/16 5_250_000
/32 2_625_000
/64 1_312_500
/128 656_250
/256 328_125
@slender iron who is able to upload the new toolchain tarball to s3? I assume we don't want to fetch it from developer.arm.com every time, but rather do the same thing that was done for the last one.
Passing the NULL pointer value char_written here is not correct, though the problem may go undiagnosed. Unlike other languages, C does not have "out" or "reference" parameters. Instead, the programmer manually emulates them by passing the address of some suitable value using the & operator.
Recommendation: The declaration should be UINT char_written = 0;, and the address of it passed to f_write: f_write(..., &char_written).
This will
- include a possibly-invisible "\0" character at the end of the file, because
"abc"is the same as the character array{'a', 'b', 'c, '\0'}with a size of 4 bytes. - not include a newline character at the end of the file. Technically, a text file has each line end with a newline character
- (I don't know if we want to ship CRLF files for people suffering on Windows systems, or whether Windows now gracefully handles UNIX style text files)
Recommendation: add \n to the...
Besides my comments directly on the code, a build failed:
Build pirkey_m0 for zh_Latn_pinyin took 12.46s and failed
make: Entering directory '/home/runner/work/circuitpython/circuitpython/ports/atmel-samd'
Use make V=1, make V=2 or set BUILD_VERBOSE similarly in your environment to increase build verbosity.
-48 bytes free in flash out of 188160 bytes ( 183.75 kb ).
26000 bytes free in ram for stack out of 32768 bytes ( 32.0 kb ).
Too little flash!!!```
By making this new fe...
This looks good now, and CI liked it
The build failures are because not all MCUs support atomic operations on values of type bool, sigh. I will implement this feature in a way that does not require atomic_bool.
I thought all the SPI clocks were on the PCLK2 bus clock. They are not. Never trust what you read online, folks. Note that SPI2 and SPI3 will have half the maximum speed, since PCLK1 has a max speed of 42MHz.
@slender iron drat: Build pirkey_m0 for zh_Latn_pinyin took 12.90s and failed with gcc9
region `FLASH' overflowed by 284 bytes
so did pyruler and trinket_m0
I'm still going to PR it and we can discuss strats on the PR
.. the new version is not offered in .deb form, so the installation process also changes
Problems:
- several m0 builds (pirkey, trinket, pyruler) no longer fit
- this uses the tarball direct from arm; I think we'd prefer to have it in storage managed by circuitpython project, like the current toolchain .deb
@tannewt let me know what direction you'd like to see this go in, now that we know there are failures due to binary size increases
@onyx hinge Good plan with the PR.
@onyx hinge I can upload it
Hi @slender iron and good morning!
π
@gilded cradle The eInk Gizmo, uses SPI like the TFT Gizmo, right? Limor mentioned it was basically the same except for having a reset pin instead of a backlight pin. I'm doing the pinouts page and wanted to make sure I was doing it properly.
Yes, I think so @idle owl. The eInk breakouts used SPI, so that would make sense.
π
i am back now - was at a non-work meeting
This PR corrects an issue in the STM32 port where an incorrect bus clock was used to calculate frequency on several instances of the SPI peripheral, halving the clock rate. The module now correctly selects a bus clock based on SPI instance.
Since SPI was one of the first modules created for the port, I've also taken the opportunity to clean it up a bit to bring it more in line with the other modules.
@tannewt it has been almost 20 years since I did any proper C/C++ coding so I'm definitely not qualified to comment on the C code :man_facepalming:, but thank you for making these changes :+1: . As soon as they land I'll take the latest build and test with the adafruit_radio library. :shipit:
Question: is there a way to discover if the device is only BLE 4.x (i.e. not extended advertisements) which I could use to ensure the correct check on the length of the message is used in the `adaf...
@onyx hinge ack... I've added a bunch of comments and things to the relevant pieces of code so folks can see what I'm doing to make this work. What do you need from me to help facilitate feedback, suggestions and gathering of requirements module authors who want to write tests may need..? E.g. would a blog post telling the story of what I've been up to (published on ntoll.org) be helpful?
E.g. see comments in: https://github.com/ntoll/Adafruit_CircuitPython_Radio/blob/master/tests/conftest.py (can't help but wonder about the potential abundance of mocking).
@plucky flint the PR has artifacts
so you can test the extended advertising
@slender iron doh... I totally missed that. Thanks.
All of the nRF52840 boards support extended advertising. If a board doesn't then it will throw an exception when passed an advertisement that is too long. (255 is the nordic limit rather than the BLE one I believe.)
Builds are available for PRs if you click the latest green check on a commit and look in the top right for the "Artifacts" drop down.
hahahaha... that sentence "np, it's new and has been flaky" is basically the world of computers since 1960. π
haha
OK... I'm gonna quickly test with your PR and my lib. Give me 15 mins.... then I'm going to have to stop for the day (dad taxi duty in 30mins)
ok, I'll be here if you have any questions
@plucky flint ooh I shall subscribe to your blog! I'm not the author of any circuitpython libraries, so I can't offer to jump in, but one suggestion would be to find one or more library devs who are interested in trying to apply your approach, and work with them to find what commonalities there are
@onyx hinge π
you look like the best kind of blogger, intermittent and not trying to monetize anything π
Thank you! π
@plucky flint unit tests look perfect
π it was an interesting problem to approach. I'll write up tomorrow in a blog post. Would welcome feedback from old hands at writing CircuitPython modules.
It also has limitations / gotchas which I'll also explain / explore (mainly due to potential problems of too many mocks)
even with gotchas it's better than no testing
@Casey10110 are you using CircuitPython or Arduino to test this?
I've actually tested on both and neither works. I'd warn people against using any 16 MB chips until this is solved!
Sending works... I need to re-jig the AdafruitRadio subclass of Advertisement, but I've run out of time. I'll check/test in the morning. FWIW, it's all looking good. π
-> AFK to dad taxi kids in a manic recreation of the travelling salesman problem.
catch you folks tomorrow.
π
@plucky flint I did something similar but used stubs instead of mocks
@ivory yew stubs as in code stubs in the repos of the module to be tested..? I wanted to avoid having "spare" code hanging around, hence the mocking approach. There's +/- to each way (hence my asking for feedback so we get to a solution that works most of the time for most of the people with caveats and gotchas well highlighted). I'm open minded to anything that works in a simple, easy to grok manner. π
@ivory yew π and thanks for the heads up. I reckon folks probably want to be able to do both depending on their need. Flexibility is key. π
Oh yes.... absolutely
In this case, I guess mocks are more like spies (i.e. objects you can use to observe the side-effects of internal behaviours of the code being tested)
I'm still trying to figure out the best way to do this myself, but I've been taking this approach so far with more confident results than just magicmocking the universe.
When I'm feeling better I'm happy to talk about some testing approaches and stuff.
Amen.... mocks are both really useful but also feel like a big bazooka with which to shoot yourself in the foot.
I love exploring this sort of stuff... so when you're feeling better (get well soon!) please don't hesitate to ping me.
I'll brain dump into a blog tomorrow as a start.
then again, your documentation is not supposed to be finding errors in your code
you have tests for that
(and sphinx also lets you test code snippets in your docs, by the way, for which mocks are actually useful)
anyway.... I'm being "looked at" by my kids. Gotta go.
@stuck elbow this is for mocks in actual modules (conversation has moved away from Sphinx).
anyway -> :car:
ah, sorry
Thanks @jepler for the review comments and suggestions. I'll push the changes as requested soon.
@iayanpahwa It would be something like:
#if CIRCUITPY_FULL_BUILD == 0
make_empty_file(&vfs_fat->fatfs, "/code.py");
#else
make_sample_code_file(&vfs_fat->fatfs);
#endif
I'd start with a single global to guard if they run at all. Most of them already do some checking to see if they need to run, it's just costly at the moment.
Let's close this for now. We can update along with CP 6. The Pirkey is hundreds of bytes over which will be hard to recover.
A new version of my EDGE badge microphone hacking from Supercon is at https://github.com/tomacorp/edgemicscope . Now the scope has adjustable gain, offset, and timebase.
nice @timber remnant !
if you have time, you should show it on show and tell today
(4:30pm)
How do I learn more about show and tell?
last week's: https://www.youtube.com/watch?v=lZRvS7pYRaY
To show and share your project at 7:30pm today, view the chat or in discord https://adafru.it/discord and look for the JOIN link to join. For best results be...
@timber remnant The easy-mode is to hang out in #live-broadcast-chat a bit before 4:30PM PST and wait for the link to StreamYard. If you can't get in, keep trying as space will open up as people leave
OH. MY. JEEBUS. @stuck elbow That is beautiful . Tindie link ASAP PLZ
@pastel panther I haven't figured out how I want to handle it yet
I don't want to go to the expensive Swiss post office with a bag full of packages every day, that's for sure
Very nice @stuck elbow! You could increase handling time and just go 1-2 times per week.
@stuck elbow understood. like @gilded cradle said, shipping weekly is a thing as long as you're clear about it. For impatient people you could always charge for rush shipping& handling if you wanted to
I will rather find a fab in China that is willing to manufacture, store and ship them. Will make the shipping costs much lower too.
ya, probably makes sense.
@idle owl, I just verified that the eInk gizmo is indeed using SPI.
@gilded cradle I figured, I cribbed your pinouts text from the TFT gizmo. Thanks for verifying. Did you get yours?
No, I just looked at the schematic.
Ah fair enough
Was about to status update in Slack and wanted to make sure I was accurate about your status
Yeah, I should get it tomorrow and then can make sure we have a working library. Until then I can probably wire up a breakout.
No rush. I have plenty to do.
Ok, then I'll wait
Unless Limor wants it rushed, which I guess I'll find out.
Yeah
I love how ST likes to just change this tiny handful of pins between MCUs of the same family, so i have to manually compare every page of their pinout charts when making a new MCU definition looking for the easter eggs they hid for me. I swear some engineer over there likes to toggle a couple things in every silicon edition just to keep us on our toes.
It would help if they offered a downloadable pin map.
really
That way I wouldn't have to manually inspect whether they decided to take out a single RX pin on a random pin for giggles. Or add in a single new timer output because why not
@wanton fiber says that ST is really responsive, maybe we should suggest that.
@ionic elk hihi are ya working on new board defs?
OK where was I before I got distracted by a little play with this riscv dev board? working on the tick performance stuff...
something odd with STM32 and displayio for tft. OLED works, and there's TFT traffice
@hierophect youc an post saleae traces here
@meager fog yep I'm hacking away
@ionic elk ok lemme know what board you are gonna do next and ill order it π
Is this for my now closed PR? On master we shouldn't have displayio enabled at all? I haven't quite gotten back to displayio since I raised the board frequencies.
I'm doing the Meowbit, the PybNano, and the blackpill all at once
@ionic elk I'm testing the SPI PR, and trying to create a second SPI instance besides SCK/MOSI pins. Are there other pins that would work? thanks
A0/A1, SCL/SDA, D9/D10, etc., don't work
peripherals/stm32/stm32f405/periph.c is the place to check
I remember there was a python sketch somewhere that went through every combination of board pins and gave options for what worked
ooh, great, thanks
but it was for i2c
i was going to run that; I mistakenly thought that a wide variety of pins would work (like on nRF)
@tannewt I think we could do so if you give us an approving review. I'm loathe to do it since I tinkered so much in this PR.
also @meager fog I'll be in NYC next week - I'd love to say hi if anyone is in the office! If everyone's away for thanksgiving I understand of course.
@tannewt is this USB interrupt something that exists now? If so, can you suggest what to search for? I came up empty.
@meager fog I'll need new PIDs for these new board defs, right? Could use three pairs, meowbit, pybnano, and blackpill.
@ionic elk it appears I have to specify SCK/MOSI/MISO. It's not possible to omit MOSI or MISO for read-only or write-only SPI. Is this a restriction of the STM HAL? On the other ports this is possible.
Could you add a comment that SPI1 corresponds to reserved_SPI[0], etc.?
Tested frequencies on two SPI peripherals. Looks good! Granularity is coarse, as you note. e.g. 10MHz gives 5.something; have to go to 11 MHz to get 10.42
missing newline at end of file
@tulip sleet no, that's a restriction of how I sort, and should be fixed. That's a pretty major retool though, and should probably be a new issue/PR.
Needs the whole pin picker algorithm to be different, similar to UART.
sure, I'll open an issue
stm32f4 port:
Allow specifying an SPI peripheral with only SCK and MOSI, or SCK and MISO, to allow write-only or read-only SPI without using up another pin. The other ports currently allow this.
yeah the F4 HAL absolutely allows that
it's no problem, the SPI module was one of the first I added and needs some revisions at this point
By the way, is the Meowbit actually open source? Or am I hacking?
Not seeing a schematic or anything so I'm just kinda eyeballing the unlisted connections here
Code is at https://github.com/tomacorp/edgemicscope
Tested versions of CircuitPython are 5.0.0 Beta 0 and 5.0.0 Alpha 5.
Hardware is the AdaFruit EDGE Badge, as distributed for the Hack-A-Day Superconference 2019.
After updating a lot of points on the display, two calls to refresh() are required:
board.DISPLAY.refresh(minimum_frames_per_second=0)
# Don't know why this second refresh is required.
board.DISPLAY.refresh(minimum_frames_per_second=0)
To reproduce the problem...
@onyx hinge look in tinyusb for the interrupt
This better differentiates errors than using OSError everywhere.
I think these should be called mp_type_bleio_ConnectionError, etc. because they are in the _bleio namespace. Note that in CPython, there is a global ConnectionError, for instance, and we don't want to potentially conflict with that.
I think it makes sense for this to be a subclass of OSError, cf. subclasses of OSError here: https://docs.python.org/3/library/exceptions.html#os-exceptions
This is a very nice cleanup.
One thing to check: do these str/repr/print properly as _bleio.RoleError, etc? These appear to be the first native-module-namespace exceptions we have in the code base.
@solar whale I have CTS working. π
Iβll be interested to see where I went wrong.
Look forward to trying it.
Cool! Lots of new toys π
hopefully pairing will unlock HID too
@indigo wedge did ja order the nRF5340 PDK?
@tawny creek No, haven't done anything with nRF in quite some time now
But the dual core architecture is an interesting challenge
Serial console errors rendering on eInk are kind of entertaining. TFTs it more or less renders in realtime. eInk it takes a bit then flashes as it renders. Feels like it's trying and failing to catch up.
ugh why is particle xenon so janky, and why did I bring it (instead of the feather nrf52840) with me to the coffee shop. And no j-link.
oh well, nothing that chugging my coffee and heading home can't cure π
I'd recommend taking all three of these chips of the devices.h list at this point unless someone actually got them to work.
gcc 9 release notes:
Inliner defaults was tuned to better suits modern C++ codebases especially when built with link time optimizations. New parameters max-inline-insns-small, max-inline-insns-size, uninlined-function-insns, uninlined-function-time, uninlined-thunk-insns, and uninlined-thunk-time were added.
maybe should check whether these can be tuned back to gcc7 values and get us under size limits on those little m0 builds
Hi, I'm the one who added the IS25LP128F definition, which I verified with my HW. Please don't blame the SW for your HW problems :)
For sure, Arturo, I don't want to blame the software. The thing is, the hardware setup is EXACTLY the same as for the other chips that work on the EXACT same board. If you want me to send you a schematic (or even two boards, one with a chip that works, and another that doesn't) to verify this I will. Others will have this issue for sure.
yay, trinket m0 + zh_Latn_pinyin fits again with gcc9
so maybe we can have nice things
I'm looking at this again, there are some optimization flags we can set so that gcc9 behaves closer to gcc7 in terms of code size. I think this may let the most constrained m0 boards fit again.
@jepler This might be something you can look into.
@ionic elk what are you working on today?
@jepler will note this is very low priority - ill probably be redesigning the edgebadge, i was in a rush to get this rev done :) for now people can jumper to I2S pins
@jepler I think the USB interrupt is in TinyUSB although we could move it out.
Is this ready for another look?
@tannewt I think your assessment about the USB interrupt is right: as it's contained in tinyusb right now, we'd need some more changes before we can use it to trigger background tasks sooner.
It looks like I have some failed builds to attend to but they're shallow (use of ticks_ms global need to be converted to function calls), so it should be ready for stylistic checks.
Any suggestions on a way to benchmark the possible USB performance regression you're concerned about? That would be ...
I'd rather it not be because OSError usually do weird things with errnos. I took a look at urllib3 as a comparison and its exceptions are derived from Exception too. https://urllib3.readthedocs.io/en/latest/reference/index.html#urllib3.exceptions.HTTPError
Ok @dhalbert please take another look. Printing now includes the module by overriding the print method.
Adafruit CircuitPython 5.0.0-beta.0-19-g5e857fdb6-dirty on 2019-11-21; Adafruit Feather nRF52840 Express with nRF52840
>>> import _bleio
>>> raise _bleio.BluetoothError("test")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_bleio.BluetoothError: test
>>> e = _bleio.BluetoothError("test")
>>> str(e)
'test'
>>> repr(e)
"_bleio.BluetoothError('test'...
@slender iron Hi, just saw your mention. Had some mail stuff I had to do this morning but working on board defs now
how is that going?
it's just data entry basically, what's up?
Got something else you'd like to push up in the priority queue?
I do need PIDs and VIDs for the USB, to finish up these board profiles
I may have asked for too much. Here's CPython:
testing.py:
class MyException(Exception):
pass
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import testing
>>> raise testing.MyException
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
testing.MyException
>>> str(testing.MyException)
"<class 'testing.MyException'>"
>>> str(testing.MyException(...
The print change now matches CPython, but the repr() change does not. Could you undo that? That's the last thing. Thanks!
See
https://github.com/adafruit/circuitpython/pull/2311#issuecomment-557250793
@ionic elk I'm wondering which ones you have done and which you have left to do.
Easy enough. Please take another look.
Adafruit CircuitPython 5.0.0-beta.0-20-g521c7531b-dirty on 2019-11-21; Adafruit Feather nRF52840 Express with nRF52840
>>> import _bleio
>>> raise _bleio.BluetoothError("test 2")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_bleio.BluetoothError: test 2
>>> e = _bleio.BluetoothError("test 2")
>>> str(e)
'test 2'
>>> repr(e)
"BluetoothError('test 2',)"
is there an issue where you list the boards that need usb ids?
Hi, I have a M4 Express feather (CP 5 alpha 5) driving a 4.2" display using the eink friend.
I can display text with displayio and Label when using the built in terminalio font but if I attempt to use a bitmap font with bitmap_font.load_font("/Helvetica-Bold-16.bdf"), the code will run but the eink will not update.
Posted to the forum but wondered if anone here could help?
@slender iron no I mostly saw people asking here on the discord so I figured it wasn't issue appropriate. Should I open one?
As for progress, I just wrapped up testing the PYB Nano, which is working like a charm
ya, that'll be easiest to track. or add it to the board issue
Moving on to blackpill now. I've cut the Meowbit into a separate branch since it's obviously going to depend on TFT Displayio and I didn't want to hold the others up
that's ok to look at it in a second PR
are you waiting for me to look at TFT displayio?
I'd rather revisit it first - I'm hoping it might actually have had something to do with the SPI bug Dan caught, which would be convenient
I can get some saleae pics and stuff
ok, either way
@ladyada I'll need some new VIDs and PIDs for these boards, correct?
This PR adds support for the PYB Nano V2 and an Elcrow-sourced "blackpill" style board, both of which use the STM32F411CE. Links are as follows:
PYB Nano
"blackpill"
The PYB Nano has been tested successfully and has built in external flash. However, I'm having difficulty with the blackpill, which is erratic about when it allows flashing using...
By using something like a wifi breakout, itβs not possible to create a new network, it just lets something connect to an existing one right?
the esp32 itself can create a new network, no problem β not sure if the nina firmware lets you do it, though
i see stuff about ESP32 softAP (access point), but not sure what supports that. We have no guides for that
There are some AP features built into the ESP32SPI library https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/c68c64264d4e52897387ae6c10d6ad433f783c66/adafruit_esp32spi/adafruit_esp32spi.py#L434, which drives the NINA firmware. I haven't tested it.
This adds a pair method to a connection to initiate pairing and a paired attribute to fetch current paired state.
This has only been tested on remotely initiated connections (aka as a peripheral.)
Hiya.
I've been playing with an FT232H and ili3941 display as per this guide: https://learn.adafruit.com/tft-sidekick-with-ft232h/overview
I'm finding on my Ubuntu 18.04 LTS server writing an Image to the display is resulting is high CPU. My server is an Atom J4105, it's a pretty nice low power x86 server (https://ark.intel.com/content/www/us/en/ark/products/128989/intel-celeron-j4105-processor-4m-cache-up-to-2-50-ghz.html)
import board
import digitalio
import adafruit_rgb_dis...
This looks good, pretty much same as before. Hopefully the other-side pairing will just work as well.
So @stuck elbow if i use an airlift breakout i can just connect my microcontroller to it and not have to involve home wifi? Also is this only a hardwired connection or is it wireless (sorry for asking a probably stupid question π )
@short phoenix What do you want to do? Normally you have the Airlift connect to your home wifi so you have internet access. Do you want to have a private network so other devices can connect to the Airlift?
@caternuson hiya did you see the same?
@tulip sleet i was thinking a little bit of both but i guess you can only use a home wifi for esp32/airlift. Thatβs fine but iβm curious... are there any breakouts or microcontrollers that create a private network?
@short phoenix the ESP32 NINA firmware, which is loaded onto the ESP32 on the AIrlift boards, can create a local access point so other devices can connect to it. I don't know if we expose this in any way. See this Arduino thread for now: https://forum.arduino.cc/index.php?topic=585266.0
@short phoenix OK, the Access Point mode is accessible from CircuitPython: https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/master/adafruit_esp32spi/adafruit_esp32spi.py#L532
create_AP()
we don't seem to have any examples
Thanks a bunch!
PYB Nano v2 VID 0x239A PID 0x0067 # bootloader
PID 0x8067 # arduino
PID 0x8068 # circuitpython
F411 BlackPill VID 0x239A PID 0x0069 # bootloader
PID 0x8069 # arduino
PID 0x806A # circuitpython
@short phoenix @tulip sleet there is an example of how to create a webserver on an AP -- https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI/blob/master/examples/server/esp32spi_wsgiserver.py#L52
@tulip sleet @slender iron is there a reason why the wiznet is not enabled on the grand_central _m4 -- it is enabled on the feather_m4_express and metro_m4_express. See forum post https://forums.adafruit.com/viewtopic.php?f=63&t=158985
@tulip sleet I set up to make my own builds so I could test my current refactor - it was getting all the audio code into the base class using a couple of lines of code to make the differences in audio setup work, so I needed to make sure Express worked even though Bluefruit did. It works. There's about 1k difference in the UF2 size, the new one being bigger, but doing an import of the library and checking gc.mem_free() shows that there's about 100 bytes more available after import with the new version, which is to say, essentially no difference in that case. So, good to know there.
@idle owl that's due to changes in the frozen-in mpy files? that seems not bad at all
@onyx hinge I refactored the library entirely so all the common code is in a base class, and then there is the express module which is nearly empty, and now there's a bluefruit module which has a couple of new features we could never fit into the express module due to CPX memory constraints.
We're going to freeze it in without the bluefruit module because memory. But I wanted to see what my refactor did. So I checked.
@idle owl cool, sounds like that approach will work out then
The bluefruit module will eventually have bluetooth stuff in it too once that's solidified.
is there much new stuff for bluefruit? the audio is a little different, that's the only part I focused on.
So now you can from adafruit_circuitplayground.bluefruit import cpb and use all the same code concepts as you did using cpx.
Audio is the major difference between the two, but I added new features to the library such as sound_level and loud_sound.
So you can print the sound levels like the light levels now, and use them for thresholds if you'd like, and you can use a loud sound as an input.
Requires a buffer for the sound levels to work, and it was too much for cpx.
CPB on the other hand π
Hardware wise, the Bluefruit has bluetooth, CPX has IR, the chips are different, and the rest is basically identical.
So all the features people wanted out of that library can probably now go into the bluefruit module. Sound levels and loud sound had come up multiple times, so that'll be good to get that added.
When I was referring to a clear method I was thinking that midi_in.buffer_overflow would need somehow to be cleared but your example code suggests when you read the value and it is true then it auto-clears the buffer_overflow property so the next time it's read it's false?
On the counter front, I was thinking about the classic model seen on networking stacks. E.g. IP has a wide range of counters like Udp: receive buffer errors. If the application isn't that interested in loss it can ig...
@solar whale there's no reason I know of that it was omitted; just an oversight. I will make a PR that turns the network stuff on for all builds
@onyx hinge @idle owl I am going to work on a simple mechanism to alter what's in a frozen library based on board. My latest idea is to have an optional freeze.py that's run during the CPy build, and can decide what to include based on BOARD, etc. There would be a dummy adafruit_circuitplayground/bluefruit.py that simply throws an explanatory error on import.
@tulip sleet my mind went way crazier, thinking that we needed to add a preprocessor to the freeze process. let's not go there if we can avoid it.
"take file from board/ if present, from usual location otherwise" could work too
yes, I was originally going to have extra directories that were board-specific, but just having the general ability to run a script to do whatever seems easiest and most flexible. Kind of like conf.py.
when freezing happens, the code to freeze is copied to a temp directory, so we can do whatever we want there and not disturb the submodule directory.
@tulip sleet I'm having issues with this elcrow board - do you figure I should split it off into another branch, so we can just merge the PYB Nano by itself?
yes, just put it in a separate PR after you debug it
i mean if/when you get it to work. Narrow the current PR to not include it (i'm a little confused)
i don't see the elcrow board in PR #2196
Ok I'll do that. My primary problem is that it's a huge pain to flash - they put boot0 on a button, and even when pressed it fails 90% of the time. It reminds me of the issues I had dealing with knockoff STM32F103C8 Bluepills - it's super finicky
I'm beginning to think I could really benefit from an interactive debug/brainstorm/coding session with someone to figure out how to make _pixelbuf pixelbuf_pixelbuf_subscr (via instance_subscr) be able to call a python subclass .show() without also breaking the unit tests (and breaking subscripts of subclasses of native classes for other uses).
So I'd kinda be fine with just dropping it altogether if this isn't a widely used board. They don't have public schematics either without a Baidu account so I can't even see if they rigged up USB correctly
it's the "blackpill"
For the record, the PYB Nano is the exact same MCU on nearly the same formfactor, and has basically none of these issues
I'd just mention that to Limor then, that it's flaky
do you have only one sample?
maybe you got a bad one?
@ruby atlas scott knows the most about subclassing stuff; one of us would want to look at the code first, I think. Soon, but maybe not today.
@tulip sleet I've only got the one so it could be a fluke, for sure
I'll try switching over to OpenOCD and see if that gets better results than my st-util program. But given that I've got the Nano and Discovery working without issue I'm pretty confident in my flakyness assertion
@ionic elk Are you trying to load it with DFU? the flakiness sounds like the same flakiness I have with the bad STM Feather. BTW, I spent some time on it: clock freqs seem fine (I looked at SPI clock rates), voltages seem OK, it's very mysterious. Next would be to Saleae the status neopixel to see why it's erratic.
i have two more '405 feathers arriving today
I'm trying to load it with an STlink over SWD, so it's a bit different. I'm not using a bootloader
but I thought SWD didn't care about BOOT0
I might do a big round-up of different ways of flashing stuff onto an STM32 today
it does if there's code already running
it has trouble halting the target otherwise
@tulip sleet hoping i get back to hacking later today, so maybe i'll be able to sort it out. i think i just need to just focus on it for a few uninterrupted hours (which has been really really really hard to get, so I've been poking at it a few minutes at a time here and there).
@tulip sleet thanks -- I tested it on the GCM4 and posted a .uf2 to the forum post in case the poster wants to try it.
@ionic elk do you have the RESET line connected? Does that make a difference
@solar whale thank you! I am preparing a PR but not done yet
well huh, i2sout on particle xenon works WAAYY worse than I remember it, even at the ref of my pull request π¦
@tulip sleet reset is also on a button π
no reset pin or pad??
actually, I may have missed it
I don't have a schematic so I have to go by pin names only but there's this little R pin so that's probably it. I'll try that
i generally don't need the RESET connection when doing J-Link with SAMD, but no idea about STM
I don't usually either but these buttons don't seem to be doing the job
This PR adds support for the PYB Nano V2, which uses the STM32F411CE on a small form factor board with a W25Q64JV_IQ for external flash support and a built in MMA7660FC accelerometer. Tested for flash operation and multiple modules of support with success.
Drops the Blackpill from #2312, since it has proven flaky in testing. Partially addresses #2196
sigh, this was one of those unproductive mornings. Didn't make any progress on nrf i2sout, and maybe fried my black silkscreen metro m4 express. it'll reach the bootloader, but not start circuitpython.
@onyx hinge can you get Arduino blink to run on it?
@tulip sleet I didn't try that yet.
at asf4/samd51/hpl/rtc/hpl_rtc.c:71
71 hri_rtcmode0_wait_for_sync(dev->hw, RTC_MODE0_SYNCBUSY_SWRST);
``` It hangs here, with the SWRST bit of "calendar" staying set forever...
(I briefly powered it from a 12V DC adapter on the DC jack, which is out of spec)
oops π¦ :
I'm going to stop for lunch and come back to i2s for at least another hour. and order a fresh metro m4 express, I guess.
yah, maybe you can get them to ship it today. do you have a feather m4 to substitute? I have at least two of everything for this kind of reason
I have other m4ish boards, and this was not for my current project, just running some neopixels, so I'm not going to sweat getting a replacement right away.
(I'm honestly surprised that feeding it 12v for a short time caused a problem, it's just going to the 5v linear regulator and I thought those were all pretty robust, but adafruit says 7-9V only)
is the 3.3v output still ok?
I'll check after lunch, if you think it's worth doing any further troubleshooting on the board.
seems weird to me that it'll enter bootloader, run swd debugging, ... but other stuff is just broken. It must have a small amount of magic smoke remaining.
Enable network and ps2io for SAMD51 builds. Disabled explicitly on boards that don't want this.
Original issue was that network was not enabled on Grand Central. See https://forums.adafruit.com/viewtopic.php?f=63&t=158985. Thanks @jerryneedell for answering forum query!
Not enabling on nRF or STM32F4 because no testing has been done on those boards. nRF in particular might not interact well with the SoftDevice if they each enabling/disabling interrupts in competition with each o...
please upload a photo or diagram showing what external chips you have wired up
(no, there was no visible smoking or anything like that, just referring to the idea of magic smoke)
Downloaded the PR and build for grandcentral_m4_express.
Works with attached Ethernet_featherwing.
@ruby atlas I'm happy to be a second set of eyes
@tulip sleet I see some build errors on your PR fr the ethernet -- did those boards really run out of flash -- on an m4?
@onyx hinge I thought 12V was OK for a metro_m4_express On the pinout page it says The DC Jack is a 5.5mm/2.1mm center-positive DC connector, which is the most common available. Provide about 6V-12V here to power the Metro. There is no fuse on this connection so you can draw more current, up to 800mA between the 5V and 3.3V supplies, and 2A from Vin.
hmmm -- on the overview page it says Power the METRO M4 with 7-9V polarity protected DC or the micro USB connector to any 5V USB source. The 2.1mm DC jack has an on/off switch next to it so you can turn off your setup easily. The METRO will automagically switch between USB and DC. ruh roh -- which is it?
@solar whale @onyx hinge max input voltage on the 5V regulator is 20V https://www.onsemi.com/pub/Collateral/NCP1117-D.PDF The 3.3V regulator is downstream from that.
so I'm not sure why it would fry itself
if the 12v adapter is not well regulated, its unloaded output voltage may be >20v
maybe even just briefly
Should the conflicting limits on the 2 pages of the guide be fixed?
Yes, a forum post would be a good idea. thank you
@idle owl @tulip sleet is there enough room in CPX to store the bluefruit code? Could just add a check to it to validate the correct board.
not with certain languages (guess, not tested)
and this is just the initial code; there will be BLE additions
please try it first. I'd really like to avoid custom freezing mechanics for a single use case
Please remove the stm32f401 changes from here since the PYB Nano is a 411. No need to open a new PR though. Just push a new commit here.
I would just time a couple 100k transfer as a sanity check. Once this is merged we'll have more testing on it.
@tannewt sure, good catch. Those should go in with the Meowbit
@tulip sleet 5V and 3.3V rails read close to nominal values. the board didn't heal over lunch, but at least I'm not hungry anymore.
I am going to set this aside and get back to looking at the nrf stuff which is my actual goal for the day π
I was more distressed until I saw that the cat is on the silk of the current pink version of the metro m4 express too
@slender iron okay will ping you when i have something more concrete to discuss.
@tulip sleet thanks again for trying to help me troubleshoot, and thanks for understanding that I preferred to step away for a bit before continuing.
np, having a fresh mind is fine; I'm not waiting around π And the only reason to spend time on this is if you have a suspicion this might be a more systemic issue, other than just a fried board. I have had failed boards 3-4 times; sometimes I want to make sure it's not a production problem, but sometimes it's just broken
there is always a reason; whether it's worth figuring out the reason is the question
I had the board since ages ago, no problems, spent the last 2-3 days running a big neopixel strip from it (USB powered). I KNOW that the last thing I did before it didn't work anymore involved plugging in this 12VDC power adapter. So, my gut check about how it "should have been" okay aside, it seems like the incorrect power supply is a logical culprit.
@tulip sleet what was the issue you had with ble hid on ios? I can see that I'm notifying but it doesn't type into the sms app
got it working on mac
yes I thought so
i'm looking at the PR's
which one?
the library ones, because Thach found an issue that I missed, and I'm trying to remember what it was
When using frozen bytecode compiled into the "firmware" (obviously not quite true in the Unix port), and said frozen bytecode has mp_type_bytes object(s) defined, and said object(s) are used as default arguments to functions generated SIGSEGV. After researching, I found this is due to the behavior of making certain things "long_lived". My specific failure occurred in make_str_long_lived, specifically trying to assign str->data, but in my case, "str" is a "ROM" pointer. In other words it is no...
@slender iron that didn't matter, but make sure to forget the device on iOS before re-pairing; sometimes that seems to matter
hrm
it seems like it isn't remembering since I turned off the bond bit
it asks me to pair each time
it will still ask to pair, but it might be remembering a bad key or something. Delete it from the devices list after disconencting and see if that makes a diff
@meager fog @slender iron would you like to sync up on stm32 priorities? I've reorganized my Basecamp todo list - let me know if you'd like anything moved up or down, or if you have new stuff you'd like to see added.
@slender iron i think what Thach found was a missing report id in the descriptor, but that was fixed long ago. it's lost to Slack history timeout (grrr)
@ionic elk please email me a link and I'll look monday
@tulip sleet I should have the good descriptor. I can see that the phone subscribes to the notifications π
i just tried to type into a google search box or something. did you try a different app
I tried notes too
right notes was what i used too. give me a bit to try to reconstruct this. there are traces of a fix somewhere, I just have to find it
I'll push my latest library code
ripping out and redoing my i2s wiring. The bottom trace is the "LRC" (fast clock) of i2s referenced to GND, and I'm pretty sure it should be much more square than that..!
.. measured nearest the MAX 98357A I2S DAC breakout
ooookayyyy, the wire from the -BUS to the breakout board GND was bad
three hours down the drain for that??
Widlarize that wire!
g! define widlarize
@slender iron I think the problem that Thach found was a missing report ID in my descriptor. I can't find the code where it WAS missing, but based on my hug and status reports, it sounds like that. I would just make sure that the report you are sending contains a report ID of the correct value.
@tulip sleet I think it's ok because I'm getting the report ids from the descriptor itself
@slender iron I had originally commented out everything but the keyboard device while debugging, but forgot . In that case, there should have been no report ID. I think maybe the bug was that I was still passing one in, or when I restored the rest of the devices I forgot to put it back
i just mean make sure your report does contain a report id
oh, I do remember that
so your issue may be something else
you mean you remember my description of the bug?
my descriptor has three report ids in it
ya, that if you only have one report you omit the id
right, some devices care, some don't
MacOS didn't care, iOS did
i didn't mean to leave it in for just one device, it was a typo, basically
I have keyboard, mouse and consumer control atm
i had same combo
i was doing xcode event logging and all kinds of stuff; it was being delivered, and just disappearing after that
ah, I haven't gotten that far
did xcode help?
my bug from yesterday was that I had the incorrect report uuid. the desktop nrf connect helped me find that
it just verified to me that the event was ok. I was using the "monitor"? I can't remember. it produces reams of output; it was not pleasant to sort through
there is some filtering but it's not great; i am glad I'm not doing iOS development
I'll try it later if needed
there were two main processes receiving the data, bluetoothd and BLEsomething, and I filtered the huge event stream on those (and there was still a lot of chaff)
k, sounds like something to try after lunch π
Downloaded the PR and build for grandcentral_m4_express.
Works with attached Ethernet_featherwing.
huh this makes my feather nRF52840 disconnect from usb: ```jepler@eric:/media/jepler/CIRCUITPY$ dd if=/dev/zero bs=512 count=200 of=/media/jepler/CIRCUITPY/zero
a smaller amount of data (e.g., 100 blocks) doesn't
USB disconnects, light throbs yellow. didn't see anything useful in gdb yet.
Old value = 0
New value = 8
0x0002ca14 in allocate_stack ()
(gdb) where
#0 0x0002ca14 in allocate_stack ()
#1 0x000541d8 in main ()
To trigger, I run dd if=/dev/zero bs=512 count=200 of=/media/jepler/CIRCUITPY/zero.
With a debug build, I can capture this traceback:
Breakpoint 4, reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM)
at ../../supervisor/shared/safe_mode.c:84
84 void __attribute__((noinline,)) reset_into_safe_mode(safe_mode_t reason) {
(gdb) where
#0 reset_into_safe_mode (reason=reason@entry=GC_ALLOC_OUTSIDE_VM)
at ../../supervisor/shared/safe_mode.c:84
#1 0x00027dc4 in gc...
@onyx hinge can be helpful to set a breakpoint on HardFault_Handler
@tulip sleet I did something slightly different, but I think the traceback in that issue I just filed is relevant
it actually looks sorta like an ill-timed write during soft reset calls allocation functions when it's forbidden...? not confident of that diagnosis yet.
afk
@onyx hinge flash write is pretty slow on nRF, so maybe we run out of heap trying to buffer al lthe data coming in while waiting for flash write
@slender iron @onyx hinge @ionic elk cancelling all checks in a GitHub Actions check run is actually really slow. I had a subjob fail due to network problems, so I cancelled the run in order to restart it, and it's taken many minutes to stop all the subjobs.
@tulip sleet yeah the UI needs polish. I hadn't yet tried cancelling one wholesale, but I can only imagine.
I wonder if there's a CLI/API tool you could fire and forget instead
it is still pretty flaky. kind of 0.8 instead of 1.0
and now they're all stopped, but the "Cancel Check Suite" button is still there, so I can't force a re-run.
@tannewt This is ready to re-review, after fixing build issues. It turns out the mpconfigport.mk files were not set up properly (no ifndef) to be overridden by mpconfigboard.mk files.
@slender iron thanks! Will take a look at it over the weekend.
@solar whale it is working in general, I think, except on iOS: keyboard not working on iOS
Is it harder to use an airlift breakout board compared to a featherwing when using something like the Feather M4 Express
Like I was thinking of using the quad 2x2 featherwing kit, and I would rather save some space on that since there's only 4 spots and use a breakout, would this work?
(mention me if you reply to this please)
@short phoenix While it may be easier to use the Wing, the breakout will work fine (it's basically an SPI peripheral) and save you the slots on the 2x2. You can stack Wings if you put stacking headers on them, which may or may not be easier, depending on what Wings you're playing with. I'll admit I'm a little curious what you're building that would use 5 Wings at once.
@slender iron @tulip sleet I'm afraid my git skills are not up to being able to properly merge scott's changes in tannewt/central_paring in to master to check things out. I'll wait for a PR.... If you have time, I'd love to know how to get the links above to be merged into my fork. When I try it, I end up with a 4.0 build ??? I'll try to figure it out.
So @main meteor i just wanna have a breakout in case i get another board thatβs not feather. But all i would need to do on the 2x2 feather and wings board is to wire over an empty spot for a feather over to a breadboard with airlift breakout on it?
Should work fine.
Doesn't even need to be an empty spot if there's a Wing with stacking headers
@solar whale I just clone other people's repos directly and build inside them, so I don't have to merge. You could clone into a separate tree, or you could add it as yet another remote to an existing tree, but a separate clone is simpler. I think Scott was just showing what the diffs are from the current master, and not necessarily implying one should merge.
@tannewt tried what you suggested, It's breaking builds on some boards. Any idea?
@tulip sleet i tried that but must have done something wrong. Will try again later. Just clone Scottβs repo, checkout central_pairing and build, correct.
right
hmmm -- that reults in ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha-3621-ga69cffd57-dirty on 2019-11-23; Adafruit Feather nRF52840 Express with nRF52840
2144 cd circuitpython_tannewt/
2145 git_update
2146 make -C mpy-cross/
2147 git checkout central_pairing
2148 cd ports/nrf/
2151 git_update
2153 make BOARD=feather_nrf52840_express clean
2154 make BOARD=feather_nrf52840_express
2155 cp build-feather_nrf52840_express/firmware.uf2 /media/jerryneedell/FTHR840BOOT/
2156 history
``` git_update does ```git submodule sync
git submodule update --init --recursive
git submodule foreach --recursive 'git fetch --tags'
I must be missing something
@tulip sleet I think I am not completely crazy... I tried just cloning Scott's repo and building master and stll get a 4.0 build so I think the rest above makes some sense. I'll give up on this for now. 2161 git clone https://github.com/tannewt/circuitpython.git circuitpython_tannewt 2162 cd circuitpython_tannewt/ 2163 git_update 2164 make -C mpy-cross/ 2165 cd ports/nrf 2166 make BOARD=feather_nrf52840_express clean 2167 make BOARD=feather_nrf52840_express 2168 cp build-feather_nrf52840_express/firmware.uf2 /media/jerryneedell/FTHR840BOOT/ result ```Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.0.0-alpha-3014-g9fb635b60 on 2019-11-23; Adafruit Feather nRF52840 Express with nRF52840
his work is probably in a different branch than master, so you'd need to checkout that branch.
git branch --list to look for likely suspects
@solar whale Scott's tags are not up to date in some way. I've noticed this in the past.
it may have to do with his original fork being from MicroPython instead of adafruit/circuitpython
@tulip sleet the problem is that the latest BLE code will not run if it sees a 4.0 tag.... I was just trying to create something to test, but as I said, probably best to just wait for a PR. I'll just read the code for now.
@solar whale the current problem with BLE HID on iOS is fairly deep, so don't feel you need to spend time on this. Scott will circle back after the weekend on it.
OK - These have been removed.
@dhalbert @tannewt
I'm not all that happy with changing the signature for subscr globally, but couldn't find a non-breaking way to ensure native subscript methods are able to call instance methods.
The issue was that mp_obj_subscr calls instance_subscr that then called mp_obj_subscr with self->subobj[0] (which is the native type). The native subscr could no longer call the non-native subclass method because the argument to pixelbuf_pixelbuf_subscr was the native class and not the NeoPix...
Can someone point me in the right direction? I am trying to test out the E-ink Gizmo, but I can't find any refrences.
Hi @rain hinge - have you checked out the CircuitPlayground TFT Gizmo learn guide?
Let me look again. I glanced through it, but I wasn't sure if it was relevant to the E-ink one as well
This is what I'm trying to get working: https://www.adafruit.com/product/4428
Extend and expand your Circuit Playground projects with a bolt on E-Ink Gizmo that lets you add a lovely tri-color e-Ink display in a sturdy and reliable fashion. This PCB looks just like a ...
I think this is close, but I don't think the pins are correct: https://github.com/adafruit/Adafruit_CircuitPython_IL0373/blob/8fc5caecff0b1269c34d68ab081621b367eca11d/examples/il0373_simpletest.py
Ah - ok, I am not certain either. @gilded cradle is the resident display expert. Maybe she'll catch this thread and chime in?
@rain hinge there is a guide in moderation for it right now. You'll want to look at the Adafruit_CircuitPython_Gizmo library at https://github.com/adafruit/Adafruit_CircuitPython_Gizmo
I wrote an example for using it.
awesome, thank you!
yw
Thanks @gilded cradle !
yw @old smelt, thanks for pinging me
Sweet
Thank you @gilded cradle and @old smelt !
I know the Pybadge has a guide out for nes emulation but has anyone done gameboy or gameboy advanced emulation on it yet?
Where can I find a good guide for porting Circuit Python to a new board and writing a library for it? I've got a board design I'm working on that would be perfect, but it's an STM32F446 board and I need CAN (which means a new library).
@flint lantern See https://learn.adafruit.com/how-to-add-a-new-board-to-circuitpython for procedures for adding a board, but it mostly assumes it's for an existing chip. It's more work to support a new chip variant. The STM32F4 port is under active development by @ionic elk, and a CAN native module would be welcome. A new chip and a new module are both non-trivial amounts of work and require careful study of the code base.
@tulip sleet Thank you! Do you know what @ionic elk 's fork is? I'd like to make sure I track that.
@flint lantern I use my fork for git flow only, so you'd be better off simply following the Adafruit master, I think.
We try to keep the PRs pretty small, too. So I typically never have a significant body of finished work that isn't being actively submitted.
@ionic elk Ok, that makes life easier. So, I noticed that you have linker and startup files for each supported chip -- are those substantially identical to what STM32CubeMX pumps out, or are they special?
Regarding STM32F446 - probably a chunk of work since but it is at least still in the Foundation line rather than moving up to Advanced, which might entail extra changes. You'd want to start by taking a look at the definitions for the F405, then comparing the datasheets to see what's different in terms of pin defs. The MCU vs Package distinction needs a refactor so you might need to ask questions if things seem unclear.
Linker files are very different from the ones CubeMX generates, to support internal flash!
If you have a development board with SPI flash on it that's not as relevant, but if you don't have external flash you'll need to follow my existing linkers or you won't be able to use a filesystem, store code, etc. REPL only.
I've got a custom board, so no external flash...
You'd need to follow the existing linkers then, for sure.
I guess I can compare the CubeMX output for the two chips to each other and to your linker script and figure out what I need to change.
Is this a project with an existing history of using CPy? Not to try and discourage you, but CAN is usually something I associate more with an RTOS
Brand new project -- the idea is a board that can interpret incoming data from a car and control a bunch of LED strips. I figure CPy provides the most straightforward and accessible programming interface. I was looking at micropython as well but @slender iron convinced me I ought to look at CPy.
Hmm, well, I'm not sure where CAN would be on the current priority list. I love learning new peripherals but my only experience with it was a college professor waving a 5 inch thick binder describing the protocol around to emphasize how crazy embedded can get. Might be a bit of a haul
Maybe there are some good mediation chips you could try before diving in?
CAN to UART or something like that
The STM-provided CAN driver isn't too bad as these things go.
CAN is really an awesome bus, all things considered.
I'm just a greenhorn figuring out how to wrap a CPy driver around it.
Sure thing! You could check out the implementations of SPI and UART to get an idea of how things are operating now. If you submit a PR, I'll be on hand to test and review it.
I was thinking of copying the Python interface over from micropython.
You'll need to fit it into the Common HAL bindings. We don't use the machine API
Actually, I don't think we even have a common HAL for CAN.
By 'machine API', do you mean the Cube HAL?
Yes, I noticed that there is no common HAL for CAN at this time.
I meant Micropython's API. I'm not a micropython person though! I'm just a C guy, I barely touch the python stuff π you'd need to ask @tulip sleet about that when he's awake again
Just wondering if anyone can help. I'm trying to run the 'screen' command to connect to my circuit playground express (I'm running circuit python). When I connect I get a blank screen, no REPL. It worked fine yesterday, so I am puzzled. I'm typing "screen /dev/tty.usbmodem14401 115200". I've checked the port is correct with ls /dev/tty.* as before. Don't know what I'm doing wrong. I really need the output to the console for debugging. Anyone have any ideas? (I'm on Mac Os).
I see an error that briefly says 'sorry could not find a pty'?
Never mind, seems the code wasn't running. Thought I'd receive a message about syntax or similar.
Make sure you don't have it open by anything else
@round sigil if you have a code.py running, you'll see nothing until it prints something or you type ctrl-c.
@tulip sleet following up from yesterday, has there ever been any interest in a CAN common hal component?
@ionic elk There hasn't been strong demand, and most of the chips we are using now don't support CAN. Adding CAN support is a value-added cost bump to the basic chip, so it raises the cost of the chip. Also it appears you still need an external transceiver chip in many cases
maybe some kind of CAN featherwing would make sense
I figured the same in terms of ease of use. But it does look like quite a lot of the ST chips support CAN out of the box - everything in the foundation line and the F12 and F13 in the access line support it.
@ionic elk no need for us to do it since Pierce is looking into it. We should just answer questions and give API feedback.
Sure, I don't know your process of deciding on new python-exposed APIs
Wasn't sure if there were extra steps/considerations.
Hi all, our community meeting is tomorrow at 11am Pacific / 2pm Eastern here in this text channel and the matching voice channel. Everyone is welcome to attend to discuss all things
. The notes doc for tomorrow's meeting is here: https://docs.google.com/document/d/1TuHZGiIFaJoudoecozZjlu0P7LEzi64EXh7w9L7CevE/edit?usp=sharing
One of the failed builds was arduino_mkr1300 so in ports/atmel-samd you can make BOARD=arduino_mkr1300 to check that your changes have fixed the errors that were detected during CI. (I didn't look at other builds, but most likely they all have the same underlying cause)
&vfs_fat->fatfs should be just fatfs
These 3 variables are only used in the CIRCUITPY_FULL_BUILD branch, so move them just after #else.
@onyx hinge I added some notes to your in-the-weeds topic
@tulip sleet thanks! I am sure I have missed previous discussion on this topic
np
@flint lantern -- I saw this pop up on TIndie today. I am not a CAN bus guy, but this might help keep you entertained while you work on the (probably big) CAN project you were discussing. https://www.tindie.com/products/iamorion/feather-canbus-shield/
@slender iron , @ionic elk Many of the STM32F4 series have one or two CAN interfaces built in, but each one requires an external interface trip to provide the correct electrical interface. The external chips run $0.50-$1.00 each in bulk and tend to have some very impressive isolation specs -- 15 kV HBM is not at all uncommon.
@lunar crown Amusingly, I have some prototypes of a very similar board I made myself for this project. Mine has a 5V boost converter so it will play nice even on battery. π
@slender iron , @tulip sleet How do you feel about copying the micropython CAN API over? It seems to touch all the necessary points and doesn't have a lot of fluff. The only thing I think it's missing is a function to calculate all of the bit timing stuff from a given data rate. Here's a link to the docs for it: https://docs.micropython.org/en/latest/library/pyb.CAN.html
@flint lantern my impression is it's desired for all hw drivers in circuitpython to be implemented using the common-hal structure, so just copying a set of file from micropython is unlikely to be satisfactory. I'm less sure what is considered good API design, except that simplicity and generality is favored over covering every HW feature
Perhaps the underlying hardware differs too much for that though..
For instance in the address matching capabilities
@flint lantern the micropython api is a good place to start but there are a couple changes that will need to be made
@onyx hinge I'm proposing that as an example of what an API might look like, not how the underlying code is architected. Hardware filtering is extremely common in CAN hardware, to the point where I'm not aware of a CAN transceiver (either uC peripheral or external chip) that doesn't have it, although the number of available filters differ and there are some other features around them available on some chips that I have no real interest in exposing via API. If there is a transceiver that doesn't have hardware filtering that someone wants to use in the future, it can be implemented in software.
@slender iron What kind of changes?
there is some background here: https://circuitpython.readthedocs.io/en/4.x/docs/design_guide.html
we'd merge together MP's constructor and init methods
our constructors also take in pin objects rather than peripheral number
https://circuitpython.readthedocs.io/en/4.x/docs/common_hal.html is good but maybe old info on folder structure
CAN.state would be a property rather than a function
So, if a particular peripheral only operates on only a few pins, how do you deal with user input of incorrect pins?
throw an exception
π
Here is the SAMD I2C implementation: https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/common-hal/busio/I2C.c#L76
@flint lantern makes sense to me, you have to start somewhere
It might be difficult to implement CAN.state() as a property without an auxiliary function to read it out of the underlying hardware on demand.
The obvious thing to do is update it every time one of the hardware interrupt fires or the user calls any other function. However, there are times when the underlying hardware can increment the error counters without triggering an interrupt.
hey, I;m trying to make a new board def based of the m4 express. I have everything working except one of the pins i want to use overlaps with the MICROPY_HW_LED_RX
i know many boards don;t have this, and they just seem to not have that def in the mpconfigboard.h. but when i comment it out the board does not boot into cp. it just blinks
nm! it went away. it must have been something else
@flint lantern It is fine to have the .state property call some function to read the state as necessary. For instance, when we have a driver that reads a temperature sensor, .temperature will do a transaction with the sensor to get the temperature.
and we don't have callbacks, so rxcallback() can't be implemented directly. But you can have an interrupt handler that gets called and adds a message to a fifo, and then have a property that returns how many messages are in the fifo, and another to read from the fifo (e.g. like the way UART works)
You might want to look at other CAN API's and see how they are structured (e.g. if there are other Python ones). They may be better or worse.
https://python-can.readthedocs.io/en/master/ is the first one I found
good morning