Skip to content

Commit

Permalink
Free up OPI PSRAM pins if PSRAM not working - different magic
Browse files Browse the repository at this point in the history
  • Loading branch information
troyhacks committed Nov 26, 2024
1 parent 4204abe commit 5df0565
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion wled00/pin_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ String PinManagerClass::getPinSpecialText(int gpio) { // special purpose PIN in
// ESP32-S3
if (gpio > 18 && gpio < 21) return (F("USB (CDC) or JTAG"));
#if CONFIG_ESPTOOLPY_FLASHMODE_OPI || CONFIG_SPIRAM_MODE_OCT
if (psramFound()) {
if (psramFound() && ESP.getPsramSize() > 0) {
if (gpio > 32 && gpio < 38) return (F("(reserved) Octal PSRAM or Octal Flash"));
}
#endif
Expand Down
5 changes: 2 additions & 3 deletions wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,7 @@ void WLED::setup()

#if defined(CONFIG_IDF_TARGET_ESP32S3)
#if CONFIG_ESPTOOLPY_FLASHMODE_OPI || CONFIG_SPIRAM_MODE_OCT
DEBUG_PRINTF("**** PSRAM WAS %s *****",psramFound()?"Found!":"NOT FOUND!"); // TroyHacks: Figure out why it's finding PSRAM when there isn't any. FIXME
if (psramFound()) {
if (psramFound() && ESP.getPsramSize() > 0) {
// S3: reserve GPIO 33-37 for "octal" PSRAM
managed_pin_type pins[] = { {33, true}, {34, true}, {35, true}, {36, true}, {37, true} };
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
Expand All @@ -618,7 +617,7 @@ void WLED::setup()
managed_pin_type pins[] = { {16, true}, {17, true} };
pinManager.allocateMultiplePins(pins, sizeof(pins)/sizeof(managed_pin_type), PinOwner::SPI_RAM);
#endif
if (psramFound()) {
if (psramFound() && ESP.getPsramSize() > 0) {
DEBUG_PRINT(F("Total PSRAM: ")); DEBUG_PRINT(ESP.getPsramSize()/1024); DEBUG_PRINTLN("kB");
DEBUG_PRINT(F("Free PSRAM : ")); DEBUG_PRINT(ESP.getFreePsram()/1024); DEBUG_PRINTLN("kB");
} else {
Expand Down
4 changes: 2 additions & 2 deletions wled00/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ void appendGPIOinfo() {
#if defined(ARDUINO_ARCH_ESP32)
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
if (psramFound()) oappend(SET_F(",16,17")); // GPIO16 & GPIO17 reserved for SPI RAM on ESP32 (not on S2, S3 or C3)
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
if (psramFound()) oappend(SET_F(",33,34,35,36,37")); // in use for "octal" PSRAM or "octal" FLASH -seems that octal PSRAM is very common on S3.
#elif defined(CONFIG_IDF_TARGET_ESP32S3) && (CONFIG_ESPTOOLPY_FLASHMODE_OPI || CONFIG_SPIRAM_MODE_OCT)
if (psramFound() && ESP.getPsramSize() > 0) oappend(SET_F(",33,34,35,36,37")); // in use for "octal" PSRAM or "octal" FLASH -seems that octal PSRAM is very common on S3.
#endif
#endif

Expand Down

0 comments on commit 5df0565

Please sign in to comment.