[STM32F30x] DMA-InterruptFlags lassen sich nicht resetten

OP Persönliche Seite #3764528
Lesenswert?

Hallo Zusammen,

ich habe ein komisches Problem. Ich verwende für ein Projekt mit dem 
STM32F3 ChibiOS/RT und die HAL vom Giovanni. Rein vom Register Setup 
kann ich laut RM00316 keine Fehler feststellen.

ABER: Die Interruptflags im DMA1->ISR lassen sich nicht durch schreiben 
des DMA1-ICFR resetten wie das normal der Fall wäre/ist. (Der Code läuft 
exakt so in einem anderen Projekt)

Was mache ich: Ich habe alle ADCs im Dualmode laufen und triggere sie 
über das Updateevent des TIM1. Der Timer ist im Debug Register so 
eingestellt das er bei einem Breakpoint nicht weiter läuft, was er auch 
tut (PWMs sind still). Außerdem habe ich die PWM Frequenz auf 1kHz 
gesetzt um eventuelle Rechzeitprobleme auszuschließen, da der DMA ja 
beim Breakpoint im Interrupt des DMA(half sowie full habe ich probiert) 
weiterläuft ist es schwierig zu sehen ob die Flags wirklich gecleared 
werden. Was ich aber sehen kann sobald der DMA das erste mal den Int 
feuert kreist er nur noch im Interrupt. Es wird keine Zeile 
Applikationscode mehr ausgeführt.


Hat jemand eine Idee in welcher Situation es sein kann das die Flags vom 
DMA sich nicht zurücksetzen lassen?

Anbei der Konfigurationscode. Das Projekt habe ich auf n Blinky und ADC 
und PWM soweit auskommentiert.
1
const ADCConversionGroup CBridgeADC::adcConvGrp1_2 = {
2
   FALSE,                                                        /* circular mode */
3
   CBridgeADC::U8_NBR_OF_CHANNELS,
4
   NULL,
5
   NULL,
6
   /*
7
   * external trigger from TRGO2 of TIM1 on rising edge
8
   *
9
   */
10
   0,//ADC_CFGR_EXTSEL_SRC(9) | ADC_CFGR_EXTEN_RISING,              /* CFGR     */
11
   ADC_TR(0, 4095),                                              /* TR1      */
12
   ADC_CCR_DUAL(1),                                              /* CCR      */
13
   {                                                             /* SMPR[2]  */
14
      /*
15
       * 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
16
       * extra filtering, OPAMP1 as Input
17
       */
18
      ADC_SMPR1_SMP_AN2(ADC_SMPR_SMP_19P5),
19
      0
20
   },
21
   {     /* Current Phase A */                                   /* SQR[4]   */
22
      ADC_SQR1_SQ1_N(ADC_CHANNEL_IN2)| ADC_SQR1_SQ2_N(ADC_CHANNEL_IN2),
23
      0,
24
      0,
25
      0
26
   },
27
   /*
28
   * 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
29
   * extra filtering, OPAMP2 as Input
30
   */
31
   {                                                             /* SSMPR[2] */
32
      ADC_SMPR1_SMP_AN7(ADC_SMPR_SMP_19P5),
33
      0
34
   },
35
   {     /* DC Bus Voltage */                                    /* SSQR[4]  */
36
      ADC_SQR1_SQ1_N(ADC_CHANNEL_IN7) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN7),
37
      0,
38
      0,
39
      0
40
   }
41
};
42

43
const ADCConversionGroup CBridgeADC::adcConvGrp3_4 = {
44
   FALSE,                                                        /* circular mode */
45
   CBridgeADC::U8_NBR_OF_CHANNELS,
46
   NULL,
47
   NULL,
48
   /*
49
    * external trigger from TRGO2 of TIM1 on rising edge
50
    *
51
    */
52
   0,//ADC_CFGR_EXTSEL_SRC(10) | ADC_CFGR_EXTEN_RISING,              /* CFGR     */
53
   ADC_TR(0, 4095),                                              /* TR1      */
54
   ADC_CCR_DUAL(1),                                              /* CCR      */
55
   {                                                             /* SMPR[2]  */
56
         /*
57
          * 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
58
          * extra filtering, OPAMP1 as Input
59
          */
60
         0,
61
         ADC_SMPR2_SMP_AN12(ADC_SMPR_SMP_19P5)
62
   },
63
   {     /* Current Phase C */                                   /* SQR[4]   */
64
         ADC_SQR1_SQ1_N(ADC_CHANNEL_IN12) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN12),
65
         0,
66
         0,
67
         0
68
   },
69
   /*
70
    * 20 ADC Cycles Conversion time with 7.5 clocks sample time to get a litle
71
    * extra filtering, OPAMP2 as Input
72
    */
73
   {                                                             /* SSMPR[2] */
74
         ADC_SMPR1_SMP_AN3(ADC_SMPR_SMP_19P5),
75
         0
76
   },
77
   {     /* External Setpoint */                                 /* SSQR[4]  */
78
         ADC_SQR1_SQ1_N(ADC_CHANNEL_IN3) | ADC_SQR1_SQ2_N(ADC_CHANNEL_IN3),
79
         0,
80
         0,
81
         0
82
   }
83

84
};
85

86
volatile adcsample_t CBridgeADC::samples1_2[U8_SAMPLES_BUF_DEPTH] = {0xAAAA};
87
volatile adcsample_t CBridgeADC::samples3_4[U8_SAMPLES_BUF_DEPTH] = {0xAAAA};
88

89
volatile float32_t _f32CurrentPhaseA = 0.0f;
90
volatile float32_t _f32CurrentPhaseC = 0.0f;
91
volatile float32_t _f32DCBusVoltage = 0.0f;
92
volatile float32_t _f32ExtSetPoint = 0.0f;
93

94
/******************************************************************************
95
 * G L O B A L   F U N C T I O N S
96
 ******************************************************************************/
97

98
/**************************************************************************//**
99
 * \\brief Constructor
100
 *
101
 *
102
 ****************************************************************************//*
103
 * Changes :    Author, Date, Version, Reason for change
104
 *              ***************************************************************
105
 *              Tecnologic, 06.06.2014, 1.0, Creation
106
 ******************************************************************************/
107
CBridgeADC::CBridgeADC(){}
108

109
/**************************************************************************//**
110
 * \\brief Initialize ADC Hardware
111
 *
112
 * Task context is needed for delay
113
 *
114
 * \\retval     Result
115
 *              true = success
116
 ****************************************************************************//*
117
 * Changes :    Author, Date, Version, Reason for change
118
 *              ***************************************************************
119
 *              Tecnologic, 25.06.2014, 1.0, Creation
120
 ******************************************************************************/
121
bool CBridgeADC::HardwareInit(void){
122

123
   /*
124
    * Activates the ADC1 driver and the temperature sensor.
125
    */
126
   adcStart(&ADCD1, NULL);
127
   adcStart(&ADCD3, NULL);
128

129
   /*
130
    * Starts an ADC continuous conversion.
131
    */
132
   //adcStartConversion(&ADCD1, &_adcConvGrp1_2, (adcsample_t*)_samples1_2, U8_SAMPLES_PER_CHANNEL);
133
   //adcStartConversion(&ADCD3, &_adcConvGrp3_4, (adcsample_t*)_samples3_4, U8_SAMPLES_PER_CHANNEL);
134
   adcConvert(&ADCD1, &adcConvGrp1_2, (adcsample_t*)samples1_2, U8_SAMPLES_PER_CHANNEL);
135
   adcConvert(&ADCD3, &adcConvGrp3_4, (adcsample_t*)samples3_4, U8_SAMPLES_PER_CHANNEL);
136

137
   return true;
138
} /* HardwareInit */
ADC Config
1
PWMConfig CBridgePWM::pwmcfg =
2
{
3
   STM32_TIM1CLK,   // use PWM system clock
4
   (pwmcnt_t)(STM32_TIM1CLK/(CBridgePWM::f32Freqency*2.0f) -1),
5
   NULL,
6
   { /*  */
7
    {PWM_OUTPUT_ACTIVE_HIGH | PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH, NULL},
8
    {PWM_OUTPUT_ACTIVE_HIGH | PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH, NULL},
9
    {PWM_OUTPUT_ACTIVE_HIGH | PWM_COMPLEMENTARY_OUTPUT_ACTIVE_HIGH, NULL},
10
    {PWM_OUTPUT_DISABLED, pwmpcb}
11
   },
12
   /*
13
   * CR2 Register
14
   *
15
   * Use Update events as Triger Output 1
16
   * Use CC4 Events as Trigger Output 2
17
   *
18
   */
19
   (STM32_TIM_CR2_MMS(7) | STM32_TIM_CR2_MMS2(7)),
20
   /*
21
   * Break and Deadtime Register
22
   *
23
   * Deadtime set in multiples of Timer CLK
24
   */
25
   STM32_TIM_BDTR_DTG((uint32_t)(CBridgePWM::f32Deadtime * (float32_t)STM32_TIM1CLK -1)),
26
   /*
27
   * no extra interrupts enabled
28
   */
29
   0
30
};
31

32
float32_t CBridgePWM::f32CounterMax = STM32_TIM1CLK/(CBridgePWM::f32Freqency*2.0f) -1;
33

34
/******************************************************************************
35
 * G L O B A L   F U N C T I O N S
36
 ******************************************************************************/
37

38

39
/**************************************************************************//**
40
 * \\brief Constructor handles the PWM initialization.
41
 *
42
 * Optional, detailed description
43
 * of function ...
44
 *
45
 * \\param[in]  f32Freqency
46
 *              Freqency of the PWM Waveform in Hz
47
 *
48
 * \\param[in]  f32Deadtime
49
 *              Deadtime of the complementary PWM Waveforms in seconds
50
 *
51
 ****************************************************************************//*
52
 * Changes :    Author, Date, Version, Reason for change
53
 *              ***************************************************************
54
 *              Tecnologic, 06.06.2014, 1.0, Creation
55
 ******************************************************************************/
56
CBridgePWM::CBridgePWM(){}
57

58
/**************************************************************************//**
59
 * \\brief Initialize PWM Hardware
60
 *
61
 * \\retval     Result
62
 *              true on success
63
 ****************************************************************************//*
64
 * Changes :    Author, Date, Version, Reason for change
65
 *              ***************************************************************
66
 *              Tecnologic, 25.06.2014, 1.0, Creation
67
 ******************************************************************************/
68
bool CBridgePWM::HardwareInit(void){
69
    pwmStart(pwmp, &pwmcfg);
70
    (pwmp)->tim->CR1 |= STM32_TIM_CR1_CMS(1);
71
    pwmEnableChannel(pwmp, 3, (uint16_t)(f32CounterMax * 0.01f));
72
    return true;
73
}
 PWM Config

Der Restliche Code ist aktueller ChibiOS V3 Code vom GitHub Master.
Das ADC_DUAL TestHal Projekt läuft auch sauber, mit Interrupt. Daraus 
folgere ich das es etwas mit der gesamt Konfiguration des Systems zutun 
hat. Die Konfiguration von ChibiOS habe ich auch test weise von dem 
Projekt übernommen aber keine Besserung. Bei ST ist das Problem nicht 
bekannt, soll also nicht am Prozessor liegen, was ich auch nicht 
glaube,.

Vllt hatte jemand schon mal was ähnliches, weiß nicht wo ich noch 
schauen könnte? Wäre für jeden Hinweis dankbar.

Wenn die DMA Ints deaktiviert sind, läuft alles super, der DMA arbeitet 
auch, nur stört mich das mit dem Interrupt, Das deutet darauf hin das 
nicht alles stimmt oder sich was zankt.

Gruß

Tec

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren