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

Thread: Teensy 3.6 with RA8875 5" BuyDisplay TFT, limited pins

  1. #1

    Teensy 3.6 with RA8875 5" BuyDisplay TFT, limited pins

    I am refining my RTTY decoder project which is currently running a Teensy 3.6 and an SSD1309 display, all working as expected. I would now like to upgrade to a bigger display and have bought this: https://www.ebay.co.uk/itm/5-5-0-inc...72.m2749.l2649

    The current 1309 display is connected to the board like this:

    #include <Adafruit_SSD1306.h>
    #define OLED_CLK A16 // 7
    #define OLED_MOSI A17 // 8
    #define OLED_CS A18 // 15
    #define OLED_RESET A19 // 16
    #define OLED_DC A20 // 4
    // // 2 VCC +3.3 Volt
    // // 1 GND

    The project uses the audio board and I have a rotary encoder and LEDs on 25, 26 and 27, 28, 29 and 30.
    PS/2 keyboard not yet working, although I would prefer to use a USB keyboard if possible. :

    #include <PS2Keyboard.h>
    const int DataPin = 5;
    const int IRQpin = 4;

    I also have Tx mode and outgoing data LEDs on 3 and 2.

    My research has taken me to the Adafruit library which is incompatible pins wise and Sumotoy library which is much more versatile but also seems to be incompatible. I wonder if someone would be kind enough to see if there is a straightforward solution please?

    Full program attached, should it be useful.
    Attached Files Attached Files

  2. #2
    Senior Member
    Join Date
    Jan 2015
    Location
    UK
    Posts
    139
    First you need to change your display driver from:

    #include <Adafruit_SSD1306.h>

    to

    #include <RA8875.h>

    Then setup the SPI pins to your board. Might be worth trying out some RA8875 examples first.

  3. #3
    It really is that simple? I thought that the pin assignments were going to conflict, the Adafruit library for instance gives only a single option for connections and I thought that the other one only had a couple of options, neither of which matched what I have in use. Sorry if I am just being dense here.

    I have been looking at the pinouts on the display and trying to corelate them with the Teensy and (yes I know it's me!) it seems to contradict itself.

    Wikipedia says...

    Master Output → Slave Input (MOSI):

    SIMO, MTSR - correspond to MOSI on both master and slave devices, connects to each other
    SDI, DI, DIN, SI - on slave devices; connects to MOSI on master, or to below connections
    SDO, DO, DOUT, SO - on master devices; connects to MOSI on slave, or to above connections

    Master Input ← Slave Output (MISO):

    SOMI, MRST - correspond to MISO on both master and slave devices, connects to each other
    SDO, DO, DOUT, SO - on slave devices; connects to MISO on master, or to below connections
    SDI, DI, DIN, SI - on master devices; connects to MISO on slave, or to above connections

    Slave Select:

    SS: S̅S̅, SSEL, CS, C̅S̅, CE, nSS, /SS, SS#

    In other words, MOSI (or SDO on a master) connects to MOSI (or SDI on a slave). MISO (or SDI on a master) connects to MISO (or SDO on a slave). Slave Select is the same functionality as chip select and is used instead of an addressing concept. Pin names are always capitalized as in Slave Select, Serial Clock, and Master Output Slave Input.


    I believe that the Teensy is acting as a master and the display as a slave. I further believe that MISO on the Teensy connects to SDO on the display and MOSI on the Teensy is connected to SDI on the display. CS is pin to pin. On my existing display, I have CS (obvious), RES, SDA, SCL and power rails.

    What is the correct way to connect the new display and do I need to alter any software please?

  4. #4
    The Sumotoy library will not compile. I am using a 3.6 and have tried to compile without making any alterations to the basic setup example.

    The Adafruit library is hard coded to use pins that I don't think I have available, according to the header in its example for a Uno...

    // Library only supports hardware SPI at this time
    // Connect SCLK to UNO Digital #13 (Hardware SPI clock)
    // Connect MISO to UNO Digital #12 (Hardware SPI MISO)
    // Connect MOSI to UNO Digital #11 (Hardware SPI MOSI)
    #define RA8875_INT 3
    #define RA8875_CS 10
    #define RA8875_RESET 9

    Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);

    As per the Sumotoy header, I have connected pin 2 to CS, pin 7 to SDI / MOSI and pin 14 to SCLK. SDO on the display is unconnected.

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,696
    Try out the version that ships with Teensyduino. It is one that a few of us updated to work on Teensy... Or go up to
    https://github.com/mjs513/RA8875/tree/RA8875_t4

    To get our latest.

  6. #6
    Thank you Kurt, that is greatly appreciated. I have got it installed and have been trying to get it all working to no avail. I am not at my best so will have another play tomorrow. Symptoms are a black screen, with all connections to it 3.3v high. I thought that CS ought to be low?

    Anyway, thanks again and I will report back.

  7. #7
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,696
    As always double check your wiring, also make sure to choose the right display type in the begin, like one demo I have:
    tft.begin(RA8875_800x480, 16, 12000000);


    Also depending on how your configuration is setup, 3.3v or 5v? Don't try using Teensy 3.3v to run it. I always order with +5v version and run off of the USB at that point.

    Also check backlight. That is is your setup for internal or external back light? Again not knowing exactly which one you have, look at the jumpers. And if setup for external back light, then make sure that pin is connected up to some IO pin and set it high...

    Again double check wiring... Been there, screwed up several times. Also sometimes with these the MISO/MOSI connection may be reversed from what you think it is.

  8. #8
    I have tried a few things...

    First I improved the power supply to the board. The display is a 5V so was being powered from the USB supply, but now it is on its own decent supply and the Teensy is also fed from it on the Vin pin.
    Next step was to lift the Teensy out of the breadboard, remove the audio board and revert to standard (default) connections. Backlight control is "PWM from microcontroller".

    I noticed that the display remained black when I uploaded the basic setup, although I had disabled the Reset with 255 and wired as per header ionformation. All four control pins were stuck high, so no clock even.

    Next test was with the Adafruit library. As soon as I ran it, I saw the backlight come on, rebooting it continually eventually produced coloured strations and a corrupt "Hello World!" in tiny letters top left. Further booting changed that from red to blue on the few occasions anything appeared.

    Then I went back to the forked library and tried the gauges sketch. That appeared to have no clock either but after a few reboots, it started to draw on the screen but that is all. Clock had started but went high just after. I tried the Mandelbrot sketch but just had some random colour spots.

    I have tried swapping MISO and MOSI, I got nothing at all with them swapped. The clock issue is interesting, it suggests a power supply issue but I can confirm it is all connected properly. My RTTY decoder program works reliably so I don't anticipate that there is a fault with the Teensy 3.6 board. I have ordered another just as a double check.

    One point I note is that the display is configured for 4 wire SPI and doesn't appear to have a Reset line. The datasheets show the 4 wire interface on JP1 and there is only CS, SDI, SDO, SCLK, GND and VDD.

    One of the datasheets... https://www.buydisplay.com/download/..._Datasheet.pdf

  9. #9
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,696
    I actually have one or two of those boards, which have worked... I am mostly playing with their 4.3" display version which has different connectors.
    With the RA8875 library try running some example sketch like ILI_Ada_FontTest4
    If it has it on your version.


    In it make sure CS pin is correct, the sketch may have it as 9, so set to what yours is.

    Also make sure on the tft.begin call to choose either RA8875_480x272 or RA8875_800x480 depending on what yours is. My guess 800x480 as I think the ER-TFT050-3 is...

    Also if something does not show up, try: tft.begin(RA8875_800x480, 16, 8000000);
    Which sets max SPI speed at 8mhz, to see if that works.

    As for Reset, I think I have on those displays used, pin 11 on the other connector

  10. #10
    Hi Kurte, I can't find that particular sketch on my system. I have done more testing, both with the embedded library and the forked library. I have also connected and configured the Reset line, all without benefit. I can see the clock starting every time now, so happy with that. There also realistically correct looking signals on MISO and MOSI so I am starting to think that it could be a duff display. Repeatedly booting it will provide a succession of black screens, white screens, coloured striations and corrupt images. I have also seperated out the the wiring in case of any inductive coupling.

    The next and final step would be to test it on a UNO. I would have done it today, but their example programs have reference to display pins that don't exist, like INT. It might be me, but I have had no problem with any other display I have tried. Thank you greatly for all your help and patient assistance, it really makes a difference!

  11. #11
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,696
    I should have asked what version of Teensyduino you have installed and the like.
    The latest stuff we have played with is up at: https://github.com/mjs513/RA8875/tree/RA8875_t4

    I have pulled my hair out on some of these. One I messed up on and did not have the 5v VR on it... Always flaky, so I got a VR and soldered it on, plus a few caps and changed the jumpers...

    Also mine came configured as SPI3 not SPI4, (first one), So I needed to update the solder jumpers on back.

    So another thing I would suggest is to double check yours to make sure all of the jumpers are correct.

    Another simple sketch I started testing some with includes:
    Code:
    /******************************************************************
     This is an example for the Adafruit RA8875 Driver board for TFT displays
     ---------------> http://www.adafruit.com/products/1590
     The RA8875 is a TFT driver for up to 800x480 dotclock'd displays
     It is tested to work with displays in the Adafruit shop. Other displays
     may need timing adjustments and are not guanteed to work.
     
     Adafruit invests time and resources providing this open
     source code, please support Adafruit and open-source hardware
     by purchasing products from Adafruit!
     
     Written by Limor Fried/Ladyada for Adafruit Industries.
     BSD license, check license.txt for more information.
     All text above must be included in any redistribution.
     ******************************************************************/
    //#define USE_ADAFRUIT
    #define RA8875_INT 7
    #define RA8875_CS 9
    #define RA8875_RESET 8
    
    #ifdef USE_ADAFRUIT
    #include <SPI.h>
    #include "Adafruit_GFX.h"
    #include "Adafruit_RA8875.h"
    Adafruit_RA8875 tft = Adafruit_RA8875(RA8875_CS, RA8875_RESET);
    #else
    #include <SPI.h>
    #include <RA8875.h>
    RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);
    #define fillScreen fillWindow
    #endif
    
    uint16_t tx, ty;
    
    void setup() 
    {
      Serial.begin(9600);
      Serial.println("RA8875 start");
    
      /* Initialise the display using 'RA8875_480x272' or 'RA8875_800x480' */
    #ifdef USE_ADAFRUIT
      if (!tft.begin(RA8875_800x480)) {
        Serial.println("RA8875 Not Found!");
        while (1);
      }
    
      Serial.println("Found RA8875");
    #else
      tft.begin(RA8875_800x480, 16, 12000000);
    #endif
      tft.displayOn(true);
    
    #ifdef USE_ADAFRUIT
      tft.GPIOX(true);      // Enable TFT - display enable tied to GPIOX
      tft.PWM1config(true, RA8875_PWM_CLK_DIV1024); // PWM output for backlight
      tft.PWM1out(255);
    #endif
      // With hardware accelleration this is instant
      tft.fillScreen(RA8875_WHITE);
    
    #ifdef USE_ADAFRUIT
      // Play with PWM
      for (uint8_t i=255; i!=0; i-=5 ) 
      {
        tft.PWM1out(i); 
        delay(10);
      }  
      for (uint8_t i=0; i!=255; i+=5 ) 
      {
        tft.PWM1out(i); 
        delay(10);
      }
      tft.PWM1out(255); 
    #endif  
      tft.fillScreen(RA8875_RED);
      delay(500);
      tft.fillScreen(RA8875_YELLOW);
      delay(500);
      tft.fillScreen(RA8875_GREEN);
      delay(500);
      tft.fillScreen(RA8875_CYAN);
      delay(500);
      tft.fillScreen(RA8875_MAGENTA);
      delay(500);
      tft.fillScreen(RA8875_BLACK);
      
      // Try some GFX acceleration!
      tft.drawCircle(100, 100, 50, RA8875_BLACK);
      tft.fillCircle(100, 100, 49, RA8875_GREEN);
      
      tft.fillRect(11, 11, 398, 198, RA8875_BLUE);
      tft.drawRect(10, 10, 400, 200, RA8875_GREEN);
      tft.fillRoundRect(200, 10, 200, 100, 10, RA8875_RED);
      tft.drawPixel(10,10,RA8875_BLACK);
      tft.drawPixel(11,11,RA8875_BLACK);
      tft.drawLine(10, 10, 200, 100, RA8875_RED);
      tft.drawTriangle(200, 15, 250, 100, 150, 125, RA8875_BLACK);
      tft.fillTriangle(200, 16, 249, 99, 151, 124, RA8875_YELLOW);
      tft.drawEllipse(300, 100, 100, 40, RA8875_BLACK);
      tft.fillEllipse(300, 100, 98, 38, RA8875_GREEN);
      // Argument 5 (curvePart) is a 2-bit value to control each corner (select 0, 1, 2, or 3)
      tft.drawCurve(50, 100, 80, 40, 2, RA8875_BLACK);  
      tft.fillCurve(50, 100, 78, 38, 2, RA8875_WHITE);
      
      pinMode(RA8875_INT, INPUT);
      digitalWrite(RA8875_INT, HIGH);
      
    #ifdef USE_ADAFRUIT
      tft.touchEnable(true);
    #endif    
      Serial.print("Status: "); Serial.println(tft.readStatus(), HEX);
      Serial.println("Waiting for touch events ...");
    }
    
    void loop() 
    {
      float xScale = 1024.0F/tft.width();
      float yScale = 1024.0F/tft.height();
    
      /* Wait around for touch events */
      if (! digitalRead(RA8875_INT)) 
      {
    #ifdef USE_ADAFRUIT
        if (tft.touched()) 
        {
          Serial.print("Touch: "); 
          tft.touchRead(&tx, &ty);
          Serial.print(tx); Serial.print(", "); Serial.println(ty);
          /* Draw a circle */
          tft.fillCircle((uint16_t)(tx/xScale), (uint16_t)(ty/yScale), 4, RA8875_WHITE);
        } 
    #endif
      }
    }
    And in cases like this it might help to post images of your setup. This one ran fine right now for me on one of their T4.3" displays with T4.
    I am running latest Arduino and latest Teensduino +++ and the library version mentioned.

  12. #12
    I have the latest or at least a very recent build of the IDE. I removed the RA8875 library from the included libraries because it was being selected for compilation rather than the t4 library. It compiles correctly according to the debug information.

    The images show a variety of screens after a reboot. The 'scope traces are pins 10 to 13 and all look realistic to me. At the time, the display was a white screen.

    I have stripped away everything else that was connected and just have it running from the USB port.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMG_5469.jpg 
Views:	16 
Size:	176.1 KB 
ID:	20516   Click image for larger version. 

Name:	IMG_5471.jpg 
Views:	14 
Size:	217.3 KB 
ID:	20517  


  13. #13
    A few more images and the connection diagram from their datasheet...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMG_5470.jpg 
Views:	14 
Size:	267.0 KB 
ID:	20518   Click image for larger version. 

Name:	IMG_5472.jpg 
Views:	9 
Size:	82.8 KB 
ID:	20519  

    Click image for larger version. 

Name:	IMG_5468.jpg 
Views:	11 
Size:	157.2 KB 
ID:	20520  

  14. #14
    The 'sillyscope' traces...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMG_5474.jpg 
Views:	8 
Size:	110.2 KB 
ID:	20521   Click image for larger version. 

Name:	IMG_5475.jpg 
Views:	5 
Size:	111.8 KB 
ID:	20522  

    Click image for larger version. 

Name:	IMG_5476.jpg 
Views:	7 
Size:	99.0 KB 
ID:	20523   Click image for larger version. 

Name:	IMG_5477.jpg 
Views:	6 
Size:	133.9 KB 
ID:	20525  


  15. #15
    Another one of the random displays after a reboot...
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	IMG_5473.jpg 
Views:	9 
Size:	81.3 KB 
ID:	20526  

  16. #16
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,696
    Did you try the begin with: RA8875_480x272 and see if it makes any differences?

    Also did you verify the jumpers on your display match the ones for SPI 4 wire?

    Edit try slowing down the SPI speed. These displays are very temperamental to signals...

  17. #17
    Jumpers verified, will try the other resolution setting now. It is as you suggest, sold as an 800x480.

  18. #18
    No difference apart from the (corrupt) image being smaller. Still the same random selection of different screens. This is what I ran...

    Code:
    /*
    ROUND GAUGE EXAMPLE with ballistic!
    This example show how to create 3 round gauge that react like the real one with (almost) correct ballistic
    The 3 gauges read analog values from A0,A1 & A2
    Created by S.U.M.O.T.O.Y - Max MC Costa
    If you modify or get better result please let me know
    */
    #include <SPI.h>
    #include <RA8875.h>
    
    volatile int16_t curVal1 = 0;
    volatile int16_t oldVal1 = 0;
    volatile int16_t curVal2 = 0;
    volatile int16_t oldVal2 = 0;
    volatile int16_t curVal3 = 0;
    volatile int16_t oldVal3 = 0;
    
    
    #define RA8875_CS 10
    #define RA8875_RESET 255//any pin or nothing!
    
    
    RA8875 tft = RA8875(RA8875_CS);//Teensy
    
    void setup() {
      //Serial.begin(9600);
      //  begin display: Choose from: RA8875_480x272, RA8875_800x480, RA8875_800x480ALT, Adafruit_480x272, Adafruit_800x480
    tft.begin(RA8875_480x272, 16, 8000000);
      drawGauge(63, 63, 63);
      drawGauge(63 * 3 + 4, 63, 63);
      drawGauge(63 * 5 + 8, 63, 63);
    }
    
    void loop(void) {
    
      curVal1 = map(analogRead(A0), 0, 1023, 1, 254);
      curVal2 = map(analogRead(A1), 0, 1023, 1, 254);
      curVal3 = map(analogRead(A2), 0, 1023, 1, 254);
    
      if (oldVal1 != curVal1) {
        drawNeedle(curVal1, oldVal1, 63, 63, 63, RA8875_GREEN, RA8875_BLACK);
        oldVal1 = curVal1;
      }
      if (oldVal2 != curVal2) {
        drawNeedle(curVal2, oldVal2, 63 * 3 + 4, 63, 63, RA8875_CYAN, RA8875_BLACK);
        oldVal2 = curVal2;
      }
      if (oldVal3 != curVal3) {
        drawNeedle(curVal3, oldVal3, 63 * 5 + 8, 63, 63, RA8875_MAGENTA, RA8875_BLACK);
        oldVal3 = curVal3;
      }
    }
    
    void drawGauge(uint16_t x, uint16_t y, uint16_t r) {
      tft.drawCircle(x, y, r, RA8875_WHITE); //draw instrument container
      tft.roundGaugeTicker(x, y, r, 150, 390, 1.3, RA8875_WHITE); //draw major ticks
      if (r > 15) tft.roundGaugeTicker(x, y, r, 165, 375, 1.1, RA8875_WHITE); //draw minor ticks
    
    }
    
    
    
    void drawNeedle(int16_t val, int16_t oval, uint16_t x, uint16_t y, uint16_t r, uint16_t color, uint16_t bcolor) {
      uint16_t i;
      if (val > oval) {
        for (i = oval; i <= val; i++) {
          drawPointerHelper(i - 1, x, y, r, bcolor);
          drawPointerHelper(i, x, y, r, color);
          if ((val - oval) < (128)) delay(1);//ballistic
        }
      }
      else {
        for (i = oval; i > val; i--) {
          drawPointerHelper(i + 1, x, y, r, bcolor);
          drawPointerHelper(i, x, y, r, color);
          //ballistic
          if ((oval - val) >= 128) {
            delay(1);
          } else {
            delay(3);
          }
        }
      }
    }
    
    void drawPointerHelper(int16_t val, uint16_t x, uint16_t y, uint16_t r, uint16_t color) {
      float dsec, toSecX, toSecY;
      int16_t minValue = 0;
      int16_t maxValue = 255;
      float fromDegree = 150.0;//start
      float toDegree = 240.0;//end
      if (val > maxValue) val = maxValue;
      if (val < minValue) val = minValue;
      dsec = (((float)(val - minValue) / (float)(maxValue - minValue) * toDegree) + fromDegree) * (PI / 180.0);
      toSecX = cos(dsec) * (r / 1.35);
      toSecY = sin(dsec) * (r / 1.35);
      tft.drawLine(x, y, 1 + x + (int16_t)toSecX, 1 + y + (int16_t)toSecY, color);
      tft.fillCircle(x, y, 2, color);
    }

  19. #19
    This is an interesting document for I think an earlier version. It shows pin 10 on JP2 needing a seperate interrupt signal fed to it.

    https://forum.arduino.cc/index.php?a...;attach=115746

  20. #20
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,696
    Your code runs on my display once I change pin numbers to match mine. Might help to hook up reset pin.

    Also again these displays are sort of picky on signals. So I had better luck once i moved to an RPI like connector that the display plgugs into.

    You might try other jumper wires to make sure they are seated well. Sometimes on ones plugging into display I would try things to get them to make better contact. like unplug, use a needle or like to push in the area within the break in cover (tab) and then plug back on pin hopefully making it tighter.

    Other than that not sure what else to suggest

    EDIT: On interrupt pin, I believe that is an optional pin that can be configured to be used, to have the display let know things... Like instead of us doing a query of the display to see if an operation has completed, I believe the system can be configured to interrupt you to say its done,.

  21. #21
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,851
    Quote Originally Posted by KurtE View Post
    Also again these displays are sort of picky on signals. So I had better luck once i moved to an RPI like connector that the display plgugs into.

    You might try other jumper wires to make sure they are seated well. Sometimes on ones plugging into display I would try things to get them to make better contact. like unplug, use a needle or like to push in the area within the break in cover (tab) and then plug back on pin hopefully making it tighter.

    Other than that not sure what else to suggest

    EDIT: On interrupt pin, I believe that is an optional pin that can be configured to be used, to have the display let know things... Like instead of us doing a query of the display to see if an operation has completed, I believe the system can be configured to interrupt you to say its done,.
    FWIW, I've had other displays that worked better when I threw out the cheap jumper wires and went to better jumper wires and/or cut my own solid wire connections.

    I've also had to throw out breadboards where over time one or more connections became unstable.

    And I seem to routinely have to redo solder connections that aren't always stably connected. This last happens a lot in costume parts where the movement of the Teensy in the costume will break the solder joint.

    In general, try to keep your wires as short as possible. And some places just have a lot of electrical noise.

    Another thing to check is whether your CS pins have pull-up resistors. This can help particularly if you have two different items on the same SPI bus. I had one setup with the Teensy Animated Eyes setup (2 displays on the same SPI bus) where it worked a lot better when I included pull-up resistors between each of the two CS pins and 3.3v (I would typically use 2.2k resistors).

    Finally, some displays just can't run as fast, and you may need to experiment to find the highest SPI bus speed that the display will tolerate. Even two displays from the same manufacturer might have slight differences in the maximum bus speed.
    Last edited by MichaelMeissner; 06-07-2020 at 04:24 PM.

  22. #22
    Thanks both. I will have another dabble but I am getting convinced that the board is faulty, so have emailed the seller for their comments.

  23. #23
    Curiouser and curiouser! I have reconnected back to a decent 5V supply, the display and Teensy share the same supply. No change as expected. I then took a flylead from pin 11 on the parallel bus and flashed it to earth. The display went black and on the next boot, it came back uncorrupted. I have now made a permanent connection to pin 9 and in my next test, it has come up uncorrupted again. I wonder if that reset pin should be held high if not in use? If it were floating then it could explain the issues.

  24. #24
    Progress is being made. I have now got compilation success on alternative pins, to avoid the audio board and other pins I have already assigned. Reset is pin 11 on the parallel bus connector JP3. This works:

    Code:
    /*
    Explain the minimal setup and how to use instances...
    */
    
    #include <SPI.h>
    #include <RA8875.h>
    
    /*
    Teensy3.x
    You are using 4 wire SPI here, so:
     MOSI:  11
     MISO:  12
     SCK:   13
     */
    #define RA8875_CS 20 //any digital pin
    #define RA8875_RESET 21//any pin, if you wnat to disable just set at 255 or not use at all
    #define RA8875_MOSI 7
    #define RA8875_SCLK 14
    #define RA8875_MISO 12
    /*
    Teensy3.x has small difference since it can use alternative SPI pins,
    essential if you want to use this library with Audio Shield.
    You can set alternative SPI pins:
    RA8875(CSpin,RSTpin=255,MOSI=11,SCLK=13,MISO=12);//the default configuration
    To use with Audio shield:-------------------------------
    CS: 2,20,21 because are not used by audio shield
    MOSI:7
    SCLK:14
    RA8875(2,255,7,14);//will not interfere with Audio Shield
    Teensy LC
    This cpu can use slight different configuration, it can be instanced
    with the CS pin only so it will use SPI0 but you can use this:
    //RA8875(CSp,RSTp,mosi_pin,sclk_pin,miso_pin);
    RA8875 tft = RA8875(RA8875_CS,RA8875_RESET,0,20,1);
    This will use the SPI1 (24Mhz)
    --------------------------------------------------------
    To omit Reset pin, set as 255
    For CS you CANNOT use arbitrary pin!
    Teensy 3.x can use: 2,6,9,10,15,20,21,22,23
    The shorter instance can be: RA8875(CSpin);
    */
    //RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);//Teensy
    //or
    //RA8875 tft = RA8875(RA8875_CS);//Teensy (not using rst pin)
    //or (for audio board)
    RA8875 tft = RA8875(RA8875_CS,RA8875_RESET,RA8875_MOSI,RA8875_SCLK);//Teensy using alternative SPI pin
    //or
    //RA8875 tft = RA8875(RA8875_CS,RA8875_RESET,RA8875_MOSI,RA8875_SCLK,RA8875_MISO);//Teensy using alternative SPI pin + alt miso
    
    
    void setup() 
    {
      Serial.begin(38400);
      //long unsigned debug_start = millis ();
      //while (!Serial && ((millis () - debug_start) <= 5000)) ;
      Serial.println("RA8875 start");
    /*
        If you have an Adafruit RA8875 board + display choose:
    Adafruit_480x272 , Adafruit_800x480
        If you have any other display you have to choose:
    RA8875_480x272 , RA8875_800x480
    */
    tft.begin(RA8875_800x480, 16, 8000000);
    
    /*
    By default the library init display at 16bit color depth but
    you can optionally force the display to work at 8 bit:
    
    tft.begin(RA8875_480x272,8);//force 8bit color depth
    */
    
    //Now that board it's inited you can use any draw or text command:
    tft.print("Hello World!");//did you see it?
    }
    
    void loop() 
    {
    
    }

  25. #25
    Today I have been able to start modifying the software to suit the new display. I have tried al the options for the pins and it has made no difference to an issue of possible incompatibility. The program starts to run and then appears to crash every time before it starts to look for input from the outside world. The original OLED display works fine and does not use the SPI library, but the 5" does require it and will not compile without it. I am really scratching my head over this one. I wonder if someone could take a look and tell me where I am being dumb please? ;-) Software attached that doesn't work.

    It writes the startup screen, then writes the headings and the two lines. After that it goes unresponsive.
    Attached Files Attached Files
    Last edited by AJL Electronics; 06-07-2020 at 04:40 PM.

Posting Permissions

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