usb audio with internal mclk
Posted: Thu Apr 09, 2020 5:13 am
Hi, i would like to start testing the USB audio framework on the xCORE-200 explorer board to make use of the IO headers to connect some DAC boards with I2S input.
Of course, the framework does not support doing audio without an external clock source, which is normal, but for my purpose i don't mind losing samples and having distortion for this phase of development.
i based my application off of the mc-audio configuration for the framework since it also has a xcore-200 chip. so far i have modified the mclk and mclk2 (for the 2 tiles) generation code in main.xc and audio.xc in this manner:
So the clock is now taken from a clock block and output to p_mclk_in, rather than input from the pin and used as a source to generate the internal mclk. The other I2S signals need p_mclk_in and clk_audio_mclk to be generated and with this change they should still have working clocks on p_mclk_in and clk_audio_mclk. Of course mclk and mclk2 are generated separately on 2 tiles, rather than input from the same external signal, which is why i expect to lose samples once in a while.
I haven't looked into setting mclk for different sampling rates but i think it should work.
So i think this test setup should work, but im looking for a general validation.
Thank you!
Of course, the framework does not support doing audio without an external clock source, which is normal, but for my purpose i don't mind losing samples and having distortion for this phase of development.
i based my application off of the mc-audio configuration for the framework since it also has a xcore-200 chip. so far i have modified the mclk and mclk2 (for the 2 tiles) generation code in main.xc and audio.xc in this manner:
Code: Select all
//modified
configure_clock_rate(clk_audio_mclk2, 100, 8);
configure_port_clock_output(p_mclk_in2, clk_audio_mclk2);
set_port_clock(p_for_mclk_count, clk_audio_mclk2);
start_clock(clk_audio_mclk2);
//default
//set_clock_src(clk_audio_mclk2, p_mclk_in2);
//set_port_clock(p_for_mclk_count, clk_audio_mclk2);
//start_clock(clk_audio_mclk2);
I haven't looked into setting mclk for different sampling rates but i think it should work.
So i think this test setup should work, but im looking for a general validation.
Thank you!