cancel
Showing results for 
Search instead for 
Did you mean: 

SCKL frequency of SPI

YoussefElbattah
Associate III

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,

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

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".

View solution in original post

6 REPLIES 6
STTwo-32
ST Employee

Hello @YoussefElbattah and welcome to the ST Community 😊.

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.

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

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.

I've discovered that the system clock used is MSI which has low frequency when attempting to set the HSION and reset MSION in the CR register of the RCC peripheral, I encountered an issue. While HSION is successfully set, the MSION doesn't reset. because in the datasheet it tels me that the MSION cannot reset if it is used a default system clock.

For the value of APB2, APB1 and AHB prescalers are 0.

By the way i'm not using Cubemx and HAL APIs.

Best Regards

 

TDK
Guru

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 III

Thank you i have fixed the issue 😀