-
Notifications
You must be signed in to change notification settings - Fork 393
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
ESP32 compile error with arduino-esp32 v2.0.3-rc1 (error: 'esp32_gpioMux' was not declared in this scope) #112
Comments
I seem to be having the same issue. I tried to move to OneWireNG but DSTherm is pretty limited in what it can do and i could not get the DallasTemperature lib to work with it. |
OneWireNG and DallasTemperature works perfectly, what was your problem? If you got problem open issue in OneWireNG project |
Its working, perfectly now. The issue was being caused by another version of onewire that was lurking in my libraries. As soon as I huned it out and deleted it the error went away. |
We tested it on esp32 and it works with perfect timings on logic analyzer. |
same issue on my side: |
If possible, Please, verify that it works with Esp32s3 Dev Module using Version 2.0.3-RC1. I am unable to get it to function. |
If you got problem report it on OneWireNg project. |
@uzi18 OneWire is not working. No one here is interested if OneWireNG is working. |
I got a similar error on Platformio indicating that OneWire 2.3.6 is broken when being used with esp32-203: In function 'void directModeInput(uint32_t)': |
To be clear it is not a Arduino Core 2.0.3 issue. The problem is the external OneWire library. The library is not from espressif. So espressif is not responsible for. |
I am having the same problem today. I have one copy of OneWire, version 2.3.6 and it conflicts when I have the ESP32 TTGO LoRa32-OLED Board selected. The #include <OneWire.h> code verifies OK if there is an ESP8266 selected. If I delete the #include statement, the code verifies OK with the ESP32. |
For the previous comment: This was suggested on the Arduino Forum-- ESPRESSIF has recently released a new version of the ESP32 core for the ESP-IDF. That core is not compatible, yet, with the ESP32 Arduino Core. From the errors OneWire is using the ESP32 API directly. OneWire may need to be updated. |
But OneWireNG is compatible and works perfectly. |
+1 I, too, am having the compile issue. Downgrading to version 2.0.2 of the ESP32 Arduino core works as a temporary fix. |
uzi18, I have read the docs on OneWireNG at github and I can't see how to do the following very simple read/write on a designated pin:
} |
For the previous comment, that's one DS18B20 per pin and direct power. Real simple. What I don't see in the OneWireNG examples is how it is compatible with OneWire. If it is directly compatible, then the code in the previous comment should work without change. Is that true? The reason I wrote my own code to read the DS18B20 is that I have 20 remote units, but the Dallas library can take a second or so to do a read. I don't have the time to sit in the Dallas function 20 times reading the remotes, so my code (the first time through in each remote) gets garbage, but it starts the conversion. The second and subsequent passes, it reads good data and restarts the conversion process. This works really well with a Nano or Pro Mini. |
OK, I used the library manager to add OneWireNg. The #include statement seems to work, but using the statement "OneWire" doesn't create the expected read/write functions, so I don't know what "compatible" means. |
@drquark Use this OneWire version. It is a modified version of OneWire and does work with actual Arduino Esp32 core 2.0.3 |
OK, Jason2866, I'll give it a try. Thanks. I just downgraded to ESP32 core version 2.0.2 and that eliminated the #include <OneWire.h> error. |
include is the same, but try to uninstall OneWire lib - they can collide in Arduino IDE check also DSTemp example for code like above |
Please understand I am depending on the open source community to submit pull requests to maintain ESP32 defines. |
Using the ESP32 core version 2.0.2 and the current 2.3.6 version of OneWire, I'm uploading fine and reading the DS18B20s no sweat. |
But now you are fixed with old core |
Have done a version which is PR ready and should work. Since i have no possibility to test (for the next 4 weeks) give it a try and if ok please give me a feedback here and i will do the PR. |
@Jason2866 Thanks for this fix. I just tried with a DS18B20 and am seeing some strange behavior.
I will research about the boot mode, and if I make any progress will report back. |
Sorted. By simply replacing .pio\libdeps\m5stack-core2\OneWire\utilOneWire_direct_gpio.h with your new file from https://github.com/Jason2866/OneWire/tree/esp32_arduino_core2/util/utilOneWire_direct_gpio.h solved the problem. Thanks Jason PLATFORM: Espressif 32 (4.2.0) > M5Stack Core2
DallasTemperature @ 3.9.1 |
@Jason2866 - Thank you very much! I still need to perform some final testing, but so far my code now compiles and loads on to my ESP32-WROOM DevKit. |
This is issue is not related to the OneWire problem. You have a other problem here. |
PR #114 |
I've merged #114. For everyone following this issue and still using ESP32, please download the latest OneWire and reply here to confirm (or deny) this fully solves the problem. I am waiting for your feedback before publishing a new OneWire version which will make this fix available to everyone using the Arduino Library Manager. Please take a moment to test this latest code and let me know if it should be published as a release to the wider Arduino community? |
It works for me connecting to a DS18B20. Thanks. |
I just tested the latest version on an ESP8266 with 4 DS18B20 sensors attached to a single pin and it still works fine. (I know this change is for the ESP32, but always good to make sure other platforms are not impacted as well.) |
It's working on ESP32! |
Is there an ETA on when a new release containing this PR might be? I want to publish my repository that depends on the fix or if I need to add some documentation to describe a workaround. Tnx. |
2.3.7 released |
@PaulStoffregen @Jason2866 Thank you. |
Board
Esp32S2 Dev Module and Esp32S3 Dev Module
Device Description
NodeMcu-32S or Esp32-S3-DevKitC-1 v1.6
Testing with Dallas OneWire Temperature sensor
Hardware Configuration
GPIO 2 connected to Dallas Temperature sensor
Version
latest master
IDE Name
Arduino IDE 1.8.20
Operating System
Windows 10
Flash frequency
80 Mhz
PSRAM enabled
no
Upload speed
921600
Description:
I am getting an error while compiling sample/example code for Dallas Temperature sensor.
Steps to generate the error:
1- Load the code: File -> Examples -> Dallas Temperature -> Simple
2- verify / Compile
Compiler generates the following error:
OneWire_direct_gpio.h:191:38: error: 'esp32_gpioMux' was not declared in this scope ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;
It appears that "esp32_gpioMux" is no longer defined!!!
Sketch:
// Include the libraries we need
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/*
*/
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin();
}
/*
*/
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
Serial.print("Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperatures
Serial.println("DONE");
// After we got the temperatures, we can print them here.
// We use the function ByIndex, and as an example get the temperature from the first sensor only.
float tempC = sensors.getTempCByIndex(0);
// Check if reading was successful
if(tempC != DEVICE_DISCONNECTED_C)
{
Serial.print("Temperature for the device 1 (index 0) is: ");
Serial.println(tempC);
}
else
{
Serial.println("Error: Could not read temperature data");
}
}
Errors or Incorrect Output
Debug Message
In file included from C:\Users\eghav\AppData\Local\arduino15\packages\esp32\hardware\esp32\2.0.3-RC1\cores\esp32/Arduino.h:36,
from C:\Users\eghav\Documents\Arduino\libraries\OneWire\OneWire.cpp:142:
C:\Users\eghav\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeInput(uint32_t)':
C:\Users\eghav\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:191:38: error: 'esp32_gpioMux' was not declared in this scope
ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;
^~~~~~~~~~~~~
C:\Users\eghav\AppData\Local\arduino15\packages\esp32\hardware\esp32\2.0.3-RC1\cores\esp32/esp32-hal.h:73:47: note: in definition of macro 'ESP_REG'
#define ESP_REG(addr) *((volatile uint32_t *)(addr))
^~~~
C:\Users\eghav\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h: In function 'void directModeOutput(uint32_t)':
C:\Users\eghav\Documents\Arduino\libraries\OneWire\util/OneWire_direct_gpio.h:232:38: error: 'esp32_gpioMux' was not declared in this scope
ESP_REG(DR_REG_IO_MUX_BASE + esp32_gpioMux[pin].reg) = pinFunction;
^~~~~~~~~~~~~
C:\Users\eghav\AppData\Local\arduino15\packages\esp32\hardware\esp32\2.0.3-RC1\cores\esp32/esp32-hal.h:73:47: note: in definition of macro 'ESP_REG'
#define ESP_REG(addr) *((volatile uint32_t *)(addr))
^~~~
exit status 1
Error compiling for board ESP32S3 Dev Module.
The text was updated successfully, but these errors were encountered: