cancel
Showing results for 
Search instead for 
Did you mean: 

STM32429ZI Dısc1 Gyro wrong data problem

RageLog
Associate

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);
 
        }

2 REPLIES 2
T J
Lead

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...

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