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

Strange...

but AF setting is same, i tried on my H743 here, ext clk for SAI / I2S :

AScha3_1-1766524959552.png

 

 

AScha3_0-1766524904153.png

 

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

Can you try: using your 12.2 MHz osc as HSE bypass , master clock ?

This has to work.

Just adjust the clock tree...

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

Yes it is very strange I don’t understand why it’s not working. It gives you the option to use an external clock source, but when I configure and use an external clock it seems to ignore it. 

The waveform shown on the scope seems ok ? The edges are rounded but that’s due to the scope probe capacitance. I could adjust the screw on the probe but it will never have nice square edges. 

I can try connecting the oscillator to HSE for test purposes but I was running the system clock at 80MHz which I won’t achieve if the HSE is 12.288MHz 

The only other option is to go back to using the BT401 as the I2S master. But I had issues with this because at power up the BT402 I2S clocks were intermittent. And this caused my voice prompts to stutter. I would prefer not to have to rely on the BT401 to generate the I2S clocks as the voice prompts are safety critical, they must work correctly all the time. The audio from the BT401 is secondary. 

Ok, so :

- L433 can be master, BT401 can work as slave

- 12.288 oscillator should be the clock

 

-> we use the 12.288 oscillator as HSE bypass

- set PLL for core to ...12 /4 --- PLL x 50  /2 = 76.8 M for core

- set PLL for SAI ...12 /4 --- PLL x 16 /4 = 12.288   , set 48kHz audio

 

Then all should work, as you want it.

AScha3_0-1766570852961.png

AScha3_1-1766570886714.png

(here on H743 , should be almost same on your L433 )

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

This is turning into a nightmare, I dont understand why the SAI external clock wont work.

I tried configuring the clocks to use HSE like you suggested but get an error...

 

freeflyer_0-1766579930109.png

 

 

Come on...so set PLLM /4 -> /2 and the output divider /2 -> /4 , to respect, what are the constraints of the PLL , Cube is telling you.

This might be different on different chips...so just adjust it , to match it for your L433 .

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

Sorry AScha.3 I am just getting super frustrated with this, I've ploughed lots of work into this project and the firmware is 99% complete with all the functionality I require, but this last 1% (issue with Bluetooth playback) risks writing the whole project off.

The good news is that I managed to configure the clock to use the 12.288MHz oscillator as HSE and the SAI also runs from the oscillator....

 

freeflyer_0-1766583016552.png

 

The bad news is the issue with the bluetooth audio playback still exists, so after all that it seems the clock source (internal MSI RC or external oscillator) is not the issue.

So now I have to go back to square one and fix this issue with the bluetooth audio playback, but I don't know where to start.

I have reverted the BT401 back to being the I2S master and the bluetooth audio playback works, so the issue appears to be when the BT401 is an I2S slave but I don't know why.

I would prefer the BT401 to be a slave because:

 

1) It removes dependency from the BT401 as without the BT401 providing the I2S clocks the voice prompt audio will not work

2) The voice prompt audio is critical and must always work

3) I can save power by only powering up the BT401 when needed.  But I won't be able to do this if the BT401 is the master as the I2S clocks are needed for the voice prompts.  This means the BT401 will be powered and drawing around 20mA just to generate the I2S clocks for the voice prompts

 

The BT401 has firmware for I2S slave, but I don't know why it doesn't work.

Ok, so you got it working, as it should , the way i showed you.

>The BT401 has firmware for I2S slave, but I don't know why it doesn't work.

But you said, its working as slave....i tried explain the problem with "who is the master to control the transmission" , 

so test (i cannot...) : can you play some time from BT401 (as slave)  ?

And dont worry about noise at first 2 secs or so, starting a stream can always be a problem.

(If receiving works ok, the way would be: receive, but mute first seconds, until stream stable.)

If it cannot work really good in slave mode, we have to change the procedure .

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

I have attached a video of the playback issues I am having showing the oscilloscope capture of the I2S bit clock (CH1 yellow) and the I2S LR clock (CH2 cyan) generated by the STM32 (the clocks appear to be stable and voice prompts which also use the same I2S clocks play fine). To explain the sequence of events in the video….

1. The STM32 is powered up and I2S clocks are started, the battery voice prompt is called and when the battery voice prompt finishes the BT401 is powered up with 5V via a load switch (TPS22918).

2. The voice prompt begins counting upwards (1, 2, 3 etc) and I press the play button on the phone. This is when you hear the crackling noise, the first of which happens at ~43 seconds into the video.

3. Then again at ~53 seconds, then at ~1m 04s, then music finally plays.

4. I then stop the music (press pause on the phone) at ~1m 13s.

5. Then I try to play again at ~1m 23s but it fails, so I try again at ~1m 33s but it fails.

6. After this you will see the phone in the video and the failed playback attempts.

7. On the final attempt, the audio plays from the phone speaker and the BT401 just plays a high pitch buzz.

Hmm...you didnt write: is this BT as slave ? or master? and L433 clock from..?

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