Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Teensy 4.1, Touchscreen, Audio

  1. #1
    Junior Member
    Join Date
    Feb 2021
    Location
    Mclean VA -- West of DC
    Posts
    7

    Teensy 4.1, Touchscreen, Audio

    Working on a handheld audio project, I recently abandoned Raspberry Pi (boot time too long) in favor of Teensy 4.1 -- I am very excited about the audio possibilities.
    I need touchscreen LCD for menu/navigation only (3.5", 480x320, ILI9488 is popular) and SD card for audio waves. I was using GTK+ but I'm happy to jump into LVGL. I only need a few GPIOs (I2c would be useful.)
    At this point, I just want to know what to buy and an "existence proof" to proceed. The best LCD reference code I can find is SK Pang's. My questions:

    1) Should I look at serial or parallel LCD interface? Can a parallel LCD work in serial (SPI) mode? (Most serial LCDs ship from China, with 2 month delivery -- ouch!)
    2) I evidently need 3 SPI ports -- audio (I2S, which is similar to SPI, right?), LCD and touch. Can the Teensy do all that at once?
    3) Does the Teensy need to constantly refresh the LCD or does the ILI9488 have a frame buffer?

    Any help & opinions happily accepted; thanks!

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,769
    ... first pass answers links to other info ...

    Forum search for ILI9488 will find development and notes on SPI display usage. There are options for continuous DMA update or single write processing and the screen can be buffered ... notes on driver and usage on ILI9488 thread.

    Depending on display the Touch could share SPI perhaps or it might be i2c

    Audio i2s is a unique set of pins - not SPI - see the PJRC Audio card Rev D for example connections and use.

  3. #3
    Member
    Join Date
    Oct 2020
    Location
    Berks UK
    Posts
    34
    Quote Originally Posted by Bewing View Post
    Working on a handheld audio project, I recently abandoned Raspberry Pi (boot time too long) in favor of Teensy 4.1 -- I am very excited about the audio possibilities.
    I need touchscreen LCD for menu/navigation only (3.5", 480x320, ILI9488 is popular) and SD card for audio waves. I was using GTK+ but I'm happy to jump into LVGL. I only need a few GPIOs (I2c would be useful.)
    At this point, I just want to know what to buy and an "existence proof" to proceed. The best LCD reference code I can find is SK Pang's. My questions:

    1) Should I look at serial or parallel LCD interface? Can a parallel LCD work in serial (SPI) mode? (Most serial LCDs ship from China, with 2 month delivery -- ouch!)
    2) I evidently need 3 SPI ports -- audio (I2S, which is similar to SPI, right?), LCD and touch. Can the Teensy do all that at once?
    3) Does the Teensy need to constantly refresh the LCD or does the ILI9488 have a frame buffer?

    Any help & opinions happily accepted; thanks!
    Interested that you are concerned about Chinese (eBay?) delivery times. Iíve just ordered 5x very low cost Chinese sourced ILI9341s (TFT, SPI) and fully expect them to be here in the UK in about a week. But yes the vendors do state 2 months delivery just to cover their asses. The occasional item takes a month or so for sure, but on average supply from China to the UK at least is pretty fast. I used to let the delivery estimate put me off but I donít now, I just accept that a small number of the parcels wonít show for a while.

    The Teensy 4.1 can manage at least 3 SPI ports using the standard SPI library, so you shouldnít have a problem interfacing it?

    Steve

  4. #4
    Senior Member
    Join Date
    Jul 2020
    Posts
    918
    Quote Originally Posted by Bewing View Post
    (I2S, which is similar to SPI, right?)
    Well I'd call them completely different. I2S requires a stable set of clocks, all phase-locked to each other and low jitter,
    running continuously and communicates a pair of digital audio channels per data wire. SPI can be bit banged and has
    no stringent timing requirements and is typically used for chip configuration.

  5. #5
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    4,019
    A couple of things that I've seen over time that have been posted to the group or elsewhere.

    The Teensy 4.1 has several different options for audio processing:
    • First I2S bus: The simplest approach to audio is the main I2S bus. There is a Teensy audio adapter where the revision D board is designed to fit on top of or under the Teensy 4.x processors. This is probably the best approach for a handheld device, but you can use other I2S devices and attach them to the appropriate pins. There are ways to make quad/octo/hex channel input/output using the 5 pins that can function as input or outputs;
    • Second I2S bus: The Teensy 4.x has a second I2S bus that you can use. IIRC this bus is a little more restricted than the first bus in that I think it is only stereo input/output;
    • S/PDIF: The Teensy 4.x can handle S/PDIF inputs/outputs. You can use either the pins for the first two I2S buses, or there are two dedicated pins that can be used;
    • MQS: The Teensy 4.x has one MQS input/output stream for medium quality sound. However, given the pins used overlap with the SPI pins, it would not be appropriate for your use;
    • TDM: The Teensy 3.x/4.x has support for a 256 bit Time Division Multiplexed frame containing many audio channels.


    In terms of the touch screen input, I've seen posts that say sometimes the touch screen part interferes with the display part if both are on the same SPI bus. Sometimes the fix is to add either pull-up resistors on both of the CS pins and/or adding a tri-state buffer. On the Teensy 4.1 you have a second SPI bus that is accessible that I imagine you could hook the touchscreen bits to and use the main SPI bus for the screen. Other touchscreens use I2C instead of SPI for the touch information.


    For I2C devices (like some touch screens), you might need to add pull-up resistors. A lot of devices include pull-up resistors, but if you find I2C devices hanging, you might need to add your own pull-ups:


    If you need a lot more speed in the graphics side of things, you might consider off loading the screen support to a dedicate GPU that can handle the the graphics/touchscreen directly. The one that I'm familiar with is the Gamedunio3 that has a 4.3" screen and 7" screen. Note, it uses an Arduino layout for the pins, so you would likely need a Teensy -> Arduino shield to attach it:

Posting Permissions

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