infineon4engineers Facebook

infineon@google+ Google+

infineon@linkedin linkedin

infineon4engi@twitter twitter

infineon@youtube youtube

+ Reply to Thread
Results 1 to 2 of 2

Thread: XMC1100 ADC Problem with setting Gain

  1. #1
    New Member New Member Samuel is on a distinguished road
    Join Date
    Jan 2019
    Posts
    2
    Points
    32.5

    XMC1100 ADC Problem with setting Gain

    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.glo bal_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,
    Samuel

    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.
    Id still like to know how to write to that register from my main file, but its not that important now.
    Last edited by Samuel; Jan 4th, 2019 at 10:29 AM.

  2. #2

    Infineon Employee
    Infineon Employee
    jferreira will become famous soon enough
    Join Date
    Oct 2012
    Posts
    601
    Hi,

    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.

    Regards,
    Jesus
    The views expressed here are my personal opinions, have not been reviewed or authorized by Infineon and do not necessarily represent the views of Infineon.

+ Reply to Thread

Tags for this Thread

Disclaimer

All content and materials on this site are provided as is. Infineon makes no warranties or representations with regard to this content and these materials of any kind, whether express or implied, including without limitation, warranties or representations of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. No license, whether express or implied, is granted by Infineon. Use of the information on this site may require a license from a third party, or a license from Infineon.


Infineon accepts no liability for the content and materials on this site being accurate, complete or up- to-date or for the contents of external links. Infineon distances itself expressly from the contents of the linked pages, over the structure of which Infineon has no control.


Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Usage Terms of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Usage Terms of this site. Infineon reserves the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.