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/TMS570LS0432: Simple SPI1 communication with loopback

Part Number: TMS570LS0432
Other Parts Discussed in Thread: HALCOGEN

Tool/software: Code Composer Studio

Hi,

I use a TMS570LS0432 Launchpad.

I'm trying to program a simple SP1 communication with loopback like in this demo :

https://training.ti.com/hercules-tutorial-mibspi-overview 

The only change I want to make is to replace the mibspi1 by the spi1. I haven't found an example for that and I can't get it to work. (It works very well with mibspi1)

Is there any example for the HalCoGen configuration and CCS studio code ?

Thank you in advance for your answer!

  • Hello,

    /*initialize the spi*/
    spiInit();

    /* - enabling loopback */
    spiEnableLoopback(spiREG1,Digital_Lbk);

    spiDAT1_t dataconfig1_t;

    dataconfig1_t.CS_HOLD = FALSE;
    dataconfig1_t.WDEL = TRUE;
    dataconfig1_t.DFSEL = SPI_FMT_0;
    dataconfig1_t.CSNR = 0xFE;

    spiTransmitAndReceiveData(spiREG1, &dataconfig1_t, 8, TX_Data, RX_Data);
  • Thank you it works very well now !

    Can you still explain to me the functioning and usefulness of the parameters of the "spiDAT1_t" structure?

    Thank you very much

  • Hello,

    spiDAT1_t is a structure defining the chip select hold mode (CSHOLD), data word format, chip select number (CSNR), and delay feature. Those parameters are in upper portion of SPIDAT1 register.

    If the CSHOLD bit is set in the control field of a word, the chip select signal will not be deactivated until the next control field is loaded with new chip select information.

    If the WDEL bit is set within the control field, the wait delay (WDELAY defined in SPIFMT register) will be still applied between the two transactions.

    The drive state for SPISCS[3:0] pins is controlled by the CSNR.