对于 HSPDM 部分,我将其配置为由 CCU6 触发:
IfxHspdm_setHwRunActiveEdge(g_hspdm,
IfxHspdm_HwRunActiveEdge_rising);
IfxHspdm_setHwRunTriggerSource(g_hspdm, IfxHspdm_HwTriggerSource_CCU6);
IfxHspdm_enableHwRun(g_hspdm);
对于 CCU6 而言,看起来 CCU61 的 T13 是通往 HWRUN 的路线:
所以我在这里配置了 CCU6:
IfxCcu6_Timer_Config timerConfig; IfxCcu6_Timer_initModuleConfig(
timerConfig, MODULE_CCU61); /* Configure the T12 timer
frequency/period (trigger for T13 timer) and T13 timer frequency/period
(trigger * for ADC). Timer T13 starts counting in single shot mode
triggered by a period-match event of the T12 timer. * The period of
the timer T13 represents a delay (from the period-match event of the T12
timer) of the ADC * trigger event. */
timerConfig.base.t12Frequency = CCU6_T12_TIMER_FREQ; /*
Timer T12 frequency */
timerConfig.base.waitingTime = CCU6_T12_TIMER_PERIOD; /*
waitingTime is the period of T12 timer */
timerConfig.base.t13Frequency = CCU6_T13_TIMER_FREQ; /*
Timer T13 frequency */
timerConfig.base.t13Period = CCU6_T13_TIMER_PERIOD; /*
Timer T13 period */ timerConfig.timer =
IfxCcu6_TimerId_t13; /* Select the timer, T13
is the master */ timerConfig.synchronousOperation = FALSE;
/* Disable synchronous start of the timers */
timerConfig.trigger.t13InSyncWithT12 = TRUE; /*
T12 timer starts the T13 timer */ /* Configure the T13
timer start event */ timerConfig.timer13.t12SyncEvent =
IfxCcu6_T13TriggerEvent_onT12Period;
timerConfig.timer13.t12SyncDirection =
IfxCcu6_T13TriggerDirection_onT12CountingUp; /* Apply the
configuration to the CCU6 module */ IfxCcu6_Timer_initModule(
g_timer, timerConfig); //CCU61:COUT63 to HSPDM:HWRUN(0) T13 PWM
channel 63 /* Activate the line ServiceRequest_3 to route the T13
period match event trigger to the HSPDM module */
IfxCcu6_enableInterrupt( MODULE_CCU61,
IfxCcu6_InterruptSource_t13PeriodMatch); /* Configure the T13 timer
for single shot mode */ IfxCcu6_enableSingleShotMode( MODULE_CCU61,
IfxCcu6_TimerId_t13); IfxCcu6_Timer_start( g_timer);
但是 HSPDM 输出未触发。
我做错了什么? 请帮忙。
如何在TC357TA中配置CCU6以触发HSPDM?
关键词: TC357TA HSPDM 微控制器
在TC357TA中配置CCU6以触发HSPDM,您可以使用以下代码:
```
#include "IfxHspdm.h"
#include "IfxCcu6_Timer.h"
Ifx_HSPDM* g_hspdm;
Ifx_CCU6_Timer_Config timerConfig;
Ifx_CCU6_Timer timer;
int main(void)
{
// Initialize HSPDM
IfxHspdm_enableModule(g_hspdm);
IfxHspdm_setHwRunActiveEdge(g_hspdm, IfxHspdm_HwRunActiveEdge_rising);
IfxHspdm_setHwRunTriggerSource(g_hspdm, IfxHspdm_HwTriggerSource_CCU6);
IfxHspdm_enableHwRun(g_hspdm);
// Initialize CCU6
IfxCcu6_Timer_initModuleConfig(&timerConfig, &MODULE_CCU61);
IfxCcu6_Timer_initModule(&timer, &timerConfig);
// Configure CCU61
IfxCcu6_Timer_configureCount(&timer, IfxCcu6_Timer_CountMode_edgeAligned);
IfxCcu6_Timer_enableModule(&timer);
IfxCcu6_Timer_runAsHwSteadyCounter(&timer);
// Wait for the CCU6 to trigger the HSPDM
while (1)
{
// Do something
}
return 0;
}
```
得拥有正确的库和驱动程序,并且已经对TC357TA进行了正确的初始化。
需要将`g_hspdm`和`MODULE_CCU61`替换为实际的HSPDM和CCU6模块的指针或变量。
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
与电子爱好者谈读图四被打赏50分 | |
与电子爱好者谈读图二被打赏50分 | |
【FRDM-MCXN947评测】Core1适配运行FreeRtos被打赏50分 | |
【FRDM-MCXN947评测】双核调试被打赏50分 | |
【CPKCORRA8D1B评测】---移植CoreMark被打赏50分 | |
【CPKCORRA8D1B评测】---打开硬件定时器被打赏50分 | |
【FRDM-MCXA156评测】4、CAN loopback模式测试被打赏50分 | |
【CPKcorRA8D1评测】--搭建初始环境被打赏50分 | |
【FRDM-MCXA156评测】3、使用FlexIO模拟UART被打赏50分 | |
【FRDM-MCXA156评测】2、rt-thread MCXA156 BSP制作被打赏50分 |