I2S (IIS) MCLK settings

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User10696
Level 4
Level 4
First solution authored
I am trying to use an USIC in the I2S mode. I cannot seem to change the frequency of the MCLK. It is always 120MHz. The XMC_I2S_CH_SetBaudrate() function only allows the SCLK frequency to be changed. The documentation shows the MCLK coming from the Baudrate generator, but there does not seem to be any registers to set the frequency. I need a MCLK frequency between 10 - 20 MHz. How can I set MCLK to this frequency?

I have looked for I2S examples in DAVE but there does not seem to be anything available.
0 Likes
2 Replies
chismo
Employee
Employee
First like received
Hello,

The MCLK frequency is always a factor of PDIV+1 over the SCLK. PDIV refers to the register bit field in the USIC channel's BRG register.

In this case, probably the baud rate settings need to be manually configured via direct register access.
What is the SCLK frequency that you are using?

Regards,
Min Wei
0 Likes
User10696
Level 4
Level 4
First solution authored
I have solved the MCLK problem. It was a hardware problem, the EXTCLK pin was being used instead of the MCLK pin, that is why I could not change the frequency with the baud rate generator. I have now set the required frequencies for the MCLK, SCLK and LRCLK by setting the baud rate registers, as the XMC library does not allow the frequencies to be set separately.

I now have another problem. No data is sent. I can fill the FIFO by writing to the IN[0] and IN[16] registers, but the FIFO just remains full and no data is transmitted. The USIC is set to I2S Master mode and as far as I can see the registers are set correctly. PCR.DTEN=1 and TCSR.TDEN=1 are set. What else needs to be set to start the transmission?

I am using the other USICs as UARTs and I2C and there the data is transmitted as soon as the FIFO is filled. With I2S I understand it is synchronized to the WA signal, but what do I need to do to start the transmission. I cannot find any information in the reference manual.
0 Likes