Other Parts Discussed in Thread: SYSCONFIG
器件型号: TMS320F2800137
主题: SysConfig 中讨论的其他器件
我使用的是 F2800137 C2000 微控制器、我正在尝试生成四组互补 ePWM 信号、总共需要八个信号。 我使用 SysConfig 配置这些 ePWM。 出于某种原因、当我从闪存运行程序时、一个有时两个 EPWM 信号(不是互补信号,通常只是互补信号对中的一个信号)不会发出。 但是、当我从 RAM 运行时、所有 PWM 都会出来。
我最初认为死区模块没有正确设置一些寄存器、但由于我正在选择两个输出来基于同一个 ePWM 信号、我看不到互补对中的一个 ePWM 可以如何产生、但另一个 ePWM 无法产生。
我还认为这可能是因为我有一个 ADC ISR 从每 5 个周期触发一次的 ADC 读取值、这可能需要很长时间。 但我注释掉了整个 ISR、但仍然给出了这种行为。
我的 ePWM 频率为 100kHz。 我筛选了以下一些相关的 SysConfig 设置和代码:




void main(void){ // *********************** Initialization (from example) ********************** // Device_init(); // Initialize device clock and peripherals Device_initGPIO(); // Disable pin locks and enable internal pull-ups. Interrupt_initModule(); // Initialize PIE and clear PIE registers. Disables CPU interrupts. Interrupt_initVectorTable(); // Initialize the PIE vector table with pointers to the shell ISRs
Board_init(); // Configure peripherals (from SysConfig)
// Disable and re-enable sync and EPWM clock (don't ask why, it's from the example) SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC);
// Configure the CPU Timer configCPUTimer(TIMER_BASE, DEVICE_SYSCLK_FREQ, 1000000);
// Enable global Interrupts and higher priority real-time debug events: EINT; // Enable Global interrupt INTM ERTM; // Enable Global realtime interrupt DBGM
CPUTimer_startTimer(TIMER_BASE); // start CPU 0 timer
// set 50% duties for testing set_duty(PJX_BUCK_BASE, 605); set_duty(PJX_BOOST_BASE, 605); set_duty(MJX_BUCK_BASE, 605); set_duty(MJX_BOOST_BASE, 605);
use_control = 0;
// Enter main control loop (does nothing for now) while (1) { ; }}
void set_duty(uint32_t epwm_module, volatile uint16_t desired_duty){ // invert +jx buck and +jx boost if (epwm_module == PJX_BUCK_BASE || epwm_module == PJX_BOOST_BASE) { desired_duty = (uint16_t) EPWM_TBPRD - desired_duty; }
// set EPWM A counter compare value EPWM_setCounterCompareValue(epwm_module, EPWM_COUNTER_COMPARE_A, desired_duty);
// set to low at zero, high at counter compare EPWM_setActionQualifierAction(epwm_module, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); EPWM_setActionQualifierAction(epwm_module, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(epwm_module, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD);}
我正在使用 JTAG 对 C2000 进行编程、并将引导引脚 GPIO24 和 GPIO37 通过 3.3k 上拉电阻拉至高电平、因此它应该在启动时从闪存运行。
提前感谢您的意见!