SPI group

This group defines all used Serial Peripheral Interface (SPI) interfaces.

Each SPI interface is a sub group with the SPI name as the group name.

"SPI": {
"encoder_spi": {
"pad_sck": "PA5",
"pad_miso": "PA6",
"pad_mosi": "PA7",
"pad_ncs": "PA15",
"peripheral" : "SPI0",
"role": "master",
"communication_mode": "duplex",
"frame_format": "motorola",
"clock_polarity": "idle_low",
"clock_phase": "sample_on_leading_edge",
"bit_order": "msb_first",
"baud_rate": "10 MHz",
}
}

pad_sck

Serial Clock.

type: String

pad_mosi

“Master Out Slave In” data signal.

type: String

pad_miso

“Master In Slave Out” data signal.

type: String

pad_ncs

Chip Select signal (Low active).

type: String

peripheral

name of the SPI peripheral to use.

type: String

role

Is either master(host) or slave(device).

type: enum

default: master

communication_mode

Describes the communication. Possible values are:

duplex : the traditional mode using MISO and MOSI to transmit and receive at the same time.

half-duplex : meaning the same wire between master and slave is used for both directions.

receive-only : send line is not used

send-only : receive Line is not used.

type: enum

default: duplex

frame_format

Describes the communication. Possible values are:

motorola : the “normal” SPI.

ti :

type: enum

default: motorola

clock_polarity

Also often called CPOL. Describes the communication. Possible values are:

idle_low

idle_high

type: enum

default: idle_low

clock_phase

Also often called CPHA. Describes the communication. Possible values are:

sample_on_leading_edge : samples the data on the edge from idle value to non-idle value.

sample_on_trailinging_edge : samples the data on the edge from non-idle value to idle value.

type: enum

default: sample_on_leading_edge

SPI Mode

Sometimes the documentation talks about a SPI Mode with the value of 0 to 3. This mode maps to the phase and polarity as described in the following table:

Mode	CPOL	CPHA	description
0	0	0	clock: idle_low, phase: sample_on_leading_edge
1	0	1	clock: idle_low, phase: sample_on_trailing_edge
2	1	0	clock: idle_high, phase: sample_on_leading_edge
3	1	1	clock: idle_high, phase: sample_on_trailing_edge

bit_order

Describes the communication. Possible values are:

msb_first : most significant bit first (bits on the line : 76543210 )

lsb_first : least significant bit first (bits on the line: 01234567 )

type: enum

default: msb_first

baud_rate

Is the number of bits per second exchanged on the data lines. Expressed as frequency of the clock line.

type: int (Hz)