RFduino, microSD shield, and LSM9DS0

Hello All!

I am currently working on a datalogging project that involves taking data from the LSM9DS0 and writing it to an SD card. I have successfully done this before on a SF Redboard, but this time around I have been asked to do it on an RFduino.

I can get the LSM9DS0 to connect to the RFduino okay, and I have been able to get the RFduino to write to an SD card okay, but I have found that the RFduino seemingly cannot take data from the LSM9DS0 and write it to an SD card.

I know that the microSD shield uses SPI on pins 3, 4, 5, and 6, and currently I have the LSM9DS0 setup for I2C on pins 5 and 6 (RFduino equivalent of SCL and SDA). Bitbanging the LSM9DS0 to other unused pins yields the same results. Almost always, I cannot get anything to write after the LSM9DS0 is initialized, which is to say after the function (as used):

uint16_t status = dof.begin(dof.G_SCALE_245dps, dof.A_SCALE_6G, dof.M_SCALE_2GS);

Does anyone have any experience with this sort of a setup or any ideas to work around this? If I can get anything to write to the SD card after this line of code, I would be all set. I would rather not have to switch to SPI for the LSM9DS0 if I don’t have to.

Hello again!

I just wanted to let everyone know that I did figure it out. I incorrectly bit banged to the LSM9DS0 the first time (it has to be done inside the library rather than outside), and as soon as I corrected that error it worked fine. I bit banged the I2C connection to pins 1 and 2 using Wire.beginOnPin(), which would interfere with output to the serial monitor (pins 0 and 1), but I had no choice considering that I only had three pins open and needed two. Fortunately I don’t need the serial monitor!

Hello,

I was wondering if you had any hints or tricks for using the LSM9DS0 with the RFduino. I’ve attached pin 5 to SCL and 6 to SDA, and am using the basic Sparkfun example sketch unedited. The code does not compile when I select the RFduino board, but does when I select another board, like an UNO. It seems related to the SPI settings, even though I am using I2C. Any thoughts our help would be very appreciated!

Here is the error message I get:

/Users/…/libraries/LSM9DS0/src/SFE_LSM9DS0.cpp: In member function ‘void LSM9DS0::initSPI()’:

/Users/…/libraries/LSM9DS0/src/SFE_LSM9DS0.cpp:593:22: error: ‘SPI_CLOCK_DIV4’ was not declared in this scope

SPI.setClockDivider(SPI_CLOCK_DIV4);

^

Error compiling.