# How to use two SPI busses with CB1 on Manta M8P

**URL:** <https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219>\
**Category:** General Discussion\
**Created:** [October 5, 2024, 12:01pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219 "2024-10-05T12:01:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 5, 2024, 12:01pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/1 "2024-10-05T12:01:05Z")

</div>

Hi all around,

I’m in need to use two SPI busses since I want do use ADXL345 and ADS1220 on one toolhead.

Since [it is not valid to place an adxl345 directly on the same SPI bus as other devices](https://klipper.discourse.group/t/using-ads1220-with-load-cells-in-wheatstone-bridge/18836/35) I want to wire two independent SPI busses to the CB1 on my Manta M8P.

According to the [GPIO pinout of the CB1](https://github.com/bigtreetech/CB1?tab=readme-ov-file#40-pin-gpio) there is only The SPI1 Bus wired to the 40-pins, which i currently use for the ADXL. I’ve configured it as follows:

> [adxl345]  
> axes\_map: x,y,z  
> cs\_pin: cb1:gpio200  
> spi\_bus: spidev1.1

I’ve seen that pins sometimes can have [alternate functions](https://wiki.pine64.org/wiki/SOPine_GPIO_Alternate_Functions_Table), so is it possible to use other pins for that purpose?

And if it is possible, how to configure them properly?

Beside that, I’ve seen the Manta M8P provides a seperate 8-pin connector called SPI. Since I did not manage to get that working with the ADXL and then headed over to the 40-pin-gpio, I’m unsure if i can use that … and same question as above:  
How to configure that properly?

_Edit:_

I’m using Armbian on my CB1:

```auto
OS: Armbian (24.8.1) aarch64 
Host: BigTreeTech CB1 
Kernel: 6.6.44-current-sunxi64 
Uptime: 3 mins 
Packages: 523 (dpkg) 
Shell: bash 5.2.15 
Terminal: /dev/pts/2 
CPU: (4) @ 1.512GHz 
Memory: 163MiB / 918MiB

```

and edited the overlays in `/boot/armbianEnv.txt` to:

```auto
overlays=spidev1_1 spidev1_2

```

An `ls /dev/spi*` gives me now:

```auto
/dev/spidev1.1	/dev/spidev1.2

```

So I’m hopeful to get the 8-pin connector on the M8P working - further investigation is needed to make it come true…

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 5, 2024, 2:09pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/2 "2024-10-05T14:09:54Z")

</div>

> [@limefrog](#):
>
> Since [it is not valid to place an adxl345 directly on the same SPI bus as other devices](https://klipper.discourse.group/t/using-ads1220-with-load-cells-in-wheatstone-bridge/18836/35) I want to wire two independent SPI busses to the CB1 on my Manta M8P.

That’s not quite accurate. Kevin indicated that you should read the ADXL345 documentation to avoid and if you look there you’ll see:

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/c/c0797e1c86f66cff55f67bfcd3130c4863d44c3d.png)

Regardless, you’re not indicating what main controller board you’re using and what is wired to it - there may be some opportunities there, especially with the EXP1/EXP2 connectors (if you don’t have anything attached to them) for connecting one of the devices - I have attached an ADXL345 to the SPI pins on EXP2 and run from there.

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 5, 2024, 3:10pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/3 "2024-10-05T15:10:52Z")

</div>

Hi [mykepredko](https://klipper.discourse.group/u/mykepredko),

thank you for your reply and for the clarification. That is a quite valuable information if it ever comes to design an actual PCB for my toolhead. So far I’m just juggling with the Chinese breakout boards for ADXL and ADS and a flying wiring around my toolhead.

I think it might be better to follow the way of separation both devices at the moment, since i already had to make [a bunch of consessions](https://klipper.discourse.group/t/using-ads1220-with-load-cells-in-wheatstone-bridge/18836/34) here and it seems to make the whole thing less wonky than having an OR-Gate tangling around. 🙂

> [@mykepredko](#):
>
> you’re not indicating what main controller board you’re using

> [@limefrog](#):
>
> CB1 on Manta M8P

Or what was your Question aiming at?

I don’t use the EXP1/EXP2 for anything. But as far as i can figure out [here](https://github.com/bigtreetech/CB1#overlays-settings) the `tft35` would use `spidev1.1`. Correct me if I’m wrong but that would be connected to EXP1/EXP2?

Anyway I’m already using `spidev1.1` for connecting the ADXL via the GPIO, so it might not be a solution to connect there?

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 5, 2024, 3:55pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/4 "2024-10-05T15:55:38Z")

</div>

The EXP2 connector provides SPI CS, MISO, MOSI and SCK lines for whatever peripheral it’s attached to - this is really designed for a UC1701 based UI board but if you’re not using it, it is a separate SPI port that you can use.

You’ll have to dig into the M8P’s schematic and its MCU’s datasheet to see if it is a properly wired (for Klipper) SPI port but, at the very least, you have software SPI pins you can work with. BTT is uneven as to whether or not the MCU’s SPI1 or SPI2 pins, that are defaulted to by Klipper, are used.

I agree that, at this point, you should separate your SPI devices and use separate SPI ports/pins for each device but it would be helpful for you to list out what are the devices you want to use and what ports you feel you have available.

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 5, 2024, 7:45pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/5 "2024-10-05T19:45:38Z")

</div>

Hm,

according to this document:  
[BIGTREETECH MANTA M8P V1.1-SCH.pdf](https://klipper.discourse.group/uploads/short-url/uaf9zenuZq364e8wyWhYx3krMMc.pdf) (3.2 MB)

The EXP2s SPI is connected to pins 50-53 of the STM32G0B1VET6 and it seems they are meant for an SD-card reader:

```auto
50 PB11/SPI2_MOSI,TIM2_CH4, USART3_RX, I2C2_SDA,ADC_IN15
51 SPI2_NSS/FDCAN2_RX,ADC_IN16/PB12
52 SPI2_SCK,TIM1_CH1N, FDCAN2_TX,I2C2_SCL/PB13PIU13052
53 SPI2_MISO/TIM15_CH1, I2C2_SDA/PB14 PIU13053

```

That makes me think this refers in the end to `/dev/spidev2.x` but I really don’t know.

I also discovered the 8-pin connector called SPI (P6) being connected to:

```auto
30 PIU13030 PA5/SPI1_SCK/I2S1_CK,USART6_RX, USART3_TX,ADC12_IN5
31 PIU13031 PA6/SPI1_MISO/TIM3_CH1,TIM16_CH1,I2C2_SDA,I2C3_SDA/ADC_IN6
32 PIU13032 PA7/SPI1_MOSI/TIM3_CH2,I2C2_SCL,I2C3_SCL/ADC_IN7
33 PIU13033 PC4/USART3_TX, USART1_TX, TIM2_CH1_ETR, FDCAN1_RX/ADC_IN17

```

This SPI bus seems to be connected to the stepper drivers also, so I think, it is not a good idea to wire the ADXL here due to its behavior with other devices. But the ADS1220 might be possible?

> [@mykepredko](#):
>
> I agree that, at this point, you should separate your SPI devices and use separate SPI ports/pins for each device

At the moment the ADXL is NOT connected to the STM32, but connected to the 40-pin-GPIO connector of the CB1

```auto
19 PH7 GPIO231, SPI1_MOSI
21 PH8 GPIO232, SPI1_MISO
23 PH6 GPIO230, SPI1_CLK 
26 PG8 GPIO200, CS

```

I have it up and running there. So, according to ‘never touch a running system’ I’d keep it there. It is running on the seperate MCU

```auto
[mcu cb1]
serial: /tmp/klipper_host_mcu

```

so it is out of reach of other SPI devices.

> [@mykepredko](#):
>
> you have software SPI pins you can work with

Uw, this is a strange thing to me … connecting a wire to software sounds a bit like science-fiction. But I assume I can tell the software to accept hardware pins intended for other purposes to act as SPI bus pins?

Well this is the point to reveal that I’m not an educated electronics technician nor software progamer. So I have to admit, the above dug out Information doesn’t help me any further.

> [@mykepredko](#):
>
> it would be helpful for you to list out what are the devices you want

- Steppers (X,Y,Z\*3,E)
- Fans (coldend, partcooling\*2, MCU)
- heaters (hotend, bed)
- temperature sensors (hotend, bed, MCU, chamber)
- LED Stripe (maybe a second one to visualise the state of the machine as a kind of traffic Light, later on)
- ADXL345 for resonance metering
- ADS1220 for Z-endstop via strain gauges/load-cells

Clean and compact. No display / touch screen. No CAN bus / I2C Bus. Only control element should be an ‘emergency stop button’ I didn’t manage to implement from first day. 🕶

_Edit:_

At the moment I’m convinced the EXP2 connector proposed by [mykepredko](https://klipper.discourse.group/u/mykepredko) seems to be the best choice…

…question is, how to implement it? How to figure out which `micro-controller bus name` has to be configured?

Sadly the [Klipper configuration reference](https://www.klipper3d.org/Config_Reference.html?h=load#common-spi-settings) isn’t helpful on this topic:

```auto
#spi_speed:
# The SPI speed (in hz) to use when communicating with the device.
# The default depends on the type of device.
#spi_bus:
# If the micro-controller supports multiple SPI busses then one may
# specify the micro-controller bus name here. The default depends on
# the type of micro-controller.
#spi_software_sclk_pin:
#spi_software_mosi_pin:
#spi_software_miso_pin:
# Specify the above parameters to use "software based SPI". This
# mode does not require micro-controller hardware support (typically
# any general purpose pins may be used). The default is to not use
# "software spi".

```

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 6, 2024, 1:53am UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/6 "2024-10-06T01:53:50Z")

</div>

Lots to go through here.

> [@limefrog](#):
>
> Hm,
> 
> according to this document:  
> [BIGTREETECH MANTA M8P V1.1-SCH.pdf](https://klipper.discourse.group/uploads/short-url/uaf9zenuZq364e8wyWhYx3krMMc.pdf) (3.2 MB)
> 
> The EXP2s SPI is connected to pins 50-53 of the STM32G0B1VET6 and it seems they are meant for an SD-card reader:
> 
> ```auto
> 50 PB11/SPI2_MOSI,TIM2_CH4, USART3_RX, I2C2_SDA,ADC_IN15
> 51 SPI2_NSS/FDCAN2_RX,ADC_IN16/PB12
> 52 SPI2_SCK,TIM1_CH1N, FDCAN2_TX,I2C2_SCL/PB13PIU13052
> 53 SPI2_MISO/TIM15_CH1, I2C2_SDA/PB14 PIU13053
> 
> ```

Those pins are the defaults for the `SPI2` hardware port. In your `printer.cfg` you would be able to just specify `SPI2`.

Looking at the schematic (Manta M8P V1.1), these pins ONLY go to EXP2 - they do not go to the “MCU-CARD” (that’s the SPI1 pins discussed below).

> [@limefrog](#):
>
> That makes me think this refers in the end to `/dev/spidev2.x` but I really don’t know.

That’s using on the 40pin rPi connector.

> [@limefrog](#):
>
> I also discovered the 8-pin connector called SPI (P6) being connected to:
> 
> ```auto
> 30 PIU13030 PA5/SPI1_SCK/I2S1_CK,USART6_RX, USART3_TX,ADC12_IN5
> 31 PIU13031 PA6/SPI1_MISO/TIM3_CH1,TIM16_CH1,I2C2_SDA,I2C3_SDA/ADC_IN6
> 32 PIU13032 PA7/SPI1_MOSI/TIM3_CH2,I2C2_SCL,I2C3_SCL/ADC_IN7
> 33 PIU13033 PC4/USART3_TX, USART1_TX, TIM2_CH1_ETR, FDCAN1_RX/ADC_IN17
> 
> ```

That is the default for `SPI1`

> [@limefrog](#):
>
> This SPI bus seems to be connected to the stepper drivers also, so I think, it is not a good idea to wire the ADXL here due to its behavior with other devices. But the ADS1220 might be possible?

What are the stepper drivers that you’re using. If you’re not using the TMC2130/TMC2160 (ie TMC2208 or TMC2209) then you’re fine.

> [@limefrog](#):
>
> > [@mykepredko](#):
> >
> > I agree that, at this point, you should separate your SPI devices and use separate SPI ports/pins for each device
> 
> At the moment the ADXL is NOT connected to the STM32, but connected to the 40-pin-GPIO connector of the CB1
> 
> ```auto
> 19 PH7 GPIO231, SPI1_MOSI
> 21 PH8 GPIO232, SPI1_MISO
> 23 PH6 GPIO230, SPI1_CLK 
> 26 PG8 GPIO200, CS
> 
> ```
> 
> I have it up and running there. So, according to ‘never touch a running system’ I’d keep it there. It is running on the seperate MCU

No worries, I’d agree with that.

> [@limefrog](#):
>
> > [@mykepredko](#):
> >
> > you have software SPI pins you can work with
> 
> Uw, this is a strange thing to me … connecting a wire to software sounds a bit like science-fiction. But I assume I can tell the software to accept hardware pins intended for other purposes to act as SPI bus pins?

It’s called “bit-banging” and a) very well understood and b) well implemented in Klipper.

But, what it appears to me is that you won’t need to use it.

> [@limefrog](#):
>
> > [@mykepredko](#):
> >
> > it would be helpful for you to list out what are the devices you want
> 
> - Steppers (X,Y,Z\*3,E)
> - Fans (coldend, partcooling\*2, MCU)
> - heaters (hotend, bed)
> - temperature sensors (hotend, bed, MCU, chamber)
> - LED Stripe (maybe a second one to visualise the state of the machine as a kind of traffic Light, later on)
> - ADXL345 for resonance metering
> - ADS1220 for Z-endstop via strain gauges/load-cells
> 
> Clean and compact. No display / touch screen. No CAN bus / I2C Bus. Only control element should be an ‘emergency stop button’ I didn’t manage to implement from first day. 🕶

Not what I was asking for - what I was asking about was the SPI devices you want to attach and which ones you want to use.

So, from what I understand, you have three SPI ports available:

- SPI1 which is the 8 pin connector on the M8P **AND** used for the motor connectors **AND** the SD Card socket (as noted above)
- SPI2 which is coming through the EXP2 connector
- rPi SPI `/dev/spidev1.1` SPI port (which has your ADXL345 already on it)

That leaves the two SPI ports on the M8P for your use. If you are using SPI1 in any way (communicating with SPI TMC Stepper Drivers or using an SD Card for firmware updates) then I’d recommend staying away from it.

Now, above, you mention something about a TFT3.5 which uses an SPI interface -is this still an option?

> [@limefrog](#):
>
> _Edit:_
> 
> At the moment I’m convinced the EXP2 connector proposed by [mykepredko](https://klipper.discourse.group/u/mykepredko) seems to be the best choice…
> 
> …question is, how to implement it? How to figure out which `micro-controller bus name` has to be configured?

As noted above, it’s simply `SPI2`

> [@limefrog](#):
>
> Sadly the [Klipper configuration reference](https://www.klipper3d.org/Config_Reference.html?h=load#common-spi-settings) isn’t helpful on this topic:
> 
> ```auto
> #spi_speed:
> # The SPI speed (in hz) to use when communicating with the device.
> # The default depends on the type of device.
> #spi_bus:
> # If the micro-controller supports multiple SPI busses then one may
> # specify the micro-controller bus name here. The default depends on
> # the type of micro-controller.
> #spi_software_sclk_pin:
> #spi_software_mosi_pin:
> #spi_software_miso_pin:
> # Specify the above parameters to use "software based SPI". This
> # mode does not require micro-controller hardware support (typically
> # any general purpose pins may be used). The default is to not use
> # "software spi".
> 
> ```

`spi_bus: spi2`

I agree that the Klipper reference isn’t really helpful - I suspect that it has to do with the fact that main controller board designers are pretty willy-nilly when it comes to how SPI ports and pins are wired. However, it doesn’t look like the Manta M8P designer wasn’t too bad in selecting the SPI pins.

So, I think we’re in agreement that the `SPI2` port would be best to wire the ADS1220.

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 6, 2024, 2:46am UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/7 "2024-10-06T02:46:51Z")

</div>

@mykepredko Thanks a lot!

> [@mykepredko](#):
>
> What are the stepper drivers that you’re using.

I use the TMC2209

> [@mykepredko](#):
>
> Not what I was asking for - what I was asking about was the SPI devices you want to attach and which ones you want to use.

ok, so

> [@limefrog](#):
>
> - ADXL345 for resonance metering
> - ADS1220 for Z-endstop via strain gauges/load-cells

would have been sufficient, right?

> [@mykepredko](#):
>
> So, from what I understand, you have three SPI ports available

better having three and two needed than vice versa.  
🕶

So I’ll heat up my soldering iron and start rewiring my printhead.  
🙃

I’ve to redesign the cable carrier and widen the cable bushing, since i want to change one ribbon cable for the ADXL with two round, shielded cables for ADXL and ADS to improve signal quality - maybe i use a third one for the fans to reduce interferences from PWM there. The stepper of the feeder has one already.

So please be a little patient with me. It’ll take a few days, before I come up with the finished message, but I’ll definitely do.  
😇

And again: Thank you for your help!

_Edit:_

I assume i can remove `/dev/spidev1.2` from

> [@limefrog](#):
>
> the overlays in `/boot/armbianEnv.txt` to:
> 
> `overlays=spidev1_1 spidev1_2`

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 6, 2024, 2:56am UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/8 "2024-10-06T02:56:21Z")

</div>

All good except:

> [@limefrog](#):
>
> I’ve to redesign the cable carrier and widen the cable bushing, since i want to change one ribbon cable for the ADXL with two round, shielded cables for ADXL and ADS to improve signal quality - maybe i use a third one for the fans to reduce interferences from PWM there. The stepper of the feeder has one already.

Why do you feel a ribbon cable isn’t good enough and what kind of cables are you using?

I’m asking this because unless you know exactly what you are doing, you’re not going to improve signal quality and there’s a good chance you’ll make it worse.

Start with a ribbon cable, they’re fairly small and easy to work with. Make sure you have a single ground and power supply going to your boards with no way that they will be connected/shorted together. Don’t do extra work until you know you have a problem.

If you have any questions, please ask.

> [@limefrog](#):
>
> And again: Thank you for your help!

No problem, I’m interested in seeing what you produce.

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 6, 2024, 3:33am UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/9 "2024-10-06T03:33:30Z")

</div>

> [@mykepredko](#):
>
> Why do you feel a ribbon cable isn’t good enough

On the one hand that results out of the discussion [here](https://klipper.discourse.group/t/using-ads1220-with-load-cells-in-wheatstone-bridge/18836/33) (There you also can see some pictures, what I’m breeding here).

On the other hand that will result in a much stiffer cable whip, not hanging loose. I already had cable breakage because of bending the cable whip in another printer. Since I replaced the ribbon cables with round cables, the movement of the cable whip looks much smoother with wider radii and better distributed torsion along the whole length.

To be honest, the latter issue is more important to me and the first came up as a by-product just using shielded cables after the decision for round cable was already made.

> [@mykepredko](#):
>
> what kind of cables are you using?

I decided to use two cable types:

- for SPI bus: Cat5e 4 pair AWG 26 (flexible)
- for Stepper and Fans: LIYCY TP 2 x 2 x 0.25 mm² (flexible)

> [@mykepredko](#):
>
> Make sure you have a single ground and power supply going to your boards with no way that they will be connected/shorted together.

I have that. You think about inductive coils? And yes, the cable shields get connected to Protective Earth (PE) - on one side only.  
😉

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 7, 2024, 12:35pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/10 "2024-10-07T12:35:30Z")

</div>

I’ve planned the cabling for my printhead a bit more in detail. For anybody interested i show it here (heater and thermal sensor not shown).

[overview.pdf](https://klipper.discourse.group/uploads/short-url/k1ueZY4yViKq4aJF99Qw1iO1Fab.pdf) (384.9 KB)

@mykepredko I’d like to ask you to have a look, just to make sure I haven’t made a major mistake. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 7, 2024, 2:21pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/11 "2024-10-07T14:21:53Z")

</div>

That is what I was expecting from what you said above.

From the schematic perspective, the wiring is fine. Power looks good.

Previously you wrote,

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/2/2c8e60ce2df2cb0f805a7cf9922751301fee8bf4.png)

and while I did question your use of this, I should have been more explicit to say that by using twisted pair cable in this way, you’re going to get poorer signal quality than from a straight ribbon cable (or even just loose wires).

The issue is that by twisting signal lines together like this, you’re going to increase crosstalk between them. Normally when people use twisted pair, they put a ground line with each signal line which provides better signal integrity - IF THEY DO IT PROPERLY - Doing this would defeat the physical/mechanical advantages that you’re looking for in this case.

I just did a bit of research on this and the rule of thumb is that this is okay for up to 400kHz for a 0.5m length.

That feels a bit too conservative for me - for what you’re doing if you don’t exceed 2m cable lengths and data rates are less than 500kHz then things should be okay. That doesn’t mean that if you were to look at the signals at the ADS1220 or the ADXL345 boards you’ll have nice crisp edges and you will see the influence of the other line on the signal you’re observing.

To summarize, the basic approach is okay but I wouldn’t recommend wiring SPI signals this way. It should work but if there is a problem you can rewire it as you will not have damaged any of the circuitry in the printer.

I’m looking forward to hearing how things work out for you.

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 7, 2024, 6:19pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/12 "2024-10-07T18:19:45Z")

</div>

> [@mykepredko](#):
>
> Normally when people use twisted pair, they put a ground line with each signal line which provides better signal integrity

Yes, that is why I put MOSI and MISO in different pairs. Might it be cleaner to put them together with 3V3 and DREADY and having CLK and CS together in the third pair? I’d like to keep 5V and GND together in one pair then, since this should become the reference-voltage for the bridge.

> [@mykepredko](#):
>
> 2m cable lengths and data rates are less than 500kHz then things should be okay

So, as usual, I’m close to the limit again:  
I have 2m and the ADS will have `spi_speed: 512000`.

> [@mykepredko](#):
>
> nice crisp edges

I’m quite happy if it becomes reliable to a sufficient degree.

> [@mykepredko](#):
>
> you will not have damaged any of the circuitry in the printer

Im very hopefull on this topic. 🕶

> [@mykepredko](#):
>
> I’m looking forward to hearing how things work out for you.

I’ll keep you informed…

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 7, 2024, 6:27pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/13 "2024-10-07T18:27:07Z")

</div>

> [@limefrog](#):
>
> > [@mykepredko](#):
> >
> > Normally when people use twisted pair, they put a ground line with each signal line which provides better signal integrity
> 
> Yes, that is why I put MOSI and MISO in different pairs. Might it be cleaner to put them together with 3V3 and DREADY and having CLK and CS together in the third pair? I’d like to keep 5V and GND together in one pair then, since this should become the reference-voltage for the bridge.

For the ADXL345, this would be okay. I’m not sure about the ADS1220 - if you’re looking for the cleanest power possible then keep +5V, +3V3 and GND away from lines that are wiggling.

Good luck!

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 9, 2024, 7:51pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/14 "2024-10-09T19:51:02Z")

</div>

Just to show the new accommodation of the ADXL. This Part is the modified cable support on the printhead side and also holds the X-Endstop:

 ![DSC_9572](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/d/dec37275661db3b3b2b02f0aad64c19e0a3776a2.jpeg)  
 ![DSC_9573](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/a/a4348263f0fd22ea47a21e6f2d8237afb0fd7bb5.jpeg)

p.s.

I know this group is software related, and showing printer parts and building progress is not scope here. So, I won’t have a problem to stop that, just let me know.

---

<div class="post-metadata">

**Author:** ![mykepredko](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/mykepredko/32/2085_2.png) [@mykepredko](https://klipper.discourse.group/u/mykepredko)\
**Post date:** [October 10, 2024, 12:31am UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/15 "2024-10-10T00:31:28Z")

</div>

Looks good.

> [@limefrog](#):
>
> I know this group is software related, and showing printer parts and building progress is not scope here. So, I won’t have a problem to stop that, just let me know.

I think of this group as devoted to 3D printers with a focus on Klipper. If you have something you’ve done that you’re proud of or may help somebody in the future, by all means post it here as you’ve done.

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 10, 2024, 1:54pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/16 "2024-10-10T13:54:46Z")

</div>

Okay then, here you are.

This is the lower part of the printhead chassis. I integrated four strain gauges and embedded them in the plastic to build load cells.

 ![](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/d/d3e66396deffc23951bbe0f427abb1f65d3e238d.jpeg)  
They are soldered to build a wheatstone bridge (hopefully I made it correct, the wires are thin as hairs).  
I covered everything with an ABS-Acetone-solution for protection and avoidance of unwanted movement.

 ![DSC_9577](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/7/7666f2ebc140d170f9dae13e3d55798fc8539ee9.jpeg)

 ![DSC_9576](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/c/ce75a5f60e948be2b9afda0800fb18cbe3148874.jpeg)

 ![DSC_9579](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/6/6d34980c5fc805414b44412558bfdfac2e14302e.jpeg)

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 10, 2024, 2:11pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/17 "2024-10-10T14:11:43Z")

</div>

Here you can see how both parts fit together, building the chassis of my printhead:

 ![DSC_9580](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/9/9e75a985f88f7a949d30444946635faff3bc3b81.jpeg)

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 10, 2024, 2:48pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/18 "2024-10-10T14:48:06Z")

</div>

So, just soldered the bits together:

 ![DSC_9582](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/6/695c6f5421c6d86ddd1432e4ac1e9a7593d78495.jpeg)

 ![DSC_9583](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/0/0ff921047e782eb720deeb3b515b004f3a7a89d9.jpeg)

Glued the PCB now and decided to drown all those copperhairs in ABS-Acetone-solution. If this attempt fails everything goes to the waste bin anyway.

 ![DSC_9585](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/6/6dc387fddf99375d919a25d7507659fcedf21408.jpeg)

Now i’ll have to wait for everything to harden and cover the copperhairs from the backside also. That will take some time.

B.t.w.: If anybody plans to create a PCB regarding to this specific application: Just keep solder points for the bridge. By no means it is possible to use plug connectors here.

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [October 14, 2024, 12:49pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/19 "2024-10-14T12:49:16Z")

</div>

18 posts were split to a new topic: [Motor and controller issues](https://klipper.discourse.group/t/motor-and-controller-issues/19385)

---

<div class="post-metadata">

**Author:** ![limefrog](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/limefrog/32/9762_2.png) [@limefrog](https://klipper.discourse.group/u/limefrog)\
**Post date:** [October 12, 2024, 7:43pm UTC](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219/23 "2024-10-12T19:43:13Z")

</div>

> [@mykepredko](#):
>
> spi\_bus: spi2

Seems to be case sensitive. Typing `SPI2` throws:

> Unknown spi\_bus ‘SPI2’

Typing `spi2` went trough.

As you might assume I was fiddling around with the machine today.

 ![DSC_9593](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/3/332062b0c342b76b2c1bb4ab7a52bb2d3936c1d0.jpeg)

I redid the whole lighting…

 ![DSC_9589](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/4/4419c53756acb6896f45048cc5646e5d993153bc.jpeg)

…and cabling, combining together in one part for cable support and LED stripe.

 ![DSC_9592](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/f/ffde5be1fd34fbd78b0963dea8304f9f5a706b7a.jpeg)

But I can’t recommend this integration. I would happily split that again in a further edition, since it is a pain to get the LED Stripe and wiring for it in there (solderings are right in the middle of it).

On the other hand, I assembled the print head with the strain gauges inside.

 ![DSC_9591](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/e/ede1e1eea544d0054cda7bf2bb8452057aaf1ffa.jpeg)

Looks a little bit awful with all the wires. I like hidden wires.  
The less I can see them, the better it becomes.

I managed to get everything up and running again, what was running before (Ah! E-stepper untested → tomorrow), including ADXL.

Bud did not manage to get the ADS runnig. Must be a wiring error, since the machine doesn’t start when i plug it in. But I’m not in the mood anymore → tomorrow also.

For testing that: Does there exist a testing command for ADCs like the `ACCELEROMETER_QUERY` for the ADXL? Just somethig to confirm it is found?

[Next page](https://klipper.discourse.group/t/how-to-use-two-spi-busses-with-cb1-on-manta-m8p/19219.md?page=2)
