Skip to content

pins_arduino.h #7160

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
1 task done
wmarchewka opened this issue Aug 21, 2022 · 2 comments · Fixed by #7161
Closed
1 task done

pins_arduino.h #7160

wmarchewka opened this issue Aug 21, 2022 · 2 comments · Fixed by #7161
Assignees
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue

Comments

@wmarchewka
Copy link

Board

WT32-ETH01

Device Description

WT32-ETH01

Hardware Configuration

#define VSPI_MISO -1
#define VSPI_CS 12
#define VSPI_SCLK 14
#define VSPI_MOSI 15

Version

v2.0.4

IDE Name

Platformio

Operating System

Mac OS 11.6

Flash frequency

40Mhz

PSRAM enabled

yes

Upload speed

96100

Description

Code worked when Platformio Development environment is set to [env:esp32dev] but when changed to [env:wt32-eth01]
code fails with:

platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp: In member function 'void SPIClass::begin(int8_t, int8_t, int8_t, int8_t)':
/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:64:37: error: 'SCK' was not declared in this scope
_sck = (_spi_num == VSPI) ? SCK : 14;

It appears that the:
espressif/arduino-esp32/blob/master/variants/wt32-eth01/pins_arduino.h

Does not contain the same elements as the other library:
static const uint8_t SS = 5;
static const uint8_t MOSI = 23;
static const uint8_t MISO = 19;
static const uint8_t SCK = 18;

Sketch

#include <Arduino.h>
#include <SPI.h>

#define VSPI_MISO -1
#define VSPI_CS 12
#define VSPI_SCLK 14
#define VSPI_MOSI 15

SPIClass *vspi = NULL;

void setup(){
  vspi = new SPIClass(VSPI);                              //create spi
  vspi->begin(VSPI_SCLK, VSPI_MISO, VSPI_MOSI, VSPI_CS);  //SCLK, MISO, MOSI, SS
  pinMode(VSPI_CS, OUTPUT);                               //VSPI SS
  digitalWrite(VSPI_CS, HIGH);                            //pull ss high t 
}

void loop()
{
  delay(1);
}

Debug Message

platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp: In member function 'void SPIClass::begin(int8_t, int8_t, int8_t, int8_t)':
/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src/SPI.cpp:64:37: error: 'SCK' was not declared in this scope
         _sck = (_spi_num == VSPI) ? SCK : 14;

Other Steps to Reproduce

https://community.platformio.org/t/wt32-eth01-spi-issue/28132/2

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@wmarchewka wmarchewka added the Status: Awaiting triage Issue is waiting for triage label Aug 21, 2022
@SuGlider
Copy link
Collaborator

SuGlider commented Aug 21, 2022

@P-R-O-C-H-Y - I think that this is a case simillar to #6737

Actually, it lacks SPI pin definition in pins_arduino.h for wt32-eth01 board.
But we should think about a schema similar to HardwareSerial, where we check if RX1, TX1 are defined in pins_arduino.h, otherwise it just uses some default definition.

@VojtechBartoska VojtechBartoska added Status: Needs investigation We need to do some research before taking next steps on this issue and removed Status: Awaiting triage Issue is waiting for triage labels Aug 22, 2022
@P-R-O-C-H-Y
Copy link
Member

@wmarchewka The author of the board doesn't declare the default SPI pins. Adding the same pins as default ones for ESP32 to the pins_arduino.h can conflict with Ethernet pins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs investigation We need to do some research before taking next steps on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants