Hello NXP S32K3 team:
I am using ADC1 of S32K312 for both SW & HW trigger,:
Question:
Sometimes when code runs in Adc_StartGroupConversion ---> Adc_UpdateStatusStartConversion ---> Adc_IpwStartNormalConversion ---> Adc_IpwStartNormalConversionAdcSar ---> Adc_Sar_Ip_SetConversionMode,
Assert will fail at DevAssert(((*MSRAddr) & ADC_MSR_ADCSTATUS_MASK) == ADC_MSR_ADCSTATUS(ADC_SAR_IP_MSR_ADCSTATUS_IDLE)); in Adc_Sar_Ip_SetConversionMode in Adc_Sar_Ip.c, and MCU dead.
It seems that ADC1 FSM is not IDLE and is triggered by HW(I am not very sure), I there any method to avoid this kind of situation (MSR[ADCSTATUS] is set by HW trigger when I try to start normal software conversions? Since when software conversion is trigger each 10ms, HW trigger situation is not sure, may be occurs when triiger SW, may be not occurs…)
My configuration as follows:
a)config ADC1 with several channels,
b)
one channel is config as hardware trigger as follow:
external 1Khz PWM wave ---> TRGMUX_IN1 (PORT) ---> TRGMUX(output ADC1 hardware trigger) ---> rising edge triggerADC1 inject group conversion
other channels config as software trigger software normal group / software one shot each 10ms
c)Pseudocode as follows
void HwTrg_Init(void)
{
Adc_EnableGroupNotification(Adc1GroupHwTrg);
Adc_EnableHardwareTrigger(Adc1GroupHwTrg);
}
Void HwTrg_MainFunction(void)
{
Uint16 temp = ResultBuffer;
// other actions…
}
Void HwTrg_Adc1EndNotification(void)
{
Adc_ReadGroup(Adc1GroupHwTrg, &ResultBuffer);
}
Void SwTrg_MainFunction(void)
{
If (Adc_GetGroupStatus(Adc1GroupSwTrg) != ADC_BUSY)
{
Adc_StartGroupConversion(Adc1GroupSwTrg);
}
}
I hope you can understand my question.
Thank you very much.