Hi,
I set two conversion groups of ADC0 using the RTM4.0.2. One group contains 8 channels and the other contains 7 channels. Both of them are triggered by software.
After I start the conversion of group0 by calling ADC_StartGroupConversion(&adc_pal_1_instance, 0 ), I store the adc results to related parameters. Then I start the second group by calling ADC_StartGroupConversion(&adc_pal_1_instance, 1 ).However, I can not get the updated result inside the second group buffer.
Putting a manaul delay like" while(cnt<10000){cnt++;}" before starting the second group, it comes out the updated result of second groups.
Here comes the question: how long should it wait after starting the first group of Is these a way to check whether is finished or not of the first group.
Code:
status_t status;
u16 cnt=0;
/*acquire values of ADC0*/
/*adc_pal0_Results00[high]=channel[high]*/
status = ADC_StartGroupConversion(&adc_pal_1_instance, 0 );//groupIdx
DEV_ASSERT(status == STATUS_SUCCESS);
g_raw_KL15_adc =adc_pal_1_results0[0];
g_raw_BAT24V_adc =adc_pal_1_results0[1];
g_raw_TCV_ST_adc =adc_pal_1_results0[2];
g_raw_ERRL1_ST_adc =adc_pal_1_results0[3];
g_raw_ERRL2_ST_adc =adc_pal_1_results0[4];
g_raw_TCV_UB_ST_adc =adc_pal_1_results0[5];
g_raw_TCV_Sensor_adc =adc_pal_1_results0[6];
g_raw_TCV_LOW_ST_adc =adc_pal_1_results0[7];
//status = ADC_StopGroupConversion(&adc_pal_1_instance, 0 ,1 );//groupIdx
while(cnt<10000)
{
cnt++;
}
status = ADC_StartGroupConversion(&adc_pal_1_instance, 1 );
DEV_ASSERT(status == STATUS_SUCCESS);
g_raw_ABS_GND_adc =adc_pal_1_results1[0];
g_raw_RA_UB_adc =adc_pal_1_results1[1];
g_raw_DBR_ST_adc =adc_pal_1_results1[2];
g_raw_BRKL1_ST_adc =adc_pal_1_results1[3];
g_raw_EMAS_ST_adc =adc_pal_1_results1[4];
g_raw_WL1_ST_adc =adc_pal_1_results1[5];
g_raw_ABS_ST_adc =adc_pal_1_results1[6];
//status = ADC_StopGroupConversion(&adc_pal_1_instance, 1 ,1 );//groupIdx
//acquire values of ADC1
status = ADC_StartGroupConversion(&adc_pal_2_instance,0 );
DEV_ASSERT(status == STATUS_SUCCESS);
g_raw_XA_UB_adc =adc_pal_2_results0[0];
g_raw_FA_UB_adc =adc_pal_2_results0[1];
g_raw_BWG_UB_adc =adc_pal_2_results0[2];
Solved! Go to Solution.
Hello @thulzh,
This is expected as the ADC_StartGroupConversion() function does not block the execution.
The STATUS_SUCCESS means the group conversion has been triggered but not finished.
You can either
1. Read the status of the subsequent ADC_StartGroupConversion() function until it returns STATUS_SUCCESS and the second group has been successfully triggered or
2. use callbacks or
3. measure the duration of the first group conversion. A single conversion time can be calculated, Section 44.5.4.5 Sample time and total conversion time, (RM. rev.13).
Regards,
Daniel
Hello @thulzh,
This is expected as the ADC_StartGroupConversion() function does not block the execution.
The STATUS_SUCCESS means the group conversion has been triggered but not finished.
You can either
1. Read the status of the subsequent ADC_StartGroupConversion() function until it returns STATUS_SUCCESS and the second group has been successfully triggered or
2. use callbacks or
3. measure the duration of the first group conversion. A single conversion time can be calculated, Section 44.5.4.5 Sample time and total conversion time, (RM. rev.13).
Regards,
Daniel