how can i change lpspi serial clock frequency(sclk)

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

how can i change lpspi serial clock frequency(sclk)

350 Views
sandeep_c
Contributor I

hi i need to change sclk frequency lpspi of rt1170 as of now iam getting 500kz this i need to change to 10mhz can i do that? if yes how can i do that

1) srcClock_Hz=24mhz

  LPSPI_MasterInit(LPSPI4, &masterConfig, srcClock_Hz);

iam getting 500khz sclk even when case 2 also

1) srcClock_Hz=12mhz

  LPSPI_MasterInit(LPSPI4, &masterConfig, srcClock_Hz);

iam getting 500khz sclk 

 

0 Kudos
2 Replies

344 Views
kamilla_peixoto
Contributor II

You can use that struct and change all the parameters you need.


lpspi_master_config_t masterConfig = {
.bitsPerSec = 480000U,
.whichPcs = LPSPI_PCS0,
.pcsPolarity = LPSPI_ACTIVE_LOW,
.isPcsContinuous = true,
.bitcount = 8U,
.lpspiSrcClk = 48000000U,
.clkPhase = LPSPI_CLOCK_PHASE_1ST_EDGE,
.clkPolarity = LPSPI_SCK_ACTIVE_HIGH,
.lsbFirst = false,
.transferType = LPSPI_USING_INTERRUPTS,
};

0 Kudos

341 Views
sandeep_c
Contributor I
Thanks for the reply @kamilla_peixoto but i have below structure members only
/*! @brief LPSPI master configuration structure.*/
typedef struct _lpspi_master_config
{
uint32_t baudRate; /*!< Baud Rate for LPSPI. */
uint32_t bitsPerFrame; /*!< Bits per frame, minimum 8, maximum 4096.*/
lpspi_clock_polarity_t cpol; /*!< Clock polarity. */
lpspi_clock_phase_t cpha; /*!< Clock phase. */
lpspi_shift_direction_t direction; /*!< MSB or LSB data shift direction. */

uint32_t pcsToSckDelayInNanoSec; /*!< PCS to SCK delay time in nanoseconds, setting to 0 sets the minimum delay.
It sets the boundary value if out of range.*/
uint32_t lastSckToPcsDelayInNanoSec; /*!< Last SCK to PCS delay time in nanoseconds, setting to 0 sets the minimum
delay. It sets the boundary value if out of range.*/
uint32_t betweenTransferDelayInNanoSec; /*!< After the SCK delay time with nanoseconds, setting to 0 sets the
minimum delay. It sets the boundary value if out of range.*/

lpspi_which_pcs_t whichPcs; /*!< Desired Peripheral Chip Select (PCS). */
lpspi_pcs_polarity_config_t pcsActiveHighOrLow; /*!< Desired PCS active high or low */

lpspi_pin_config_t pinCfg; /*!< Configures which pins are used for input and output data
*during single bit transfers.*/

lpspi_data_out_config_t dataOutConfig; /*!< Configures if the output data is tristated
* between accesses (LPSPI_PCS is negated). */
} lpspi_master_config_t;
0 Kudos