Description
Round dataBits up to a whole number of wordBits-sized words and return the unused trailing bit count.
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.
Round dataBits up to a whole number of wordBits-sized words and return the unused trailing bit count.
When to use this tool
Use SPI Word Padding Bit Count when you need an explicit SPI mode or clock-budget component.
How to use the tool and how it works
- Enter dataBits, wordBits. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read words, padding. Use the output convention below.
Round dataBits up to a whole number of wordBits-sized words and return the unused trailing bit count.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| dataBits | Data Bits | Required. Safe integer; minimum 0. |
| wordBits | Word Bits | Required. Safe integer; minimum 1; maximum 32. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| words | Words | Required. Safe integer. |
| padding | Unused or added positions under the stated alignment rule. | Required. Safe integer. |
{
"input": {
"dataBits": 20,
"wordBits": 8
},
"output": {
"words": 3,
"padding": 4
}
} Limitations and assumptions
- The calculation does not pack bits, select bit order, or verify a device's supported word size.
- 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 Interword Idle Clock Count
Multiply idleSeconds by clockHz and round up or down according to roundUp.
- Microcontroller: DMA Element Count Vs Byte Count
Divide byteCount by bytesPerElement for completeElements and remainingBytes.