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 SS conflicts with 'gpio15 must be low during boot' #2466

Closed
supersjimmie opened this issue Aug 31, 2016 · 13 comments
Closed

SPI SS conflicts with 'gpio15 must be low during boot' #2466

supersjimmie opened this issue Aug 31, 2016 · 13 comments

Comments

@supersjimmie
Copy link

In common.h the I2C SS is specified as:
static const uint8_t SS = 15;
But for a normal boot, gpio15 must be pulled low.

When I attach an I2C device to MOSI, MISO, SCK and SS, how can I be certain the esp will still boot? (in my case it fails 'randomly')
Would a pulldown resistor on gpio15 be enough to fix this correctly? Or should I remove the device' SS at each boot?

@me-no-dev
Copy link
Collaborator

can not use a pulled down pin (GPIO15) for I2C ;) I2C can work only with pull-ups.

@me-no-dev
Copy link
Collaborator

MOSI, MISO, SCK and SS are SPI pins and if you use SS for slave select, you need to make sure that the salve is not pulling it up by pull-up.

@supersjimmie
Copy link
Author

supersjimmie commented Aug 31, 2016

BUMMER, Ment SPI, not I2C!

So what you are saying is that I cannot pull-down and SPI works with pull-up, but it should not be pulled-up for normal boot operation.... Now I am confused. :(

@supersjimmie
Copy link
Author

supersjimmie commented Aug 31, 2016

@me-no-dev the datasheet of my slave device says:
CC1101 is configured via a simple 4-wire SPI compatible interface (SI, SO, SCLK and CSn) where CC1101 is the slave.
...
The CSn pin must be kept low during transfers on the SPI bus.

So in my code I can say

pinMode(SS, OUTPUT);
digitalWrite(SS, LOW); // only set to HIGH when needed

But then still, if you are saying I need pull-up to make SPI work, how can I avoid a wrong boot-mode?
Both the esp and the slave are 'undefined' high or low if not pulled-up/down?

@supersjimmie supersjimmie changed the title I2C SS conflicts with 'gpio15 must be low during boot' SPI SS conflicts with 'gpio15 must be low during boot' Aug 31, 2016
@duncan-a
Copy link

The CC1101 is an SPI-bus device - it does not use the I2C-bus...

On 31 August 2016 at 15:52, supersjimmie notifications@github.com wrote:

@me-no-dev https://github.com/me-no-dev the datasheet of my slave
device says:
CC1101 is configured via a simple 4-wire SPI compatible interface (SI, SO,
SCLK and CSn) where CC1101 is the slave.
...
The CSn pin must be kept low during transfers on the SPI bus.

So in my code I can say

pinMode(SS, OUTPUT);
digitalWrite(SS, LOW); // only set to HIGH when needed

But then still, if you are saying I need pull-up to make I2C work, how can
I avoid a wrong boot-mode?
Both the esp and the slave are 'undefined' high or low if not
pulled-up/down?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#2466 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ALP8xVarR2SAiAFB0SJ6YpzBSJKNN3Ifks5qlYcsgaJpZM4JxnJc
.

@supersjimmie
Copy link
Author

supersjimmie commented Aug 31, 2016

@duncan-a / @me-no-dev I know, I changed my question because I meant SPI instead of I2C.

@me-no-dev
Copy link
Collaborator

having a pull-down on pin15 does not break SPI communication. You can in your code init the pin HIGH because that will happen after boot anyway.

@supersjimmie
Copy link
Author

Thanks @me-no-dev if that is possible then that is how I will start building.

@Maigre
Copy link

Maigre commented Sep 18, 2017

Hi, sorry for the bump,
but i am facing the same issue here:
i am plugging a wiz5500 to esp8266 via SPI,
and the ESP8266 fails to boot as soon as i plug the SS pin..
How do you handle that ? Should i wire a resistor from gpio15 to GND ?
SPI will still be working after that ?
Thanks !

@vicnevicne
Copy link
Contributor

vicnevicne commented Sep 18, 2017

Hi,
In my case, a pull down was not the solution because the master actively drove the SS up.
My solution was to use another pin as an "SS enable" (SS_EN), with 3 resistors and a transistor. On boot-up, SS_EN is in high impedance and guarantees that GPIO15 is kept down, but as soon as the setup() drives SS_EN high, the master SS signal is passed on to GPIO15.
The schematic is as follows:
ss_en
Probably a simpler circuit to do the job, but that's what I came up with and it works... feel free to comment or propose alternatives of course...

@Maigre
Copy link

Maigre commented Sep 20, 2017

Hi !
i end up wiring a 4.7k resistor between GPIO15 (D8) and GND.
The GPIO15 is used as SS without any trouble, and it boot correctly now.
Thanks for your help and detailed answer ! It pointed me in the good direction :)
Best,
Thomas

leon-anavi added a commit to AnaviTechnology/anavi-tag-manager that referenced this issue Jan 4, 2020
Remove unnecessary components inherited by ANAVI Gas Detector.
Add 4.7K resistor to GPIO15 of ESP8266. This way it is possible
to use this pin for SPI communicaiton after booting the board:
esp8266/Arduino#2466 (comment)

Signed-off-by: Leon Anavi <leon@anavi.org>
@shivapower1985
Copy link

Hi, sorry for the bump,
but i am facing the same issue here:
i am plugging a wiz5500 to esp8266 via SPI,
and the ESP8266 fails to boot as soon as i plug the SS pin..
How do you handle that ? Should i wire a resistor from gpio15 to GND ?
SPI will still be working after that ?
Thanks !

Hi Maigre,
First of all thanks for your suggestion to wire a resistor between GPIO15 and GND, and after hours of search I am able to upload my sketch with my CS pin connected at GPIO 15.
I want your help in connecting W5500 lite with ESP8266. I find difficulty in configuring DHCP. When I upload the sketch for setting the IP it throws "IP unset" and returns "0" for "Ethernet.begin(mac)".
my pin connections are,
W5500 lite - ESP8266

    V          -     3.3v
    G          -     GND
   SCK       -     D5
   MI         -     D6
   MO       -     D7
   CS         -     D8

Sketch
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//IPAddress ip(192,168,2,2);

void setup() {
Serial.begin(9600);

Ethernet.init(15);
pinMode(15, OUTPUT);
digitalWrite(15, LOW); // only set to HIGH when needed

Serial.print(Ethernet.begin(mac));

Ethernet.begin(mac);

Serial.println(Ethernet.localIP());
}

void loop() {
}

My OUTPUT:
0
(IP unset)

@shivapower1985
Copy link

Hi Maigre,
First of all thanks for your suggestion to wire a resistor between GPIO15 and GND, and after hours of search I am able to upload my sketch with my CS pin connected at GPIO 15.
I want your help in connecting W5500 lite with ESP8266. I find difficulty in configuring DHCP. When I upload the sketch for setting the IP it throws "IP unset" and returns "0" for "Ethernet.begin(mac)".
my pin connections are,
W5500 lite - ESP8266

    V          -     3.3v
    G          -     GND
   SCK       -     D5
   MI         -     D6
   MO       -     D7
   CS         -     D8

Sketch
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//IPAddress ip(192,168,2,2);

void setup() {
Serial.begin(9600);

Ethernet.init(15);
pinMode(15, OUTPUT);
digitalWrite(15, LOW); // only set to HIGH when needed

Serial.print(Ethernet.begin(mac));

Ethernet.begin(mac);

Serial.println(Ethernet.localIP());
}

void loop() {
}

My OUTPUT:
0
(IP unset)

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

6 participants