I have a very similar requirement to this question, except I’m interfacing with an external MCU instead of an FPGA. As with the linked question, the MCU produces a high volume of measurement data, which it then needs to send to the Apalis.
The aim is to use either SPI or QSPI for this interface. I’m using a UART interface between the MCU and the Apalis for low-speed data exchange (configuration data, commands, etc.), so the SPI/QSPI interface can be used solely for the high volume measurement data. This also means the SPI/QSPI interface can be unidirectional.
The issue I’m facing is regarding the Master/Slave configuration of the interface. It makes sense (as pointed out in the linked question) for the MCU to be the Master, as it is the only device sending data. However, I understand that while supported on the later kernels, using Linux as a high-speed SPI Slave is an unusual use case. In addition to this, the MCU only supports QSPI Master mode, so if I were to use QSPI (which would be ideal given the increased bits per clock), I would have to implement a QSPI Slave process under Linux.
As such, here are my perceived options, for which I’d very much appreciate some input and/or recommendation:
- MCU as SPI Master and Linux as SPI Slave. Limited to 40Mbit/s (as per Apalis iMX8 datasheet).
- MCU as SPI Slave and Linux as SPI Master. Option 1: additional ‘data ready’ line output from MCU which initiates a transfer from the Linux Master when the MCU toggles the line. Limited to 60Mbit/s (as per Apalis iMX8 datasheet).
- MCU as SPI Slave and Linux as SPI Master. Option 2: additional ‘data ready’ line output from MCU which causes a perpetual SPI transfer from the Apalis (i.e. continuous ‘dummy’ writes from the Master) as long as the ‘data ready’ line is asserted.
- MCU as QSPI Master and Linux as QSPI Slave. Unsure of maximum bitrate. Is this possible at the hardware level? I believe it should be possible within Linux, but I’m not sure about the hardware SPI controller on the Apalis.
Any comments on the above would be greatly appreciated. Note that I’ve used an ethernet-based process in the past, but found the overhead of the ethernet stack on the MCU to be too large. For similar reasons I’m not looking to use USB, and the MCU doesn’t have a PCI-E interface. As such, the highest throughput, lowest overhead interface should be SPI/QSPI.