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

XMC™ Forum Discussions

Level 1
Level 1
Hello everyone,

I have a XMC1100 Boot Kit (KIT_XMC11_BOOT_001) and would like to use its ADC with a gain of 12.
I have tried to configure the ADC with Dave and added an ADC_MEASURMENT APP, but there is no option for setting gain there.
So i tried it without gain at first and the measurement works, but I do need the gain.
So after that I found the function "XMC_VADC_GLOBAL_SHS_SetGainFactor" in the xmc_vadc module and tried using that, but when stepping into the function in debug mode i noticed that writing to the Gain control register GNCTR00 doesnt seem to work. The value of the register (in the "Expressions" window of Dave) doesnt change.
Specifically, i am using: XMC_VADC_GLOBAL_SHS_SetGainFactor(GLOBAL_ADC_0.global_shs_ptr, 3, XMC_VADC_GROUP_INDEX_0, 2);
I also tried directly setting the GNCTR00 register this way: GLOBAL_ADC_0.global_shs_ptr->GNCTR00 |= ((uint32_t)3 << 8);
But neither of those change the value in GNCTR00.
So i took a look at the datasheet and found that the gain control register is supposed to be at the memory address 0x48034180. I entered that address into the memory watch window and found out that the contents of this register are as follows:
Address 0 - 3 4 - 7 8 - B C - F
48034180 ???????? ???????? ???????? ????????
As far as i know, this means that there is nothing at this register. That would explain why i cant successfully write to it, but the Datasheet says that there should be something there, so i am a bit confused.
So what am i missing here? Does the Chip not have settable gain after all? Am i just looking at the wrong function, or using it incorrectly?

Best regards,

EDIT: Nevermind, I got it to work after all.
I added the line:
SHS0->GNCTR00 |= ((uint32_t)3 << 8);
at line 231 of xmc_vadc.c
and tested it by applying the same voltage to two different ADC channels, which gave different results by the expected factor.
I´d still like to know how to write to that register from my main file, but its not that important now.
1 Reply
First like received 750 replies posted 500 replies posted

Actually the structure member global_shs_ptr is not initialized properly by the APP in the case of XMC11
We will fix it in the next release.