XMC1400 external VAREF for ADC issue

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

cross mob
Andi_H
Employee
Employee
First solution authored First like received
Hello,

i would like to use the external VAREF (VDD Pin = 5V) for reading ADC results from 5V Sensors

and (VDDP= 3,3V) for digital IO (communication with other ics and so on...

1st question: is that in principle possible? --> VDD > VDDP ?
2nd question how can i activate the external VAREF? --> I am using DAVE 4.3.2 and the ADC Measurement App 4.1.22 --> the generated code looks:


/*********************** C3 Configurations ************************************/


/*C3 ADC Channel configuration structure*/
XMC_VADC_CHANNEL_CONFIG_t C3_ch_config =
{
.input_class = (uint32_t) XMC_VADC_CHANNEL_CONV_GLOBAL_CLASS0, /* Global ICLASS 0 selected */
.lower_boundary_select = (uint32_t) XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0,
.upper_boundary_select = (uint32_t) XMC_VADC_CHANNEL_BOUNDARY_GROUP_BOUND0,
.event_gen_criteria = (uint32_t) XMC_VADC_CHANNEL_EVGEN_NEVER, /*Channel Event disabled */
.sync_conversion = (uint32_t) 0, /* Sync feature disabled*/
.alternate_reference = (uint32_t) XMC_VADC_CHANNEL_REF_INTREF, /* Internal reference selected */ //----------------------------------------------this line to external ref ?!
.result_reg_number = (uint32_t) 13, /* GxRES[13] selected */
.use_global_result = (uint32_t) 0, /* Use Group result register*/
.result_alignment = (uint32_t) XMC_VADC_RESULT_ALIGN_RIGHT, /* Result alignment - Right Aligned*/
.broken_wire_detect_channel = (uint32_t) XMC_VADC_CHANNEL_BWDCH_VAGND, /* No Broken wire mode select*/
.broken_wire_detect = (uint32_t) 0, /* No Broken wire detection*/
.bfl = (uint32_t) 0, /* No Boundary flag */
.channel_priority = (uint32_t) 0, /* Lowest Priority 0 selected*/
.alias_channel = (int8_t) -1, /* ALIAS is Disabled*/
};

/*C3 Result configuration structure*/
XMC_VADC_RESULT_CONFIG_t C3_res_config =
{
.data_reduction_control = (uint8_t) 0, /* No Accumulation */
.post_processing_mode = (uint32_t) XMC_VADC_DMM_REDUCTION_MODE,
.wait_for_read_mode = (uint32_t) 0, /* Disabled */
.part_of_fifo = (uint32_t) 0 , /* No FIFO */
.event_gen_enable = (uint32_t) 0 /* Disable Result event */
};

/* C3 ADC channel Handle */
ADC_MEASUREMENT_CHANNEL_t ADC_MEASUREMENT_C3_handle =
{
.ch_num = (uint8_t) 2,
.group_handle = (VADC_G_TypeDef*)(void*) VADC_G1,
.group_index = (uint8_t) 1,
.ch_handle = (XMC_VADC_CHANNEL_CONFIG_t*) &C3_ch_config,
.res_handle = (XMC_VADC_RESULT_CONFIG_t*) &C3_res_config,
};


2770.attach
2771.attach

According to these pictures i thought its working without any problems.

But in my test setup goes something wrong: when i conect VDD to 5V then the VDDP Pins (normally 3,3V) rise up to 4V. When i disconect VDD, then is the reference voltage 2,5V at this pin.

Can anybody explain me what i am doing wrong?

Big Thnaks!

Andi
0 Likes
5 Replies
Andi_H
Employee
Employee
First solution authored First like received
This picture below discribe exactly what i want to do:

2431.attach

how can i change this register? Is that the problem?

2449.attach
2449.attach

It would be nice if somebody have an idea...?!

Thanks

Andi
0 Likes
Andi_H
Employee
Employee
First solution authored First like received
push....

Andi
0 Likes
Eric1
Employee
Employee
Hello Andi,

VDD and VDDP have to be supplied with the same Voltage.
2423.attach


All CONFIG_x APPs are meant to represent the complete Peripheral.
All other APPs are use case APPs. This means with the focus of usability we skipped some configuration features.

The external reference is not available in the ADC_MEASUREMENT_ADV.
But, as you already tried, you can add this feature by writing into the register or using the XMC_LIB.

In the XMC LIB the XMC_VADC_GLOBAL_SHS_Init() with the XMC_VADC_GLOBAL_SHS_CONFIG_t is configuring the reference ("analog_reference_select").
The Bit is protected by the SCWC bit (SHS_SHSCFG_SCWC_Msk). You need to set also this bit to write the AREF bit.

It is possible to use the internal 5V reference and supply the MCU with a lower Voltage (e.g. 3.3V).
But Vain has to be in the range of -0.05 VSSP to +0.05 VDDP.
You can find this information in the second picture you have posted ADC Characteristics: "Analog input voltage range Vain".

Regards
Eric
0 Likes
Andi_H
Employee
Employee
First solution authored First like received
Hey Eric,

thanks for your reply. Thats sounds not good for me, but good to know...

for which kind of application is this usefull? Aref 5V but Vain max 3.3V?

Best regards
Andi
0 Likes
User13476
Level 1
Level 1
I am using XMC 4700, evaluation board and working on ADC module.

My question?

I want supply 2.5 voltage VAREF PIN, so that I can use standrad reference voltage as 2.5V.

However, I am not able to set the VAREF at 2.5v.

Please tell me the procedure I need to follow to set the VAREF as 2.5 volts.


Thanks.
ADCG











Eric wrote:
Hello Andi,

VDD and VDDP have to be supplied with the same Voltage.
2424.attach


All CONFIG_x APPs are meant to represent the complete Peripheral.
All other APPs are use case APPs. This means with the focus of usability we skipped some configuration features.

The external reference is not available in the ADC_MEASUREMENT_ADV.
But, as you already tried, you can add this feature by writing into the register or using the XMC_LIB.

In the XMC LIB the XMC_VADC_GLOBAL_SHS_Init() with the XMC_VADC_GLOBAL_SHS_CONFIG_t is configuring the reference ("analog_reference_select").
The Bit is protected by the SCWC bit (SHS_SHSCFG_SCWC_Msk). You need to set also this bit to write the AREF bit.

It is possible to use the internal 5V reference and supply the MCU with a lower Voltage (e.g. 3.3V).
But Vain has to be in the range of -0.05 VSSP to +0.05 VDDP.
You can find this information in the second picture you have posted ADC Characteristics: "Analog input voltage range Vain".

Regards
Eric
0 Likes