This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS SPI frequency calculation

I am using IMXRT1050-EVKB board. I have loaded CMSIS SPI example code from the Pack Installer

/* Select USB1 PLL PFD0 (720 MHz) as lpspi clock source */
#define EXAMPLE_LPSPI_CLOCK_SOURCE_SELECT (1U)

/* Clock divider for master lpspi clock source */
#define EXAMPLE_LPSPI_CLOCK_SOURCE_DIVIDER (7U)

#define EXAMPLE_LPSPI_CLOCK_FREQ (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (EXAMPLE_LPSPI_CLOCK_SOURCE_DIVIDER + 1U))

#define TRANSFER_BAUDRATE 500000U /* Transfer baudrate - 500k */

The SPI frequency for these parameters gives me around 0.5MHz at times and around 16.3MHz some time. I get the same frequency every time I change the value of either TRANSFER_BAUDRATE(increasing from 500k to 1000k/2000k) or EXAMPLE_LPSPI_CLOCK_SOURCE_DIVIDER or even both. When I disconnect my board from the power source for a couple of minutes, then I can see the change in frequency. But again, this change doesn't happen every time I power off the board. Also I am not sure how the frequency is been calculated with the above mentioned parameters. I am using oscilloscope to observe the SCK frequency. Any help regarding the frequency calculation would be much appreciated.

Regards,
Snehal