Closed u382514 closed 3 years ago
Hi Brandon, Thanks for digging in to this! Just one very quick thought... Do you have an SD card inserted? I'm guessing you don't. But if you do, you'll (probably) need to power it up too as it shares the SPI bus with the IMU. Cheers, Paul
Hey Paul! No, I don't have the SD card in it and I didn't seem to need it to read sensor data off the ICM using 1.2.1. I wanted to take it down to bare minimum and build back up to diagnose the issue. As you can see above with the 2.0.4 setup, it's quite a feat at the moment to get a sketch to compile. I 'think' the issue is related to CIPO because that's the only variable I've seem to be able to change that reproduces the problem but it could also very well be something deeper in 2.0.4. I'm hoping that if I can get past the 224/236 problem everything will be downhill from there!
Is there a way to test if CIPO has indeed been enabled after the code runs?
Thanks, Brandon
You might be able to see what is going on with an oscilloscope. I think it would need to be an oscilloscope though, a logic analyzer is unlikely to give you the full picture. You could insert a microSD Sniffer into the micro SD socket and access the CIPO signal on that? If you see the signal hitting 3.3V then you can be confident that the pull-up is enabled. All the best, Paul
I was able to get it up and running. I needed to 'kickstart' the SPI manually BEFORE running the enableCIPOPullup logic. essentially doing below:
SPI.begin();
SPI.beginTransaction(spisettings);
SPI.transfer(0x00);
SPI.endTransaction();
am_hal_gpio_pinconfig(6, cipoPinCfg);
Once I did that I got the correct 234 whoami value and was then able to configure the ICM-20948 and read sensor data. I'm not sure why I need the kickstart here using 2.0.4 when I didn't need to do that on 1.2.1. I attempted to go down that rabbit hole and got lost. Moving forward!
Thanks!
Subject of the issue
I know it's a 2.0.4 issue again and we know 2.0.4 isn't mature yet, but hear me out! I'm attempting to get the basic 234 WhoAmI result from the ICM-20948 chip. I noticed on OLA on 1.2.1 it will read 224 if the CIPO is not enabled and will give the proper 234 result if the CIPO IS enabled. I'm assuming this is by design but have no idea why or how.
In 2.0.4, not matter how I configure the CIPO enable logic, I always get the 224 reading and cannot get past it. I'm posting the issue here as I'm sure you folks are much more aware of the inner workings of the 'why' on this board.
Does anyone have any ideas on where to go from here?
Your workbench
Steps to reproduce
The sketch below is a fully working sketch. You should be able to put it in a sketch file and easily compile it under 1.2.1. With the little work above for 2.0.4 you should be able to get it to compile there just as easy without any changes to the sketch code.
Note: The CIPO enable logic will look a bit different just because I took out the middleman due to differences in Apollo versions (namely, no padMode). Although I took a more direct route, it's essentially the same path leading to the am_hal_gpio_pinconfig functon.
Expected behavior
Expected to get 234 when CIPO is enabled and 224 when it is disabled on both, 1.2.1 and 2.0.4 Apollo.
Actual behavior
1.2.1 works as expected, but 2.0.4 always reads 224.