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.

using TM4C1294XL for controlling nokia 5110

Other Parts Discussed in Thread: EK-TM4C123GXL

I cant seem to port a program that was working for me on a tm4c123gxl launchpad.  I am trying to control the Nokia 5110 LCD using SSI0 on a TM4C1294XL launchpad.   The application looks pretty straight forward but I doing something wrong.  Can someone please provide some feedback?  I don't see anything coming up on the LCD.

int main(void)
{
	uint32_t l_ui32SysClock = 0;

    // Run from the PLL at 10 MHz and save off setting
    l_ui32SysClock = ROM_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 10000000);

    // enable portA and SSI0
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);

    // enable SSI pins
    ROM_GPIOPinConfigure(GPIO_PA2_SSI0CLK);    // clk pa2
    ROM_GPIOPinConfigure(GPIO_PA3_SSI0FSS);    // fss pa3
    ROM_GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);  // tx, pa5
    ROM_GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);

    // enable DC pin
    ROM_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6);  //dc, pa6

    // Disable SSI0
    ROM_SSIDisable(SSI0_BASE);

    // Configure SSI0
    ROM_SSIConfigSetExpClk(SSI0_BASE, l_ui32SysClock, SSI_FRF_MOTO_MODE_0, SSI_MODE_MASTER, 1000000, 8);

    // Enable SSI0
    ROM_SSIEnable(SSI0_BASE);

    // wait on any prior transaction
    while(ROM_SSIBusy(SSI0_BASE)){}

    // set DC pin for commands (low)
    ROM_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, 0);

    // pin setup time
    ROM_SysCtlDelay(10);

    // LCD INIT
    ROM_SSIDataPut(SSI0_BASE, 0x21);// chip active
    ROM_SSIDataPut(SSI0_BASE, 0x13);// LCD bias mode 1:48
    ROM_SSIDataPut(SSI0_BASE, 0xB8);// 0xB8 (for 3.3V blue SparkFun)
    ROM_SSIDataPut(SSI0_BASE, 0x20);// send 0x20 before modifying the display control mode
    ROM_SSIDataPut(SSI0_BASE, 0x0C);// set display control to normal mode
    ROM_SSIDataPut(SSI0_BASE, 0x80);// x origin 0
    ROM_SSIDataPut(SSI0_BASE, 0x40);// y origin 0

    // wait on any prior transaction
    while(ROM_SSIBusy(SSI0_BASE)){}

    // set DC pin for data (high)
    ROM_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, GPIO_PIN_6);

    // pin setup time
    ROM_SysCtlDelay(10);

    // data
    ROM_SSIDataPut(SSI0_BASE, 0x00);//
    ROM_SSIDataPut(SSI0_BASE, 0x52);// 'R'
    ROM_SSIDataPut(SSI0_BASE, 0x00);//

    ROM_SysCtlDelay(10000);

	while (1){}
}

Pin setup on LCD side:

  • RST  - empty
  • CE    - PA3
  • DC    - PA6
  • DIN   - PA5
  • CLK  - PA2
  • Vcc   - +3V3
  • Gnd -  GND

Thanks in advance!

  • Hello Hiowatha

    Data sheet for the display, please to understand the requirements?

    Regards

    Amit

  • hiowatha said:

    Pin setup on LCD side:

    • RST  - empty
    • CE    - PA3
    • DC    - PA6
    • DIN   - PA5
    • CLK  - PA2
    • Vcc   - +3V3
    • Gnd -  GND

     Hi, my question are silly but check you did'nt provided enough details so:

     Application was working on 123 Launchpad has one LP socket. Have you removed the zero Ohm resistors or not?

     It work on 123, code appear to be ok also for 1294 too.

     - Is BP socket the right one carrying PA signals (BP2) ?

     - Are line selection jumper set to Port A?

     - At last but not least, are wiring correct?

     Did you own a LA or at almost a tool like saleae Logic 8/16  ?

     Remove LCD and monitor interface to inspect if signal are ok.

  • Hello Hiowatha,

    I think the problem is

     ROM_GPIOPinConfigure(GPIO_PA5_SSI0XDAT1);  // tx, pa5

    It should be

     ROM_GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);  // tx, pa5

    Even the next API call for GPIOPinTypeSSI should have PA4 and not PA5

    Regards

    Amit

  • look on my initializatin, in my code I use RST pin,

    void LcdInitialization()
    {
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, 0x00);  // sce
        GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, 0x00);  // res
    
      
       // Delay to keep printing speed reasonable. About 100 milliseconds.
       //
        ROM_SysCtlDelay(ROM_SysCtlClockGet() / (10 * 3));
     
        GPIOPinWrite(GPIO_PORTB_BASE, GPIO_PIN_5, GPIO_PIN_5);  // res
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, GPIO_PIN_6);  // sce
    
        LcdWriteCommand( 0x21 );                    // LCD Extended Commands.
        LcdWriteCommand( 0xC8 );                    // Set LCD Vop (Contrast).
        LcdWriteCommand( 0x06 );                    // Set Temp coefficent.
        LcdWriteCommand( 0x13 );                    // LCD bias mode 1:48.
        LcdWriteCommand( 0x20 );                    // LCD Standard Commands, Horizontal addressing mode.
        LcdWriteCommand( 0x08 );                    // LCD blank
        LcdWriteCommand( 0x0C );                    // LCD in normal mode.
    }

  • look on  IO

    void LcdIoInitialization()
    {
      
        ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
        GPIOPinTypeGPIOOutput(GPIO_PORTB_BASE, GPIO_PIN_5);  //  rts
      
    
        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6);  // sce
        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7);  //  dc
        
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    
    
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    
    
        GPIOPinConfigure(GPIO_PA2_SSI0CLK);
        GPIOPinConfigure(GPIO_PA3_SSI0FSS);
        GPIOPinConfigure(GPIO_PA4_SSI0RX);
        GPIOPinConfigure(GPIO_PA5_SSI0TX);
    
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |
                       GPIO_PIN_2);  
      
    }
    
    

    and SPI

    void LcdSpiInitialization()
    {
        SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
                           SSI_MODE_MASTER, 1000000, 8);
        SSIEnable(SSI0_BASE);  
    }

  • Amit Ashara said:

     ROM_GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);  // tx, pa4

     Right, but pin OF PA are same on 123 and 129 series.. It is this code  working on 123 but not on 129 where tx and rx pin are reversed.... OK NEED take care between close parent family

     ******************* from 1294 Data Sheet ********************************

    SSI0Clk 35 PA2 (15) I/O TTL SSI module 0 clock
    SSI0Fss 36 PA3 (15) I/O TTL SSI module 0 frame signal
    SSI0XDAT0 37 PA4 (15) I/O TTL SSI Module 0 Bi-directional Data Pin 0 (SSI0TX in
                                 Legacy SSI Mode).
    SSI0XDAT1 38 PA5 (15) I/O TTL SSI Module 0 Bi-directional Data Pin 1 (SSI0RX in
                                 Legacy SSI Mode).
    SSI0XDAT2 40 PA6 (13) I/O TTL SSI Module 0 Bi-directional Data Pin 2.
    SSI0XDAT3 41 PA7 (13) I/O TTL SSI Module 0 Bi-directional Data Pin 3.

    ++++++++++++++++++++++++   From 123 data sheet ++++++++++++++++++++++++++

    Table 15-1. SSI Signals (144LQFP)
    Pin Name Pin Number Pin Mux / Pin Assignment   Pin Type Buffer Type Description

    SSI0Clk 39 PA2 (2) I/O TTL SSI module 0 clock
    SSI0Fss 40 PA3 (2) I/O TTL SSI module 0 frame signal
    SSI0Rx 41 PA4 (2) I TTL SSI module 0 receive
    SSI0Tx 42 PA5 (2) O TTL SSI module 0 transmit


  • P.S.

    my code is for x123

  • Lukasz said:
    GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA3_SSI0FSS); GPIOPinConfigure(GPIO_PA4_SSI0RX); GPIOPinConfigure(GPIO_PA5_SSI0TX);

     Hi Lucasz, this also on TM4C129?

     I used SPI on 123 and follow your code but I don't used on 129 and pin appeared to me as reversed.. Maybe I do some test on silicon.

  • my code is working on EK-TM4C123GXL launchpad

  • Lukasz said:
    my code is working on EK-TM4C123GXL launchpad

     Right and if hardware pin are reversed and BP on connected launchpad don't care of SPI, BoosterPack are out of luck thru family.

  • So I have a few things to try:

    • I didn't realize the pins had "flipped" between the 123 and the 129.  That means I should be using P4 vs P5 on the 129.  It should be the TX on the 129 which goes the the DIN on the LCD.  Thanks for catching that guys. 
    • I also notice that Lukasz enables the RX pin as well.  Not sure if that matters, but can try that.  I was not configuring that pin on my 123 and it worked fine without it, but maybe the 129 is pickier?
    • The other thing of note is that reset pin which Lukasz uses as well.  I did have that on the 123 but was lazy and didn't port it over to the 129 example.  Maybe that is messing things up as well?

    I will try all these suggestions see if that helps.   This is home project, so I'll verify it when I get home and let you guys know.

    Again thank you all for the help and advice.

  • Hello Hiowatha,

    1. Yes it has flipped

    2. The function of RX pin has not changed between 123 and 129

    Regards

    Amit

  • hiowatha said:
    • I didn't realize the pins had "flipped" between the 123 and the 129.  That means I should be using P4 vs P5 on the 129.  It should be the TX on the 129 which goes the the DIN on the LCD.  Thanks for catching that guys. 

     Power of the forum we learn all ;)

    hiowatha said:
    • I also notice that Lukasz enables the RX pin as well.  Not sure if that matters, but can try that.  I was not configuring that pin on my 123 and it worked fine without it, but maybe the 129 is pickier?

     No it work same way, just take account of different pin usage

    hiowatha said:
    • The other thing of note is that reset pin which Lukasz uses as well.  I did have that on the 123 but was lazy and didn't port it over to the 129 example.  Maybe that is messing things up as well?

     I bough some of these LCD some time ago but I never used. If 123 work without Reset, no reason to add to 129. Just take care of timing when you raise up clock from 10 to 120MHz

  • Amit Ashara said:

    1. Yes it has flipped

    2. The function of RX pin has not changed between 123 and 129

     Hi Amit, some bad kind of viruses not enough information issue has get control of you on  ;)

     1 flipped r/tx?

     2 can you be more selective on if PIN or connection from BPack

  • There is yet another (possible/likely) "fly in this ointment."  That Lcd vendor has past supplied that Nokia-like Lcd with 2 different Control ICs - and these required different treatment!   (such is always a delight...)

    Seems more efficient to create an adapter board which can be fed by a variety of launchpads - and which can support multiple style/types of displays.  Suggest 2x16, perhaps 4x20 character modules and 122x32 and 128x64 graphic - all lcd.   Oleds are also an option although far more expensive unless ~1" diagonal (or so) in size.

    It should be possible to "stylize" the most "usual" parallel and/or serial connection schemes - and to produce "known good" code - in support of both the "normal" TM4C & 129 family - reducing, "each/every" Lcd use issue to pretty much a cook-book implementation.

    Proper setting/accommodation of contrast voltage often proves challenging.  (elevated voltage requirements for Oled)

    Unknown is the condition of poster's Lcd - whether it has survived ESD throughout its passage thru the "surplus market" - and thus may defy the best efforts of all here...

    Answering every such post uniquely is bound to be repetitive - subject to variation - and in no one's, "best interest..."

  • cb1- said:

    Unknown is the condition of poster's Lcd - whether it has survived ESD throughout its passage thru the "surplus market" - and thus may defy the best efforts of all here...

     Hi CB1, LCD5110 lcd are popular on hobbist but also on some TI devkit to demonstrate graphics.

     This color LCD  never got used by Nokia and was thrown to parallel market, SO I own some brand new I never used.

     If the first was working on 123 the latter require pin change from PA.5 to PA.4

  • @ Roberto,

    Hi back.  Iirc - original poster here never reported his Lcd as, "working."  (the one working w/123 MCU was reported by a follow-up poster)  Thus the possibility of dead display remains.  And - the source vendor of op's display is well known to have sold displays w/2 different control ICs - each requiring somewhat different set-up/config.

    Do you agree that some "stylized" display solution will prove far better than, "guess/trial-error" method (if we can call it that) too often in evidence here...  (i.e. endless "re-inventing" of a known/perfected wheel...)

  • hiowatha said:

    cant seem to port a program that was working for me on a tm4c123gxl launchpad.  I am trying to control the Nokia 5110 LCD using SSI0 on a TM4C1294XL launchpad.   The application looks pretty straight forward but I doing something wrong.  Can someone please provide some feedback?  I don't see anything coming up on the LCD.

    
    

     HI Hiowatha, as CB1 pointed I reread with more care your text, Is this display still working on 123 launchpad?

     Are you using a BoosterPack or simple LCD wired to?

  • cb1- said:
    Do you agree that some "stylized" display solution will prove far better than, "guess/trial-error" method (if we can call it that) too often in evidence here...  (i.e. endless "re-inventing" of a known/perfected wheel...)

     Perfectly agree in full. I don't use in a production still can be evaluated when cost is a constraint in a not larger volume.

    cb1- said:
    And - the source vendor of op's display is well known to have sold displays w/2 different control ICs - each requiring somewhat different set-up/config.

     I confirm exchanging the LCD of a Sony cell phone and none of new part worked and still working one cannot be exchanged on two equal phone....

     The one you probably remember is the B/W nokia 3324 series from Epson or Philips.

     As I wrote this LCD is still in his box and may be need go to selling channel or gifted to some student, standard LCD price dropped down too much and are available in every quantity.

  • Thank you all for the attention, honestly appreciate it.

    So to level set: this LCD was working as of say 2 days ago.  The LCD is a stand alone LCD and as recently as 2 days ago I saw it working with the TM4C123GXL.  I will try it again tonight with the TM4C123GXL to make sure I haven't burned it or something.

    This was mostly a learning experiment for myself.  I was trying to get the TM4C1294XL to play along with the LCD using SPI.  Since it was working with the TM4C123GXL  I figured it was going to be a pretty simple port.  The previous code did not use the ROM bootloader API's either, so I was also trying those out as well.

    I did miss something obvious which was that the PA4 and PA5 pins had been flipped between TM4C1294XL and TM4C123GXL, so I can try that as soon as I get home.  I will post my results soon.

    Thanks again.

  • Hello Roberto,

    I meant the direct response for the first two points as mentioned by Hiowatha!!!

    Rephrasing

    1. The SSI0RX (PA4) and SSI0TX (PA5) between TM4C123 and TM4C129 has flipped. On TM4C129 it is SSI0TX (PA4) and SSI0RX (PA5).

    2. Even if the connection is the same on the board, the existing configuration that the poster has will cause the RX pin to be selected and not the TX pin for SSI function. If all 4 lines of configuration were put then it would not have been a problem as the PCTL encoding is the same.

    Regards

    Amit

  • Thanks again to all you guys.  Definitely good pointers from all.

    So i got this working by doing 2 things.  I enabled pin A7 to use as my RST LCD pin.  I also changed from using P5 to P4 as originally suggest by Amit.  That did the trick.  I now believe the main mistake was the P4/P5 inversion I had.  If I have time I will come back to prove that but to put this discussion to rest, I believe the issue was the P4/P5 inversion between the two launchpads.

    Again many thanks to you guys.  :-D

  • Hello,

    does the code in the main post work? I fixed the inverted two pins and used A7 to make a reset puls before initialization, but I get just black screen.

    Could someone help me to solve that?

    And could anybody recommend any library to deal with this LCD? 

    Here is my code:

    int main(void)
    {
        uint32_t l_ui32SysClock = 0;
    
        // Run from the PLL at 10 MHz and save off setting
        l_ui32SysClock =     SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                SYSCTL_CFG_VCO_480), 60000000);
    
        // enable portA and SSI0
        SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
        SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
    
    
        // enable SSI pins
        GPIOPinConfigure(GPIO_PA2_SSI0CLK);    // clk pa2
        GPIOPinConfigure(GPIO_PA3_SSI0FSS);    // fss pa3
        GPIOPinConfigure(GPIO_PA4_SSI0XDAT0);  // tx, pa4
        GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4);
        GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_7);
        SysCtlDelay(300);
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7, GPIO_PIN_7);
        // enable DC pin
        //GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_6);  //dc, pa6
    
        // Disable SSI0
        SSIDisable(SSI0_BASE);
    
        // Configure SSI0
        SSIConfigSetExpClk(SSI0_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
                           SSI_MODE_MASTER, 100000, 8);
        while(SSIBusy(SSI0_BASE)){}
    
        // Enable SSI0
        SSIEnable(SSI0_BASE);
    
        // wait on any prior transaction
        while(SSIBusy(SSI0_BASE)){}
    
        // set DC pin for commands (low)
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, 0);
        // pin setup time
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7, 0);
        SysCtlDelay(50000);
    
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_7, GPIO_PIN_7);
    
        // LCD INIT
        SSIDataPut(SSI0_BASE, 0x21);// chip active
        SSIDataPut(SSI0_BASE, 0x13);// LCD bias mode 1:48
        SSIDataPut(SSI0_BASE, 0xB8);// 0xB8 (for 3.3V blue SparkFun)
        SSIDataPut(SSI0_BASE, 0x20);// send 0x20 before modifying the display control mode
        SSIDataPut(SSI0_BASE, 0x0C);// set display control to normal mode
        SSIDataPut(SSI0_BASE, 0x80);// x origin 0
        SSIDataPut(SSI0_BASE, 0x40);// y origin 0
    
        // wait on any prior transaction
        while(SSIBusy(SSI0_BASE)){}
    
        // set DC pin for data (high)
        GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_6, GPIO_PIN_6);
    
        // pin setup time
        SysCtlDelay(10);
    
        // data
        /*
        SSIDataPut(SSI0_BASE, 0x00);//
        SSIDataPut(SSI0_BASE, 0x52);// 'R'
        SSIDataPut(SSI0_BASE, 0x00);//
    */
        SysCtlDelay(10000);
    
        while (1){}
    }