PWM (hard) orange pi PC (H3) example blinky OK 看全部

I was looking into hardware pwm and thought I could use the sunxi_pwm module,
I had a look in the H3 manual, and I think only port PA5 is usable (serial boot connector middle pin)
I had no luck executing the sunxi_pwm module (filesystem with PWM0 is not created).
The fex file does not set the port correctly to pwm nor the pwm register.
WiringOP is not configured correctly for PWM (yet)

But you can always set the ports manually ;)
(p 317 H3 manual  011 PWM0 dataregister for port PA5)

in the H3 manual P.188 the state that the control register for PWM is at 0x01C21400 (here you can set the frequency with prescalers for 24Mhz)
At an offset of 0x04 you can find the control register for the period (duty cycle --upper 16bit is number of cycles -- lower 16bit is number of active cycles -- upper has to be greater or equal)
in the manual they only refer to channel 0...

I attached an example with comment, which blinks a LED attached to port PA05. You can play with it by modifying the code (see comment)




attachment: 您需要登录才可以下载或查看附件。没有账号?Register
Is there a way to use WiringPi with PWM on the OPC?
  • 推荐 osator
  • 2016-3-25 19:57:49
I've check your code and PWM0 is working. I also tried to run PWM1 (I've changed information about register in code to PA6) but it didn't worked. So only one hadrware PWM is available on OP?
let me try
@osator
Yes. You can read about this in  H3 datasheet v1.1
SoC H3 has only one port PWM
123NextPage