How to send 32-bit data when DSPI is in master mode?Are there any example code or configuration advice?(I want to use MPC5634 to drive TLE82453)
Solved! Go to Solution.
Use two 16-bit frames. First PUSH command will be configured with CONT=1, second with CONT=0. This way CS stays asserted between 16-bit frames and it acts as one 32-bit data frame.
I can offer you an example code showing SPI communication with external flash memory S25FL129P. Used device was MPC5676R that is MCU similar to MPC5634M having compatible DSPI module:
Use two 16-bit frames. First PUSH command will be configured with CONT=1, second with CONT=0. This way CS stays asserted between 16-bit frames and it acts as one 32-bit data frame.
I can offer you an example code showing SPI communication with external flash memory S25FL129P. Used device was MPC5676R that is MCU similar to MPC5634M having compatible DSPI module:
Hi, davidtosenovjan:
I refer to your advice to config DSPI(CONT = 1).Now,
the PCS signal remains asserted for the duration of the two transfers.
;But SCK signal inserted Tcsc and Tasc.
Hi davidtosenovjan:
I refer to the example you provided to write the following code,but it didn't work.I have no idea to modify.Are there any advice you can provided.
void initDSPI_B(void) {
DSPI_B.MCR.R = 0x80010001; /* Configure DSPI_B as Master */
DSPI_B.CTAR[0].R = 0x700C0021; /* Configure CTAR0 */
DSPI_B.MCR.B.HALT = 0x0; /* Exit HALT mode: go from STOPPED to RUNNING state*/
SIU.PCR[102].R = 0x060C; /* MPC555x: Config pad as DSPI_B SCK Output */
SIU.PCR[103].R = 0x050C; /* MPC555x: Config pad as DSPI_B SIN input */
SIU.PCR[104].R = 0x060C; /* MPC555x: Config pad as DSPI_B SOUT output*/
SIU.PCR[105].R = 0x060C; /* MPC555x: Config pad as GPIO high output SPI_CS */
SIU.PCR[109].R = 0x0300; /* MPC555x: Config pad as GPIO high output RESET_MCU*/
SIU.PCR[106].R = 0x0300; /* MPC555x: Config pad as GPIO high output ENABLE_MCU*/
SIU.PCR[110].R = 0x0100; /* MPC555x: Config pad as GPIO Input FAULT_MCU*/
SIU.GPDO[106].B.PDO = 1;
SIU.GPDO[109].B.PDO = 1;
}
int main(void)
{
initSysclk();
initDSPI_B();
xcptn_xmpl (); /* Configure and Enable Interrupts */
CAN_A_init();
init_PIT_RTI();
DSPI_B.SR.R= 0x10000000;
DSPI_B.PUSHR.R = 0x80018300;//78020000;
while(!(DSPI_B.SR.B.RFDF)){}
dummy_var = (uint8_t)(DSPI_B.POPR.R);
DSPI_B.SR.R = 0x80020000;
DSPI_B.PUSHR.R = 0x08011040;
while(!(DSPI_B.SR.B.RFDF)){}
dummy_var = (uint8_t)(DSPI_B.POPR.R);
DSPI_B.SR.R = 0x80020000;
DSPI_B.PUSHR.R = 0x8001A860;
while(!(DSPI_B.SR.B.RFDF)){}
dummy_var = (uint8_t)(DSPI_B.POPR.R);
DSPI_B.PUSHR.R = 0x080100FA; //1KHz
while(!(DSPI_B.SR.B.RFDF)){}
dummy_var = (uint8_t)(DSPI_B.POPR.R);
DSPI_B.SR.R = 0x80020000;
DSPI_B.PUSHR.R = 0x80009080; //setpoint
while(!(DSPI_B.SR.B.RFDF)){}
dummy_var = (uint8_t)(DSPI_B.POPR.R);
DSPI_B.PUSHR.R = 0x080003FF;
while(!(DSPI_B.SR.B.RFDF)){}
dummy_var = (uint8_t)(DSPI_B.POPR.R);
DSPI_B.SR.R = 0x80020000;
/* Loop forever */
for(;;)
{
}
}
Okay,Thanks for your reply