如何设置P12.4为TC0_39_TR1

公告

大中华汽车电子生态圈社区并入开发者社区- 更多资讯点击此

Tip / 登入 to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Jack_Jiang
Level 1
Level 1
Distributor - Future(GC)
5 questions asked First solution authored First reply posted

Dears,

我基于CYT2B7_M4在测试TCPWM0的capture功能,例程是TVII_Sample_Driver_Library_7.2.0\tviibe1m\src\examples\tcpwm\capture,按照例程将P12.4成功修改成TC0_40_TR0复用功能,但是这个PIN也可以配置为TC0_39_TR1,尝试修改为TC0_39_TR1失败,请问该如何修改,修改了main_cm4.c如下代码:

Line28~30

/* Capture Mode Configuration def */
#define TCPWM0_GRPx_CNTx_CAPTURE TCPWM0_GRP0_CNT39//TCPWM0_GRP0_CNT0
#define PCLK_TCPWM0_CLOCKSx_CAPTURE PCLK_TCPWM0_CLOCKS39//PCLK_TCPWM0_CLOCKS0
#define TCPWM_PERI_CLK_DIVIDER_NO_CAPTURE 0u

 

Line33~35

#define TCPWM_TR_ONE_CNT_INx_PORT GPIO_PRT12//GPIO_PRT6
#define TCPWM_TR_ONE_CNT_INx_PIN 4ul//1u
#define TCPWM_TR_ONE_CNT_INx_MUX P12_4_TCPWM0_TR_ONE_CNT_IN118//P6_1_TCPWM0_TR_ONE_CNT_IN0

 

Line165~170

cy_stc_sysint_irq_t irq_cfg =
{
    .sysIntsrc=tcpwm_0_interrupts_39_IRQn,//tcpwm_0_interrupts_0_IRQn,
    .intIdx = CPUIntIdx3_IRQn,
    .isEnabled = true,
};

0 点赞
1 解答
Alfred_Tsang
Moderator
Moderator
Moderator
50 replies posted 50 sign-ins 10 solutions authored

Hi ,

In SDL cpature example, you can find the TR_ONE_CNT_INx equation on the top
(TR_ONE_CNT_INx: x = (256 * GrpNum * 3) + (CntNum * 3) + TR_ONE_CNT_NR_USE)

if you would like to use "P12_4_TCPWM0_LINE_COMPL39", given GrpNum = 0 and CntNum = 39, therefore TR_ONE_CNT_NR_USE input trigger should be equal to 1.

for more information, please refer to AN220224 section 2.2.2 Table 5.

Best regards,

在原帖中查看解决方案

0 点赞
1 回复
Alfred_Tsang
Moderator
Moderator
Moderator
50 replies posted 50 sign-ins 10 solutions authored

Hi ,

In SDL cpature example, you can find the TR_ONE_CNT_INx equation on the top
(TR_ONE_CNT_INx: x = (256 * GrpNum * 3) + (CntNum * 3) + TR_ONE_CNT_NR_USE)

if you would like to use "P12_4_TCPWM0_LINE_COMPL39", given GrpNum = 0 and CntNum = 39, therefore TR_ONE_CNT_NR_USE input trigger should be equal to 1.

for more information, please refer to AN220224 section 2.2.2 Table 5.

Best regards,

0 点赞