AM5728 eHRPWM 驱动和中断设计随笔

eHRPWM波形产生方法

(1)将pwm1.sh脚本拷至/opt/tools目录下。

(2)运行如下命令:

root@am57xx-evm:/opt/tools# chmod 777 pwm1.sh

root@am57xx-evm:/opt/tools# ./pwm1.sh 1000000 500000 200000

Set APWM1 mode acsuccess!

root@am57xx-evm:/opt/tools# cat /sys/kernel/debug/pwm

platform/dmtimer-pwm@16, 1 PWM device

 pwm-0   (pwm_fan             ): requested enabled

 

platform/48440200.pwm, 2 PWM devices

 pwm-0   (sysfs               ): requested enabled

 pwm-1   (sysfs               ): requested enabled

 

platform/4843e100.ecap, 1 PWM device

 pwm-0   (backlight           ): requested enabled

root@am57xx-evm:/opt/tools# cat /sys/class/pwm/pwmchip1/pwm0/{enable,period,duty_cycle}

1

1000000

500000

root@am57xx-evm:/opt/tools# cat /sys/class/pwm/pwmchip1/pwm1/{enable,period,duty_cycle}

1

1000000

200000

(3)然后用示波器测量EHRPWM2B引脚。

 

4)./pwm1.sh 1000000 500000 200000  (可以改变占空比)

(5)重启,可以改变周期。./pwm1.sh 2000000 500000 200000

 

本调试基于信迈科技XM5728-IDK-V3开发板。

AM5728: Beagle-x15 board the output for EHRPWM2A pins issue

 

https://e2e.ti.com/support/processors/f/791/t/929657?AM5728-Beagle-x15-board-the-output-for-EHRPWM2A-pins-issue

 

C6747 EHRPWM Example

 

https://processors.wiki.ti.com/index.php/C6747_EHRPWM_Example

 

 

Linux/AM6548: ehrpwm

https://e2e.ti.com/support/processors/f/791/t/748195

 

 

TI WIKI:

https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Foundational_Components/Kernel/Kernel_Drivers/Display/PWM.html

 

 

Regarding CTRL_MMR0 tbclk, you need to enable this in driver file (pwm-tiehrpwm.c), you need to use register CTRLMMR_EPWM0_CTRL/0x00104140.

See for example how CTRLMMR_OLDI_DAT0_IO_CTRL/0x001041E0 register is used in below files:

linux-4.14.67/drivers/gpu/drm/tidss/tidss_dispc7.h
linux-4.14.67/drivers/gpu/drm/tidss/tidss_dispc7.c

Regards,
Pavel

 

 

 

~/XM/kernel/Linux/drivers$ vi pwm/pwm-tiehrpwm.c

https://git.ti.com/cgit/apps/tida01555/tree?h=master

 

 

Page 6931

 

 

~/XM/kernel/Linux/drivers$ vi irqchip/irq-crossbar.c

 

Are these codes useful?

C:\ti\processor_sdk_rtos_am57xx_6_03_00_106\pdk_am57xx_1_0_17\packages\ti\csl\example\gpio\gpio_interrupt.c

 

C:\ti\processor_sdk_rtos_am57xx_6_03_00_106\pdk_am57xx_1_0_17\packages\ti\csl\arch\a15\src\ interrupt.c

 

C:\ti\processor_sdk_rtos_am57xx_6_03_00_106\pdk_am57xx_1_0_17\packages\ti\csl\arch\c66x\ interrupt.c

 

Please refer to ~/pdk_am57xx_1_0_17/packages/ti/osal/src/tirtos/RegisterIntr_tirtos.c for the OSAL APIs you can use to install ISR in TI-RTOS.

You can also refer to ~/pdk_am57xx_1_0_17/packages/ti/drv/uart/src/v1/UART_v1.c as example how the APIs are used.

 

 

https://e2e.ti.com/support/processors/f/791/t/931094?CCS-AM5728-EHRPWM-Interrupt-in-DSP-with-TI-RTOS

 

In AM5728's DSP processor, we need EHRPWM Interrupt with TI RTOS. The question is how to register interrupt isr?

We need to detect the phase by  ehrpwm2A or ehrpwm2B interrupts when the counter is decreased from period to zero.

 

I have configured the registers for interrupt as here:  

 

void PWM_InterruptConfig(void)

{

    /*

     * AM57x DSP does not have a default Xbar connection for PWM

     * interrupts, need to use a reserved IRQ Xbar instance for Xbar

     * interrupt configuration

     */

     /* Use reserved XBAR_INST_DSP1_IRQ_34 */

    CSL_xbarIrqConfigure(CSL_XBAR_IRQ_CPU_ID_DSP1, CSL_XBAR_INST_DSP1_IRQ_34, CSL_XBAR_PWMSS2_IRQ_ePWM1INT);

 

    // disables the ePWM Event interrupt.

    CSL_epwmEtIntrDisable(PWM_BASE_ADDRESS);

 

    // Configures the interrupt source and interrupt period.

    // Enable event time-base counter equal to zero.

    // Generate an interrupt on the first event

    CSL_epwmEtIntrCfg(PWM_BASE_ADDRESS, PWMSS_EPWM_ETSEL_INTSEL_CTR_0, PWMSS_EPWM_ETPS_INTPRD_GEN_FIRST_EVT);

 

    // Enables the ePWM Event interrupt.

    CSL_epwmEtIntrEnable(PWM_BASE_ADDRESS);

 

}

 

But I also write ISR, which needs to be registered or installed.

How to register it in TI RTOS?

 

Are these codes useful?

C:\ti\processor_sdk_rtos_am57xx_6_03_00_106\pdk_am57xx_1_0_17\packages\ti\csl\example\gpio\gpio_interrupt.c

 

C:\ti\processor_sdk_rtos_am57xx_6_03_00_106\pdk_am57xx_1_0_17\packages\ti\csl\arch\a15\src\ interrupt.c

 

C:\ti\processor_sdk_rtos_am57xx_6_03_00_106\pdk_am57xx_1_0_17\packages\ti\csl\arch\c66x\ interrupt.c

 

 

Thanks,

 

 

 

How to specify pinmux configuration for EHRPWM0 in motor_control example for IDK AM437x?

https://e2e.ti.com/support/processors/f/791/t/487977?How-to-specify-pinmux-configuration-for-EHRPWM0-in-motor-control-example-for-IDK-AM437x-

 

How to get AM335x ePWM interrupt

 

https://e2e.ti.com/support/legacy_forums/embedded/linux/f/354/p/474058/1705662

 

request_irq failed/GPIO Example

 

https://e2e.ti.com/support/processors/f/791/t/395791

 

 

Dts:

~/XM/kernel/Linux/arch/arm/boot/dts$ vi dra7.dtsi

~/XM/kernel/Linux/arch/arm/boot/dts$ vi am57xx-evm-common.dtsi

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值