본문 바로가기

IT/Linux

Linux kernel AM335X PWM 설정 및 사용

1. PWM 사용법은 하기의 웹사이트 참조 한다.

http://software-dl.ti.com/processor-sdk-linux/esd/docs/latest/linux/Foundational_Components/Kernel/Kernel_Drivers/PWM.html

 

3.2.4.11. PWM — Processor SDK Linux for AM335X Documentation

Linux has support for Enhanced Pulse Width Modulator (ePWM) and Auxiliary Pulse Width Modulator (APWM) modules. APWM is Enhanced Capture (eCAP) module configured in PWM mode. These devices are part of The Pulse-Width Modulation Subsystem (PWMSS) The curren

software-dl.ti.com

 

2. HW  

(1) PWMSS (Pulse-width Modulation Subsystem) 은 다음 3개의 모듈로 구성 되어 있다.

    본 문서에서는 eHRPWM을 사용에 관한 내용이다.

    ① eHRPWM

    ② eCAP

    ③ eQEP

 

3, Device Tree

4. 사용법

  (1) 커널을 부팅 하고, sysfs interface에는 아래와 같이 표시되어야 드라이버가 등록된 것이다.

 (2)  PWM 모듈 Request

(3) pwmX는 다음과 같은 File들로 구성 되어 있다.

(4) period 와 duty_cycle에 값이 있어야 모듈이 enable 된다.

    1khz, 30% duty로 설정하고, pwm1은 극성을 바꾸면 duty가 70%가 된다.

(4) 동작 화면

 - yellow : pwm0(ehrpwm2a)  / green : pwm1(ehrpwm2b)

반응형