ACD block for C2000 MCU doesn't follow the sampletime we have set

4 次查看(过去 30 天)
We are using the F280025C Lauchpad in external mode from Simulink. This MCU is part of the C2000 series.
We use the ADC blocks to read values from a voltage divider. We use a sample time of 0.0001s, but when zoomed out it looks like the sample time is at 0.1s instead. As seen in the images below, the sensing seems to be working for 8 iterations, then keeps a stable value for the next 992 iterations (or there about). These images is taken from the same measurement and same simulation.
We also have other ADC block on other pins, and they works exactly the same, having the same intervals for expected behaviour.
These are the settings we use in the ADC block
Does anyone know what is going one here?

回答(1 个)

MULI
MULI 2024-10-16
Hi Henrik,
I understand that you are facing an issue with the ADC block on the F280025C LaunchPad. Despite setting a sample time of 0.0001 seconds, the ADC appears to operate correctly only a few iterations before maintaining a stable value.
To resolve this issue, you can follow the below suggestions:
  • If the sample time is too short, the processor may not complete the current ADC conversion before the next one starts, causing overruns.
  • Enable overrun detection in Simulink. Go to Configuration Parameters > Hardware Implementation > Overrun detection and configure a GPIO pin to indicate if an overrun occurs. For more information on detecting overruns, you can refer to the following documentation link https://www.mathworks.com/help/releases/R2023b/ti-c2000/ug/detect-and-fix-task-overruns-on-c2000-hardware.html
  • Ensure that the sample time in your model is greater than the sum of the sample and hold time and the conversion time. For F280025C, ensure the total time accommodates these factors.
  • Verify that both the system clock and ADC clock are configured correctly for your desired sample rate.
You can also refer to the following example which demonstrates the usage of ADC block to sample an analog voltage.
Hope this answers your query!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by