Code was marking a PWM slice as variable frequency when is was fixed.
#circuitpython-dev
1 messages · Page 354 of 1
What OS are you using @jerryneedell ?
is there a procedure to go into safe mode on the pico ?
Ok that makes sense, I'm pretty sure the need for a reset is a Windows specific issue. Its very easy on Windows to get a COM port into a zombie state where no application can claim it any more unless its removed. I have never seen that on Linux.
@jaunty juniper I don't think so. the reset button trick might just work
Thanks Dave! Just ran into this with audio PWM. Perfect timing!
I've also a seen it on a Raspberry Pi.
I'm trying to import <math.h> in my build of circuitpython so that I can calculate sin(angle). Did you ever figure out how to access math.h?
I'm building for the PyPortal.
Here's the error I'm getting:
CC ../../lib/protomatter/src/core.c
LINK build-pyportal/firmware.elf
/usr/local/Caskroom/gcc-arm-embedded/10-2020-q4-major/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: firmware.elf.lto.o: in function `displayio_bitmap_obj_blitfancy':
<artificial>:(.text.displayio_bitmap_obj_blitfancy+0x1d4): undefined reference to `sin'
/usr/local/Caskroom/gcc-arm-embedded/10-2020-q4-major/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: <artificial>:(.text.displayio_bitmap_obj_blitfancy+0x1ec): undefined reference to `cos'
collect2: error: ld returned 1 exit status
make: *** [build-pyportal/firmware.elf] Error 1
From a problem signaled by Redat on discord, the following code hangs after a reload.
import board
import gamepad
from digitalio import DigitalInOut
button1 = DigitalInOut(board.GP7)
button2 = DigitalInOut(board.GP14)
button3 = DigitalInOut(board.GP13)
button4 = DigitalInOut(board.GP12)
button5 = DigitalInOut(board.GP11)
button6 = DigitalInOut(board.GP10)
button7 = DigitalInOut(board.GP9)
button8 = DigitalInOut(board.GP8)
pad = gamepad.GamePad(
button1,
button2,
...
tested, works pretty well!
@onyx hinge Do you have time to review https://github.com/adafruit/Adafruit_CircuitPython_SD/pull/43 again? If it's positive I will make a new release with your doc change as well.
Tested the 2-color EPD FeatherWing again with 6.2.0-beta.1 on a FeatherS2 with adafruit-circuitpython-bundle-6.x-mpy-20210209. Issue still occurs, changes to label text aren't shown with a simple display.refresh(). This sequence gets it to work:
display.show(None)
display.show(splash)
display.refresh()
Neither the 3-color EPD FeatherWing nor the MagTag exhibit this issue.
My proposal on the copyright: Do nothing right now finish off the PR. Then open a separate issue and discuss. Maybe for example, the entire docs folder should be optional for Community devices ...
@idle wharf I'm game.
My only concern is the guide we need to update along with the PR.
someday I think the bundle model will break down, but for now I could that working great...
If you do the build stuff... I'll do the circup stuff...
Took me a second to realise that wasn't a reply to me. It was confusing as a response. 😄
AH yes... good point. OK. I'll open issue we can discuss and hold the PR
I'm a discord conversation and YT community meeting time traveler...
@idle wharf I don't have the cycles at the moment to update that guide. There's not a whole lot to the update, but the page that explains cookiecutter needs to match, well, cookiecutter. I don't suppose you're interested in updating it?
Fancy!
The reply feature has made that a lot easier to do.
I will look at it, but its probably not something I would want to do. Maybe I supply text, I don't want to learn Adadruit's doc system.If it was markdown in the repo then it'd be an easier sell. (I struggle with RST too.)
I totally understand that the docs and the PR need to go together.
FWIW -- on the Raspberry Pi, I have MicroPython on the Pico and I also see occasional spontaneous resets of the board.
@idle wharf Yeah it's a proprietary system that has a tiny learning curve, but that's entirely fair. I figured it was worth asking.
Totally OK for you to ask 😉
@lone axle I'm thinking perhaps punt the PRs I suggested, and instead update the Sharing a Library guide to match the incoming PR so we can merge it sooner rather than later. Would you be up for that?
@lone axle These two sections will need to be updated to match the new cookiecutter output.
the cookie cutter one?
Yeah.
yep. I can do that. @idle wharf do you know how to test locally the new version? I want to make sure I get all of the prompts accounted for but have only ever run the production one.
@idle wharf We're on. Please finalise the PR and we'll get it merged.
Well we gotta sort out the copyright and the docs stuff... I think those are bigger choices for you to make
(writing the issue now)
Ok
@lone axle I think I tagged you on the PR already, but I'll tag you once we're ready.
Then you can get to it when timing works out. I might leave merging up to you at that point so you can deploy the doc updates at the same time on your own time.
Do you mean how to get the latest version from the repo?
Do you use gh client ?
how to run cookie cutter with it once I have it cloned locally.
Oh, I can help with that one. You run the same command as in the guide, but you run it from within the cloned repo, and you use . instead of the github address.
ah... I backup one folder and then cookiecutter cookiecutter-adafruit-circuitpython
excellent! thank you both 🙂
😄 exactly
If I did it that way Kattni, I'd probably checkin my test runs by accident...
haha that's totally fair.
Finding this issue here just saved me a lot of heartache :) I didn't pay attention two the "two pins per PWM channel" thing until seeing this.
@jerryneedell I tried this with the I2C/SPI backpack, which uses an MCP23008. I had to use 3.3v->5v level shifters to get it to work with a Metro M4, and then I moved it to an RPi Pico and it worked fine. I did not try it without the level shifters on the Pico in the interest of not potentially frying the Pico.
If I use the Metro M4 connected straight to the backpack with the 5V pullups, it hangs up. I think it does not like the overvoltage. I have seen this before with the SAMD51
The ...
@dhalbert Thanks, I did add 10K pull-ups -- and I think the single levels are since it it designed for a Pi. It only takes 5V input.
I'm really puzzled by the behavior on the Pico. Alos puzzled by the guide reference to the adafruit_74hc595 library ... It does not seem to be used.
@idle owl OK its not actually that a big a deal now that I went through all the files and categorized them.
https://github.com/adafruit/cookiecutter-adafruit-circuitpython/issues/103
@idle wharf any plan to add a pre-commit-config.yaml to circup ? with make check in it
@idle wharf Please tag me on that issue so I can have it in my email and look at it tomorrow.
@jaunty juniper great idea... circup feels sort of one-off to me, maybe the cookiecutter should be applied to it
The 74hc595 library is used only for SPI. The backpack has an MCP23008 for I2C and a 74HC595 for SPI use. I will clarify the Guide.
Were your pullups to 3.3V or to 5V?
3.3v -- and I just got it to work by removing the pull-ups and adding another I2C breakout to the setup to let it provide the pull-ups. Checking my wiring, but it seems to be happy now...
Should I close this? It is not clear to me what was wrong before, but I don't think this is a CP issue.
Yes, let's. Redat is getting some level shifters and will try with those. Their LCD is arrangement is different.
@tulip sleet Thanks for the help with the LCD. The "plate" was the only LCD I had and I was only hooking it up to respond to the original Discord question. I had some pretty long wires and that may have played into it. Now that it is working, I'm happy to put it back in my parts box.
oh so this is fixed? I thought the PWM channels could be freely mapped. Where did you find that table with the channel pairs?
I have a box full of pre-Adafruit LCDs and adapters of various sizes. THe level converters seemed very necessary on the ones i have.
I check the schematic for this one before using it. The I2C signals are level shited on the board for the Pi, but it expect 5V in -- 3V is not connected....
hmm -- I take that back -- I need to read up on the mcp230017 -- and stop using this for now
I am confused. looking at the schematic now, the mcp230017 is connected to 5V -- not sure how that is OK on a Raspberry Pi?
Table 526 on page 536 of the data sheet. Also in Table 290 on page 252.
Agreed, shalikashvili, audio is a pretty common feature for many projects. It's lack on this platform is notable.
I’ve been playing around with classes for LatchingRelay and soon Relay. Is this something that would find a home somewhere?
Hey @lone axle , sorry for the late boop (aka "ping"), but wanted to make sure I got this to you. The steps for updating a library I have from Saturday, and other stuff I've found since. Let me know if you can't reach it, need more info or anything
https://gist.github.com/hugodahl/283d55a020bb2632d4425211f2eafbbe
Hello, sorry if this is not the correct channel but I do not know where to put or ask question regarding the libraries.
If was looking in some issues for the library
Adafruit_Circuitpython_DHT.
I review the issues (open/closed). I compile a table that is in my REPO. link included
So, I decide to compare the old with the new library, and here I am talking for the BITBANG as a lot of people raising the issues are using RPs
I found that the new library uses the following code to start the communication
dhtpin.direction = Direction.OUTPUT dhtpin.value = True time.sleep(0.1) dhtpin.value = False time.sleep(0.001)
However reviewing the odl library in C code I found that the initialization time were
` // Set pin high for ~500 milliseconds.
pi_2_mmio_set_high(pin);
sleep_milliseconds(500);
// The next calls are timing critical and care should be taken
// to ensure no unnecssary work is done below.
// Set pin low for ~20 milliseconds.
pi_2_mmio_set_low(pin);
busy_wait_milliseconds(20);`
This times coincides with some standard found in ocfreaks.com and in sgbotic.com
Images attached.
I did some tests, altough not perfect, at least my DHT11 worked with the bitbang of the
Adafruit_Circuitpython_DHT library 70% of the time in my RP3
Last thing, I did find a sparkfun datasheet that mentions 1 ms as low signal to start listening,
https://github.com/jposada202020/DHT_Investigation/blob/main/DHT_investigation.md
Do anybody knows why we use 0.001 for the low signal? I really appreciate some insight. THANKS 🙂
DHT Protocol
@still zephyr the dht11 protocol is a weird one. the lack of real-time support on the rpi makes it hard to support
I have to rig up measuring current running on battery. Using an INA219 FeatherWing. FeatherS2 on USB 5V power (data lines not connected to fool Deep Sleep) down to avg 1.5mA using TimeAlarm, but there's the red power LED shining brightly.
Not using any sleep modes, just disconnecting from wifi when it's not needed cuts current by around 30mA.
@tannewt do I need to edit the run_code_py function in the main.c file?
Hi,
I'd like to add our new device, DynaLoRa-USB dongle. A low cost prototyping tool for wireless communications and tinkering with CircuitPython/Arduino :)
Design files in our repo: https://github.com/BHDynamics/rfm_radio_dongle
Thanks,
Enrique
@fossil gorge that is awesome. No worries about the time, you can ping me here anytime I turn off notifications when I'm unavailable so pinging me will never be interrupting anything.
I will talk with Kattni and figure out where the best place would be to get this info into the learn system.
I know some of that is a bit circumstance specific, but figured I'd document it to it's at least "known"
And those parts are the ones which I've run into. The parts you covered, I put in there more or less verbatim
The community bundle is a home for user-contributed libraries. See https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library
@mental nexus scrolls back a year
@mental nexus I don't think so. I ended up doing a much simpler workaround of the problem that didn't require <math.h>
@mental nexus You have to refer to the version of the trig functions that work with floats, e.g., cosf instead of cos. You can also write MICROPY_FLOAT_C_FUN(cos) to refer to the correct (float or double) version.
You should also use the type mp_float_t for floating-point values
Thanks @ionic elk and @onyx hinge Found this example in the ulab code late last night while GitHub codescrolling: https://github.com/v923z/micropython-ulab/pull/104/files#diff-eb92dc1ef7752e89bd82ac2ba0c8878ab7e3c73b342063caeb72cf75963e4a9a
And thanks for the warning for the right code and data type to use for float or double.
@candid sun Hey! This channel will do well enough.
Do you have the AW9523 board yet? It is my understanding that you'll be working with it soon with Noe and Pedro.
yes we are! i have a couple on order
Oh ok, you don't have it yet. Well maybe you can still help. I'm working on the guide for it and trying to do the wiring diagrams. I'm a little unclear on how to hook up an LED.
I thought LEDs usually go from pin to ground with a resistor in the mix.
But all the extra pins on this board are VCC.
or VIN rather.
i was a little cloudy on it too but i'm thinking that the LED's pos leg will be connected to one of the GPIO outs
Right ok I figured that part
but yeah not completely sure what the VIN rails are for
where there's one for each pin
hmm, from Limor in Slack: "ok the cool thing about the expander is you do not need LED resistors"
Right that's where I got confused was the VIN rails.
I guess I'll ping Limor. She'll know for sure.
I thought you might have it already 🙂
no unfortunately, hopefully soon though! darn snow
@candid sun Oi yeah. Ok, well I'll let you know what I find out 🙂 In case you get it before the guide goes live.
Thanks for thinking through it with me!
@idle owl thank you!
@idle owl yah, the AW has fancy pants outputs that limit the current, so will basically do what the resistor would do normally
Ok, that makes sense, but I still don't understand the VIN rails. @tidal kiln Don't LEDs go from GPIO to ground?
Or is the current limiting to connect the LED to VIN and GPIO?
let me look at the docs real quick. mines on the way also unfortunately.
product description says "simply connect the LED anode to one of the many VIN pads, then connect the cathode to the GPIO pin"
think of the VIN rail as that red stripe
^^yep
so like LED+ to VIN, LED- to GPIO
the VIN rail is for convenience, otherwise you'd be bringing all the LED anodes (+) back to a single point
Hmm ok
Fair enough.
Thanks!
@slender iron This is still needed in 6.x for a generic CircuitPython audio out example, correct? python try: from audioio import AudioOut except ImportError: try: from audiopwmio import PWMAudioOut as AudioOut except ImportError: pass
@tidal kiln Like so?
@slender iron Ok, updating the Essentials guide to remove deprecated code, and wanted to verify that wasn't also deprecated now. Didn't think it was, but naturally I chose a Bluefruit to test, so it would have worked if I removed the extra stuff there... figures. Thanks.
@idle owl i think so. that's my understanding at least. do you have one to actually test?
@tidal kiln Nope.
That's why I'm struggling.
if I could have simply hooked one up, I would probably have sorted it.
heh
@blissful pollen Looks like great work on the ParallelBus for RP2040. If you have a 320x240 sized display, can you run a ParallelBus benchmark speed test? So far, I've got the PyPortal (ATSAMD51 "M4") and the ESP32-S2 Saola development board.
https://gist.github.com/kmatch98/d025c51bb9c764deb0720531f983031e
Thanks (though I still have to tweak the PR in how it sets the pins for output). I do not have any 320x240 sized displays just the 480x320 one. I saw your speed tests but of course can't replicate them exactly
@gilded cradle If I were going to add the Getting Started with Pico and CircuitPython guide link to the Pico downloads page on circuitpython.org, do I add it to _board/raspberry_pi_pico.md ?
@slender iron Would you suggest replacing the RPi Documentation link with our guide? Or adding it in addition to?
addition to
Thanks
@tidal kiln I was going to look at the Pico TCS34725 issue. Unfortunately I don't have this breakout. It has level shifters. Are you powering it with 3.3V on Vin or 5V? I am just wondering about the strength of the pullups and whether the SCL/SDA pins are showing 5v or 3.3v out.
cosf worked perfectly. Thanks!
@idle owl, that's correct. Sorry for the delay.
@gilded cradle No worries, thanks.
@tulip sleet sry. on a quick pre-snow event errand run. let me take a look....
np
@tulip sleet power via 3V3 OUT from pico. i just set this back up. i'll add a photo to issue thread.
thanks, I was wondering whether the Pico was seeing 5v pullups. Maybe next step is to parallel some 10k or 5k resistors on the pullups to see if stronger pullups help. I will try some other breakouts.
@tidal kiln so you are just sending an EON command, and that's getting a NAK, right? this is weird
can't remember what the command was, but something i grabbed from the driver, and the just tried to send that manually
yep, and it NAKs
Is there a list of what works and doesn't work (but will one day) in CircuitPython on Raspberry Pi Pico. I might take a look at PWMAudioOut next week...
Thanks. I see https://learn.adafruit.com/getting-started-with-raspberry-pi-pico-circuitpython/faq-and-troubleshooting too but it doesn't cover everthing (yet).
Will stereo playback of samples work ok?
@slender iron - I noticed that we are building RP2040 builds with BLE on by default. Not that we're short on memory, but it does add about 31K to the build. Was that done on purpose?
BLEIO_HCI makes sense, BLEIO does not
@tulip sleet - If I just set CIRCUITPY_BLEIO to 0 I get an error in main where bleio_reset is getting called.
is BLEIO_HCI set? You need BLEIO for BLEIO_HCI
BLEIO_HCI is on by default when CIRCUITPY_FULL_BUILD is on
that makes sense, because you may want to use it with an AirLift
ANy board that has the flash space has BLEIO_HCI on
OK - I'll ignore it then, thanks!
Will stereo playback of samples work ok?
Yes, it should work. The pins need to share a PWM slice under the hood.
I saw #4143 but haven't yet worked out exactly what's going on there, is that related to this? Is there anything simple that documents "the slices" or is in the monster datasheet?
@tulip sleet no change with 10k or 4.7k added in
@tidal kiln 😦 thanks for trying. I will try a few other breakouts to see if they fail similarly, and will order that one.
np. yep. from what i can tell, it's a pretty weird issue.
I saw #4143 but haven't yet worked out exactly what's going on there, is that related to this?
This bug is fixed in main. (I'll close shortly.)
Is there anything simple that documents "the slices" or is in the monster datasheet?
It's in the pin function section. It's simple though. The slice is pin number / 2 % 8 and the channel is pin number %2. In words, starting at zero the next two pins share a slice, then the next two do and so forth until pin 16 which starts the pattern aga...
@uncut nexus we should have plenty of space for it on the rp2040. thanks for asking though!
@kahveciderin It depends on how you are mounting the SD card. If you mount it to / then you shouldn't need to.
I suspect this may have something to do with tick management internally. It's a bit of a hack now that I mean to take another look at.
We'd love to have it but it isn't a priority for us. We're happy to help anyone get started developing with CircuitPython.
Looks good! Thank you!
@tulip sleet Around for a question?
@idle owl sure
@tulip sleet What is this? https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/dc466bca6d0accfdfcf080ddb99eef3716dd4d25/CircuitPython_Essentials/CircuitPython_Logger.py#L24
I mean I assume the except OSError as e bit is for when the filesystem isn't writeable.
But what's the specific argument?
Trying to add this to a guide, and want to make sure it's all necessary and how to explain it if so.
an exception can have associated values, often an error code or (usually) a string, e.g.:
>>> e = Exception(32)
>>> e.args[0]
32
>>> e = Exception("something wrong")
>>> e.args
('something wrong',)
>>> e.args[0]
'something wrong'
So this was the equivalent of raise OSError(28)
the 28 is an errno value, hold on
ok
error 28 is ENOSPC, no space left on device (e.g. filesystem full)
I think a comment is in order
Indeed.
@tulip sleet Added the comment, I'll put it in with the current code I'm working on.
and all other errors it blinks more slowly
like being unable to open the file for write, etc.
The existing implementation of I2C does not currently recognize requests for a repeated start condition, which caused reads to fail on some chips. Since only the "IT" interrupt-driven versions of the ST HAL support this feature, fixing this issue also required implementing the usual infrastructure for ST interrupts, matching other modules like UART and PulseIn.
@tannewt I didn't really touch the base implementation here, but if you think we'd benefit from moving regular I2C operations to t...
@tulip sleet Right. Ok. Thanks!
I tested the Pico with a BME280, LIS3DH, and BNO055 (uses clock stretching), and don't see issues. So the problem seems fairly specific to this I2C device. I'll order one to check.
Please note the change of day! Here is the notes document for TUESDAY’S CircuitPython Weekly meeting. It is on TUESDAY next week, at 11am Pacific / 2pm Eastern here on Discord. Everyone is encouraged to attend! Please add your hug reports and status updates even if you’ll be attending the meeting - it’s super helpful! If you are unable to attend but would still like to include updates, feel free to include them in the notes and we’ll read them off during the meeting. Hope to see you there! <@&356864093652516868> https://docs.google.com/document/d/1CgGh2MkN5dY0VeqONvdY1h9bs13mZhzp1a4nYExQ4vg/edit
Google Docs
CircuitPython Weekly for 16 February 2021 Welcome to the CircuitPython Weekly meeting notes! Feel free to add your Hug Reports and Status Updates early. During the meeting, we go through them as a round robin sorted by username. If you can’t make the meeting and would still like to participate,...
@tulip sleet More questions about the nature of storage.remount(). Or maybe only one question, I don't know. If you run it, and make the filesystem writable to CP, your computer can no longer write to it. So, in the Essentials guide for example, we show how to wire a pin to ground to make the filesystem read-only, and if you start the board without that pin wired, it's writable. What do you do if you don't have that extra step in there? So let's say you have the following boot.py file: python import storage storage.remount("/")And you log something for a bit, but then you want to update your code, how do you get back to a writable state?
Because you can't simply delete boot.py, because it's a read-only filesystem at that point.
This is specific to the Pico, which I don't know if you can get into safe mode, as I assume that's going to be your answer.
@idle owl you can do this in the REPL:
>>> import os
>>> os.remove("boot.py") # delete boot.py
OR
>>> os.rename("boot.py", "boot1.py") #rename boot.py
Ooooh. Ok.
@brentru I'm less familiar with the mqtt parts of this. EBADF is most likely to occur when a read or write operation is attempted on a socket that has been closed. Are there extra steps that should be taken here to ensure that valid sockets are being used in the loop?
This could be simply that you're running out of sockets, since any TLS sockets you use will actually reserve 2, and we only have 4 total right now for memory reasons. That said, if you were, it should raise a message specific to that and not the placeholder OSError: 0
@brentru can you double check that this is fixed?
Closing this as it's almost certainly overridden by major reworks to the Socket module and more minor changes to Requests. Other issues are now tackling remaining instances of OSError: 0
Can you try with the "Absolute Newest" CircuitPython https://circuitpython.org/board/adafruit_magtag_2.9_grayscale/ and latest release of Requests? This may be a distinct DNS issue, but there has been a lot of rework and issues closed since 6.1.
@tannewt @brentru is this issue still relevant with the changes to Socket?
@tannewt similar ping on this as #2097
I copied some larger audio files to CIRCUITPY, using up about 30% of the space. storage.erase_filesystem() reset the board but did not reformat the filesystem. The filesystem appears the same before and after. So perhaps the original issue was a corrupted filesystem that wasn't cleaned up by erase_filesystem(). I've changed the title to reflect the more general issue.
I have also reproduced this behavior.
A few questions for feedback:
- A better name of the function
Bitmap.blitfancy - Should the source and destination translation points
ox,oyandpx,pybe sent as(x,y)tuples? - Should I add a
decode_an_tuple_of_intfunction since this code is duplicated? (maybe it will save space) - Should I add a
constrain_clip_boundaryfunction to constrain and arrange the clip coordinates, since this code is duplicated? (maybe it will save space)
This version added about 2kB to a bu...
is this expected behavior?
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit_circuitplayground.express import cpx
>>> dir(cpx)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is not supported on Circuit Playground Express.
>>>
older rev, fwiw:
Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit CircuitPlayground Express with displayio with samd21g18
>>> from adafruit_circuitplayground.express import cpx
>>> dir(cpx)
['__class__', '__dict__', '__init__', '__module__', '__qualname__', 'gamepad', 'temperature', 'acceleration', 'shake', 'tapped', '_int1', '_i2c', 'light', '_audio_out', 'detect_taps', '_touch', 'touch_A1', 'touch_A2', 'touch_A3', 'touch_A4', 'touch_A5', 'touch_A6', 'touch_TX', 'adjust_touch_threshold', 'pixels', 'button_a', 'button_b', 'were_pressed', 'switch', 'red_led', '_sine_sample', '_generate_sample', 'play_tone', 'start_tone', 'stop_tone', 'play_file', '_a', '_b', '_switch', '_led', '_pixels', '_temp', '_light', '_touches', '_touch_threshold_adjustment', '_lis3dh', '_speaker_enable', '_sample', '_sine_wave', '_sine_wave_sample', '_detect_taps', 'touch_A7']
>>>
wait
why are you importing from .express?
It was refactored to use a base class
I don't know why it would fail that way
but do from adafruit_circuitplayground import cp and then dir(cp) and it works.
ah. i'm copying someone else. could be it. let me self rtm....
Hah. Ok
Yeah we refactored it, you shouldn't be importing from .express specifically anymore.
There's really nothing in it.
Nearly everything is in the base class.
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit_circuitplayground import cp
>>> type(cp)
<class 'Express'>
>>> dir(cp)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is not supported on Circuit Playground Express.
>>>
Ah ok
welp
It works on Bluefruit
so I'm not sure what's going on there
I think I'm running the beta though, and maybe not the latest CP lib.
let me update the lib
the actual lib is frozen in, right? must be, it's not in my lib folder.
yes for CPX
not bluefruit
Hmm it works on Bluefruit.
I am confuse.
Let me grab a CPX.
okie doke. cool. thanks.
Yep fail.
I wonder if it's the way we did the unsupported things, when you do dir(cp) it tries to list unsupported features and fails? I'm stretching here.
the line number is odd too, if that can be trusted
Agreed, it's not right.
I don't know what's going on.
hold on
let me update, this is running a dirty build.
it otherwise generally works
>>> cp.pixels.fill(0xADAF00)
>>> cp.play_tone(440, 1)
>>>
tab completion works too
fail on the beta as well.
I wonder what changed. Pretty sure that dirty build had a latest version of the lib too, and it failed with that. So it's not like updating the frozen module will fix it.
I'm at a loss. Bluefruit works fine.
you said not frozen on bluefruit? so it's using what's in lib folder?
yes
Bluefruit has room for it.
Express, not so much.
Doesn't appear to be a frozen library limitation ```>>> import adafruit_lis3dh
dir(adafruit_lis3dh)
['class', 'file', 'name', 'const', 'digitalio', 'math', 'namedtuple', 'struct', 'time', 'version', 'repo', 'LIS3DH_I2C', 'RANGE_8_G', 'RANGE_16_G', 'RANGE_4_G', 'RANGE_2_G', 'DATARATE_1344_HZ', 'DATARATE_400_HZ', 'DATARATE_200_HZ', 'DATARATE_100_HZ', 'DATARATE_50_HZ', 'DATARATE_25_HZ', 'DATARATE_10_HZ', 'DATARATE_1_HZ', 'DATARATE_POWERDOWN', 'DATARATE_LOWPOWER_1K6HZ', 'DATARATE_LOWPOWER_5KHZ', 'STANDARD_GRAVITY', 'AccelerationTuple', 'LIS3DH', 'LIS3DH_SPI']
But it could be something about it being frozen and the way we handle unsupported modules.
seems like it. if it were a basic frozen issue, the above would have it also.
Or would fail somehow anyway.
@slender iron @onyx hinge I am composing beta.2 release notes.
@idle owl worth issue?
@tidal kiln Probably, though I have no idea who will look at it or when. But yes, please. File an issue.
Re this thread:
https://forums.adafruit.com/viewtopic.php?f=58&t=175096
Some weirdness trying to use dir() with the CPX. Can recreate it:
Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit_circuitplayground import cp
>>> type(cp)
>>> dir(cp)
Traceback (most recent call last):
File "", line 1, in
File "adafruit_circuitplayground/express.py", line 82, in _unsupported
NotImplementedError: This feature is...
@tidal kiln Ah I would have filed it on the lib. But that also works. Might get it looked at more quickly. Or it might get moved to the lib. 🤷♀️
🙂
We can consider reverting #4114 once https://github.com/adafruit/Adafruit_CircuitPython_SD/pull/43 is merged. The need for native .spi will go away.
This doesn't actually work for me (adapting the duplex spi example), though I think the problem lies either with my pio code or the construction of the StateMachine.
Here's my test program, with a workaround for https://github.com/adafruit/Adafruit_CircuitPython_PIOASM/issues/7 applied:
import adafruit_pioasm
import rp2pio
import board
"""
; Pin assignments:
; - SCK is side-set pin 0
; - MOSI is OUT pin 0
; - MISO is IN pin 0
;
; Autopush and autopull must be enabled, an...
@idle owl, you have time for milk and cookiecutter?
I saw your reply on the issue, I had one more idea. Would Adafruit want to add the product number so the link to the adafruit hardware page could be in every library?
If the URLS could pre-known (well formatted) we could even add the picture.
fine to merge once CI passes
Hmm. Maybe? We kind of do that with the PCB repos already. Don't see why it wouldn't be useful in the CircuitPython library repos.
I say "kind of", I mean we do.
The single build failure the stm/boards/espruino_pico ja build, which is overflowing by over 2k bytes, which is odd, because I would have expected previous PR's to cause this.
Sorry for delayed response, I was quickly eating before our meeting.
@uncut nexus are you looking at the pio as well?
@idle wharf The cookiecutter for the PCB repos has that feature is my point.
Including the image from the product page.
If you want to see an example of how to do it.
We don't automatically set the pin direction for the output pins so you need init code to do it. Your current init uses the set instruction to do it but doesn't provide the first set pin (should be the same as output.)
We probably should automatically set the sideset direction automatically, otherwise we need to use set for it as well.
Perfect! I will add that and finish up the PR tonight. Woo hoo!
I was able to reproduce this error. Commenting out the raise exception in _unsupported in adafruit_circuitplayground.express allowed for it to operate as expected.
@property
def _unsupported(self):
"""This feature is not supported on Circuit Playground Express."""
raise NotImplementedError(
"This feature is not supported on Circuit Playground Express."
)
@property
def _unsupported(self):
""...
Excellent, thank you.
@onyx hinge want to chat PIO before our meeting?
@slender iron sure, let me get back to my desk
can just do it in the same place
Thank you for reproducing this. I assumed it was something connected to how we were handling unsupported features. I would like to figure out why it's happening, and sort out a way to still provide an error for the unsupported features.
@tulip sleet If you have a moment: https://github.com/adafruit/Adafruit_Learning_System_Guides/pull/1449
Cheers.
Here?
or help
@tulip sleet boot.py is run only when the board boots up, correct? So is that on soft reset as well? When you press the reset button? Or since the Pico has no reset button, when you plug it into USB?
on pico, yes when plugged in. I will double-check about reload
by plugging or via the run pin
Run pin?
no not on soft reload, of course, since USB is connected
the pico has a pin called run, that... resets
as the name does not imply
It's meant to be beginner.
Hah! True
@tulip sleet Trying to explain this file: https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/master/Getting_Started_With_Raspberry_Pi_Pico/data_logger_boot.py So far I have it's setting up the pin. With the storage.remount("/", pin.value), it's running storage.remount every time the board starts up, but only remounts if the pin is connected to ground? Is that a good explanation?
it might be clearer if you test the pin and run remount only if it's in the state that needs it.
if pin.value:
storage.remount(...)
ok
or maybe it's not pin.value
I'll update and test it.
it would be a breaking change but having readonly a required named parameter would make the API clearer in the examples (as long as everyone understands it's readonly from python of course)
actually is that possible ?
@tulip sleet It's not. 😄
Would it be if pin.value if I did a Pull.DOWN?
Why is a pull-up used over a pull-down anyway.
and put the other end of the button to VSYS
?
instead of gnd
There's no button. It's a jumper wire.
oh, you connect the jumper wire to what?
gnd is usually more readily available than the +v when you design a board. Maybe a little less noisy too
if you pull DOWN then you'd connect GP0 to vcc to simulate the "press"
this is fine 🔥
some old microcontrollers had pull "UP"s but not "DOWN"s, now most have both.. so like original arduino atmega had only pull UP as far as I remember
Exactly.
I was thinking storage.remount("/", readonly = False) might be more readable than a mysterious boolean, even if the name is not necessary ?
i like using the argname
@tulip sleet python if not write_pin.value: storage.remount("/") yes?
I mean it worked
but checking with you anyway
i thought you had to specify a non-default value of the readonly arg?
¯_(ツ)_/¯
it defaults to False
or even if the default value is ok, specifying it is clearer.
how so, I'm not following
remount could remount read/write or readonly, so which is it? we'd have to look at the doc
Oh hmm
I am not sure what causes it but you can fix this issue by adding a __dir__ function to this class and return the dir(super()). This is a little bit of a hack, but since this function doesn't have any other methods I think it should work.
def __dir__(self):
return dir(super())
then again we only ever remount with False, since it's to change the default behaviour of the drive
well, you could flip back and forth, for some reason
@tulip sleet So what should I be doing then?
true, like write into a file and remount readonly
@jaunty juniper I'm getting that much, but I'm unclear on exactly what the code is supposed to be.
I'd be interested in knowing why dir() has this behavior also.
But, in terms of supporting this a different way, you could have stubbed versions of these functions added to circuit_playground_base that raise the exception. Boards that support the function would override and implement. Others would do nothing, in which case the base stub would get called and raise the exception.
I think it has something to do with it being a property, but I don't know why. I was able to reproduce this if I commented everything out related to the _unsupported property and created a new property that raised a different exception.
@idle owl
if not switch.value:
# If switch pressed, mount CIRCUITPY so Python can write it.
storage.remount("/", readonly=False)
@tulip sleet Thank you
No problems spotted, but I didn't do any testing. (@ladyada did but didn't formally review the PR)
It's a bummer that the audio sample converter APIs I added didn't work out to use here, but I see why it wasn't used.
Oh, good call. I've gotten so used to @property I don't even notice it much now. Hmmmm....why is it a property? For the items that get remapped:
sound_level = _unsupported
loud_sound = _unsupported
play_mp3 = _unsupported
the last two are functions.
Simply commenting out the @property line gets around it also:
Adafruit CircuitPython 6.2.0-beta.1-194-gf6603aa56-dirty on 2021-02-10; Adafruit CircuitPlayground Express with samd21g18
>>> from adafruit...
If you gotta, you gotta. No testing performed. I initially wondered if i2c_assign_irq needed a "free irq" counterpart, but now I see it's just determining the preassigned IRQ for the peripheral... I'll stick on an Approve but I don't know what's going on with that failed build .. doesn't make much sense
It would appear that dir() is trying to call the unsupported properties. If you hit tab-complete, a property gets called. This may be a side-effect of that, but if so, bleh.
@slender iron I will do beta.2 unless you have anything else you want to add now
let me glance over pending stuff
@tulip sleet looks good to me
I suspect we'll want to do one next week too
downloading the download logs now ...
I'm curious about the pico stats too. we really need a cron for it
it would be great to suppress the upload logging. I haven't had time to look at that. I did look at doing AWS lambda to do some preprocessing, but just saw it was possible
@uncut nexus @onyx hinge I went a little wild improving state machine (untested): https://github.com/tannewt/circuitpython/tree/rp2040_audiobusio
added stride support, restart, run and stop
also wait_for_txstall which I need for I2S
I'll test it tomorrow when I do the PIO for I2S
we should determine a better way to pin init
Automated website update for release 6.2.0-beta.2 by Blinka.
New boards:
- dynalora_usb
- silicognition-m4-shim
- lilygo_ttgo_t8_s2_st7789
Interesting note in the python docs about dir().
Note: Because dir() is supplied primarily as a convenience for use at an interactive prompt, it tries to supply an interesting set of names more than it tries to supply a rigorously or consistently defined set of names, and its detailed behavior may change across releases. For example, metaclass attributes are not in the result list when the argument is a class.
Maybe __dir__ sh...
I am still getting "ValueError: All timers for this pin are in use" when using GP18 and GP19 as PWMOut.
analog_in = AnalogIn(board.A4)
AttributeError: 'module' object has no attribute 'A4'
With the patch in, this script is working for me:
import pwmio
import board
pinred = pwmio.PWMOut(board.GP17, frequency=5000, duty_cycle=0)
pingreen = pwmio.PWMOut(board.GP18, frequency=5000, duty_cycle=0)
pinblue = pwmio.PWMOut(board.GP19, frequency=5000, duty_cycle=0)
print(pinred,pingreen,pinblue)
Note that if you choose GPIO pins that use the same channel (such as 5 and
21, or any pair
that differ by 16) you will still get the ValueError.
On Wed, Feb 10, 2021 at 10:32 PM bhavithiran97 <...
You don't need an AnalogIn to read the temp. It's available as microcontroller.cpu.temperature in 6.2.0-beta.2. Just import microcontroller before that.
Any support for this? maybe making the microcontroller.cpu.frequency settable would help
Adding our newest board since it was already successfully merged into main CircuitPython repo.
Best regards,
Enrique
Rando question - has anybody dealt with pinning Micropython and NimBLE to core 0? I'm running into inconsistent initialization times on a BLE board, largely because of this issue:
https://github.com/micropython/micropython/issues/5489
on a metro-esp32s2
After a hard reset I can access I2C normaly, but after soft reboot or deep sleep the access fails to find the I2C device
This example uses board.I2C, but is fails the same with busio.I2C
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 6.2.0-beta.2 on 2021-02-11; Adafruit Metro ESP32S2 with ESP32S2
>>>
>>> import shtc3_simpletest
Temperature: 2...
closing -- duplicate of #4147 -- it's deja vu -- all over again....
[adafruit/circuitpython] New comment on issue #4147: ESP32S2: unable to access I2C after soft reboot
This is pretty much a show stopper for using es32s2 with I2C -- Should this be assigned to a milestone? I think it is fairly urgent.
[adafruit/circuitpython] New comment on issue #4147: ESP32S2: unable to access I2C after soft reboot
hmm -- This issue doe snot occurs with an U expected Maker feathers2 and a bme680 I2C sensor.
It is able to run after reboot.
No idea if it is relevant, but I do not have the UF2 Bootloader on the umfeathers2.
@tulip sleet Is there something I have to do to "revert" to not use the UF2 bootloader on a metro esp32s2 -- I just did a make flash ... and it loaded OK but does not boot? It works fine with the UF2 Bootloader.
did you load the bin or the uf2?
i don't remember the uf2 mechanism, but I never use the uf2 bootloader. you can do esptool.py ... erase_flash or something like that to get rid of everything, and then load the bin.
[adafruit/circuitpython] New comment on issue #4147: ESP32S2: unable to access I2C after soft reboot
Ah HA! This issue doe not occur on the Metro-esp32s2 if I do not use the UF2 Bootloader.... the plot thickens....
ah -- uf2 bootloader is causing some mischief....
The same thing happened last night. Do you think it has something to do with low battery levels?
We saw something similar a long time ago with SAMD boards. They would reboot at too low a voltage level: the voltage was enough to run the CPU but the first attempt at trying to read the flash chip failed. So the code assumed the flash filesystem was defective and reformatted it. We ended up changing the bootloader to wait longer for the voltage to stabilize.
The latest 6.1.0-beta.2 has a fix so that waking from deep sleep will not mistakenly think there was a brownout. I'm not sure that w...
I think they mean “with the proposed changes incorporated”
On Wed, Feb 10, 2021 at 9:48 PM bhavithiran97 notifications@github.com
wrote:
What do you mean by patch in ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/adafruit/circuitpython/issues/4143#issuecomment-777217031,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ADWE465QJJPA2IXXPMGZOYTS6NVTBANCNFSM4XF4LMKA...
@slender iron seems like your work in progress code that you shared with me yesterday supersedes the draft PR I had to enable read and read/write on pio .. agree?
[adafruit/circuitpython] New branch created: revert\-4114\-spidevice\_spi
Fixes #4172.
https://github.com/adafruit/Adafruit_CircuitPython_SD/pull/43 removes the need for the .spi accessor. We don't want to expose this internal state unnecessarily.
@tannewt's also cleaned up __enter__() and __exit__(), so this revert does not undo those improvements.
Did you test again with 6.1.0-beta.2? It incorporates the #4165 fix.
I also bumped into this in #3748. I agree that this is annoying and should be fixed.
The basic problem is that dir() is calling the properties:
class Test:
def func(self):
pass
@property
def prt(self):
print("prt was called")
@property
def prop(self):
raise NotImplementedError("no prop")
Adafruit CircuitPython 6.2.0-beta.2-dirty on 2021-02-11; Adafruit PyPortal with samd51j20
>>> from test import Test
>>> t = Test()
>>> dir(t)
prt was called
Traceback (most recent call la...
Is this a duplicate of #3748 ?
@hierophect Don't know - I've moved to using the pure-python implementation of this driver instead.... https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/
@hierophect Ok - I'll verify with MiniMQTT. Which CircuitPython version should I test on?
It looks like a duplicate to me. Also, should this particular issue be raised in the library?
Hi guys, I tried to get help on the discord channel but no dice so I'm opening and issue.
I'm playing with the feather M4 express and a stemma speaker. There is something weird happening where after playing the mp3 file, there is a weird noise playing. like a high note going to a low note. kind of line a laser blaster sound FX
Here's a clip of that sound. https://streamable.com/8axwjf
And Here is the code I'm using.
import time
import board
import digitalio
import audiomp...
correct, dupklicate of
https://github.com/adafruit/circuitpython/issues/4036
you can sub to that issue to be notified when resolved
its due to the capacitors on the audio board going to ground after you deinit audioio. dont use with for creating AudioOut - do that at the top of the project so that it doesnt deinit.
@hierophect
Are there extra steps that should be taken here to ensure that valid sockets are being used in the loop?
I'm not sure if the socket is being closed by the broker (MQTT terminology for "server") or the client (device)...I can try this locally with a Mosquitto broker.
Yes, good catch, it's a dupe. I wouldn't say it's a library bug, because it's just the base bug being exercised. There may be other issues caused by calling dir(cp), such as instantiating all the TouchIn's, etc.
Closing in favor of dupe #4171, which has a bit more discussion.
@brentru latest. This should be all wrapped up with the new SSLSocket.
Ok. Since this is based on an out of date version of socket, and the driver is no longer even using it, I think this is safe to close.
Same bug reported in MicroPython, not fixed there yet either: https://github.com/micropython/micropython/issues/4546.
Thanks for the quick response.
Here is my original code and I just tested it again and it still doing the same thing. How do I prevent the deinit in this case? I fooled around a lot last night trying to figure what I'm doing wrong.
import time
import board
import digitalio
import audiomp3
import audioio
whistlefx = audiomp3.MP3Decoder(open("whistle.mp3", "rb"))
a = audioio.AudioOut(board.A1)
while True:
try:
print("playing")
a.play(whistlefx)
...
you may have to either mute the speaker if it has a mute, or play a 'loop' of 0 values to the audio stream to keep the output going
Got it !!! adding deinit() after the clip is done prevent it. Thanks!
Note that hasattr() and tab completion have the same effect (they use the same underlying method).
Except tab catches the exception by passing true to mp_load_method_protected.
@onyx hinge ya I think so. Sorry about that! Still good for you to wrap your head around pio. You can help me come up with a better way to init pins.
If you need someone to bounce ideas off of let me know, I've spent a bunch of time in that code lately. If nothing else can test things out
@slender iron do you know what macro protomatter should check to decide if the microcontroller is rp2?
I am fixing my MacOS setup to be able to build on my Mac Mini M1 and I hit an issue, I wanted to see if this was already on your radar.
When I install the esp-idf from github and run source ~/esp/esp-idf/export.sh it works but in a new terminal when I try to run the export form ports/esp32s2/ I get ERROR: Platform Darwin-arm64 appears to be unsupported
Is it time to update the IDF version in CP ?
I know I saw someone else run into a similar issue a few days back.
I can build successfully from the ~/esp/esp-idf environment.
@onyx hinge no, you may need to add one
@idle wharf it may need an esp-idf update in circuitpython before that build environment will work.
Let me find the specific change they made past ~/code/adafruit/circuitpython/ports/esp32s2/esp-idf ➦ 8bc19ba89
Here it is ...
pretend it is x86_64 until Darwin-arm64 tool builds are available:
Well for now... the next person who hits this can at least find that.
looks like we're using an adafruit fork of esp-idf so it would totally work to pull that change into there, and then use it in CP
I understand if you don't want to switch tasks and do that right now though
If you explain to me how to do it, (or point me to the how-to) I'm happy to do it. My git foo is not advanced.
I want to connect to pico's REPL in another way than USB, as I want to use USB as host. Is it possible now, or should I wait for this issue to be done first?
@matemaciek We don't currently support REPL over UART or USB Host. We really want folks to always be able to access their code over USB via mass storage.
@idle wharf maybe just file an issue on circuitpython then
We've discussed this a bit but it's not easy to do well. Changing clocks tend to have cascading impacts on peripherals as well. Leaving open because I imagine we'll do it at some point.
An intermediate version would allow changing it in boot.py once. I think folks may want full support though for power saving too.
When installing the esp-idf from github and runing source ~/esp/esp-idf/export.sh it works but in a new terminal when running the export from ports/esp32s2/ I get ERROR: Platform Darwin-arm64 appears to be unsupported.
I can build successfully using the latest IDF (commit 73db14240).
The fix in the IDF appears to be this one
https://github.com/espressif/esp-idf/commit/5739127412b6756801a38c700d068dd1d937ed41#diff-873391a19109de0fec9486d3ef26704a32fe81560a38f2e1f6c4f3db99d19350
...
Thanks Jeff !
https://github.com/adafruit/circuitpython/issues/4182
I'm fine with whatever you want to do. Please stick to one reviewer. You need to sort out the build issue before we can merge.
[adafruit/circuitpython] New comment on issue #4147: ESP32S2: unable to access I2C after soft reboot
I was wondering when this stopped working.
Works with
Adafruit CircuitPython 6.1.0-beta.2-7-g22ad76bb4-dirty on 2020-12-07; FeatherS2 with ESP32S2
Doesnt Work (built today from main)
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; FeatherS2 with ESP32S2
What converter APIs? Please open a long term issue for us to unify buffer conversion. This DMA stuff is too tied to buffer conversion at the moment.
Please also modify the length of FLASH_FIRMWARE in link.ld so it doesn't accidentally overwrite things. Thanks for adding this!
Please use the linker provide values:
flash_range_program(page_addr - &__flash_binary_start, bytes, FLASH_PAGE_SIZE);
A few questions for feedback:
* A better name of the function `Bitmap.blitfancy`, maybe `blit_rotate_scale`?
I'm ok calling it fancy blit.
* Should the source and destination translation points `ox`,`oy` and `px`,`py` be sent as `(x,y)` tuples?
Whatever is consistent with existing APIs (I can't remember.) One reason to avoid tuples is it forces an object creation.
* Should I add a function to decode two ints from a tuple, since this code is duplicated? Or ...
@tannewt I added @siddacious since it was originally his issue, and he might have wanted to test.
void audiosample_convert_u8m_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes);
void audiosample_convert_u8s_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes);
void audiosample_convert_s8m_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes);
void audiosample_convert_s8s_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes);
void audiosample_convert_u16m_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes)...
@tulip sleet do you know how to kick make:code into the bootloader? https://forums.adafruit.com/viewtopic.php?f=60&t=175128
This bar graph is a good indication that Long term isn't just a place for issues that we ignore forever. It would be nice if it were "more full", but we certainly do get to these items (and there are probably even more items that were once marked long term but got moved to a release-milestone before being completed).
Some items that have come up repeatedly but have been addressed separately each time:
- Conversion of samples between signed & unsigned
- Conversion of mono samples to stereo
- Conversion between 8 and 16 bits (some ports even need other sizes, e.g., 10 bits (pico) or even non-power-of-two ranges (nrf))
- "re-blocking" audio to fit an underlying buffer size required by the API
- "ramping" to/from a quiescent value
We should more closely identify what we would like to do, find API...
@slender iron OK I filed an issue but it's a bit rambly so anything you can do to concentrate our minds will help
@slender iron yup single click. I can post in the forum if you want
@tulip sleet go ahead
On Linux, if your CircuitPython board supports reboot-to-bootloader and is at the location $SERIAL, you can commandline reboot it to bootloader with: stty hup 1200 < "$SERIAL"
@onyx hinge rambly is ok for now. mainly we should gather ideas
@onyx hinge I didn't know if make:code binaries supported that
it wasn't really related to what you & dan were discussing
@tulip sleet what's an expendable module that could free up about 2k in space?
you mean for testing or in general?
Gotta fix this espruino thing
the JP issue. Kinda silly but it's a low prio board anyway
so I can probably just chop something and worry about it if anyone brings it up later
there's something weird going on because it should not have grown by 2kB just in your PR
if you build it locally with TRANSLATION=ja does it overflow?
let me try that, I don't normally build for translations so I was looking for the syntax
make BOARD=... TRANSLATION=ja clean
then not with clean
running
CIRCUITPY_FRAMEBUFFERIO could go
hmmm, it does work on main, how weird.
Reading the build output, the difference is a flag, -DCIRCUITPY_USB_VENDOR=0
I'll try that and see if anything magic happens
nope, no dice, how weird
(stepped out for a sec)
If you gotta, you gotta. No testing performed. I initially wondered if i2c_assign_irq needed a "free irq" counterpart, but now I see it's just determining the preassigned IRQ for the peripheral... I'll stick on an Approve but I don't know what's going on with that failed build .. doesn't make much sense
@tulip sleet Framebuffer did the trick though, thanks for the suggestion.
As discussed here:
https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx/pulls#issuecomment-663080712
Updates Design Guide with recommendation on using Exceptions and asserts.
Testing performed: scoped it, didn't drive a real display yet
- created a 128x64 display, 3 bits resolution
- checked across soft resets
- checked recreating display
Also found a race condition between timer_disable and redraw, which would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable or put a delay or print inside it. That's what pausing inside reconstruct
fixes.
So that the "right timer" can be chosen, timer_allocate now gets the self pointer. It...
This PR adds a new manual tests folder for scripts that are primarily useful for testing core modules (ie, that do not use libraries and focus on raw API access to a single module). It also adds three tests: Host, Client, and NTP access tests for the Socket module. Future additions to this testing folder should be sorted by module name, matching shared-bindings and common-hal.
Is the webserver stuff working on the ESP32S2 yet? I have a cool home automation related project in mind, but it requires acting as a webserver.
so....a PR that's like a few lines of text to update docs....anyway to dial down the CI?
that's ok...i'm the one who's sorry. poor little hamsters.
Thanks for the feedback, I added a few functions to reduce the repetition, saved a little space, but still about 2k larger than the previous.
Makes sense to put it into a different module, since I can envision other bitmap manipulation functions (I'm already thinking about a blit version with color re-mapping options). How about a name like like bitmap_tools?
Next question, is how do I break it into a separate chunk?
Keep it inside displayio, or up at the same level as displ...
With the latest versions of code, it looks like it's working now. Thanks for looking!
@slender iron I'm a few days late, but I just tried the new code and 16-bit worked perfectly! Look at this beautiful sine!
(oh, and I had changed the tone to 256 Hz--that's not a mistake)
Hey folks -- I'm one of the organizers of PyCascades. We're running a mentored sprint on Sunday, Feb 21st in PT. I was wondering if any contributors to CircuitPython would be interested in joining us for a few hours to lead a sprint and help some folks who are new to open source get started.
You can learn more about PyCascades here: https://2021.pycascades.com/
Website for PyCascades 2021, a regional Python conference in the Pacific Northwest hosted online.
It seems like common_hal_rtc_init() is not getting called which leads to generation of random numbers.
I am not sure where to add a call for it, how do other ports handle RTC initialization?
@matemaciek I have heard that the CircuitPython crew has UART on the roadmap for the Pico but there is none on the map for USB host support (on any board).
But once UART is available you can use a separate board as USB host to connect to the PICO via UART or other protocol. It’s not so elegant but you can “spoof” a REPL to go to UART. I know It’s not officially supported by the crew here but you can hack something that can work. Ping me on discord if you want an example.
I'm trying to port circuitpython to this module:
https://www.we-online.de/katalog/en/PROTEUS-III
i have the a devkit and started my efforts by basing it on the official Nordic devkit (PCA10056) board definition.
now my question is:
i don't need USB support. can i disable it or at least have the REPL run on UART rather than CDC?
Bluetooth® LE 5.1 Module | f 2402 to 2480 MHz | dLoS 400 m | ITX 18.9 mA | Isleep 0.4 µA | Order Samples Free of Charge & Request Quotes Online | High Quality | Fast Delivery
We are working on adding a second USB CDC serial channel, which will not be connected to the REPL, and could be used to communicate with a host to send an arbitrary binary bytestream back and forth.
@fading mantle
i don't need USB support. can i disable it or at least have the REPL run on UART rather than CDC?
No, we don't have a way of supplying the REPL over UART right now. It is part of the CircuitPython "experience" to have the REPL accessible via USB. The same is true for the CIRCUITPY drive being available via USB in order to get code and libraries onto the board.
@fading mantle I’ve made a hack that intercepts the REPL and takes input via UART (see file ri.py. Perhaps this could be expanded to send output back on the UART. https://hackaday.io/project/171269/files
I can only speak for myself, but I think there will eventually be a compromise on the "usb workflow" we will make. "ble workflow" is something tannewt wants to work on and will likely involve a non-usb UART and non-mass-storage file transfer. It would just be mean to write that in a way that it only works with a BLE uart and not a hardware UART. USB host mode isn't on our roadmap, but I'm not sure why we'd have to turn it down. But we'd probably want CircuitPython to be able to detect whether it's connected as a host or as a device and still be capable of presenting the standard CDC & Mass Storage interfaces when connected as a device. And of course you can always fork & rebrand--While we love to bring in all the boards that meet the circuitpython guidelines. A friendly fork is absolutely a thing that can exist.
maybe this info would be also useful.
what Im working on requires a loop that waits for a request through I2C and depending on what it recieves it will play a specific sound FX. But the issue was that the AudioOut was initialized but it would not stay up or active while waiting for something. So what I just do is I created a function that initialise AudioOut, play the sound FX and deinit() once the clip is done playing.
here's the function I made instead of trying to keep the audio st...
Random question - I love circuit python. Like, straight-up LOVE it. My concern is that I see very little compatibility with boards outside of the Adafruit ecosystem. Are there any plans for a broader adoption of Circuitpython?
(E.g. I want to use CircuitPython at work, not just in my personal hobby projects - will that ever happen?)
I've run into an issue w PWMOut on RP2040 Pico board while using adafruit_motor. Seems that setting the PWM pins to full duty cycle of 0xFFFF fails to turn the motor, but 0xFFFE turns it just fine. This means the throttle = 1.0 or throttle = -1.0 values don't work. @slender iron any ideas if this is something funny about PWM on the Pico? @errant grail had a look at this as well and didn't see anything obvious.
@prisma salmon there are over 100 devices listed with support for circuitpython, not made by Adafruit <Gigantic link removed>
@lone axle well now I need a Thunderpack board!
https://circuitpython.org/downloads The filters at the top is how I got my number. Though I will admight, it's a bit tedius to select all of the other manufactureres. Maybe a "negative" filter would be good.
As far as using it for work. I guess it depends heavily on your work. I've used Circuitpython and Adafruit devices successfully in 100-200 sized deployments of custom hardware "widgets" for work.
Another point on the supported boards\chips. Anyone can implement a port to any chipset. As CP grows, I'm betting it will be something companies make happen, they will see it as an advantage.
With regards to filtering being tedius I guess maybe I should use my old friend... Subtraction to find that number 😅 it's been a long day already.
Happy Seattle Snow Day -- Don't Forget to ⭐️ your favorite repo.
https://github.com/adafruit/circuitpython
Thanks for the heads-up! I do some freelance microcontroller builds, and sometimes, the spec they'll want is to use some cheap amazon esp32 variant. Thankfully, I can do a lot of stuff in micropython, but some stuff is just so much easier in Circuitpy.
This sounds like a bug. Please file an issue.
ESP32 support is blocked behind having a good way to interact with it because it's missing native USB. This will be less of an issue when 1) we have a BLE workflow and 2) more folks use ESP32-S* chips.
Ah! That makes sense! Someone'd mentioned ESP32-S as the quick-fix; and now this makes good sense.
is the S2 cheaper ? what with having one core and only wifi, would it take over the cheap ESP32 market ?
Is the reason it works with the ESP32-S2 because it's got the onboard storage? What's the distinction between it and the standard ESP32 that opens the possibility up?
What will make S2 cheaper is for an OSS board to be massed produced to drive down the cost
right
the native USB support (called USB-OTG in the espressif docs)
Thanks! Didn't see that distinction in a quick "vs" chart between the two.
OK... we're prolly off topic now... 😉
I've run into an issue w PWMOut on RP2040 Pico board while using adafruit_motor. Seems that setting the PWM pins to full duty cycle of 0xFFFF fails to turn the motor, but 0xFFFE turns it just fine. This means the adafruit_motor throttle = 1.0 or throttle = -1.0 values don't work. I found that throttle = 0.9999998 works, but 0.9999999 does not.
I'm using GP28 and GP27 on the Pico.
Running adafruit-circuitpython-raspberry_pi_pico-en_US-20210212-08f30fe.uf2
Library from this...
ok, filed it, thanks.
I'm ok if we switch to the 4.3 branch. I'm not planning on doing it myself. I'd expect them to backport this to 4.2 as well.
@microDev1 I suspect RTC init is done in port_init in supervisor/port.c.n
I like bitmap_tools. It'd be a peer of displayio so you'd make a new folder in shared-bindings and common-hal. Since it'd just be functions, you implement them in __init__.c. I think supervisor does something similar.
Hey folks -- reposting just in case my message got lost in the shuffle last night.
Would any CircuitPython maintainers be interested in leading a mentored sprint for PyCascades for a few hours on Sunday, Feb 21st in PT? We'd love to have you.
Fairly -- I'm doing a new example file for the adafruit_motor library that uses PWM pins and the h-bridge and I'd like to keep it consistent with the -1.0 to 1.0 range we show in those examples.
I'm doing a guide of mini-examples for how to use different motors with the Pico.
Some of this shared code will probably need to be platform aware too or at least weak. For example, the RP2040 has an interpolator that may be able to accelerate some of the conversion. Cortex-M4s also have some basic SIMD instructions that can be used to do multiple instructions at once. (I'm not sure if the compiler will automatically use them.)
@tulip sleet @onyx hinge or @ionic elk do you have cycles to debug John's PWM issue on RP2040?
I'm debugging I2S atm
I'm on other stuff RN but I could check it out tomorrow
i have a guess, even without looking at the code
i'll see if it's real easy
i am working on cdc
Why is there an underscore in the name?
Thank you for expanding the design guide! It's really good to keep it up to date.
@tulip sleet there is a bit of weirdness around the top value I may have gotten wrong
yeah, it's not like the atmel code
self->top is 2^16 instead of 2^16 -1
this could use some printf debugging
I don't see any issues. Thanks! (Not approving because it's a draft.)n
One comment on size. Thanks for updating the linker script!
I think you want to use FLASH_SECTOR_SIZE (4k) instead of FLASH_PAGE_SIZE (256). There are checks for the 4k alignment here: https://github.com/raspberrypi/pico-sdk/blob/master/src/rp2_common/hardware_flash/flash.c#L69-L70
@ionic elk I'm trying the manual NTP test script. Would you expect it to work repeatedly wrapped inwhile True: with pool.socket(pool.AF_INET,pool.SOCK_DGRAM) as sock: I get "Out of sockets" after 4 loops. Also tried w/o with and explicitly using close.
hmm. Have you tried waiting for a little bit after closing?
If that doesn't work I'll double check that close is working
I have a 5-second delay between iterations. When I explicitly close, I get Out of sockets after 1 iteration (suspect some under-the-covers retries) ...update: ignore the 1 iteration behavior, I forgot "Out of sockets" requires a microcontroller reset
I created a test program that loops turning a MIDI note on and off. After running for a while (minutes not hours) I lose USB communications (both USB-MIDI and serial debug). I have the LED flashing to debug and it appears the loop is continuing it's just USB comms that stops inexplicably.
This is only reproducible on one of my Wins10 PCs (Dell XPS desktop) and the USB driver is still active when data isn't flowing. Further if I switch to a Teensy 4.0 running the same test (written in C++) ...
So it turns out you CAN read the rp2's BOOTSEL pin from software. CircuitPython modifications and nasty hacks required. details: https://gist.github.com/jepler/c7676f0c5fe4eab9c584424d997a7991
Why is there an underscore in the name?
I thought it might be appropriate to distinguish them from the Micropython battery of tests that are run automatically by run-tests. The rest of the tests in that folder are very uniform in style and purpose, and these are different enough that I thought it'd be worth prefixing them.
Thanks! We should probably wait for the pull request up at protomatter to be accepted first, but I marked this ready for review anyhow.
@tannewt I know you have similar code. If you want to take yours in favor of mine (if so feel free to close this up!), make sure you have the equivalent of this change for getting the right shifted-in bits:
if (rx) {
- rx_source = (const volatile uint8_t*) &self->pio->rxf[self->state_machine];
- if (!self->in_shift_right) {
+ rx_source = (volatile uint8_t*) &self->pio->rxf[self->state_machine];
+ if (self->in_shift_right) {
rx_sourc...
@slender iron hey - did one (or more) of your deep dives cover your efforts converting atmel start stuff into what's in CP? i.e. what you did here:
https://github.com/adafruit/asf4
@tidal kiln no, that's pre-deep dive
thought it might be. thanks. no worries. totally just for self education thing.
np
Ok, I deleted the ! which I think is the only change.
@slender iron Would this kind of Pico board qualify for it's own CP board entry: https://shop.pimoroni.com/products/pimoroni-pico-vga-demo-base it is based on Raspberry Pi documentation and very similar to the hardware used for the BBC emulator demo. I am mostly interested in the VGA output, but even without that it has I2S and PWM output, reset button, 3 button, SD card... but it totally lack I2C connector or Wii connector. And no RGB either. You do not solder the Pico on top, it has female header.
I think that's better handled with a library
Like those "Portal" thing. Just simplifying the access to "accessories"?
Or more the CPX library and CLUE library.
Device name should be "CircuitPython Midi" not "CircuitPython Audio" as this is a midi interface.
It would also be useful if this could be overridden with a custom device name.
Fixes #4189.
- The
pwmio_pwmout_obj_ttopwas 32 bits, but it's passed to pico-sdk as 16 bits. Make it 16 bits so the compiler can catch values that are too large. Then needed to force some arithmetic to be 32 bit. - Maintain top as a 0 to n-1 value. It was getting set to 65536 in one case. Remove
self-> top -1computations. - Comparison check for low vs high frequency had a boundary problem at
.frequency = 1907. Fix by using<=comparison instead of<. - Add some bounds che...
@onyx hinge I fixed something in RP2040 PWMOut that was decrementing the pwm counter top by 1. The pwmaudio code was setting the top to 1023, so the pwmout code was setting the top to 1022. I wonder if this has anything to do with the audio glitches you were seeing ??
@slender iron maybe? my last audio was esp32-s2 ..
oh, i am completely off base, i forgot you were doing esp32-s2
but maybe I should look at that ...
sri
I observed a strange behavior when using the .hidden flag of the displayio.Group where the group is actually visible, even when group.hidden is set to True.
If the group.hidden is set to True before content is appended into it, the .hidden flag is ignored.
The group.hidden flag's proper behavior can only be recovered if it set to False and then back to True again.
Here's the example code to replicate the issue. This was tested on the PyPortal.
CircuitPython vers...
I am testing a small script where two .wav files are played depending on the readings from an HC-SR04. I am running this script on a feather M4 Express with a Prop-Maker for audio.
In Example 1, I initialize the HC-SR04 before initializing the speaker, and audio will play correctly. In Example 2, I initialize the speaker before the HC-SR04, and the audio comes out as static noise. I should also mention that Example 1 is still broken in a way because the distance readings are off. The readi...
Tested it, this works perfectly now, thank you @dhalbert
I was confused about the "red X" failed CI notes, but those are for the Protomatter CI running in my fork, on a commit that refers to this PR. Click over to the "checks" tab to see a green board.
@ionic elk another curiosity... for several iterations, supervisor reload will allow recovery and 4 more UDP transactions before "Out of sockets", but then for no apparent reason it will go into this mode where even reload doesn't allow recovery and microcontroller reset is required:```Code stopped by auto-reload.
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
1 WiFi NOT connected
Connecting to WiFi... WiFi connected
Creating socket...
Sending packet...
Traceback (most recent call last):
File "code.py", line 37, in <module>
RuntimeError: Out of sockets
Closing socket (explicit)... None
Code stopped by auto-reload.
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
1 WiFi NOT connected
Connecting to WiFi... WiFi connected
Creating socket...
Sending packet...
Traceback (most recent call last):
File "code.py", line 37, in <module>
RuntimeError: Out of sockets
Closing socket (explicit)... None
Code stopped by auto-reload.
soft reboot```I noticed in the debug log that "Out of sockets" is oddly accompanied by AP disconnect, which makes me think something unexpected is happening deep in lwip. WiFi connections otherwise are very stable and the disconnects are very predictable with the "out of sockets" sequences.
[adafruit/circuitpython] Pull request review submitted: #4192 RP2040: fix off\-by\-one PWM top issue
I've gotta look at this further when I'm fresh. See section 4.5.2.2 in the datasheet. My understanding was that CC needs to be TOP+1 in order to not go low at all.
@idle wharf alright it's done! cookie cutter is merged, and I've udpated these guide sections with the new files https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/creating-a-library#cookie-cutter-2866283-2 and new prompts / order: https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/creating-a-library#prompts-2979136-7
WOOT ! You are awesome. Thank you!
Thank you as well! This makes it much nicer working on community bundle projects.
Going to use the new version tomorrow morning on my stream to finally publish properly a library I made a little bit back.
I'll be skiing, but I'll watch it time delayed
Thanks again for your testing and code review !
instead of calling it the QT Py 2040 , you should call it the QT Py Pi
There is tinyusb PR that fix this issue recently, please try to manually update tinyusb to see if that fix your issue
@DynamoBen Here is a build for the Pico that updates tinyusb to the tip of its master branch as of now. The commit hash is in the filename:
pico-with-tinyusb-at-09868434c.uf2.zip
Could you test with this and see if it improves things? Thanks.
I only tested this enough to see that it presents the REPL and CIRCUITPY.
Yesterday morning arrived my 1st RPi Pico and some accessories (from Pimoroni Ltd)
The "rotate-scale" transform is usually called "rotozoom" in the demoscene — just in case you needed a shorter name.
Is there any step that needs to be done for Library releases to "inform" PyPi what the "latest version" is?
I have found a situation where PyPi has the new version. And all of the release actions seem to have completed successfully. But it's considering the previous version as the latest, not the new one which was released more recently. https://pypi.org/project/adafruit-circuitpython-display-text/1.12.3/
Ah 🤦 the lead number is too small
I see what you mean in the datasheet. I will look at the output with the Saleae. We may need to use 65534 as the TOP to set instead of 65535.
https://www.youtube.com/channel/UCA4j-J-TFW_9Dt4iTwIjtYQ
Once visit this channel for Raspberry Pi Pico Projects
https://www.youtube.com/channel/UCA4j-J-TFW_9Dt4iTwIjtYQ
Once visit this channel for Raspberry Pi Pico Projects
@panchalnikunj It is inappropriate to spam our repos with pointers to your YouTube channel, even if it is relevant material. I am deleting your comments. Please do no do this again.
Hi. First time novice user. Can you tell me why, when I save my circuit python code in Mu with my QT Py attached, the serial display fails to show any print code I might display? It just says code running but doesn't output anything.
I tried installing it, however I left it on overnight, and the same thing happened. Is there a way for me to manually know what the battery level is so I can just exit the program?
@late atlas in order to automatically run your Python program on reboot of your QTpy, you have to save your file with a file name of code.py. With your current file name it’s not actually running your code at all.
@dhalbert Some progress, now my test app is locking up instead of USB comms stopping.
It is just picking up the tag though, right?
It could see the tag, but it didn't think it was the latest since the number was smaller.
I ended up making a small typo fix change and then making a new release and that got it back to working good.
@dhalbert Some progress, now my test app is locking up instead of USB comms stopping.
The root cause of this is related to the use of two separate properties to control hidden behaviour of Group and TileGrid.
The Group contains two properties that help hide graphical content:
hiddenhidden_by_parent
I'm not clear on the logic behind hidden_by_parent so I'm interested to better understand the importance of that.
Here is cause of the issue. Whenever content is appended (and maybe inserted) into a Group, the hidden property is not transferred into th...
I managed to find how to access the battery (magtag.peripherals.battery).
the voltage was enough to run the CPU but the first attempt at trying to read the flash chip failed
About at what voltage did that happen?
@tannewt I read the datasheet and did a lot of boundary testing with the Saleae, checking both the low and high frequency cases at the boundary , and much higher and lower frequencies. I made sure duty_cycle = 65535 result in high all the time, no glitches output. Just rounding properly did not always result in no glitches. I also improved the calculations of actual_frequency by rounding to the nearest integer.
The flash chips we use typical have a minimum operating voltage of 2.6v. The exact chip used in the ESP32-S2 module is not specific, but it might be similar. The datasheet for the module says a recommended minimum operating voltage is 3.0v. So it would be interesting to know if your voltage is dipping below either of those.
We could add code to CircuitPython that refuses to run below a certain voltage. It could also wait longer on startup for the voltage to stabilize.
Got it. I've added a simple
if magtag.peripherals.battery < 3.3:
break
I'll see what happens tonight.
Starting the work for #4182
- Updated the branch ESP-IDF to point to releases/v4.3
- Fixed the include paths in Makefile
- Fixed #includes which had incorrect full paths to use shorter paths
Open Questions:
- There are other full path includes.. they work, but should they be changed?
- Local build now fails on actual code changes which would be needed.
This is the first one, but there are more errors behind this. It would be great if someone who knows C could pickup from here....
I started a PR and did the boring parts of updating the include paths. I don't know C so if someone is excited and could pick up from here, that would be great.
Attempts to use os.urandom(n) on the Pico currently report:
>>> os.urandom(1)
Traceback (most recent call last):
File "", line 1, in
NotImplementedError: No hardware random available
The datasheet for the Pico indicate that the ring oscillator can be used for this (RP2040 datasheet, page 240). They do note that there are potential cryptographic attacks possible on this, but could this still be a considered "random hardware"? There are CircuitPython libraries that requi...
which library requires os.urandom?
FYI was rebuilding CircuitPython with some custom code additions and after loading it on the pyportal a bunch of code broke, saying that it could not create module. Turns out a lot of my libraries got truncated when loading the larger UF2 file. Bleh. 🤦♂️
This might be obvious to experienced Python programmers, but not to me.
The code runs with no errors, but the display does not show the bitmap because the with statement has closed the file.
To help beginners like me, it would be good if OnDiskBitmap would throw an exception if it cannot read the file instead of failing quietly as it does now.
with open("hari/BlobAnim.bmp", "rb") as bitmap_file:
bitmap = displayio.OnDiskBitmap(bitmap_file) # setup the file as bitmap data source...
@ionic elk n/m my earlier UDP questions, jfurcean demonstrated that the code was fine, and I replicated it OK on a different device.
Since RTC and Time are completed and the recommendation is not to use NTP I'm closing this. Thanks everyone !
In the bundle, adafruit_rsa uses os.urandom. In the community bundle, circuitpython_nrf24l01 does. In Learn, CPB_Quick_Draw_Duo (gracefully works around it if it's missing) and CLUE_Rock_Paper_Scissors (advanced version only) do.
@joelburton you cant use random.randint() ?
@ionic elk Thank you so much for all the Socket library fixes in the latest beta, it's really appreciated! (I'm StarWitch from GitHub, I reported that UDP socket args issue.)
I also started this chase down the rabbit hole. I however did not make nice edits so my result is not really pretty.
The semaphore stuff is easy to fix. Once that is done the SPI requires some relatively major changes as Espressif have refactored some calls. I made some changes so it compiles but doesnt work. I will now start again :)
I'm not really liking all the full path includes. I changed them to most;ly match how the IDF does its includes. I think this might make it easier for ...
I'm running into this issue in 6.2.0-beta.2 with several different encoders and can't reliably use them for my projects due to this. Is it still simply just awaiting a PR at this point or does more work need to be done first?
Thanks @skieast, I appreciate you picking this up and running with it !
I always been a programmer that looks at time spent to learn a language. Adafruit created Adafruit Feather STM32F405 Express. Same chip as MicroPython pyboard v1.1 creator of Micropython. Adafruit created WICED and said this "Arduino standard-supported Atmega series and many libraries that are written specifically for AVR will not compile or work with the STM32". I want to take advantage of all libs and use python from adafruit. But adafruit circuitpython is not as ready for STM32 as Micropython and I may not be able to use all available libs that adafruit has to offer which are many.... That and guides are what sets you apart from others.. How can you work on finishing circuit python for Atmel and STM32 ? Are they both getting equal programming effort? You even say "CircuitPython support is in a good spot" for the STM32F405 Express. What does that mean? How committed are you towards the the fast different chip STM32? Again being my goal is using all adafruit libs , products, and python. Its sounds like your plans is making the STM32 only for circuit pthyon (after ATMEL support is finished) and let Arduino worry about the ATMEL to STM32 other LIBS. Is it best to pass on STM32F405 Express for now unless I want to use only python and MICROPYTHON to boot??
not sure what you mean by "atmel" here, it's all Microchip now
also, not sure what you are trying to do
the release notes say "As of this release, atmel-samd, nrf, and stm for the F4 family are stable." — so, assuming that by "atmel" you mean the samd chips, they are all supported.
a good indication of a board support is the list of built-in modules supported. And you can compare the feather STM32f405 Express with the feather M4 Express for example.
https://circuitpython.readthedocs.io/en/6.1.x/shared-bindings/support_matrix.html
Standing out to me are usb_hid, audio* and rotaryio, which might limit your technical choices if you need them, but it's still a pretty strong support
I wish for a feature matrix view of that information. (✅ - done ⭕️ - not done ❌ - not possible) It could be used to indicate if it is possible or not so a community member could contribute. Also when one board ends up creating a new library it would show more help is needed.
It would take a RST superdev though I think
"not possible" is not always clear
I might be wrong about the specific labels but I assume the general idea is possible
well, the matrix linked already has most of that information, except for the impossible bit
you can always write a two-liner in python to display it differently
True, I'm just visualizing it differently in my mind's eye
and apart from some very few exceptions, CircuitPython support tends to have module granularity — if a module is there, it all works
Is this PR moving forward? Not to rush it but I'm using my version for testing as the board has connectors for USB native and USB serial and onboard I2c devices. All good for testing without needing a ton of wiring and bits that fall off when I move it around.
Thanks @skieast, I appreciate you picking this up and running with it !
tbh I have no idea how to 'run with it'. Does that somehow involve me modifying your PR? Or do I just start a new PR with what I have. As you can probably see my github knowledge is limited. Very much so.
I may just start a new local branch and make my changes in a more consistent way now that I know it works.
@skieast I think you can use the gh cli to checkout the PR.
gh pr checkout 4195 But maybe you need to be a maintainer on my fork ... hmmm no sure now that I say that outloud.
I'll do some reading. Forgot about the gh cli. In any case I'm going to at least try to get spi working here. Thanks.
I am looking at moving a part built project from C to circuitpython, I have most libraries covered but I am looking for an I/O expander library. I was using the 40-bit PCA9698 I/O expander but dont have the skills to write a circuit python library. Any tips on writing libraries?
@fading steppe check out https://github.com/adafruit/Adafruit_CircuitPython_PCA9685 -- you may not even need to write the driver yourself
I was looking at the PCA9698 a 40 channel I/O expander
oh I had the wrong number, sorry!
All good 😄
well I actually fault search engines for showing me things I didn't search for that don't contain the words I searched for 🙂
Maybe I will look at using mulitple 74HC595 shift registers
there's https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/creating-a-library which mostly talks about setting up the file structure for a library. I don't know if there's a document that really talks about "here's how you take a datasheet and make the code you need"...
choosing a chip that is already supported is maybe a wise choice. Otherwise if you had the interest I'd advise you to study code for a different I2C I/O expander -- some parts will be broadly applicable, other parts will be specific to the chip.
Becuase I have so many LED's to control I need more that 8 I/O in an expander
The 74HC595 is only 8 channel
At upwards of 100 LED's to control I need more I/O
Which is why I was looking at the PCA9698
The big benefit to the PCA9698 is its current capability
At 5 V supply voltage, the outputs are capable of sourcing 10 mA and sinking 25 mA with a total package load of 1 A to allow direct driving of 40 LEDs.
yeah it made me think of IS31FL3731. but I think its current capacity is MUCH lower. no way that passes 1A
anyway my gut feel is that PCA9685 is totally a "doable" driver, you would have to get comfortable with bit arithmetic but it has fairly simple I2C interactions to bulk set outputs high or low..
for instance understanding why a value like 16 would turn on the 5th LED in a set of 8..
I'll take a look at it again, I remember looking into it a while ago
you'll want to look at https://circuitpython.readthedocs.io/projects/busdevice/en/latest/api.html#module-adafruit_bus_device.i2c_device for how to talk to i2c devices. Depending how you like to think about things you might find it helpful to use https://circuitpython.readthedocs.io/projects/register/en/latest/api.html#i2c or you might not.
I can and can fork those (it’s RSA lib I want). But thought it would be helpful to get this on someone’s non-urgent list for implementation for the pico.
Thanks!
On Feb 13, 2021, at 2:19 PM, ladyada notifications@github.com wrote:
@joelburton you cant use random.randint() ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
@onyx hinge just found this as well!! https://www.adafruit.com/product/4886
constant current LED driver, no resistors needed
neat!
perfect!
well tbf i dont know the crypto implications - i am not sure how we seed the pico's RNG. i will leave open but yah maybe can you submit a PR to change RSA lib to use random. instead of os.urandom if it throws an exception?
what are you doing with the pico and RSA anyways? makin a U2F? :)
I teach Computer Science; I'm making graduation gifts for my students of a
pico with various CS challenges built in, and one of them is decrypting a
message using RSA. :-)
On Sat, Feb 13, 2021 at 6:41 PM ladyada notifications@github.com wrote:
well tbf i dont know the crypto implications - i am not sure how we seed
the pico's RNG. i will leave open but yah maybe can you submit a PR to
change RSA lib to use random. instead of os.urandom if it throws an
exception?what are you d...
I should have made a PR earlier lol...
I have a compiling version available in my update-idf branch.
Didn't make PR because SPI and I2C stuff needed some testing. How should we proceed now?
I should have made a PR earlier lol...
I have a compiling version available in myupdate-idfbranch.
Didn't make PR because SPI and I2C stuff needed some testing. How should we proceed now?
Awesome. I will take a look at your branch. If I have time later tomorrow I'll do some i2c testing.
ahh ok, random.* would be fine for your purposes then! if you submit a PR we will review it and merge
@tannewt I see the basic idea of what you are talking about for adding a new directory for bitmap_tools in shared-bindings and then for each port in ports\common-hal, but I don't understand the specifics to pull it all together.
Right now I don't forsee any port-specific code, so does it need anything in common-hal for each port?
How do I tell the build system to include the new files when I build a given port?
Thanks for you guidance!
Hi @skieast , I only have a Cucumber M to test with. Happy to make the amendments to the PR to get it building. Though don't have the R boards to confirm/test with.
Hi @skieast , I only have a Cucumber M to test with. Happy to make the amendments to the PR to get it building. Though don't have the R boards to confirm/test with.
I have the RIS board so can test the R variants with that. The only difference should be the PSRAM on the R variants.
Thanks,
Hi all,
I am using CircuitPython with Arduino Nano 33 BLE board. Currently, I am trying to read the built-in IMU readings and get the following error:
Traceback (most recent call last):
File "code.py", line 18, in
RuntimeError: SDA or SCL needs a pull up
I then set the board.R_PULLUP as digital output with a value of True. I added a delay after setting the True value and was able to measure that the R_PULLUP pin level was set to HIGH. And then when the code ran to line 18 (the lin...
Whats this statement mean from adafruit "Arduino standard-supported Atmega series and many libraries that are written specifically for AVR will not compile or work with the STM32"
I answered my own question... adafruit has my answer in the description of the board.. "Arduino is supported through STM32duino. "
@noble mango that has nothing to do with circuitpython, as it doesn't work on atmegas
That simple thing didn't work. I'll try raising the cap. Something I also noticed is when I wake up, the display is always completely black.
I have R (and RIS), and can test that specifically. I'd expect the build to be identical except for PID and board name. Technically, the R (and M) don't require designated I2C, but the pre-soldered header pins and pinout doc are color-coded for 40/41 the same as the RIS. Saola builds of course run fine on Cucumber.
There is a number of gaming devices available that run CircuitPython, and so when a new game is made, it is desirable to make it run on all of them, or at least as many as possible. However, each device has different way of accessing the buttons and the audio, and some builds might even need to have the display initialized.
Asking the players to edit the code of the game to adjust it to the device they have is not a very nice way of doing this. Providing a separate version of the game for ...
One way I attempted to solve this problem with the Stage library is by using a device-specific module — I named it ugame because the first device I supported was the µGame, but later I realized that it has to have the same name on all devices. That module contains all the code necessary to initialize and use the buttons, audio and display, and it's frozen on the device. This way each device can come with its own version of the code, specially adjusted to it.
Another way of handling this was proposed by @tannewt — instead of having different versions of the library for different devices, there would be only one version, that would contain the code for all the supported devices, and it would guess what device it is running on by checking what names are defined in the board module, and initialize it all accordingly.
I tried to implement this here: https://github.com/deshipu/circuitpython-vacuum-invaders-displayio/blob/master/invaders/controls.p...
Yet another way of doing this would be to generate the library for the individual devices from some kind of a template, letting the player select how the buttons, audio and display are connected in their particular device. This has the advantage of not wasting additional memory for classes that are not being used, and of supporting a wide variety of homebrew devices that we don't need to know up front. It has the disadvantage of requiring the player to select the device they have.
so i'm getting a build error for a new board i'm working on
Here's the output:
../../py/gc.c: In function 'gc_sweep':
../../py/gc.c:298:68: error: 'MP_QSTR___del__' undeclared (first use in this function)
298 | mp_load_method_maybe(MP_OBJ_FROM_PTR(obj), MP_QSTR___del__, dest);
| ^~~~~~~~~~~~~~~
../../py/gc.c:298:68: note: each undeclared identifier is reported only once for each function it appears in
make: *** [../../py/mkrules.mk:55: build-cp_sapling_m0_revb/py/gc.o] Error 1```
Adding this board as it was already merged into circuitpython repo.
thanks & Best regards,
m4tk
I believe in my build I disable the check for pull-ups in the i2c as the cucumber doesn't have any on the internal bus. At least I was getting errors when creating an instance. Will have to check again when I have a chance
On the Discord it was suggested you could fork my fork, but I know you can't do that really without removing other forks. I could make you collaborators on my fork instead.
But, why don't we abandon this PR and you can do your own sounds like @microDev1 had already gotten farther than I had anyway. That's probably the easiest. I'll leave this open and you all can decide. Thanks for doing the work for this!
ok so... technically yes this does work.
but it seems like when it tries to get into REPL-on-display mode it crashes, and if thats during a file save sometimes so hard that the USB filesys gets corrupted and i have to nuke it to get it back.
Uh oh, it worked better than that for me. I'll test further on Monday. I know I tested being in the REPL, soft restarting, but mmmmaybe not writing to CIRCUITPY.
Pins 40 and 41 are also JTAG pins, so they're set to never reset for the port if DEBUG || JTAG. So no I2C and DEBUG=1. Is there any flexibility with that? DEBUG log is super helpful.
I finished that tetris game, now it shows next brick, deletes full lines and keeps score: https://github.com/deshipu/circuitpython-tetris-displayio
I've been working on a WWVB (north american time signal) decoder and .. it actually receives and decodes the time!
still some work to do with conversion to/from local time but the new adafruit_datetime module should help there
then I get to add some kind'o display
@prime flower yay, it's slightly different than what I have to do on desktop python (missing datetime.astimezone method?), but I seem to be able to convert from UTC to US Central time using adafruit_datetime
I'm working on a game that uses an isometric view, and one thing I need for this is to sort the sprites representing mobs according to their depth on the screen. In displayio the drawing order is determined by the order of elements in the displayio.Group, and I'm wondering what would be the best way of keeping it sorted:
- Create a list out of the group, sort it, and then create a new group, with all the items from the sorted list appended to it. Do this every time the positions o...
Yes, i'm working on getting the i2c working on microdev branch. we shall see. "shouldn't be hard" said someone one youtube once
YAY, scan() works. Only some minor semaphore stuff to edit.
Unfortunately v4.3-beta1 of the IDF did not fix the soft reboot and i2c issue. So a long rabbit hole with no actual results
Something like this should work, but of course not optimally:
for layer in sorted(group):
group.remove(layer)
group.append(layer)
I believe in my build I disable the check for pull-ups in the i2c as the cucumber doesn't have any on the internal bus. At least I was getting errors when creating an instance. Will have to check again when I have a chance
The pull-up check is meant to check for external pullups. Adafruit microcontroller boards don't generally have pullups unless there are on-board I2C sensors. All our breakouts do have sensors. So we don't disable pull-up detection, and I would not expect you to either,...
I've only done this on my internal build as its otherwise painful to use the sensors on the board. Would be far better if gravitech had pullups on the internal (on board) i2c bus. when i have more time maybe i'll just bodge on some resistors.
+1 on this from me, being able to write native modules without needing to integrate with the core would be huge.
Hi I've just tried the example code for the keyboard emulation on the Pico. I've loaded CircuitPython 6.2.0-beta.2 onto the Pico and tried a keyboard example "examples/hid_keyboard_shortcuts.py" from Circuitpython.org and I get an error
Traceback (most recent call last):
File "", line 9, in
ImportError: no module named 'adafruit_hid'
Is there a problem in the latest beta as I've seen a Youtube video using this module with 6.2.0=beta.1.
With non-DEBUG build, this RS seems fine reading the sensors with nothing external:
I2C addresses:
0x5f HTS221x5F
0x68 MPU6050x68
0x76 BMP280x76
Temp=83.8F Hum=19.9% Press=1004.8hPa
I'm still getting this issue with magtag.network.fetch on 6.2.0-beta.2.
Nice !Yep - that's not implemented.
@KTibow What version of adafruit_requests do you have? There were a couple of soket leaks plugged recently. Can you try the latest if you're not already using it?
See https://github.com/pimoroni/pimoroni-pico/tree/main/micropython/modules for a use case for this. This probably ties also into https://github.com/adafruit/circuitpython/issues/2825
@lone axle @honest nova Do you have documentation yet for base_alignment? I thought it was in issue 75 but I don't see it now. I was going to comment on its behavior but I haven't tried it yet or even read docs so maybe I'm wrong about how it works.
@alpine nimbus there is a doc-string for it in the branch from the PR here: https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/pull/115/files#diff-49bd1990ecfe52c52b15fd3fcef8f04f3f547d58af5171cd1a44ddc684527f44R63
thanks!
@lone axle So by default the top of the bounding box is placed at label.y and with base_alignment=True the baseline is at label.y instead?
@alpine nimbus You could use the position x,y in the label to position the two labels at the same y position. There will be an example with the PR showing this. I have some code trying to show the behavior with anchor point that you can get from the PR, but for simplicity it was not included in the current PR. let me know if you have any other questions. We are currently working in the documentation, and it will be good to include it. Please see issue 75 where we put some New documentation proposition, any feedback will be really appreciated 🙂
unfortunately, i can't try it out until after you check it in. Or, I should say, I'm too lazy to set up a CP build environment.
no problem, for the example I used the code in your original issue, it will look familiar
That's weird that you give both labels the same x,y. They turn out next to each other and not one on top of the other?
When I first saw the example code I had some strange ideas how it worked but its actually straightforward
import pwmio import board ping1 = pwmio.PWMOut(board.GP18, variable_frequency=True) ping2 = pwmio.PWMOut(board.GP19, variable_frequency=True)
Getting "ValueError: All timers for this pin are in use".
I want to change the frequency in a function, both GP18 and GP19 to same frequency. How can I do that ?
Hopefully, when you try it let us know, maybe you have some insight that we did not see... Also this was intended to include align the text using the baseline to address Paint your dragon enhancement suggestion.
I think it would be nice for the docs to show how to place two labels next to each other. Lets say they're a number and a unit (e.g. 33 F). A) place both labels at some value of y and set base_alignment=True B) Place the number label at some value of x and compute the x value of the unit label based on the with of the number's bounding box plus a bit extra. I guess the extra would be the width of a space character.
from a comment in paintyourdragon's issue, it looks like the width of a space would be int((self._font.get_glyph(ord(" ")).width)
probably the space character in the larger font?
Good points, regarding the spaces, yes according to my tests, space could vary from 4-8 (maybe more) pixels width according to font and size
By the way, I'm really excited about this code. Good job!
Normally you can access the separation with the _shiftx (I think) to do some the x movement after each glyph
Thank you 
It is a team effort for sure,!
🥳
adafruit_hid is an external library you can get from the bundle: https://circuitpython.org/libraries. Did you add it to the board?
For general info about libraries: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries
Ah! I didn't realise that, I'm new to Python. I must have missed that in the video or it was mentioned in an earlier video I hadn't watched, thanks for the information I can fix it now.
@timonsku having been through the process of trying to use that, I have to say it's not as useful as it seems. The problem is that all the functions you are going to call have to be included in a special table at compile time — and only a handful is there by default — so while it's useful for speeding up some purely computational functions, it's very limited otherwise.
Similar to this issue:
https://github.com/adafruit/circuitpython/issues/3894
Running: Adafruit CircuitPython 6.2.0-beta.2-14-g766e79ad3 on 2021-02-12
Sensor: mlx90614
I have this code running:
i2c = io.I2C(scl=board.GP5, sda=board.GP4, frequency=100000)
time.sleep(1.0)
# Lock the I2C device before we try to scan
while not i2c.try_lock():
pass
# Print the addresses found once
print("I2C addresses found:", [hex(device_address) for device_address in i2c.scan()])
...
@Bhavithiran97 you can't, check out the table here: https://github.com/adafruit/circuitpython/issues/4143#issuecomment-776388367
Some pins are paired. While you can adjust the duty cycle you can not adjust the frequency. If you need a different frequency on each pin you need to choose a different set of pins that don't share their PWM bank.
What this patch fixes is that you can still use them both but not if you construct them both with variable_frequency=True as you can not change their...
Which video were you watching? Thanks.
It was by Novaspirit tech on Youtube.
The socket is being closed by the client according to my Mosquitto logs. Client cpy3438 closed its connection.
So if I understand correctly, all that needs to be done here is to recreate that fix (deleting the bad never_reset check) and submit it as its own PR? This is the risk of folding in important fixes into semi-unrelated PRs I suppose.
Originally implemented in #3930
Reverted in #4012 without separating out this bugfix
May be responsible for #4142
@noble mango support for the STM32F405 should be very broad across Adafruit libraries. The remaining modules that aren't implemented like rotaryio or frequencyio are less used and just haven't been requested in a way that pushes them over priority features on other chips. Is there a specific module you are missing? The Feather F405 is very fast, which makes it good for audio, signal or screen projects, but a lot of people are more used to the SAMD series so that tends to see more project attention.
@noble mango also, just a quick historical note. The company called Atmel used to make a series of 8 bit chips called the Atmega, using their own processor core design called AVR, which are used in the old Arduinos. None of those will support Circuitpython, they're over a decade old and much weaker than modern chips. Atmel also created the SAMD family, which uses the ARM core and is much more powerful, and is the family of chips Circuitpython uses. Atmel as a company was bought by Microchip in 2016, so all their chip lines are now under the Microchip brand, but people still call the chips "atmel SAMD" sometimes out of habit.
?serverinfo
I was just runnin ga test with the "feather_m0_adalogger" build and noticed that it does not include the native busdevice... Does anyone know if this was intentional or should I open an issue to add it?
Looks good to me:
Adafruit CircuitPython 6.2.0-beta.2-16-gbc6db350e on 2021-02-15; Adafruit MagTag with ESP32S2
>>> import board
>>> spi = board.SPI()
>>> spi.frequency
250000
Looks good to me:
Adafruit CircuitPython 6.2.0-beta.2-16-gbc6db350e on 2021-02-15; Adafruit MagTag with ESP32S2
>>> import board
>>> spi = board.SPI()
>>> spi.frequency
250000
Looks good to me functionally for 4142. I haven't looked into how is_free or never_reset work.:
Adafruit CircuitPython 6.2.0-beta.2-16-gbc6db350e on 2021-02-15; Adafruit MagTag with ESP32S2
>>> import board
>>> spi = board.SPI()
>>> spi.frequency
250000
Is there any way to get PWM working on any pins at this point? Currently working on a senior capstone project that decided to go with Circuitpython on our teensy, but only now realized that PWM isn't working. I don't get any errors, just no output. Thanks for your help!
@solar whale it may not fit..
<@&356864093652516868> just a reminder that the meeting is tomorrow due to a US holiday. Same time of day as usual, just 24 hours later.
@onyx hinge thanks -- I may do some experimenting -- it looks tight with ~2500 bytes avaialable in us_EN
is it a hangover day after the valentines?
"Presidents Day" -- Combined "Washingtons and Lincolns Birthdays"
@ajordan5 it's on my todo list but not at the top. PWM is currently unsupported, the existing code is really just a placeholder. Would it be practical for your senior project to switch over to another chip that's out of beta and in our stable category? A SAMD51 or STM32F405 will have all common modules implemented and any Circuitpython code for the i.MX should be portable to them.
@dhalbert since @anecdata has tested, I'm just pinging you for structural go-ahead.
So, the ESP32S2 has an I2C issue where it resets, but it doesn't seem to be an actual crash, so it doesn't land in safe mode. It also doesn't hit a reset_handler, but that might just be because it isn't ARM? in any case it's making it hard to trace what actually causes the reset
anybody have ideas how I could break on reset, so I get a backtrace?
@hierophect Yes switching to a chip that has full support is kind of where we were leaning anyway. Looks like that is the way to go.
Updates builtin exec to accept memoryview as a valid code argument.
Meets python spec (already implemented in micropython).
@ajordan5 sounds good, the Feather F405 or Feather M4 Express might fit your needs. i.MX support should be expanded out of the alpha state sometime this spring but it's taking a backseat to other priorities right now.
Just wanted to follow up. I found a temporary solution. Essentially, the HC-SR04 and speaker are constantly initialized and deinitialized within the loop. The two are never initialized at the same time.
`
import time
import math
import board
import digitalio
import audioio
from audiocore import WaveFile
import adafruit_hcsr04
=== speaker ===
propMakerPower = digitalio.DigitalInOut(board.D10)
propMakerPower.direction = digitalio.Direction.OUTPUT
propMakerPower.value = True
...
@ionic elk Is there a known address it goes to on RESET so you can set a breakpoint at that address?
@dhalbert ok you were able to replicate this issue? ill take it off my todo list if so
I've been testing this today, it appears to be the same problem as #4079, and probably #4147. Your test sketch catches the problem the most cleanly, I think. I can verify that at least for me, busio.I2C(board.X, board.X) does not cause this issue, only board.I2C.
This makes me think it has something to do with how the internal IDF object is dealt with internally during reset. The current version of I2C on the ESP32S2 doesn't do much on reset, so from what I can tell, board.I2C() tries ...
@solar whale I'm really not sure, unfortunately, I've been looking for one but there doesn't seem to be a clean stand-in for Reset_Handler.
@tulip sleet if you have some time tomorrow I was wondering if I could ask you some questions about the intended behavior of board.I2C on soft reboot
I'm confused about how the reset should affect that object.
I have also been looking at this, trying various things. I believe if i pull out my PR #3803 I think this starts to work, But then the original problem with the wifi and i2c cannot coexist re-appears. I wiil do some more work later today. I have also tried the IDF v4.3-beta1, using something @analog bridge has on his repo. I managed to get i2c.scan() working but have to look further into it. Lots to look at.
I do think its something with the IDF but rather hard to pinpoint what.
@supple gale wait, you have a problem where wifi and I2C can't coexist? I haven't been looking at that
I'm currently trying to just figure out why I2C is always invalid after soft reboots if it uses board.I2C()
There was a problem. I had fixed it. And all was working. Something between then and now broke I2C.
I can partially solve the issue by adding a i2c_driver_delete to the reset process, so it doesn't do the weird non-crash reset, but then it just makes all I2C operations for board.I2C fail with ESP_ERR_INVALID_STATE
I had a build from December 12 where it worked. From main. When was the version of the IDF being used changed?
Oh I see I misread your issue, your fix resolved one issue but seems related to this one?
Ah, so you actually removed the driver reset?
yes, and looking at some espressif forums this seems to be fine. at one point at least.
i have a conference call in a few minutes but after that will look at where i am at with the various idf versions and do some testing
Do you know when CPY moved from the IDF that scott had to v4.2 that is currently being used?
@skieast noted on discord that #3803 is a related issue. Re-enabling the driver delete partially resolves this problem but will cause the wifi-i2c conflict to reappear
I'd have to double check. I updated the IDF several times to address AnalogIO issues but I think that predates any of these issues.
what is "DF"
lol, cant type IDF
oh I thought you meant another acronym haha
@gilded cradle had an issue like that in a different environment on top of the IDF I believe, possibly relevant
The two problems are related, based on Bruce's issue and PR. It seems that by enabling a thorough reset, the wifi and I2C conflict, but removing it breaks board.I2C()
This matches my experience in testing.
Here are the dates of the two versions,
Works with
Adafruit CircuitPython 6.1.0-beta.2-7-g22ad76bb4-dirty on 2020-12-07; FeatherS2 with ESP32S2
Doesnt Work (built from main)
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; FeatherS2 with ESP32S2
The code pings google dns and does an i2c.scan(), nothing very complicated. When the running code it interrupted and restarted so does circuitpython. Restart that is.
Well, at least the re-enabling the reset mostly fixes the board.I2C() thing, I haven't tested the wifi part
My issue was that when I was using I2C and WiFi in ESPHome on the ESP32-S2, I would get a WiFi disconnect. I've heard that changing the init order can help, but I ended up putting the project on hold.
@supple gale I'm tracking this issue here: https://github.com/adafruit/circuitpython/issues/4046 if you add updates there we can keep track of things
There are at least 4 different issues that seem to be attached to this one central problem, just at differing levels of library obfuscation
ok thanks. is there any way to merge issues? lol. i'm replying mostly to another one.
Not that I know of, we just close them if they're obviously redundant, but if it's possible they could actually be different problems they tend to stay up until they've been definitively fixed.
I think #4046 is the best issue to track in since it includes an example sketch that makes the problem very easy to replicate
I have been doing some testing as well, including using IDF v4.3-beta1. Mostly to see if the problem changes or goes away with a newer IDF.
[adafruit/circuitpython] New comment on issue #4147: ESP32S2: unable to access I2C after soft reboot
I'm consolidating this with a number of other issues that all appear to be the same thing. Please continue discussion of this issue in #4046.
I'm consolidating this with a number of other issues that all appear to be the same thing. Please continue discussion of this issue in #4046.
I'm consolidating this with a number of other issues that all appear to be the same thing. Please continue discussion of this issue in #4046.
I'm just playing with a Pico and noticed there's no pulseio library. It's moved to pwmio but the docs say it doesn't disappear until 7.x? https://circuitpython.readthedocs.io/en/6.1.x/shared-bindings/pulseio/#pulseio.PWMOut
@simple pulsar pwmio was created to split PWM away from the IR libraries PulseOut and PulseIn, since they didn't really have anything to do with one another and often used completely different chip peripherals under the hood.
Now that that's happened, PulseOut and PulseIn are going to be treated as lower priority than pwmio since they're typically used for IR controllers, which are pretty specific compared to PWM which is used for all kinds of things.
My question was more about the migration and the docs look incorrect for 6.2.0-beta.2
most commonly, blinking leds
I am guessing that because the pico did not exist before 6.2, it is not an incompatibility if it does not have the pulseio library.
it is a bit of hair splitting, perhaps
BTW, PWMOut is documented as being in pulseio until 7.x: https://circuitpython.readthedocs.io/en/6.1.x/shared-bindings/pulseio/#pulseio.PWMOut
the doc says PWMOut is removed from pulseio in 7, but pulseio is not implemented on the pico yet, so that's still valid for me, it can have PWMOut if pulseio is implemented before 7
in 6 it is in both, but deprecated in pulseio
On soft reboot all the devices except those needed for, say, display, should be reset. an I2C would be preserved only if it were driving the display.
I just ran this
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040
>>> import pwmio
>>> import board
>>> pins = (board.GP0, board.GP1, board.GP2, board.GP3,
... board.GP4, board.GP5, board.GP6, board.GP7,
... board.GP8, board.GP9, board.GP10, board.GP11,
... board.GP12, board.GP13, board.GP14, board.GP15)
>>> pwms = [pwmio.PWMOut(p, frequency=2000, duty_cycle=3456) for p in pins]
On Cytron Maker Pi Pico which has LEDs on the pins. Even numb...
👍 for this feature.
Since the pico has two UART ports, I was hoping to use one of them to talk to another pico - daisy chaining them together would be great, with child picos using UART0 to talk to the parent, and UART1 to talk to the next child in the chain.
As it is now, the pico does not support running as an I2C peripheral under circuitpython, and can not use the UART1 function, so the options are limited for pico-to-pico communication.
On Pico I'm not finding audio libs on 6.2.0-beta.2, are they supposed to be there? ```Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040
import audiocore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'audiocore'
import audiopwmio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'audiopwmio'
I can't find libraries which hold PWMAudioOut and WaveFile on 6.2.0-beta.2:
Adafruit CircuitPython 6.2.0-beta.2 on 2021-02-11; Raspberry Pi Pico with rp2040
>>> import audiocore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'audiocore'
>>> import audiopwmio
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'audiopwmio'
I'm looking at the gamepad library, and see it doesn't have support for analog triggers. is there a reason that wasn't added or is it just not in the documentation?
They were merged after beta.2 iirc
gamepad is really for monitoring buttons in the background. You probably just want analogin for reading an analog value
Are you referring to gamepad in the adafruit_hid library? https://circuitpython.readthedocs.io/projects/hid/en/latest/_modules/adafruit_hid/gamepad.html
yes, but that's basically the only reference I've been able to find to gamepad usage in circuit python. looking at the core usb_hid there's no gamepad documentation at all
I am guessing that was just something that wasn't implemented.
@bleak spear I've got a fork of the library that makes the gamepad expose more buttons. Still trying to get multiple picos talking to each other though
Thanks. It's be my first time but I'll seek out the Absolute Newest release
BTW, on audio front something odd might be going on with PyPortal code vs WaveFile: https://forums.adafruit.com/viewtopic.php?f=60&t=175520
@ladyada I confirmed that there's an issue. TCS34725 does not respond, and also takes down the I2C bus so that other devices on the bus are prevented from responding: I added an LIS3DH, which could not be found until I removed the TCS34725.
Notes: @ladyada says this may very well be due to the unusual way we probe for the device on the RP2040. If We do a zero-length read; normally we would do a zero-length write, but the pico SDK does not provide for that. (I believe that is right, based o...
Running ble_adafruit_feather_bluefruit_sense.py on a Feather Sense causes a crash on connection from the Bluefruit Playground app.
It works fine with 6.0.1, but crashes with 6.1.0.
Thanks to Southern Dragon in ciscord for finding this.
This sort of thing will demonstrate the problems. Playback is sometimes fine, sometimes accompanies by nasty noise, and occasionally silent with some minor noise.
Adafruit CircuitPython 6.2.0-beta.2-18-g2a467f137 on 2021-02-15; Raspberry Pi Pico with rp2040
>>> import board
>>> from audiopwmio import PWMAudioOut as AudioOut
>>> from audiocore import WaveFile
>>> audio_out = AudioOut(board.GP18, right_channel=board.GP19)
>>> testwav = WaveFile(open("120998-32k.wav", "rb")) ### 32...
Here's zip with wav file: 120998-32k.zip
It's converted to 32k and trimmed version of https://freesound.org/people/Thirsk/sounds/120998/
There's some example code for this: https://github.com/adafruit/Adafruit_CircuitPython_HID/tree/master/examples
@tulip sleet Ok so trying to pick up where I left off. Is this where we landed? ```python
import board
import digitalio
import storage
write_pin = digitalio.DigitalInOut(board.GP0)
write_pin.direction = digitalio.Direction.INPUT
write_pin.pull = digitalio.Pull.UP
If the write pin is connected to ground, CircuitPython can write to the CIRCUITPY filesystem.
if not write_pin.value:
storage.remount("/", readonly=False)
comment could be clearer, but is the code proper?
I'm not sure we want to take that out because .. yeah. That. And it means when setting things to output, folks won't be confused as to why previous code worked without setting direction.
But good to know, thank you.
otherwise looks good
Ok, thanks!
that code needs to be in the boot.py, of course
Is that going on https://learn.adafruit.com/circuitpython-essentials/circuitpython-storage ?
No, it's going in the Getting Started with Pico and CP guide
We could update the one on storage as well if it makes sense.
I've been using this on the CLUE: ```import board
import digitalio
import storage
button_a = digitalio.DigitalInOut(board.BUTTON_A)
button_a.switch_to_input(pull=digitalio.Pull.UP)
if not button_a.value:
### Left button is pressed down, remount CIRCUITPY r/w
print("Remounting / read-write")
storage.remount("/", readonly=False)
else:
print("Leaving / as read-only")
Convenient.
That's left button held down. Are both buttons pressed at power-on used for bootloader mode on ESP32-S2 CLUE?
I have no idea. I haven't looked into that one yet.
another way is to always remount it, and use the safe mode to access the disk
@stuck elbow I'm including that in this page, but not as the "default". It's basically a "you can also do".
sounds good
since I usually replace the reset button with a jumper on my boards, it's rather hard to trigger safe mode on them
@stuck elbow You can get to the REPL though even when the board is read-only to your computer... and run os.remove or os.rename on boot.py... right? Without safe mode?
I thought that's what Dan told me to do last week. And I think I tried it and it worked. I can test it again though.
Not sure how to get the Pico into safe mode. No reset button. And Dan said access the REPL.
@idle owl that is correct in my experience. You can get to REPL and rename or remove boot.py from there in order to switch back to USB drive having write access.
without out safemode
Yah ok. That's what I thought. I got nervous again when safe mode came up. Heh.
yeah, you can, but it's not very convenient
To be clear, this would remount every time the board starts up, yes? ```python
import storage
storage.remount("/", readonly=False)```
@stuck elbow Is this right? ^^
@tulip sleet do you have a bit of time today to discuss this ESP32S2 I2C issue? It's turned out to be way hairier than I thought. I think the best way to approach it will be to try and keep I2C objects persistent across resets but I'm not totally up to speed on how that system works so I was hoping to pick your brain.
@tulip sleet if you're not the person I should be asking let me know. I'm not sure whose ballpark this falls into
@idle owl yeah
Thank you!
@ionic elk I have not looked into this in any detail. I would not try to keep the I2C objects persistent across soft-reloads, since many aspects (like which pins to use) may change. It sounds like a workaround, solving the surface problem instead of the deeper problem. Instead, I think it would be more important to make sure that the ESP-IDF's state of the world re I2C is reset properly on soft reload, so that re-creating the objects works properly. There is some bug in the ESP-IDF, or we are using it improperly.
Limor said she was able to get it working properly with wifi in Arduino, remember? So I would look at the sequence of calls in Arduino to see if it's different than what CPy uses.
In any case, this solves the problem and makes it unlikely to ever come back, which is important for me from the maintenance point of view.
@tulip sleet you might already know this but the historical issue I'm running into is that calling i2c_driver_delete apparently causes a hang when combined with wifi. There was a "fix" that removed it, which fixed the wifi problems but introduced all of these new I2C issues
i do remember, so I think something about i2c_driver_delete is doing something or we are doing something else wrong
I've been running the wifi hang under a debugger and I'm having trouble pinning down why exactly it's a hang at all
Do you know why GDB would make a big jump in the code like this?
(gdb) n
esp32s2: Target halted, PC=0x400A0369, debug_reason=00000001
330 RUN_BACKGROUND_TASKS;
(gdb) n
esp32s2: Target halted, PC=0x400A025F, debug_reason=00000001
331 if (reload_requested) {
(gdb) s
main () at ../../main.c:600
600 skip_repl = run_code_py(safe_mode);
Is this just some kind of GDB skipping stuff thing or is it possible memory corruption?
Or maybe it's just how Xtensa deals with GDB, I'm not sure. I've been frustrated by the debugging experience on ESP32-S2 so far.
it might be inline code substitution or optimization reordering. Can you compile it with less optimization?
Which was the issue that Limor talked about Arduino in? I wasn't part of these original bug conversations
it was in a mtg
@tulip sleet good idea, I'll try that
i thought you were in that mtg (last week's CPy mtg)
Was it last weeks? I don't have it in my notes?
It wasn't the one before? I wrote down stuff for GP15, bus device, SD card, no I2C though
well, anyway, she said she did not see the problem in an Arduino test program, so you might try enabling wifi in Arduino and then doing the I2C stuff. But maybe it is not a good test because you'd have to the driver_delete and re-create in the same program. So upon reflection, maybe it's not a proof of anything, since Arduino doesn't have soft-reload
My question was going to be about the soft reload. It clears out the heap, right? Would it clear stuff that the IDF uses?
What protects objects in the never_reset arrays from having their internal state destroyed?
Even if we do re-introduce the driver deletion, this would still be at risk of occurring for never_reset I2C instances.
The IDF has its own storage. ... Are there python objects in the never_reset arrays? If so, they may be allocated outside of the regular CPy heap, either statically or in some non-heap dynamic storage (supervisor_allocation or something like that).
I am not familiar with never_reset of stuff other than pin state
Typically, no. In something like STM's never_reset array, it's just an array of booleans, telling me the physical I2C peripherals I shouldn't reset and shut down the clocks for
I've never had to worry about the higher level objects much before, other than for interrupts, where I used a root pointer
that is used only for a display I2C, right?
can you reassign the pins without doing a driver_delete?
I guess, on the low level I don't have to worry about what it's used for. Never_reset isn't represented in the python APIs
@tulip sleet yes, you can. That's what the Wifi fix was doing. It just kept the peripheral up and running forever after it was initialized the first time, and would simply re-arrange the pin mux rather than actually reset it
After on a soft reboot, when using board.I2C and certain other library-related scenarios, you see a weird full-board power reset
do we do driver_delete on other peripherals without issue?
e.g. SPI or analog or whatever?
Code that is producing the error: "Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Connecting to Mere Muggles
Traceback (most recent call last):
File "code.py", line 63, in <module>
ConnectionError: Unknown failure 205
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Connecting to Mere Muggles
Traceback (most recent call last):
File "code.py", line 63, in <module>
ConnectionError: Unknown failure 205
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload."
@tulip sleet yes for UART, no for SPI
UART we do or don't recycle the existing driver instances? (just not sure what "yes" and "no" mean here)
the busio API stuff for ESP32 seems like it's all over the place