I am developing MCSPI slave mode on TDA2PX, using "utils_mcscpi.c".
However, I was faced with the issue of the first Tx data being transmitted in duplication.
The details are as follows.
1. Development Environment
1) TDA2PX Slave Device with Ti RTOS
2) Using External Master Device
3) Using MCSPI4
2. Issue
1) Slave Tx Buf Length = 256Byte
2) Slave Tx Data = 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, ......
3) Master Rx Data = 3, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, ......
3. MCSPI4 Param Settings
1) Slave Mode
2) Interrupt Mode
3) FIFO Enable
4) FIFO RxTrigLvl = 32Byte / FIFO TxTrigLvl = 32Byte / Char Length ( Word Length ) = 1Byte
5) Only Using RX0 Full Enable Interrupt Mask ( in bsp_mcspi.c )
6) Param Setting Code
mCSPINum = 3; mcspiPrms = Mcspi_PARAMS; mcspiPrms.instNum = mCSPINum; mcspiPrms.opMode = MCSPI_OPMODE_INTERRUPT; mcspiPrms.enableCache = (UInt32) FALSE; mcspiPrms.enableErrIntr = (UInt32) FALSE; #ifdef A15_TARGET_OS_LINUX mcspiPrms.prcmPwrmEnable = FALSE; #else mcspiPrms.prcmPwrmEnable = TRUE; #endif mcspiPrms.spiHWCfgData.masterOrSlave = MCSPI_COMMMODE_SLAVE; mcspiPrms.spiHWCfgData.singleOrMultiChEnable = MCSPI_SINGLE_CHANNEL; mcspiPrms.spiHWCfgData.pinOpModes = MCSPI_PINOPMODE_4PIN; mcspiPrms.spiHWCfgData.fifoRxTrigLvl = 32; mcspiPrms.spiHWCfgData.fifoTxTrigLvl = 32; for (i = 0U; i < 1; i++) { mcspiPrms.spiHWCfgData.configChfmt[i].charLength = MCSPI_LEN_8BIT; mcspiPrms.spiHWCfgData.configChfmt[i].multiWordAccessEnable = (UInt32) FALSE; mcspiPrms.spiHWCfgData.configChfmt[i].spiChipSelectEnablePol = (UInt32) FALSE; mcspiPrms.spiHWCfgData.configChfmt[i].clockMode = MCSPI_MODE2; mcspiPrms.spiHWCfgData.configChfmt[i].clockRatioExtension = 0; mcspiPrms.spiHWCfgData.configChfmt[i].spiWordInitDelay = MCSPI_NO_DELAY; mcspiPrms.spiHWCfgData.configChfmt[i].trasmitReceiveMode = MCSPI_BOTH_RXTX; mcspiPrms.spiHWCfgData.configChfmt[i].granularityEnable = (UInt32) TRUE; #if defined (TDA3XX_AR12_ALPS) /* 8 MHz Bus Frequency */ mcspiPrms.spiHWCfgData.configChfmt[i].busFreq = 8000000; #else /* 24 MHz Bus Frequency */ mcspiPrms.spiHWCfgData.configChfmt[i].busFreq = 24000000; /* 500kHz Bus Frequency */ #endif mcspiPrms.spiHWCfgData.configChfmt[i].spienHighPolarity = (UInt32) FALSE; mcspiPrms.spiHWCfgData.configChfmt[i].slaveModeChipSelect = MCSPI_SPIEN_0; mcspiPrms.spiHWCfgData.configChfmt[i].spiDat0Dir = MCSPI_OUT; mcspiPrms.spiHWCfgData.configChfmt[i].spiDat1Dir = MCSPI_IN; } Mcspi_ChanParams_init(&chanParams); #if 1 /* update the edma Handle */ chanParams.fifoEnable = (UInt32) TRUE; chanParams.chanNum = 0; #endif chanParams.chipSelTimeControl = MCSPI_CLK_CYCLE0; chanParams.spiChipSelectHold = FALSE; chanParams.chanNum = 0; |
Is there anything wrong or missing about the settings?
Or are there other debugging points related to it?
Please let me know your opinion.
Thank you.