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.

TMS570LS1224: MIBSPI Chip select timing

Part Number: TMS570LS1224
Other Parts Discussed in Thread: HALCOGEN

I am able to set only for a maximum Wdelay for chipselect of 255*Time period of VCLK (3.215us) in HalCogen GUI.

For a slave device I require a tdes_CS of 50uS (please refer to the image below ).

How to configure in HalcoGen and CCS to get a chipselect timing of 50uS ?

  • For large delay, you need to transmit data word by word instead of a block of data. 

  • How to transmit word by word ? 

  • Please tell me the steps that i need to follow. I am a beginner with TI MCU. 

  • Hi Sakthi,

    This is the SPI TX function which is used to transmit a block of data:

    int32 spiTransmitData(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint16 * srcbuff)
    {

      .....
    }

    1. you can call this function to only transmit 1 word (2bit to 16 bit), and insert a delay manually, then call this function to transmit next word:

        spiTransmitData(..., blocksize=1, ...);

        delay(

        spiTransmitData(..., blocksize=1, ...);

        ...

    2. you can modify the HAL generated code: add delay to spiTransmitData(...) function:

        uint32 spiTransmitData(spiBASE_t *spi, spiDAT1_t *dataconfig_t, uint32 blocksize, uint16 * srcbuff)

        {

    volatile uint32 SpiBuf;
    uint16 Tx_Data;
    uint32 Chip_Select_Hold = (dataconfig_t->CS_HOLD) ? 0x10000000U : 0U;
    uint32 WDelay = (dataconfig_t->WDEL) ? 0x04000000U : 0U;
    SPIDATAFMT_t DataFormat = dataconfig_t->DFSEL;
    uint8 ChipSelect = dataconfig_t->CSNR;

    /* USER CODE BEGIN (10) */
    /* USER CODE END */
    while(blocksize != 0U)
    {

    if((spi->FLG & 0x000000FFU) !=0U)
    {
       break;
    }

    if(blocksize == 1U)
    {
       Chip_Select_Hold = 0U;
    }
    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    Tx_Data = *srcbuff;

    spi->DAT1 = ((uint32)DataFormat << 24U) |
    ((uint32)ChipSelect << 16U) |
    (WDelay) |
    (Chip_Select_Hold) |
    (uint32)Tx_Data;


    /*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
    srcbuff++;
    /*SAFETYMCUSW 28 D MR:NA <APPROVED> "Hardware status bit read check" */
    while((spi->FLG & 0x00000100U) != 0x00000100U)
    {
    } /* Wait */
    SpiBuf = spi->BUF;

    blocksize--;

             delay();
    }

    /* USER CODE BEGIN (11) */
    /* USER CODE END */

    return (spi->FLG & 0xFFU);

    }

    BTW, don't enable the CSHOLD.