2018-11-05 12:52 PM
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);
}
2018-11-05 02:44 PM
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...
2018-11-20 04:10 PM
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