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/TMS570LS0232: some questions about the spi commuication with a sample chip

Part Number: TMS570LS0232
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

I'm trying to achieve spi communication between TMS570LS0232 and a sample chip recently. My goal is that TMS570LS0232 sends read command and the sample chip will return the corresponding data. Now I have some questions and hope get help.

1. Because of the characteristics of sample chip I must use SPI2's SIMO to send command and SPI3's SIMO to get  the data from sample chip. So I want to know what I should do to complete the configuration of SPI2 and SPI3's SOMI in HALCOGEN when I don't need to use them. Can I directly keep the default configuration of them?

2.The data type of the command and sample information is uint8, but the data type that HALCOGEN has provided in the function spiTransmitData()  is uint16. Is there any ways that I  can use to successfully call the function spiTransmitData() and also spiGetData() ?

  • Hello,

    LS0232 is the SPI master in your configuration. The LS0232 SPI provides the serial clock to the sample chip. Data written to the shift register initiates data transmission on the SIMO pin, MSB first. Simultaneously, received data is shifted through the SPISOMI pin into the LSB of the SPIDAT0 register. Both transmit and receive use the same clock.

    1. you can use either SPI2 or SPI3 to tx and rx data to/from the sample chip, but you can not use SPI2 to TX and SPI3 to read.

    2. CHARLEN[4:0] specifies the number of bits (2 to 16) in the data word. The CHARLEN[4:0] value directs the state control logic to count the number of bits received or transmitted to determine when a complete word is transferred. When you call the spiTransmitData()/spiGetData() or spiTransmitAndReceiveData(), you need to define the dataconfig_t first:

     spiDAT1_t dataconfig1_t;

     dataconfig1_t.CS_HOLD = FALSE;
     dataconfig1_t.WDEL    = TRUE;
     dataconfig1_t.DFSEL   = SPI_FMT_0;  //select 8 bit in HALCoGen
     dataconfig1_t.CSNR    = 0xFE;             //use CS0

  • Thank you very much for your reply, I will make further attempts with your advice.