cancel
Showing results for 
Search instead for 
Did you mean: 

SPI setting speed is too low.

KKIM.6
Senior II

Hi, I'm testing a custom STM32WB09TEF7TR board.

 

To communicate with the analog front end, I need to use SPI.

However, SPI communication requires 17 us setting time, which means around 60 kHz.

This speed is very slow.

So, the Initiation of SPI becomes the bottleneck of the speed of the overall system.

 

So, I wonder if there is anything I missed.

Below is the oscilloscope result for the SCLK (yellow) MOSI (green) and MISO (blue) CS (pink) pins, respectively.

After the CS pin reset, around 17 us are required to start SPI transmission.

scope_1.png

 

 My code for this function is below.

 

void spi_read_write(void)

{

GPIOA->BSRR = GPIO_BSRR_BR9; // Reset CS_pin

HAL_SPI_TransmitReceive_DMA(&hspi3, SPI_tx_DMA, SPI_rx_DMA, 5);

HAL_Delay(1);

GPIOA->BSRR = GPIO_BSRR_BS9; // Set CS_pin

}

 

 

2 REPLIES 2
TDK
Guru

HAL takes a bit to get started. To speed it up, you can switch to the Release configuration at the expense of some debugging functionality. You can also increase the chip clock speed. Otherwise you will need to write your own driver.

 

There are a variety of ways to get fast communication between devices. Consider circular DMA triggered by a timer.

If you feel a post has answered your question, please click "Accept as Solution".

@TDK wrote:

There are a variety of ways to get fast communication between devices. Consider circular DMA triggered by a timer.


Do you mean that we can put multiple SPI requests before the previous SPI communication ends using a timer interrupt?