Low Power Serial Peripheral Interface (LPSPI) Peripheral Driver.
The LPSPI driver allows communication on an SPI bus using the LPSPI module in the S32K1xx processors.
In order to use the LPSPI driver it must be first initialized in either master or slave mode, using functions LPSPI_DRV_MasterInit() or LPSPI_DRV_SlaveInit(). Once initialized, it cannot be initialized again for the same LPSPI module instance until it is de-initialized, using LPSPI_DRV_MasterDeinit() or LPSPI_DRV_SlaveDeinit(). Different LPSPI module instances can function independently of each other.
In each mode (master/slave) are available two types of transfers: blocking and non-blocking. The functions which initiate blocking transfers will configure the time out for transmission. If time expires LPSPI_MasterTransferBlocking/LPSPI_SlaveTransferBlocking will return error and the transmission will be aborted.
Depending on frame size receive and transmit buffers must be aligned as is presented in the next table:
Bits/frame | less or equal with 8 | between 9 and 16 | more than 16 |
---|---|---|---|
Alignment | 1 byte | 2 bytes | 4 bytes |
This alignment requirements should be taken into consideration when "transferByteCount" is configured. For a better understanding these are some examples of how to calculate the right value to "transferByteCount":
Bits/frame | number of frames | bytes per frame | transferByteCount |
---|---|---|---|
8 | 10 | 1 | 10 |
10 | 10 | 2 | 20 |
24 | 10 | 4 | 40 |
32 | 10 | 4 | 40 |
40 | 10 | 8 | 80 |
64 | 10 | 8 | 80 |
Modules | |
LPSPI Driver | |
Low Power Serial Peripheral Interface Peripheral Driver. | |