Board Node32s what pins are hardware serial default?

Hey guys I have an esp32-wroom-32ue and in the arduino IDE I use the board Node32s. I am trying read values from an IC that uses SPI comms, but there are two buses on the module the V and the H bus. I am using the H bus.

The IC on my board uses the MAX31865 chip, which uses SPI communication to report temperature readings. There is a prebuilt library for this IC made by Adafruit, but it just asks for the CS pin and defaults the MISO,CLK, and MOSI hardware pins. How do I know which of the 2 esp buses will be used?

Also say that this board is defaulting to the bus I am not using, is there a way to specify that I am using another hardware SPI bus? Also I will paste the example sketch from the Adafruit Max31865 library.

 interface
  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries. 
  BSD license, all text above must be included in any redistribution
 ****************************************************/

#include <Adafruit_MAX31865.h>

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(10, 11, 12, 13);
// use hardware SPI, just pass in the CS pin
//Adafruit_MAX31865 thermo = Adafruit_MAX31865(10);

// The value of the Rref resistor. Use 430.0 for PT100 and 4300.0 for PT1000
#define RREF      430.0
// The 'nominal' 0-degrees-C resistance of the sensor
// 100.0 for PT100, 1000.0 for PT1000
#define RNOMINAL  100.0

void setup() {
  Serial.begin(115200);
  Serial.println("Adafruit MAX31865 PT100 Sensor Test!");

  thermo.begin(MAX31865_3WIRE);  // set to 2WIRE or 4WIRE as necessary
}


void loop() {
  uint16_t rtd = thermo.readRTD();

  Serial.print("RTD value: "); Serial.println(rtd);
  float ratio = rtd;
  ratio /= 32768;
  Serial.print("Ratio = "); Serial.println(ratio,8);
  Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
  Serial.print("Temperature = "); Serial.println(thermo.temperature(RNOMINAL, RREF));

  // Check and print any faults
  uint8_t fault = thermo.readFault();
  if (fault) {
    Serial.print("Fault 0x"); Serial.println(fault, HEX);
    if (fault & MAX31865_FAULT_HIGHTHRESH) {
      Serial.println("RTD High Threshold");
    }
    if (fault & MAX31865_FAULT_LOWTHRESH) {
      Serial.println("RTD Low Threshold");
    }
    if (fault & MAX31865_FAULT_REFINLOW) {
      Serial.println("REFIN- > 0.85 x Bias");
    }
    if (fault & MAX31865_FAULT_REFINHIGH) {
      Serial.println("REFIN- < 0.85 x Bias - FORCE- open");
    }
    if (fault & MAX31865_FAULT_RTDINLOW) {
      Serial.println("RTDIN- < 0.85 x Bias - FORCE- open");
    }
    if (fault & MAX31865_FAULT_OVUV) {
      Serial.println("Under/Over voltage");
    }
    thermo.clearFault();
  }
  Serial.println();
  delay(1000);
}

Look in the IDE: File->examples->SPI->SPI_Multiple_Busses
and you will see lots of discussion about the V and H busses.

1 Like

In the case for Adafruit you should be fine with using the VSPI bus as default, no need to set pin numbers except CS, GPIO_NUM_5.

I would use the above format to set the library to use the HSPI bus.

You may find the need to instantiate the SPIClass library for the HSPI bus.

SPIClass SPIX(HSPI);

SPIX can be words of your own choosing.

1 Like

Hi @feynman137,

Are the SPI pins you are using these shown in this line of code you posted?

On your ESP32 model "esp32-wroom-32ue" the GPIOS
GPIO10 and GPIO11 cannot be used as regular GPIO.

"Both ESP32-WROOM-32D and ESP32-WROOM-32U integrate a 4 MB of external SPI flash. The integrated SPI flash is connected to GPIO6, GPIO7, GPIO8, GPIO9, GPIO10 and GPIO11. These six pins cannot be used as regular GPIOs. "
Ref:

Show the link to this library.

RV mineirin

I was able to get a temperature reading by doing as suggested by Idaho Walker and just listing out all of the SPI pins used.

@ruilviana the pins used in the code I posted were from the example in reality mine are as listed below. I have 3 sensors that I am trying to read with this set-up. Interestingly all are working except for the last group, which uses pin 35 as CS, this is likely an error on my part and not something due to functionality of the module but I need to verify.

MAX31865 Library

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(5,23,19,18)

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(32,23,19,18)

// Use software SPI: CS, DI, DO, CLK
Adafruit_MAX31865 thermo = Adafruit_MAX31865(35,23,19,18)

Correct.

The ESP32 has 2 I/O ports, portA and portB. portA is the first 32 pins, portB takes care of the rest of the pin numbers. portB pins, >32, are designed as inputs ONLY, for starters, lack pullups/downs, and are optimized for Analog inputs. See, API Reference - ESP32 - — ESP-IDF Programming Guide latest documentation (espressif.com) for more info. There is a way to make portB pins act like portA pins on the ESP32 S models but that involves using the ESP32 RTC API.

And note, The ESP32 supports 3 devices connected to each SPI bus.

1 Like

Okay, if I understand you correctly, this was a limitation of the module and not a soldering error. Looking at the documentation I see now that IOs>34 are input only. Thank you for pointing this out.

1 Like

For all models of the ESP32 up to S, all GPIO pins on portB are input only. Beginning with the S model the portB pins can be used as those on portA by using the ESP32 RTC API. When using the ESP32 RTC API on portB the portB pins will have all the functionality of portA pins. For me, as a regular ESP32 user, this is an important and welcomed change that allows me to extend the functionality of the ESP32 GPIO.