Troubleshooting - notro/fbtft GitHub Wiki

A white display is uninitialized. When the device and driver is loaded, the display should turn black (no pixels set).
If 'led' is used, the backlight should turn off momentarily during initialization.

One problem can be changing module parameters without unloading the module first. If modprobe sees that the module is already loaded, it returns without doing anything. The option --first-time, instructs modprobe to tell if the module is already loaded.

Power supply

Make sure you have an adequate power supply.
A normal USB port on a computer will fail to deliver enough current (500mA).
I also depends on what else is connected to the Pi, and if networking is in use etc.
http://elinux.org/R-Pi_Troubleshooting#Troubleshooting_power_problems
http://elinux.org/RPi_Low-level_peripherals#Power_pins
http://nordicgroup.us/rpi/power/

Cable length

The length of the cables determines how fast you can drive the display (among other things like the type of LCD controller, level shifter etc.).
Diisplays that use 9-bit SPI is escpecially suspectible to noise, since the first bit decides between Command/Data. If this bit is flipped during display update, the display setup can be messed up, and the display can turn white.

Wiring

A common problem is faulty wiring, either miswired or bad connections.

Here is a python script I used to find a miswiring on a parallel bus display I have (not SPI). Attached a probe wire to PROBE_GPIO. When asked by the script, move the probe to the specified signal on the LCD header and press enter. The script will then go through all the GPIOs to find which one is connected to this LCD header pin.

import os
import time
import subprocess
import array
import sys

PROBE_GPIO = 30

#Rev. 1 AVAILABLE_GPIOS = [0,1,4,7,8,9,10,11,14,15,17,18,21,22,23,24,25]
#Rev. 2 AVAILABLE_GPIOS = [2,3,4,7,8,9,10,11,14,15,17,18,22,23,24,25,27,28,29,30,31]
AVAILABLE_GPIOS = [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
AVAILABLE_GPIOS.remove(PROBE_GPIO)

SIGNALS = [ 'reset', 'dc', 'wr', 'db00', 'db01', 'db02', 'db03', 'db04', 'db05', 'db06', 'db07', 'db08', 'db09', 'db10', 'db11', 'db12', 'db13', 'db14', 'db15' ]

def main(argv):
	result = {}

	writef("/sys/class/gpio/export", "%s" % PROBE_GPIO)
	writef("/sys/class/gpio/gpio%s/direction" % PROBE_GPIO, 'in')

	# export and set all as outputs
	for gpio in AVAILABLE_GPIOS:
		try:
			writef("/sys/class/gpio/export", "%s" % gpio)
			writef("/sys/class/gpio/gpio%s/direction" % gpio, 'out')
		except IOError:
			print("pass")
			pass

	with GPIO(PROBE_GPIO, 'in') as probe:
		for signal in SIGNALS:
			raw_input("Move probe to %s: " % signal)
			result[signal] = -1
			for gpio in AVAILABLE_GPIOS:
				with GPIO(gpio) as pin:
					pin.clear()
					if probe.get() == 0:
						pin.set()
						if probe.get() == 1:
							result[signal] = gpio
							print("Found: %d" % gpio)


	for signal in SIGNALS:
		sys.stdout.write("%s:%d," % (signal, result[signal]))
	print("")

	writef("/sys/class/gpio/unexport", "%s" % PROBE_GPIO)

	# set all as inputs and unexport
	for gpio in AVAILABLE_GPIOS:
		try:
			writef("/sys/class/gpio/gpio%s/direction" % gpio, 'in')
			writef("/sys/class/gpio/unexport", "%s" % gpio)
		except IOError:
			print("pass")
			pass



def writef(file, val):
#	print "%s <- %s" % (file, val)
	with open(file, 'w') as f: f.write(val)

def readf(file):
#	print "%s <- %s" % (file, val)
	with open(file, 'r') as f: ret = f.read()
	return ret

class GPIO:
	def __init__(self, num, dir='out'):
		self.num = num
		self.val = 0
#		writef("/sys/class/gpio/export", "%s" % num)
#		writef("/sys/class/gpio/gpio%s/direction" % num, dir)

	def close(self):
		pass
#		writef("/sys/class/gpio/gpio%s/direction" % self.num, "in")
#		writef("/sys/class/gpio/unexport", "%s" % self.num)

	def __enter__(self):
		return self

	def __exit__(self, type, value, trace):
		self.close()

	def get(self):
		return int(readf("/sys/class/gpio/gpio%s/value" % self.num))

	def set(self, val=1):
		if val == 0:
			self.val = 0
		else:
			self.val = 1
		writef("/sys/class/gpio/gpio%s/value" % self.num, "%s" % self.val)
		return self.val

	def clear(self):
		self.set(0)

	def pulse(self):
		if (self.val):
			self.set(0)
			time.sleep(1)
			self.set(1)
		else:
			self.set(1)
			time.sleep(1)
			self.set(0)








if __name__ == '__main__':
	try:
		main(sys.argv[1:])
	except KeyboardInterrupt:
		print("")

piwik