I already configured IO10 to IO13 for SPI connection on Edison by following this (section 11.7),
I did this for another SPI sensor and I have disconnected that sensor from the arduino expansion board. Not sure if this is related to the issue or not.
I also noticed the code assumes CSG connected to Arduino pin 9 and CSXM connected to Arduino pin 10. I think this is because the code is for the (DOF breakout, not the block,
I am using the 9DOF block. How can I make sure CSG connected to Arduino pin 9 and CSXM connected to Arduino pin 10?
As you can see in Re: Sparkfun boards help, the Arduino code for Sparkfun 9 DOF is not currently working. However in that same post you can find that there is a software that's actually working from the Linux side. Why don't you take a look at it?
Thanks for the reply!
I did make arduino code work with I2C interface by editing the hardware\intel\i686\variants\edison_fab_c\variant.h file and changing
#define LINUX_I2C_ADAPTER 1
You can find the discussion here: Re: Arduino Library for SparkFun Block 9 Degrees of Freedom
Now I want to try the SPI interface of the block. The arduino code seems to support both I2C and SPI, but I haven't figured out how to make SPI work.
Did you modify SJ8 and SJ9 on the 9DOF board? By default the board is hardwired to I2C. I think you need to cut both traces and add solder blobs to connect to SPI -- in addition to the code changes. I haven't actually tried this, but looking at the schematics, it seems like modifying the jumpers is required for SPI.
Thanks for the input! No, I didn't do that. I will try it after i get a hobby knife (hope that's the right tool to cut the traces). I will also ask Sparkfun support team to see if SJ8 and SJ9 are the only jumpers needs to be modified to switch between I2C and SPI.
Thanks again for the help!
I modified SJ8 and SJ9 on the 9DOF board by cutting both traces and add solder blobs to connect to SPI. I also did code change for LSM9DS0_Simple.ino sketch. I still get all the 0 values. Anything else should I check? BTW, I sent email to sparkfun support last week but haven't got any reply yet. Any input is highly appreciated!
G: 0.00, 0.00, 0.00
A: 0.00, 0.00, 0.00
M: 0.00, 0.00, 0.00
Pitch, Roll: 0.00, 0.00
Here is the output from setup(),
LSM9DS0 WHO_AM_I's returned: 0x0
Should be 0x49D4
Just got the following reply from Sparkfun (see below) and it looks like SJ8 and SJ9 are the right jumpers to modify.
Yeah, that sounds right. Just briefly looking at the silkscreen and Eagle schematic it says something about the MOSI and SCK pins. This matches what the description is talking about with the SPI connection on the 9DOF block:
"By default, the IMU is connected to the Edison through the I2C bus but it can be configured to use the SPI bus. "
Just cut the default trace with an XActo knife and add a solder blob from the center pad to the side of the SPI pads.
In perusing the forums, others have had problems getting SPI going at first, but there are definitely people who have had success.
Here's an example: Intel Edison Arduino Breakout SPI
after initializing the SPI library seemed to help. But I'm guessing here, having not used SPI on Edison myself.
FYI - Added pinMode(SS, OUTPUT); in setup() but still getting 0 values after that
uint16_t status = dof.begin();
I realized that I configured IO10 to IO13 for SPI connection on Edison by following this (section 11.7) for another SPI sensor which I don't want to use anymore,
Should I undo this configuration change to make the 9DOF block SPI work? If yes, any idea how to undo the change? Any input is welcome!
11.7 Configure IO10 through IO13 for SPI connectivity
To configure IO10 through IO13 for SPI connectivity, do the following:
enter the following commands in Linux:
# echo 111 > /sys/class/gpio/export
# echo 115 > /sys/class/gpio/export
# echo 114 > /sys/class/gpio/export
# echo 109 > /sys/class/gpio/export
# echo 263 > /sys/class/gpio/export
# echo 240 > /sys/class/gpio/export
# echo 262 > /sys/class/gpio/export
# echo 241 > /sys/class/gpio/export
# echo 242 > /sys/class/gpio/export
# echo 243 > /sys/class/gpio/export
# echo 258 > /sys/class/gpio/export
# echo 259 > /sys/class/gpio/export
# echo 260 > /sys/class/gpio/export
# echo 261 > /sys/class/gpio/export
# echo 226 > /sys/class/gpio/export
# echo 227 > /sys/class/gpio/export
# echo 228 > /sys/class/gpio/export
# echo 229 > /sys/class/gpio/export
# echo 214 > /sys/class/gpio/export
# echo low > /sys/class/gpio/gpio214/direction
# echo high > /sys/class/gpio/gpio263/direction
# echo high > /sys/class/gpio/gpio240/direction
# echo high > /sys/class/gpio/gpio262/direction
# echo high > /sys/class/gpio/gpio241/direction
# echo high > /sys/class/gpio/gpio242/direction
# echo high > /sys/class/gpio/gpio243/direction
# echo high > /sys/class/gpio/gpio258/direction
# echo high > /sys/class/gpio/gpio259/direction
# echo low > /sys/class/gpio/gpio260/direction
# echo high > /sys/class/gpio/gpio261/direction
# echo in > /sys/class/gpio/gpio226/direction
# echo in > /sys/class/gpio/gpio227/direction
# echo in > /sys/class/gpio/gpio228/direction
# echo in > /sys/class/gpio/gpio229/direction
# echo mode1 > /sys/kernel/debug/gpio_debug/gpio111/current_pinmux
# echo mode1 > /sys/kernel/debug/gpio_debug/gpio115/current_pinmux
# echo mode1 > /sys/kernel/debug/gpio_debug/gpio114/current_pinmux
# echo mode1 > /sys/kernel/debug/gpio_debug/gpio109/current_pinmux
# echo high > /sys/class/gpio/gpio214/direction
Are you using the Arduino BOB or the mini BOB? A lot of these commands are for setting up mux directions on the Arduino board which may not affect the Sparkfun signals (but some changes you make on the Arduino BOB do affect the signals going to the Sparkfun block (like, for example, you can mux I2C2 and 12C6 together).
That being said, since you are using Arduino code, dof.begin() is likely setting some of these for you, anyway.
Thanks for the reply! I am using Arduino BOB, not the mini BOB.
FYI - I have reinstalled the image on Edison to make sure IO10 to 13 won’t be set for SPI, but still couldn’t make the 9DOF block work with SPI