Main Content

Check ADC Inputs


The analog to digital converter (ADC) can measure incorrect values. For example, in custom-designed analog circuits, currents measured by ADC can be incorrect due to noise, out-of-phase measurements, or sampling issues. This results in faulty feedback to the control system that leads to instability.


Verify ADC Pin

See the hardware schematics and verify that you identified and configured the correct ADC pins for a given measurement (a-phase, b-phase).

Verify ADC Block Configuration

Open the ADC block and verify that the Input Channels, ADC module, SOC trigger, SOCx acquisition window parameters are configured correctly.

ADC sampling begins with the SOC event. In some cases, for example, when sensing the current through the shunt resistors, ADC sampling requires synchronization with the bottom leg switches. In this case, verify that the SOC event is configured correctly with ADC-PWM interrupt synchronization. This also results in reduced EMI/EMC noise in the sampling because ADC conversion happens outside the PWM transition. For more information, see Task Scheduling in Target Hardware.

Reduce Noise in ADC Sampling

You may notice noise in the ADC samples. This may happen either if there is EMI/EMC or if sampling is faster than what the device can support. EMI/EMC can be reduced by improving the hardware design.

To avoid problems due to faster sampling, see the device datasheet and determine the maximum supported clock frequency of the ADC. For example, if you are using a Texas Instruments™ TMS320F28379D series microcontroller, it can support a CPU clock frequency of 200 MHz, but the maximum clock frequency supported by the ADC module is 50 MHz. Use this value to set ADC clock prescaler (ADCCLK) parameter on the Hardware Implementation tab in the Configuration Parameter dialog box of your model.

Check VDD of Current Measurement Device

Many current measurement devices derive VDD from the DC power supply (VDC). In addition, the device enable pin also determines the supply voltage to the internal current measurement circuit (for example, Texas Instruments BOOSTXL-DRV8305). Absence of VDD (or the device enable pin) results in 0 V at the ADC of the target hardware. Ensure that these conditions are not present in your hardware.

Check ADC Current Conventions

Check if you are using the correct conventions for ADC current sensing. Motor Control Blockset™ considers the current entering the motor (or leaving the inverter) as positive. This convention changes with the hardware because of the differences in the inverting or non-inverting op-amp and the analog current sensing circuit. Check the inverter current sensing circuit op-amp and set the inverter.invertingAmp variable (control parameter) to:

  • 1 — If the current sensing circuit uses a non-inverting op-amp.

  • –1 — If the current sensing circuit uses an inverting op-amp.

For more information about setting a control parameter, see Estimate Control Gains from Motor Parameters.

Test Readability of Unipolar and Bipolar Signals

Check if the measurement circuit is designed to read unipolar and bipolar signals.

Check if the inverter.ISenseVoltPerAmp variable (control parameter) is set correctly according to the hardware specification. For more information about this parameter, see Estimate Control Gains from Motor Parameters.

DC signal measurement circuits are usually unipolar. For example, BoostXL-DRV8305 has a DC voltage measurement circuit that converts the voltage range of 0 – 44.3 V to 0 – 3.3 V at the ADC. Voltage ADCs cannot measure negative voltages.

AC signal measurement circuits are usually bipolar. For example, BoostXL-DRV8305 has an AC current measurement circuit that converts the current range of –23.57 to +23.57 A to 0 – 3.3 V at the ADC with an offset of 1.65V.

Check ADC Offset and Gain computation

Verify the ADC offset values before deploying and executing the code on the target hardware. For more information, see Current Sensor ADC Offset and Position Sensor Calibration.

Check the accuracy of the computed gain for conversion of the ADC counts to signal value in the real world as described in the previous section.

Check ADC Resolution

Check the ADC resolution to determine the minimum value of the signal that it can measure. For example, a 3.3 V 12-Bit ADC that can measure ±16.5 A has a resolution of 0.1 Volts/Ampere. The minimum current that the ADC can measure (excluding EMI/EMC and noise) is approximately 8 mA.

Determine the minimum measurable current by the ADC. Verify that this current is greater than the ADC signal-to-noise ratio, tolerance, and errors. Ensure that you simulate and check the model before deploying it to the target hardware.

Low ADC resolution can result in difficulties when implementing sensorless algorithms to control motors that consume very small currents (for example, 50 mA AC) on no load. In addition, EMI/EMC and noise affects ADC measurements. It is a good practice to simulate the model and verify if the ADC resolution is appropriate. Increase the gain of the sensor amplifier on the hardware to increase the ADC resolution.