LPSPI Clocking
‎09-13-2022
12:35 PM
1,479 Views
mspenard603
Contributor IV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
4 Replies
‎09-15-2022
03:20 AM
1,471 Views
jay_heng
NXP Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
‎09-15-2022
08:53 AM
1,468 Views
mspenard603
Contributor IV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
And my functional clock freq is 80mhz. So I'm wonder how and why it is that my line freq is 40mhz.
‎09-15-2022
05:28 PM
1,463 Views
jay_heng
NXP Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
‎09-16-2022
04:55 AM
1,458 Views
mspenard603
Contributor IV
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
This is for a ATWINC1500 module. Their example code has a TRANSFER_BAUDRATE of 100000000U and a maximum SPI clock freq of 40mHz.