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.

EK-TM4C1294XL: SPI speed is less than i configurated

Part Number: EK-TM4C1294XL

Greetings! I'm using TivaC with TFT 2.8 SPI Module ili9341 (http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807). And i have a problem: too slow refreshing of screen (0.6 FPS). I figured out what problem is slow SPI connection. After this i checked it out with oscillograph (Real speed is 45.45 KHz but i configured TivaC SPI as 10 MHz).

SPI initialization code:

SPI_Params_init(&SPI_Parameters);
SPI_Parameters.mode = SPI_MASTER;
SPI_Parameters.bitRate = 10000000;
SPI_Parameters.dataSize = 8;
SPI_Parameters.transferMode = SPI_MODE_BLOCKING;
SPI_H = SPI_open(0, &SPI_Parameters);
if (!SPI_H)
{
    System_abort("An attempt to configurate module \"SPI\" was unsuccessful!");
}

SPI send code:

unsigned char Answer = 0x0;
SPI_Message_Data.count = Data_Length;
SPI_Message_Data.txBuf = Data_Ptr;
Answer = SPI_transfer(SPI_H, &SPI_Message_Data);
return Answer;

I don't know what's wrong with my code, help, please

P.S. This is exactly my problem because of some guys is using this display with <I don't know, 30 FPS, may be?> like in this video: https://www.youtube.com/watch?v=WapdjBnF7tQ

  • Very SLOW, Screen Update Greetings as well,

    Georgy Tuzikov said:
    I'm using TivaC

    However - the code you show has the (highly) unpleasant scent of, "low/no-energy" - and is FAR from the "Tiva C" you mention!

    There are clear examples of the (proper) SPI Set-Up (Initialization & Configuring) found w/in Tivaware.   (i.e. examples/peripherals/SPI)

    Staff & I are surprised that you are able to "write to the screen at all" with the code shown.   Your use of the "API" provides the most eased & fastest means to "Satisfy your NEED for SCREEN UPDATE SPEED!"    Allez...

  • Hello cb1,

    They are using TI-RTOS for Tiva-C. The RTOS team will be able to help them with this request.

  • Hello Ralph,

    Thanks for that - poster made "no mention" & our group employs (other) than single vendor implementations.    Your response (does) explain how (some - yet s l o w e d) data found its way to the screen.

    Any RTOS adds complexity - poster's "Switch" to the API should provide the highest achievable "Screen Transfer Rate" - unburdened by (any) RTOS.   

    Once the "achievable" transfer rate is known - (only then) would our group embark upon RTOS addition - so that "Any/all RTOS penalties" may be "SPOT-LIGHTED!"

  • Hi Georgy,

    The engineer that was going to look at this is out ill for the rest of the day (not COVID-19), so I'll get the ball rolling....

    1. Functionally, is the contents of the screen correct?

    2. Is the device doing anything else? For example other tasks are running and doing XYZ.

    3. What board are you using? For example TI LaunchPad or custom hardware.

    4. Have you validated the SPI Loopback example in TI-RTOS for TivaC works properly? Can you check the bitrate with a scope with this example?

    Todd

  • Hello Todd,

    1) What do you mean?

    2) Right now- no

    3) EK-TM4C1294XL

    4) Ye, i did. Same thing. Unstead of 60 MHz i get 71.42 KHz

    I attached a little bit changed TI SPI example. I removed slave task and create a SPI flooder in master task. SPI bitrate 60 MHz (1/2 of Clock). Oscilloscope is showing 1 pulse per 14 uSec i.e. 71.42 KHz

    3757.spiloopback_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT.rar

  • Hello Todd,

    1) What do you mean?

    2) Right now- no

    3) EK-TM4C1294XL

    4) Ye, i did. Same thing. Unstead of 60 MHz i get 71.42 KHz

    I attached a little bit changed TI SPI example. I removed slave task and create a SPI flooder in master task. SPI bitrate 60 MHz (1/2 of Clock). Oscilloscope is showing 1 pulse per 14 uSec i.e. 71.42 KHz 3568.spiloopback_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT.rar

  • Georgy Tuzikov said:
    I attached a little bit changed TI SPI example. I removed slave task and create a SPI flooder in master task. SPI bitrate 60 MHz (1/2 of Clock). Oscilloscope is showing 1 pulse per 14 uSec i.e. 71.42 KHz 3568.spiloopback_EK_TM4C1294XL_TI_TivaTM4C1294NCPDT.rar

    What time base is your Oscilloscope set to?

    I took the example and ran it on a EK-TM4C1294XL on a LSA set to 500 MHz sampling rate, connected to SSI2CLK and SSI2XDAT0.

    With a low zoom at first sight the SSI clock pulses appear around 13.4 uSec apart:

    However, when zoom in then the SPI clock is shown as nominally 60 MHz:

    I.e. suspect that your Oscilloscope "showing 1 pulse per 14 uSec" measurement is not the SPI clock rate, but rather the rate at which the following software loop in the code is running at:

        while (1)
        {
            /* Initiate SPI transfer */
            transferOK = SPI_transfer(masterSpi, &masterTransaction);
        }

  • Hi Chester, thanks for the reply.

    Ok, i got it. My bad is what i counted not SCK pulses...

    So, i checked again - same as you checked i.e. ~60 MHz on SCK wire.

    If i configure SPI as 60 MHz i'll get 7.5 M bytes per second i.e 48 FPS. And i'm stumped because of this.

    Why didn't i get my 48 FPS? If my SPI is ok, problem is in my TivaC code for display...

    Anyway, thanks for replies everyone. Threads problem is resolved.