This was killing me. The rp5 is such a magnificent machine for python development. I use the AI Qwen to write the python programs. For some reason, Google Gemini sucks at it, even 2.5. can't wait to see how I can do the Adxl355. There seems to be a universal timing problem there.
A few minutes of tinkering time.
Bought
https://www.ebay.co.uk/itm/167295678646 modules. Soldered the header on, and bridged CS to VCC to select I2C mode.
Pi wiring:
VCC to Pi pin 1 (3V3)
SDA to Pi pin 3 (GPIO2 / SDA)
SCL to Pi pin 5 (GPIO3 / SCL)
INT1 to Pi pin 7 (GPIO 4)
GND to Pi pin 9 (GND)
ADXL345 is supported by the adxl34x driver at
https://github.com/torvalds/linux/blob/ ... l34x-i2c.cAdd the relevant config to the i2c-sensor overlay - now a pull request at
https://github.com/raspberrypi/linux/pull/6712Add "dtoverlay=i2c-sensor,adxl345" to /boot/firmware/config.txt, and I have an extra input device that gives me positional readouts.
Change config to "dtoverlay=i2c-sensor,adxl345,i2c0". Power down. Rewired SDA and SCL to pins 27 & 28 respectively (GPIOs 0&1). Power up. I have the same input device present and giving me positional readout.
The overlay has all the hardware I2C buses available as overrides, as documented by "dtoverlay -h i2c-bus".
If you wish to use a bitbashed I2C bus, then use "dtoverlay=i2c-gpio,i2c_gpio_sda=0,i2c_gpio_scl=1,bus=8", and "dtoverlay=i2c-sensor,adxl345,i2c-path=i2c@8" (substitute the 8 with the bus number of your choice that isn't already taken, and 0 & 1 with the GPIOs of your choice).
I just did the bus 0 on pins 27&28 and it worked perfectly. I think the i2c device thing is critical. The '355' may need a new device, or this one works. A device file only has a few extra droverlay commands.
All the rp's are quite fussy about putting things in config.txt and rebooting. I powered off for extra oomph. My main goal is to put a lot of '345's on a base and running an array. This can do rotation and tilt and can reduce internal noise. However, on adxl355 can do for many 345's and I have dreams. However, the adxl355 has never been shown to work on i2c, and rp5.
This solution was on the rp forums.
ps. the main problem was that there are a number of pi models, and although you specify rp5, the search engines don't do that. As well, the rp5 has a completely different gpio chip, and runs Debian bookworm. They have made great progress to unify everything.
No comments:
Post a Comment