Radxa 0 and PWM

I’m trying to follow the overlay explanations on https://wiki.radxa.com/Zero/Debian and added meson-g12a-pwm-c-on-gpiox-8 and meson-g12a-pwmao-a-on-gpioao-11 to my overlays line:

overlays=meson-g12a-uart-ao-a-on-gpioao-0-gpioao-1,meson-g12a-pwm-c-on-gpiox-8,meson-g12a-pwmao-a-on-gpioao-11

Sidenote: I don’t need to add those overlays to see /sys/class/pwm/pwmchip0 and 2, so why add them?

This is the Debian image zero_debian_buster_xfce4_arm64_20211028_1030-mbr and I’m on kernel 5.10.69-6-amlogic-g775a46783ad8.

Then, when I enter /sys/class/pwm/pwmchip0 I do

# echo 0 > export

And a directory called pwm0 appears. Then I enter directoy pwm0 and I:

# echo 10000 > period
# echo 5000 > duty_cycle
# echo 1 > enable

But no matter what I do, I don’t see any PWM signal appearing on pin 40 or 18 on my scope?
So what am I doing wrong?

Ok, to follow up. I managed to get PWM from PWM_C (pin18) by exporting 0 on pwmchip4. But I still can’t get any signal from PWMAO_A (pin40) on pwmchip0 or 2? Tried many combinations of export (0 and 1)?

update: It’s fixed. For those trying to find out what’s going on:

  1. overlays need to be space separated, not comma!
  2. Default there are two pwmchips in /sys/class/pwm, but with the overlays added, 2 new appear, resulting in 4 pwmchips in total.
  3. pwmchip2/pwm0 is PWMAO_A on pin 40 (device ff807000)
  4. pwmchip6/pwm0 is PWM_C on pin18 (device ffd1a000)

Get additional information about pwm chips with

cat /sys/kernel/debug/pwm
cat /sys/class/pwm/pwmchip4/device/modalias 

pwmchip0 and pwmchip2 seems to refer to CPU (voltage) and WiFi.

After adding meson-g12a-bo-c-on-gpiox-8 to overlays in /boot/uEnv.txt I can see a new device /sys/class/pwm/pwmchip4. The device have the address of PWM_C.
If I configure it with

echo 0 > /sys/class/pwm/pwmchip4/export
echo 1 > /sys/class/pwm/pwmchip4/export

echo 100000 > /sys/class/pwm/pwmchip4/pwm0/period 
echo 100000 > /sys/class/pwm/pwmchip4/pwm1/period

echo 5000 > /sys/class/pwm/pwmchip4/pwm0/duty_cycle 
echo 5000 > /sys/class/pwm/pwmchip4/pwm1/duty_cycle

echo 1 > /sys/class/pwm/pwmchip4/pwm0/enable
echo 1 > /sys/class/pwm/pwmchip4/pwm1/enable

I have an LED connected to pin18, but I don’t see anything. Am I missing something?