基于UCD3138的PSFB
大家好,现在手里有款600W的PSFB, 是参考UCD3138-027设计的。 相关的PSFB的程序是TI下载的,由到GUI下载至3138。现在遇到的问题是,当ON/OFF高电平时开机, 显示AC_OK, +12V,+3.3V都有。 当ON/OFF低电平时,也就是闭环,AC_OK, +12V,+3.3V都有, 而PG_OK信号灯未亮! 各路的DPWM也没有波形, 但是GUI的Memory显示,各路AD采样都有的值, 由于未加载,显示值很小。 但不至于没有波形吧? DPWM0,1,2,3都未检测到波形。 请问我该如何进行, 忘各位指导指导!
相应的程序如下:
#define MAIN 1
#include "system_defines.h" #include "Cyclone_Device.h" #include "pmbus_commands.h" #include "pmbus.h" #include "variables.h" #include "function_definitions.h" #include "software_interrupts.h" #include "cyclone_defines.h"
void init_interrupts(void) { TimerRegs.T16PWM2CMP0DAT.all = 1587; //Threshold to send the pwm low. Approx 10KHz. by spec.64ns clock period TimerRegs.T16PWM2CMP1DAT.all = 0xffff; //Threshold to send the pwm high TimerRegs.T16PWM2CMPCTRL.all = 2; //Enables compare 0 (reset) interrupt TimerRegs.T16PWM2CNTCTRL.all = 0x00c; //PWM counter is running & enables PWM counter reset by compare action on compare 0
// FaultMuxRegs.EXTFAULTCTRL.bit.FAULT1_POL = 1; //rising edge // FaultMuxRegs.EXTFAULTCTRL.bit.FAULT1_INT_EN = 1; //enable fault detection pin interrupt // FaultMuxRegs.EXTFAULTCTRL.bit.FAULT1_DET_EN = 1; //enable fault detection // MiscAnalogRegs.IOMUX.bit.JTAG_DATA_MUX_SEL = 3; //TDO/TDI Pin Mux Select as: Fault0 & Fault1
disable_interrupt(); disable_fast_interrupt(); //make sure fast interrupt is disabled write_reqmask(CIMINT_ALL_PWM2_COMP | CIMINT_ALL_FAULT_MUX);//CIMINT_ALL_DIGI_COMP); write_firqpr (CIMINT_ALL_FAULT_MUX); enable_fast_interrupt(); enable_interrupt(); }
/* Dpwm0Regs.DPWMINT.bit.PRD_INT_SCALE = 1; // generate an interrupt on each 16 switching cycles(used to reset the integrator) Dpwm0Regs.DPWMINT.bit.PRD_INT_EN = 0;
disable_interrupt(); disable_fast_interrupt(); //make sure fast interrupt is disabled write_reqmask(CIMINT_ALL_DPWM0 | CIMINT_ALL_PWM2_COMP ); //enable pwm2cmp and DPWM0 interrupt(End of 16th period)(int-priority29) write_firqpr (CIMINT_ALL_DPWM0); // DPWM0 interrupt(End of 16th period) is mapped to FIQ enable_fast_interrupt(); enable_interrupt(); */
void init_variables(void) { supply_state = STATE_IDLE; //supply_state = 12; current_share_kp = 1000; current_share_ki = 10; fault_status = 0; debug_buffer[0]=1; debug_buffer[1]=2; debug_buffer[2]=3; debug_buffer[3]=4; debug_buffer[4]=5; debug_buffer[5]=6; debug_buffer[6]=7; debug_buffer[7]=8; }
void main() { volatile unsigned int dummy; if(GioRegs.FAULTIN.bit.FLT3_IN == 0)// Re-Check pin assignment (ADC_EXT/SYNC may be?) { //clear_integrity_word(); }
init_gpio(); restore_default_all(); init_variables(); configure_vin_on_off_thresholds(); configure_vout_cmd(); configure_ton_rise(); init_vout_fault(); // Analog comparator B init_uart0(); init_pmbus(); init_front_end0(); init_front_end1(); init_front_end2(); // init_filter0(); init_filter1(); init_filter2(); look_for_interrupted_dflash_erase(); init_ipri_cycle_by_cycle(); // init_cpcc(); current_share_int_state = (EADC_DAC_TARGET << CS_INT_EXP);
#ifdef SINGLE_FRAME_ENABLE init_dpwms_for_single_frame(); #else init_dpwms(); #endif
init_loop_mux(); handle_light_load_mode_configuration(); // init_current_sensing_hardware(); init_ADC_polled(); init_faults(); #ifdef IDE_ENABLE init_ide(); #endif init_prebias(); init_interrupts(); dummy = FaultMuxRegs.FAULTMUXINTSTAT.all;
Dpwm3Regs.DPWMCTRL1.bit.GPIO_A_EN = 1; Dpwm3Regs.DPWMCTRL1.bit.GPIO_A_VAL= 1;
FaultMuxRegs.DCOMPCTRL0.bit.CNT_THRESH = 1; FaultMuxRegs.DCOMPCTRL0.bit.FE_SEL = 0; FaultMuxRegs.DCOMPCTRL0.bit.COMP_POL = 1; FaultMuxRegs.DCOMPCTRL0.bit.THRESH = 850; FaultMuxRegs.DPWM0FLTABDET.bit.DCOMP0_EN=1; FaultMuxRegs.DCOMPCTRL0.bit.INT_EN=1;
//FaultMuxRegs.DCOMPCTRL0.bit.CNT_CLR = 1; //clear DCOMP reading //FaultMuxRegs.DCOMPCTRL0.bit.CNT_CLR = 0;
FaultMuxRegs.DCOMPCTRL0.bit.COMP_EN=1;
for(;;) { if (erase_segment_counter > 0) { erase_task(); } pmbus_handler();
// FeCtrl0Regs.EADCDAC.bit.DAC_VALUE=800;
/* if (Interrupt_Flag==3) { //Dpwm3Regs.DPWMCTRL1.bit.GPIO_A_VAL=1; //disable_fast_interrupt(); //write_firqpr (0x00000000); CimRegs.FIRQPR.all = (0x00000000); } */ } }
/* if (Interrupt_Flag==3) { Dpwm3Regs.DPWMCTRL1.bit.GPIO_A_VAL=1; disable_fast_interrupt(); } */
//Dpwm0Regs.DPWMINT.bit.PRD_INT_EN = 0; // // CimRegs.FIRQPR.all = (0x00000000); #pragma INTERRUPT(c_int00,RESET)
void c_int00(void) { main(); }
顶! 感谢 TI的FAE, 给了我UCD3138各种EVM的 CODE,让像我们这样的菜鸟学生有了更好的学习 谢谢! 需要的留下邮箱哈!
串口边上有个小开关,确认一下有没有打开?
需要,fengjunjie1212@163.com,麻烦了