Setting up VADC

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

cross mob
Not applicable
Hi,

when trying to set up the AD-Converter with Dave (I am not using the Apps) I am facing some problems. I cant get any results from the converter even if I follow the instructions from the reference manual and the application note for the ADC. I am using a XMC4500 relax kit. Here is my initialisation sequence:
SCU_RESET -> PRSET0 |= (1 << SCU_RESET_PRSET0_VADCRS_Pos); //apply reset
SCU_RESET -> PRCLR0 |= (1 << SCU_RESET_PRCLR0_VADCRS_Pos); //release reset
VADC -> GLOBCFG |= (1 << VADC_GLOBCFG_DIVWC_Pos); //write acces for clk division

VADC -> CLC &=~(1 << VADC_CLC_DISR_Pos); //enable clk
VADC -> BRSSEL[0] |= (1 << VADC_BRSSEL_CHSELG0_Pos); //Background request source for channel 0
VADC -> BRSMR |= (0b01 << VADC_BRSMR_ENGT_Pos); //configure gating
VADC_G0 -> ARBPR|= (1 << VADC_G_ARBPR_ASEN0_Pos);
VADC_G0 -> ARBCFG |= (0b11 << VADC_G_ARBCFG_ANONC_Pos); //enable ADC
VADC -> BRSMR |= (1 << VADC_BRSMR_LDEV_Pos); //generate load event


First of all it is not possible to write in the GLOBCFG register. When debugging and using breakpoints, the write control bit can not be set. The write control is always disabled. If I dont apply the reset all registers related to the ADC contain the value 0xffffffff. How comes that? There doesn't occure any value in the result register.
I applied a poti at P14.0 to change the measured value.
Any suggestions?

Thank you for your help,
XMC_Beginner
0 Likes
4 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
0 Likes
User19285
Level 1
Level 1
I am running into the exact same issue. Looking at DAVE examples is not helping.

Does anyone know why all of the values for the VADC registers might default to 0xFFFFFFFF instead of the values given in the datasheet? (The same holds true for the USIC registers).

I am also trying to setup not using Dave Apps (I'm actually using Keil as the compiler, but using DAVE also shows these memory locations defaulting to 0xFFFFFFFF.).

I have attached a screenshot showing the registers as all F's, and a bit of the code.

Thanks

4156.attach
0 Likes
User19285
Level 1
Level 1
The issue was buried deep in the bloated DaveApp code; I did not see any mention of it in the user manual.

The Peripheral CLK must be ungated, and the VADC periph must then be manually reset in SW. See below for the two lines that make it work (136/137).

4157.attach
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
The issue was buried deep in the bloated DaveApp code; I did not see any mention of it in the user manual.
=> DAVE code abstraction layer.


To get to know better the ADC these documents might be helpful:

https://www.infineon.com/dgdl/Infineon-VADC-XMC4000-AP32305-AN-v01_02-EN.pdf?fileId=5546d4624e765da5...
https://www.infineon.com/dgdl/Infineon-VADC-XMC1200_XMC1300-AP32304-AN-v01_10-EN.pdf?fileId=5546d462...

Regards,
Jesus
0 Likes