1

I am probing the SPI Clock pin 13 with my analog discovery 2. Nothing else is connected. The clock signal is there but it rises over time. (see picture) Here is my code:

#include <SPI.h>
void setup() {
  // put your setup code here, to run once:
  SPI.begin();
  SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE0));
  pinMode(8, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(8,LOW);
  SPI.transfer(0xF7);
  SPI.transfer(0xFF);
  digitalWrite(8,HIGH);
  delay(500);

}

What do you think is causing this? Thanks enter image description here

3
  • SPI Clock pin 13... of... an UNO?
    – timemage
    Commented Dec 5, 2020 at 1:08
  • Which Arduino board you are using? BTW, not related to your issue but for the proper use of SPI bus, move your ` SPI.beginTransaction(SPISettings(100000, MSBFIRST, SPI_MODE0));` to the loop before the data transfer, and close your SPI transfer with SPI.endTransaction(). Also, SS pin by default is set to pin 10, and automatically set to OUTPUT when you call SPI.begin().
    – hcheung
    Commented Dec 5, 2020 at 1:31
  • 2
    Looks like a hardware problem. I tried your code, and my scope shows a very steady square wave. Commented Dec 5, 2020 at 10:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.