I am new to the STM32 platform and as such I am playing around with sensors to gain some experience. I am using Atollic Lite and CubeMX to ease the learning curve.
I am having a problem communicating over SPI with an MPU-9250 IMU - All I want to do right now is read the WHO_AM_I register and as such I am using the HAL_SPI_Transmit(), HAL_SPI_Receive() and HAL_SPI_TransmitReceive() functions.
- The first clock burst is a HAL_SPI_Transmit() to write data.
- The second and third clock bursts is a HAL_SPI_Transmit() and HAL_SPI_Receive() to read a registers data.
- The fourth and fifth clock bursts are a HAL_SPI_TransmitReceive() to read the same register data as in the previous burst.
As you can see, there is no response on the MISO line when data requests are made. This is my problem and for the life of me I cannot find the issue. I have a feeling is is a configuration issue that I can't see because of lack of experience.
Here are extracts from the MPU-9250 data sheets:
Attached below are the contents of my main.c file containing the initialization of the clock, the GPIO's and SPI.
If any one can see my mistake, help would be greatly appreciated! If you need more info, please don't hesitate to ask.