user7257: I am using SPI to communicate with a IMU device which is working perfectly, except the SPISpeed which is not being altered as it should:
unsigned int m_SPISpeed = 400000;
SPI.begin();
pinMode(m_SPISelect, OUTPUT);
m_SPISettings = SPISettings(m_SPISpeed, MSBFIRST, SPI_MODE0);
...
SPI.beginTransaction(m_SPISettings);
digitalWrite(m_SPISelect, LOW);
SPI.transfer(regAddr | 0x80);

Where m_SPISpeed is 400000. No matter what i set this value to it is always operating at 125000Hz.

user10794: As was pointed out in the question comments, your use of unsigned int is the problem. The prototype for SPISettings is:
SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) {

The comments in spi.h say:
// We find the fastest clock that is less than or equal to the
// given clock rate. The clock divider that results in clock_setting
// is 2 ^^ (clock_div + 1). If nothing is slow enough, we'll use the
// slowest (128 == 2 ^^ 7, so clock_div = 6).

So your SPI speed will be the processor speed divided by 128, which is 16 MHz divided by 128, being 125000 Hz, which is your observed result (since unsigned int cannot possibly hold more than 65535 on this platform).

7257: <p>I am using SPI to communicate with a IMU device which is working perfectly, except the SPISpeed which is not being altered as it should:</p>

<pre><code>unsigned int m_SPISpeed = 400000;
SPI.begin();
pinMode(m_SPISelect, OUTPUT);
m_SPISettings = SPISettings(m_SPISpeed, MSBFIRST, SPI_MODE0);
...
SPI.beginTransaction(m_SPISettings);
digitalWrite(m_SPISelect, LOW);
SPI.transfer(regAddr | 0x80);
</code></pre>

<p>Where <code>m_SPISpeed</code> is 400000. No matter what i set this value to it is always operating at <code>125000Hz</code>.</p>
 10794: <p>As was pointed out in the question comments, your use of <strong>unsigned int</strong> is the problem. The prototype for SPISettings is:</p>

<pre><code>SPISettings(uint32_t clock, uint8_t bitOrder, uint8_t dataMode) {
</code></pre>

<p>The comments in spi.h say:</p>

<pre><code>// We find the fastest clock that is less than or equal to the
// given clock rate. The clock divider that results in clock_setting
// is 2 ^^ (clock_div + 1). If nothing is slow enough, we'll use the
// slowest (128 == 2 ^^ 7, so clock_div = 6).
</code></pre>

<p>So your SPI speed will be the processor speed divided by 128, which is 16 MHz divided by 128, being 125000 Hz, which is your observed result (since unsigned int cannot possibly hold more than 65535 on this platform).</p>
