cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_SPI_Transmit & HAL_SPI_Receive timing issue

sai_sankar_rao_R
Associate II

Hi all,

I am working on the STEVAL-PROTEUS1 Board, which features the STM32WB5MMG module and the IIS3DWB high bandwidth accelerometer sensor interfaced via SPI_1.

According to the IIS3DWB sensor datasheet, it supports up to 10MHz (CLK) and an ODR of 26667Hz (37 microseconds).

My objective is to collect sensor data at an ODR of 26667Hz.

Here are the steps I've taken so far:

  1. Configured SPI_1 to 8MHz.
  2. Configured the sensor to generate an ODR interrupt, which is successfully triggering every 37 microseconds.
  3. The issue arises when collecting data (6 bytes) from the sensor, which is taking 42 microseconds. Ideally, this should not exceed 10 microseconds using HAL functions.

Could anyone help me understand if the HAL function is supposed to take 42 microseconds, or if I might be doing something wrong?

Note: The M4 core is running at 64MHz and the M0 core at 32MHz.

Thanks in advance!

1 REPLY 1
gbm
Lead III

Use DMA for SPI - "fire and forget" is much more efficient than interrupt-driven SPI.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice