Skip to main content
YoussefElbattah
Associate II
Mar 1, 2024 9:33 PM UTC
Solved

SCKL frequency of SPI

Hello,

I have set the BR bit in CR1 to 0 with the expectation of obtaining an 8MHz clock frequency. However, I am encountering an actual frequency of approximately 1.042MHz. Does anyone have an explanation for this issue, or should I consider implementing any calibration procedure for the clock?

 

Best regards,

This topic has been closed for replies.
TDK
TDKBest answer
Mar 3, 2024 1:07 PM UTC

Default clock (MSI) frequency is 2.097 MHz. Half that is about 1.042 MHz. That is what you're seeing.

Unclear what the current state of this issue is. If you're trying to disable MSI, you will need to switch the system clock to HSI first. Not just turn HSI on, but actually switch the system clock to use it.

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

6 replies

STTwo-32
ST Technical Moderator
Mar 1, 2024 9:46 PM UTC

Hello @YoussefElbattah and welcome to the ST Community :smiling_face_with_smiling_eyes:.

Can you add more details about your use case (The MCU that you are using, the clock source of your SPI,...).

Best Regards.

STTwo-32 

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.
YoussefElbattah
Associate II
Mar 1, 2024 10:18 PM UTC

Hello,

Thank you, i'm using STM32L152RE and my clock source of SPI is HSI 16Mhz so if i divide by 2 i will get 8Mhz not 1Mhz.

Best Regards.

Youssef

STTwo-32
ST Technical Moderator
Mar 1, 2024 10:44 PM UTC

What are the values of the APB1 Prescaler, APB2 Prescaler and AHB Prescaler on the clock tree.

Best 

Regards

STTwo-32 

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.
TDK
TDKBest answer
Mar 3, 2024 1:07 PM UTC

Default clock (MSI) frequency is 2.097 MHz. Half that is about 1.042 MHz. That is what you're seeing.

Unclear what the current state of this issue is. If you're trying to disable MSI, you will need to switch the system clock to HSI first. Not just turn HSI on, but actually switch the system clock to use it.

"If you feel a post has answered your question, please click ""Accept as Solution""."
YoussefElbattah
Associate II
Mar 8, 2024 9:46 PM UTC

Thank you i have fixed the issue :grinning_face: