-
Notifications
You must be signed in to change notification settings - Fork 235
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
Digilent pmod i2s2 distorted audio #321
Comments
The standard Circle I2S driver is not compatible with this device and I think it needs the following modifications:
These modifications should be applied by the following patch, which is based on Circle 44.5 from master branch:
These modifications are for I2S output only. You can use standard sample rates of 44100 and 48000 Hz, not more because the clock generator with MASH can generate a maximum frequency of 25 MHz. I wasn't able to test this without hardware, of course. If it doesn't work, we have to rethink this. |
I tested these modifications on the hardware, but doesn't work as expected.
This makes me think the clock is fine. Is it perhaps the order of MSB and LSB that are different? I seem to recal having similar distortion in an old esp32 project that had the wrong i2s format settings. |
According to this datasheet pg. 119 the bit order is MSB to LSB in the Raspberry Pi I2S peripheral, which is the same as noted in the Pmod I2S2 Reference Manual, you have referenced above. Unfortunately I think, my assumptions were wrong, we cannot generate MCLK with the I2S peripheral in the Raspberry Pi, because the serial bit clock is not only presented via the GPIO pin, but is also used to shift the data in the peripheral. I think we need a second separate GPIO clock for this purpose. I do not know, if this will work, because this second clock wouldn't be synchronized with the SCLK signal and the data, coming from the I2S peripheral, but we could try. Let me think about this until tomorrow. |
Thx Rene, but if it's too much trouble for the implementation then let's move on. I just need to find a reasonable high quality i2s DAC + ADC for my sampler project. If this is too difficult/exotic to get working, I'd rather put my efforts in getting the audio injector octo running. Two years ago when I started working with Circle I got it to work in 2ch mode using some existing code for a vGuitar rig made by Patrick on Hackaday. If I want to use all of the 8ch out and 6ch in, i'll have to try and implement TDM in Circle, which i'm afraid is above my capabilities but I can try. Patrick ported Paul Stofregen's Teensy Audio Library to Circle, and that had TDM support, and believe he got it to work with Circle. Maybe i can try to reverse engineer/hack it into Circle. |
OK, no problem. I think continuing here would only be of interest for Circle, if there would be many potential users of the Pmod I2S2 on the Raspberry Pi, but I did a search in the forums and found only one user. Good luck for your plans with the Teensy Audio Library port, and thank you for using Circle! |
I've hooked up (this) i2s module (currently testing output only), but i'm getting distorted audio. I've tested this using my own audio sample playback code where you can hear the sample but sounds like there is some distortion and a lot of noise (which plays back fine when using sndpwm), but also with sample 34-sounddevices where i hear what sounds like a modulated square wave instead of a modulated sine wave.
I hooked up the module using these pins (schema):
Pi 3.3v -> 3_3V
Pi GND -> GND
Pi GPIO18 -> ADOUT MCLK
Pi GPIO19 -> ADOUT LRCK
Pi GPIO21 -> ADOUT SDIN
Any ideas?
If i connect GPIO18 to ADOUT SCLK instead of ADOUT MCLK, i get nothing.
I also played around in sample 34-sounddevices with the SAMPLE_RATE and WRITE_FORMAT, but no significant difference.
Also just tested this with a PCM5102A, and works without problems.
Many thanks!
The text was updated successfully, but these errors were encountered: