Skip to content

Emirhan-KURU/LIS3DSH_STM32F4

Repository files navigation

LIS3DSH STM32F4Discovery

Data can be received from the sensor in two different modes:

1- Normal Mode 2- FIFO Mode

In Normal Mode, data is received from the x, y and z axes at intervals determined by the selected initial (init) values.

In FIFO Mode, the sensor is operated for a short time, during this time the FIFO buffer is filled and the process is carried out in this way.

IOC Settings

Configured to spi1 full duplex and dma mode

image

Then opened CS pin (Output) and Interrupt pin (E0)

image

If data will be sent from uart, uart can be opened

Code

Necessary structure definitions are made

/* USER CODE BEGIN 0 */
LIS3DSH_InitTypeDef mySensor;
LIS3DSH_DataRaw DataRaw;
/* USER CODE END 0 */

than added init

  /* USER CODE BEGIN 2 */
  mySensor.SelectAxes = LIS3DSH_Select_XYZ_Axis;
  mySensor.BDU_select = LIS3DSH_BDU_data_continue;
  mySensor.OdrConfig  = LIS3DSH_ODR_1600_HZ;
  mySensor.FullScale  = LIS3DSH_FULLSCALE_16;
  mySensor.bandwidth  = LIS3DSH_BW_400_HZ;
  LIS3DSH_Init(&hspi1,&mySensor);
  /* USER CODE END 2 */

Modes

1- Normal Mode

 DataRaw = LIS3DSH_GetDataRaw();

2- FIFO Mode

HAL_Delay(750);
DataRaw = ReadFIFOData(&mySensor,&huart2);

Result

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published