HSE MonotonicCnt API stuck in while loop

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

HSE MonotonicCnt API stuck in while loop

4,652 次查看
VincentYALin
Contributor II

We are using S32K312 HSE API MonotonicCnt , we found out there are a possibility that function might stuck in Hse_Ip_ServiceRequest’s while loop.

 

MonotonicCnt_Read -> HSE_Send -> Hse_Ip_ServiceRequest

 

while ((FALSE == Mu_Ip_IsResponseReady(Hse_Ip_apMuBase[u8MuInstance], u8MuChannel)) && (u32ElapsedTicks < u32TimeoutTicks))

{

/* Update the elapsed ticks, current ticks will be updated too by the OsIf function */

u32ElapsedTicks += OsIf_GetElapsed(&u32CurrentTicks, (OsIf_CounterType)HSE_IP_TIMEOUT_OSIF_COUNTER_TYPE);

}

We are calling MonotonicCnt_Read , MonotonicCnt_Config , MonotonicCnt_Write about once every few seconds , is there anyway to avoid it ?

 

 

0 项奖励
回复
10 回复数

4,015 次查看
StephenYeh
Contributor III

Hi Dan,

We try to use MONOTONIC_CNT for our application.

We find this data which could not access every 2 seconds. Does this the limitation and control by HSE-FW due to protect the HSE data-flash Read/Write cycle?

0 项奖励
回复

4,592 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hello @VincentYALin,

Did the HSE FW version you are using support for config monotomic counter?

Did you pass into the correct parameters when call HSE functions?

Best regards,

Dan

0 项奖励
回复

4,080 次查看
VincentYALin
Contributor II

Hi Dan, 

I was trying to reply to your question but NXP website has gone maintain for few days 

Did the HSE FW version you are using support for config monotomic counter?

from the function 

GetAttr( HSE_FW_VERSION_ATTR_ID, sizeof(hseAttrFwVersion_t), &pHseFwVersion );

[Cpt_M] pHseFwVersion.socTypeId 13

[Cpt_M] pHseFwVersion.fwTypeId 0

[Cpt_M] pHseFwVersion.majorVersion 2

[Cpt_M] pHseFwVersion.minorVersion 6

[Cpt_M] pHseFwVersion.patchVersion 0

HSE_DEMOAPP_S32K3XX_0_2_6_0 have example about monotonic operation. so we are assuming fw does support it. 

Did you pass into the correct parameters when call HSE functions?

Yes , it's stability issue, it works sometimes but it stuck in while loop occassionally.

 

from the installer folder nxp > HSE_DEMOAPP_S32K3XX_0_2_6_0 > demo_security_installer_scripts, we found some scripts relate to the monotonic functions that has delay time of 4s to 5s. we had experience this stuck in while loop issue while we doing stress testing on monotonic counter with intervals around 4s, Would you share with us about why do you set 4s-5s as delay time in the example scripts? 

following are from monotonic_counter.cmm file

SUB_FILL_DATA:
DIALOG.END
BREAK
v monotonic_cnt_select = MONOTONIC_CNT_INCREMENT
v gProgramAttributes = MONOTONIC_COUNTER
v gRunExampleTest = 1
GO
wait 4s
break
v allTestExecuted = 1
v monotonic_cnt_select = MONOTONIC_CNT_NOT_SELECTED
v gProgramAttributes = NO_ATTRIBUTE_PROGRAMMED v gRunExampleTest = 0
v MonotonicCnt IncrementValue = 0
GO
do monotonic_counter.cmm

0 项奖励
回复

4,628 次查看
VincentYALin
Contributor II

Any NXP tech support can help ?

0 项奖励
回复

4,007 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hello @VincentYALin,

The HSE FW team confirmed that: there is no need for such larger delay. As it involves, flash write operation, they added sufficient delay to ensure smooth operation. You can reduce the delay as per your convenience.

Best regards,

Dan

0 项奖励
回复

3,967 次查看
VincentYALin
Contributor II
so what's next step ? I might still stuck in the while loop
0 项奖励
回复

3,964 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hi @VincentYALin,

From my point of view, you can modify "wait 4s" to "wait 2s or 1s" to follow your expectation.

Best regards,

Dan

0 项奖励
回复

3,941 次查看
VincentYALin
Contributor II

It sound like we have an misunderstanding on what I have trouble with . 

What I have trouble with is that , there is a possibility S32K312 MCU might stuck in MonotonicCnt_Read with HSE fw version 2.6

What I want from NXP is to give me a reason why this happen / How do I avoid it ?

is this a known issue  ? if not have you try to replicate it ?

Thank you 

0 项奖励
回复

3,611 次查看
DanNguyenDuy
NXP Employee
NXP Employee

Hello @VincentYALin,

Could you send me your project or a demo example? I'm going to check this from my side.

Best regards,

Dan

0 项奖励
回复

3,573 次查看
VincentYALin
Contributor II

this is basically how we reproduce it 

MonotonicCnt_Config(1, 64);

int count = 0; 

uint64 hse_counter = 0 ;

while(1){

MonotonicCnt_Read(1,&hse_counter ); 

count++;

print("count  = %d",count );

sleep(1);

}

 

0 项奖励
回复