Skip to content

implement duplex I2S, add TE EP-2350 ting board def#11136

Open
FoamyGuy wants to merge 3 commits into
adafruit:mainfrom
FoamyGuy:te_ep2350
Open

implement duplex I2S, add TE EP-2350 ting board def#11136
FoamyGuy wants to merge 3 commits into
adafruit:mainfrom
FoamyGuy:te_ep2350

Conversation

@FoamyGuy

Copy link
Copy Markdown
Collaborator

I2S duplex supported by new argument clock_follower for I2SOut and I2SIn. Defaults to False meaning the object will be in "clock source" mode. Set it to True for "clock follower" mode. The NAU88L21 datasheet, and perhaps others, refer to these as master and slave modes. I changed them to follow the precedent set with I2C and aimed for the most descriptive names I could think of.

This driver utilizes the new functionality: https://github.com/adafruit/Adafruit_CircuitPython_NAU88L21, all testing was performed with this and earlier versions of it.

The passthrough example shows the full API usage: https://github.com/adafruit/Adafruit_CircuitPython_NAU88L21/blob/main/examples/nau88l21_passthrough.py It uses I2SOut as the source and I2SIn as the follower.

I2SIn also gets a new argument invert_bit_clock for clock follower mode if the external clock drives data on the rising edge. And a new property overflow a flag that can be checked to determine if samples where dropped.

The new I2S functionality is only implemented in the rpi port currently.

Other changes in this PR:

  • TE EP-2350 ting board def
  • Tweak the Chorus docstring example to use more than one voice so the effect is audible by default.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question about the term "follower".

//| :param ~microcontroller.Pin main_clock: The main clock pin
//| :param bool left_justified: True when data bits are aligned with the word select clock. False
//| when they are shifted by one to match classic I2S protocol.
//| :param bool clock_follower: True when this object follows an externally supplied clock:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does the term "follower" come from? I'm happy to avoid "master" and "slave" but maybe external_clock would be simpler.

@FoamyGuy FoamyGuy Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not take "follower" from any specific place. I actually did call this argument external_clock at first but ended up changing it. The NAU88L21 datasheet makes references to "internal clock" in a different context than what this argument is for if I understand it correctly. The CODEC can have the system clock set directly by MCLK or generated from a frequency locked loop FLL on MCLK, BCLK, or FS, and uses "internal clock" during sections of the datasheet detailing the operation.

I thought using external_clock for the argument name and the terms "external clock mode", "internal clock mode" might give someone the false impression that it was as in relation or opposite to the "internal clock" referenced in the datasheet.

I can change it back if you think external_clock is more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants