Hi all TI experts,
I attempted to use MCSPI to read and write to a flash peripheral, but I encountered an issue. When I need to read or write to address 0x000000 of this flash, I first send a read command. Using the Logic Analyzer (LA), I can see that the command is correctly issued. However, when I subsequently send the address 0x00 0x00 0x00, I notice that the MCSPI does not respond at all.
Here is the part where I initialize the MCSPI:
uint32_t chCtrlRegVal, chConfRegVal;
panel_flash_chNum = gConfigMcspi0ChCfg[0U].chNum;
panel_flash_baseAddr = MCSPI_getBaseAddr(gMcspiHandle[CONFIG_MCSPI0]);
dataWidth = 8;
MCSPI_setDataWidth(panel_flash_baseAddr, panel_flash_chNum, dataWidth);
MCSPI_enableTxFIFO(panel_flash_baseAddr, panel_flash_chNum, MCSPI_TX_FIFO_ENABLE);
MCSPI_enableRxFIFO(panel_flash_baseAddr, panel_flash_chNum, MCSPI_RX_FIFO_ENABLE);
chCtrlRegVal = MCSPI_readChCtrlReg(panel_flash_baseAddr, panel_flash_chNum);
gChEnableRegVal = chCtrlRegVal | CSL_MCSPI_CH0CTRL_EN_MASK;
gChDisableRegVal = chCtrlRegVal & (~CSL_MCSPI_CH0CTRL_EN_MASK);
chConfRegVal = MCSPI_readChConf(panel_flash_baseAddr, panel_flash_chNum);
gCsAssertRegVal = chConfRegVal | CSL_MCSPI_CH0CONF_FORCE_MASK;
gCsDeAssertRegVal = chConfRegVal & (~CSL_MCSPI_CH0CONF_FORCE_MASK);
bitRate = gConfigMcspi0ChCfg[0U].bitRate;
Here is the part where MCSPI sends bytes:
uint8_t ret = 0;
vTaskDelay(1);
for(int i=0;i<len;i++)
{
if(0 != (MCSPI_readChStatusReg(panel_flash_baseAddr, panel_flash_chNum) & CSL_MCSPI_CH0STAT_TXFFE_MASK))
{
MCSPI_writeTxDataReg(panel_flash_baseAddr, (uint8_t) (*data+i), panel_flash_chNum);
vTaskDelay(1);
if(0 != (MCSPI_readChStatusReg(panel_flash_baseAddr, panel_flash_chNum) & CSL_MCSPI_CH0STAT_TXFFE_MASK))
{
ret = 1;
}
else
{
ret = 0;
}
}
else
{
ret = 0;
break;
}
vTaskDelay(1);
}
return ret;
Here is the part where MCSPI receive bytes:
uint8_t ret = 0;
vTaskDelay(1);
for(int i=0;i<len;i++)
{
MCSPI_writeTxDataReg(panel_flash_baseAddr, 0x00, panel_flash_chNum);
if(0 != (MCSPI_readChStatusReg(panel_flash_baseAddr, panel_flash_chNum) & CSL_MCSPI_CH1STAT_RXS_FULL)){
data[i] = MCSPI_readRxDataReg(panel_flash_baseAddr, panel_flash_chNum);
ret = 1;
}
else{
ret = 0;
break;
}
vTaskDelay(1);
}
return ret;
Could you please let me know if there is any mistake on my part that caused this issue?
Best,
Larry