To use the HDMI LCD XPT2046 on Raspberry Pi 2B, you have to follow these steps:
1. Modify the file /boot/config.txt with the following parameters:
# uncomment to force a specific HDMI mode (this will force VGA)gpu_mem=32framebuffer_ignore_alpha=1framebuffer_swap=1disable_overscan=1init_uart_clock=16000000hdmi_group=2hdmi_mode=1hdmi_mode=87hdmi_cvt 800 480 60 6 0 0 0start_file=start_x.elffixup_file=fixup_x.elf2. To configure the touch controller ADS7846 you have to add the following parameters to the same file:
dtparam=spi=ondtoverlay=ads7846,penirq=25,speed=10000,penirq_pull=2,xohms=1503. To calibrate the touch screen ADS7856, you’ll need to get the file "5inch_HDMI_LCD.tar.gz" from somewhere. If you search with Google, you should be able to find it easily enough. With this file, you can extract the archive file "xinput-calibrator_0.7.5-1_armhf.deb".
Install it with:
# dpkg -i xinput-calibrator_0.7.5-1_armhf.debThis installs the graphical touch screen calibration tool for the 5″ LCD. Since we want to provide at least a baseline calibration, we add a directory at /etc/X11/xorg.conf.d and create a file named 99-calibration.conf in that directory. The contents (as an example) would be:
Section "InputClass"Identifier "calibration"MatchProduct "ADS7846 Touchscreen"Option "Calibration" "129 3955 191 3946"EndSectionIf you want to calibrate your display manually, you can simply log into the Raspberry Pi 2 on the console and issue the normal startx command. Then SSH into the Raspberry Pi 2, and run the command:
DISPLAY=:0 xinput_calibratorYou should get a screen that tells you to press the stylus to the crosshair. Once you’ve hit all four crosshairs, you are presented with a chunk of text that looks strikingly like the above 99-calibration.conf file contents. Replace the /etc/X11/xorg.conf.d/99-calibration.conf file’s contents with the output of the xinput_calibrator command and you should be in good shape.
Other interesting parameters:
1.- Setting max_usb_current=1 sets the available current over USB to 1.2A (default is 600mA). This can help if you have a decent power supply (2A, at least) and need to power something like a small external HDD or something that needs 300+ mA.
max_usb_current=1