PaulStoffregen / CapacitiveSensor

Detect touch or proximity by capacitve sensing
http://www.pjrc.com/teensy/td_libs_CapacitiveSensor.html
387 stars 143 forks source link

Exception 29 on ESP8266-12e #6

Closed s00500 closed 8 years ago

s00500 commented 9 years ago

Hi I'm getting an Exception (29) on the esp8266-12E (NodeMCU DevBoard v1.0 "Amica") Here is the error:

Exception (29):
epc1=0x40201e82 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000008 depc=0x00000000

ctx: cont 
sp: 3ffe9b60 end: 3ffe9d30 offset: 01a0

>>>stack>>>
3ffe9d00:  3fffdc20 000000fa 3ffe9d54 40201cf4  
3ffe9d10:  3fffdc20 00000000 3ffe9d54 4020184a  
3ffe9d20:  00000000 00000000 3ffe8d10 40100118  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x42
csum 0x42
~ld
PaulStoffregen commented 9 years ago

I can't troubleshoot ESP8266 problems. But if someone does solve this, please submit the fix as a pull request. As long as it only changes the ESP8266-specific code, I'll be happy to merge the fix.

develpr commented 8 years ago

@s00500 if you don't mind me asking, how did you have your circuit setup for this? Are you using the ADC pin?

s00500 commented 8 years ago

No, I havn't been using D5 and D6 (GPIO 12 and 14)

androcioli commented 8 years ago

@s00500 Hi I'm getting an Exception (29) on the esp8266 too. Did you resolve this problem with CapacitiveSensor or you have found another code for the ESP8266?

s00500 commented 8 years ago

@androcioli no i've been using way simpler code to do this.

androcioli commented 8 years ago

@s00500 Do you can making the code available you're using?

BorisWild commented 8 years ago

Open CapacitiveSensor.h... find lines 95 - 104... and refresh them with that:

elif defined(ARDUINO_ARCH_ESP8266)

define PIN_TO_BASEREG(pin) ((volatile uint32_t*) GPO)

define PIN_TO_BITMASK(pin) (1 << pin)

define IO_REG_TYPE uint32_t

define IO_REG_ASM

define DIRECT_READ(base, mask) ((GPI & (mask)) ? 1 : 0) //GPIO_IN_ADDRESS

define DIRECT_MODE_INPUT(base, mask) (GPE &= ~(mask)) //GPIO_ENABLE_W1TC_ADDRESS

define DIRECT_MODE_OUTPUT(base, mask) (GPE |= (mask)) //GPIO_ENABLE_W1TS_ADDRESS

define DIRECT_WRITE_LOW(base, mask) (GPOC = (mask)) //GPIO_OUT_W1TC_ADDRESS

define DIRECT_WRITE_HIGH(base, mask) (GPOS = (mask)) //GPIO_OUT_W1TS_ADDRESS

PaulStoffregen commented 8 years ago

fixed by https://github.com/PaulStoffregen/CapacitiveSensor/commit/83ee030b7c20a5eb7f127f900cfcc95f886642e2

Maxr1998 commented 7 years ago

@BorisWild @PaulStoffregen I somehow can't get this to work for me with my ESP8266-12E, it always throws a timeout (-2). This is my code:

#include <CapacitiveSensor.h>

CapacitiveSensor csense = CapacitiveSensor(12, 14);

void setup() { 
  Serial.begin(115200);
}

void loop() {
  Serial.println(csense.capacitiveSensor(30));
}

I'm using the latest library version cloned from GitHub.

I have a 10MOhm resistor wired up to pin 12, and a 1KOhm resistor to pin 14. They are soldered together on a 1cm (2.54 cm)*1cm (2.54 cm) sheet of copper tape. Do I have to search the error in the code or in the wiring? Btw, if I short the pins with my finger, the value gets to zero, when removing the finger it jumps up to sub-100, but then immediately goes back to -2.

BorisWild commented 7 years ago

Too big resistors.

3 нояб. 2016 г. 1:22 пользователь "Max Rumpf" notifications@github.com написал:

@BorisWild https://github.com/BorisWild I somehow can't get it to work for me, it always throws a timeout (-2). This is my code:

include

CapacitiveSensor csense = CapacitiveSensor(12, 14);

void setup() { Serial.begin(115200); }

void loop() { Serial.println(csense.capacitiveSensor(30)); }

I have a 10MOhm resistor wired up to pin 12, and a 1KOhm resistor to pin

  1. They are soldered together on a 1cm*3cm sheet of copper tape. Do I have to search the error in the code or in the wiring?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PaulStoffregen/CapacitiveSensor/issues/6#issuecomment-258017533, or mute the thread https://github.com/notifications/unsubscribe-auth/AQkLDGOKaSZuJ4CrgVDDottQR6qqqpliks5q6Q0WgaJpZM4GIycg .

Maxr1998 commented 7 years ago

@BorisWild Well, example code said:

Uses a high value resistor e.g. 10M between send pin and receive pin Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values. Receive pin is the sensor pin - try different amounts of foil/metal on this pin

What values would you recommend for the ESP then? I want it to sense through a 2mm sheet of plastic, that's why I ask. Thanks for your help! :)

Maxr1998 commented 7 years ago

Ok, I tested my resistor values on an Arduino Mega, where they work fine. Now I just need to adapt them to my ESP8266.

rmeister commented 7 years ago

Came here for the same problem as Maxr1998, but found out that in my case reason for the error was different: The library does not support GPIO16 on the ESP8266.

I use a 10K resistor for direct touch sensing.

Maxr1998 commented 7 years ago

Forgot to update, it also works for me now, with a 100k to 200k resistor through a 1mm layer of plastic.