lib_i2s slave error ?

If you have a simple question and just want an answer.
Oddworld
Member
Posts: 11
Joined: Tue Mar 03, 2015 10:57 am

lib_i2s slave error ?

Post by Oddworld »

Hi,

I am trying to adapt the lib_i2s to the need of my application, I want to use a 4-bit port instead of 4 1-bit ports.

when looking at i2s_slave_init_port, I discovered something strange :

static void i2s_slave_init_ports(out buffered port:32 p_dout[num_out], size_t num_out, in buffered port:32 p_din[num_in], size_t num_in, in port p_bclk, in buffered port:32 p_lrclk, clock bclk)
{
    set_clock_on(bclk);
    configure_clock_src(bclk, p_bclk);
    configure_out_port(p_lrclk, bclk, 1);
    
    for (size_t i = 0; i < num_out; i++)
        configure_out_port(p_dout, bclk, 0);
    for (size_t i = 0; i < num_in; i++)
        configure_in_port(p_din, bclk);
    
    start_clock(bclk);
}

The device is supposed to be a slave here so why lrclk is configured as an output ? Shouldn't it be  configure_in_port(p_lrclk, bclk); instead ?

I have always use the library as master so never tried this. Does anyone tried the slave component ? Does it works ?

Thanks

 

User avatar
Ross
Verified
XCore Legend
Posts: 1185
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

That looks like a bug to me. However, the port will get "turned around" on the first input so still functions. A bug never the less.. you won't want to be driving LR back at the DAC/ADC at any point.. Thanks.