LPSPI Clocking

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPSPI Clocking

788 Views
mspenard603
Contributor IV

Why is it that whatever clock freq I configure the wire frequency I see is half that? I only ever see the CCR's PreScaler set to 0 as well.

 

srcClock_Hz = CLOCK_GetFreq(kCLOCK_Usb1PllPfd1Clk) / (CLOCK_GetDiv(kCLOCK_LpspiDiv) + 1U); //80 mHz
LPSPI_MasterInit(LPSPI1, &masterConfig, srcClock_Hz);

 

Yet I see 40mHz on my scope.

0 Kudos
4 Replies

780 Views
jay_heng
NXP Employee
NXP Employee

srcClock_Hz is just LPSPI module functional clock, i believe what you mean is masterConfig.baudRate

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

LPSPI_MasterGetDefaultConfig(&masterConfig);
masterConfig.baudRate = TRANSFER_BAUDRATE;
masterConfig.whichPcs = EXAMPLE_LPSPI_MASTER_PCS_FOR_INIT;

srcClock_Hz = (CLOCK_GetFreq(kCLOCK_Usb1PllPfd0Clk) / (EXAMPLE_LPSPI_CLOCK_SOURCE_DIVIDER + 1U));
LPSPI_MasterInit(EXAMPLE_LPSPI_MASTER_BASEADDR, &masterConfig, srcClock_Hz);

 

0 Kudos

777 Views
mspenard603
Contributor IV
Well, my baud rate is: #define TRANSFER_BAUDRATE 100000000U
And my functional clock freq is 80mhz. So I'm wonder how and why it is that my line freq is 40mhz.
0 Kudos

772 Views
jay_heng
NXP Employee
NXP Employee

You want to set TRANSFER_BAUDRATE to 100MHz, even greater than functional clock 80MHz? it should be invalid case, and there will be roll-back issue in LPSPI driver

0 Kudos

767 Views
mspenard603
Contributor IV
There is a 1 to 1 correspondence between TRANSFER_BAUDRATE and functional clock frequency?

This is for a ATWINC1500 module. Their example code has a TRANSFER_BAUDRATE of 100000000U and a maximum SPI clock freq of 40mHz.
0 Kudos