0
\$\begingroup\$

for a project I will be using 2 microcontrollers communicating with SPI 100 kbps. Distance between them will be approximately 60-70 cm but these microcontrollers will be in a case with a 24 V battery and other components so I am afraid of EMI and noise. Would there be a corruption in SPI communication or any problem? Any suggestions that you can give such as: use twisted pair cable etc. As a last option I might go with a CAN but that would be a waste of space for CAN Bus transceivers.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ so I am afraid of EMI and noise Explain why you assume it will be an issue. Are you doing anything non-standard? Normally SPI lines aren't that sensitive if you have a proper design. Unless you use 1 Mohm resistors to put the SPI signals on the SPI bus (which would be a crazy idea and serves no purpose) then I do not see how EMI can be a problem unless the other circuit is a high power RF transmitter. In my opinion you see a problem where there is no problem. \$\endgroup\$ Feb 12, 2019 at 9:42
  • 1
    \$\begingroup\$ As I know SPI was being used for communication between 2 devices that are on the same PCB. So for a 70 cm distance and in a case with 3*24 V batteries and some contactors, I had a uncertanity that maybe SPI was not the best protocol to use for this project. \$\endgroup\$ Feb 12, 2019 at 10:23
  • 2
    \$\begingroup\$ @GünkutAğabeyoğlu You are right, using SPI between two PCBs is not very usual. However, your clock rate is very low. 70 cm distance shouldn't be an issue at 100 kbps. As you are free to design your communication protocol, you should of course add some checksum mechanism. Nevertheless I would prefer CAN, especially if your micros are running at 5V. In a housing > 70cm, does adding an 8 pin MCP2251 plus maybe some tiny passive components on your PCBs really cause space issues? \$\endgroup\$
    – mic
    Feb 12, 2019 at 11:18
  • \$\begingroup\$ @mic Thanks for the infor I will probably go for CAN-Bus since there are also 140Amp switches in the case that also scare me. I had PCB printed that is why I did not want to add transceiver but it seems like CAN is the best option for now. \$\endgroup\$ Feb 12, 2019 at 11:27
  • \$\begingroup\$ Use shielded twisted-pairs(3). Tie both ends of the shields to the PCB grounds. Tie the black-wire (you must have one of the TP wires be black, for this to work) to the Transmitter IC RTN right at the TX IC; ditto for the Receiver IC RTN. Then tie the various (3) white wires to the complete the 3 signal paths between Transmitter and Receiver IC on the two PCBs. [This assumes the PCBs are at the same potential.] \$\endgroup\$ Feb 12, 2019 at 17:58

2 Answers 2

2
\$\begingroup\$

The data speeds are very low so 60-70 cms is not much problem but SPI is generally used for on board communication. We had faced the same issue for 3V signals @ 2Mbps for 85cms off board communication, the solution to this was on the cost of a couple of GPIO pins for conversion of SPI signals to differential pair signals (RS485) using LTC2850, same at receivers end.

\$\endgroup\$
1
\$\begingroup\$

On an application I use Uart at 115kHz right out of the PIC over a distance of more than 1 meter without any issue, given the SPI is basically driven the same way, should work fine.

You can add 1k resistor both ends and protection diode for static if the cable needs to be disconnected.

As the comment say, make sure to tie the ground and for EMI you can use a shielded cable.

You can add a checksum in your communication protocol - just in case.

If you want to do it clean, CAN is quite a bit of an overkill for this purpose (It's a multi-point bus with a lot of overhead), you can simply use something like RS232 with a transceiver for point to point.

\$\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.