pyA10Lime 0.2 : SPI OSError

Started by oryx_r, September 16, 2014, 12:03:18 PM

Previous topic - Next topic

oryx_r

Hi,
I test spi program of olimex a10lime but it doesn't work.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from pyA10Lime import spi

spi.open("/dev/spidev2.0")
spi.read(2)
spi.close()


It put this message :
Traceback (most recent call last):
  File "./spi.py", line 7, in <module>
    spi.read(2)
OSError: [Errno 22] Invalid argument
zsh: exit 1     ./spi.py


The spi work well (I test it with /opt/spidev of olimex)

Thanks for your help

gst_retd

I have the exact same problem on A20 LIME2 with pyA20Lime2 0.2

read(2), xfer([0x01, 0x02],2) and write([0x01, 0x02]) gave me the same errno 22 return code. So this maybe a problem that is not related to the python code or library but maybe more to the SPI module (I wonder).

Is there someone that have SPI running on thoses cards? And if yes how have you done this?

Best regards.

JohnS

Trace through the read call to see why 2 is invalid.

John

gst_retd

I made a quick search. The errno 22 is a kernel/module error number that corresponds to "Invalid argument". So I really think that the 2 (or whatever value is used) is not misunderstood by python but more likely something is going wrong when python calls the system the read or write to the device (maybe there is a problem with the module behind the device virtual file system? do you have some clue?

Maybe we can find a small C example that can reproduce this issue it maybe easier, don't you think? 

JohnS

I still think you should trace it but good luck.

John

gst_retd

Maybe I should trace for sure but I'm not a "Python guy" nor a "driver guy" and I really don't know how to trace such things maybe you may give me some clue?

Best regards.

JohnS

I've no board nor SPI to connect up nor any desire to use python for it if i had.  Not a clue without any of those.

Using a dev board and wanting something like this is your big chance to figure stuff out I'd have thought.

John

HenningA

The open is wrong, it should be

spi.open(2,0)

for opening spidev2.0

Henning