I had a problem like this too and never found a solution using legacy. However, moving over to mainline worked for me. My displays have been running for months without crashes. There are caveats however - it didn't work out of the box, But, there are some good threads in this forum where a few people helped me and others get up and running. Search "pygame lcd" and you'll find the threads. It took some time and several tries I almost gave up, but I finally got it working.
Try it, and post your progress in the forum. I'll come back in a few days and see if there is anything I can contribute. You might get lucky and the smart people who helped me might chime in first.
I wish you luck! Stay with it, it'll be worth it and you'll be able to keep armbian.
It's simple guide, presenting how to setup LCD (ili9431) with integrated touchscreen (tsc2046) on mainline kernel (4.11). It may be not fully "armbian way", since I'm pretty new in armbian
In case that somebody is interested, I recently bought couple those displays from here
Few basic informations:
1. OrangePiZero has two SPI buses. First one is usually occupied by build in memory. So we can only use bus1
2. tsc2046 chip is fully compatible with ads7846, and we have drivers for it since years now
3. Maximum clock frequency for ads7846 is 3.25Mhz, but don't expect that it will work with that. Reasonable value is something beetween 0.5-2Mhz. Lower frequency, if you observing misbehavior.
4. Probably most important information ili9431 and tsc2046 poorly cooperate on shared bus. I don't know exactly why, because I don't have access to logic analyzer, but it's proven fact (at least on my equipment). You have to lower bus frequency to 2MHz (highest common value), and even then it work very unstable. My educated guess is that, missed interrupt from touchscreen (when SPI is busy with sending data to LCD) makes it stop making further attempts to communicate. Or maybe there is some incompatibility on electrical level, I really don't know.
5. My electrical setup (keep in mind it's 3.3V)
OPIZ - LCD (ili9431)
PA13 - CS
PA14 - SCK
PA16 - SDO
PA15 - SDI
PA03 - DC
PA00 - RESET
PA06 - controls transistor which is driving current to LCD pin. You may also connect LCD pin to VCC, and leave PA06 floating.
And here is part for touchscreen. We are going to use emulated spi bus with bitbang. At this point bitbang isn't compiled in armbian kernel - we will take care of this later.
Compile and add those DTS with "armbian-add-overlay" command.
Next, download armbian sources and cross compile kernel - without any modifications, just to make sure that everything is compiling without issues:
# mkdir armbian
# cd armbian
# git clone https://github.com/armbian/build.git
# git clone https://github.com/igorpecovnik/lib
# cp lib/compile.sh .
# ./compile.sh BRANCH=dev BOARD=orangepizero KERNEL_ONLY=yes PROGRESS_DISPLAY=plain RELEASE=jessie
Enable required modules :
echo "CONFIG_SPI_BITBANG=m" >> lib/config/kernel/linux-sun8i-dev.config
echo "CONFIG_SPI_GPIO=m" >> lib/config/kernel/linux-sun8i-dev.config
... and recompile kernel, then install deb packages from output directory. You may also copy drivers, it may be faster for testing but it's not advised for "serious" deployment.
Loading modules at startup:
# cat > /etc/modprobe.d/fb_ili9341.conf << _EOF_
options fbtft_device custom name=fb_ili9341 gpios=dc:3,reset:0,led:6 speed=16000000 busnum=1
_EOF_
# echo fbtft_device >> /etc/modules
# echo ads7846 >> /etc/modules
If you connected LED pin to VCC, then you should omit that ",led:6" in configuration above.
I hope that this will help anyone who want to connect LCD display and build simple touchscreen based Orange Pi Zero terminal
I'm not sure if this is relevant, but I recently had to start using mainline on my orange pi zero since pygame was constantly crashing with legacy. Of course, the onboard wifi isn't available in this release so I started to test the usb wifi gadgets I had on hand. Some failed miserably. However the COMFAST CF-WU810N 2.4GHz 802.11b/g/n works like a charm. No additional drivers necessary. Just configure wifi. I've very pleased with the functionality and performance of my current setup and wanted to mention that it's very well for me.
One noteworthy item, however. To get the wifi device to be called wlan0 rather than a long name with the address in the name I created the following link and rebooted:
armbian mods and developers -- thank you for providing mainline. I understand it's experimental and a never-ending cause for painful reiterations of similar problems, but for my personal projects it's working well. I had hit a dead-end with legacy and mainline has been solid for some time now. Also, I like the separation of mainline on the forum. I think that's a big win.
Touch is possible, but not something I did in any of my projects. There are additional pins on the display for touch that will need to be connected, and if you use x windows the display may need to be calibrated.