I2S not working as expected? #3231
Replies: 3 comments 3 replies
-
|
The I2S coming from the chip runs fine. I suggest starting with unmodified https://github.com/earlephilhower/arduino-pico/blob/master/libraries/I2S/examples/SimpleTone/SimpleTone.ino and hooking up your logic analyzer to GP20, 21, and 22 and verifying you get the square-wave tone I2S data. Note that GP20 is not pin 20 on the PCB, in general, so make sure you use the right PCB pin for those IOs. Once that's verified, you can move on to the hookup of your DACs. Some are PITAs like the PCM5102 modules I got from AX which need a very precise setup (and some shorting of on-board jumpers) to actually speak I2S and send analog out. After you get that running look at BackgroundAudio or ESP8266Audio for more complex I2S stuff. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Brilliant! Thank you so much for your time and maintenance Earl. I'm still a bit clueless with more advanced C++, I appreciate the basics of objects and how they make code so much clearer but as soon as it dips into things like Polymorphism my brain polymorphs into something resembling guac and runs out of my ears. You get the idea. ;) Turns out that when I went back to the datasheets for the relevant chips, the one I thought was a target is actually a controller so I've had to wiggle the thing around a bit. As a result I've split the board into two designs - one just went out to JLC this afternoon (I'm on GMT which also explains why I spell stuff the way I do). This can help me better understand the signalling - assuming I didn't goof anything else. So the master clock isn't needed (or even used!) which was a massive relief. I'm quite happy designing for very fast signals now but when they have to jump between different PCBs I get chills. I'm sure you're aware of the issue. But then again, I2S was never intended for interconnects, so that's on "us" so to speak. I'm still playing a little bit of catch up from my 1980s training (and I quit doing this at any level in the mid 80s) so that's been a baptism of fire. I've dropped a bundle trying to improve a friend's design which was almost entirely analogue into something with mixed mode on the same PCB. That bit of what I term "railtrack thinking" let me down a rabbit hole chasing problems that didn't exist because I'd missed something that breaks the project no matter what. I've witnessed this sort of thinking in professionals including (and perhaps esp.) with medical doctors and a few other scientists in various fields. The point is we get stuck in a rut and keep moving forward even though we're chasing the pot of gold at the end of the rainbow. Locked into that thinking we fail to see other solutions. I remember a programming guru from my era (famous name that I've suddenly forgotten) who documented his experience with a similar problem and the catharsis that washed over when he spotted it. Moving to an I2S capable digitiser was a light-bulb moment. Simpler, lower BOM cost and probably better performance. The next leap will use your library with a Pico (although an ESP32 or even some STM32s will work) so that I can make a dummy target to supply the existing 16-bit master which is uses a PLL to generate the internal clocks (badly). Had I looked at this two years back I'd have already have sorted this problem. Oh well, I live and learn. BTW, I looked at your state machine code. It's very instructive in how to make code readable. I've hand coded Z80 assembler to machine code but looking at that made me blush. Words like elegant and beautiful come to mind. It just reads like a book. |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
It might be that I've done something wrong here but I've tried the demos (to keep it simple and pain free) from the I2S examples on the library on several different 2040s (all Pi Foundation) and not a single one of them seems to produce any actual audio data.
What works:
Bit Clock: Check (following the sample rates exactly as they should)
Word/Frame Clock: Check (ditto)
Master Clock: (to my surprise) Check and ditto
What doesn't:
Audio Data: Not a dickie-bird. I've checked every single pin on the header on several different boards and the same thing happens. Signals from bit, frame and master (controller) all appear as they should. Everything else either appears as a steady state or ground as the IOs aren't being using.
Outputs are probed with an oscilloscope and I need to make sure this works before I order some physical hardware from our friends in Asia - the entire PCB is already laid out for a Pico 2040 (official) but I followed the pinning in the sketches to make sure everything was OK. Am I missing something? While I'm not "new" to I2S I am new to the Pico and perhaps it needs something to trigger data IO, although that doesn't seem to likely with demos like the square wave.
I could use an STM32 but they are less convenient, and generally run at lower clock speeds and I wanted a solution that was easy for people to assemble hence the Pico seems the obvious choice, esp. when it comes to clock speeds above a couple of MHz as signal integrity becomes a very serious issue even over comparatively short jumps.
The other thing with the 2040 (or 2350) is that it's low-cost part and I can easily mount two or more on the PCB for the final iteration.
Beta Was this translation helpful? Give feedback.
All reactions