Hi, Riccardo,
I think you should configure the SPIx_MCR[PCSIS] so that the SPI knows the PCSx logic(low or high) when it transfers data.
In SDK, pls try to set the line:
typedef enum _dspi_pcs_polarity_config
{
kDSPI_PcsActiveHigh = 0U, /*!< Pcs Active High (idles low). */
kDSPI_PcsActiveLow = 1U /*!< Pcs Active Low (idles high). */
} dspi_pcs_polarity_config_t;
masterConfig.whichPcs = EXAMPLE_DSPI_MASTER_PCS_FOR_INIT;
masterConfig.pcsActiveHighOrLow = kDSPI_PcsActiveLow;
This is the code to initialize the PCSIS bits:
void DSPI_MasterInit(SPI_Type *base, const dspi_master_config_t *masterConfig, uint32_t srcClock_Hz)
{
uint32_t temp;
/* enable DSPI clock */
CLOCK_EnableClock(s_dspiClock[DSPI_GetInstance(base)]);
DSPI_Enable(base, true);
DSPI_StopTransfer(base);
DSPI_SetMasterSlaveMode(base, kDSPI_Master);
temp = base->MCR & (~(SPI_MCR_CONT_SCKE_MASK | SPI_MCR_MTFE_MASK | SPI_MCR_ROOE_MASK | SPI_MCR_SMPL_PT_MASK |
SPI_MCR_DIS_TXF_MASK | SPI_MCR_DIS_RXF_MASK));
base->MCR = temp | SPI_MCR_CONT_SCKE(masterConfig->enableContinuousSCK) |
SPI_MCR_MTFE(masterConfig->enableModifiedTimingFormat) |
SPI_MCR_ROOE(masterConfig->enableRxFifoOverWrite) | SPI_MCR_SMPL_PT(masterConfig->samplePoint) |
SPI_MCR_DIS_TXF(false) | SPI_MCR_DIS_RXF(false);
//////// Rong write: PLS refer to the initialization line
DSPI_SetOnePcsPolarity(base, masterConfig->whichPcs, masterConfig->pcsActiveHighOrLow);
/////////////////////////////////////////////////////////////////////////
Hope it can help you
BR
Xiangjun Rong