Achieving a 1MHz data acquisition rate

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

cross mob
User12223
Level 2
Level 2
First solution authored
Hi,

Is it possible or has anybody managed to achieve an ADC sampling rate of 1MHz?

I have been trying for a while using many methods, I have also come across a lot of documentation that suggest this is possible, yet I am unable to achieve this.

The fasted I have been able to achieve is ~700kHz.
I used an XMC4500 relax kit and Dave 4 to achieve this speed. Within Dave 4, I configured an ADC_Measurement App to start at initialization and continuously convert.
I also configured a CCU8 PWM to 1MHz calling an interrupt on every period match.
The interrupt simply toggles a digital pin, to generate a waveform on the oscilloscope, and get ADC conversion result. However, it seems on the scope that it is this 'ADC_MEASUREMENT_GetResult' function that is the problem.
If I comment the 'ADC_MEASUREMENT_GetResult' function, it appears the interrupt is called at the correct times...


void Interrupt_ISR(void)
{
DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0);
// result[0] = ADC_MEASUREMENT_GetResult(&ADC_MEASUREMENT_Channel_A);
}



void Interrupt_ISR(void)
{
DIGITAL_IO_ToggleOutput(&DIGITAL_IO_0);
result[0] = ADC_MEASUREMENT_GetResult(&ADC_MEASUREMENT_Channel_A);
}

As the interrupt toggles the pin, the frequency measured is half the actual. Ie, 500kHz = 1MHz or 342kHz = 684kHz.
As soon as I uncomment the 'ADC_MEASUREMENT_GetResult' function, my frequency is thrown off, as seen above. I am only converting the one channel but I will eventually need 5/6.

I have read documentation on concatenating registers, running apps in parallel etc but I am yet to find any examples or useful documentation I can apply.

I am looking for a bit of guidance and wondering if you guys have had this issue or have a solution I could try?

Thanks in advanced,
Steven
0 Likes
5 Replies
lock attach
Attachments are accessible only for community members.
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

If not done already please increase the compiler optimization to at least -O1. When you create a project in DAVE the default compiler optimization is set to -O0 (no optimizations) for a better debug ability.
I would recommend to trigger the ADC conversion using a timer instead and in the end of measurement interrupt you read the results.
See attachment.

Regards,
Jesus
0 Likes
User12223
Level 2
Level 2
First solution authored
Hi Jesus,

Thank you for your insight and thank you your example, I should have came to you first!

I also found a method by 'bypassing' the function call, ADC_MEASUREMENT_GetResult, and instead equating a variable to the desired registries.
Ie, Result[0] = ADC_MEASUREMENT_Channel_A.group_handle->RES[15];

However, I prefer your example.

I managed to get your example working on xmc4700 relax kit. I will try to convert it across to the XMC4500. If I run into any problems, ill keep you updated.

Thanks for the help Jesus.

Regards,
Steven
0 Likes
User12223
Level 2
Level 2
First solution authored
Hi,

Is it possible to convert more than 1 channel at this speed?
I optimized the compiler and have a successful conversion speed of 1MHz with one channel and an interrupt is generated on completion of the conversion.
However, when I increase the channel count to 2, the interrupt is no longer called. It is called the once at the start but never again.
It seems as though the conversion of the 2 channels takes more than 1us, because if the CCU is slowed down, to 100kHz, 2 channels can easily be converted.

The desired sample time is 67ns and the actual is 550ns, I have read documentation which suggest this is possible. Can you help me with how?

Thanks,
Steven
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

You can sample and convert up to 4 channels in parallel. You can use in DAVE, 4 ADC_MEASUREMENT_ADV APPs instances which are triggered by the same period match event of any timer.

Regards,
Jesus
0 Likes
User12223
Level 2
Level 2
First solution authored
Thank you for all your help Jesus
0 Likes