M2M_T_SPI_RESULT m2m_spi_init(INT16 usif_num, INT16 mode, INT16 speed, INT16
*device)
Description: the function initializes the SPI port, which uses TX and RX lines provided by a dedicated serial port: SPI_MISO line is mapped onto TX, and SPI_MOSI line onto RX. The SPI port is configured as Master, the module provides the clock signal on the dedicate pin called SPI_CLK. In accordance with the used module, refer to document [2]/[5]/[7]/[9]/[10] to have information on SPI and serial ports.
Parameters:
usif_num: see the table below.
usif_num |
SPI mapped onto Serial Port: |
|
3 |
USIF1 |
Modem Serial Port 2 (Trace Port) |
mode: the SPI interface provides four modes of clock phase (CPHA) and clock polarity
(CPOL).
mode |
CPOL |
CPHA |
|
0 |
0 |
0 |
Data are sampled on the rising edge of the clock |
1 |
0 |
1 |
Data are sampled on the falling edge of the clock |
2 |
1 |
0 |
Data are sampled on the falling edge of the clock |
3 |
1 |
1 |
Data are sampled on the rising edge of the clock |
speed: the SPI interface provides four clock speed.
speed |
Clock [MHz] |
1 |
1,0 |
2 |
3,25 |
3 |
6,5 |
4 |
13 |
device: NULL
Return
value:
refer to
M2M_T_SPI_RESULT enum