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.

TMS320F280049C: How to increase the SPI bit rate at 10MHz

Part Number: TMS320F280049C
Other Parts Discussed in Thread: SYSCONFIG

Hello, 

I am trying to setup an SPI communication between two TMS320F280049C launchpads at 10Mbps. At the moment, I am working only on one with the loopback feature just for learning sake while I wait for the second board to be delivered. 

I am configuring the board on sysconfig and I everytime I run the debugger with a configurated bitrate higher than ∼6MHz the code returns an assert error  (ESTOP0). I am aware that the bit rate can't be higher than LSPCLK/4 but the LSPCLK set on the board is 100MHz and therefore I should be able to obtain maximum 25MHz of bit rate. Therefore I should be able to set easily 10MHz bit rate. Where am I missing something? How can I solve my problem? 

I attach my code, the pictures of my configuration and of the error:

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

//
// Global Variables
//
uint16_t write_data = 0;
uint16_t read_data = 0;

//
// Main
//
void main(void)
{

    //
    // Initialize device clock and peripherals
    //
    Device_init();

    //
    // Disable pin locks and enable internal pull-ups.
    //
    Device_initGPIO();

    //
    // Initialize PIE and clear PIE registers. Disables CPU interrupts.
    //
    Interrupt_initModule();

    //
    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    //
    Interrupt_initVectorTable();

    //
    // PinMux and Peripheral Initialization
    //
    Board_init();

    //
    // C2000Ware Library initialization
    //
    C2000Ware_libraries_init();

    //
    // Enable Global Interrupt (INTM) and real time interrupt (DBGM)
    //
    EINT;
    ERTM;

    while(1)
    {
        // TX (non blocking)
        SPI_writeDataNonBlocking(mySPI0_BASE, write_data);

        // RX (blocking nonFIFO)
        read_data = SPI_readDataBlockingNonFIFO(mySPI0_BASE);

        // Error check
        if (read_data != write_data)
        {
            ESTOP0;
        }
        
        write_data++;
    }
}

The code is a simple loopback of a number called "write_data" which is incremented each cycle. The "read_data" is just the looped back value of "write_data".

In the two images there is only the configuration gui of the SPI peripheral and of the clock tree of my board.

The last picture is about the debugger view and where I am led when I resume the code. 

Thank you in advance for your help Slight smile.

Kind regards, 

Edoardo

  • Edoardo,

    Which of these ASSERT function is causing PC to jump to __error__ function?

    Regards,

    Manoj

  • Dear Manoj, 

    The ASSERT which is causing to jump to the __error_function is the second one: ASSERT(bitRate <= (lspclkHz/4U)).

    Best regards,

    Edoardo

  • Edoardo,

    Have you enabled Device Support in SysConfig? If Generated Source doesn't include device.c and device.h then clocktree.h setting don't take effect.

    Fig1: Shows how to enable device support

    Fig2: Shows device.c / .h in Generated Source using SysConfig

    Fig3: Shows device.c and f28004x_codestartbranch.asm excluded from build

    Fig1:

      

    Fig2:

    Fig3:

    Do the steps in Fig1/2/3 to get things working.

    Regards,

    Manoj

  • Dear Manoj, 

    Many thanks!! Now it works! 

    I did as you explained. To clarify for other people I performed the following steps:

    1) activated the "Device Support" feature in sysconfig;

    2) excluded manually the old "device.c" and "codestartbranch.asm" files from the project explorer by right clicking on them and selecting the exclude option (without this step the compiler gives errors);

    3) built the project. 

    Now everything is like in the pictures you sent. 

    Thank you again for your help, I wish you a good day. 

    Kind regards,
    Edoardo