|
1 |
| -downloaded LCD_show |
2 | 1 |
|
3 |
| -read script LCD35-show |
| 2 | +https://gist.github.com/notro/63fc8f563b5f85010d30 |
4 | 3 |
|
5 |
| -installed pkgs (some may be present) |
| 4 | +"gpio" command ! woah |
6 | 5 |
|
7 |
| - sudo apt-get install xserver-xorg-input-evdev xinput-calibrator xserver-xorg-video-fbdev fbset |
| 6 | +SPEC https://www.waveshare.com/wiki/3.5inch_RPi_LCD_(A) |
8 | 7 |
|
9 |
| -copied device tree overlays from lcd-show |
| 8 | +https://elinux.org/Device_Tree_Source_Undocumented |
10 | 9 |
|
11 |
| - sudo cp ./waveshare35a-overlay.dtb /boot/overlays/waveshare35a.dtbo |
12 |
| - sudo cp ./waveshare35a-overlay.dtb /boot/overlays/ |
| 10 | +https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fbtft/README?h=staging-testing |
| 11 | +https://github.com/notro/fbtft/wiki/Device-Tree |
| 12 | +https://github.com/notro/fbtft/wiki/FBTFT-RPI-overlay |
13 | 13 |
|
14 |
| -added to cmdline.txt |
15 | 14 |
|
16 |
| - fbcon=map:10 fbcon=font:ProFont6x11 |
| 15 | +https://www.kernel.org/doc/Documentation/devicetree/bindings/spi/ |
| 16 | +https://www.kernel.org/doc/Documentation/devicetree/bindings/spi/spi-controller.yaml |
17 | 17 |
|
18 |
| -modified config.txt (unsure yet if all mods needed) |
| 18 | +controller is https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/brcm%2Cbcm2835-gpio.txt |
19 | 19 |
|
20 |
| - dtparam=i2c_arm=on |
21 |
| - dtparam=spi=on |
22 |
| - enable_uart=1 |
| 20 | +https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt |
23 | 21 |
|
24 |
| - dtoverlay=waveshare35a |
25 |
| - #dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=1000000,keep_vref_on=1,swapxy=1,pmax=255,xohms=60,xmin=200,xmax=3900,ymin=200,ymax=3900 |
26 | 22 |
|
27 |
| - hdmi_force_hotplug=1 |
28 |
| - hdmi_group=2 |
29 |
| - hdmi_mode=1 |
30 |
| - hdmi_mode=87 |
31 |
| - hdmi_cvt 480 320 60 6 0 0 0 |
32 |
| - hdmi_drive=2 |
| 23 | +AHA! the documented pinout like https://www.waveshare.com/3.5inch-rpi-lcd-a.htm is the rPi physical pinout. The device-tree config uses the GPIO numbers like https://www.researchgate.net/figure/Schematic-zoom-of-the-Raspberry-Pi-3-B-pins-Adapted-from-14_fig2_351755761 |
33 | 24 |
|
34 |
| -docs: |
| 25 | +con2fbmap |
| 26 | +chvt |
35 | 27 |
|
36 |
| -on fbcon, fbcon=map option etc: |
37 |
| -* https://www.kernel.org/doc/Documentation/fb/fbcon.txt |
38 |
| -* control after with con2fbmap command |
| 28 | +driver = fb_ili9486 (fbtft based) |
39 | 29 |
|
40 |
| -aha, so the trick here is to fake the pi into thinking it has hdmi, output to hdmi, then clone fb0->fb1 in userspace with fbcp, ew. But it's useful to keep the hdmi options |
41 |
| -in config.txt because otherwise the lcd will sometimes be fb0, sometimes fb1. |
42 | 30 |
|
43 |
| -created /etc/X11/xorg.conf.d/ |
| 31 | +# lock cpu freq |
| 32 | +for f in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do |
| 33 | + echo 'performance' | sudo tee -a $f; |
| 34 | +done |
| 35 | +for f in /sys/devices/system/cpu/cpu*/cpufreq/{scaling_min_freq,scaling_max_freq}; do |
| 36 | + echo '500000' | sudo tee -a $f; |
| 37 | +done |
44 | 38 |
|
45 |
| -created /etc/X11/xorg.conf.d/99-fbdev-lcd.conf |
| 39 | +cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq |
46 | 40 |
|
47 |
| - Section "Device" |
48 |
| - Identifier "lcd35" |
49 |
| - Driver "fbdev" |
50 |
| - Option "fbdev" "/dev/fb1" |
51 |
| - EndSection |
| 41 | +cat /sys/kernel/debug/clk/clk_summary |
52 | 42 |
|
| 43 | +https://starfishmedical.com/blog/raspberry-pi-clock-conundrum/ |
53 | 44 |
|
54 |
| -(may need to change) |
55 | 45 |
|
56 |
| -/etc/init.d/lightdm restart |
| 46 | +try dtparam uart1 on / off ? |
57 | 47 |
|
58 |
| -... with which the display blanks, but doesn't do anything else, damn. |
| 48 | +vcgencmd get_config str |
59 | 49 |
|
60 | 50 |
|
61 |
| -made it work with a more complex x config; may break after reboot hdmi |
62 | 51 |
|
63 |
| - # Note that this supplements the default config loaded from |
64 |
| - # /etc/X11/xorg.conf.d/99-fbdev-lcd.conf and the other .conf files there. |
| 52 | +# tis doesn't seem right |
| 53 | +# |
| 54 | +# I actually observe somewhat working with reset 0x19 (25), dc 0x18 (24), pendown 0x11 (17) |
| 55 | +# which is wtf. Data pin must be right if display can show stuff. |
| 56 | +# |
| 57 | +# but all refs agree https://www.waveshare.com/3.5inch-rpi-lcd-a.htm |
| 58 | +# |
65 | 59 |
|
66 |
| - Section "Device" |
67 |
| - Identifier "lcd35" |
68 |
| - Driver "fbdev" |
69 |
| - Option "fbdev" "/dev/fb1" |
70 |
| - EndSection |
71 | 60 |
|
72 |
| - Section "Monitor" |
73 |
| - Identifier "hdmi" |
74 |
| - EndSection |
| 61 | + LCD panel: Ilitek ILI9486 |
| 62 | + Touch layer: ADS7846 |
| 63 | + Touch controller: XPT2046 |
75 | 64 |
|
76 |
| - Section "Monitor" |
77 |
| - Identifier "lcd35" |
78 |
| - VendorName "Wavecomm-clone" |
79 |
| - ModelName "Touch-35" |
80 |
| - # DisplaySize ... |
81 |
| - # Option "Rotate" ... |
82 |
| - EndSection |
| 65 | +Pin Symbol Description |
| 66 | +1, 17 3.3V + Power rail |
| 67 | +2, 4 5V + Power rail |
| 68 | +3, 5, 7, 8, 10, 12, 13, 15, 16 NV NC |
| 69 | +6, 9, 14, 20, 25 GND Ground |
| 70 | +11 TP_IRQ Touch panel interrupt, pulled low during touch |
| 71 | +18 LCD_RS LCD instruction control, Instruction/Data register selection |
| 72 | +19 LCD_SI/TP_SI SPI data input of both LCD & touch panel |
| 73 | +21 TP_S0 SPI data output of touch panel |
| 74 | +22 RST Reset |
| 75 | +23 LCD_SCK/TP_SCK SPI clock for both LCD & touch panel |
| 76 | +24 LCD_CS LCD chip select (active low) |
| 77 | +26 TP_CS Touch panel chip select (active low) |
83 | 78 |
|
84 |
| - Section "Screen" |
85 |
| - Identifier "lcd35" |
86 |
| - Device "lcd35" |
87 |
| - Monitor "lcd35" |
88 |
| - EndSection |
89 | 79 |
|
90 |
| - # The device is defined in /etc/X11/xorg.conf.d/99-fbdev-lcd.conf |
91 |
| - Section "Screen" |
92 |
| - Identifier "hdmi" |
93 |
| - Device "Allwinner A10/A13 FBDEV" |
94 |
| - Monitor "hdmi" |
95 |
| - EndSection |
| 80 | +/* |
| 81 | + * Pin mapping |
| 82 | + * PHY GPIO NAME INOUT PULL ACTIVE DESC |
| 83 | + * 11 17 TP_IRQ IN H? LOW Touch panel interrupt, pulled low during touch |
| 84 | + * 18 24 LCD_RS OUT LCD instruction control, Instruction/Data register selection |
| 85 | + * 19 10 LCD_SI/TP_SI OUT SPI data input of both LCD & touch panel |
| 86 | + * 21 9 TP_S0 IN SPI data output of touch panel |
| 87 | + * 22 25 RST OUT H? Reset |
| 88 | + * 23 11 LCD_SCK/TP_SCK OUT SPI clock for both LCD & touch panel |
| 89 | + * 24 8 LCD_CS OUT H? LOW LCD chip select (active low) |
| 90 | + * 26 7 TP_CS OUT H? LOW Touch panel chip select (active low) |
| 91 | + */ |
96 | 92 |
|
97 |
| - Section "ServerLayout" |
98 |
| - Identifier "lcd35" |
99 |
| - Screen "lcd35" |
100 |
| - Screen "hdmi" RightOf "lcd35" |
101 |
| - #InputDevice "ADS7846 Touchscreen" "SendCoreEvents" |
102 |
| - EndSection |
| 93 | +/proc/device-tree/soc/gpio@7e200000/spi0_pins/brcm,pins |
| 94 | +0000000 0000 0900 0000 0a00 0000 0b00 |
| 95 | +0000014 |
103 | 96 |
|
104 |
| -touchscreen rotated. Used |
| 97 | +/proc/device-tree/soc/gpio@7e200000/spi0_gpio7/brcm,pins |
| 98 | +0000000 0000 0700 0000 0800 0000 0900 0000 0a00 |
| 99 | +0000020 0000 0b00 |
| 100 | +0000024 |
105 | 101 |
|
106 |
| - sudo DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xinput list |
| 102 | +/proc/device-tree/soc/gpio@7e200000/alt0/brcm,pins |
| 103 | +0000000 0000 0400 0000 0500 0000 0700 0000 0800 |
| 104 | +0000020 0000 0900 0000 0a00 0000 0b00 |
| 105 | +0000034 |
107 | 106 |
|
108 | 107 |
|
109 |
| -pi@raspberrypi:~ $ sudo DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xinput list |
110 |
| -⎡ Virtual core pointer id=2 [master pointer (3)] |
111 |
| -⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] |
112 |
| -⎜ ↳ ADS7846 Touchscreen id=6 [slave pointer (2)] |
113 |
| -⎣ Virtual core keyboard id=3 [master keyboard (2)] |
114 |
| - ↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)] |
| 108 | +what about using spi0-2cs ? |
115 | 109 |
|
| 110 | +craig@raspberrypi:~ $ sudo dtoverlay -h spi0-2cs |
| 111 | +Name: spi0-2cs |
116 | 112 |
|
117 |
| -then ran |
| 113 | +Info: Change the CS pins for SPI0 |
118 | 114 |
|
119 |
| - sudo DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xinput_calibrator |
| 115 | +Usage: dtoverlay=spi0-2cs,<param>=<val> |
120 | 116 |
|
121 |
| -to get |
| 117 | +Params: cs0_pin GPIO pin for CS0 (default 8) |
| 118 | + cs1_pin GPIO pin for CS1 (default 7) |
| 119 | + no_miso Don't claim and use the MISO pin (9), freeing |
| 120 | + it for other uses. |
122 | 121 |
|
123 |
| - Section "InputClass" |
124 |
| - Identifier "calibration" |
125 |
| - MatchProduct "ADS7846 Touchscreen" |
126 |
| - Option "MinX" "20980" |
127 |
| - Option "MaxX" "22437" |
128 |
| - Option "MinY" "50226" |
129 |
| - Option "MaxY" "52274" |
130 |
| - Option "SwapXY" "1" # unless it was already set to 1 |
131 |
| - Option "InvertX" "0" # unless it was already set |
132 |
| - Option "InvertY" "0" # unless it was already set |
133 |
| - EndSection |
134 | 122 |
|
135 |
| -installed in config as simplified |
136 | 123 |
|
| 124 | +https://raspberrypi.stackexchange.com/questions/24279/disable-bcm2708-fb-the-hdmi-framebuffer-device |
137 | 125 |
|
138 |
| - Section "InputClass" |
139 |
| - Identifier "calibration" |
140 |
| - MatchProduct "ADS7846 Touchscreen" |
141 |
| - Option "SwapXY" "1" # unless it was already set to 1 |
142 |
| - Option "InvertX" "0" # unless it was already set |
143 |
| - Option "InvertY" "0" # unless it was already set |
144 |
| - EndSection |
145 | 126 |
|
146 |
| -but didn't work because swapxy not working |
| 127 | +Looks like it works if I disable the use of /dev/fb0 on /usr/share/X11/xorg.conf.d/99-fbturbo.conf |
147 | 128 |
|
148 | 129 |
|
149 | 130 |
|
150 |
| -If I want both displays to work I have to switch to using fbturbo for the driver on the little panel too, |
151 |
| -it doesn't like sharing with fbdev. |
152 | 131 |
|
| 132 | +touch is ads7846 |
| 133 | +but no worky? |
| 134 | +[ 788.783946] SPI driver ads7846 has no spi_device_id for ti,tsc2046 |
| 135 | +[ 788.783979] SPI driver ads7846 has no spi_device_id for ti,ads7843 |
| 136 | +[ 788.783992] SPI driver ads7846 has no spi_device_id for ti,ads7845 |
| 137 | +[ 788.784003] SPI driver ads7846 has no spi_device_id for ti,ads7873 |
| 138 | +relevant? why no evdev? |
153 | 139 |
|
| 140 | +sudo dtoverlay ads7846 penirq=17 xohms=60 pmax=255 |
| 141 | +sudo dtoverlay ads7846 cs=1 penirq=17 penirq_pull=2 speed=50000 swapxy=0 pmax=255 xohms=80 xmin=20 |
| 142 | + |
| 143 | + |
| 144 | +someone else's: |
| 145 | +dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900 |
| 146 | + |
| 147 | +https://www.kernel.org/doc/Documentation/devicetree/bindings/input/ads7846.txt |
0 commit comments