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

Thread: Teensy 4.0 with Audio Board and ILI9341 screen wiring

  1. #1
    Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    86

    Teensy 4.0 with Audio Board and ILI9341 screen wiring

    Did somebody already wire the ILI9341 screen to Teensy 4.0 stacked with the new Audio Board? Ideally, without using the bottom connectors.
    Just trying to save myself some time figuring it out.
    Thank you.

  2. #2
    Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    86
    Sorry, forgot to ask what SD card reader will fit on Teensy 4.0 (bottom side) ? I've never done it and they all look so different.
    Can somebody point out one for me on Amazon, preferably?
    Thanks again.

  3. #3
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,456
    Quote Originally Posted by Andy Belov View Post
    Sorry, forgot to ask what SD card reader will fit on Teensy 4.0 (bottom side) ? I've never done it and they all look so different.
    Can somebody point out one for me on Amazon, preferably?
    Thanks again.
    Note, I haven't done it yet, but I suspect that there isn't room to solder a micro SD card directly to the Teensy. There are 2 or 3 bumps in the back of the Teensy that looks like they would be where the card reader would go. Even if the card reader clears those bumps, you might not be able to get a card into the reader.

    Instead what Paul did in the breakout board during the beta test and loglow looks like he is doing in his breakout board was you attach a FFC 1mm 8 position connector to the Teensy, and then use a 1mm 8 position FFC cable to connect those 8 pins to another FFC 1mm 8 position connector to the PCB, and from there on route the pins.


    Blackketter has a different approach to use a castlelated PCB with the center cut out, Then you connect it by making a solder bridge between the cutout register and the Teensy. There he just brings out the pins to the side of the Teensy that you can connect to a normal through hole solder micro SD card reader.

  4. #4
    Senior Member
    Join Date
    May 2016
    Posts
    245
    I've run the T4 with the ILI9341 Display, and the T4 with the Audio Board, but not all three together.
    That's my job for tomorrow. To be honest I'm still a bit confused as to whether they will play nice on the same SPI bus... I'll let you know how it works out.
    Do you have any suggestions on the pins to try?

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,420
    Quote Originally Posted by Andy Belov View Post
    Did somebody already wire the ILI9341 screen to Teensy 4.0 stacked with the new Audio Board? Ideally, without using the bottom connectors.
    Just trying to save myself some time figuring it out.
    Thank you.
    Looking at the Audio Adapter page for the New Rev D board : pjrc.com/store/teensy3_audio.html

    The SPI pins are in the 'normal' spots

    SCK 13
    MISO 12
    MOSI 11
    Just need to find an open CS pin for the display.

    Just soldered up a new Rev D board for Teensy 4. Did testing against the First Audio Tutorial and Pot and button pins worked - and the beep tone to headphones - then tested A Winbond 16 MB flash chip I soldered on to work as well as the SD Socket on the Audio board - including putting files on the SD card and transferring them to the Flash chip with the SerialFlash example.

  6. #6
    Senior Member
    Join Date
    May 2016
    Posts
    245
    From defragster: J
    ust need to find an open CS pin for the display.
    and that is where I'm totally confused!

    The T3.6 had a bunch of alternate pins for the SPI bus and it was necessary to use those alternates to have the TFT and audio board connected at the same time.
    The T4.0 hsa a bunch of SPI buses, and no alternate pins (that I can find),

    I have loglow's excellent pinout sheet - no CS alternates are there. So, the question is: can I steal any CS pin from another SPI port, or do I have to connect the display to its own dedicated SPI bus?

    A second question is: can I choose any available pin for D/C on the display?

    Aside: I'm wiring up a new general prototyping T4 board as we speak... To start with it will have the Audio board, display, a 16 channel port expander, rotary encoder, tactile switches, and one or two pots. I'm using my beta Loglow breakout board. It works, but pins 35 and 36 are wonky, (I hope he doesn't change the format on the next go-around)

  7. #7
    Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    86
    Hi Derek,
    Good to know that I'm not alone in this. I'm making a compact (big pocket size) musical instrument which needs a screen, the Audio Board, about 30 capacitive sensors, bluetooth with A2DP, USB host (for MIDI keyboards), gutar preamp (got this working yesterday), fast SD writer (for recording).
    And I need Teensy 4.0 for all this, because I need every bit of power for real-time pitch recognition from microphone and/or guitar.

    I know we'll do it. Today I have all Sunday to my self and I'm going to breadboard T4, the Audio Board and the screen.
    Let's see who wins (today).

  8. #8
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    2,301
    Quote Originally Posted by defragster View Post

    Just soldered up a new Rev D board for Teensy 4. Did testing against the First Audio Tutorial and Pot and button pins worked - and the beep tone to headphones - then tested A Winbond 16 MB flash chip I soldered on to work as well as the SD Socket on the Audio board - including putting files on the SD card and transferring them to the Flash chip with the SerialFlash example.
    FWIW, i too just soldered up Rev D audio board for T4. Soldered volume pot and teensy microphone. Mounted on T4 with female headers. Tested with WavFilePlayer with volume control and WAV files from uSD on shield. mic tests were good too.

    https://www.pjrc.com/store/teensy3_audio.html

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,420
    Quote Originally Posted by DerekR View Post
    From defragster: J
    and that is where I'm totally confused!

    The T3.6 had a bunch of alternate pins for the SPI bus and it was necessary to use those alternates to have the TFT and audio board connected at the same time.
    The T4.0 hsa a bunch of SPI buses, and no alternate pins (that I can find),

    I have loglow's excellent pinout sheet - no CS alternates are there. So, the question is: can I steal any CS pin from another SPI port, or do I have to connect the display to its own dedicated SPI bus?

    A second question is: can I choose any available pin for D/C on the display?

    Aside: I'm wiring up a new general prototyping T4 board as we speak... To start with it will have the Audio board, display, a 16 channel port expander, rotary encoder, tactile switches, and one or two pots. I'm using my beta Loglow breakout board. It works, but pins 35 and 36 are wonky, (I hope he doesn't change the format on the next go-around)
    On Teensy_4 the SPI doesn't have the ability to use hardware specific CS pins in the same special T_3.x way - so any available digital pin can be used for CS AFAIK based on watching KurtE work and making it work the best it can in that fashion.

    @KurtE might chime in - but the D/C pin is the same - or check the updated ILI9341 thread where the T4 was made to work - I haven't gotten back to that yet with this new setup.

    I was hoping to do a full build with a fresh T_4 using the OSH Blackketter breakout - but alas that didn't yield a usable board so I'm using another T4 instead for now - and distracted by doing my neglected outdoor 'summer chores' that need to be done for winter with fall here.


    @manitou - with the RevD board … got and installed a MIC and POT and full Audio Tutorial wire kit in addition to putting on the DigiKey Winbond flash. Tested enough to see that all work ( except MIC )

  10. #10
    Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    86
    I got it working, both the Audio Board and the screen, but only as long as I keep the SD card out of the Audio Board.
    As soon as I just stick the SD card back into the slot, the screen doesn't show the "Touched..." message in this test: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\XPT204 6_Touchscreen\examples\ILI9341Test
    Maybe it's because I don't initialize the SD library? Well, I was going to use Teensy on-board SD card anyway.

    I tried the guitar and peak meter for the microphone, all works.

    Here is my connection pins for the screen (the numbers are the Teensy pins):

    // Touch ---
    #define T_IRQ 16
    // T_DO: connected to TFT_SDO on the screen
    // T_DIN: connected to TFT_MOSI on the screen
    #define T_CS 9
    // T_CLK: connected to TFT_SCK on the screen
    // Screen ---
    #define TFT_SDO 12 // * (MISO), connected to T_DO on the screen
    #define TFT_LED 5 // 100 Ohm resistor
    #define TFT_SCK 13
    #define TFT_MOSI 11
    #define TFT_DC 5
    #define TFT_RST 255 // RESET: +3.3V, connected on the screen
    #define TFT_CS 14
    // GND
    // VCC: +3.3V


    Here is the modified ILI9341Test test:

    #define CS_PIN 9
    #define TFT_DC 5
    #define TFT_CS 14
    // MOSI=11, MISO=12, SCK=13

    #define TIRQ_PIN 16
    XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);
    //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);
    ... the rest is as it was

  11. #11
    Senior Member
    Join Date
    May 2016
    Posts
    245
    Andy - You beat me!!! I didn't get very far at all today, I could find my plastic bag of female headers We have a local electronics parts store that's closed on Sundays, so I'll be able to get some in the morning...

    Anyway, It's great to hear of your success!

    @defragster - if you can use any pin as CS, do you know if there's a reason why specific pins are listed on the T4 card, and loglow's sheet? That's what's been confusing my tiny brain.

  12. #12
    Junior Member
    Join Date
    Jul 2018
    Posts
    10
    Thanks Andy!

    Your information helped me wiring the Teensy 4.0 and the TFT & Touch with the Audio Shield.

  13. #13
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,456
    Quote Originally Posted by DerekR View Post
    Andy - You beat me!!! I didn't get very far at all today, I could find my plastic bag of female headers We have a local electronics parts store that's closed on Sundays, so I'll be able to get some in the morning...

    Anyway, It's great to hear of your success!

    @defragster - if you can use any pin as CS, do you know if there's a reason why specific pins are listed on the T4 card, and loglow's sheet? That's what's been confusing my tiny brain.
    The hardware has some optimizations for the main CS pin (10 for the first SPI bus), but unlike the Teensy 3.x processors (with 5 pins), the optimizations don't seem to help as much. I'll let the display/SPI experts weigh in on this one.

    If you have multiple devices on the same SPI bus, here are some things you can do to make it better:


    The simplest is putting pull-up resistors in parallel for the CS and DC pins for each device. I'm not sure how you would go about providing tri-state relief on devices with more than one SPI device (i.e. the display/touch screen, and the audio shield with both micro SD card and soldered flash memory).

    I vaguely recall there have been discussions about the touchscreen not being properly tri-stated, but I haven't actually tried it yet.

  14. #14
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,420
    Quote Originally Posted by DerekR View Post
    Andy - You beat me!!! I didn't get very far at all today, I could find my plastic bag of female headers We have a local electronics parts store that's closed on Sundays, so I'll be able to get some in the morning...

    Anyway, It's great to hear of your success!

    @defragster - if you can use any pin as CS, do you know if there's a reason why specific pins are listed on the T4 card, and loglow's sheet? That's what's been confusing my tiny brain.
    Just seeing this. Loglow card is just a copy of relevant pin functions to match the PJRC card - where the underlying function is fixed on the T4.

    There are pins associated with the T4's SPI hardware it seems, but the design of the SPI engine doesn't allow the same integration into queued events of the CS pin so it has to be manipulated manually - in which case the pin used doesn't matter.

  15. #15
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,420
    Quote Originally Posted by MichaelMeissner View Post
    ...
    I vaguely recall there have been discussions about the touchscreen not being properly tri-stated, but I haven't actually tried it yet.
    There are some touchscreens - the problem is actually the display controller MISO pin not being tri-stated - and it was only observed (at least here) so far on some ILI9488 displays. Touch worked when the MISO pin was not routed - though I didn't have a second SPI device online - it is possible the Touch MISO is the same.

  16. #16
    Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    86
    Finished KiCAD PCB today and found all parts on DigiKey for this.
    Looks like something from Star Wars.

    Click image for larger version. 

Name:	Pedal.jpg 
Views:	21 
Size:	78.0 KB 
ID:	18239

    Teensy 4.0
    Guitar input (preamp buffer)
    Line in, out, phone out.
    Bluetooth.
    LiPo charger with load sharing, 500mAH battery.
    "Audio Board" re-flowed on-board.
    SD-card with 4 data lines from Teensy's bottom.
    USB host.
    The screen is on the back. Power and reset buttons, 3 LED's for charger.

    The board is 90x62mm. Going to order 3-5 sets to test next week. This is how I spent my week of vacation.
    The case in FreeCAD is next. Got a 3D printer already.

  17. #17
    I've dug through this entire thread and the unfortunate reality is that although it has what appears to be a variety of useful information, it literally does NOT address the OP's main topic, comprehensively...

    I have built a system from the 3.5 with this display, using the ili9341t3N variant. I needed more processing power so I have switched over to the T4.0. I've been beating my head for the past 6 hours trying to get the display to work.

    Perhaps someone can compile all of the bits into ONE single post that defines everything that is required to use this display on the 4.0.

    1) How exactly are the physical connections setup between the 4.0 and the display's video section?
    - VCC: 5V or 3.3V source???
    - GND: This is pretty obvious
    - CS: pin 10?
    - RESET pulled up or dedicated pin?
    - DC ?
    - SDI MOSI ?
    - SCK ?
    - SDO MISO ?

    Are any limiting resistors or pullup/pulldown resistors needed on any of these pins? If so, what impedance?

    2) In the code, what pin definitions are required? Why am I seeing definitions for MOSI, MISO, RST being made but NOT included in the init line "ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);"

    3) What is the full list of required libraries?

    4) Are there any modifications necessary to any of the library h or cpp files?

    It would be incredibly helpful to have all of this info compiled into one SINGLE post, detailing all of the necessary bits to get this working.

    Lastly, since this is a touchscreen display, comprehensively detailing the setup for this should go hand in hand within the same post.

    Thankyou!!!

  18. #18
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,420
    Quote Originally Posted by AshPowers View Post
    I've dug through this entire thread and the unfortunate reality is that although it has what appears to be a variety of useful information, it literally does NOT address the OP's main topic, comprehensively...

    I have built a system from the 3.5 with this display, using the ili9341t3N variant. I needed more processing power so I have switched over to the T4.0. I've been beating my head for the past 6 hours trying to get the display to work.

    Perhaps someone can compile all of the bits into ONE single post that defines everything that is required to use this display on the 4.0.

    1) How exactly are the physical connections setup between the 4.0 and the display's video section?
    - VCC: 5V or 3.3V source???
    - GND: This is pretty obvious
    - CS: pin 10?
    - RESET pulled up or dedicated pin?
    - DC ?
    - SDI MOSI ?
    - SCK ?
    - SDO MISO ?
    ...
    The samples included with the " ili9341t3N " have been tested and perhaps updated as needed to work with the Teensy 4 - but based on the following the Teensy 4 connects and works not unlike the Teensy 3.x's.

    To that end - to see the working connectivity - these tests were using the standard " ili9341t3 " included in TeensyDuino without change::

    Just plugged a Teensy 4.0 onto the Prior PJRC Purple Display Test board and ran this sketch with this TeensyDuino 1.49 beta 4 install :: "...\hardware\teensy\avr\libraries\ILI9341_t3\exam ples\graphicstest\graphicstest.ino"

    That is the included _t3 code run without change and it is powering the ili9341 display as::
    Code:
    #define TFT_DC  9
    #define TFT_CS 10
    
    // Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
    Looking at this PJRC page pjrc.com/store/display_ili9341_touch.html it refers to the 'purple test board' noted above as in use.

    Likewise as connected with the Touch ili9341 from the above this sketch runs properly without change: "...\hardware\teensy\avr\libraries\XPT2046_Touchsc reen\examples\ILI9341Test\ILI9341Test.ino"

    See post #5 if the T_4 Rev D audio board is in use. Minor edits for display CS and DC pins used may be needed to avoid those used by the Audio board, but the SPI pins are as noted - standard for the T_3.x without the need to move the SCK pin to an alternate location for the T_4.0 as indicated on the product page linked in p#5.

  19. #19
    Interesting results.. When trying to compile, I'm getting a slew of errors..

    C:\Users\Ash\Documents\Arduino\libraries\ILI9341_t 3/ILI9341_t3.h:178:9: error: 'KINETISK_SPI0' was not declared in this scope

    sr = KINETISK_SPI0.SR;

    ^

    C:\Users\Ash\Documents\Arduino\libraries\ILI9341_t 3/ILI9341_t3.h: In member function 'void ILI9341_t3::waitFifoEmpty()':

    C:\Users\Ash\Documents\Arduino\libraries\ILI9341_t 3/ILI9341_t3.h:187:9: error: 'KINETISK_SPI0' was not declared in this scope

    sr = KINETISK_SPI0.SR;

    Many more of these same kinds of errors... I've never seen something like this before.

  20. #20
    Update: I Resolved these errors by deleting an ILI9341-T3 directory within the c:\users\....library folder. It was trying to use that one and apparently it is the wrong one.

    However, I'm still not getting images on the screen. In the serial monitor, the initial part of the test showing the modes, format, diagnostics of the LCD chipset are all coming back 0x0 so obviously the Teensy and display aren't communicating properly.

    The T4 is a 3.3v system so I am not using any resistors on any of the connections between the T4 and LCD. The LCD is powered by the T4's 3.3V output pin.

    CS on the display is connected to pin 10, CS, on the T4.
    DC on the display is at pin 8 on the T4
    RESET is at 9
    MOSI is at 11
    SCK is at 13
    MISO is at 12

    Are my connections correct here or?

    This display has been working perfectly with the T3.5 for the past several weeks so I'm confident it is not problematic.

    I also have tested each of the IO pins to make sure nothing was damaged on the T4 - an LED was attached to each pin and a simple program written to make it blink. All of the IO pins involved with the display are working normally.
    Last edited by AshPowers; 01-06-2020 at 08:03 AM.

  21. #21
    Using the Adafruit ili9341 library, it appears to be communicating with the display. The graphicstest example is consistently returning the following:

    Display Power Mode: 0x94
    MADCTL Mode: 0x48
    Pixel Format: 0x5
    Image Format: 0x80
    Self Diagnostic: 0xC0

    On power-up, the screen is bright white and then within ~0.5s it dims down to about half-luminosity. Unfortunately no graphics/text is being displayed on the screen.

    Pin connections:

    #define TFT_DC 9
    #define TFT_CS 10
    #define TFT_MOSI 11
    #define TFT_MISO 12
    #define TFT_RST 8
    #define TFT_CLK 13

  22. #22
    Member
    Join Date
    Mar 2019
    Location
    Hoboken, New Jersey, USA
    Posts
    86
    It works with the modified example I've posted on 10-06-2019, 07:19 PM above.
    One thing I've noticed is that you have "TFT_RST 8". Don't know if there is a point in this, as it has to be on +3.3V always. Or you need to have pin 8 on.
    Also, when I had the new audio shield connected as well and the SD card was inserted, the screen didn't work, like in your case.
    I've never solved it, because I have the SD card using Teensy's 4-bit interface and it all works.

    Check the contacts, too. Sometimes a cold solder can drive you crazy. Don't just check with the "beep" tester, make sure that the resistance is close to 0. It may beep with a bad solder.

    And put a serial output at the point where you actually output to the screen, to make sure your program doesn't crash before that. Happened to me too many times.

  23. #23
    Andy,

    Using the graphicstest example, calling ili9341_t3.h, and replacing code with yours, it will not communicate with the LCD. When using the adafruit ili9341 lib, it at least gets back some information from the LCD, consistently.

    I also put the reset pin on the LCD on a pullup with a 10K resistor to the 3.3v leg and no dice.

    I have continuity on all connections - from pin to pin of the T4 to the LCD.

    I am driving the LCD from the 3.3V output and I removed the limiting resistors on the back and bridged the pads for each circuit.

    The T4 is running at 600MHz, compiled with the "Faster" option.

    The ili9341-t3.h library is the one that comes with the teensyduino plug in and I have the latest 1.48 version of that, and the latest arduino IDE.

    The graphicstest example runs through a number of tests and reports back through the serial port so I Can see it moving along through the code. It isn't getting hung up anywhere.

    I am measuring an out freq at the SCK pin of 14.4KHz
    3.26v at the 3.3V pin


    To say the least, this is driving me nuts, LOL!
    Last edited by AshPowers; 01-06-2020 at 03:03 PM.

  24. #24
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,994
    Sorry I might be a bit lazy here and not try to figure out your current setup.

    Things like: Have you tried the latest beta releases of Teensyduino? I don't remember when the ili9341_t3 support went in for T4... AS for CS pins, there is only one, pin 10.

    And I don't remember if I tried to force you to use that for DC pin or not. I know I don't force it in ILI9341_t3n library: https://github.com/KurtE/ILI9341_t3n

    I initially did the work on that library first, before I ported back changes into the ili9341_t3 library.

    Also I know at one point some where experimenting with trying to run at a real fast SPI speed, which may or many not work, especially depending on wiring.

    You might look at ILI9341_t3.h file for the defines like:
    Code:
    #define ILI9341_SPICLOCK 30000000
    #define ILI9341_SPICLOCK_READ 2000000
    If they are higher than this, you might try lowering to this. And if they are this, try changing the 30mhz to 20mhz and see if it works.

  25. #25
    I appreciate the help guys. I'm going to order up another display as I may have damaged this one when wiring it up. It doesn't seem like this should be so difficult and I've tried so many different solutions. Good ol Amazon - replacement will be here tomorrow, LOL.

Posting Permissions

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