1

Hi guys I am new to coding and I am trying to monitor the voltage and resistance value of a potantiometer by using spi communication on raspberryPi3. I found that code but when I try to run it, the program gives me:

Problem transmitting spi data..ioc" invalid argument

I read the code carefully again but I couldn't find anything wrong. Maybe I am missing something. If you help me it would be so good. Thanks:) By the way the code is here:

http://www.hertaville.com/interfacing-an-spi-adc-mcp3008-chip-to-the-raspberry-pi-using-c.html

danday74
  • 52,471
  • 49
  • 232
  • 283

1 Answers1

2

You should try to fully initialize your SPI structure.

.........
spi[i].speed_hz      = this->speed ;
spi[i].bits_per_word = this->bitsPerWord ;
spi[i].cs_change = 0;

//Ypu should add this lines
spi[i].pad = 0;
spi[i].tx_nbits = 0;
spi[i].rx_nbits = 0;

It should help :)

sashok1337
  • 1,019
  • 1
  • 7
  • 14