2020-12-17 05:52 PM
2020-12-21 03:57 AM
Hi @blian.1 ,
Please note that the SPI read command is performed with 16 clock pulses, so if you place in a loop the SPI single register reading command, you have to send the command for that register and wait the second 8-bit slot for the register value reading, maybe not sending bits during the second 8-bit slots, as performed in the second and third lines of your first picture, and as described in the datasheet, p. 46.
loop (
MOSI 86h MISO 00h
MOSI 00h MISO 6Ah
)
You can also use multiple byte read command by adding blocks of 8 clock pulses to the previous one, but you will read consecutive registers and not only the WHO_AM_I in this way.
-Eleon
2020-12-21 04:07 AM
Ps: for a specific implementation of IMU sensor SPI communication implementation on STM32F1 MCU family you can browse the STM32CubeF1 function pack, that contains a few examples related to sensors.
-Eleon