PCA9450 reset reason from userspace

Hello,
I’m trying to display in my application the reset reason.
I don’t think the following guide Watchdog (Linux) | Toradex Developer Center applies to PCA9450 or verdin mini, as from the the PCA9450 datasheet https://www.nxp.com/docs/en/data-sheet/PCA9450.pdf register 0xA is configuration register.
it does seem that the info I’m looking for is in register 0x5:

I can access this register with command:

cat /sys/bus/i2c/devices/0-0025/pca9450-pmic/registers | grep 0x05

my problem is, I have tried to read this register in different scenarios and the values I read are consistent (same value repeating the same pattern) but they don’t match the values reported in the datasheet.

if I issue a software reboot with “sudo reboot” command:

cat /sys/bus/i2c/devices/0-0025/pca9450-pmic/registers | grep 0x05
[0x05] = 40

If I unplug and plug back the power cable:

cat /sys/bus/i2c/devices/0-0025/pca9450-pmic/registers | grep 0x05
[0x05] = 80

If I force the hardware watchdog:

cat /sys/bus/i2c/devices/0-0025/pca9450-pmic/registers | grep 0x05
[0x05] = 50

can anyone explain the discrepancy with the datasheet?

Regards,
Rocco

Greetings @RoccoBr,

I don’t think it’s a discrepancy. The values in Linux seem to be in hexadecimal, while the datasheet shows the information in binary/bits.

With that 0x40 would mean bit 6 is set. Which looking at the datasheet corresponds to a WDOG reset. This makes sense since software reboots are done in a similar fashion to watchdog resets.

0x80 means bit 7 is set, so PWRON reset which makes sense for a full power-cycle.

0x50 means bit 6 and 4 are set. So WDOG and PMIC_RST, which seems to make sense as well.

Did that help clear things up?

Best Regards,
Jeremias

hi @jeremias.tx ,
well, I would expect bit 5 to be set in case of reboot from command line and only bit 6 in case of watchdog, but at the end of the way, the most important thing is that I get always the same value in a specific situation

Regards,
Rocco

well, I would expect bit 5 to be set in case of reboot from command line and only bit 6 in case of watchdog,

I’ve seen other customers gets similar values when doing a software reboot via the reboot command. Seems like that’s just how the driver here interprets things.

but at the end of the way, the most important thing is that I get always the same value in a specific situation

Just to confirm as you said previously the values are consistent in each situation, correct?

Best Regards,
Jeremias

Hi @jeremias.tx ,
yes I always get the same value in the same situation

Okay well, as you said what matters the most here is the consistency of the values so it’s good to see that. Do you have any other questions on this topic then?

Best Regards,
Jeremias

no @jeremias.tx thanks

Glad we were able to help clarify!