What are the details about the lpspiSrcClk field?

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

What are the details about the lpspiSrcClk field?

771 Views
dann_daggett
Contributor I

Hello All, this is my first newbie post so please correct me if I've put it in an incorrect forum.

In lpspi_master_driver.h it defines lpspi_master_config_t.  Most fields are self-explanatory except the lpspiSrcClk field.  My question is, what does that field mean?  What kind of value should be set there?  The example program has this set to .lpspiSrcClk = 48000000U,  Is that a magic number?  What does it mean?  Are there any detailed docs that discuss this?

typedef struct {
   uint32_t bitsPerSec; /*!< Baud rate in bits per second*/
   lpspi_which_pcs_t whichPcs; /*!< Selects which PCS to use */
   lpspi_signal_polarity_t pcsPolarity; /*!< PCS polarity */
   bool isPcsContinuous; /*!< Keeps PCS asserted until transfer complete */
   uint16_t bitcount; /*!< Number of bits/frame, minimum is 8-bits */
   uint32_t lpspiSrcClk; /*!< Module source clock */
   lpspi_clock_phase_t clkPhase; /*!< Selects which phase of clock to capture data */
   lpspi_sck_polarity_t clkPolarity; /*!< Selects clock polarity */
   bool lsbFirst; /*!< Option to transmit LSB first */
   lpspi_transfer_type transferType; /*!< Type of LPSPI transfer */
   uint8_t rxDMAChannel; /*!< Channel number for DMA rx channel. If DMA mode isn't used this field will be ignored. */
   uint8_t txDMAChannel; /*!< Channel number for DMA tx channel. If DMA mode isn't used this field will be ignored. */
   spi_callback_t callback; /*!< Select the callback to transfer complete */
   void *callbackParam; /*!< Select additional callback parameters if it's necessary */
} lpspi_master_config_t;

Thank you very much,

Dan

0 Kudos
2 Replies

632 Views
razva_tilimpea
NXP Employee
NXP Employee

Hi,

That number represent the frequency of the source clock which is connected to LPSPI. If you are using PEx it should automatically get that value from clock manager. The purpose of this frequency is to calculate based on it the dividers to get the right spi clock frequency.

Best regards,

Razvan

632 Views
dann_daggett
Contributor I

Thank you very much, that does now make sense.
Dan

0 Kudos