TMC 5160 - pin stepper_spi_miso_pin is an alias for PA6

Hi there. I'm installing external 48V steppers on the Manta following the advanced configuration page. I have run into this error. Jumpers are set, boards are energized. Driver power is set to 24V (external drivers). Any thoughts?
No description
64 Replies
MONSOONO
MONSOONOOP13mo ago
PA6 is connected to the ADXL
MONSOONO
MONSOONOOP13mo ago
No description
MONSOONO
MONSOONOOP13mo ago
No description
MONSOONO
MONSOONOOP13mo ago
50V include from advanced steper configuration guide
No description
MONSOONO
MONSOONOOP13mo ago
Manta 1.1 board def is image, my override in text: [adxl345] cs_pin: PC4 spi_software_sclk_pin: PA5 spi_software_mosi_pin: PA6 #SD0 --> MOSI spi_software_miso_pin: PA7 #SDA --> MISO
No description
MONSOONO
MONSOONOOP13mo ago
Manta 1.1 board def
No description
MONSOONO
MONSOONOOP13mo ago
Looks like the board def for the manta explicitly links the ADXL to pins defined as the same SPI bus motor pins. I'm not sure what the resolution for this would be. Going to explore alternative pins for ADXL while waiting for guidance on this issue.
MONSOONO
MONSOONOOP13mo ago
No description
MONSOONO
MONSOONOOP13mo ago
MONSOONO
MONSOONOOP13mo ago
SPI2 with PB14(MISO), PB13(SCK), PB11(MOSI), in the EXP2 section should be available, but a bit awkward for wiring.
MONSOONO
MONSOONOOP13mo ago
MONSOONO
MONSOONOOP13mo ago
ADXL override commented out, now booting. ADXL now swapped to software using the SPI2 pins. It boots. Next step is to rewire the sensor and test.
miklschmidt
miklschmidt13mo ago
This is the problem. Use the stepper_spi_* pin names. It's the same spi bus. Klipper complains because you're using 2 names for the same physical pins. Not because you can't use the same physical pin for more than one section. It's a confusing error, i know.
MONSOONO
MONSOONOOP13mo ago
So like this? cs_pin: PC4 spi_software_sclk_pin: stepper_spi_sclk_pin spi_software_mosi_pin: stepper_spi_mosi_pin #SD0 --> MOSI spi_software_miso_pin: stepper_spi_miso_pin #SDA --> MISO The strange thing about this is that it only started doing this after connecting SPI drivers, which I did not think would cause a name conflict.
miklschmidt
miklschmidt13mo ago
Yes. Why is that strange? UART drivers don't use SPI, so they don't use the software_spi_* pins 🙂 I'm not sure w hy you changed the adxl345 software spi pins in the first place
MONSOONO
MONSOONOOP13mo ago
It's strange that it didn't complain about the name, since that is already in the board definition, even though they are not being used, they are still being compiled. I'm not saying it's an error, just different from my C++ compiler experience.
MONSOONO
MONSOONOOP13mo ago
GitHub
Manta M8P Boot Loop on SPI1 with ADXL345 · Issue #27 · bigtreetech/...
Connecting an ADXL345 to SPI1 on my Manta M8P causes the MCU to not boot. It seems like the bootloader is conflicting with some other device on SPI1 on boot. Can anyone confirm if there is any othe...
MONSOONO
MONSOONOOP13mo ago
The MOSI and MISO pins need to be swapped or the board wont start This fix contradicts the guidance of the manta manual
miklschmidt
miklschmidt13mo ago
Yes, as i mentioned earlier the klipper implementation of pin aliases is really odd.. Ooh. This should be fixed in the config!
MONSOONO
MONSOONOOP13mo ago
Yeah, just got it to work last night after trying a few times a month ago (no idea why it didnt work then), and with this latest issue I wasn't sure if I had fixed it.
miklschmidt
miklschmidt13mo ago
If you want, i’ll accept a quick PR that swaps those two pins in the board config.cfg. If not i’ll make the change once i’m back from work tomorrow 👍
MONSOONO
MONSOONOOP13mo ago
I've never submitted a PR to somebody else's repo so double check that I don't mess this up :) Done. That was good to learn. hopefully that fix was appropriate. Thanks for your help. I tried a bunch of things we discussed, but none of it worked. I'm not confident my PR will work. While I figured out how to make a PR, I still have no idea how to handle Klipper aliases.
miklschmidt
miklschmidt13mo ago
Gotcha, but you can confirm that switching the pins is the fix, yeah? PR is correct for that at least, so maybe the physical pins have to be swapped. In which case we'll correct the wiring diagram instead
MONSOONO
MONSOONOOP13mo ago
Switching the pins is definitely the fix. You are right though, the wires need to be swapped as well.
miklschmidt
miklschmidt13mo ago
Got it, will get that fixed
MONSOONO
MONSOONOOP13mo ago
I recommend using this wiring: GND-GND 3.3V-3.3V PA6-MOSI PA7-MISO PA5-SCL PC4-CS GND-X 5V-X Generic ADXL chip says 3-5, but was very hot at 5 and didn't work any better.
miklschmidt
miklschmidt13mo ago
It got hot at 5v? It should have a dc/dc regulator on board. The GY291's do 3-6V on VIN
MONSOONO
MONSOONOOP13mo ago
Yeah, it didn't fry the chip, but the regulator was toasty
miklschmidt
miklschmidt13mo ago
I see. The issue is that the voltage drop on 3.3v easily get's too big, depends on the users wiring.
MONSOONO
MONSOONOOP13mo ago
Will the SPI motors still work if PA6 is used for MISO on the motors and PA7 is used for MOSI on the motors but the ADXL is using PA6 for MOSI and PA7 for MISO?
miklschmidt
miklschmidt13mo ago
Well i assume the change is necessary because of wrong labelling of the pins. So i'd assume yes. But please test this. I don't own the m8p 1.1 myself, so best i can do is listen to users like you
MONSOONO
MONSOONOOP13mo ago
The motors appear to work fine on SPI with the existing define, but I was unable to test this. Should I be creating a dummy board definition? Because when I put: cs_pin: PC4 spi_software_sclk_pin: stepper_spi_sclk_pin spi_software_mosi_pin: stepper_spi_mosi_pin #SD0 --> MOSI spi_software_miso_pin: stepper_spi_miso_pin #SDA --> MISO in my overrides, it did not boot.
miklschmidt
miklschmidt13mo ago
You mean for the adxl right, you're not changing the motor SPI config?
MONSOONO
MONSOONOOP13mo ago
It has been difficult to test this because of the namespace problems that I do not understand. Yeah, motor needs to stay the same, but MISO and MOSI need to swap for ADXL.
miklschmidt
miklschmidt13mo ago
There's no namespace issues if you use stepper_spi_whatever instead of the actual pins. The 5160 motor includes use these The error happens when you use 2 different names for the same pin in your config
MONSOONO
MONSOONOOP13mo ago
But it also doesn't let you use the same name? "pin stepper_spi_miso_pin used multiple times in config" Okay, I'll work on testing this
miklschmidt
miklschmidt13mo ago
Wait, when did you get this? Hmmm... This might be a problem yeah.. You're not able to use spi_miso_pin for both software mosi and miso at the same time. There's no way to get around that no matter what you call that pin
MONSOONO
MONSOONOOP13mo ago
Default Manta 1.1 config with: [adxl345] cs_pin: adxl345_cs_pin spi_software_mosi_pin: stepper_spi_miso_pin spi_software_miso_pin: stepper_spi_mosi_pin spi_software_sclk_pin: stepper_spi_sclk_pin in overrides
miklschmidt
miklschmidt13mo ago
yeah i understand now
MONSOONO
MONSOONOOP13mo ago
Yeah, me too. I think it's a bigger problem.
miklschmidt
miklschmidt13mo ago
And just swapping the physical pins on the ADXL is not enough to get it to work? yeah i'm not sure there's an actual fix :/
MONSOONO
MONSOONOOP13mo ago
An override to move the ADXL to another SPI? I tried this quickly on bus2, but it didn't work and I didn't test it thoroughly. I'm going to read about using the ADXL with the RPI.
miklschmidt
miklschmidt13mo ago
That's an option, yes Just wire it like this https://www.klipper3d.org/Measuring_Resonances.html#direct-to-raspberry-pi and then
[include RatOS/boards/rpi/config.cfg]
[include RatOS/sensors/rpi-adxl345.cfg]
[resonance_tester]
accel_chip: adxl345 rpi
[include RatOS/boards/rpi/config.cfg]
[include RatOS/sensors/rpi-adxl345.cfg]
[resonance_tester]
accel_chip: adxl345 rpi
MONSOONO
MONSOONOOP13mo ago
Okay, ignore my PR, because it will probably break
miklschmidt
miklschmidt13mo ago
When running queries make sure to specify the CHIP parameter. Ie ACCELEROMETER_QUERY CHIP="adxl345 rpi"
762x39
762x3913mo ago
Reading this Greek means I'm probably doomed when I get to this stage.
MONSOONO
MONSOONOOP13mo ago
Excellent. I'll test this against SPI2 What stage are you at?
762x39
762x3913mo ago
Just wiring the electronics panel.
miklschmidt
miklschmidt13mo ago
If you're using a toolboard, there's no need to worry about this. If not i recommend going straight for https://discord.com/channels/582187371529764864/1181623658502963261/1182064767809097898 Also this is specifically related to the manta m8p 1.1
MONSOONO
MONSOONOOP13mo ago
Are you doing SPI drivers on the Manta?
miklschmidt
miklschmidt13mo ago
This works fine on an Octopus Pro for example.
762x39
762x3913mo ago
Yes I'm running the newer BTT 5160t Plus with a 1.1 M8P with an EBB42
blacksmithforlife
then you are fine, use the ADXL on the toolboard
MONSOONO
MONSOONOOP13mo ago
3docity
3docity Australia
ADXL345 And BIGTREETECH CB1 (Input Shaper Setup) - 3docity Australia
Input shaper is a technique used by Klipper firmware on a 3d printers to reduce ringing (aka ghosting or echoing) in 3d prints. Ringing is caused by
blacksmithforlife
Rat-OS does this already for you
MONSOONO
MONSOONOOP13mo ago
Got an error message re the spi bus not being avaialble when implementing the config provided by miklschmidt. I'll have to check it in the morning and compare the names with what was in the board envs, since my board envs didn't match that guide anyway
blacksmithforlife
I was the one who worked on the cb1 image and I tested the adxl on the manta boards. I remember having to enable the overlays and that was then added to Rat-OS
MONSOONO
MONSOONOOP13mo ago
##Accelerometer connected to rpi [include RatOS/boards/rpi/config.cfg] [include RatOS/sensors/rpi-adxl345.cfg] [resonance_tester] accel_chip: adxl345 rpi
MONSOONO
MONSOONOOP13mo ago
Here's the error. The CB1 github page says:
No description
MONSOONO
MONSOONOOP13mo ago
I confirmed spidev1.2 is commented out in my boardenvs. ADXL queried successfully with SPI2 pins in software SPI: [adxl345] cs_pin: PE7 spi_software_sclk_pin: PB13 #(SCK) spi_software_mosi_pin: PB11 #SD0 --> MOSI spi_software_miso_pin: PB14 #SDA --> MISO axes_map: x,z,y
MONSOONO
MONSOONOOP13mo ago
No description
MONSOONO
MONSOONOOP13mo ago
Testing this solution later today.

Did you find this page helpful?