1
0
mirror of https://github.com/xtacocorex/CHIP_IO synced 2025-07-20 04:43:21 +00:00

fixing issue related to loading the SPI2 overlay, forcing use of the sample provided by NTC in their chip-dt-overlays deb package.

This commit is contained in:
Robert Wolterman
2017-01-28 02:34:04 +00:00
parent bf27e2feea
commit eafcf0bf69
3 changed files with 10 additions and 18 deletions

View File

@ -24,6 +24,7 @@ import time
DEBUG = False DEBUG = False
OVERLAYINSTALLPATH = "/lib/firmware/chip_io" OVERLAYINSTALLPATH = "/lib/firmware/chip_io"
SPIINSTALLPATH = "/lib/firmware/nextthingco/chip"
OVERLAYCONFIGPATH = "/sys/kernel/config/device-tree/overlays" OVERLAYCONFIGPATH = "/sys/kernel/config/device-tree/overlays"
CUSTOMOVERLAYFILEPATH = "" CUSTOMOVERLAYFILEPATH = ""
@ -41,7 +42,7 @@ _LOADED = {
} }
_OVERLAYS = { _OVERLAYS = {
"SPI2" : "chip-spi2.dtbo", "SPI2" : "sample-spi.dtbo",
"PWM0" : "chip-pwm0.dtbo", "PWM0" : "chip-pwm0.dtbo",
"CUST" : "" "CUST" : ""
} }
@ -160,7 +161,11 @@ def load(overlay, path=""):
# SET UP THE OVERLAY PATH FOR OUR USE # SET UP THE OVERLAY PATH FOR OUR USE
if overlay.upper() != "CUST": if overlay.upper() != "CUST":
opath = OVERLAYINSTALLPATH + "/" + _OVERLAYS[overlay.upper()] opath = OVERLAYINSTALLPATH
# IF THE OVERLAY IS SPI, USE THE NTC PATH
if overlay.upper() == "SPI2":
opath = SPIINSTALLPATH
opath += "/" + _OVERLAYS[overlay.upper()]
else: else:
opath = path opath = path
if DEBUG: if DEBUG:

View File

@ -9,7 +9,7 @@ Manual::
For Python2.7:: For Python2.7::
sudo apt-get update sudo apt-get update
sudo apt-get install git build-essential python-dev python-pip flex bison -y sudo apt-get install git build-essential python-dev python-pip flex bison chip-dt-overlays -y
git clone https://github.com/atenart/dtc git clone https://github.com/atenart/dtc
cd dtc cd dtc
make make
@ -24,7 +24,7 @@ For Python2.7::
For Python3:: For Python3::
sudo apt-get update sudo apt-get update
sudo apt-get install git build-essential python3-dev python3-pip flex bison -y sudo apt-get install git build-essential python3-dev python3-pip flex bison chip-dt-overlays -y
git clone https://github.com/atenart/dtc git clone https://github.com/atenart/dtc
cd dtc cd dtc
make make

View File

@ -5,7 +5,7 @@ import os
# ENABLE DEBUG # ENABLE DEBUG
print("ENABLING OVERLAY MANAGER DEBUG") print("ENABLING OVERLAY MANAGER DEBUG")
OM.enable_debug() OM.toggle_debug()
# **************** PWM ******************* # **************** PWM *******************
print("\nIS PWM ENABLED: {0}".format(OM.get_pwm_loaded())) print("\nIS PWM ENABLED: {0}".format(OM.get_pwm_loaded()))
@ -20,19 +20,6 @@ print("UNLOADING PWM0")
OM.unload("PWM0") OM.unload("PWM0")
print("IS PWM ENABLED: {0}".format(OM.get_pwm_loaded())) print("IS PWM ENABLED: {0}".format(OM.get_pwm_loaded()))
# **************** I2C-1 *******************
print("\nIS I2C ENABLED: {0}".format(OM.get_i2c_loaded()))
OM.load("I2C1")
print("IS I2C ENABLED: {0}".format(OM.get_i2c_loaded()))
# VERIFY I2C-1 EXISTS
if os.path.exists('/sys/class/i2c-dev/i2c-1'):
print("I2C1 DEVICE EXISTS")
else:
print("I2C1 DEVICE DID NOT LOAD PROPERLY")
print("UNLOADING I2C1")
OM.unload("I2C1")
print("IS I2C ENABLED: {0}".format(OM.get_i2c_loaded()))
# **************** SPI2 ******************* # **************** SPI2 *******************
print("\nIS SPI ENABLED: {0}".format(OM.get_spi_loaded())) print("\nIS SPI ENABLED: {0}".format(OM.get_spi_loaded()))
OM.load("SPI2") OM.load("SPI2")