1

I've changed an i2c config file so current baudrate is 300000. I do a reboot and start an i2c baudrate checking program. sudo ./checkbr But what I get seems to be usual baudrate settings(default). Then I do a startx and load a gui. I open a terminal and make same steps. After sudo ./checkbr I'm getting desired baudrate = 300000. Why can't I get 300000 without x server loaded? I've also tried removing i2c_bcm2708 and re-adding it with baudrate = 300000 but still no results unless I do startx. If it's important, I do check a baudrate with a c++ piece of code which reads data from i2c in a loop and measures time needed to read it. In case of X server off I get 3x slower read speed than with a X started.

EDIT: Something may be wrong with my code so here it goes.

  for (;;) {
        I2CInterface.readRegister(MPU6050_ADDRESS, MPU6050_RA_ACCEL_XOUT_H, 14, data);
        oldTime = curTime;
        clock_gettime(CLOCK_REALTIME, &curTime);
        dt = ( (static_cast<int64_t>(curTime.tv_sec)*1000000000 + static_cast<int64_t>     (curTime.tv_nsec)) - (static_cast<int64_t>(oldTime.tv_sec)*1000000000 + 
        static_cast<int64_t>(oldTime.tv_nsec)) ) /1000000000.0;
        printf( "%7f \n", dt);
   }

I2CInterface.readRegister last 2 parameters are number of bytes and where to store it.

  • Odd. Does it slow down again when you stop X? The Pi model, firmware, and operating system may be relevant. – joan Feb 21 '15 at 20:10
  • I've just tried and yes, after stopping X server, reading i2c data slows down again. My setup is Raspberry Pi Model B, 3.12.35 kernel and Raspbian (Wheezy) installed. – user3081123 Feb 21 '15 at 20:18
1

My Pi i2c was working nicely. i2c baudrate as defined in /etc/modprobe.d/i2c.conf

With the newest upgrade with new kernel (using Device Tree), the problems started. Initially nothing worked. After googling I added "dtparam=i2c=on" to /boot/config.txt. The i2c-bus started working, but with default speed.

with "dtparam=i2c=on, i2c_baudrate=400000" in /boot/config.txt allowed me to increase the baudrate to 400k.

I am running my Pi as headless, so I do not know about any startx etc.

see:

http://www.raspberrypi.org/forums/viewtopic.php?t=97314

https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.