Adam Pitak

K70 SAI transmitter not send data :(

Discussion created by Adam Pitak on Jan 30, 2013
Latest reply on Jan 24, 2014 by Gerardo Valdovinos

Hello

I m trying configure SAI0 as regular transmitter, everything working fine but on output I2S0_TXD0 I have no data

MCLK, I2S0_TX_FS, I2S0_TX_BCLK work good.

 

I push data into I2S0_TDR0 and in interrupt from SAI check FRF bit from TCSR register

 

Thank You for answers and help.

here is my config:

 

 

 





SIM_SCGC6 |= SIM_SCGC6_SAI0_MASK;


// enable I2S module



   



    I2S0_TCR1 |= I2S_TCR1_TFW(3);



//watermark level



   



    I2S0_TCR2 |= I2S_TCR2_MSEL(1) |



//MCLK select from CLKGEN






I2S_TCR2_BCD_MASK |



// bit clock direction






I2S_TCR2_DIV(0);



// from MCLK divider to BCLK (max 256)



   



    I2S0_TCR3 |= I2S_TCR3_TCE(2);



// Transmit channel enable; TDR0=2; TDR1=1 ????



   



    I2S0_TCR4 |=  I2S_TCR4_FRSZ(1) |


//number of words in frame






I2S_TCR4_SYWD(31) |



//number bits in frame






I2S_TCR4_MF_MASK |



//frame sync polarity MSB/LSB first






I2S_TCR4_FSE_MASK |



//Frame sync early: log.0 Justified, log.1 I2S






I2S_TCR4_FSD_MASK;



//frame sync direction



   



    I2S0_TCR5 |= I2S_TCR5_WNW(31) |


// number of bits in next word






I2S_TCR5_W0W(31) |



// number of bits in first word






I2S_TCR5_FBT(31);



//first bit shiffed



   



    I2S0_MCR |= I2S_MCR_MOE_MASK |



//MCLK generated internally






I2S_MCR_MICS(3);



//MCLK input clock select from PLL=120 MHz



   



    I2S0_MDR |= I2S_MDR_DIVIDE(999)|


//2722





(fract + 1)






I2S_MDR_FRACT(6);



//
MCLKout = MCLKin * -------------














//





(divide +1)



   



    PORTE_PCR6 |= PORT_PCR_MUX(0x04); 

// configure port for MCLK output


    PORTE_PCR10 |= PORT_PCR_MUX(0x04);

// configure port for I2S0_TXD0


    PORTE_PCR11 |= PORT_PCR_MUX(0x04);

// configure port for I2S0_TX_FS


    PORTE_PCR12 |= PORT_PCR_MUX(0x04);

// configure port for I2S0_TX_BCLK



   



    I2S0_TCSR |= I2S_TCSR_TE_MASK |



//enable transmitter






I2S_TCSR_STOPE_MASK |


//stop enable






I2S_TCSR_FR_MASK |



//reset fifo pointers






I2S_TCSR_FRIE_MASK ;


//enable interrupt from watermark




Outcomes