2018-01-04 04:18 AM
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 CSSPI1_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 #ais3624dq2018-01-04 06:12 AM
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.
2018-01-04 09:36 PM
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 ?
2018-01-05 10:39 AM
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?
2018-01-09 12:11 AM
i can see 0X0F request going out on MOSI pin and can see 0xFF incoming on MISO pin.
2018-01-09 12:12 AM
it is wired properly with all capacitors. do i have to do anything to interrupts pin
?
2018-01-10 09:38 AM
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
Make sure it is not in I2C mode.
Make sure the CS pin is low for the 16 clocks of the transaction.
2018-01-18 04:11 AM
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.