Skip to main content
Explorer
October 5, 2025
Solved

Does STM32F4 Discovery (Disc1) have a built-in MEMS sensor?

  • October 5, 2025
  • 3 replies
  • 462 views

Hi everyone :waving_hand:,

I’m currently working on a bare-metal project using the STM32F4 Discovery (Disc1) board and developing my code purely with CMSIS header files (no HAL or CubeMX).

I wanted to check if this board has any onboard MEMS sensors (like accelerometer or gyroscope) — similar to what some older STM32 Discovery boards include.

If a MEMS sensor is present:

What is the exact sensor part number?

Which communication interface does it use (I2C/SPI)?

Are there any reference manuals or example register-level code available to initialize and read data using CMSIS?


If not available, could you suggest a good external MEMS sensor (like MPU6050 or LIS3DH) that works well with STM32F4 boards for motion or tilt detection?

My goal is to implement tilt or motion detection completely in bare-metal C without HAL drivers.

Any guidance, datasheets, or example code snippets would be really appreciated :folded_hands:

Thanks in advance!

 

Best answer by STTwo-32

Hello @Core_dump and welcome to the ST Community.

To check what are the MEMS available on your  board, you can refer to the schematic pack and the bill of material of your board (check the revision on your board). Those ressources are available here. For the examples you can have a look at this demonstration example (it is based on HAL). I suggest you to follow it and referring also to the Datasheet of the MEMS you can develop your own code based on the register access method that you are using (there is no register level official examples).

PS: on the DK board you are using there is a MEMS 3-axis accelerometer connected using SPI to the MCU). You can find the exact reference on the readme file of the example I’ve attached.

Best Regards.

STTwo-32

 

3 replies

STTwo-32
STTwo-32Best answer
Technical Moderator
October 5, 2025

Hello @Core_dump and welcome to the ST Community.

To check what are the MEMS available on your  board, you can refer to the schematic pack and the bill of material of your board (check the revision on your board). Those ressources are available here. For the examples you can have a look at this demonstration example (it is based on HAL). I suggest you to follow it and referring also to the Datasheet of the MEMS you can develop your own code based on the register access method that you are using (there is no register level official examples).

PS: on the DK board you are using there is a MEMS 3-axis accelerometer connected using SPI to the MCU). You can find the exact reference on the readme file of the example I’ve attached.

Best Regards.

STTwo-32

 

Ozone
Principal
October 6, 2025

A quote from the user manual :

Ozone_0-1759727604149.png

So, yes.

My goal is to implement tilt or motion detection completely in bare-metal C without HAL drivers.

I suggest to get the "legacy" SPL-based firmware package and demo code, and strip it down to your needs. It should still be available for download on ST's site.
The F407 discovery came before "Cube/HAL", the SPL is much lighter in this regards, and much better tested than most current Cube code. I use the SPL for projects involving the F407 and similiar "old" MCUs myself.

Andrew Neil
Super User
October 6, 2025

As the others have said, all this information could be found in the board documentation.

 


@Core_dump wrote:

My goal is to implement tilt or motion detection completely in bare-metal C without HAL drivers.


In that case, you really need to get into the habit of studying documentation - that is key to bare-metal coding!

How To Interface Anything To Anything Else.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.