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

DAVE™ Forum Discussions

Not applicable
Hey there,

I started µC-programming a few weeks ago and as a newbie I am very greatful for the DAVE-APPS 😉 It makes it much more easier for me.
I've got a XMC4200Q48-Hexagon-Kit and I want to do synchronous sampling of two analog signals (I use the VADC_G1CH0 and VADC-G0CH0 pins). The sync. sampling is working very well with the ADC_MEASUREMENT_ADV App!

To get the actual sampling rate, I connected it with an oscilloscope. Unfortunately I have a sampling rate of only max. 300 kHz when I use the code below. (Therefore I'm toggling a pin in the for-loop between both GetResult-functions.)

To my question: is there a way to improve the sampling rate? According to data sheet I should be able to sample with > 1 Msps for 12-bit. Or is the reason for the slow sampling just a bad programming? I've put my code below.

#include                  //Declarations from DAVE Code Generation (includes SFR declaration)
#include "GPIO.h"

uint32_t result[250];
uint32_t sync_result[250];
uint8_t i;

int main(void)
{
DAVE_STATUS_t status;

status = DAVE_Init(); // Initialization of DAVE APPs

ADC_MEASUREMENT_ADV_SetIclass(&ADC_MEASUREMENT_ADV_0);
ADC_MEASUREMENT_ADV_StartADC(&ADC_MEASUREMENT_ADV_0);
ADC_MEASUREMENT_ADV_SoftwareTrigger(&ADC_MEASUREMENT_ADV_0);

while(1U)
{
for(i=0; i<250; i++)
{
// here I toggle the testpin for oszilloscope measurement

result = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel1);
sync_result = ADC_MEASUREMENT_ADV_GetResult(&ADC_MEASUREMENT_ADV_0_Channel2);

// here I toggle the testpin for oszilloscope measurement again
}
}
}


Thank you!

Best regards,
johann
0 Likes
0 Replies