cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to source a 12.288MHz clock for STM32L433

freeflyer
Senior III

 

I am trying to source a 12.288MHz clock for an STM32L433 but having difficulties finding something.

The clock is required for I2S playback with a bluetooth receiver (BT401).

I have tried using the internal MSI RC to generate the 12.288MHz clock for SAI,  but the BT401 is misbehaving so it might be because the MSI RC clock has too much jitter.

I was wondering if a ASFL1-12.288MHZ-EC-T would be suitable for the clock source for the SAI external clock input....

https://uk.rs-online.com/web/p/crystal-oscillators/2403583

Below is the setup... 

 

freeflyer_0-1766340884039.png

 

The I2S amplifier (MAX98357A) seems to work fine with the 12.288MHz clock generated by the internal MSI RC and PLL.

 

But the BT401 either requires multiple attempts to start playing and sometimes plays just a screeching sound for a few seconds then stops.  So I need to rule out whether the issue is caused by clock jitter by trying a more accurate clock source.

 

I am currently using the STM32L433 Nucleo board which has a footprint for an external HSE crystal, but I cannot find a crystal for that footpring with a 12.288MHz frequency.

 

The ASFL1-12.288MHZ-EC-T seems to be an all in one device, you just provide power and it generates the output clock.  So its not like a crystal which needs a special drive circuit ?

 

I have read the application note AN2867 Recommended resonators for STM32 MCUs/MPUs, but its complicated and just confused me.

55 REPLIES 55

Your scoped image itle is MASTER, are you sure slave use same config. Plus you show MCLK on scope, then BT401 output it on some pin? Exist this signal in slave mode too? Or in slave mode is same pin changed to input and require MCLK from outside BT401 ? In normal audio systems all parts use one sync clock.

mƎALLEm
ST Employee

Hello @freeflyer ,

Regarding this statement:


@freeflyer wrote:

The ASFL1-12.288MHZ-EC-T seems to be an all in one device, you just provide power and it generates the output clock.  So its not like a crystal which needs a special drive circuit ?

I have read the application note AN2867 Recommended resonators for STM32 MCUs/MPUs, but its complicated and just confused me.


ASFL1-12.288MHZ-EC-T is a crystal oscillator (XO) according to its datasheet: while AN2867 is treating the case of crystals (XTAL) and resonators.

In other hand, if AN2867 looks complicated, I suggest to refer to this article: How to select a compatible crystal and load capacitors for STM32 with layout guidelines, a simplified version of that application note ;)

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Its probably confusing as I am showing scope captures of when the BT401 is a master and also a slave.

The scope capture you are referring to (titled MASTER) is in fact when the BT401 was the master and the STM32 was the slave.  In this configuration, the MCLK is generated by the BT401 but is not used by the STM32 or the amp (its just captured on the scope for reference).

But I have since changed the configuration for the BT401 to be the slave, which is when I started having isssues with playback with the BT401. When the BT401 is in slave mode, it only ouputs data on the SD pin.  But to do this it needs a BCLK and LRCLK, which is provided by the STM32.  MCLK is not needed by the BT401 in slave mode, it only needs BCLK and LRCLK.

 

 

Yes I have already done this, I tried to feed the 12.288 MHz from the osillator into the SAI EXTCLOCK pin but it did not work.  So instead I fed it into the HSE pin and it worked, but I still had the same issues with the BT401 playback.  So I concluded that the issue is not due to clock drift/jitter of the MSI, because the issue still occurs when I use the oscillator


@MM..1 wrote:

In normal audio systems all parts use one sync clock.


This is a concern and I'm now not sure whether AScha.3 solution will work, because there will be a clock from the BT401 (as a master) and a clock for the STM32 sending the audio to the amp (as a master)

freeflyer_0-1766783976137.png

If only the BT401 behaved as a slave, eveything would be working and I would not have all this grief.

I did briefly try this configuration, but the voice prompts have left over data when the finish so its broken and I need to fix it, though I am now unsure whether this configuration will actually work due to the two difference clock sources.


@freeflyer wrote:

  MCLK is not needed by the BT401 in slave mode, it only needs BCLK and LRCLK.


Show doc where is this defined.

IMG_3889.jpeg

I have also confirmed this with my contact in china who supplies the boards/chips/firmware 

freeflyer
Senior III

Yes I have already done this, I tried to feed the 12.288 MHz from the osillator into the SAI EXTCLOCK pin but it did not work.  So instead I fed it into the HSE pin and it worked, but I still had the same issues with the BT401 playback.  So I concluded that the issue is not due to clock drift/jitter of the MSI, because the issue still occurs when I use the oscillato

Something like this is the BT ?

AScha3_0-1766830600606.png

For doing it like i supposed ->


freeflyer_0-1766783976137.png

If only the BT401 behaved as a slave, eveything would be working and I would not have all this grief.

I did briefly try this configuration, but the voice prompts have left over data when the finish so its broken and I need to fix it, though I am now unsure whether this configuration will actually work due to the two difference clock sources.

++++++++++++++++++++++++++++++++++++

Callbacks ...only the transmit are to handle, as we want play audio. At first .

The receive callbacks...forget , for now. BT receive will run , but we dont use it.

Except, later, if it looks "ok" , then we copy in the (transmit) callbacks not zeros for silence, or "voice" for info, but also then one of the input buffers , to "copy" the input from BT to the play buffer.

(Synchronisation is at first not important, we do it later. Get it working at first, even if BT audio might have some dropouts...or else, not important now. )

We create two independent streams : the important, L433 is master, to play to the dac.

The second, from BT , might run...musik, or not...silence. But output always possible, and voice clear.


You should set the (circ.) buffers for the input and output streams to same size, maybe 2x (2x 2K ),

so copy (in output callbacks) from input to output buffer is easy, because same size.

And yes, the two streams are fully independent, but as both run 48k sample rate, no big problem.

Get this working first, then i explain, how to do some simple synchronization for the BT audio. 

If you feel a post has answered your question, please click "Accept as Solution".

I dont see one word about MCLK not required...