Enable SPI A20

Started by Arn, February 07, 2020, 01:33:28 PM

Previous topic - Next topic

Arn

Hi,

I want to connect and NFC reader by SPI on UEXT, and I can't figure how make it works.

Sorry but I'm very noob in this.

I have an A-20SOM204 with

# uname -a
Linux Interface 5.2.5-sunxi #5.92.1 SMP Fri Aug 2 17:04:12 EEST 2019 armv7l armv7l armv7l GNU/Linux

I have spi0, but i don't see how activate spi1 & spi2
# ls /sys/bus/spi/devices/
spi0.0

JohnS

At the very least SPI1 looks from the schematic (take a look) to be same pins as Gigabit net...

John

Arn

#2
Sorry but I don't understand.

Are you saying that even if nothing goes below /dev and /sys/bus/spi/devices/ spi1 and spi2 are already enabled? How can I do so that I can see them and gain control over them?

Thanks

The reason why I say this is because I have seen pyA20 to be able to send and receive but it is always based on the /dev/spidev1.0 or be /dev/spidev2.0 tree, but I do not see them.

# ls /dev/s*
/dev/stderr  /dev/stdin  /dev/stdout

/dev/shm:

/dev/snd:
by-path  controlC0  pcmC0D0c  pcmC0D0p  timer

Also, I have some problems installing pyA20.

# python3 -m pip install pyA20
Collecting pyA20
  Using cached https://files.pythonhosted.org/packages/dd/c2/ec7b33d0aacd1037635a50c5b6d238453415de2fd417de13d5d1545cb6d8/pyA20-0.2.12.tar.gz
Building wheels for collected packages: pyA20
  Running setup.py bdist_wheel for pyA20 ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-gssqj4j5/pyA20/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp5iawerrcpip-wheel- --python-tag cp36:
  usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: -c --help [cmd1 cmd2 ...]
     or: -c --help-commands
     or: -c cmd --help

  error: invalid command 'bdist_wheel'

  ----------------------------------------
  Failed building wheel for pyA20
  Running setup.py clean for pyA20
Failed to build pyA20
Installing collected packages: pyA20
  Running setup.py install for pyA20 ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-gssqj4j5/pyA20/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3owtn64p-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.6
    creating build/lib.linux-armv7l-3.6/pyA20
    copying pyA20/__init__.py -> build/lib.linux-armv7l-3.6/pyA20
    creating build/lib.linux-armv7l-3.6/pyA20/gpio
    copying pyA20/gpio/__init__.py -> build/lib.linux-armv7l-3.6/pyA20/gpio
    creating build/lib.linux-armv7l-3.6/pyA20/i2c
    copying pyA20/i2c/__init__.py -> build/lib.linux-armv7l-3.6/pyA20/i2c
    creating build/lib.linux-armv7l-3.6/pyA20/spi
    copying pyA20/spi/__init__.py -> build/lib.linux-armv7l-3.6/pyA20/spi
    running build_ext
    building 'pyA20.gpio.gpio' extension
    creating build/temp.linux-armv7l-3.6
    creating build/temp.linux-armv7l-3.6/pyA20
    creating build/temp.linux-armv7l-3.6/pyA20/gpio
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c pyA20/gpio/gpio_lib.c -o build/temp.linux-armv7l-3.6/pyA20/gpio/gpio_lib.o
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c pyA20/gpio/gpio.c -o build/temp.linux-armv7l-3.6/pyA20/gpio/gpio.o
    pyA20/gpio/gpio.c:25:10: fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-gssqj4j5/pyA20/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3owtn64p-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-gssqj4j5/pyA20/


:/home/usr/Desktop/pyA20-0.2.12# python3 setup.py install 
running install
running build
running build_py
running build_ext
building 'pyA20.gpio.gpio' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c pyA20/gpio/gpio_lib.c -o build/temp.linux-armv7l-3.6/pyA20/gpio/gpio_lib.o
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c pyA20/gpio/gpio.c -o build/temp.linux-armv7l-3.6/pyA20/gpio/gpio.o
pyA20/gpio/gpio.c:25:10: fatal error: Python.h: No such file or directory
 #include "Python.h"
          ^~~~~~~~~~
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Arn

ok,

I have run:
sudo apt-get update
sudo apt-get install python3-dev
python3 setup.py clean
python3 setup.py install

And now the installation go well, but i think that something is wrong.

# python3
Python 3.6.9 (default, Nov  7 2019, 10:44:02)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyA20.gpio import port
>>> dir(port)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>> from pyA20.gpio import connector
>>> dir(connector)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>> led = port.PH2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pyA20.gpio.port' has no attribute 'PH2'
>>> exit()