2 Replies Latest reply on Sep 9, 2016 12:45 PM by Intel Corporation

    MCU i2c problems

    piotrek

      I'm trying to port my i2c sensor reading code from mraa to mcu and I'm having some difficulties. I'm using Arduino breakout board. I followed the instructions here Using the MCU SDK and API: Code examples | Intel® Software. After Edison boots I run init_i2c8.sh to enable i2c8. The script gives me these errors, which are not mentioned in the example:

       

      /home/root/mcu_stuff/init_i2c8.sh: line 3: echo: write error: Device or resource busy

      /home/root/mcu_stuff/init_i2c8.sh: line 4: echo: write error: Device or resource busy

      /home/root/mcu_stuff/init_i2c8.sh: line 9: echo: write error: Device or resource busy

      /home/root/mcu_stuff/init_i2c8.sh: line 10: echo: write error: Device or resource busy

       

      After that I start reading of the i2c data on mcu, however it hangs on the first attempt to read something:

       

      debug_print(DBG_INFO, "LSM303_init() checking who_am_i\n");

      unsigned char id;

      int res = i2c_read(LSM303_acc_address, LSM303_WHO_AM_I, &id, 1); //hangs here

      debug_print(DBG_INFO, "LSM303_init() who_am_i: %d\n", id);

       

      I would like to add that nearly identical code using mraa works flawlessly:

       

      i2c->address(acc_address);

      unsigned char id = i2c->readReg(WHO_AM_I); //I get correct device id

      cout << "LSM303_init() who_am_i: " << (int) id << endl;

       

      I couldn't find much information about i2c8 in edison hardware guides besides that I need to have it muxed in order to use i2c on mcu.

       

      According to the Edison Board configuration tool I'm running the latest firmware.

        • 1. Re: MCU i2c problems
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Piotrek,

          Thanks for using Intel Edison, we’ll try to help you with this.

          We would like to know if you loaded the SDK scripts as it is mentioned in the section Loading the MCU SDK scripts onto your board, in this link  https://software.intel.com/en-us/node/545143,

          Additionally, as you mentioned, we must program pin muxing before using I2C from MCU, we configured the I2C-8 running the script init_i2c8.sh (https://software.intel.com/en-us/node/557356). This message /home/root/mcu_stuff/init_i2c8.sh: line 3: echo: write error: Device or resource busy indicates that the pin has been exported before, so it was already in the export file and didn’t indicate any error.
           
          Also, we would like to know a little bit more information, which sensor are you using and its configuration? This is in order to help you.

          Regards,
          -Yermi
           

          • 2. Re: MCU i2c problems
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi Piotrek,

            I would like to know if you have any updates or questions. Just let us know and we’ll help.

            Regards,
            -Yermi