This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

2812DSP复位后无法继续运行

您好,

控制板采用如下的复位电路,当我按下复位按钮后,我可以通过示波器观察到XRS引脚的电平恢复了,而PWM驱动被拉低了,无法恢复。从CCS变量观察窗口可以看见PDPINTA的值由1变为0,可是硬件上并没有焊有关PDPINT的电路,程序中也没有使能这个中断,这是怎么一回事呢?

希望得到您的解答。

谢谢

  • 不确定问题的原因,但是可以考虑外部上拉处理一下
  • 我可以请教您一个其他的问题吗,就不重新开贴了。
    除了PDPINT之外那个引脚还能让2812实现PWM保护的功能呢,最好是将PWM驱动强制拉低。
  • 可以通过外部中断来控制PWM的应该只有PDPINT引脚了
  • 芯片复位后没有跑起来 出来芯片复位管脚的处理 看看复位是否会带来板上其他电路功能异常
    PDPINT硬件快速是PWM输出为高祖 如果全要低需要外部做下拉处理
  • 如果我想采用软件中断的方式,将EXTCONA寄存器INDCOE位设为1,将三路比较单元分开控制。当采样检测电流,当大于阈值时,我需要切断6路PWM信号中的4路。在中断程序中将EvaRegs.COMCONA.bit.FCMPxOE设为0(高阻态),但是当我实验时发现,PWM信号并不能关断,请问这是怎么回事呢?

    十分感谢您的耐心解答,程序我在后面附上。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    // �ز���ֵ���ƿ�������
    // This program is used for buck-boost inverter
    // Date: Sep 8th , 2019 Version: 1.2
    // Author: ZhangYuyao
    // Description��
    // �ɼ�ֱ�����е�����ͨ���ӳٵ��������ķ������˳�����Ƶ�ɷݡ��ڷ�����ͨ���ı��ز���ֵ��С��ɵ��ƣ�����ʵ���У���ı���Ʋ��ķ�ֵ��
    #include "DSP281x_Device.h"
    #include "DSP281x_Examples.h"
    #include "IQmathLib.h"
    #include <math.h>
    #define Ts 0.00005
    #define N 400 // 50*400=20000Hz �ز���Ϊ400
    /*#pragma CODE_SECTION(T1_Compare_isr, "ramfuncs"); // ���жϺ���T1PINT_isrд��RAM�У���Ϊad_isr���������ã�����ʡ��ÿ�ζ���flash��д��RAM
    // ������Initflash()�ij�ʼ���ͱ�д����
    extern Uint16 RamfuncsLoadStart; // ��Ϊ����memcpy�����ı���������MemCopy�����еı����������ȫ�ֱ�������
    extern Uint16 RamfuncsLoadEnd;
    extern Uint16 RamfuncsRunStart;*/
    // Variable defs
    int32 idc_s; // idc_s---ֱ������е�������
    int32 idc;
    int32 idc_Q = 0;
    int32 idc_Q1 = 0; // ����ʱ�ź�
    int32 idc_Q2 = 0; // ��ʱT/4�ź�
    int32 idc_avg1 = 0; // the avg value after T/4 delay
    int32 idc_avg1_Q1 = 0; // ����ʱ�ź�
    int32 idc_avg1_Q2 = 0; // ��ʱT/8�ź�
    int32 idc_avg2 = 0; // the avg value after all delay
    int32 buffer[400];
    float32 coefficient_k; // ��ֵ����ϵ��
    int16 i = 0;
    int16 j = 0;
    int16 k = 301;
    int16 jj = 0;
    int16 kk = 351;
    int32 g1,g2,g3,P,G;
    float32 Modu_Index=0.4; // Modulation index, ���Ʊ�
    // Sine table
    float32 sina[400]=
    {
    0,0.0157,0.0314,0.0471,0.0628,0.0785,0.0941,0.1097,0.1253,0.1409,0.1564,0.1719,0.1874,0.2028,0.2181,0.2334,
    0.2487,0.2639,0.2790,0.2940,0.3090,0.3239,0.3387,0.3535,0.3681,0.3827,0.3971,0.4115,0.4258,0.4399,0.4540,
    0.4679,0.4818,0.4955,0.5090,0.5225,0.5358,0.5490,0.5621,0.5750,0.5878,0.6004,0.6129,0.6252,0.6374,0.6494,
    0.6613,0.6730,0.6845,0.6959,0.7071,0.7181,0.7290,0.7396,0.7501,0.7604,0.7705,0.7804,0.7902,0.7997,0.8090,
    0.8181,0.8271,0.8358,0.8443,0.8526,0.8607,0.8686,0.8763,0.8838,0.8910,0.8980,0.9048,0.9114,0.9178,0.9239,
    0.9298,0.9354,0.9409,0.9461,0.9511,0.9558,0.9603,0.9646,0.9686,0.9724,0.9759,0.9792,0.9823,0.9851,0.9877,
    0.9900,0.9921,0.9940,0.9956,0.9969,0.9980,0.9989,0.9995,0.9999,1.0000,0.9999,0.9995,0.9989,0.9980,0.9969,
    0.9956,0.9940,0.9921,0.9900,0.9877,0.9851,0.9823,0.9792,0.9759,0.9724,0.9686,0.9646,0.9603,0.9558,0.9511,
    0.9461,0.9409,0.9354,0.9298,0.9239,0.9178,0.9114,0.9048,0.8980,0.8910,0.8838,0.8763,0.8686,0.8607,0.8526,
    0.8443,0.8358,0.8271,0.8181,0.8090,0.7997,0.7902,0.7804,0.7705,0.7604,0.7501,0.7396,0.7290,0.7181,0.7071,
    0.6959,0.6845,0.6730,0.6613,0.6494,0.6374,0.6252,0.6129,0.6004,0.5878,0.5750,0.5621,0.5490,0.5358,0.5225,
    0.5090,0.4955,0.4818,0.4679,0.4540,0.4399,0.4258,0.4115,0.3971,0.3827,0.3681,0.3535,0.3387,0.3239,0.3090,
    0.2940,0.2790,0.2639,0.2487,0.2334,0.2181,0.2028,0.1874,0.1719,0.1564,0.1409,0.1253,0.1097,0.0941,0.0785,
    0.0628,0.0471,0.0314,0.0157,0,-0.0157,-0.0314,-0.0471,-0.0628,-0.0785,-0.0941,-0.1097,-0.1253,-0.1409,
    -0.1564,-0.1719,-0.1874,-0.2028,-0.2181,-0.2334,-0.2487,-0.2639,-0.2790,-0.2940,-0.3090,-0.3239,-0.3387,
    -0.3535,-0.3681,-0.3827,-0.3971,-0.4115,-0.4258,-0.4399,-0.4540,-0.4679,-0.4818,-0.4955,-0.5090,-0.5225,
    -0.5358,-0.5490,-0.5621,-0.5750,-0.5878,-0.6004,-0.6129,-0.6252,-0.6374,-0.6494,-0.6613,-0.6730,-0.6845,
    -0.6959,-0.7071,-0.7181,-0.7290,-0.7396,-0.7501,-0.7604,-0.7705,-0.7804,-0.7902,-0.7997,-0.8090,-0.8181,
    -0.8271,-0.8358,-0.8443,-0.8526,-0.8607,-0.8686,-0.8763,-0.8838,-0.8910,-0.8980,-0.9048,-0.9114,-0.9178,
    -0.9239,-0.9298,-0.9354,-0.9409,-0.9461,-0.9511,-0.9558,-0.9603,-0.9646,-0.9686,-0.9724,-0.9759,-0.9792,
    -0.9823,-0.9851,-0.9877,-0.9900,-0.9921,-0.9940,-0.9956,-0.9969,-0.9980,-0.9989,-0.9995,-0.9999,-1.0000,
    -0.9999,-0.9995,-0.9989,-0.9980,-0.9969,-0.9956,-0.9940,-0.9921,-0.9900,-0.9877,-0.9851,-0.9823,-0.9792,
    -0.9759,-0.9724,-0.9686,-0.9646,-0.9603,-0.9558,-0.9511,-0.9461,-0.9409,-0.9354,-0.9298,-0.9239,-0.9178,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    // TI File $Revision: /main/2 $
    // Checkin $Date: April 29, 2005 11:10:23 $
    //###########################################################################
    //
    // FILE: DSP281x_Ev.c
    //
    // TITLE: DSP281x Event Manager Initialization & Support Functions.
    //
    //###########################################################################
    // $TI Release: DSP281x C/C++ Header Files V1.20 $
    // $Release Date: July 27, 2009 $
    //###########################################################################
    #include "DSP281x_Device.h" // DSP281x Headerfile Include File
    #include "DSP281x_Examples.h" // DSP281x Examples Include File
    //---------------------------------------------------------------------------
    // InitEv:
    //---------------------------------------------------------------------------
    // This function initializes to a known state.
    //
    void InitEv(void)
    {
    // EVA Configure T1PWM, T2PWM, PWM1-PWM6
    // Initalize the timers
    // Initalize EVA Timer1
    EvaRegs.T1PR = 3750; // Timer1 period, the frequency of carrier is 20kHz
    EvaRegs.T1CMPR = 0x0000; // Timer1 compare
    EvaRegs.T1CNT = 0x0000; // Timer1 counter
    EvaRegs.T1CON.bit.TMODE=1; // TMODE = continuous up/down
    EvaRegs.T1CON.bit.TPS=0; // T1CLK = HSPCLK/1 = 150MHz
    EvaRegs.T1CON.bit.TENABLE=0; // Timer disable
    EvaRegs.T1CON.bit.TCLKS10=0; // Select the internal clock
    EvaRegs.T1CON.bit.TECMPR=1; // Timer compare enable
    // Setup T1PWM and T2PWM
    // Drive T1/T2 PWM by compare logic
    // EvaRegs.GPTCONA.bit.TCMPOE = 1;
    // Polarity of GP Timer 1 Compare = Active low
    // EvaRegs.GPTCONA.bit.T1PIN = 1;
    // Polarity of GP Timer 2 Compare = Active high
    // EvaRegs.GPTCONA.bit.T2PIN = 2;
    EvaRegs.GPTCONA.bit.T1TOADC=2; // ��������ADC
    // Enable compare for PWM1-PWM6
    EvaRegs.CMPR1 = 0x0000;
    EvaRegs.CMPR2 = 0x0000;
    EvaRegs.CMPR3 = 0x0000;
    // Compare action control. Action that takes place
    // on a cmpare event
    // output pin 1 CMPR1 - active high
    // output pin 2 CMPR1 - active low
    // output pin 3 CMPR2 - active high
    // output pin 4 CMPR2 - active low
    // output pin 5 CMPR3 - active high
    // output pin 6 CMPR3 - active low
    //EvaRegs.ACTRA.all = 0x0666;
    EvaRegs.ACTRA.all = 0x0999;
    //EvaRegs.DBTCONA.all = 0x0000; // Disable deadband
    /* Overlap_time 1us */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    // TI File $Revision: /main/2 $
    // Checkin $Date: April 29, 2005 11:11:45 $
    //###########################################################################
    //
    // FILE: DSP281x_Adc.c
    //
    // TITLE: DSP281x ADC Initialization & Support Functions.
    //
    //###########################################################################
    // $TI Release: DSP281x C/C++ Header Files V1.20 $
    // $Release Date: July 27, 2009 $
    //###########################################################################
    #include "DSP281x_Device.h" // DSP281x Headerfile Include File
    #include "DSP281x_Examples.h" // DSP281x Examples Include File
    #define ADC_usDELAY 8000L
    #define ADC_usDELAY2 20L
    //---------------------------------------------------------------------------
    // InitAdc:
    //---------------------------------------------------------------------------
    // This function initializes ADC to a known state.
    //
    void InitAdc(void)
    {
    extern void DSP28x_usDelay(Uint32 Count);
    // To powerup the ADC the ADCENCLK bit should be set first to enable
    // clocks, followed by powering up the bandgap and reference circuitry.
    // After a 5ms delay the rest of the ADC can be powered up. After ADC
    // powerup, another 20us delay is required before performing the first
    // ADC conversion. Please note that for the delay function below to
    // operate correctly the CPU_CLOCK_SPEED define statement in the
    // DSP28_Examples.h file must contain the correct CPU clock period in
    // nanoseconds. For example:
    AdcRegs.ADCTRL1.bit.RESET = 1; // reset the ADC
    asm(" RPT #0 || NOP"); // one cycle
    AdcRegs.ADCTRL1.bit.RESET = 0;
    AdcRegs.ADCTRL3.bit.ADCBGRFDN = 0x3; // Power up bandgap/reference circuitry
    DELAY_US(ADC_usDELAY); // Delay before powering up rest of ADC
    AdcRegs.ADCTRL3.bit.ADCPWDN = 1; // Power up rest of ADC
    DELAY_US(ADC_usDELAY2); // Delay after powering up ADC
    /*AdcRegs.ADCTRL1.bit.RESET = 1; // reset the ADC
    asm(" RPT #0 || NOP"); // one cycle
    AdcRegs.ADCTRL1.bit.RESET = 0;*/
    AdcRegs.ADCTRL1.bit.SUSMOD = 3; // ������ͣʱ�����з��������������ֵ�·�߼�����ֹͣ
    AdcRegs.ADCTRL1.bit.ACQ_PS = 2; // S/H width in ADC module periods = (ACQ_PS+1)/ADCLK = 1.2 us
    AdcRegs.ADCTRL1.bit.CPS = 1; // �ں�ʱ���ٽ���һ�ζ���Ƶ
    AdcRegs.ADCTRL3.bit.ADCCLKPS = 15; // ADC module clock = HSPCLK/(2*ADCCLKPS)*(CPS+1)=2.5 MHz
    AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // 0,���/ֹͣģʽ 1,����ģʽ
    AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 0 Dual Sequencer Mode, 1 Cascaded Mode
    AdcRegs.ADCTRL3.bit.SMODE_SEL = 0; // 0 Sequential Sampling Mode, 1 Simultaneous Sampling Mode
    AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0; // ������·
    AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x6; // ADCINA6
    AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // ���SEQ1���жϱ�־λ
    AdcRegs.ADCST.bit.INT_SEQ2_CLR = 1; // ���SEQ2���жϱ�־λ
    AdcRegs.ADCTRL2.bit.EVA_SOC_SEQ1 = 1; // Allows SEQ1/SEQ to be started by Event Manager A trigger
    AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ = 0; // EVB SOC enable for cascaded sequencer (Note: This bit is active only in cascaded mode.) 0, No action.
    AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ2 = 0; // Event Manager B SOC mask bit for SEQ2. 0, SEQ2 cannot be started by EVB trigger.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX