9 Replies Latest reply on Jul 21, 2016 12:11 AM by gavinkoh70

    Intel Edison  board interfacing with 2.4 inch LCD TFT Screen

    rahul147258

      Hi,

      I procured the LCD TFT 2.4 inch. as like  present on this link.2.4 Inch TFT LCD Touch Screen Module For Arduino .

      I have Interfaced this LCD with Arduino UNO .It works well...By Including several TFT Adafruit_GFX library.

       

      when I am interfacing with Intel Edison Breakout board with Arduino IDE with TFT 2.4 inch LCD breakout board.

      I am not able to interface it.they are asking me to include Extra libaraary such as "avr/io".after including it also the program is not working.

      Now can anyone tell me what kind of Library to be included in order to work with Intel Edison breakout board with LCD TFT screen.

       

      IF anyone worked On it Please tell me what and all extra library to be included for their working.

       

       

      thanks

        • 1. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi rahul147258 ,

          The error you are getting is because the library is not supported by Edison. It works on Arduino UNO because the library is based on the AVR architecture. Since Edison has a different architecture you are getting that error and the library won't work.

          I'm not sure if it's the same TFT display as yours, but in the following threads, other users have been able to use TFT displays with Edison and the library you are using has been modified to work with Edison. I haven't test them by myself, but I recommend you to check those threads. You might find them useful.

          I think that the last thread discusses the same error you are getting. The user was able to use the display after a couple of modifications, however he used a Galileo board, but you could give it a try with Edison as well.

          Regards,
          Diego
          • 2. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
            rahul147258

            hi, Diego

            Have gone through all this procedure  and I faced several issues..

            I wanted to interface 2.4 inch TFT LCD  which seems like it has controller SPfd5408.. with Intel edison breakout board.

            Now  i have gone to the library which ur provided for the" ILI9341 https://communities.intel.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2FKurtE%2FAdafruit_ILI9341%2Ftree%2FIntel-… ".

            1) can u tell me whether this libraray suports for My  2.4 inch  TFT LCD? because when i uploaded the graphics test program from this libaray it get compile.and There were no Error in Console Window..But output din come On LCD...

            2)can u tell me how to change the IL9341 lIbaray details for making it to work with spfd5408 TFT LCD??

            3)can u tell me any alternative way to handle this issue?

            4) i have downloaded the Spfd5408 controller Libraray from GitHub - JoaoLopesF/SPFD5408: Adafruit Libraries changed to works in TFT 2.4 shields with the SPFD5408 controller for Ar… .

            5) now i am not able to proceed farher.For UR information I have tested this LCD with arduino its working fine i just downaloded GFX and TFT libraray foo arduino it was working welll...

             

            Please make it for edison..

             

             

            5) please help me i am keen to learn about thses things...

             

             

            your Obidient RAHUL

            THANKS

            • 3. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
              Intel Corporation
              This message was posted on behalf of Intel Corporation

              Hi Rahul,

              As we mentioned before, the TFT display hasn't been tested by us, and the library mentioned in the thread previously pointed was modified by another user who was able to setup the display. If you are using a different TFT screen or driver, then you would have to make the proper changes to the library or code to make it work. An option would be to contact the author of the modified library through Github since he was the one who did the proper changes to make it work.

              Regards,
              -Pablo

              • 4. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
                gavinkoh70

                Well, I have had some experience converting existing display libraries to work under Intel Edison. Worked on two different ones:

                 

                You have absolutely no choice but to convert existing libraries. These libraries are usually already configured to run under Arduino, and you must convert them to run under the Intel Edison. It's not an easy task, but it can be done. Allow me to present you some examples of how I converted their source code from Arduino to let them run on the Intel Edison.

                 

                First, here's an extract of the Github source code for the two displays I mentioned above.

                 

                From Sumotoy's RA8875 Github, we have:

                void RA8875::_writeData(uint8_t data)
                {
                  _startSend(); // delete this section - not relevant to Intel Edison 
                  #if defined(___DUESTUFF) && defined(SPI_DUE_MODE_EXTENDED) // delete this section
                    SPI.transfer(_cs, RA8875_DATAWRITE, SPI_CONTINUE);
                    SPI.transfer(_cs, data, SPI_LAST);
                  #else
                  #if defined(__AVR__) && defined(_FASTSSPORT) // delete this section
                    _spiwrite(RA8875_DATAWRITE);
                    _spiwrite(data);
                  #else
                  #if defined(SPI_HAS_TRANSACTION) && defined(__MKL26Z64__) // delete this section
                    if (_altSPI){
                      SPI1.transfer(RA8875_DATAWRITE);
                      SPI1.transfer(data);
                    } else {
                      SPI.transfer(RA8875_DATAWRITE);
                      SPI.transfer(data);
                    }
                  #else
                    SPI.transfer(RA8875_DATAWRITE); // preserve this for Intel Edison
                    SPI.transfer(data); // preserve this for Intel Edison
                  #endif
                  #endif
                  #endif
                  _endSend(); // delete this section - not relevant to Intel Edison 
                }
                

                 

                From wallacezq's Github for the Adafruit display, we have:

                uint8_t Adafruit_ILI9341::readdata(void) {
                   digitalWrite(_dc, HIGH); // preserve this for Intel Edison
                   digitalWrite(_cs, LOW); // preserve this for Intel Edison
                   uint8_t r = spiread(); // preserve this for Intel Edison
                   digitalWrite(_cs, HIGH); // preserve this for Intel Edison
                   return r; // preserve this for Intel Edison
                }
                
                uint8_t Adafruit_ILI9341::spiread(void) {
                  uint8_t r = 0; // preserve this for Intel Edison
                  if (hwSPI) { // only using hardware SPI, so will delete the else portion
                #if defined (__AVR__) // delete this section
                    uint8_t backupSPCR = SPCR;
                    SPCR = mySPCR;
                    SPDR = 0x00;
                    while(!(SPSR & _BV(SPIF)));
                    r = SPDR;
                    SPCR = backupSPCR;
                #elif defined (__arm__) // delete this section
                    SPI.setClockDivider(11); // 8-ish MHz (full! speed!)
                    SPI.setBitOrder(MSBFIRST);
                    SPI.setDataMode(SPI_MODE0);
                    r = SPI.transfer(0x00);
                #elif defined (__X86__)
                    r = SPI.transfer(0x00); // preserve this for Intel Edison
                #endif
                  } else { // delete this section
                    for (uint8_t i=0; i<8; i++) {
                      digitalWrite(_sclk, LOW);
                      digitalWrite(_sclk, HIGH);
                      r <<= 1;
                      if (digitalRead(_miso))
                  r |= 0x1;
                    }
                  }
                  //Serial.print("read: 0x"); Serial.print(r, HEX);
                  return r; // preserve this for Intel Edison
                }
                

                 

                Here are the corresponding changes I made to enable the RA8875 and ILI9341 on the Intel Edison. You should notice a pattern:

                void RA8875::_writeData(uint8_t data)
                {
                  digitalWrite(_cs, LOW); // there ought to be some chip select to turn on the display
                  SPI.transfer(RA8875_DATAWRITE); // next send out the command
                  SPI.transfer(data); // followed by sending out the data
                  digitalWrite(_cs, HIGH); // turn off the chip select
                }
                
                uint8_t Adafruit_ILI9341::readdata(void) {
                  digitalWrite(_dc, HIGH); // select data instead of command for the D/CX pin
                  digitalWrite(_cs, LOW); // there ought to be some chip select to turn on the display
                  uint8_t r = spiread(); // read in the data
                  digitalWrite(_cs, HIGH);  // turn off the chip select
                  return r;
                }
                
                uint8_t Adafruit_ILI9341::spiread(void) {
                  uint8_t r = 0;
                  r = SPI.transfer(0x00); // read in the data from 0x00
                  return r; // return the data that is read in
                }
                

                 

                Notice how I deleted chunks of conditional compilation code that was not relevant to the Intel Edison (eg, _DUESTUFF, SPI_HAS_TRANSACTION, __AVR__, and __arm__).

                 

                If your hardware provider support is excellent, you can usually use the library as provided (no changes required). However, sometimes the library could benefit from tidying up as you add more even more of your own functionally; in that case, keep parts of code that are Intel Edison compatible, (eg,  __X86__), and delete everything else that is irrelevant. Of course, you may say there's no benefit to tidying code that way, but it's entirely up to you.

                 

                When the classes are constructed, you also need to determine the initialization method, for example, whether _CS (chip select) is required, _CLK (clock), etc. Check the hardware specifications, for example, I looked up the RA8875 and ILI9341 docs to make sure I wouldn't be talking Greek to the display hardware.

                 

                An example: During Initialization (like RA8875::begin and RA8875::_initialize), you must be wary of commands that are hardware specific, things like "SPI.setClockDivider(SPI_SPEED_WRITE);" For example, you could try to use slower clock speeds, or change timing delays (in accordance with timing diagrams from the hardware specs). Do this only if you are not certain if it would work with your display. A simple blank screen could be caused by overclocking from the Intel Edison - that's a bit of an exaggeration, but who knows, it might happen to you.

                 

                Once all your code has been pared down, you will notice a distinct pattern in getting hardware displays to work on the Intel Edison. Look at and compare and contrast between the modified RA8875 and ILI9341 code in the second code box above. PS - these code snippets actually do work with the Intel Edison.

                 

                So in summary, make absolutely sure that your SPI R/W command and data functions are similar to what I have done above, get the initialization script reworked properly, check the specs document to confirm hardware specific issues are ironed out, then test a few key drawing features - something fundamental like drawing a pixel or invoking a clearscreen.

                 

                If and when your display finally works on the Intel Edison, give yourself a big hearty pat on the back!

                • 5. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
                  rahul147258

                  Thanks for help,

                  see now I think the LCD which I a m using is having spdf5048 controller and the LCD does not have SPI communication. what are Modification must be done for interfacing with Intel Edison.

                  I have downloaded the library from this Link can u tell me wat modification must be one.

                  GitHub - JoaoLopesF/SPFD5408: Adafruit Libraries changed to works in TFT 2.4 shields with the SPFD5408 controller for Ar…

                  now please guide me what changes must be Done??

                   

                  thanks for helping ..I understood ur code but that will work on SPI communication. Right now my requirement is this 2.4 TFT LCD

                   

                   

                  Thanks

                  • 6. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
                    gavinkoh70

                    I think the problem is found in pin_magic.h.

                     

                    There are conditional compiles aplenty in there that is hardware specific to the Arduino Board and its variants. You need to find a set of code that works for the Intel Edison, otherwise you have to refer to the hardware specs of the display chip and rewrite that file.

                     

                    Examples:

                    Line 67 -

                    #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__) || defined(__AVR_ATmega8__)

                     

                    Line 134 -

                    #elif defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__)

                     

                    Line 165 - I believe your code is compiling to this section of code... look through to see why it is not working? Are changes required? Do you have to use another #if section?

                    #else // Mega w/Breakout board

                     

                    Line 71 - Will this section of code be necessary? You decide.

                    #ifdef USE_ADAFRUIT_SHIELD_PINOUT

                    • 7. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
                      gavinkoh70

                      Also, be cognizant of the Intel Edison core code. For me, it's installed over at:

                      [USERS]\AppData\Local\Arduino15\packages\Intel\hardware\i686\1.6.7+1.0\cores\arduino

                      [USERS]\AppData\Local\Arduino15\packages\Intel\hardware\i686\1.6.7+1.0\variants

                       

                      Files like pins_arduino.h and wiring_digital.h in these folders must be included and will need to match up with whatever has been coded for the spdf5048 (arduino version). You will need to translate them so that the right pin and calling method is used.

                       

                      So, if you keep getting compilation errors, look inside all of these files.

                       

                      I won't be able to help you much since I don't have this display card in my inventory.

                       

                      Good luck!

                      • 8. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
                        gavinkoh70

                        Another thing.

                         

                        Looking at this diagram tells me that quite a number of pins would be used. Please also check the Intel Edison hardware specs document (at http://download.intel.com/support/edison/sb/edisonarduino_hg_331191007.pdf ) to ascertain the pins are configured correctly.

                        DIS2508_img2.jpg

                        • 9. Re: Intel Edison  board interfacing with 2.4 inch LCD TFT Screen
                          rahul147258

                          Thanks for replying

                           

                           

                          when I interfaced this with arduino I have to utilize all the pins from arduino except pin number A5.so I tried to interface same with Intel Edison board arduino expansion board.

                           

                          from this  Diagram I have to utilize all the  pIns.

                           

                          thanks