Sparkfun icm_20948 spi connection to uno r4 minima returning wrong id

Hi

I have seen similar threads but my scenario is a little different.

I am using the ICM 20948 mounted to a generic prototyping shield and the SPI connections wires soldered to the correct pins. CS is pin 2. The shield is installed on a UNO R4 Minima and has been working fine.

I just removed the SparkFun SD module that was on I2C, and replaced it with an Adafruit 254 SD module on SPI. I have used this module before and have it wired with CS on pin 10.

Now when I run my sketch the initialization of the ICM 20948 says "Wrong ID".

I can only guess there is some collision in the libraries or how SPI is getting shared. Unfortunately I don't know enough about that to figure out what the problem could be.

I am hoping I don't have to remove the SPI SD module and use a QWIIC one. This ICM 20948 has caused me no end of problems.

Thanks in advance for any help with this.

Curly_bracket

SD card modules are notorious for not sharing the SPI bus properly. Use I2C to talk to the IMU and the problem should go away.

I've never had any problems with the ICM_20948 and I2C. It seems to be rock solid.

I am starting to realize these things are usually not fully thought out and are incompatible.

I have similar issues with a GPS data logger shield that will not work with any other modules so its kind of useless.

Your idea of separating the SD card communication from the ICM makes sense.

With the ICM on SPI I am getting about 2500 readings per second which I need to capture the min/max values at high frequency. I2C is too slow for that.

Those six (6) min/max values get written to the SD card only once per second. That could be on I2C but I think last time I experimented with that it was taking ~200 milliseconds to save the data every second. That was causing me to miss 20% of the accelerometer measurements. This is why I switched to the Adafruit 254 SD module because it is SPI. I really wish that library was compatible and/or someone that got it working with the ICM (also on SPI) would share any secrets to getting it to work.

Hopefully the QWIIC SD module I have will share nicely.

Alternatively I think I could store the data in memory until the accelerometer detects zero motion, and at that time dump the memory to the SD card. I'd probably run out of memory though.

Thank you for helping

Curly_bracket

these things are usually not fully thought out and are incompatible.

Actually, they have been thought out very well, and are compatible. But the manufacturers of hobby modules very often don't pay attention the rules, or make design and manufacturing mistakes. You cannot trust the cheap modules from China to be reliable, and obey standard conventions.

Sounds like you open the SD card file, write a few bytes, and close it again, which is a common beginner mistake. Not only is that very slow, the process also dramatically increases the SD card power consumption and error rate.

I understand but I am only dealing with genuine Arduino UNOs, Sparkfun and Adafruit boards. No no-name modules. Also I am not repeatedly closing the file. I am either syncing or flushing depending on the module/library.

Is there a more reliable SD module I should be looking at?

This combination would not reliably open and write any data:

  • SparkFun 20948 9-Axis motion tracker (SPI, CS pin 2) and
  • SparkFun 15164 OpenLog SD (I2C).

And this combination just gives the "Wrong ID" warning:

  • SparkFun 20948 9-Axis motion tracker (SPI, CS pin 2) and
  • Adafruit ADA254 MicroSD Card (SPI. CS pin 10)

Is there something that can be coded to define which SPI module is on which CS pin? I am guessing but that is my only hope because diving into the libraries is beyond me.

Thanks

Curly_bracket

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.