Hi there,
I want to measure VBUS without any external circuitry and came across the USB-C VBUS Zephyr API.
Is this API suitable for what I'm after? If so, do I need to sacrifice one or multiple pins for this purpose?
I found some relevant KConfig options options. In my prj.conf, I can enable the CONFIG_USBC_VBUS_DRIVER Kconfig option. However, when trying to enable CONFIG_USBC_VBUS_ADC, I get the "CONFIG_USBC_VBUS_ADC was assigned the value y, but got the value n. Missing dependencies: DT_HAS_ZEPHYR_USB_C_VBUS_ADC_ENABLED" warning. There's no CONFIG_DT_HAS_ZEPHYR_USB_C_VBUS_ADC_ENABLED Kconfig option, and I'd think that I can resolve this warning by adding the relevant node in the devicetree.
Based on the USB-C device stack page, I tried to add the following devicetree nodes:
port1: usbc-port@1 { compatible = "usb-c-connector"; reg = <1>; tcpc = <&ucpd1>; vbus = <&vbus1>; power-role = "sink"; sink-pdos = <PDO_FIXED(5000, 100, 0)>; }; vbus1: vbus { compatible = "zephyr,usb-c-vbus-adc"; io-channels = <&adc2 8>; output-ohms = <49900>; full-ohms = <(330000 + 49900)>; };
However, any of the above nodes make the build fail.
Thanks in advance for your help!
- Laci