Page 2 of 2

Re: STM32F4 I2C Not Recognizing Ack

Posted: Mon Aug 08, 2016 7:19 pm
by RedEyer
Hi,

I found the root of evil :)
Something wrong with my logic analyzer. There are 3.3V 0.8 mA on the all channel of my logic analyzer.

I wrote this code:

Code: Select all

  while (1){
    ret = i2cMasterTransmitTimeout(&I2CD1, MPU6050_ADDRESS_AD0_LOW, g_addr, sizeof(g_addr), g_data, sizeof(g_data), TIME_INFINITE);
   
    if(ret != MSG_OK){
      palSetPad(GPIOD, GPIOD_LED5);
      chThdSleepMilliseconds(delay);

      palClearPad(GPIOD, GPIOD_LED5);
      chThdSleepMilliseconds(delay);
    }
    else if(ret == MSG_OK){
      palSetPad(GPIOD, GPIOD_LED6);
      chThdSleepMilliseconds(delay);

      palClearPad(GPIOD, GPIOD_LED6);
      chThdSleepMilliseconds(delay);
    }
    chThdSleepMilliseconds(delay);
  }


So, when i2cMasterTransmitTimeout() returns error, the red LED is blinking, if success the blue LED is blinking.
When I disconnected my logic analyzer - the blue LED starts blinking, when connect - the red LED starts blinking.

Result - the logic analyzer influences on I2C bus.

Giovanni, thanks for your answers!

Re: STM32F4 I2C Not Recognizing Ack

Posted: Mon Aug 08, 2016 8:42 pm
by Giovanni
Hi,

I am glad it is solved, however it is not like I helped much, I don't have any HW where I am now (small vacation),

Anyway I2C is tricky, there is an history of problems caused by unexpected sources.

Giovanni