2019-04-30 02:59 AM
Hello,
in my project I have to acquire 2 channels in injected mode and 7 channels in regular mode on ADC1. The first injected channel is not converted correctly, sometimes it seems to be blocked for several samples and then it starts working again. If I invert the conversion sequence of the two injected channels the problem remains on the first converted channel. The problem remains even if I block the conversion of regular channels.
Any suggestions?
2019-04-30 03:38 AM
Probably a code issue. How do you retrieve the results ?
The injection mode has EOC (for each channel) and EOS (for the sequence) as well, and a single result register.
And the ref manual says:
Note: It is not possible to use both the auto-injected and discontinuous modes simultaneously.
2019-04-30 05:59 AM
Hi Ozone,
I read data into ADC1 interrupt routine ad the end of sequence.
Discontinuos mode is disable in CubeMx, I use 4.20 version for compatibility with previous versions, not the last version.
The code in project is:
/* activate interrupt */
LL_ADC_WriteReg(ADC1, IER, LL_ADC_IT_JEOS);
/* ADC1 interrupt routine */
void ADC1_2_IRQHandler(void)
{
/* USER CODE BEGIN ADC1_2_IRQn 0 */
if(READ_BIT(ADC1->ISR, ADC_ISR_JEOS))
{
LL_ADC_WriteReg(ADC1, ISR, ADC_ISR_JEOS);
Adc1IrqCounter++;
Adc1JData[0] = LL_ADC_ReadReg(ADC1, JDR1);
Adc1JData[1] = LL_ADC_ReadReg(ADC1, JDR2);
}
....
}
2019-04-30 06:13 AM
I never used injected mode, surprised to realise there are 4 dedicated result registers ... :o
Have you tried to check for EOC in the interrupt handler, and see if the conversion results are plausible ?
The F30x is not new, but I would nonetheless verify that the actual ADC configuration (config register settings) matches the supposed one. Cube is rumored to contain some bugs...