Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rsbohn opened this issue Dec 30, 2021 · 4 comments · Fixed by #5842
Closed

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

rsbohn opened this issue Dec 30, 2021 · 4 comments · Fixed by #5842
Assignees
Milestone

Comments

@rsbohn
Copy link

rsbohn commented Dec 30, 2021

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

@rsbohn rsbohn added the bug label Dec 30, 2021
@rsbohn
Copy link
Author

rsbohn commented Dec 30, 2021

Same code, modulo pin assignments, works on latest Feather RP2040.

@tannewt tannewt added this to the 7.x.x milestone Dec 30, 2021
@rsbohn
Copy link
Author

rsbohn commented Jan 11, 2022

I think @dhalbert mentioned this in the CircuitPython Weekly earlier today.

@dhalbert dhalbert self-assigned this Jan 11, 2022
@rsbohn
Copy link
Author

rsbohn commented Jan 12, 2022

Loaded new build, works as expected! Thank you.

@rsbohn
Copy link
Author

rsbohn commented Jan 15, 2022

[just a sighting] Metro M4 board stuck in PDMIn.record() sometime during file access (circup update --all).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants