.. include:: ../substitutions.rst .. _fan-62A: Fan === The phyCORE-AM62Ax development kit provides fan connectivity via a 4-pin Hirose connector at X16 (VCC_5V0_SW rail). The fan is intended to be mounted directly to the processor heat sink for thermal management. The regulated 5V output is enabled by driving a GPIO0 low (0), turning the fan on. When the GPIO0 is pulled high (1), the 5V supplied to the fan connector will be turned off. This guide will demonstrate how to test your connections to the header x16. To learn more information about the phyCORE-AM62Ax thermal management and fan utilization, please see section 4.9 in the `Hardware Manual `_ . .. image:: ../../images/phycore-am62ax/pb-07524_fan.png :width: 800px Requirements ------------ The phyCORE-AM62Ax development kit does not include a heat sink and fan. The below are the two fans that were tested on the PHYTEC hardware: .. list-table:: :header-rows: 1 * - Item - Description - Link * - Heat Sink - (29mmx29mmx9.5mm) - `Digikey link (heat sink) `_ * - Fan - DC axial fan, 30mm square x 10mm - `Digikey link (fan) `_ * - Female Connector - PCB 1576.2 version 4xpin keyed header - `Digikey link (female connector for 1576.2) `_ * - Crimping Terminals - 4x crimping jackets - `Mouser link `_ .. image:: ../../images/phycore-am62x/pb-07124_fan_schematic_15761.png :width: 700px :alt: phyCORE-AM62Ax Fan Schematic Recommended Header Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. list-table:: :header-rows: 1 * - Pin - Signal - Wire Color * - 1 - VCC_5V0_SW - Red * - 2 - GND - Black * - 3 - FAN_FG - Yellow * - 4 - PWM - Blue Hardware Setup ---------------- * Connect fan to the 4-pin Hirose connector located at X16. Enabling the Overlay --------------------- * Power on the development kit and stop in U-boot. * Load the device tree overlay required for exporting the GPIO signal that controls the fan and then boot the board. .. code-block:: none :caption: Target (U-boot) setenv overlays k3-am62-phyboard-lyra-gpio-fan.dtbo boot .. note:: For more information about overlays see chapter :ref:`ConfiguringTheBootloader-62A`. * Verify that the "gpio-fan" was exported properly to gpio-460. .. code-block:: none :caption: Target (Linux) cat /sys/kernel/debug/gpio .. code-block:: none :caption: Expected Output root@phyboard-lyra-am62axx-2:~# cat /sys/kernel/debug/gpio gpiochip2: GPIOs 360-367, parent: i2c/1-0021, pcf8574, can sleep: gpio-360 (GPIO0_HDMI_RST |reset ) out hi ACTIVE LOW gpio-361 (GPIO1_CAN0_nEN |standby ) out lo gpio-362 (GPIO2_LED2 |led-2 ) out lo gpio-363 (GPIO3_LVDS_GPIO ) gpio-364 (GPIO4_BUT2 |menu ) in lo IRQ gpio-365 (GPIO5_LVDS_BKLT_EN ) gpio-366 (GPIO6_ETH1_USER_RESE) gpio-367 (GPIO7_AUDIO_USER_RES) gpiochip1: GPIOs 368-419, parent: platform/601000.gpio, 601000.gpio: gpio-391 ( |home ) in lo gpiochip0: GPIOs 420-511, parent: platform/600000.gpio, 600000.gpio: gpio-433 ( |green:heartbeat ) out lo gpio-452 ( |led-1 ) out lo gpio-460 ( |gpio-fan ) out lo ACTIVE LOW Toggling the Fan ------------------- * Turn the fan ON. .. code-block:: none :caption: Target (Linux) echo 1 > /sys/class/thermal/cooling_device0/cur_state .. note:: Run the command above 3-4 times to have the fan stay ON consistently. * Turn the fan OFF. .. code-block:: none :caption: Target (Linux) echo 0 > /sys/class/thermal/cooling_device0/cur_state Enabling a proper Thermal Governor ---------------------------------- If your application includes a GPIO-based fan, PHYTEC recommends enabling the bang-bang thermal governor as the default setting. This governor uses hysteresis to manage fan state transitions, preventing abrupt on/off cycling and enabling smoother control for fans that only support binary on/off operation, rather than variable speed throttling. Update the current thermal governor strategy to bang-bang using the command below: .. code-block:: none :caption: Target (Linux) echo bang_bang > /sys/class/thermal/thermal_zone0/policy .. note:: To enable the bang-bang thermal governor by default, recompile the kernel with CONFIG_THERMAL_DEFAULT_GOV_BANG_BANG=y in the menuconfig configuration. For further details, please refer to the guide: |ref-modify-bsp|.