Connect accelerometer to stm32
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-04 2:11 PM
Posted on December 04, 2011 at 23:11
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 #adxl345
Labels:
- Labels:
-
SPI
This discussion is locked. Please start a new topic to ask your question.
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-04 2:56 PM
Posted on December 04, 2011 at 23:56
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);
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Up vote any posts that you find helpful, it shows what's working..
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-05 3:15 AM
Posted on December 05, 2011 at 12:15
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.Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2011-12-12 2:32 PM
Posted on December 12, 2011 at 23:32
I decided to use I2C connection and all is ok.
