主要内容

Troubleshooting ADC Configuration and Runtime Issues

For hardware-specific limitations and constraints of MCAL modules, refer to the MCAL user manual included in the MCAL package:

<MCALPath>\X2x\U2Ax\common_family\docs\user_manual\U2Ax.

Channel Count Mismatch Between ADC Block and CDF

Issue

If the number of channels configured in the Simulink ADC block exceeds the number of channels configured in the corresponding ADC Group in the CDF, code generation fails or the model reports configuration errors.

Solution

Ensure that the number of channels specified in the ADC block matches the channel count defined in the ADC Group configuration (CDF).

Update either the block parameters or the ADC Group definition so that both remain consistent.

Trigger Mode Mismatch Between Block and CDF

Issue

The Trigger mode in the ADC block refers to a software trigger. If the ADC Group is configured for hardware trigger in the CDF (Configuration Description File) and the block is configured with Trigger Only or Trigger & Read, the configuration is invalid and results in errors.

Solution

Align the trigger configuration between the Simulink block and the ADC Group in the CDF:

  • For hardware-triggered ADC Groups, use Read results only in the block.

  • For software-triggered ADC Groups, use Trigger Only or Trigger & Read, depending on the intended workflow.

Invalid Output Data Type Selection

Issue

The target supports only uint16 as the data type for converted ADC values. Selecting any other output data type in the ADC block results in build-time errors or invalid code generation.

Solution

Set the Output data type parameter of the ADC block to uint16.

Do not use other integer or floating-point data types for ADC conversion results.

Results Not Available Due to ADC Idle State

Issue

In interrupt-based workflows, if ADC results are read inside the ISR, the ADC status transitions to ADC_IDLE. Any subsequent Read results only block executed later in the model step function may return no data because the ADC is already idle.

Solution

Read ADC results only once per conversion cycle.

If results are read inside the ISR, do not attempt to read them again in the model step function. Design the model so that the consumer logic receives the data captured in the ISR context.