SPI not transmitting

Hi,

after I've read all SPI forum posts trying to fix my problem, I've decided to write my own.

I want to transmit just one byte via SPI every second an see the Signal on my Oszi thats all. I wrote the most basic code to do so but its still not working. I'm just getting a high MOSI Signal and no clock. SS Pin is set as OUTPUT. Why isn't it working?

Thanks for your help!

Hardware:
Arduino Nano/Arduino Uno, both not working

Code:

#include <SPI.h>

uint8_t b = 125;

void setup() {
  pinMode(SS, OUTPUT);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);
  SPI.setClockDivider(SPI_CLOCK_DIV128);
  digitalWrite(SS, HIGH);

}

void loop() {
  delay(1000);
  digitalWrite(SS, LOW);
  SPI.transfer(b);
  digitalWrite(SS, HIGH);
}

Your codes are modified as follows; try these.

#include <SPI.h>

uint8_t b = 125;

void setup() 
{
   Serial.begin(9600);
  //pinMode(SS, OUTPUT);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SPI_MODE0);
  SPI.setClockDivider(SPI_CLOCK_DIV128);
  //digitalWrite(SS, HIGH);

}

void loop() 
{
  delay(1000);
  digitalWrite(SS, LOW);
  delay(1);
  byte x1 = SPI.transfer(b);
  Serial.println(x1, HEX);
  digitalWrite(SS, HIGH);
}

Thanks for the fast answer, unfortunately it still doenst work :frowning: .
The serial monitor shows zeros and sometimes 7D or FF, i guess thats because the MISO pin is floating.
MOSI is still constantly high
SCK is still constantly LOW
I guess the Arduino thinks that its a Slave somehow

Sorry guys it was my fault, the triggering of the Oszi was setup the wrong way... Problem solved