How to use SPI and Interrupts on a serial DPM (sDPM)

SPI does not offer generic interrupt support. This is usually done via a separate interrupt inputs and must be synchronized with the handled in the SPI controller.
But SPI controller and the interrupt handling in the used operating system are unknown to the cifx/netX Toolkit.

Furthermore, SPI send and receive functions calls from the toolkit to the SPI controller must be locked against each other to make them undisruptable,
because SPI transfers and the netX sDPM (serial DPM) protocoll does not allow nested transfer calls.

The locking of SPI read / write functions is located in the in SerialDPMInterface.c module and handled by the OS_SpiLock() function (see OS_SPICustom.c).

For the netX interrupt state handling, the cifX/netX Toolkit offers a interrupt service handler function cifXTKitISRHandler() (located in cifXInterrupt.c).
But this function also needs to use the SPI read and write functions to access the sDPM.
Using the SPI read and write functions, at the same time, in an user application and the a physical interrupt function will end up a deadlock situation,
because active SPI transfer should not be disrupted and a physical ISR function should never be block inside the ISR.

This deadlock situation can be prevented, by moving the toolkit ISR/DSR functions into an application thread which is triggred by interrupt event, generated from the physical interrupt service of the operating system.


(warning)SPI and interrupt handling are also described in the cifX/netX Toolkit manual Version 12 / Chapter 3