Read 8 buffered ports at the same time

If you have a simple question and just want an answer.
User avatar
XCore Legend
Posts: 1913
Joined: Thu Jun 10, 2010 11:43 am

Post by mon2 »

Try the following and post your results:

Code: Select all

//port config:
           on tile[0] : clock clk = XS1_CLKBLK_1;
           on tile[0] : in port p_clk_in = XS1_PORT_1I;//using  external AD CLK
           on tile[0] : in port p_rd = XS1_PORT_1J;// DATA READY SIGNAL
           on tile[0] : in buffered port:32 chan_1 = XS1_PORT_1L;//DATA CHANNEL
           on tile[0] : in buffered port:32 chan_2 = XS1_PORT_1K;
           on tile[0] : in buffered port:32 chan_3 = XS1_PORT_1M;
           on tile[0] : in buffered port:32 chan_4 = XS1_PORT_1N;
           on tile[0] : in buffered port:32 chan_5 = XS1_PORT_1O;

void sample_1_3(unsigned char k)
                chan_1:> valdata1[k];
                chan_2:> valdata2[k];
                chan_3:> valdata3[k];

void sample_4_5(unsigned char k)
                chan_4:> valdata4[k];
                chan_5:> valdata5[k];

          //wait for data ready signal which last about 40ns. it's not enough.

                case p_rd  when  pinsneq(0):> cmd:
                on tile[0]:  sample_1_3(k);
                on tile[0]:  sample_4_5(k);

User avatar
XCore Expert
Posts: 573
Joined: Thu Nov 26, 2015 11:47 pm

Post by akp »

The data interface would work well with a multi-channel TDM slave implementation. lib_i2s doesn't have that at present to my knowledge (just master), but you could use slave I2S to get an idea how to do it. The I2S slave code could probably be modified to get the 8 x 1 channel rather than 8 x stereo that it's designed for now.