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.

CCS/TMS320F28377S: SPI 3-wire Mode, SPISTE toggle

Part Number: TMS320F28377S
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi, 

I'm drive SPI 3-wire using TMS28377S.

My code is

1. Clear the SPISTE bit to Low.  --> SPI_LOAD_LOW(); 
2. Send 4 16-bit words.               --> SpiSend(0x8001); and SpiSend(0x8001); and.....
3. Set SPISTE bit to High.           --> SPI_LOAD_HIGH();

Each time a 16-bit word is sent, the SPISTE bit is toggled.


1) When tested with the following code settings, does SPISTE automatically toggle after sending a 16-bit word( SpiSend(0x8001); )?

2) Is there any way to prevent this?

========================================================================

/* SPI initialization part */ void InitSpi(void) { SpiaRegs.SPICCR.bit.SPISWRESET = 0; SpiaRegs.SPICCR.bit.CLKPOLARITY = 1; SpiaRegs.SPICCR.bit.SPICHAR = (16-1); // 16-bit word SpiaRegs.SPICCR.bit.SPILBK = 0; // Enable master (0 == slave, 1 == master) // Enable transmission (Talk) // Clock phase (0 == normal, 1 == delayed) // SPI interrupts are disabled SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1; SpiaRegs.SPICTL.bit.TALK = 1; SpiaRegs.SPICTL.bit.CLK_PHASE = 0; SpiaRegs.SPICTL.bit.SPIINTENA = 0; SpiaRegs.SPIPRI.bit.TRIWIRE = 1; // Set the baud rate SpiaRegs.SPIBRR.bit.SPI_BIT_RATE = SPI_BRR; // 500kHz // Set FREE bit // Halting on a breakpoint will not halt the SPI SpiaRegs.SPIPRI.bit.FREE = 1; // Release the SPI from reset SpiaRegs.SPICCR.bit.SPISWRESET = 1; }
/* SPI Send Function part */ uint16_t SpiSend(uint16_t data) { uint16_t Dummy; SpiaRegs.SPICTL.bit.TALK = 1; SpiaRegs.SPITXBUF = data; while(SpiaRegs.SPISTS.bit.INT_FLAG !=1) {} Dummy = SpiaRegs.SPIRXBUF; return Dummy; }
/* Real data transmission part */ void TestDataSendFunc(void) { SPI_LOAD_LOW(); // SPISTE Low SpiSend(0x8001); // 1 SpiSend(0x8001); // 2 SpiSend(0x8001); // 3 SpiSend(0x8001); // 4 SPI_LOAD_HIGH(); // SPISTE High }

================================================================

Thanks for your time

Best regards,

Lee

  • Hi Minsik,

    I am assuming SPI_LOAD_LOW() and SPI_LOAD_HIGH() are functions that toggle a GPIO pin which you are using as SPISTE. Is this correct? If so, you must configure that pin to be a GPIO pin. Refer to the GPIO section in the TMS320F2837xS technical reference manual for more information.

    Please note that the SPI on the device you are using does support FIFO mode. If you enable the FIFO, you can load up to 16 characters back-to-back. The SPI will keep the SPISTE pin low until all the characters in the FIFO have been transmitted. You refer to any of the SPI FIFO examples in C2000ware for more information.