cancel
Showing results for 
Search instead for 
Did you mean: 

Read multiple ADC chanels with regular conversion manager (RCM)

lgran.1
Associate

Hi,

I would like to know how to (if possible) read multiple chanels for the same ADC with one request using the RCM. Now I am only requesting one read at a time. I am using the Nucleo-stm32g431RB with x-nucleo-ihm08m1 and 5.Y.4

Thanks in advance,

L

1 REPLY 1
Muthanna
Associate III

Hi, 

I am looking for a solution for the same question.
I would like to read multiple channels using a single request.

I did this workaround using a variable "adcSelect" to alternate between the two handles.

switch( RCM_GetUserConvState())
{
case RCM_USERCONV_IDLE :
if(adcSelect == FES_SELECTED)
RCM_RequestUserConv(FEShandle);
else if(adcSelect == TRTL_SELECTED)
RCM_RequestUserConv(TRTLhandle);
else //error
{}
break;
 
case RCM_USERCONV_REQUESTED :
break;
 
case RCM_USERCONV_EOC :
switch(adcSelect)
{
case FES_SELECTED :
FES_Datum = RCM_GetUserConv();
adcSelect = TRTL_SELECTED;
break;
 
case TRTL_SELECTED :
TRTL_Datum = RCM_GetUserConv();
adcSelect = FES_SELECTED;
break;
 
default : //error
break;
}
break;
}


It worked well until I saw the code crash in an infinite while loop waiting for ADC EOC in the regular_conversion_manager.c file

/* Wait EOC */
while ( LL_ADC_IsActiveFlag_EOC( RCM_handle_array[handle]->regADC ) == RESET )
{
}

Weirdly it happens when there is a separate Timer Input Capture Interrupt Triggered "only" when I use multiple RCM registrations.
I want to avoid all this.
Looking for help.