-
Notifications
You must be signed in to change notification settings - Fork 1.3k
I2C peripheral in use after soft reset #10307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@tannewt I put the issue we discussed here |
I am also seeing this on
This does not happen on Sample code: import time, math, time
import ulab.numpy as np
import board, busio, audiobusio, audiocore, audiomixer
import adafruit_tlv320
SAMPLE_RATE = 44100
CHANNEL_COUNT = 1
BUFFER_SIZE = 2048
i2c_sda_pin, i2c_scl_pin = board.GP16, board.GP17
i2s_bck_pin, i2s_lck_pin, i2s_dat_pin = board.GP20, board.GP21, board.GP22
i2c = busio.I2C(scl=i2c_scl_pin, sda=i2c_sda_pin)
audio = audiobusio.I2SOut(bit_clock=i2s_bck_pin, word_select=i2s_lck_pin, data=i2s_dat_pin)
dac = adafruit_tlv320.TLV320DAC3100(i2c)
dac.configure_clocks(sample_rate=SAMPLE_RATE, bit_depth=16)
dac.headphone_output = True
dac.headphone_volume = -35 # dB, does not seem to work?
mixer = audiomixer.Mixer(sample_rate=SAMPLE_RATE, channel_count=CHANNEL_COUNT, buffer_size=BUFFER_SIZE)
audio.play(mixer)
# generate a sine wave
tone_volume = 0.5
frequency = 440
length = SAMPLE_RATE // frequency
sine_wave = np.array(np.sin(np.linspace(0, 2*np.pi, length, endpoint=False))
* tone_volume * 32767, dtype=np.int16)
sine_wave_sample = audiocore.RawSample(sine_wave, sample_rate=SAMPLE_RATE)
while True:
mixer.voice[0].play(sine_wave_sample, loop=True)
time.sleep(1)
mixer.voice[0].stop()
time.sleep(1) |
I'm having this error on
Which results in:
The board-specific I2C is GP4/GP5 which is I2C0, whereas GP18/GP19 is I2C1. |
The following code also triggers an error on the #10264 build:
|
Please try this branch: https://github.com/tannewt/circuitpython/tree/fix_finalisers I think I broke finalisers in that change. I only have time to compile it now. |
Yep, seems to have fixed it. My above test code on RP2040 works a second time after Ctrl-C, Ctrl-D, as well as a version of @relic-se's much simpler example of just creating a |
yes, @tannewt this is fixed for me now too. Fruit Jam sucessfully re-initializing DAC on I2C after soft resets (both from file save and ctrl-D). |
CircuitPython version and board name
Code/REPL
Behavior
after soft reset (ctrl-D, saving file, etc.)
Error initializing TLV320 DAC: I2C peripheral in use
Hard reset will fix it.Description
In the case of Larsio Paint Music, the program will still run, but there's no sound since the DAC hasn't been properly initialized.
Additional information
No response
The text was updated successfully, but these errors were encountered: