Skip to content

How can I change (lower) the SPI bitrate? #327

Answered by Andy2No
RudolfAtHome asked this question in Q&A
Discussion options

You must be logged in to vote

I haven't tried it with this core yet, but in standard Arduino, it works like this:

// include the SPI library:
#include <SPI.h>

// set pin 10 as the slave select for the device
const int slaveSelectPin = 10;  // There isn't one called that - it's CS, active low.  Can be any unused GPIO pin.

void setup() {
  // set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT);
  digitalWrite(slaveSelectPin,HIGH);

  // initialize SPI:
  SPI.begin();

  //SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE3)); // Pick a speed and mode, to suit the device

  SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE0)); // slow down
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RudolfAtHome
Comment options

Answer selected by earlephilhower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants