HAL_SPI_Transmit & HAL_SPI_Receive timing issue
- January 2, 2025
- 2 replies
- 621 views
Hi all,
I am currently working with the STEVAL-PROTEUS1 Board, which incorporates the STM32WB5MMG module and the IIS3DWB high-bandwidth accelerometer sensor, interfaced via SPI_1.
According to the IIS3DWB sensor datasheet, it supports a clock frequency of up to 10MHz and an Output Data Rate (ODR) of 26667Hz (37 microseconds).
My objective is to collect sensor data at an ODR of 26667Hz.
Here are the steps I have taken so far:
- Configured SPI_1 to 8MHz.
- Configured the sensor to generate an ODR interrupt, which is successfully triggering every 37 microseconds.
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 in blocking mode. I have also tried using non-blocking mode (DMA), but it is taking the same or more time.
Could anyone help me understand if the HAL function is supposed to take 42 microseconds, or if there might be an issue with my implementation?
Note: The M4 core is running at 64MHz and the M0 core at 32MHz.
Thank you in advance for your assistance!
