Skip to content

Commit 1d30511

Browse files
committed
SPI defined/undefined behaviour update
1 parent 769e9ca commit 1d30511

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/design-documents/hal/0000-spi-overhaul.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ void spi_free(spi_t *obj);
163163
- if `ssel` is `NC` the hal implementation ignores this pin.
164164
- if `ssel` is not `NC` then the hal implementation owns the pin and its management.
165165
- When managed by the hal implementation, `ssel` is always considered active low.
166+
- When managed by the hal implementation, `ssel` must be asserted for the whole duration of the spi transmission.
167+
- When managed by the hal implementation, the delay from the chip select assert to the first clock edge must be at least half spi clock period.
168+
- When managed by the hal implementation, the delay from the last clock edge to the chip select de-assert to must be at least half spi clock period.
169+
- If hardware can not handle all `ssel` related requirements, then device capabilities should indicate that `ssel` cannot be managed by hardware.
166170
- When the hardware supports the half-duplex (3-wire) mode, if `miso` (exclusive) or `mosi` is missing in any function that expects pins, the bus is assumed to be half-duplex.
167171
- `spi_free()` resets the pins to their default state.
168172
- `spi_free()` disables the peripheral clock.
@@ -178,7 +182,6 @@ void spi_free(spi_t *obj);
178182
- `spi_frequency()` sets the frequency to use during the transfer.
179183
- `spi_frequency()` returns the actual frequency that will be used.
180184
- `spi_frequency()` updates the baud rate generator leaving other configurations unchanged.
181-
- `spi_init()`, `spi_frequency()` and `spi_format()` must be called at least once each before initiating any transfer.
182185
- `spi_transfer()` :
183186
- writes `tx_len` symbols to the bus.
184187
- reads `rx_len` symbols from the bus.
@@ -227,6 +230,7 @@ void spi_free(spi_t *obj);
227230
- Passing an invalid pointer as `handler` to `spi_transfer_async`.
228231
- Calling `spi_transfer_async_abort()` while no async transfer is being processed (no transfer or a synchronous transfer).
229232
- In half-duplex mode, any mechanism (if any is present) to detect or prevent collision is implementation defined.
233+
- Initiating any transfer after `spi_init()` but before both the frequency and format have been set with `spi_frequency()` and `spi_format()`
230234
231235
### Updated flow
232236
The IRQ flow has slightly changed. In the new API the flow is as follow :

0 commit comments

Comments
 (0)