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

cross mob
MoRo
Employee
Employee
10 likes given First like received 5 questions asked

Hi friends, I want to run ADC on XMC1400 with 9 channels. In addition, on this XMC1400 I have 9 digital inputs to recieve trigger, depending on which trigger is received, I will select which ADC channel should be capture. For instance, if digital input 1 is triggered, I will read ADC channel A, and the same for others.

Now the question is how to select or deselect channels due to the digital inputs?

Due to the fact that, after call ADC_MEASUREMENT_StartConversion(&ADC_MEASUREMENT) the XMC will start to read all the channels, in spite of of I just need the channel A and I do not need others, and for next round, I need channel B or C or... depending on trigger received. Is there any register on XMC to enable channels or disable channel to reduce time of ADC measurement?

I know each channel will take more than 1.5us and it will take a long time to receive reading flag is done.

In this shot describe all of the channels will start to read, but I do not want to stay for a long time to read CH_A or CH_B in the queue.

MoRo_0-1675630423186.png

I will be grateful, if anybody can help me to optimize time of responsibility in ADC?

Best regards,

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

The background mode can't remove the channel. You can use the adv component to achieve this function. I add a test project here.

View solution in original post

0 Likes
6 Replies
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

I think we can use the lib to achieve this function instead of the APP. Just like the attached project.

We may config the .refill_needed 0, it means the channel_num will not be added automatically.  

We can use "XMC_VADC_GROUP_QueueInsertChannel(VADC_G0, g_queue_entry_0_handle);". to insert the channel num again.

Please check if it can meet your requirement.

 

MoRo
Employee
Employee
10 likes given First like received 5 questions asked

Thank you for the guides. So you mean before call ADC_MEASUREMENT_StartConversion(), I need to remove or insert channels to minimize time of responsibility of ADC conversion as much as I want. Am I right?

For instance, if I need to get the only CH_A result. I should remove all others in queue tail. Like here?
XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t  CH_B);
XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t CH_C);
.
.
.
then I have to call ADC_MEASUREMENT_StartConversion().
In this scenario, the queued channels are removed and the ADC converter spends time reading only CH_A.
I would appreciate it if you could correct me if I am wrong?

0 Likes
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

As my opinion, your understanding is right.

MoRo
Employee
Employee
10 likes given First like received 5 questions asked

Just as a question, with  XMC_VADC_GROUP_QueueRemoveChannel(XMC_VADC_GROUP_t *const group_ptr); we can only select a group of ADC channels not a specific channel.

MoRo_0-1675935162781.png

Could you guide me with more details?

 

0 Likes
lock attach
Attachments are accessible only for community members.
MoRo
Employee
Employee
10 likes given First like received 5 questions asked

Here I have created the simple sample code which can detect how many channels measured after call ADC_MEASUREMENT_StartConversion(). On the line number 40 for instance with XMC_VADC_GROUP_QueueRemoveChannel(&Channel_A) I am not able to remove Channel_A from the queue.
Could guide me to find how remove or insert the channels in sample code?

0 Likes
lock attach
Attachments are accessible only for community members.
LinglingG_46
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 10 questions asked

The background mode can't remove the channel. You can use the adv component to achieve this function. I add a test project here.

0 Likes