2024-01-08 08:56 AM - edited 2024-01-08 09:00 AM
I was unable to configure ADC1 to measure a "4 channel sequence" and then generate an interrupt.
I am using the injected result registers to read the values in the ISR.
Adc_Value[0]= ADC1->JDR1;
Adc_Value[1]= ADC1->JDR2;
Adc_Value[2]= ADC1->JDR3;
Adc_Value[3]= ADC1->JDR4;
All values show zero!
Can anyone provide an example code for reading injected results + interrupt?
Alternatively the DMA may be used, but when I try to use regular/non injected results via DMA, I am not able to generate an interrupt anymore!
The sequence is triggered by TIM1 at every 15.8 uS.
2024-01-10 05:23 AM
2024-01-10 11:32 AM
Hi Sarra,
Could you please point me to "Indep_InjectedGroup" firmware example?
Where do I find it?
Thanks,
Yitzhak
2024-01-11 12:32 AM
ofc, here is the link to the software
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-01-16 07:08 AM
This code is using APIs/Functions that are not compatible with my project/code.
Any code example that is compatible with the recent Cube MX/Cube IDE code?
2024-01-16 07:51 AM
Just you want results every 15,8 us, so about 300000 data per second - right?
What you want to do with this amount of data?
If you just do anything with the data, your CPU would have no time to do anything else.
2024-01-16 08:36 AM
253164 results to be exact.
We do not really have to use all 4 measurement each 15.8 uS.
But let's address that later. The ADC should be able to do this.
Let's even think that the sample rate is slower.
2024-01-16 11:15 AM
Ok, should be possible; on what G4 ?
+ can you attach your x.ioc ? (maybe as zip, if forum still not "allowed" ioc )
2024-01-16 11:18 AM
Yes, STM32G474
2024-01-16 11:52 AM - edited 2024-01-16 12:43 PM
setup adc1 :
then try to start it:
MX_ADC1_Init();
MX_TIM1_Init();
/* USER CODE BEGIN 2 */
HAL_ADCEx_Calibration_Start(&hadc1); // adc1 kalib.
HAL_Delay(2); // wait a little
HAL_ADCEx_InjectedStart_IT(&hadc1); // start adc for int mode
HAL_TIM_Base_Start(&htim1); // Trigger ADCs
/* USER CODE END 2 */
-> then set breakpoint in adc int , check results in debug mode...