Imagine the following Adc setup: AdcGroupA contains three AdcChannels AdcCh1, AdcCh2, AdcCh3 as shown in the Adc configuration (arxml) below:
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>AdcGroupA</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/Adc/AdcConfigSet/AdcHwUnit/AdcGroup</DEFINITION-REF>
<PARAMETER-VALUES>
...
</PARAMETER-VALUES>
<REFERENCE-VALUES>
<ECUC-REFERENCE-VALUE>
<DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/Adc/AdcConfigSet/AdcHwUnit/AdcGroup/AdcGroupDefinition</DEFINITION-REF>
<VALUE-REF DEST="ECUC-CONTAINER-VALUE">/ActiveEcuC/Adc/AdcConfigSet/AdcHwUnit_ADC0/AdcCh1</VALUE-REF>
</ECUC-REFERENCE-VALUE>
<ECUC-REFERENCE-VALUE>
<DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/Adc/AdcConfigSet/AdcHwUnit/AdcGroup/AdcGroupDefinition</DEFINITION-REF>
<VALUE-REF DEST="ECUC-CONTAINER-VALUE">/ActiveEcuC/Adc/AdcConfigSet/AdcHwUnit_ADC0/AdcCh3</VALUE-REF>
</ECUC-REFERENCE-VALUE>
<ECUC-REFERENCE-VALUE>
<DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/Adc/AdcConfigSet/AdcHwUnit/AdcGroup/AdcGroupDefinition</DEFINITION-REF>
<VALUE-REF DEST="ECUC-CONTAINER-VALUE">/ActiveEcuC/Adc/AdcConfigSet/AdcHwUnit_ADC0/AdcCh2</VALUE-REF>
</ECUC-REFERENCE-VALUE>
</REFERENCE-VALUES>
<SUB-CONTAINERS>
</SUB-CONTAINERS>
</ECUC-CONTAINER-VALUE>
In a Complex Driver or IoHwAb the AdcGroup can then be used as follows:
Adc_ValueGroupType AdcGroupAReadDataBuffer[SIZE_OF_GROUPA];
Adc_StartGroupConversion( AdcGroupA );
…
Std_ReturnType Adc_ReadGroup( AdcGroupA, &AdcGroupAReadDataBuffer[0] );
…
valueAdcCh1 = AdcGroupAReadDataBuffer[IDX_GROUPA_CH1];
valueAdcCh2 = AdcGroupAReadDataBuffer[IDX_GROUPA_CH2];
valueAdcCh3 = AdcGroupAReadDataBuffer[IDX_GROUPA_CH3];
AUTOSAR Adc specification says for Adc_ReadGroup [SWS_Adc_00369] “The group channel values are stored in ascending channel number order.” But which “channel number” is meant here? If I have a look at the behavior of some Adc driver it is obviously not related to the AdcChannel.AdcChannelId. Therefore, I assume that the order is related to the list of references to AdcChannels in the AdcGroup. BUT: this list has no index or ID! See arxml snippet above. So, the order/sorting is not determined by anything. Or is it? Seems like in my toolchain the order is defined by the sequence how you add the AdcChannels to the AdcGroup:
#define IDX_GROUPA_CH1 (0u)
#define IDX_GROUPA_CH2 (2u)
#define IDX_GROUPA_CH3 (1u)
The resulting question is: How do I find out what index is used for an AdcChannel within an AdcGroup (data buffer)? Is there any generated define for this (which would replace the IDX_GROUPA_CH? In the example above)? And please don’t tell me: “have a look at the arxml file” or “As you have configured it”. Keep in mind that the developers of the C-code often have no access or license to the Configuration-Tool-Chain.