This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/TMS320C6748: J15 pins for SPI

Part Number: TMS320C6748
Other Parts Discussed in Thread: OMAPL138

Tool/software: TI-RTOS

Hi,

I am coding a SPI driver for SPI0. The problem  is that I can not see any values when I connect the J15 SPI outputs (SIMO and CLK values) to an osciloscope. I am trying to analize the SPI 0 CLK signal (J15 25 pin).

When I debug my driver using the XDS110 Debug I can check that registers are configured correctly and the SPIPC2 (CLKDIN)register is updated to high to low in each cycle but no outputs are read by my osciloscope.

Also I have some questions after check the starterware example and the technical manual:

- In the starterware SPI example, CS is not set to low value before communication starting.  According the technical manual the transmission starts when the CS is low. Is it correct?

- The SPIPC1 bits shall be configured if the SPi is defined as master?? I understand reading the reference manual that it is not neccessary, although in my code I configure to avoid errors.

My code is following (I dont write all the code, only important code):

InitSPI is called from main and its input value is uiSPIReg = SOC_SPI_0_REGS 

CS is configure to 2

#define CS_NONE_UI 0x00
#define CS_HOLT1_UI 0x04

#define SIMO_SOMI_CLK_CS_UI 0x00000E04 /* value to configure SMIO,SOMI,CLK and CS pin as functional pin */
#define SIMO_SOMI_CLK_CS_IO_UI 0x00000604 /* value to configure SMIO,SOMI,CLK and CS pin input/output */

void InitSPI(const Int_ui uiSPIReg)
{

DataFormat_st stDataFormat;


/* Waking up the SPI1 instance. */
PSCModuleControl(uiSPIReg, HW_PSC_SPI0, PSC_POWERDOMAIN_ALWAYS_ON,
PSC_MDCTL_NEXT_ENABLE);

/* Performing the Pin Multiplexing for SPI1. */
SPIPinMuxSetup(uiSPIReg);

/*
** Using the Chip Select(CS) 2 pin of SPI1 to communicate
*/
SPI0CSPinMuxSetup(2);

/*Reset SPI*/
SPIReset(uiSPIReg);

/*Active SPI (out of reset)*/
SPIOutOfReset(uiSPIReg);


/*Configure SPI as master*/
SPIModeConfigure(uiSPIReg, SPI_MASTER_MODE_UI);

/*Set SPI operation 4 pin CS */
SetSPIPinControl(uiSPIReg, SPIIPC0_UI, SIMO_SOMI_CLK_CS_UI);

/*Set Holt1 default CS selection TBD*/
SPIDefaultCSSet(uiSPIReg, CS_HOLT1_UI);

/* Configures SPI Data Format 0*/
stDataFormat.uiWDelay = 0;
stDataFormat.ucbparityPolarity = SPI_EVEN_PARITY_UI;
stDataFormat.ucbParityEnable = SPI_PARITY_DISABLE_UI;
stDataFormat.ucbWaitEna = SPI_WAITENA_DISABLE_UI;
stDataFormat.ucbShiftDir = SPI_MSB_UI;
stDataFormat.ucbDisableTimer = DISCSTIMERS_DISABLE_UI;
stDataFormat.ucbPolarity = SPI_CLK_POL_LOW_UI;
stDataFormat.ucbPhase = SPI_CLK_INPHASE_UI;
stDataFormat.uiSPIModuleCLK = SPI_MOD_CLK_UI;
stDataFormat.uiSPIClkFreq = SPI_CLK_FREQ_UI;
stDataFormat.uiCharLen = SPI_DATA_L8_UI;

SPIConfigDataFmtReg(uiSPIReg, SPIDAT1_FORMAT0_UI, stDataFormat);

SetSPIPinControl(uiSPIReg, SPIIPC1_UI, SIMO_SOMI_CLK_CS_IO_UI);
SPIEnable(uiSPIReg);

}

Affer configuration this function is called cyclic 

ExchangeSPIData(Int_ui uiSPIReg,
const Char_uc* pucOutBuffer,
Char_uc* pucInBuffer,
Int_ui * puiBufferLength)
{
/* Initialize return value */
ECUSTATUS_e eResult = eSTATUSECU_OK;
Int_ui uiRecLength = 0;

...

Int_ui uiStatusSPI = SPIFlagStatus(uiSPIReg);

while (uiStatusSPI > 0 && *puiBufferLength > 0)
{
/*Receiver reg full -> clear bit in SPI Flag Status*/
if (uiStatusSPI & SPI_SPIFLG_RXINTFLG_UI){
/*Read SPIBuf*/
*pucInBuffer = (char)SPIDataReceive(uiSPIReg);
uiRecLength++;
}

/*Transmitter reg empty*/
if (uiStatusSPI & SPI_SPIFLG_TXINTFLG_UI)
{
/*Write data in SPI_SPIDAT1-> clear bit in SPI Flag Status*/
SPIDat1ConfigCSNR(uiSPIReg, CS_NONE_UI);
SPITransmitData1(uiSPIReg, *pucOutBuffer);
*puiBufferLength--;
UARTSendMessage("Transmit \n", 10);
pucOutBuffer++;


}

... -> errors manage

/*Update SPI status value*/
uiStatusSPI = SPIFlagStatus(uiSPIReg);
}

/* Deasserts the CS pin(line) - Comm with CS is finished */
SPIDat1ConfigCSNR(uiSPIReg, CS_HOLT1_UI);
//Buffer length is now the received data length
*puiBufferLength = uiRecLength;


}

 Thank you very much by your help!