Hi all,
I started to play with i.MX93 FRDM board and when I wrote a simple script to control RGB LEDs on the board, I've managed to control only Green and Blue LEDs. Red LED stays ON whatever I tried.
Based on the schematics, all leds are connected in a similar manner, so they operate Active High.
Here is my script:
---------------------------
#!/bin/sh
PERIOD=1000000
set_pwm() {
CHIP=$1
CHANNEL=$2
DUTY=$3
PWM_PATH="/sys/class/pwm/pwmchip${CHIP}/pwm${CHANNEL}"
if [ ! -d "$PWM_PATH" ]; then
echo "$CHANNEL" > "/sys/class/pwm/pwmchip${CHIP}/export" 2>/dev/null
fi
# Reset duty cycle to 0 first to satisfy TPM driver constraints
echo 0 > "${PWM_PATH}/duty_cycle" 2>/dev/null
echo "$PERIOD" > "${PWM_PATH}/period"
echo "$DUTY" > "${PWM_PATH}/duty_cycle"
echo 1 > "${PWM_PATH}/enable" 2>/dev/null
}
# Red is Active-Low: Default OFF = 1000000 (3.3V / High)
RED_DUTY=${1:-0}
# Green and Blue are Active-High: Default OFF = 0 (0V / Low)
GREEN_DUTY=${2:-0}
BLUE_DUTY=${3:-0}
# Red -> pwmchip4, Channel 3
set_pwm 4 3 "$RED_DUTY"
# Green -> pwmchip0, Channel 0
set_pwm 0 0 "$GREEN_DUTY"
# Blue -> pwmchip0, Channel 2
set_pwm 0 2 "$BLUE_DUTY"
-------------------------------------------
I've checked that red LED (GPIO_IO13) is allocated to the ledsgrp2:
pin 17 (IMX93_IOMUXC_GPIO_IO13): 424f0000.pwm (GPIO UNCLAIMED) function pinctrl group ledsgrp2
as far as I can see with debugfs commands, the pin GPIO_IO13 is configured for ALT1 mode, which is a TPM2 channel 3 (PWM).
when I run the script, I can successfully control Blue and Green LEDS but Red LED stays ON.
Is there something that I miss?