#analogbufio issue on M4

1 messages · Page 1 of 1 (latest)

thorn bronze
#

Hey again. So it looks like maybe analogbufio isn't available on the M4 Express. I get ImportError: no module named 'analogbufio' when I try to import it. But I went ahead and grabbed the analogbufio directory from here: https://github.com/adafruit/circuitpython/tree/main/shared-bindings/analogbufio
and added it to lib on the CIRCUITPY drive. That got me past the import error, but now I get File "code.py", line 8, in <module> AttributeError: 'module' object has no attribute 'BufferedIn'
when I run this code:

import analogbufio
import array

length = 1000
mybuffer = array.array("H", [0x0000] * length)
rate = 500000
adcbuf = analogbufio.BufferedIn(board.A1, sample_rate=rate)
adcbuf.readinto(mybuffer)
adcbuf.deinit()
for i in range(length):
    print(i, mybuffer[i])```
tall spire
#

Ah. So it doesn't support it at all.

thorn bronze
#

apparently not :/

#

Not sure if that DMA option you mentioned is possible with what I have

tall spire
#

Not with CP at least. You'd have to try a different board. An ESP32-S3 would be the step up I recommend because it can do analogbufio and has an FPU.

thorn bronze
#

yeah, i just ordered an S2 last night. That should work, right?

#

And I got a PDM mic as well

tall spire
#

Not the S2. That has no FPU but it does have analogbufio

thorn bronze
#

aw crap. haha

tall spire
#

So could be worth a try for a small display.

thorn bronze
#

i better change that order

#

ok, i'll see if i can make it work with the S2. It's a 32x32 display.

tall spire
#

Honestly, if you can get the PDM mic to work, you can keep using the M4, though I guess the issue is that you've run out of pins.

thorn bronze
#

yeah, exactly

#

I only have D4 left after the matrix featherwing is connected

tall spire
#

How about the analog pins? They should be able to do digital as well

thorn bronze
#

So for the S3 - which do you think would be better? The 4MB Flash 2MB PSRAM one, or the 8MB Flash No PSRAM one?

#

Ah, I'll look at that analog pins. I have A0 and A1 there.

tall spire
#

I'd get the PSRAM version. I've been burned before by not taking that especially with the large arrays I've been using and you need a large array to do FFT

#

You'll quickly run out of RAM

thorn bronze
#

cool, that's what I figured as well. thanks