Replies: 1 comment 5 replies
-
Have you put it on an oscilloscope and watched what it does? 32 clocks are sent per frame channel (the pull noblock leaves the 31st bit on the output line and toggles the clock, which doesn't matter since the codec isn't using the LSBs for anything meaningful anyway). Here's a schematic from TI showing the I2S protocol in detail: Note that the bit sent after the frame clock changes is marked as having no meaning. This is because the frame is always intended to be bigger than the bit depth of the sample being sent. Also note that the data format indicated by the project is signed 32-bit integers. The MSB of this integer will be used by the codec. The LSBs will be truncated to the codec's resolution (this is inherent in I2S protocol). So you're right that max 31 most-significant bits of the input DATA are sent, but 32 clocks are sent. Changing 30 to 31 will send 32 bits of data in a 33 bit frame. That tends to make a lot of codecs grumpy (and they'll ignore the LSBs anyway), but nobody's stopping you from trying it. |
Beta Was this translation helpful? Give feedback.
-
For reference, I'm trying out this PIO program in a Rust project (not using any of the associated C code in this repo). I'm outputting to a PCM5102A
The code in question
I'm wondering if this program is only outputting 31 bits of data per frame instead of 32.
At the very start of the program, x is assigned to 30, and then we essentially enter a loop, decrementing x until it's 0.
The
jmp x-- dataL
instruction jumps todataL
ifx
is non-zero before the decrement.So if
x
were1
at the start, it would output a bit, then thejmp
instruction would bring you back to the output instruction one more time for a total of 2 bits being output.If
x
is then 30, I would guess this loop then outputs only 31 bits here.I'm relatively new to PIO programming though, so there might be a detail somewhere that I'm missing.
Beta Was this translation helpful? Give feedback.
All reactions