1 1
Denis Periša

Orange Pi Zero PWM

Recommended Posts

I have some servo motor I would like to start but cannot find any info on how to do it. Is PWM available in Pi PC or Pi Zero?

 

Thanks

Edited by zador.blood.stained
Merged 2 threads with the same topic (Orange Pi Zero PWM)

Share this post


Link to post
Share on other sites

 

There is /dev/pwm in nanopi.
 
nanopi@nanopim1:~$ ls /dev/p*
/dev/ppp  /dev/psaux  /dev/ptmx  /dev/pwm
 
 
A sample code is here.
 

 

I'm trying to understand how you get from point A to point Z via that matrix repository at Github.  

 

That repository is intended "Nanopi2/Fire/M2" devices, yet the Orange Pi Zero is an Arm H2 device.  Remember the orange pi zero is listed as the topic for this posting.   Is the Orange Pi Zero Arm H2 really a Nanopi2 / Fire or M2 device?  How do you know that? Are these things the same? (I'd refer to the readme.md sheet at the matrix repository, but alas, that doesn't exist... sigh.)

 

Orange Pi Zero = Arm H2 Quad-core Cortex-A7 1.2Ghz.

Raspberry Pi Zero =A Broadcom BCM2835 application processor with 1GHz ARM11 core

 

(Note: no offense intended here..  I'm struggling to understand how to address the pins on the Orange Pi Zero, and I'm more than confused here...  Any hints or links to help gain and understanding? Many thanks --Zip)

Share this post


Link to post
Share on other sites

yup. but I read somewhere that 4.9 kernel should have pwm support for h3/h2 devices.

It has the support, but it's not activated by default since hardware PWM is supported only on PA5 pin, which is used bt default serial console (UART0). So it requires some DT modifications which include moving default debug console to a different UART port.

Share this post


Link to post
Share on other sites

how about software pwm? found this code in another site:

 

#include <wiringPi.h>

int main () {
  wiringPiSetup();
  int t_on, t_off;
  int d, i;

  d= 100 ;

  t_on= 50 *d;
  t_off= 50 *( 100 -d);

  for (i= 10 ; i!= 0 ; i++) {
    digitalWrite( 1 , LOW);
    delayMicroseconds(t_on);
    digitalWrite( 1 , HIGH);
    delayMicroseconds(t_off);
  }
  return ( 0 );
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
1 1