2011-12-04 02:11 PM
Hello. I have troubles with connecting adxl345 to stm32f103vet6.
When I try to read a data from device, I always get '0'. For example:int16_vect3 myVec;
ADXL_GetACC(myVec);
///myVec.x now is '0', myVec.y=0,myVec.z=0I'm sure that I connect and initialize the accelerometer properly - http://pastebin.com/T4fuArEr #spi #stm32 #adxl3452011-12-04 02:56 PM
Be sure you enable the clocks for GPIOA and SPI1, before configuring the peripherals.
You initialize some pins for SPI2 Set the pins as AF_PP, the peripheral will control the direction/use based on 2wire and Master/Slave settings. /* Configure SPI1 pins: SCK, MISO and MOSI ----------------------------*/ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP; GPIO_Init(GPIOA, &GPIO_InitStructure);2011-12-05 03:15 AM
If I doing it how you say ADXL_SPI_Setup()!=Success
And now I can't initizalize, but few days ago all was be ok.2011-12-12 02:32 PM
I decided to use I2C connection and all is ok.