Jump to content
I2Cdevlib Forums

savida

Members
  • Content Count

    4
  • Joined

  • Last visited

About savida

  • Rank
    Newbie

Recent Profile Visitors

675 profile views
  1. Well my code is perl not C, but if I knew where the base code was and had write access I could contribute untested C based on the perl. Basically I changed the string of "ifs" that check for convergence. if ( abs mean_accel_x <= accel_dead_zone ) { ready++;; } else to if ( abs mean_accel_x <= accel_dead_zone ) { ready |= 0x80; } else And the exit from the loop to if (ready == 0xfc) break ; Each subsequent check uses the next bit, so the next tests set 0x40, 0x20, 0x10, 0x08 & 0x04 which or'ed together give 0xfc. The problen with the existing code is that "ready" can get incremented more than once by the same test on a subsequent loop iteration and therefore reach 6 before all six axis have converged. BTW anyone know where the /8 and /4 before stuffing into the registers is documented?
  2. Phew! Not bricked. It seems if you set the accelerator offsets to zero then you get 32767 back. The above text converted to perl converges fine, but I had to make a modification. The problem with the above is that it will keep trying until the count is 6. All well and good but it will retry one it has already got right and increment the counter wrongly. ie four could have converged, the fith not and the sixth twice. What I did was set ready to zero then for each item if it had converged I set a different bit on in ready and quit when ready == 0xFC. Thaqnks for the code base.
  3. Well it seems they are persistant. However I seem to have bricked the thing. accel_x always gives 32767. I have tried a device reset to no avail. :-(
  4. Hi I have a couple of questions about calibration. I am using a MPU6050 on a Raspberry Pi with perl. I understand the calibration part where one gets averages over a largish number of samples. What I don't understand is what is done to those averages before stuffing into registers. I assume that the registers in question are *G_OFFS_TC, or is it *G_OFFS_USR, and *A_OFFS ? Secondly, once one has those offsets, do you poke them on each power up or are the settings persistant? TIA
×
×
  • Create New...