xbst / KUSBA

Klipper USB Accelerometer Project
GNU General Public License v3.0
213 stars 25 forks source link

`Invalid adxl345 id (got f2 vs e5)` error running `ACCELEROMETER_QUERY` for the first time #6

Closed hakimio closed 1 year ago

hakimio commented 1 year ago

I understand that Invalid adxl345 id (got f2 vs e5) error is documented but instead of ignoring it, it should be fixed. This doesn't happen with FYSETC Portable Input Shaper and should not happen with KUSBA.

xbst commented 1 year ago

This happens with a Raspberry Pi Pico with ADXL345 too, not just KUSBA. This is a Klipper problem and there is nothing I can do to fix it.

hakimio commented 1 year ago
hakimio commented 1 year ago

I guess you were referring to this closed bug report: https://github.com/Klipper3d/klipper/issues/4712

xbst commented 1 year ago

I have no idea why FYSETC PIS doesn't have this problem. Me and other people (simple discord searches can find some recent examples) had the invalid ID issue on the first query with Pi Picos too, not just KUSBA. This indicates a software issue.

One difference between the KUSBA vs PIS is, PIS uses different GPIO pins for the SPI bus to the ADXL, could be related. But the pins the KUSBA use are full HW SPI pins too, and they should work the same. Again, the only possible explanation I can think of for this is a Klipper bug, even if it is not reported on GitHub.

hakimio commented 1 year ago

Can you create a bug report on Klipper repo and link it here?

Fragmon commented 1 year ago

I found a solution:

Use this: [adxl345] cs_pin: adxl:gpio1

spi_bus: spi0a

spi_software_sclk_pin: adxl:gpio2 spi_software_mosi_pin: adxl:gpio3 spi_software_miso_pin: adxl:gpio0

xbst commented 1 year ago

Ideally I prefer hardware SPI over software SPI, but I'll test it and if this fixes the issue without producing worse results I'll add it as an option to the .cfg.

Witawat commented 1 year ago

Invalid adxl345 id (got f2 vs e5). This is generally indicative of connection problems (e.g. faulty wiring) or a faulty adxl345 chip.

how to fix ? or use klipper version ?

xbst commented 1 year ago

It is covered in the instructions: https://github.com/xbst/KUSBA#note-the-first-reading-from-the-accelerometer-will-be-invalid-usually-f2-vs-e5-this-is-expected-and-your-kusba-will-still-work-fine-after-the-first-query-run-accelerometer_query-once-before-starting-measuring-resonances First reading will be invalid, should work fine after that.