Code: Select all
static const ADCConversionGroup ADC_config_channel1 = {
FALSE, /*NOT CIRCULAR*/
NUM_CH, /*NUMB OF CHANNELS*/
adc_callback, /*ADC CALLBACK*/
adc_callback_error, /*ADC ERROR CALLBACK*/
ADC_CR1_JEOCIE , /* CR1 */
ADC_CR2_JEXTEN_0 | (0b1001 << ADC_CR2_JEXTSEL_Pos) | ADC_CR2_ADON | ADC_CR2_DMA, /* CR2 */
0, /* SMPR1 */
0, /* SMPR2 */
0, /* SQR1 */
0, /* SQR2 */
0, /* SQR3 */
( 0x01 << ADC_JSQR_JSQ4_Pos) /* JSQR */
};
and I have configured my timer 1 as follows
Code: Select all
tim1 = STM32_TIM1; /* gives direct access to the tim1 registers */
tim1->CR1 |= STM32_TIM_CR1_CMS(3);
TIM1->DIER = TIM_DIER_CC4IE;
tim1->CCMR2 |= TIM_CCMR2_OC4M_2 | TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_0 | TIM_CCMR2_OC4PE;
tim1->CCER |= (TIM_CCER_CC4E);
tim1->BDTR |= ( TIM_BDTR_MOE );
tim1->CCR[3] = tim1->ARR - 1;
I am calling the function adcStartConversion(&PHASE_B, &ADC_config_channel1, sample_buff_channel_1, NUM_SAMPLES) at regular intervals
but I keep receiving the ADC_ERR_DMAFAILURE in my error callback. How can I properly trigger the ADC read on the timer event? Also am I required to configure the DMA for the same?