Author Topic: Using analog switch for SPI MOSI signal  (Read 350 times)

0 Members and 1 Guest are viewing this topic.

Offline ieeeHuseyinTopic starter

  • Contributor
  • Posts: 17
  • Country: tr
Using analog switch for SPI MOSI signal
« on: May 15, 2024, 09:30:22 am »
Hello,

I am experimenting with RGB leds (like ws2815)

I use SPI over RPI to control the RGB leds.

I want to control two separate led groups.

I had problems with SPI1.

I am thinking of using SN74LVC1G3157DCKR to control two separate led groups with SPI0.

The datasheet says it can be used with SPI.

Is it a problem to use an analog switch for a digital signal?

https://www.ti.com/lit/ds/symlink/sn74lvc1g3157.pdf?HQS=dis-dk-null-digikeymode-dsf-pf-null-wwe&ts=1715693632860&ref_url=https%253A%252F%252Fwww.ti.com%252Fgeneral%252Fdocs%252Fsuppproductinfo.tsp%253FdistId%253D10%2526gotoUrl%253Dhttps%253A%252F%252Fwww.ti.com%252Flit%252Fgpn%252Fsn74lvc1g3157
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7480
  • Country: nl
  • Current job: ATEX product design
Re: Using analog switch for SPI MOSI signal
« Reply #1 on: May 15, 2024, 09:36:31 am »
It's not an issue, you can do it. You can also use logic gates, but analog switches today are often times smaller and cheaper.
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: ru
Re: Using analog switch for SPI MOSI signal
« Reply #2 on: May 15, 2024, 09:47:20 am »
Most modern MCUs have several SPIs, it would be wiser to learn how to use them correctly.  :)
In addition, you can use the software SPI (serial out) on any pins.
External switches will require control/selection, and this is the same output that can be used directly.
And sorry for my English.
 

Offline xvr

  • Frequent Contributor
  • **
  • Posts: 263
  • Country: ie
    • LinkedIn
Re: Using analog switch for SPI MOSI signal
« Reply #3 on: May 15, 2024, 09:59:51 am »
You could use this switch, but it worth to add pull down resistors to its outputs. Because when you switch one RGB string to SPI output other RGB string input left floating.

PS. ws2815 can be cascaded without any switches. Are you really need a switch?
 

Offline ieeeHuseyinTopic starter

  • Contributor
  • Posts: 17
  • Country: tr
Re: Using analog switch for SPI MOSI signal
« Reply #4 on: May 15, 2024, 11:10:24 am »
You could use this switch, but it worth to add pull down resistors to its outputs. Because when you switch one RGB string to SPI output other RGB string input left floating.

PS. ws2815 can be cascaded without any switches. Are you really need a switch?

I have shown the connection diagram below.

The leds will be connected in two separate places.
 

Offline ieeeHuseyinTopic starter

  • Contributor
  • Posts: 17
  • Country: tr
Re: Using analog switch for SPI MOSI signal
« Reply #5 on: May 15, 2024, 11:12:59 am »
Most modern MCUs have several SPIs, it would be wiser to learn how to use them correctly.  :)
In addition, you can use the software SPI (serial out) on any pins.
External switches will require control/selection, and this is the same output that can be used directly.

I cannot use software spi because I am sending data at high speeds.
 

Offline S. Petrukhin

  • Super Contributor
  • ***
  • Posts: 1270
  • Country: ru
Re: Using analog switch for SPI MOSI signal
« Reply #6 on: May 15, 2024, 11:20:48 am »
Most modern MCUs have several SPIs, it would be wiser to learn how to use them correctly.  :)
In addition, you can use the software SPI (serial out) on any pins.
External switches will require control/selection, and this is the same output that can be used directly.

I cannot use software spi because I am sending data at high speeds.

The SPI can adjust the speed.
But that's not what I was talking about.

You will need a pin that switches the transmission direction for the external switch.
But you can leave the output for the first line of LEDs alone and output data there, and use the pin that should be used for switching in the same way for another part of the serial output.

External switching makes sense when you have many directions and you choose them in binary code.
And sorry for my English.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf