Attachments are accessible only for community members.
Not applicable
Dec 30, 2015
12:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 30, 2015
12:15 AM
Hi All,
I following the steps in the documentation contained in DAVE 4 for the "ADC_MEASUREMENT[4.1.12]" under the "Usage" tab, the example simply does not work.
Notes:
1) I adapted the example to work with the XMC1300 boot kit. Thus I used the potentiometer pin P2.5.
2) Checked on scope, the voltage level does change on change of the potentiometer.
3) I have attached the example for the XMC1300 boot kit.
Is there somewhere I can find a working example of using the ADC?
Regards,
Enigma
I following the steps in the documentation contained in DAVE 4 for the "ADC_MEASUREMENT[4.1.12]" under the "Usage" tab, the example simply does not work.
Notes:
1) I adapted the example to work with the XMC1300 boot kit. Thus I used the potentiometer pin P2.5.
2) Checked on scope, the voltage level does change on change of the potentiometer.
3) I have attached the example for the XMC1300 boot kit.
Is there somewhere I can find a working example of using the ADC?
Regards,
Enigma
- Tags:
- adc
- IFX
- not working
10 Replies
Dec 30, 2015
05:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 30, 2015
05:40 AM
Looking at your code, seems that you adapted wrongly the code to your device.
Because you are using XMC13, you should have:
instead of:
Because you are using XMC13, you should have:
result = ADC_MEASUREMENT_GetResult(&ADC_MEASUREMENT_Channel_A);
instead of:
result = ADC_MEASUREMENT_GetResult(&ADC_MEASUREMENT_0);
Not applicable
Dec 30, 2015
06:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 30, 2015
06:08 AM
Hi,
I tried both ways, based on the documentation. Still does not work. Does it work for you? I can work with the ADC without using the APPs and can get reliable readings, but using the APP it fails.
Regards,
Enigma
I tried both ways, based on the documentation. Still does not work. Does it work for you? I can work with the ADC without using the APPs and can get reliable readings, but using the APP it fails.
Regards,
Enigma
Not applicable
Dec 30, 2015
10:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 30, 2015
10:02 AM
Hello,
I work with the ADC-Measurement app and use:
ResultA = // Get result from ADC Channel A
XMC_VADC_GROUP_GetResult
(ADC_MEASUREMENT_Channel_A.group_handle,
ADC_MEASUREMENT_Channel_A.ch_handle->result_reg_number);
ResultB = // Get result from ADC Channel B
XMC_VADC_GROUP_GetResult
(ADC_MEASUREMENT_Channel_B.group_handle,
ADC_MEASUREMENT_Channel_B.ch_handle->result_reg_number);
to retrieve the results from two channels. It's working fine for me. Maybe you give this a try.
Regards
Kurt
I work with the ADC-Measurement app and use:
ResultA = // Get result from ADC Channel A
XMC_VADC_GROUP_GetResult
(ADC_MEASUREMENT_Channel_A.group_handle,
ADC_MEASUREMENT_Channel_A.ch_handle->result_reg_number);
ResultB = // Get result from ADC Channel B
XMC_VADC_GROUP_GetResult
(ADC_MEASUREMENT_Channel_B.group_handle,
ADC_MEASUREMENT_Channel_B.ch_handle->result_reg_number);
to retrieve the results from two channels. It's working fine for me. Maybe you give this a try.
Regards
Kurt
Dec 30, 2015
11:53 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 30, 2015
11:53 AM
enigmaldc wrote:
Hi,
I tried both ways, based on the documentation. Still does not work. Does it work for you? I can work with the ADC without using the APPs and can get reliable readings, but using the APP it fails.
Regards,
Enigma
I don't have right now the XMC1300 board with me, but I tested the example in a XMC4400 board and I got it working, no problems.
You can try to debug it step by step, maybe start to see if the interrupt is being executed.
Attachments are accessible only for community members.
Dec 30, 2015
06:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 30, 2015
06:06 PM
enigmaldc wrote:
Hi All,
I following the steps in the documentation contained in DAVE 4 for the "ADC_MEASUREMENT[4.1.12]" under the "Usage" tab, the example simply does not work.
Notes:
1) I adapted the example to work with the XMC1300 boot kit. Thus I used the potentiometer pin P2.5.
2) Checked on scope, the voltage level does change on change of the potentiometer.
3) I have attached the example for the XMC1300 boot kit.
Is there somewhere I can find a working example of using the ADC?
Regards,
Enigma
Hi,
You might want to give this code a try.
Not applicable
Jan 08, 2016
02:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 08, 2016
02:10 AM
Hi All,
Thanks for all the replies. I just got back to playing with my new toys. I will give this example a try and let you know how it goes.
Regards
Enigma
Thanks for all the replies. I just got back to playing with my new toys. I will give this example a try and let you know how it goes.
Regards
Enigma
Not applicable
Jan 11, 2016
08:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 11, 2016
08:02 AM
Hi Travis,
I looked at your example, but maybe I am just not understanding what you did, but I find it very hard following your code. Here I have very simple code and it just does not work
I just want to monitor pins P2.3, P2.4 and P2.5 in this example continuously, but this simple example of mine fails. Can you spot my mistake? I can monitor these channels with the following code
but this uses the background method. What is the core difference between using "Background" and "Scan"?
Regards
Enigma
I looked at your example, but maybe I am just not understanding what you did, but I find it very hard following your code. Here I have very simple code and it just does not work
const XMC_VADC_GLOBAL_CONFIG_t g_global_handle = { };
const XMC_VADC_GROUP_CONFIG_t g_group_handle = { };
const XMC_VADC_SCAN_CONFIG_t g_scan_handle = {
.trigger_signal = XMC_VADC_REQ_TR_A,
.trigger_edge = XMC_VADC_TRIGGER_EDGE_ANY,
.external_trigger = 1,
.req_src_interrupt = 1 };
// P2.3,G1CH5
const XMC_VADC_CHANNEL_CONFIG_t g_g1_ch5_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 5 };
// P2.4, G1CH6
const XMC_VADC_CHANNEL_CONFIG_t g_g1_ch6_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 6 };
// P2.5, G1CH7
const XMC_VADC_CHANNEL_CONFIG_t g_g1_ch7_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 7 };
int main(void)
{
uint32_t result[16] = {};
XMC_VADC_GLOBAL_Init(VADC, &g_global_handle);
XMC_VADC_GROUP_Init(VADC_G1, &g_group_handle);
XMC_VADC_GROUP_SetPowerMode(VADC_G1, XMC_VADC_GROUP_POWERMODE_NORMAL);
XMC_VADC_GLOBAL_StartupCalibration(VADC);
XMC_VADC_GROUP_ScanInit(VADC_G1, &g_scan_handle);
XMC_VADC_GROUP_ChannelInit(VADC_G1, 5, &g_g1_ch5_handle); // P2.3
XMC_VADC_GROUP_ChannelInit(VADC_G1, 6, &g_g1_ch6_handle); // P2.4
XMC_VADC_GROUP_ChannelInit(VADC_G1, 7, &g_g1_ch7_handle); // P2.5
XMC_VADC_GROUP_ScanAddChannelToSequence(VADC_G1, 5); // P2.3
XMC_VADC_GROUP_ScanAddChannelToSequence(VADC_G1, 6); // P2.4
XMC_VADC_GROUP_ScanAddChannelToSequence(VADC_G1, 7); // P2.5
// enable continuous mode - autoscan feature
XMC_VADC_GLOBAL_BackgroundEnableContinuousMode(VADC);
// conversion is triggered by software
XMC_VADC_GLOBAL_BackgroundTriggerConversion(VADC);
while (1U) {
result[7] = XMC_VADC_GROUP_GetResult(VADC_G1, 5);
result[1] = XMC_VADC_GROUP_GetResult(VADC_G1, 6);
result[0] = XMC_VADC_GROUP_GetResult(VADC_G1, 7);
}
}
I just want to monitor pins P2.3, P2.4 and P2.5 in this example continuously, but this simple example of mine fails. Can you spot my mistake? I can monitor these channels with the following code
#include
// uses standard values
const XMC_VADC_GLOBAL_CONFIG_t g_global_handle = { };
// uses standard values
const XMC_VADC_GROUP_CONFIG_t g_group_handle = { };
// uses standard values
const XMC_VADC_BACKGROUND_CONFIG_t g_bgn_handle = { };
// P2.3,G1CH5
const XMC_VADC_CHANNEL_CONFIG_t g_g1_ch5_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 5 };
// P2.4, G1CH6
const XMC_VADC_CHANNEL_CONFIG_t g_g1_ch6_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 6 };
// P2.5, G1CH7
const XMC_VADC_CHANNEL_CONFIG_t g_g1_ch7_handle = {
.alias_channel = XMC_VADC_CHANNEL_ALIAS_DISABLED,
.result_reg_number = 7 };
int main(void)
{
uint32_t result[16] = {};
// init ADC, set the clock and VADC
XMC_VADC_GLOBAL_Init(VADC, &g_global_handle);
XMC_VADC_GROUP_Init(VADC_G1, &g_group_handle);
// set power mode
XMC_VADC_GROUP_SetPowerMode(VADC_G1, XMC_VADC_GROUP_POWERMODE_NORMAL);
// start calibration
XMC_VADC_GLOBAL_StartupCalibration(VADC);
XMC_VADC_GLOBAL_BackgroundInit(VADC, &g_bgn_handle);
//init ch before adding it to the group
XMC_VADC_GROUP_ChannelInit(VADC_G1, 5, &g_g1_ch5_handle);
XMC_VADC_GROUP_ChannelInit(VADC_G1, 6, &g_g1_ch6_handle);
XMC_VADC_GROUP_ChannelInit(VADC_G1, 7, &g_g1_ch7_handle);
// add ch to background source
XMC_VADC_GLOBAL_BackgroundAddChannelToSequence(VADC, 1, 5);
XMC_VADC_GLOBAL_BackgroundAddChannelToSequence(VADC, 1, 6);
XMC_VADC_GLOBAL_BackgroundAddChannelToSequence(VADC, 1, 7);
// enable continuous mode - autoscan feature
XMC_VADC_GLOBAL_BackgroundEnableContinuousMode(VADC);
// conversion is triggered by software
XMC_VADC_GLOBAL_BackgroundTriggerConversion(VADC);
while(1U)
{
// readout the result from the ADc reading - value between [0,2^8-1] for 12 bit reading
result[7] = XMC_VADC_GROUP_GetResult(VADC_G1, 5);
result[1] = XMC_VADC_GROUP_GetResult(VADC_G1, 6);
result[0] = XMC_VADC_GROUP_GetResult(VADC_G1, 7);
}
}
but this uses the background method. What is the core difference between using "Background" and "Scan"?
Regards
Enigma
Attachments are accessible only for community members.
Jan 12, 2016
01:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 12, 2016
01:47 AM
Not applicable
Jan 12, 2016
11:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 12, 2016
11:22 AM
Hi Travis,
Thanks, I will have a look tomorrow and let you know how it went.
Regards
Enigma
Thanks, I will have a look tomorrow and let you know how it went.
Regards
Enigma
Not applicable
Jan 18, 2016
08:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jan 18, 2016
08:10 AM
Hi Travis,
Thanks, it works and I have come across my own mistake now.
It does not seems to me that there is really any difference in the background method or the scan method. Could you elaborate on the two methods?
Regards
Enigma
Thanks, it works and I have come across my own mistake now.
It does not seems to me that there is really any difference in the background method or the scan method. Could you elaborate on the two methods?
Regards
Enigma