Reboot system every 10 minutes

Hi everyone,

I stopped the salt-minion service to customize the code, but Autopi is restarting every 10 minutes, could you help me with this problem?

Hi @Marianne_Diniz,

Welcome to the community.

What you see is the intended power scenario of the device. The device contains a low level chip, which resets the device in case of an emergency in the OS. The functionality is simple. A heartbeat is send from the OS to the chip and if the chip does not receive the heartbeat, then the power is killed and the OS is rebooted.
If you want to add your own code, then you need to maintain that heartbeat in order for the device to stay awake.
The code is located here:

Look for heartbeat_handler.

The default timeout is 10 mins.

Best
Peter

Hi Peter,

Where is this file? Is it located in autopi file system? I was not able to find it.

All the code is located right here:

/var/cache/salt/

best
Peter

Hi Marianne, pls share how you do stop salt-minion.
sudo systemctl stop salt-minion just hangs forever on my side

I have the same reboot problem.

Hey guys,

I have installed linux onto a RaspberryPi4 and connected the autopi board to it. How can I send this heartbeat using general linux?

Thanks,
Vele

I’ve implemented the heartbeat in python and the Pi still sleeps after 10-15 minutes. I also have the pins shorted where the jumper goes.

#!/usr/bin/python3
import gpio_pin
import logging
import os
import psutil
import RPi.GPIO as gpio
import time
from i2c_conn import I2CConn
from spm2_conn import SPM2Conn
import smbus
import code
import threading
spm = None
led_pwm = None
psutil.Process(os.getpid()).nice(-1)
gpio.setwarnings(False)
gpio.setmode(gpio.BOARD)
gpio.setup(gpio_pin.HOLD_PWR, gpio.OUT, initial=gpio.LOW)
gpio.setup(gpio_pin.SPM_RESET, gpio.OUT, initial=gpio.HIGH)

spm = SPM2Conn()
spm.init({'port':1,'address':8})

gpio.setup(gpio_pin.LED, gpio.OUT)
led_pwm=gpio.PWM(gpio_pin.LED,2)
led_pwm.start(50)

def th_heartbeat(name):
    while True:
        #gpio.output(gpio_pin.HOLD_PWR, gpio.HIGH)
        spm.heartbeat()
        time.sleep(10)
        #gpio.output(gpio_pin.HOLD_PWR, gpio.LOW)

thBeat = threading.Thread(target=th_heartbeat, args=(1,))
thBeat.start()

code.interact(local=dict(globals(), **locals()))