BBB Watchdog


I am trying to add watchdog reset support to my CPP app on a BBB.

I have added sg_BeagleBone_Watchdog.cpp and sg_BeagleBone_Watchdog.hpp files and their dependencies to my project.

Following the documentation I have added:
SG::BeagleBone::Watchdog watchdog;
while(true) {
watchdog.kick(); // pat the watchdog


When I run it I get:

terminate called after throwing an instance of ‘std::system_error’
what(): SG++ failed to open /dev/watchdog: Permission denied

So I tried following Watchdog timer - BeagleBone, but the first line also fails:

cat > /dev/watchdog
-bash: /dev/watchdog: Permission denied

I have tried with sudo but no change.

Please advise what I have missed.