Skip to content

SPI "SS" pin #18

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

Open
smuehlst opened this issue Nov 30, 2019 · 4 comments
Open

SPI "SS" pin #18

smuehlst opened this issue Nov 30, 2019 · 4 comments

Comments

@smuehlst
Copy link

I'm trying out the SPI library from the current master branch (as of commit e7e1d8a) with the Arduino RFID Library for MFRC522, and the firstcompilation error that comes up is that there is no SS pin is defined.

Apparently each Arduino implementation should declare a SS define that refers to the default pin to be used for the "Slave Select" signal. See https://www.arduino.cc/en/Reference/SPI.

@phillowcompiler
Copy link

I think you can use any pin.
but,PB12 is used for TF_SS.
PB0,1 is for LCD on Longan nano.
so example, if you select PB11(B11) for SS, you would write :

SPIClass SPI(PB15, PB14, PB13, PB11);

@smuehlst
Copy link
Author

smuehlst commented Dec 1, 2019

@phillowcompiler It is clear to me that more or less any pin can be used for the Slave Select signal in my own code.

The issue is that the Arduino RFID Library for MFRC522 that depends on SPI expects the SS pin to be defined after including the SPI.h header:

https://github.com/miguelbalboa/rfid/blob/b7d7f3e572af6cfd78722f2bd693097019ec55ff/src/MFRC522.cpp#L16

/**
 * Constructor.
 */
MFRC522::MFRC522(): MFRC522(SS, UINT8_MAX) { // SS is defined in pins_arduino.h, UINT8_MAX means there is no connection from Arduino to MFRC522's reset and power down input
} // End constructor

@phillowcompiler
Copy link

I see😃
If so, can you try to modify "plarformio.ini"?

https://docs.platformio.org/en/latest/projectconf/section_env_build.html

@smuehlst
Copy link
Author

smuehlst commented Dec 2, 2019

If so, can you try to modify "plarformio.ini"?

Yes, I could do that, but my primary goal was to report this problem so it hopefully will be fixed sooner or later before an official release. An implementation of the Arduino SPI library will be useless or difficult to use if it doesn't implement the features that are expected by existing code...

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