adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.07k stars 1.2k forks source link

I2S protocol issue (MSB inverted) #8040

Open StreakingJerry opened 1 year ago

StreakingJerry commented 1 year ago

CircuitPython version

Adafruit CircuitPython 8.1.0 on 2023-05-22; ESP32-S3-Box-Lite with ESP32S3

Code/REPL

import time
import array
import audiocore
import board
import audiobusio

audio = audiobusio.I2SOut(board.I2S_SCLK, board.I2S_LRCK, board.I2S_CODEC_DSDIN)
d = array.array("H", [0])
d[0] = 0b1111111111111111
print(d)
w = audiocore.RawSample(d, sample_rate=8000)
audio.play(w, loop=True)
while True:
  time.sleep(1)

Behavior

This is what I got from oscilloscope: 000 The yellow line is the LRCK and the green line is DSDIN.

If I change d[0] to 0b0000000000000000, This is the outcome: 001

Obviously the MSB is inverted.

Also, I find that the left_justified parameter does not work. It seems that the default value is False. However, there is no different on oscilloscope whether set it to True or False.

Description

No response

Additional information

No response

dhalbert commented 1 year ago

Triage notes: