Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Troubleshooting

notro edited this page Dec 11, 2013 · 12 revisions

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 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.

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:

import os
import time
import subprocess
import array
import sys

PROBE_GPIO = 30

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.remove(PROBE_GPIO)

SIGNALS = [ 'reset', 'dc', 'cs', '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

Clone this wiki locally