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: setWatch and digitalWrite Assert failure - DHT11 module #1346
Comments
Looks like in jsdevices.h we need to define:
However that will possibly blow out the Lines 95 to 96 in e609b94
|
On all the other platforms there is only a relatively small amount of hardware that can do watches, so EV_EXTIx corresponds to that and there's a mapping, eg: https://github.com/espruino/Espruino/blob/master/targets/nrf5x/jshardware.c#L867 I'm not sure what the case is with ESP32 but if it is then it's hidden behind their API. Given the competition for space in that enum (otherwise we'd have to double the size of it, which wastes ~128 bytes of input buffer on most platforms), I'd rather not increase that size across the board. We could perhaps define EV_EXTI_COUNT in platform_config.h though and use that? |
Pin 16 and 17 are used/reserved for PSRAM.
I would recommend, not to use them.
2018-02-19 9:54 GMT+01:00 Gordon Williams <notifications@github.com>:
… On all the other platforms there is only a relatively small amount of
hardware that can do watches, so EV_EXTIx corresponds to that and there's a
mapping, eg: https://github.com/espruino/Espruino/blob/master/targets/
nrf5x/jshardware.c#L867
I'm not sure what the case is with ESP32 but if it is then it's hidden
behind their API.
Given the competition for space in that enum (otherwise we'd have to
double the size of it, which wastes ~128 bytes of input buffer on most
platforms), I'd rather not increase that size across the board. We could
perhaps define EV_EXTI_COUNT in platform_config.h though and use that?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1346 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB-Gnh5Ogc-xX0aHS1UYUPzUUfcd6uOKks5tWTbbgaJpZM4SKDaZ>
.
|
Thanks @gfwilliams and @jumjum123 I'm not sure how to cleanly do the changes to jsdevice.h without a conditional Currently there is no tie up with the generated platform.h, so within the enum defines are made for non-existent serial ports for example, that would free up some of the numbers, (or would that be used for software serial?) |
Yes, I was wondering about the unused Serial/I2C/etc too. The tie-up could have to be done with build_platform_config based on chip family, but it would be nice improvement I think. Having said that, how many ESP32 pins can't be used? If there are only 16 usable then it totally makes sense to use the 16 EXTI that we have. Just a note, but if jshPinWatch returns EV_NONE, I believe you get a nice |
Thanks. I'm trying to look at the ESP-idf docs to see if there is a function to check watchability of pins like in the nfc sample you pointed me too. I see that checks in a loop - wondering if the speed of that has any bearing? And do you know a cunning way of checking that enum does not exceed 64 at compile time? |
According this there appears to be at least 19-20 pins: Espruino/targets/esp32/jshardware.c Lines 113 to 120 in 028b592
|
Ok, one sec and I'll update |
Turns out we already do this with DEVICE_SANITY_CHECK (although it's not compile-time) I just committed a patch that might fix this. Honestly, not the tidiest stuff I've ever done, but should save some code space on a bunch of platforms |
Thanks @gfwilliams This is now working on the ESP32:
|
Reported as issues with the ESP32 and the DHT11 module:
http://forum.espruino.com/conversations/316936
http://forum.espruino.com/conversations/316733
To reproduce:
digitalWrite(D16,0)
on it own works ok.To get the assert (rather than a core dump) - compile:
make clean && BOARD=ESP32 DEBUG=1 make
https://github.com/espruino/Espruino/blob/master/src/jsdevices.c#L413
EV_EXTI_MAX is defined as: https://github.com/espruino/Espruino/blob/e609b94f83f665c26cf4f86acac068c396427e99/src/jsdevices.h#L54
@jumjum123 did the setwatch code for ESP32 - so I'm unsure how pin numbers (D22 in this case) is mapping to a channel?
@gfwilliams
It seems the code is built for board with pins 0-15? We are getting a failure when a pin > 16 is used.
Sorry - without having an understanding of the code I'm note sure how to fix or the relationship between
setWatch()
anddigitalWrite()
and channels and pins?The text was updated successfully, but these errors were encountered: