GithubHelp home page GithubHelp logo

xtacocorex / chip_io Goto Github PK

View Code? Open in Web Editor NEW
273.0 273.0 58.0 317 KB

A CHIP IO library for Python: IO+PWM+SPWM+ADC+Utilities

License: MIT License

Makefile 0.56% Python 26.37% C 72.89% Shell 0.06% C++ 0.12%

chip_io's People

Contributors

bluesolder avatar fabien-gigante avatar fordsfords avatar hbradio avatar meitelwein avatar mzealey avatar streamnsight avatar tryonlinux avatar werecatf avatar xtacocorex avatar zerotri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chip_io's Issues

aREST support

More of a feature request than an issue.

Any way you can add aREST support for this? I am not the greatest at programming, but I feel it should be possible as its very close to a RPi.

no luck with HW PWM0

I got SOFTPWM working fine, except it doesn't seem to be very precise if I can trust my oscilloscope: asking for 50hz I get something more like 45Hz, and can never set duty cycle down lower than ~5%

So I wanted to try HW PWM, and hooked things up on PWM0, but no response.
Using only PWM.start("PWM0", 5, 50), no error but no response.

So I thought maybe I need to activate PWM0 overlay.

I ran

>>> import CHIP_IO.OverlayManager as OM
>>> OM.load("PWM0")

and I am getting:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build/bdist.linux-armv7l/egg/CHIP_IO/OverlayManager.py", line 180, in load
  File "build/bdist.linux-armv7l/egg/CHIP_IO/OverlayManager.py", line 84, in _set_overlay_verify
  File "/usr/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.7/os.py", line 150, in makedirs
    makedirs(head, mode)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/sys/kernel/config/device-tree'

I'm running python with sudo so not sure what else I need to do.
I installed the dtb as per the instructions.

Any ideas?
Thanks for help.

Maintain Python3 Support

This is a blanket issue to ensure Python3 support remains working for all CHIP_IO features. I don't actively use Python3, so it's sometimes left to the wayside.

LRADC definitely has issues in Python3 per #42.

I have a feeling this will be closed when @jdcc does work on his fork.

Touchscreen ADC-s

Hello, as far as I know there are 4 ADC-s (X1, X2, Y1, Y2) for the touchscreen. Would it be possible for you to expose these via the CHIP-IO library?

Error setting up channel X

Hello,

Once a python script using CHIP_IO has exited, when I try to run it again, even with using GPIO.cleanup() before setting up the IO, I'm getting an error:

GPIO.setup(set, GPIO.OUT)
RuntimeError: Error setting up channel CSID2, maybe already exported? (gpio_export: could not write '134' to /sys/class/gpio/export (Device or resource busy))

Is there any workaround to be able to run my script again, without rebooting?
Thanks.

running tests fails with python2.7 and python3

  1. The instructions given for running tests are only relevant for python2.7.
  2. sudo py.test fails, and sudo python2 -m pytest fails too:
========================================================================== test session starts ==========================================================================
platform linux2 -- Python 2.7.9 -- py-1.4.25 -- pytest-2.6.3
collected 0 items / 5 errors 

================================================================================ ERRORS =================================================================================
_______________________________________________________________ ERROR collecting test/test_gpio_input.py ________________________________________________________________
test/test_gpio_input.py:5: in <module>
    import CHIP_IO.GPIO as GPIO
E   ImportError: No module named GPIO
_______________________________________________________________ ERROR collecting test/test_gpio_output.py _______________________________________________________________
test/test_gpio_output.py:3: in <module>
    import CHIP_IO.GPIO as GPIO
E   ImportError: No module named GPIO
_______________________________________________________________ ERROR collecting test/test_gpio_setup.py ________________________________________________________________
test/test_gpio_setup.py:4: in <module>
    import CHIP_IO.GPIO as GPIO
E   ImportError: No module named GPIO
________________________________________________________________ ERROR collecting test/test_pwm_setup.py ________________________________________________________________
test/test_pwm_setup.py:5: in <module>
    import CHIP_IO.PWM as PWM
E   ImportError: No module named PWM
______________________________________________________________ ERROR collecting test/test_softpwm_setup.py ______________________________________________________________
test/test_softpwm_setup.py:4: in <module>
    import CHIP_IO.SOFTPWM as PWM
E   ImportError: No module named SOFTPWM
======================================================================== 5 error in 1.23 seconds ========================================================================
  1. installing pytest with pip3/python3 and running sudo python3 -m pytest fails too... :(
========================================================================== test session starts ==========================================================================
platform linux -- Python 3.4.2, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/chip/CHIP_IO, inifile: 
collected 0 items / 6 errors 

================================================================================ ERRORS =================================================================================
__________________________________________________________________ ERROR collecting test/lradc_test.py __________________________________________________________________
test/lradc_test.py:11: in <module>
    ADC.setup(125)
CHIP_IO/LRADC.py:57: in setup
    set_sample_rate(rate)
CHIP_IO/LRADC.py:116: in set_sample_rate
    print("Setting Sample Rate to: {0}").format(rate)
E   AttributeError: 'NoneType' object has no attribute 'format'
---------------------------------------------------------------------------- Captured stdout ----------------------------------------------------------------------------
ENABLING LRADC DEBUG OUTPUT
LRADC SETUP WITH SAMPLE RATE OF 125
Setting Sample Rate to: {0}
_______________________________________________________________ ERROR collecting test/test_gpio_input.py ________________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_gpio_input.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_gpio_input.py:5: in <module>
    import CHIP_IO.GPIO as GPIO
E   ImportError: No module named 'CHIP_IO.GPIO'
_______________________________________________________________ ERROR collecting test/test_gpio_output.py _______________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_gpio_output.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_gpio_output.py:3: in <module>
    import CHIP_IO.GPIO as GPIO
E   ImportError: No module named 'CHIP_IO.GPIO'
_______________________________________________________________ ERROR collecting test/test_gpio_setup.py ________________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_gpio_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_gpio_setup.py:4: in <module>
    import CHIP_IO.GPIO as GPIO
E   ImportError: No module named 'CHIP_IO.GPIO'
________________________________________________________________ ERROR collecting test/test_pwm_setup.py ________________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_pwm_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_pwm_setup.py:5: in <module>
    import CHIP_IO.PWM as PWM
E   ImportError: No module named 'CHIP_IO.PWM'
______________________________________________________________ ERROR collecting test/test_softpwm_setup.py ______________________________________________________________
ImportError while importing test module '/home/chip/CHIP_IO/test/test_softpwm_setup.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
test/test_softpwm_setup.py:4: in <module>
    import CHIP_IO.SOFTPWM as PWM
E   ImportError: No module named 'CHIP_IO.SOFTPWM'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
======================================================================== 6 error in 1.89 seconds ========================================================================

Add Support for Loading DTB Overlays

Prepare for the future by adding a feature to enable a user to load/unload a DTB Overlay.

Example:
Load:
sudo mkdir /sys/kernel/config/device-tree/overlays/DIPexample
su -c 'cat irtempi2c.dtbo > /sys/kernel/config/device-tree/overlays/DIPexample/dtbo'

Unload:
sudo rmdir /sys/kernel/config/device-tree/overlays/DIPexample/

LRADC Support

With the proper kernel and DTB, the LRADC is enabled. Get this working. Probably implement purely in Python as register setting was causing segfaults in my test code.

PWM lines

just a question here:

I just realize there only seem to be one PWM pin, (PWM0)
Can other pins be used for HW PWM, or is that it?

'coz I was looking to control a few motors, but if there is only one pin that's not going to work! :-/

Minor issue building dtc

Perhaps it's a missing dependency upstream, but the make of dtc fails as version_gen.h is not provided in the dtc repo. A 'make version_gen.h' is required before the make of dtc itself. Thanx!

Create dumb function setmode() to mimic RPi.GPIO

Tons of people are porting Raspberry Pi code to the CHIP and have gotten hung up on the RPi.GPIO setmode function.

Make this a dummy function for the time being. It might be able to be used for #32 if GPIO is drastically different on the CHIP Pro.

new_xio: Error when Pin-Name not correct

If you set-up a pin via string name (I think there should be constants available as well, but that's just me), one gets the following error:

>>> import CHIP_IO.GPIO as GPIO
>>> GPIO.setup("GPIO0", GPIO.OUT)
ASSRT failed at source/event_gpio.c:248 (s == strlen(direction))

While "XIO-P0" works fine, "GPIO0" throws this c-error.

internal pull up/down resistor

Does chip have internal pull up or down resistors that I can enable? I would prefer this over using a bread board. I have tried using
GPIO.setup("CSID3", GPIO.IN, pull_up_down=GPIO.PUD_UP)
I have also tried "XIO-P0".
I don't get any errors but the pin appears to be floating.

new_xio: Channel in use when running as non-root

If you're not root (or probably not in the group that is allowed), and try to set up a pin, the following happens:

>>> import CHIP_IO.GPIO as GPIO
>>> GPIO.setup("GPIO0", GPIO.OUT)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Channel in use (already exported)

Even though I am just not allowed to and the channel is actually not exported.

SPI fails to load - sun4i-spi 1c17000.spi: prop pinctrl-0 index 0 invalid phandle

I am using CHIP version 4.4.13-ntc-mlc #1 SMP Tue Dec 6 21:38:00 UTC 2016 armv7l GNU/Linux
when running

import CHIP_IO.OverlayManager as OM
OM.load("SPI2")

in the console I am getting
sun4i-spi 1c17000.spi: prop pinctrl-0 index 0 invalid phandle
sun4i-spi 1c17000.spi: chipselect 0 already in use
spi_master spi32766: spi_device register error /soc@01c00000/spi@01c17000/spi2@0
of_spi_notify: failed to create for '/soc@01c00000/spi@01c17000/spi2@0'
__of_changeset_entry_notify: notifier error @/soc@01c00000/spi@01c17000/spi2@0

Any ideas how to resolve it?

Install failed

I'm relatively new to python, and I got chip working, but after reboot its not working anymore:

chip@chip ~/dev> sudo python3 test.py 
[sudo] password for chip: 
Error processing line 1 of /usr/local/lib/python3.4/dist-packages/easy-install.pth:

  Traceback (most recent call last):
    File "/usr/lib/python3.4/site.py", line 177, in addpackage
      if not dircase in known_paths and os.path.exists(dir):
    File "/usr/lib/python3.4/genericpath.py", line 19, in exists
      os.stat(path)
  TypeError: embedded NUL character

Remainder of file ignored
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import CHIP_IO.GPIO as GPIO
ImportError: No module named 'CHIP_IO'

I'm wondering why chip_io isn't available by a package manager?

tests failing

Running sudo py.test on a fresh install results in 9 failures:

============================= test session starts ==============================
platform linux2 -- Python 2.7.9 -- py-1.4.25 -- pytest-2.6.3
collected 63 items

test/test_gpio_input.py ..
test/test_gpio_output.py ......
test/test_gpio_setup.py ..........
test/test_pwm_setup.py FFFF...........F.........
test/test_softpwm_setup.py ...............softpwm_start failedFsoftpwm_start failedFsoftpwm_start failedFsoftpwm_start failedF.

=================================== FAILURES ===================================
_________________________ TestPwmSetup.test_start_pwm __________________________

self = <test_pwm_setup.TestPwmSetup instance at 0xb668fb70>

    def test_start_pwm(self):
        PWM.start("PWM0", 0)

        pwm_test = '/sys/class/pwm/pwmchip0/pwm0'

>       assert os.path.exists(pwm_test)
E       assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E        +  where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E        +    where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path

test/test_pwm_setup.py:15: AssertionError
________________ TestPwmSetup.test_start_pwm_with_polarity_one _________________

self = <test_pwm_setup.TestPwmSetup instance at 0xb67804b8>

    def test_start_pwm_with_polarity_one(self):
        PWM.start("PWM0", 0, 2000, 1)

        pwm_test = '/sys/class/pwm/pwmchip0/pwm0'

>       assert os.path.exists(pwm_test)
E       assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E        +  where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E        +    where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path

test/test_pwm_setup.py:27: AssertionError
______________ TestPwmSetup.test_start_pwm_with_polarity_default _______________

self = <test_pwm_setup.TestPwmSetup instance at 0xb6780be8>

    def test_start_pwm_with_polarity_default(self):
        PWM.start("PWM0", 0, 2000, 0)

        pwm_test = '/sys/class/pwm/pwmchip0/pwm0'

>       assert os.path.exists(pwm_test)
E       assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E        +  where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E        +    where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path

test/test_pwm_setup.py:41: AssertionError
________________ TestPwmSetup.test_start_pwm_with_polarity_zero ________________

self = <test_pwm_setup.TestPwmSetup instance at 0xb66bd698>

    def test_start_pwm_with_polarity_zero(self):
        PWM.start("PWM0", 0, 2000, 0)

        pwm_test = '/sys/class/pwm/pwmchip0/pwm0'

>       assert os.path.exists(pwm_test)
E       assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E        +  where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E        +    where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path

test/test_pwm_setup.py:55: AssertionError
_____________________ TestPwmSetup.test_pwm_duty_modified ______________________

self = <test_pwm_setup.TestPwmSetup instance at 0xb66bdaf8>

    def test_pwm_duty_modified(self):
        PWM.start("PWM0", 0)

        pwm_test = '/sys/class/pwm/pwmchip0/pwm0'

>       assert os.path.exists(pwm_test)
E       assert <function exists at 0xb6d80d30>('/sys/class/pwm/pwmchip0/pwm0')
E        +  where <function exists at 0xb6d80d30> = <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'>.exists
E        +    where <module 'posixpath' from '/usr/lib/python2.7/posixpath.pyc'> = os.path

test/test_pwm_setup.py:115: AssertionError
_________ TestSoftpwmSetup.test_pwm_duty_cycle_invalid_value_negative __________

self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66a4238>

    def test_pwm_duty_cycle_invalid_value_negative(self):
>       PWM.start("XIO-P7", 0)
E       RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)))

test/test_softpwm_setup.py:85: RuntimeError
__________ TestSoftpwmSetup.test_pwm_duty_cycle_invalid_value_string ___________

self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66a48a0>

    def test_pwm_duty_cycle_invalid_value_string(self):
>       PWM.start("XIO-P7", 0)
E       RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)))

test/test_softpwm_setup.py:91: RuntimeError
__________ TestSoftpwmSetup.test_pwm_frequency_invalid_value_negative __________

self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66b6080>

    def test_pwm_frequency_invalid_value_negative(self):
>       PWM.start("XIO-P7", 0)
E       RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (g)

test/test_softpwm_setup.py:97: RuntimeError
___________ TestSoftpwmSetup.test_pwm_frequency_invalid_value_string ___________

self = <test_softpwm_setup.TestSoftpwmSetup instance at 0xb66551e8>

    def test_pwm_frequency_invalid_value_string(self):
>       PWM.start("XIO-P7", 0)
E       RuntimeError: Error starting softpwm on pin U14_20 (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy))
E       gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (gpio_export: could not write '1023' to /sys/class/gpio/export (Device or resource busy)
E       Error setting up softpwm on pin 1023, maybe already exported? (g)

test/test_softpwm_setup.py:103: RuntimeError
===================== 9 failed, 54 passed in 2.12 seconds ======================

Handle CHIP Pro

The NTC CHIP Pro is a smaller CHIP with the GR8 SOC that is designed for embedded applications.

The IO of the CHIP Pro is slightly different from the CHIP.

Need to come up with an elegant way to handle IO on the CHIP Pro while maintaining compatibility with the CHIP/PocketCHIP.

Edge Detection Oddities

Edge Detection on the XIO is goofy as it double hits for both falling and rising regardless of user setting.

GPIO.cleanup() is broken

I introduced a weird corner case when using GPIO.cleanup() in implementing #43. In the scenario when you just import CHIP_IO.GPIO and immediately do a cleanup on all pins, thing's break.

Test Code:

import CHIP_IO.GPIO as GPIO
GPIO.cleanup()

If you actually export a pin from inside CHIP_IO and then do a GPIO.cleanup(), it's happy.

@fordsfords I think the issue is with the C code and the Python API. I know you know nothing about the Python API part, but could you look at: 8ecec67
(py_cleanup in py_gpio.c) and see if I'm doing that strcmp right?

My initial debugging had me put an if statement around the close(epfd) in event_cleanup() inside event_gpio.c. That didn't help the situation.

Make Issue Python 3

New to GitHub, so I apologize if this is the wrong place for this, but I was having issues compiling when getting to the below step:

sudo python3 setup.py instal

The issue was something about rpigpiomodule not being defined (forgot to copy it) in py_gpio.c. So I looked at the adafruit-beagalbone repository and saw how they defined it there (https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/py_gpio.c) and added it to my local copy of py_gpio.c at line 862 (Code I added is below). It now compiles without issues. When I figure out how to commit changes back to the repository I will. Everything works perfect now. Thanks for your hard work porting this!!

#if PY_MAJOR_VERSION > 2
static struct PyModuleDef rpigpiomodule = {
   PyModuleDef_HEAD_INIT,
   "GPIO",       // name of module
   moduledocstring,  // module documentation, may be NULL
   -1,               // size of per-interpreter state of the module, or -1 if the module keeps state in global variables.
   gpio_methods
};
#endif

pwm problem

i use 4.4 or 4.3 firmware:
I follow your sample will found error:

import CHIP_IO.SOFTPWM as SPWM
SPWM.start("XIO-P7", 50)
SPWM.set_duty_cycle("XIO-P7", 25.5)
Traceback (most recent call last):
File "", line 1, in
RuntimeError: You must start() the PWM channel first

SOFTPWM does not do anything

I have CHIP v1.0 and firmware official build headless 4.4 (Python 2.7.9).

Simply toggling gpio works using this library, but soft pwm does nothing. I have measured both with multimeter and ostilloscope and detected no change in output. I did not get any error messages either.

import time
import CHIP_IO.SOFTPWM as PWM
PWM.start("XIO-P7", 50)
time.sleep(5)
PWM.stop("XIO-P7")
PWM.cleanup()

Overlay Manager fails

I'm unable to get the overlay manager to work.

When i type the following in the REPL:

>>> import CHIP_IO.OverlayManager as OM
>>> OM.enable_debug()
>>> OM.load("PWM0")

I get the following error:

LOAD OVERLAY: PWM0 @ 
VALID OVERLAY
CONFIG PATH:  /sys/kernel/config/device-tree/overlays/chip-pwm
OVERLAY PATH: /lib/firmware/chip_io/chip-pwm0.dtbo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/dist-packages/CHIP_IO-0.2.2-py3.4-linux-armv7l.egg/CHIP_IO/OverlayManager.py", line 180, in load
    errc = _set_overlay_verify(overlay.upper(), opath, cpath)
  File "/usr/local/lib/python3.4/dist-packages/CHIP_IO-0.2.2-py3.4-linux-armv7l.egg/CHIP_IO/OverlayManager.py", line 84, in _set_overlay_verify
    os.makedirs(config_path)
  File "/usr/lib/python3.4/os.py", line 227, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.4/os.py", line 227, in makedirs
    makedirs(head, mode, exist_ok)
  File "/usr/lib/python3.4/os.py", line 237, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/sys/kernel/config/device-tree'

Any feedback would be appreciated. Thanks.

Add ability to clean up a single pin

In the underlying C code, there is the ability to cleanup a single pin. Expose this feature to the Python layer. This way, you don't need to blast all the pins away if you just want to clean up a single pin.

py.test fail on softpwm: segmentation fault

trying this stuff out...I tried the py.test, with these results:

test/test_gpio_input.py FF
test/test_gpio_output.py FFFF..
test/test_gpio_setup.py FFFFFFF..F
test/test_pwm_setup.py FFFF...........F.........
test/test_softpwm_setup.py F...Segmentation fault

HW PWM Issues

I just confirmed issues with the HW PWM code.

@fordsfords, looks like your imporovements might have broken it. :(

Will commit my test code for the HW PWM. Need to be running 4.4 with a custom kernel enable CONFIG_OF_CONFIGFS.

Add pin aliases

As discussed in #6 , "GPIO0" is not an allowed pin name.

The allowable names are what are defined by NTC on their documentation or the header and pin number.

The PocketCHIP does have a breakout of some pins at the top and there are indeed pins labeled "GPIO1" to "GPIO6". So it would be cool if these alternate names would be allowed.

Remove i2c-1 DTB Overlay?

With the 4.4.13-ntc-mlc OS drop from NTC, i2c-1 is back in the main dtb in /boot.

Do we want to remove this capability from OverlayManager?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.