I am using S32K116 sample and convert the 6 channel ADC0 by PDB back-to-back mode. And I also want to use the ADC0 compare value function to compare 2 channel of 6 ADC and it will generate an interrupt if the condition is true.
I can't get any interrupts from ADC expect the last one ADC channel of the PDB chain which I set enable the ADC interrupt to all ADC channels .( All ADC channel had set ADC0->SC1 |= ALEN(1) )
The ADC interrupt and the PDB pretrigger both use the COCO flag . Is there any conflict between them? I don't know if I am right or not. I really need you help!
Yes, all the channels will be compared but if the compara condition is true, but the ADC COCO interrupt will be called regardless of PDB back-to-back mode.
It means that it will generate 6 ADC interrupts in a PDB back to back chain ? And How to config the PDB period ? It seems something wrong in my code.. Could you give me some suggestion ?
The compare function cannot be enabled for just 2 channels out of the 6.
And if the compare function is enabled, the COCO flag is set only if the corresponding compare result is true.
Are all the compare results true when you are testing it?
It means that if I enable the compare function, ALL ADC channels' result will compare with the CV & CV, right ?
Now I have some questions. From the S32K RM ,I get that when ADC sample and convert completed, the result will write into R[n] and the COCO flag will set 1.
What happens if I set both ADC convert complete interrupt and the PDB back to back mode to pretrigger the next ADC channel at the same time ? Both are work or just one ? In my project , I cant get the ADC interrupt but the PDB pretrigger.
Looking forward to your reply.