Hi,
I am currently looking at using the two pwms in tiny6410 to run 2 stepper
motors.
I have got PWM0 working using the mini6410_pwm.c driver provided by
friendly arm. But I am facing trouble using both simultaneously. It would
be a big help if anyone can provide a working example of this. Code to
generate signal on PWM1 would also greatly help.
code used for PWM0 :
tmp = readl(S3C64XX_GPFCON);
tmp &= ~(0x3U << 28);
tmp |= (0x2U << 28);
writel(tmp, S3C64XX_GPFCON);
tcon = __raw_readl(S3C_TCON);
tcfg1 = __raw_readl(S3C_TCFG1);
tcfg0 = __raw_readl(S3C_TCFG0);
//prescaler = 50
tcfg0 &= ~S3C_TCFG_PRESCALER0_MASK;
tcfg0 |= (50 - 1);
//mux = 1/16
tcfg1 &= ~S3C_TCFG1_MUX0_MASK;
tcfg1 |= S3C_TCFG1_MUX0_DIV16;
__raw_writel(tcfg1, S3C_TCFG1);
__raw_writel(tcfg0, S3C_TCFG0);
clk_p = clk_get(NULL, "pclk");
pclk = clk_get_rate(clk_p);
tcnt = (pclk/50/16)/freq;
__raw_writel(tcnt, S3C_TCNTB(0));
__raw_writel(tcnt/2, S3C_TCMPB(0));
tcon &= ~0x1f;
tcon |= 0xb; //disable deadzone, auto-reload, inv-off, update
TCNTB0&TCMPB0, start timer 0
__raw_writel(tcon, S3C_TCON);
tcon &= ~2; //clear manual update bit
__raw_writel(tcon, S3C_TCON);
I dont require dead zone and DMA.
Thanks in advance,
Harsha

