usb-pd-arduino
usb-pd-arduino copied to clipboard
Arduino Framework disables Dead Battery Support
Grüezi in die Schweiz,
thank you, Manuel, for this wonderful library! I am using it in my project https://github.com/klaus-liebler/labathome. The usage scenario requires Dead Battery Support.
I did not get this feature working and after investigating it, I discovered this: https://github.com/stm32duino/Arduino_Core_STM32/pull/1374/commits/1f5cb30fe186836c6e7ef6708257f1a563e6df83
So, the Arduino Framework disables the Dead Battery PullDowns in a very early initialisation phase, when your stack has not yet initialized the UCPD peripherial. So, the USB-C PSU shuts down, the STM32 resets and presents the PullDowns again...which awakes the PSU and the CPU boots again --> endless reboots. Unfortunately, the only way to overcome this Arduino-paternalism is to comment out the particular line of code. Of cource, this is not a direct issue of your library, but just in case others stumble on it.
Regards,
Klaus
Thank you for the feedback. This is good to know. So far I didn't pay much attention to the Arduino code in that area...
Thanks for this issue! I had an issue with only specific PD sources causing some issues, I wonder if the timing of this was causing an issue with that. I'll have to check again now that STM32duino has patched it.
In order to avoid chasing github issues, the way to disable this behavior in stm32duino core >2.9.0 is build flag SKIP_DISABLING_UCPD_DEAD_BATTERY.