Jump to content
Rei Vilo

[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 :)

Share this post


Link to post
Share on other sites

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.

WITH_COPY_PASTE
*** 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 

WITH_FULL_SCREEN
*** 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, 

WITH_FULL_SCREEN
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.

Share this post


Link to post
Share on other sites

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

post-574-14264605294947_thumb.jpg

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.

 

Regards,

Calin

 

Share this post


Link to post
Share on other sites

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.

 

post-389-14264605305423_thumb.png
 
icon_e_smile.gif
 
This is a cross-post with the 43oh forum.

Share this post


Link to post
Share on other sites

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

attachicon.gifsck.jpg

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.

Share this post


Link to post
Share on other sites

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.

Share this post


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

Share this post


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 :)

Share this post


Link to post
Share on other sites

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):

http://www.ebay.at/itm/201042408158?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

 

So, thank you, Rei Vilo!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×