C2000 ADC's Discretization Step Size correction

Hello community of Plexim, this is my first post. I’m currently working with the Launchpad F28379D with a synchronous buck converter.

At the beginning, I configured a Sawtooth Carrier with complementary outputs, and my converter responds with these signals.

Then, I wanted to put in two ADC’s one for current (yellow signal) and the other for voltage (blue signal). I used the External Mode on Serial to see it online with a scope on my computer, and these are my results.

Since my converter switching frequency is 100 kHz, I must capture the signal at least twice its value, i.e., 5e-6 us. However, I was only capable of setting it to 10e-6 due to an error: Sample time for task 0 on CPU 0 is too small - raise sample time or system clock rate. *** plecs. I ended up in this forum to see if any of you could help me to understand this situation of why I’m seeing an average line on current and not the digital conversion of it, also at the end, external mode options are sampling options, but to be honest, I couldn’t comprehend it.

This is the schematic of my PLECS simulati.on

Hey there!

So to best answer it would be helpful to understand what your goal is in measuring your signal with the ADC. As you know, the ADC reads a voltage value by doing a conversion at a particular point in time - it is not a continuous reading of the signal. This explains why what you are seeing appears to be some sort of “average” line. The truth is that your ADC is running its conversion at the same point in the wave being applied to the ADC pin, resulting in a very consistent result. In terms of power electronics applications, usually we would try to be performing this read during a particular point in the wave to find a reading we are looking for. An example of this is current control - we can read at a particular point in the wave to find the peak, average, or minimum current and use that information to control the system.

The ADC in a general sense is not a perfect tool for monitoring a wave. Ideally to monitor a wave we want to make continuous reads as fast as possible, at a much higher rate than the frequency of the wave we are monitoring. For example, if we are switching at 100 kHz, we may want to be making readings at 1 MHz or more in order to get an idea of what our switched waveform actually looks like, which it seems you’ve identified.

So given all this, it makes sense to look at how we can trigger the ADC. In PLECS, your options for this are to have the ADC triggered by either a Timer or a PWM. For the latter option, we do not have oversampling, so at most you can have two triggers of the ADC during the period of the wave - during the underflow and overflow events of the PWM. This will provide some information on the look of your wave but not a full picture - at best you may seen the minimum and maximum values of the wave you’re reading.

But what about the timer? By default if no trigger source is selected for the ADC (trigger source is “Determine automatically”) the trigger for the ADC will be the source of the base sample rate for the model. The base sample time of the model is set by either a timer or a peripheral placed in the model that runs at the same rate (such as a PWM for example). You can put in your own timer block and trigger the ADC using it at whatever rate you want, but we will only read and send this information from the controller to PLECS at our base sample rate. In this sense, we are limited by the base sample time. The base sample time is limited to a minimum of 5e-6 as a sample rate faster than this is incapable of running even the simplest of models.

So, to summarize, there is not a very clean solution to doing what you’re attempting to do. Generally the ADC block works best as a tool to acquire a certain point in your output wave and not the entire wave. I’d use another tool such as a scope to look directly at your output waves, and you can look at how the waves appear in simulation using PLECS to compare.

I hope this answers as much as possible! If there is any confusion here let us know. Thanks!