TMS320F2800157: SPI MINIMUM FREQUENCY

Part Number: TMS320F2800157
Other Parts Discussed in Thread: LMX2582, SYSCONFIG

Tool/software:

Hello,

I’m working on establishing SPI communication between a TI F2800157 MCU and the LMX2582 PLL IC. The LMX2582 EVM uses an SPI clock of 125 kHz, and I’m trying to configure the same bit rate on the F2800157 using SysConfig in Code Composer Studio.

However, I’m unable to set the SPI clock to exactly 125 kHz through SysConfig, it seems to round off or restrict to certain values.

Could you please help me understand:

  • What is the minimum SPI clock frequency supported by the F2800157?

  • Is there any way to manually configure the SPI bit rate (e.g through register settings) to achieve 125 kHz?

  • Are there any limitations or dependencies (like LSPCLK frequency or divider values) that affect the achievable SPI frequency?

Any guidance on how to achieve or approximate 125 kHz SPI communication would be appreciated.

Thank you!

  • Hi Muhammed,

    What is the minimum SPI clock frequency supported by the F2800157?

    This is mentioned in the TRM (SPIBRR register) as well as the error in the screenshot you provided.

    Is there any way to manually configure the SPI bit rate (e.g through register settings) to achieve 125 kHz?

    Along with modifying these SPI settings, you can use the SysConfig ClockTree Tool to modify LSPCLK to achieve this setting. 

    Are there any limitations or dependencies (like LSPCLK frequency or divider values) that affect the achievable SPI frequency?

    Refer to the detailed TRM and datasheet for this. 

    Best Regards,

    Aishwarya

  • Hi Aishwarya,

    As per your suggestion, I changed the LSPCLK clock frequency using the Clock Tree Tool, and now I’m able to set the SPI bit rate to 125 kHz.

    However, I’m still facing an issue, there is no SPI output when trying to communicate with the LMX2582 PLL IC.

    • For reference, I tested the same SPI configuration using the SAME54 MCU, and in that case, I was able to observe the correct output waveform.

    I’ve attached (or provided below) the code snippet and SPI configuration I’m currently using. Could you please review and help verify if there’s anything missing or incorrect in the configuration?

    void main(void)
    {
        //
        // Initializes system control, device clock, and peripherals
        //
        Device_init();
    
        //
        // Initializes PIE and clear PIE registers. Disables CPU interrupts.
        // and clear all CPU interrupt flags.
        //
        Interrupt_initModule();
    
        //
        // Initialize the PIE vector table with pointers to the shell interrupt
        // Service Routines (ISR).
        //
        Interrupt_initVectorTable();
    
        //
        // Board Initialization
        //
        Board_init();
    
        //
        // Enables CPU interrupts
        //
        Interrupt_enableGlobal();
    
        //Enbale Oscillator
        GPIO_writePin(oscEnablePin, 1);
    
        //Enable PLL DCDC
        GPIO_writePin(pllDCDCEnablePin, 1);
    
        //Enable LDO
        GPIO_writePin(ldoEnablePin, 1);
    
        //Enable PLL IC
        GPIO_writePin(pllEnablePin, 1);
    
        GPIO_writePin(lmxCSPin, 1);
    
        DEVICE_DELAY_US(2000000);
    
        //
        // Loop.
        //
    
        for(;;)
        {
            if(writeOnce) {
    
                writeOnce = false;
                lmx2582Softreset();
                DEVICE_DELAY_US(100000);
    
                sendLMX2582Registers();
            }
            
    
            GPIO_togglePin(myGPIOOutput0);
            DEVICE_DELAY_US(1000000);
        }
    }
    
    void sendLMX2582Registers()
    {
        int i,j;
        for (i = 0; i < NUM_LMX2582_REGS; i++)
        {
            uint32_t regVal = lmx2582_reg_values[i];
            uint8_t data[3];
            data[0] = (regVal >> 16) & 0xFF;
            data[1] = (regVal >> 8) & 0xFF;
            data[2] = regVal & 0xFF;
    
            GPIO_writePin(lmxCSPin, 0);
            SPI_transmitNBytes(SPIA_BASE,data,3,2);
    
            while (SPI_isBusy(SPIA_BASE));
            
            // for (j = 0; j < 3; j++)
            // {
            //     // SPI_writeDataBlockingNonFIFO(SPIA_BASE, data[j]);
            //     // SPI_transmitByte(SPIA_BASE, data[j]);
            //     SPI_writeDataBlockingFIFO(SPIA_BASE, data[j]);
    
            // }
            //  DEVICE_DELAY_US(1);
            
             GPIO_writePin(lmxCSPin, 1);
    
        }
        
       
    }
    
    
    void lmx2582Softreset()
    {
        const uint32_t reset_cmd = 0x00221E;
        uint8_t data[3];
            data[0] = (reset_cmd >> 16) & 0xFF;
            data[1] = (reset_cmd >> 8) & 0xFF;
            data[2] = reset_cmd & 0xFF;
    
        int j;
        GPIO_writePin(lmxCSPin, 0);
    
        SPI_transmitNBytes(SPIA_BASE,data,3,2);
        // while (SPI_getTxBufferStatus(SPIA_BASE) != SPI_TX_BUFFER_EMPTY);
        while (SPI_isBusy(SPIA_BASE));
    
            // for (j = 0; j < 3; j++)
            // {
            //     // SPI_writeDataBlockingNonFIFO(SPIA_BASE, data[j]);
            //     // SPI_transmitByte(SPIA_BASE, data[j]);
            //     SPI_writeDataBlockingFIFO(SPIA_BASE, data[j]);
            // }
            
        // DEVICE_DELAY_US(1);
        GPIO_writePin(lmxCSPin, 1);
    }