cancel
Showing results for 
Search instead for 
Did you mean: 

i3g4250d - Getting same XYZAngRate value on every read

PKupp.1
Associate

Hi,

I have a i3g4250d sensor chip on our custom board with STM32G474 MCU.

I have used the below driver

github.com STMicroelectronics stm32-i3g4250d

for reading the sensor chip registers through SPI interface

I am able to read "WHO_AM_I_ADDR" register without any issue that confirms my SPI interface is fine and communicating with sensor chip

but

when I read XYZ values I always get the same value irrespective of sensor position.

My sensor init configurations are

CTRL_REG1 = 0x3F

CTRL_REG4 = 0x10

When I read the STATUS_REG, the first read shows 0xFF and consecutive reads always shows 0x00

What could be the problem.

PS: I have a Accelero meter sensor chip lsm303agr on the same board configured with I2C interface which is working properly.

Thank You

Prabhu M K

3 REPLIES 3
Eleon BORLINI
ST Employee

Hi Prabhu M K @PKupp.1​ ,

do you see any particular issue in the SPI oscilloscope patterns? Are you using SPI 4 wires?

-Eleon

PKupp.1
Associate

Hi Eleon,

I got another board assembled.

In this i get an different issue. I get random XYZ values even though the board is stationery.

STATUS_REG reads 0xFF and 0xB3 on every alternative reads.

Below my SPI configuration, I am using 4 wire.

SPI Clock speed 5.3125 Mhz

  /* USER CODE BEGIN SPI1_Init 1 */
  hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
  /* USER CODE END SPI1_Init 1 */
  hspi1.Instance = SPI1;
  hspi1.Init.Mode = SPI_MODE_MASTER;
  hspi1.Init.Direction = SPI_DIRECTION_2LINES;
  hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
  hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
  hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
  hspi1.Init.NSS = SPI_NSS_SOFT;
  hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
  hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
  hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
  hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
  hspi1.Init.CRCPolynomial = 7;
  hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
  hspi1.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;

Regards,

Prabhu M K

swati
Associate II

Hi Prabhu M K @PKupp.1​ ,

Have you got the answer of the above problem, because i am also facing the same issue with STM32F411VET6 and sensor is the same I3G4250D.