Hi,
Thank you for sharing more information, from the piece of code you have shared and the analyzer image, it seems that the output you're seeing after 0x9f are random stuff because you have set a datasize of 4.
masterXfer.dataSize = 4;
Since only the first byte have a value the other 3 bytes will be dummy data, and you could see this in the ecspi driver located at: SDK_2_11_0_EVK-MIMX8MM\devices\MIMX8MM6\drivers\fsl_ecspi.c
while (xfer->dataSize > 0UL)
{
/* ECSPI will transmit and receive at the same time, if txData is NULL,
* instance will transmit dummy data, the dummy data can be set by user.
* if rxData is NULL, data will be read from RX FIFO buffer, but the
* data will be ignored by driver.
* Note that, txData and rxData cannot be both NULL.
*/
state = ECSPI_WriteBlocking(base, xfer->txData, dataCounts);
if (kStatus_Success != state)
{
return state;
}
if (NULL != xfer->txData)
{
xfer->txData += dataCounts;
}
state = ECSPI_ReadBlocking(base, xfer->rxData, dataCounts);
if (kStatus_Success != state)
{
return state;
}
if (NULL != xfer->rxData)
{
xfer->rxData += dataCounts;
}
xfer->dataSize -= dataCounts;
}
Also, if you need the SS to stay active, you'll need to have SS_CTL clear and after looking into the driver code this is not supported, but that does not mean it could not be added on your side, you may refer to the reference manual for more information on this:
AldoG_1-1685480024190.png
Please refer to the fsl_ecspi.c function:
void ECSPI_SetChannelConfig(ECSPI_Type *base, ecspi_channel_source_t channel, const ecspi_channel_config_t *config)
Best regards,
Aldo.