Real PWM?

Milan Romic
Hi everyone!

I am playing with, how they call it, "PWM" example but it is not a real
PWM. There is no width modulation, only modulation with frequency. With
this PWM you cannot change effective value at output.

Is there any example or anything (maybe kernel module) what is a real PWM?

Thanks in advance

tn88test
You can look at this http://www.youtube.com/watch?v=9y6kIe9jpu8

Milan Romic
Thanks!

I hope that will help.

tn88test
If you want real PWM, you need to build your own driver. On the S3C2440
datasheet PWM function can be implemented by using the TCMPBn. PWM
frequency is determined by TCNTBn. For a higher PWM value, decrease the
TCMPBn value. For a lower PWM value, increase the TCMPBn value.

You can study the mini2440_pwm.c source code in the kernel build.You can
see that it only control the frequency.

clk_p = clk_get(NULL, "pclk");
pclk  = clk_get_rate(clk_p);
tcnt  = (pclk/50/16)/freq;
  
__raw_writel(tcnt, S3C2410_TCNTB(0));
__raw_writel(tcnt/2, S3C2410_TCMPB(0));

tn88test
You can try to change 

__raw_writel(tcnt/2, S3C2410_TCMPB(0));

to

__raw_writel(tcnt/4, S3C2410_TCMPB(0));

rebuild it and you will get 1/4 PWM.