Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
I was trying to convert the M4 SPI configuration into PRU using sys_mcspi.h
MCSPI_ChConfig gConfigMcspi0ChCfg[CONFIG_MCSPI0_NUM_CH] = { { .chNum = MCSPI_CHANNEL_0, .frameFormat = MCSPI_FF_POL0_PHA0, .bitRate = 12500000, .csPolarity = MCSPI_CS_POL_LOW, .trMode = MCSPI_TR_MODE_TX_RX, .inputSelect = MCSPI_IS_D0, .dpe0 = MCSPI_DPE_DISABLE, .dpe1 = MCSPI_DPE_ENABLE, .slvCsSelect = MCSPI_SLV_CS_SELECT_0, .startBitEnable = FALSE, .startBitPolarity = MCSPI_SB_POL_LOW, .csIdleTime = MCSPI_TCS0_0_CLK, .defaultTxData = 0x0U, .txFifoTrigLvl = 16U, .rxFifoTrigLvl = 16U, }, };
This is how I translated it to PRU: Is mapping correct?
MCSPI0_CFG.CH0CONF = 0x0; MCSPI0_CFG.CH0CONF_bit.PHA = 0; //SPICLK phase MCSPI0_CFG.CH0CONF_bit.POL = 0; //SPICLK polarity MCSPI0_CFG.CH0CONF_bit.CLKD = 12500000; //Frequency divider for SPICLK MCSPI0_CFG.CH0CONF_bit.EPOL = 0; //SPIEN polarity MCSPI0_CFG.CH0CONF_bit.TRM = 2; //Transmit/Receive modes MCSPI0_CFG.CH0CONF_bit.IS = 0; //Input Select MCSPI0_CFG.CH0CONF_bit.DPE0 = 0; //Transmission Enable for data line 0 [SPIDATAGZEN[0]] MCSPI0_CFG.CH0CONF_bit.DPE1 = 1; //Transmission Enable for data line 1 [SPIDATAGZEN[1]] MCSPI0_CFG.CH0CONF_bit.SPIENSLV = 0; //Channel 0 only and target mode only MCSPI0_CFG.CH0CONF_bit.SBE = 0; //Start bit enable for SPI transfer
I am not sure about the following: