I tried to send/receive any data to the SPI devices trying with spidev module and the other time with the wiringpi2 module but I wasn't able to get/send any data. I also miss some good documentation on both modules explaining how to use this libraries. Does anybody know how to setup this right?
Code I used with spidev (only ADC)
Code: Select all
import time
import spidev
import struct
#ADC konfigurieren
spi.open(0,1) #Open SPI for ADC
spi.max_speed_hz = 8000000 #set max Bus-Speed
spi.bits_per_word = 8 #set number of bits
spi.mode = 0b00 #set clock polarity and phase
spi.close()
#ADC
spi.open(0,1) #Open SPI for ADC
spi.xfer2([0x84]) #sent Bytes to ADC for CH1
s = spi.readbytes(2)
print (s)
spi.close()
Code: Select all
import wiringpi2 as wiringpi
wiringpi.wiringPiSetupPhys()
wiringpi.wiringPiSPISetup(1, 2000000)
CH1 = wiringpi.wiringPiSPIDataRW(1, 0x84, 8)
print (CH1)