Hello me agan
I have a remarkable fix and question.
That's the code for the initialization of the DSPI
static bool MCP23S17_DspiInit(void)
{
dspi_master_config_t masterConfig;
uint32_t srcClock_Hz;
CLOCK_EnableClock( kCLOCK_Spi0 );
DSPI_Deinit( MCP23S17_DSPI_BASE );
DSPI_MasterGetDefaultConfig(&masterConfig);
masterConfig.whichCtar = MCP23S17_DSPI_CTAR;
masterConfig.ctarConfig.baudRate = MCP23S17_SPI_BAUDRATE;
masterConfig.ctarConfig.bitsPerFrame = MCP23S17_SPI_BITS_PER_FRAME;
masterConfig.ctarConfig.cpol = MCP23S17_SPI_CPOL;
masterConfig.ctarConfig.cpha = MCP23S17_SPI_CPHA;
masterConfig.ctarConfig.direction = MCP23S17_SPI_SHIFT_DIR;
masterConfig.ctarConfig.pcsToSckDelayInNanoSec = MCP23S17_DELAY_NS;
masterConfig.ctarConfig.lastSckToPcsDelayInNanoSec = MCP23S17_DELAY_NS;
masterConfig.ctarConfig.betweenTransferDelayInNanoSec = MCP23S17_DELAY_NS;
/* Default PCS for init; actual PCS is chosen via configFlags later */
masterConfig.whichPcs = MCP23S17_DSPI_PCS0;
masterConfig.pcsActiveHighOrLow = kDSPI_PcsActiveLow;
masterConfig.enableContinuousSCK = false;
masterConfig.enableRxFifoOverWrite = false;
masterConfig.enableModifiedTimingFormat = false;
masterConfig.samplePoint = kDSPI_SckToSin0Clock;
srcClock_Hz = MCP23S17_DSPI_CLK_FREQ;
if (srcClock_Hz == 0U)
{
return false;
}
DSPI_MasterInit(MCP23S17_DSPI_BASE, &masterConfig, srcClock_Hz);
SPI0->MCR |= (0x003F0000);
return true;
}
The surprise here is the line
SPI0->MCR |= (0x003F0000);
needs to be there .. After the inizialization despite the explicit setting to have a low active CS the CS is always active high. But the procedure is the same in the SDK. So
explain me what is wrong.
Thank You
Pietro