Add a 3.5 inch display
Warning
If upgrading from pCP version 9.2 or lower, or if installing fresh on pCP 10 or higher, be sure to read the important note below, otherwise jivelite will fail to write out its settings.
What was used
Hardware
- Raspberry Pi 3B—see Components - Raspberry Pi.
- A 3.5 TFT screen - 3.5inch RPi Display - 480x320 Pixel - XPT2046 Touch Controller
- 8GB SD card—see Components - SD card.
Software
- piCorePlayer 8.2.0-rc1—see piCorePlayer Downloads.
Steps
Step 1 - Setup piCorePlayer
- Setup piCorePlayer—see Getting started.
Warning
Before continuing, ensure piCorePlayer is connecting to LMS and playing music.
Step 2 - Edit cmdline.txt
- Access piCorePlayer via ssh—see Access piCorePlayer via ssh.
- Edit the file
cmdline.txt. - Add
fbcon=map:10 fbcon=font:ProFont6x11 logo.nologoto the end of the first line incmdline.txt.
tc@pCP:~$ m1
tc@pCP:~$ c1
tc@pCP:/mnt/mmcblk0p1$ vicmd
Danger
cmdline.txt must be just one long line of boot codes. Adding extra lines will cause boot failure.
tc@pCP:/mnt/mmcblk0p1$ cat cmdline.txt
tz=EST-10EST,M10.1.0,M4.1.0/3 dwc_otg.fiq_fsm_mask=0xF host=piCorePlayer dwc_otg.lpm_enable=0 console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed smsc95xx.turbo_mode=N noswap consoleblank=0 waitusb=2 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo
Info
These 3 options may not really be required. Try removing them one at a time. Let us know.
- fbcon=map:10
- fbcon=font:ProFont6x11
- logo.nologo
Step 3 - Edit config.txt
- Access piCorePlayer via ssh—see Access piCorePlayer via ssh.
- Edit the file
config.txt—see Edit config.txt. - Add
dtoverlay=piscreen,speed=24000000,rotate=90between the lines starting with #—Begin-Custom and #—End-Custom in config.txt.
tc@pCP:~$ m1
tc@pCP:~$ c1
tc@pCP:/mnt/mmcblk0p1$ vicfg
- The bottom part of config.txt should end up looking like the following.
#Custom Configuration Area, for config settings that are not managed by pCP.
#pCP will retain these settings during insitu-update
#---Begin-Custom-(Do not alter Begin or End Tags)-----
dtoverlay=piscreen,speed=24000000,rotate=90
#---End-Custom-----------------------------------------
piscreen overlay description:
Name: piscreen
Info: PiScreen display by OzzMaker.com
Load: dtoverlay=piscreen,<param>=<val>
Params: speed Display SPI bus speed
rotate Display rotation {0,90,180,270}
fps Delay between frame updates
debug Debug output level {0-7}
xohms Touchpanel sensitivity (X-plate resistance)
Step 4 - Resize root partition
Resize the root partition to give extra space to download extensions required by Jivelite.
- From the [Main Page] click the [Resize FS] button and choose to increase the size to at least 100 MB.
Step 5 - Load Jivelite extensions
The default skin and all its dependencies will be automatically loaded.
- From the [Main Page] and click the [Extensions] button at the end of the “Additional functions” section.
- Click the [Available] tab.
- Select the “pcp-jivelite_default-wav35skin.tcz” extension from the piCorePlayer main repository.
- Click the [Load] button.
This loads the following extensions.
-----pcp-jivelite_default-wav35skin.tcz
|-----pcp-jivelite_wav35skin.tcz
| |-----pcp-jivelite.tcz
| | |-----touchscreen-xxxxx.tcz
| | |-----libts.tcz
| | |-----pcp-lua.tcz
| | |-----pcp-jivelite_hdskins.tcz
Step 6 - Backup and shutdown
-
Backup and shutdown the Raspberry Pi.
$
pcp bs
Step 7 - Add display
- Add the display on the Raspberry Pi.
Step 8 - Boot piCorePlayer
- Power on
Info
At this stage the touch screen should be working as just a console window, without Jivelite.
Step 9 - Create jivelite.sh script (for pCP earlier than version 10)
Warning
This has changed for pCP version 10 and higher. The jivelite startup script is now considerably more sophisticated, and you do not need a custom jivelite script at all.
-
Create a file jivelite.sh in directory /mnt/mmcblk0p2/tce/
$
ce$
vi jivelite.sh -
Copy and paste the code below into jivelite.sh
#!/bin/sh
EVENTNO=$(cat /proc/bus/input/devices | awk '/ADS7846 Touchscreen/{for(a=0;a>=0;a++){getline;{if(/mouse/==1){ print $NF;exit 0;}}}}')
export JIVE_NOCURSOR=1
export SDL_VIDEODRIVER=fbcon
export SDL_FBDEV=/dev/fb1
export TSLIB_TSDEVICE=/dev/input/$EVENTNO
export SDL_MOUSEDRV=TSLIB
while true; do
/opt/jivelite/bin/jivelite
sleep 3
done
-
Set jivelite.sh as executable.
$
chmod 755 jivelite.sh
Warning
The script above is assuming the device name is ADS7846 Touchscreen. To determine device name use the command below.
tc@pCP:~$ cat /proc/bus/input/devices | grep N:
N: Name="ADS7846 Touchscreen"
Step 10 - Calibrate Touch Display
$ sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 /usr/local/bin/ts_calibrate
You should see the following 2 lines on the screen.
Touchscreen calibration utility
Touch crosshair to calibrate
- Touch the 5 crosshairs, 4 corners plus center.
xres = 480, yres = 320
Took 10 samples...
Top left : X = 3858 Y = 342
Took 12 samples...
Top right : X = 321 Y = 344
Took 3 samples...
Bot right : X = 315 Y = 3814
Took 12 samples...
Bot left : X = 3841 Y = 3734
Took 8 samples...
Center : X = 2078 Y = 2026
512.168335 -0.130261 -0.000433
-21.502014 0.001012 0.087424
Calibration constants: 33565464 -8536 -28 -1409156 66 5729 65536
Step 11 - Check calibration was successful
$ sudo TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/event0 /usr/local/bin/ts_test
You should see the following 2 lines on the screen.
Touchscreen test program
Touch screen to move crosshair
- Move the stylus around the screen and the crosshair should follow.
- Touch [Quit] button on the top right to exit test.
1599049890.101942: 246 164 6
1599049890.121943: 246 164 19
1599049890.142008: 246 164 28
1599049890.161937: 246 164 31
1599049890.181949: 246 165 37
1599049890.207568: 247 165 40
1599049890.221956: 248 165 42
1599049890.242051: 249 165 43
1599049890.261960: 251 165 43
1599049890.281957: 252 165 42
1599049890.304261: 253 165 43
1599049890.321945: 255 165 42
tc@pCP:~$
Step 12 - Set Jivelite to Autostart
- Go to the [Tweaks] > “Jivelite Setup” page.
- Set “Set Autostart” to “Yes”.
- Click [Set Autostart] to save.
- Click [Main Page] > [Reboot].
Step 13 - Setup Jivelite
- Select language.
Step 14 - Backup
- Click [Main Page] > [Backup] to save Jivelite settings.
More information
- Download piCorePlayer
- Burn piCorePlayer onto a SD card
- Determine your piCorePlayer IP address
- Access piCorePlayer via ssh
- Edit config.txt
- piCorePlayer aliases
- piCorePlayer CLI
- Basic vi commands
- Raspberry Pi config.cfg
- Waveshare 4.1 TFT + piCorePlayer + Jivelite
- Documentation / fb / fbcon.txt