Adafruit_ZeroPDM icon indicating copy to clipboard operation
Adafruit_ZeroPDM copied to clipboard

SAMD21 errata: SERCTRL.BITREV only works when slot size is 32 bits

Open dhalbert opened this issue 7 years ago • 6 comments

While reading through the SAMD21 errata, for Device Variant A, Die Revision D, which I think is what we use, found this erratum (page 897 in ATSAMD21-40001882A.pdf)

40.1.4.10 I2S 1 – I2S RX serializer in LSBIT mode (SERCTRL.BITREV set) only works when the slot size is 32 bits. Errata reference: 13320 Fix/Workaround: In SERCTRL.SERMODE RX, SERCTRL.BITREV LSBIT must be used with CLKCTRL.SLOTSIZE 32

The code here does use BITREV. For mono, it uses SLOTSIZE 32, but for stereo, it uses SLOT SIZE 16. (I don't know that we tried this with stereo yet anyway.)

(BTW, CircuitPython does not happen to use BITREV.)

dhalbert avatar Jun 07 '18 03:06 dhalbert

ooh good find. yeah we only use mono ever, so it works as is

ladyada avatar Jun 07 '18 05:06 ladyada

I'm trying the same configuration in SAMD21 Xplianed pro through ASF and its not working with I2S_FRAME_SYNC_WIDTH_SLOT, its working with only I2S_FRAME_SYNC_WIDTH_BIT and still i'm not getting the expected data.

pashinen avatar Aug 10 '18 09:08 pashinen

@pashinen Sorry, are you saying you're using this code or your own code? For example code, use this library (with the caveat mentioned above) or see https://github.com/adafruit/circuitpython/blob/master/ports/atmel-samd/common-hal/audiobusio/PDMIn.c as another example.

dhalbert avatar Aug 10 '18 11:08 dhalbert

I'm saying what all the configuration has been done according to library i have done that apart from that width slot thing. And the code only works if i put width bit in frame sync.

pashinen avatar Aug 10 '18 11:08 pashinen

Hello@dhalbert @ladyada @pashinen
I am trying to connect my PDM microphone with my Arduino/stm32 board but this library is not working can you guys suggest me that how can I run my microphone with Arduino board or my stm32 board as I have both.

Thanking you in anticipation

Syedafzal059 avatar Jan 21 '20 11:01 Syedafzal059

@Syedafzal059 STM is compeltely different - we dont have any suggestions - please go to stmduino for any STM code. https://github.com/stm32duino

ladyada avatar Jan 21 '20 17:01 ladyada