AnsweredAssumed Answered

STM32F103 ADC and timer interupt

Question asked by Cezar Chirila on Apr 19, 2017
Latest reply on Apr 20, 2017 by Cezar Chirila

Hello!

I want to build a project where i need to do about 3500 readings from a CCD sensor in a short period a time. The signal i want to read has a frequency of about 0.35MHz, which should be fine as long as i use  13.5cycles for sampling time. 

 

The problem is in the intrerupt. Here is how my program works:

  • TIM2,3,4 are started in PWM mode, needed for the CCD
  • In main loop:
  • If the reading has been done (it is only done once), send the data over serial port
  • In interupt of TIM1:
  • If the reading hasn t been done already, start ADC, read current pixel and put it in a vector, increment current pixel unless the last pixel has been reached, when then I say that the reading is over.

 

Unfortunately I do not get anything in the serial output. What can be the problem? Is the interupt routine not called? 

 

Here it is: 

void TIM1_UP_IRQHandler(void)
{
/* USER CODE BEGIN TIM1_UP_IRQn 0 */
if(read_all == 0){
HAL_ADC_Start(&hadc1);
aTxBuffer[current_pixel] = HAL_ADC_GetValue(&hadc1);
if(current_pixel == last_pixel){
read_all = 1;
current_pixel = 3;
}
else
current_pixel++;
}
/* USER CODE END TIM1_UP_IRQn 0 */
HAL_TIM_IRQHandler(&htim1);
/* USER CODE BEGIN TIM1_UP_IRQn 1 */

/* USER CODE END TIM1_UP_IRQn 1 */
}

 

I have also attached all the code. Thank you!

Attachments

Outcomes