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.

LM4F232 SSI example code

Other Parts Discussed in Thread: EK-LM3S811

Can anybody suggest me , where can I get the example code for the OLED "Hello" display using SSI communication.

  • Hi, Try here: (Tiva)TM4C-2.1.0.12573/examples/boards/ek-lm4f232/hello
  • Dear Petrei 

    Thanks for the response. But which you specified is UART Communication right! 

    I am looking for the SSI Communication sample code for OLED, with launchpad   LM4F232H5QD. Kindly let me know.

  • Hi Amit Ashara

    I am trying to do coding for OLED Display using SSI Communication. Can you please help me for the code contentwise , as i dint found any example code for "OLED display using SSI Communication" .
    I have attached the code here , please have a look into it and revert back.


    #include "inc/hw_types.h"
    #include "inc/hw_memmap.h"
    #include "driverlib/fpu.h"
    #include "driverlib/sysctl.h"
    #include "driverlib/rom.h"
    #include "driverlib/pin_map.h"
    #include "grlib/grlib.h"
    #include "drivers/cfal96x64x16.h"
    #include "utils/uartstdio.h"
    #include "driverlib/gpio.h"
    #include "driverlib/ssi.h"
    #include "inc/hw_ints.h"


    #ifdef DEBUG
    void
    __error__(char *pcFilename, unsigned long ulLine)
    {
    }
    #endif

    void WriteDataToRfSpiChannel(UINT8 address, UINT8 data) ;

    int main(void)
    {


    FPULazyStackingEnable();


    SysCtlClockSet(SYSCTL_SYSDIV_20 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ | SYSCTL_OSC_MAIN); //10 MHz


    SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_SSI0);


    SSIClockSourceSet(SSI0_BASE, SSI_CLOCK_SYSTEM);
    SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_3, SSI_MODE_MASTER, SysCtlClockGet()/8, 8);


    GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5);

    GPIOPinConfigure(GPIO_PA2_SSI0CLK);
    GPIOPinConfigure(GPIO_PA3_SSI0FSS);
    GPIOPinConfigure(GPIO_PA4_SSI0RX);
    GPIOPinConfigure(GPIO_PA5_SSI0TX);



    SSIEnable(SSI0_BASE);

    while(SSIDataGetNonBlocking(SSI0_BASE, &ulDataRx))
    {
    }
    WriteDataToSpiChannel(address, data);
    }


    void WriteDataToSpiChannel(UINT8 address, UINT8 data)
    {
    tContext sContext;
    tRectangle sRect;
    uint32_t pui32DataTx[10];
    uint32_t pui32DataRx[10];
    uint32_t temp[10];

    pui32DataTx = data;


    SSIDataPut(SSI0_BASE, &pui32DataTx);

    while(SSIBusy(SSI0_BASE))
    {
    }


    temp = SSIDataGet(SSI0_BASE, &pui32DataRx);

    ////////////////////////////////// OLED DISPLAY ////////////////////////////////


    CFAL96x64x16Init();


    GrContextInit(&sContext, &g_sCFAL96x64x16);


    sRect.sXMin = 0;
    sRect.sYMin = 0;
    sRect.sXMax = GrContextDpyWidthGet(&sContext) - 1;
    sRect.sYMax = 12;
    GrContextForegroundSet(&sContext, ClrDarkBlue);
    GrRectFill(&sContext, &sRect);


    GrContextForegroundSet(&sContext, ClrWhite);
    GrRectDraw(&sContext, &sRect);

    GrContextFontSet(&sContext, g_pFontCm14);
    GrStringDrawCentered(&sContext, temp, -1,
    GrContextDpyWidthGet(&sContext) / 2, 5, 0);

    GrFlush(&sContext);

    while(1)
    {
    }
    }
  • Hi, Looking again into my documentation it seems i am still right, no mistake. Please look into file Tiva/examples/boards/ek-lm4f232/drivers/cfal96x64x16.c and you will find this: “The display structure that describe the drivers are for CFAL9664-F-B1 OLED panel with SSD 1332 controller.” and uses the SPI module. The hello application initializes the display, based on SPI and on line 160 and 167 of hello.c file writes on display. It is also true that the UART is also initialized, but this is secondary thing in your case. In fact, all examples which uses that OLED panel uses the SPI implicitly. Please use this file (cfal96x64x16.c) into your project to display on OLED panel. Regards, EDIT: SSI/SPI are all the same thing!
  • Hello Petrei , Thanks a lot for the solution. It helps me a lot for my application.
    One more doubt, For the dataput function, i.e..... ROM_SSIDataPut(DISPLAY_SSI_BASE, *pcData); , the #define used is
    #define DISPLAY_SSI_BASE SSI2_BASE . But, SSI2_BASE means is that a register address or OLED address!

    If I replace the OLED with other device for SPI communication , from where I should pull the address?

    Thanks in advance.
  • Hi,

    Please note you have three SSI modules on your micro, so if one module is used for an OLED display, then you may use another one for other SSI communication types, and use its base address for the new task.

    In some extreme cases, you may use the same SSI module for other devices, but this means reconfiguration for each type, so it would be better to avoid it, at least for a while, until you get more experienced with this micro.

    Petrei

  • Okay Petrei, will follow your suggestion. thanks for all your inputs and for your time. :)
  • Hello Petrei

    One more input I need from you. May I please know where can I get the addresses/Page related info to OLED. As I am trying to do one line string scroll in oled .
  • Hi,

    I think this display it is not so complicated like others - to write a string you may use the library function void GrStringDraw(..., i32X, i32Y, ...) where you have to refer points i32X, i32Y on display, where the string should be painted. The origin (0,0) is the upper left corner, if I remember well. Anyway, the Tiva/doc folder has a .pdf doc describing all internals of this display/graphics library.

    Look also for display's data sheet.

  • Actually I want to scroll a particular string for some period in a single line. Some idea I got for my application through your response. thank you petrei. I ll try and update the status soon.
    :)
  • Hello Petrei

    I am looking for the line clear function for oled. I tried with this , "Display96x16x1ClearLine(unsigned long ulY); " . but dint worked for me . Is there any other function for clearing a particular line?????
    Thank you
  • yeah the above mentioned command is for ek-lm3s811 launchpad i guess.
  • Hi,

    You need to clear an ACII line (to wipe out a string) - the only method is to draw again a string with the same length as the original, but containing only spaces (0x20).

    Take care in grlib a "line" is a graphical one, as for rectangle drawing. 

    Petrei