1

I am currently trying to follow this tutorial. I keep running into errors for the RPi part. I have received several error related to SPI. I removed SPI from my blacklist and followed the instructions from a question asked on StackExchange to get to my current problem. The python code given in the tutorial imports the nrf24 library. I receive this error when I run (from tutorial):

/home/pi/nrf24pihub/nrf24.py:374: RuntimeWarning: This channel is already in use, >continuing anyway. Use GPIO.setwarnings(False) to disable warnings.

GPIO.setup(self.irq_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)

Traceback (most recent call last):

File "raspberryfriend.py", line 13, in

radio.begin(0, 0,25,18) #set gpio 25 as CE pin

File "/home/pi/nrf24pihub/nrf24.py", line 381, in begin

self.write_register(NRF24.SETUP_RETR, (int('0100', 2) << NRF24.ARD) | (int('1111', 2) << NRF24.ARC))

File "/home/pi/nrf24pihub/nrf24.py", line 239, in write_register

return self.spidev.xfer2(buf)[0]

IOError: [Errno 22] Invalid argument

Here is the nrf24.py code. All I can gather is that the 'but' argument might exceed some storage limit, but the tutorial appears to have worked for others. How should I get around or fix this error? The error occurs in Python, so should I seek a solution from one of those forums?

  • are you running this as root? i.e. with sudo? – rob Jan 30 '15 at 8:53
  • Yes, I ran the code as root. – Sean Bearden Jan 30 '15 at 20:06
3

The Python spidev module has been broken (I think) since Linux kernel 3.15.x.

Its maintenance has recently been augmented with more support so I expect a new version shortly.

See Read this if you use Python Spidev.

  • 2
    I was able to update py-spidev from instructions I obtained at the link. There error is gone and everything seems to work as expected. Thank you for your help! – Sean Bearden Jan 31 '15 at 0:08
-1

It accepts only arrays as argument Try to place your data in an array!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.