spi clock comfiguration

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

spi clock comfiguration

295 Views
sandeep_c
Contributor I

hi eveyone i configured the LPSPI4 in rt1170 as below the baudarate which i had taken from example but

1) iam not getting how to calculate the baudrate 

2)as i configured below iam getting clock frequency 500khz but i need to increase spi clock frequency to 10mhz how can i do it

 

#define LPSPI_MASTER_CLK_FREQ (CLOCK_GetFreqFromObs(CCM_OBS_LPSPI4_CLK_ROOT))
PRINTF("\r\nSPI INTERFACE CALLED");
#if 1
uint32_t srcClock_Hz;
lpspi_master_config_t masterConfig;
masterConfig.baudRate =500000;
masterConfig.bitsPerFrame=8;
masterConfig.cpol=kLPSPI_ClockPolarityActiveHigh;
masterConfig.cpha = kLPSPI_ClockPhaseFirstEdge;
masterConfig.direction = kLPSPI_MsbFirst;
masterConfig.pcsToSckDelayInNanoSec=1000;
masterConfig.lastSckToPcsDelayInNanoSec=1000;
masterConfig.betweenTransferDelayInNanoSec=1000;
masterConfig.whichPcs = kLPSPI_Pcs1;
masterConfig.pinCfg = kLPSPI_SdiInSdoOut;
masterConfig.dataOutConfig=kLpspiDataOutRetained;
masterConfig.pcsActiveHighOrLow=kLPSPI_SdiInSdoOut;
srcClock_Hz = LPSPI_MASTER_CLK_FREQ;
LPSPI_MasterInit(LPSPI4, &masterConfig, srcClock_Hz);

i_MXRT1170Processor_0-1681454111692.png

 

0 Kudos
2 Replies

263 Views
nxpuser98
Contributor I

Did solve this? I currently have the same problem with 500 kHz SPI clock frequency although I configured 1 MHz.

0 Kudos

255 Views
sandeep_c
Contributor I
yes its solved
0 Kudos