Skip to content

Instantly share code, notes, and snippets.

@jadudm
Forked from kaz-yos/elecrow_config.txt
Created October 20, 2019 21:11
Show Gist options
  • Save jadudm/b643cd2af6a97eabf10a4cb0e6047c1b to your computer and use it in GitHub Desktop.
Save jadudm/b643cd2af6a97eabf10a4cb0e6047c1b to your computer and use it in GitHub Desktop.
Elecrow 5inch 800x480 LCD configuration for Raspberry Pi (Add to the bottom of /boot/config.txt)
### Elecrow HDMI 5inch 800x480 LCD display
# https://www.amazon.com/Elecrow-Display-Monitor-800x480-Raspberry/dp/B013JECYF2/
# Adopted from the following URL. Modified for clarity and corrections.
# https://www.amazon.com/gp/aw/review/B013JECYF2/R3ZXW0VTV8AEB/ref=cm_cr_dp_mb_rvw_1?ie=UTF8&cursor=1
# DOCUMENTATION > CONFIGURATION > CONFIG-TXT
# https://www.raspberrypi.org/documentation/configuration/config-txt.md
### Display configuration
# hdmi_group: 0 auto-detect from EDID; 1 CEA; 2 DMT
hdmi_group=2
# hdmi_mode: 87 custom configuration
hdmi_mode=87
# hdmi_cvt: <width> <height> <framerate in Hz> <aspect 6 is 15:9> <margins> <interlace> <rb>
hdmi_cvt 800 480 60 6 0 0 0
### Touch panel activation
# Serial Peripheral Interface (SPI) Bus
# https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
# Gibhub: raspberrypi/firmware/boot/overlays/README
# https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README
### Enable interfaces
# enable the spi interfaces
dtparam=spi=on
# enable the ARM's i2c interface
dtparam=i2c_arm=on
### Configure touch panel
# penirq is required and usually xohms (60-100) has to be set as well.
# Apart from that, pmax (255) and swapxy are also common.
# The rest of the calibration can be done with xinput-calibrator.
# See: github.com/notro/fbtft/wiki/FBTFT-on-Raspian
# Device Tree binding document:
# www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt
# Device tree bindings for TI's ADS7843, ADS7845, ADS7846, ADS7873, TSC2046
# SPI driven touch screen controllers.
# https://www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt
# Activate ADS7846 Touch controller
dtoverlay=ads7846
# cs: SPI bus Chip Select (default 1)
dtparam=cs=1
# penirq: GPIO used for PENIRQ. REQUIRED
dtparam=penirq=25
# penirq_pull: Set GPIO pull (default 0=none, 2=pullup)
dtparam=penirq_pull=2
# speed: SPI bus speed (default 2MHz, max 3.25MHz)
dtparam=speed=50000
# set to keep vref on for differential measurements as well
dtparam=keep_vref_on=0
# swapxy: Swap x and y axis
dtparam=swapxy=0
# pmin: Minimum reported pressure value (default 0)
# pmax: Maximum reported pressure value (default 65535)
dtparam=pmax=255
# xohms: Touchpanel sensitivity (X-plate resistance) (default 400)
dtparam=xohms=150
# Use xinput-calibrator to obtain these values
# $ sudo aptitute install xinput-calibrator
# Pi menu - Preferences - Calibrate Touch Screen
# xmin: Minimum value on the X axis (default 0)
dtparam=xmin=148
# xmax: Maximum value on the X axis (default 4095)
dtparam=xmax=3948
# ymin: Minimum value on the Y axis (default 0)
dtparam=ymin=283
# ymax: Maximum value on the Y axis (default 4095)
dtparam=ymax=4015
# Configures the w1-gpio Onewire interface module.
# Use this overlay if you *do* need a GPIO to drive an external pullup.
dtoverlay=w1-gpio-pullup
# gpiopin: GPIO for I/O (default "4")
dtparam=gpiopin=4
# pullup: Non-zero, "on", or "y" to enable the parasitic
# power (2-wire, power-on-data) feature
# extpullup: GPIO for external pullup (default "5")
dtparam=extpullup=1
@jadudm
Copy link
Author

jadudm commented Oct 20, 2019

This block, from here, mattered.

https://raspberrypi.stackexchange.com/questions/91337/elecrow-7-hdmi-screen-reports-no-signal

max_usb_current=1
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt=1024 600 60 6 0 0 0
#hdmi_safe=1

I also commented out all of the interface bits, and the touch seems to work regardless. (My model does not plug into the Pi, but uses USB instead. Perhaps those configuration options were part of the problem.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment