From e989c486685dce95b8354523262afd5b090d9361 Mon Sep 17 00:00:00 2001 From: Mohammed Mubeen Date: Fri, 21 May 2021 16:27:13 +0530 Subject: [PATCH] Added information on limitation of asynchronous SPI at high speeds(MHz ranges) --- targets/TARGET_STM/README.md | 11 +++++++++++ targets/TARGET_STM/stm_spi_api.c | 1 + 2 files changed, 12 insertions(+) diff --git a/targets/TARGET_STM/README.md b/targets/TARGET_STM/README.md index d86835f2de..4805b917ac 100644 --- a/targets/TARGET_STM/README.md +++ b/targets/TARGET_STM/README.md @@ -406,6 +406,17 @@ Option is also to define your own `HAL_ETH_MspInit` function, you then have to add **USE_USER_DEFINED_HAL_ETH_MSPINIT** macro. +### Asynchronous SPI limitation + +The current Asynchronous SPI implementation will not be able to support high speeds (MHz Range). +The maximum speed supported depends on +- core operating frequency +- depth of SPI FIFOs (if available). + +For application that require optimized maximum performance, the recommendation is to implement the DMA-based SPI transfer. +The SPI DMA transfer support shall be implemented on a case-by-case based on below example +https://github.com/ABOSTM/mbed-os/tree/I2C_SPI_DMA_IMPLEMENTATION_FOR_STM32L4 + ## Mbed OS Wiki pages diff --git a/targets/TARGET_STM/stm_spi_api.c b/targets/TARGET_STM/stm_spi_api.c index 2c891635e4..187e11bd02 100644 --- a/targets/TARGET_STM/stm_spi_api.c +++ b/targets/TARGET_STM/stm_spi_api.c @@ -1034,6 +1034,7 @@ static int spi_master_start_asynch_transfer(spi_t *obj, transfer_type_t transfer } // asynchronous API +// DMA support for SPI is currently not supported, hence asynchronous SPI does not support high speeds(MHZ range) void spi_master_transfer(spi_t *obj, const void *tx, size_t tx_length, void *rx, size_t rx_length, uint8_t bit_width, uint32_t handler, uint32_t event, DMAUsage hint) { struct spi_s *spiobj = SPI_S(obj);