hi nxp
Now I use SPI1 and SPI2 of MPC5744P as master to connect to SPI slave device, the spi code as follow:
SPI1 code:
dspi_master_config_t dspi1_MasterInitConfig0 =
{
.bitsPerSec = 500000,
.pcsPolarity = DSPI_ACTIVE_HIGH,
.bitcount = 8,
.clkPhase = DSPI_CLOCK_PHASE_1ST_EDGE,
.clkPolarity = DSPI_ACTIVE_LOW,
.lsbFirst = false,
.transferType = DSPI_USING_INTERRUPTS,
.rxDMAChannel = 255U,
.txDMAChannel = 255U,
.txAdditionalDMAChannel = 255U,
.callback = NULL,
.callbackParam = NULL,
.continuousPCS = false,
.whichPCS = 0
};
/* SPI Slave Configurations */
dspi_slave_config_t dspi1_SlaveInitConfig0 =
{
.bitcount = 8,
.clkPhase = DSPI_CLOCK_PHASE_1ST_EDGE,
.clkPolarity = DSPI_ACTIVE_HIGH,
.transferType = DSPI_USING_INTERRUPTS,
.rxDMAChannel = 255U,
.txDMAChannel = 255U,
.callback = NULL,
.callbackParam = NULL
};
SPI2 code:
dspi_master_config_t dspi2_MasterInitConfig0 =
{
.bitsPerSec = 500000,
.pcsPolarity = DSPI_ACTIVE_HIGH,
.bitcount = 8,
.clkPhase = DSPI_CLOCK_PHASE_1ST_EDGE,
.clkPolarity = DSPI_ACTIVE_LOW,
.lsbFirst = false,
.transferType = DSPI_USING_INTERRUPTS,
.rxDMAChannel = 255U,
.txDMAChannel = 255U,
.txAdditionalDMAChannel = 255U,
.callback = NULL,
.callbackParam = NULL,
.continuousPCS = false,
.whichPCS = 0
};
/* SPI Slave Configurations */
dspi_slave_config_t dspi2_SlaveInitConfig0 =
{
.bitcount = 8,
.clkPhase = DSPI_CLOCK_PHASE_1ST_EDGE,
.clkPolarity = DSPI_ACTIVE_HIGH,
.transferType = DSPI_USING_INTERRUPTS,
.rxDMAChannel = 255U,
.txDMAChannel = 255U,
.callback = NULL,
.callbackParam = NULL
};
main.c
DSPI_MasterInit(SPI1_INSTANCE, &dspi1State, &dspi1_MasterInitConfig0);
DSPI_MasterInit(SPI2_INSTANCE, &dspi2State, &dspi2_MasterInitConfig0);
DSPI_MasterSetDelay(SPI1_INSTANCE, 1, 1, 1);
DSPI_MasterSetDelay(SPI2_INSTANCE, 1, 1, 1);
while(1)
{
DSPI_MasterTransfer(SPI1_INSTANCE, master_send1, master_receive1, NUMBER_OF_FRAMES);
DSPI_MasterTransfer(SPI2_INSTANCE, master_send2, master_receive2, NUMBER_OF_FRAMES);
}
The CS0,SCK and Sout of SPI1 are measured with oscilloscope, and all of them have waveform signals, But only Sout of SPI2 have waveform signal, CS0 and SCK of SPI2 is continuous height level, I confirmed the configuration of SPI2 is similar to SPI1, what's the problem?
Hi,
could you share the project?
Regards,
Lukas