Adafruit Industries, Essential service and business: NYC – Executive Order 202.6 - Read more. Accepting essential orders - here's how.
0

Proper way of adding a TFT display to the Pocket Beagle in l
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Proper way of adding a TFT display to the Pocket Beagle in l

by ocram on Sat Nov 16, 2019 3:14 pm

Hi,

I have a TFT 3.5" display with a il9486 controller that a friend let me borrow to use with my PocketBeagle. I want to use the fbtft driver in order to display an X11 application on it. I have looked around but can only find older implementations of this combination that describe using the capemgr and overlays to get it to work on the PocketBeagle. As far as I can tell the capemgr is replaced by uBoot but then it seems the overlays are now replaced by config-pin.

The overlays I have found seem to be meant to configure and enable the spi device and its pins. However, the PocketBeagle with the latest image (4.14.108-ti-r124) seems to come with the spi0 device already available and configured out of the box. At least some documentation I have found indicated this and the devices are listed in the /dev folder right after boot-up:

Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~$ ls /dev/spi*
/dev/spidev1.0  /dev/spidev2.0  /dev/spidev2.1

/dev/spi:
0.0  1.0  1.1


Both a short python and C programs with a loopback jumper between the MOSI and MISO pins on spi0 confirm it is working:

Code: Select all | TOGGLE FULL SIZE
debian@beaglebone:~/testSPI$ more testSPI.py
#!/bin/python3
import Adafruit_BBIO
import Adafruit_BBIO.SPI as SPI

from Adafruit_BBIO.SPI import SPI
# /dev/spidev1.0
spi = SPI(1, 0)
print(spi.xfer2([32, 11, 110, 22, 220]))
spi.close()
debian@beaglebone:~/testSPI$ python3 testSPI.py
[32, 11, 110, 22, 220]


Code: Select all | TOGGLE FULL SIZE
int main(void)
{
  int i = 0;
  int rxval;
  const char *send = "HELLO";//{'H', 'E', 'L', 'L', 'O'};
  char recv[5] = {'\0'};
  iolib_init();
  if (spi_enable_pb(SPI_BUS))
  {
    spi_ctrl(SPI_BUS, SPI_CH0, SPI_MASTER, SPI_RXTX, /* use SPI_TX or SPI_RXTX depending on needs */
             SPI_DIV32, SPI_CLOCKMODE3, /* 48 MHz divided by 32, SPI mode 3 */
             SPI_CE_ACT_LOW, SPI_INOUT, 16); /* D0 is output and D1 is input, 16-bit transactions */
    printf("Sending: %s\n", send);
    spi_transact(SPI_BUS, SPI_CH0, send[i] /*or integer to transmit data*/, &rxval);
    recv[i++] = rxval;
    spi_transact(SPI_BUS, SPI_CH0, send[i] /*or integer to transmit data*/, &rxval);
    recv[i++] = rxval;
    spi_transact(SPI_BUS, SPI_CH0, send[i] /*or integer to transmit data*/, &rxval);
    recv[i++] = rxval;
    spi_transact(SPI_BUS, SPI_CH0, send[i] /*or integer to transmit data*/, &rxval);
    recv[i++] = rxval;
    spi_transact(SPI_BUS, SPI_CH0, send[i] /*or integer to transmit data*/, &rxval);
    recv[i++] = rxval;
    printf("Received: %s\n", recv);
  }
  spi_disable_pb(SPI_BUS);
  iolib_free();
  return(0);
}

debian@beaglebone:~/devLib/iobb/test-io$ gcc -o spi ./spi.c -I../ -L../ -liobb
debian@beaglebone:~/devLib/iobb/test-io$ sudo ./spi
Sending: HELLO
Received: HELLO



This article https://www.mouser.com/applications/retro-arcade-build/ provides an overlay in the "Modify the Hardware Configuration" section that should do what I need, with a bit of modification since it calls out a different display model. But other than mentioning the dtbo file should be added to the /boot/uEnv.txt file there is no detail on how to do that (syntax to use) and also how to check that loading the overlay worked and a way to load the fbtft driver. Any chance you guys have some insight into what I could try to get this to work? The display I am testing with is working well on an Arduino Uno using the MCUFRIEND driver and the Adafruit_GFX library.

ocram
 
Posts: 25
Joined: Mon Nov 19, 2012 10:06 am

Re: Proper way of adding a TFT display to the Pocket Beagle

by drewfustini on Sun Dec 01, 2019 9:29 pm

This looks like an issue for similar controller:
https://github.com/notro/fbtft/issues/311

The tinydrm (formerly fbtft) drivers allow small TFT displays to be used with the Linux kernel.

drewfustini
 
Posts: 920
Joined: Sat Dec 26, 2015 1:19 pm

Please be positive and constructive with your questions and comments.