l3g4200d an�?² stm32 problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-01-05 1:28 PM
Hi! I have a board with L3G4200D gyroscope and STM32F103 mcu. Gyroscope is connected to mcu via SPI bus (SPI2 on mcu). But it's not working because of some strange things. Reading from gyroscope controll registers is working normally untill i try to write something. After writing to controll registers reading of any register gives 0xFF. I can't understand what's the problem. Guys, can you help me?
Here is my code Thanks for help!- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-01-05 3:34 PM
You need to be waiting on RXNE before raising the CS pin, TXE goes high as the first bit leaves the STM32, RXNE goes high as the LAST BIT LEAVES, and the last bit returned is received. Consider it as a TC (Transmit Complete) flag.
Pulling CS high early causes the slave chip to be confused, as it doesn't complete the transaction. This should be apparent if you scope the pins. Now you will need to do a ReadData to clear the RXNE bit first, ReadData just reads the DR registerUp vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2012-06-19 5:20 AM
can i have ur entire code? cause i'm dealing with lsm330dl now ,from now on , my spi read and write are working properly, but there is something wrong with the data output, maybe we can share our code to see whether we can help each other.
