Description
Use CPOL to choose the leading edge and CPHA to select the leading or trailing sampling edge.
SPI clock polarity determines idle level and the first transition; clock phase determines which edge samples data. Word and idle budgets describe separate parts of the transfer.
Use CPOL to choose the leading edge and CPHA to select the leading or trailing sampling edge.
When to use this tool
Use SPI Idle Level Sample Sign when you need an explicit SPI mode or clock-budget component.
How to use the tool and how it works
- Enter cpol, cpha, edge. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read idleLevel, sampleEdge, samplesOnGivenEdge. Inspect samplesOnGivenEdge before interpreting the associated values.
Use CPOL to choose the leading edge and CPHA to select the leading or trailing sampling edge. Return idleLevel and whether edge equals that sampleEdge.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| cpol | Cpol | Required. Safe integer; minimum 0; maximum 1. |
| cpha | Cpha | Required. Safe integer; minimum 0; maximum 1. |
| edge | Edge | Required. Text; one of "rising", "falling"; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| idleLevel | Idle Level | Required. Safe integer. |
| sampleEdge | Sample Edge | Required. Text; maximum UTF-16 length 8192. |
| samplesOnGivenEdge | Samples On Given Edge | Required. Boolean. |
{
"input": {
"cpol": 0,
"cpha": 0,
"edge": "rising"
},
"output": {
"idleLevel": 0,
"sampleEdge": "rising",
"samplesOnGivenEdge": true
}
} Limitations and assumptions
- This decodes the supplied mode without measuring timing or verifying a peripheral's requirements.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Compare both devices' timing requirements and verify the actual chip-select and clock waveform.
References
Similar or alternative tools
- SPI Cpha First Edge Action Token
Map CPOL zero to a rising first edge and one to falling.
- Microcontroller: SPI Clock Edge Number Label
Return the idle level, leading edge, sampling and shifting edge numbers, and mode = 2 × clockPolarity + clockPhase.