Wemos lolin32 ESP32 - Arduino Reconfiguration Reset and Led

I have trying to connect to my MCU, after working using Blynk, with another different Wifi HotSpot following some tutorials but had not be possible. The MCU try to connect to the previous Wifi AP name and credentials and never is possible to make a reset to reconfigure as is documented in the manuals too.

After a deep analysis in the Blynk files, concretelly “settings.h”, was found that the pin for reset is zero “0” for all MCU types except USE_WROVER_BOARD.

However Wemos Lolin32 Reset button is connected to EN input so never is going to enter in reconfiguration by using the reset pin. Also, to be able the Led pin flashes as indicated in tutorials, the BOARD_LED_PIN defined should be declared as LED_BUILTIN because Arduino environment sets the correct pin when MCU type is changed to another.

To solve the LED subject, “settings.h” code was modified including a condition in case of ARDUINO_LOLIN32 is being defined as follows…


/*
 * Board configuration (see examples below).
 */

#if defined(USE_WROVER_BOARD)

  #define BOARD_BUTTON_PIN            15
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN_R             0
  #define BOARD_LED_PIN_G             2
  #define BOARD_LED_PIN_B             4
  #define BOARD_LED_INVERSE           false
  #define BOARD_LED_BRIGHTNESS        128

#elif defined(USE_TTGO_T7)

  // This board does not have a built-in button
  // Connect a button to gpio0 <> GND
  #define BOARD_BUTTON_PIN            0
  #define BOARD_BUTTON_ACTIVE_LOW     true

  #define BOARD_LED_PIN               19 
  #define BOARD_LED_INVERSE           false
  #define BOARD_LED_BRIGHTNESS        64

#else

  #warning "Custom board configuration is used"


  #define BOARD_BUTTON_PIN            0                     // Pin where user button is attached
  #define BOARD_BUTTON_ACTIVE_LOW     true                  // true if button is "active-low"

  #if defined(ARDUINO_LOLIN32)
    #define BOARD_LED_PIN               LED_BUILTIN         // Set LED pin - if you have a single-color LED attached
  #else
    #define BOARD_LED_PIN               12 //XNC01          // Set LED pin - if you have a single-color LED attached
  #endif
  //#define BOARD_LED_PIN_R           15                    // Set R,G,B pins - if your LED is PWM RGB
  //#define BOARD_LED_PIN_G           12
  //#define BOARD_LED_PIN_B           13
  //#define BOARD_LED_PIN_WS2812      4                     // Set if your LED is WS2812 RGB
  #define BOARD_LED_INVERSE           false                 // true if LED is common anode, false if common cathode
  #define BOARD_LED_BRIGHTNESS        64                    // 0..255 brightness control

#endif

The code would be extensible to all MCU board types by changing declare
#define BOARD_LED_PIN LED_BUILTIN
at the beginning of this settings.h file and removing the rest of references because Arduino changes the LED pin according to the MCU selected.

On the other hand, to be able to carry out the necessary reset for the reconfiguration of the AP, it is necessary to put pin 0 to ground for the necessary 10 seconds. This can be done by means of a cable or by means of tweezers since the two pins; labeled “0” and “GND” are next.

Once the message that the flash has been deleted appears, proceed to make the connection with the new AP following the usual procedure.
If the change has been made in the “settings.h” file as indicated, the LED will be activated as described in the procedures.

I hope this helps other developers who have encountered this problem.

Greetings community.

I think you’re confusing the hardware reset button, which is always connected to EN or RST on MCUs with the button that is used to reset the Blynk dynamically provisioned credentials.

Not everyone uses the Arduino IDE, and the whole point of this is to allow the user to define different LEDs and reset buttons if required. ALso, as you’ll see from the other board definitions, some use RGB LEDs and the LED_BUILTIN option won’t work with these.

Anyone who is having issues like this should probably read this…

Pete.

Thanks Pete.

Has been my first contact with Blynk trying to integrate it and evaluate.
As a newby, I haven’t read all the helpful docs to get it working, just some tutorials and examples in which, as it said at the beginning of Troubleshooting article, most people commonly use the word reset when word Provisioning should be used to differentiate both different purposes. This has been my confusion trying to get Reset as Provisioning to work.

Totally agree with LED answers but should be noted that tipically MCU board implementations in the Arduino IoT ecosystem are using the pin 13 for LED and it has been declared as LED_BUILTIN so it can be changed according to the MCU selection.
My suggestion is about to replace the current pin declared as 12 to LED_BUILTIN or 13 or by a preprocessor directive such as:
#error (“Please, define LED pin for your MCU”)
because, if no error is given when compiling, user doesn’t know why the LED doesn’t work as expected. It’s working but on the wrong pin. Consequentelly, the user is not informed visually of the status of the Blynk program state, so we are not sure what is happening.

Thanks Pete for your answers and post, now it’s very clear to me.