S32K312 ADC HW & SW trigger combination

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K312 ADC HW & SW trigger combination

1,211件の閲覧回数
MarkChen1
Contributor I

 

 

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.

0 件の賞賛
返信
2 返答(返信)

1,158件の閲覧回数
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

The following Knowledge Base Post could help you as reference:

https://community.nxp.com/t5/S32K-Knowledge-Base/RTD400-LLD-K344-ADC-SW-HW-trigger/ta-p/1966179

Hope it helps you.

Have a nice day!

0 件の賞賛
返信

1,137件の閲覧回数
MarkChen1
Contributor I
Thank you Leo for your suggestion.

Actually I am config ADC SW and HW trigger successfully in same AdcHwUnit with SW32K3_S32M27x_RTD_R21-11_5.0.0 & EB

Have you ever encounter any issue regarding when both SW periodic trigger and EXT TRGMUX HW trigger enabled, SW trigger failed when check Main Status Register[MSR] [ADCSTATUS]



 DevAssert(((*MSRAddr) & ADC_MSR_ADCSTATUS_MASK) == ADC_MSR_ADCSTATUS(ADC_SAR_IP_MSR_ADCSTATUS_IDLE));
0 件の賞賛
返信