-
-
Notifications
You must be signed in to change notification settings - Fork 761
Open
Description
jshPinDefaultPullup()
is called during Espruino startup in jshInit()
for the ESP32 devices to initialise safe GPIO pins. The code was written for the original ESP32 with a subsequent mod to exclude setup of any pins in the case of the ESP32-C3. However, it has not been changed to handle the ESP32-S3, resulting in the original ESP32 safe pins being initialised in an S3 build. The current code in targets/esp32/jshardware.c
being
void jshPinDefaultPullup() {
#ifdef CONFIG_IDF_TARGET_ESP32C3
#else
// 6-11 are used by Flash chip
// 32-33 are routed to rtc for xtal
// 16-17 are used for PSRAM (future use)
jshPinSetStateRange(0,0,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(12,15,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(18,19,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(21,22,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(25,27,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(34,39,JSHPINSTATE_GPIO_IN_PULLUP);
#endif
}
A fix should ideally set 'safe pins' for all ESP32 variants. However a quick fix is required to stop setting the pins , possibly incorrectly, for the S3. Such as this
void jshPinDefaultPullup() {
#if ESP_IDF_VERSION_MAJOR>=4
//to do: include safe pins for C3 and S3 variants
#else
// Set safe pins for original ESP32
// 6-11 are used by Flash chip
// 32-33 are routed to rtc for xtal
// 16-17 are used for PSRAM (future use)
jshPinSetStateRange(0,0,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(12,15,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(18,19,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(21,22,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(25,27,JSHPINSTATE_GPIO_IN_PULLUP);
jshPinSetStateRange(34,39,JSHPINSTATE_GPIO_IN_PULLUP);
#endif
}
This fix will be provided in a combined PR for this issue and #2649 (another ESP32-S3 pin issue)
Metadata
Metadata
Assignees
Labels
No labels