Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPI clock acting weird #24

Closed
danieleff opened this issue Jun 11, 2017 · 4 comments
Closed

SPI clock acting weird #24

danieleff opened this issue Jun 11, 2017 · 4 comments

Comments

@danieleff
Copy link

I was trying Adafruit ILI9341, but was not working.
I think the following code is a simplified version of the problem:

void setup() {
  int cs = 2;
  SPI.begin();
  pinMode(cs, OUTPUT);
  digitalWrite(cs, HIGH);

  while(1) {
      SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE0));
      delay(100);
      digitalWrite(cs, LOW);
      SPI.transfer(0x01);
      digitalWrite(cs, HIGH);
      SPI.endTransaction();
      delay(100);
  }
}

With arduino UNO, I get the following:
image
With F746 discovery:
image
or ( with F407 always)
image
Logic analizer settings are the same.
Can you check if you get the same results?

@fpistm
Copy link
Member

fpistm commented Jun 11, 2017

Hi @danieleff ,

have you made those test with or without this fix?
#19

@danieleff
Copy link
Author

With that fix:

> git show
commit 055864fb16457cd45b638f48588b85477f0eb226
Merge: dadfba3 052443e
Author: Frederic Pillon <[email protected]>
Date:   Fri Jun 9 17:36:17 2017 +0200

(Actually does not compile on 407 disco, timer.c:466:22: error: 'RCC_PeriphCLKInitTypeDef {aka struct <anonymous>}' has no member named 'TIMPresSelection', but its another issue, I commented out)

@fpistm
Copy link
Member

fpistm commented Jun 12, 2017

I do not check yet, but seems as GPIO pull config issue.

@fpistm fpistm closed this as completed in 5f4cbdd Jun 15, 2017
@fpistm
Copy link
Member

fpistm commented Jun 15, 2017

Thanks @cparata
Pull setting on the SCK pin should be in PULLDOWN if the SPI polarity is LOW and in PULLUP if the SPI polarity is HIGH.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants