# Boards with PWM on FreeBSD



## Phishfry (Feb 1, 2022)

PWM on FreeBSD. Many Arm boards offer PWM Pins. What boards do you use with PWM on FreeBSD?
I believe PWM requires a driver and not all arm boards offer them.
If a Board Support Package is provided it usually requires rework for FreeBSD.


Know Working
--------------------------------
BeagleBoneBlack


Refrences
---------------------------------





						⚙ D17938 Add a PWM subsystem
					






					reviews.freebsd.org
				








						pwm(8)
					






					www.freebsd.org


----------



## Phishfry (Feb 2, 2022)

Looks like these are the two PWM drivers in GENERIC kernconf.

```
# PWM
device        pwm
device        aw_pwm
device        rk_pwm
```

I wonder if the Rock64 would work with this driver.





						rS356808
					






					reviews.freebsd.org
				




 I wonder if this works on all Allwinner chips or just 64bit ? Like BPi-M1 with A20.





						src - FreeBSD source tree
					






					cgit.freebsd.org


----------



## Andriy (Feb 2, 2022)

AFAIR, Rock64 does not route PWM outputs to its pin headers in a usable fashion.
It nominally has two PWM outputs but both go through the pins that are used by an I2C bus which is used by the PMIC.

On Orange Pi PC Plus there are also two PWMs, but one is routed to the pin that's used by the power LED, so pretty much all you can do with that PWM is flicker the LED (short of desoldering the LED and adding a header). The other is routed to the dedicated serial header, so if you want to use it you have to jump through the hoops to switch serial console to something else (or just do without it).

Sometimes board designers make silly choices with how they use multi-function pins.


----------



## Isoux (Feb 3, 2022)

Andriy said:


> On Orange Pi PC Plus there are also two PWMs, but one is routed to the pin that's used by the power LED, so pretty much all you can do with that PWM is flicker the LED (short of desoldering the LED and adding a header). The other is routed to the dedicated serial header, so if you want to use it you have to jump through the hoops to switch serial console to something else (or just do without it).


I think that something can be done with PWM1 on PA6 mux 3.
PWR LED is on PL10 & STATUS LED on PA15
I checked that as you can see in my post:
`% sudo gpioctl -t PA15`
`% sudo gpioctl -f /dev/gpioc1 -t PL10`
so we'll see ....


----------



## unitrunker (Feb 3, 2022)

Two PWM output alternates that work on commodity hardware.

1. audio output eg. /dev/dsp
2. directly toggle the RTS or DTR pins on a serial port.

Option 1 will have higher latency than option 2.

An equally important question is how much current do you need?


----------



## Andriy (Feb 3, 2022)

Isoux said:


> I think that something can be done with PWM1 on PA6 mux 3.


There is no PWM1 in H3.


----------



## Isoux (Feb 3, 2022)

Andriy said:


> There is no PWM1 in H3.


But the picture you posted above shows that there is?


----------



## Phishfry (Feb 3, 2022)

Isoux said:


> But the picture you posted above shows that there is?


Yes but they rob it at board level for i2c & PMIC as he stated.

You actually see this frequently. PWM is used for backlight control on many laptops.
It's there but you can't use it.


----------



## Andriy (Feb 4, 2022)

Isoux said:


> But the picture you posted above shows that there is?


It's in the picture but not in the H3 specification and it is not actually available.
I guess that mistakes happen and, in the internet age, they get proliferated quite often.


----------



## Isoux (Feb 4, 2022)

Ок


----------

