AmirRezaHariri / ICM20948_STM32Library

SparkFun ICM20948 Library ported for STM32 MCUs with DMP
11 stars 2 forks source link

Does this library support SPI? #2

Open Nv7-GitHub opened 6 months ago

Nv7-GitHub commented 6 months ago

The example code only uses I2C

AmirRezaHariri commented 6 months ago

The example code only uses I2C

As you can see in ICM_20948.cpp i have edited ICM_20948_write_I2C, ICM_20948_read_I2C and ICM_20948_I2C::begin() to make it work with STM32 interfaces (the code is originally for Arduino).

In the same manner, you can edit ICM_20948_write_SPI, ICM_20948_read_SPI and ICM_20948_SPI::begin() (which are commented), to make it work with SPI interfaces of STM32.

Nv7-GitHub commented 5 months ago

Sorry, I'm new to STM32 so I don't know how to do that. Does this library support I2C fast mode (400khz)? How fast could the main loop be while constantly polling the DMP in this mode?

AmirRezaHariri commented 5 months ago

You can config the MCU in Cube MX (or cube ide which has MX built in) to enable fast mode for I2C. This is also possible using the code.

If I'm not mistaken, you can get DMP data as fast as 225Hz, but it's best that you refer to the icm 20948 datasheet. I managed to get to 200+ on stm32f103.