bassamanator / rp2040-zero-adxl345-klipper

Instructions on how to connect your ADXL345 to your host Raspberry Pi via a RP2040-Zero
42 stars 5 forks source link

Invalid adxl345 id (got 72 vs e5). #4

Closed DragarX closed 3 weeks ago

DragarX commented 3 weeks ago

Really not sure what's causing this, the accelerometer works fine using standard Arduino and micropython code but through klipper this is all i get.

1:10 AM Invalid adxl345 id (got 72 vs e5). 1:10 AM Invalid adxl345 id (got 72 vs e5). This is generally indicative of connection problems (e.g. faulty wiring) or a faulty adxl345 chip. 1:10 AM ACCELEROMETER_QUERY SENSOR=adxl345

my klipper config

[mcu pico]
baud: 115200
serial: /dev/serial/by-id/usb-Klipper_rp2040_E6635C469F765728-if00
restart_method: command

[adxl345]
cs_pin: pico:gpio1
spi_bus: spi0a
#spi_software_sclk_pin: pico:gpio3
#spi_software_mosi_pin: pico:gpio2
#spi_software_miso_pin: pico:gpio0
axes_map: x, y, z

[resonance_tester]
accel_chip: adxl345
probe_points:
    100,100,50

Software SPI was tested and just gave me the standard 0xFF id indicating a bad connection.

I compiled Klipper myself and used your firmware but both give me this issue. Using my stm32 with the same accelerometer gets perfect readings, so I'm not sure why the rp2040-zero is having issues. Any help would be much appreciated.

bassamanator commented 3 weeks ago

Wire length plays a big role in getting this to work. I know this because of countless hours of struggling over the course of many weeks.

DragarX commented 3 weeks ago

Not sure how wire length could come into play, the cable i'm using is shielded with twisted pairs and when I mention it working with "standard Arduino and micropython code" it is using the exact same cable, as well as when using it on my stm32. I'll try connecting it using different cables and a different SPI bus. If you have any other suggestions, let me know.

DragarX commented 3 weeks ago

So I managed to fix the issue by connecting the power line to 5v rather than 3.3v I didn't think the Creality adxl345 was 5v tolerant but this was the only way to get a stable reading.

3:06 PM
accelerometer values (x, y, z): 1258.350101, -8882.471304, 3370.820191
3:06 PM
ACCELEROMETER_QUERY SENSOR=adxl345
3:06 PM
accelerometer values (x, y, z): 1480.411884, -8660.409521, 3753.867940
3:06 PM
ACCELEROMETER_QUERY SENSOR=adxl345
3:05 PM
Klipper state: Disconnect
3:05 PM
FIRMWARE_RESTART
3:00 PM
Klipper state: Shutdown
2:58 PM
Invalid adxl345 id (got 79 vs e5).
2:58 PM
Invalid adxl345 id (got 79 vs e5).
This is generally indicative of connection problems
(e.g. faulty wiring) or a faulty adxl345 chip.
2:58 PM
ACCELEROMETER_QUERY SENSOR=adxl345
2:57 PM
Klipper state: Disconnect

EDIT: I was wrong, this worked for about 2 minutes and then the adxl345 stopped responding entirely.

EDIT2: Using 2 different rp2040-zeros, both of them have busted voltage regulators, I think the cheaper non waveshare clones are not up to the task.

DragarX commented 3 weeks ago

This can be closed. Killed 2 adxl345s trying to get this working. I would still like to figure out what caused the inconsistent readings, but I don't have anymore accelerometers to test.