Skip to content

Incorrect 'SS' pin assignment, variant file for Adafruit ESP32 Feather Board' ? #1586

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

Closed
mrwgx3 opened this issue Jul 3, 2018 · 4 comments
Closed

Comments

@mrwgx3
Copy link

mrwgx3 commented Jul 3, 2018

Basic Infos

Hardware

Adafruit HUZZAH32 - ESP32 Feather Board
https://www.adafruit.com/product/3405

Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards
https://www.adafruit.com/product/2922

Adafruit Ultimate GPS FeatherWing
https://www.adafruit.com/product/3133

FeatherWing Tripler Mini Kit - Prototyping Add-on For Feathers
https://www.adafruit.com/product/3417

OS, IDE, and Commit

OS:       Windows 10 Professional
IDE:      1.8.5
COMMIT?:  via 'git branch -v'
          * master b855eb2 * arduino-esp32 release mgmt. update (#1557)

Settings in IDE

Module:            Adafruit ESP32 Feather
CPU Frequency:     80Mhz  
Core Debug Level:  None

Description

While bringing up the forementioned hardware assembly, my colleague and I found we could not compile the 'CardInfo' example sketch contained within the Arduino 'SD' library:

Arduino: 1.8.5 (Windows 10), Board: "Adafruit ESP32 Feather, 80MHz, 921600, None"
CardInfo:27: error: 'Sd2Card' does not name a type
 Sd2Card card;
...
...

Pressing onward, we next tried the 'SD_Test.ino' example sketch within the SD(esp32) library. The sketch compiled OK, but when ran produced a 'Card Mount Failed' message. Suspecting an incorrect SD card chip-select assignment, we next looked at the 'pins_arduino.h' variant file defined for the 'ESP32 Feather' board:

static const uint8_t SS = 2;

The Adafruit website for the RTC/SD board identifies GPIO pin 33 as the required pin, and changing the variant file's SS pin definition to this value resolved the issue.

Is the 'SS=33' assignment for the RTC/SD/ESP32 feather board combination a once-only assignment, or can the change be made permanent within the variant file?

Copy Author: @ladyada

@me-no-dev
Copy link
Member

It works either way :) but since we are talking about a wing, it makes no sense to define this in the board's pin definition.
In your code you should use SD.begin(33) to mount SD :)

Oh and the original Arduino SD library does not work here.

@mrwgx3
Copy link
Author

mrwgx3 commented Jul 4, 2018

Thanks @me-no-dev for your comments. Copying @ladyada ...

Oh and the original Arduino SD library does not work here.

We were just following the instructions given us on the Adafruit website to verify card functioning. See 'Get Card Info' section on this webpage

It works either way :) but since we are talking about a wing, it makes no
sense to define this in the board's pin definition.

After studying the schematics for the wings supporting an SD card, I agree with you; the SD_CS pin jumps around. The current SS definition given in the variant file (GPIO2), however, happens to be a no-connect at the ESP32 processor. This would be the pin I'd pick to "do no harm", but it guarantees the example sketches 'SD_Test.ino' and 'SD_time.ino' won't function with the ESP32 Feather as coded.

In your code you should use SD.begin(33) to mount SD :)

That would be one way to get 'SD_Test.ino' and 'SD_time.ino' working again:

#define   mySDSS   SS      // Default, change as required
...
    if (!SD.begin( mySDSS )) {
        Serial.println("Card Mount Failed");
        return;
}

Another alternative would be for Adafruit to write an 'CardInfo' sketch for the ESP32.

@me-no-dev
Copy link
Member

While it made sense to use the standard SD lib on ESP8266, it does not make much sense to do it on ESP32 (we have more integrated file system, sdmmc and more). If "GetCardInfo" is an issue, then maybe yes, writing a compatible sketch is a good idea.
If SS is defined as IO2 in the feather definitions and that pin is not broken out, then sure it's not a bad idea to be changed to a pin that is actually exposed.

@mrwgx3
Copy link
Author

mrwgx3 commented Jul 13, 2018

While it made sense to use the standard SD lib on ESP8266, it does not make much
sense to do it on ESP32 (we have more integrated file system, sdmmc and more).
If "GetCardInfo" is an issue, then maybe yes, writing a compatible sketch is a good idea.
If SS is defined as IO2 in the feather definitions and that pin is not broken out, then
sure it's not a bad idea to be changed to a pin that is actually exposed.

@ladyada,
Let me know about any changes you want to make to the 'pins_arduino.h' variant file for the feather-esp32 board (SS = 33,for example). Thnks

mcwhittemore added a commit to mcwhittemore/arduino-esp32 that referenced this issue Jan 18, 2019
Pin 2 is not found on the [Adafruit docs](https://learn.adafruit.com/adafruit-huzzah32-esp32-feather) for this board and 33 was suggested in espressif#1586 as a fix. I've tried this locally on my board and it is working correctly.
me-no-dev pushed a commit that referenced this issue Jan 22, 2019
Pin 2 is not found on the [Adafruit docs](https://learn.adafruit.com/adafruit-huzzah32-esp32-feather) for this board and 33 was suggested in #1586 as a fix. I've tried this locally on my board and it is working correctly.
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