-->
Page 1 of 1

How do i change iic bus speed? setClock do not work for me!

PostPosted: Sun Jan 31, 2016 12:18 pm
by charrua
Hi, my first post!

My name: Juan Ignacio Odriozola, from Uruguay, South America.
I'm a technician in electronics and a teacher. My native language is Spanish, so sorry for my bad English.

I bought some esp8266 sometime ago with the intention of using it with an arduino, never used them and recently i realized that they can be programmed, so last night i follow some tuts on how to setup the arduino ide and voila ... took me more time to get the module ready for use on a prototype board than the arduino ide to get ready.

this is my prototype (esp8266 spider project :)

Image

Ok, i loaded an passed the blink test!

Then, I attach a 9DOF module with a digital compass (HMC5883) an accelerometer (ADXL345) and a gyroscope (ITG3200)

Do a loop for scanning slaves on the bus with success.

Code: Select allWire.begin(SDApin, SCLpin);
  Serial.println("");
  Serial.println(" scanning slaves...");
  for (int i=1; i<128; i++){
    Wire.beginTransmission(i);
    if (Wire.endTransmission(true)==0){
      //ack!
      Serial.print(i);
      Serial.print(",");
    }
  }
  Serial.println("");
  Serial.println("end scanning");


Then test the libs for each chip and find that some tweaking was needed, basically changing int by int16_t Init and reading of sensor ok. I send back via Serial.Print the readings and here is the graph using SerialGraph (nice app!):

Image

I then connect a logic analyzer and saw the clock is about 100KHz (96 KHz), so i try Wire.setClock but no matter which number i pass to that method i get the same scl speed (ok i tested 100000, 400000 and 800000 only 3 numbers but final clock is the same)

Image

I saw a thread about troubles with setClock but was finished as solved in the last release of the lib.

Any help is appreciated

Juan Ignacio Odriozola

Re: How do i change iic bus speed? setClock do not work for

PostPosted: Tue Feb 09, 2016 8:54 am
by charrua
I moved to Eclipse - Expressif SDK and looking the implementation of iic bus, and some docs from Expressif, it's implemented by software and the maximun speed allowable is about 100KHz.