Skip to content

Re-enable PDMIn without ASF#789

Merged
dhalbert merged 3 commits into
adafruit:masterfrom
tannewt:pdmin3
May 2, 2018
Merged

Re-enable PDMIn without ASF#789
dhalbert merged 3 commits into
adafruit:masterfrom
tannewt:pdmin3

Conversation

@tannewt
Copy link
Copy Markdown
Member

@tannewt tannewt commented May 1, 2018

The API is almost the same except the frequency attribute has been
renamed to sample_rate so that its less likely to be confused with
frequencies within the audio itself.

Fixes #263.

I2SOut.

The API is almost the same except the frequency attribute has been
renamed to sample_rate so that its less likely to be confused with
frequencies within the audio itself.

Fixes micropython#263.
@tannewt tannewt added this to the 3.0 Beta milestone May 1, 2018
@tannewt tannewt requested a review from dhalbert May 1, 2018 21:57
Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, and the CMSIS level of progarmming is actually surprisingly refreshing.

Two q's:

  1. You increased SAMPLES_PER_BUFFER to 64. Is this just for throughput? I was keeping it lower due to SAMD21 RAM size, but maybe it's OK.

  2. Have you tried it on a CPX the builtin mic with small and larger buffer sizes, sampling freqs, and 8 vs 16 bit? This was crucial for me to make sure it was keeping up.

@dhalbert
Copy link
Copy Markdown
Collaborator

dhalbert commented May 2, 2018

Tried tannewt/pdmin3 on CPX:

Adafruit CircuitPython v1.9.3-1940-gcfea51ec6 on 2018-05-02; Adafruit CircuitPlayground Express with samd21g18
>>> 
>>> 
>>> 
>>> import board, audiobusio
>>> p = audiobusio.PDMIn(board.MICROPHONE_CLOCK, board.MICROPHONE_DATA)
>>> b = bytearray(160)
>>> p.record(b, 160)
[hangs]

Also tried a 2000-byte buffer. Same thing.

Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CPX test failed

@tannewt
Copy link
Copy Markdown
Member Author

tannewt commented May 2, 2018

Ok thanks for testing it! I had only tested on the metros with 16-bit.

I'm looking into it now.

tannewt added 2 commits May 2, 2018 15:15
The DMA trigger source was incorrect when using serializer 1 on
the SAMD21.

Playback register was incorrect for 8 bit as well. Now fixed.
Copy link
Copy Markdown
Collaborator

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woot! Tested and works great on CPX! I'm getting the same kind of numbers as 2.2.4.

@dhalbert dhalbert merged commit 9d484c4 into adafruit:master May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants