cancel
Showing results for 
Search instead for 
Did you mean: 

AIS3624DQ WHO_AM_I returning 0XFF

saket thool
Associate II
Posted on January 04, 2018 at 13:18

the following code i have written for STM32F103C8T6 for interfacing with AIS3624DQ accelerometer. But while checking , when i read register WHO_AM_I (0x0F) it should return me 0X32 default but it is returning me 0XFF. for any output register it is returning me the same value as 0xFF. please help in this. i know some thing is wrong but i am not getting it. 

thanks in advance. the code is as follows.

////////

unsigned int x=0;

void main()

{

GPIO_Digital_Output(&GPIOA_BASE, _GPIO_PINMASK_4); //chip select CS

SPI1_Init_Advanced(_SPI_FPCLK_DIV2, _SPI_MASTER | _SPI_16_BIT | _SPI_CLK_IDLE_HIGH | _SPI_FIRST_CLK_EDGE_TRANSITION | _SPI_MSB_FIRST | _SPI_SS_ENABLE | _SPI_SSM_ENABLE | _SPI_SSI_1, &_GPIO_MODULE_SPI1_PA567);

Delay_ms(100);

while(1)

{

GPIOA_ODR.B4=0; //chip select low

x=SPI1_Read(0X0F);

Delay_ms(10);

GPIOA_ODR.B4=1; //

//chip select high

}

}

#stm32f103c8t6 #acceleration #ais3624dq
7 REPLIES 7
Posted on January 04, 2018 at 15:12

Could also be that device is not wired up properly or not powered.

You should perhaps use a scope or logic analyzer and confirm the pins are functioning in the expected manner.

Not familiar with the library you're using, perhaps try with some of the SPL or HAL example code for SPI, making sure clocks and pins enabled. Do you enable the GPIOA and SPI1 clocks somewhere.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 05, 2018 at 05:36

Clock and Chip select pin is working as seen on RTO. what additional things i can check ?

any guide for HAL library for the same ?

Posted on January 05, 2018 at 18:39

So do you see the WHOAMI (0x0F) request going out and the data coming back? Do you see 0xFF coming back or 0x32 ?

If you see 0xFF you're going to have to examine what's going on with the AIS3624DQ in your design. Is it wired/powered correctly?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 09, 2018 at 08:11

i can see 0X0F request going out on MOSI pin and can see 0xFF incoming on MISO pin.

Posted on January 09, 2018 at 08:12

it is wired properly with all capacitors. do i have to do anything to interrupts pin 

?

Posted on January 10, 2018 at 17:38

You'd need to clock through a second byte to get response to the command.

The minimal circuit and signalling are described in the manual

http://www.st.com/content/ccc/resource/technical/document/datasheet/group1/90/87/ca/72/a8/3a/41/32/DM00141453/files/DM00141453.pdf/jcr:content/translations/en.DM00141453.pdf

 

Make sure it is not in I2C mode.

Make sure the CS pin is low for the 16 clocks of the transaction.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on January 18, 2018 at 12:11

thanks for replay. 

right now i have reached till acquiring x axis data from register. but is has enormous amount of noise in stationary position. but also i can see the minimum and maximum changes in xdata when i give motion to the accelerometer. I think some filtering part is not configured properly. please suggest something on this. also how much delay should i add in reading two register of x axis.