4 Replies Latest reply on Jun 15, 2017 8:27 AM by floydg

    Intel Joule;Ubuntu 16.04;mraa;SPI not working

    AkshayBhagat91

      Platform

      Board:Intel Joule 570X Expansion Board

      OS:

      uname -a

      Linux scout-570x-DVT3 4.4.0-1000-joule #0+joule12-Ubuntu SMP PREEMPT Fri Jan 6 04:28:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

      lsb_release -a

      No LSB modules are available.

      Distributor ID: Ubuntu

      Description: Ubuntu 16.04.1 LTS

      Release: 16.04

      Codename: xenial

      MRAA

      mraa-gpio version Version v1.7.0-11-g47c21e0 on INTEL JOULE EXPANSION

      Program:

      Source

      #include "mraa.h"

      #include

      #include

      #include

      int main(int argc, char** argv)

      { mraa_init();

      //! [Interesting]

      mraa_spi_context spi;

      spi = mraa_spi_init(0);

      printf("Hello, SPI initialised\n");

      std::cout<<"spi init"< uint8_t data[] = { 0x00, 0x32 };

      uint8_t* recv;

      std::cout<<"assigning data"< int i=90;

      data[1] = i;

      std::cout<<"spi write coming up"< recv = mraa_spi_write_buf(spi, data, 2);

      if (recv==NULL)

      std::cout<<"error in writing"< printf("Writing -%i\n", i);

      //printf("RECIVED-%i-%i\n", recv[0], recv[1]);

      usleep(100000);

      //! [Interesting]

      }

      Output

      Hello, SPI initialised

      spi init

      assigning data

      spi write coming up

      error in writing

      Writing -90

      Debug

      journalctl -t libmraa

      -- Logs begin at Thu 2017-04-13 12:04:32 EDT, end at Thu 2017-06-01 18:28:10 EDT. -- Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: libmraa version v1.7.0-11-g47c21e0 initialised by user 'scout' with EUID 1001

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: Adding i2c bus found on i2c-4 on adapter i2c_designware.0

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: Adding i2c bus found on i2c-9 on adapter i2c_designware.5

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: Adding i2c bus found on i2c-10 on adapter i2c_designware.6

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: Adding i2c bus found on i2c-5 on adapter i2c_designware.1

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: Adding i2c bus found on i2c-6 on adapter i2c_designware.2

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: libmraa initialised for platform 'INTEL JOULE EXPANSION' of type 13

      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: spi: Failed opening SPI Device. bus:/dev/spidev32765.0. Error 2 No such file or directory
      Jun 01 18:18:37 scout-570x-DVT3 libmraa[2837]: spi: write_buf: context is invalid
      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: libmraa version v1.7.0-11-g47c21e0 initialised by user 'scout' with EUID 1001

      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: Adding i2c bus found on i2c-4 on adapter i2c_designware.0

      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: Adding i2c bus found on i2c-9 on adapter i2c_designware.5

      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: Adding i2c bus found on i2c-10 on adapter i2c_designware.6

      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: Adding i2c bus found on i2c-5 on adapter i2c_designware.1

      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: Adding i2c bus found on i2c-6 on adapter i2c_designware.2

      Jun 01 18:24:50 scout-570x-DVT3 libmraa[3049]: libmraa initialised for platform 'INTEL JOULE EXPANSION' of type 13

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: libmraa version v1.7.0-11-g47c21e0 initialised by user 'scout' with EUID 1001

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: Adding i2c bus found on i2c-4 on adapter i2c_designware.0

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: Adding i2c bus found on i2c-9 on adapter i2c_designware.5

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: Adding i2c bus found on i2c-10 on adapter i2c_designware.6

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: Adding i2c bus found on i2c-5 on adapter i2c_designware.1

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: Adding i2c bus found on i2c-6 on adapter i2c_designware.2

      Jun 01 18:28:04 scout-570x-DVT3 libmraa[3115]: libmraa initialised for platform 'INTEL JOULE EXPANSION' of type 13

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: libmraa version v1.7.0-11-g47c21e0 initialised by user 'scout' with EUID 1001

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: Adding i2c bus found on i2c-4 on adapter i2c_designware.0

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: Adding i2c bus found on i2c-9 on adapter i2c_designware.5

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: Adding i2c bus found on i2c-10 on adapter i2c_designware.6

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: Adding i2c bus found on i2c-5 on adapter i2c_designware.1

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: Adding i2c bus found on i2c-6 on adapter i2c_designware.2

      Jun 01 18:28:10 scout-570x-DVT3 libmraa[3116]: libmraa initialised for platform 'INTEL JOULE EXPANSION' of type 13

      Comments

      Do I need to enable spidev for libmraa to work. If so how do I enable it?