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.

TMS320F28379D: Unable to generate SPI clock

Part Number: TMS320F28379D


Tool/software:

hey TI,
I am unable to generate SPI clock on my launchpadF28379D , I am using SPI B.

In this way I have configured it, 

void SPI_PIN_init_B()
{
    // GPIO pin config as SPI B

    // MOSI SPIB
    GPIO_setPinConfig(SPIB_MOSI);    // GPIO_63_SPISIMOB
    GPIO_setPadConfig(63, GPIO_PIN_TYPE_STD);        // pin type as Push-pull output
    GPIO_setDirectionMode(63, GPIO_DIR_MODE_IN);    // Direction of MOSI_SPIB as Outout pin

    // MISO SPIB
    GPIO_setPinConfig(SPIB_MISO);       // GPIO_64_SPISOMIB
    GPIO_setPadConfig(64, GPIO_PIN_TYPE_STD);      // pin type as Push-pull output
    GPIO_setDirectionMode(64, GPIO_DIR_MODE_OUT);   // Direction of MISO_SPIB as Input pin
   
    // Clock SPIB
    GPIO_setPinConfig(SPIB_CLK);              // GPIO_65_SPICLKB
    GPIO_setPadConfig(65, GPIO_PIN_TYPE_STD);        // pin type as Push-pull output
    GPIO_setDirectionMode(65, GPIO_DIR_MODE_IN);    // Direction of CLK_SPIB as Output pin
   
    // Slave select SPIB
    GPIO_setPinConfig(SPIB_SS);           // GPIO_66_SPISTEB
    GPIO_setPadConfig(66, GPIO_PIN_TYPE_STD);        // pin type as Push-pull output
    GPIO_setDirectionMode(66, GPIO_DIR_MODE_IN);    // Direction of SS_SPIB as Output pin
}

void SPI_init_B()
{
    // init SPIB
    SPI_disableModule(SPIB_BASE); // disable SPIB module
    /*
     SPI - SPIB
     LSPCLK - 50Mhz (use equivalent value in Hz)
     SPI protocol - mode_3 (polarity 1, phase 1)
     SPI mode - Master mode
     SPI baudrate - 2Mhz ( use equivalent value in Hz)
     data wirdth - 2 bytes (16 bits)
    */
    SPI_setConfig(SPIB_BASE, 50000000, SPI_PROT_POL0PHA0 , SPI_MODE_SLAVE,2000000, 16);
    SPI_enableModule(SPIB_BASE); // Enable SPIB module
}


void main()
{
            SPI_writeDataNonBlocking(SPIB_BASE, 0xAAAA);   // generate clock by master
            DEVICE_DELAY_US(10);
}

I have attached the evidence below 


recently I have Updated the CCS version. 
  • did you put this 2 lines in an endless loop?

  • yes , a While loop.

    while(1)
    {
        SPI_writeDataNonBlocking(SPIB_BASE, 0xAAAA);   // generate clock by master
        DEVICE_DELAY_US(10);
    }

    I found a mistake and change them, the changes :
    GPIO_setDirectionMode(65, GPIO_DIR_MODE_OUT);    // Direction of CLK_SPIB as Output pin
    GPIO_setDirectionMode(63, GPIO_DIR_MODE_OUT);    // Direction of MOSI_SPIB as Outout pin
  • To be clear, did fixing this mistake fix the problem, or are you still unable to see the SPI clock?

    Regards,
    Jason Osborn

  • Sorry for late reply, No I am unable to see SPI clock. 

  • Re-reading what you posted, I've got a few debug steps for you:

    1. Where are you calling SPI_PIN_init_B() and SPI_init_B() ? They're not present in your main() function in the excerpt you posted, and they need to be.
    2. Make sure that your definitions for SPIB_MOSI, SPIB_MISO, SPIB_CLK, and SPIB_SS are correctly set.
    3. MINOR ISSUE: In master mode, STE should also be an output.
    4. MINOR ISSUE: It's generally good practice to explicitly call the GPIO_setMasterCore() function on a device with more than one core, though it's not necessarily required in a single-core project on CPU1.

    Refer to my bolded text for the most impactful issue I noticed.

    Regards,
    Jason Osborn