1 Reply Latest reply on Aug 3, 2016 12:13 PM by rbulha

    Edison I2C with TLV493D magnetic sensor from Infineon - Can't establish communication

    rbulha

      Hi,

       

      I'm using Intel Edison with the Arduino board. I'm trying to use the I2C magnetic sensor from Infineon model TLV493D.

       

      The sensor works when connected to it's dev kit, but with Edison it is not recognized.

       

      My I2C is working, I'm able to comunicate with different sensors, but this one is giving me headache.

       

      Looking on my scope, the timing look's ok. The picture shows a write command that fails (ACK=1)

      NewFile1.png

      Looking the scope when the sensor is connected on it's own dev kit, and there is a odd signal before a write or read command.

      NewFile2.png

      So i'm wondering if there is a way to drive manually the SCL line from MRAA?

       

      Now i'm using Python and MRAA with a simple code to try to write or read from the sensor.:

       

      import mraa

       

      bus = mraa.I2c(0)

      bus.address(0x5E)

       

      datam = bus.read(8)

       

      Is there anybody that uses the same sensor or know how to drive manually the SCL line? So, I can try to mimic the dev kit.

       

      Thanks,

      Rogerio

        • 1. Re: Edison I2C with TLV493D magnetic sensor from Infineon - Can't establish communication
          rbulha

          I've solved this problem, in fact I give up from the MRAA+Python over Linux and I made a MCU firmware using MCU SDK.

           

          Now the sensor is answer to the i2c, looking on the scope is the same waveform, maybe some timing constraints was changed, I don't know for sure, but anyway, I will finally move this code to the MCU.

           

          code i'm using:

           

          #include "mcu_api.h"

          #include "mcu_errno.h"

           

           

          /* the I2C address of MPU6050 */

          #define TlV493D_ADDR    0x5E

           

           

          static unsigned char tlv493d_read_3b(unsigned char *tdB)

          {

              int res;

              res = i2c_read(TlV493D_ADDR, 0, tdB, 6);

              if (res)

              {

                  debug_print(DBG_ERROR, "tlv493d_read_3b fail...");

                  return 0Xff;

              }

            debug_print(DBG_ERROR, "First byte 0x%x\n", tdB[0]);

              return 0x00;

          }

           

           

          void mcu_main()

          {

            unsigned char device_3b[6];

            unsigned char res;

            char buf[40];

            int len;

              /* your configuration code starts here */

            gpio_setup(48, 1);  /* set GPIO 48 as output */

           

           

              while (1)       /* your loop code starts here */

              {

                  //gpio_write(48, 1);

              res = tlv493d_read_3b(device_3b);

                  mcu_sleep(100);         /*100 -> sleep 1 second */

                  if(!res){

                  len = mcu_snprintf(buf, 40, "3B = %2x:%2x %2x:%2x %2x:%2x\n", device_3b[0],device_3b[1],device_3b[2],device_3b[3],device_3b[4],device_3b[5]);

                  host_send((unsigned char*)buf, len);

                  }

                  //gpio_write(48, 0);

                  //mcu_sleep(1);

              }

          }