AnsweredAssumed Answered

Output the PWM signal

Question asked by zcyhansen on May 12, 2013
Latest reply on May 12, 2013 by Aaronwu

now am using the example driver at :

drivers/char/bfin_simple_timer.c

and the driver compile well. And I had insert the modle in my BF537 (running uclinux)

it dose well .

next ,i  write a applications to use the driver to produce the pwm .

the application is follow:

#include <stdio.h>

#include <stdlib.h>

#include <unistd.h>

#include <sys/ioctl.h>

#include <sys/types.h>

#include <sys/stat.h>

#include <fcntl.h> //open function

#include "pwmapp.h"

int main(){

    int fd,result;

    fd=open("/dev/timer7",O_RDWR);// timer7 linkto minor=7

    if(fd==-1)

        return 0;

    result=ioctl(fd,BFIN_SIMPLE_TIMER_SET_PERIOD,3);

    printf("ioctl %d\n",result);   

    result=ioctl(fd,BFIN_SIMPLE_TIMER_START,3);

    printf("ioctl %d\n",result);

    //result=ioctl(fd,8,3);

    while(1){

    }

    return 0;

}

 

and I run this application.  but  the pin cannot  output any signal.

I read the bf537 datasheet:  it said:

"Every timer has a dedicated TMRx pin that can be found on port F ,If enabled, the TMRx pins output the single-pulse or PWM signals generated by the timer. "

And the datasheet says timer7 pin is PF2.QQ截图20130511202514.jpg

so  I  test the PF2 pin    this is my port:(GPIO_UART1TX_PF2)

QQ截图20130511202421.jpg

 

BUT THIS port cannot test any output.??

Outcomes