Input MCLK = 24MHz.
Output BCLK = 4.8MHz.
Output LRCK = 48kHz.
i.e. OSR = 500 (i.e. 24MHz / 48kHz).
One channel = 50*BCLK.
I'm not sure if this requirement can be implemented. Now I only can get a set of I2S signals below:
Input MCLK = 24MHz.
Output BCLK = 2.4MHz.
Output LRCK = 48kHz.
i.e. OSR = 500 (i.e. 24MHz / 48kHz).
One channel = 25*BCLK.
The program below to get this set of I2S signals:
Code: Select all
on tile[0] : out buffered port:32 p_dout[2] = {XS1_PORT_1M, XS1_PORT_1N};
on tile[0] : in buffered port:32 p_din[2] = {XS1_PORT_1I, XS1_PORT_1J};
on tile[0] : port p_mclk = XS1_PORT_1F;
on tile[0] : out buffered port:32 p_bclk = XS1_PORT_1H;
on tile[0] : out buffered port:32 p_lrck = XS1_PORT_1G;
on tile[0] : port p_ctrl = XS1_PORT_8C;
on tile[0] : clock mclk = XS1_CLKBLK_2;
on tile[0] : clock bclk = XS1_CLKBLK_3;
{
configure_clock_src(mclk, p_mclk);
configure_clock_src_divide(bclk, p_mclk, 5); // 24MHz / 10 = 2.4MHz
configure_port_clock_output(p_bclk, bclk);
configure_out_port_no_ready(p_lrck, bclk, 0);
configure_out_port_no_ready(p_dout[0], bclk, 0);
start_clock(mclk);
start_clock(bclk);
unsigned Lch_sample = 0xAC6B4D;
unsigned Rch_sample = 0x1296479;
while(1)
{
partout(p_lrck, 25, 0x01000000);
partout(p_dout[0], 25, Lch_sample);
partout(p_lrck, 25, 0x00FFFFFF);
partout(p_dout[0], 25, Rch_sample);
}
}
1. Am I doing the right things to output such I2S signals?
2. How can I output a 4.8MHz clock from a 24MHz clock?
Any idea will be appreciated!