0
\$\begingroup\$

I would like to interface an ATSAMS70 with a CS42L51 but this is my first time doing so. The connection would be this:

MCLK - PCK2 SCLK - TK LRCK - TF SDIN - TD SDOUT - RD

The thing is about the frequency I will work with. I will be using USB on the ATSAM, so I chose a 12 MHz crystal. I would like to have a sample rate of 44.1 KHz but according to the datasheet I would need a MCLK of 11.2896 MHZ using the 256 scaler.

Would that be a problem? I mean, I would not be matching the 44.1 KHz but I think that's not that bad.

\$\endgroup\$
  • \$\begingroup\$ Next time add additional information to the original question and comment on the answer which you want edited. If you generate the sound inside the microcontroller, then the sample rate is of no importance apart from Nyquist criteria and general signal generation things, so sure, just drive it with the 12MHz crystal. \$\endgroup\$ – Linards Sep 19 '15 at 19:43
  • \$\begingroup\$ Ah ok, sorry about that. So, MCLK will be 12 MHz and the codec will have to use one scaler, let's say 256, and I will get 46875 Hz which will only let me generate tones of max freq of 23.437 KHz. That's not an issue for me. I just want to be sure about the settings. And SCLK will be TK at 46875Hz imposed by the codec and LRCK will have to be the TF from the ATSAM. Is that right? \$\endgroup\$ – the_moon Sep 23 '15 at 19:13
  • \$\begingroup\$ Yes, that seems correct. \$\endgroup\$ – Linards Sep 23 '15 at 20:13
  • \$\begingroup\$ Hey @Linards, how about routing the PCK line of 12 MHz. Do I need to take particular care of something? It wouldn't be longer than 25 mm and wouldn't have vias as I have placed the ICs... \$\endgroup\$ – the_moon Oct 10 '15 at 15:15
  • \$\begingroup\$ Not really, just make it as short as possible and watch out for adjacent wires which could catch unwanted cross-talk, as well as properly surrounding it with a ground plane. Just to get a feel for the crosstalk effects - eeweb.com/toolbox/microstrip-crosstalk Good luck! \$\endgroup\$ – Linards Oct 11 '15 at 19:13
1
\$\begingroup\$

Whether that's a problem depends on how you use the audio.

If the sampling rate of the original audio is 44.1kHz, but you use 12M/256=46.88kHz, the audio will be higher pitched by around 6%. You can check how this would sound via Audacity or similiar software.

However I don't really get why you think that the I2S would be tied to the processors frequency with a 2^N divider - you could just use a timer with a divider closer to the needed value and since the main clock for a S70 is up to 300MHz, you could just divide that by 6803 by using a timer and get a 44.098kHz sampling rate, which has an error of only ~0.005%.

\$\endgroup\$
0
\$\begingroup\$

I thought I had to send 12MHz to MCLK and set 256 in the codec in order for it to get the 44.1 Khz signal from tk. Isnt it hoy it works? I am going to generate sounds in the S7 and I will only send it to the codec to be played on the headphones...

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.