Jump to content

[Energia Library] LCD_screen Library Suite

Recommended Posts

I'm using a SD-card instead of SRAM as cache to save / retrieve a screen area when displaying a dialog box for my LCD_screen library.


I'm using the FatFs library and it works fine except the program freezes just after. I suspect a memory leak and / or a memory overflow.


How to measure the free SRAM with Energia? I guess it's going to be the difference between a HEAP and a STACK.


I've started the dedicated thread HELP - How to Measure Free SRAM with Energia as this measure could be helpful for other projects.


Thank you :)

Link to post
Share on other sites
  • Replies 94
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

As of October 2015 and due to intellectual property issues and licence infringements with users, the LCD_screen Library Suite is no longer available for download.   A special edition of the library is

Good news! The LCD_GUI library is available and brings the usual elements of a graphic interface as: label, button, dialog box, menu, slider and text box.     The project is based on a LaunchP

Give me some time to get some rest!   IMHO, implementing SD-card instead of SRAM shouldn't be difficult. You need to change 2 functions: void LCD_HY28A_SRAM::_fastCopyAreaToSRAM(uint16_t x0, uint1

Posted Images

Some news about interfacing a screen with a SD-card: it works!


For the GUI example, program freezes suddenly. I suspect some memory issues, as memory leak.

*** FatFs on SPI 3 ok
Kentec 3.5 + SD screen
Orientation: 0
0: Original     28 ms
1. point readPixel      70 ms
2. copyPaste    46 ms
3. copy-paste SD      301 ms

A full screen copy / paste using the SD-card requires 

*** FatFs on SPI 3 ok
Kentec 3.5 + SD screen
0: Original     32 ms
1: Copy SD 2410 ms
2: Paste SD        828 ms

To give an idea, 

HY28A + SRAM screen
0: Original     565 ms
1: Copy SRAM 7395 ms
2: Paste SRAM         1213 ms

I need to investigate the FatFs code more thoroughly. For the moment, I've just plugged-and-played with the FatFs library.

Link to post
Share on other sites

@@Rei Vilo - check SCK stability(logic tester). See on my 3,5,8 bit SCK:


Maybe for test try to reduce SPI speed to SPI_CLOCK_DIV16.



Remember about pullup resistor on MISO (for me it is necessary):

Hi Grant,

Try to add a pull-up resitor of 1K to MISO pin. The original driver enables the weak pull-up for MISO, but in the the Energia SPI lib it is not enabled. You can also try to set the MISO pin with pinMode(MISO, INPUT_PULLUP) before SPI.begin.





Link to post
Share on other sites
  • 2 months later...

Thanks to the 43oh forum, I received one 4D Systems uLCD-32WPTU screen with BoosterPack for Stellaris LaunchPad to test.


It is an all-in-one screen module featuring touch, SD card, built-in fonts and speaker.


Please find my review and the updated LCD_screen Library Suite for Energia.


This is a cross-post with the 43oh forum.
Link to post
Share on other sites

@@Rei Vilo - check SCK stability(logic tester). See on my 3,5,8 bit SCK:


Maybe for test try to reduce SPI speed to SPI_CLOCK_DIV16.



Remember about pullup resistor on MISO (for me it is necessary):


Yes, I've already noticed that, at high speed like SPI_CLOCK_DIV2 = 8 MHz, bits aren't sent at a regular pace but rather in burst mode.


I checked this with Energia and it seems to comply with SPI protocol. Anyway, it works, except when SPI chips are on a breadboard.


I also suspect some memory leaks on the SD-card library.

Link to post
Share on other sites
  • 5 months later...

The ILI9225B-based BoosterPack now runs on the Connected LaunchPad on the BoosterPack #1.


I'm facing an issue with SPI speed that tops at 4 MHz, actually the same I experienced with the Stellaris LaunchPad.


Although the ILI9225B controller features pixel reading, the ILI9225B isn't exactly compliant with the SPI protocol, as only one data line merges MOSI and MISO. So reading pixels isn't implemented.

Link to post
Share on other sites

This is quite easy.


1. Change the constructor of the ILI9225 object for


#if defined(ENERGIA) // LaunchPads specific

Screen_ILI9225B::Screen_ILI9225B(uint8_t version)


                                    // Pin number / LaunchPad MSP430 / LM4F120 TM4C123

    _pinScreenCS            = 2;    // 2  / P1_0 / PB_5;

    _pinTouchClock          = 7;    // 7  / P1_5 / PB_4;

    _pinTouchMOSI           = 15;   // 15 / P1_7 / PB_7;

    _pinTouchMISO           = 14;   // 14 / P1_6 / PB_6;

    _pinScreenDataCommand   = 6;    // 6  / P1_4 / PE_5;

    if (version == 1) {

        _pinTouchCS         = 9;    //  9 / P2_1 / PA_6;

    } else {

        _pinTouchCS         = 10;   // 10 / P2_2 / PA_7;


    _pinReset               = 11;   // 11 / P2_3 / PA_2;


I'm using the pin numbers instead of the pin names.
If you want to place the screen on the second BoosterPack,
  • just add 40 to the pin numbers
  • and change the SPI port from 2 to 5 (not tested yet)

    SPI.setModule(2); // SPI 2 for BoosterPack 1

    SPI.setModule(5); // SPI 5 for BoosterPack 2
2. Each time there's a 

#if defined(__LM4F120H5QR__)


add to it


#if defined(__LM4F120H5QR__) || defined(__TM4C123GH6PM__) 

My project compiles and works perfectly when I use embedXcode but no longer when I use Energia :o
Link to post
Share on other sites

For the beta release 122 with support for the ILI9225B-based screen, have a look here.


The whole structure of the library suite has been refactored around an abstract object with pure virtual functions. 


The whole library compiles and runs fine with embedXcode but may rise issues with Energia. 


I haven't had enough time to investigate.


Enjoy :)

Link to post
Share on other sites
  • 2 weeks later...

Just wanna report, that a cheap ILI9225 TFT from ebay runs perfectly with the beta release 122 (without the not implemented touchscreen)! 

The special thing with this TFT is, that it is full 5V compatible (ok, not useful with tiva launchpad, but with any +5V-Boards):



So, thank you, Rei Vilo!

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...