How to slow down the IC2 on DUE?

I am using a IMU the GY521 on my DUE , Wire1 port.
When I boot, the IMU shows up about 70% of the time, the rest I get
("\tCould not connect to GY521");

Did some research and I installed 2 pull-up resistor (5k each) on SDA1 and SCL1.
The go to the 3.3v. It did not solve the problem.
I would like to slow the communication from 400Khz to 200.
My wires are about 5 inch long. There must be a command for that, but I could not find it.
Thanks a lot.

#include "GY521.h"


GY521 sensor(0x68, &Wire1);

uint32_t counter = 0;


void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println(__FILE__);
  Serial.print("GY521_LIB_VERSION: ");
  Serial.println(GY521_LIB_VERSION);

  Wire.begin();

  delay(100);
  while (sensor.wakeup() == false)
  {
    Serial.print(millis());
    Serial.println("\tCould not connect to GY521");
    delay(1000);
  }
}

Wire.setClock(200000L); perhaps?

I wrote it.
Wire1.begin();
Wire1.setClock(200000L); First boot was bad, the next 3 were OK,
Lets see how reliable the boot is...
Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.