Calling pinMode causes reset / hex dump - help needed.
Posted: Sun May 15, 2016 10:14 am
I'm using a Witty / GizWits module and just started with Arduino. I'm trying to read temp/humidity with a DHT22 sensor. I've got working circuitry on a breadboard which is fine with NodeMCU/Lua code and I'm trying to convert over to using Arduino.
Using the following code, when I try to set a GPIO to be input to read the DHT, it resets / reboots the ESP module (I'm using Serial Monitor to watch it) and I also get a hex dump...
The first time I upload / run the code I get the following and the code loop just stops...
If I then press the reset button on the GizWits daughter board it goes into a proper repeating loop but each time I get the same as above as well as a hex dump.
If I remove the line...
I've even disconnected the DHT circuitry completely but just using pinMode seems to be causing problems and I don't understand why.
Cheers,
Brian
Using the following code, when I try to set a GPIO to be input to read the DHT, it resets / reboots the ESP module (I'm using Serial Monitor to watch it) and I also get a hex dump...
Code: Select all
void getDhtSensorData() {
Serial.println("\ngetDhtSensorData() entered...");
pinMode(DHT_DATA_PIN, INPUT);
/*
Other code removed for clarity - the above line causes the reboot
*/
Serial.println("Exiting getDhtSensorData()...");
}
void getSensorData() {
Serial.println("getSensorData() entered...");
getDhtSensorData();
// getBmpSensorData();
Serial.println("Exiting getSensorData()...");
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
delay(5000);
Serial.begin(115200);
Serial.println("\n\nStarting loop()...");
Serial.println("Calling getSensorData()...");
getSensorData();
}
The first time I upload / run the code I get the following and the code loop just stops...
Code: Select all
0x0f
csum 0x0f
~ld
Starting loop()...
Calling getSensorData()...
getSensorData() entered...
getDhtSensorData() entered...
Exiting getDhtSensorData()...
Exiting getSensorData()...
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
If I then press the reset button on the GizWits daughter board it goes into a proper repeating loop but each time I get the same as above as well as a hex dump.
If I remove the line...
Code: Select all
...altogether then I get a proper loop without errors or hex dump. pinMode(DHT_DATA_PIN, INPUT);
I've even disconnected the DHT circuitry completely but just using pinMode seems to be causing problems and I don't understand why.
Cheers,
Brian