This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with imu compass. (SOLVED)
#21
(2024-07-10, 06:54 PM)Mentula Wrote: Alright I'm pretty sure I have the problem nailed down.
Turns out the cable i used was too long.

If I understood correctly the rpi3 uses a baudrate of 100kHz while the rpi5 uses 400kHz on the i2c bus by default which could explain this behavior.
Curiously, setting the baudrate of the pi5 to 100kHz did not allow it to function, but at 10kHz it did altough at a very low refresh rate.

Adding * to config.txt
Code:
i2c_arm_baudrate=100000
I think 100khz is probably best.. 10khz is going to be an issue because the driver samples the device 100 times per second. This is more than 10khz clock can support.

Quote:I dismissed the length entirely when it worked on the pi3 and here we are..

I cut down my cable from a total of 800mm in steps of 100 and it started working at about 400mm at 400kHz. That is from the rpi5 pins to the imu pins.
The rpi3 handled the 800mm without problem. 
That is quite strange but not completely surprising.
Quote:I'm not smart enough to tell you why the accelerometer data made it through even a 4m cable but the compass only managed 400mm but atleast I have it working now.
Inside this chip the compass is a separate sensor which communicates via i2c (internal i2c of the sensor) to the main imu, and the main imu buffers the readings internally and uses a separate i2c bus. I find this a bit strange as well.
Quote:Imu 1 and 2 (1v8) and 4 (adafruit 3v3) all work on the rpi5.

I dont know how to rename a thread but anyone who does is welcome to name it something more appropriate.

A huge thanks to everyone for the support.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)