SPI issues with MCP2515

I am using an Arduino Uno and a Sparkfun CanBus shield to hopefully interface with my car. I have been bang my head on the keyboard trying to get the MCP2515 properly initialised over the SPI bus.

I am initialising the SPI bus like this:

SPI.begin();
SPI.setDataMode(SPI_MODE0);
SPI.setClockDivider(SPI_CLOCK_DIV4);
SPI.setBitOrder(MSBFIRST);

After I write to the CANCTRL register, setting it to Normal(0b0000111) mode, I try to read back CANSTAT to complete the mode change. You will see from my logic analyser the read command and register on MOSI but the value is also returned on MOSI instead of MISO. I'm not sure why this is happening. Any help is much appreciated.

Please post your code.

Read this before posting a programming question

Ok, I cleaned up my code and simplified it removing the functions from the class to make it easier to troubleshoot over a forum. I am trying to set the MCP2515 to NORMAL mode and it doesn't get set. The datasheet specifies that you must write to the CANCTRL register and then read back the value from CANSTAT to finalize the change to the register.

Here is the Write over SPI:

And the Read of CANSTAT:

Here is my code: https://docs.google.com/file/d/0B85DGEE4zI89X21VOUZ1WTlMRkU/edit?usp=sharing

Thanks!

Not sure why the screenshots didn't post.

Write to CANCTRL

https://docs.google.com/file/d/0B85DGEE4zI89X21VOUZ1WTlMRkU/edit?usp=sharing

Read from CANSTAT