PWM fifo,bus flag error - Raspberry Pi Forums


hello everybody,

i'm trying configure gpio18 pwm0 output. did following configurations

highlight:

code: select all

  gpf_sel1_v = 0x2000000; //set gpio18 alt5 -> pwm   pwm_ctl_v = pwm0_enable | pwm0_ms_mode;   pwm_rng1_v = 0x400;   pwm_dat1_v = 0x300; //duty cycle of 75% 
more code:

code: select all

//definities van de registers  #define gpf_sel1   	0x20200004    #define gpf_sel1_v      (*(volatile unsigned long *)gpfsel1)      #define pwm_ctl  	0x2020c000   				 #define pwm_ctl_v      (*(volatile unsigned long *)pwmctl)  #define pwm_sta  	0x2020c004   				 #define pwm_sta_v      (*(volatile unsigned long *)pwmsta)  #define pwm_rng1  	0x2020c010  				 #define pwm_rng1_v      (*(volatile unsigned long *)pwmrng1)  #define pwm_dat1  	0x2020c014   				 #define pwm_dat1_v      (*(volatile unsigned long *)pwmdat1)  #define	pwmclk_cntl	40 #define	pwmclk_div	41 #define	pwm0_ms_mode    0x0080  // run in ms mode #define	pwm0_usefifo    0x0020  // data fifo #define	pwm0_revpolar   0x0010  // reverse polarity #define	pwm0_offstate   0x0008  // ouput off state #define	pwm0_repeatff   0x0004  // repeat last value if fifo empty #define	pwm0_serial     0x0002  // run in serial mode #define	pwm0_enable     0x0001  // channel enable   #define module_name "pwm_module"   unsigned long gpfsel1;  unsigned long gpset0;  unsigned long gpclr0; unsigned long pwmctl; unsigned long pwmrng1; unsigned long pwmdat1; unsigned long pwmsta; unsigned long value;  ...  int pb_init(void)  { ...    printk("<1>pb: ioremap\n");     gpfsel1 =(unsigned long)ioremap(gpf_sel1,4); 	   gpset0 =(unsigned long)ioremap(gp_set0,4);    gpclr0 =(unsigned long)ioremap(gp_clr0,4);    pwmctl =(unsigned long)ioremap(pwm_ctl,4);    pwmrng1 =(unsigned long)ioremap(pwm_rng1,4);   pwmdat1 =(unsigned long)ioremap(pwm_dat1,4);   pwmsta =(unsigned long)ioremap(pwm_sta,4); 		     printk("<1>pb set register\n");  				     gpf_sel1_v = 0x2000000; //set gpio18 alt5 -> pwm   pwm_ctl_v = pwm0_enable | pwm0_ms_mode;   pwm_rng1_v = 0x400;   pwm_dat1_v = 0x300; //duty cycle of 75%    value = pwm_sta_v;   printk("%ld",value);      return 0;  }  ...   module_init(pb_init); 					 module_exit(pb_exit);						 
when read pwm status register flag "fifo read error flag" , "bus error flag" high. don't use fifo instead use data register. know i'm doing wrong?

thanks

most of code i've seen sprinkles 10 microsecond delays around writing pwm registers.


raspberrypi



Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums