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.

PROCESSOR-SDK-AM62X: Using ECAP as APWM

Part Number: PROCESSOR-SDK-AM62X
Other Parts Discussed in Thread: AM625

trying to use eCAP1 driver as APWM on AM62x platform  (BSP-08_03_00_19) 

throwing the error "no device"  while doing echo to enable 

how to use eCAP driver in APWM mode for AM62x platform ?

in dtb only ecap1 and ecap0 are enabled , all other nodes disabled

according to your documentation 

  • eCAP modules provide a single PWM output channel pre instance when configured in APWM mode

so, how to configure it in APWM mode ? 

- Nagendra 

  • Hello Nagendra,

    To confirm, you are using the AM62x SK board right?

    When I go to the AM62x Linux Processor SDK 8.3 board-support/linux-x.x.x/arch/arm64/boot/dts/ti/k3-am625-sk.dts, I see that the epwms and ecaps are all disabled by default:

    &epwm0 {
            status = "disabled";
    };
    
    &epwm1 {
            status = "disabled";
    };
    
    &epwm2 {
            status = "disabled";
    };
    
    &ecap0 {
            status = "disabled";
    };
    
    &ecap1 {
            status = "disabled";
    };
    
    &ecap2 {
            status = "disabled";
    };
    

    So I would not expect you to see any PWM or ECAP instances on your EVM board under /sys/class/pwm until you modify the dts file to enable the instances, rebuild the dtb file, and put the new dtb file in the EVM's Linux filesystem under /boot/ (I'll typically rename the original dtb file to k3-am625-sk.dtb.orig just so I can keep it around for ease of use).

    If you have already modified the device tree file, what do you see on the board when you search the pwm directory?
    # ls /sys/class/pwm

    Regards,

    Nick

  • hello Nick

    yes I enabled it ecap1 driver in the dts file. I am using custom AM625 HW

    i could enabled the pwm of ecap1 device using below commands 

    echo 0 > /sys/class/pwm/pwmchip0/export  (this creates pwm0 node, but echo 1 throws error) 
    echo 900000000 > /sys/class/pwm/pwmchip0/pwm0/period
    echo 30000000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
    echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable 

    now, the issue is with pwm frequency which is 10 HZ , i could not increase the frequency , I need minimum 1KHZ 

    is there any limitation ?

    - nagendra 

  • Hello Nagendra,

    Please reference https://software-dl.ti.com/processor-sdk-linux/esd/AM62X/08_03_00_19/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/PWM.html 

    If you get 1 as an output from $ cat /sys/class/pwm/pwmchip5/npwm , then that means there is only one channel on that PWM instance. echo 0 should export the first channel, echo 1 would export the second channel if there was one, etc.

    Did you try disabling the ecap instance, then changing the period, then re-enabling the ecap instance? I am not sure whether the signal period will change if the ecap is enabled when the period value is updated.

    Regards,

    Nick