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.

TMS320F28388S: SPI Clock is not generating .

Part Number: TMS320F28388S
Other Parts Discussed in Thread: TMDSCNCD28388D, C2000WARE

Tool/software:

Urgent help needed ,My SPI clock is not generating after I modified only application level of example code "spi_ex6_eeprom"

I am providing my code in below ,I am quite new to C2000 platform , I need a guidance 

// Included Files
//
#include "driverlib.h"
#include "device.h"
#include "board.h"

//
// Defines
//
#define MAX6675_CS_GPIO   11    // Chip Select GPIO Pin
#define SPI_BASE_ADDR     SPIA_BASE

void initSPI(void);
uint16_t readMAX6675(void);
void selectChip(void);
void deselectChip(void);

void initSPI(void)
{
    // Configure GPIO pins for SPI
    GPIO_setPinConfig(GPIO_16_SPIA_SIMO);
    GPIO_setPinConfig(GPIO_17_SPIA_SOMI);
    GPIO_setPinConfig(GPIO_18_SPIA_CLK);
    GPIO_setPadConfig(16, GPIO_PIN_TYPE_STD);
    GPIO_setPadConfig(17, GPIO_PIN_TYPE_STD);
    GPIO_setPadConfig(18, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(16, GPIO_QUAL_ASYNC);
    GPIO_setQualificationMode(17, GPIO_QUAL_ASYNC);
    GPIO_setQualificationMode(18, GPIO_QUAL_ASYNC);
    GPIO_setDirectionMode(16, GPIO_DIR_MODE_OUT);
    GPIO_setDirectionMode(17, GPIO_DIR_MODE_IN);
    GPIO_setDirectionMode(18, GPIO_DIR_MODE_OUT);

    // Configure Chip Select GPIO
    GPIO_setPadConfig(MAX6675_CS_GPIO, GPIO_PIN_TYPE_STD);
    GPIO_setQualificationMode(MAX6675_CS_GPIO, GPIO_QUAL_SYNC);
    GPIO_setDirectionMode(MAX6675_CS_GPIO, GPIO_DIR_MODE_OUT);
    GPIO_setControllerCore(MAX6675_CS_GPIO, GPIO_CORE_CPU1);
    GPIO_writePin(MAX6675_CS_GPIO, 1);

    // Initialize SPI Module
    SPI_disableModule(SPI_BASE_ADDR);
    SPI_setConfig(SPI_BASE_ADDR, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0, SPI_MODE_MASTER, 4000000, 8);
    SPI_setPTESignalPolarity(SPI_BASE_ADDR, SPI_PTE_ACTIVE_LOW);
    SPI_disableFIFO(SPI_BASE_ADDR);
    SPI_disableLoopback(SPI_BASE_ADDR);
    SPI_setEmulationMode(SPI_BASE_ADDR, SPI_EMULATION_STOP_AFTER_TRANSMIT);
    SPI_enableModule(SPI_BASE_ADDR);
}

void selectChip(void)
{
    GPIO_writePin(MAX6675_CS_GPIO, 0);
    DEVICE_DELAY_US(10);
}

void deselectChip(void)
{
    GPIO_writePin(MAX6675_CS_GPIO, 1);
    DEVICE_DELAY_US(10);
}

uint16_t readMAX6675(void)
{
    uint16_t receivedData = 0;

    selectChip();

    SPI_writeDataBlockingNonFIFO(SPI_BASE_ADDR, 0x0000);
    receivedData = SPI_readDataBlockingNonFIFO(SPI_BASE_ADDR);

    deselectChip();

    if(receivedData & 0x04) // Check for Fault Bit
    {
        return 0xFFFF; // Error Value
    }

    return (receivedData >> 3) * 0.25; // Temperature Conversion
}

void main(void)
{
    Device_init();
    Device_initGPIO();
    initSPI();

    while(1)
    {
        uint16_t temperature = readMAX6675();
        if(temperature != 0xFFFF)
        {
            // Valid temperature reading
        }
        DEVICE_DELAY_US(1000000); // Delay 1 second
    }
}


  • Hi Ramakrishna,

    An expert will get back to you shortly on the matter. Thank you. 

    Best Regards,

    Aishwarya 

  • Hello,

    The first thing I would suggest doing is changing SPI_EMULATION_STOP_AFTER_TRANSMIT to SPI_EMULATION_FREE_RUN and see if this changes the behavior. Based on your current configuration, SPI_EMULATION_STOP_AFTER_TRANSMIT, it's possible for a debug pause to completely halt the SPI peripheral. At a glance, everything else in your configuration looks correct, so my immediate concern is that it's related to the emulation.

    Regards,
    Jason Osborn

  • Thanks for your valuable input.
    Actually after changing from SPI_EMULATION_STOP_AFTER_TRANSMIT to SPI_EMULATION_FREE_RUN also it didn't solve my issue but with this change when I changes from GPIO_setPadConfig(16, GPIO_PIN_TYPE_STD) to GPIO_setPadConfig(16, GPIO_PIN_TYPE_PULLUP) for all three gpio ,then it actually started working .
    But I didn't get the logic behind it .
    Can you explain what is the correct configuration for C2000 series controllers specially for  TMS320F28388S???

  • Hmm. Per our documentation, there should be no requirement to set these pins to use the internal pullup. Setting an IO to pullup is often helpful if there is unexpected/significant noise on a signal, particularly at startup, or the signal is somehow otherwise being pulled into an unknown state. Are you using the TMDSCNCD28388D controlCARD hardware or are you using custom hardware?

    Regards,
    Jason Osborn

  • Yes , I am using TMDSCNCD28388D controlCARD hardware 180 pin . Unfortunately this card pinout document is also incomplete and I am facing same Clock in I2C peripheral where internal pullup also didn't solve my issue yet.Face palm‍♂️

  • Ramakrishna,

    The TMDSCNCD28388D schematic should have the full pinout. For I2C, device TRM section 33.2 describes GPIO settings and section 33.3.2 mentions external pullup resistors and provides a link to an app note on calculating them. Additionally, if the I2C peripheral is not functioning, consider verifying the contents of the control registers against the settings described in the I2C section of the TRM.

    If this advice does not help, please make a new thread for the I2C issue so that the relevant SME can be assigned, and ensure that you link this post in the body in case the situation context becomes relevant.

    Regards,
    Jason Osborn

  • But unfortunately TMDSCNCD28388D schematic is not full pinout .

    Refer below snap ,as per C2000ware library I2CA uses GPIO PIN 104 and 105 .

    And GPIO 105 and 106 is missing from TMDSCNCD28388D schematic pin out.



    And also I made new thread for the I2C issue 3 days ago , but still no response received.Face palm‍♂️

  • Apologies for the delay in response, I was unexpectedly out of office.

    Referring to the device schematic, GPIO 105 and 106 are routed directly to U17, a DP83822IRHBR Ethernet transceiver, for serial control. I'm not certain why the default signal defined in C2000Ware uses GPIO105 in that case.

    Referring to the device TRM, I2CA SCL is also available on other pins, including IOs 32, 33, 43, 57, and 92. Try using one of these instead.

    Regards,
    Jason Osborn