cancel
Showing results for 
Search instead for 
Did you mean: 

How to access built in E-Compass in STM32 Discovery board (the one with F411 MCU)

KShar
Associate

I need to know how to take the magnetic sensor data from the built in sensor in the discovery board. I'm using CubeMX to generate the basic configuration code and i'm also using HAL library for programming the MCU in Embedded C. All I need is just to read and store the sensor data into some variables.

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi @KShar​ , don't think there is a plug-play version of E-Compass library for the discovery kit. So I suggest you to start from the X-CUBE-MEMS1 library package, which is however designed for the STM32 Nucleo development board. You can refer to the UM2225 app note, where the function:

void MotionEC_Run(MEC_input_t *data_in, MEC_output_t *data_out)

is described. This function gets the sensor data into the variable *data_in and returns the calculated values in the *data_out variable. Regards

Ozone
Lead

The F303 discovery board came with an e-compass demo firmware.

Eleon BORLINI
ST Employee

​Don't know if it's better to start from a STM32F3 Discovery FW or STM32F4 Nucleo FW...