Anyone have the PCM1802/08 ADC working with this library? #162
-
First, I got these boards a while back and I did find that on the older boards i have that there are solder jumps to set fmt0 (so the board works with std format, rather than left-justified) and the + pads are not connected to vcc, so, I soldiered a jumper wire to vcc to get that to work). And have the pwrdwn and Fsync tied to + to enable the chip. I checked all clocks (same connections to the PCM5102 DAC board, that works great for output) I also set the program to 24bits per sample (PCM1802/8 is only 24b bit as i understand from the data sheets), and as I said, the PCM5102 outputs generated sinewave perfectly with the same clocks and settings. But, I am getting NO output at all on the pcm1802 Dout pin - i am using with APLL off, so the ESP32 is generating the master clock (this chip has no pll), and all the clock inputs are working. But, i can get no output from this board. I have 2 boards, tried both of them. Any help will be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 24 replies
-
The PCM1802 seems to be very difficult to use and Google did not provide any help either. My gut feeling is that the issue is FSYNC which is not provided by I2S. If you use the ESP32 as Master (and the PCM1802 as slave) there is no way to generate this signal. Maybe you can try to use the ESP32 as slave (and the PCM1802 as master) and ignore this signal ? I suggest that you start with a sketch that outputs the signal from the ADC to Serial to verify the signal first. Finally I also don't understand why you would need 2 ESP32. The ESP32 supports 2 I2S Ports where each has 2 separate channels where you can do input and output at the same time. ps. I just found the following link which might be useful https://www.pjrc.com/pcm1802-breakout-board-needs-hack/
Even when if format is wrong you might get some data on DOUT and I hope your soldered VCC is 3V |
Beta Was this translation helpful? Give feedback.
-
Oh, then this seems to be a generic problem on all the boards. See this issue. ps. I confirm that I am using the "ESP32 Dev Module" selection in Arduino as well. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/pschatzmann/arduino-audiokit/tree/main/src/audio_driver/ac101 |
Beta Was this translation helpful? Give feedback.
-
I just committed a correction. |
Beta Was this translation helpful? Give feedback.
-
For the reference here is the technical sheet for the PCM1802 https://www.ti.com/cn/lit/ds/symlink/pcm1802.pdf?ts=1671611414917&ref_url=https%253A%252F%252Fwww.google.com%252F It might be worth to give "master mode" a trial. |
Beta Was this translation helpful? Give feedback.
-
Hello, i join your discussion because i will certainly buy one of these pcm1802, https://forum.pjrc.com/threads/69636-PCM1802-gt-Teensy4-x-gt-PCM5102 |
Beta Was this translation helpful? Give feedback.
-
Looking at the technical sheet, I don't think that is is possible to use this with pure I2S because of the additional FSY signal required by the module. The only chance that I see is to set the module to master mode and the microcontroller to slave mode and just ignore the additional signals. I am currently trying to make the WM8960 work with Arduino: this would be a very cool solution with a built in ADC, DAC and amplifier |
Beta Was this translation helpful? Give feedback.
-
The teensy hack seemed to work fine,is that the I2S of the teensy that provide FSYNC and the esp32 do not? |
Beta Was this translation helpful? Give feedback.
-
I've got the pcm1802 working. Fsync is not an issue when the pcm1802 is configured in slave mode (fsync just needs to be pulled to 3.3V). The issue I'm having is that the esp32 does not seem to be outputting the correct clock signal for the pcm1802 system clock. If operating at 11.4khz, 256fs, then the pcm1802 needs an 11.2896 Mhz clock signal. I've been providing this via an external signal generator for now, but I would like to understand how to generate this from the esp32. I can confirm that the streams-i2s-serial example works out of the box (while applying an external system clock signal). The only issue with this is that it is not necessarily lined up with the bck and ws signals coming from the esp32, so the output wave on the serial monitor appears chopped sometimes (this is just my theory as to why its chopped, maybe it's due to the padding byte?). By the way, my board required the jumper mod described in the pjrc blog post already mentioned in this thread. I am hoping to do DSP on the esp32 for IQ processing. It seems that I may need to find another library according to other discussion posts. But, this was the only library that actually reconstructed the waveform properly on the serial plotter. I tried with the standard esp32 driver/i2s.h library but I couldn't reliably convert the 24bits of data back into the original waveform... @pschatzmann could you point me to where this operation is done in your source code? Also, would it be feasible to do AM demodulation with your library? I see AM mod sketches but not for demod. Edit: I think the esp32 was probably sourcing the correct clock signal all along, but the wroom version is outputting the clock on pin 1 (tx) despite specifying pin 3 in the code. |
Beta Was this translation helpful? Give feedback.
-
On the ESP32 I am using my Int24_5bytes_t.h to represent and convert to/from 24 bits. |
Beta Was this translation helpful? Give feedback.
-
I just found this code on github: https://github.com/jtomes123/ESP32_I2S_PCM1808_PMC5102 |
Beta Was this translation helpful? Give feedback.
-
The streams-i2s-serial example is properly working with the aliexpress pcm1808 board. It needs the mck clock, I used the following pinout:
Of course the serial speed is way too low even at 1000000bps, so the plot is a bit choppy, but seems that the adc is working very well. I used the internal DAC in cosine mode for test signal. The board needs clean 5V and 3.3V power supply. Using just the ESP board's pins as power supply the ADC is a bit noisy, the lower 10 bits are just noise. Platformio default espressif32 platform sometimes drops missing WiFiClientSecure.h error, forcing a new version solves it: |
Beta Was this translation helpful? Give feedback.
The PCM1802 seems to be very difficult to use and Google did not provide any help either.
My gut feeling is that the issue is FSYNC which is not provided by I2S. If you use the ESP32 as Master (and the PCM1802 as slave) there is no way to generate this signal.
Maybe you can try to use the ESP32 as slave (and the PCM1802 as master) and ignore this signal ?
I suggest that you start with a sketch that outputs the signal from the ADC to Serial to verify the signal first.
Finally I also don't understand why you would need 2 ESP32. The ESP32 supports 2 I2S Ports where each has 2 separate channels where you can do input and output at the same time.
ps. I just found the following link which might…