In my project I use the BBB as the main controller for the autonomous system with a battery supply. The startup of the system has only one option, it’s a key. It is a simple key with 2 positions on/off that switches the power relay. The supply remains on till key in “on” position. The same logic as the key in the car.
The BBB uses 5V AC connector wich comes from switch relay for supplying and BBB board has a nice feature with a battery as 2nd power supply. To be sure that BBB will be switched off correctly I want to use PMIC’s (TPS65217) feature to generate an ACM interrupt. In this interrupt, I want to stop execution, save logs and switch BBB off till the supercap/battery will discharge.
I use Debian ( 4.19.173-bone-rt-r60 ) on BBB. The image was build with OMAP builder.
After boot, I’ve checked the PMIC settings:
i2cget -f -y 0 0x24 0x2
0x20
Where AC interrupt mask bit 5:
0b = Interrupt is issued when power to the AC input is applied or removed.
1b = No interrupt is issued when power to the AC input is applied or removed.
That means, that the interrupt is masked and if I do any action with AC cable, the interrupt counter will not be increased
~$ cat /proc/interrupts | grep tps
68: 0 INTC 7 Level tps65217-irq
70: 0 tps65217 0 Edge vbus
71: 0 tps65217 2 Edge tps65217_pwr_but
Interrupt counter returns always 0:
~$ cat /proc/irq/68/spurious
count 0
unhandled 0
last_unhandled 0 ms
if I manually remove 5th bit, the counter works fine.
To debug this, I tried to follow that topic:
Disable Power Button IRQ from TPS65217 on BBBW? - Linux Discussions - Engineering and Component Solution Forum - TechForum │ Digi-Key
I’ve disabled pwr button, just to be sure that dts was compiled correctly.
The button was disabled successful.
The next step was to remove USB from the charger part:
tps@24 {
reg = < 0x24 >;
compatible = "ti,tps65217";
interrupt-controller;
#interrupt-cells = < 0x01 >;
interrupts = < 0x07 >;
interrupt-parent = < 0x01 >;
ti,pmic-shutdown-controller;
phandle = < 0x38 >;
charger {
compatible = "ti,tps65217-charger";
interrupts = < 0x00 >;
interrupt-names = "AC";
status = "okay";
};
pwrbutton {
compatible = "ti,tps65217-pwrbutton-disabled";
interrupts = < 0x02 >;
status = "disabled";
};
But after replacing the new compiled am335x-boneblack-uboot-univ.dtb
i2cget -f -y 0 0x24 0x2
0x60
The mask was not cleared and AC interrupt does not work as expected.
It would be nice to hear from the community how can I get it working or what I do wrong.
Thank you for your attention
Best regard