summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorNick Brassel <nick@tzarc.org>2020-04-29 14:01:20 +1000
committerGitHub <noreply@github.com>2020-04-29 14:01:20 +1000
commitb17482c3fdca11788c0863465ed4a7e56a13d0f5 (patch)
tree83a36cc8f2a755dcbc2821fceea4d11e84501f28 /docs
parent5b4870c046fa81b5574904cd21e2d13da41cf2e4 (diff)
Add SPI master for ChibiOS/ARM. (#8779)
Diffstat (limited to 'docs')
-rw-r--r--docs/spi_driver.md19
1 files changed, 18 insertions, 1 deletions
diff --git a/docs/spi_driver.md b/docs/spi_driver.md
index e2b5b140b7..c170bf1dfc 100644
--- a/docs/spi_driver.md
+++ b/docs/spi_driver.md
@@ -18,7 +18,24 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu
## ChibiOS/ARM Configuration
-ARM support for this driver is not ready yet. Check back later!
+You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc.
+
+To enable SPI, modify your board's `halconf.h` to enable SPI - both `HAL_USE_SPI` and `SPI_USE_WAIT` should be `TRUE`, and `SPI_SELECT_MODE` should be `SPI_SELECT_MODE_PAD`.
+Then, modify your board's `mcuconf.h` to enable the SPI peripheral you've chosen -- in the case of using SPI2, modify `STM32_SPI_USE_SPI2` to be `TRUE`.
+
+As per the AVR configuration, you may select any other standard GPIO as a slave select pin, and can be supplied to `spi_start()`.
+
+Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
+
+`config.h` override | Description | Default Value
+----------------------------|---------------------------------------------------------------|--------------
+`#define SPI_DRIVER` | SPI peripheral to use - SPI1 => `SPID1`, SPI2 => `SPID2` etc. | `SPID2`
+`#define SPI_SCK_PIN` | The pin to use for the SCK | `B13`
+`#define SPI_SCK_PAL_MODE` | The alternate function mode for the SCK pin | `5`
+`#define SPI_MOSI_PIN` | The pin to use for the MOSI | `B15`
+`#define SPI_MOSI_PAL_MODE` | The alternate function mode for the MOSI pin | `5`
+`#define SPI_MISO_PIN` | The pin to use for the MISO | `B14`
+`#define SPI_MISO_PAL_MODE` | The alternate function mode for the MISO pin | `5`
## Functions