Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1

    Add a python library (SPI-pi) to picoreplayer

    H there,

    i want to use an RFID Reader combined with picoreplayer.
    For that rfid reader, i need to use a library (MRFC522 library) and the library needs SPI-py https://github.com/lthiery/SPI-Py.
    i have installed python-dev, compile?? and RPI-Gpio?? extensions (via the webpage)

    So now i just downloaded the SPI-py library on my Windows pc and then copied the folder to home/tc/SPI-Py.

    Now i need to install it, and thats my problem:

    When i use:
    Code:
    sudo python setup.py install
    it installs fine, but i can only use it until the next reboot, because the internal backup function of picoreplayer does not backup the installation folder of SPI-py (not that one under /home/tc, but the one where it gets installed)

    If i use
    Code:
    sudo python setup.py install --user
    i can start my python script which uses it also after restarting picoreplayer (and using its backup function) but i cannot autostart my script, it only works if i start the script inside its installation folder (i mean it starts only if i do: Cd /home/tc/Myscript/ and then sudo python Myscript.py
    .

    Autostarting is done by using:

    sudo nano /opt/bootlocal.sh
    sudo python /home/tc/Myscript/Myscript.py

    Any idea how to solve this?

    Like Backup the Library differently? or installing it differently?

    Greetings

    cubii
    Last edited by cubii; 2017-03-18 at 02:07.

  2. #2
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    922
    Quote Originally Posted by cubii View Post
    H there,

    i want to use an RFID Reader combined with picoreplayer.
    For that rfid reader, i need to use a library (MRFC522 library) and the library needs SPI-py https://github.com/lthiery/SPI-Py.
    i have installed python-dev, compile?? and RPI-Gpio?? extensions (via the webpage)

    So now i just downloaded the SPI-py library on my Windows pc and then copied the folder to home/tc/SPI-Py.

    Now i need to install it, and thats my problem:

    When i use:
    Code:
    sudo python setup.py install
    it installs fine, but i can only use it until the next reboot, because the internal backup function of picoreplayer does not backup the installation folder of SPI-py (not that one under /home/tc, but the one where it gets installed)

    If i use
    Code:
    sudo python setup.py install --user
    i can start my python script which uses it also after restarting picoreplayer (and using its backup function) but i cannot autostart my script, it only works if i start the script inside its installation folder (i mean it starts only if i do: Cd /home/tc/Myscript/ and then sudo python Myscript.py
    .

    Autostarting is done by using:

    sudo nano /opt/bootlocal.sh
    sudo python /home/tc/Myscript/Myscript.py

    Any idea how to solve this?

    Like Backup the Library differently? or installing it differently?

    Greetings

    cubii
    That's starting to get involved, have you read all of the information over at www.tinycorelinux.net? There is a lot of information about persistence and creating extensions for the Core based OS.

    Files are Backed up based on /opt/.filetool.lst

  3. #3
    Quote Originally Posted by paul- View Post
    Files are Backed up based on /opt/.filetool.lst
    Thanks for the answer, i have added the folder usr/local/lib/python2.7/site-packages to /opt/.filetool.list

    so that the compiled SPI-py module gets backed up.

    Now the startup of myscript.py works.

    Is this good way to do it? or at least ok?


    Greetings

    cubii

  4. #4
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    922
    Quote Originally Posted by cubii View Post
    Thanks for the answer, i have added the folder usr/local/lib/python2.7/site-packages to /opt/.filetool.list

    so that the compiled SPI-py module gets backed up.

    Now the startup of myscript.py works.

    Is this good way to do it? or at least ok?


    Greetings

    cubii
    Backups work fine, we do it more than we should with pCP. If files never change, they are better off in extensions.

  5. #5
    Thanks,

    If i have the time, i will read into the extension thing of tinycorelinux.

  6. #6
    Hi there,

    I cant get picoreplayer 3.22 and a MFRC522 NFC Reader via spi-py work together.

    I have installed:

    Code:
    tce-load -wi  compiletc.tcz
    tce-load -wi  python-dev.tcz
    tce-load -wi  python-RPi.GPIO.tcz
    tce-load -wi  nano.tcz

    via ssh

    and then i want to install the following apps via git:

    Code:
             _ _____             ___  __
       ___  (_) ___/__  _______ / _ \/ /__ ___ _____ ____
      / _ \/ / /__/ _ \/ __/ -_) ___/ / _ `/ // / -_) __/
     / .__/_/\___/\___/_/  \__/_/  /_/\_,_/\_, /\__/_/
    /_/                                   /___/
    
    piCorePlayer = piCore + Squeezelite + Raspberry Pi
    
    The software is provided "as is" without warranty of any kind,
    either express or implied, including without limitation any implied
    warranties of condition, uninterrupted use, merchantability,
    fitness for a particular purpose, or non-infringement.
    tc@piCorePlayer:~$ cd SPI-Py/
    tc@piCorePlayer:~/SPI-Py$ sudo python setup.py install
    running install
    running build
    running build_ext
    building 'spi' extension
    creating build
    creating build/temp.linux-armv6l-2.7
    gcc -pthread -fno-strict-aliasing -O3 -pipe -march=armv6zk -mtune=arm1176jzf-s -                                                                                                                                                             mfpu=vfp -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/in                                                                                                                                                             clude/python2.7 -c spi.c -o build/temp.linux-armv6l-2.7/spi.o
    creating build/lib.linux-armv6l-2.7
    gcc -pthread -shared build/temp.linux-armv6l-2.7/spi.o -L/usr/local/lib -lpython                                                                                                                                                             2.7 -o build/lib.linux-armv6l-2.7/spi.so
    running install_lib
    copying build/lib.linux-armv6l-2.7/spi.so -> /usr/local/lib/python2.7/site-packa                                                                                                                                                             ges
    running install_egg_info
    Writing /usr/local/lib/python2.7/site-packages/SPI_Py-1.0-py2.7.egg-info
    tc@piCorePlayer:~/SPI-Py$ git clone https://github.com/mxgxw/MFRC522-python
    Cloning into 'MFRC522-python'...
    remote: Counting objects: 60, done.
    remote: Total 60 (delta 0), reused 0 (delta 0), pack-reused 60
    Unpacking objects: 100% (60/60), done.
    Checking connectivity... done.
    tc@piCorePlayer:~/SPI-Py$ cd MFRC522-python/
    tc@piCorePlayer:~/SPI-Py/MFRC522-python$ sudo python Read.py
    can't open device: No such file or directory
    Aborted
    tc@piCorePlayer:~/SPI-Py/MFRC522-python$
    tc@piCorePlayer:~/SPI-Py/MFRC522-python$
    But the MRFCReader is not found.

    This is working with picoreplayer 3.18 and the same hardware.

    Does someone know what is the problem there?

    There was a problem with the Reader and raspbian, see here:
    https://github.com/lthiery/SPI-Py/co...1af8e48ddbd8e7

    and here:
    https://github.com/raspberrypi/linux/issues/1547

    perhaps these links can give a hint?

    It seems the change from spi-bcm2708 to the bcm2835 broke something.

    config.txt is untouched.

    Thanks
    cubii
    Last edited by cubii; 2017-11-14 at 15:41.

  7. #7
    to make a long story short,

    Why do i get with picore 3.11 on a wifi zero the following answer:

    Code:
    tc@piCorePlayer:~$ ls /dev/spi*
    /dev/spidev0.0  /dev/spidev0.1
    tc@piCorePlayer:~$
    and with picore 3.22 on the same wifi zero:

    Code:
    tc@piCorePlayer:~$ ls /dev/spi*
    ls: /dev/spi*: No such file or directory
    both untouched images, with activated
    Code:
    dtparam=i2c=on,spi=on,i2s=on
    , only ssh activates and wifi added.



    cubii

  8. #8
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    922
    I don't have or use any SPI devices, so I'm not much help. SPI drivers included in pCP.

    Did you read that entire github issue?

    Did you add dtoverlay=spi0-hw-cs as the thread said?

  9. #9
    Quote Originally Posted by paul- View Post

    Did you read that entire github issue?

    Did you add dtoverlay=spi0-hw-cs as the thread said?

    Yes and Yes.

    Thanks for taking a look.

    Perhaps this is a general problem with spi devices, not only with the NFC Reader...(or i am using them wrong...)
    What is your output of ls /dev/spi* ?
    Perhaps the driver is loaded (lsmod shows a spi... device/driver) but the module is missing? (i dont know exactly what i am saying here, but this is what i understood after searching the net.)
    Last edited by cubii; 2017-11-16 at 12:48.

  10. #10
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    922
    if lsmod shows the module loaded, then that is not the issue. spi-bcm2835.ko is supplied in the base image.

    I guess what I would do is start with the latest Raspbian image and see what happens.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •