guild icon
Toit
#touch exception
Thread channel in help
Oliver M
Oliver M 02/26/2023 07:59 PM
I'm trying out the example code from the Touch class, but I'm getting an error when trying to run it:

****************************************************************************** Decoding by `jag`, device has version <2.0.0-alpha.53> ****************************************************************************** EXCEPTION error. UNKNOWN ERROR 0xffffffff(-1) 0: touch_read_ <sdk>/gpio/touch.toit:113:3 1: Touch.read <sdk>/gpio/touch.toit:58:12 2: main touch-test.toit:21:18 ******************************************************************************

The code I'm using is

while true: touch := Touch (gpio.Pin 0) --threshold=500 print (touch.read --raw) touch.close sleep --ms=1000

(plus the relevant imports). I'm using a TTGO T-BEAM, and pins 0 or 32 bothe didn't work... Any ideas?
floitsch
floitsch 02/26/2023 09:34 PM
I can reproduce. Will have a look at it.
floitsch
floitsch 02/26/2023 10:16 PM
Found it. I broke touch, when I refactored some of its code for other variants of the ESP32. :😦:
Working on a fix now.
Oliver M
Oliver M 02/26/2023 10:19 PM
Thank you! :πŸ‘πŸ»:
floitsch
floitsch 02/26/2023 10:25 PM
fyi: the last version where touch still worked was with Jaguar v1.7.6 (Toit v2.0.0-alpha.38).(edited)
floitsch
floitsch 02/26/2023 10:30 PM
Fix for the touch is uploaded and should make it into the next release.
I expect us to do one early next week, but it could slip more towards the end of the week.
floitsch
floitsch 02/26/2023 10:31 PM
big thanks for reporting the issue.
bitphlipphar
bitphlipphar 02/28/2023 04:06 AM
Fix is included in Jaguar v1.9.3.
Oliver M
Oliver M 02/28/2023 07:21 PM
I'm now getting a different error :😦: ****************************************************************************** Decoding by `jag`, device has version <2.0.0-alpha.55> ****************************************************************************** EXCEPTION error. UNKNOWN ERROR 0x103(259) 0: touch_read_ <sdk>/gpio/touch.toit:113:3 1: Touch.read <sdk>/gpio/touch.toit:58:12 2: main touch-test.toit:21:18 ******************************************************************************
floitsch
floitsch 02/28/2023 08:48 PM
Is there something in there lines before?
Oliver M
Oliver M 02/28/2023 08:58 PM
This is the complete program: import gpio import gpio.touch show Touch main: while true: touch := Touch (gpio.Pin 32)// --threshold=500 print (touch.read --raw) touch.close sleep --ms=1000
Oliver M
Oliver M 02/28/2023 08:59 PM
(I've attached a cable to pin 32)
Oliver MOPOliver M
This is the complete program: ```import gpio import gpio.touch show Touch main: while true: touch := Touch (gpio.Pin 32)// --threshold=500 print (touch.read --raw) t...
floitsch
floitsch 02/28/2023 11:51 PM
I was actually able to reproduce. I think by pure coincidence...
floitsch
floitsch 02/28/2023 11:51 PM
When the touch-pin is grounded, then I get this error.
floitsch
floitsch 02/28/2023 11:52 PM
If it's floating (as it should), then the error goes away and the touch functionality works.
Oliver M
Oliver M 03/01/2023 08:35 AM
I have a cable plugged into the pin with a bare end, which would be the bit to touch; but I get the error immediately, before I even touch it.
floitsch
floitsch 03/01/2023 11:55 AM
Weird. I do the same. If the bare end touches ground, I get that exact same error. If it doesn't then things work for me.
floitsch
floitsch 03/01/2023 12:02 PM
Espressif IoT Development Framework. Official development framework for Espressif SoCs. - esp-idf/touch_sensor.c at release/v4.4 Β· espressif/esp-idf
floitsch
floitsch 03/01/2023 12:03 PM
So the touch sensor got a 0 read.
Oliver M
Oliver M 03/01/2023 12:03 PM
I tried touching the cable while running the program, but same result: error regardless of whether the cable is touched or not.
floitsch
floitsch 03/01/2023 12:06 PM
It could be that we are initializing the touch sensor in a bad way, but I just checked again, and can't see anything that sticks out.
floitsch
floitsch 03/01/2023 12:07 PM
Do you maybe have an easy way of testing with Arduino, to see if the setup works there?
Oliver M
Oliver M 03/01/2023 12:17 PM
No, I've only got an ESP32; I can try another one to make sure that that particular one isn't a dud.
floitsch
floitsch 03/01/2023 12:17 PM
You can run Arduino on the ESP32.
floitsch
floitsch 03/01/2023 12:18 PM
But if you haven't set it up yet, it's not worth it.
floitsch
floitsch 03/01/2023 12:18 PM
Using the esp-idf would also be an option.
floitsch
floitsch 03/01/2023 12:18 PM
But again: if you haven't set it up...
Oliver M
Oliver M 03/01/2023 12:18 PM
Ah, you mean with the Arduino IDE! I used to do that, but have abandoned it because I prefer toit :πŸ™‚:
floitsch
floitsch 03/01/2023 12:18 PM
:πŸ™‚:
floitsch
floitsch 03/01/2023 12:19 PM
Just sometimes useful to figure out what we are doing wrong wrt esp-idf calls.
Oliver M
Oliver M 03/03/2023 06:52 PM
I don't know if that helps, but I've just tried with pin 2, and I'm getting a different error: EXCEPTION error. ALREADY_IN_USE 0: gpio_use_ <sdk>/gpio/pin.toit:389:3 1: Pin <sdk>/gpio/pin.toit:131:17 2: main touch-test.toit:6:21
Oliver M
Oliver M 03/03/2023 06:52 PM
Same program, so nothing apart from trying to init the pin and then touch.read it
Oliver M
Oliver M 03/03/2023 06:53 PM
(alpha 55)
Oliver M
Oliver M 03/03/2023 07:05 PM
Doh! I have the pin initialisation in the while loop, so the second time this is executed the pin is actually in use.
Oliver M
Oliver M 03/03/2023 07:05 PM
It works now with pin 15!
πŸ™‚1
πŸ‘1
Oliver M
Oliver M 03/03/2023 07:06 PM
But the program seems to mess up the wifi, as I get a lot of messages about dropped wifi connections from the jag monitor.
Oliver M
Oliver M 03/03/2023 07:11 PM
Pin 0 still gives the error above. (The Unknown Error 0x103)(edited)
floitsch
floitsch 03/03/2023 07:54 PM
Might be that pin 0 is pulled low by your board (i wouldn't be surprised if it was a strapping pin). Pin 32 is more surprising to me.
Oliver M
Oliver M 03/03/2023 08:00 PM
It’s a TTGO T-BEAM. As long as any pin works, that’s enough for me :πŸ™‚: Quite pleased that it even works through a few mm of plastic – I need it for a waterproof box, and that saves me putting a hole in the case for a physical button.
πŸ‘1
floitsch
floitsch 03/04/2023 10:07 AM
Looked it up, and indeed, gpio 0 is a strapping pin: "GPIO 0 (must be LOW to enter boot mode)"
There is likely a pull down resistor on pin 0.
I then continued looking, and I think pin 32 is explained here: https://github.com/LilyGO/TTGO-T-Beam/issues/30
(edited)
Hi The pinout diagram should be updated to reflect that pins 32 and 33 are only capable of output (GPO), and pins 34, 35, 36 and 39 are only capable of input (GPI). See this official Espressif docu...
Oliver M
Oliver M 03/04/2023 11:49 PM
Ah, so I was just extremely unlucky in my choice of pins 0 and 32 :😳:
floitsch
floitsch 03/04/2023 11:56 PM
I think so.
PeterJ
PeterJ 04/21/2023 08:58 AM
Is it possible somehow to pull GPIO 36 to low?
ai-bot
ai-bot Bot04/21/2023 08:58 AM
Sorry, I don't talk to strangers.
floitsch
floitsch 04/21/2023 08:59 AM
argh. I think I need to change the ai-bot.
ai-bot
ai-bot Bot04/21/2023 08:59 AM
Sorry, I don't talk to strangers.
floitsch
floitsch 04/21/2023 09:00 AM
Bot is kicked.
PeterJPeterJ
Is it possible somehow to pull GPIO 36 to low?
floitsch
floitsch 04/21/2023 09:01 AM
Is this related to the touch exception?
PeterJ
PeterJ 04/21/2023 09:02 AM
No, my electronic engineer attached a charging circuit to pin 36 and I need to somehow pull it low to start the charging circuit
floitsch
floitsch 04/21/2023 09:02 AM
ok. Let's open a different help topic then.
PeterJ
PeterJ 04/21/2023 09:02 AM
Okay :πŸ™‚:
51 messages in total