1
\$\begingroup\$

I have 2 microcontrollers - one is S32K118 and other is S32K142. Both are 64 pins. S32K1xx datasheet

I need communication between the Microcontrollers in SPI Configuration.

Suppose the microcontroller supports 2 LPSPI modules, say LPSPI0, LPSPI1, LPSPI2.

For that, I need to connect the LPSPI0 module pins from one microcontroller to the LPSPI0 module pins in the other microcontroller, right?

Or it doesn't matter if the SPI communication between one microcontroller and the another microcontroller takes places on different SPI modules, like say LPSPI0 in 1st and LPSPI1 in another microcontroller? or LPSPI1 in 1st controller and LPSPI2 in the second controller?

And what about the chip select pin? Which module should I select for the chip select in SPI communication between the microcontrollers? Why are they 2 modules for chip select? Like, which should I choose based on which will act as the master microcontroller initiating the SPI communication and which microcontroller will act as the slave. enter image description here

This SPI Communcation is only between the 2 microcontrollers. Please explain to clear this confusion. Stuck here.

Any recommendations?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

It does not matter which SPI module you use, so you can connect SPI0 of one microcontroller to SPI1 of the other. The SPI modules (like any others) are independent of each other.

The main reason there are multiple SPI's is to connect two devices (each with their own SPI controller), or to have a more flexible configuration. Mostly pins are having multiple functions, and by using SPI0, maybe UART1 does not work as they share pins, so you can use SPI1.

For the chip select pins, if you use SPI1, you should use CS1. On some microcontrollers I thought they can be any pin, but with the ones you use it seems to be hard-wired.

\$\endgroup\$
4
  • \$\begingroup\$ Thank you for the answer. Could you please explain the chip select answer with reference to the master-slave configuration between the microcontrollers \$\endgroup\$
    – user220456
    Commented Jun 19, 2020 at 11:40
  • \$\begingroup\$ Normally you use CS (chip select) when you connect e.g. two slaves to one master, to 'select' the slave. In your case there is only one slave, so probably you can connect it to GND (low is active). \$\endgroup\$ Commented Jun 19, 2020 at 12:03
  • \$\begingroup\$ Thank you for the answer \$\endgroup\$
    – user220456
    Commented Jun 19, 2020 at 12:04
  • \$\begingroup\$ Good luck with your project \$\endgroup\$ Commented Jun 19, 2020 at 23:58

Your Answer

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