ESP32 multiple SPI Max31865

marius_sch_priv
Posts: 8
Joined: Wed Jul 01, 2020 6:51 am

ESP32 multiple SPI Max31865

Postby marius_sch_priv » Wed Jul 01, 2020 7:00 am

Hey together,

I really hope you can help me. I am developing software for an ESP32 DevKit V1. There are connected several Max31865 (exactly 8) to read data from the temperature sensor attached.
I've to poll those values in a given time.
So I've tried to use the following library:

https://github.com/jamieparkinson/ESP32-MAX31865

My understanding is, that if I need to get 2 SPI connections working I've to generate two objects of class Max31865 and so on.
So my code is the following:

Code: Select all

#define PIN_NUM_MISO 12
#define PIN_NUM_MOSI 13
#define PIN_NUM_CLK 14

// Starting with 1, because of the labels on the device.

Max31865 device_1 = Max31865(PIN_NUM_MISO, PIN_NUM_MOSI, PIN_NUM_CLK, 13);
Max31865 device_2 = Max31865(PIN_NUM_MISO, PIN_NUM_MOSI, PIN_NUM_CLK, 14);

    max31865_config_t tempConfig = {};
    tempConfig.autoConversion = true;
    tempConfig.vbias = true;
    tempConfig.filter = Max31865Filter::Hz60;
    tempConfig.nWires = Max31865NWires::Four;
    // max31865_rtd_config_t rtdConfig = {};
    // rtdConfig.nominal = 100.0f;
    // rtdConfig.ref = 430.0f;

    ESP_ERROR_CHECK(device_1.begin(tempConfig));
    ESP_ERROR_CHECK(device_2.begin(tempConfig));
If im doing so, im getting the following error:
E (952) spi: spi_bus_initialize(462): SPI bus already initialized.
E (952) Max31865: Error initialising SPI bus: ESP_ERR_INVALID_STATE

The error only occurs while calling the "begin"-Function on a device.

Please help me, am I missing out on something?

Thanks in advance!

Who is online

Users browsing this forum: No registered users and 140 guests