Watchdog reset from Python

macmack5

Member
Raspberry Pi needs to issue a reset command on the I2C port before the timer on the watchdog expires. (From manual) How do I do this from a Python program? How do I set up the watchdog timer from Python?
 

alexburcea

Moderator
Staff member
Look at the GitHub Python page for instructions.
You can create a Python program that can either be run at a startup and periodically reset the counter or a script that reset the counter and exit and you call it from CRON.
 

alexburcea

Moderator
Staff member
There is a difference between watchdog and battery backup. The watchdog function just monitors the Raspberry for hung-up and cycles his power.
To be more accurate, once enabled, the watchdog needs to be periodically reset through an I2C port else will cycle the Raspberry power. Is obviously that for this feature you need to power the Raspberry from the card.
 

macmack5

Member
Yes, I think so. You can power a Pi by applying 5V to the appropriate pin on the io header? How do you set it up so it supplies power the first time?
 

alexburcea

Moderator
Staff member
No, you supply the 5V to the appropriate connector on the card, and the card routes the power to the Raspberry pin header.
By default the watchdog function is disabled and the card powers the Raspberry. Once you enable the watchdog, by setting its period, the power will be cut if you do not reset the watchdog for a period longer than the programmed one.
 

alexburcea

Moderator
Staff member
The maximum current for powering Raspberry is 3A. Was tested also with pi 5 and will work as long it does not drain more than 3A.
 

macmack5

Member
The Pi 5 negotiates with a USB-PD power supply, which means it may not be happy with a supply from one of your cards. (No reply and the Pi 5 assumes the supply is not adequate.) The config.txt and eeprom config files have to be modified to tell the Pi 5 the supply is adequate. I have a few links explaining how to do this, but I am waiting for a new supply to arrive. I will try to update here if it works. When the Pi 5 boots, it complains about the inadequate supply.
 

alexburcea

Moderator
Staff member
I did not have this problem with RPI 5 powered through the 2x20 pin header. Make sure the power applied to the card is adequate, meaning is not dropped when RPI consumes some power. I understand that the RPI5 negotiates only if powered through the USB connector.
Please let me know what type of card you are using to power the Pi.
I will run more tests with rpi5 this week and share the conclusions, please do so when you receive the new power supply.
 

macmack5

Member
I think I still have it plugged in to the USB C. I will try it both ways when the bigger supply arrives and let you know. You are always so helpful, thanks. I have a thermocouple card and 16 relay card on this pi. I have supply wired to both cards.
 

alexburcea

Moderator
Staff member
If you can measure the voltage at the Raspberry 2x20 pin header while is powered from the cards we can diagnose the problem.
 

macmack5

Member
Finally got back to this issue. Installed new supply, 10A. Disconnected USB C. Powering through 16x relay board and thermocouple board. Same issue, wormwood os complains that supply is not adequate and shuts off peripherals. Also gives low voltage warning. I adjusted the supply voltage (measured at card input) up to 5.25 V and warning goes away. Pi is also stable with additional 1/4 volt. (This even worked with the original supply.)

Now I will have to change config files and test.
 

alexburcea

Moderator
Staff member
Thank you for the report. It would be helpful if you could compare the voltage at the card input with the one at the Raspberry 2x20 pin header.
 
Top