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?
64 Replies
PA6 is connected to the ADXL
50V include from advanced steper configuration guide
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
Manta 1.1 board def
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.
STM32G0B1
VET6
AA008 9R A
TWN AA 209
13
https://www.mouser.ca/datasheet/2/389/stm32g0b1cc-2042221.pdf
SPI2 with PB14(MISO), PB13(SCK), PB11(MOSI), in the EXP2 section should be available, but a bit awkward for wiring.
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.
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.
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.
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
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.
That's a good question: https://github.com/bigtreetech/Manta-M8P/issues/27
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...
The MOSI and MISO pins need to be swapped or the board wont start
This fix contradicts the guidance of the manta manual
Yes, as i mentioned earlier the klipper implementation of pin aliases is really odd..
Ooh. This should be fixed in the config!
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.
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 👍
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.
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
Switching the pins is definitely the fix. You are right though, the wires need to be swapped as well.
Got it, will get that fixed
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.
It got hot at 5v? It should have a dc/dc regulator on board. The GY291's do 3-6V on VIN
Yeah, it didn't fry the chip, but the regulator was toasty
I see. The issue is that the voltage drop on 3.3v easily get's too big, depends on the users wiring.
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?
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
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.
You mean for the adxl right, you're not changing the motor SPI config?
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.
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 configBut 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
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
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
yeah i understand now
Yeah, me too. I think it's a bigger problem.
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 :/
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.
That's an option, yes
Just wire it like this https://www.klipper3d.org/Measuring_Resonances.html#direct-to-raspberry-pi
and then
Okay, ignore my PR, because it will probably break
When running queries make sure to specify the
CHIP
parameter. Ie ACCELEROMETER_QUERY CHIP="adxl345 rpi"
Reading this Greek means I'm probably doomed when I get to this stage.
Excellent. I'll test this against SPI2
What stage are you at?
Just wiring the electronics panel.
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
Are you doing SPI drivers on the Manta?
This works fine on an Octopus Pro for example.
Yes I'm running the newer BTT 5160t Plus with a 1.1 M8P with an EBB42
then you are fine, use the ADXL on the toolboard
Putting this here: https://www.3docity.com.au/adxl345-and-bigtreetech-cb1-input-shaper-setup/
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
Rat-OS does this already for you
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
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
##Accelerometer connected to rpi
[include RatOS/boards/rpi/config.cfg]
[include RatOS/sensors/rpi-adxl345.cfg]
[resonance_tester]
accel_chip: adxl345 rpi
Here's the error. The CB1 github page says:
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
Testing this solution later today.