The SPI interface is composed by 4 lines:
- MOSI: Master Output - Slave Input
- MISO: Master Input - Slave Output
- CLK: Clock
- SS: Slave Select
In case of the Edison, we have the following lines:
- SPI_2_TXD: Transmit data
- SPI_2_RXD: Receive data
- SPI_2_CLK: Clock
- SPI_2_FS0: Slave Select (or Chip Select)
So if the Edison is the slave device, the directions should be the following:
- SPI_2_TXD: Output
- SPI_2_RXD: Input
- SPI_2_CLK: Input (The master device controls this signal)
- SPI_2_FS0: Input (The master device controls this signal)
However, I haven't configured the Edison as SPI slave and if I'm not mistaken, the SPI interface can be configured only as SPI master. There is a thread about using the Edison as SPI slave: Intel Edison SPI (SSP) Slave Example Code?. As you can see in the thread, the way to use Edison as SPI slave was to emulate a SPI port through software using GPIOs to emulate the SPI signals.
I hope you find this information useful.
Edison does not have the true SPI slave function?
Can you tell me the port setting of GP115, GP144, GP109 and GP110?
For example When edison operates in SPI slave, SPI_2_CLK and SPI_2_FS0 will be input.
Is the port setting okay below?
# echo mode1 > /sys/kernel/debug/gpio_debug/gpio109/current_pinmux
# echo mode1 > /sys/kernel/debug/gpio_debug/gpio110/current_pinmux
Will GP109 and GP110 be output?
(Isn't there the SPI slave example code yet?)
According to the Compute Module Hardware Guide for Boards and Kits, the SPI pins have a fixed direction when they are configured to work as SPI, and these directions correspond to the SPI Master device, so it cannot be configured to work as SPI Slave.
Regarding the port setting, yes that port setting is correct. The IO pins should be configured to mode1 for SPI functionality. I recommend you to check the following document; at the end there is an example of the port setting in order to use the SPI: Intel® Edison Kit for Arduino* Hardware Guide for Boards and Kits
On the other hand, as I said the SPI interface works only when the Edison is configured as Master. For SPI Slave applications you would have to emulate the interface through software programming general IOs to work as SPI IOs as suggested in here: Intel Edison SPI (SSP) Slave Example Code?. But let me check, just to be sure, if the SPI can't be configured as SPI Slave. I'll confirm it as soon as possible.
Additionally, there aren't code examples for SPI Slave functionality.
However, it's written "slave mode" in "Table 23" of "4.6 SPI interface" of "Intel Edison Compute Module Hardware Guide".
And it's written "SPI slave AC specification" in "4.6.2" of "Intel Edison Compute Module Hardware Guide".
I saw this and had thought that Edison has the true SPI slave function.
Are they specifications when it emulate the interface through software programming general IOs to work as SPI Slave?
I'm checking about the SPI Slave configuration. I'll post the information I'm able to find as soon as possible.
I apologize for the delay in my response. I've confirmed that the SPI Slave mode is not supported on Edison. The documentation will be updated to avoid confusions about the SPI Slave mode.
If you want to use the Edison as SPI Slave device, then as I mentioned above, you will have to emulate the SPI interface through software using GPIOs for the SPI pins.
Thank you for your reply.