Reset Board using the RST Pin in case it gets stuck



  • Dear Pycom-Community,

    at the moment I'm using a GPy as a communication module for my 5V Arduino. The GPy is 3.3V. I'm using Cat m1 with the GPy at the moment and I've experienced stability issues, I just can't fix programmatically (Guru meditation errors and lock-ups of the modem) so I want to reset the GPy through the Arduino, in the case, the GPy doesn't send a ping in a certain timeframe to the arduino.

    According to different posts, I'm not so sure about the internal watchdog of the Pycom-modules:
    [https://forum.pycom.io/topic/4589/external-watchdog?=1601900599657](link url)
    [https://forum.pycom.io/topic/4303/external-watchdog-board-for-pycom/4?
    =1601894304611](link url)
    [https://forum.pycom.io/topic/5198/calling-machine-reset-from-timer-interrupt-routine/7?_=1601894304614](link url)

    As far as I've understood, you have to ground the RST Pin, which is the physical Pin 9 on the GPy: [https://forum.pycom.io/topic/475/reset-pin](link url)

    I've tried it out and grounded the Pin manually and the GPy got reset.

    What would be the best way to use the Arduino to reset the GPy? Personally, I've thought using one digital Pin of the Arduino as an input and the GPy changes the state from High to Low, and Low to High of this Pin frequently. If the Arduino does not recognize a change of state of that Pin in a certain timeframe, it puts the RST Pin of the the GPy low through another digital output pin connected to the RST Pin of the GPy (2 Pins of the Arduino in use, 2 Pins of the GPy in use, while one is the RST Pin of the GPy). It's also gets recommended here: [https://electronics.stackexchange.com/questions/172878/how-do-i-get-my-arduino-to-reset-another-board](link url)

    I could use a logic converter between the 2 boards, so the 5V Arduino can communicate with the 3.3V GPy. I'm not sure, but can I just hook up the RST Pin of the GPy with a digital pin of the Arduino, setting that Arduino pin as digital Output and High and put it Low, in the case the GPy hangs? In the datasheet, a pullup-resistor for the RST Pin is recommended on page 5: [https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf](link url)

    But in this thread, somebody said, that the RST Pin is already pulled up for the LoPy so I think, it should be the same for the GPy: [https://forum.pycom.io/topic/475/reset-pin](link url)

    I also kinda would like to reverse that setup. The Arduino watching over the GPy, in the case of a hang up, but the GPy also watching over the Arduino, resetting the Arduino via the Arduino's Reset Pin in the case the Arduino didn't send a measurement string in ages.

    I would be happy about any input. I thank everybody in advance!

    Kind regards,

    SciWax



  • @Gijs said in Reset Board using the RST Pin in case it gets stuck:

    The other way could work the same, but using a voltage divider. The 3.3V of the Gpy module is already above the HIGH threshold of the ATMEGA IC, not needing any sort of logic level converter per sé

    Yeah, that's true. I forgot about this possibility. So I will place a voltage divider between the RESET Pin of the Arduino and one of the GPy GPIO's, so I don't brick the chosen GPIO on the GPy, because they don't work at the same logic level. Now I just have to calculate, which resistors should be okay.

    Thank you for the adivse!



  • @robert-hh Thank you so much for the input and the github-link! I will surely come back to it, when I only use the GPy itself. In my current project iteration, I have to use an Arduino microcontroller, where the GPy itself is basically only used for sending my measurement data and receiving the time from a ntp server, so that my RTC always shows the right time.



  • @SciWax The reset pin is on the GPY the one next to the Reset button. It is also the physical pin 9 of the ESP32 chip itself. You can pull that one low to trigger a physical reset.
    For that purpose I made an external watchdog based on an Attiny85 which can be freely configured. See: https://github.com/robert-hh/ATTiny-Watchdog-for-MicroPython
    The Attiny can well run at 3.3V- It uses the Arduino environment and includes the drivers for Micropython.



  • @Gijs Thank you for the advise, Gijs!

    Indeed, that's also the conclusion I came to. According to the Arduino Website:

    Arduino (Atmega) pins default to inputs, so they don't need to be explicitly declared as inputs with pinMode() when you're using them as inputs.
    Source: Arduino Website

    When I connect a Digital Pin of the Arduino to the RST Pin of the GPy, it will be the input of the RST Pin, so it won't float and won't put out random changes of the pin state. This would be bad.

    I've tested the suggestion in this thread:
    Reset nodemcu from Arduino Slave

    Basically you just have to set your chosen Arduino Digital Pin to Output, where it gets set automatically to Low and then set it back to input, so you give the control back to the GPy RST Pin.

    pinMode(Arduino_Pin, OUTPUT);
    delay(1);
    pinMode(Arduino_Pin, INPUT);
    

    I've just tested it with two 5V Arduinos and it works as expected. I will test it with the GPy too, as soon as I've finished the code for the pings on the GPy.


  • Global Moderator

    Hi,

    To use the arduino as a watchdog for the GPY, you could indeed check the state of a pin as you mention, and when the state is not updated, reset the GPy module. I would use one of the IO pins of the arduino as an pinMode(INPUT), until the GPy needs resetting, then you would set pinMode(OUTPUT); digitalWrite(LOW), pulling the pin low, and thus pulling the reset line low, whilst never putting 5V on the reset line.

    The other way could work the same, but using a voltage divider. The 3.3V of the Gpy module is already above the HIGH threshold of the ATMEGA IC, not needing any sort of logic level converter per sé

    Best,
    Gijs


Log in to reply
 

Pycom on Twitter