Skip to content

metro-m4 call to PDMIn.record() never returns #5797

@rsbohn

Description

@rsbohn

CircuitPython version

Adafruit CircuitPython 7.1.0-rc.0 on 2021-12-23; Adafruit Metro M4 Express with samd51j19

Code/REPL

# testing pdm mic
import time
import board
from ulab import numpy as np
from audiobusio import PDMIn, I2SOut
from neopixel import NeoPixel

neo = NeoPixel(board.NEOPIXEL, 1, brightness=0.1)
YELLOW = 0xFFFF00
RED = 0xFF0000
GREEN = 0x00FF00

# M4 I2S pins are fixed
mic = PDMIn(clock_pin=board.D3, data_pin=board.D1,
    sample_rate=16000, bit_depth=16)

buffer = np.zeros(256, dtype=np.uint16)
while True:
    neo[0] = YELLOW
    time.sleep(1)
    neo[0] = RED
    mic.record(buffer, len(buffer))
    neo[0] = GREEN
    time.sleep(5)

Behavior

Expected: NeoPixel is yellow in warmup, red while recording, then green.

Actual: NeoPixel is yellow, then sticks on red.

Call to mic.record() never returns.

I can still read and write the CIRCUITPY drive, but I have to reset the board to break out of mic.record().

This works as expected with 7.0.0, but hangs as documented here on anything after 7.1.0-rc.0.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions