ADC app notes insufficient - very annoyed

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

cross mob
lock attach
Attachments are accessible only for community members.
Not applicable
Hi All,

Setup : XMC1300 boot kit + DAVE 4

I want to trigger ADC conversion without making use of the DAVE 4 apps. Attached is code that should work in principle. I followed all the app notes that are available and the reference manual, these have proven to be useless in my case.

I have to digital inputs going into the ERU unit (P2.0 and P2.4). A logical and is performed and on the falling edge I would like to take a measurement from the ADC. The ADC is configured such that I can take a measurement from P2.3.

What I can see is that the ERU fires an interupt, so I know that setup within the code is working. The interupt for the ADC measurement never fires and no matter what I do I can not get this to work.

Could a Infineon employee or someone skilled enough have a look at the code. It is rather simple and I can not figure out why it is not working.

Regards
Enigma
0 Likes
3 Replies
lock attach
Attachments are accessible only for community members.
User7282
Level 4
Level 4
In the project that you sent I found a few issues:

1 - On the background configuration structure, you should set the parameter req_src_interrupt = 1. This is in fact what you want to do, trigger an interrupt when the conversion is finished.

2 - You are calling the function XMC_VADC_GROUP_ResultInit(VADC_G1, 5, &g1_ch5_res_config); You should be calling it instead using:
XMC_VADC_GROUP_ResultInit(VADC_G1, 10, &g1_ch5_res_config);


because you are configuring the result register 10.

3 - You are setting the VADC interrupt to a group specific service request. Since you are using a background source, you should assign this to a shared service request, such as VADC0_C0_0_IRQn.

4 - You are forgetting to tell the ADC what is the service request were the conversion finished event will be defined. For that you can use the function XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode().

I think that I got the project working as intended, here it goes.
0 Likes
Not applicable
Hi again,

It works, thank you very much, but I would like to understand the system now.

Comments:
1) Your point 1 and 2 I agree with, there I made a stupid mistake.
2) On point 3 what I do not get is that I had "VADC0_G1_1_IRQn" and you used "VADC0_C0_0_IRQn". Could you please point me to some documentation discussing this, an app note or something. From the datasheet this is not clear to me at all.
3) On point 4 I do not understand this at all, I have not see this in any app note or documentation thus far. Could you point me to some documentation here. I have also looked at the code the apps produce and I do not find this therein.

I would appreciate any clarity on these points you can offer, this I believe would not just be interesting for me but to the community as a whole too.

Regards
Enigma
0 Likes
User7282
Level 4
Level 4
So I think that the best place that you have to check this is the XMC1300 VADC app note.

In the Chapter 6, "Events and Interrupts", page 72. I think that this gives you good information about all the events and in particular the request source events. Near the end of the page you can read this: "All these events can be assigned to a service request output. Two different kinds of request outputs are available:
- Group specific (GxSRy) request outputs are only driven from the group where the event is generated.
Background Request Source events are not included here.
- Common request lines (CxSRy) can be accessed from any group and even from the Background Request
source events."

The figure in the next page also shows that. So here you can see why you have to change from "VADC0_G1_1_IRQn" (group specific request line) to "VADC0_C0_0_IRQn" (common request line).

In the page 74, section 6.2.1 "Request Source Events":
"To generate Background Source events:
1. Enable the Source Interrupt (ENSI=b1) in the Background Source Mode Register (BRSMR).
2. Select a service request line in the Service Request Node Pointer (SEV0NP) bitfield of the Global Event Node Pointer Register (GLOBEVNP).
3. Enable the Interrupt or Peripheral action for the service request line selected."

Searching in the low level drivers you can see that the function that configures SEV0NP bitfield is XMC_VADC_GLOBAL_BackgroundSetReqSrcEventInterruptNode(). Also in the generated code from the ADC_MEASUREMENT APP this function is present in the initialization function.
0 Likes