This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PWM ecap mode to read the PWM signal range , dutycycle and etc.

Other Parts Discussed in Thread: AM3352

Hi,
We wrritten our own PWM-as Capture mode -- but few things i didnt able to get -- 
we are looking for "Period" and "dutycycle" from the capture registers. 

Does the below configuration -- "IS IT SUITS..???" to our requirements


Configuration: code: Absolute Time-Stamp Operation Rising Edge Trigger Example : page: 2368 : 
code snippts: Page: 2369 : 
//------------ECCTL1---------------------------------------------------- 
reg_val = readw(pc->mmio_base + ECCTL1); // read the exsisting value

/* Configure eCAP mode & disable sync option */
//reg_val &= (~(ECCTL2_APWM_MODE)) ; //SET TO CAPTURE MODE

reg_val |= (ECCTL1_CAP4POL|ECCTL1_CAP3POL|ECCTL1_CAP2POL|ECCTL1_CAP1POL); // SE ALL 4 AS RISING EDGE

reg_val |= (ECCTL1_CTRRST4|ECCTL1_CTRRST3|ECCTL1_CTRRST2|ECCTL1_CTRRST1); // SE ALL 4 AS RISING EDGE 

reg_val |= ECCTL1_CAPLDEN; // Enable 

reg_val &= (~(ECCTL1_PRESCALE_DIV));

printk(KERN_INFO "ECCTL1:0x%x \n",reg_val);


writew(reg_val, pc->mmio_base + ECCTL2);


//------------ECCTL2---------------------------------------------------- 
reg_val = readw(pc->mmio_base + ECCTL2); 

reg_val &= (~(ECCTL2_APWM_MODE |ECCTL2_SYNC_EN |ECCTL2_CONT_ONESHT)) ; //CLEAR BIT (9|5|1)
// SET TO CAPTURE MODE 

reg_val |= (ECCTL2_TSCTR_FREERUN | ECCTL2_SYNC_SEL_DISA); // SE ALL 4 AS RISING EDGE


// reg_val |= ECCTL2_SWSYNC|ECCTL2_SYNCI_EN|ECCTL2_RE_ARM|ECCTL2_STOP_WRAP;
printk(KERN_INFO "ECCTL1:0x%x \n",reg_val);

writew(reg_val, pc->mmio_base + ECCTL2);

As in the capture mode : 4 - usecases given in the tech. reference manual in that we took 1 as testing 

1. Absolute Time-Stamp Operation Rising Edge Trigger Example
2. Absolute Time-Stamp Operation Rising and Falling Edge Trigger Example
3. Time Difference (Delta) Operation Rising Edge Trigger Example
4. Time Difference (Delta) Operation Rising and Falling Edge Trigger Example

Please suggest us one -- out of 4 modes , which of the more can we use for the period and dutycycle.
------ PWM-mode PWM-1A and PWM-1B -- generates PWM waveform 
------ those wave form is captured by eCAP0 and eCAP2 and also Timer 5 and 6.

we are wrritten code for the capture mode with ecap0 and ecap2.

Please guide to read the pwm.

regards,

Viswanath K