Solved: Setting up ADXL

Hey all. Is there anything special I need to enable to get the adxl running? I wired it into my Spider 2.3 (see pic), but when I try to”generate shaper graphs” script in mainsail, Console reports “Invalid adxl345 id (got from instead of e5)” I know SPI needs to be enabled to use this header on the board, and the RatOS site indicates it’s usually enabled but I don’t know if SPI is actually enabled and may be involved in the error. Thanks for any help. ✌️
No description
16 Replies
miklschmidt
miklschmidt7mo ago
provided your wiring is correct, use software_spi. Hardware SPI is not something you enable, it's a feature of the MCU on specific pins - an MCU may have several SPI busses. Software spi can solve problems where hardware SPI fails - which i believe is a klipper issue. Such as cases of multiple devices sharing the same bus.
🅰4⃣🍩
🅰4⃣🍩7mo ago
Thanks for the reply. 🙂✌️ How do I enable software SPI? I triple checked the wiring. I confirmed 3.3v is at the adxl (which I grabbed from an empty endstop). I looked in the cfg and found the pins (PA4 thru 7) and wired them the the EXP2 header per the pinout diagram. There must be something I’m missing in a cfg.
miklschmidt
miklschmidt7mo ago
you specify the software_spi_mosi/miso/sclk pins in your adxl section (look at the klipper docs, or something like the octopus pro config)
🅰4⃣🍩
🅰4⃣🍩7mo ago
So need to add an adxl section in my overrides?
miklschmidt
miklschmidt7mo ago
I'm assuming you already made your own board config with that adxl section already in it?
🅰4⃣🍩
🅰4⃣🍩7mo ago
I was working from the spider cfg in rat os. Just overrides for minor pin changes from 1.0 Can you tell me where the adxl definition belongs? I’ll go find syntax from klipper. I’m just confused about all the cfg files in ratOS I’m used to one main cfg and a couple small includes like for macros and LEDs or whatever Ok. I looked at my edited board include file for the spider 2.3: There is an alias under #accel : adxl345_cs_pin=PA4 And below an [adxl345] definition with: cs_pin: adxl345_cs_pin spi_software_mosi_pin: PA7, misopin: PA6, and sclkpin: PA5 You should be able to see my wiring in the posted pic going to those PA pins. Do I need to define the bus somewhere? spi1 ?
miklschmidt
miklschmidt7mo ago
It's originally defined in the board config. Modify it there (if you made your own), if it has a spi_bus defined you can't unset it.
🅰4⃣🍩
🅰4⃣🍩7mo ago
(The orange and brown wires for voltage and ground have been moved to an endstop and confirmed voltage at the adxl board)
miklschmidt
miklschmidt7mo ago
Ah yes this is correct. Is this CS pin correct though?
🅰4⃣🍩
🅰4⃣🍩7mo ago
Correct in the sense that one end the wire is on PA4 in the EXP2 on mainboard and the other end is on the cs pin of adxl I see no bus definition
miklschmidt
miklschmidt7mo ago
Should be fine. I'm guessing it's an ADXL issue in this case Alternatively you can try connecting it to the RPI, there's an include for that I gotta go though
🅰4⃣🍩
🅰4⃣🍩7mo ago
The same adxl was used on two other machines and was fine wiring to the Pi and following klipper directions.
miklschmidt
miklschmidt7mo ago
(it's in the sensors folder) just set the accel_chip to adxl345 rpi under [resonance_tester] and connect it like in the klipper docs. Yeah it's probably a spider 2.2 quirk. It was a PITA to get it working on the 1.1 because of SD card interference. Maybe there's something in the spider 2.2 docs / schematics.
🅰4⃣🍩
🅰4⃣🍩7mo ago
Thanks I’ll give it a shot. I’m guessing I don’t need to install numpy or other installs
miklschmidt
miklschmidt7mo ago
nope, just wire, include and add it to [resonance_tester] later!
🅰4⃣🍩
🅰4⃣🍩7mo ago
Wasn’t able to get working via EXP2 on Spider. I know. I know. 🤦‍♂️ Rewired. Connected to Pi. Moved all the adxl cfg bits into the override section on printer.cfg commented out others. Added in the 3 small sections for adxl from klipper.org instructions. Accelerometer_query: values reported no errors. 🥳 thanks again for the help!!!