XMC4200 ADC Problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User10696
Level 4
Level 4
First solution authored
Hello

I am using the ADC in a XMC4200 Microcontroller.
I am using one channel in a group. The group is triggered from a CCU4 at 20kHz. The result is configured to accumulate 4 values and then trigger a service request.

This works fine most of the time. In my interrupt routine I see the result is 4 times the expected value and the DRC is zero.

But every few seconds I get an incorrect result. In the interrupt routine the result is the expected value (not 4 times) and the DRC is 3.

Why is the service request being set by the first result, instead of waiting for the fourth result?

I have tried clearing the result event with the REFCLR register each time I read a result (not sure if this is necessary), but this did not help.

Why does it mostly work, but sometimes go wrong?
0 Likes
1 Solution
User10696
Level 4
Level 4
First solution authored
In the mean time I have managed to solve the problem.
It was not a problem with the ADC, that is working correclty.
The problem was with too many other interrupts and incorrect priorites. The ADC interrupt was coming correctly, but due to too low a priority it did not run until the first conversion of the next sequence had already been completed. So the interrupt was reading the first result of the next sequence rather than the last result of the sequence which set the interrupt.
I have changed the priority of the ADC interrupt and now everything is working as expected.

View solution in original post

0 Likes
3 Replies
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi ,

Will you able to share more details about the project so that we can try recreating the issue ? You can share your project and I can check the settings at my end.

Best Regards,
Vasanth
0 Likes
User10696
Level 4
Level 4
First solution authored
In the mean time I have managed to solve the problem.
It was not a problem with the ADC, that is working correclty.
The problem was with too many other interrupts and incorrect priorites. The ADC interrupt was coming correctly, but due to too low a priority it did not run until the first conversion of the next sequence had already been completed. So the interrupt was reading the first result of the next sequence rather than the last result of the sequence which set the interrupt.
I have changed the priority of the ADC interrupt and now everything is working as expected.
0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked
Hi,

Happy to know that the issue is resolved.

Best Regards,
Vasanth
0 Likes