Skip to main content
RageLog
Associate
November 5, 2018
Question

STM32429ZI Dısc1 Gyro wrong data problem

  • November 5, 2018
  • 2 replies
  • 1498 views

I'm tring to write own L3GD20 library. I can read chip ID (but L3G sent to me ffd4 and its partially true). But I cannot read any axis of gyro. Partially gyro always sent to me FF or 00. I'm doing something wrong but I dont know what's wrong. How can I fix this.

L3GD20 header and c file is linked

and last main is :

InitL3GD20(sSPI5,sGPIOC,GPIO_Pin_1);
for(;;){
 //SetupCtrlReg1();
 ax = GetXYZValueFromL3GD20();
 SendStringUsart( USART2, "AxisX:\n\r\t");
 SendStringUsart( USART2, "\n\r");
 SendFloatUsart( USART2, (ax.AxisX*8.75)/1000);
 SendStringUsart( USART2, "\n\r");
 _delay_ms(50);
 if(CheckL3GD20())
 {
 GPIO_SetBits(GPIOG,GPIO_Pin_13);
 GPIO_ResetBits(GPIOG,GPIO_Pin_14);
 }
 else
 {
 GPIO_SetBits(GPIOG,GPIO_Pin_14);
 GPIO_ResetBits(GPIOG,GPIO_Pin_13);
 
 }

This topic has been closed for replies.

2 replies

T J
Senior III
November 5, 2018

can you show us the SPI_I2S_SendData ? it is likely your issue..

FFD4 is showing you the 16bit mode didn't stick...

I used hand written SPI routines, they work very well...

RageLog
RageLogAuthor
Associate
November 21, 2018

You are right. The problem is sending 16 bit data. I receive dummy data and real data dummy data. ! send 2 times 8 bit data. The device send me first dummy data and 2'nd times send me real data