aboutsummaryrefslogtreecommitdiff
path: root/eeprom_pi.py
diff options
context:
space:
mode:
authorBenedict <benedict@0xb8000.de>2018-04-12 17:12:49 +0200
committerBenedict <benedict@0xb8000.de>2018-04-12 17:12:49 +0200
commitdf8543dc4d560ec3db278aca544a3750d0f9996e (patch)
tree6f6857b5cf0d592ee849b0fe72d51ac6f51da3e0 /eeprom_pi.py
parentb7b1ece7831f6f822b0a1a44924d9d9897065341 (diff)
pi: eeprom: fix read issue
When reading form EEPROM wait some time lowering the READ pin to give the EEPROM time to set its output stable.
Diffstat (limited to 'eeprom_pi.py')
-rw-r--r--eeprom_pi.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/eeprom_pi.py b/eeprom_pi.py
index 2b46892..e51f4b8 100644
--- a/eeprom_pi.py
+++ b/eeprom_pi.py
@@ -46,6 +46,8 @@ def init_board(write = True):
def read_data():
+ GPIO.output(3, False)
+ time.sleep(0.3)
data = (GPIO.input(11))
print(GPIO.input(11))
data |= (GPIO.input(12) << 0x1)
@@ -63,6 +65,8 @@ def read_data():
data |= (GPIO.input(7) << 0x7)
print(GPIO.input(7))
print("read data: %s" % data)
+ time.sleep(0.3)
+ GPIO.output(3, True)
return data
# data should be one byte
@@ -123,7 +127,5 @@ def read_data_at(address):
# wait a little bit so the address is stable
time.sleep(0.3)
# trigger output enable
- GPIO.output(3, False)
data = read_data()
- GPIO.output(3, True)
print("read data %s" % data)