Description
CircuitPython version
Adafruit CircuitPython 9.1.0 on 2024-07-10; Teensy 4.0 with IMXRT1062DVJ6A
Code/REPL
import audiobusio
import audiocore
import board
import array
import time
import math
# Generate one period of sine wave.
length = 8000 // 440
sine_wave = array.array("H", [0] * length)
for i in range(length):
sine_wave[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15) + 2 ** 15)
sine_wave = audiocore.RawSample(sine_wave, sample_rate=8000)
i2s = audiobusio.I2SOut(bit_clock=board.D21, word_select=board.D20, data=board.D7, main_clock=board.D23)
i2s.play(sine_wave, loop=True)
time.sleep(1)
i2s.stop()
Behavior
Traceback (most recent call last):
File "main.py", line 17, in
ValueError: Invalid bit_clock pin
Description
First of all, CircuitPython is amazing! I really appreciate all of the hard work put into it!
There is a slight issue with the Teensy Audio Adapter board though.
The code above uses the default pins for the teensy audio adapter board.
Teensy 4.x audio adapter board Rev. D2:
https://www.pjrc.com/store/teensy3_audio.html
I have also tried using different pins and assigning them manually, but still receive ValueError: Invalid bit_clock pin
The code is nearly identical to the example given in the CircuitPython docs.
https://docs.circuitpython.org/en/latest/shared-bindings/audiobusio/index.html#audiobusio.I2SOut
Any help would be greatly appreciated!
Additional information
I have tried defining different pins for bit_clock
, word_select
, data
, and main_clock
. Pins that were not used for audio by the audio adapter board by default on the Teensy pinout did not raise an error.
Default pins for the audio adapter board raised a ValueError
- BCLK1 (board.D21)
- LRCLK1 (board.D20)
- OUT1A (board.D7)
- MCLK1 (board.D23)