"documentation" on Banana Pi Zero M2 is so chaotic it's even funny.
goal: get PWM working.
so I installed
I designed my board with last RPI 0 I had and I was using pin GPIO 12 (wiringPi 1) so I did:
armbian
, waited a week till my usb OTG cable came (because you'll just fail default SSH into it), configured ssh and followed steps in here to install modified wiring pi -- gpio
utility. I can confirm setting pin L/H works.
next step is to verify PWM works, so here fun begins.
pinout looks to be the same as on Raspberry Pi and so they claim:

# gpio mode 1 pwm
the pin you choose is not surport hardware PWM
you can select PA6 for PWM pin
or you can use it in softPwm mode
so as you can read it's not 'surpot' and I should try PA6.
no idea what is PA6 so I was searching and found this on-the-topic thread .
so I set :
# gpio mode 7 pwm
you choose the hardware PWM:1
and it informed me I have choosen PWM:1 whatever that should mean. (1 being on?)
sure enough I tried to set duty cycle and waited to see my led come on, but just like the gentleman in the foermentioned thread I got:
# gpio pwm 7 100
val pwmWrite 0 <= X <= 1024
Or you can set new range by yourself by pwmSetRange(range
error that doesn't change with ducy cycle value I input it with.
next best bet I found got me to adding pwm overlay, activating pwm, setting period and duty cycle. commands passed without an error but LED did not light up. as suggested at the begginging of the tread in limitations, my PWM line is now connected to GPIO 15 (UART_TXD) **--is this correct??**.
this is my armbianEnv.txt
# cat /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=both
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
rootdev=UUID=986b3dcb-01f8-4965-8a16-03b55c7341fd
rootfstype=ext4
overlays=i2c0 pwm w1-gpio
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
and I just have noticed i2c0
and w1-gpio
were added to overlays
probably by armbian-config
utility so that might be ok.
but if you ask me:
root@bananapim2zero:~# ls /boot/dtb/ | grep pwm
root@bananapim2zero:~# ls /boot/dtb-6.1.11-sunxi/ | grep pwm
shows no such overlay so I don't know.
at the end, I would like to make sense of all that abbreviations as: PA
, all the GPIO pin names listed in here mean, I mean there seem st be some logic in there, but I just don't know why are there two separate tables that prefix those names once with CON2-
then CON3-
following P{0-24}
like there would be two different GPIOs? Why and what is UART _jumper_?
and mainly: how do I get PWM work?
i2c and w1 to follow.
I'm sure answers will shed light to many more lost ones looking for RPI replacement.
Thanks!
Asked by greengold
(113 rep)
Apr 22, 2023, 08:20 PM
Last activity: Apr 23, 2023, 11:53 AM
Last activity: Apr 23, 2023, 11:53 AM