3
\$\begingroup\$

I would like to ask if anyone had experience using this kind of IC, i had this school project where i have a lot of sensors using SPIs (each is 10-20 meters away from uC) and these needs to be somehow far from the main controller (uC). I knew that SPIs don't work well when implemented too far from the SPI master or SPI co-slave, so upon searching alternatives, i bump into some ideas like:

  • use two uC and convert SPI to RS485 then convert RS485 to SPI
  • use two uC and use their UART and convert them to RS485 then vice-versa
  • use two uC and apply Ethernet/PoE between the two
  • implement long distance SPI

i would like to re-consider the latter but i would like to try out first the former, then found this IC MAX3140, I'm totally new to this kind of data protocol connection when it comes to long distances. I have this image below where i want to use the IC in this kind of setup.

enter image description here

Did i get the gist of using these IC right?

https://www.maximintegrated.com/en/products/interface/controllers-expanders/MAX3140.html

i guess i do understand this structure below based on its datasheet

enter image description here

as you can see, there's only one Max3140 IC used and that'll only be (1) SPI to RS-485 alone. What i want to know if the below structure work out same since not specified on datasheet (using the IC vice-versa also, (2) RS-485 to SPI). Can it be the one way around? how about clock, etc?

enter image description here

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Based on what you have, option 1 seems to be your only choice. Also if you use two of these per node you can use CAT-5 cable and RJ-45 connectors. Remember that RS-485 needs a signal ground to avoid DC drift. \$\endgroup\$
    – user105652
    Feb 21, 2018 at 5:26
  • 2
    \$\begingroup\$ Can you give an idea of how much 'somehow far' is? Reason: there is a well know saying "Don't tell us the solution, tell us the problem". Also what bitrate do you need to read the sensors. \$\endgroup\$
    – Oldfart
    Feb 21, 2018 at 7:46
  • \$\begingroup\$ @Sparky256 thanks :D so you mean like ethernet/PoE, i should use CAT-5 wires to implement SPI-RS485 vice-versa? \$\endgroup\$
    – Mheruian
    Feb 22, 2018 at 0:11
  • \$\begingroup\$ @oldfart i'll edit the question for good reference, actually it'll be 10 to 20 meters aways, 10 meters away and additional 10 meters consideration for cable routing procedure. \$\endgroup\$
    – Mheruian
    Feb 22, 2018 at 0:12
  • 1
    \$\begingroup\$ Well RS-485 is your transmission and reception standard. The SPI is isolated from this, but you need to run a small ground wire from RS-485 port to port, so DC drift it not an issue. You will need to keep a SPI control stack in each port so they do not conflict, much like I2C does. \$\endgroup\$
    – user105652
    Feb 22, 2018 at 3:20

2 Answers 2

1
\$\begingroup\$

use two uC and convert SPI to RS485 then convert RS485 to SPI

Converting SPI to RS485 then back to SPI only really works in the master-to-slave forward direction. It doesn't work when trying to extract data from a slave because of the turn-around time and the immediate possibility that data coming back will gradually become out-of-sync with the forward going clock signal over longer and longer distances.

For instance I have sent 2 MHz clocked SPI converted to RS485 many tens of metres to drive remote DACs and it worked just fine - clock and data roll along to the slave and appear in-sync with each other and all is well.

use two uC and use their UART and convert them to RS485 then vice-versa

This is the obvious choice because you are creating a solution that does not require clock sync across the full cable - you have local sync at both ends and that works just fine. The MX chip appears suitable for this but, as always the devil is in the detail so read the data sheet to see if there are any gotchas.

use two uC and apply Ethernet/PoE between the two

Harder to get up and running but could be the best overall solution for a "many-user" system

implement long distance SPI

See my first answer - use 485 as a buffer and take note that slave-to-master comms will be problematic.

\$\endgroup\$
2
  • \$\begingroup\$ It doesn't work when trying to extract data from a slave because of the turn-around time and the immediate possibility that data coming back will gradually become out-of-sync with the forward going clock signal over longer and longer distances. Thanks a lot :D this is what makes me think also since i haven't use or had bought the IC, the data could be not properly propagated for the uC to compute. Actually, what i'm currently building is a DAQ system so yeah, sensors are about acquiring data and its vital for me. \$\endgroup\$
    – Mheruian
    Feb 22, 2018 at 0:17
  • 1
    \$\begingroup\$ @Mheruian if you are happy with this answer please consider accepting it. If you need more clarification then ask. \$\endgroup\$
    – Andy aka
    Feb 27, 2018 at 8:26
2
\$\begingroup\$

There is LTC6820 (https://www.analog.com/en/products/ltc6820.html) chip, that allows isolated long distance SPI over one twisted pair. The specs claim 1mbps, up to 100 meters.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.