Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 62 of 62

Thread: Teensy 4.0 with Audio Board and ILI9341 screen wiring

  1. #51
    Member
    Join Date
    Jan 2021
    Location
    France
    Posts
    44
    thanks for your reply.

    Good news therefore for the Reset pin, a saved pin!

    First learning tests (as a reminder I am a beginner):
    TFT_CS = pin 0
    TFT_DC = pin 3
    TOUCH_CS = pin 1
    with the audio card connected, I display on the TFT the peaks of the microphone, and I use the touch screen => it works very well

    First experience with my TFT is conclusive.

    Now I have to test the SD card and the onboard memory on the audio card

    My montage looks like a dish of spaguetti, so does a breakboard for T4 + audio board + tft exist ?
    Click image for larger version. 

Name:	IMG_1479.jpg 
Views:	25 
Size:	141.5 KB 
ID:	23273
    Last edited by fred_france; 01-14-2021 at 12:32 PM.

  2. #52
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,050
    Note in your picture you need a few extra pins:
    • If you use flash memory or the micro SD card reader, you need to connect the ground pin on the left;
    • You always need to connect the ground pin on the right (second pin from top); (and)
    • You always need to connect the 3.3v pin on the right (third pin from the top).


    I'm not sure whether you need to connect VIN on the right (top pin). I don't think you do, but I don't know if the amplifier needs more power than 3.3v can supply.

    The reason for the two grounds being used for different things is the Teensy 3.1/3.2/3.5/3.6 uses the ground pin on the left for normal ground, and the ground pin on the left is an analog ground pin, meant for grounding analog inputs/outputs. Hence on the revision A-C audio shields, the ground on the left is used for the SPI devices, and the ground on the right is used for the analog stuff. Presumably when Paul redesigned the revision D audio shield, he did not cross connect the two grounds (Teensy 4.0/4.1 don't have analog ground).

  3. #53
    Member
    Join Date
    Jan 2021
    Location
    France
    Posts
    44
    thank you for your comments.
    here is the wiring that works for me.

    (I did not use the T_IRQ pin)

    I used the libraries: ILI9341_t3.h and XPT2046_Touchscreen.h
    Code:
    #define TFT_DC 3
    #define TFT_CS 0
    #define TOUCH_CS 1

    Click image for larger version. 

Name:	Teensy_4_audio_board_ILI9341.jpg 
Views:	42 
Size:	111.7 KB 
ID:	23290

  4. #54
    Senior Member
    Join Date
    Apr 2020
    Location
    DFW area in Texas
    Posts
    259
    Here's what I'm using in the project currently occupying my workbench:

    Code:
    #include <ILI9341_t3.h>
    #include <XPT2046_Touchscreen.h>
    #include <ILI9341_t3_Controls.h>
    #include <font_Arial.h>           // custom fonts that ships with ILI9341_t3.h
    #include <font_ArialBold.h>
    #include <Audio.h>
    
    // GUItool: begin automatically generated code
    [ snipped ]
    // GUItool: end automatically generated code
    
    
    // This is calibration data for the raw touch data to the screen coordinates (specifically for my TFT display)
    const int TS_MINX = 260;
    const int TS_MINY = 220;
    const int TS_MAXX = 3750;
    const int TS_MAXY = 3900;
    
    // when used w/ Audio Adapter, must use an alternate CS pin for the display
    const int TFT_CHIP_SELECT = 14;
    const int TFT_DATA_COMMAND = 9;
    ILI9341_t3 tft = ILI9341_t3(TFT_CHIP_SELECT, TFT_DATA_COMMAND);
    
    // when used w/ Audio Adapter, must use an alternate CS pin for the touchscreen
    #define TS_CS_PIN  5
    
    XPT2046_Touchscreen ts(TS_CS_PIN, 255);
    
    //
    // The following pins are used in this project:
    //
    // PIN  D1  = (not used)
    // PIN  D2  = (not used)
    // PIN  D3  = (not used)
    // PIN  D4  = (not used)
    // PIN  D5  = TouchScreen chip select (alternate when used w/ audio adapter)
    // PIN  D6  = Audio adapter memory chip select
    // PIN  D7  = Audio adapter data in
    // PIN  D8  = Audio adapter data out
    // PIN  D9  = TFT/TS data/command select
    // PIN D10  = Audio adapter SD card chip select
    // PIN D11  = SPI MOSI (data in)
    // PIN D12  = SPI MISO (data out)
    // PIN D13  = SPI serial clock + on-board LED
    // PIN  A0  = (D14) TFT chip select (alternate when used w/ audio adapter)
    // PIN  A1  = Volume pot on audio adapter
    // PIN  A2  = (not used)
    // PIN  A3  = (not used)
    // PIN  A4  = (D18) Audio adapter SDA (I2C control data)
    // PIN  A5  = (D19) Audio adapter SCL (I2C control clock)
    Good luck & have fun !!

    Mark J Culross
    KD5RXT

  5. #55

    Lightbulb Teensy 4.0 w SD Card w Audio w TFT ILI9341 w Touch (XPS)

    Hi,
    I think I may have found the right thread...
    So, I am trying to get all the following to work: Teensy 4.0, with the Audio Adapter rev D - I need to use its SD Card. Also, I need to connect it to a touch screen based on the ILI9341 and Touch XPS chipset.
    Based on what I have read this far, I came up with the attached - would this work?
    I can do soldering tomorrow and finish the code for setting this up - if all works I volunteer to a small write-up that we can help Steve with, I think others may benefit from a small update to the current page (https://www.pjrc.com/store/display_ili9341_touch.html).
    Thank you in advance for your guidance.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Teensy40_Audio40D_SDCard_TFTILI_XPSTouch.jpg 
Views:	18 
Size:	130.6 KB 
ID:	24082  

  6. #56
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,050
    A couple of minor comments:

    1) Pin 6 is used by the audio shield if you solder a flash memory chip to the audio shield (which can be a faster but smaller permanent storage device than the SD card). Even if you don't solder in a flash memory chip, it might avoid problems if you use a different chip for the CS pin select.

    2) On SPI systems that have multiple devices on a single SPI bus, it can be helpful if you have pull-up resistors on each CS pin. Note, the audio shield adds pull-up resistors for both pins 6 (flash memory) and 10 (micro SD card reader), but you may need one for your display.


    3) As the paper above mentioned, some devices no do properly handle tri-stating. On the Teensy 4.0 you could move the display to the second SPI port, but you will need to solder 2 wires to the pads underneath the Teensy. Note, pin 1 is MISO1 (it isn't on the pinout card unfortunately), which means you would have to re-route the MIDI connection from Serial1 (i.e. pins 0/1). I think you can buy tri-state buffers also, but I don't have any experience with this.

    4) You aren't hooking up the reset pin on the display. You might want to hook it up to a pin, and explicitly reset the device when needed.

    5) I've read about different ways touch sensing are communicated. If it uses I2C, it should be ok, providing you don't use the two I2C ports used by the audio shield. If it is a SPI connection, I recall some of the devices in the past had trouble with tri-stating. I've never used touch screens in my usage.

    6) Generally, I try to do hookups, etc. on a breadboard first before moving to a soldered connection. That way you can verify that it works first, and possibly move pins around as needed before going to solder. If you go straight to solder, it could be you need to change pins, or it could be your solder connections need to be fixed, so it can be harder to figure out what the problem is. Of course the downside is, I've had ports on breadboards stop working, and using cheap jumper wires can sometimes stop working also.

    7) Particularly on a fast Teensy like the 4.0, you can overwhelm the display by sending data too fast. It may be helpful play with the SPI bus speed if you display is glitching. I've found that even for the same driver, different manufacturers displays might top out at different SPI bus speeds.
    Last edited by MichaelMeissner; 03-16-2021 at 06:36 PM.

  7. #57

    Thank you

    Much appreciated, Michael.
    I will try to document this at the end and include your precious advice in my work.
    Alfa66

    Quote Originally Posted by MichaelMeissner View Post
    A couple of minor comments:

    1) Pin 6 is used by the audio shield if you solder a flash memory chip to the audio shield (which can be a faster but smaller permanent storage device than the SD card). Even if you don't solder in a flash memory chip, it might avoid problems if you use a different chip for the CS pin select.

    2) On SPI systems that have multiple devices on a single SPI bus, it can be helpful if you have pull-up resistors on each CS pin. Note, the audio shield adds pull-up resistors for both pins 6 (flash memory) and 10 (micro SD card reader), but you may need one for your display.


    3) As the paper above mentioned, some devices no do properly handle tri-stating. On the Teensy 4.0 you could move the display to the second SPI port, but you will need to solder 2 wires to the pads underneath the Teensy. Note, pin 1 is MISO1 (it isn't on the pinout card unfortunately), which means you would have to re-route the MIDI connection from Serial1 (i.e. pins 0/1). I think you can buy tri-state buffers also, but I don't have any experience with this.

    4) You aren't hooking up the reset pin on the display. You might want to hook it up to a pin, and explicitly reset the device when needed.

    5) I've read about different ways touch sensing are communicated. If it uses I2C, it should be ok, providing you don't use the two I2C ports used by the audio shield. If it is a SPI connection, I recall some of the devices in the past had trouble with tri-stating. I've never used touch screens in my usage.

    6) Generally, I try to do hookups, etc. on a breadboard first before moving to a soldered connection. That way you can verify that it works first, and possibly move pins around as needed before going to solder. If you go straight to solder, it could be you need to change pins, or it could be your solder connections need to be fixed, so it can be harder to figure out what the problem is. Of course the downside is, I've had ports on breadboards stop working, and using cheap jumper wires can sometimes stop working also.

    7) Particularly on a fast Teensy like the 4.0, you can overwhelm the display by sending data too fast. It may be helpful play with the SPI bus speed if you display is glitching. I've found that even for the same driver, different manufacturers displays might top out at different SPI bus speeds.

  8. #58
    Hi,
    I have a Teensy 4.1 with audio board and ILI9341 attached. I fought with the system not working and read the thread completely. I want to report, that the system only worked after I switched TFT_CS from 15 to 5. Funnily after I had compiled the code with 5 and switched hardware back to 15 it still worked with the code compiled for 5! Then I recompiled for 15 and it did not work any more with hardware at 15! - With software and hardware both at 5 it does work SD-card plugged in and SD_CS set to 1, see code. At the moment I have not tested SD-card-code together with TFT and Touch.
    Code:
    #include <ILI9341_t3.h>
    #include <font_Arial.h> // from ILI9341_t3
    #include <XPT2046_Touchscreen.h>
    #include <SPI.h>
    
    #define SD_CS 10
    
    #define CS_PIN  6 // Touch
    
    // For optimized ILI9341_t3 library
    #define TFT_DC      9
    #define TFT_CS      5
    #define TFT_RST    255  // 255 = unused, connect to 3.3V
    #define TFT_MOSI    11
    #define TFT_SCLK    13
    #define TFT_MISO    12
    //ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCLK, TFT_MISO);
    
    XPT2046_Touchscreen ts(CS_PIN);
    #define TIRQ_PIN  255 //2
    //XPT2046_Touchscreen ts(CS_PIN);  // Param 2 - NULL - No interrupts
    //XPT2046_Touchscreen ts(CS_PIN, 255);  // Param 2 - 255 - No interrupts
    //XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);  // Param 2 - Touch IRQ Pin - interrupt enabled polling
    
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
    
    void setup() {
      //tft.setClock(10000000);
      pinMode(SD_CS, OUTPUT);
      digitalWrite(SD_CS, HIGH);
      Serial.begin(38400);
      tft.begin();
      tft.setRotation(1);
      tft.fillScreen(ILI9341_BLACK);
      ts.begin();
      ts.setRotation(1);
      while (!Serial && (millis() <= 1000));
    }
    
    boolean wastouched = true;
    
    int nr=0;
    
    void loop() {
      nr++;
      boolean istouched = ts.touched();
      if (istouched) {
        TS_Point p = ts.getPoint();
        if (!wastouched) {
          tft.fillScreen(ILI9341_BLACK);
          tft.setTextColor(ILI9341_YELLOW);
          tft.setFont(Arial_60);
          tft.setCursor(60, 80);
          tft.print("Touch");
        }
        tft.fillRect(100, 150, 140, 60, ILI9341_BLACK);
        tft.setTextColor(ILI9341_GREEN);
        tft.setFont(Arial_24);
        tft.setCursor(100, 150);
        tft.print("X = ");
        tft.print(p.x);
        tft.setCursor(100, 180);
        tft.print("Y = ");
        tft.print(p.y);
        Serial.print(", x = ");
        Serial.print(p.x);
        Serial.print(", y = ");
        Serial.println(p.y);
      } else {
        if (wastouched) {
          tft.fillScreen(ILI9341_BLACK);
          tft.setTextColor(ILI9341_RED);
          tft.setFont(Arial_48);
          tft.setCursor(120, 50);
          tft.print("No");
          tft.setCursor(80, 120);
          tft.print("Touch");
          tft.setFont(Arial_24);
          tft.setCursor(100, 180);
          tft.print("Nr = ");
          tft.print(nr);
        }
        Serial.println("no touch");
      }
      wastouched = istouched;
      delay(100);
    }

  9. #59
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,325
    The audio shields uses Pin 15 - it's for the optional potentiometer and has a capacitor to smooth its readings..
    It's always a good idea to take a look at the used pins before connecting something

  10. #60
    Hm, yes, you are totally right. :-) I did overlook this cap in the schematic.
    ... and pin 15 is clearly explicitly recommended in https://www.pjrc.com/store/display_ili9341_touch.html.

    It is really funny, that the system worked compiled for CS=5 and hardware connected to pin 15, including this 100nF capacitor!!!

    I am very happy that this works now. This t3- library with T4.1 is so very much faster than my trials before with Pico+Micropython....

  11. #61
    Junior Member
    Join Date
    Aug 2017
    Posts
    2
    Hi, so the connections table for teensy 4.x given in https://www.pjrc.com/store/display_ili9341_touch.html is incomplete? The Teensy 4.1 SD card is using pin 10. In this case a hint would be useful there.

    Is there a forum place to get help for the following subject?
    I'm struggling with PlatformIO. Here Audio.h includes DMAChanel.h, which is not present. It seems, that the PlatformIO teensy is not yet supporting 4.1?
    Would be glad to get a hint.

  12. #62
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,325
    Quote Originally Posted by MK_Munich View Post
    Hi, so the connections table for teensy 4.x given in https://www.pjrc.com/store/display_ili9341_touch.html is incomplete? The Teensy 4.1 SD card is using pin 10. In this case a hint would be useful there.
    Teensy 4.1 builtin SD does not use pin 10. The Audio Board uses pin10 if you use its SD.
    I think it should be natural to look at everything carefully before connecting anything, and I can't see an issue or would say the page is incomplete.


    Quote Originally Posted by MK_Munich View Post
    Is there a forum place to get help for the following subject?
    I'm struggling with PlatformIO. Here Audio.h includes DMAChanel.h, which is not present. It seems, that the PlatformIO teensy is not yet supporting 4.1?
    Would be glad to get a hint.
    You might have a better chance if you create a new thread, since the title of this thread has nothing to do with your question - or contact the PlatiomIO experts. Maybe they have a forum or another place to ask?
    Last edited by Frank B; 04-10-2021 at 10:02 AM.

Posting Permissions

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