define __LL_RCC_CALC_MSI_FREQ(__MSISEL__, __MSIRANGE__)
时间: 2023-10-01 10:09:38 浏览: 74
define-CV.rar_The Process
`__LL_RCC_CALC_MSI_FREQ` is a macro defined in the STM32 HAL (Hardware Abstraction Layer) library. It is used to calculate the frequency of the MSI (Multi-Speed Internal) oscillator on STM32 microcontrollers based on the values of `MSISEL` and `MSIRANGE` passed as arguments.
The MSI oscillator is used as a source for various clock signals in the microcontroller, including the system clock. The frequency of the MSI oscillator can be adjusted by selecting different ranges and frequencies.
The `__LL_RCC_CALC_MSI_FREQ` macro takes two arguments:
- `__MSISEL__`: A value representing the selected MSI range (0-15).
- `__MSIRANGE__`: A value representing the selected MSI frequency range (0-3).
The macro calculates the frequency of the MSI oscillator using the following formula:
MSI frequency = (32768 Hz / (1 << (__MSIRANGE__ + 1))) * (__MSISEL__ + 1)
This formula takes into account the fact that the MSI oscillator is derived from a 32.768 kHz internal RC oscillator and that the frequency range is defined as a power of 2.
阅读全文