adafruit / Adafruit_ZeroPDM

Arduino Library for using ATSAMD processors with PDM microphones (w/I2S)
MIT License
15 stars 5 forks source link

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

Open dhalbert opened 6 years ago

dhalbert commented 6 years ago

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.)

ladyada commented 6 years ago

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

pashinen commented 6 years ago

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.

dhalbert commented 6 years ago

@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.

pashinen commented 6 years ago

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.

Syedafzal059 commented 4 years ago

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

ladyada commented 4 years ago

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