Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 2 1 2 LastLast
Results 1 to 25 of 27

Thread: Teensy 4.0 + RA8875

  1. #1
    Junior Member
    Join Date
    Jan 2020
    Posts
    16

    Teensy 4.0 + RA8875

    Hey guys,

    So currently I have hooked up an 4.3" RA8875 TFT screen to my teensy 4.0 and it works fine.
    I was just wondering if there was some intuitive program that could be used as a GUI editor, such as Qt or GUIslice builder.
    Both of these claim to have support for the Teensy 4.0 and/or the RA8875 screens, but I cannot find any documentation or tutorials on how to get this to work.

    Any and all help is appreciated.

    Kind regards.

  2. #2
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    To give an update, this is how far i've come myself:

    Click image for larger version. 

Name:	0ee5e88b5aab5fd010eb419f593a87ba.png 
Views:	0 
Size:	2.9 KB 
ID:	19059

    This is what i created in GUI Slice Builder

    Click image for larger version. 

Name:	a45be442-2f2e-4529-8373-a7c10f64cf21.jpg 
Views:	3 
Size:	62.4 KB 
ID:	19060

    This is what my display shows. So technically i'm close, but also far off.

    This is the test file that was generated by GUI Slice Builder:
    https://pastebin.com/uCYMP7TF

    This is the config I've adapted:
    https://pastebin.com/CNyXVLm9

  3. #3
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    You may want to check you display resolution:
    Code:
      // Select the RA8875 display resolution:
      // - RA8875_480x272 = 480x272 (4.3" display)
      // - RA8875_800x480 = 800x480 (5" and 7" displays)
      #define DRV_DISP_ADAGFX_RA8875_INIT RA8875_800x480
    You may need to change this is 480x272 instead of 800x480. Never used these builders so would have to dig into it. You may have to edit display file as well for your display not sure

  4. #4
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by mjs513 View Post
    You may want to check you display resolution:
    Code:
      // Select the RA8875 display resolution:
      // - RA8875_480x272 = 480x272 (4.3" display)
      // - RA8875_800x480 = 800x480 (5" and 7" displays)
      #define DRV_DISP_ADAGFX_RA8875_INIT RA8875_800x480
    You may need to change this is 480x272 instead of 800x480. Never used these builders so would have to dig into it. You may have to edit display file as well for your display not sure
    I did not see this, thanks for your keen eye. I will try this first thing in the morning.
    Also, there is an DPI setting, would this, or could this affect the way the screen works? If so, I couldn't find the DPI value of the Adafruit RA8875 480x272 4.3" display anywhere, and measuring it up manually would seem a bit inaccurate.

  5. #5
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    The dpi setting is the 480x272. Yep it can define the way it works but you have to give it a try. If you look at the comments right about what I think you may want to try is:
    Code:
    #define DRV_DISP_ADAGFX_RA8875_INIT RA8875_480x272
    which the comment next to is says is for a 4.3in display. The way its set up is for a RA8875 800x480 dpi display.

  6. #6
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by mjs513 View Post
    The dpi setting is the 480x272. Yep it can define the way it works but you have to give it a try. If you look at the comments right about what I think you may want to try is:
    Code:
    #define DRV_DISP_ADAGFX_RA8875_INIT RA8875_480x272
    which the comment next to is says is for a 4.3in display. The way its set up is for a RA8875 800x480 dpi display.
    That I understand, but in GUI Slicer you can also set up the width, height and dpi (dots per inch) of the screen. I'm not sure if the dpi setting influences anything.

  7. #7
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    You will probably have modify in a couple of other places as well to get it to work properly. I saw this in one of the issues to set up a config:

    Uncomment /configs/ard-adagfx-ra8875-notouch.h in /src/GUIslice_config.h

    Then you may have to edit the ra8875 config file as well. There doesn't seem to be one place where its all at.

    EDIT: also check your pin numbers to make sure they line up but probably they are since you are getting something.

  8. #8
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by mjs513 View Post
    You will probably have modify in a couple of other places as well to get it to work properly. I saw this in one of the issues to set up a config:

    Uncomment /configs/ard-adagfx-ra8875-notouch.h in /src/GUIslice_config.h

    Then you may have to edit the ra8875 config file as well. There doesn't seem to be one place where its all at.

    EDIT: also check your pin numbers to make sure they line up but probably they are since you are getting something.
    Unfortunately checking both files for anything that could cause problems, and tweaking those, didn't really change anything. Even the setting you spotted earlier didn't change it. I guess I'll just use the "hardcore" way of defining your own shapes for now.

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,085
    Also maybe check the SPI speed. Maybe depending on your setup, it is trying to drive SPI too fast...

  10. #10
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by KurtE View Post
    Also maybe check the SPI speed. Maybe depending on your setup, it is trying to drive SPI too fast...
    Hmm possible, I'll see if I can find where this is located, if tweakable at all.

  11. #11
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by KurtE View Post
    Also maybe check the SPI speed. Maybe depending on your setup, it is trying to drive SPI too fast...
    Quote Originally Posted by mjs513 View Post
    You will probably have modify in a couple of other places as well to get it to work properly. I saw this in one of the issues to set up a config:

    Uncomment /configs/ard-adagfx-ra8875-notouch.h in /src/GUIslice_config.h

    Then you may have to edit the ra8875 config file as well. There doesn't seem to be one place where its all at.

    EDIT: also check your pin numbers to make sure they line up but probably they are since you are getting something.
    I have reached a dead end, do you guys know of any other possible causes? Or simply the fact that this new processor is not properly setup in the low level code of this software?
    I have currently "hacked" it to think that it is actually flashing to a Teensy 3.6, but couldn't find any influences of this on the workings.

  12. #12
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,085
    Sorry, I don't know exactly your setup?

    That is I downloaded (forked and cloned from) https://github.com/ImpulseAdventure/GUIslice

    As far as I can tell it does not know anything about Teensy 4... Examples don't compile, Tried to copy your config file will try again...

    From what I can tell, this is not using our version of RA8875, but instead is using the Adafruit_RA8875 library.

    The Adafruit library does work on my displays with the T4, although I often might have to powercycle it or the like after programming it.

    Not sure how hard it would be to convert it over to using our RA8875 library that was derived from Sumotoy...

  13. #13
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by KurtE View Post
    Sorry, I don't know exactly your setup?

    That is I downloaded (forked and cloned from) https://github.com/ImpulseAdventure/GUIslice

    As far as I can tell it does not know anything about Teensy 4... Examples don't compile, Tried to copy your config file will try again...

    From what I can tell, this is not using our version of RA8875, but instead is using the Adafruit_RA8875 library.

    The Adafruit library does work on my displays with the T4, although I often might have to powercycle it or the like after programming it.

    Not sure how hard it would be to convert it over to using our RA8875 library that was derived from Sumotoy...
    Okay in that case, do you know of any other GUI building application such as GUISlice Builder that could work?
    As I'm trying to create an interface that will not be small, it will likely take a long while to set this up, not that it's impossible, it's just hard to tweak doing it the hardcore way of defining where squares should be et cetera.

  14. #14
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Because power cycling is for the things I'm using it for in no way possible at all.

  15. #15
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    You can check out this thread: https://forum.pjrc.com/threads/56650...ight=littlevgl, talkin about LittlevGL.

  16. #16
    Junior Member
    Join Date
    Jan 2020
    Posts
    16
    Quote Originally Posted by mjs513 View Post
    You can check out this thread: https://forum.pjrc.com/threads/56650...ight=littlevgl, talkin about LittlevGL.
    Hm yeah I looked at it, but so far nobody managed to get that to work with the Teensy 4.0, nor the RA8875 as of yet, so that's a shame.
    Or at least not documented.

  17. #17
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    Quote Originally Posted by ThijmenL View Post
    Hm yeah I looked at it, but so far nobody managed to get that to work with the Teensy 4.0, nor the RA8875 as of yet, so that's a shame.
    Or at least not documented.
    Yeah - was just looking at it. Doesn't look like it will support a RA8875 I think at this point. Its looking for using frame buffering like we have with all the other displays. Unfortunately the only way to do that I know of is what @KurtE did using Layers. But I could be wrong. But could be wrong - if you check the littlevgl forum looks like there is some comments on using the Adafruit display with an ESP32.

  18. #18
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,085
    Note: I should point out that my needing to reset/reboot may be some other issue, or may simply be someone needs to work with Adafruit to see where the issue may be... May need to see if the problems happen with their RA8875 display board as well or are particular to other displays like from BuyDisplay

    The other option may also be, to see how hard it is to first get a working setup on T4, mine was not compiling but maybe did not update proper places in their configuration header files...

    Then see how much of the reliance they have on the Adafruit library versus try it with our Sumotoy based RA8875 driver.

  19. #19
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    @KurtE
    Was just doing that - pretty much have to review all the files in src. Seems it embedded all over the place. There is no one place. Don't think it hard just tedious to add the RA8875 library. Then you have to go in config and look at their display files. In others words it heavy reliance on the adafruit library.

  20. #20
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    Oh I forgot probably wont build because T4.0 not defined in GUISlice_config.h. I had to add this:
    Code:
    #elif defined(__IMXRT1062__) // Teensy 3.6
      #define GSLC_CFG_ARD
      #define GSLC_DEV_TEENSY_4_0
    and I can get the examples to build without errors.

    Oops forgot to change 3.6 to 4.0

  21. #21
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,085
    @mjs513 - Yes I added that one and builds... Fails to init the RA8875 so far...

    Right now trying to build a version with RA8875.h file will see how bad that goes.

    EDIT - Yep although I don't think anything looks at GSLC_DEV_TEENSY_4_0 or GSLC_DEV_TEENSY_3_6

  22. #22
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    6,085
    I have the beginnings of something maybe starting to work with the RA8875 driver...

    Note your example with text is showing up with nothing (blank screen). I am for sure not properly handling fonts and the like.

    I also have not put in the touch support at all yet.

    But at least the first two basic examples show something on the display.

    Not sure how far I will take it... But the current WIP is up at: https://github.com/KurtE/GUIslice/tree/t4_sumo_ra8875

    Next up may see if I can enable the hardware touch... Note: I hate these f.... config files both here and in RA8875 driver itself they often assume you only have one configuration....

  23. #23
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    Quote Originally Posted by KurtE View Post
    I have the beginnings of something maybe starting to work with the RA8875 driver...

    Note your example with text is showing up with nothing (blank screen). I am for sure not properly handling fonts and the like.

    I also have not put in the touch support at all yet.

    But at least the first two basic examples show something on the display.

    Not sure how far I will take it... But the current WIP is up at: https://github.com/KurtE/GUIslice/tree/t4_sumo_ra8875

    Next up may see if I can enable the hardware touch... Note: I hate these f.... config files both here and in RA8875 driver itself they often assume you only have one configuration....
    After a few false starts got it installed. Had to change CS from 9 to 10. You are right about it not displaying text. I ran through a couple of the examples for Arduino and the graphics is working very nicely but not text is showing.

  24. #24
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    Looks like you have to link fonts but reading the wiki is like reading the RM:
    https://github.com/ImpulseAdventure/...iki/User-Guide

    Ok check this out:https://github.com/ImpulseAdventure/...dmin_ctrls.ino

  25. #25
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    4,588
    Ok This example will display test almost there
    Code:
    //
    // GUIslice Library Examples
    // - Calvin Hass
    // - https://www.impulseadventure.com/elec/guislice-gui.html
    // - https://github.com/ImpulseAdventure/GUIslice
    // - Example 02 (Arduino):
    //   - Accept touch input, text button
    //   - Expected behavior: Clicking on button outputs a message
    //     to the serial monitor
    //   - NOTE: This is the simple version of the example without
    //     optimizing for memory consumption. A "minimal"
    //     version is located in the "arduino_min" folder which includes
    //     FLASH memory optimization for reduced memory devices.
    //
    
    // ARDUINO NOTES:
    // - GUIslice_config.h must be edited to match the pinout connections
    //   between the Arduino CPU and the display controller (see ADAGFX_PIN_*).
    
    #include "GUIslice.h"
    #include "GUIslice_drv.h"
    
    // Defines for resources
    
    // ------------------------------------------------
    // Load specific fonts
    // ------------------------------------------------
    
    // To demonstrate additional fonts, uncomment the following line:
    #define USE_EXTRA_FONTS
    
    // Different display drivers provide different fonts, so a few examples
    // have been provided and selected here. Font files are usually
    // located within the display library folder or fonts subfolder.
    #ifdef USE_EXTRA_FONTS
        #include <Adafruit_GFX.h>
        #include <gfxfont.h>
        #include "Fonts/FreeSansBold12pt7b.h"
        #define FONT_NAME1 &FreeSansBold12pt7b
    #else
      // Use the default font
      #define FONT_NAME1 NULL
    #endif
    
    // Enumerations for pages, elements, fonts, images
    enum {E_PG_MAIN};
    enum {E_ELEM_BOX,E_ELEM_BTN_QUIT};
    enum {E_FONT_BTN,E_FONT_TXT,MAX_FONT}; // Use separate enum for fonts, MAX_FONT at end
    bool    m_bQuit = false;
    
    // Instantiate the GUI
    #define MAX_PAGE            1
    #define MAX_ELEM_PG_MAIN    2
    
    gslc_tsGui                  m_gui;
    gslc_tsDriver               m_drv;
    gslc_tsFont                 m_asFont[MAX_FONT];
    gslc_tsPage                 m_asPage[MAX_PAGE];
    gslc_tsElem                 m_asPageElem[MAX_ELEM_PG_MAIN];
    gslc_tsElemRef              m_asPageElemRef[MAX_ELEM_PG_MAIN];
    
    // Define debug message function
    static int16_t DebugOut(char ch) { Serial.write(ch); return 0; }
    
    // Button callbacks
    // - This function gets called when the button is pressed
    bool CbBtnQuit(void* pvGui,void *pvElemRef,gslc_teTouch eTouch,int16_t nX,int16_t nY)
    {
      // Determine what type of event occurred on the button
      // - In this case we're just looking for the user releasing
      //   a touch over the button.
      if (eTouch == GSLC_TOUCH_UP_IN) {
        // Output a message when the button is pressed
        Serial.println("Quit button pressed");
        // Set a variable flag that we can use elsewhere
        m_bQuit = true;
      }
      return true;
    }
    
    void setup()
    {
      gslc_tsElemRef* pElemRef = NULL;
    
      // Initialize debug output
      Serial.begin(9600);
      gslc_InitDebug(&DebugOut);
      //delay(1000);  // NOTE: Some devices require a delay after Serial.begin() before serial port can be used
    
      // Initialize
      if (!gslc_Init(&m_gui,&m_drv,m_asPage,MAX_PAGE,m_asFont,MAX_FONT)) { return; }
    
      // Load Fonts
      if (!gslc_FontSet(&m_gui,E_FONT_BTN,GSLC_FONTREF_PTR,FONT_NAME1,1)) { return; }
      if (!gslc_FontSet(&m_gui,E_FONT_TXT,GSLC_FONTREF_PTR,NULL,1)) { return; }
    
      // -----------------------------------
      // Create page elements
      gslc_PageAdd(&m_gui,E_PG_MAIN,m_asPageElem,MAX_ELEM_PG_MAIN,m_asPageElemRef,MAX_ELEM_PG_MAIN);
    
      // Background flat color
      gslc_SetBkgndColor(&m_gui,GSLC_COL_GRAY_DK2);
    
      // Create background box
      pElemRef = gslc_ElemCreateBox(&m_gui,E_ELEM_BOX,E_PG_MAIN,(gslc_tsRect){10,50,300,150});
      gslc_ElemSetCol(&m_gui,pElemRef,GSLC_COL_WHITE,GSLC_COL_BLACK,GSLC_COL_BLACK);
    
      // Create Quit button with text label
      pElemRef = gslc_ElemCreateBtnTxt(&m_gui,E_ELEM_BTN_QUIT,E_PG_MAIN,
        (gslc_tsRect){120,100,80,40},(char*)"Quit",0,E_FONT_BTN,&CbBtnQuit);
    
      // -----------------------------------
      // Start up display on main page
      gslc_SetPageCur(&m_gui,E_PG_MAIN);
    
      m_bQuit = false;
    }
    
    void loop()
    {
      // Periodically call GUIslice update function
      gslc_Update(&m_gui);
    
      // In most programs, we would detect the button press and take an
      // action. In this simplest of examples, the "Quit" button callback
      // just outputs a message to the serial monitor when pressed and
      // sets the variable m_bQuit to true but the main loop continues to run.
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •